@eturnity/eturnity_reusable_components 7.24.3-EPDM-11320.0 → 7.24.3-EPDM-11143.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.
Files changed (67) hide show
  1. package/.prettierrc +7 -0
  2. package/package.json +20 -6
  3. package/public/favicon.ico +0 -0
  4. package/public/index.html +17 -0
  5. package/src/App.vue +70 -75
  6. package/src/assets/svgIcons/copy.svg +10 -0
  7. package/src/components/addNewButton/index.vue +27 -24
  8. package/src/components/banner/actionBanner/index.vue +30 -32
  9. package/src/components/banner/banner/index.vue +80 -88
  10. package/src/components/banner/infoBanner/index.vue +44 -36
  11. package/src/components/buttons/buttonIcon/index.vue +78 -83
  12. package/src/components/buttons/closeButton/index.vue +26 -26
  13. package/src/components/buttons/mainButton/index.vue +76 -80
  14. package/src/components/card/index.vue +52 -56
  15. package/src/components/collapsableInfoText/index.vue +76 -81
  16. package/src/components/deleteIcon/index.vue +28 -31
  17. package/src/components/draggableInputHandle/index.vue +17 -20
  18. package/src/components/dropdown/Dropdown.stories.js +8 -8
  19. package/src/components/dropdown/index.vue +72 -75
  20. package/src/components/errorMessage/index.vue +23 -23
  21. package/src/components/filter/filterSettings.vue +329 -349
  22. package/src/components/filter/index.vue +130 -130
  23. package/src/components/filter/parentDropdown.vue +40 -43
  24. package/src/components/icon/Icons.stories.js +4 -4
  25. package/src/components/icon/iconCache.js +1 -1
  26. package/src/components/icon/iconCollection.vue +37 -40
  27. package/src/components/icon/index.vue +65 -72
  28. package/src/components/iconWrapper/index.vue +118 -122
  29. package/src/components/infoCard/index.vue +17 -20
  30. package/src/components/infoText/index.vue +82 -88
  31. package/src/components/inputs/checkbox/index.vue +94 -91
  32. package/src/components/inputs/inputNumber/index.vue +488 -508
  33. package/src/components/inputs/inputNumberQuestion/index.vue +124 -127
  34. package/src/components/inputs/inputText/index.vue +252 -265
  35. package/src/components/inputs/radioButton/index.vue +120 -135
  36. package/src/components/inputs/searchInput/index.vue +81 -84
  37. package/src/components/inputs/select/index.vue +631 -644
  38. package/src/components/inputs/select/option/index.vue +91 -91
  39. package/src/components/inputs/select/select.stories.js +7 -7
  40. package/src/components/inputs/slider/index.vue +46 -46
  41. package/src/components/inputs/switchField/index.vue +152 -159
  42. package/src/components/inputs/textAreaInput/index.vue +113 -120
  43. package/src/components/inputs/toggle/index.vue +127 -137
  44. package/src/components/label/index.vue +61 -64
  45. package/src/components/markerItem/index.vue +40 -40
  46. package/src/components/modals/actionModal/index.vue +29 -32
  47. package/src/components/modals/infoModal/index.vue +27 -34
  48. package/src/components/modals/modal/index.vue +80 -88
  49. package/src/components/navigationTabs/index.vue +47 -50
  50. package/src/components/pageSubtitle/index.vue +29 -33
  51. package/src/components/pageTitle/index.vue +39 -47
  52. package/src/components/pagination/index.vue +62 -64
  53. package/src/components/progressBar/index.vue +67 -70
  54. package/src/components/projectMarker/index.vue +163 -172
  55. package/src/components/rangeSlider/Slider.vue +449 -449
  56. package/src/components/rangeSlider/index.vue +270 -282
  57. package/src/components/rangeSlider/utils/dom.js +3 -3
  58. package/src/components/selectedOptions/index.vue +51 -51
  59. package/src/components/sideMenu/index.vue +109 -117
  60. package/src/components/spinner/index.vue +34 -37
  61. package/src/components/tableDropdown/index.vue +326 -343
  62. package/src/components/tables/mainTable/index.vue +106 -109
  63. package/src/components/tables/viewTable/index.vue +92 -105
  64. package/src/components/threeDots/index.vue +171 -174
  65. package/src/components/videoThumbnail/index.vue +59 -67
  66. package/src/components/videoThumbnail/videoThumbnail.stories.js +6 -6
  67. package/.eslintrc.js +0 -125
@@ -1,80 +1,70 @@
1
1
  <template>
