bfg-common 1.3.115 → 1.3.117

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.
@@ -107,6 +107,7 @@
107
107
  :is-edit="props.isEdit"
108
108
  :state="props.state"
109
109
  @remove="onRemovePciDevice(pciDevicesIndex[key])"
110
+ @roll-back="onRollBackPciDevice(pciDevicesIndex[key])"
110
111
  @send-data="
111
112
  onSendDataPciDevicesMethod($event, pciDevicesIndex[key])
112
113
  "
@@ -455,7 +456,7 @@ const defaultPciDevice: UI_I_PciDevice = {
455
456
  device_name: 'cdrom',
456
457
  }
457
458
  const pciDevicesIndex = ref<number[]>([0])
458
- const pciDevicesType = ref<('new' | 'edit')[]>(['new'])
459
+ const pciDevicesType = ref<('new' | 'edit' | 'removed')[]>(['new'])
459
460
  const pciDevices = ref<UI_I_PciDevice[]>([])
460
461
  watch(
461
462
  () => props.pciDevices,
@@ -484,8 +485,11 @@ const addPciDevice = (): void => {
484
485
  const onRemovePciDevice = (index: number): void => {
485
486
  const removeIndex = pciDevicesIndex.value.indexOf(index)
486
487
  pciDevicesIndex.value = pciDevicesIndex.value.filter((item) => item !== index)
487
- pciDevicesType.value = pciDevicesType.value.filter(
488
- (_item, key) => key !== removeIndex
488
+ pciDevicesType.value = pciDevicesType.value.map(
489
+ (item, key) => {
490
+ if (key !== removeIndex) return 'removed'
491
+ return item
492
+ }
489
493
  )
490
494
 
491
495
  pciDevices.value = pciDevices.value.filter((_pciDevice, key: number) => {
@@ -496,6 +500,13 @@ const onRemovePciDevice = (index: number): void => {
496
500
  delete sendDataNewPciDevices.value[index]
497
501
  sendData()
498
502
  }
503
+ const onRollBackPciDevice = (index: number): void => {
504
+ const removeIndex = pciDevicesIndex.value.indexOf(index)
505
+ pciDevicesType.value = pciDevicesType.value.map((item, key) => {
506
+ if (key === removeIndex) return 'edit'
507
+ return item
508
+ })
509
+ }
499
510
 
500
511
  const isShowFileModal = ref<boolean>(false)
501
512
  const onAddDevice = (item: UI_I_DropdownTreeItemChild): void => {
@@ -3,7 +3,9 @@
3
3
  <atoms-stack-block
4
4
  :has-children="true"
5
5
  :removable="isRemovable"
6
- @remove="removePciDevice"
6
+ :is-roll-back="props.type === 'removed'"
7
+ @remove="onRemovePciDevice"
8
+ @roll-back="onRollBackPciDevice"
7
9
  >
8
10
  <template #stackBlockKey>
9
11
  <div class="flex-align-center">
@@ -74,6 +76,7 @@ const props = defineProps<{
74
76
  const emits = defineEmits<{
75
77
  (event: 'send-data', value: UI_I_SendDataNewPciDevice): void
76
78
  (event: 'remove'): void
79
+ (event: 'roll-back'): void
77
80
  }>()
78
81
 
79
82
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -158,9 +161,12 @@ watch(
158
161
  { immediate: true }
159
162
  )
160
163
 
161
- const removePciDevice = (): void => {
164
+ const onRemovePciDevice = (): void => {
162
165
  emits('remove')
163
166
  }
167
+ const onRollBackPciDevice = (): void => {
168
+ emits('roll-back')
169
+ }
164
170
  </script>
165
171
 
166
172
  <style scoped lang="scss">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.115",
4
+ "version": "1.3.117",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",