@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.
- package/.prettierrc +7 -0
- package/package.json +20 -6
- package/public/favicon.ico +0 -0
- package/public/index.html +17 -0
- package/src/App.vue +70 -75
- package/src/assets/svgIcons/copy.svg +10 -0
- package/src/components/addNewButton/index.vue +27 -24
- package/src/components/banner/actionBanner/index.vue +30 -32
- package/src/components/banner/banner/index.vue +80 -88
- package/src/components/banner/infoBanner/index.vue +44 -36
- package/src/components/buttons/buttonIcon/index.vue +78 -83
- package/src/components/buttons/closeButton/index.vue +26 -26
- package/src/components/buttons/mainButton/index.vue +76 -80
- package/src/components/card/index.vue +52 -56
- package/src/components/collapsableInfoText/index.vue +76 -81
- package/src/components/deleteIcon/index.vue +28 -31
- package/src/components/draggableInputHandle/index.vue +17 -20
- package/src/components/dropdown/Dropdown.stories.js +8 -8
- package/src/components/dropdown/index.vue +72 -75
- package/src/components/errorMessage/index.vue +23 -23
- package/src/components/filter/filterSettings.vue +329 -349
- package/src/components/filter/index.vue +130 -130
- package/src/components/filter/parentDropdown.vue +40 -43
- package/src/components/icon/Icons.stories.js +4 -4
- package/src/components/icon/iconCache.js +1 -1
- package/src/components/icon/iconCollection.vue +37 -40
- package/src/components/icon/index.vue +65 -72
- package/src/components/iconWrapper/index.vue +118 -122
- package/src/components/infoCard/index.vue +17 -20
- package/src/components/infoText/index.vue +82 -88
- package/src/components/inputs/checkbox/index.vue +94 -91
- package/src/components/inputs/inputNumber/index.vue +488 -508
- package/src/components/inputs/inputNumberQuestion/index.vue +124 -127
- package/src/components/inputs/inputText/index.vue +252 -265
- package/src/components/inputs/radioButton/index.vue +120 -135
- package/src/components/inputs/searchInput/index.vue +81 -84
- package/src/components/inputs/select/index.vue +631 -644
- package/src/components/inputs/select/option/index.vue +91 -91
- package/src/components/inputs/select/select.stories.js +7 -7
- package/src/components/inputs/slider/index.vue +46 -46
- package/src/components/inputs/switchField/index.vue +152 -159
- package/src/components/inputs/textAreaInput/index.vue +113 -120
- package/src/components/inputs/toggle/index.vue +127 -137
- package/src/components/label/index.vue +61 -64
- package/src/components/markerItem/index.vue +40 -40
- package/src/components/modals/actionModal/index.vue +29 -32
- package/src/components/modals/infoModal/index.vue +27 -34
- package/src/components/modals/modal/index.vue +80 -88
- package/src/components/navigationTabs/index.vue +47 -50
- package/src/components/pageSubtitle/index.vue +29 -33
- package/src/components/pageTitle/index.vue +39 -47
- package/src/components/pagination/index.vue +62 -64
- package/src/components/progressBar/index.vue +67 -70
- package/src/components/projectMarker/index.vue +163 -172
- package/src/components/rangeSlider/Slider.vue +449 -449
- package/src/components/rangeSlider/index.vue +270 -282
- package/src/components/rangeSlider/utils/dom.js +3 -3
- package/src/components/selectedOptions/index.vue +51 -51
- package/src/components/sideMenu/index.vue +109 -117
- package/src/components/spinner/index.vue +34 -37
- package/src/components/tableDropdown/index.vue +326 -343
- package/src/components/tables/mainTable/index.vue +106 -109
- package/src/components/tables/viewTable/index.vue +92 -105
- package/src/components/threeDots/index.vue +171 -174
- package/src/components/videoThumbnail/index.vue +59 -67
- package/src/components/videoThumbnail/videoThumbnail.stories.js +6 -6
- package/.eslintrc.js +0 -125
@@ -1,80 +1,70 @@
|
|
1
1
|
<template>
|
2
|
-
<
|
3
|
-
<
|
4
|
-
<
|
5
|
-
<
|
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
|
-
<
|
14
|
+
<option-title>
|
15
15
|
{{ activeView }}
|
16
|
-
</
|
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
|
-
<
|
27
|
-
|
23
|
+
:value="item.name"
|
24
|
+
>{{ item.name }}
|
25
|
+
<delete-icon @click.stop="$emit('on-view-delete', item)"
|
26
|
+
/></Option>
|
28
27
|
</template>
|
29
|
-
</
|
30
|
-
</
|
31
|
-
<
|
32
|
-
<
|
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
|
-
</
|
39
|
-
</
|
40
|
-
<
|
41
|
-
:
|
42
|
-
:
|
33
|
+
</reset-button>
|
34
|
+
</upper-container>
|
35
|
+
<column-wrapper
|
36
|
+
:numCols="filterData.length"
|
37
|
+
:hasActiveView="!!filterViews && !!filterViews.length"
|
43
38
|
>
|
44
|
-
<
|
39
|
+
<column-container
|
45
40
|
v-for="(item, idx) in filterData"
|
46
41
|
:key="idx + '_filterdata'"
|
47
42
|
>
|
48
|
-
<
|
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
|
-
</
|
54
|
-
<
|
55
|
-
<
|
56
|
-
<
|
57
|
-
|
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
|
-
|
55
|
+
ghost-class="ghost"
|
56
|
+
:setData="modifyDragItem"
|
57
|
+
v-model="item.dataOptions"
|
58
|
+
itemKey="choice"
|
64
59
|
>
|
65
60
|
<template #item="{ element: column }">
|
66
|
-
<
|
67
|
-
<
|
68
|
-
<
|
69
|
-
|
70
|
-
|
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
|
-
|
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
|
-
</
|
78
|
+
</checkbox-wrapper>
|
87
79
|
</template>
|
88
|
-
</
|
89
|
-
</
|
90
|
-
</
|
91
|
-
<
|
92
|
-
|
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
|
-
<
|
88
|
+
<select-component
|
100
89
|
v-if="isMultipleSelector(filter.filter_type)"
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
:is-searchable="filter.choices.length > 7"
|
90
|
+
selectWidth="100%"
|
91
|
+
selectHeight="36px"
|
92
|
+
fontSize="13px"
|
105
93
|
:label="filter.label"
|
106
|
-
:
|
107
|
-
:
|
108
|
-
|
109
|
-
|
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
|
-
<
|
101
|
+
<option-title> {{ filter.selectedText }} </option-title>
|
113
102
|
</template>
|
114
103
|
<template #dropdown>
|
115
|
-
<
|
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
|
-
<
|
121
|
-
:is-checked="filterOption.selected"
|
109
|
+
<checkbox
|
122
110
|
:label="filterOption.text"
|
123
|
-
|
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
|
-
</
|
122
|
+
</dropdown-checkbox-container>
|
134
123
|
</template>
|
135
|
-
</
|
136
|
-
<
|
137
|
-
<
|
138
|
-
|
139
|
-
|
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
|
-
:
|
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
|
-
<
|
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
|
-
:
|
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
|
-
</
|
182
|
-
</
|
183
|
-
<
|
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
|
-
<
|
188
|
-
|
189
|
-
</RowLabel>
|
190
|
-
<GridContainer>
|
174
|
+
<row-label :data-id="filter.dataId">{{ filter.label }}</row-label>
|
175
|
+
<grid-container>
|
191
176
|
<VueDatePicker
|
192
|
-
|
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
|
-
|
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
|
-
</
|
236
|
-
</
|
237
|
-
<
|
220
|
+
</grid-container>
|
221
|
+
</section-container>
|
222
|
+
<select-component
|
238
223
|
v-else
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
:is-searchable="filter.choices.length > 7"
|
224
|
+
selectWidth="100%"
|
225
|
+
selectHeight="36px"
|
226
|
+
fontSize="13px"
|
243
227
|
:label="filter.label"
|
244
|
-
|
245
|
-
|
228
|
+
alignItems="vertical"
|
229
|
+
:isSearchable="filter.choices.length > 7"
|
230
|
+
:disabled="!filter.choices.length"
|
246
231
|
>
|
247
232
|
<template #selector="{ selectedValue }">
|
248
|
-
<
|
233
|
+
<option-title>
|
249
234
|
{{
|
250
235
|
getSelectedValue({
|
251
236
|
value: selectedValue,
|
@@ -253,70 +238,65 @@
|
|
253
238
|
filter
|
254
239
|
})
|
255
240
|
}}
|
256
|
-
</
|
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
|
-
</
|
268
|
-
</
|
269
|
-
</
|
270
|
-
</
|
271
|
-
</
|
272
|
-
<
|
273
|
-
<
|
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
|
-
<
|
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
|
-
<
|
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
|
-
<
|
292
|
-
<
|
293
|
-
<
|
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
|
-
</
|
300
|
-
</
|
301
|
-
</
|
302
|
-
</
|
279
|
+
</reset-button>
|
280
|
+
</reset-container>
|
281
|
+
</button-container>
|
282
|
+
</container-wrapper>
|
303
283
|
</template>
|
304
284
|
|
305
285
|
<script>
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
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
|
-
|
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
|
-
|
332
|
-
|
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
|
-
|
344
|
-
|
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
|
-
|
336
|
+
const ButtonContainer = styled.div`
|
357
337
|
display: flex;
|
358
338
|
gap: 10px;
|
359
339
|
padding: 15px;
|
360
340
|
`
|
361
341
|
|
362
|
-
|
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
|
-
|
352
|
+
const ColumnContainer = styled.div``
|
373
353
|
|
374
|
-
|
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
|
-
|
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
|
-
|
378
|
+
const OptionTitle = styled.div`
|
399
379
|
cursor: pointer !important;
|
400
380
|
`
|
401
381
|
|
402
|
-
|
382
|
+
const CheckboxContainer = styled.div`
|
403
383
|
display: grid;
|
404
384
|
gap: 6px;
|
405
385
|
`
|
406
386
|
|
407
|
-
|
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
|
-
|
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
|
-
|
403
|
+
const RowWrapper = styled.div`
|
424
404
|
margin-bottom: 12px;
|
425
405
|
`
|
426
406
|
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
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
|
-
|
417
|
+
const SectionContainer = styled.div``
|
438
418
|
|
439
|
-
|
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
|
-
|
446
|
-
|
425
|
+
const ViewContainerAttrs = { maxWidth: Number }
|
426
|
+
const ViewContainer = styled('div', ViewContainerAttrs)`
|
447
427
|
max-width: ${(props) =>
|
448
|
-
|
428
|
+
props.maxWidth && props.maxWidth > 300 ? props.maxWidth + 'ch' : '300px'};
|
449
429
|
`
|
450
430
|
|
451
|
-
|
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
|
-
|
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
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
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
|
-
|
502
|
-
|
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
|
-
|
531
|
-
|
532
|
-
selectedDates: null,
|
533
|
-
value1: null,
|
534
|
-
dateStart: null,
|
535
|
-
dateEnd: null
|
536
|
-
}
|
497
|
+
filterViews: {
|
498
|
+
required: true
|
537
499
|
},
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
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
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
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
|
-
|
588
|
-
|
589
|
-
|
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
|
-
|
592
|
-
|
549
|
+
const currentDate = new Date(year, month, day)
|
550
|
+
const selectedDate = new Date(date)
|
593
551
|
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
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
|
-
|
605
|
-
|
606
|
-
|
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
|
-
|
609
|
-
|
566
|
+
const currentDate = new Date(year, month, day)
|
567
|
+
const selectedDate = new Date(date)
|
610
568
|
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
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
|
-
|
625
|
-
|
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>
|