2
- <ContainerWrapper @click="$emit('on-container-click')">
3
- <UpperContainer v-if="filterViews && filterViews.length">
4
- <ViewContainer :max-width="activeView.length">
5
- <SelectComponent
6
- align-items="vertical"
7
- font-size="13px"
8
- :label="$gettext('active_filter')"
9
- select-height="36px"
10
- select-width="100%"
2
+ <container-wrapper @click="$emit('on-container-click')">
3
+ <upper-container v-if="filterViews && filterViews.length">
4
+ <view-container :maxWidth="activeView.length">
5
+ <select-component
11
6
  @click.stop
7
+ selectWidth="100%"
8
+ selectHeight="36px"
9
+ fontSize="13px"
10
+ :label="$gettext('active_filter')"
11
+ alignItems="vertical"
12
12
  >
13
13
  <template #selector>
14
- <OptionTitle>
14
+ <option-title>
15
15
  {{ activeView }}
16
- </OptionTitle>
16
+ </option-title>
17
17
  </template>
18
18
  <template #dropdown>
19
19
  <Option
20
20
  v-for="(item, idx) in filterViews"
21
21
  :key="idx + '_view'"
22
- :value="item.name"
23
22
  @click="$emit('on-view-select', item)"
24
- >
25
- {{ item.name }}
26
- <DeleteIcon @click.stop="$emit('on-view-delete', item)" />
27
- </Option>
23
+ :value="item.name"
24
+ >{{ item.name }}
25
+ <delete-icon @click.stop="$emit('on-view-delete', item)"
26
+ /></Option>
28
27
  </template>
29
- </SelectComponent>
30
- </ViewContainer>
31
- <ResetButton @click="$emit('on-reset-filters')">
32
- <Icon
33
- :color="theme.colors.blue"
34
- :name="'update'"
35
- size="14px"
36
- />
28
+ </select-component>
29
+ </view-container>
30
+ <reset-button @click="$emit('on-reset-filters')">
31
+ <icon :name="'update'" size="14px" :color="theme.colors.blue" />
37
32
  <div>{{ $gettext('reset_filters') }}</div>
38
- </ResetButton>
39
- </UpperContainer>
40
- <ColumnWrapper
41
- :has-active-view="!!filterViews && !!filterViews.length"
42
- :num-cols="filterData.length"
33
+ </reset-button>
34
+ </upper-container>
35
+ <column-wrapper
36
+ :numCols="filterData.length"
37
+ :hasActiveView="!!filterViews && !!filterViews.length"
43
38
  >
44
- <ColumnContainer
39
+ <column-container
45
40
  v-for="(item, idx) in filterData"
46
41
  :key="idx + '_filterdata'"
47
42
  >
48
- <ColumnTitle
43
+ <column-title
44
+ :showBorder="idx + 1 !== filterData.length"
49
45
  :data-id="`filter_label_project_view_file_manager_${item.type}`"
50
- :show-border="idx + 1 !== filterData.length"
51
46
  >
52
47
  {{ item.columnName }}
53
- </ColumnTitle>
54
- <RowContainer v-if="item.type === 'columns'">
55
- <CheckboxContainer>
56
- <Draggable
57
- v-model="item.dataOptions"
58
- ghost-class="ghost"
48
+ </column-title>
49
+ <row-container v-if="item.type === 'columns'">
50
+ <checkbox-container>
51
+ <draggable
52
+ @change="onDragChange({ data: item.dataOptions })"
59
53
  handle=".drag-container"
60
- item-key="choice"
61
- :set-data="modifyDragItem"
62
54
  style="display: contents"
63
- @change="onDragChange({ data: item.dataOptions })"
55
+ ghost-class="ghost"
56
+ :setData="modifyDragItem"
57
+ v-model="item.dataOptions"
58
+ itemKey="choice"
64
59
  >
65
60
  <template #item="{ element: column }">
66
- <CheckboxWrapper>
67
- <DragContainer class="drag-container">
68
- <Icon
69
- :name="'duplicate-1'"
70
- size="12px"
71
- />
72
- </DragContainer>
73
- <Checkbox
74
- :is-checked="column.selected"
75
- :is-disabled="column.selected && isCheckboxDisabled"
61
+ <checkbox-wrapper>
62
+ <drag-container class="drag-container">
63
+ <icon :name="'duplicate-1'" size="12px" />
64
+ </drag-container>
65
+ <checkbox
76
66
  :label="column.text"
77
- size="small"
67
+ :isChecked="column.selected"
78
68
  @on-event-handler="
79
69
  onChange({
80
70
  dataType: item.type,
@@ -82,45 +72,43 @@
82
72
  choice: column.choice
83
73
  })
84
74
  "
75
+ size="small"
76
+ :isDisabled="column.selected && isCheckboxDisabled"
85
77
  />
86
- </CheckboxWrapper>
78
+ </checkbox-wrapper>
87
79
  </template>
