@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.
- package/.eslintrc.js +184 -0
- package/.prettierrc +8 -6
- package/package.json +9 -21
- package/src/App.vue +79 -78
- package/src/assets/theme.js +3 -3
- package/src/components/addNewButton/AddNewButton.stories.js +2 -2
- package/src/components/addNewButton/index.vue +48 -51
- package/src/components/banner/actionBanner/index.vue +54 -55
- package/src/components/banner/banner/banner.stories.js +5 -5
- package/src/components/banner/banner/index.vue +159 -159
- package/src/components/banner/infoBanner/index.vue +41 -53
- package/src/components/buttons/buttonIcon/index.vue +125 -122
- package/src/components/buttons/closeButton/CloseButton.stories.js +3 -3
- package/src/components/buttons/closeButton/index.vue +49 -49
- package/src/components/buttons/mainButton/index.vue +108 -108
- package/src/components/card/index.vue +70 -70
- package/src/components/collapsableInfoText/index.vue +96 -94
- package/src/components/deleteIcon/DeleteIcon.stories.js +4 -4
- package/src/components/deleteIcon/index.vue +54 -54
- package/src/components/draggableInputHandle/index.vue +37 -37
- package/src/components/dropdown/Dropdown.stories.js +9 -10
- package/src/components/dropdown/index.vue +106 -106
- package/src/components/errorMessage/index.vue +52 -52
- package/src/components/filter/filterSettings.vue +486 -452
- package/src/components/filter/index.vue +135 -135
- package/src/components/filter/parentDropdown.vue +73 -73
- package/src/components/icon/Icons.stories.js +7 -7
- package/src/components/icon/iconCollection.vue +53 -53
- package/src/components/icon/index.vue +122 -122
- package/src/components/iconWrapper/index.vue +156 -156
- package/src/components/infoCard/index.vue +30 -32
- package/src/components/infoText/index.vue +142 -137
- package/src/components/inputs/checkbox/Checkbox.stories.js +8 -8
- package/src/components/inputs/checkbox/index.vue +190 -180
- package/src/components/inputs/inputNumber/InputNumber.stories.js +41 -41
- package/src/components/inputs/inputNumber/index.vue +696 -701
- package/src/components/inputs/inputNumberQuestion/index.vue +185 -182
- package/src/components/inputs/inputText/InputText.stories.js +22 -22
- package/src/components/inputs/inputText/index.vue +337 -336
- package/src/components/inputs/radioButton/RadioButton.stories.js +16 -16
- package/src/components/inputs/radioButton/index.vue +222 -219
- package/src/components/inputs/searchInput/SearchInput.stories.js +8 -8
- package/src/components/inputs/searchInput/index.vue +127 -126
- package/src/components/inputs/select/index.vue +792 -792
- package/src/components/inputs/select/option/index.vue +124 -124
- package/src/components/inputs/select/select.stories.js +31 -32
- package/src/components/inputs/slider/index.vue +99 -99
- package/src/components/inputs/switchField/index.vue +220 -222
- package/src/components/inputs/textAreaInput/TextAreaInput.stories.js +57 -57
- package/src/components/inputs/textAreaInput/index.vue +171 -173
- package/src/components/inputs/toggle/Toggle.stories.js +14 -14
- package/src/components/inputs/toggle/index.vue +214 -217
- package/src/components/label/index.vue +82 -82
- package/src/components/markerItem/index.vue +68 -66
- package/src/components/modals/actionModal/index.vue +54 -54
- package/src/components/modals/infoModal/index.vue +39 -36
- package/src/components/modals/modal/index.vue +134 -134
- package/src/components/modals/modal/modal.stories.js +5 -5
- package/src/components/navigationTabs/index.vue +96 -94
- package/src/components/pageSubtitle/index.vue +55 -49
- package/src/components/pageTitle/index.vue +56 -56
- package/src/components/pagination/index.vue +92 -89
- package/src/components/progressBar/index.vue +107 -107
- package/src/components/projectMarker/index.vue +246 -244
- package/src/components/rangeSlider/Slider.vue +491 -465
- package/src/components/rangeSlider/index.vue +410 -410
- package/src/components/rangeSlider/utils/dom.js +5 -5
- package/src/components/selectedOptions/index.vue +119 -119
- package/src/components/sideMenu/index.vue +199 -199
- package/src/components/spinner/index.vue +57 -57
- package/src/components/tableDropdown/index.vue +520 -520
- package/src/components/tables/mainTable/index.vue +417 -400
- package/src/components/tables/viewTable/index.vue +171 -171
- package/src/components/threeDots/index.vue +340 -334
- package/src/components/videoThumbnail/index.vue +86 -86
- package/src/components/videoThumbnail/videoThumbnail.stories.js +14 -16
- package/src/helpers/numberConverter.js +2 -2
- package/src/helpers/translateLang.js +9 -9
- package/src/mixins/inputValidations.js +5 -5
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/utils/index.js +0 -12
@@ -1,633 +1,667 @@
|
|
1
1
|
<template>
|
2
|
-
<
|
3
|
-
<
|
4
|
-
<
|
5
|
-
<
|
6
|
-
|
7
|
-
|
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
|
-
|
9
|
+
select-height="36px"
|
10
|
+
select-width="100%"
|
11
|
+
@click.stop
|
12
12
|
>
|
13
13
|
<template #selector>
|
14
|
-
<
|
14
|
+
<OptionTitle>
|
15
15
|
{{ activeView }}
|
16
|
-
</
|
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
|
-
|
25
|
-
|
26
|
-
|
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
|
-
</
|
29
|
-
</
|
30
|
-
<
|
31
|
-
<
|
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
|
-
</
|
34
|
-
</
|
35
|
-
<
|
36
|
-
:
|
37
|
-
:
|
34
|
+
</ResetButton>
|
35
|
+
</UpperContainer>
|
36
|
+
<ColumnWrapper
|
37
|
+
:has-active-view="!!filterViews && !!filterViews.length"
|
38
|
+
:num-cols="filterData.length"
|
38
39
|
>
|
39
|
-
<
|
40
|
+
<ColumnContainer
|
40
41
|
v-for="(item, idx) in filterData"
|
41
42
|
:key="idx + '_filterdata'"
|
42
43
|
>
|
43
|
-
<
|
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
|
-
</
|
49
|
-
<
|
50
|
-
<
|
51
|
-
<
|
52
|
-
|
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
|
-
|
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
|
-
<
|
62
|
-
<
|
63
|
-
<
|
64
|
-
</
|
65
|
-
<
|
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
|
-
|
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
|
-
</
|
79
|
+
</CheckboxWrapper>
|
79
80
|
</template>
|
80
|
-
</
|
81
|
-
</
|
82
|
-
</
|
83
|
-
<
|
84
|
-
<
|
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
|
-
<
|
89
|
-
v-if="
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
-
|
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
|
-
<
|
105
|
+
<OptionTitle> {{ filter.selectedText }} </OptionTitle>
|
102
106
|
</template>
|
103
107
|
<template #dropdown>
|
104
|
-
<
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
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
|
-
|
121
|
-
|
122
|
-
|
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
|
-
</
|
125
|
-
<
|
126
|
-
<
|
127
|
-
|
128
|
-
|
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
|
-
:
|
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
|
-
<
|
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
|
-
:
|
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
|
-
</
|
169
|
-
</
|
170
|
-
<
|
193
|
+
</GridContainer>
|
194
|
+
</SectionContainer>
|
195
|
+
<SectionContainer
|
171
196
|
v-else-if="isDateSelector(filter.filter_type)"
|
172
197
|
@click.stop
|
173
198
|
>
|
174
|
-
<
|
175
|
-
|
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
|
-
|
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
|
-
|
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
|
-
</
|
221
|
-
</
|
222
|
-
<
|
247
|
+
</GridContainer>
|
248
|
+
</SectionContainer>
|
249
|
+
<SelectComponent
|
223
250
|
v-else
|
224
|
-
|
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
|
-
<
|
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
|
-
</
|
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
|
-
</
|
252
|
-
</
|
253
|
-
</
|
254
|
-
</
|
255
|
-
</
|
256
|
-
<
|
257
|
-
<
|
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
|
-
<
|
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
|
-
<
|
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
|
-
<
|
276
|
-
<
|
277
|
-
<
|
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
|
-
</
|
280
|
-
</
|
281
|
-
</
|
282
|
-
</
|
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
|
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
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
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
|
-
|
314
|
-
|
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
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
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
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
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
|
-
|
338
|
-
|
339
|
-
|
340
|
-
`
|
367
|
+
const ButtonContainer = styled.div`
|
368
|
+
display: flex;
|
369
|
+
gap: 10px;
|
370
|
+
padding: 15px;
|
371
|
+
`
|
341
372
|
|
342
|
-
const ResetContainer = styled.div`
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
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
|
-
|
385
|
+
const DragContainer = styled.div`
|
386
|
+
cursor: grab;
|
356
387
|
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
`
|
388
|
+
&:active {
|
389
|
+
cursor: grabbing;
|
390
|
+
}
|
391
|
+
`
|
361
392
|
|
362
|
-
const RowContainer = styled('div', TitleAttrs)`
|
363
|
-
|
364
|
-
|
393
|
+
const RowContainer = styled('div', TitleAttrs)`
|
394
|
+
padding: 10px 14px;
|
395
|
+
min-width: 300px;
|
365
396
|
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
397
|
+
${({ showBorder, theme }) =>
|
398
|
+
showBorder &&
|
399
|
+
`
|
400
|
+
border-right: 1px solid ${theme.colors.grey4};
|
401
|
+
`}
|
371
402
|
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
`
|
403
|
+
.ghost {
|
404
|
+
opacity: 0.5;
|
405
|
+
background-color: #e5fcb4;
|
406
|
+
}
|
407
|
+
`
|
377
408
|
|
378
|
-
const OptionTitle = styled.div`
|
379
|
-
|
380
|
-
`
|
409
|
+
const OptionTitle = styled.div`
|
410
|
+
cursor: pointer !important;
|
411
|
+
`
|
381
412
|
|
382
|
-
const CheckboxContainer = styled.div`
|
383
|
-
|
384
|
-
|
385
|
-
`
|
413
|
+
const CheckboxContainer = styled.div`
|
414
|
+
display: grid;
|
415
|
+
gap: 6px;
|
416
|
+
`
|
386
417
|
|
387
|
-
const CheckboxWrapper = styled.div`
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
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
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
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
|
-
|
405
|
-
`
|
434
|
+
const RowWrapper = styled.div`
|
435
|
+
margin-bottom: 12px;
|
436
|
+
`
|
406
437
|
|
407
|
-
const LabelAttrs = {
|
408
|
-
|
409
|
-
}
|
410
|
-
const RowLabel = styled('div', LabelAttrs)`
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
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
|
-
|
421
|
-
|
422
|
-
|
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
|
-
|
428
|
-
|
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
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
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
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
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
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
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
|
-
|
486
|
-
|
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
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
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
|
-
|
536
|
-
|
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
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
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
|
-
|
546
|
-
|
547
|
-
|
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
|
-
|
550
|
-
|
602
|
+
const currentDate = new Date(year, month, day)
|
603
|
+
const selectedDate = new Date(date)
|
551
604
|
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
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
|
-
|
563
|
-
|
564
|
-
|
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
|
-
|
567
|
-
|
619
|
+
const currentDate = new Date(year, month, day)
|
620
|
+
const selectedDate = new Date(date)
|
568
621
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
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
|
-
|
623
|
-
|
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
|
-
|
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>
|