@eturnity/eturnity_reusable_components 7.35.1-EPDM-11386.0 → 7.35.1-EPDM-10620.1

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": "7.35.1-EPDM-11386.0",
3
+ "version": "7.35.1-EPDM-10620.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
package/src/App.vue CHANGED
@@ -1,10 +1,13 @@
1
1
  <template>
2
- <ThemeProvider :style="{ height: '100%' }" :theme="getTheme()" />
2
+ <ThemeProvider :style="{ height: '100%' }" :theme="getTheme()">
3
+ <RouterView />
4
+ </ThemeProvider>
3
5
  </template>
4
6
 
5
7
  <script>
6
8
  import { ThemeProvider } from 'vue3-styled-components'
7
9
  import theme from './assets/theme'
10
+
8
11
  export default {
9
12
  name: 'App',
10
13
  components: {
@@ -0,0 +1,6 @@
1
+ <svg width="16" height="16" viewBox="12 12 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M20 13L27 16.8175L26.0477 18.4379L20 15.1397L13.9523 18.4379L13 16.8175L20 13Z" fill="#263238"/>
3
+ <path d="M17.1006 19.1906L20.0001 17.6078L22.8996 19.1906" stroke="#263238" stroke-width="2"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M20 21.5621L22.6508 23.0078L21.6985 24.6282L20 23.7019L18.3015 24.6282L17.3492 23.0078L20 21.5621ZM16.1269 25.8141L13.9523 27L13 25.3797L15.1746 24.1937L16.1269 25.8141ZM26.0477 27L23.8731 25.8141L24.8254 24.1937L27 25.3797L26.0477 27Z" fill="#263238"/>
5
+ <path d="M20.9662 22.9146H19.0332L19.0332 18.2928H20.9662L20.9662 22.9146Z" fill="#263238"/>
6
+ </svg>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <svg width="800px" height="800px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
4
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
+ <g id="copy" fill="none" transform="translate(85.333333, 42.666667)">
6
+ <path d="M341.333333,85.3333333 L341.333333,405.333333 L85.3333333,405.333333 L85.3333333,85.3333333 L341.333333,85.3333333 Z M298.666667,128 L128,128 L128,362.666667 L298.666667,362.666667 L298.666667,128 Z M234.666667,7.10542736e-15 L234.666667,42.6666667 L42.6666667,42.6666667 L42.6666667,298.666667 L1.42108547e-14,298.666667 L1.42108547e-14,7.10542736e-15 L234.666667,7.10542736e-15 Z">
7
+ </path>
8
+ </g>
9
+ </g>
10
+ </svg>
@@ -35,9 +35,6 @@ const theme = {
35
35
  tablet: '768px',
36
36
  tabletLarge: '950px',
37
37
  },
38
- fonts: {
39
- mainFont: '"Figtree", sans-serif',
40
- },
41
38
  borderRadius: '4px',
42
39
  }
43
40
 
@@ -87,7 +87,10 @@
87
87
  :key="index + '_field'"
88
88
  >
89
89
  <SelectComponent
90
- v-if="isMultipleSelector(filter.filter_type)"
90
+ v-if="
91
+ isMultipleSelector(filter.filter_type) ||
92
+ isSingleSelector(filter.filter_type)
93
+ "
91
94
  align-items="vertical"
92
95
  :disabled="!filter.choices.length"
93
96
  font-size="13px"
@@ -102,16 +105,12 @@
102
105
  <OptionTitle> {{ filter.selectedText }} </OptionTitle>
103
106
  </template>
104
107
  <template #dropdown>
105
- <DropdownCheckboxContainer
106
- v-for="(filterOption, optionIdx) in filter.choices"
107
- :key="optionIdx + 'optionIdx'"
108
- @click.stop
109
- >
110
- <Checkbox
111
- :is-checked="filterOption.selected"
112
- :label="filterOption.text"
113
- size="small"
114
- @on-event-handler="
108
+ <template v-if="isSingleSelector(filter.filter_type)">
109
+ <Option
110
+ v-for="(filterOption, optionIdx) in filter.choices"
111
+ :key="optionIdx + 'optionIdx'"
112
+ :value="filterOption.text"
113
+ @click="
115
114
  onChange({
116
115
  dataType: item.type,
117
116
  value: $event,
@@ -119,8 +118,31 @@
119
118
  field: filter.field,
120
119
  })
121
120
  "
122
- />
123
- </DropdownCheckboxContainer>
121
+ >
122
+ {{ filterOption.text }}
123
+ </Option>
124
+ </template>
125
+ <template v-else>
126
+ <DropdownCheckboxContainer
127
+ v-for="(filterOption, optionIdx) in filter.choices"
128
+ :key="optionIdx + 'optionIdx'"
129
+ @click.stop
130
+ >
131
+ <Checkbox
132
+ :is-checked="filterOption.selected"
133
+ :label="filterOption.text"
134
+ size="small"
135
+ @on-event-handler="
136
+ onChange({
137
+ dataType: item.type,
138
+ value: $event,
139
+ choice: filterOption.choice,
140
+ field: filter.field,
141
+ })
142
+ "
143
+ />
144
+ </DropdownCheckboxContainer>
145
+ </template>
124
146
  </template>
125
147
  </SelectComponent>
126
148
  <SectionContainer v-else-if="isRangeSelector(filter.filter_type)">
@@ -305,25 +327,29 @@
305
327
  const ContainerWrapper = styled.div`
306
328
  position: absolute;
307
329
  margin-top: 4px;
330
+ max-height: 70vh;
331
+ overflow-y: auto;
308
332
  background-color: ${(props) => props.theme.colors.white};
309
333
  min-width: 100%;
310
334
  width: max-content;
311
335
  border: 1px solid ${(props) => props.theme.colors.grey4};
312
336
  border-radius: 4px;
313
- z-index: 99999;
337
+ z-index: 1;
314
338
  font-size: 13px;
315
339
  `
316
340
 
317
341
  const ColAttrs = { numCols: Number, hasActiveView: Boolean }
318
342
  const ColumnWrapper = styled('div', ColAttrs)`
319
343
  display: grid;
344
+ max-height: 50vh;
345
+ overflow-y: auto;
320
346
  grid-template-columns: repeat(${(props) => props.numCols}, auto);
321
347
 
322
348
  ${({ hasActiveView, theme }) =>
323
349
  hasActiveView &&
324
350
  `
325
- border-top: 1px solid ${theme.colors.grey4};
326
- `}
351
+ border-top: 1px solid ${theme.colors.grey4};
352
+ `}
327
353
  `
328
354
 
329
355
  const TitleAttrs = { showBorder: Boolean }
@@ -335,8 +361,8 @@
335
361
  ${({ showBorder, theme }) =>
336
362
  showBorder &&
337
363
  `
