@eturnity/eturnity_reusable_components 8.16.2--EPDM-14330.6 → 8.16.2--EPDM-14330.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "8.16.2--EPDM-14330.6",
3
+ "version": "8.16.2--EPDM-14330.8",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -34,6 +34,9 @@
34
34
  <ButtonContainer :button-size="buttonSize">
35
35
  {{ text }}
36
36
  </ButtonContainer>
37
+ <NumberContainer v-if="numberCount">
38
+ <NumberText>{{ numberCount }}</NumberText>
39
+ </NumberContainer>
37
40
  </ButtonWrapper>
38
41
  </PageContainer>
39
42
  </template>
@@ -68,7 +71,7 @@
68
71
  }
69
72
  const ButtonWrapper = styled('div', ButtonAttrs)`
70
73
  display: grid;
71
- grid-template-columns: auto 1fr;
74
+ grid-template-columns: auto 1fr auto;
72
75
  font-size: ${(props) =>
73
76
  props.theme?.mainButton?.size?.[props.buttonSize]?.fontSize};
74
77
  color: ${(props) => {
@@ -159,6 +162,25 @@
159
162
  }};
160
163
  `
161
164
 
165
+ const NumberContainer = styled.div`
166
+ display: flex;
167
+ align-items: center;
168
+ justify-content: center;
169
+ margin-right: 10px;
170
+ `
171
+
172
+ const NumberText = styled.div`
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ font-size: 12px;
177
+ font-weight: 400;
178
+ color: ${(props) => props.theme.semanticColors.purple[500]};
179
+ padding: 3px 8px;
180
+ border-radius: 8px;
181
+ background-color: ${(props) => props.theme.semanticColors.purple[50]};
182
+ `
183
+
162
184
  export default {
163
185
  name: 'ButtonIcon',
164
186
  components: {
@@ -167,6 +189,8 @@
167
189
  ButtonWrapper,
168
190
  IconContainer,
169
191
  Icon,
192
+ NumberContainer,
193
+ NumberText,
170
194
  },
171
195
  props: {
172
196
  type: {
@@ -241,6 +265,11 @@
241
265
  type: Boolean,
242
266
  default: false,
243
267
  },
268
+ numberCount: {
269
+ type: Number,
270
+ required: false,
271
+ default: null,
272
+ },
244
273
  },
245
274
  data() {
246
275
  return {
@@ -5,6 +5,7 @@
5
5
  class="button-icon"
6
6
  fill-type="stroke"
7
7
  icon-name="filter"
8
+ :number-count="getNumberCount()"
8
9
  :text="$gettext('filter')"
9
10
  type="filter"
10
11
  @click="toggleOptions"
@@ -438,6 +439,17 @@
438
439
  document.removeEventListener('click', this.handleClickOutside)
439
440
  }
440
441
  },
442
+ getNumberCount() {
443
+ return this.selectedSort.filter((item) => {
444
+ const hasColumn = !!item.column
445
+ const hasConstraint = !!item.constraint
446
+ const hasSelectedOptions =
447
+ item.column === 'updated'
448
+ ? !!item.selectedDate
449
+ : !!item.selectedOptions?.length
450
+ return hasColumn && hasConstraint && hasSelectedOptions
451
+ }).length
452
+ },
441
453
  constraintOptions(index) {
442
454
  const generalOptions = [
443
455
  {
@@ -472,10 +484,17 @@
472
484
  label: this.$gettext('is_after_or_on'),
473
485
  },
474
486
  ]
487
+
475
488
  if (this.selectedSort?.[index]?.column === 'updated') {
476
489
  return dateOptions
477
490
  }
478
491
 
492
+ if (this.selectedSort?.[index]?.column === 'project_status') {
493
+ return generalOptions.filter(
494
+ (option) => option.value !== 'contains_none'
495
+ )
496
+ }
497
+
479
498
  return generalOptions
480
499
  },
481
500
  getSelectedLabel({ type, value, index }) {
@@ -42,6 +42,34 @@
42
42
  @on-toggle-change="$emit(option.onToggle, $event)"
43
43
  />
44
44
  </ToggleContainer>
45
+ <LineSeparator />
46
+ <SelectedContainer>
47
+ <SectionTitle>{{ $gettext('Shown') }}</SectionTitle>
48
+ <SelectComponent
49
+ ref="selectSortDropdown"
50
+ align-items="vertical"
51
+ class="sort-dropdown"
52
+ :dropdown-auto-close="true"
53
+ select-height="40px"
54
+ @click.stop
55
+ @input-change="onPageSizeChange($event)"
56
+ >
57
+ <template #selector>
58
+ <SelectedText>{{
59
+ pageSize + ' ' + $gettext('projects')
60
+ }}</SelectedText>
61
+ </template>
62
+ <template #dropdown>
63
+ <RcOption
64
+ v-for="option in shownOptions"
65
+ :key="option.label"
66
+ :value="option.value"
67
+ >
68
+ {{ $gettext(option.label) }}
69
+ </RcOption>
70
+ </template>
71
+ </SelectComponent>
72
+ </SelectedContainer>
45
73
  </BoxContainer>
46
74
  </ButtonWrapper>
47
75
  </PageContainer>
@@ -52,6 +80,8 @@
52
80
  import ButtonIcon from '../buttons/buttonIcon/index.vue'
53
81
  import MainButton from '../buttons/mainButton/index.vue'
54
82
  import RCToggle from '../inputs/toggle/index.vue'
83
+ import SelectComponent from '../inputs/select/index.vue'
84
+ import RcOption from '../inputs/select/option/index.vue'
55
85
 
56
86
  const PageContainer = styled.div``
57
87
 
@@ -138,6 +168,18 @@
138
168
  gap: 8px;
139
169
  `
140
170
 
171
+ const SelectedText = styled.div`
172
+ font-size: 14px;
173
+ font-weight: 400;
174
+ color: ${(props) => props.theme.semanticColors.grey[800]};
175
+ `
176
+
177
+ const SelectedContainer = styled.div`
178
+ display: inline-flex;
179
+ gap: 8px;
180
+ flex-direction: column;
181
+ `
182
+
141
183
  export default {
142
184
  name: 'ViewSettings',
143
185
  components: {
@@ -154,6 +196,10 @@
154
196
  LineSeparator,
155
197
  RCToggle,
156
198
  ToggleContainer,
199
+ SelectComponent,
200
+ RcOption,
201
+ SelectedText,
202
+ SelectedContainer,
157
203
  },
158
204
  props: {
159
205
  columnsData: {
@@ -164,6 +210,11 @@
164
210
  type: Array,
165
211
  required: false,
166
212
  },
213
+ pageSize: {
214
+ type: Number,
215
+ required: false,
216
+ default: 20,
217
+ },
167
218
  },
168
219
  emits: ['onSelectColumn', 'onSelectAllColumns'],
169
220
  data() {
@@ -171,8 +222,14 @@
171
222
  isOptionsVisible: false,
172
223
  }
173
224
  },
174
- mounted() {
175
- // Remove the mounted event listener since we now handle it in toggleOptions
225
+ computed: {
226
+ shownOptions() {
227
+ return [
228
+ { label: '20' + ' ' + this.$gettext('projects'), value: 20 },
229
+ { label: '50' + ' ' + this.$gettext('projects'), value: 50 },
230
+ { label: '100' + ' ' + this.$gettext('projects'), value: 100 },
231
+ ]
232
+ },
176
233
  },
177
234
  beforeUnmount() {
178
235
  document.removeEventListener('click', this.handleClickOutside)
@@ -215,6 +272,10 @@
215
272
  document.removeEventListener('click', this.handleClickOutside)
216
273
  }
217
274
  },
275
+ onPageSizeChange(value) {
276
+ console.log('value', value)
277
+ this.$emit('onPageSizeChange', value)
278
+ },
218
279
  },
219
280
  }
220
281
  </script>
@@ -3,6 +3,7 @@
3
3
  <ButtonIcon
4
4
  class="button-icon"
5
5
  icon-name="sorting"
6
+ :number-count="getNumberCount()"
6
7
  :text="$gettext('sort')"
7
8
  type="filter"
8
9
  @click="toggleOptions"
@@ -286,6 +287,13 @@
286
287
  document.removeEventListener('click', this.handleClickOutside)
287
288
  }
288
289
  },
290
+ getNumberCount() {
291
+ return this.selectedSort.filter((item) => {
292
+ const hasColumn = !!item.column
293
+ const hasDirection = !!item.direction
294
+ return hasColumn && hasDirection
295
+ }).length
296
+ },
289
297
  toggleOptions() {
290
298
  this.isOptionsVisible = !this.isOptionsVisible
291
299
  if (this.isOptionsVisible) {
@@ -56,7 +56,7 @@
56
56
  const InputContainer = styled('input', inputAttrs)`
57
57
  border: 1px solid ${(props) => props.theme.colors.grey4};
58
58
  padding: ${(props) =>
59
- props.isFilter ? '7px 30px 7px 10px' : '11px 30px 11px 10px'};
59
+ props.isFilter ? '8px 30px 8px 10px' : '11px 30px 11px 10px'};
60
60
  border-radius: 4px;
61
61
  font-size: 13px;
62
62
  color: ${(props) => props.theme.colors.black};