Browse Source

feat(gui-v2): implement color picker to rating and checkbox options

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3022/head
mertmit 2 years ago
parent
commit
427d9084c0
  1. 27
      packages/nc-gui-v2/components/smartsheet-column/CheckboxOptions.vue
  2. 27
      packages/nc-gui-v2/components/smartsheet-column/RatingOptions.vue

27
packages/nc-gui-v2/components/smartsheet-column/CheckboxOptions.vue

@ -1,7 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { Sketch } from '@ckpack/vue-color'
import { useColumnCreateStoreOrThrow } from '#imports' import { useColumnCreateStoreOrThrow } from '#imports'
import { enumColor, getMdiIcon } from '@/utils' import { getMdiIcon } from '@/utils'
const { formState } = useColumnCreateStoreOrThrow() const { formState } = useColumnCreateStoreOrThrow()
@ -37,9 +36,12 @@ const iconList = [
}, },
] ]
const advanced = ref(true) const picked = computed({
get: () => formState.value.meta.color,
const picked = ref(formState.value.meta.color || enumColor.light[0]) set: (val) => {
formState.value.meta.color = val
},
})
// set default value // set default value
formState.value.meta = { formState.value.meta = {
@ -92,16 +94,11 @@ watch(
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-card class="w-full shadow-lg mt-2" body-style="padding: 0px"> <GeneralColorPicker
<a-collapse v-model:activeKey="advanced" accordion ghost expand-icon-position="right"> v-model="picked"
<a-collapse-panel key="1" header="Advanced" class=""> :row-size="8"
<a-button class="!bg-primary text-white w-full" @click="formState.meta.color = picked.hex"> Pick Color </a-button> :colors="['#fcb401', '#faa307', '#f48c06', '#e85d04', '#dc2f02', '#d00000', '#9d0208', '#777']"
<div class="px-7 py-3"> />
<Sketch v-model="picked" />
</div>
</a-collapse-panel>
</a-collapse>
</a-card>
</a-row> </a-row>
</template> </template>

27
packages/nc-gui-v2/components/smartsheet-column/RatingOptions.vue

@ -1,7 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { Sketch } from '@ckpack/vue-color'
import { useColumnCreateStoreOrThrow } from '#imports' import { useColumnCreateStoreOrThrow } from '#imports'
import { enumColor, getMdiIcon } from '@/utils' import { getMdiIcon } from '@/utils'
const { formState } = useColumnCreateStoreOrThrow() const { formState } = useColumnCreateStoreOrThrow()
@ -29,9 +28,12 @@ const iconList = [
}, },
] ]
const advanced = ref(true) const picked = computed({
get: () => formState.value.meta.color,
const picked = ref(formState.value.meta.color || enumColor.light[0]) set: (val) => {
formState.value.meta.color = val
},
})
// set default value // set default value
formState.value.meta = { formState.value.meta = {
@ -95,16 +97,11 @@ watch(
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-card class="w-full shadow-lg mt-2" body-style="padding: 0px"> <GeneralColorPicker
<a-collapse v-model:activeKey="advanced" accordion ghost expand-icon-position="right"> v-model="picked"
<a-collapse-panel key="1" header="Advanced" class=""> :row-size="8"
<a-button class="!bg-primary text-white w-full" @click="formState.meta.color = picked.hex"> Pick Color </a-button> :colors="['#fcb401', '#faa307', '#f48c06', '#e85d04', '#dc2f02', '#d00000', '#9d0208', '#777']"
<div class="px-7 py-3"> />
<Sketch v-model="picked" />
</div>
</a-collapse-panel>
</a-collapse>
</a-card>
</a-row> </a-row>
</template> </template>

Loading…
Cancel
Save