@autoafleveren/ui 1.7.0 → 1.8.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/dist/ui.cjs +1 -1
- package/dist/ui.js +85 -86
- package/package.json +1 -1
- package/src/modules/components/AppContextMenu/AppContextMenu.vue +3 -2
- package/src/modules/components/AppContextMenu/__tests__/app-context-menu.spec.ts +7 -8
- package/src/modules/components/AppContextMenu/index.d.ts +5 -2
package/package.json
CHANGED
|
@@ -97,10 +97,11 @@
|
|
|
97
97
|
class="app-context-menu fixed z-100 flex w-64 flex-col rounded-lg bg-secondary p-2 drop-shadow-card empty:hidden"
|
|
98
98
|
data-test-context-menu
|
|
99
99
|
>
|
|
100
|
-
<div v-if="
|
|
100
|
+
<div v-if="search?.enabled && actionsWithFallback.length > 0">
|
|
101
101
|
<AppInput
|
|
102
|
+
v-bind="search"
|
|
102
103
|
:model-value="searchActionsQuery"
|
|
103
|
-
:placeholder="
|
|
104
|
+
:placeholder="search?.placeholder ?? ''"
|
|
104
105
|
class="mb-2 text-zinc-700"
|
|
105
106
|
type="text"
|
|
106
107
|
data-test-driver-search
|
|
@@ -93,7 +93,7 @@ describe('the AppContextMenu ShortcutItem component', () => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
it('should render the search input when enableSearch is true', () => {
|
|
96
|
-
const wrapper = createWrapper(actionsMock, {
|
|
96
|
+
const wrapper = createWrapper(actionsMock, { search: { enabled: true } });
|
|
97
97
|
const searchInput = wrapper.findComponent({ name: 'AppInput' });
|
|
98
98
|
|
|
99
99
|
expect(searchInput.exists()).toBe(true);
|
|
@@ -101,8 +101,7 @@ describe('the AppContextMenu ShortcutItem component', () => {
|
|
|
101
101
|
|
|
102
102
|
it('should use the searchPlaceholder prop as the input placeholder', () => {
|
|
103
103
|
const wrapper = createWrapper(actionsMock, {
|
|
104
|
-
|
|
105
|
-
searchPlaceholder: 'Search actions...',
|
|
104
|
+
search: { enabled: true, placeholder: 'Search actions...' },
|
|
106
105
|
});
|
|
107
106
|
|
|
108
107
|
const searchInput = wrapper.findComponent({ name: 'AppInput' });
|
|
@@ -111,7 +110,7 @@ describe('the AppContextMenu ShortcutItem component', () => {
|
|
|
111
110
|
});
|
|
112
111
|
|
|
113
112
|
it('should default the placeholder to an empty string when searchPlaceholder is not provided', () => {
|
|
114
|
-
const wrapper = createWrapper(actionsMock, {
|
|
113
|
+
const wrapper = createWrapper(actionsMock, { search: { enabled: true } });
|
|
115
114
|
const searchInput = wrapper.findComponent({ name: 'AppInput' });
|
|
116
115
|
|
|
117
116
|
expect(searchInput.attributes('placeholder')).toBe('');
|
|
@@ -119,7 +118,7 @@ describe('the AppContextMenu ShortcutItem component', () => {
|
|
|
119
118
|
|
|
120
119
|
it('should display noResultsText when searching yields no results', async () => {
|
|
121
120
|
const wrapper = createWrapper(actionsMock, {
|
|
122
|
-
|
|
121
|
+
search: { enabled: true },
|
|
123
122
|
noResultsText: 'No results found',
|
|
124
123
|
});
|
|
125
124
|
|
|
@@ -138,7 +137,7 @@ describe('the AppContextMenu ShortcutItem component', () => {
|
|
|
138
137
|
});
|
|
139
138
|
|
|
140
139
|
it('should default noResultsText to an empty string when not provided', async () => {
|
|
141
|
-
const wrapper = createWrapper(actionsMock, {
|
|
140
|
+
const wrapper = createWrapper(actionsMock, { search: { enabled: true } });
|
|
142
141
|
const searchInput = wrapper.findComponent({ name: 'AppInput' });
|
|
143
142
|
|
|
144
143
|
await searchInput.vm.$emit('update:modelValue', 'test_action_non_existant');
|
|
@@ -154,7 +153,7 @@ describe('the AppContextMenu ShortcutItem component', () => {
|
|
|
154
153
|
});
|
|
155
154
|
|
|
156
155
|
it('should filter actions based on search query', async () => {
|
|
157
|
-
const wrapper = createWrapper(actionsMock, {
|
|
156
|
+
const wrapper = createWrapper(actionsMock, { search: { enabled: true } });
|
|
158
157
|
const searchInput = wrapper.findComponent({ name: 'AppInput' });
|
|
159
158
|
|
|
160
159
|
await searchInput.vm.$emit('update:modelValue', 'Action #1');
|
|
@@ -198,7 +197,7 @@ describe('the AppContextMenu ShortcutItem component', () => {
|
|
|
198
197
|
{ ...actionsMock[0], name: 'Action 5' },
|
|
199
198
|
];
|
|
200
199
|
|
|
201
|
-
const wrapper = createWrapper(manyActions, {
|
|
200
|
+
const wrapper = createWrapper(manyActions, { search: { enabled: true }, maxList: 2 });
|
|
202
201
|
const searchInput = wrapper.findComponent({ name: 'AppInput' });
|
|
203
202
|
|
|
204
203
|
await searchInput.vm.$emit('update:modelValue', 'Action');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { App } from 'vue';
|
|
2
2
|
import type AppContextMenu from './AppContextMenu.vue';
|
|
3
|
+
import type { AppInputProps } from '~components/AppInput/index.d';
|
|
3
4
|
|
|
4
5
|
export type { Action } from '~components/AppActionBar/index.d';
|
|
5
6
|
|
|
@@ -8,8 +9,10 @@ export interface Props {
|
|
|
8
9
|
event: PointerEvent | MouseEvent;
|
|
9
10
|
actions?: Action[];
|
|
10
11
|
confirmed?: Action['key'];
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
search?: Omit<AppInputProps<string>, 'modelValue'> & {
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
};
|
|
13
16
|
noResultsText?: string;
|
|
14
17
|
maxList?: number;
|
|
15
18
|
}
|