@itfin/components 1.2.87 → 1.2.89

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <itf-popover :visible.sync="value" ref="popover" :trigger="trigger" custom-class="nopadding" :placement="placement">
2
+ <itf-popover :visible.sync="isVisible" ref="popover" :trigger="trigger" custom-class="nopadding" :placement="placement">
3
3
  <template #activator="{ on }">
4
4
  <slot name="activator" :on="on"></slot>
5
5
  </template>
@@ -27,12 +27,12 @@
27
27
  </itf-button>
28
28
  </div>
29
29
 
30
- <div class="itf-select-popover__scroll text-start">
30
+ <div v-if="isVisible" class="itf-select-popover__scroll text-start">
31
31
  <template v-if="!search && recentIcons.length">
32
32
  <div class="py-1 text-muted">Recent</div>
33
33
  <div class="d-flex align-items-start flex-wrap flex-grow-0">
34
34
  <itf-button v-for="icon of recentIcons" :key="icon" icon v-tooltip="icon" @click="onSelectIcon(icon)">
35
- <itf-icon :name="icon" />
35
+ <itf-mdi-icon :name="icon" />
36
36
  </itf-button>
37
37
  </div>
38
38
 
@@ -40,7 +40,7 @@
40
40
  </template>
41
41
  <div class="d-flex align-items-start flex-wrap flex-grow-0">
42
42
  <itf-button v-for="icon of iconsList" :key="icon" icon v-tooltip="icon" @click="onSelectIcon(icon)">
43
- <itf-icon :name="icon" />
43
+ <itf-mdi-icon>{{ icon }}</itf-mdi-icon>
44
44
  </itf-button>
45
45
  </div>
46
46
  <div v-if="!iconsList.length" class="text-muted pt-1">
@@ -70,9 +70,10 @@
70
70
  }
71
71
  </style>
72
72
  <script>
73
- import { Vue, Component, Prop, PropSync } from 'vue-property-decorator';
73
+ import { Vue, Component, Model, Prop, PropSync } from 'vue-property-decorator';
74
74
  import itfPopover from './Popover';
75
75
  import itfIcon from '../icon/Icon';
76
+ import itfMdiIcon from '../icon/MdiIcon';
76
77
  import iconsList from '../icon/icons';
77
78
  import itfButton from '../button/Button';
78
79
  import itfTextField from '../text-field/TextField.vue';
@@ -81,33 +82,38 @@ import tooltip from '../../directives/tooltip';
81
82
  const RECENT_ITEMS_KEY = 'itfSelectPopoverRecent';
82
83
 
83
84
  export default @Component({
84
- name: 'itfSelectPopover',
85
+ name: 'itfIconPopover',
85
86
  directives: {
86
87
  tooltip
87
88
  },
88
89
  components: {
89
90
  itfIcon,
91
+ itfMdiIcon,
90
92
  itfPopover,
91
93
  itfButton,
92
94
  itfTextField
93
95
  },
94
96
  })
