@archbase/data 4.0.37 → 4.0.39

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.
Binary file
package/dist/index.js CHANGED
@@ -1,22 +1,21 @@
1
- import { isDate as ve, parseISO as Ie } from "date-fns";
2
- import { EventEmitter as Be } from "events";
3
- import { uniqueId as $e, cloneDeep as Ne } from "lodash";
4
- import { archbaseI18next as R, ArchbaseDataSourceError as g, ArchbaseObjectHelper as Re, processErrorMessage as G, QUICK as we, NORMAL as Ee, ADVANCED as Se, ArchbaseFilterDSL as Fe, QueryFilterEntity as he, detectDataSourceVersion as pe, MigrationMetrics as He, ARCHBASE_IOC_API_TYPE as We, ArchbaseJacksonParser as ie } from "@archbase/core";
5
- import { ADVANCED as jt, ARCHBASE_IOC_API_TYPE as _t, FILTER_TYPE as kt, NORMAL as Ut, QUICK as Gt, useArchbaseBool as qt } from "@archbase/core";
6
- import { useState as V, useCallback as u, useRef as ce, useMemo as M, useEffect as q, useReducer as Me } from "react";
1
+ import { EventEmitter as Le } from "events";
2
+ import { uniqueId as Pe, cloneDeep as Be } from "lodash";
3
+ import { archbaseI18next as R, ArchbaseDataSourceError as g, ArchbaseObjectHelper as Re, processErrorMessage as G, QUICK as ve, NORMAL as Ie, ADVANCED as we, ArchbaseFilterDSL as Ee, QueryFilterEntity as he, detectDataSourceVersion as pe, MigrationMetrics as $e, ARCHBASE_IOC_API_TYPE as Ne, ArchbaseJacksonParser as ie } from "@archbase/core";
4
+ import { ADVANCED as Wt, ARCHBASE_IOC_API_TYPE as Mt, FILTER_TYPE as zt, NORMAL as jt, QUICK as _t, useArchbaseBool as kt } from "@archbase/core";
5
+ import { useState as V, useCallback as u, useRef as ce, useMemo as M, useEffect as q, useReducer as He } from "react";
7
6
  import { produce as Q } from "immer";
8
7
  import "reflect-metadata";
9
8
  import X from "axios";
10
9
  import * as ne from "inversify";
11
- import { useContainer as ze } from "inversify-react";
12
- import { create as je } from "zustand";
13
- import { createTrackedSelector as _e } from "react-tracked";
10
+ import { useContainer as We } from "inversify-react";
11
+ import { create as Me } from "zustand";
12
+ import { createTrackedSelector as ze } from "react-tracked";
14
13
  var d = /* @__PURE__ */ ((o) => (o[o.dataChanged = 0] = "dataChanged", o[o.recordChanged = 1] = "recordChanged", o[o.refreshData = 2] = "refreshData", o[o.fieldChanged = 3] = "fieldChanged", o[o.beforeClose = 4] = "beforeClose", o[o.afterClose = 5] = "afterClose", o[o.beforeOpen = 6] = "beforeOpen", o[o.afterOpen = 7] = "afterOpen", o[o.beforeAppend = 8] = "beforeAppend", o[o.afterAppend = 9] = "afterAppend", o[o.beforeRemove = 10] = "beforeRemove", o[o.afterRemove = 11] = "afterRemove", o[o.beforeInsert = 12] = "beforeInsert", o[o.afterInsert = 13] = "afterInsert", o[o.beforeEdit = 14] = "beforeEdit", o[o.afterEdit = 15] = "afterEdit", o[o.beforeSave = 16] = "beforeSave", o[o.afterSave = 17] = "afterSave", o[o.beforeCancel = 18] = "beforeCancel", o[o.afterCancel = 19] = "afterCancel", o[o.afterScroll = 20] = "afterScroll", o[o.onError = 21] = "onError", o[o.onFieldError = 22] = "onFieldError", o))(d || {});
