@eturnity/eturnity_reusable_components 9.37.9-ATE-23.1 → 9.37.10
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/dist/index.es3.js
CHANGED
|
@@ -468,7 +468,7 @@ const theme = (() => {
|
|
|
468
468
|
main: {
|
|
469
469
|
// variant: this is the default variant
|
|
470
470
|
default: {
|
|
471
|
-
backgroundColor:
|
|
471
|
+
backgroundColor: "transparent",
|
|
472
472
|
textColor: semanticColors.purple[500],
|
|
473
473
|
borderColor: "",
|
|
474
474
|
iconBackgroundColor: semanticColors.buttonIcon.none
|
package/package.json
CHANGED
package/src/assets/theme.js
CHANGED
|
@@ -469,7 +469,7 @@ const theme = (() => {
|
|
|
469
469
|
main: {
|
|
470
470
|
// variant: this is the default variant
|
|
471
471
|
default: {
|
|
472
|
-
backgroundColor:
|
|
472
|
+
backgroundColor: 'transparent',
|
|
473
473
|
textColor: semanticColors.purple[500],
|
|
474
474
|
borderColor: '',
|
|
475
475
|
iconBackgroundColor: semanticColors.buttonIcon.none,
|
|
@@ -587,7 +587,9 @@
|
|
|
587
587
|
)
|
|
588
588
|
this.$emit('dropdown-search', '')
|
|
589
589
|
this.$nextTick(() => {
|
|
590
|
-
this.
|
|
590
|
+
this.$refs.searchInput.$el.children[0].children[0].focus()
|
|
591
|
+
})
|
|
592
|
+
this.$nextTick(() => {
|
|
591
593
|
this.scrollToItem()
|
|
592
594
|
})
|
|
593
595
|
}
|
|
@@ -630,7 +632,13 @@
|
|
|
630
632
|
CLICK_OUTSIDE_CAPTURE
|
|
631
633
|
)
|
|
632
634
|
this.$emit('dropdown-search', '')
|
|
635
|
+
this.$nextTick(() => {
|
|
636
|
+
this.scrollToItem()
|
|
637
|
+
})
|
|
633
638
|
this.$emit('toggle-dropdown-open', { close: false })
|
|
639
|
+
this.$nextTick(() => {
|
|
640
|
+
this.$refs.searchInput.$el.children[0].children[1].focus()
|
|
641
|
+
})
|
|
634
642
|
} else {
|
|
635
643
|
document.removeEventListener(
|
|
636
644
|
'click',
|
|
@@ -646,10 +654,6 @@
|
|
|
646
654
|
this.toggleOpen()
|
|
647
655
|
}
|
|
648
656
|
},
|
|
649
|
-
focusSearchInput() {
|
|
650
|
-
const input = this.$refs.searchInput?.$el.querySelector('input')
|
|
651
|
-
input?.focus({ preventScroll: true })
|
|
652
|
-
},
|
|
653
657
|
scrollToItem() {
|
|
654
658
|
if (this.$refs.optionsContainer) {
|
|
655
659
|
this.$refs.optionsContainer.$el.scrollIntoView({
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import { mount } from '@vue/test-utils'
|
|
3
|
-
import { h, nextTick, ref } from 'vue'
|
|
4
3
|
import TableDropdown from './index.vue'
|
|
5
4
|
import SearchInput from '@/components/inputs/searchInput'
|
|
6
5
|
import InputText from '@/components/inputs/inputText'
|
|
@@ -59,9 +58,7 @@ describe('TableDropdown', () => {
|
|
|
59
58
|
|
|
60
59
|
it('renders a template link with the value for a filled template item', () => {
|
|
61
60
|
const wrapper = mountDropdown({
|
|
62
|
-
tableItems: [
|
|
63
|
-
{ type: 'template', value: 'My Template', row: { id: 2 } },
|
|
64
|
-
],
|
|
61
|
+
tableItems: [{ type: 'template', value: 'My Template', row: { id: 2 } }],
|
|
65
62
|
})
|
|
66
63
|
expect(wrapper.text()).toContain('My Template')
|
|
67
64
|
expect(wrapper.findComponent(MainButton).exists()).toBe(false)
|
|
@@ -133,74 +130,6 @@ describe('TableDropdown', () => {
|
|
|
133
130
|
})
|
|
134
131
|
})
|
|
135
132
|
|
|
136
|
-
describe('opening: focus and scroll', () => {
|
|
137
|
-
let scrollIntoView
|
|
138
|
-
let focus
|
|
139
|
-
|
|
140
|
-
// The dropdown lives in a parent that owns `isOpen`, so one click runs both
|
|
141
|
-
// toggleOpen and the isOpen watcher, exactly as it does in the app.
|
|
142
|
-
const mountControlled = (props = {}) => {
|
|
143
|
-
const isOpen = ref(false)
|
|
144
|
-
return mount({
|
|
145
|
-
setup() {
|
|
146
|
-
return () =>
|
|
147
|
-
h(TableDropdown, {
|
|
148
|
-
colSpan: 2,
|
|
149
|
-
tableItems: [{ type: 'text', value: 'Selected Item' }],
|
|
150
|
-
optionItems: [
|
|
151
|
-
{ display_name: 'Item 1', company_item_number: '123' },
|
|
152
|
-
{ display_name: 'Item 2', company_item_number: '456' },
|
|
153
|
-
],
|
|
154
|
-
optionsDisplay: ['display_name', 'company_item_number'],
|
|
155
|
-
...props,
|
|
156
|
-
isOpen: isOpen.value,
|
|
157
|
-
onToggleDropdownOpen: ({ close }) => {
|
|
158
|
-
isOpen.value = !close
|
|
159
|
-
},
|
|
160
|
-
})
|
|
161
|
-
},
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const open = async (wrapper) => {
|
|
166
|
-
await wrapper.findComponent(TableDropdown).trigger('click')
|
|
167
|
-
await nextTick()
|
|
168
|
-
await nextTick()
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
beforeEach(() => {
|
|
172
|
-
scrollIntoView = jest.fn()
|
|
173
|
-
Element.prototype.scrollIntoView = scrollIntoView
|
|
174
|
-
focus = jest.spyOn(HTMLInputElement.prototype, 'focus')
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
afterEach(() => {
|
|
178
|
-
focus.mockRestore()
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
it('focuses the search input without letting focus scroll the page', async () => {
|
|
182
|
-
const wrapper = mountControlled()
|
|
183
|
-
await open(wrapper)
|
|
184
|
-
|
|
185
|
-
expect(focus).toHaveBeenCalledTimes(1)
|
|
186
|
-
expect(focus).toHaveBeenCalledWith({ preventScroll: true })
|
|
187
|
-
expect(focus.mock.instances[0]).toBe(
|
|
188
|
-
wrapper.findComponent(SearchInput).find('input').element
|
|
189
|
-
)
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
it('scrolls the options container into view once, smoothly', async () => {
|
|
193
|
-
const wrapper = mountControlled()
|
|
194
|
-
await open(wrapper)
|
|
195
|
-
|
|
196
|
-
expect(scrollIntoView).toHaveBeenCalledTimes(1)
|
|
197
|
-
expect(scrollIntoView).toHaveBeenCalledWith({
|
|
198
|
-
behavior: 'smooth',
|
|
199
|
-
block: 'center',
|
|
200
|
-
})
|
|
201
|
-
})
|
|
202
|
-
})
|
|
203
|
-
|
|
204
133
|
describe('interactions', () => {
|
|
205
134
|
it('emits toggle-dropdown-open with close:true when an open row is clicked', async () => {
|
|
206
135
|
const wrapper = mountDropdown({ isOpen: true })
|