@eturnity/eturnity_reusable_components 7.37.5-qa-elisee-7.42.0 → 7.39.0

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.
@@ -1,32 +1,105 @@
1
1
  <template>
2
- <PageContainer>
3
- <BoxContainer>
4
- <SelectedContainer>
5
- {{ numberSelected }} {{ $gettext('selected') }}
6
- </SelectedContainer>
7
- <ListContainer v-if="optionsList.length">
8
- <ListItem
9
- v-for="item in optionsList"
10
- :key="item.type"
11
- :hover-color="item.hoverColor"
12
- @click="$emit('on-' + item.type)"
13
- >
14
- {{ item.name }}
15
- </ListItem>
16
- </ListContainer>
17
- <EmptyText v-if="!optionsList.length">
18
- {{ $gettext('no_batch_actions_available') }}
19
- </EmptyText>
20
- <IconContainer @click="$emit('on-close')">
21
- <Icon
22
- color="white"
23
- cursor="pointer"
24
- name="close_for_modals,_tool_tips"
25
- size="14px"
26
- />
27
- </IconContainer>
28
- </BoxContainer>
29
- </PageContainer>
2
+ <PageWrapper>
3
+ <PageContainer v-if="!expanded">
4
+ <BoxContainer>
5
+ <SelectedContainer>
6
+ {{ numberSelected }} {{ $gettext('selected') }}
7
+ </SelectedContainer>
8
+ <ListContainer v-if="optionsList.length">
9
+ <ListItem
10
+ v-for="item in limitedOptions"
11
+ :key="item.type"
12
+ :disabled="item.disabled || false"
13
+ :hover-color="item.hoverColor"
14
+ @click="$emit('on-' + item.type)"
15
+ >
16
+ {{ item.name }}
17
+ </ListItem>
18
+ <IconContainer @click="expandOptions">
19
+ <ButtonContainer
20
+ v-if="optionsList.length > optionLimit || hasComponent"
21
+ name="more_options,_tool_tips"
22
+ >
23
+ <DotItem />
24
+ <DotItem />
25
+ <DotItem />
26
+ </ButtonContainer>
27
+ </IconContainer>
28
+ </ListContainer>
29
+ <EmptyText v-if="!optionsList.length">
30
+ {{ $gettext('no_batch_actions_available') }}
31
+ </EmptyText>
32
+ <CloseContainer>
33
+ <IconContainer @click="$emit('on-close')">
34
+ <Icon
35
+ color="white"
36
+ cursor="pointer"
37
+ name="close_for_modals,_tool_tips"
38
+ size="14px"
39
+ />
40
+ </IconContainer>
41
+ </CloseContainer>
42
+ </BoxContainer>
43
+ </PageContainer>
44
+ <CenterPageContainer v-else>
45
+ <CenterBox>
46
+ <TitleContainer>
47
+ <BoxTitle> {{ numberSelected }} {{ $gettext('selected') }} </BoxTitle>
48
+ <IconContainer @click="$emit('on-close')">
49
+ <Icon
50
+ color="white"
51
+ cursor="pointer"
52
+ name="close_for_modals,_tool_tips"
53
+ size="14px"
54
+ />
55
+ </IconContainer>
56
+ </TitleContainer>
57
+ <DividerContainer>
58
+ <Divider />
59
+ </DividerContainer>
60
+ <ExpandedList>
61
+ <ExpandedListItem
62
+ v-for="item in expandedOptions"
63
+ :key="item.type"
64
+ :disabled="item.disabled || false"
65
+ :hasComponent="!!item?.component"
66
+ :hover-color="item.hoverColor"
67
+ @click="
68
+ !item?.component && !item.disabled && $emit('on-' + item.type)
69
+ "
70
+ >
71
+ <ListItemWrapper
72
+ v-if="item?.component"
73
+ :hasComponent="!!item?.component"
74
+ @click="!item.disabled && toggleElement(item.type)"
75
+ >
76
+ <ListItemTitle>
77
+ {{ item.name }}
78
+ <InfoText
79
+ v-if="item.disabled && item.disabledInfo"
80
+ :text="item.disabledInfo"
81
+ />
82
+ </ListItemTitle>
83
+ <Icon
84
+ color="white"
85
+ :cursor="item.disabled ? 'not-allowed' : 'pointer'"
86
+ name="arrow_right"
87
+ size="20px"
88
+ />
89
+ </ListItemWrapper>
90
+ <template v-else>
91
+ {{ item.name }}
92
+ </template>
93
+ <OptionsContainer
94
+ v-if="item?.component && item.open && !item.disabled"
95
+ >
96
+ <slot :name="item.component"></slot>
97
+ </OptionsContainer>
98
+ </ExpandedListItem>
99
+ </ExpandedList>
100
+ </CenterBox>
101
+ </CenterPageContainer>
102
+ </PageWrapper>
30
103
  </template>
