@itfin/components 1.3.23 → 1.3.25

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.3.23",
3
+ "version": "1.3.25",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -27,16 +27,10 @@
27
27
  right: 0;
28
28
  bottom: 0;
29
29
  z-index: -1;
30
- border-radius: var(--adp-cell-border-radius) var(--bs-border-radius-lg) var(--bs-border-radius-lg) var(--adp-cell-border-radius);
30
+ border-radius: var(--adp-cell-border-radius) 0 0 var(--adp-cell-border-radius);
31
31
  background: var(--adp-cell-background-color-selected);
32
32
  }
33
33
 
34
- &:after {
35
- left: 100%;
36
- right: -2rem;
37
- transform: translate(-1.4375rem) scaleY(.6) scaleX(.4) rotate(45deg);
38
- }
39
-
40
34
  &:before {
41
35
  right: 0.25rem;
42
36
  }
@@ -51,16 +45,10 @@
51
45
  right: 0;
52
46
  bottom: 0;
53
47
  z-index: -1;
54
- border-radius: var(--bs-border-radius-lg) var(--adp-cell-border-radius) var(--adp-cell-border-radius) var(--bs-border-radius-lg);
48
+ border-radius: 0 var(--adp-cell-border-radius) var(--adp-cell-border-radius) 0;
55
49
  background: var(--adp-cell-background-color-selected);
56
50
  }
57
51
 
58
- &:after {
59
- right: 100%;
60
- left: -2rem;
61
- transform: translate(1.4375rem) scaleY(.6) scaleX(.4) rotate(45deg);
62
- }
63
-
64
52
  &:before {
65
53
  left: 0.25rem;
66
54
  }
@@ -19,6 +19,10 @@
19
19
  </div>
20
20
  </template>
21
21
  <style lang="scss" scoped>
