x-group-list 0.4.7 → 0.4.9
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.js +104 -119
- package/package.json +20 -17
package/dist/index.js
CHANGED
|
@@ -1,128 +1,113 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}), u;
|
|
1
|
+
function tidyList(e, r) {
|
|
2
|
+
let i = [], a = [];
|
|
3
|
+
e.forEach((e) => {
|
|
4
|
+
e.type === 0 ? i.push(e) : e.type === 1 ? a.push(e) : console.assert(!1);
|
|
5
|
+
}), i.sort((e, r) => e.position - r.position), a.sort((e, r) => e.position - r.position);
|
|
6
|
+
let o = [];
|
|
7
|
+
a.forEach((e) => {
|
|
8
|
+
i.find((r) => r.id === e.group) || o.push(e.id);
|
|
9
|
+
}), a = a.filter((e) => !o.find((r) => r === e.id));
|
|
10
|
+
let s = [];
|
|
11
|
+
return i.forEach((e) => {
|
|
12
|
+
let i = [];
|
|
13
|
+
a.forEach((r) => {
|
|
14
|
+
r.group === e.id && (r.show = !e.collapse, i.push(r));
|
|
15
|
+
}), e.count = i.length, e.count > 0 ? (s.push(e), s.push(...i)) : r || s.push(e);
|
|
16
|
+
}), s;
|
|
18
17
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
18
|
+
function getListEntry(e, r) {
|
|
19
|
+
return e.value.find((e) => e.id === r);
|
|
21
20
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
21
|
+
function setCollapse(e, r, i) {
|
|
22
|
+
for (let a = 0; a < e.value.length; a++) {
|
|
23
|
+
let o = e.value[a];
|
|
24
|
+
if (o.id === r) {
|
|
25
|
+
if (o.type !== 0) {
|
|
26
|
+
console.assert(!1, "type must be 0");
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
for (o.collapse = i, a++; a < e.value.length && (o = e.value[a], o.type !== 0); a++) o.show = !i;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
35
33
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
34
|
+
function hasDetail(e) {
|
|
35
|
+
return !!e.value.find((e) => e.type === 0 && e.detail);
|
|
38
36
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
function toggleDetail(e, r) {
|
|
38
|
+
e.value.forEach((e) => {
|
|
39
|
+
e.type === 0 && (e.detail = e.id === r);
|
|
40
|
+
});
|
|
43
41
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
function selectItem(e, r) {
|
|
43
|
+
e.value.forEach((e) => {
|
|
44
|
+
e.type !== 0 && (e.select = e.id === r);
|
|
45
|
+
});
|
|
48
46
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
p.group === e.id && (p.position = n.length, n.push(p));
|
|
93
|
-
}), e.count = n.length, i.push(e), i.push(...n);
|
|
94
|
-
}), s.value = i;
|
|
47
|
+
function onDragEnd(e, r, i, a) {
|
|
48
|
+
if (r === 1) {
|
|
49
|
+
if (a === 0) {
|
|
50
|
+
let r = e.value.splice(a, 1)[0];
|
|
51
|
+
e.value.splice(i, 0, r);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
let r;
|
|
55
|
+
for (let i = 0; i < e.value.length; i++) {
|
|
56
|
+
let a = e.value[i];
|
|
57
|
+
if (a.type === 0) r = a;
|
|
58
|
+
else if (a.type === 1) {
|
|
59
|
+
if (!r) {
|
|
60
|
+
console.assert(!1);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (a.group !== r.id) {
|
|
64
|
+
if (a.group = r.id, r.collapse) {
|
|
65
|
+
let r = i;
|
|
66
|
+
for (i++; i < e.value.length; i++) {
|
|
67
|
+
let a = e.value[i];
|
|
68
|
+
if (a.type === 0 || a.show) break;
|
|
69
|
+
let o = e.value[r];
|
|
70
|
+
e.value[r] = a, e.value[i] = o, r = i;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
} else console.assert(!1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
let o = [], s = [];
|
|
79
|
+
e.value.forEach((e) => {
|
|
80
|
+
e.type === 0 ? o.push(e) : e.type === 1 ? s.push(e) : console.assert(!1);
|
|
81
|
+
});
|
|
82
|
+
let c = [];
|
|
83
|
+
o.forEach((e, r) => {
|
|
84
|
+
e.position = r;
|
|
85
|
+
let i = [];
|
|
86
|
+
s.forEach((r) => {
|
|
87
|
+
r.group === e.id && (r.position = i.length, i.push(r));
|
|
88
|
+
}), e.count = i.length, c.push(e), c.push(...i);
|
|
89
|
+
}), e.value = c;
|
|
95
90
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
function toPosInfos(e) {
|
|
92
|
+
let r = {};
|
|
93
|
+
return e.value.forEach((e) => {
|
|
94
|
+
e.type === 0 ? r[e.id] = {
|
|
95
|
+
id: e.id,
|
|
96
|
+
group: "",
|
|
97
|
+
position: e.position
|
|
98
|
+
} : e.type === 1 ? r[e.id] = {
|
|
99
|
+
id: e.id,
|
|
100
|
+
group: e.group,
|
|
101
|
+
position: e.position
|
|
102
|
+
} : console.assert(!1);
|
|
103
|
+
}), r;
|
|
109
104
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
105
|
+
function diffPosInfos(e, r) {
|
|
106
|
+
let i = [];
|
|
107
|
+
for (let a in r) {
|
|
108
|
+
let o = r[a], s = e[a];
|
|
109
|
+
(!s || o.group !== s.group || o.position !== s.position) && i.push({ ...o });
|
|
110
|
+
}
|
|
111
|
+
return i;
|
|
117
112
|
}
|
|
118
|
-
export {
|
|
119
|
-
D as diffPosInfos,
|
|
120
|
-
r as getListEntry,
|
|
121
|
-
g as hasDetail,
|
|
122
|
-
k as onDragEnd,
|
|
123
|
-
b as selectItem,
|
|
124
|
-
v as setCollapse,
|
|
125
|
-
d as tidyList,
|
|
126
|
-
I as toPosInfos,
|
|
127
|
-
E as toggleDetail
|
|
128
|
-
};
|
|
113
|
+
export { diffPosInfos, getListEntry, hasDetail, onDragEnd, selectItem, setCollapse, tidyList, toPosInfos, toggleDetail };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-group-list",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.9",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -22,28 +22,31 @@
|
|
|
22
22
|
"*": "prettier --write ."
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"vue": "^3.5.
|
|
26
|
-
"vuetify": "^3.
|
|
25
|
+
"vue": "^3.5.27",
|
|
26
|
+
"vuetify": "^3.11.7"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@eslint/js": "^9.39.
|
|
30
|
-
"@types/node": "^
|
|
31
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
32
|
-
"eslint": "^9.39.
|
|
29
|
+
"@eslint/js": "^9.39.2",
|
|
30
|
+
"@types/node": "^25.0.9",
|
|
31
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
32
|
+
"eslint": "^9.39.2",
|
|
33
33
|
"eslint-config-prettier": "^10.1.8",
|
|
34
|
-
"eslint-plugin-prettier": "^5.5.
|
|
35
|
-
"eslint-plugin-vue": "^10.
|
|
36
|
-
"globals": "^
|
|
34
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
35
|
+
"eslint-plugin-vue": "^10.7.0",
|
|
36
|
+
"globals": "^17.0.0",
|
|
37
37
|
"husky": "^9.1.7",
|
|
38
|
-
"lint-staged": "^16.2.
|
|
39
|
-
"prettier": "3.
|
|
40
|
-
"sass": "^1.
|
|
38
|
+
"lint-staged": "^16.2.7",
|
|
39
|
+
"prettier": "3.8.0",
|
|
40
|
+
"sass": "^1.97.2",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
|
-
"typescript-eslint": "^8.
|
|
43
|
-
"vite": "
|
|
42
|
+
"typescript-eslint": "^8.53.1",
|
|
43
|
+
"vite": "npm:rolldown-vite@7.3.1",
|
|
44
44
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
45
|
-
"vite-plugin-vuetify": "^2.1.
|
|
45
|
+
"vite-plugin-vuetify": "^2.1.3",
|
|
46
46
|
"vue-eslint-parser": "^10.2.0",
|
|
47
|
-
"vue-tsc": "^3.
|
|
47
|
+
"vue-tsc": "^3.2.2"
|
|
48
|
+
},
|
|
49
|
+
"overrides": {
|
|
50
|
+
"vite": "npm:rolldown-vite@7.3.1"
|
|
48
51
|
}
|
|
49
52
|
}
|