31
104
 
32
105
  <script>
@@ -37,6 +110,13 @@
37
110
  // name: 'Export'
38
111
  // },
39
112
  // {
113
+ // type: 'export',
114
+ // name: 'Export'
115
+ // ...
116
+ // add component parameter if we were passing a component to the selected options
117
+ // component: 'set_supplier'
118
+ // },
119
+ // {
40
120
  // type: 'delete',
41
121
  // name: 'Delete',
42
122
  // hoverColor: 'red' // default is green
@@ -48,25 +128,84 @@
48
128
  // :optionsList="optionsList"
49
129
  // @on-close="onCloseFunction()"
50
130
  // @on-export="function()" @on-delete="function()"
51
- // />
131
+ // >
132
+ // <template v-slot:set_supplier>
133
+ // <CustomSelectComponent
134
+ // :option-list="suppliers"
135
+ // @set-supplier="checkboxBulkActions('setSupplier', $event)"
136
+ // />
137
+ // </template>
138
+ // </SelectedOptions>
52
139
  import styled from 'vue3-styled-components'
140
+ import InfoText from '../infoText'
53
141
  import Icon from '../icon'
54
142
 
143
+ const PageWrapper = styled.div`
144
+ font-size: 13px;
145
+ `
146
+
147
+ const DividerContainer = styled.div`
148
+ display: contents;
149
+ `
150
+
151
+ const Divider = styled.div`
152
+ border-bottom: 1px solid rgba(255, 255, 255, 0.2);
153
+ width: 95%;
154
+ margin: 0 auto;
155
+ `
156
+
55
157
  const PageContainer = styled.div`
56
158
  position: fixed;
57
159
  bottom: 30px;
58
160
  left: 50%;
161
+ width: auto;
162
+ max-width: 70%;
59
163
  transform: translateX(-50%);
60
164
  `
61
165
 
166
+ const CenterPageContainer = styled.div`
167
+ position: fixed;
168
+ top: 50%;
169
+ left: 50%;
170
+ transform: translate(-50%, -50%);
171
+ border-radius: 4px;
172
+ background-color: rgba(0, 0, 0, 0.4);
173
+ `
174
+
175
+ const OptionsContainer = styled.div`
176
+ position: fixed;
177
+ right: -252px;
178
+ background-color: ${(props) => props.theme.colors.black};
179
+ border-radius: 4px;
180
+ padding: 15px;
181
+ `
182
+
62
183
  const SelectedContainer = styled.div`
63
184
  display: grid;
64
185
  align-items: center;
65
186
  height: 100%;
66
187
  padding-right: 20px;
188
+ white-space: nowrap;
67
189
  border-right: 1px solid rgba(255, 255, 255, 0.2);
68
190
  `
69
191
 
