@eturnity/eturnity_reusable_components 1.2.85-EPDM-3013.1 → 1.2.85-EPDM-3013.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": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.85-EPDM-3013.1",
3
+ "version": "1.2.85-EPDM-3013.3",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 13H12v5l6-6-6-6v5H4V2H2v11z"/></svg>
@@ -0,0 +1,7 @@
1
+ <svg fill="none" height="20" viewbox="12 12 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M13 13H27V14.5556H13V13Z" fill="#B2B9C5"></path>
3
+ <path d="M13 21.5556H27V23.1111H13V21.5556Z" fill="#B2B9C5"></path>
4
+ <path d="M13 13H14.5556V22.3333H13V13Z" fill="#B2B9C5"></path>
5
+ <path d="M25.4444 13L27 13V22.3333H25.4444V13Z" fill="#B2B9C5"></path>
6
+ <path d="M23.8889 19.6111H16.1111L18.0556 16.1111L20.7778 18.0556L21.5556 17.2778L23.8889 19.6111Z" fill="#B2B9C5"></path>
7
+ </svg>
@@ -1,7 +1,41 @@
1
1
  <template>
2
2
  <container-wrapper>
3
- <column-wrapper :numCols="filterData.length">
4
- <column-container v-for="(item, idx) in filterData" :key="idx">
3
+ <view-container
4
+ v-if="filterViews && filterViews.length"
5
+ :maxWidth="activeView.length"
6
+ >
7
+ <select-component
8
+ selectWidth="100%"
9
+ selectHeight="36px"
10
+ fontSize="13px"
11
+ :label="$gettext('active_filter')"
12
+ alignItems="vertical"
13
+ >
14
+ <template #selector>
15
+ <option-title>
16
+ {{ activeView }}
17
+ </option-title>
18
+ </template>
19
+ <template #dropdown>
20
+ <Option
21
+ v-for="(item, idx) in filterViews"
22
+ :key="idx + '_view'"
23
+ @click.native="$emit('on-view-select', item)"
24
+ :value="item.name"
25
+ >{{ item.name }}
26
+ <delete-icon @click.native.stop="$emit('on-view-delete', item)"
27
+ /></Option>
28
+ </template>
29
+ </select-component>
30
+ </view-container>
31
+ <column-wrapper
32
+ :numCols="filterData.length"
33
+ :hasActiveView="!!filterViews && !!filterViews.length"
34
+ >
35
+ <column-container
36
+ v-for="(item, idx) in filterData"
37
+ :key="idx + '_filterdata'"
38
+ >
5
39
  <column-title :showBorder="idx + 1 !== filterData.length">
6
40
  {{ item.columnName }}
7
41
  </column-title>
@@ -16,8 +50,8 @@
16
50
  v-model="item.dataOptions"
17
51
  >
18
52
  <checkbox-wrapper
19
- v-for="column in item.dataOptions"
20
- :key="column.choice"
53
+ v-for="(column, index) in item.dataOptions"
54
+ :key="index + 'dataOption'"
21
55
  >
22
56
  <drag-container class="drag-container">
23
57
  <icon :name="'duplicate-1'" size="12px" />
@@ -39,8 +73,11 @@
39
73
  </draggable>
40
74
  </checkbox-container>
41
75
  </row-container>
42
- <row-container v-if="item.type === 'filter'">
43
- <row-wrapper v-for="filter in item.dataOptions" :key="filter.field">
76
+ <row-container v-if="item.type === 'filter'" showBorder>
77
+ <row-wrapper
78
+ v-for="(filter, index) in item.dataOptions"
79
+ :key="index + '_field'"
80
+ >
44
81
  <select-component
45
82
  v-if="isMultipleSelector(filter.filter_type)"
46
83
  selectWidth="100%"
@@ -58,8 +95,8 @@
58
95
  <template #dropdown>
59
96
  <dropdown-checkbox-container @click.stop>
60
97
  <checkbox
61
- v-for="filterOption in filter.choices"
62
- :key="filterOption.choice"
98
+ v-for="(filterOption, optionIdx) in filter.choices"
99
+ :key="optionIdx + 'optionIdx'"
63
100
  :label="filterOption.text"
