@bimdata/design-system 2.1.0-rc.2 → 2.1.0-rc.4

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.2",
3
+ "version": "2.1.0-rc.4",
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
  );
@@ -116,7 +116,7 @@ export default {
116
116
  type: String,
117
117
  default: "Search",
118
118
  },
119
- isResetSearch: {
119
+ resetOnLeave: {
120
120
  type: Boolean,
121
121
  default: false,
122
122
  },
@@ -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
  },
@@ -192,7 +209,7 @@ export default {
192
209
  this.$emit("update:modelValue", options);
193
210
  },
194
211
  resetSearch() {
195
- if (this.isResetSearch) {
212
+ if (this.clearSearchOnLeave) {
196
213
  this.searchText = "";
197
214
  }
198
215
  },
@@ -117,7 +117,7 @@ export default {
117
117
  type: String,
118
118
  default: "Search",
119
119
  },
120
- isResetSearch: {
120
+ clearSearchOnLeave: {
121
121
  type: Boolean,
122
122
  default: false,
123
123
  },
@@ -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
  },
@@ -180,7 +197,7 @@ export default {
180
197
  return this.optionKey && option && option.optionGroup;
181
198
  },
182
199
  resetSearch() {
183
- if (this.isResetSearch) {
200
+ if (this.clearSearchOnLeave) {
184
201
  this.searchText = "";
185
202
  }
186
203
  },