@eturnity/eturnity_reusable_components 9.34.7 → 9.37.0-ATE-95.0

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": "9.34.7",
3
+ "version": "9.37.0-ATE-95.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -1,5 +1,33 @@
1
1
  <template>
2
2
  <ContainerWrapper @click="$emit('on-container-click')">
3
+ <PageSizeContainer v-if="pageSizeOptions && pageSizeOptions.length">
4
+ <SelectComponent
5
+ align-items="vertical"
6
+ :data-id="componentName + '_page_size_select'"
7
+ :data-qa-id="componentName + '_page_size_select'"
8
+ font-size="13px"
9
+ :is-searchable="false"
10
+ :label="$gettext('Shown')"
11
+ select-height="36px"
12
+ select-width="100%"
13
+ @click.stop
14
+ @input-change="$emit('on-page-size-change', $event)"
15
+ >
16
+ <template #selector>
17
+ <OptionTitle> {{ pageSize }} {{ pageSizeUnit }} </OptionTitle>
18
+ </template>
19
+ <template #dropdown>
20
+ <Option
21
+ v-for="(item, idx) in pageSizeOptions"
22
+ :key="idx + '_page_size'"
23
+ :data-id="`${componentName}_page_size_option_${idx + 1}`"
24
+ :value="item"
25
+ >
26
+ {{ item }} {{ pageSizeUnit }}
27
+ </Option>
28
+ </template>
29
+ </SelectComponent>
30
+ </PageSizeContainer>
3
31
  <UpperContainer v-if="filterViews && filterViews.length">
4
32
  <ViewContainer v-if="showActiveFilter" :max-width="activeView.length">
5
33
  <SelectComponent
@@ -564,6 +592,12 @@
564
592
  padding: 10px 14px;
565
593
  `
566
594
 
595
+ const PageSizeContainer = styled.div`
596
+ padding: 10px 14px;
597
+ border-bottom: 1px solid ${(props) => props.theme.colors.grey4};
598
+ max-width: 300px;
599
+ `
600
+
567
601
  const ResetButton = styled.div`
568
602
  display: inline-flex;
569
603
  gap: 16px;
@@ -578,6 +612,7 @@
578
612
  name: 'FilterSettings',
579
613
  components: {
580
614
  ContainerWrapper,
615
+ PageSizeContainer,
581
616
  ColumnWrapper,
582
617
  ColumnTitle,
583
618
  ColumnContainer,
@@ -642,6 +677,28 @@
642
677
  type: String,
643
678
  required: false,
644
679
  },
680
+ /** Current page size; shown on the selector. */
681
+ pageSize: {
682
+ type: [Number, String],
683
+ required: false,
684
+ default: null,
685
+ },
686
+ /**
687
+ * Selectable page sizes. Empty (the default) hides the control, so hosts
688
+ * that do not paginate are unaffected. Include the host's current value —
689
+ * otherwise the selector shows a size the user cannot pick again.
690
+ */
691
+ pageSizeOptions: {
692
+ type: Array,
693
+ required: false,
694
+ default: () => [],
695
+ },
696
+ /** Already-translated noun for the counted rows, e.g. "components". */
697
+ pageSizeUnit: {
698
+ type: String,
699
+ required: false,
700
+ default: '',
701
+ },
645
702
  },
646
703
  data() {
647
704
  return {
@@ -17,6 +17,9 @@
17
17
  :filter-data="filterData"
18
18
  :filter-views="filterViews"
19
19
  :has-active-view="hasActiveView"
20
+ :page-size="pageSize"
21
+ :page-size-options="pageSizeOptions"
22
+ :page-size-unit="pageSizeUnit"
20
23
  :settings-translations="settingsTranslations"
21
24
  :show-active-filter="showActiveFilter"
22
25
  @on-apply-current-view="onApplyCurrentView()"
@@ -24,6 +27,7 @@
24
27
  @on-container-click="onContainerClick()"
25
28
  @on-drag-change="$emit('on-drag-change', $event)"
26
29
  @on-filter-change="onFilterChange($event)"
30
+ @on-page-size-change="$emit('on-page-size-change', $event)"
27
31
  @on-prevent-close="onPreventClose($event)"
28
32
  @on-reset-filters="onResetFilters()"
29
33
  @on-save-new-view="$emit('on-save-new-view')"
@@ -56,6 +60,24 @@
56
60
  dropdownText: {
57
61
  required: false,
58
62
  },
63
+ /** Current page size; shown on the selector. */
64
+ pageSize: {
65
+ type: [Number, String],
66
+ required: false,
67
+ default: null,
68
+ },
69
+ /** Selectable page sizes. Empty (the default) hides the control. */
70
+ pageSizeOptions: {
71
+ type: Array,
72
+ required: false,
73
+ default: () => [],
74
+ },
75
+ /** Already-translated noun for the counted rows, e.g. "components". */
76
+ pageSizeUnit: {
77
+ type: String,
78
+ required: false,
79
+ default: '',
80
+ },
59
81
  filterViews: {
60
82
  required: true,
61
83
  },
@@ -14,15 +14,7 @@
14
14
  :data-value="domDataValue"
15
15
  :disabled-bg-color="disabledBgColor"
16
16
  :disabled-text-color="disabledTextColor"
17
- :hovered-bg-color="
18
- colorMode == 'dark'
19
- ? theme.semanticColors.teal[800]
20
- : colorMode == 'transparent'
21
- ? 'grey6'
22
- : hoveredBgColor
23
- ? hoveredBgColor
24
- : 'grey5'
25
- "
17
+ :hovered-bg-color="hoveredBackgroundColor"
26
18
  :is-disabled="isDisabled"
27
19
  :min-width="minWidth"
28
20
  :padding="padding"
@@ -172,6 +164,11 @@
172
164
  }
173
165
  },