64
101
  :isChecked="filterOption.selected"
65
102
  @on-event-handler="
@@ -75,103 +112,97 @@
75
112
  </dropdown-checkbox-container>
76
113
  </template>
77
114
  </select-component>
78
- <select-component
79
- v-else-if="isRangeSelector(filter.filter_type)"
80
- selectWidth="100%"
81
- selectHeight="36px"
82
- fontSize="13px"
83
- :label="filter.label"
84
- alignItems="vertical"
115
+ <section-container v-else-if="isRangeSelector(filter.filter_type)">
116
+ <row-label>{{ filter.label }}</row-label>
117
+ <grid-container>
118
+ <input-number
119
+ :placeholder="
120
+ filter.unit
121
+ ? $gettext('min_amount') + ' (' + filter.unit + ')'
122
+ : $gettext('min_amount')
123
+ "
124
+ :numberPrecision="0"
125
+ :value="filter.range.start"
126
+ @input-change="
127
+ onChange({
128
+ dataType: item.type,
129
+ value: $event,
130
+ choice: 'start',
131
+ field: filter.field
132
+ })
133
+ "
134
+ fontSize="13px"
135
+ inputHeight="36px"
136
+ :unitName="filter.unit"
137
+ />
138
+ <input-number
139
+ :placeholder="
140
+ filter.unit
141
+ ? $gettext('max_amount') + ' (' + filter.unit + ')'
142
+ : $gettext('max_amount')
143
+ "
144
+ :numberPrecision="0"
145
+ :value="filter.range.end"
146
+ @input-change="
147
+ onChange({
148
+ dataType: item.type,
149
+ value: $event,
150
+ choice: 'end',
151
+ field: filter.field
152
+ })
153
+ "
154
+ fontSize="13px"
155
+ inputHeight="36px"
156
+ :unitName="filter.unit"
157
+ />
158
+ </grid-container>
159
+ </section-container>
160
+ <section-container
161
+ v-else-if="isDateSelector(filter.filter_type)"
162
+ @click.stop
85
163
  >
