refactor(design-system): replace functional components (#3802)

* update creator item

* update warning tooltip

* update badge and trigger icon

* update action box

* update avatar component

* update badge

* update heading component

* update icon component

* update link component

* update menu

* update route component

* fix avatar bug

* fix avatar bug

* update input component

* update select

* update input

* update tags component

* update spinner

* update square button

* update tag component

* update text component

* add danger color

* add vue.extend

* add human readable names

* add human readable name

* revert button changes

* update name

* revert name

* update classes

* delete unused component

* redo name change

* rename

* rename back

* rename back

* update snapshots
This commit is contained in:
Mutasem Aldmour
2022-08-05 15:03:24 +02:00
committed by GitHub
parent f151a8ad4a
commit 60da5bb7ec
40 changed files with 486 additions and 307 deletions

View File

@@ -1,19 +1,19 @@
<template functional>
<template>
<fragment>
<el-tag
v-if="props.type === 'danger'"
v-if="type === 'danger'"
type="danger"
size="small"
:class="$style['danger']"
>
{{ props.text }}
{{ text }}
</el-tag>
<el-tag
v-else-if="props.type === 'warning'"
v-else-if="type === 'warning'"
size="small"
:class="$style['warning']"
>
{{ props.text }}
{{ text }}
</el-tag>
</fragment>
</template>
@@ -48,4 +48,4 @@ export default {
color: $--badge-warning-color;
border: none;
}
</style>
</style>

View File

@@ -1,28 +1,28 @@
<template functional>
<template>
<div
:class="{
container: true,
clickable: props.clickable,
active: props.active,
clickable: clickable,
active: active,
}"
@click="listeners.click"
v-on="$listeners"
>
<CategoryItem
v-if="props.item.type === 'category'"
:item="props.item"
v-if="item.type === 'category'"
:item="item"
/>
<SubcategoryItem
v-else-if="props.item.type === 'subcategory'"
:item="props.item"
v-else-if="item.type === 'subcategory'"
:item="item"
/>
<NodeItem
v-else-if="props.item.type === 'node'"
:nodeType="props.item.properties.nodeType"
:bordered="!props.lastNode"
@dragstart="listeners.dragstart"
@dragend="listeners.dragend"
v-else-if="item.type === 'node'"
:nodeType="item.properties.nodeType"
:bordered="!lastNode"
@dragstart="$listeners.dragstart"
@dragend="$listeners.dragend"
/>
</div>
</template>
@@ -33,13 +33,15 @@ import NodeItem from './NodeItem.vue';
import CategoryItem from './CategoryItem.vue';
import SubcategoryItem from './SubcategoryItem.vue';
Vue.component('CategoryItem', CategoryItem);
Vue.component('SubcategoryItem', SubcategoryItem);
Vue.component('NodeItem', NodeItem);
export default {
export default Vue.extend({
name: 'CreatorItem',
components: {
CategoryItem,
SubcategoryItem,
NodeItem,
},
props: ['item', 'active', 'clickable', 'lastNode'],
};
});
</script>
<style lang="scss" scoped>

View File

@@ -8,7 +8,7 @@
@keydown.stop
@keydown.esc="editName = false"
>
<n8n-text :class="$style.renameText" :bold="true" color="text-base" tag="div"
<n8n-text :bold="true" color="text-base" tag="div"
>{{ $locale.baseText('ndv.title.renameNode') }}</n8n-text>
<n8n-input ref="input" size="small" v-model="newName" />
<div :class="$style.editButtons">

View File

@@ -845,9 +845,9 @@ export default mixins(
// Set focus on field
setTimeout(() => {
// @ts-ignore
if (this.$refs.inputField.$el) {
if (this.$refs.inputField) {
// @ts-ignore
(this.$refs.inputField.$el.querySelector(this.getStringInputType === 'textarea' ? 'textarea' : 'input') as HTMLInputElement).focus();
this.$refs.inputField.focus();
}
});

View File

@@ -77,7 +77,8 @@ export default mixins(showMessage).extend({
};
},
mounted() {
const select = this.$refs.select as (Vue | undefined);
// @ts-ignore
const select = (this.$refs.select && this.$refs.select.$refs && this.$refs.select.$refs.innerSelect) as (Vue | undefined);
if (select) {
const input = select.$refs.input as (Element | undefined);
if (input) {
@@ -200,10 +201,10 @@ export default mixins(showMessage).extend({
}
},
focusOnInput() {
const select = this.$refs.select as Vue;
const input = select && select.$refs.input as HTMLElement;
if (input && input.focus) {
input.focus();
const select = (this.$refs.select) as (Vue | undefined);
if (select) {
// @ts-ignore
select.focusOnInput();
this.focused = true;
}
},

View File

@@ -1,4 +1,4 @@
<template functional>
<template>
<span :class="$style.trigger">
<svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Trigger node</title>

View File

@@ -1,4 +1,4 @@
<template functional>
<template>
<n8n-tooltip content=" " placement="top" >
<div slot="content"><slot /></div>
<font-awesome-icon :class="$style['icon']" icon="exclamation-triangle"></font-awesome-icon>