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

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.1",
3
+ "version": "2.1.0-rc.3",
4
4
  "main": "./src/BIMDataComponents/index.js",
5
5
  "module": "./src/BIMDataComponents/index.js",
6
6
  "files": [
@@ -26,24 +26,40 @@
26
26
  <slot name="contentAfterBtn" :isOpen="displayed"></slot>
27
27
  </div>
28
28
  <transition :name="`slide-fade-${transitionName}`">
29
- <BIMDataPaginatedList
30
- :class="`submenu submenu--${directionClass}`"
31
- v-show="displayed"
32
- :list="list"
33
- :perPage="perPage"
34
- :elementKey="elementKey"
35
- @element-click="onElementClick"
36
- :loading="loading"
37
- >
38
- <template #element="{ element }">
39
- <slot
40
- name="element"
41
- :element="element"
42
- :close="away"
43
- :isOpen="displayed"
44
- ></slot>
45
- </template>
46
- </BIMDataPaginatedList>
29
+ <div>
30
+ <BIMDataPaginatedList
31
+ :class="`submenu submenu--${directionClass}`"
32
+ v-show="displayed"
33
+ :list="filteredList"
34
+ :perPage="perPage"
35
+ :elementKey="elementKey"
36
+ @element-click="onElementClick"
37
+ :loading="loading"
38
+ >
39
+ <template #header>
40
+ <BIMDataSearch
41
+ v-if="search"
42
+ width="calc(100% - 12px)"
43
+ color="primary"
44
+ radius
45
+ :placeholder="searchPlaceholder"
46
+ v-model="searchText"
47
+ class="m-6"
48
+ />
49
+ <div v-if="filteredList.length === 0" class="p-x-6 p-b-6">
50
+ <slot name="empty"></slot>
51
+ </div>
52
+ </template>
53
+ <template #element="{ element }">
54
+ <slot
55
+ name="element"
56
+ :element="element"
57
+ :close="away"
58
+ :isOpen="displayed"
59
+ ></slot>
60
+ </template>
61
+ </BIMDataPaginatedList>
62
+ </div>
47
63
  </transition>
48
64
  </div>
49
65
  </template>
@@ -105,11 +121,20 @@ export default {
105
121
  type: String,
106
122
  default: "36px",
107
123
  },
124
+ search: {
125
+ type: Boolean,
126
+ default: false,
127
+ },
128
+ searchPlaceholder: {
129
+ type: String,
130
+ default: "Search",
131
+ },
108
132
  },
109
133
  emits: ["element-click"],
110
134
  data() {
111
135
  return {
112
136
  displayed: false,
137
+ searchText: "",
113
138
  };
114
139
  },
115
140
  computed: {
@@ -122,6 +147,16 @@ export default {
122
147
  iconRotation() {
123
148
  return this.displayed ? (this.directionClass === "up" ? -90 : 90) : 0;
124
149
  },
150
+ filteredList() {
151
+ if (this.searchText === "") {
152
+ return this.list;
153
+ } else {
154
+ const lowerCaseSearchText = this.searchText.toLowerCase();
155
+ return this.list.filter(element =>
156
+ element.toLowerCase().includes(lowerCaseSearchText),
157
+ );
158
+ }
159
+ },
125
160
  },
126
161
  methods: {
127
162
  onHeaderClick() {
@@ -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
  },
@@ -192,7 +192,7 @@ export default {
192
192
  this.$emit("update:modelValue", options);
193
193
  },
194
194
  resetSearch() {
195
- if (this.isResetSearch) {
195
+ if (this.clearSearchOnLeave) {
196
196
  this.searchText = "";
197
197
  }
198
198
  },
@@ -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
  },
@@ -180,7 +180,7 @@ export default {
180
180
  return this.optionKey && option && option.optionGroup;
181
181
  },
182
182
  resetSearch() {
183
- if (this.isResetSearch) {
183
+ if (this.clearSearchOnLeave) {
184
184
  this.searchText = "";
185
185
  }
186
186
  },