338
- border-right: 1px solid ${theme.colors.grey4};
339
- `}
364
+ border-right: 1px solid ${theme.colors.grey4};
365
+ `}
340
366
  `
341
367
 
342
368
  const ButtonContainer = styled.div`
@@ -372,8 +398,8 @@
372
398
  ${({ showBorder, theme }) =>
373
399
  showBorder &&
374
400
  `
375
- border-right: 1px solid ${theme.colors.grey4};
376
- `}
401
+ border-right: 1px solid ${theme.colors.grey4};
402
+ `}
377
403
 
378
404
  .ghost {
379
405
  opacity: 0.5;
@@ -402,6 +428,7 @@
402
428
  display: grid;
403
429
  gap: 6px;
404
430
  width: 100%;
431
+ overflow-wrap: anywhere;
405
432
  padding: 7px 10px;
406
433
  background: ${(props) => props.theme.colors.grey5};
407
434
  `
@@ -435,11 +462,11 @@
435
462
  `
436
463
 
437
464
  const UpperContainer = styled.div`
438
- display: grid;
439
- grid-gap: 20px
440
- grid-template-columns: 1fr 1fr;
441
- padding: 10px 14px;
442
- `
465
+ display: grid;
466
+ grid-gap: 20px
467
+ grid-template-columns: 1fr 1fr;
468
+ padding: 10px 14px;
469
+ `
443
470
 