88
- </Draggable>
89
- </CheckboxContainer>
90
- </RowContainer>
91
- <RowContainer
92
- v-if="item.type === 'filter'"
93
- show-border
94
- >
95
- <RowWrapper
80
+ </draggable>
81
+ </checkbox-container>
82
+ </row-container>
83
+ <row-container v-if="item.type === 'filter'" showBorder>
84
+ <row-wrapper
96
85
  v-for="(filter, index) in item.dataOptions"
97
86
  :key="index + '_field'"
98
87
  >
99
- <SelectComponent
88
+ <select-component
100
89
  v-if="isMultipleSelector(filter.filter_type)"
101
- align-items="vertical"
102
- :disabled="!filter.choices.length"
103
- font-size="13px"
104
- :is-searchable="filter.choices.length > 7"
90
+ selectWidth="100%"
91
+ selectHeight="36px"
92
+ fontSize="13px"
105
93
  :label="filter.label"
106
- :label-data-id="filter.dataId"
107
- :min-option-length="1"
108
- select-height="36px"
109
- select-width="100%"
94
+ :labelDataId="filter.dataId"
95
+ :isSearchable="filter.choices.length > 7"
96
+ alignItems="vertical"
97
+ :disabled="!filter.choices.length"
98
+ :minOptionLength="1"
110
99
  >
111
100
  <template #selector>
112
- <OptionTitle> {{ filter.selectedText }} </OptionTitle>
101
+ <option-title> {{ filter.selectedText }} </option-title>
113
102
  </template>
114
103
  <template #dropdown>
115
- <DropdownCheckboxContainer
104
+ <dropdown-checkbox-container
116
105
  v-for="(filterOption, optionIdx) in filter.choices"
117
106
  :key="optionIdx + 'optionIdx'"
118
107
  @click.stop
119
108
  >
120
- <Checkbox
121
- :is-checked="filterOption.selected"
109
+ <checkbox
122
110
  :label="filterOption.text"
123
- size="small"
111
+ :isChecked="filterOption.selected"
124
112
  @on-event-handler="
125
113
  onChange({
126
114
  dataType: item.type,
@@ -129,25 +117,21 @@
129
117
  field: filter.field
130
118
  })
131
119
  "
120
+ size="small"
132
121
  />
133
- </DropdownCheckboxContainer>
122
+ </dropdown-checkbox-container>
134
123
  </template>
135
- </SelectComponent>
136
- <SectionContainer v-else-if="isRangeSelector(filter.filter_type)">
137
- <RowLabel :data-id="filter.dataId">
138
- {{ filter.label }}
139
- </RowLabel>
140
- <GridContainer>
141
- <InputNumber
142
- font-size="13px"
143
- input-height="36px"
144
- :number-precision="isIntegerRange(filter.filter_type) ? 0 : 2"
124
+ </select-component>
125
+ <section-container v-else-if="isRangeSelector(filter.filter_type)">
126
+ <row-label :data-id="filter.dataId">{{ filter.label }}</row-label>
127
+ <grid-container>
128
+ <input-number
145
129
  :placeholder="
146
130
  filter.unit
147
131
  ? $gettext('min') + ' (' + filter.unit + ')'
148
132
  : $gettext('min')
149
133
  "
150
- :unit-name="filter.unit"
134
+ :numberPrecision="isIntegerRange(filter.filter_type) ? 0 : 2"
151
135
  :value="filter.range.start"
152
136
  @input-change="
153
137
  onChange({
@@ -157,17 +141,17 @@
157
141
  field: filter.field
158
142
  })
159
143
  "
144
+ fontSize="13px"
145
+ inputHeight="36px"
146
+ :unitName="filter.unit"
160
147
  />
161
- <InputNumber
162
- font-size="13px"
163
- input-height="36px"
164
- :number-precision="isIntegerRange(filter.filter_type) ? 0 : 2"
148
+ <input-number
165
149
  :placeholder="
166
150
  filter.unit
167
151
  ? $gettext('max') + ' (' + filter.unit + ')'
168
152
  : $gettext('max')
169
153
  "
170
- :unit-name="filter.unit"
154
+ :numberPrecision="isIntegerRange(filter.filter_type) ? 0 : 2"
171
155
  :value="filter.range.end"
172
156
  @input-change="
173
157
  onChange({
@@ -177,30 +161,31 @@
177
161
  field: filter.field
178
162
  })
179
163
  "
164
+ fontSize="13px"
165
+ inputHeight="36px"
166
+ :unitName="filter.unit"
180
167
  />
181
- </GridContainer>
182
- </SectionContainer>
183
- <SectionContainer
168
+ </grid-container>
169
+ </section-container>
170
+ <section-container
184
171
  v-else-if="isDateSelector(filter.filter_type)"
185
172
  @click.stop
186
173
  >