15
- class ke {
14
+ class je {
16
15
  eventEmitter;
17
16
  listenersDisable = !1;
18
17
  constructor() {
19
- this.eventEmitter = new Be();
18
+ this.eventEmitter = new Le();
20
19
  }
21
20
  disabledAllListeners() {
22
21
  return this.listenersDisable = !0, this;
@@ -79,7 +78,7 @@ class ye {
79
78
  validator;
80
79
  getIdentity;
81
80
  constructor(e, t, r) {
82
- this.name = e, this.label = r || e, this.records = [], this.filteredRecords = [], this.loadOptions(t), this.fieldEventListeners = {}, this.emitter = new ke(), this.uuid = $e(), this.validator = t.validator, this.getIdentity = t.getIdentity;
81
+ this.name = e, this.label = r || e, this.records = [], this.filteredRecords = [], this.loadOptions(t), this.fieldEventListeners = {}, this.emitter = new je(), this.uuid = Pe(), this.validator = t.validator, this.getIdentity = t.getIdentity;
83
82
  }
84
83
  loadOptions(e) {
85
84
  this.records = e.records, this.filters = [], e.filters && (this.filters = e.filters), this.currentRecord = void 0, this.currentRecordIndex = -1, this.filteredRecords = this.applyFilters(), this.filteredRecords.length > 0 && (this.currentRecordIndex = 0, this.currentRecord = this.filteredRecords[this.currentRecordIndex]), this.grandTotalRecords = e.grandTotalRecords, this.currentPageIndex = e.currentPage, this.totalPages = e.totalPages, this.pageSize = e.pageSize, this.active = !0, this.filter = e.filter, this.sort = e.sort, this.originFilter = e.originFilter, this.originSort = e.originSort, this.originGlobalFilter = e.originGlobalFilter, this.defaultSortFields = e.defaultSortFields ? e.defaultSortFields : [];
@@ -247,7 +246,7 @@ class ye {
247
246
  type: 14,
248
247
  record: this.currentRecord,
249
248
  index: this.getCurrentIndex()
250
- }), this.editing = !0, this.currentRecord = Ne(this.currentRecord), this.emitter.emit("afterEdit", this.currentRecord, this.getCurrentIndex()), this.emit({
249
+ }), this.editing = !0, this.currentRecord = Be(this.currentRecord), this.emitter.emit("afterEdit", this.currentRecord, this.getCurrentIndex()), this.emit({
251
250
  type: 15,
252
251
  record: this.currentRecord,
253
252
  index: this.getCurrentIndex()
@@ -416,7 +415,7 @@ class ye {
416
415
  return;
417
416
  const r = Re.getNestedProperty(e, t);
418
417
  if (r !== void 0)
419
- return ve(r) ? Ie(r) : r;
418
+ return r;
420
419
  }
421
420
  setFieldValue(e, t) {
422
421
  if (this.validateDataSourceActive("setFieldValue"), this.isEmpty() || !this.currentRecord)
@@ -427,7 +426,7 @@ class ye {
427
426
  }
428
427
  let r = t;
429
428
  const i = Re.getNestedProperty(this.currentRecord, e);
430
- return ve(t) && (r = Ie(t)), e.split(".").length > 1 ? Re.setNestedProperty(this.currentRecord, e, r) : this.currentRecord[e] = r, this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.emitFieldChangeEvent(e, i, r), this.emitter.emit("fieldChanged", this.currentRecord, this.getCurrentIndex(), e, i, r), this.emit({
429
+ return e.split(".").length > 1 ? Re.setNestedProperty(this.currentRecord, e, r) : this.currentRecord[e] = r, this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.emitFieldChangeEvent(e, i, r), this.emitter.emit("fieldChanged", this.currentRecord, this.getCurrentIndex(), e, i, r), this.emit({
431
430
  type: 3,
432
431
  record: this.currentRecord,
433
432
  index: this.getCurrentIndex(),
@@ -641,7 +640,7 @@ class ye {
641
640
  }));
642
641
  }
643
642
  }
644
- class Ae extends ye {
643
+ class Se extends ye {
645
644
  service;
646
645
  constructor(e, t, r, i) {
647
646
  super(t, r, i), this.service = e;
@@ -748,10 +747,10 @@ class Ae extends ye {
748
747
  }
749
748
  }
750
749
  applyRemoteFilter(e, t, r) {
751
- return e && e.filter.filterType === we && e.filter.quickFilterText && e.filter.quickFilterText !== "" ? this.getDataWithQuickFilter(e, t) : e && (e.filter.filterType === Ee || e.filter.filterType === Se) ? this.getDataWithFilter(e, t) : this.getDataWithoutFilter(t);
750
+ return e && e.filter.filterType === ve && e.filter.quickFilterText && e.filter.quickFilterText !== "" ? this.getDataWithQuickFilter(e, t) : e && (e.filter.filterType === Ie || e.filter.filterType === we) ? this.getDataWithFilter(e, t) : this.getDataWithoutFilter(t);
752
751
  }
753
752
  async getDataWithFilter(e, t) {
754
- const r = new Fe();
753
+ const r = new Ee();
755
754
  r.buildFrom(e.filter, e.sort);
756
755
  const i = r.toJSON();
757
756
  let s;
@@ -774,7 +773,7 @@ class Ae extends ye {
774
773
  return e && e.sort ? e.sort.quickFilterSort : this.defaultSortFields;
775
774
  }
776
775
  }
777
- class Ue {
776
+ class _e {
778
777
  id;
779
778
  companyId;
780
779
  filter;
@@ -792,7 +791,7 @@ class Ue {
792
791
  Object.assign(this, e);
793
792
  }
794
793
  }
795
- class Ge extends ye {
794
+ class ke extends ye {
796
795
  getFilterById(e) {
797
796
  if (this.locate({ id: e }))
798
797
  return this.convertCurrentRecordToFilter();
@@ -812,7 +811,7 @@ class Ge extends ye {
812
811
  }
813
812
  async addNewFilter(e, t) {
814
813
  this.insert(
815
- new Ue({
814
+ new _e({
816
815
  id: e.id,
817
816
  name: e.name,
818
817
  description: e.description,
@@ -860,7 +859,7 @@ class Ge extends ye {
860
859
  ) : [];
861
860
  }
862
861
  }
863
- class qe {
862
+ class Ue {
864
863
  id;
865
864
  companyId;
866
865
  filter;
@@ -879,7 +878,7 @@ class qe {
879
878
  Object.assign(this, e);
880
879
  }
881
880
  }
882
- class Je extends Ae {
881
+ class Ge extends Se {
883
882
  getFilterById(e) {
884
883
  if (this.locate({ id: e }))
885
884
  return this.convertCurrentRecordToFilter();
@@ -899,7 +898,7 @@ class Je extends Ae {
899
898
  }
900
899
  async addNewFilter(e, t) {
901
900
  this.insert(
902
- new qe({
901
+ new Ue({
903
902
  id: e.id,
904
903
  name: e.name,
905
904
  description: e.description,
@@ -950,7 +949,7 @@ class Je extends Ae {
950
949
  ) : [];
951
950
  }
952
951
  }
953
- function yt(o, e, t, r) {
952
+ function mt(o, e, t, r) {
954
953
  const i = e && ("appendToFieldArray" in e || "updateFieldArrayItem" in e), [s, n] = V(r), [, a] = V(0), l = u(() => {
955
954
  a((f) => f + 1);
956
955
  }, []), [p, C] = V(r), [W, z] = V(0), L = u(() => {
@@ -962,7 +961,7 @@ function yt(o, e, t, r) {
962
961
  i ? (C(f), e && !e.isBrowsing() && t && e.getFieldValue(t) !== f && e.setFieldValue(t, f)) : (n(f), e && !e.isBrowsing() && t && e.getFieldValue(t) !== f && e.setFieldValue(t, f));
963
962
  }, [e, t, i]), c = u(() => {
964
963
  const f = pe(e);
965
- He.trackV2Usage(o, f);
964
+ $e.trackV2Usage(o, f);
966
965
  }, [o, e]);
967
966
  return ce(() => {
968
967
  process.env.NODE_ENV === "production" && c();
@@ -984,7 +983,7 @@ function yt(o, e, t, r) {
984
983
  trackUsage: c
985
984
  };
986
985
  }
987
- const vt = {
986
+ const Rt = {
988
987
  /**
989
988
  * Valida se o componente está seguindo o padrão corretamente
990
989
  */
@@ -1001,7 +1000,7 @@ const vt = {
1001
1000
  "getFieldValue",
1002
1001
  "setFieldValue"
1003
1002
  ].every((r) => typeof e[r] == "function") ? !0 : (console.error(`[${o}] V1 DataSource missing required methods`), !1)
1004
- }, It = `
1003
+ }, pt = `
1005
1004
  // Em qualquer componente que use DataSource:
1006
1005
 
1007
1006
  import { useArchbaseV1V2Compatibility } from '../core/patterns/ArchbaseV1V2CompatibilityPattern';
@@ -1526,7 +1525,7 @@ class k {
1526
1525
  return i;
1527
1526
  }
1528
1527
  }
1529
- class Qe {
1528
+ class qe {
1530
1529
  name;
1531
1530
  label;
1532
1531
  service;
@@ -1963,7 +1962,7 @@ class Qe {
1963
1962
  return;
1964
1963
  }
1965
1964
  const s = e.filter.filterType, n = e.filter.quickFilterText;
1966
- s === we && n && n !== "" ? this.getDataWithQuickFilter(e, t, r) : s === Ee || s === Se ? this.getDataWithFilter(e, t, r) : this.getDataWithoutFilter(t, r);
1965
+ s === ve && n && n !== "" ? this.getDataWithQuickFilter(e, t, r) : s === Ie || s === we ? this.getDataWithFilter(e, t, r) : this.getDataWithoutFilter(t, r);
1967
1966
  }
1968
1967
  // =================== Event Management ===================
1969
1968
  addListener(e) {
@@ -2145,7 +2144,7 @@ class Qe {
2145
2144
  // =================== Remote Data Loading ===================
2146
2145
  async getDataWithFilter(e, t, r) {
2147
2146
  try {
2148
- const i = new Fe();
2147
+ const i = new Ee();
2149
2148
  i.buildFrom(e.filter, e.sort);
2150
2149
  const s = i.toJSON();
2151
2150
  let n;
@@ -2200,7 +2199,7 @@ class Qe {
2200
2199
  }), this.onError && this.onError(r, e), t && t();
2201
2200
  }
2202
2201
  }
2203
- function xe(o) {
2202
+ function Fe(o) {
2204
2203
  const e = ce(null), [t, r] = V(null), [i, s] = V(-1), [n, a] = V(0), [l, p] = V(!0), [C, W] = V(!1), [z, L] = V(!1), [P, N] = V(!1), c = M(() => (e.current || (e.current = new k(o)), e.current), []), f = u((F) => {
2205
2204
  switch (F.type) {
2206
2205
  case d.dataChanged:
@@ -2321,7 +2320,7 @@ function xe(o) {
2321
2320
  getDebugInfo: ue
2322
2321
  };
2323
2322
  }
2324
- function wt(o) {
2323
+ function yt(o) {
2325
2324
  const {
2326
2325
  dataSource: e,
2327
2326
  currentRecord: t,
@@ -2341,7 +2340,7 @@ function wt(o) {
2341
2340
  getFieldValue: c,
2342
2341
  getFieldArray: f,
2343
2342
  isFieldArray: b
2344
- } = xe(o);
2343
+ } = Fe(o);
2345
2344
  return {
2346
2345
  dataSource: e,
2347
2346
  currentRecord: t,
@@ -2363,11 +2362,11 @@ function wt(o) {
2363
2362
  isFieldArray: b
2364
2363
  };
2365
2364
  }
2366
- function Et(o) {
2367
- return xe(o);
2365
+ function vt(o) {
2366
+ return Fe(o);
2368
2367
  }
2369
- function Ce(o) {
2370
- const { id: e, loadOnStart: t = !0 } = o, r = ce(null), [i, s] = V(void 0), [n, a] = V(-1), [l, p] = V(0), [C, W] = V(0), [z, L] = V(!0), [P, N] = V(!1), [c, f] = V(!1), [b, T] = V(!1), [K, m] = V(null), h = M(() => (r.current || (r.current = new Qe(o)), r.current), []), Y = u((I) => {
2368
+ function Ae(o) {
2369
+ const { id: e, loadOnStart: t = !0 } = o, r = ce(null), [i, s] = V(void 0), [n, a] = V(-1), [l, p] = V(0), [C, W] = V(0), [z, L] = V(!0), [P, N] = V(!1), [c, f] = V(!1), [b, T] = V(!1), [K, m] = V(null), h = M(() => (r.current || (r.current = new qe(o)), r.current), []), Y = u((I) => {
2371
2370
  switch (I.type) {
2372
2371
  case d.dataChanged:
2373
2372
  case d.recordChanged:
@@ -2459,8 +2458,8 @@ function Ce(o) {
2459
2458
  h.applyRemoteFilter(I, H, () => {
2460
2459
  T(!1), se && se();
2461
2460
  });
2462
- } catch (Pe) {
2463
- T(!1), m(Pe.message || "Erro ao aplicar filtro");
2461
+ } catch (Oe) {
2462
+ T(!1), m(Oe.message || "Erro ao aplicar filtro");
2464
2463
  }
2465
2464
  }, [h]), ue = u(async (I) => {
2466
2465
  try {
@@ -2470,7 +2469,7 @@ function Ce(o) {
2470
2469
  }
2471
2470
  }, [h]), F = u((I) => {
2472
2471
  h.setPageSize(I);
2473
- }, [h]), _ = u(() => h.getPageSize(), [h]), de = M(() => n < l - 1, [n, l]), De = M(() => n > 0, [n]), Te = M(() => l === 0, [l]), Ve = M(() => n === 0, [n]), Oe = M(() => n === l - 1, [n, l]), ge = M(() => z, [z]), fe = M(() => P, [P]), me = M(() => c, [c]), Le = u(() => process.env.NODE_ENV === "development" ? {
2472
+ }, [h]), _ = u(() => h.getPageSize(), [h]), de = M(() => n < l - 1, [n, l]), Ce = M(() => n > 0, [n]), be = M(() => l === 0, [l]), De = M(() => n === 0, [n]), Te = M(() => n === l - 1, [n, l]), ge = M(() => z, [z]), fe = M(() => P, [P]), me = M(() => c, [c]), Ve = u(() => process.env.NODE_ENV === "development" ? {
2474
2473
  ...h.getDebugSnapshot(),
2475
2474
  hookState: {
2476
2475
  currentRecord: i,
@@ -2496,10 +2495,10 @@ function Ce(o) {
2496
2495
  error: K,
2497
2496
  // Estado derivado
2498
2497
  canNext: de,
2499
- canPrior: De,
2500
- isEmpty: Te,
2501
- isFirst: Ve,
2502
- isLast: Oe,
2498
+ canPrior: Ce,
2499
+ isEmpty: be,
2500
+ isFirst: De,
2501
+ isLast: Te,
2503
2502
  isBrowsing: ge,
2504
2503
  isEditing: fe,
2505
2504
  isInserting: me,
@@ -2531,10 +2530,10 @@ function Ce(o) {
2531
2530
  setPageSize: F,
2532
2531
  getPageSize: _,
2533
2532
  // Debug
2534
- getDebugInfo: Le
2533
+ getDebugInfo: Ve
2535
2534
  };
2536
2535
  }
2537
- function St(o) {
2536
+ function It(o) {
2538
2537
  const {
2539
2538
  dataSource: e,
2540
2539
  currentRecord: t,
@@ -2562,7 +2561,7 @@ function St(o) {
2562
2561
  refreshData: Z,
2563
2562
  getPageSize: E,
2564
2563
  getDebugInfo: j
2565
- } = Ce(o);
2564
+ } = Ae(o);
2566
2565
  return {
2567
2566
  dataSource: e,
2568
2567
  currentRecord: t,
@@ -2592,10 +2591,10 @@ function St(o) {
2592
2591
  getDebugInfo: j
2593
2592
  };
2594
2593
  }
2595
- function Ft(o) {
2596
- return Ce(o);
2594
+ function wt(o) {
2595
+ return Ae(o);
2597
2596
  }
2598
- class At {
2597
+ class Et {
2599
2598
  /**
2600
2599
  * Gera chave de query baseada no DataSource e filtros
2601
2600
  */
@@ -2619,7 +2618,7 @@ class At {
2619
2618
  );
2620
2619
  }
2621
2620
  }
2622
- const xt = {
2621
+ const St = {
2623
2622
  /** Configuração para dados que mudam raramente */
2624
2623
  STATIC_DATA: {
2625
2624
  staleTime: 30 * 60 * 1e3,
@@ -2649,7 +2648,7 @@ const xt = {
2649
2648
  // 1 minuto
2650
2649
  retry: 5
2651
2650
  }
2652
- }, Ct = (o) => {
2651
+ }, Ft = (o) => {
2653
2652
  const { initialData: e, name: t, label: r, initialDataSource: i, onLoadComplete: s, store: n, validator: a } = o, l = () => n && n.existsValue(t) ? n.getValue(t) : i || new ye(t, {
2654
2653
  records: e,
2655
2654
  grandTotalRecords: e.length,
@@ -2663,7 +2662,7 @@ const xt = {
2663
2662
  return q(() => {
2664
2663
  n && n.setValue(t, p), s && s(p);
2665
2664
  }, [t]), { dataSource: p };
2666
- }, bt = (o) => {
2665
+ }, At = (o) => {
2667
2666
  const e = (r) => {
2668
2667
  r.addListener(o.listener);
2669
2668
  }, t = (r) => {
@@ -2672,9 +2671,9 @@ const xt = {
2672
2671
  q(() => (o.dataSource && (t(o.dataSource), e(o.dataSource)), () => {
2673
2672
  o.dataSource && t(o.dataSource);
2674
2673
  }), [o.dataSource?.uuid || o.dataSource?.getName()]);
2675
- }, Dt = (o) => {
2674
+ }, xt = (o) => {
2676
2675
  const { initialData: e, name: t, initialDataSource: r, onLoadComplete: i, validator: s } = o, [n, a] = V(
2677
- r ?? new Ge(t, {
2676
+ r ?? new ke(t, {
2678
2677
  records: e,
2679
2678
  grandTotalRecords: e.length,
2680
2679
  currentPage: 0,
@@ -2697,7 +2696,7 @@ const xt = {
2697
2696
  }), i && i(n);
2698
2697
  }, [e, t]), { dataSource: n };
2699
2698
  };
2700
- class be {
2699
+ class xe {
2701
2700
  tokenManager;
2702
2701
  constructor(e) {
2703
2702
  this.tokenManager = e;
@@ -2858,9 +2857,9 @@ class be {
2858
2857
  }
2859
2858
  }
2860
2859
  }
2861
- ne.decorate(ne.inject(We.TokenManager), be, 0);
2862
- ne.decorate(ne.injectable(), be);
2863
- class Ke {
2860
+ ne.decorate(ne.inject(Ne.TokenManager), xe, 0);
2861
+ ne.decorate(ne.injectable(), xe);
2862
+ class Je {
2864
2863
  client;
2865
2864
  constructor(e) {
2866
2865
  this.client = e;
@@ -2960,7 +2959,7 @@ class Ke {
2960
2959
  return this.client.delete(`${this.getEndpoint()}/${e}`, t, !1);
2961
2960
  }
2962
2961
  }
2963
- ne.decorate(ne.injectable(), Ke);
2962
+ ne.decorate(ne.injectable(), Je);
2964
2963
  class le {
2965
2964
  content;
2966
2965
  pageable;
@@ -2987,16 +2986,16 @@ class le {
2987
2986
  return new le(e, t, r, i, s);
2988
2987
  }
2989
2988
  }
2990
- function Ye(o) {
2989
+ function Qe(o) {
2991
2990
  return o.totalElements || o.totalElements === 0 ? o.totalElements : o.page.totalElements;
2992
2991
  }
2993
- function Xe(o) {
2992
+ function Ke(o) {
2994
2993
  return o.totalPages || o.totalPages === 0 ? o.totalPages : o.page.totalPages;
2995
2994
  }
2996
- function Ze(o) {
2995
+ function Ye(o) {
2997
2996
  return o.pageable ? o.pageable.pageNumber : o.page.number;
2998
2997
  }
2999
- function Tt(o) {
2998
+ function Ct(o) {
3000
2999
  const {
3001
3000
  name: e,
3002
3001
  label: t,
@@ -3018,7 +3017,7 @@ function Tt(o) {
3018
3017
  store: b,
3019
3018
  id: T,
3020
3019
  validator: K
3021
- } = o, m = ce(!1), h = () => !!(b && b.existsValue(e) || P), Y = () => b && b.existsValue(e) ? b.getValue(e) : P || new Ae(r, e, {
3020
+ } = o, m = ce(!1), h = () => !!(b && b.existsValue(e) || P), Y = () => b && b.existsValue(e) ? b.getValue(e) : P || new Se(r, e, {
3022
3021
  records: [],
3023
3022
  grandTotalRecords: 0,
3024
3023
  currentPage: c,
@@ -3048,9 +3047,9 @@ function Tt(o) {
3048
3047
  p && (O = p(O)), n && (O = n(O)), j((U) => {
3049
3048
  const re = {
3050
3049
  records: O.content,
3051
- grandTotalRecords: Ye(O),
3052
- totalPages: Xe(O),
3053
- currentPage: Ze(O),
3050
+ grandTotalRecords: Qe(O),
3051
+ totalPages: Ke(O),
3052
+ currentPage: Ye(O),
3054
3053
  pageSize: x,
3055
3054
  filter: $,
3056
3055
  sort: v,
@@ -3174,16 +3173,16 @@ function Tt(o) {
3174
3173
  clearError: B
3175
3174
  };
3176
3175
  }
3177
- function et(o) {
3176
+ function Xe(o) {
3178
3177
  return o.totalElements || o.totalElements === 0 ? o.totalElements : o.page.totalElements;
3179
3178
  }
3180
- function tt(o) {
3179
+ function Ze(o) {
3181
3180
  return o.totalPages || o.totalPages === 0 ? o.totalPages : o.page.totalPages;
3182
3181
  }
3183
- function rt(o) {
3182
+ function et(o) {
3184
3183
  return o.pageable ? o.pageable.pageNumber : o.page.number;
3185
3184
  }
3186
- function Vt(o) {
3185
+ function bt(o) {
3187
3186
  const {
3188
3187
  name: e,
3189
3188
  service: t,
@@ -3203,7 +3202,7 @@ function Vt(o) {
3203
3202
  loadOnStart: c = !0,
3204
3203
  store: f,
3205
3204
  validator: b
3206
- } = o, T = () => !!(f && f.existsValue(e) || L), K = () => f && f.existsValue(e) ? f.getValue(e) : L || new Je(t, e, {
3205
+ } = o, T = () => !!(f && f.existsValue(e) || L), K = () => f && f.existsValue(e) ? f.getValue(e) : L || new Ge(t, e, {
3207
3206
  records: [],
3208
3207
  grandTotalRecords: 0,
3209
3208
  currentPage: N,
@@ -3226,9 +3225,9 @@ function Vt(o) {
3226
3225
  z && B && y && y.length > 0 ? v = await z(B, S, A, y) : W && B ? v = await W(B, S, A) : C && y && y.length > 0 ? v = await C(S, A, y) : p ? v = await p(S, A) : B && y && y.length > 0 ? v = await t.findAllWithFilterAndSort(B, S, A, y) : B ? v = await t.findAllWithFilter(B, S, A) : y && y.length > 0 ? v = await t.findAllWithSort(S, A, y) : v = await t.findAll(S, A), l && (v = l(v)), s && (v = s(v)), h((J) => {
3227
3226
  const te = {
3228
3227
  records: v.content,
3229
- grandTotalRecords: et(v),
3230
- totalPages: tt(v),
3231
- currentPage: rt(v),
3228
+ grandTotalRecords: Xe(v),
3229
+ totalPages: Ze(v),
3230
+ currentPage: et(v),
3232
3231
  pageSize: A,
3233
3232
  filter: B,
3234
3233
  sort: y,
@@ -3343,39 +3342,39 @@ function Vt(o) {
3343
3342
  clearError: ee
3344
3343
  };
3345
3344
  }
3346
- function Ot(o) {
3347
- return ze((e) => e.get(o));
3345
+ function Dt(o) {
3346
+ return We((e) => e.get(o));
3348
3347
  }
3349
- function Lt(o) {
3348
+ function Tt(o) {
3350
3349
  q(() => {
3351
3350
  o();
3352
3351
  }, []);
3353
3352
  }
3354
- function Pt(o, e) {
3353
+ function Vt(o, e) {
3355
3354
  q(() => {
3356
3355
  o();
3357
3356
  }, e);
3358
3357
  }
3359
- function Bt(o) {
3358
+ function Ot(o) {
3360
3359
  q(() => () => {
3361
3360
  o();
3362
3361
  }, []);
3363
3362
  }
3364
- function $t() {
3363
+ function Lt() {
3365
3364
  const [, o] = V(0);
3366
3365
  return u(() => {
3367
3366
  o((t) => t + 1);
3368
3367
  }, []);
3369
3368
  }
3370
- const it = (o) => (o + 1) % 1e6;
3371
- function st() {
3372
- const [, o] = Me(it, 0);
3369
+ const tt = (o) => (o + 1) % 1e6;
3370
+ function rt() {
3371
+ const [, o] = He(tt, 0);
3373
3372
  return o;
3374
3373
  }
3375
- function Nt() {
3376
- return st();
3374
+ function Pt() {
3375
+ return rt();
3377
3376
  }
3378
- const nt = je((o, e) => ({
3377
+ const it = Me((o, e) => ({
3379
3378
  values: /* @__PURE__ */ new Map(),
3380
3379
  setValue: (t, r) => o((i) => {
3381
3380
  const s = new Map(i.values);
@@ -3389,8 +3388,8 @@ const nt = je((o, e) => ({
3389
3388
  }),
3390
3389
  clearAllValues: () => o((t) => ({ values: /* @__PURE__ */ new Map() })),
3391
3390
  reset: () => o((t) => ({ values: /* @__PURE__ */ new Map() }))
3392
- })), ot = _e(nt), Ht = (o = "default") => {
3393
- const e = ot();
3391
+ })), st = ze(it), Bt = (o = "default") => {
3392
+ const e = st();
3394
3393
  return { setValue: (p, C) => {
3395
3394
  e.setValue(`${o}.${p}`, C);
3396
3395
  }, getValue: (p) => e.getValue(`${o}.${p}`), clearValue: (p) => {
@@ -3402,7 +3401,7 @@ const nt = je((o, e) => ({
3402
3401
  e.clearAllValues();
3403
3402
  }, values: e.values };
3404
3403
  };
3405
- function Wt(o, e, t = window) {
3404
+ function $t(o, e, t = window) {
3406
3405
  const r = ce(e);
3407
3406
  q(() => {
3408
3407
  r.current = e;
@@ -3420,46 +3419,46 @@ function Wt(o, e, t = window) {
3420
3419
  );
3421
3420
  }
3422
3421
  export {
3423
- jt as ADVANCED,
3424
- _t as ARCHBASE_IOC_API_TYPE,
3425
- xt as ARCHBASE_QUERY_DEFAULTS,
3426
- be as ArchbaseAxiosRemoteApiClient,
3422
+ Wt as ADVANCED,
3423
+ Mt as ARCHBASE_IOC_API_TYPE,
3424
+ St as ARCHBASE_QUERY_DEFAULTS,
3425
+ xe as ArchbaseAxiosRemoteApiClient,
3427
3426
  ye as ArchbaseDataSource,
3428
3427
  k as ArchbaseDataSourceV2,
3429
- Ge as ArchbaseLocalFilterDataSource,
3430
- At as ArchbaseQueryUtils,
3431
- Ke as ArchbaseRemoteApiService,
3432
- Ae as ArchbaseRemoteDataSource,
3433
- Qe as ArchbaseRemoteDataSourceV2,
3434
- Je as ArchbaseRemoteFilterDataSource,
3428
+ ke as ArchbaseLocalFilterDataSource,
3429
+ Et as ArchbaseQueryUtils,
3430
+ Je as ArchbaseRemoteApiService,
3431
+ Se as ArchbaseRemoteDataSource,
3432
+ qe as ArchbaseRemoteDataSourceV2,
3433
+ Ge as ArchbaseRemoteFilterDataSource,
3435
3434
  d as DataSourceEventNames,
3436
3435
  le as DefaultPage,
3437
- kt as FILTER_TYPE,
3438
- Ue as LocalFilter,
3439
- vt as MigrationValidation,
3440
- Ut as NORMAL,
3441
- Gt as QUICK,
3442
- qe as RemoteFilter,
3443
- It as USAGE_EXAMPLE,
3444
- qt as useArchbaseBool,
3445
- Ct as useArchbaseDataSource,
3446
- bt as useArchbaseDataSourceListener,
3447
- xe as useArchbaseDataSourceV2,
3448
- Et as useArchbaseDataSourceV2Editor,
3449
- wt as useArchbaseDataSourceV2ReadOnly,
3450
- Lt as useArchbaseDidMount,
3451
- Pt as useArchbaseDidUpdate,
3452
- Wt as useArchbaseEventListener,
3453
- $t as useArchbaseForceRerender,
3454
- Nt as useArchbaseForceUpdate,
3455
- Dt as useArchbaseLocalFilterDataSource,
3456
- Tt as useArchbaseRemoteDataSource,
3457
- Ce as useArchbaseRemoteDataSourceV2,
3458
- Ft as useArchbaseRemoteDataSourceV2Editor,
3459
- St as useArchbaseRemoteDataSourceV2ReadOnly,
3460
- Vt as useArchbaseRemoteFilterDataSource,
3461
- Ot as useArchbaseRemoteServiceApi,
3462
- Ht as useArchbaseStore,
3463
- yt as useArchbaseV1V2Compatibility,
3464
- Bt as useArchbaseWillUnmount
3436
+ zt as FILTER_TYPE,
3437
+ _e as LocalFilter,
3438
+ Rt as MigrationValidation,
3439
+ jt as NORMAL,
3440
+ _t as QUICK,
3441
+ Ue as RemoteFilter,
3442
+ pt as USAGE_EXAMPLE,
3443
+ kt as useArchbaseBool,
3444
+ Ft as useArchbaseDataSource,
3445
+ At as useArchbaseDataSourceListener,
3446
+ Fe as useArchbaseDataSourceV2,
3447
+ vt as useArchbaseDataSourceV2Editor,
3448
+ yt as useArchbaseDataSourceV2ReadOnly,
3449
+ Tt as useArchbaseDidMount,
3450
+ Vt as useArchbaseDidUpdate,
3451
+ $t as useArchbaseEventListener,
3452
+ Lt as useArchbaseForceRerender,
3453
+ Pt as useArchbaseForceUpdate,
3454
+ xt as useArchbaseLocalFilterDataSource,
3455
+ Ct as useArchbaseRemoteDataSource,
3456
+ Ae as useArchbaseRemoteDataSourceV2,
3457
+ wt as useArchbaseRemoteDataSourceV2Editor,
3458
+ It as useArchbaseRemoteDataSourceV2ReadOnly,
3459
+ bt as useArchbaseRemoteFilterDataSource,
3460
+ Dt as useArchbaseRemoteServiceApi,
3461
+ Bt as useArchbaseStore,
3462
+ mt as useArchbaseV1V2Compatibility,
3463
+ Ot as useArchbaseWillUnmount
3465
3464
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archbase/data",
3
- "version": "4.0.37",
3
+ "version": "4.0.39",
4
4
  "description": "Data management layer for Archbase React v3 - DataSource, hooks, and API services",
5
5
  "author": "Edson Martins <edsonmartins2005@gmail.com>",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "reflect-metadata": "^0.2.2",
39
39
  "rxjs": "^7.8.2",
40
40
  "zustand": "^5.0.6",
41
- "@archbase/core": "4.0.37"
41
+ "@archbase/core": "4.0.39"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@mantine/hooks": "9.4.0",
Binary file