86
- <template #selector>
87
- <option-title>
88
- {{ filter.selectedText }}
89
- </option-title>
90
- </template>
91
- <template #dropdown>
92
- <dropdown-checkbox-container @click.stop>
93
- <input-number
94
- :placeholder="settingsTranslations.start"
95
- :numberPrecision="0"
96
- :value="filter.range.start"
97
- @input-change="
98
- onChange({
99
- dataType: item.type,
100
- value: $event,
101
- choice: 'start',
102
- field: filter.field
103
- })
104
- "
105
- fontSize="13px"
106
- :labelText="settingsTranslations.start"
107
- />
108
- <input-number
109
- :placeholder="settingsTranslations.end"
110
- :numberPrecision="0"
111
- :value="filter.range.end"
112
- @input-change="
113
- onChange({
114
- dataType: item.type,
115
- value: $event,
116
- choice: 'end',
117
- field: filter.field
118
- })
119
- "
120
- fontSize="13px"
121
- :labelText="settingsTranslations.end"
122
- />
123
- </dropdown-checkbox-container>
124
- </template>
125
- </select-component>
126
- <calendar-container v-else-if="isDateSelector(filter.filter_type)">
127
- <row-label
128
- v-if="settingsTranslations && settingsTranslations.start"
129
- >{{ settingsTranslations.start }}</row-label
130
- >
131
- <date-picker-input
132
- :placeholder="'-'"
133
- :lang="getDatePickerLanguage()"
134
- type="date"
135
- :value="filter.range.start"
136
- @change="
137
- onChange({
138
- dataType: item.type,
139
- value: $event,
140
- choice: 'start',
141
- field: filter.field
142
- })
143
- "
144
- @focus="onDatepickerFocus(filter.range)"
145
- @close="onDatepickerBlur()"
146
- format="YYYY-MM-DD"
147
- valueType="format"
148
- :disabled-date="disableFutureDates"
149
- />
150
- <row-label
151
- :marginTop="true"
152
- v-if="settingsTranslations && settingsTranslations.end"
153
- >{{ settingsTranslations.end }}</row-label
154
- >
155
- <date-picker-input
156
- :placeholder="'-'"
157
- :lang="getDatePickerLanguage()"
158
- type="date"
159
- :value="filter.range.end"
160
- @change="
161
- onChange({
162
- dataType: item.type,
163
- value: $event,
164
- choice: 'end',
165
- field: filter.field
166
- })
167
- "
168
- @focus="onDatepickerFocus(filter.range)"
169
- @close="onDatepickerBlur()"
170
- format="YYYY-MM-DD"
171
- valueType="format"
172
- :disabled-date="disablePastDates"
173
- />
174
- </calendar-container>
164
+ <row-label>{{ filter.label }}</row-label>
165
+ <grid-container>
166
+ <date-picker-input
167
+ :placeholder="$gettext('Date from')"
168
+ :lang="getDatePickerLanguage()"
169
+ type="date"
170
+ :value="filter.range.start"
171
+ @change="
172
+ onChange({
173
+ dataType: item.type,
174
+ value: $event,
175
+ choice: 'start',
176
+ field: filter.field
177
+ })
178
+ "
179
+ @focus="onDatepickerFocus(filter.range)"
180
+ @close="onDatepickerBlur()"
181
+ format="YYYY-MM-DD"
182
+ valueType="format"
183
+ :disabled-date="disableFutureDates"
184
+ />
185
+ <date-picker-input
186
+ :placeholder="$gettext('Date to')"
187
+ :lang="getDatePickerLanguage()"
188
+ type="date"
189
+ :value="filter.range.end"
190
+ @change="
191
+ onChange({
192
+ dataType: item.type,
193
+ value: $event,
194
+ choice: 'end',
195
+ field: filter.field
196
+ })
197
+ "
198
+ @focus="onDatepickerFocus(filter.range)"
199
+ @close="onDatepickerBlur()"
200
+ format="YYYY-MM-DD"
201
+ valueType="format"
202
+ :disabled-date="disablePastDates"
203
+ />
204
+ </grid-container>
205
+ </section-container>
175
206
  <select-component
176
207
  v-else
177
208
  selectWidth="100%"
@@ -194,8 +225,8 @@
194
225
  </template>
195
226
  <template #dropdown>
196
227
  <Option
197
- v-for="filterOption in filter.choices"
198
- :key="filterOption.choice"
228
+ v-for="(filterOption, filterIdx) in filter.choices"
229
+ :key="filterIdx + '_filterIdx'"
199
230
  :value="filterOption.choice"
200
231
  >{{ filterOption.text }}</Option
201
232
  >
@@ -207,15 +238,15 @@
207
238
  </column-wrapper>
208
239
  <button-container>
209
240
  <main-button
210
- v-if="buttonText.save_view && hasActiveView"
241
+ v-if="buttonText.apply_view && hasActiveView"
211
242
  type="primary"
212
- :text="buttonText.save_view"
213
- @click.native="$emit('on-save-current-view')"
243
+ :text="buttonText.apply_view"
244
+ @click.native="$emit('on-apply-current-view')"
214
245
  />
215
246
  <main-button
216
247
  type="secondary"
217
- v-if="buttonText.save_new_view"
218
- :text="buttonText.save_new_view"
248
+ v-if="buttonText.save_view"
249
+ :text="buttonText.save_view"
219
250
  @click.native="$emit('on-save-new-view')"
220
251
  />
221
252
  <main-button
@@ -238,6 +269,7 @@ import MainButton from '../buttons/mainButton'
238
269
  import Checkbox from '../inputs/checkbox'
239
270
  import draggable from 'vuedraggable'
240
271
  import Icon from '../icon'
272
+ import DeleteIcon from '../deleteIcon'
241
273
  import { datePickerLang } from '../../helpers/translateLang'
242
274
  import 'vue2-datepicker/index.css'
243
275
  import 'vue2-datepicker/locale/de'
@@ -258,10 +290,16 @@ const ContainerWrapper = styled.div`
258
290
  font-size: 13px;
259
291
  `
260
292
 