187
- <RowLabel :data-id="filter.dataId">
188
- {{ filter.label }}
189
- </RowLabel>
190
- <GridContainer>
174
+ <row-label :data-id="filter.dataId">{{ filter.label }}</row-label>
175
+ <grid-container>
191
176
  <VueDatePicker
192
- :auto-apply="true"
177
+ text-input
178
+ :placeholder="$gettext('Date from')"
179
+ :locale="getDatePickerLanguage()"
180
+ :model-value="filter.range.start"
181
+ :enable-time-picker="false"
193
182
  :clearable="true"
183
+ :auto-apply="true"
194
184
  :disabled-dates="disableFutureDates"
195
- :enable-time-picker="false"
196
185
  format="yyyy-MM-dd"
197
- :locale="getDatePickerLanguage()"
198
186
  model-type="format"
199
- :model-value="filter.range.start"
200
- :placeholder="$gettext('Date from')"
201
- text-input
202
- @close="onDatepickerBlur()"
203
187
  @focus="onDatepickerFocus(filter.range)"
188
+ @close="onDatepickerBlur()"
204
189
  @update:model-value="
205
190
  onChange({
206
191
  dataType: item.type,
@@ -211,18 +196,18 @@
211
196
  "
212
197
  />
213
198
  <VueDatePicker
214
- :auto-apply="true"
199
+ text-input
200
+ :placeholder="$gettext('Date to')"
201
+ :locale="getDatePickerLanguage()"
202
+ :model-value="filter.range.end"
203
+ :enable-time-picker="false"
215
204
  :clearable="true"
205
+ :auto-apply="true"
216
206
  :disabled-dates="disablePastDates"
217
- :enable-time-picker="false"
218
207
  format="yyyy-MM-dd"
219
- :locale="getDatePickerLanguage()"
220
208
  model-type="format"
221
- :model-value="filter.range.end"
222
- :placeholder="$gettext('Date to')"
223
- text-input
224
- @close="onDatepickerBlur()"
225
209
  @focus="onDatepickerFocus(filter.range)"
210
+ @close="onDatepickerBlur()"
226
211
  @update:model-value="
227
212
  onChange({
228
213
  dataType: item.type,
@@ -232,20 +217,20 @@
232
217
  })
233
218
  "
234
219
  />
235
- </GridContainer>
236
- </SectionContainer>
237
- <SelectComponent
220
+ </grid-container>
221
+ </section-container>
222
+ <select-component
238
223
  v-else
239
- align-items="vertical"
240
- :disabled="!filter.choices.length"
241
- font-size="13px"
242
- :is-searchable="filter.choices.length > 7"
224
+ selectWidth="100%"
225
+ selectHeight="36px"
226
+ fontSize="13px"
243
227
  :label="filter.label"
244
- select-height="36px"
245
- select-width="100%"
228
+ alignItems="vertical"
229
+ :isSearchable="filter.choices.length > 7"
230
+ :disabled="!filter.choices.length"
246
231
  >
247
232
  <template #selector="{ selectedValue }">
248
- <OptionTitle>
233
+ <option-title>
249
234
  {{
250
235
  getSelectedValue({
251
236
  value: selectedValue,
@@ -253,70 +238,65 @@
253
238
  filter
254
239
  })
255
240
  }}
256
- </OptionTitle>
241
+ </option-title>
257
242
  </template>
258
243
  <template #dropdown>
259
244
  <Option
260
245
  v-for="(filterOption, filterIdx) in filter.choices"
261
246
  :key="filterIdx + '_filterIdx'"
262
247
  :value="filterOption.choice"
248
+ >{{ filterOption.text }}</Option
263
249
  >
264
- {{ filterOption.text }}
265
- </Option>
266
250
  </template>
267
- </SelectComponent>
268
- </RowWrapper>
269
- </RowContainer>
270
- </ColumnContainer>
271
- </ColumnWrapper>
272
- <ButtonContainer>
273
- <MainButton
251
+ </select-component>
252
+ </row-wrapper>
253
+ </row-container>
254
+ </column-container>
255
+ </column-wrapper>
256
+ <button-container>
257
+ <main-button
274
258
  v-if="buttonText.apply_view"
275
- :text="buttonText.apply_view"
276
259
  type="primary"
260
+ :text="buttonText.apply_view"
277
261
  @click="$emit('on-apply-current-view')"
278
262
  />
279
- <MainButton
263
+ <main-button
264
+ type="secondary"
280
265
  v-if="buttonText.save_view"
281
266
  :text="buttonText.save_view"
282
- type="secondary"
283
267
  @click="$emit('on-save-new-view')"
284
268
  />
285
- <MainButton
269
+ <main-button
270
+ type="cancel"
286
271
  v-if="buttonText.cancel"
287
272
  :text="buttonText.cancel"
288
- type="cancel"
289
273
  @click="$emit('on-cancel-view')"
290
274
  />
291
- <ResetContainer v-if="!filterViews || !filterViews.length">
292
- <ResetButton @click="$emit('on-reset-filters')">
293
- <Icon
294
- :color="theme.colors.blue"
295
- :name="'update'"
296
- size="14px"
297
- />
275
+ <reset-container v-if="!filterViews || !filterViews.length">
276
+ <reset-button @click="$emit('on-reset-filters')">
277
+ <icon :name="'update'" size="14px" :color="theme.colors.blue" />
298
278
  <div>{{ $gettext('reset_filters') }}</div>
299
- </ResetButton>
300
- </ResetContainer>
301
- </ButtonContainer>
302
- </ContainerWrapper>
279
+ </reset-button>
280
+ </reset-container>
281
+ </button-container>
282
+ </container-wrapper>
303
283
  </template>
304
284
 
305
285
  <script>
306
- import styled from 'vue3-styled-components'
307
- import SelectComponent from '../inputs/select'
308
- import Option from '../inputs/select/option'
309
- import InputNumber from '../inputs/inputNumber'
310
- import MainButton from '../buttons/mainButton'
311
- import Checkbox from '../inputs/checkbox'
312
- import draggable from 'vuedraggable'
313
- import Icon from '../icon'
314
- import DeleteIcon from '../deleteIcon'
315
- import { datePickerLang } from '../../helpers/translateLang'
316
- import theme from '@/assets/theme.js'
317
- import VueDatePicker from '@vuepic/vue-datepicker'
286
+ import styled from 'vue3-styled-components'
287
+ import SelectComponent from '../inputs/select'
288
+ import Option from '../inputs/select/option'
289
+ import InputNumber from '../inputs/inputNumber'
290
+ import MainButton from '../buttons/mainButton'
291
+ import Checkbox from '../inputs/checkbox'
292
+ import draggable from 'vuedraggable'
293
+ import Icon from '../icon'
294
+ import DeleteIcon from '../deleteIcon'
295
+ import { datePickerLang } from '../../helpers/translateLang'
296
+ import theme from '@/assets/theme.js'
297
+ import VueDatePicker from '@vuepic/vue-datepicker'
318
298
 
319
- const ContainerWrapper = styled.div`
299
+ const ContainerWrapper = styled.div`
320
300
  position: absolute;
321
301
  margin-top: 4px;
322
302
  background-color: ${(props) => props.theme.colors.white};
@@ -328,8 +308,8 @@
328
308
  font-size: 13px;
329
309
  `
330
310
 
331
- const ColAttrs = { numCols: Number, hasActiveView: Boolean }
332
- const ColumnWrapper = styled('div', ColAttrs)`
311
+ const ColAttrs = { numCols: Number, hasActiveView: Boolean }
312
+ const ColumnWrapper = styled('div', ColAttrs)`
333
313
  display: grid;
334
314
  grid-template-columns: repeat(${(props) => props.numCols}, auto);
335
315
 
@@ -340,8 +320,8 @@
340
320
  `}
341
321
  `
342
322
 
343
- const TitleAttrs = { showBorder: Boolean }
344
- const ColumnTitle = styled('div', TitleAttrs)`
323
+ const TitleAttrs = { showBorder: Boolean }
324
+ const ColumnTitle = styled('div', TitleAttrs)`
345
325
  font-size: 14px;
346
326
  font-weight: 700;
347
327
  color: ${(props) => props.theme.colors.eturnityGrey};
@@ -353,13 +333,13 @@
353
333
  `}