444
471
  const ResetButton = styled.div`
445
472
  display: inline-flex;
@@ -622,6 +649,9 @@
622
649
  const foundItem = options.find((item) => item.choice === value)
623
650
  return foundItem ? foundItem.text : value ? value : filter.selectedText
624
651
  },
652
+ isSingleSelector(type) {
653
+ return type === 'boolean'
654
+ },
625
655
  isMultipleSelector(type) {
626
656
  return type === 'multi_select_integer' || type === 'multi_select_string'
627
657
  },
@@ -92,7 +92,7 @@
92
92
  mounted() {
93
93
  document.addEventListener('click', this.clickOutside)
94
94
  },
95
- beforeDestroy() {
95
+ beforeUnmount() {
96
96
  document.removeEventListener('click', this.clickOutside)
97
97
  },
98
98
  methods: {
@@ -1,32 +1,81 @@
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"
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
+ :hover-color="item.hoverColor"
13
+ @click="$emit('on-' + item.type)"
14
+ >
15
+ {{ item.name }}
16
+ </ListItem>
17
+ <ButtonContainer
18
+ v-if="optionsList.length > optionLimit || hasComponent"
19
+ @click="expandOptions"
20
+ name="more_options,_tool_tips"
21
+ >
22
+ <DotItem />
23
+ <DotItem />
24
+ <DotItem />
25
+ </ButtonContainer>
26
+ </ListContainer>
27
+ <EmptyText v-if="!optionsList.length">
28
+ {{ $gettext('no_batch_actions_available') }}
29
+ </EmptyText>
30
+ <IconContainer @click="$emit('on-close')">
31
+ <Icon
32
+ color="white"
33
+ cursor="pointer"
34
+ name="close_for_modals,_tool_tips"
35
+ size="14px"
36
+ />
37
+ </IconContainer>
38
+ </BoxContainer>
39
+ </PageContainer>
40
+ <CenterPageContainer v-else>
41
+ <CenterBox>
42
+ <TitleContainer>
43
+ <BoxTitle> {{ numberSelected }} {{ $gettext('selected') }} </BoxTitle>
44
+ <IconContainer @click="$emit('on-close')">
45
+ <Icon
46
+ color="white"
47
+ cursor="pointer"
48
+ name="close_for_modals,_tool_tips"
49
+ size="14px"
50
+ />
51
+ </IconContainer>
52
+ </TitleContainer>
53
+ <Divider />
54
+ <ExpandedListItem
55
+ v-for="item in limitedOptions"
10
56
  :key="item.type"
11
57
  :hover-color="item.hoverColor"
12
- @click="$emit('on-' + item.type)"
58
+ @click="item?.component ? '' : $emit('on-' + item.type)"
13
59
  >
14
60
  {{ 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>
61
+ <IconContainer
62
+ v-if="item?.component"
63
+ @click="toggleElement(item.type)"
64
+ >
65
+ <Icon
66
+ color="white"
67
+ cursor="pointer"
68
+ name="arrow_right"
69
+ size="14px"
70
+ />
71
+ </IconContainer>
72
+ <OptionsContainer v-if="item?.component && item.open">
73
+ <slot :name="item.component" />
74
+ </OptionsContainer>
75
+ </ExpandedListItem>
76
+ </CenterBox>
77
+ </CenterPageContainer>
78
+ </PageWrapper>
30
79
  </template>
31
80
 
32
81
  <script>
@@ -37,6 +86,13 @@
37
86
  // name: 'Export'
38
87
  // },
39
88
  // {
89
+ // type: 'export',
90
+ // name: 'Export'
91
+ // ...
92
+ // add component parameter if we were passing a component to the selected options
93
+ // component: 'set_supplier'
94
+ // },
95
+ // {
40
96
  // type: 'delete',
41
97
  // name: 'Delete',
42
98
  // hoverColor: 'red' // default is green
@@ -48,10 +104,25 @@
48
104
  // :optionsList="optionsList"
49
105
  // @on-close="onCloseFunction()"
50
106
  // @on-export="function()" @on-delete="function()"
51
- // />
107
+ // >
108
+ // <template v-slot:set_supplier>
109
+ // <CustomSelectComponent
110
+ // :option-list="suppliers"
111
+ // @set-supplier="checkboxBulkActions('setSupplier', $event)"
112
+ // />
113
+ // </template>
114
+ // </SelectedOptions>
52
115
  import styled from 'vue3-styled-components'
116
+ import MainButton from '../buttons/mainButton'
53
117
  import Icon from '../icon'
54
118
 
119
+ const PageWrapper = styled.div``
120
+
121
+ const Divider = styled.div`
122
+ border-bottom: 1px solid ${({ theme }) => theme.colors.white};
123
+ width: 100%;
124
+ `
125
+
55
126
  const PageContainer = styled.div`