192
+ const TitleContainer = styled.div`
193
+ display: flex;
194
+ align-items: center;
195
+ justify-content: space-between;
196
+ width: 100%;
197
+ padding: 16px;
198
+ `
199
+
200
+ const BoxTitle = styled.div`
201
+ font-size: 13px;
202
+ color: ${(props) => props.theme.colors.white};
203
+ transform: translateZ(0);
204
+ backface-visibility: hidden;
205
+ -webkit-font-smoothing: antialiased;
206
+ -moz-osx-font-smoothing: grayscale;
207
+ `
208
+
70
209
  const BoxContainer = styled.div`
71
210
  display: flex;
72
211
  align-items: center;
@@ -74,28 +213,75 @@
74
213
  opacity: 90%;
75
214
  color: ${(props) => props.theme.colors.white};
76
215
  border-radius: 4px;
77
- padding: 8px 10px 8px 20px;
78
- font-size: 14px;
79
- height: 40px;
216
+ padding: 0px 10px 0px 20px;
217
+ font-size: 13px;
218
+ height: 45px;
219
+ `
220
+
221
+ const CenterBox = styled(BoxContainer)`
222
+ justify-content: center;
223
+ flex-direction: column;
224
+ height: auto;
225
+ align-items: flex-start;
226
+ border-radius: 4px;
227
+ width: 400px;
228
+ padding: 0px;
229
+ `
230
+
231
+ const ButtonContainer = styled.div`
232
+ display: flex;
233
+ flex-direction: row;
234
+ align-items: center;
235
+ justify-content: center;
236
+ padding: 5px;
237
+ cursor: pointer;
238
+
239
+ div {
240
+ // This is the dot color
241
+ background: ${(props) => props.theme.colors.white};
242
+ }
243
+ `
244
+
245
+ const CloseContainer = styled.div`
246
+ margin-left: 20px;
247
+ `
248
+
249
+ const DotItem = styled.div`
250
+ width: 4px;
251
+ height: 4px;
252
+ margin: 1px;
253
+ border-radius: 50%;
80
254
  `
81
255
 
82
256
  const ListContainer = styled.div`
83
- padding: 0 20px;
257
+ height: 100%;
84
258
  display: flex;
85
- gap: 20px;
259
+ align-items: center;
86
260
  color: ${(props) => props.theme.colors.white};
87
261
  `
88
262
 
89
263
  const ListAttrs = {
264
+ disabled: Boolean,
90
265
  hoverColor: String,
91
266
  }
267
+
92
268
  const ListItem = styled('div', ListAttrs)`
93
- cursor: pointer;
269
+ width: max-content;
270
+ height: 100%;
271
+ display: flex;
272
+ align-items: center;
273
+ padding: 0 10px;
274
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
275
+ color: ${(props) => props.disabled && props.theme.colors.grey3};
276
+
94
277
  &:hover {
278
+ background: rgba(255, 255, 255, 0.1);
95
279
  color: ${(props) =>
96
- props.hoverColor
280
+ props.disabled
281
+ ? props.theme.colors.grey3
282
+ : props.hoverColor
97
283
  ? props.theme.colors[props.hoverColor]
98
- : props.theme.colors.green};
284
+ : props.theme.colors.white};
99
285
  }
100
286
  `
101
287
 
@@ -106,7 +292,7 @@
106
292
  height: 30px;
107
293
  width: 30px;
108
294
  cursor: pointer;
109
- margin-left: 20px;
295
+ margin-left: 8px;
110
296
 
111
297
  &:hover {
112
298
  background: rgba(255, 255, 255, 0.1);
@@ -114,6 +300,46 @@
114
300
  }
115
301
  `
116
302
 
303
+ const ExpandedList = styled.div`
304
+ width: 100%;
305
+ display: flex;
306
+ flex-direction: column;
307
+ `
308
+
309
+ const ExpandedListItem = styled('div', {
310
+ disabled: Boolean,
311
+ hoverColor: String,
312
+ hasComponent: Boolean,
313
+ })`
314
+ width: 100%;
315
+ display: flex;
316
+ justify-content: space-between;
317
+ align-items: center;
318
+ padding: ${(props) => (props.hasComponent ? '0' : '13px 15px')};
319
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
320
+ color: ${(props) => props.disabled && props.theme.colors.grey3};
321
+
322
+ &:hover {
323
+ background: rgba(255, 255, 255, 0.1);
324
+ color: ${(props) =>
325
+ props.disabled ? props.theme.colors.grey3 : props.theme.colors.white};
326
+ }
327
+ `
328
+
329
+ const ListItemWrapper = styled('div', { hasComponent: Boolean })`
330
+ width: 100%;
331
+ display: flex;
332
+ align-items: center;
333
+ justify-content: space-between;
334
+ padding: ${(props) => (props.hasComponent ? '13px 15px' : '0')};
335
+ `
336
+
337
+ const ListItemTitle = styled.div`
338
+ display: flex;
339
+ align-items: center;
340
+ gap: 10px;
341
+ `
342
+
117
343
  const EmptyText = styled.div`