95
- class itfSelectPopover extends Vue {
96
- @PropSync('visible') value;
97
+ class itfIconPopover extends Vue {
98
+ @Model('input') value;
97
99
  @Prop({ type: String, default: '' }) title;
98
100
  @Prop({ type: Boolean, default: '' }) removable;
99
101
  @Prop({ type: String, default: 'bottom', validator: (value) => ['bottom', 'left', 'right', 'top'].includes(value) }) placement;
100
102
  @Prop({ type: String, default: 'click', validator: (value) => ['click', 'focus', 'hover', 'manual'].includes(value) }) trigger;
101
103
 
104
+ isVisible = false;
102
105
  search = '';
106
+ icons = [];
103
107
  recentIcons = [];
104
108
 
105
- created() {
109
+ async created() {
106
110
  this.recentIcons = this.getRecentIcons();
111
+ this.icons = await import('@mdi/js');
107
112
  }
108
113
 
109
114
  get iconsList() {
110
- return Object.keys(iconsList).filter((icon) => icon.includes(this.search.toLowerCase()));
115
+ // from cames case
116
+ return Object.keys(this.icons).map(key => key.replace(/([A-Z])/g, '-$1').toLowerCase()).filter((icon) => icon.includes(this.search.toLowerCase()));
111
117
  }
112
118
 
113
119
  onSelectIcon(icon) {
@@ -82,7 +82,7 @@
82
82
  </slot>
83
83
 
84
84
  <slot name="spinner" v-bind="scope.spinner">
85
- <div v-show="mutableLoading" class="itf-spinner itf-select__loader">Loading...</div>
85
+ <div v-show="mutableLoading" class="itf-spinner itf-select__loader">{{ $t('components.select.loading') }}</div>
86
86
  </slot>
87
87
  </div>
88
88
  </div>
@@ -127,7 +127,7 @@
127
127
  </li>
128
128
  <li v-if="filteredOptions.length === 0" class="vs__no-options text-muted">
129
129
  <slot name="no-options" v-bind="scope.noOptions"
130
- ><span v-if="!mutableLoading">Sorry, no matching options.</span></slot
130
+ ><span v-if="!mutableLoading">{{ $t('components.select.noOptions') }}</span></slot
131
131
  >
132
132
  </li>
133
133
  <slot name="list-footer" v-bind="scope.listFooter" />
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="itf-money-field">
2
+ <div class="itf-money-field" :class="{'currency-arrow': !currencyDisabled}">
3
3
  <div :style="`--itf-money-field-padding-left: ${selectedCurrencySymbol.length * 0.6 + 1}rem`">
4
4
  <span class="itf-money-field__prepend">{{ selectedCurrencySymbol }}</span>
5
5
  <itf-text-field
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
 
14
14
  <div v-if="currencySelect" class="itf-money-field__currency">
15
- <span>{{ selectedCurrencyCode }}</span>
15
+ <span>{{ selectedCurrencyCode }}<itf-icon v-if="!currencyDisabled" name="chevron_down" /></span>
16
16
  <select v-if="!disabled && !currencyDisabled" :value="currencyId" @input="onCurrencyChanged">
17
17
  <option v-for="currency in currencies" :key="currency.Id" :value="currency.Id" :selected="currencyId === currency.Id">
18
18
  {{ currency.Symbol }}, {{ currency.Code }} - {{ currency.Title }}
@@ -33,6 +33,11 @@
33
33
  padding-right: 4rem;
34
34
  }
35
35
  }
36
+ &.currency-arrow {
37
+ .itf-text-field input {
38
+ padding-right: 4.5rem;
39
+ }
40
+ }
36
41
 
37
42
  &__prepend {
38
43
  z-index: 6;
@@ -64,10 +69,12 @@ import { Component, Emit, Model, Prop, Vue } from 'vue-property-decorator';
64
69
  import itfTextField from './TextField';
65
70
  import itfSelect from '../select/Select';
66
71
  import itfLabel from '../form/Label';
72
+ import itfIcon from '../icon/Icon';
67
73
 
68
74
  export default @Component({
69
75
  name: 'itfMoneyField',
70
76
  components: {
77
+ itfIcon,
71
78
  itfLabel,
72
79
  itfSelect,
73
80
  itfTextField
@@ -33,6 +33,9 @@ export function parseHours (str, { hoursInDay } = { hoursInDay: 8 }) {
33
33
  }
34
34
 
35
35
  export function formatDate (date, inputFormat = 'yyyy-MM-dd', toFormat) {
36
+ if (!date) {
37
+ return date;
38
+ }
36
39
  return DateTime.fromFormat(date, inputFormat).toFormat(toFormat || ITFSettings.defaultDisplayDateFormat);
37
40
  }
38
41
 
package/src/locales/en.js CHANGED
@@ -57,6 +57,10 @@ module.exports = {
57
57
  close: 'Close',
58
58
  wholeYear: 'Whole year',
59
59
 
60
+ select: {
61
+ loading: 'Loading...',
62
+ noOptions: 'Select an option or create a new one',
63
+ },
60
64
  modal: {
61
65
  delete: 'Delete',
62
66
  cancel: 'Cancel',
@@ -83,5 +87,9 @@ module.exports = {
83
87
  areYouSureYouWantToDeleteThisField: 'Are you sure you want to delete this property?',
84
88
  customizePage: 'Customize page',
85
89
  type: 'Type',
90
+ options: 'Options',
91
+ addOption: 'Add an option',
92
+ showMoreProperties: '{n} more property|{n} more properties',
93
+ hideMoreProperties: 'Hide {n} property|Hide {n} properties',
86
94
  }
87
95
  };