@orchidui/core 1.8.1-100 → 1.8.1-102

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.
@@ -1,18 +1,18 @@
1
- import { ref as s } from "vue";
1
+ import { ref as n } from "vue";
2
2
  function I(m) {
3
- const { id: L, name: w, localDb: _ } = m, B = s(L), r = s(w), i = s(_), v = s([]), l = s([]), f = s({}), D = s({
3
+ const { id: L, name: w, localDb: _ } = m, B = n(L), s = n(w), i = n(_), D = n([]), l = n([]), f = n({}), g = n({
4
4
  total: 0,
5
5
  last_page: 0
6
- }), g = s(!1);
7
- let y = null;
6
+ }), y = n(!1);
7
+ let b = null;
8
8
  const p = async () => {
9
- g.value = !0, y && clearTimeout(y), y = setTimeout(async () => {
10
- let e = i.value.table(r.value);
9
+ y.value = !0, b && clearTimeout(b), b = setTimeout(async () => {
10
+ let e = i.value.table(s.value);
11
11
  const t = C();
12
- t.filter && Object.entries(t.filter).forEach(([c, o]) => {
12
+ console.log("local filter options :", t), t.filter && Object.entries(t.filter).forEach(([c, o]) => {
13
13
  o && Array.isArray(o) ? e = e.filter((d) => {
14
14
  const u = d[c];
15
- return o.some((b) => typeof b == "string" && typeof u == "string" ? u.toLowerCase().includes(b.toLowerCase()) : u === b);
15
+ return o.some((v) => typeof v == "string" && typeof u == "string" ? u.toLowerCase().includes(v.toLowerCase()) : u === v);
16
16
  }) : o && typeof o == "string" ? e = e.filter((d) => {
17
17
  const u = d[c];
18
18
  return typeof u == "string" && u.toLowerCase().includes(o.toLowerCase());
@@ -21,34 +21,35 @@ function I(m) {
21
21
  e = e.sortBy(c.column), c.direction === "desc" && (e = e.reverse());
22
22
  });
23
23
  const a = await e.toArray();
24
- v.value = a;
25
- const n = await i.value.table(r.value).count();
26
- D.value = {
27
- total: n,
24
+ D.value = a;
25
+ const r = await i.value.table(s.value).count();
26
+ g.value = {
27
+ total: r,
28
28
  page: t.page,
29
29
  per_page: t.per_page,
30
- last_page: Math.ceil(n / t.per_page)
31
- }, g.value = !1;
30
+ last_page: Math.ceil(r / t.per_page)
31
+ }, y.value = !1;
32
32
  }, 300);
33
33
  }, C = () => {
34
34
  const e = {}, t = ["columnEdit", "page", "per_page"];
35
- return Object.entries(f.value).forEach(([a, n]) => {
36
- !t.includes(a) && n !== void 0 && n !== null && n !== "" && (e[a] = n);
35
+ return Object.entries(f.value).forEach(([a, r]) => {
36
+ !t.includes(a) && r !== void 0 && r !== null && r !== "" && (e[a] = r);
37
37
  }), {
38
38
  filter: e,
39
39
  sortBy: l.value,
40
40
  page: f.value.page,
41
- per_page: f.value.per_page
41
+ per_page: f.value.per_page,
42
+ pagination: g.value
42
43
  };
43
44
  };
44
45
  return {
45
46
  // State
46
47
  sortBy: l,
47
- localData: v,
48
+ localData: D,
48
49
  dataTableId: B,
49
- dbTablename: r,
50
- paginationData: D,
51
- isLoading: g,
50
+ dbTablename: s,
51
+ paginationData: g,
52
+ isLoading: y,
52
53
  // Methods
53
54
  toggleSort: (e) => {
54
55
  const t = l.value.find((a) => a.column === e);
@@ -57,16 +58,16 @@ function I(m) {
57
58
  ) : l.value = l.value.filter((a) => a.column !== e) : l.value = [...l.value, { column: e, direction: "asc" }], p();
58
59
  },
59
60
  bulkPutLocalData: async (e) => {
60
- await i.value.table(r.value).bulkPut(e);
61
+ await i.value.table(s.value).bulkPut(e);
61
62
  },
62
63
  bulkDeleteLocalData: async (e) => {
63
- await i.value.table(r.value).bulkDelete(e);
64
+ await i.value.table(s.value).bulkDelete(e);
64
65
  },
65
66
  getLocalDataUpdatedAt: async () => {
66
- const e = await i.value.table(r.value).orderBy("updated_at").reverse().limit(1).first();
67
+ const e = await i.value.table(s.value).orderBy("updated_at").reverse().limit(1).first();
67
68
  return e == null ? void 0 : e.updated_at;
68
69
  },
69
- getLocalDataIds: async () => await i.value.table(r.value).toCollection().primaryKeys(),
70
+ getLocalDataIds: async () => await i.value.table(s.value).toCollection().primaryKeys(),
70
71
  syncLocalData: p,
71
72
  // Setters
72
73
  setFilter: (e) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orchidui/core",
3
3
  "description": "Orchid UI, Library Vue 3 tailwind css",
4
- "version": "1.8.1-100",
4
+ "version": "1.8.1-102",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "vite build"