@itfin/components 1.2.105 → 1.2.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itfin/components",
3
- "version": "1.2.105",
3
+ "version": "1.2.106",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -140,6 +140,7 @@ class PropertiesEditMenu extends Vue {
140
140
  }
141
141
 
142
142
  addNewOption() {
143
+ this.newOption = '';
143
144
  this.isNewOptionVisible = true;
144
145
  this.$nextTick(() => {
145
146
  this.$refs.newOptionInput.focus();
@@ -40,8 +40,8 @@
40
40
  </div>
41
41
  </div>
42
42
  <div class="align-items-end d-flex pb-1">
43
- <slot name="add-column" @click="$emit('addColumn')">
44
- <itf-button icon small>
43
+ <slot name="add-column">
44
+ <itf-button icon small @click="$emit('add-сolumn')">
45
45
  <itf-icon name="plus" />
46
46
  </itf-button>
47
47
  </slot>
@@ -1,9 +1,18 @@
1
1
  <template>
2
2
  <div class="itf-board-column-wrapper">
3
- <itf-button v-if="showAddButton" block small class="text-muted">
3
+ <div v-if="isNewOptionVisible">
4
+ <itf-text-field
5
+ style="margin: -4px 0"
6
+ ref="newOptionInput"
7
+ v-model="newOption"
8
+ :placeholder="newItemPlaceholder"
9
+ @blur="onBlurOption"
10
+ @keydown.enter="submitNewOption"
11
+ />
12
+ </div>
13
+ <itf-button v-else-if="showAddButton" :loading="loading" block small class="text-muted" @click="addNewOption">
4
14
  <itf-icon name="plus" />
5
-
6
- Add entry
15
+ {{ newItemText }}
7
16
  </itf-button>
8
17
 
9
18
  <div class="itf-board-cards-wrapper" ref="container">
@@ -43,6 +52,7 @@ import itfButton from '../button/Button';
43
52
  import loading from '../../directives/loading';
44
53
  import itfForm from '../form/Form';
45
54
  import itfEditButton from '../editable/EditButton';
55
+ import itfTextField from '../text-field/TextField.vue';
46
56
  import createDraggable from '../sortable/draggable';
47
57
 
48
58
  const { Node, ...draggableDirectives } = createDraggable({
@@ -59,6 +69,7 @@ const { Node, ...draggableDirectives } = createDraggable({
59
69
 
60
70
  export default @Component({
61
71
  components: {
72
+ itfTextField,
62
73
  itfIcon,
63
74
  itfForm,
64
75
  itfEditButton,
@@ -77,6 +88,12 @@ class BoardColumn extends Vue {
77
88
  @Prop(Array) items;
78
89
  @Prop(Boolean) showAddButton;
79
90
  @Prop(Boolean) cardSorting;
91
+ @Prop(Boolean) loading;
92
+ @Prop({ type: String, default: 'Add new task' }) newItemText;
93
+ @Prop({ type: String, default: 'Type a new task...' }) newItemPlaceholder;
94
+
95
+ isNewOptionVisible = false;
96
+ newOption = '';
80
97
 
81
98
  beforeDestroy() {
82
99
  if (this.cardSorting) {
@@ -107,5 +124,26 @@ class BoardColumn extends Vue {
107
124
  }
108
125
  });
109
126
  }
127
+
128
+ onBlurOption() {
129
+ this.isNewOptionVisible = false;
130
+ }
131
+
132
+ addNewOption() {
133
+ this.newOption = '';
134
+ this.isNewOptionVisible = true;
135
+ this.$nextTick(() => {
136
+ this.$refs.newOptionInput.focus();
137
+ });
138
+ }
139
+
140
+ submitNewOption() {
141
+ const newOption = this.newOption;
142
+ if (newOption) {
143
+ this.$emit('create', newOption);
144
+ this.newOption = '';
145
+ this.isNewOptionVisible = false;
146
+ }
147
+ }
110
148
  }
111
149
  </script>