@wssto2/vue-core 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.
@@ -6,7 +6,7 @@ import { u as O } from "./format-B8mJm946.js";
6
6
  import { _ as U } from "./DateField.vue_vue_type_script_setup_true_lang-GVasv8ao.js";
7
7
  import { _ as T } from "./FormGroup.vue_vue_type_script_setup_true_lang-DG2zdG_a.js";
8
8
  import { e as z } from "./control-7EP4tjYy.js";
9
- import { P as G, c as H, i as J } from "./index-Ddjj0x7J.js";
9
+ import { P as G, c as H, i as J } from "./index-CM_Uh_xF.js";
10
10
  import { u as K } from "./platform-q3cjODLx.js";
11
11
  import { b as M } from "./routeResource-DstM0hvf.js";
12
12
  import { _ as Q } from "./AsyncSection.vue_vue_type_script_setup_true_lang-Blj6KgCr.js";
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as k, computed as N, openBlock as n, createBlock as u, unref as a, withCtx as g, createElementBlock as p, Fragment as _, renderList as $, createElementVNode as i, toDisplayString as h, createCommentVNode as C, ref as x, watch as b, createVNode as y } from "vue";
2
2
  import { useI18n as E } from "vue-i18n";
3
- import { P as V, i as R } from "./index-Ddjj0x7J.js";
3
+ import { P as V, i as R } from "./index-CM_Uh_xF.js";
4
4
  import { u as S } from "./platform-q3cjODLx.js";
5
5
  import { b as B } from "./routeResource-DstM0hvf.js";
6
6
  import { _ as F } from "./AsyncSection.vue_vue_type_script_setup_true_lang-Blj6KgCr.js";
@@ -8,7 +8,7 @@ import { _ as F } from "./FormView.vue_vue_type_script_setup_true_lang-cr0xNDXP.
8
8
  import { _ as L } from "./SelectField.vue_vue_type_script_setup_true_lang-BJoAkBo2.js";
9
9
  import { _ as f } from "./TextField.vue_vue_type_script_setup_true_lang-B9dwVASU.js";
10
10
  import { u as A } from "./useSaveChrome-DuWm0Czf.js";
11
- import { P as D, b as G, i as I } from "./index-Ddjj0x7J.js";
11
+ import { P as D, b as G, i as I } from "./index-CM_Uh_xF.js";
12
12
  import { t as M } from "./toast-CqSDTWRX.js";
13
13
  import { u as O } from "./platform-q3cjODLx.js";
14
14
  import { b as U } from "./routeResource-DstM0hvf.js";
@@ -4,7 +4,7 @@ import { a as ge } from "./AdaptivePageShell.vue_vue_type_script_setup_true_lang
4
4
  import { u as L } from "./platform-q3cjODLx.js";
5
5
  import { _ as Q } from "./AsyncSection.vue_vue_type_script_setup_true_lang-Blj6KgCr.js";
6
6
  import { u as Y } from "./useLoad-CYRVx6HW.js";
7
- import { i as k, d as G } from "./index-Ddjj0x7J.js";
7
+ import { i as k, d as G } from "./index-CM_Uh_xF.js";
8
8
  import { u as Z } from "./FormErrors.vue_vue_type_script_setup_true_lang-BQb7wLT0.js";
9
9
  import { _ as ee } from "./FormView.vue_vue_type_script_setup_true_lang-cr0xNDXP.js";
10
10
  import { _ as U } from "./TextField.vue_vue_type_script_setup_true_lang-B9dwVASU.js";