354
334
  `
355
335
 
356
- const ButtonContainer = styled.div`
336
+ const ButtonContainer = styled.div`
357
337
  display: flex;
358
338
  gap: 10px;
359
339
  padding: 15px;
360
340
  `
361
341
 
362
- const ResetContainer = styled.div`
342
+ const ResetContainer = styled.div`
363
343
  display: grid;
364
344
  align-content: center;
365
345
  margin-left: auto;
@@ -369,9 +349,9 @@
369
349
  }
370
350
  `
371
351
 
372
- const ColumnContainer = styled.div``
352
+ const ColumnContainer = styled.div``
373
353
 
374
- const DragContainer = styled.div`
354
+ const DragContainer = styled.div`
375
355
  cursor: grab;
376
356
 
377
357
  &:active {
@@ -379,7 +359,7 @@
379
359
  }
380
360
  `
381
361
 
382
- const RowContainer = styled('div', TitleAttrs)`
362
+ const RowContainer = styled('div', TitleAttrs)`
383
363
  padding: 10px 14px;
384
364
  min-width: 300px;
385
365
 
@@ -395,16 +375,16 @@
395
375
  }
396
376
  `
397
377
 
398
- const OptionTitle = styled.div`
378
+ const OptionTitle = styled.div`
399
379
  cursor: pointer !important;
400
380
  `