261
- const ColAttrs = { numCols: Number }
293
+ const ColAttrs = { numCols: Number, hasActiveView: Boolean }
262
294
  const ColumnWrapper = styled('div', ColAttrs)`
263
295
  display: grid;
264
296
  grid-template-columns: repeat(${(props) => props.numCols}, auto);
297
+
298
+ ${({ hasActiveView, theme }) =>
299
+ hasActiveView &&
300
+ `
301
+ border-top: 1px solid ${theme.colors.grey4};
302
+ `}
265
303
  `
266
304
 
267
305
  const TitleAttrs = { showBorder: Boolean }
@@ -269,8 +307,7 @@ const ColumnTitle = styled('div', TitleAttrs)`
269
307
  font-size: 14px;
270
308
  font-weight: 700;
271
309
  color: ${(props) => props.theme.colors.eturnityGrey};
272
- padding: 14px;
273
- border-bottom: 1px solid ${(props) => props.theme.colors.grey4};
310
+ padding: 10px 14px;
274
311
  ${({ showBorder, theme }) =>
275
312
  showBorder &&
276
313
  `
@@ -294,9 +331,15 @@ const DragContainer = styled.div`
294
331
  }
295
332
  `
296
333
 
297
- const RowContainer = styled.div`
298
- padding: 15px;
299
- width: 260px;
334
+ const RowContainer = styled('div', TitleAttrs)`
335
+ padding: 10px 14px;
336
+ width: 300px;
337
+
338
+ ${({ showBorder, theme }) =>
339
+ showBorder &&
340
+ `
341
+ border-right: 1px solid ${theme.colors.grey4};
342
+ `}
300
343
 
301
344
  .ghost {
302
345
  opacity: 0.5;
@@ -316,7 +359,7 @@ const CheckboxContainer = styled.div`
316
359
  const CheckboxWrapper = styled.div`
317
360
  display: grid;
318
361
  grid-template-columns: auto 1fr;
319
- gap: 6px;
362
+ gap: 16px;
320
363
  padding: 2px;
321
364
  align-items: center;
322
365
  `
@@ -335,7 +378,7 @@ const RowWrapper = styled.div`
335
378
  const DatePickerInput = styled(DatePicker)`
336
379
  border: 1px solid ${(props) => props.theme.colors.grey4};
337
380
  border-radius: 4px;
338
- padding: 7px 12px 7px 15px;
381
+ padding: 7px 12px 7px 7px;
339
382
  width: 100%;
340
383
  position: relative;
341
384
 
@@ -355,7 +398,6 @@ const DatePickerInput = styled(DatePicker)`
355
398
  padding: 0;
356
399
  font-size: 13px;
357
400
  box-shadow: none;
358
- /* font-family: ${(props) => props.theme.fonts.mainFont}; */
359
401
  color: #393939;
360
402
  vertical-align: bottom;
361
403
  }
@@ -383,6 +425,22 @@ const RowLabel = styled('div', LabelAttrs)`
383
425
  margin-top: ${(props) => (props.marginTop ? '12px' : '0')};
384
426
  `
385
427
 