@@ -2,7 +2,7 @@ import { defineComponent as x, useTemplateRef as v, computed as w, ref as $, ope
2
2
  import { useI18n as N } from "vue-i18n";
3
3
  import { _ as q } from "./Button.vue_vue_type_script_setup_true_lang-CL9Qh5yq.js";
4
4
  import { u as A } from "./describeError-Ctga6GcS.js";
5
- import { P as D, b as L, e as O, i as g, d as T } from "./index-Ddjj0x7J.js";
5
+ import { P as D, b as L, e as O, i as g, d as T } from "./index-CM_Uh_xF.js";
6
6
  import { _ as k } from "./AlertDialog.vue_vue_type_script_setup_true_lang-whA4WLdl.js";
7
7
  import { t as b } from "./toast-CqSDTWRX.js";
8
8
  import { u as V } from "./platform-q3cjODLx.js";
@@ -6,7 +6,7 @@ import { u as D } from "./format-B8mJm946.js";
6
6
  import { _ as p } from "./FormGroup.vue_vue_type_script_setup_true_lang-DG2zdG_a.js";
7
7
  import { e as b } from "./control-7EP4tjYy.js";
8
8
  import { u as U } from "./describeError-Ctga6GcS.js";
9
- import { c as q, P as z, b as F, _ as L, i as O, d as T } from "./index-Ddjj0x7J.js";
9
+ import { c as q, P as z, b as F, _ as L, i as O, d as T } from "./index-CM_Uh_xF.js";
10
10
  import { t as h } from "./toast-CqSDTWRX.js";
11
11
  import { u as j, h as G } from "./platform-q3cjODLx.js";
12
12
  import { b as H } from "./routeResource-DstM0hvf.js";
@@ -6,7 +6,7 @@ import { _ as N } from "./Panel.vue_vue_type_script_setup_true_lang-BA0u_DtS.js"
6
6
  import { _ as S } from "./FormView.vue_vue_type_script_setup_true_lang-cr0xNDXP.js";
7
7
  import { _ as a } from "./TextField.vue_vue_type_script_setup_true_lang-B9dwVASU.js";
8
8
  import { r as $ } from "./guards-Dve61KjR.js";
9
- import { u as C, a as E } from "./index-Ddjj0x7J.js";
9
+ import { u as C, a as E } from "./index-CM_Uh_xF.js";
10
10
  const V = { class: "flex flex-1 flex-col items-center justify-center gap-8" }, k = { class: "text-xl font-semibold text-content-strong" }, H = /* @__PURE__ */ d({
11
11
  __name: "SignInPage",
12
12
  setup(q) {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as g, ref as m, watch as p, openBlock as c, createElementBlock as v, createVNode as i, unref as e, withCtx as w, createBlock as x, createCommentVNode as y, createElementVNode as V, toDisplayString as $ } from "vue";
2
2
  import { useI18n as N } from "vue-i18n";
3
- import { P as S, i as b } from "./index-Ddjj0x7J.js";
3
+ import { P as S, i as b } from "./index-CM_Uh_xF.js";
4
4
  import { u as k } from "./platform-q3cjODLx.js";
5
5
  import { b as I } from "./routeResource-DstM0hvf.js";
6
6
  import { _ as R } from "./AsyncSection.vue_vue_type_script_setup_true_lang-Blj6KgCr.js";
@@ -1,9 +1,9 @@
1
1
  import { defineComponent as R, openBlock as q, createBlock as P, unref as e, withCtx as u, createVNode as t, mergeProps as L, provide as N, computed as g, useTemplateRef as $, createElementVNode as x, toDisplayString as C, createTextVNode as j } from "vue";
2
2
  import { useI18n as A } from "vue-i18n";
3
- import { u as F } from "./neighbors-095bixO7.js";
3
+ import { a as F } from "./neighbors-DVN_cADL.js";
4
4
  import { _ as H } from "./Avatar.vue_vue_type_script_setup_true_lang-CFIheaSr.js";
5
5
  import { u as J } from "./describeError-Ctga6GcS.js";
6
- import { i as w, P as Q, p as W, f as X, M as Y, g as Z, d as ee } from "./index-Ddjj0x7J.js";
6
+ import { i as w, P as Q, p as W, f as X, M as Y, g as Z, d as ee } from "./index-CM_Uh_xF.js";
7
7
  import { _ as se } from "./AlertDialog.vue_vue_type_script_setup_true_lang-whA4WLdl.js";
8
8
  import { t as k } from "./toast-CqSDTWRX.js";
9
9
  import { _ as ae } from "./SectionNavigator.vue_vue_type_script_setup_true_lang-ROl9_pdO.js";
@@ -18,7 +18,7 @@ import { _ as T } from "./FormGroup.vue_vue_type_script_setup_true_lang-DG2zdG_a
18
18
  import { e as B } from "./control-7EP4tjYy.js";
19
19
  import { u as z, _ as K } from "./useCommand-BkONMn3X.js";
20
20
  import { u as U } from "./fieldMessages-C3Rpbktw.js";
21
- import { u as ce, s as le } from "./status-DHFcoQly.js";
21
+ import { u as ce, s as le } from "./status-cZWwrYGN.js";
22
22
  import { _ as M } from "./TextField.vue_vue_type_script_setup_true_lang-B9dwVASU.js";
23
23
  const ue = /* @__PURE__ */ R({
24
24
  __name: "DeactivateDialog",
@@ -6,8 +6,8 @@ import { _ as I } from "./Avatar.vue_vue_type_script_setup_true_lang-CFIheaSr.js
6
6
  import { u as F } from "./format-B8mJm946.js";
7
7
  import { u as L } from "./platform-q3cjODLx.js";
8
8
  import { _ as G } from "./Badge.vue_vue_type_script_setup_true_lang-DJyZc0C7.js";
9
- import { i as K, f as E, M as W } from "./index-Ddjj0x7J.js";
10
- import { U as j, u as H, s as J } from "./status-DHFcoQly.js";
9
+ import { i as K, f as E, M as W } from "./index-CM_Uh_xF.js";
10
+ import { U as j, u as H, s as J } from "./status-cZWwrYGN.js";
11
11
  import { u as O } from "./environment-Dva-SG8D.js";
12
12
  import { u as Q } from "./languages-BShG9LpE.js";
13
13
  import { _ as X } from "./FormGroup.vue_vue_type_script_setup_true_lang-DG2zdG_a.js";
@@ -0,0 +1,22 @@
1
+ import { type RouteLocationRaw } from "vue-router";
2
+ import type { RecordListContext } from "../resource/listContext";
3
+ import type { CollectionDefinition } from "./definition";
4
+ import type { CollectionQuery } from "./types";
5
+ export interface CollectionBackOptions {
6
+ /** The encoded list state the record was opened with: untrusted (it is in the URL). Default: the route's `?from=`. */
7
+ from?: () => string | null | undefined;
8
+ /** The list's route. */
9
+ list: RouteLocationRaw;
10
+ /** What the back link to the list says ("Tickets"); a function follows the locale. */
11
+ backLabel: string | (() => string);
12
+ /** The URL key the list keeps its state under. Default `"query"`. */
13
+ stateKey?: string;
14
+ }
15
+ /** The list's route carrying `query` as its state; a string route is returned as it is. */
16
+ export declare function listRouteOf<Row, Sort extends string, Filter extends string, View extends string>(definition: CollectionDefinition<Row, Sort, Filter, View>, list: RouteLocationRaw, stateKey: string, query: CollectionQuery<Sort, Filter, View>): RouteLocationRaw;
17
+ /**
18
+ * Back to the list a record was opened from, as the user left it, for a record page without a pager:
19
+ * it decodes `?from=` through the list's definition and asks for nothing. A direct link (no or untrusted
20
+ * state) leads to the plain list. Pass its result as `ResourcePage`'s `list`.
21
+ */
22
+ export declare function useCollectionBack<Row, Sort extends string, Filter extends string, View extends string>(definition: CollectionDefinition<Row, Sort, Filter, View>, options: CollectionBackOptions): RecordListContext;
@@ -7,6 +7,8 @@ export { httpList, listParams, readListPage } from "./http";
7
7
  export { LIST_CONTEXT_PARAM } from "./location";
8
8
  export type { CollectionColumns, Column, ColumnKey, ColumnKind, ColumnValue, MobileRole, RowAction, SlotKey, TableColumns } from "./columns";
9
9
  export type { FilterDescriptor, FilterOption, ViewDescriptor } from "./filters";
10
+ export { useCollectionBack } from "./back";
11
+ export type { CollectionBackOptions } from "./back";
10
12
  export { useCollectionNeighbors } from "./neighbors";
11
13
  export type { CollectionNeighbors, Neighbor, NeighborOptions } from "./neighbors";
12
14
  export { createMemorySavedViews } from "./savedViews";
@@ -1,13 +1,13 @@
1
1
  import { D as O, L as j, a as U, h as G, l as X, r as Z } from "../http-D_D9YbLH.js";
2
2
  import { _ as H, a as J, u as K } from "../CollectionPage.vue_vue_type_script_setup_true_lang-DkpFEHUw.js";
3
- import { u as W } from "../neighbors-095bixO7.js";
4
- import { a as ee, b as te } from "../rowLayout-D1cYQghV.js";
5
- import { _ as oe } from "../DataTable.vue_vue_type_script_setup_true_lang-ChS9ULwk.js";
3
+ import { u as W, a as Y } from "../neighbors-DVN_cADL.js";
4
+ import { a as te, b as se } from "../rowLayout-D1cYQghV.js";
5
+ import { _ as ae } from "../DataTable.vue_vue_type_script_setup_true_lang-ChS9ULwk.js";
6
6
  import { defineComponent as y, openBlock as c, createElementBlock as d, Fragment as h, renderList as v, createBlock as k, unref as f, withCtx as C, normalizeClass as m, createVNode as p, createCommentVNode as g, computed as w, toValue as E } from "vue";
7
7
  import { _ } from "../Icon.vue_vue_type_script_lang-D7oC-d-S.js";
8
8
  import { _ as S } from "../Tooltip.vue_vue_type_script_setup_true_lang-OOD_XNWx.js";
9
9
  import { useI18n as T } from "vue-i18n";
10
- function B(r = {}) {
10
+ function $(r = {}) {
11
11
  const s = new Map(Object.entries(r).map(([t, e]) => [t, [...e]]));
12
12
  let a = 1;
13
13
  const o = (t) => {
@@ -79,7 +79,7 @@ const A = {
79
79
  }, 1032, ["text"]))), 128))
80
80
  ])) : g("", !0);