56
127
  position: fixed;
57
128
  bottom: 30px;
@@ -59,6 +130,23 @@
59
130
  transform: translateX(-50%);
60
131
  `
61
132
 
133
+ const CenterPageContainer = styled.div`
134
+ position: fixed;
135
+ top: 50%;
136
+ left: 50%;
137
+ transform: translate(-50%, -50%);
138
+ border-radius: 4px;
139
+ background-color: rgba(0, 0, 0, 0.4);
140
+ `
141
+
142
+ const OptionsContainer = styled.div`
143
+ position: fixed;
144
+ right: -300px;
145
+ background-color: ${(props) => props.theme.colors.black};
146
+ border-radius: 4px;
147
+ padding: 20px;
148
+ `
149
+
62
150
  const SelectedContainer = styled.div`
63
151
  display: grid;
64
152
  align-items: center;
@@ -67,6 +155,18 @@
67
155
  border-right: 1px solid rgba(255, 255, 255, 0.2);
68
156
  `
69
157
 
158
+ const TitleContainer = styled.div`
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: space-between;
162
+ width: 100%;
163
+ `
164
+
165
+ const BoxTitle = styled.div`
166
+ font-size: 14px;
167
+ color: ${(props) => props.theme.colors.white};
168
+ `
169
+
70
170
  const BoxContainer = styled.div`
71
171
  display: flex;
72
172
  align-items: center;
@@ -79,9 +179,41 @@
79
179
  height: 40px;
80
180
  `
81
181
 
182
+ const CenterBox = styled(BoxContainer)`
183
+ justify-content: center;
184
+ flex-direction: column;
185
+ height: auto;
186
+ gap: 25px;
187
+ align-items: flex-start;
188
+ border-radius: 4px;
189
+ width: 400px;
190
+ padding: 20px;
191
+ `
192
+
193
+ const ButtonContainer = styled.div`
194
+ display: flex;
195
+ flex-direction: row;
196
+ align-items: center;
197
+ justify-content: center;
198
+ padding: 5px;
199
+ cursor: pointer;
200
+
201
+ div {
202
+ // This is the dot color
203
+ background: ${(props) => props.theme.colors.white};
204
+ }
205
+ `
206
+ const DotItem = styled.div`
207
+ width: 4px;
208
+ height: 4px;
209
+ margin: 1px;
210
+ border-radius: 50%;
211
+ `
212
+
82
213
  const ListContainer = styled.div`
83
214
  padding: 0 20px;
84
215
  display: flex;
216
+ align-items: center;
85
217
  gap: 20px;
86
218
  color: ${(props) => props.theme.colors.white};
87
219
  `
@@ -99,6 +231,13 @@
99
231
  }
100
232
  `
101
233
 
