@autoafleveren/ui 1.4.5 → 1.4.7

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": "@autoafleveren/ui",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/*",
@@ -26,6 +26,7 @@
26
26
 
27
27
  const slots = useSlots();
28
28
 
29
+ const hasAvatar = computed(() => !!slots.avatar);
29
30
  const hasTitle = computed(() => !!slots.title || !!props.title);
30
31
  const hasIcon = computed(() => !!slots.icon || !!props.icon);
31
32
  const contentClasses = computed(() => `${props.contentClasses} ${hasTitle.value ? 'mt-4' : undefined}`);
@@ -49,6 +50,15 @@
49
50
  <slot name="icon"></slot>
50
51
  </CardIconSlot>
51
52
 
53
+ <div
54
+ v-if="hasAvatar"
55
+ :class="{ 'mr-3': hasIcon }"
56
+ class="float-right"
57
+ data-test-avatar
58
+ >
59
+ <slot name="avatar"></slot>
60
+ </div>
61
+
52
62
  <h3
53
63
  v-if="hasTitle"
54
64
  class="text-2xl font-bold text-zinc-900"
@@ -7,6 +7,7 @@ describe('the AppCard component', () => {
7
7
  it('should hide the optional elements by default', () => {
8
8
  const wrapper = shallowMount(AppCard);
9
9
 
10
+ expect(wrapper.find('[data-test-avatar]').exists()).toBe(false);
10
11
  expect(wrapper.find('[data-test-title]').exists()).toBe(false);
11
12
  expect(wrapper.find('[data-test-icon]').exists()).toBe(false);
12
13
  });
@@ -77,6 +78,16 @@ describe('the AppCard component', () => {
77
78
  expect(descriptionElement.text()).toBe('description');
78
79
  });
79
80
 
81
+ it('can set the avatar by slot', () => {
82
+ const wrapper = shallowMount(AppCard, {
83
+ slots: { avatar: 'test-avatar' },
84
+ });
85
+
86
+ const avatar = wrapper.find('[data-test-avatar]');
87
+ expect(avatar.exists()).toBe(true);
88
+ expect(avatar.text()).toBe('test-avatar');
89
+ });
90
+
80
91
  it('can set the icon by prop', () => {
81
92
  const wrapper = shallowMount(AppCard, {
82
93
  props: { icon: 'icon' },
@@ -19,11 +19,11 @@
19
19
 
20
20
  const emit = defineEmits<{
21
21
  (event: 'update:modelValue', value: number[]): void;
22
- (event: 'update:sort', value: UpdateSortArgument): void;
23
22
  (event: 'updatePage', value: number): void;
24
23
  (event: 'clickItem', value: Item): void;
25
24
  (event: 'contextMenuOpen', value: Item): void;
26
25
  (event: 'clickContextItem', value: Item): void;
26
+ (event: 'sortClient', value: UpdateSortArgument): void;
27
27
  }>();
28
28
 
29
29
  const slots = useSlots();
@@ -126,8 +126,8 @@
126
126
  sort.value = undefined;
127
127
  }
128
128
 
129
- function onUpdateSort(value: UpdateSortArgument): void {
130
- emit('update:sort', value);
129
+ function onUpdateClientSort(value: UpdateSortArgument): void {
130
+ emit('sortClient', value);
131
131
  }
132
132
 
133
133
  defineExpose({ dataTableInstance });
@@ -162,7 +162,7 @@
162
162
  @click-row="clickRow"
163
163
  @contextmenu-row="contextMenu.open"
164
164
  @update:server-options="onUpdateServerOptions"
165
- @update-sort="onUpdateSort"
165
+ @update-sort="onUpdateClientSort"
166
166
  >
167
167
  <template #loading>
168
168
  <AppLoader size="medium" />