81
81
  }
82
- }), D = ["today", "yesterday", "this_week", "last_week", "this_month", "last_month", "this_year", "last_year"];
82
+ }), B = ["today", "yesterday", "this_week", "last_week", "this_month", "last_month", "this_year", "last_year"];
83
83
  function V(r, s) {
84
84
  const { t: a } = T();
85
85
  return w(() => ({
@@ -87,25 +87,26 @@ function V(r, s) {
87
87
  icon: "calendarEventFill",
88
88
  label: E(s) ?? a("core.collection.date_presets.label"),
89
89
  type: "select",
90
- options: D.map((o) => ({ value: o, label: a(`core.collection.date_presets.options.${o}`) }))
90
+ options: B.map((o) => ({ value: o, label: a(`core.collection.date_presets.options.${o}`) }))
91
91
  }));
92
92
  }
93
93
  export {
94
- ee as CollectionCell,
94
+ te as CollectionCell,
95
95
  H as CollectionPage,
96
96
  J as CollectionTable,
97
- D as DATE_PRESETS,
97
+ B as DATE_PRESETS,
98
98
  O as DEFAULT_PAGE_SIZES,
99
- oe as DataTable,
99
+ ae as DataTable,
100
100
  j as LIST_CONTEXT_PARAM,
101
- te as RecordIdentity,
101
+ se as RecordIdentity,
102
102
  N as RowActions,
103
- B as createMemorySavedViews,
103
+ $ as createMemorySavedViews,
104
104
  U as defineCollection,
105
105
  G as httpList,
106
106
  X as listParams,
107
107
  Z as readListPage,
108
108
  K as useCollection,
109
- W as useCollectionNeighbors,
109
+ W as useCollectionBack,
110
+ Y as useCollectionNeighbors,
110
111
  V as useDatePresetFilter
111
112
  };
@@ -16,7 +16,7 @@ export interface CollectionNeighbors {
16
16
  readonly previous: Readonly<Ref<Neighbor | null>>;
17
17
  readonly next: Readonly<Ref<Neighbor | null>>;
18
18
  readonly loading: Readonly<Ref<boolean>>;
19
- /** The list as the user left it (its route with the state in the query); null without list state. */
19
+ /** The list as the user left it (its route with the state in the query, also when the record is no longer in it); null without list state. */
20
20
  readonly listRoute: Readonly<Ref<RouteLocationRaw | null>>;
21
21
  /**
22
22
  * What a record page takes as `list` (`<ResourcePage :list="neighbors.context">`, or its `back` and pager in a page of its own):
@@ -1,4 +1,4 @@
1
- import { _ as t, h as n, j as a, i, k as o, d as r, l as d, m as u, n as y, r as l, o as I, s as f, q as p, t as A, f as c } from "../index-Ddjj0x7J.js";
1
+ import { _ as t, h as n, j as a, i, k as o, d as r, l as d, m as u, n as y, r as l, o as I, s as f, q as p, t as A, f as c } from "../index-CM_Uh_xF.js";
2
2
  export {
3
3
  t as SignInAsButton,
4
4
  n as identityFeature,
@@ -315,7 +315,7 @@ function Cs(e) {
315
315
  const Ye = async (e) => {
316
316
  await B(e.http);
317
317
  }, Je = z({
318
- login: { name: "login", path: "/login", component: () => import("./SignInPage-DQsEYuR3.js"), meta: { public: !0, titleKey: "core.identity.signin.title" } }
318
+ login: { name: "login", path: "/login", component: () => import("./SignInPage-DIo9fK1d.js"), meta: { public: !0, titleKey: "core.identity.signin.title" } }
319
319
  });
320
320
  function Os(e = {}) {
321
321
  return H({
@@ -334,7 +334,7 @@ function Os(e = {}) {
334
334
  });
335
335
  }
336
336
  const Z = z({
337
- index: { name: "profile", path: "/profile", component: () => import("./ProfilePage-C4MQsZjd.js"), meta: { titleKey: "core.profile.title" } }
337
+ index: { name: "profile", path: "/profile", component: () => import("./ProfilePage-B1-66cXB.js"), meta: { titleKey: "core.profile.title" } }
338
338
  }), Qe = /* @__PURE__ */ E({
339
339
  __name: "ProfileMenuItem",
340
340
  setup(e) {
@@ -358,19 +358,19 @@ function es(e) {
358
358
  return { name: `users.record.${e.path}`, path: e.path, component: s, meta: { ...e.meta } };
359
359
  }
360
360
  const W = "iam.user:view", qs = "iam.user:manage", ss = "iam.user.activity:view", ee = z({
361
- index: { name: "users.index", path: "/users", component: () => import("./UsersList-Dg31_WWq.js"), meta: { access: W, titleKey: "core.users.title" } },
361
+ index: { name: "users.index", path: "/users", component: () => import("./UsersList-C3cNr0MI.js"), meta: { access: W, titleKey: "core.users.title" } },
362
362
  record: {
363
363
  name: "users.record",
364
364
  path: "/users/:id",
365
- component: () => import("./UserRecord-Ye2uS25j.js"),
365
+ component: () => import("./UserRecord-DVm0mIrA.js"),
366
366
  meta: { access: W, titleKey: "core.users.title", remountOnParam: "id" },
367
367
  children: [
368
- { name: "users.record.general", path: "general", component: () => import("./General-DgR7_gax.js"), meta: { section: { labelKey: "core.users.sections.general", icon: "user3Line", groupKey: "core.users.section_groups.person" } } },
369
- { name: "users.record.signin", path: "signin", component: () => import("./SignIn-DBWmWSzJ.js"), meta: { section: { labelKey: "core.users.sections.signin", icon: "key2Line", groupKey: "core.users.section_groups.access" } } },
370
- { name: "users.record.sessions", path: "sessions", component: () => import("./Sessions-Bi-DFlda.js"), meta: { section: { labelKey: "core.users.sections.sessions", icon: "deviceLine", groupKey: "core.users.section_groups.access" } } },
371
- { name: "users.record.signins", path: "signins", component: () => import("./SignIns-H9EIa9Fb.js"), meta: { section: { labelKey: "core.users.sections.signins", icon: "timeFill", groupKey: "core.users.section_groups.activity" } } },
372
- { name: "users.record.changes", path: "changes", component: () => import("./Changes-CjrNUYmQ.js"), meta: { section: { labelKey: "core.users.sections.changes", icon: "edit", groupKey: "core.users.section_groups.activity" } } },
373
- { name: "users.record.activity", path: "activity", component: () => import("./Activity-CaQd8aXw.js"), meta: { access: ss, section: { labelKey: "core.users.sections.activity", icon: "listCheck", groupKey: "core.users.section_groups.activity" } } }
368
+ { name: "users.record.general", path: "general", component: () => import("./General-Cvb-tLsE.js"), meta: { section: { labelKey: "core.users.sections.general", icon: "user3Line", groupKey: "core.users.section_groups.person" } } },
369
+ { name: "users.record.signin", path: "signin", component: () => import("./SignIn-B8FbIWMH.js"), meta: { section: { labelKey: "core.users.sections.signin", icon: "key2Line", groupKey: "core.users.section_groups.access" } } },
370
+ { name: "users.record.sessions", path: "sessions", component: () => import("./Sessions-CIVLL9X4.js"), meta: { section: { labelKey: "core.users.sections.sessions", icon: "deviceLine", groupKey: "core.users.section_groups.access" } } },
371
+ { name: "users.record.signins", path: "signins", component: () => import("./SignIns-nH3zghoi.js"), meta: { section: { labelKey: "core.users.sections.signins", icon: "timeFill", groupKey: "core.users.section_groups.activity" } } },
372
+ { name: "users.record.changes", path: "changes", component: () => import("./Changes-CBM8york.js"), meta: { section: { labelKey: "core.users.sections.changes", icon: "edit", groupKey: "core.users.section_groups.activity" } } },
373
+ { name: "users.record.activity", path: "activity", component: () => import("./Activity-DdnEG7EW.js"), meta: { access: ss, section: { labelKey: "core.users.sections.activity", icon: "listCheck", groupKey: "core.users.section_groups.activity" } } }
374
374
  ]
375
375
  }
376
376
  });
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** The version of @wssto2/vue-core (kept equal to package.json by index.test.ts). */
2
- export declare const version = "0.4.11";
2
+ export declare const version = "0.4.12";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const o = "0.4.11";
1
+ const o = "0.4.12";
2
2
  export {
3
3
  o as version
4
4
  };
@@ -0,0 +1,105 @@
1
+ import { computed as j, ref as z, shallowRef as I, watch as F, getCurrentScope as J, onScopeDispose as Q } from "vue";
2
+ import { useRoute as O } from "vue-router";
3
+ import { i as N } from "./error-CD7x0Jrz.js";
4
+ import { L as k, d as B, e as D, o as U, q as V } from "./http-D_D9YbLH.js";
5
+ function K(l, t, n, g) {
6
+ return typeof t == "string" ? t : { ...t, query: { ...t.query, [n]: D(l, g) } };
7
+ }
8
+ function le(l, t) {
9
+ const n = O(), g = t.from ?? (() => typeof n.query[k] == "string" ? n.query[k] : null), q = j(() => {
10
+ const f = B(l, g());
11
+ return f ? K(l, t.list, t.stateKey ?? "query", f) : t.list;
12
+ });
13
+ return {
14
+ get back() {
15
+ return { label: typeof t.backLabel == "function" ? t.backLabel() : t.backLabel, to: q.value };
16
+ },
17
+ neighbors: null
18
+ };
19
+ }
20
+ const W = 8;
21
+ function re(l, t) {
22
+ const n = O(), g = t.from ?? (() => typeof n.query[k] == "string" ? n.query[k] : null), q = t.stateKey ?? "query", f = z(null), p = z(0), h = I(null), m = I(null), S = z(!1), x = I(null), o = /* @__PURE__ */ new Map();
23
+ let d = 0, C = new AbortController(), E = !1;
24
+ function L(w, b, a) {
25
+ const v = { ...w, page: b }, i = V(v);
26
+ let u = o.get(i);
27
+ for (u ? o.delete(i) : (u = (async () => l.load(v, { signal: a }))(), u.catch(() => {
28
+ o.get(i) === u && o.delete(i);
29
+ })), o.set(i, u); o.size > W; ) o.delete(o.keys().next().value);
30
+ return u.catch((e) => {
31
+ if (N(e)) throw e;
32
+ return null;
33
+ });
34
+ }
35
+ function T() {
36
+ f.value = null, h.value = null, m.value = null, p.value = 0;
37
+ }
38
+ async function _() {
39
+ const w = ++d, b = C.signal, a = B(l, g()), v = t.current();
40
+ if (x.value = a ? K(l, t.list, q, a) : null, !a || v === null || v === void 0 || v === "") {
41
+ T(), S.value = !1;
42
+ return;
43
+ }
44
+ S.value = !0, h.value = null, m.value = null;
45
+ const i = (e) => e ? e.rows.findIndex((r) => String(l.key(r)) === String(v)) : -1, u = (e, r) => {
46
+ const s = D(l, { ...a, page: e });
47
+ return {
48
+ key: r,
49
+ get to() {
50
+ return { name: n.name ?? void 0, params: { ...n.params, [t.param]: String(r) }, query: { ...n.query, [k]: s }, hash: n.hash };
51
+ }
52
+ };
53
+ };
54
+ try {
55
+ let e = a.page, r = await L(a, e, b), s = i(r);
56
+ for (const y of [e - 1, e + 1]) {
57
+ if (s !== -1 || !r || y < 1 || y > r.lastPage) continue;
58
+ const c = await L(a, y, b), M = i(c);
59
+ c && M !== -1 && (e = y, r = c, s = M);
60
+ }
61
+ if (w !== d) return;
62
+ if (!r || s === -1) {
63
+ T();
64
+ return;
65
+ }
66
+ const X = r.pageSize || a.pageSize, A = r.rows;
67
+ let P = null;
68
+ if (s > 0) P = u(e, l.key(A[s - 1]));
69
+ else if (e > 1) {
70
+ const y = await L(a, e - 1, b), c = y?.rows[y.rows.length - 1];
71
+ c !== void 0 && (P = u(e - 1, l.key(c)));
72
+ }
73
+ let R = null;
74
+ if (s < A.length - 1) R = u(e, l.key(A[s + 1]));
75
+ else if (e < r.lastPage) {
76
+ const c = (await L(a, e + 1, b))?.rows[0];
77
+ c !== void 0 && (R = u(e + 1, l.key(c)));
78
+ }
79
+ if (w !== d) return;
80
+ p.value = r.total, f.value = (e - 1) * X + s + 1, h.value = P, m.value = R, x.value = K(l, t.list, q, { ...a, page: e });
81
+ } catch (e) {
82
+ if (!N(e)) throw e;
83
+ } finally {
84
+ w === d && (S.value = !1);
85
+ }
86
+ }
87
+ const G = F([g, t.current], _, { immediate: !0 });
88
+ function H() {
89
+ E || (E = !0, d++, C.abort(), G(), o.clear());
90
+ }
91
+ return J() && Q(H), U(() => {
92
+ C.abort(), C = new AbortController(), o.clear(), _();
93
+ }), { position: f, total: p, previous: h, next: m, loading: S, listRoute: x, context: {
94
+ get back() {
95
+ return { label: typeof t.backLabel == "function" ? t.backLabel() : t.backLabel, to: x.value ?? t.list };
96
+ },
97
+ get neighbors() {
98
+ return f.value === null ? null : { position: f.value, total: p.value, previous: h.value?.to ?? null, next: m.value?.to ?? null };
99
+ }
100
+ } };
101
+ }
102
+ export {
103
+ re as a,
104
+ le as u
105
+ };
@@ -1,5 +1,5 @@
1
1
  import { a, r as o } from "./http-D_D9YbLH.js";
2
- import { i as r } from "./index-Ddjj0x7J.js";
2
+ import { i as r } from "./index-CM_Uh_xF.js";
3
3
  const n = ["active", "locked", "inactive", "all"];
4
4
  function l(i) {
5
5
  return a({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wssto2/vue-core",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "goCore": "v1.7.0",
5
5
  "description": "Shared Vue 3 library for go-core applications: app shell, list / record / form pages and their controls.",
6
6
  "keywords": [
@@ -1,91 +0,0 @@
1
- import { ref as P, shallowRef as z, watch as X, getCurrentScope as j, onScopeDispose as B } from "vue";
2
- import { useRoute as F } from "vue-router";
3
- import { i as M } from "./error-CD7x0Jrz.js";
4
- import { L as I, o as J, d as Q, e as N, q as U } from "./http-D_D9YbLH.js";
5
- const V = 8;
6
- function te(s, r) {
7
- const v = F(), R = r.from ?? (() => typeof v.query[I] == "string" ? v.query[I] : null), D = r.stateKey ?? "query", y = P(null), p = P(0), h = z(null), d = z(null), b = P(!1), S = z(null), n = /* @__PURE__ */ new Map();
8
- let m = 0, k = new AbortController(), E = !1;
9
- function q(w, g, l) {
10
- const f = { ...w, page: g }, c = U(f);
11
- let a = n.get(c);
12
- for (a ? n.delete(c) : (a = (async () => s.load(f, { signal: l }))(), a.catch(() => {
13
- n.get(c) === a && n.delete(c);
14
- })), n.set(c, a); n.size > V; ) n.delete(n.keys().next().value);
15
- return a.catch((e) => {
16
- if (M(e)) throw e;
17
- return null;
18
- });
19
- }
20
- function K() {
21
- y.value = null, h.value = null, d.value = null, p.value = 0, S.value = null;
22
- }
23
- async function T() {
24
- const w = ++m, g = k.signal, l = Q(s, R()), f = r.current();
25
- if (!l || f === null || f === void 0 || f === "") {
26
- K(), b.value = !1;
27
- return;
28
- }
29
- b.value = !0, h.value = null, d.value = null;
30
- const c = (e) => e ? e.rows.findIndex((t) => String(s.key(t)) === String(f)) : -1, a = (e, t) => {
31
- const o = N(s, { ...l, page: e });
32
- return {
33
- key: t,
34
- get to() {
35
- return { name: v.name ?? void 0, params: { ...v.params, [r.param]: String(t) }, query: { ...v.query, [I]: o }, hash: v.hash };
36
- }
37
- };
38
- };
39
- try {
40
- let e = l.page, t = await q(l, e, g), o = c(t);
41
- for (const i of [e - 1, e + 1]) {
42
- if (o !== -1 || !t || i < 1 || i > t.lastPage) continue;
43
- const u = await q(l, i, g), _ = c(u);
44
- u && _ !== -1 && (e = i, t = u, o = _);
45
- }
46
- if (w !== m) return;
47
- if (!t || o === -1) {
48
- K();
49
- return;
50
- }
51
- const O = t.pageSize || l.pageSize, C = t.rows;
52
- let A = null;
53
- if (o > 0) A = a(e, s.key(C[o - 1]));
54
- else if (e > 1) {
55
- const i = await q(l, e - 1, g), u = i?.rows[i.rows.length - 1];
56
- u !== void 0 && (A = a(e - 1, s.key(u)));
57
- }
58
- let L = null;
59
- if (o < C.length - 1) L = a(e, s.key(C[o + 1]));
60
- else if (e < t.lastPage) {
61
- const u = (await q(l, e + 1, g))?.rows[0];
62
- u !== void 0 && (L = a(e + 1, s.key(u)));
63
- }
64
- if (w !== m) return;
65
- p.value = t.total, y.value = (e - 1) * O + o + 1, h.value = A, d.value = L;
66
- const x = r.list;
67
- S.value = typeof x == "string" ? x : { ...x, query: { ...x.query, [D]: N(s, { ...l, page: e }) } };
68
- } catch (e) {
69
- if (!M(e)) throw e;
70
- } finally {
71
- w === m && (b.value = !1);
72
- }
73
- }
74
- const G = X([R, r.current], T, { immediate: !0 });
75
- function H() {
76
- E || (E = !0, m++, k.abort(), G(), n.clear());
77
- }
78
- return j() && B(H), J(() => {
79
- k.abort(), k = new AbortController(), n.clear(), T();
80
- }), { position: y, total: p, previous: h, next: d, loading: b, listRoute: S, context: {
81
- get back() {
82
- return { label: typeof r.backLabel == "function" ? r.backLabel() : r.backLabel, to: S.value ?? r.list };
83
- },
84
- get neighbors() {
85
- return y.value === null ? null : { position: y.value, total: p.value, previous: h.value?.to ?? null, next: d.value?.to ?? null };
86
- }
87
- } };
88
- }
89
- export {
90
- te as u
91
- };