@itfin/components 1.0.110 → 1.0.113

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.0.110",
3
+ "version": "1.0.113",
4
4
  "main": "dist/itfin-components.umd.js",
5
5
  "unpkg": "dist/itfin-components.common.js",
6
6
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
package/src/.DS_Store ADDED
Binary file
@@ -60,7 +60,7 @@ $font-size: 1em;
60
60
  }
61
61
  }
62
62
  // Single, when searching but not loading or open
63
- .vs--single.vs--searching:not(.vs--open):not(.vs--loading) {
63
+ .vs--single.vs--searching:not(.vs--open):not(.vs--combobox):not(.vs--loading) {
64
64
  .vs__search {
65
65
  opacity: .2;
66
66
  }
Binary file
@@ -116,7 +116,7 @@ class itfDatePicker extends Vue {
116
116
  @Prop({ type: String, default: '' }) placeholder;
117
117
  @Prop({ type: String, default: '' }) prependIcon;
118
118
  @Prop({ type: String, default: 'bottom-start' }) placement;
119
- @Prop({ type: [String, Date], default: null }) minDate;
119
+ @Prop({ type: [String, Date], default: '' }) minDate;
120
120
  @Prop(Boolean) clearable;
121
121
 
122
122
  focused = false;
@@ -78,7 +78,7 @@ class itfDatePickerInline extends Vue {
78
78
  @Prop({ type: Boolean, default: false }) onlyCalendar;
79
79
  @Prop({ type: Boolean, default: false }) range;
80
80
  @Prop({ type: Object, default: () => ({}) }) customDays;
81
- @Prop({ type: [String, Date], default: null }) minDate;
81
+ @Prop({ type: [String, Date], default: '' }) minDate;
82
82
  @Prop({
83
83
  type: Array,
84
84
  default: () => ([
@@ -88,7 +88,7 @@
88
88
  </div>
89
89
  <transition :name="transition">
90
90
  <ul
91
- v-if="dropdownOpen"
91
+ v-if="dropdownWindowOpen"
92
92
  :id="`vs${uid}__listbox`"
93
93
  ref="dropdownMenu"
94
94
  :key="`vs${uid}__listbox`"
@@ -231,9 +231,7 @@ import itfButton from '../button/Button';
231
231
  import appendToBody from '../../directives/appendToBody';
232
232
  import sortAndStringify from '../../helpers/sortAndStringify';
233
233
  import uniqueId from '../../helpers/uniqueId';
234
- /**
235
- * @name VueSelect
236
- */
234
+
237
235
  export default {
238
236
  components: {
239
237
  itfButton,
@@ -242,6 +240,10 @@ export default {
242
240
  directives: { appendToBody },
243
241
  mixins: [pointerScroll, typeAheadPointer, ajax],
244
242
  props: {
243
+ query: {
244
+ type: String,
245
+ default: ''
246
+ },
245
247
  /**
246
248
  * Contains the currently selected value. Very similar to a
247
249
  * `value` attribute on an <input>. You can listen for changes
@@ -579,7 +581,10 @@ export default {
579
581
  */
580
582
  clearSearchOnBlur: {
581
583
  type: Function,
582
- default: function ({ clearSearchOnSelect, multiple }) {
584
+ default: function ({ clearSearchOnSelect, multiple, combobox }) {
585
+ if (combobox) {
586
+ return false;
587
+ }
583
588
  return clearSearchOnSelect && !multiple
584
589
  },
585
590
  },
@@ -627,6 +632,10 @@ export default {
627
632
  type: Boolean,
628
633
  default: false,
629
634
  },
635
+ combobox: {
636
+ type: Boolean,
637
+ default: false,
638
+ },
630
639
  /**
631
640
  * Keycodes that will select the current option.
632
641
  * @type Array
@@ -708,7 +717,7 @@ export default {
708
717
  */
709
718
  dropdownShouldOpen: {
710
719
  type: Function,
711
- default({ noDrop, open, mutableLoading }) {
720
+ default({ noDrop, open, mutableLoading, combobox, options }) {
712
721
  return noDrop ? false : open;// && !mutableLoading
713
722
  },
714
723
  },
@@ -723,7 +732,7 @@ export default {
723
732
  },
724
733
  data() {
725
734
  return {
726
- search: '',
735
+ searchString: '',
727
736
  open: false,
728
737
  isComposing: false,
729
738
  pushedTags: [],
@@ -733,6 +742,15 @@ export default {
733
742
  },
734
743
  inject: { itemLabel: { default: null } },
735
744
  computed: {
745
+ search: {
746
+ get() {
747
+ return this.query || this.searchString;
748
+ },
749
+ set(val) {
750
+ this.searchString = val;
751
+ this.$emit('update:query', val);
752
+ }
753
+ },
736
754
  /**
737
755
  * Determine if the component needs to
738
756
  * track the state of values internally.
@@ -848,6 +866,7 @@ export default {
848
866
  */
849
867
  stateClasses() {
850
868
  return {
869
+ 'vs--combobox': this.combobox,
851
870
  'vs--open': this.dropdownOpen,
852
871
  'vs--single': !this.multiple,
853
872
  'vs--multiple': this.multiple,
@@ -874,6 +893,17 @@ export default {
874
893
  dropdownOpen() {
875
894
  return this.opened || this.dropdownShouldOpen(this);
876
895
  },
896
+ /**
897
+ * Return the current state of the
898
+ * dropdown menu window
899
+ * @return {Boolean} True if open
900
+ */
901
+ dropdownWindowOpen() {
902
+ if (this.combobox && !this.options.length) {
903
+ return false;
904
+ }
905
+ return this.dropdownOpen;
906
+ },
877
907
  /**
878
908
  * Return the placeholder string if it's set
879
909
  * & there is no value selected.
@@ -959,6 +989,9 @@ export default {
959
989
  if (this.isTrackingValues) {
960
990
  this.setInternalValueFromOptions(val)
961
991
  }
992
+ if (this.combobox) {
993
+ this.searchString = this.findOptionFromReducedValue(val) || '';
994
+ }
962
995
  },
963
996
  },
964
997
  /**
@@ -998,7 +1031,7 @@ export default {
998
1031
  this.findOptionFromReducedValue(val)
999
1032
  )
1000
1033
  } else {
1001
- this.$data._value = this.findOptionFromReducedValue(value)
1034
+ this.$data._value = this.findOptionFromReducedValue(value);
1002
1035
  }
1003
1036
  },
1004
1037
  /**
@@ -1057,8 +1090,8 @@ export default {
1057
1090
  this.open = !this.open
1058
1091
  this.searchEl.blur()
1059
1092
  }
1060
- if (this.clearSearchOnSelect) {
1061
- this.search = ''
1093
+ if (this.clearSearchOnSelect && !this.combobox) {
1094
+ this.search = '';
1062
1095
  }
1063
1096
  },
1064
1097
  /**
@@ -32,7 +32,7 @@
32
32
  margin-right: 0;
33
33
  padding-bottom: calc(var(--itf-tabs-tab-padding) * 3);
34
34
 
35
- .itf-tab {
35
+ & > .itf-tab {
36
36
  padding: var(--itf-tabs-tab-padding) 10px 0;
37
37
  width: calc(100% - 2px);
38
38
  margin-bottom: calc(var(--itf-tabs-tab-padding) * 1.5);
@@ -79,7 +79,7 @@
79
79
  }
80
80
  }
81
81
  }
82
- .itf-tabs-content {
82
+ & > .itf-tabs-content {
83
83
  flex-grow: 1;
84
84
  z-index: 1;
85
85
  margin-right: -1px;
@@ -97,7 +97,7 @@
97
97
  justify-content: start;
98
98
  flex-wrap: wrap;
99
99
 
100
- .itf-tab {
100
+ & > .itf-tab {
101
101
  white-space: nowrap;
102
102
  display: block;
103
103
  //float: right;
@@ -170,7 +170,7 @@
170
170
  }
171
171
  }
172
172
  .itf-tabs-content {
173
- .itf-tab-content {
173
+ & > .itf-tab-content {
174
174
  height: 100%;
175
175
 
176
176
  &.filled {
@@ -21,7 +21,7 @@ class ValidatableMixin extends Vue {
21
21
  @Prop({ type: [String, Array], default: () => [] }) errorMessages;
22
22
  @Prop({ type: [String, Array], default: () => [] }) successMessages;
23
23
  @Prop({ type: [String, Array], default: () => [] }) messages;
24
- @Prop({ type: Array, default: () => [] }) rules;
24
+ @Prop({ type: Array, default: () => [], validator: (value) => Array.isArray(value) }) rules;
25
25
  @Prop({ required: false }) value;
26
26
 
27
27
  errorBucket = [];