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.
Files changed (2) hide show
  1. package/dist/index.js +104 -119
  2. package/package.json +20 -17
package/dist/index.js CHANGED
@@ -1,128 +1,113 @@
1
- function d(s, l) {
2
- const o = [];
3
- let f = [];
4
- s.forEach((i) => {
5
- i.type === 0 ? o.push(i) : i.type === 1 ? f.push(i) : console.assert(!1);
6
- }), o.sort((i, e) => i.position - e.position), f.sort((i, e) => i.position - e.position);
7
- const a = [];
8
- f.forEach((i) => {
9
- o.find((e) => e.id === i.group) || a.push(i.id);
10
- }), f = f.filter((i) => !a.find((e) => e === i.id));
11
- const u = [];
12
- return o.forEach((i) => {
13
- const e = [];
14
- f.forEach((t) => {
15
- t.group === i.id && (t.show = !i.collapse, e.push(t));
16
- }), i.count = e.length, i.count > 0 ? (u.push(i), u.push(...e)) : l || u.push(i);
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 r(s, l) {
20
- return s.value.find((o) => o.id === l);
18
+ function getListEntry(e, r) {
19
+ return e.value.find((e) => e.id === r);
21
20
  }
22
- function v(s, l, o) {
23
- for (let f = 0; f < s.value.length; f++) {
24
- let a = s.value[f];
25
- if (a.id === l) {
26
- if (a.type !== 0) {
27
- console.assert(!1, "type must be 0");
28
- break;
29
- }
30
- for (a.collapse = o, f++; f < s.value.length && (a = s.value[f], a.type !== 0); f++)
31
- a.show = !o;
32
- break;
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 g(s) {
37
- return !!s.value.find((l) => l.type === 0 && l.detail);
34
+ function hasDetail(e) {
35
+ return !!e.value.find((e) => e.type === 0 && e.detail);
38
36
  }
39
- function E(s, l) {
40
- s.value.forEach((o) => {
41
- o.type === 0 && (o.detail = o.id === l);
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 b(s, l) {
45
- s.value.forEach((o) => {
46
- o.type !== 0 && (o.select = o.id === l);
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 k(s, l, o, f) {
50
- if (l === 1) {
51
- if (f === 0) {
52
- const t = s.value.splice(f, 1)[0];
53
- s.value.splice(o, 0, t);
54
- return;
55
- }
56
- let e;
57
- for (let t = 0; t < s.value.length; t++) {
58
- const n = s.value[t];
59
- if (n.type === 0)
60
- e = n;
61
- else if (n.type === 1) {
62
- if (!e) {
63
- console.assert(!1);
64
- return;
65
- }
66
- if (n.group !== e.id) {
67
- if (n.group = e.id, e.collapse) {
68
- let p = t;
69
- for (t++; t < s.value.length; t++) {
70
- const c = s.value[t];
71
- if (c.type === 0 || c.show)
72
- break;
73
- const h = s.value[p];
74
- s.value[p] = c, s.value[t] = h, p = t;
75
- }
76
- }
77
- break;
78
- }
79
- } else
80
- console.assert(!1);
81
- }
82
- }
83
- const a = [], u = [];
84
- s.value.forEach((e) => {
85
- e.type === 0 ? a.push(e) : e.type === 1 ? u.push(e) : console.assert(!1);
86
- });
87
- const i = [];
88
- a.forEach((e, t) => {
89
- e.position = t;
90
- const n = [];
91
- u.forEach((p) => {
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 I(s) {
97
- const l = {};
98
- return s.value.forEach((o) => {
99
- o.type === 0 ? l[o.id] = {
100
- id: o.id,
101
- group: "",
102
- position: o.position
103
- } : o.type === 1 ? l[o.id] = {
104
- id: o.id,
105
- group: o.group,
106
- position: o.position
107
- } : console.assert(!1);
108
- }), l;
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 D(s, l) {
111
- const o = [];
112
- for (const f in l) {
113
- const a = l[f], u = s[f];
114
- (!u || a.group !== u.group || a.position !== u.position) && o.push({ ...a });
115
- }
116
- return o;
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.7",
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.23",
26
- "vuetify": "^3.10.9"
25
+ "vue": "^3.5.27",
26
+ "vuetify": "^3.11.7"
27
27
  },
28
28
  "devDependencies": {
29
- "@eslint/js": "^9.39.1",
30
- "@types/node": "^24.10.0",
31
- "@vitejs/plugin-vue": "^6.0.1",
32
- "eslint": "^9.39.1",
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.4",
35
- "eslint-plugin-vue": "^10.5.1",
36
- "globals": "^16.5.0",
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.6",
39
- "prettier": "3.6.2",
40
- "sass": "^1.93.3",
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.46.3",
43
- "vite": "^7.2.1",
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.2",
45
+ "vite-plugin-vuetify": "^2.1.3",
46
46
  "vue-eslint-parser": "^10.2.0",
47
- "vue-tsc": "^3.1.3"
47
+ "vue-tsc": "^3.2.2"
48
+ },
49
+ "overrides": {
50
+ "vite": "npm:rolldown-vite@7.3.1"
48
51
  }
49
52
  }