174
166
  computed: {
167
+ hoveredBackgroundColor() {
168
+ if (this.colorMode == 'dark') return theme.semanticColors.teal[800]
169
+ if (this.colorMode == 'transparent') return 'grey6'
170
+ return this.hoveredBgColor || theme.semanticColors.grey[300]
171
+ },
175
172
  /** Vue omits `data-value` when bound to null, so the parent select cannot find this row for search filtering. */
176
173
  domDataValue() {
177
174
  const v = this.value
@@ -0,0 +1,33 @@
1
+ /* eslint-disable */
2
+ import { mount } from '@vue/test-utils'
3
+ import Option from '@/components/inputs/select/option'
4
+ import theme from '@/assets/theme'
5
+
6
+ describe('RCoption', () => {
7
+ const mountOption = (props = {}) =>
8
+ mount(Option, {
9
+ props: { value: 'a', ...props },
10
+ slots: { default: 'Option A' },
11
+ })
12
+
13
+ it('hovers on grey 300 by default', () => {
14
+ expect(mountOption().vm.hoveredBackgroundColor).toBe(
15
+ theme.semanticColors.grey[300]
16
+ )
17
+ })
18
+
19
+ it('lets an explicit hoveredBgColor win over the default', () => {
20
+ expect(
21
+ mountOption({ hoveredBgColor: 'grey4' }).vm.hoveredBackgroundColor
22
+ ).toBe('grey4')
23
+ })
24
+
25
+ it('keeps its own hover colours in dark and transparent colour modes', () => {
26
+ expect(mountOption({ colorMode: 'dark' }).vm.hoveredBackgroundColor).toBe(
27
+ theme.semanticColors.teal[800]
28
+ )
29
+ expect(
30
+ mountOption({ colorMode: 'transparent' }).vm.hoveredBackgroundColor
31
+ ).toBe('grey6')
32
+ })
33
+ })
@@ -365,7 +365,7 @@
365
365
  }
366
366
 
367
367
  &:hover {
368
- background-color: ${(props) => props.theme.colors.grey5};
368
+ background-color: ${(props) => props.theme.semanticColors.grey[300]};
369
369
  }
370
370
  `
371
371
 
@@ -420,7 +420,7 @@
420
420
  height: 37px;
421
421
 
422
422
  &:hover {
423
- background-color: ${(props) => props.theme.colors.grey5};
423
+ background-color: ${(props) => props.theme.semanticColors.grey[300]};
424
424
  }
425
425
  `
426
426
 
@@ -143,11 +143,13 @@
143
143
  .arrow-container,
144
144
  .input-placeholder,
145
145
  .table-dropdown-item {
146
- background-color: ${(props) => props.theme.colors.grey5};
146
+ background-color: ${(props) =>
147
+ props.theme.semanticColors.grey[300]};
147
148
  }
148
149
 
149
150
  input {
150
- background-color: ${(props) => props.theme.colors.grey5};
151
+ background-color: ${(props) =>
152
+ props.theme.semanticColors.grey[300]};
151
153
  }
152
154
  }
153
155
 
@@ -337,7 +339,7 @@
337
339
  &:hover {
338
340
  input:disabled {
339
341
  background-color: ${(props) =>
340
- props.theme.colors.grey5 + '!important'};
342
+ props.theme.semanticColors.grey[300] + '!important'};
341
343
  }
342
344
 
343
345
  .drag-icon {
@@ -345,7 +347,7 @@
345
347
  }
346
348
 
347
349
  .drag-wrapper {
348
- background-color: ${(props) => props.theme.colors.grey5};
350
+ background-color: ${(props) => props.theme.semanticColors.grey[300]};
349
351
  }
350
352
 
351
353
  .arrow-dropdown {
@@ -416,7 +418,7 @@
416
418
  height: unset;
417
419
 
418
420
  &:focus {
419
- background: ${(props) => props.theme.colors.grey5};
421
+ background: ${(props) => props.theme.semanticColors.grey[300]};
420
422
  }
421
423
  }
422
424
 
@@ -254,12 +254,12 @@
254
254
  background-color: ${(props) =>
255
255
  props.colorTheme == 'dark'
256
256
  ? theme.semanticColors.teal[700]
257
- : '#ebeef4'};
257
+ : theme.semanticColors.grey[300]};
258
258
  }
259
259
 
260
260
  &:focus-visible {
261
261
  outline: none;
262
- background-color: #ebeef4;
262
+ background-color: ${theme.semanticColors.grey[300]};
263
263
  }
264
264
  `
265
265
  const OptionChild = styled('div', { colorTheme: String })`
@@ -272,12 +272,12 @@
272
272
  background-color: ${(props) =>
273
273
  props.colorTheme == 'dark'
274
274
  ? theme.semanticColors.teal[600]
275
- : '#ebeef4'};
275
+ : theme.semanticColors.grey[300]};
276
276
  }
277
277
 
278
278
  &:focus-visible {
279
279
  outline: none;
280
- background-color: #ebeef4;
280
+ background-color: ${theme.semanticColors.grey[300]};
281
281
  }
282
282
  `
283
283
 
@@ -358,7 +358,7 @@
358
358
  },
359
359
  hoveredBackgroundColor: {
360
360
  type: String,
361
- default: theme.colors.grey5,
361
+ default: theme.semanticColors.grey[300],
362
362
  },
363
363
  dataId: {
364
364
  required: false,