chore(ui): Fix code formatting

This commit is contained in:
Ferdinand Thiessen 2021-12-05 23:51:44 +01:00
parent 11a4f87005
commit 58621d3da4
10 changed files with 59 additions and 56 deletions

View File

@ -17,11 +17,11 @@ module.exports = {
project: resolve(__dirname, './tsconfig.json'),
tsconfigRootDir: __dirname,
ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports
sourceType: 'module', // Allows for the use of imports
},
env: {
browser: true
browser: true,
},
// Rules order is important, please avoid shuffling them
@ -44,7 +44,7 @@ module.exports = {
// https://github.com/prettier/eslint-config-prettier#installation
// usage with Prettier, provided by 'eslint-config-prettier'.
'prettier', //'plugin:prettier/recommended'
'plugin:prettier/recommended'
],
plugins: [
@ -54,10 +54,6 @@ module.exports = {
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file
// required to lint *.vue files
'vue',
// https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674
// Prettier has not been included as plugin to avoid performance impact
// add it as an extension for your IDE
],
// add your custom rules here
@ -66,10 +62,8 @@ module.exports = {
// TypeScript
quotes: ['warn', 'single', { avoidEscape: true }],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
};

View File

@ -15,7 +15,7 @@
"main": "src/index.ts",
"types": "src/api.d.ts",
"scripts": {
"pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'",
"format": "prettier --config ./package.json --write '{,!(node_modules|backend)/**/}*.{js,ts,vue}'",
"lint": "eslint --ext .js,.ts,.vue ./src"
},
"dependencies": {

View File

@ -140,16 +140,6 @@ export default defineComponent({
},
setup(props, { emit }) {
const store = useEventStore();
const startDate = computed(() => {
const d = date.buildDate({ milliseconds: 0, seconds: 0, minutes: 0, hours: 0 });
if (!props.date || !date.isValid(props.date)) return d;
const split = props.date.split('-');
return date.adjustDate(d, {
year: parseInt(split[0]),
month: parseInt(split[1]),
date: parseInt(split[2]),
});
});
const active = ref(0);
const activeJob = ref<{ validate: () => Promise<boolean> }>();
@ -166,9 +156,12 @@ export default defineComponent({
void store.getTemplates();
});
watch(props, (n, o) => {
if (event.value?.id !== n.modelValue?.id) reset();
});
watch(
() => props.modelValue,
(newModelValue) => {
if (event.value?.id !== newModelValue?.id) reset();
}
);
function addJob() {
if (!activeJob.value) event.value.jobs.push(emptyJob());

View File

@ -57,7 +57,12 @@
</q-form>
</q-card-section>
<q-card-actions>
<q-btn label="Schicht löschen" color="negative" :disabled="canDelete" @click="$emit('remove-job')" />
<q-btn
label="Schicht löschen"
color="negative"
:disabled="canDelete"
@click="$emit('remove-job')"
/>
</q-card-actions>
</q-card>
</template>
@ -126,7 +131,7 @@ export default defineComponent({
}
expose({
validate: () => form.value?.validate() || Promise.resolve(true)
validate: () => form.value?.validate() || Promise.resolve(true),
});
return {
@ -140,7 +145,6 @@ export default defineComponent({
};
},
});
</script>
<style></style>

View File

@ -6,11 +6,24 @@
<div class="text-h6">Editere {{ title }} {{ actualType.name }}</div>
</q-card-section>
<q-card-section>
<q-input ref="dialogInput" v-model="actualType.name" :rules="rules" dense label="name" filled />
<q-input
ref="dialogInput"
v-model="actualType.name"
:rules="rules"
dense
label="name"
filled
/>
</q-card-section>
<q-card-actions>
<q-btn flat color="danger" label="Abbrechen" @click="discardChanges()" />
<q-btn flat color="primary" label="Speichern" :disable="!!dialogInput && !dialogInput.validate()" @click="saveChanges()" />
<q-btn
flat
color="primary"
label="Speichern"
:disable="!!dialogInput && !dialogInput.validate()"
@click="saveChanges()"
/>
</q-card-actions>
</q-card>
</q-dialog>
@ -33,11 +46,7 @@
</template>
<template #body-cell-actions="props">
<q-td :props="props" align="right" :auto-width="true">
<q-btn
round
icon="mdi-pencil"
@click="editType(props.row.id)"
/>
<q-btn round icon="mdi-pencil" @click="editType(props.row.id)" />
<q-btn round icon="mdi-delete" @click="deleteType(props.row.id)" />
</q-td>
</template>
@ -58,7 +67,7 @@ export default defineComponent({
components: {},
props: {
type: { type: String as PropType<'EventType' | 'JobType'>, required: true },
title: {type: String, required: true}
title: { type: String, required: true },
},
setup(props) {
const store = useEventStore();
@ -69,7 +78,7 @@ export default defineComponent({
const actualType = ref(emptyType);
const input = ref<QInput>();
const dialogInput = ref<QInput>();
const storeName = computed(() => props.type == 'EventType' ? 'eventTypes' : 'jobTypes')
const storeName = computed(() => (props.type == 'EventType' ? 'eventTypes' : 'jobTypes'));
onBeforeMount(async () => await store[`get${props.type}s`]());
@ -78,8 +87,7 @@ export default defineComponent({
const rules = [
(s: unknown) => !!s || 'Darf nicht leer sein!',
(s: string) =>
rows.value.find((e) => e.name === s) === undefined ||
'Der Name wird bereits verwendet',
rows.value.find((e) => e.name === s) === undefined || 'Der Name wird bereits verwendet',
];
const columns = [
@ -100,8 +108,7 @@ export default defineComponent({
function addType() {
if (input.value === undefined || input.value.validate())
store
[`add${props.type}`](actualType.value.name)
store[`add${props.type}`](actualType.value.name)
.then(() => {
actualType.value.name = '';
})
@ -121,12 +128,17 @@ export default defineComponent({
function editType(id: number) {
dialogOpen.value = true;
actualType.value = Object.assign({}, rows.value.find((v) => v.id === id));
actualType.value = Object.assign(
{},
rows.value.find((v) => v.id === id)
);
}
function saveChanges() {
if (dialogInput.value === undefined || dialogInput.value.validate())
void store[`rename${props.type}`](actualType.value.id, actualType.value.name).then(() => discardChanges());
void store[`rename${props.type}`](actualType.value.id, actualType.value.name).then(() =>
discardChanges()
);
}
function discardChanges() {

View File

@ -63,7 +63,7 @@ export default defineComponent({
const rule = new Proxy(props.modelValue, {
get(target, prop) {
if (typeof prop === 'string') {
return ((props.modelValue as unknown) as Record<string, unknown>)[prop];
return (props.modelValue as unknown as Record<string, unknown>)[prop];
}
},
set(target, prop, value) {

View File

@ -18,7 +18,7 @@
</q-dialog>
<div class="q-pa-md">
<q-card style="height: 70vh; max-width: 1800px" class="q-pa-md">
<div class="scroll" ref="scrollDiv" style="height: 100%">
<div ref="scrollDiv" class="scroll" style="height: 100%">
<q-infinite-scroll :offset="250" @load="load">
<q-list>
<q-item id="bbb">

View File

@ -54,10 +54,10 @@ export default defineComponent({
setup() {
const quasar = useQuasar();
const tabs = computed(() => ([
const tabs = computed(() => [
{ name: 'listView', label: 'Liste' },
{ name: 'agendaView', label: 'Kalendar' }
]));
{ name: 'agendaView', label: 'Kalendar' },
]);
const drawer = ref<boolean>(false);