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