Skip to content

Commit e9850a7

Browse files
committed
Merge branch 'main' into release/1.0.0
2 parents 7441c4f + c00dac1 commit e9850a7

File tree

16 files changed

+1171
-88
lines changed

16 files changed

+1171
-88
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"nanodelay": "2.0.2",
7171
"postcss": "8.4.49",
7272
"postcss-import": "16.1.0",
73-
"postcss-nested": "6.2.0",
73+
"postcss-nested": "7.0.2",
7474
"sharp": "0.33.5",
7575
"svgo": "3.3.2",
7676
"tailwindcss": "3.4.15",
@@ -119,7 +119,7 @@
119119
"immutable": "^5.0.0-beta.5",
120120
"interactjs": "1.10.27",
121121
"lodash-es": "4.17.21",
122-
"marked": "^14.0.0",
122+
"marked": "^15.0.0",
123123
"nanodelay": "2.0.2",
124124
"pdfjs-dist": "^4.0.0",
125125
"postcss-hexrgba": "^2.1.0",
@@ -132,7 +132,7 @@
132132
"vue-collapsed": "^1.2.5",
133133
"vue-content-loader": "^2.0.1",
134134
"vue-demi": "0.14.10",
135-
"vue-router": "4.4.5",
135+
"vue-router": "4.5.0",
136136
"vuedraggable": "next",
137137
"webfontloader": "1.6.28",
138138
"zxcvbn": "^4.4.2"

packages/persona-icon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"ohash": "1.1.4",
5858
"ora": "8.1.1",
5959
"p-all": "5.0.0",
60-
"svg-path-commander": "2.1.5",
60+
"svg-path-commander": "2.1.6",
6161
"svgo": "3.3.2",
6262
"webfont": "11.2.26"
6363
},

packages/persona-ilustration/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"ora": "8.1.1",
7777
"p-all": "5.0.0",
7878
"sharp": "0.33.5",
79-
"svg-path-commander": "2.1.5",
79+
"svg-path-commander": "2.1.6",
8080
"svgo": "3.3.2",
8181
"webfont": "11.2.26"
8282
},

