@bimdata/design-system 2.1.0-rc.3 → 2.1.0-rc.5

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": "@bimdata/design-system",
3
- "version": "2.1.0-rc.3",
3
+ "version": "2.1.0-rc.5",
4
4
  "main": "./src/BIMDataComponents/index.js",
5
5
  "module": "./src/BIMDataComponents/index.js",
6
6
  "files": [
@@ -90,6 +90,9 @@ export default {
90
90
  elementKey: {
91
91
  type: String,
92
92
  },
93
+ elementLabelKey: {
94
+ type: String,
95
+ },
93
96
  disabled: {
94
97
  type: Boolean,
95
98
  default: false,
@@ -152,6 +155,13 @@ export default {
152
155
  return this.list;
153
156
  } else {
154
157
  const lowerCaseSearchText = this.searchText.toLowerCase();
158
+ if (this.elementLabelKey) {
159
+ return this.list.filter(element =>
160
+ element[this.elementLabelKey]
161
+ .toLowerCase()
162
+ .includes(lowerCaseSearchText),
163
+ );
164
+ }
155
165
  return this.list.filter(element =>
156
166
  element.toLowerCase().includes(lowerCaseSearchText),
157
167
  );
@@ -31,7 +31,7 @@
31
31
  v-model="searchText"
32
32
  class="m-6"
33
33
  />
34
- <div v-if="filteredOptions.length === 0" class="p-x-6 p-b-6">
34
+ <div v-if="filteredOptions.length === 0">
35
35
  <slot name="empty"></slot>
36
36
  </div>
37
37
  <ul class="bimdata-list m-b-6">
@@ -137,9 +137,26 @@ export default {
137
137
  return this.options;
138
138
  } else {
139
139
  const lowerCaseSearchText = this.searchText.toLowerCase();
140
- return this.options.filter(option =>
141
- option.toLowerCase().includes(lowerCaseSearchText),
142
- );
140
+ if (this.optionLabelKey) {
141
+ return this.options.filter(option =>
142
+ option[this.optionLabelKey]
143
+ .toLowerCase()
144
+ .includes(lowerCaseSearchText),
145
+ );
146
+ }
147
+ if (this.optionKey) {
148
+ return this.options.filter(
149
+ option =>
150
+ option.optionGroup ||
151
+ option[this.optionKey]
152
+ .toLowerCase()
153
+ .includes(lowerCaseSearchText),
154
+ );
155
+ } else {
156
+ return this.options.filter(option =>
157
+ option.toLowerCase().includes(lowerCaseSearchText),
158
+ );
159
+ }
143
160
  }
144
161
  },
145
162
  },
@@ -31,7 +31,7 @@
31
31
  v-model="searchText"
32
32
  class="m-6"
33
33
  />
34
- <div v-if="filteredOptions.length === 0" class="p-x-6 p-b-6">
34
+ <div v-if="filteredOptions.length === 0">
35
35
  <slot name="empty"></slot>
36
36
  </div>
37
37
  <ul class="bimdata-list m-y-6">
@@ -138,9 +138,26 @@ export default {
138
138
  return this.options;
139
139
  } else {
140
140
  const lowerCaseSearchText = this.searchText.toLowerCase();
141
- return this.options.filter(option =>
142
- option.toLowerCase().includes(lowerCaseSearchText),
143
- );
141
+ if (this.optionLabelKey) {
142
+ return this.options.filter(option =>
143
+ option[this.optionLabelKey]
144
+ .toLowerCase()
145
+ .includes(lowerCaseSearchText),
146
+ );
147
+ }
148
+ if (this.optionKey) {
149
+ return this.options.filter(
150
+ option =>
151
+ option.optionGroup ||
152
+ option[this.optionKey]
153
+ .toLowerCase()
154
+ .includes(lowerCaseSearchText),
155
+ );
156
+ } else {
157
+ return this.options.filter(option =>
158
+ option.toLowerCase().includes(lowerCaseSearchText),
159
+ );
160
+ }
144
161
  }
145
162
  },
146
163
  },