401
381
 
402
- const CheckboxContainer = styled.div`
382
+ const CheckboxContainer = styled.div`
403
383
  display: grid;
404
384
  gap: 6px;
405
385
  `
406
386
 
407
- const CheckboxWrapper = styled.div`
387
+ const CheckboxWrapper = styled.div`
408
388
  display: grid;
409
389
  grid-template-columns: auto 1fr;
410
390
  gap: 16px;
@@ -412,7 +392,7 @@
412
392
  align-items: center;
413
393
  `
414
394
 
415
- const DropdownCheckboxContainer = styled.div`
395
+ const DropdownCheckboxContainer = styled.div`
416
396
  display: grid;
417
397
  gap: 6px;
418
398
  width: 100%;
@@ -420,42 +400,42 @@
420
400
  background: ${(props) => props.theme.colors.grey5};
421
401
  `
422
402
 
423
- const RowWrapper = styled.div`
403
+ const RowWrapper = styled.div`
424
404
  margin-bottom: 12px;
425
405
  `
426
406
 
427
- const LabelAttrs = {
428
- marginTop: Boolean
429
- }
430
- const RowLabel = styled('div', LabelAttrs)`
407
+ const LabelAttrs = {
408
+ marginTop: Boolean
409
+ }
410
+ const RowLabel = styled('div', LabelAttrs)`
431
411
  font-weight: 700;
432
412
  font-size: 13px;
433
413
  margin-bottom: 8px;
434
414
  margin-top: ${(props) => (props.marginTop ? '12px' : '0')};
435
415
  `
436
416
 
437
- const SectionContainer = styled.div``
417
+ const SectionContainer = styled.div``
438
418
 
439
- const GridContainer = styled.div`
419
+ const GridContainer = styled.div`
440
420
  display: grid;
441
421
  grid-template-columns: 1fr 1fr;
442
422
  grid-gap: 12px;
443
423
  `
444
424
 
445
- const ViewContainerAttrs = { maxWidth: Number }
446
- const ViewContainer = styled('div', ViewContainerAttrs)`
425
+ const ViewContainerAttrs = { maxWidth: Number }
426
+ const ViewContainer = styled('div', ViewContainerAttrs)`
447
427
  max-width: ${(props) =>
448
- props.maxWidth && props.maxWidth > 300 ? props.maxWidth + 'ch' : '300px'};
428
+ props.maxWidth && props.maxWidth > 300 ? props.maxWidth + 'ch' : '300px'};
449
429
  `
450
430
 
451
- const UpperContainer = styled.div`
431
+ const UpperContainer = styled.div`
452
432
  display: grid;
453
433
  grid-gap: 20px
454
434
  grid-template-columns: 1fr 1fr;
455
435
  padding: 10px 14px;
456
436
  `
457
437
 
458
- const ResetButton = styled.div`
438
+ const ResetButton = styled.div`
459
439
  display: inline-flex;
460
440
  gap: 16px;
461
441
  width: max-content;
@@ -466,188 +446,188 @@
466
446
  cursor: pointer;
