Compare commits
3 Commits
190c2df6ac
...
63eb6787e5
Author | SHA1 | Date | |
---|---|---|---|
63eb6787e5 | |||
28050d9cd5 | |||
e94b71d577 |
14
package.json
14
package.json
|
@ -126,8 +126,8 @@
|
|||
"@cypress/vite-dev-server": "5.0.7",
|
||||
"@cypress/vue": "6.0.0",
|
||||
"@faker-js/faker": "8.3.1",
|
||||
"@histoire/plugin-screenshot": "0.17.6",
|
||||
"@histoire/plugin-vue": "0.17.6",
|
||||
"@histoire/plugin-screenshot": "0.17.8",
|
||||
"@histoire/plugin-vue": "0.17.8",
|
||||
"@rushstack/eslint-patch": "1.6.1",
|
||||
"@tsconfig/node18": "18.2.2",
|
||||
"@types/codemirror": "5.60.15",
|
||||
|
@ -136,7 +136,7 @@
|
|||
"@types/is-touch-device": "1.0.2",
|
||||
"@types/lodash.debounce": "4.0.9",
|
||||
"@types/marked": "5.0.2",
|
||||
"@types/node": "20.10.8",
|
||||
"@types/node": "20.11.2",
|
||||
"@types/postcss-preset-env": "7.7.0",
|
||||
"@types/sortablejs": "1.15.7",
|
||||
"@typescript-eslint/eslint-plugin": "6.18.1",
|
||||
|
@ -154,15 +154,15 @@
|
|||
"cypress": "13.6.2",
|
||||
"esbuild": "0.19.11",
|
||||
"eslint": "8.56.0",
|
||||
"eslint-plugin-vue": "9.19.2",
|
||||
"eslint-plugin-vue": "9.20.1",
|
||||
"happy-dom": "12.10.3",
|
||||
"histoire": "0.17.6",
|
||||
"histoire": "0.17.8",
|
||||
"postcss": "8.4.33",
|
||||
"postcss-easing-gradients": "3.0.1",
|
||||
"postcss-easings": "4.0.0",
|
||||
"postcss-focus-within": "8.0.1",
|
||||
"postcss-preset-env": "9.3.0",
|
||||
"rollup": "4.9.4",
|
||||
"rollup": "4.9.5",
|
||||
"rollup-plugin-visualizer": "5.12.0",
|
||||
"sass": "1.69.7",
|
||||
"start-server-and-test": "2.0.3",
|
||||
|
@ -172,7 +172,7 @@
|
|||
"vite-plugin-pwa": "0.17.4",
|
||||
"vite-plugin-sentry": "1.3.0",
|
||||
"vite-svg-loader": "5.1.0",
|
||||
"vitest": "1.1.3",
|
||||
"vitest": "1.2.0",
|
||||
"vue-tsc": "1.8.27",
|
||||
"wait-on": "7.2.0",
|
||||
"workbox-cli": "7.0.0"
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
v-tooltip="$t('input.editor.bulletList')"
|
||||
>
|
||||
<span class="icon">
|
||||
<icon :icon="['fa', 'fa-list-ol']"/>
|
||||
<icon :icon="['fa', 'fa-list-ul']"/>
|
||||
</span>
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
|
@ -120,7 +120,7 @@
|
|||
v-tooltip="$t('input.editor.orderedList')"
|
||||
>
|
||||
<span class="icon">
|
||||
<icon :icon="['fa', 'fa-list-ul']"/>
|
||||
<icon :icon="['fa', 'fa-list-ol']"/>
|
||||
</span>
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
|
|
|
@ -51,6 +51,7 @@ import Multiselect from '@/components/input/multiselect.vue'
|
|||
import type {ILabel} from '@/modelTypes/ILabel'
|
||||
import {useLabelStore} from '@/stores/labels'
|
||||
import {useTaskStore} from '@/stores/tasks'
|
||||
import {getRandomColorHex} from '@/helpers/color/randomColor'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
|
@ -132,7 +133,10 @@ async function createAndAddLabel(title: string) {
|
|||
return
|
||||
}
|
||||
|
||||
const newLabel = await labelStore.createLabel(new LabelModel({title}))
|
||||
const newLabel = await labelStore.createLabel(new LabelModel({
|
||||
title,
|
||||
hexColor: getRandomColorHex(),
|
||||
}))
|
||||
addLabel(newLabel, false)
|
||||
labels.value.push(newLabel)
|
||||
success({message: t('task.label.addCreateSuccess')})
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* @param color
|
||||
* @returns {string}
|
||||
*/
|
||||
export function colorFromHex(color: string) {
|
||||
if (color.substring(0, 1) === '#') {
|
||||
export function colorFromHex(color: string): string {
|
||||
if (color !== '' && color.substring(0, 1) === '#') {
|
||||
color = color.substring(1, 7)
|
||||
}
|
||||
|
||||
|
|
|
@ -24,12 +24,8 @@ export default class LabelModel extends AbstractModel<ILabel> implements ILabel
|
|||
constructor(data: Partial<ILabel> = {}) {
|
||||
super()
|
||||
this.assignData(data)
|
||||
|
||||
if (this.hexColor === '') {
|
||||
this.hexColor = getRandomColorHex()
|
||||
}
|
||||
|
||||
if (this.hexColor.substring(0, 1) !== '#') {
|
||||
if (this.hexColor !== '' && this.hexColor.substring(0, 1) !== '#') {
|
||||
this.hexColor = '#' + this.hexColor
|
||||
}
|
||||
this.textColor = colorIsDark(this.hexColor) ? '#4a4a4a' : '#fff'
|
||||
|
|
|
@ -67,7 +67,7 @@ export const useLabelStore = defineStore('label', () => {
|
|||
}
|
||||
|
||||
function setLabel(label: ILabel) {
|
||||
labels.value[label.id] = label
|
||||
labels.value[label.id] = {...label}
|
||||
update(label)
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import {useBaseStore} from '@/stores/base'
|
|||
import ProjectUserService from '@/services/projectUsers'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
import TaskCollectionService from '@/services/taskCollection'
|
||||
import {getRandomColorHex} from '@/helpers/color/randomColor'
|
||||
|
||||
interface MatchedAssignee extends IUser {
|
||||
match: string,
|
||||
|
@ -337,7 +338,10 @@ export const useTaskStore = defineStore('task', () => {
|
|||
let label = validateLabel(Object.values(labelStore.labels), labelTitle)
|
||||
if (typeof label === 'undefined') {
|
||||
// label not found, create it
|
||||
const labelModel = new LabelModel({title: labelTitle})
|
||||
const labelModel = new LabelModel({
|
||||
title: labelTitle,
|
||||
hexColor: getRandomColorHex(),
|
||||
})
|
||||
label = await labelStore.createLabel(labelModel)
|
||||
}
|
||||
return label
|
||||
|
|
|
@ -150,8 +150,8 @@ function deleteLabel(label: ILabel) {
|
|||
}
|
||||
|
||||
function editLabelSubmit() {
|
||||
return labelStore.updateLabel(labelEditLabel.value)
|
||||
}
|
||||
return labelStore.updateLabel(labelEditLabel.value)
|
||||
}
|
||||
|
||||
function editLabel(label: ILabel) {
|
||||
if (label.createdBy.id !== userInfo.value.id) {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {computed, ref} from 'vue'
|
||||
import {computed, onBeforeMount, ref} from 'vue'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
import {useRouter} from 'vue-router'
|
||||
|
||||
|
@ -46,6 +46,7 @@ import LabelModel from '@/models/label'
|
|||
import {useLabelStore} from '@/stores/labels'
|
||||
import {useTitle} from '@/composables/useTitle'
|
||||
import {success} from '@/message'
|
||||
import {getRandomColorHex} from '@/helpers/color/randomColor'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
|
@ -55,6 +56,8 @@ useTitle(() => t('label.create.title'))
|
|||
const labelStore = useLabelStore()
|
||||
const label = ref(new LabelModel())
|
||||
|
||||
onBeforeMount(() => label.value.hexColor = getRandomColorHex())
|
||||
|
||||
const showError = ref(false)
|
||||
const loading = computed(() => labelStore.isLoading)
|
||||
|
||||
|
|
Reference in New Issue
Block a user