@eturnity/eturnity_reusable_components 1.0.31 → 1.0.35

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": "@eturnity/eturnity_reusable_components",
3
- "version": "1.0.31",
3
+ "version": "1.0.35",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -18,7 +18,7 @@
18
18
  <td class="text">Body 3</td>
19
19
  <td class="text">Body 4</td>
20
20
  <div class="icons-container">
21
- <three-dots :options="listOptions" />
21
+ <three-dots :options="listOptions" :isLoading="false" />
22
22
  </div>
23
23
  </tr>
24
24
  </tbody>
@@ -87,7 +87,7 @@ const Container = styled("label", containerAttrs)`
87
87
  &:after {
88
88
  content: "";
89
89
  position: absolute;
90
- display: none;
90
+ display: ${(props) => (props.isChecked ? "block" : "none")};
91
91
  }
92
92
  }
93
93
 
@@ -124,10 +124,6 @@ const InputCheckbox = styled.input`
124
124
  cursor: pointer;
125
125
  height: 0;
126
126
  width: 0;
127
-
128
- &:checked ~ .checkmark:after {
129
- display: block;
130
- }
131
127
  `
132
128
 
133
129
  export default {
@@ -6,23 +6,26 @@
6
6
  <dot-item />
7
7
  </button-container>
8
8
  <dropdown-container v-if="isOpen">
9
+ <loading-container v-if="isLoading">
10
+ <spinner />
11
+ </loading-container>
9
12
  <children-container
10
13
  class="child"
11
14
  :isOpen="hoverItem !== null"
12
- v-if="hoverItem !== null"
15
+ v-if="hoverItem !== null && !isLoading"
13
16
  >
14
17
  <option-child
15
18
  v-for="child in childOpen"
16
19
  :key="child.value"
17
20
  @click.stop="
18
21
  onSelect({
19
- value: child.value,
22
+ item: child,
20
23
  hasChildren: hasChildren(child),
21
24
  })
22
25
  "
23
26
  @keyup.enter.stop="
24
27
  onSelect({
25
- value: child.value,
28
+ item: child,
26
29
  hasChildren: hasChildren(child),
27
30
  })
28
31
  "
@@ -30,16 +33,14 @@
30
33
  {{ child.name }}
31
34
  </option-child>
32
35
  </children-container>
33
- <options-container>
36
+ <options-container v-if="!isLoading">
34
37
  <option-item
35
38
  v-for="(item, index) in options"
36
39
  :key="item.value"
37
40
  tabindex="0"
38
- @click="
39
- onSelect({ value: item.value, hasChildren: hasChildren(item) })
40
- "
41
+ @click="onSelect({ item: item, hasChildren: hasChildren(item) })"
41
42
  @keyup.enter="
42
- onSelect({ value: item.value, hasChildren: hasChildren(item) })
43
+ onSelect({ item: item, hasChildren: hasChildren(item) })
43
44
  "
44
45
  @mouseover="onItemHover({ index, item })"
45
46
  >
@@ -59,6 +60,7 @@
59
60
  // <three-dots
60
61
  // :options="listOptions"
61
62
  // @on-select="onSelect($event)"
63
+ // :isLoading="true"
62
64
  // />
63
65
  // options to pass:
64
66
  // listOptions: [
@@ -109,6 +111,7 @@
109
111
  // ],
110
112
 
111
113
  import styled from "vue-styled-components"
114
+ import Spinner from "../spinner"
112
115
 
113
116
  const PageContainer = styled.div`
114
117
  display: grid;
@@ -149,6 +152,17 @@ const DropdownContainer = styled.div`
149
152
  grid-template-columns: auto auto;
150
153
  `
151
154
 
155
+ const LoadingContainer = styled.div`
156
+ border: 1px solid ${(props) => props.theme.colors.grey3};
157
+ display: grid;
158
+ grid-template-columns: 1fr;
159
+ min-width: 200px;
160
+ height: 200px;
161
+ align-items: center;
162
+ justify-items: center;
163
+ background: #fff;
164
+ `
165
+
152
166
  const OptionsContainer = styled.div`
153
167
  border: 1px solid ${(props) => props.theme.colors.grey3};
154
168
  display: grid;
@@ -159,6 +173,7 @@ const OptionsContainer = styled.div`
159
173
  background-color: #fff;
160
174
  max-height: 220px;
161
175
  overflow: auto;
176
+ height: max-content;
162
177
  `
163
178
 
164
179
  const OptionItem = styled.div`
@@ -216,6 +231,7 @@ const ChildrenContainer = styled("div", childAttrs)`
216
231
  background-color: #fff;
217
232
  margin-right: -1px;
218
233
  height: max-content;
234
+ max-height: 200px;
219
235
  overflow: auto;
220
236
  `
221
237
 
@@ -231,11 +247,17 @@ export default {
231
247
  OptionChild,
232
248
  ArrowLeft,
233
249
  DropdownContainer,
250
+ Spinner,
251
+ LoadingContainer,
234
252
  },
235
253
  props: {
236
254
  options: {
237
255
  required: true,
238
256
  },
257
+ isLoading: {
258
+ required: false,
259
+ default: false,
260
+ },
239
261
  },
240
262
  data() {
241
263
  return {
@@ -262,11 +284,11 @@ export default {
262
284
  this.childOpen =
263
285
  item.children && item.children.length ? item.children : null
264
286
  },
265
- onSelect({ value, hasChildren }) {
287
+ onSelect({ item, hasChildren }) {
266
288
  if (hasChildren) {
267
289
  return
268
290
  }
269
- this.$emit("on-select", value)
291
+ this.$emit("on-select", item)
270
292
  this.isOpen = false
271
293
  },
272
294
  clickOutside(event) {