@eturnity/eturnity_reusable_components 1.2.85-EPDM-3013.1 → 1.2.85-EPDM-3013.2

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.2",
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,90 @@
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"
85
- >
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>
115
+ <section-container v-else-if="isRangeSelector(filter.filter_type)">
116
+ <row-label>{{
117
+ filter.unit
118
+ ? filter.label + ' (' + filter.unit + ')'
119
+ : filter.label
120
+ }}</row-label>
121
+ <grid-container>
122
+ <input-number
123
+ :placeholder="$gettext('min_amount')"
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="$gettext('max_amount')"
140
+ :numberPrecision="0"
141
+ :value="filter.range.end"
142
+ @input-change="
143
+ onChange({
144
+ dataType: item.type,
145
+ value: $event,
146
+ choice: 'end',
147
+ field: filter.field
148
+ })
149
+ "
150
+ fontSize="13px"
151
+ inputHeight="36px"
152
+ :unitName="filter.unit"
153
+ />
154
+ </grid-container>
155
+ </section-container>
156
+ <section-container v-else-if="isDateSelector(filter.filter_type)">
157
+ <row-label>{{ filter.label }}</row-label>
158
+ <grid-container>
159
+ <date-picker-input
160
+ :placeholder="$gettext('Date from')"
161
+ :lang="getDatePickerLanguage()"
162
+ type="date"
163
+ :value="filter.range.start"
164
+ @change="
165
+ onChange({
166
+ dataType: item.type,
167
+ value: $event,
168
+ choice: 'start',
169
+ field: filter.field
170
+ })
171
+ "
172
+ @focus="onDatepickerFocus(filter.range)"
173
+ @close="onDatepickerBlur()"
174
+ format="YYYY-MM-DD"
175
+ valueType="format"
176
+ :disabled-date="disableFutureDates"
177
+ />
178
+ <date-picker-input
179
+ :placeholder="$gettext('Date to')"
180
+ :lang="getDatePickerLanguage()"
181
+ type="date"
182
+ :value="filter.range.end"
183
+ @change="
184
+ onChange({
185
+ dataType: item.type,
186
+ value: $event,
187
+ choice: 'end',
188
+ field: filter.field
189
+ })
190
+ "
191
+ @focus="onDatepickerFocus(filter.range)"
192
+ @close="onDatepickerBlur()"
193
+ format="YYYY-MM-DD"
194
+ valueType="format"
195
+ :disabled-date="disablePastDates"
196
+ />
197
+ </grid-container>
198
+ </section-container>
175
199
  <select-component
176
200
  v-else
177
201
  selectWidth="100%"
@@ -194,8 +218,8 @@
194
218
  </template>
195
219
  <template #dropdown>
196
220
  <Option
197
- v-for="filterOption in filter.choices"
198
- :key="filterOption.choice"
221
+ v-for="(filterOption, filterIdx) in filter.choices"
222
+ :key="filterIdx + '_filterIdx'"
199
223
  :value="filterOption.choice"
200
224
  >{{ filterOption.text }}</Option
201
225
  >
@@ -207,15 +231,15 @@
207
231
  </column-wrapper>
208
232
  <button-container>
209
233
  <main-button
210
- v-if="buttonText.save_view && hasActiveView"
234
+ v-if="buttonText.apply_view && hasActiveView"
211
235
  type="primary"
212
- :text="buttonText.save_view"
213
- @click.native="$emit('on-save-current-view')"
236
+ :text="buttonText.apply_view"
237
+ @click.native="$emit('on-apply-current-view')"
214
238
  />
215
239
  <main-button
216
240
  type="secondary"
217
- v-if="buttonText.save_new_view"
218
- :text="buttonText.save_new_view"
241
+ v-if="buttonText.save_view"
242
+ :text="buttonText.save_view"
219
243
  @click.native="$emit('on-save-new-view')"
220
244
  />
221
245
  <main-button
@@ -238,6 +262,7 @@ import MainButton from '../buttons/mainButton'
238
262
  import Checkbox from '../inputs/checkbox'
239
263
  import draggable from 'vuedraggable'
240
264
  import Icon from '../icon'
265
+ import DeleteIcon from '../deleteIcon'
241
266
  import { datePickerLang } from '../../helpers/translateLang'
242
267
  import 'vue2-datepicker/index.css'
243
268
  import 'vue2-datepicker/locale/de'
@@ -258,10 +283,16 @@ const ContainerWrapper = styled.div`
258
283
  font-size: 13px;
259
284
  `
260
285
 
261
- const ColAttrs = { numCols: Number }
286
+ const ColAttrs = { numCols: Number, hasActiveView: Boolean }
262
287
  const ColumnWrapper = styled('div', ColAttrs)`
263
288
  display: grid;
264
289
  grid-template-columns: repeat(${(props) => props.numCols}, auto);
290
+
291
+ ${({ hasActiveView, theme }) =>
292
+ hasActiveView &&
293
+ `
294
+ border-top: 1px solid ${theme.colors.grey4};
295
+ `}
265
296
  `