packages/persona/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
},
6060
"dependencies": {
6161
"@floating-ui/dom": "1.6.12",
62-
"@jill64/universal-sanitizer": "1.3.3",
62+
"@jill64/universal-sanitizer": "1.3.4",
6363
"@juggle/resize-observer": "3.4.0",
6464
"@nuxt/kit": "3.13.2",
6565
"@splidejs/splide": "4.1.4",
@@ -93,10 +93,10 @@
9393
"html-escaper": "^3.0.3",
9494
"interactjs": "1.10.27",
9595
"lodash-es": "4.17.21",
96-
"marked": "14.1.4",
96+
"marked": "15.0.2",
9797
"nanodelay": "2.0.2",
9898
"pathe": "^1.1.2",
99-
"pdfjs-dist": "4.7.76",
99+
"pdfjs-dist": "4.8.69",
100100
"pspdfkit": "^2024.6.0",
101101
"scroll-into-view": "1.16.2",
102102
"tabbable": "6.2.0",

src/components/dropzone/Dropzone.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ defineSlots<{
213213

214214
<style lang="postcss">
215215
.dropzone {
216-
@apply cursor-pointer block w-full;
216+
@apply cursor-pointer block w-full relative;
217217
218218
&__input {
219-
@apply hidden;
219+
@apply absolute w-[.1px] h-[.1px] opacity-0 overflow-hidden -z-1 bottom-0 right-0;
220220
}
221221
222222
* {

src/components/table-static/TableStatic.spec.ts

Lines changed: 171 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Draggable from '../table/__mocks__/vuedraggable'
22
import { vi } from 'vitest'
3-
import { fireEvent, render } from '@testing-library/vue'
4-
import { ref } from 'vue-demi'
3+
import {
4+
render,
5+
fireEvent,
6+
queryByTestId,
7+
} from '@testing-library/vue'
8+
import { nextTick, ref } from 'vue-demi'
59
import { defineTable } from '../table'
610
import Table from './TableStatic.vue'
711

@@ -37,6 +41,54 @@ const items = ref([
3741
},
3842
])
3943

44+
const sortableFields = defineTable([
45+
{ key: 'id' },
46+
{ key: 'name' },
47+
{
48+
key : 'gender',
49+
sortable: false,
50+
},
51+
{
52+
key : 'age',
53+
sortable: true,
54+
},
55+
])
56+
57+
function generateItems () {
58+
return [
59+
{
60+
id : 1,
61+
name : 'Dora',
62+
gender: 'male',
63+
age : 27,
64+
},
65+
{
66+
id : 2,
67+
name : 'Emilly',
68+
gender: 'male',
69+
age : 20,
70+
},
71+
{
72+
id : 3,
73+
name : 'Jane',
74+
gender: 'female',
75+
age : 30,
76+
},
77+
{
78+
id : 4,
79+
name : 'Andi',
80+
gender: 'male',
81+
age : 21,
82+
},
83+
{
84+
id : 5,
85+
name : 'Bella',
86+
gender: 'female',
87+
age : 24,
88+
},
89+
]
90+
}
91+
4092
it('should render properly', () => {
4193
const screen = render({
4294
components: { Table },
@@ -305,3 +357,120 @@ it('should able to select all items (except disable one) in variant static', asy
305357

306358
expect(selected.value).toHaveLength(0)
307359
})
360+
361+
it('should X field header have sortable class if have `sortable` property with `true` value & `sortable` prop is provided', () => {
362+
const items = ref(generateItems())
363+
const screen = render({
364+
components: { Table },
365+
template : `
366+
<Table
367+
:fields="sortableFields"
368+
:items="items"
369+
sortable
370+
/>`,
371+
setup () {
372+
return {
373+
sortableFields,
374+
items,
375+
}
376+
},
377+
})
378+
379+
const heads = screen.queryAllByTestId('table-static-header')
380+
381+
expect(heads.at(0)).toHaveClass('table-static__header--sortable')
382+
expect(heads.at(2)).not.toHaveClass('table-static__header--sortable')
383+
})
384+
385+
it('should able modify sort by header using v-model:sort-by', async () => {
386+
const items = ref(generateItems())
387+
const sortBy = ref({})
388+
const screen = render({
389+
components: { Table },
390+
template : `
391+
<Table
392+
v-model:sort-by="sortBy"
393+
:fields="sortableFields"
394+
:items="items"
395+
sortable
396+
/>`,
397+
setup () {
398+
return {
399+
sortableFields,
400+
items,
401+
sortBy,
402+
}
403+
},
404+
})
405+
406+
const heads = screen.queryAllByTestId('table-static-header')
407+
408+
expect(heads.at(0)).toHaveClass('table-static__header--sortable')
409+
expect(heads.at(2)).not.toHaveClass('table-static__header--sortable')
410+
411+
await fireEvent.click(heads.at(0))
412+
413+
const icon = queryByTestId(heads[0], 'table-static-header-sort')
414+
415+
expect(icon).toHaveAttribute('active', 'asc')
416+
expect(sortBy.value).toStrictEqual({ id: 'asc' })
417+
418+
await fireEvent.click(heads.at(0))
419+
420+
expect(icon).toHaveAttribute('active', 'desc')
421+
expect(sortBy.value).toStrictEqual({ id: 'desc' })
422+
423+
await fireEvent.click(heads.at(0))
424+
425+
expect(icon).not.toHaveAttribute('active', 'desc')
426+
expect(sortBy.value).toStrictEqual({ id: undefined })
427+
428+
sortBy.value = { name: 'desc' }
429+
await nextTick()
430+
431+
const icon2 = queryByTestId(heads[1], 'table-static-header-sort')
432+
433+
expect(icon).not.toHaveAttribute('active', 'asc')
434+
expect(icon2).toHaveAttribute('active', 'desc')
435+
})
436+
437+
it('should have multiple value if sortable set to `multiple`', async () => {
438+
const items = ref(generateItems())
439+
const sortBy = ref({})
440+
const screen = render({
441+
components: { Table },
442+
template : `
443+
<Table
444+
v-model:sort-by="sortBy"
445+
:fields="sortableFields"
446+
:items="items"
447+
sortable="multiple"
448+
/>`,
449+
setup () {
450+
return {
451+
sortableFields,
452+
items,
453+
sortBy,
454+
}
455+
},
456+
})
457+
458+
const heads = screen.queryAllByTestId('table-static-header')
459+
460+
expect(heads.at(0)).toHaveClass('table-static__header--sortable')
461+
expect(heads.at(2)).not.toHaveClass('table-static__header--sortable')
462+
463+
await fireEvent.click(heads.at(0))
464+
465+
const icon = queryByTestId(heads[0], 'table-static-header-sort')
466+
const icon2 = queryByTestId(heads[1], 'table-static-header-sort')
467+
468+
expect(icon).toHaveAttribute('active', 'asc')
469+
expect(sortBy.value).toStrictEqual({ id: 'asc' })
470+
471+
await fireEvent.click(heads.at(1))
472+
473+
expect(icon).toHaveAttribute('active', 'asc')
474+
expect(icon2).toHaveAttribute('active', 'asc')
475+
expect(sortBy.value).toStrictEqual({ id: 'asc', name: 'asc' })
476+
})

0 commit comments

Comments
 (0)