22
+ .itf-inline-edit {
23
+ margin: -5px;
24
+ padding: 5px;
25
+ }
22
26
  .itf-inline-edit .input {
23
27
  border: 0 none;
24
28
  margin: 0;
@@ -23,6 +23,10 @@
23
23
  </div>
24
24
  </template>
25
25
  <style lang="scss">
26
+ .itf-inline-edit {
27
+ margin: -5px;
28
+ padding: 5px;
29
+ }
26
30
  .itf-inline-edit .itf-select .form-control {
27
31
  border: 0 none;
28
32
  margin: 0;
@@ -20,6 +20,10 @@
20
20
  </itf-select>
21
21
  </template>
22
22
  <style lang="scss">
23
+ .itf-inline-edit {
24
+ margin: -5px;
25
+ padding: 5px;
26
+ }
23
27
  .itf-inline-edit.itf-select .form-control {
24
28
  border: 0 none;
25
29
  margin: 0;
@@ -26,7 +26,7 @@
26
26
 
27
27
  <div v-if="editable && !lockFields" class="text-start">
28
28
  <div v-if="isShowAll || !hiddenItemsCount">
29
- <itf-dropdown ref="newItemDd" autoclose="outside" class="flex-grow-1 mw-100" shadow :button-options="{ small: true }">
29
+ <itf-dropdown ref="newItemDd" class="flex-grow-1 mw-100" shadow :button-options="{ small: true }">
30
30
  <template #button>
31
31
  <span class="text-muted d-flex align-items-center">
32
32
  <itf-icon name="plus" />
@@ -188,11 +188,15 @@ class itfPropertyItem extends Vue {
188
188
  }
189
189
 
190
190
  hideEditMenu() {
191
- this.$refs.editDd.hide();
191
+ if (this.$refs.editDd) {
192
+ this.$refs.editDd.hide();
193
+ }
192
194
  }
193
195
 
194
196
  showEditMenu() {
195
- this.$refs.editDd.show();
197
+ if (this.$refs.editDd) {
198
+ this.$refs.editDd.show();
199
+ }
196
200
  this.$nextTick(() => {
197
201
  this.isEditMode = true;
198
202
  });
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <div class="b-properties-list">
3
+ <sortable
4
+ require-sortable-attribute
5
+ v-model="list"
6
+ axis="y"
7
+ :read-only="!editable"
8
+ auto-scroll="window"
9
+ >
10
+ <div v-for="(item, n) of listToHide" :key="n" class="b-properties-list__item" v-show="item.isVisible || isShowAll">
11
+ <div v-if="editable && sortable" role="button" tabindex="-1" class="b-properties-list__draghandler" sortable>
12
+ <itf-icon class="dragHandle" name="drag_vertical" />
13
+ </div>
14
+ <div class="b-properties-list__item_content">
15
+ <slot name="item" :item="item.item"></slot>
16
+ </div>
17
+ </div>
18
+ </sortable>
19
+
20
+ <div v-if="editable" class="text-start">
21
+ <itf-button v-if="hiddenItemsCount" small class="text-muted" @click="toggleShowAll">
22
+ <itf-icon :name="isShowAll ? 'chevron_up' : 'chevron_down'" />
23
+ {{isShowAll ? $tc(hidePropertiesText, hiddenItemsCount, { n: hiddenItemsCount }) : $tc(showPropertiesText, hiddenItemsCount, { n: hiddenItemsCount })}}
24
+ </itf-button>
25
+
26
+ <itf-dropdown ref="newItemDd" class="flex-grow-1 mw-100" shadow :button-options="{ small: true }">
27
+ <template #button>
28
+ <span class="text-muted d-flex align-items-center">
29
+ <itf-icon name="plus" />
30
+ {{ addPropertyText }}
31
+ </span>
32
+ </template>
33
+ <slot name="dropdown"></slot>
34
+ </itf-dropdown>
35
+ </div>
36
+ </div>
37
+ </template>
38
+ <style lang="scss" scoped>
39
+ .itf-dropdown__menu {
40
+ div {
41
+ position: relative;
42
+ }
43
+ .dropdown-submenu {
44
+ display: none;
45
+ position: absolute;
46
+ left: 100%;
47
+ top: -7px;
48
+ }
49
+ .dropdown-submenu-left {
50
+ right: 100%;
51
+ left: auto;
52
+ }
53
+ & div:hover > .dropdown-submenu {
54
+ display: block;
55
+ }
56
+ }
57
+ .b-properties-list {
58
+ display: flex;
59
+ flex-direction: column;
60
+ padding: 5px 3px 5px 15px;
61
+
62
+ &__item {
63
+ display: flex;
64
+ }
65
+ &__item_content {
66
+ flex-grow: 1
67
+ }
68
+ &__draghandler {
69
+ user-select: none;
70
+ transition: opacity 150ms ease-in 0s;
71
+ cursor: grab;
72
+ display: flex;
73
+ align-items: center;
74
+ justify-content: center;
75
+ width: 18px;
76
+ height: 24px;
77
+ opacity: 0;
78
+ border-radius: 3px;
79
+ fill: rgba(55, 53, 47, 0.35);
80
+ }
81
+ &__item:hover &__draghandler {
82
+ opacity: 1;
83
+ }
84
+ }
85
+ </style>
86
+ <script>
87
+ import { Vue, Component, Prop, PropSync } from 'vue-property-decorator';
88
+ import itfIcon from '../icon/Icon';
89
+ import itfButton from '../button/Button';
90
+ import itfDropdown from '../dropdown/Dropdown.vue';
91
+ import itfLabel from '../form/Label.vue';
92
+ import itfTextField from '../text-field/TextField.vue';
93
+ import Sortable from '../sortable/Sortable.vue';
94
+
95
+ export default @Component({
96
+ name: 'itfEditableList',
97
+ components: {
98
+ itfIcon,
99
+ itfDropdown,
100
+ itfTextField,
101
+ itfLabel,
102
+ itfButton,
103
+ Sortable
104
+ }
105
+ })
106
+ class itfPropertiesList extends Vue {
107
+ @PropSync('items', { type: Array, required: true }) list;
108
+ @Prop({ type: Function, default: () => true }) isVisible;
109
+ @Prop({ type: Boolean, default: false }) loading;
110
+ @Prop({ type: Boolean, default: false }) editable;
111
+ @Prop({ type: Boolean, default: false }) sortable;
112
+ @Prop({ type: String, default: 'components.customize.showMoreProperties' }) showPropertiesText;
113
+ @Prop({ type: String, default: 'components.customize.hideMoreProperties' }) hidePropertiesText;
114
+ @Prop({ type: String, default: function() { return this.$t('components.customize.addProperty') } }) addPropertyText;
115
+
116
+ isShowAll = false;
117
+
118
+ toggleShowAll() {
119
+ this.isShowAll = !this.isShowAll;
120
+ }
121
+
122
+ get hiddenItemsCount() {
123
+ return this.listToHide.filter((item) => !item.isVisible).length;
124
+ }
125
+
126
+ get listToHide() {
127
+ return this.items.map((item) => {
128
+ return {
129
+ item,
130
+ isVisible: this.isVisible(item)
131
+ }
132
+ });
133
+ }
134
+ }
135
+ </script>
@@ -1,15 +1,25 @@
1
1
  import { storiesOf } from '@storybook/vue';
2
2
  import itfButton from '../button/Button.vue';
3
3
  import itfEditableElement from './EditableElement.vue';
4
+ import itfEditableList from './EditableList.vue';
4
5
 
5
6
  storiesOf('Common', module)
6
7
  .add('Editable element', () => ({
7
8
  components: {
8
9
  itfButton,
9
- itfEditableElement
10
+ itfEditableElement,
11
+ itfEditableList
10
12
  },
11
13
  data() {
12
- return {}
14
+ return {
15
+ items: [
16
+ { name: 'test' },
17
+ { name: 'test 2' },
18
+ { name: 'test 3' },
19
+ { name: 'test 4' },
20
+ { name: 'test 5' },
21
+ ]
22
+ }
13
23
  },
14
24
  template: `<div>
15
25
  <p>You need wrap whole application with this tag</p>
@@ -27,6 +37,15 @@ storiesOf('Common', module)
27
37
 
28
38
  <h3>Example</h3>
29
39
 
40
+ <itf-editable-list :items.sync="items" editable sortable :is-visible="(item) => item.name.includes('4')">
41
+ <template #item="{ item }">
42
+ {{item}}
43
+ </template>
44
+ <template #dropdown>
45
+ asd
46
+ </template>
47
+ </itf-editable-list>
48
+
30
49
  <itf-editable-element>
31
50
  <template v-slot="{ hide }">
32
51