266
297
 
267
298
  const TitleAttrs = { showBorder: Boolean }
@@ -269,8 +300,7 @@ const ColumnTitle = styled('div', TitleAttrs)`
269
300
  font-size: 14px;
270
301
  font-weight: 700;
271
302
  color: ${(props) => props.theme.colors.eturnityGrey};
272
- padding: 14px;
273
- border-bottom: 1px solid ${(props) => props.theme.colors.grey4};
303
+ padding: 10px 14px;
274
304
  ${({ showBorder, theme }) =>
275
305
  showBorder &&
276
306
  `
@@ -294,10 +324,16 @@ const DragContainer = styled.div`
294
324
  }
295
325
  `
296
326
 
297
- const RowContainer = styled.div`
298
- padding: 15px;
327
+ const RowContainer = styled('div', TitleAttrs)`
328
+ padding: 10px 14px;
299
329
  width: 260px;
300
330
 
331
+ ${({ showBorder, theme }) =>
332
+ showBorder &&
333
+ `
334
+ border-right: 1px solid ${theme.colors.grey4};
335
+ `}
336
+
301
337
  .ghost {
302
338
  opacity: 0.5;
303
339
  background-color: #e5fcb4;
@@ -316,7 +352,7 @@ const CheckboxContainer = styled.div`
316
352
  const CheckboxWrapper = styled.div`
317
353
  display: grid;
318
354
  grid-template-columns: auto 1fr;
319
- gap: 6px;
355
+ gap: 16px;
320
356
  padding: 2px;
321
357
  align-items: center;
322
358
  `
@@ -335,7 +371,7 @@ const RowWrapper = styled.div`
335
371
  const DatePickerInput = styled(DatePicker)`
336
372
  border: 1px solid ${(props) => props.theme.colors.grey4};
337
373
  border-radius: 4px;
338
- padding: 7px 12px 7px 15px;
374
+ padding: 7px 12px 7px 7px;
339
375
  width: 100%;
340
376
  position: relative;
341
377
 
@@ -355,7 +391,6 @@ const DatePickerInput = styled(DatePicker)`
355
391
  padding: 0;
356
392
  font-size: 13px;
357
393
  box-shadow: none;
358
- /* font-family: ${(props) => props.theme.fonts.mainFont}; */
359
394
  color: #393939;
360
395
  vertical-align: bottom;
361
396
  }
@@ -383,6 +418,22 @@ const RowLabel = styled('div', LabelAttrs)`
383
418
  margin-top: ${(props) => (props.marginTop ? '12px' : '0')};
384
419
  `
385
420
 
421
+ const SectionContainer = styled.div``
422
+
423
+ const GridContainer = styled.div`
424
+ display: grid;
425
+ grid-template-columns: 1fr 1fr;
426
+ grid-gap: 12px;
427
+ `
428
+
429
+ const ViewContainerAttrs = { maxWidth: Number }
430
+ const ViewContainer = styled('div', ViewContainerAttrs)`
431
+ padding: 10px 14px;
432
+
433
+ max-width: ${(props) =>
434
+ props.maxWidth && props.maxWidth > 260 ? props.maxWidth + 'ch' : '260px'};
435
+ `
436
+
386
437
  export default {
387
438
  name: 'filter-settings',
388
439
  components: {
@@ -406,7 +457,11 @@ export default {
406
457
  DragContainer,
407
458
  InputNumber,
408
459
  DatePickerInput,
409
- RowLabel
460
+ RowLabel,
461
+ SectionContainer,
462
+ GridContainer,
463
+ ViewContainer,
464
+ DeleteIcon
410
465
  },
411
466
  props: {
412
467
  filterData: {
@@ -424,11 +479,17 @@ export default {
424
479
  // 'save_view': '$gettext("save_view")'
425
480
  // }
426
481
  },
482
+ filterViews: {
483
+ required: true
484
+ },
427
485
  activeLanguage: {
428
486
  required: false
429
487
  },
430
488
  settingsTranslations: {
431
489
  required: false
490
+ },
491
+ activeView: {
492
+ required: false
432
493
  }
433
494
  },
434
495
  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
@@ -114,12 +106,11 @@ export default {
114
106
  this.$emit('on-filter-view-select', item)
115
107
  },
116
108
  onViewDelete(item) {
117
- this.onToggleDropdown()
118
109
  this.$emit('on-filter-view-delete', item)
119
110
  },
120
- onSaveCurrentView() {
111
+ onApplyCurrentView() {
121
112
  this.onToggleDropdown()
122
- this.$emit('on-save-current-view')
113
+ this.$emit('on-apply-current-view')
123
114
  }
124
115
  },
125
116
  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>