428
+ const SectionContainer = styled.div``
429
+
430
+ const GridContainer = styled.div`
431
+ display: grid;
432
+ grid-template-columns: 1fr 1fr;
433
+ grid-gap: 12px;
434
+ `
435
+
436
+ const ViewContainerAttrs = { maxWidth: Number }
437
+ const ViewContainer = styled('div', ViewContainerAttrs)`
438
+ padding: 10px 14px;
439
+
440
+ max-width: ${(props) =>
441
+ props.maxWidth && props.maxWidth > 300 ? props.maxWidth + 'ch' : '300px'};
442
+ `
443
+
386
444
  export default {
387
445
  name: 'filter-settings',
388
446
  components: {
@@ -406,7 +464,11 @@ export default {
406
464
  DragContainer,
407
465
  InputNumber,
408
466
  DatePickerInput,
409
- RowLabel
467
+ RowLabel,
468
+ SectionContainer,
469
+ GridContainer,
470
+ ViewContainer,
471
+ DeleteIcon
410
472
  },
411
473
  props: {
412
474
  filterData: {
@@ -424,11 +486,17 @@ export default {
424
486
  // 'save_view': '$gettext("save_view")'
425
487
  // }
426
488
  },
489
+ filterViews: {
490
+ required: true
491
+ },
427
492
  activeLanguage: {
428
493
  required: false
429
494
  },
430
495
  settingsTranslations: {
431
496
  required: false
497
+ },
498
+ activeView: {
499
+ required: false
432
500
  }
433
501
  },
434
502
  data() {
@@ -3,31 +3,23 @@
3
3
  <parent-dropdown
4
4
  @on-toggle="onToggleDropdown()"
5
5
  :isOpen="isDropdownOpen"
6
- :dropdownText="activeView ? activeView : 'Default view'"
7
- :type="filterType"
8
- />
9
- <filter-views
10
- v-if="
11
- filterType === 'views' &&
12
- isDropdownOpen &&
13
- filterData &&
14
- filterData.length
15
- "
16
- :filterData="filterData"
17
- @on-select="onViewSelect($event)"
18
- @on-delete="onViewDelete($event)"
6
+ :dropdownText="dropdownText ? dropdownText : 'Default view'"
19
7
  />
20
8
  <filter-settings
21
- v-if="filterType === 'settings' && isDropdownOpen"
9
+ v-if="isDropdownOpen"
22
10
  :filterData="filterData"
11
+ :filterViews="filterViews"
23
12
  :buttonText="buttonText"
13
+ @on-view-select="onViewSelect($event)"
14
+ @on-view-delete="onViewDelete($event)"
24
15
  @on-save-new-view="$emit('on-save-new-view')"
25
16
  @on-filter-change="onFilterChange($event)"
26
17
  @on-cancel-view="onCancelSettings()"
27
18
  @on-drag-change="$emit('on-drag-change', $event)"
28
- @on-save-current-view="onSaveCurrentView()"
19
+ @on-apply-current-view="onApplyCurrentView()"
29
20
  @on-prevent-close="onPreventClose($event)"
30
21
  :hasActiveView="hasActiveView"
22
+ :activeView="activeView"
31
23
  :activeLanguage="activeLanguage"
32
24
  :settingsTranslations="settingsTranslations"
33
25
  />
@@ -37,7 +29,6 @@
37
29
  <script>
38
30
  import styled from 'vue-styled-components'
39
31
  import parentDropdown from './parentDropdown'
40
- import filterViews from './filterViews'
41
32
  import filterSettings from './filterSettings'
42
33
 
43
34
  const PageWrapper = styled.div`
@@ -49,17 +40,18 @@ export default {
49
40
  components: {
50
41
  parentDropdown,
51
42
  PageWrapper,
52
- filterViews,
53
43
  filterSettings
54
44
  },
55
45
  props: {
56
- filterType: {
57
- required: false,
58
- default: 'settings' // 'settings', 'views'
59
- },
60
46
  filterData: {
61
47
  required: true
62
48
  },
49
+ dropdownText: {
50
+ required: false
51
+ },
52
+ filterViews: {
53
+ required: true
54
+ },
63
55
  activeView: {
64
56
  required: false,
65
57
  default: null
@@ -103,7 +95,11 @@ export default {
103
95
  }, 100)
104
96
  },
105
97
  onFilterChange(data) {
98
+ // this.preventOutsideClick = true is needed for when the user clicks on the calendar icon on the date range
99
+ // because clicking the calendar does not trigger the @focus
100
+ this.preventOutsideClick = true
106
101
  this.$emit('on-filter-settings-change', data)
102
+ this.onPreventClose(false)
107
103
  },
108
104
  onCancelSettings() {
109
105
  this.onToggleDropdown()
@@ -114,12 +110,11 @@ export default {
114
110
  this.$emit('on-filter-view-select', item)
115
111
  },
116
112
  onViewDelete(item) {
117
- this.onToggleDropdown()
118
113
  this.$emit('on-filter-view-delete', item)
119
114
  },
120
- onSaveCurrentView() {
115
+ onApplyCurrentView() {
121
116
  this.onToggleDropdown()
122
- this.$emit('on-save-current-view')
117
+ this.$emit('on-apply-current-view')
123
118
  }
124
119
  },
125
120
  mounted() {
@@ -1,10 +1,7 @@
1
1
  <template>
2
2
  <page-wrapper @click="$emit('on-toggle')">
3
3
  <icon-wrapper>
4
- <icon
5
- :name="type === 'settings' ? 'settings' : 'show_in_a_new_tab'"
6
- size="18px"
7
- />
4
+ <icon name="settings" size="18px" />
8
5
  </icon-wrapper>
9
6
  <title-wrapper :isOpen="isOpen">
10
7
  <title-text>
@@ -81,10 +78,6 @@ export default {
81
78
  ArrowWrapper
82
79
  },
83
80
  props: {
84
- type: {
85
- required: false,
86
- default: 'settings' // 'settings', 'views'
87
- },
88
81
  isOpen: {
89
82
  required: true,
90
83
  default: false
@@ -27,7 +27,9 @@ import styled from 'vue-styled-components'
27
27
 
28
28
  const wrapperAttrs = { isDisabled: Boolean, size: String, cursor: String }
29
29
  const Wrapper = styled('div', wrapperAttrs)`
30
- display: inline-block;
30
+ display: flex;
31
+ align-content: center;
32
+ justify-content: center;
31
33
  width: ${(props) => props.size};
32
34
  height: ${(props) => props.size};
33
35
  min-width: ${(props) => props.size};
@@ -7,7 +7,7 @@
7
7
  <label-wrapper v-if="label">
8
8
  <input-label :labelFontColor="labelFontColor" :fontSize="fontSize">{{
9
9
  label
10
- }}</input-label>
10
+ }} <optionalLabel v-if="labelOptional">({{ $gettext('Optional') }})</optionalLabel></input-label>
11
11
  <info-text
12
12
  v-if="infoTextMessage"
13
13
  :text="infoTextMessage"
@@ -81,7 +81,9 @@ const InputLabel = styled('div', labelAttrs)`
81
81
  font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
82
82
  font-weight: 700;
83
83
  `
84
-
84
+ const optionalLabel = styled.span`
85
+ font-weight: 300;
86
+ `
85
87
  const LabelWrapper = styled.div`
86
88
  display: inline-grid;
87
89
  grid-template-columns: auto auto;
@@ -217,7 +219,8 @@ export default {
217
219
  Icon,
218
220
  IconWrapper,
219
221
  IconContainer,
220
- InputErrorWrapper
222
+ InputErrorWrapper,
223
+ optionalLabel
221
224
  },
222
225
  data() {
223
226
  return {
@@ -266,6 +269,10 @@ export default {
266
269
  label: {
267
270
  required: false
268
271
  },
272
+ labelOptional: {
273
+ required: false,
274
+ default: false
275
+ },
269
276
  noBorder: {
270
277
  required: false,
271
278
  default: false
@@ -14,8 +14,11 @@
14
14
  labelFontColor || colorMode == 'dark' ? 'white' : 'eturnityGrey'
15
15
  "
16
16
  :fontSize="fontSize"
17
- >{{ label }}</input-label
18
- >
17
+ >{{ label }}
18
+ <optionalLabel v-if="labelOptional">
19
+ ({{ $gettext('Optional') }})</optionalLabel
20
+ >
21
+ </input-label>
19
22
  <info-text
20
23
  v-if="infoTextMessage"
21
24
  :text="infoTextMessage"
@@ -45,6 +48,7 @@
45
48
  v-if="isSearchBarVisible"
46
49
  ref="searchInput"
47
50
  tabindex="0"
51
+ inputHeight="34px"
48
52
  :noBorder="true"
49
53
  :fontSize="fontSize"
50
54
  backgroundColor="transparent"
@@ -140,7 +144,6 @@ const Caret = styled.div`
140
144
  min-width: 30px;
141
145
  height: 100%;
142
146
  align-items: stretch
143
- padding-top: 5px;
144
147
  cursor: pointer;
145
148
  margin-left: auto;
146
149
  `
@@ -158,6 +161,9 @@ const InputLabel = styled('div', labelAttrs)`
158
161
  font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
159
162
  font-weight: 700;
160
163
  `
164
+ const optionalLabel = styled.span`
165
+ font-weight: 300;
166
+ `
161
167
  const inputProps = { selectWidth: String, optionWidth: String }
162
168
  const Container = styled('div', inputProps)`
163
169
  width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
@@ -192,8 +198,7 @@ const selectButton = styled('div', selectButtonAttrs)`
192
198
  position: relative;
193
199
  box-sizing: border-box;
194
200
  border-radius: 4px;
195
- padding: ${(props) =>
196
- props.isSearchBarVisible ? '0 10px 0 0' : '0px 10px 0 15px'};
201
+ padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 15px')};
197
202
  text-align: left;
198
203
  border-radius: 4px;
199
204
  min-height: 36px;
@@ -230,7 +235,6 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
230
235
  z-index:${(props) => (props.isActive ? '2' : '1')};
231
236
  position:absolute;
232
237
  top:5px;
233
- padding:10px;
234
238
  border:1px solid ${(props) => props.theme.colors.grey4}
235
239
  border-radius:4px;
236
240
  display: flex;
@@ -284,6 +288,10 @@ export default {
284
288
  label: {
285
289
  required: false
286
290
  },
291
+ labelOptional: {
292
+ required: false,
293
+ default: false
294
+ },
287
295
  infoTextMessage: {
288
296
  required: false
289
297
  },
@@ -361,6 +369,7 @@ export default {
361
369
  Container,
362
370
  InputLabel,
363
371
  LabelWrapper,
372
+ optionalLabel,
364
373
  InfoText,
365
374
  InputWrapper,
366
375
  DropdownWrapper,
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <!-- Check, if pages more than 1 -->
3
+ <paginationWrapper v-if="paginationParams.pages > 1">
4
+ <!-- Back button -->
5
+ <paginationLink
6
+ v-if="paginationParams.previous"
7
+ @click="fetchPage(paginationParams.previous)"
8
+ >
9
+ <arrowIconContainer>
10
+ <icon name="arrow_left" color="#1a237e" size="12px"/>
11
+ </arrowIconContainer>
12
+ <arrowText>{{ $gettext('back') }}</arrowText>
13
+ </paginationLink>
14
+
15
+ <!-- First page -->
16
+ <paginationLink
17
+ v-if="currentPage > 2 && paginationParams.pages > 3"
18
+ @click="fetchPage(1)"
19
+ >1</paginationLink
20
+ >
21
+
22
+ <!-- Back tree dots -->
23
+ <span v-if="currentPage > 3 && paginationParams.pages > 4">...</span>
24
+
25
+ <!-- Current block -->
26
+ <paginationLink
27
+ v-for="number in paginationNumbers()"
28
+ :key="number"
29
+ :class="[currentPage === number ? 'active' : '']"
30
+ @click="fetchPage(number)"
31
+ >{{ number }}</paginationLink
32
+ >
33
+
34
+ <!-- Forward tree dots -->
35
+ <span
36
+ v-if="
37
+ paginationParams.pages - currentPage > 2 && paginationParams.pages > 4
38
+ "
39
+ >...</span
40
+ >
41
+
42
+ <!-- End page -->
43
+ <paginationLink
44
+ v-if="
45
+ paginationParams.pages - currentPage > 1 && paginationParams.pages > 3
46
+ "
47
+ @click="fetchPage(paginationParams.pages)"
48
+ >{{ paginationParams.pages }}</paginationLink
49
+ >
50
+
51
+ <!-- Forward button -->
52
+ <paginationLink
53
+ v-if="paginationParams.next"
54
+ @click="fetchPage(paginationParams.next)"
55
+ >
56
+ <arrowText>{{ $gettext('forward') }}</arrowText>
57
+ <arrowIconContainer>
58
+ <icon name="arrow_right" color="#1a237e" size="12px" />
59
+ </arrowIconContainer>
60
+ </paginationLink>
61
+ </paginationWrapper>
62
+ </template>
63
+
64
+ <script>
65
+ import styled from "vue-styled-components"
66
+ import icon from "../icon"
67
+ const paginationWrapper=styled.nav`
68
+ color: #1a237e;
69
+ font-size: 13px;
70
+ display: -webkit-box;
71
+ display: -ms-flexbox;
72
+ display: flex;
73
+ -ms-flex-wrap: wrap;
74
+ flex-wrap: wrap;
75
+ -webkit-box-pack: end;
76
+ -ms-flex-pack: end;
77
+ justify-content: flex-end;
78
+ -webkit-box-align: center;
79
+ -ms-flex-align: center;
80
+ align-items: center;
81
+ margin-bottom: 2px;
82
+ margin-top: 10px;
83
+ `
84
+ const paginationLink=styled.div`
85
+ display: flex;
86
+ padding: 0px 5px;
87
+ margin: 0 2px;
88
+ text-align: center;
89
+ border-radius: 3px;
90
+ white-space: nowrap;
91
+ cursor: pointer;
92
+
93
+ &.active{
94
+ color: #fff;
95
+ background-color: #5c67ac;
96
+ padding: 7px 12px;
97
+ border-radius: 4px;
98
+ }
99
+ `
100
+ const arrowText=styled.div``
101
+ const arrowIconContainer=styled.div`
102
+ margin:0 10px;
103
+ display:flex;
104
+ align-items: center;
105
+ `
106
+ export default {
107
+ name: 'pagination-component',
108
+ components:{
109
+ paginationWrapper,
110
+ paginationLink,
111
+ icon,
112
+ arrowText,
113
+ arrowIconContainer
114
+ },
115
+ props: ["fetchPage","currentPage","paginationParams"],
116
+ methods: {
117
+ getNewProjects(num) {
118
+ this.$emit('on-pagination-change', num)
119
+ },
120
+ paginationNumbers() {
121
+ const prev = this.paginationParams.previous
122
+ const next = this.paginationParams.next
123
+ const n = prev + 1 || next - 1
124
+ if (this.paginationParams.pages === 2) {
125
+ return prev ? [n - 1, n] : [n, n + 1]
126
+ } else {
127
+ return prev
128
+ ? next
129
+ ? [n - 1, n, n + 1]
130
+ : [n - 2, n - 1, n]
131
+ : [n, n + 1, n + 2]
132
+ }
133
+ }
134
+ }
135
+ }
136
+ </script>
137
+
@@ -1,63 +0,0 @@
1
- <template>
2
- <container-wrapper>
3
- <list-item
4
- v-for="(item, idx) in filterData"
5
- :key="idx"
6
- @click="$emit('on-select', item)"
7
- >
8
- <list-text>{{ item.name }}</list-text>
9
- <delete-icon @click.native.stop="$emit('on-delete', item)" />
10
- </list-item>
11
- </container-wrapper>
12
- </template>
13
-
14
- <script>
15
- import styled from 'vue-styled-components'
16
- import DeleteIcon from '../deleteIcon'
17
-
18
- const ContainerWrapper = styled.div`
19
- position: absolute;
20
- margin-top: 4px;
21
- background-color: ${(props) => props.theme.colors.white};
22
- min-width: 100%;
23
- width: max-content;
24
- border: 1px solid ${(props) => props.theme.colors.grey4};
25
- border-radius: 4px;
26
- z-index: 9999;
27
- font-size: 13px;
28
- `
29
-
30
- const ListItem = styled.div`
31
- display: grid;
32
- grid-template-columns: 1fr auto;
33
- align-items: center;
34
- padding: 8px 14px;
35
- gap: 6px;
36
- font-size: 13px;
37
- cursor: pointer;
38
-
39
- &:hover {
40
- background-color: ${(props) => props.theme.colors.grey5};
41
- }
42
- `
43
-
44
- const ListText = styled.div``
45
-
46
- export default {
47
- name: 'filter-views',
48
- components: {
49
- ContainerWrapper,
50
- ListItem,
51
- ListText,
52
- DeleteIcon
53
- },
54
- props: {
55
- filterData: {
56
- required: false,
57
- default: () => {
58
- '[]'
59
- }
60
- }
61
- }
62
- }
63
- </script>