x-group-list 0.4.11 → 0.4.12

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 +71 -69
  2. package/package.json +11 -14
package/dist/index.js CHANGED
@@ -1,73 +1,74 @@
1
- function tidyList(e, r) {
2
- let i = [], a = [];
1
+ //#region src/utils/groupList.ts
2
+ function e(e, t) {
3
+ let n = [], r = [];
3
4
  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;
5
+ e.type === 0 ? n.push(e) : e.type === 1 ? r.push(e) : console.assert(!1);
6
+ }), n.sort((e, t) => e.position - t.position), r.sort((e, t) => e.position - t.position);
7
+ let i = [];
8
+ r.forEach((e) => {
9
+ n.find((t) => t.id === e.group) || i.push(e.id);
10
+ }), r = r.filter((e) => !i.find((t) => t === e.id));
11
+ let a = [];
12
+ return n.forEach((e) => {
13
+ let n = [];
14
+ r.forEach((t) => {
15
+ t.group === e.id && (t.show = !e.collapse, n.push(t));
16
+ }), e.count = n.length, e.count > 0 ? (a.push(e), a.push(...n)) : t || a.push(e);
17
+ }), a;
17
18
  }
18
- function getListEntry(e, r) {
19
- return e.value.find((e) => e.id === r);
19
+ function t(e, t) {
20
+ return e.value.find((e) => e.id === t);
20
21
  }
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) {
22
+ function n(e, t, n) {
23
+ for (let r = 0; r < e.value.length; r++) {
24
+ let i = e.value[r];
25
+ if (i.id === t) {
26
+ if (i.type !== 0) {
26
27
  console.assert(!1, "type must be 0");
27
28
  break;
28
29
  }
29
- for (o.collapse = i, a++; a < e.value.length && (o = e.value[a], o.type !== 0); a++) o.show = !i;
30
+ for (i.collapse = n, r++; r < e.value.length && (i = e.value[r], i.type !== 0); r++) i.show = !n;
30
31
  break;
31
32
  }
32
33
  }
33
34
  }
34
- function hasDetail(e) {
35
+ function r(e) {
35
36
  return !!e.value.find((e) => e.type === 0 && e.detail);
36
37
  }
37
- function toggleDetail(e, r) {
38
+ function i(e, t) {
38
39
  e.value.forEach((e) => {
39
- e.type === 0 && (e.detail = e.id === r);
40
+ e.type === 0 && (e.detail = e.id === t);
40
41
  });
41
42
  }
42
- function selectItem(e, r) {
43
+ function a(e, t) {
43
44
  e.value.forEach((e) => {
44
- e.type !== 0 && (e.select = e.id === r);
45
+ e.type !== 0 && (e.select = e.id === t);
45
46
  });
46
47
  }
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);
48
+ function o(e, t, n, r) {
49
+ if (t === 1) {
50
+ if (r === 0) {
51
+ let t = e.value.splice(r, 1)[0];
52
+ e.value.splice(n, 0, t);
52
53
  return;
53
54
  }
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) {
55
+ let t;
56
+ for (let n = 0; n < e.value.length; n++) {
57
+ let r = e.value[n];
58
+ if (r.type === 0) t = r;
59
+ else if (r.type === 1) {
60
+ if (!t) {
60
61
  console.assert(!1);
61
62
  return;
62
63
  }
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;
64
+ if (r.group !== t.id) {
65
+ if (r.group = t.id, t.collapse) {
66
+ let t = n;
67
+ for (n++; n < e.value.length; n++) {
68
+ let r = e.value[n];
69
+ if (r.type === 0 || r.show) break;
70
+ let i = e.value[t];
71
+ e.value[t] = r, e.value[n] = i, t = n;
71
72
  }
72
73
  }
73
74
  break;
@@ -75,39 +76,40 @@ function onDragEnd(e, r, i, a) {
75
76
  } else console.assert(!1);
76
77
  }
77
78
  }
78
- let o = [], s = [];
79
+ let i = [], a = [];
79
80
  e.value.forEach((e) => {
80
- e.type === 0 ? o.push(e) : e.type === 1 ? s.push(e) : console.assert(!1);
81
+ e.type === 0 ? i.push(e) : e.type === 1 ? a.push(e) : console.assert(!1);
81
82
  });
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;
83
+ let o = [];
84
+ i.forEach((e, t) => {
85
+ e.position = t;
86
+ let n = [];
87
+ a.forEach((t) => {
88
+ t.group === e.id && (t.position = n.length, n.push(t));
89
+ }), e.count = n.length, o.push(e), o.push(...n);
90
+ }), e.value = o;
90
91
  }
91
- function toPosInfos(e) {
92
- let r = {};
92
+ function s(e) {
93
+ let t = {};
93
94
  return e.value.forEach((e) => {
94
- e.type === 0 ? r[e.id] = {
95
+ e.type === 0 ? t[e.id] = {
95
96
  id: e.id,
96
97
  group: "",
97
98
  position: e.position
98
- } : e.type === 1 ? r[e.id] = {
99
+ } : e.type === 1 ? t[e.id] = {
99
100
  id: e.id,
100
101
  group: e.group,
101
102
  position: e.position
102
103
  } : console.assert(!1);
103
- }), r;
104
+ }), t;
104
105
  }
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 });
106
+ function c(e, t) {
107
+ let n = [];
108
+ for (let r in t) {
109
+ let i = t[r], a = e[r];
110
+ (!a || i.group !== a.group || i.position !== a.position) && n.push({ ...i });
110
111
  }
111
- return i;
112
+ return n;
112
113
  }
113
- export { diffPosInfos, getListEntry, hasDetail, onDragEnd, selectItem, setCollapse, tidyList, toPosInfos, toggleDetail };
114
+ //#endregion
115
+ export { c as diffPosInfos, t as getListEntry, r as hasDetail, o as onDragEnd, a as selectItem, n as setCollapse, e as tidyList, s as toPosInfos, i as 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.11",
4
+ "version": "0.4.12",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -22,31 +22,28 @@
22
22
  "*": "prettier --write ."
23
23
  },
24
24
  "dependencies": {
25
- "vue": "^3.5.29",
26
- "vuetify": "^4.0.0"
25
+ "vue": "^3.5.30",
26
+ "vuetify": "^4.0.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@eslint/js": "^10.0.1",
30
- "@types/node": "^25.3.0",
30
+ "@types/node": "^25.4.0",
31
31
  "@vitejs/plugin-vue": "^6.0.4",
32
- "eslint": "^10.0.2",
32
+ "eslint": "^10.0.3",
33
33
  "eslint-config-prettier": "^10.1.8",
34
34
  "eslint-plugin-prettier": "^5.5.5",
35
35
  "eslint-plugin-vue": "^10.8.0",
36
- "globals": "^17.3.0",
36
+ "globals": "^17.4.0",
37
37
  "husky": "^9.1.7",
38
- "lint-staged": "^16.2.7",
38
+ "lint-staged": "^16.3.3",
39
39
  "prettier": "3.8.1",
40
- "sass": "^1.97.3",
40
+ "sass": "^1.98.0",
41
41
  "typescript": "^5.9.3",
42
- "typescript-eslint": "^8.56.1",
43
- "vite": "npm:rolldown-vite@7.3.1",
44
- "vite-plugin-css-injected-by-js": "^3.5.2",
42
+ "typescript-eslint": "^8.57.0",
43
+ "vite": "^8.0.0",
44
+ "vite-plugin-css-injected-by-js": "^4.0.1",
45
45
  "vite-plugin-vuetify": "^2.1.3",
46
46
  "vue-eslint-parser": "^10.4.0",
47
47
  "vue-tsc": "^3.2.5"
48
- },
49
- "overrides": {
50
- "vite": "npm:rolldown-vite@7.3.1"
51
48
  }
52
49
  }