467
447
  `
468
448
 
469
- export default {
470
- name: 'FilterSettings',
471
- components: {
472
- ContainerWrapper,
473
- ColumnWrapper,
474
- ColumnTitle,
475
- ColumnContainer,
476
- SelectComponent,
477
- RowContainer,
478
- OptionTitle,
479
- Option,
480
- ButtonContainer,
481
- MainButton,
482
- CheckboxContainer,
483
- CheckboxWrapper,
484
- Checkbox,
485
- RowWrapper,
486
- DropdownCheckboxContainer,
487
- draggable,
488
- Icon,
489
- DragContainer,
490
- InputNumber,
491
- RowLabel,
492
- SectionContainer,
493
- GridContainer,
494
- ViewContainer,
495
- DeleteIcon,
496
- UpperContainer,
497
- ResetButton,
498
- ResetContainer,
499
- VueDatePicker
449
+ export default {
450
+ name: 'filter-settings',
451
+ components: {
452
+ ContainerWrapper,
453
+ ColumnWrapper,
454
+ ColumnTitle,
455
+ ColumnContainer,
456
+ SelectComponent,
457
+ RowContainer,
458
+ OptionTitle,
459
+ Option,
460
+ ButtonContainer,
461
+ MainButton,
462
+ CheckboxContainer,
463
+ CheckboxWrapper,
464
+ Checkbox,
465
+ RowWrapper,
466
+ DropdownCheckboxContainer,
467
+ draggable,
468
+ Icon,
469
+ DragContainer,
470
+ InputNumber,
471
+ RowLabel,
472
+ SectionContainer,
473
+ GridContainer,
474
+ ViewContainer,
475
+ DeleteIcon,
476
+ UpperContainer,
477
+ ResetButton,
478
+ ResetContainer,
479
+ VueDatePicker
480
+ },
481
+ props: {
482
+ filterData: {
483
+ required: true
484
+ },
485
+ hasActiveView: {
486
+ required: false
500
487
  },
501
- props: {
502
- filterData: {
503
- required: true
504
- },
505
- hasActiveView: {
506
- required: false
507
- },
508
- buttonText: {
509
- required: true
488
+ buttonText: {
489
+ required: true
510
490
  // example:
511
491
  // {
512
492
  // 'save_new_view': '$gettext("save_new_view")',
513
493
  // 'cancel': '$gettext("cancel")',
514
494
  // 'save_view': '$gettext("save_view")'
515
495
  // }
516
- },
517
- filterViews: {
518
- required: true
519
- },
520
- activeLanguage: {
521
- required: false
522
- },
523
- settingsTranslations: {
524
- required: false
525
- },
526
- activeView: {
527
- required: false
528
- }
529
496
  },
530
- data() {
531
- return {
532
- selectedDates: null,
533
- value1: null,
534
- dateStart: null,
535
- dateEnd: null
536
- }
497
+ filterViews: {
498
+ required: true
537
499
  },
538
- computed: {
539
- isCheckboxDisabled() {
540
- // if only 1 item left, disable checkbox
541
- let isDisabled = false
542
- let columnsData = this.filterData.filter(
543
- (item) => item.type === 'columns'
544
- )
545
- if (columnsData.length) {
546
- columnsData = columnsData[0]
547
- const filteredColumns = columnsData.dataOptions.filter(
548
- (item) => item.selected
549
- )
550
- if (filteredColumns.length === 1) {
551
- isDisabled = true
552
- }
553
- }
554
- return isDisabled
555
- },
556
- theme() {
557
- return theme
500
+ activeLanguage: {
501
+ required: false
502
+ },
503
+ settingsTranslations: {
504
+ required: false
505
+ },
506
+ activeView: {
507
+ required: false
508
+ }
509
+ },
510
+ data() {
511
+ return {
512
+ selectedDates: null,
513
+ value1: null,
514
+ dateStart: null,
515
+ dateEnd: null
516
+ }
517
+ },
518
+ methods: {
519
+ onChange({ dataType, value, choice, field }) {
520
+ if (
521
+ dataType === 'columns' &&
522
+ this.isCheckboxDisabled &&
523
+ value === false
524
+ ) {
525
+ return
558
526
  }
527
+ const data = { dataType, value, choice, field }
528
+ this.$emit('on-filter-change', data)
559
529
  },
560
- methods: {
561
- onChange({ dataType, value, choice, field }) {
562
- if (
563
- dataType === 'columns' &&
564
- this.isCheckboxDisabled &&
565
- value === false
566
- ) {
567
- return
568
- }
569
- const data = { dataType, value, choice, field }
570
- this.$emit('on-filter-change', data)
571
- },
572
- onDatepickerFocus(range) {
573
- this.dateStart = range.start
574
- this.dateEnd = range.end
575
- this.$emit('on-prevent-close', true)
576
- },
577
- onDatepickerBlur() {
578
- this.$emit('on-prevent-close', false)
579
- },
580
- disablePastDates(date) {
581
- const dateString = this.dateStart
582
- if (!dateString) {
583
- return
584
- }
585
- const dateParts = dateString.split('-')
530
+ onDatepickerFocus(range) {
531
+ this.dateStart = range.start
532
+ this.dateEnd = range.end
533
+ this.$emit('on-prevent-close', true)
534
+ },
535
+ onDatepickerBlur() {
536
+ this.$emit('on-prevent-close', false)
537
+ },
538
+ disablePastDates(date) {
539
+ const dateString = this.dateStart
540
+ if (!dateString) {
541
+ return
542
+ }
543
+ const dateParts = dateString.split('-')
586
544
 
587
- const year = parseInt(dateParts[0])
588
- const month = parseInt(dateParts[1]) - 1 // Subtract 1 since January is month 0
589
- const day = parseInt(dateParts[2])
545
+ const year = parseInt(dateParts[0])
546
+ const month = parseInt(dateParts[1]) - 1 // Subtract 1 since January is month 0
547
+ const day = parseInt(dateParts[2])
590
548
 
591
- const currentDate = new Date(year, month, day)
592
- const selectedDate = new Date(date)
549
+ const currentDate = new Date(year, month, day)
550
+ const selectedDate = new Date(date)
593
551
 
594
- // Disable dates that are greater than or equal to the current date
595
- return selectedDate <= currentDate
596
- },
597
- disableFutureDates(date) {
598
- const dateString = this.dateEnd
599
- if (!dateString) {
600
- return
601
- }
602
- const dateParts = dateString.split('-')
552
+ // Disable dates that are greater than or equal to the current date
553
+ return selectedDate <= currentDate
554
+ },
555
+ disableFutureDates(date) {
556
+ const dateString = this.dateEnd
557
+ if (!dateString) {
558
+ return
559
+ }
560
+ const dateParts = dateString.split('-')
603
561
 
604
- const year = parseInt(dateParts[0])
605
- const month = parseInt(dateParts[1]) - 1 // Subtract 1 since January is month 0
606
- const day = parseInt(dateParts[2])
562
+ const year = parseInt(dateParts[0])
563
+ const month = parseInt(dateParts[1]) - 1 // Subtract 1 since January is month 0
564
+ const day = parseInt(dateParts[2])
607
565
 
608
- const currentDate = new Date(year, month, day)
609
- const selectedDate = new Date(date)
566
+ const currentDate = new Date(year, month, day)
567
+ const selectedDate = new Date(date)
610
568
 
611
- // Disable dates that are greater than or equal to the current date
612
- return selectedDate >= currentDate
613
- },
614
- getDatePickerLanguage() {
615
- return datePickerLang(this.activeLanguage)
616
- },
617
- onDragChange({ data }) {
618
- this.$emit('on-drag-change', data)
619
- },
620
- modifyDragItem(dataTransfer) {
621
- const isSafari = /^((?!chrome|android).)*safari/i.test(
622
- navigator.userAgent
569
+ // Disable dates that are greater than or equal to the current date
570
+ return selectedDate >= currentDate
571
+ },
572
+ getDatePickerLanguage() {
573
+ return datePickerLang(this.activeLanguage)
574
+ },
575
+ onDragChange({ data }) {
576
+ this.$emit('on-drag-change', data)
577
+ },
578
+ modifyDragItem(dataTransfer) {
579
+ const isSafari = /^((?!chrome|android).)*safari/i.test(
580
+ navigator.userAgent
581
+ )
582
+ // prevents the dragged element from dragging the whole row as a "ghost"
583
+ // Safari fix because this does not work on Safari
584
+ let img = new Image()
585
+ if (!isSafari) {
586
+ dataTransfer.setDragImage(img, 0, 0)
587
+ } else {
588
+ img.src =
589
+ 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
590
+ dataTransfer.setDragImage(img, 0, 0)
591
+ }
592
+ },
593
+ getSelectedValue({ value, options, filter }) {
594
+ const foundItem = options.find((item) => item.choice === value)
595
+ return foundItem ? foundItem.text : value ? value : filter.selectedText
596
+ },
597
+ isMultipleSelector(type) {
598
+ return type === 'multi_select_integer' || type === 'multi_select_string'
599
+ },
600
+ isRangeSelector(type) {
601
+ return type === 'integer_range' || type === 'number_range'
602
+ },
603
+ isIntegerRange(type) {
604
+ return type === 'integer_range'
605
+ },
606
+ isDateSelector(type) {
607
+ return type === 'datetime'
608
+ }
609
+ },
610
+ computed: {
611
+ isCheckboxDisabled() {
612
+ // if only 1 item left, disable checkbox
613
+ let isDisabled = false
614
+ let columnsData = this.filterData.filter(
615
+ (item) => item.type === 'columns'
616
+ )
617
+ if (columnsData.length) {
618
+ columnsData = columnsData[0]
619
+ const filteredColumns = columnsData.dataOptions.filter(
620
+ (item) => item.selected
623
621
  )
624
- // prevents the dragged element from dragging the whole row as a "ghost"
625
- // Safari fix because this does not work on Safari
626
- let img = new Image()
627
- if (!isSafari) {
628
- dataTransfer.setDragImage(img, 0, 0)
629
- } else {
630
- img.src =
631
- 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
632
- dataTransfer.setDragImage(img, 0, 0)
622
+ if (filteredColumns.length === 1) {
623
+ isDisabled = true
633
624
  }
634
- },
635
- getSelectedValue({ value, options, filter }) {
636
- const foundItem = options.find((item) => item.choice === value)
637
- return foundItem ? foundItem.text : value ? value : filter.selectedText
638
- },
639
- isMultipleSelector(type) {
640
- return type === 'multi_select_integer' || type === 'multi_select_string'
641
- },
642
- isRangeSelector(type) {
643
- return type === 'integer_range' || type === 'number_range'
644
- },
645
- isIntegerRange(type) {
646
- return type === 'integer_range'
647
- },
648
- isDateSelector(type) {
649
- return type === 'datetime'
650
625
  }
626
+ return isDisabled
627
+ },
628
+ theme() {
629
+ return theme
651
630
  }
652
631
  }
632
+ }
653
633
  </script>