234
+ const ExpandedListItem = styled(ListItem)`
235
+ display: flex;
236
+ width: 100%;
237
+ justify-content: space-between;
238
+ align-items: center;
239
+ `
240
+
102
241
  const IconContainer = styled.div`
103
242
  display: grid;
104
243
  align-items: center;
@@ -106,7 +245,7 @@
106
245
  height: 30px;
107
246
  width: 30px;
108
247
  cursor: pointer;
109
- margin-left: 20px;
248
+ margin-left: 15px;
110
249
 
111
250
  &:hover {
112
251
  background: rgba(255, 255, 255, 0.1);
@@ -127,10 +266,41 @@
127
266
  BoxContainer,
128
267
  SelectedContainer,
129
268
  ListContainer,
269
+ MainButton,
270
+ ButtonContainer,
271
+ DotItem,
130
272
  ListItem,
273
+ CenterBox,
131
274
  Icon,
275
+ CenterPageContainer,
276
+ PageWrapper,
277
+ OptionsContainer,
278
+ ExpandedListItem,
279
+ TitleContainer,
132
280
  IconContainer,
133
281
  EmptyText,
282
+ BoxTitle,
283
+ Divider,
284
+ },
285
+ computed: {
286
+ hasComponent() {
287
+ return this.optionsList.some((item) => item.component)
288
+ },
289
+ },
290
+ methods: {
291
+ toggleElement(type) {
292
+ this.limitedOptions = this.optionsList.map((item) => {
293
+ if (item.type === type) {
294
+ item.open = !item.open
295
+ } else item.open = false
296
+
297
+ return item
298
+ })
299
+ },
300
+ expandOptions() {
301
+ this.expanded = !this.expanded
302
+ this.limitedOptions = this.optionsList
303
+ },
134
304
  },
135
305
  props: {
136
306
  optionsList: {
@@ -141,5 +311,21 @@
141
311
  default: 0,
142
312
  },
143
313
  },
314
+ mounted() {
315
+ this.limitedOptions = this.optionsList
316
+ .map((item) => {
317
+ return { ...item, open: false }
318
+ })
319
+ .filter((item) => !item.component)
320
+ .slice(0, this.optionLimit)
321
+ },
322
+ data() {
323
+ return {
324
+ //maximum number of options to display, if more than 4, display a 'more' option
325
+ optionLimit: 4,
326
+ expanded: false,
327
+ limitedOptions: [],
328
+ }
329
+ },
144
330
  }
145
331
  </script>
@@ -1,103 +0,0 @@
1
- <template>
2
- <Container>
3
- <RoundedTabLeft
4
- :background-color="backgroundColor"
5
- :border-radius="borderRadius"
6
- />
7
- <Tab
8
- :background-color="backgroundColor"
9
- :border-radius="borderRadius"
10
- :height="height"
11
- :width="width"
12
- >
13
- <slot></slot>
14
- </Tab>
15
- <RoundedTabRight
16
- :background-color="backgroundColor"
17
- :border-radius="borderRadius"
18
- />
19
- </Container>
20
- </template>
21
- <script>
22
- import styled from 'vue3-styled-components'
23
-
24
- const Container = styled.div`
25
- position: relative;
26
- display: flex;
27
- align-items: center;
28
- justify-content: center;
29
- `
30
- const RoundedTabLeft = styled('div', {
31
- backgroundColor: String,
32
- borderRadius: String,
33
- })`
34
- position:absolute;
35
- bottom:0;
36
- left:-${(prop) => prop.borderRadius}
37
- background-color: ${(prop) => prop.backgroundColor};
38
- width: ${(prop) => prop.borderRadius};
39
- height: ${(prop) => prop.borderRadius};
40
- -webkit-mask-image: radial-gradient(
41
- circle at top left,
42
- transparent 71%,
43
- black 71%
44
- );
45
- `
46
- const RoundedTabRight = styled('div', {
47
- backgroundColor: String,
48
- borderRadius: String,
49
- })`
50
- position:absolute;
51
- bottom:0;
52
- right:-${(prop) => prop.borderRadius}
53
- background-color: ${(prop) => prop.backgroundColor};
54
- width: ${(prop) => prop.borderRadius};
55
- height: ${(prop) => prop.borderRadius};
56
- -webkit-mask-image: radial-gradient(
57
- circle at top right,
58
- transparent 71%,
59
- black 71%
60
- );`
61
- const Tab = styled('div', {
62
- width: String,
63
- height: String,
64
- backgroundColor: String,
65
- borderRadius: String,
66
- })`
67
- display: flex;
68
- align-items: center;
69
- justify-content: center;
70
- background-color: ${(prop) => prop.backgroundColor};
71
- width: ${(prop) => prop.width};
72
- height: ${(prop) => prop.height};
73
- border-radius: ${(prop) => prop.borderRadius} ${(prop) => prop.borderRadius}
74
- 0 0;
75
- `
76
- export default {
77
- name: 'SelectedOptions',
78
- components: {
79
- Container,
80
- Tab,
81
- RoundedTabLeft,
82
- RoundedTabRight,
83
- },
84
- props: {
85
- height: {
86
- required: false,
87
- default: '40px',
88
- },
89
- width: {
90
- required: false,
91
- default: '200px',
92
- },
93
- backgroundColor: {
94
- required: false,
95
- default: 'blue',
96
- },
97
- borderRadius: {
98
- required: false,
99
- default: '20px',
100
- },
101
- },
102
- }
103
- </script>