@eturnity/eturnity_reusable_components 9.25.12 → 9.25.13

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.25.12",
3
+ "version": "9.25.13",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -107,7 +107,7 @@
107
107
  </SelectOption>
108
108
  </template>
109
109
  </SelectComponent>
110
- <template v-if="item.column === 'updated'">
110
+ <template v-if="isDateColumn(item.column)">
111
111
  <DatePickerContainer
112
112
  :data-id="
113
113
  rowDataId.dataId
@@ -149,7 +149,7 @@
149
149
  </DatePickerContainer>
150
150
  </template>
151
151
  <SelectComponent
152
- v-else
152
+ v-else-if="!isBooleanColumn(item.column)"
153
153
  ref="selectSortDropdown"
154
154
  align-items="vertical"
155
155
  class="sort-dropdown"
@@ -512,7 +512,30 @@
512
512
  document.removeEventListener('click', this.handleClickOutside)
513
513
  },
514
514
  methods: {
515
+ isDateColumn(column) {
516
+ if (column === 'updated') {
517
+ return true
518
+ }
519
+ const category = this.filterCategories.find(
520
+ (cat) => cat.name === column
521
+ )
522
+ return ['date', 'datetime', 'date_range'].includes(
523
+ category?.filter_type
524
+ )
525
+ },
526
+ isBooleanColumn(column) {
527
+ const category = this.filterCategories.find(
528
+ (cat) => cat.name === column
529
+ )
530
+ return category?.filter_type === 'boolean'
531
+ },
515
532
  handleClickOutside(event) {
533
+ // A target detached by a re-render (e.g. the select trigger when its
534
+ // dropdown opens) has lost its ancestry — it cannot be attributed as
535
+ // an outside click
536
+ if (!event.target.isConnected) {
537
+ return
538
+ }
516
539
  const isClickInSelect =
517
540
  event.target.closest('.sort-dropdown') ||
518
541
  event.target.closest('.rc-select-dropdown') ||
@@ -546,10 +569,12 @@
546
569
  return this.selectedSort.filter((item) => {
547
570
  const hasColumn = !!item.column
548
571
  const hasConstraint = !!item.constraint
549
- const hasSelectedOptions =
550
- item.column === 'updated'
551
- ? !!item.selectedDate
552
- : !!item.selectedOptions?.length
572
+ if (this.isBooleanColumn(item.column)) {
573
+ return hasColumn && hasConstraint
574
+ }
575
+ const hasSelectedOptions = this.isDateColumn(item.column)
576
+ ? !!item.selectedDate
577
+ : !!item.selectedOptions?.length
553
578
  return hasColumn && hasConstraint && hasSelectedOptions
554
579
  }).length
555
580
  },
@@ -588,10 +613,17 @@
588
613
  },
589
614
  ]
590
615
 
591
- if (this.selectedSort?.[index]?.column === 'updated') {
616
+ if (this.isDateColumn(this.selectedSort?.[index]?.column)) {
592
617
  return dateOptions
593
618
  }
594
619
 
620
+ if (this.isBooleanColumn(this.selectedSort?.[index]?.column)) {
621
+ return [
622
+ { value: 'is_true', label: this.$gettext('Yes') },
623
+ { value: 'is_false', label: this.$gettext('No') },
624
+ ]
625
+ }
626
+
595
627
  if (this.selectedSort?.[index]?.column === 'project_status') {
596
628
  return generalOptions.filter(
597
629
  (option) => option.value !== 'contains_none'
@@ -617,12 +649,12 @@
617
649
  if (type === 'column') {
618
650
  const categoryName = this.filterCategories.find(
619
651
  (option) => option.name === value
620
- ).text
652
+ )?.text
621
653
  return this.$gettext(categoryName) || '-'
622
654
  } else if (type === 'constraint') {
623
655
  return this.constraintOptions(index).find(
624
656
  (option) => option.value === value
625
- ).label
657
+ )?.label
626
658
  } else if (type === 'selectedOptions') {
627
659
  const selectedOptions =
628
660
  this.selectedSort[index]?.selectedOptions || []
@@ -261,6 +261,11 @@
261
261
  }
262
262
  },
263
263
  handleClickOutside(event) {
264
+ // Detached targets (removed by a re-render mid-click) cannot be
265
+ // attributed as outside clicks
266
+ if (!event.target.isConnected) {
267
+ return
268
+ }
264
269
  const buttonIcon = this.$el.querySelector('.button-icon')
265
270
  const boxContainer = this.$el.querySelector('.box-container')
266
271
 
@@ -266,6 +266,11 @@
266
266
  },
267
267
  methods: {
268
268
  handleClickOutside(event) {
269
+ // Detached targets (removed by a re-render mid-click) cannot be
270
+ // attributed as outside clicks
271
+ if (!event.target.isConnected) {
272
+ return
273
+ }
269
274
  const buttonIcon = this.$el.querySelector('.button-icon')
270
275
  const boxContainer = this.$el.querySelector('.box-container')
271
276
  const isClickInSelect =
@@ -402,6 +402,9 @@
402
402
  }
403
403
  const SelectButtonWrapper = styled('div', SelectButtonWrapperAttrs)`
404
404
  ${(props) => (props.disabled ? 'cursor: not-allowed' : 'cursor: pointer')};
405
+ /* Grid item: without this, nowrap selector text sets the automatic
406
+ minimum and the wrapper blows out a constrained track. */
407
+ min-width: 0;
405
408
  `
406
409
 
407
410
  const selectButtonAttrs = {
@@ -1506,6 +1509,11 @@
1506
1509
  }
1507
1510
  },
1508
1511
  getDistanceBetweenSelectAndDropdownMenu() {
1512
+ // Runs from a delayed watcher callback; the select may have closed or
1513
+ // unmounted by the time it fires
1514
+ if (!this.$refs.select?.$el) {
1515
+ return
1516
+ }
1509
1517
  const wholeSelectTopPosition =
1510
1518
  this.selectTopPosition + this.$refs.select.$el.clientHeight
1511
1519
  this.selectAndDropdownDistance =
@@ -183,28 +183,16 @@
183
183
  z-index: ${(props) => (props.isActive ? 1 : 0)};
184
184
  border-bottom: ${(props) => {
185
185
  if (props.scrollOverflow) {
186
- return '1px solid transparent'
186
+ return props.isActive
187
+ ? `1px solid ${props.theme.semanticColors.purple[400]}`
188
+ : '1px solid transparent'
187
189
  }
188
190
  if (props.isActive) {
189
191
  return `2px solid ${props.theme.semanticColors.purple[400]}`
190
192
  }
191
193
  return `2px solid ${props.theme.semanticColors.grey[400]}`
192
194
  }};
193
- ${(props) =>
194
- props.scrollOverflow && props.isActive
195
- ? `
196
- &::after {
197
- content: '';
198
- position: absolute;
199
- left: 0;
200
- right: 0;
201
- bottom: -1px;
202
- height: 2px;
203
- background-color: ${props.theme.semanticColors.purple[400]};
204
- z-index: 1;
205
- }
206
- `
207
- : ''}
195
+ margin-bottom: ${(props) => (props.scrollOverflow && props.isActive ? '-1px' : '0')};
208
196
  &:hover .rc-tabs-header__menu-slot {
209
197
  opacity: 1;
210
198
  pointer-events: auto;