-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
575 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<template> | ||
<div class="chip-list-container q-gutter-xs"> | ||
<q-chip | ||
v-for="(item, index) in modelValue" | ||
:key="item.name" | ||
:color="[ | ||
itemIndex === index ? 'background-selected' : 'background-hover' | ||
]" | ||
text-color="ink-1" | ||
class="text-ink-1 chip-wrapper" | ||
size="12px" | ||
> | ||
<q-tooltip> | ||
<q-markup-table | ||
dense | ||
class="chip-list-table" | ||
separator="none" | ||
dark | ||
flat | ||
> | ||
<tbody> | ||
<tr v-for="(value, key) in item" :key="key" class="text-white"> | ||
<td class="text-left">{{ key }}</td> | ||
<td class="text-left"> | ||
<div style="max-width: 150px" class="ellipsis"> | ||
{{ value }} | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</q-markup-table> | ||
</q-tooltip> | ||
<div @click="() => clickHandler(item, index)"> | ||
{{ item.name }} | ||
</div> | ||
<q-icon | ||
class="q-ml-sm" | ||
name="close" | ||
color="ink-3 delete-icon" | ||
@click="deleteHandler(index)" | ||
/> | ||
</q-chip> | ||
</div> | ||
<div class="relative-position q-mt-md" v-show="visible"> | ||
<q-input | ||
v-model="value" | ||
type="textarea" | ||
class="bg-background-3 input-wrapper" | ||
borderless | ||
autogrow | ||
/> | ||
<div class="text-right q-gutter-x-sm btn-group q-pb-sm q-pr-sm"> | ||
<QBtnStyle> | ||
<q-btn | ||
outline | ||
no-caps | ||
color="ink-2" | ||
outlined | ||
:label="$t('cookie_cancel')" | ||
class="bg-white" | ||
@click="cancelHandler" | ||
/> | ||
</QBtnStyle> | ||
<QBtnStyle> | ||
<q-btn | ||
outline | ||
no-caps | ||
color="ink-2" | ||
outlined | ||
:label="$t('cookie_save')" | ||
class="bg-white" | ||
@click="saveHandler" | ||
/> | ||
</QBtnStyle> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useQuasar } from 'quasar'; | ||
import { ref } from 'vue'; | ||
import QBtnStyle from '../components/style/QBtnStyle.vue'; | ||
interface Props { | ||
modelValue: { name: string; value: string }[]; | ||
} | ||
const $q = useQuasar(); | ||
const props = withDefaults(defineProps<Props>(), {}); | ||
const emits = defineEmits(['update:modelValue']); | ||
const value = ref(); | ||
const itemIndex = ref(-1); | ||
const visible = ref(false); | ||
const deleteHandler = (index) => { | ||
const data = [...props.modelValue]; | ||
data.splice(index, 1); | ||
emits('update:modelValue', data); | ||
}; | ||
const clickHandler = (item, index) => { | ||
console.log('clickHandler'); | ||
itemIndex.value = index; | ||
value.value = item.value; | ||
visible.value = true; | ||
}; | ||
const saveHandler = () => { | ||
const data = [...props.modelValue]; | ||
const obj = { ...props.modelValue[itemIndex.value], value: value.value }; | ||
data.splice(itemIndex.value, 1, obj); | ||
emits('update:modelValue', data); | ||
visible.value = false; | ||
}; | ||
const cancelHandler = () => { | ||
visible.value = false; | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.chip-list-container { | ||
.chip-wrapper { | ||
cursor: pointer; | ||
} | ||
} | ||
.chip-list-table { | ||
background: rgba(0, 0, 0, 0); | ||
color: #fff; | ||
} | ||
.delete-icon { | ||
cursor: pointer; | ||
&:hover { | ||
background: $background-1; | ||
border-radius: 50%; | ||
} | ||
} | ||
.btn-group { | ||
position: absolute; | ||
bottom: 0; | ||
right: 0; | ||
} | ||
.input-wrapper { | ||
padding: 0px 12px; | ||
padding-bottom: 48px; | ||
border-radius: 8px; | ||
::v-deep(textarea) { | ||
resize: none; | ||
} | ||
} | ||
::v-deep(.input-wrapper.q-field--outlined .q-field__control:before) { | ||
border-color: $input-stroke-hover !important; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template> | ||
<span class="btn-style-container"> | ||
<slot></slot> | ||
</span> | ||
</template> | ||
|
||
<script setup lang="ts"></script> | ||
|
||
<style lang="scss" scoped> | ||
.btn-style-container { | ||
::v-deep(.q-btn) { | ||
padding: 0; | ||
min-height: 26px; | ||
height: 26px; | ||
padding: 0 8px; | ||
} | ||
::v-deep(.q-btn--outline:before) { | ||
border: 1px solid $btn-stroke; | ||
} | ||
::v-deep(.q-btn__content) { | ||
padding: 0; | ||
line-height: 14px; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<span> | ||
<slot></slot> | ||
</span> | ||
</template> | ||
|
||
<script setup lang="ts"></script> | ||
|
||
<style lang="scss" scoped> | ||
::v-deep(.q-toggle__inner) { | ||
height: 16px; | ||
line-height: 16px; | ||
padding-top: 0; | ||
padding-bottom: 0; | ||
} | ||
::v-deep(.q-toggle__track) { | ||
height: 16px; | ||
border-radius: 8px; | ||
background: $background-5; | ||
} | ||
::v-deep(.q-toggle__thumb) { | ||
height: 12px !important; | ||
width: 12px; | ||
top: 2px; | ||
} | ||
::v-deep(.q-toggle__thumb:after) { | ||
box-shadow: none; | ||
background: $ink-on-brand; | ||
filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.1)); | ||
left: 4px; | ||
right: -4px; | ||
} | ||
::v-deep(.q-toggle__inner--truthy .q-toggle__thumb:after) { | ||
right: 0px; | ||
left: 0px; | ||
} | ||
::v-deep(.q-toggle__thumb:before) { | ||
display: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.