118
344
  color: ${(props) => props.theme.colors.white};
119
345
  font-size: 13px;
@@ -127,19 +353,98 @@
127
353
  BoxContainer,
128
354
  SelectedContainer,
129
355
  ListContainer,
356
+ ButtonContainer,
357
+ DotItem,
130
358
  ListItem,
359
+ InfoText,
360
+ CenterBox,
131
361
  Icon,
362
+ CenterPageContainer,
363
+ ListItemWrapper,
364
+ ListItemTitle,
365
+ PageWrapper,
366
+ OptionsContainer,
367
+ ExpandedListItem,
368
+ TitleContainer,
132
369
  IconContainer,
133
370
  EmptyText,
371
+ BoxTitle,
372
+ Divider,
373
+ DividerContainer,
374
+ ExpandedList,
375
+ CloseContainer,
134
376
  },
135
377
  props: {
136
378
  optionsList: {
379
+ type: Array,
137
380
  required: true,
138
381
  },
139
382
  numberSelected: {
383
+ type: Number,
140
384
  required: true,
141
385
  default: 0,
142
386
  },
143
387
  },
388
+ data() {
389
+ return {
390
+ //maximum number of options to display, if more than 4, display a 'more' option
391
+ optionLimit: 4,
392
+ showOverlay: false,
393
+ expanded: false,
394
+ expandedOptions: [],
395
+ }
396
+ },
397
+ computed: {
398
+ hasComponent() {
399
+ return this.optionsList.some((item) => item.component)
400
+ },
401
+ limitedOptions() {
402
+ return this.expandedOptions.filter((option) => !option.component)
403
+ },
404
+ },
405
+ watch: {
406
+ optionsList() {
407
+ this.initializeOptions()
408
+ },
409
+ },
410
+ mounted() {
411
+ this.initializeOptions()
412
+ },
413
+ methods: {
414
+ initializeOptions() {
415
+ this.expandedOptions = [...this.optionsList]
416
+ .map((option, index) => {
417
+ const currentOption = this.expandedOptions[index]
418
+ const isOpen = !!currentOption ? currentOption.open : false
419
+
420
+ return { ...option, open: isOpen }
421
+ })
422
+ .slice(0, this.optionLimit)
423
+ },
424
+ toggleElement(type) {
425
+ this.expandedOptions = this.optionsList.map((item) => {
426
+ if (item.type === type) {
427
+ item.open = !item.open
428
+ } else item.open = false
429
+
430
+ return item
431
+ })
432
+ },
433
+ expandOptions() {
434
+ this.expanded = !this.expanded
435
+ this.expandedOptions = this.optionsList
436
+ },
437
+ handleExpandedOptionClick(item) {
438
+ if (item.disabled) return
439
+
440
+ if (!item.component) {
441
+ this.$emit('on-' + item.type)
442
+
443
+ return
444
+ }
445
+
446
+ this.toggleElement(item.type)
447
+ },
448
+ },
144
449
  }
145
450
  </script>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" fill="#333" viewBox="0 0 29 29"><path d="m10.5 14 4-8 4 8z"/><path class='fix' fill="#ccc" d="m10.5 16 4 8 4-8z"/></svg>
@@ -1,6 +0,0 @@
1
- <svg fill="#000000" height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
2
- viewBox="0 0 512 512" xml:space="preserve">
3
- <path d="M256,0C114.617,0,0,114.615,0,256s114.617,256,256,256s256-114.615,256-256S397.383,0,256,0z M224,320
4
- c0,8.836-7.164,16-16,16h-32c-8.836,0-16-7.164-16-16V192c0-8.836,7.164-16,16-16h32c8.836,0,16,7.164,16,16V320z M352,320
5
- c0,8.836-7.164,16-16,16h-32c-8.836,0-16-7.164-16-16V192c0-8.836,7.164-16,16-16h32c8.836,0,16,7.164,16,16V320z"/>
6
- </svg>