bfg-common 1.3.357 → 1.3.359
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/atoms/TheIcon2.vue +0 -173
- package/components/atoms/collapse/CollapseNavItem.vue +3 -8
- package/components/atoms/collapse/lib/models/interfaces.ts +0 -1
- package/components/atoms/switch/Switch.vue +111 -111
- package/components/atoms/table/compact/Compact.vue +526 -526
- package/components/common/adapterManager/ui/table/Header.vue +93 -93
- package/components/common/adapterManager/ui/table/Table.vue +162 -162
- package/components/common/context/Context.vue +99 -99
- package/components/common/lib/config/states.ts +126 -126
- package/components/common/resource/progressBlock/ProgressBlock.vue +142 -142
- package/components/common/vm/actions/add/Add.vue +602 -602
- package/components/common/vm/actions/clone/Clone.vue +518 -518
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +273 -273
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +697 -697
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +256 -254
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +1 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +1 -1
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +458 -454
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +304 -299
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +167 -165
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +82 -78
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +32 -27
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/reservation/Reservation.vue +2 -3
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +182 -178
- package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +164 -164
- package/components/common/vm/actions/common/select/name/Name.vue +235 -235
- package/components/common/vm/actions/common/select/storage/Storage.vue +198 -198
- package/components/common/vm/actions/editSettings/EditSettings.vue +316 -313
- package/components/common/weekSelect/lib/config/options.ts +10 -10
- package/components/common/wizards/datastore/add/Add.vue +436 -436
- package/components/common/wizards/datastore/add/lib/config/stepItems.ts +191 -191
- package/components/common/wizards/datastore/add/lib/models/interfaces.ts +38 -38
- package/components/common/wizards/datastore/add/lib/utils.ts +70 -70
- package/components/common/wizards/datastore/add/local/createName/CreateName.vue +160 -160
- package/components/common/wizards/datastore/add/nfs/Nfs.vue +112 -112
- package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +104 -104
- package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -62
- package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -53
- package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +86 -86
- package/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails.ts +184 -184
- package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +459 -459
- package/components/common/wizards/datastore/add/types/Types.vue +80 -80
- package/components/common/wizards/datastore/add/types/lib/config/typeOptions.ts +49 -49
- package/composables/useAppVersion.ts +21 -21
- package/composables/useEnvLanguage.ts +20 -20
- package/lib/utils/sendTask.ts +72 -72
- package/minify.js +146 -146
- package/package.json +1 -1
- package/public/spice-console/application/codec.js +257 -257
- package/public/spice-console/lib/rasterEngine.js +907 -907
- package/public/spice-console/network/spicechannel.js +369 -369
- package/store/main/lib/interfaces.ts +9 -9
- package/store/tasks/actions.ts +133 -133
- package/store/tasks/getters.ts +25 -25
- package/store/tasks/lib/models/interfaces.ts +18 -18
- package/store/tasks/mutations.ts +58 -58
- package/store/tasks/state.ts +16 -16
|
@@ -1125,179 +1125,6 @@
|
|
|
1125
1125
|
</g>
|
|
1126
1126
|
</svg>
|
|
1127
1127
|
</template>
|
|
1128
|
-
<template v-else-if="props.name === 'host'">
|
|
1129
|
-
<svg
|
|
1130
|
-
width="24"
|
|
1131
|
-
height="20"
|
|
1132
|
-
viewBox="0 0 24 20"
|
|
1133
|
-
fill="none"
|
|
1134
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1135
|
-
class="host-icon"
|
|
1136
|
-
>
|
|
1137
|
-
<path
|
|
1138
|
-
d="M5.25 3.25H2.5C1.94772 3.25 1.5 3.69772 1.5 4.25V15.75C1.5 16.3023 1.94772 16.75 2.5 16.75H5.25"
|
|
1139
|
-
stroke="currentColor"
|
|
1140
|
-
stroke-width="1.2"
|
|
1141
|
-
stroke-linecap="round"
|
|
1142
|
-
/>
|
|
1143
|
-
<path
|
|
1144
|
-
d="M18.75 3.25H21.5C22.0523 3.25 22.5 3.69772 22.5 4.25V15.75C22.5 16.3023 22.0523 16.75 21.5 16.75H18.75"
|
|
1145
|
-
stroke="currentColor"
|
|
1146
|
-
stroke-width="1.2"
|
|
1147
|
-
stroke-linecap="round"
|
|
1148
|
-
/>
|
|
1149
|
-
<rect
|
|
1150
|
-
x="7.5"
|
|
1151
|
-
y="1"
|
|
1152
|
-
width="9"
|
|
1153
|
-
height="18"
|
|
1154
|
-
rx="1"
|
|
1155
|
-
stroke="currentColor"
|
|
1156
|
-
stroke-width="1.2"
|
|
1157
|
-
/>
|
|
1158
|
-
<circle cx="12" cy="14.5" r="1.5" stroke="currentColor" />
|
|
1159
|
-
<path
|
|
1160
|
-
d="M18.75 13.75C19.3713 13.75 19.875 13.2463 19.875 12.625C19.875 12.0037 19.3713 11.5 18.75 11.5"
|
|
1161
|
-
stroke="currentColor"
|
|
1162
|
-
stroke-linecap="round"
|
|
1163
|
-
/>
|
|
1164
|
-
<path
|
|
1165
|
-
d="M5.25 13.75C4.62868 13.75 4.125 13.2463 4.125 12.625C4.125 12.0037 4.62868 11.5 5.25 11.5"
|
|
1166
|
-
stroke="currentColor"
|
|
1167
|
-
stroke-linecap="round"
|
|
1168
|
-
/>
|
|
1169
|
-
<path d="M10.5 4H13.5" stroke="currentColor" stroke-linecap="round" />
|
|
1170
|
-
<path d="M10.5 7H13.5" stroke="currentColor" stroke-linecap="round" />
|
|
1171
|
-
<path d="M4.125 6.25H5.25" stroke="currentColor" stroke-linecap="round" />
|
|
1172
|
-
<path
|
|
1173
|
-
d="M18.75 6.25H19.875"
|
|
1174
|
-
stroke="currentColor"
|
|
1175
|
-
stroke-linecap="round"
|
|
1176
|
-
/>
|
|
1177
|
-
</svg>
|
|
1178
|
-
</template>
|
|
1179
|
-
<template v-else-if="props.name === 'vm'">
|
|
1180
|
-
<svg
|
|
1181
|
-
width="24"
|
|
1182
|
-
height="22"
|
|
1183
|
-
viewBox="0 0 24 22"
|
|
1184
|
-
fill="none"
|
|
1185
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1186
|
-
class="vm-icon"
|
|
1187
|
-
>
|
|
1188
|
-
<path
|
|
1189
|
-
d="M12.0537 12.5V18.0381C12.0537 18.3239 12.2062 18.588 12.4537 18.7309L16.8499 21.2691C17.0974 21.412 17.4023 21.412 17.6499 21.2691L22.046 18.7309C22.2935 18.588 22.446 18.3239 22.446 18.0381V12.9619C22.446 12.6761 22.2935 12.412 22.046 12.2691L17.6499 9.73094C17.4023 9.58803 17.0974 9.58803 16.8499 9.73094L12.0537 12.5ZM12.0537 12.5L17.2499 15.5M17.2499 15.5V21.3184M17.2499 15.5L22.3299 12.567"
|
|
1190
|
-
stroke="currentColor"
|
|
1191
|
-
stroke-width="1.2"
|
|
1192
|
-
stroke-linejoin="round"
|
|
1193
|
-
/>
|
|
1194
|
-
<path
|
|
1195
|
-
d="M6.75572 20.75V15.875M1.77427 12.624L6.57026 15.3929V15.3929C6.68503 15.4592 6.82642 15.4592 6.94118 15.3929L11.795 12.5906M1.55957 12.9619V18.0381C1.55957 18.3239 1.71205 18.588 1.95957 18.7309L6.35572 21.2691C6.60324 21.412 6.9082 21.412 7.15572 21.2691L11.5519 18.7309C11.7994 18.588 11.9519 18.3239 11.9519 18.0381V12.9619C11.9519 12.6761 11.7994 12.412 11.5519 12.2691L7.15572 9.73094C6.9082 9.58803 6.60324 9.58803 6.35572 9.73094L1.95957 12.2691C1.71205 12.412 1.55957 12.6761 1.55957 12.9619Z"
|
|
1196
|
-
stroke="currentColor"
|
|
1197
|
-
stroke-width="1.2"
|
|
1198
|
-
stroke-linejoin="round"
|
|
1199
|
-
/>
|
|
1200
|
-
<path
|
|
1201
|
-
d="M12.0555 12.5L16.8517 9.73094C17.0992 9.58803 17.2517 9.32393 17.2517 9.03812V3.96188C17.2517 3.67607 17.0992 3.41197 16.8517 3.26906L12.4555 0.73094C12.208 0.588034 11.903 0.588034 11.6555 0.73094L7.25937 3.26906C7.01185 3.41197 6.85938 3.67607 6.85938 3.96188V9.03812C6.85938 9.32393 7.01185 9.58803 7.25938 9.73094L12.0555 12.5ZM12.0555 12.5V6.5M12.0555 6.5L7.01004 3.58699M12.0555 6.5L17.083 3.5974"
|
|
1202
|
-
stroke="currentColor"
|
|
1203
|
-
stroke-width="1.2"
|
|
1204
|
-
stroke-linejoin="round"
|
|
1205
|
-
/>
|
|
1206
|
-
</svg>
|
|
1207
|
-
</template>
|
|
1208
|
-
<template v-else-if="props.name === 'datastore'">
|
|
1209
|
-
<svg
|
|
1210
|
-
width="20"
|
|
1211
|
-
height="24"
|
|
1212
|
-
viewBox="0 0 20 24"
|
|
1213
|
-
fill="none"
|
|
1214
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1215
|
-
class="datastore-icon"
|
|
1216
|
-
>
|
|
1217
|
-
<path
|
|
1218
|
-
d="M19 3.75C19 4.99264 14.9706 6 10 6C5.02944 6 1 4.99264 1 3.75M19 3.75C19 2.50736 14.9706 1.5 10 1.5C5.02944 1.5 1 2.50736 1 3.75M19 3.75V20.25C19 21.4926 14.9706 22.5 10 22.5C5.02944 22.5 1 21.4926 1 20.25V3.75M19 9.25488C19 10.4975 14.9706 11.5049 10 11.5049C5.02944 11.5049 1 10.4975 1 9.25488M19 14.7598C19 16.0024 14.9706 17.0098 10 17.0098C5.02944 17.0098 1 16.0024 1 14.7598"
|
|
1219
|
-
stroke="currentColor"
|
|
1220
|
-
stroke-width="1.2"
|
|
1221
|
-
/>
|
|
1222
|
-
<path
|
|
1223
|
-
d="M4 8.17529H4.001"
|
|
1224
|
-
stroke="currentColor"
|
|
1225
|
-
stroke-width="1.2"
|
|
1226
|
-
stroke-linecap="round"
|
|
1227
|
-
/>
|
|
1228
|
-
<path
|
|
1229
|
-
d="M4 13.6802H4.001"
|
|
1230
|
-
stroke="currentColor"
|
|
1231
|
-
stroke-width="1.2"
|
|
1232
|
-
stroke-linecap="round"
|
|
1233
|
-
/>
|
|
1234
|
-
<path
|
|
1235
|
-
d="M4 19.1997H4.001"
|
|
1236
|
-
stroke="currentColor"
|
|
1237
|
-
stroke-width="1.2"
|
|
1238
|
-
stroke-linecap="round"
|
|
1239
|
-
/>
|
|
1240
|
-
<path
|
|
1241
|
-
d="M7 8.625H7.001"
|
|
1242
|
-
stroke="currentColor"
|
|
1243
|
-
stroke-width="1.2"
|
|
1244
|
-
stroke-linecap="round"
|
|
1245
|
-
/>
|
|
1246
|
-
<path
|
|
1247
|
-
d="M7 14.1299H7.001"
|
|
1248
|
-
stroke="currentColor"
|
|
1249
|
-
stroke-width="1.2"
|
|
1250
|
-
stroke-linecap="round"
|
|
1251
|
-
/>
|
|
1252
|
-
<path
|
|
1253
|
-
d="M7 19.6348H7.001"
|
|
1254
|
-
stroke="currentColor"
|
|
1255
|
-
stroke-width="1.2"
|
|
1256
|
-
stroke-linecap="round"
|
|
1257
|
-
/>
|
|
1258
|
-
</svg>
|
|
1259
|
-
</template>
|
|
1260
|
-
<template v-else-if="props.name === 'network'">
|
|
1261
|
-
<svg
|
|
1262
|
-
width="24"
|
|
1263
|
-
height="24"
|
|
1264
|
-
viewBox="0 0 24 24"
|
|
1265
|
-
fill="none"
|
|
1266
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1267
|
-
class="network-icon"
|
|
1268
|
-
>
|
|
1269
|
-
<path
|
|
1270
|
-
d="M14.625 12.75C14.625 13.7083 14.2983 14.5902 13.7501 15.2905C12.995 16.2551 11.8199 16.875 10.5 16.875C9.44523 16.875 8.48292 16.4791 7.75355 15.8278C6.90759 15.0724 6.375 13.9734 6.375 12.75C6.375 10.4718 8.22183 8.625 10.5 8.625C11.4157 8.625 12.2618 8.92339 12.9462 9.42824C13.9645 10.1794 14.625 11.3876 14.625 12.75Z"
|
|
1271
|
-
stroke="currentColor"
|
|
1272
|
-
stroke-width="1.2"
|
|
1273
|
-
/>
|
|
1274
|
-
<path
|
|
1275
|
-
d="M22.5 19.5C22.5 21.1569 21.1569 22.5 19.5 22.5C17.8431 22.5 16.5 21.1569 16.5 19.5C16.5 18.8196 16.7265 18.1921 17.1082 17.6888C17.6561 16.9665 18.5236 16.5 19.5 16.5C21.1569 16.5 22.5 17.8431 22.5 19.5Z"
|
|
1276
|
-
stroke="currentColor"
|
|
1277
|
-
stroke-width="1.2"
|
|
1278
|
-
/>
|
|
1279
|
-
<path
|
|
1280
|
-
d="M4.5 6C4.5 6.82843 3.82843 7.5 3 7.5C2.17157 7.5 1.5 6.82843 1.5 6C1.5 5.17157 2.17157 4.5 3 4.5C3.82843 4.5 4.5 5.17157 4.5 6Z"
|
|
1281
|
-
stroke="currentColor"
|
|
1282
|
-
stroke-width="1.2"
|
|
1283
|
-
/>
|
|
1284
|
-
<path
|
|
1285
|
-
d="M19.5 3.75C19.5 4.99264 18.4926 6 17.25 6C16.7541 6 16.2957 5.8396 15.9239 5.56785C15.3638 5.15859 15 4.49678 15 3.75C15 2.50736 16.0074 1.5 17.25 1.5C18.4926 1.5 19.5 2.50736 19.5 3.75Z"
|
|
1286
|
-
stroke="currentColor"
|
|
1287
|
-
stroke-width="1.2"
|
|
1288
|
-
/>
|
|
1289
|
-
<path
|
|
1290
|
-
d="M6 20.25C6 21.4926 4.99264 22.5 3.75 22.5C2.50736 22.5 1.5 21.4926 1.5 20.25C1.5 19.0074 2.50736 18 3.75 18C4.32627 18 4.85193 18.2166 5.25 18.5729C5.71031 18.9849 6 19.5836 6 20.25Z"
|
|
1291
|
-
stroke="currentColor"
|
|
1292
|
-
stroke-width="1.2"
|
|
1293
|
-
/>
|
|
1294
|
-
<path
|
|
1295
|
-
d="M4.07031 7.05141L7.42597 9.99961M5.25024 18.5729L7.7538 15.8278M17.1085 17.6888L13.7503 15.2905M15.9241 5.56787L12.9464 9.42826"
|
|
1296
|
-
stroke="currentColor"
|
|
1297
|
-
stroke-width="1.2"
|
|
1298
|
-
/>
|
|
1299
|
-
</svg>
|
|
1300
|
-
</template>
|
|
1301
1128
|
</template>
|
|
1302
1129
|
|
|
1303
1130
|
<script setup lang="ts">
|
|
@@ -16,12 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
]"
|
|
18
18
|
>
|
|
19
|
-
<atoms-the-icon2
|
|
20
|
-
v-if="props.item.iconName"
|
|
21
|
-
:name="props.item.iconName"
|
|
22
|
-
/>
|
|
23
19
|
<span
|
|
24
|
-
v-
|
|
20
|
+
v-if="props.item.iconClassName"
|
|
25
21
|
:class="['icon', props.item.iconClassName]"
|
|
26
22
|
></span>
|
|
27
23
|
<span v-else>{{ props.item.text }}</span>
|
|
@@ -55,9 +51,8 @@
|
|
|
55
51
|
]"
|
|
56
52
|
@click="change(props.item.value)"
|
|
57
53
|
>
|
|
58
|
-
<atoms-the-icon2 v-if="props.item.iconName" :name="props.item.iconName" />
|
|
59
54
|
<span
|
|
60
|
-
v-
|
|
55
|
+
v-if="props.item.iconClassName"
|
|
61
56
|
:class="['icon', props.item.iconClassName]"
|
|
62
57
|
></span>
|
|
63
58
|
<span v-else>{{ props.item.text }}</span>
|
|
@@ -66,7 +61,7 @@
|
|
|
66
61
|
</template>
|
|
67
62
|
|
|
68
63
|
<script setup lang="ts">
|
|
69
|
-
import
|
|
64
|
+
import { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
|
|
70
65
|
|
|
71
66
|
const props = defineProps<{
|
|
72
67
|
item: UI_I_CollapseNavItem
|
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex-align-center">
|
|
3
|
-
<div class="switch-body">
|
|
4
|
-
<input :id="props.testId" v-model="value" type="checkbox" />
|
|
5
|
-
<label class="switch-label" :for="props.testId"></label>
|
|
6
|
-
</div>
|
|
7
|
-
<label :for="props.testId"><slot></slot></label>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script setup lang="ts">
|
|
12
|
-
const props = withDefaults(
|
|
13
|
-
defineProps<{
|
|
14
|
-
modelValue: boolean
|
|
15
|
-
testId?: string
|
|
16
|
-
}>(),
|
|
17
|
-
{ testId: 'ui-switch' }
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
const emits = defineEmits<{
|
|
21
|
-
(event: 'update:model-value', value: boolean): void
|
|
22
|
-
}>()
|
|
23
|
-
|
|
24
|
-
const value = computed<boolean>({
|
|
25
|
-
get() {
|
|
26
|
-
return props.modelValue
|
|
27
|
-
},
|
|
28
|
-
set(newValue) {
|
|
29
|
-
emits('update:model-value', newValue)
|
|
30
|
-
},
|
|
31
|
-
})
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<style>
|
|
35
|
-
:root {
|
|
36
|
-
--label-before-bg-color: #737373;
|
|
37
|
-
--label-after-bg-color: #fff;
|
|
38
|
-
--label-before-box-shadow: 0 0 0.1rem 0.1rem #69c0e2;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
:root.dark-theme {
|
|
42
|
-
--label-before-bg-color: #fff;
|
|
43
|
-
--label-after-bg-color: #1b2a32;
|
|
44
|
-
--label-before-box-shadow: 0 0 0;
|
|
45
|
-
}
|
|
46
|
-
</style>
|
|
47
|
-
|
|
48
|
-
<style scoped lang="scss">
|
|
49
|
-
.switch-body {
|
|
50
|
-
width: 33px;
|
|
51
|
-
height: 18px;
|
|
52
|
-
position: relative;
|
|
53
|
-
margin-right: 4px;
|
|
54
|
-
|
|
55
|
-
input[type='checkbox'] {
|
|
56
|
-
position: absolute;
|
|
57
|
-
top: 0.3rem;
|
|
58
|
-
right: 0.3rem;
|
|
59
|
-
height: 0.8rem;
|
|
60
|
-
width: 0.8rem;
|
|
61
|
-
opacity: 0;
|
|
62
|
-
}
|
|
63
|
-
.switch-label {
|
|
64
|
-
display: block;
|
|
65
|
-
position: relative;
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
height: 1.2rem;
|
|
68
|
-
}
|
|
69
|
-
.switch-label {
|
|
70
|
-
&:before {
|
|
71
|
-
position: absolute;
|
|
72
|
-
display: inline-block;
|
|
73
|
-
content: '';
|
|
74
|
-
height: 18px;
|
|
75
|
-
width: 33px;
|
|
76
|
-
border-radius: 0.45rem;
|
|
77
|
-
border: 2px solid var(--label-before-bg-color);
|
|
78
|
-
background-color: var(--label-before-bg-color);
|
|
79
|
-
transition: 0.15s ease-in;
|
|
80
|
-
transition-property: border-color, background-color;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&:after {
|
|
84
|
-
position: absolute;
|
|
85
|
-
display: inline-block;
|
|
86
|
-
content: '';
|
|
87
|
-
height: 14.5px;
|
|
88
|
-
width: 14.5px;
|
|
89
|
-
border: 1px solid var(--label-after-bg-color);
|
|
90
|
-
border-radius: 50%;
|
|
91
|
-
background-color: var(--label-after-bg-color);
|
|
92
|
-
bottom: 12.5px;
|
|
93
|
-
transition: 0.15s ease-in;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
& input[type='checkbox']:focus + label:before {
|
|
98
|
-
box-shadow: var(--label-before-box-shadow);
|
|
99
|
-
}
|
|
100
|
-
& input[type='checkbox']:checked + label:before {
|
|
101
|
-
border-color: #62a420;
|
|
102
|
-
background-color: #62a420;
|
|
103
|
-
}
|
|
104
|
-
& input[type='checkbox']:checked + label:after {
|
|
105
|
-
left: 15px;
|
|
106
|
-
}
|
|
107
|
-
& input[type='checkbox'] + label:after {
|
|
108
|
-
left: 3px;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex-align-center">
|
|
3
|
+
<div class="switch-body">
|
|
4
|
+
<input :id="props.testId" v-model="value" type="checkbox" />
|
|
5
|
+
<label class="switch-label" :for="props.testId"></label>
|
|
6
|
+
</div>
|
|
7
|
+
<label :for="props.testId"><slot></slot></label>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
const props = withDefaults(
|
|
13
|
+
defineProps<{
|
|
14
|
+
modelValue: boolean
|
|
15
|
+
testId?: string
|
|
16
|
+
}>(),
|
|
17
|
+
{ testId: 'ui-switch' }
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
const emits = defineEmits<{
|
|
21
|
+
(event: 'update:model-value', value: boolean): void
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
const value = computed<boolean>({
|
|
25
|
+
get() {
|
|
26
|
+
return props.modelValue
|
|
27
|
+
},
|
|
28
|
+
set(newValue) {
|
|
29
|
+
emits('update:model-value', newValue)
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<style>
|
|
35
|
+
:root {
|
|
36
|
+
--label-before-bg-color: #737373;
|
|
37
|
+
--label-after-bg-color: #fff;
|
|
38
|
+
--label-before-box-shadow: 0 0 0.1rem 0.1rem #69c0e2;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:root.dark-theme {
|
|
42
|
+
--label-before-bg-color: #fff;
|
|
43
|
+
--label-after-bg-color: #1b2a32;
|
|
44
|
+
--label-before-box-shadow: 0 0 0;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
47
|
+
|
|
48
|
+
<style scoped lang="scss">
|
|
49
|
+
.switch-body {
|
|
50
|
+
width: 33px;
|
|
51
|
+
height: 18px;
|
|
52
|
+
position: relative;
|
|
53
|
+
margin-right: 4px;
|
|
54
|
+
|
|
55
|
+
input[type='checkbox'] {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 0.3rem;
|
|
58
|
+
right: 0.3rem;
|
|
59
|
+
height: 0.8rem;
|
|
60
|
+
width: 0.8rem;
|
|
61
|
+
opacity: 0;
|
|
62
|
+
}
|
|
63
|
+
.switch-label {
|
|
64
|
+
display: block;
|
|
65
|
+
position: relative;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
height: 1.2rem;
|
|
68
|
+
}
|
|
69
|
+
.switch-label {
|
|
70
|
+
&:before {
|
|
71
|
+
position: absolute;
|
|
72
|
+
display: inline-block;
|
|
73
|
+
content: '';
|
|
74
|
+
height: 18px;
|
|
75
|
+
width: 33px;
|
|
76
|
+
border-radius: 0.45rem;
|
|
77
|
+
border: 2px solid var(--label-before-bg-color);
|
|
78
|
+
background-color: var(--label-before-bg-color);
|
|
79
|
+
transition: 0.15s ease-in;
|
|
80
|
+
transition-property: border-color, background-color;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&:after {
|
|
84
|
+
position: absolute;
|
|
85
|
+
display: inline-block;
|
|
86
|
+
content: '';
|
|
87
|
+
height: 14.5px;
|
|
88
|
+
width: 14.5px;
|
|
89
|
+
border: 1px solid var(--label-after-bg-color);
|
|
90
|
+
border-radius: 50%;
|
|
91
|
+
background-color: var(--label-after-bg-color);
|
|
92
|
+
bottom: 12.5px;
|
|
93
|
+
transition: 0.15s ease-in;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
& input[type='checkbox']:focus + label:before {
|
|
98
|
+
box-shadow: var(--label-before-box-shadow);
|
|
99
|
+
}
|
|
100
|
+
& input[type='checkbox']:checked + label:before {
|
|
101
|
+
border-color: #62a420;
|
|
102
|
+
background-color: #62a420;
|
|
103
|
+
}
|
|
104
|
+
& input[type='checkbox']:checked + label:after {
|
|
105
|
+
left: 15px;
|
|
106
|
+
}
|
|
107
|
+
& input[type='checkbox'] + label:after {
|
|
108
|
+
left: 3px;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
</style>
|