@archbase/data 4.0.1 → 4.0.2

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.
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
- import { isDate as we, parseISO as Ee } from "date-fns";
2
- import { EventEmitter as Le } from "events";
3
- import { uniqueId as Be, cloneDeep as $e } from "lodash";
4
- import { archbaseI18next as m, ArchbaseDataSourceError as g, ArchbaseObjectHelper as ye, processErrorMessage as G, QUICK as Se, NORMAL as Fe, ADVANCED as Ae, ArchbaseFilterDSL as xe, QueryFilterEntity as ue, detectDataSourceVersion as ve, MigrationMetrics as Ne, ARCHBASE_IOC_API_TYPE as He, ArchbaseJacksonParser as ie } from "@archbase/core";
5
- import { ADVANCED as Mt, ARCHBASE_IOC_API_TYPE as jt, FILTER_TYPE as kt, NORMAL as Ut, QUICK as Gt, useArchbaseBool as qt } from "@archbase/core";
6
- import { useState as C, useCallback as l, useRef as le, useMemo as H, useEffect as J, useReducer as We } from "react";
7
- import { produce as _ } from "immer";
1
+ import { isDate as ve, parseISO as Ie } from "date-fns";
2
+ import { EventEmitter as Oe } from "events";
3
+ import { uniqueId as Pe, cloneDeep as Le } from "lodash";
4
+ import { archbaseI18next as m, ArchbaseDataSourceError as g, ArchbaseObjectHelper as Re, processErrorMessage as q, QUICK as we, NORMAL as Ee, ADVANCED as Se, ArchbaseFilterDSL as Fe, QueryFilterEntity as he, detectDataSourceVersion as pe, MigrationMetrics as Be, ARCHBASE_IOC_API_TYPE as $e, ArchbaseJacksonParser as ie } from "@archbase/core";
5
+ import { ADVANCED as Wt, ARCHBASE_IOC_API_TYPE as zt, FILTER_TYPE as Mt, NORMAL as jt, QUICK as kt, useArchbaseBool as Ut } from "@archbase/core";
6
+ import { useState as V, useCallback as u, useRef as ce, useMemo as W, useEffect as K, useReducer as Ne } from "react";
7
+ import { produce as Q } from "immer";
8
8
  import "reflect-metadata";
9
9
  import Y from "axios";
10
10
  import * as ne from "inversify";
11
- import { useContainer as ze } from "inversify-react";
12
- import { create as Me } from "zustand";
13
- import { createTrackedSelector as je } from "react-tracked";
14
- var d = /* @__PURE__ */ ((n) => (n[n.dataChanged = 0] = "dataChanged", n[n.recordChanged = 1] = "recordChanged", n[n.refreshData = 2] = "refreshData", n[n.fieldChanged = 3] = "fieldChanged", n[n.beforeClose = 4] = "beforeClose", n[n.afterClose = 5] = "afterClose", n[n.beforeOpen = 6] = "beforeOpen", n[n.afterOpen = 7] = "afterOpen", n[n.beforeAppend = 8] = "beforeAppend", n[n.afterAppend = 9] = "afterAppend", n[n.beforeRemove = 10] = "beforeRemove", n[n.afterRemove = 11] = "afterRemove", n[n.beforeInsert = 12] = "beforeInsert", n[n.afterInsert = 13] = "afterInsert", n[n.beforeEdit = 14] = "beforeEdit", n[n.afterEdit = 15] = "afterEdit", n[n.beforeSave = 16] = "beforeSave", n[n.afterSave = 17] = "afterSave", n[n.beforeCancel = 18] = "beforeCancel", n[n.afterCancel = 19] = "afterCancel", n[n.afterScroll = 20] = "afterScroll", n[n.onError = 21] = "onError", n[n.onFieldError = 22] = "onFieldError", n))(d || {});
15
- class ke {
11
+ import { useContainer as He } from "inversify-react";
12
+ import { create as We } from "zustand";
13
+ import { createTrackedSelector as ze } from "react-tracked";
14
+ var a = /* @__PURE__ */ ((n) => (n[n.dataChanged = 0] = "dataChanged", n[n.recordChanged = 1] = "recordChanged", n[n.refreshData = 2] = "refreshData", n[n.fieldChanged = 3] = "fieldChanged", n[n.beforeClose = 4] = "beforeClose", n[n.afterClose = 5] = "afterClose", n[n.beforeOpen = 6] = "beforeOpen", n[n.afterOpen = 7] = "afterOpen", n[n.beforeAppend = 8] = "beforeAppend", n[n.afterAppend = 9] = "afterAppend", n[n.beforeRemove = 10] = "beforeRemove", n[n.afterRemove = 11] = "afterRemove", n[n.beforeInsert = 12] = "beforeInsert", n[n.afterInsert = 13] = "afterInsert", n[n.beforeEdit = 14] = "beforeEdit", n[n.afterEdit = 15] = "afterEdit", n[n.beforeSave = 16] = "beforeSave", n[n.afterSave = 17] = "afterSave", n[n.beforeCancel = 18] = "beforeCancel", n[n.afterCancel = 19] = "afterCancel", n[n.afterScroll = 20] = "afterScroll", n[n.onError = 21] = "onError", n[n.onFieldError = 22] = "onFieldError", n))(a || {});
15
+ class Me {
16
16
  eventEmitter;
17
17
  listenersDisable = !1;
18
18
  constructor() {
19
- this.eventEmitter = new Le();
19
+ this.eventEmitter = new Oe();
20
20
  }
21
21
  disabledAllListeners() {
22
22
  return this.listenersDisable = !0, this;
@@ -46,7 +46,7 @@ class ke {
46
46
  return this.eventEmitter.removeAllListeners(e), this;
47
47
  }
48
48
  }
49
- class Ie {
49
+ class ye {
50
50
  fieldEventListeners;
51
51
  records;
52
52
  filteredRecords;
@@ -79,7 +79,7 @@ class Ie {
79
79
  validator;
80
80
  getIdentity;
81
81
  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 = Be(), this.validator = t.validator, this.getIdentity = t.getIdentity;
82
+ this.name = e, this.label = r || e, this.records = [], this.filteredRecords = [], this.loadOptions(t), this.fieldEventListeners = {}, this.emitter = new Me(), this.uuid = Pe(), this.validator = t.validator, this.getIdentity = t.getIdentity;
83
83
  }
84
84
  loadOptions(e) {
85
85
  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 +247,7 @@ class Ie {
247
247
  type: 14,
248
248
  record: this.currentRecord,
249
249
  index: this.getCurrentIndex()
250
- }), this.editing = !0, this.currentRecord = $e(this.currentRecord), this.emitter.emit("afterEdit", this.currentRecord, this.getCurrentIndex()), this.emit({
250
+ }), this.editing = !0, this.currentRecord = Le(this.currentRecord), this.emitter.emit("afterEdit", this.currentRecord, this.getCurrentIndex()), this.emit({
251
251
  type: 15,
252
252
  record: this.currentRecord,
253
253
  index: this.getCurrentIndex()
@@ -414,9 +414,9 @@ class Ie {
414
414
  fieldValueByName(e, t) {
415
415
  if (e === void 0)
416
416
  return;
417
- const r = ye.getNestedProperty(e, t);
417
+ const r = Re.getNestedProperty(e, t);
418
418
  if (r !== void 0)
419
- return we(r) ? Ee(r) : r;
419
+ return ve(r) ? Ie(r) : r;
420
420
  }
421
421
  setFieldValue(e, t) {
422
422
  if (this.validateDataSourceActive("setFieldValue"), this.isEmpty() || !this.currentRecord)
@@ -426,8 +426,8 @@ class Ie {
426
426
  throw this.publishEventError(o, {}), new g(o);
427
427
  }
428
428
  let r = t;
429
- const i = ye.getNestedProperty(this.currentRecord, e);
430
- return we(t) && (r = Ee(t)), e.split(".").length > 1 ? ye.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
+ 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({
431
431
  type: 3,
432
432
  record: this.currentRecord,
433
433
  index: this.getCurrentIndex(),
@@ -641,7 +641,7 @@ class Ie {
641
641
  }));
642
642
  }
643
643
  }
644
- class Ce extends Ie {
644
+ class Ae extends ye {
645
645
  service;
646
646
  constructor(e, t, r, i) {
647
647
  super(t, r, i), this.service = e;
@@ -656,7 +656,7 @@ class Ce extends Ie {
656
656
  throw this.publishEventError(t, {}), new g(t);
657
657
  }
658
658
  if (this.emitter.emit("beforeSave", this.currentRecord), this.emit({
659
- type: d.beforeSave,
659
+ type: a.beforeSave,
660
660
  record: this.currentRecord,
661
661
  index: this.getCurrentIndex()
662
662
  }), this.validator) {
@@ -674,7 +674,7 @@ class Ce extends Ie {
674
674
  const s = this.getIdentity ? this.getIdentity(r) : r.id, o = this.getIdentity ? this.getIdentity(this.currentRecord) : this.currentRecord.id;
675
675
  (r === this.currentRecord || s !== void 0 && s === o) && (t = i);
676
676
  }), this.currentRecord = await this.service.save(this.currentRecord), this.editing && (this.filteredRecords = [...this.filteredRecords], this.filteredRecords[this.getCurrentIndex()] = this.currentRecord), this.records = [...this.records], t >= 0 ? this.records[t] = this.currentRecord : this.records.push(this.currentRecord), this.editing = !1, this.inserting = !1, this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.emitter.emit("afterSave", this.currentRecord), this.emit({
677
- type: d.afterSave,
677
+ type: a.afterSave,
678
678
  record: this.currentRecord,
679
679
  index: this.getCurrentIndex()
680
680
  }), e && e();
@@ -683,16 +683,16 @@ class Ce extends Ie {
683
683
  if (i.field) {
684
684
  const s = m.t(i.message, { defaultValue: i.message });
685
685
  this.emitter.emit("onFieldError", i.field, s), this.emit({
686
- type: d.onFieldError,
686
+ type: a.onFieldError,
687
687
  fieldName: i.field,
688
688
  error: s,
689
689
  originalError: i.message
690
690
  });
691
691
  }
692
692
  });
693
- const r = G(t);
693
+ const r = q(t);
694
694
  throw this.emitter.emit("onError", r, t), this.emit({
695
- type: d.onError,
695
+ type: a.onError,
696
696
  error: r,
697
697
  originalError: t
698
698
  }), e && e(r), new g(r);
@@ -719,7 +719,7 @@ class Ce extends Ie {
719
719
  throw this.publishEventError(t, {}), new g(t);
720
720
  }
721
721
  this.emitter.emit("beforeRemove", this.currentRecord, this.currentRecordIndex), this.emit({
722
- type: d.beforeRemove,
722
+ type: a.beforeRemove,
723
723
  record: this.currentRecord,
724
724
  index: this.getCurrentIndex()
725
725
  });
@@ -729,25 +729,25 @@ class Ce extends Ie {
729
729
  const r = this.currentRecord, i = this.currentRecordIndex;
730
730
  return this.records = [...this.records], this.filteredRecords = [...this.filteredRecords], this.records.forEach((s, o) => {
731
731
  this.currentRecord === s && (t = o);
732
- }), t >= 0 && this.records.splice(t, 1), this.records !== this.filteredRecords && this.filteredRecords.splice(this.getCurrentIndex(), 1), this.grandTotalRecords--, this.filteredRecords.length === 0 ? (this.currentRecord = void 0, this.currentRecordIndex = -1) : (this.currentRecordIndex > this.filteredRecords.length - 1 && this.currentRecordIndex--, this.currentRecord = this.filteredRecords[this.currentRecordIndex]), this.editing = !1, this.inserting = !1, this.emitter.emit("afterScroll"), this.emit({ type: d.afterScroll }), this.emitter.emit("afterRemove", r, i), this.emit({
733
- type: d.afterRemove,
732
+ }), t >= 0 && this.records.splice(t, 1), this.records !== this.filteredRecords && this.filteredRecords.splice(this.getCurrentIndex(), 1), this.grandTotalRecords--, this.filteredRecords.length === 0 ? (this.currentRecord = void 0, this.currentRecordIndex = -1) : (this.currentRecordIndex > this.filteredRecords.length - 1 && this.currentRecordIndex--, this.currentRecord = this.filteredRecords[this.currentRecordIndex]), this.editing = !1, this.inserting = !1, this.emitter.emit("afterScroll"), this.emit({ type: a.afterScroll }), this.emitter.emit("afterRemove", r, i), this.emit({
733
+ type: a.afterRemove,
734
734
  record: r,
735
735
  index: i
736
736
  }), this.lastDataBrowsingOn = (/* @__PURE__ */ new Date()).getTime(), this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), e && e(), r;
737
737
  } catch (t) {
738
- const r = G(t);
738
+ const r = q(t);
739
739
  throw this.emitter.emit("onError", r, t), this.emit({
740
- type: d.onError,
740
+ type: a.onError,
741
741
  error: r,
742
742
  originalError: t
743
743
  }), e && e(r), new g(r);
744
744
  }
745
745
  }
746
746
  applyRemoteFilter(e, t, r) {
747
- return e && e.filter.filterType === Se && e.filter.quickFilterText && e.filter.quickFilterText !== "" ? this.getDataWithQuickFilter(e, t) : e && (e.filter.filterType === Fe || e.filter.filterType === Ae) ? this.getDataWithFilter(e, t) : this.getDataWithoutFilter(t);
747
+ 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);
748
748
  }
749
749
  async getDataWithFilter(e, t) {
750
- const r = new xe();
750
+ const r = new Fe();
751
751
  r.buildFrom(e.filter, e.sort);
752
752
  const i = r.toJSON();
753
753
  let s;
@@ -770,7 +770,7 @@ class Ce extends Ie {
770
770
  return e && e.sort ? e.sort.quickFilterSort : this.defaultSortFields;
771
771
  }
772
772
  }
773
- class Ue {
773
+ class je {
774
774
  id;
775
775
  companyId;
776
776
  filter;
@@ -788,13 +788,13 @@ class Ue {
788
788
  Object.assign(this, e);
789
789
  }
790
790
  }
791
- class Ge extends Ie {
791
+ class ke extends ye {
792
792
  getFilterById(e) {
793
793
  if (this.locate({ id: e }))
794
794
  return this.convertCurrentRecordToFilter();
795
795
  }
796
796
  convertCurrentRecordToFilter() {
797
- return new ue({
797
+ return new he({
798
798
  id: this.getFieldValue("id"),
799
799
  name: this.getFieldValue("name"),
800
800
  description: this.getFieldValue("description"),
@@ -808,7 +808,7 @@ class Ge extends Ie {
808
808
  }
809
809
  async addNewFilter(e, t) {
810
810
  this.insert(
811
- new Ue({
811
+ new je({
812
812
  id: e.id,
813
813
  name: e.name,
814
814
  description: e.description,
@@ -842,7 +842,7 @@ class Ge extends Ie {
842
842
  }
843
843
  getFilters() {
844
844
  return this.getTotalRecords() > 0 ? this.browseRecords().map(
845
- (e) => new ue({
845
+ (e) => new he({
846
846
  id: e.id,
847
847
  name: e.name,
848
848
  description: e.description,
@@ -856,7 +856,7 @@ class Ge extends Ie {
856
856
  ) : [];
857
857
  }
858
858
  }
859
- class qe {
859
+ class Ue {
860
860
  id;
861
861
  companyId;
862
862
  filter;
@@ -875,13 +875,13 @@ class qe {
875
875
  Object.assign(this, e);
876
876
  }
877
877
  }
878
- class _e extends Ce {
878
+ class _e extends Ae {
879
879
  getFilterById(e) {
880
880
  if (this.locate({ id: e }))
881
881
  return this.convertCurrentRecordToFilter();
882
882
  }
883
883
  convertCurrentRecordToFilter() {
884
- return new ue({
884
+ return new he({
885
885
  id: this.getFieldValue("id"),
886
886
  name: this.getFieldValue("name"),
887
887
  description: this.getFieldValue("description"),
@@ -895,7 +895,7 @@ class _e extends Ce {
895
895
  }
896
896
  async addNewFilter(e, t) {
897
897
  this.insert(
898
- new qe({
898
+ new Ue({
899
899
  id: e.id,
900
900
  name: e.name,
901
901
  description: e.description,
@@ -932,7 +932,7 @@ class _e extends Ce {
932
932
  }
933
933
  getFilters() {
934
934
  return this.getTotalRecords() > 0 ? this.browseRecords().map(
935
- (e) => new ue({
935
+ (e) => new he({
936
936
  id: e.id,
937
937
  name: e.name,
938
938
  description: e.description,
@@ -946,41 +946,41 @@ class _e extends Ce {
946
946
  ) : [];
947
947
  }
948
948
  }
949
- function pt(n, e, t, r) {
950
- const i = e && ("appendToFieldArray" in e || "updateFieldArrayItem" in e), [s, o] = C(r), [, c] = C(0), f = l(() => {
951
- c((u) => u + 1);
952
- }, []), [R, b] = C(r), [N, W] = C(0), T = l(() => {
953
- let u = r;
954
- e && t && (u = e.getFieldValue(t), u == null && (u = r)), i ? (b(u), W((a) => a + 1)) : o(u);
955
- }, [e, t, r, i]), O = l((u) => {
956
- e && t && ((u.type === d.dataChanged || u.type === d.recordChanged || u.type === d.afterScroll || u.type === d.afterCancel || u.type === d.afterEdit) && (T(), i || f()), u.type === d.onFieldError && u.fieldName === t && console.warn(`[${n}] Field error:`, u.error));
957
- }, [e, t, T, f, i, n]), $ = l((u, a) => {
958
- i ? (b(u), e && !e.isBrowsing() && t && e.getFieldValue(t) !== u && e.setFieldValue(t, u)) : (o(u), e && !e.isBrowsing() && t && e.getFieldValue(t) !== u && e.setFieldValue(t, u));
959
- }, [e, t, i]), z = l(() => {
960
- const u = ve(e);
961
- Ne.trackV2Usage(n, u);
949
+ function mt(n, e, t, r) {
950
+ const i = e && ("appendToFieldArray" in e || "updateFieldArrayItem" in e), [s, o] = V(r), [, c] = V(0), f = u(() => {
951
+ c((l) => l + 1);
952
+ }, []), [R, C] = V(r), [H, z] = V(0), O = u(() => {
953
+ let l = r;
954
+ e && t && (l = e.getFieldValue(t), l == null && (l = r)), i ? (C(l), z((b) => b + 1)) : o(l);
955
+ }, [e, t, r, i]), P = u((l) => {
956
+ e && t && ((l.type === a.dataChanged || l.type === a.recordChanged || l.type === a.afterScroll || l.type === a.afterCancel || l.type === a.afterEdit) && (O(), i || f()), l.type === a.onFieldError && l.fieldName === t && console.warn(`[${n}] Field error:`, l.error));
957
+ }, [e, t, O, f, i, n]), N = u((l, b) => {
958
+ i ? (C(l), e && !e.isBrowsing() && t && e.getFieldValue(t) !== l && e.setFieldValue(t, l)) : (o(l), e && !e.isBrowsing() && t && e.getFieldValue(t) !== l && e.setFieldValue(t, l));
959
+ }, [e, t, i]), d = u(() => {
960
+ const l = pe(e);
961
+ Be.trackV2Usage(n, l);
962
962
  }, [n, e]);
963
- return le(() => {
964
- process.env.NODE_ENV === "production" && z();
963
+ return ce(() => {
964
+ process.env.NODE_ENV === "production" && d();
965
965
  }).current, {
966
966
  // Detecção de versão
967
967
  isDataSourceV2: i,
968
- dataSourceVersion: ve(e),
968
+ dataSourceVersion: pe(e),
969
969
  // Estados
970
970
  currentValue: i ? R : s,
971
971
  v1State: { currentValue: s, setCurrentValue: o, forceUpdate: f },
972
- v2State: { v2Value: R, setV2Value: b, v2ShouldUpdate: N },
972
+ v2State: { v2Value: R, setV2Value: C, v2ShouldUpdate: H },
973
973
  // Funções
974
- loadDataSourceFieldValue: T,
975
- dataSourceEvent: O,
976
- handleValueChange: $,
974
+ loadDataSourceFieldValue: O,
975
+ dataSourceEvent: P,
976
+ handleValueChange: N,
977
977
  // Utilitários
978
978
  isReadOnly: e ? e.isBrowsing() : !1,
979
979
  isEditing: e ? e.isEditing() : !1,
980
- trackUsage: z
980
+ trackUsage: d
981
981
  };
982
982
  }
983
- const yt = {
983
+ const Rt = {
984
984
  /**
985
985
  * Valida se o componente está seguindo o padrão corretamente
986
986
  */
@@ -991,13 +991,13 @@ const yt = {
991
991
  /**
992
992
  * Testa se o comportamento V1 está preservado
993
993
  */
994
- testV1Compatibility: (n, e) => !e || ve(e) !== "V1" || [
994
+ testV1Compatibility: (n, e) => !e || pe(e) !== "V1" || [
995
995
  "isBrowsing",
996
996
  "isEditing",
997
997
  "getFieldValue",
998
998
  "setFieldValue"
999
999
  ].every((r) => typeof e[r] == "function") ? !0 : (console.error(`[${n}] V1 DataSource missing required methods`), !1)
1000
- }, vt = `
1000
+ }, pt = `
1001
1001
  // Em qualquer componente que use DataSource:
1002
1002
 
1003
1003
  import { useArchbaseV1V2Compatibility } from '../core/patterns/ArchbaseV1V2CompatibilityPattern';
@@ -1050,7 +1050,7 @@ export function MyComponent<T, ID>({ dataSource, dataField, value, onChangeValue
1050
1050
  );
1051
1051
  }
1052
1052
  `;
1053
- class k {
1053
+ class U {
1054
1054
  name;
1055
1055
  label;
1056
1056
  records = [];
@@ -1098,24 +1098,24 @@ class k {
1098
1098
  // =================== Navigation ===================
1099
1099
  first() {
1100
1100
  return this.records.length > 0 && (this.currentIndex = 0, this.emit({
1101
- type: d.afterScroll
1101
+ type: a.afterScroll
1102
1102
  })), this;
1103
1103
  }
1104
1104
  last() {
1105
1105
  return this.records.length > 0 && (this.currentIndex = this.records.length - 1, this.emit({
1106
- type: d.afterScroll
1106
+ type: a.afterScroll
1107
1107
  })), this;
1108
1108
  }
1109
1109
  next() {
1110
1110
  return this.currentIndex < this.records.length - 1 && (this.currentIndex++, this.emit({
1111
- type: d.recordChanged,
1111
+ type: a.recordChanged,
1112
1112
  record: this.getCurrentRecord(),
1113
1113
  index: this.currentIndex
1114
1114
  })), this;
1115
1115
  }
1116
1116
  prior() {
1117
1117
  return this.currentIndex > 0 && (this.currentIndex--, this.emit({
1118
- type: d.recordChanged,
1118
+ type: a.recordChanged,
1119
1119
  record: this.getCurrentRecord(),
1120
1120
  index: this.currentIndex
1121
1121
  })), this;
@@ -1123,7 +1123,7 @@ class k {
1123
1123
  goToRecord(e) {
1124
1124
  if (e >= 0 && e < this.records.length)
1125
1125
  return this.currentIndex = e, this.emit({
1126
- type: d.recordChanged,
1126
+ type: a.recordChanged,
1127
1127
  record: this.getCurrentRecord(),
1128
1128
  index: this.currentIndex
1129
1129
  }), this.getCurrentRecord();
@@ -1154,27 +1154,27 @@ class k {
1154
1154
  if (this.validateDataSourceActive("edit"), this.isEmpty() || !this.getCurrentRecord())
1155
1155
  throw new Error(`No records to edit in DataSource ${this.name}`);
1156
1156
  return this.state = "edit", this.originalRecord = JSON.parse(JSON.stringify(this.getCurrentRecord())), this.emit({
1157
- type: d.beforeEdit,
1157
+ type: a.beforeEdit,
1158
1158
  record: this.getCurrentRecord(),
1159
1159
  index: this.currentIndex
1160
1160
  }), this.emit({
1161
- type: d.afterEdit,
1161
+ type: a.afterEdit,
1162
1162
  record: this.getCurrentRecord(),
1163
1163
  index: this.currentIndex
1164
1164
  }), this;
1165
1165
  }
1166
1166
  cancel() {
1167
1167
  return this.validateDataSourceActive("cancel"), this.state === "edit" && this.originalRecord ? (this.records = [...this.records], this.records[this.currentIndex] = { ...this.originalRecord }) : this.state === "insert" && (this.records = this.records.slice(0, -1), this.records.length > 0 ? this.currentIndex = Math.min(this.currentIndex, this.records.length - 1) : this.currentIndex = -1), this.state = "browse", this.originalRecord = null, this.emit({
1168
- type: d.afterCancel,
1168
+ type: a.afterCancel,
1169
1169
  record: this.getCurrentRecord(),
1170
1170
  index: this.currentIndex
1171
1171
  }), this;
1172
1172
  }
1173
1173
  insert(e) {
1174
1174
  return this.validateDataSourceActive("insert"), this.state = "insert", this.emit({
1175
- type: d.beforeInsert
1175
+ type: a.beforeInsert
1176
1176
  }), this.records = [...this.records, e], this.currentIndex = this.records.length - 1, this.notifyStateChange(), this.emit({
1177
- type: d.afterInsert,
1177
+ type: a.afterInsert,
1178
1178
  record: e,
1179
1179
  index: this.currentIndex
1180
1180
  }), this;
@@ -1186,7 +1186,7 @@ class k {
1186
1186
  throw new Error(`No record to save in DataSource ${this.name}`);
1187
1187
  const t = this.getCurrentRecord();
1188
1188
  if (this.emit({
1189
- type: d.beforeSave,
1189
+ type: a.beforeSave,
1190
1190
  record: t,
1191
1191
  index: this.getCurrentIndex()
1192
1192
  }), this.validator) {
@@ -1195,7 +1195,7 @@ class k {
1195
1195
  throw new Error(r[0].errorMessage);
1196
1196
  }
1197
1197
  return this.state = "browse", this.originalRecord = null, this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.notifyStateChange(), this.emit({
1198
- type: d.afterSave,
1198
+ type: a.afterSave,
1199
1199
  record: t,
1200
1200
  index: this.getCurrentIndex()
1201
1201
  }), e && e(), t;
@@ -1207,11 +1207,11 @@ class k {
1207
1207
  throw new Error(`No records to remove in DataSource ${this.name}`);
1208
1208
  const t = this.getCurrentRecord(), r = this.currentIndex;
1209
1209
  return this.emit({
1210
- type: d.beforeRemove,
1210
+ type: a.beforeRemove,
1211
1211
  record: t,
1212
1212
  index: r
1213
- }), this.records = this.records.filter((i, s) => s !== this.currentIndex), this.records.length === 0 ? this.currentIndex = -1 : this.currentIndex >= this.records.length && (this.currentIndex = this.records.length - 1), this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.notifyStateChange(), this.emit({ type: d.afterScroll }), this.emit({
1214
- type: d.afterRemove,
1213
+ }), this.records = this.records.filter((i, s) => s !== this.currentIndex), this.records.length === 0 ? this.currentIndex = -1 : this.currentIndex >= this.records.length && (this.currentIndex = this.records.length - 1), this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.notifyStateChange(), this.emit({ type: a.afterScroll }), this.emit({
1214
+ type: a.afterRemove,
1215
1215
  record: t,
1216
1216
  index: r
1217
1217
  }), e && e(), t;
@@ -1224,19 +1224,16 @@ class k {
1224
1224
  if (r === t)
1225
1225
  return this;
1226
1226
  const i = [...this.records];
1227
- return this.records = _(this.records, (s) => {
1227
+ return this.records = Q(this.records, (s) => {
1228
1228
  const o = s[this.currentIndex];
1229
1229
  o && this.setNestedValue(o, e, t);
1230
1230
  }), this.notifyStateChange(i), this.emit({
1231
- type: d.fieldChanged,
1231
+ type: a.fieldChanged,
1232
1232
  fieldName: e,
1233
1233
  oldValue: r,
1234
1234
  newValue: t,
1235
1235
  record: this.getCurrentRecord(),
1236
1236
  index: this.currentIndex
1237
- }), this.emit({
1238
- type: d.dataChanged,
1239
- data: this.records
1240
1237
  }), this;
1241
1238
  }
1242
1239
  getFieldValue(e) {
@@ -1256,14 +1253,14 @@ class k {
1256
1253
  if (!Array.isArray(r))
1257
1254
  throw new Error(`Field ${String(e)} is not an array (found: ${typeof r})`);
1258
1255
  const i = [...this.records];
1259
- this.records = _(this.records, (s) => {
1256
+ this.records = Q(this.records, (s) => {
1260
1257
  const o = s[this.currentIndex];
1261
1258
  if (o) {
1262
1259
  const c = this.getNestedValue(o, e);
1263
1260
  c && c.push(t);
1264
1261
  }
1265
1262
  }), this.notifyStateChange(i), this.emit({
1266
- type: d.fieldChanged,
1263
+ type: a.fieldChanged,
1267
1264
  fieldName: e,
1268
1265
  oldValue: r,
1269
1266
  newValue: [...r, t],
@@ -1278,14 +1275,14 @@ class k {
1278
1275
  if (!Array.isArray(i) || t < 0 || t >= i.length)
1279
1276
  return;
1280
1277
  const s = [...this.records];
1281
- this.records = _(this.records, (o) => {
1278
+ this.records = Q(this.records, (o) => {
1282
1279
  const c = o[this.currentIndex];
1283
1280
  if (c) {
1284
1281
  const f = this.getNestedValue(c, e);
1285
1282
  f[t] !== void 0 && r(f[t]);
1286
1283
  }
1287
1284
  }), this.notifyStateChange(s), this.emit({
1288
- type: d.fieldChanged,
1285
+ type: a.fieldChanged,
1289
1286
  fieldName: e,
1290
1287
  oldValue: i,
1291
1288
  newValue: this.getFieldValue(e),
@@ -1302,11 +1299,11 @@ class k {
1302
1299
  if (t < 0 || t >= r.length)
1303
1300
  return;
1304
1301
  const i = [...this.records];
1305
- this.records = _(this.records, (s) => {
1302
+ this.records = Q(this.records, (s) => {
1306
1303
  const o = s[this.currentIndex];
1307
1304
  o && this.getNestedValue(o, e).splice(t, 1);
1308
1305
  }), this.notifyStateChange(i), this.emit({
1309
- type: d.fieldChanged,
1306
+ type: a.fieldChanged,
1310
1307
  fieldName: e,
1311
1308
  oldValue: r,
1312
1309
  newValue: this.getFieldValue(e),
@@ -1321,11 +1318,11 @@ class k {
1321
1318
  if (!Array.isArray(i))
1322
1319
  throw new Error(`Field ${String(e)} is not an array`);
1323
1320
  const s = [...this.records];
1324
- this.records = _(this.records, (o) => {
1321
+ this.records = Q(this.records, (o) => {
1325
1322
  const c = o[this.currentIndex];
1326
1323
  c && this.getNestedValue(c, e).splice(t, 0, r);
1327
1324
  }), this.notifyStateChange(s), this.emit({
1328
- type: d.fieldChanged,
1325
+ type: a.fieldChanged,
1329
1326
  fieldName: e,
1330
1327
  oldValue: i,
1331
1328
  newValue: this.getFieldValue(e),
@@ -1351,7 +1348,7 @@ class k {
1351
1348
  }
1352
1349
  clear() {
1353
1350
  this.records = [], this.currentIndex = -1, this.state = "browse", this.originalRecord = null, this.emit({
1354
- type: d.dataChanged,
1351
+ type: a.dataChanged,
1355
1352
  data: this.records
1356
1353
  });
1357
1354
  }
@@ -1361,7 +1358,7 @@ class k {
1361
1358
  */
1362
1359
  setData(e) {
1363
1360
  this.records = [...e.records || []], this.currentIndex = this.records.length > 0 ? 0 : -1, this.state = "browse", this.originalRecord = null, this.emit({
1364
- type: d.dataChanged,
1361
+ type: a.dataChanged,
1365
1362
  data: this.records
1366
1363
  });
1367
1364
  }
@@ -1399,7 +1396,7 @@ class k {
1399
1396
  gotoRecordByData(e) {
1400
1397
  const t = this.records.findIndex((r) => r === e);
1401
1398
  return t >= 0 ? (this.currentIndex = t, this.emit({
1402
- type: d.recordChanged,
1399
+ type: a.recordChanged,
1403
1400
  record: this.getCurrentRecord(),
1404
1401
  index: this.currentIndex
1405
1402
  }), !0) : !1;
@@ -1412,7 +1409,7 @@ class k {
1412
1409
  }
1413
1410
  addFieldChangeListener(e, t) {
1414
1411
  const r = (i) => {
1415
- i.type === d.fieldChanged && "fieldName" in i && i.fieldName === e && t(e, i.oldValue, i.newValue);
1412
+ i.type === a.fieldChanged && "fieldName" in i && i.fieldName === e && t(e, i.oldValue, i.newValue);
1416
1413
  };
1417
1414
  return this.addListener(r), this;
1418
1415
  }
@@ -1439,7 +1436,7 @@ class k {
1439
1436
  }
1440
1437
  if (i)
1441
1438
  return this.currentIndex = t, this.emit({
1442
- type: d.recordChanged,
1439
+ type: a.recordChanged,
1443
1440
  record: this.getCurrentRecord(),
1444
1441
  index: this.currentIndex
1445
1442
  }), !0;
@@ -1450,7 +1447,7 @@ class k {
1450
1447
  for (let t = 0; t < this.records.length; t++)
1451
1448
  if (e(this.records[t]))
1452
1449
  return this.currentIndex = t, this.emit({
1453
- type: d.recordChanged,
1450
+ type: a.recordChanged,
1454
1451
  record: this.getCurrentRecord(),
1455
1452
  index: this.currentIndex
1456
1453
  }), !0;
@@ -1482,7 +1479,7 @@ class k {
1482
1479
  setRecords(e) {
1483
1480
  const t = [...this.records];
1484
1481
  this.records = [...e], e.length > 0 ? this.currentIndex = 0 : this.currentIndex = -1, this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.notifyStateChange(t), this.emit({
1485
- type: d.dataChanged,
1482
+ type: a.dataChanged,
1486
1483
  data: this.records
1487
1484
  });
1488
1485
  }
@@ -1525,7 +1522,7 @@ class k {
1525
1522
  return i;
1526
1523
  }
1527
1524
  }
1528
- class Je {
1525
+ class Ge {
1529
1526
  name;
1530
1527
  label;
1531
1528
  service;
@@ -1579,27 +1576,27 @@ class Je {
1579
1576
  // =================== Navigation ===================
1580
1577
  first() {
1581
1578
  this.filteredRecords.length > 0 && (this.currentIndex = 0, this.emit({
1582
- type: d.afterScroll
1579
+ type: a.afterScroll
1583
1580
  }));
1584
1581
  }
1585
1582
  last() {
1586
1583
  this.filteredRecords.length > 0 && (this.currentIndex = this.filteredRecords.length - 1, this.emit({
1587
- type: d.afterScroll
1584
+ type: a.afterScroll
1588
1585
  }));
1589
1586
  }
1590
1587
  next() {
1591
1588
  this.currentIndex < this.filteredRecords.length - 1 && (this.currentIndex++, this.emit({
1592
- type: d.afterScroll
1589
+ type: a.afterScroll
1593
1590
  }));
1594
1591
  }
1595
1592
  prior() {
1596
1593
  this.currentIndex > 0 && (this.currentIndex--, this.emit({
1597
- type: d.afterScroll
1594
+ type: a.afterScroll
1598
1595
  }));
1599
1596
  }
1600
1597
  goToRecord(e) {
1601
1598
  e >= 0 && e < this.filteredRecords.length && (this.currentIndex = e, this.emit({
1602
- type: d.afterScroll
1599
+ type: a.afterScroll
1603
1600
  }));
1604
1601
  }
1605
1602
  isFirst() {
@@ -1630,11 +1627,11 @@ class Je {
1630
1627
  throw this.publishEventError(e, {}), new g(e);
1631
1628
  }
1632
1629
  this.state = "edit", this.originalRecord = JSON.parse(JSON.stringify(this.getCurrentRecord())), this.emit({
1633
- type: d.beforeEdit,
1630
+ type: a.beforeEdit,
1634
1631
  record: this.getCurrentRecord(),
1635
1632
  index: this.currentIndex
1636
1633
  }), this.emit({
1637
- type: d.afterEdit,
1634
+ type: a.afterEdit,
1638
1635
  record: this.getCurrentRecord(),
1639
1636
  index: this.currentIndex
1640
1637
  });
@@ -1649,16 +1646,16 @@ class Je {
1649
1646
  } else
1650
1647
  this.state === "insert" && (this.filteredRecords = this.filteredRecords.slice(0, -1), this.records = this.records.slice(0, -1), this.grandTotalRecords--, this.filteredRecords.length > 0 ? this.currentIndex = Math.min(this.currentIndex, this.filteredRecords.length - 1) : this.currentIndex = -1);
1651
1648
  this.state = "browse", this.originalRecord = null, this.emit({
1652
- type: d.afterCancel,
1649
+ type: a.afterCancel,
1653
1650
  record: this.getCurrentRecord(),
1654
1651
  index: this.currentIndex
1655
1652
  });
1656
1653
  }
1657
1654
  insert(e) {
1658
1655
  this.validateDataSourceActive("insert"), this.state = "insert", this.emit({
1659
- type: d.beforeInsert
1656
+ type: a.beforeInsert
1660
1657
  }), this.filteredRecords = [...this.filteredRecords, e], this.records = [...this.records, e], this.currentIndex = this.filteredRecords.length - 1, this.grandTotalRecords++, this.notifyStateChange(), this.emit({
1661
- type: d.afterInsert,
1658
+ type: a.afterInsert,
1662
1659
  record: e,
1663
1660
  index: this.currentIndex
1664
1661
  });
@@ -1675,7 +1672,7 @@ class Je {
1675
1672
  }
1676
1673
  const t = this.getCurrentRecord();
1677
1674
  if (this.emit({
1678
- type: d.beforeSave,
1675
+ type: a.beforeSave,
1679
1676
  record: t,
1680
1677
  index: this.getCurrentIndex()
1681
1678
  }), this.validator) {
@@ -1689,22 +1686,22 @@ class Je {
1689
1686
  }
1690
1687
  try {
1691
1688
  const r = await this.service.save(t);
1692
- this.filteredRecords = _(this.filteredRecords, (s) => {
1689
+ this.filteredRecords = Q(this.filteredRecords, (s) => {
1693
1690
  s[this.currentIndex] = r;
1694
1691
  });
1695
1692
  let i = -1;
1696
1693
  return this.records.forEach((s, o) => {
1697
1694
  const c = this.service.getId(s), f = this.service.getId(t);
1698
1695
  (s === t || c !== void 0 && c === f) && (i = o);
1699
- }), this.records = _(this.records, (s) => {
1696
+ }), this.records = Q(this.records, (s) => {
1700
1697
  i >= 0 ? s[i] = r : s.push(r);
1701
1698
  }), this.state = "browse", this.originalRecord = null, this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.notifyStateChange(), this.emit({
1702
- type: d.afterSave,
1699
+ type: a.afterSave,
1703
1700
  record: r,
1704
1701
  index: this.getCurrentIndex()
1705
1702
  }), e && e(), r;
1706
1703
  } catch (r) {
1707
- throw this.handleSaveError(r, e), new g(G(r));
1704
+ throw this.handleSaveError(r, e), new g(q(r));
1708
1705
  }
1709
1706
  }
1710
1707
  async remove(e) {
@@ -1718,7 +1715,7 @@ class Je {
1718
1715
  }
1719
1716
  const t = this.getCurrentRecord(), r = this.currentIndex;
1720
1717
  this.emit({
1721
- type: d.beforeRemove,
1718
+ type: a.beforeRemove,
1722
1719
  record: t,
1723
1720
  index: r
1724
1721
  });
@@ -1727,15 +1724,15 @@ class Je {
1727
1724
  const i = this.records.findIndex(
1728
1725
  (s) => this.service.getId(s) === this.service.getId(t)
1729
1726
  );
1730
- return i >= 0 && (this.records = this.records.filter((s, o) => o !== i)), this.grandTotalRecords--, this.filteredRecords.length === 0 ? this.currentIndex = -1 : this.currentIndex >= this.filteredRecords.length && (this.currentIndex = this.filteredRecords.length - 1), this.lastDataBrowsingOn = (/* @__PURE__ */ new Date()).getTime(), this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.notifyStateChange(), this.emit({ type: d.afterScroll }), this.emit({
1731
- type: d.afterRemove,
1727
+ return i >= 0 && (this.records = this.records.filter((s, o) => o !== i)), this.grandTotalRecords--, this.filteredRecords.length === 0 ? this.currentIndex = -1 : this.currentIndex >= this.filteredRecords.length && (this.currentIndex = this.filteredRecords.length - 1), this.lastDataBrowsingOn = (/* @__PURE__ */ new Date()).getTime(), this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.notifyStateChange(), this.emit({ type: a.afterScroll }), this.emit({
1728
+ type: a.afterRemove,
1732
1729
  record: t,
1733
1730
  index: r
1734
1731
  }), e && e(), t;
1735
1732
  } catch (i) {
1736
- const s = G(i);
1733
+ const s = q(i);
1737
1734
  throw this.emit({
1738
- type: d.onError,
1735
+ type: a.onError,
1739
1736
  error: s,
1740
1737
  originalError: i
1741
1738
  }), e && e(s), new g(s);
@@ -1749,7 +1746,7 @@ class Je {
1749
1746
  if (r === t)
1750
1747
  return;
1751
1748
  const i = [...this.filteredRecords];
1752
- if (this.filteredRecords = _(this.filteredRecords, (s) => {
1749
+ if (this.filteredRecords = Q(this.filteredRecords, (s) => {
1753
1750
  const o = s[this.currentIndex];
1754
1751
  o && this.setNestedValue(o, e, t);
1755
1752
  }), this.state === "edit" || this.state === "insert") {
@@ -1758,21 +1755,18 @@ class Je {
1758
1755
  const o = this.records.findIndex(
1759
1756
  (c) => this.service.getId(c) === s
1760
1757
  );
1761
- o >= 0 && (this.records = _(this.records, (c) => {
1758
+ o >= 0 && (this.records = Q(this.records, (c) => {
1762
1759
  this.setNestedValue(c[o], e, t);
1763
1760
  }));
1764
1761
  }
1765
1762
  }
1766
1763
  this.notifyStateChange(i), this.emit({
1767
- type: d.fieldChanged,
1764
+ type: a.fieldChanged,
1768
1765
  fieldName: e,
1769
1766
  oldValue: r,
1770
1767
  newValue: t,
1771
1768
  record: this.getCurrentRecord(),
1772
1769
  index: this.currentIndex
1773
- }), this.emit({
1774
- type: d.dataChanged,
1775
- data: this.filteredRecords
1776
1770
  });
1777
1771
  }
1778
1772
  getFieldValue(e) {
@@ -1792,14 +1786,14 @@ class Je {
1792
1786
  if (!Array.isArray(r))
1793
1787
  throw new Error(`Field ${String(e)} is not an array (found: ${typeof r})`);
1794
1788
  const i = [...this.filteredRecords];
1795
- this.filteredRecords = _(this.filteredRecords, (s) => {
1789
+ this.filteredRecords = Q(this.filteredRecords, (s) => {
1796
1790
  const o = s[this.currentIndex];
1797
1791
  if (o) {
1798
1792
  const c = this.getNestedValue(o, e);
1799
1793
  c && c.push(t);
1800
1794
  }
1801
1795
  }), this.notifyStateChange(i), this.emit({
1802
- type: d.fieldChanged,
1796
+ type: a.fieldChanged,
1803
1797
  fieldName: e,
1804
1798
  oldValue: r,
1805
1799
  newValue: [...r, t],
@@ -1814,14 +1808,14 @@ class Je {
1814
1808
  if (!Array.isArray(i) || t < 0 || t >= i.length)
1815
1809
  return;
1816
1810
  const s = [...this.filteredRecords];
1817
- this.filteredRecords = _(this.filteredRecords, (o) => {
1811
+ this.filteredRecords = Q(this.filteredRecords, (o) => {
1818
1812
  const c = o[this.currentIndex];
1819
1813
  if (c) {
1820
1814
  const f = this.getNestedValue(c, e);
1821
1815
  f[t] !== void 0 && r(f[t]);
1822
1816
  }
1823
1817
  }), this.notifyStateChange(s), this.emit({
1824
- type: d.fieldChanged,
1818
+ type: a.fieldChanged,
1825
1819
  fieldName: e,
1826
1820
  oldValue: i,
1827
1821
  newValue: this.getFieldValue(e),
@@ -1838,11 +1832,11 @@ class Je {
1838
1832
  if (t < 0 || t >= r.length)
1839
1833
  return;
1840
1834
  const i = [...this.filteredRecords];
1841
- this.filteredRecords = _(this.filteredRecords, (s) => {
1835
+ this.filteredRecords = Q(this.filteredRecords, (s) => {
1842
1836
  const o = s[this.currentIndex];
1843
1837
  o && this.getNestedValue(o, e).splice(t, 1);
1844
1838
  }), this.notifyStateChange(i), this.emit({
1845
- type: d.fieldChanged,
1839
+ type: a.fieldChanged,
1846
1840
  fieldName: e,
1847
1841
  oldValue: r,
1848
1842
  newValue: this.getFieldValue(e),
@@ -1857,11 +1851,11 @@ class Je {
1857
1851
  if (!Array.isArray(i))
1858
1852
  throw new Error(`Field ${String(e)} is not an array`);
1859
1853
  const s = [...this.filteredRecords];
1860
- this.filteredRecords = _(this.filteredRecords, (o) => {
1854
+ this.filteredRecords = Q(this.filteredRecords, (o) => {
1861
1855
  const c = o[this.currentIndex];
1862
1856
  c && this.getNestedValue(c, e).splice(t, 0, r);
1863
1857
  }), this.notifyStateChange(s), this.emit({
1864
- type: d.fieldChanged,
1858
+ type: a.fieldChanged,
1865
1859
  fieldName: e,
1866
1860
  oldValue: i,
1867
1861
  newValue: this.getFieldValue(e),
@@ -1942,7 +1936,7 @@ class Je {
1942
1936
  return;
1943
1937
  }
1944
1938
  const s = e.filter.filterType, o = e.filter.quickFilterText;
1945
- s === Se && o && o !== "" ? this.getDataWithQuickFilter(e, t, r) : s === Fe || s === Ae ? this.getDataWithFilter(e, t, r) : this.getDataWithoutFilter(t, r);
1939
+ s === we && o && o !== "" ? this.getDataWithQuickFilter(e, t, r) : s === Ee || s === Se ? this.getDataWithFilter(e, t, r) : this.getDataWithoutFilter(t, r);
1946
1940
  }
1947
1941
  // =================== Event Management ===================
1948
1942
  addListener(e) {
@@ -1951,6 +1945,24 @@ class Je {
1951
1945
  removeListener(e) {
1952
1946
  this.listeners.delete(e);
1953
1947
  }
1948
+ /**
1949
+ * Adiciona um listener para mudanças em um campo específico.
1950
+ * Permite que componentes escutem apenas mudanças no campo que exibem,
1951
+ * evitando re-renders desnecessários.
1952
+ */
1953
+ addFieldChangeListener(e, t) {
1954
+ const r = (i) => {
1955
+ i.type === a.fieldChanged && "fieldName" in i && i.fieldName === e && t(e, i.oldValue, i.newValue);
1956
+ };
1957
+ return this.addListener(r), this;
1958
+ }
1959
+ /**
1960
+ * Remove um listener de campo específico.
1961
+ * Nota: A remoção exata não é suportada nesta versão simplificada.
1962
+ */
1963
+ removeFieldChangeListener(e, t) {
1964
+ return this;
1965
+ }
1954
1966
  emit(e) {
1955
1967
  this.listeners.forEach((t) => {
1956
1968
  try {
@@ -1996,7 +2008,7 @@ class Je {
1996
2008
  return o === c;
1997
2009
  }));
1998
2010
  return r >= 0 ? (this.currentIndex = r, this.emit({
1999
- type: d.afterScroll
2011
+ type: a.afterScroll
2000
2012
  }), !0) : !1;
2001
2013
  }
2002
2014
  /**
@@ -2016,13 +2028,13 @@ class Je {
2016
2028
  (i) => this.service.getId(i) === t
2017
2029
  );
2018
2030
  return r >= 0 ? (this.currentIndex = r, this.emit({
2019
- type: d.afterScroll
2031
+ type: a.afterScroll
2020
2032
  }), !0) : !1;
2021
2033
  }
2022
2034
  setRecords(e, t) {
2023
2035
  const r = [...this.filteredRecords];
2024
2036
  this.records = [...e], this.filteredRecords = [...e], t !== void 0 ? this.grandTotalRecords = t : this.grandTotalRecords < e.length && (this.grandTotalRecords = e.length), e.length > 0 ? this.currentIndex = 0 : this.currentIndex = -1, this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), this.notifyStateChange(r), this.emit({
2025
- type: d.dataChanged,
2037
+ type: a.dataChanged,
2026
2038
  data: this.filteredRecords
2027
2039
  });
2028
2040
  }
@@ -2047,7 +2059,7 @@ class Je {
2047
2059
  }
2048
2060
  publishEventError(e, t) {
2049
2061
  this.emit({
2050
- type: d.onError,
2062
+ type: a.onError,
2051
2063
  error: e,
2052
2064
  originalError: t
2053
2065
  }), this.onError && this.onError(e, t);
@@ -2055,7 +2067,7 @@ class Je {
2055
2067
  publishEventErrors(e) {
2056
2068
  e.forEach((t) => {
2057
2069
  t.fieldName && (this.emit({
2058
- type: d.onFieldError,
2070
+ type: a.onFieldError,
2059
2071
  fieldName: t.fieldName,
2060
2072
  error: t.errorMessage,
2061
2073
  originalError: t
@@ -2065,15 +2077,15 @@ class Je {
2065
2077
  handleSaveError(e, t) {
2066
2078
  e.response && e.response.data && e.response.data.apierror && e.response.data.apierror.subErrors && e.response.data.apierror.subErrors.forEach((i) => {
2067
2079
  i.field && (this.emit({
2068
- type: d.onFieldError,
2080
+ type: a.onFieldError,
2069
2081
  fieldName: i.field,
2070
2082
  error: i.message,
2071
2083
  originalError: i.message
2072
2084
  }), this.onFieldError && this.onFieldError(i.field, i.message));
2073
2085
  });
2074
- const r = G(e);
2086
+ const r = q(e);
2075
2087
  this.emit({
2076
- type: d.onError,
2088
+ type: a.onError,
2077
2089
  error: r,
2078
2090
  originalError: e
2079
2091
  }), this.onError && this.onError(r, e), t && t(r);
@@ -2103,7 +2115,7 @@ class Je {
2103
2115
  // =================== Remote Data Loading ===================
2104
2116
  async getDataWithFilter(e, t, r) {
2105
2117
  try {
2106
- const i = new xe();
2118
+ const i = new Fe();
2107
2119
  i.buildFrom(e.filter, e.sort);
2108
2120
  const s = i.toJSON();
2109
2121
  let o;
@@ -2146,137 +2158,136 @@ class Je {
2146
2158
  return this.defaultSortFields;
2147
2159
  }
2148
2160
  handleRemoteError(e, t) {
2149
- const r = G(e);
2161
+ const r = q(e);
2150
2162
  this.emit({
2151
- type: d.onError,
2163
+ type: a.onError,
2152
2164
  error: r,
2153
2165
  originalError: e
2154
2166
  }), this.onError && this.onError(r, e), t && t();
2155
2167
  }
2156
2168
  }
2157
- function be(n) {
2158
- const e = le(null), [t, r] = C(null), [i, s] = C(-1), [o, c] = C(0), [f, R] = C(!0), [b, N] = C(!1), [W, T] = C(!1), [O, $] = C(!1), [, z] = C({}), u = l(() => z({}), []), a = H(() => (e.current || (e.current = new k(n)), e.current), []), V = l((F) => {
2169
+ function xe(n) {
2170
+ const e = ce(null), [t, r] = V(null), [i, s] = V(-1), [o, c] = V(0), [f, R] = V(!0), [C, H] = V(!1), [z, O] = V(!1), [P, N] = V(!1), d = W(() => (e.current || (e.current = new U(n)), e.current), []), l = u((F) => {
2159
2171
  switch (F.type) {
2160
- case d.dataChanged:
2161
- case d.recordChanged:
2162
- r(a.getCurrentRecord()), s(a.getCurrentIndex()), c(a.getTotalRecords()), R(a.isBrowsing()), N(a.isEditing()), T(a.isInserting());
2172
+ case a.dataChanged:
2173
+ case a.recordChanged:
2174
+ r(d.getCurrentRecord()), s(d.getCurrentIndex()), c(d.getTotalRecords()), R(d.isBrowsing()), H(d.isEditing()), O(d.isInserting());
2163
2175
  break;
2164
- case d.fieldChanged:
2165
- r(a.getCurrentRecord()), u();
2176
+ case a.fieldChanged:
2166
2177
  break;
2167
- case d.afterScroll:
2168
- r(a.getCurrentRecord()), s(a.getCurrentIndex());
2178
+ case a.afterScroll:
2179
+ r(d.getCurrentRecord()), s(d.getCurrentIndex());
2169
2180
  break;
2170
- case d.beforeEdit:
2171
- case d.beforeInsert:
2172
- $(!0);
2181
+ case a.beforeEdit:
2182
+ case a.beforeInsert:
2183
+ N(!0);
2173
2184
  break;
2174
- case d.afterEdit:
2175
- case d.afterInsert:
2176
- case d.afterSave:
2177
- case d.afterCancel:
2178
- $(!1), R(a.isBrowsing()), N(a.isEditing()), T(a.isInserting());
2185
+ case a.afterEdit:
2186
+ case a.afterInsert:
2187
+ case a.afterSave:
2188
+ case a.afterCancel:
2189
+ N(!1), R(d.isBrowsing()), H(d.isEditing()), O(d.isInserting());
2179
2190
  break;
2180
- case d.onError:
2181
- case d.onFieldError:
2182
- $(!1);
2191
+ case a.onError:
2192
+ case a.onFieldError:
2193
+ N(!1);
2183
2194
  break;
2184
2195
  }
2185
- }, [a, u]);
2186
- J(() => (a.addListener(V), r(a.getCurrentRecord()), s(a.getCurrentIndex()), c(a.getTotalRecords()), R(a.isBrowsing()), N(a.isEditing()), T(a.isInserting()), () => {
2187
- a.removeListener(V);
2188
- }), [a, V]);
2189
- const X = l((F, j) => {
2190
- a.setFieldValue(F, j);
2191
- }, [a]), S = l((F) => a.getFieldValue(F), [a]), h = l(() => {
2192
- a instanceof k, a.edit();
2193
- }, [a]), Q = l(async () => await a.save(), [a]), Z = l(() => {
2194
- a instanceof k, a.cancel();
2195
- }, [a]), I = l((F) => {
2196
- a instanceof k, a.insert(F);
2197
- }, [a]), U = l(async (F) => await a.remove(F), [a]), ee = l(() => {
2198
- a instanceof k, a.first();
2199
- }, [a]), D = l(() => {
2200
- a instanceof k, a.last();
2201
- }, [a]), E = l(() => {
2202
- a instanceof k, a.next();
2203
- }, [a]), A = l(() => {
2204
- a instanceof k, a.prior();
2205
- }, [a]), P = l((F) => {
2206
- a instanceof k, a.goToRecord(F);
2207
- }, [a]), p = l((F, j) => {
2208
- a instanceof k && a.appendToFieldArray(F, j);
2209
- }, [a]), v = l((F, j, he) => {
2210
- a instanceof k && a.updateFieldArrayItem(F, j, he);
2211
- }, [a]), x = l((F, j) => {
2212
- a instanceof k && a.removeFromFieldArray(F, j);
2213
- }, [a]), L = l((F, j, he) => {
2214
- a instanceof k && a.insertIntoFieldArray(F, j, he);
2215
- }, [a]), y = l((F) => {
2216
- if (a instanceof k)
2217
- return a.getFieldArray(F);
2218
- const j = a.getFieldValue(F);
2219
- return Array.isArray(j) ? j : [];
2220
- }, [a]), q = l((F) => {
2221
- if (a instanceof k)
2222
- return a.isFieldArray(F);
2223
- const j = a.getFieldValue(F);
2224
- return Array.isArray(j);
2225
- }, [a]), te = H(() => i < o - 1, [i, o]), oe = H(() => i > 0, [i]), ae = H(() => o === 0, [o]), B = H(() => i === 0, [i]), K = H(() => i === o - 1, [i, o]), re = H(() => f, [f]), de = H(() => b, [b]), ce = H(() => W, [W]), fe = l(() => process.env.NODE_ENV === "development" ? {
2226
- ...a.getDebugSnapshot(),
2196
+ }, [d]);
2197
+ K(() => (d.addListener(l), r(d.getCurrentRecord()), s(d.getCurrentIndex()), c(d.getTotalRecords()), R(d.isBrowsing()), H(d.isEditing()), O(d.isInserting()), () => {
2198
+ d.removeListener(l);
2199
+ }), [d, l]);
2200
+ const b = u((F, k) => {
2201
+ d.setFieldValue(F, k);
2202
+ }, [d]), L = u((F) => d.getFieldValue(F), [d]), h = u(() => {
2203
+ d instanceof U, d.edit();
2204
+ }, [d]), E = u(async () => await d.save(), [d]), j = u(() => {
2205
+ d instanceof U, d.cancel();
2206
+ }, [d]), X = u((F) => {
2207
+ d instanceof U, d.insert(F);
2208
+ }, [d]), Z = u(async (F) => await d.remove(F), [d]), I = u(() => {
2209
+ d instanceof U, d.first();
2210
+ }, [d]), _ = u(() => {
2211
+ d instanceof U, d.last();
2212
+ }, [d]), ee = u(() => {
2213
+ d instanceof U, d.next();
2214
+ }, [d]), D = u(() => {
2215
+ d instanceof U, d.prior();
2216
+ }, [d]), S = u((F) => {
2217
+ d instanceof U, d.goToRecord(F);
2218
+ }, [d]), A = u((F, k) => {
2219
+ d instanceof U && d.appendToFieldArray(F, k);
2220
+ }, [d]), B = u((F, k, de) => {
2221
+ d instanceof U && d.updateFieldArrayItem(F, k, de);
2222
+ }, [d]), p = u((F, k) => {
2223
+ d instanceof U && d.removeFromFieldArray(F, k);
2224
+ }, [d]), v = u((F, k, de) => {
2225
+ d instanceof U && d.insertIntoFieldArray(F, k, de);
2226
+ }, [d]), x = u((F) => {
2227
+ if (d instanceof U)
2228
+ return d.getFieldArray(F);
2229
+ const k = d.getFieldValue(F);
2230
+ return Array.isArray(k) ? k : [];
2231
+ }, [d]), $ = u((F) => {
2232
+ if (d instanceof U)
2233
+ return d.isFieldArray(F);
2234
+ const k = d.getFieldValue(F);
2235
+ return Array.isArray(k);
2236
+ }, [d]), y = W(() => i < o - 1, [i, o]), J = W(() => i > 0, [i]), te = W(() => o === 0, [o]), oe = W(() => i === 0, [i]), ae = W(() => i === o - 1, [i, o]), T = W(() => f, [f]), G = W(() => C, [C]), re = W(() => z, [z]), ue = u(() => process.env.NODE_ENV === "development" ? {
2237
+ ...d.getDebugSnapshot(),
2227
2238
  hookState: {
2228
2239
  currentRecord: t,
2229
2240
  currentIndex: i,
2230
2241
  totalRecords: o,
2231
- isBrowsing: re,
2232
- isEditing: de,
2233
- isInserting: ce,
2234
- isLoading: O
2242
+ isBrowsing: T,
2243
+ isEditing: G,
2244
+ isInserting: re,
2245
+ isLoading: P
2235
2246
  }
2236
- } : null, [a, t, i, o, re, de, ce, O]);
2247
+ } : null, [d, t, i, o, T, G, re, P]);
2237
2248
  return {
2238
2249
  // DataSource instance (para casos onde acesso direto é necessário)
2239
- dataSource: a,
2250
+ dataSource: d,
2240
2251
  // Estado reativo
2241
2252
  currentRecord: t,
2242
2253
  currentIndex: i,
2243
2254
  totalRecords: o,
2244
- isLoading: O,
2255
+ isLoading: P,
2245
2256
  // Estado derivado
2246
- canNext: te,
2247
- canPrior: oe,
2248
- isEmpty: ae,
2249
- isFirst: B,
2250
- isLast: K,
2251
- isBrowsing: re,
2252
- isEditing: de,
2253
- isInserting: ce,
2257
+ canNext: y,
2258
+ canPrior: J,
2259
+ isEmpty: te,
2260
+ isFirst: oe,
2261
+ isLast: ae,
2262
+ isBrowsing: T,
2263
+ isEditing: G,
2264
+ isInserting: re,
2254
2265
  // Operações básicas
2255
- setFieldValue: X,
2256
- getFieldValue: S,
2266
+ setFieldValue: b,
2267
+ getFieldValue: L,
2257
2268
  edit: h,
2258
- save: Q,
2259
- cancel: Z,
2260
- insert: I,
2261
- remove: U,
2269
+ save: E,
2270
+ cancel: j,
2271
+ insert: X,
2272
+ remove: Z,
2262
2273
  // Navegação
2263
- first: ee,
2264
- last: D,
2265
- next: E,
2266
- prior: A,
2267
- goToRecord: P,
2274
+ first: I,
2275
+ last: _,
2276
+ next: ee,
2277
+ prior: D,
2278
+ goToRecord: S,
2268
2279
  // Operações de array (V2)
2269
- appendToFieldArray: p,
2270
- updateFieldArrayItem: v,
2271
- removeFromFieldArray: x,
2272
- insertIntoFieldArray: L,
2273
- getFieldArray: y,
2274
- isFieldArray: q,
2280
+ appendToFieldArray: A,
2281
+ updateFieldArrayItem: B,
2282
+ removeFromFieldArray: p,
2283
+ insertIntoFieldArray: v,
2284
+ getFieldArray: x,
2285
+ isFieldArray: $,
2275
2286
  // Debug
2276
- getDebugInfo: fe
2287
+ getDebugInfo: ue
2277
2288
  };
2278
2289
  }
2279
- function It(n) {
2290
+ function yt(n) {
2280
2291
  const {
2281
2292
  dataSource: e,
2282
2293
  currentRecord: t,
@@ -2287,16 +2298,16 @@ function It(n) {
2287
2298
  isEmpty: c,
2288
2299
  isFirst: f,
2289
2300
  isLast: R,
2290
- isBrowsing: b,
2291
- first: N,
2292
- last: W,
2293
- next: T,
2294
- prior: O,
2295
- goToRecord: $,
2296
- getFieldValue: z,
2297
- getFieldArray: u,
2298
- isFieldArray: a
2299
- } = be(n);
2301
+ isBrowsing: C,
2302
+ first: H,
2303
+ last: z,
2304
+ next: O,
2305
+ prior: P,
2306
+ goToRecord: N,
2307
+ getFieldValue: d,
2308
+ getFieldArray: l,
2309
+ isFieldArray: b
2310
+ } = xe(n);
2300
2311
  return {
2301
2312
  dataSource: e,
2302
2313
  currentRecord: t,
@@ -2307,127 +2318,126 @@ function It(n) {
2307
2318
  isEmpty: c,
2308
2319
  isFirst: f,
2309
2320
  isLast: R,
2310
- isBrowsing: b,
2311
- first: N,
2312
- last: W,
2313
- next: T,
2314
- prior: O,
2315
- goToRecord: $,
2316
- getFieldValue: z,
2317
- getFieldArray: u,
2318
- isFieldArray: a
2321
+ isBrowsing: C,
2322
+ first: H,
2323
+ last: z,
2324
+ next: O,
2325
+ prior: P,
2326
+ goToRecord: N,
2327
+ getFieldValue: d,
2328
+ getFieldArray: l,
2329
+ isFieldArray: b
2319
2330
  };
2320
2331
  }
2321
- function wt(n) {
2322
- return be(n);
2332
+ function vt(n) {
2333
+ return xe(n);
2323
2334
  }
2324
- function De(n) {
2325
- const e = le(null), [t, r] = C(void 0), [i, s] = C(-1), [o, c] = C(0), [f, R] = C(0), [b, N] = C(!0), [W, T] = C(!1), [O, $] = C(!1), [z, u] = C(!1), [a, V] = C(null), [, X] = C({}), S = l(() => X({}), []), h = H(() => (e.current || (e.current = new Je(n)), e.current), []), Q = l((w) => {
2335
+ function Ce(n) {
2336
+ const e = ce(null), [t, r] = V(void 0), [i, s] = V(-1), [o, c] = V(0), [f, R] = V(0), [C, H] = V(!0), [z, O] = V(!1), [P, N] = V(!1), [d, l] = V(!1), [b, L] = V(null), h = W(() => (e.current || (e.current = new Ge(n)), e.current), []), E = u((w) => {
2326
2337
  switch (w.type) {
2327
- case d.dataChanged:
2328
- case d.recordChanged:
2329
- case d.refreshData:
2330
- r(h.getCurrentRecord()), s(h.getCurrentIndex()), c(h.getTotalRecords()), R(h.getGrandTotalRecords()), N(h.isBrowsing()), T(h.isEditing()), $(h.isInserting()), u(!1), V(null);
2338
+ case a.dataChanged:
2339
+ case a.recordChanged:
2340
+ case a.refreshData:
2341
+ r(h.getCurrentRecord()), s(h.getCurrentIndex()), c(h.getTotalRecords()), R(h.getGrandTotalRecords()), H(h.isBrowsing()), O(h.isEditing()), N(h.isInserting()), l(!1), L(null);
2331
2342
  break;
2332
- case d.fieldChanged:
2333
- r(h.getCurrentRecord()), S();
2343
+ case a.fieldChanged:
2334
2344
  break;
2335
- case d.afterScroll:
2345
+ case a.afterScroll:
2336
2346
  r(h.getCurrentRecord()), s(h.getCurrentIndex());
2337
2347
  break;
2338
- case d.beforeEdit:
2339
- case d.beforeInsert:
2340
- case d.beforeSave:
2341
- case d.beforeRemove:
2342
- u(!0), V(null);
2348
+ case a.beforeEdit:
2349
+ case a.beforeInsert:
2350
+ case a.beforeSave:
2351
+ case a.beforeRemove:
2352
+ l(!0), L(null);
2343
2353
  break;
2344
- case d.afterEdit:
2345
- case d.afterInsert:
2346
- case d.afterSave:
2347
- case d.afterCancel:
2348
- case d.afterRemove:
2349
- u(!1), N(h.isBrowsing()), T(h.isEditing()), $(h.isInserting()), V(null);
2354
+ case a.afterEdit:
2355
+ case a.afterInsert:
2356
+ case a.afterSave:
2357
+ case a.afterCancel:
2358
+ case a.afterRemove:
2359
+ l(!1), H(h.isBrowsing()), O(h.isEditing()), N(h.isInserting()), L(null);
2350
2360
  break;
2351
- case d.onError:
2352
- u(!1), V(w.error);
2361
+ case a.onError:
2362
+ l(!1), L(w.error);
2353
2363
  break;
2354
- case d.onFieldError:
2355
- u(!1);
2364
+ case a.onFieldError:
2365
+ l(!1);
2356
2366
  break;
2357
2367
  }
2358
- }, [h, S]);
2359
- J(() => (h.addListener(Q), r(h.getCurrentRecord()), s(h.getCurrentIndex()), c(h.getTotalRecords()), R(h.getGrandTotalRecords()), N(h.isBrowsing()), T(h.isEditing()), $(h.isInserting()), () => {
2360
- h.removeListener(Q);
2361
- }), [h, Q]);
2362
- const Z = l((w, M) => {
2368
+ }, [h]);
2369
+ K(() => (h.addListener(E), r(h.getCurrentRecord()), s(h.getCurrentIndex()), c(h.getTotalRecords()), R(h.getGrandTotalRecords()), H(h.isBrowsing()), O(h.isEditing()), N(h.isInserting()), () => {
2370
+ h.removeListener(E);
2371
+ }), [h, E]);
2372
+ const j = u((w, M) => {
2363
2373
  h.setFieldValue(w, M);
2364
- }, [h]), I = l((w) => h.getFieldValue(w), [h]), U = l(() => {
2374
+ }, [h]), X = u((w) => h.getFieldValue(w), [h]), Z = u(() => {
2365
2375
  h.edit();
2366
- }, [h]), ee = l(async () => {
2376
+ }, [h]), I = u(async () => {
2367
2377
  try {
2368
- return V(null), await h.save();
2378
+ return L(null), await h.save();
2369
2379
  } catch (w) {
2370
- throw V(w.message || "Erro ao salvar"), w;
2380
+ throw L(w.message || "Erro ao salvar"), w;
2371
2381
  }
2372
- }, [h]), D = l(() => {
2382
+ }, [h]), _ = u(() => {
2373
2383
  h.cancel();
2374
- }, [h]), E = l((w) => {
2384
+ }, [h]), ee = u((w) => {
2375
2385
  h.insert(w);
2376
- }, [h]), A = l(async (w) => {
2386
+ }, [h]), D = u(async (w) => {
2377
2387
  try {
2378
- return V(null), await h.remove(w);
2388
+ return L(null), await h.remove(w);
2379
2389
  } catch (M) {
2380
- throw V(M.message || "Erro ao remover"), M;
2390
+ throw L(M.message || "Erro ao remover"), M;
2381
2391
  }
2382
- }, [h]), P = l(() => {
2392
+ }, [h]), S = u(() => {
2383
2393
  h.first();
2384
- }, [h]), p = l(() => {
2394
+ }, [h]), A = u(() => {
2385
2395
  h.last();
2386
- }, [h]), v = l(() => {
2396
+ }, [h]), B = u(() => {
2387
2397
  h.next();
2388
- }, [h]), x = l(() => {
2398
+ }, [h]), p = u(() => {
2389
2399
  h.prior();
2390
- }, [h]), L = l((w) => {
2400
+ }, [h]), v = u((w) => {
2391
2401
  h.goToRecord(w);
2392
- }, [h]), y = l((w, M) => {
2402
+ }, [h]), x = u((w, M) => {
2393
2403
  h.appendToFieldArray(w, M);
2394
- }, [h]), q = l((w, M, se) => {
2404
+ }, [h]), $ = u((w, M, se) => {
2395
2405
  h.updateFieldArrayItem(w, M, se);
2396
- }, [h]), te = l((w, M) => {
2406
+ }, [h]), y = u((w, M) => {
2397
2407
  h.removeFromFieldArray(w, M);
2398
- }, [h]), oe = l((w, M, se) => {
2408
+ }, [h]), J = u((w, M, se) => {
2399
2409
  h.insertIntoFieldArray(w, M, se);
2400
- }, [h]), ae = l((w) => h.getFieldArray(w), [h]), B = l((w) => h.isFieldArray(w), [h]), K = l((w, M, se) => {
2401
- u(!0), V(null);
2410
+ }, [h]), te = u((w) => h.getFieldArray(w), [h]), oe = u((w) => h.isFieldArray(w), [h]), ae = u((w, M, se) => {
2411
+ l(!0), L(null);
2402
2412
  try {
2403
2413
  h.applyRemoteFilter(w, M, () => {
2404
- u(!1), se && se();
2414
+ l(!1), se && se();
2405
2415
  });
2406
- } catch (Pe) {
2407
- u(!1), V(Pe.message || "Erro ao aplicar filtro");
2416
+ } catch (Te) {
2417
+ l(!1), L(Te.message || "Erro ao aplicar filtro");
2408
2418
  }
2409
- }, [h]), re = l(async (w) => {
2419
+ }, [h]), T = u(async (w) => {
2410
2420
  try {
2411
- u(!0), V(null), h.refreshData(w);
2421
+ l(!0), L(null), h.refreshData(w);
2412
2422
  } catch (M) {
2413
- throw u(!1), V(M.message || "Erro ao atualizar dados"), M;
2423
+ throw l(!1), L(M.message || "Erro ao atualizar dados"), M;
2414
2424
  }
2415
- }, [h]), de = l((w) => {
2425
+ }, [h]), G = u((w) => {
2416
2426
  h.setPageSize(w);
2417
- }, [h]), ce = l(() => h.getPageSize(), [h]), fe = H(() => i < o - 1, [i, o]), F = H(() => i > 0, [i]), j = H(() => o === 0, [o]), he = H(() => i === 0, [i]), Te = H(() => i === o - 1, [i, o]), me = H(() => b, [b]), Re = H(() => W, [W]), pe = H(() => O, [O]), Oe = l(() => process.env.NODE_ENV === "development" ? {
2427
+ }, [h]), re = u(() => h.getPageSize(), [h]), ue = W(() => i < o - 1, [i, o]), F = W(() => i > 0, [i]), k = W(() => o === 0, [o]), de = W(() => i === 0, [i]), De = W(() => i === o - 1, [i, o]), ge = W(() => C, [C]), fe = W(() => z, [z]), me = W(() => P, [P]), Ve = u(() => process.env.NODE_ENV === "development" ? {
2418
2428
  ...h.getDebugSnapshot(),
2419
2429
  hookState: {
2420
2430
  currentRecord: t,
2421
2431
  currentIndex: i,
2422
2432
  totalRecords: o,
2423
2433
  grandTotalRecords: f,
2424
- isBrowsing: me,
2425
- isEditing: Re,
2426
- isInserting: pe,
2427
- isLoading: z,
2428
- error: a
2434
+ isBrowsing: ge,
2435
+ isEditing: fe,
2436
+ isInserting: me,
2437
+ isLoading: d,
2438
+ error: b
2429
2439
  }
2430
- } : null, [h, t, i, o, f, me, Re, pe, z, a]);
2440
+ } : null, [h, t, i, o, f, ge, fe, me, d, b]);
2431
2441
  return {
2432
2442
  // DataSource instance (para casos onde acesso direto é necessário)
2433
2443
  dataSource: h,
@@ -2436,48 +2446,48 @@ function De(n) {
2436
2446
  currentIndex: i,
2437
2447
  totalRecords: o,
2438
2448
  grandTotalRecords: f,
2439
- isLoading: z,
2440
- error: a,
2449
+ isLoading: d,
2450
+ error: b,
2441
2451
  // Estado derivado
2442
- canNext: fe,
2452
+ canNext: ue,
2443
2453
  canPrior: F,
2444
- isEmpty: j,
2445
- isFirst: he,
2446
- isLast: Te,
2447
- isBrowsing: me,
2448
- isEditing: Re,
2449
- isInserting: pe,
2454
+ isEmpty: k,
2455
+ isFirst: de,
2456
+ isLast: De,
2457
+ isBrowsing: ge,
2458
+ isEditing: fe,
2459
+ isInserting: me,
2450
2460
  // Operações básicas
2451
- setFieldValue: Z,
2452
- getFieldValue: I,
2453
- edit: U,
2454
- save: ee,
2455
- cancel: D,
2456
- insert: E,
2457
- remove: A,
2461
+ setFieldValue: j,
2462
+ getFieldValue: X,
2463
+ edit: Z,
2464
+ save: I,
2465
+ cancel: _,
2466
+ insert: ee,
2467
+ remove: D,
2458
2468
  // Navegação
2459
- first: P,
2460
- last: p,
2461
- next: v,
2462
- prior: x,
2463
- goToRecord: L,
2469
+ first: S,
2470
+ last: A,
2471
+ next: B,
2472
+ prior: p,
2473
+ goToRecord: v,
2464
2474
  // Operações de array (V2)
2465
- appendToFieldArray: y,
2466
- updateFieldArrayItem: q,
2467
- removeFromFieldArray: te,
2468
- insertIntoFieldArray: oe,
2469
- getFieldArray: ae,
2470
- isFieldArray: B,
2475
+ appendToFieldArray: x,
2476
+ updateFieldArrayItem: $,
2477
+ removeFromFieldArray: y,
2478
+ insertIntoFieldArray: J,
2479
+ getFieldArray: te,
2480
+ isFieldArray: oe,
2471
2481
  // Operações remotas
2472
- applyRemoteFilter: K,
2473
- refreshData: re,
2474
- setPageSize: de,
2475
- getPageSize: ce,
2482
+ applyRemoteFilter: ae,
2483
+ refreshData: T,
2484
+ setPageSize: G,
2485
+ getPageSize: re,
2476
2486
  // Debug
2477
- getDebugInfo: Oe
2487
+ getDebugInfo: Ve
2478
2488
  };
2479
2489
  }
2480
- function Et(n) {
2490
+ function It(n) {
2481
2491
  const {
2482
2492
  dataSource: e,
2483
2493
  currentRecord: t,
@@ -2488,23 +2498,23 @@ function Et(n) {
2488
2498
  error: c,
2489
2499
  canNext: f,
2490
2500
  canPrior: R,
2491
- isEmpty: b,
2492
- isFirst: N,
2493
- isLast: W,
2494
- isBrowsing: T,
2495
- first: O,
2496
- last: $,
2497
- next: z,
2498
- prior: u,
2499
- goToRecord: a,
2500
- getFieldValue: V,
2501
- getFieldArray: X,
2502
- isFieldArray: S,
2503
- applyRemoteFilter: h,
2504
- refreshData: Q,
2501
+ isEmpty: C,
2502
+ isFirst: H,
2503
+ isLast: z,
2504
+ isBrowsing: O,
2505
+ first: P,
2506
+ last: N,
2507
+ next: d,
2508
+ prior: l,
2509
+ goToRecord: b,
2510
+ getFieldValue: L,
2511
+ getFieldArray: h,
2512
+ isFieldArray: E,
2513
+ applyRemoteFilter: j,
2514
+ refreshData: X,
2505
2515
  getPageSize: Z,
2506
2516
  getDebugInfo: I
2507
- } = De(n);
2517
+ } = Ce(n);
2508
2518
  return {
2509
2519
  dataSource: e,
2510
2520
  currentRecord: t,
@@ -2515,28 +2525,28 @@ function Et(n) {
2515
2525
  error: c,
2516
2526
  canNext: f,
2517
2527
  canPrior: R,
2518
- isEmpty: b,
2519
- isFirst: N,
2520
- isLast: W,
2521
- isBrowsing: T,
2522
- first: O,
2523
- last: $,
2524
- next: z,
2525
- prior: u,
2526
- goToRecord: a,
2527
- getFieldValue: V,
2528
- getFieldArray: X,
2529
- isFieldArray: S,
2530
- applyRemoteFilter: h,
2531
- refreshData: Q,
2528
+ isEmpty: C,
2529
+ isFirst: H,
2530
+ isLast: z,
2531
+ isBrowsing: O,
2532
+ first: P,
2533
+ last: N,
2534
+ next: d,
2535
+ prior: l,
2536
+ goToRecord: b,
2537
+ getFieldValue: L,
2538
+ getFieldArray: h,
2539
+ isFieldArray: E,
2540
+ applyRemoteFilter: j,
2541
+ refreshData: X,
2532
2542
  getPageSize: Z,
2533
2543
  getDebugInfo: I
2534
2544
  };
2535
2545
  }
2536
- function St(n) {
2537
- return De(n);
2546
+ function wt(n) {
2547
+ return Ce(n);
2538
2548
  }
2539
- class Ft {
2549
+ class Et {
2540
2550
  /**
2541
2551
  * Gera chave de query baseada no DataSource e filtros
2542
2552
  */
@@ -2560,7 +2570,7 @@ class Ft {
2560
2570
  );
2561
2571
  }
2562
2572
  }
2563
- const At = {
2573
+ const St = {
2564
2574
  /** Configuração para dados que mudam raramente */
2565
2575
  STATIC_DATA: {
2566
2576
  staleTime: 30 * 60 * 1e3,
@@ -2590,32 +2600,32 @@ const At = {
2590
2600
  // 1 minuto
2591
2601
  retry: 5
2592
2602
  }
2593
- }, xt = (n) => {
2594
- const { initialData: e, name: t, label: r, initialDataSource: i, onLoadComplete: s, store: o, validator: c } = n, f = () => o && o.existsValue(t) ? o.getValue(t) : i || new Ie(t, {
2603
+ }, Ft = (n) => {
2604
+ const { initialData: e, name: t, label: r, initialDataSource: i, onLoadComplete: s, store: o, validator: c } = n, f = () => o && o.existsValue(t) ? o.getValue(t) : i || new ye(t, {
2595
2605
  records: e,
2596
2606
  grandTotalRecords: e.length,
2597
2607
  currentPage: 0,
2598
2608
  totalPages: 0,
2599
2609
  pageSize: 0,
2600
2610
  validator: c
2601
- }, r), [R, b] = C(
2611
+ }, r), [R, C] = V(
2602
2612
  f()
2603
2613
  );
2604
- return J(() => {
2614
+ return K(() => {
2605
2615
  o && o.setValue(t, R), s && s(R);
2606
2616
  }, [t]), { dataSource: R };
2607
- }, Ct = (n) => {
2617
+ }, At = (n) => {
2608
2618
  const e = (r) => {
2609
2619
  r.addListener(n.listener);
2610
2620
  }, t = (r) => {
2611
2621
  r.removeListener(n.listener);
2612
2622
  };
2613
- J(() => (n.dataSource && (t(n.dataSource), e(n.dataSource)), () => {
2623
+ K(() => (n.dataSource && (t(n.dataSource), e(n.dataSource)), () => {
2614
2624
  n.dataSource && t(n.dataSource);
2615
2625
  }), [n.dataSource?.uuid || n.dataSource?.getName()]);
2616
- }, bt = (n) => {
2617
- const { initialData: e, name: t, initialDataSource: r, onLoadComplete: i, validator: s } = n, [o, c] = C(
2618
- r ?? new Ge(t, {
2626
+ }, xt = (n) => {
2627
+ const { initialData: e, name: t, initialDataSource: r, onLoadComplete: i, validator: s } = n, [o, c] = V(
2628
+ r ?? new ke(t, {
2619
2629
  records: e,
2620
2630
  grandTotalRecords: e.length,
2621
2631
  currentPage: 0,
@@ -2624,7 +2634,7 @@ const At = {
2624
2634
  validator: s
2625
2635
  })
2626
2636
  );
2627
- return J(() => {
2637
+ return K(() => {
2628
2638
  c((f) => {
2629
2639
  const R = {
2630
2640
  records: e,
@@ -2638,7 +2648,7 @@ const At = {
2638
2648
  }), i && i(o);
2639
2649
  }, [e, t]), { dataSource: o };
2640
2650
  };
2641
- class Ve {
2651
+ class be {
2642
2652
  tokenManager;
2643
2653
  constructor(e) {
2644
2654
  this.tokenManager = e;
@@ -2799,9 +2809,9 @@ class Ve {
2799
2809
  }
2800
2810
  }
2801
2811
  }
2802
- ne.decorate(ne.inject(He.TokenManager), Ve, 0);
2803
- ne.decorate(ne.injectable(), Ve);
2804
- class Qe {
2812
+ ne.decorate(ne.inject($e.TokenManager), be, 0);
2813
+ ne.decorate(ne.injectable(), be);
2814
+ class qe {
2805
2815
  client;
2806
2816
  constructor(e) {
2807
2817
  this.client = e;
@@ -2901,8 +2911,8 @@ class Qe {
2901
2911
  return this.client.delete(`${this.getEndpoint()}/${e}`, t, !1);
2902
2912
  }
2903
2913
  }
2904
- ne.decorate(ne.injectable(), Qe);
2905
- class ge {
2914
+ ne.decorate(ne.injectable(), qe);
2915
+ class le {
2906
2916
  content;
2907
2917
  pageable;
2908
2918
  totalElements;
@@ -2914,8 +2924,8 @@ class ge {
2914
2924
  first;
2915
2925
  numberOfElements;
2916
2926
  empty;
2917
- constructor(e, t, r, i, s, o, c, f, R, b) {
2918
- this.content = e, this.totalElements = t, this.totalPages = r, this.number = i, this.size = s, this.sort = o || { sorted: !1, unsorted: !0, empty: !0 }, this.last = c !== void 0 ? c : i === r - 1, this.first = f !== void 0 ? f : i === 0, this.numberOfElements = R !== void 0 ? R : e.length, this.empty = b !== void 0 ? b : e.length === 0, this.pageable = {
2927
+ constructor(e, t, r, i, s, o, c, f, R, C) {
2928
+ this.content = e, this.totalElements = t, this.totalPages = r, this.number = i, this.size = s, this.sort = o || { sorted: !1, unsorted: !0, empty: !0 }, this.last = c !== void 0 ? c : i === r - 1, this.first = f !== void 0 ? f : i === 0, this.numberOfElements = R !== void 0 ? R : e.length, this.empty = C !== void 0 ? C : e.length === 0, this.pageable = {
2919
2929
  sort: this.sort,
2920
2930
  offset: i * s,
2921
2931
  pageSize: s,
@@ -2925,19 +2935,19 @@ class ge {
2925
2935
  };
2926
2936
  }
2927
2937
  static createFromValues(e, t, r, i, s) {
2928
- return new ge(e, t, r, i, s);
2938
+ return new le(e, t, r, i, s);
2929
2939
  }
2930
2940
  }
2931
- function Ke(n) {
2941
+ function Je(n) {
2932
2942
  return n.totalElements || n.totalElements === 0 ? n.totalElements : n.page.totalElements;
2933
2943
  }
2934
- function Ye(n) {
2944
+ function Qe(n) {
2935
2945
  return n.totalPages || n.totalPages === 0 ? n.totalPages : n.page.totalPages;
2936
2946
  }
2937
- function Xe(n) {
2947
+ function Ke(n) {
2938
2948
  return n.pageable ? n.pageable.pageNumber : n.page.number;
2939
2949
  }
2940
- function Dt(n) {
2950
+ function Ct(n) {
2941
2951
  const {
2942
2952
  name: e,
2943
2953
  label: t,
@@ -2948,26 +2958,26 @@ function Dt(n) {
2948
2958
  onLoadComplete: c,
2949
2959
  onDestroy: f,
2950
2960
  filterData: R,
2951
- findAll: b,
2952
- findAllWithSort: N,
2953
- findAllWithFilter: W,
2954
- findAllWithFilterAndSort: T,
2955
- initialDataSource: O,
2956
- pageSize: $ = 50,
2957
- currentPage: z = 0,
2958
- loadOnStart: u = !0,
2959
- store: a,
2960
- id: V,
2961
- validator: X
2962
- } = n, S = le(!1), h = () => !!(a && a.existsValue(e) || O), Q = () => a && a.existsValue(e) ? a.getValue(e) : O || new Ce(r, e, {
2961
+ findAll: C,
2962
+ findAllWithSort: H,
2963
+ findAllWithFilter: z,
2964
+ findAllWithFilterAndSort: O,
2965
+ initialDataSource: P,
2966
+ pageSize: N = 50,
2967
+ currentPage: d = 0,
2968
+ loadOnStart: l = !0,
2969
+ store: b,
2970
+ id: L,
2971
+ validator: h
2972
+ } = n, E = ce(!1), j = () => !!(b && b.existsValue(e) || P), X = () => b && b.existsValue(e) ? b.getValue(e) : P || new Ae(r, e, {
2963
2973
  records: [],
2964
2974
  grandTotalRecords: 0,
2965
- currentPage: z,
2975
+ currentPage: d,
2966
2976
  totalPages: 0,
2967
- pageSize: $,
2968
- validator: X
2969
- }, t), Z = () => a && a.existsValue(e) ? a.getValue(e).getCurrentPage() : O ? O.getCurrentPage() : 0, [I, U] = C({
2970
- dataSource: Q(),
2977
+ pageSize: N,
2978
+ validator: h
2979
+ }, t), Z = () => b && b.existsValue(e) ? b.getValue(e).getCurrentPage() : P ? P.getCurrentPage() : 0, [I, _] = V({
2980
+ dataSource: X(),
2971
2981
  isLoading: !1,
2972
2982
  isError: !1,
2973
2983
  error: "",
@@ -2975,53 +2985,53 @@ function Dt(n) {
2975
2985
  label: t,
2976
2986
  filter: i,
2977
2987
  sort: s,
2978
- id: V,
2988
+ id: L,
2979
2989
  currentPage: Z(),
2980
- pageSize: $,
2981
- loadDataCount: h() ? 1 : 0
2982
- }), ee = async (p, v, x, L, y, q, te, oe, ae) => {
2983
- let B;
2984
- if (q) {
2985
- const K = await r.findOne(q);
2986
- K ? B = ge.createFromValues([K], 1, 0, 0, 0) : B = ge.createFromValues([], 0, 0, 0, 0);
2990
+ pageSize: N,
2991
+ loadDataCount: j() ? 1 : 0
2992
+ }), ee = async (p, v, x, $, y, J, te, oe, ae) => {
2993
+ let T;
2994
+ if (J) {
2995
+ const G = await r.findOne(J);
2996
+ G ? T = le.createFromValues([G], 1, 0, 0, 0) : T = le.createFromValues([], 0, 0, 0, 0);
2987
2997
  } else
2988
- T && L && y && y.length > 0 ? B = await T(L, v, x, y) : W && L ? B = await W(L, v, x) : N && y && y.length > 0 ? B = await N(v, x, y) : b ? B = await b(v, x) : L && y && y.length > 0 ? B = await r.findAllWithFilterAndSort(L, v, x, y) : L ? B = await r.findAllWithFilter(L, v, x) : y && y.length > 0 ? B = await r.findAllWithSort(v, x, y) : B = await r.findAll(v, x);
2989
- R && (B = R(B)), o && (B = o(B)), U((K) => {
2998
+ O && $ && y && y.length > 0 ? T = await O($, v, x, y) : z && $ ? T = await z($, v, x) : H && y && y.length > 0 ? T = await H(v, x, y) : C ? T = await C(v, x) : $ && y && y.length > 0 ? T = await r.findAllWithFilterAndSort($, v, x, y) : $ ? T = await r.findAllWithFilter($, v, x) : y && y.length > 0 ? T = await r.findAllWithSort(v, x, y) : T = await r.findAll(v, x);
2999
+ R && (T = R(T)), o && (T = o(T)), _((G) => {
2990
3000
  const re = {
2991
- records: B.content,
2992
- grandTotalRecords: Ke(B),
2993
- totalPages: Ye(B),
2994
- currentPage: Xe(B),
3001
+ records: T.content,
3002
+ grandTotalRecords: Je(T),
3003
+ totalPages: Qe(T),
3004
+ currentPage: Ke(T),
2995
3005
  pageSize: x,
2996
- filter: L,
3006
+ filter: $,
2997
3007
  sort: y,
2998
3008
  originFilter: te,
2999
3009
  originGlobalFilter: ae,
3000
3010
  originSort: oe,
3001
- validator: X
3011
+ validator: h
3002
3012
  };
3003
- return K.dataSource.isActive() ? K.dataSource.setData(re) : K.dataSource.open(re), {
3004
- ...K,
3013
+ return G.dataSource.isActive() ? G.dataSource.setData(re) : G.dataSource.open(re), {
3014
+ ...G,
3005
3015
  currentPage: v,
3006
3016
  pageSize: x,
3007
- filter: L,
3017
+ filter: $,
3008
3018
  sort: y,
3009
- id: q,
3019
+ id: J,
3010
3020
  isLoading: !1,
3011
3021
  isError: !1,
3012
3022
  error: "",
3013
- loadDataCount: K.loadDataCount + 1
3023
+ loadDataCount: G.loadDataCount + 1
3014
3024
  };
3015
- }), a && a.setValue(e, I.dataSource);
3025
+ }), b && b.setValue(e, I.dataSource);
3016
3026
  };
3017
- J(() => {
3027
+ K(() => {
3018
3028
  c && I.loadDataCount > 0 && c(I.dataSource);
3019
3029
  }, [I.loadDataCount]);
3020
- const D = l((p) => {
3021
- if (p.type === d.refreshData) {
3030
+ const D = u((p) => {
3031
+ if (p.type === a.refreshData) {
3022
3032
  const v = p.options;
3023
3033
  try {
3024
- U((x) => ({
3034
+ _((x) => ({
3025
3035
  ...x,
3026
3036
  isLoading: !0,
3027
3037
  filter: v.filter,
@@ -3039,41 +3049,41 @@ function Dt(n) {
3039
3049
  v.originSort,
3040
3050
  v.originGlobalFilter
3041
3051
  ).catch((x) => {
3042
- const L = G(x);
3043
- U((y) => ({
3052
+ const $ = q(x);
3053
+ _((y) => ({
3044
3054
  ...y,
3045
3055
  isError: !0,
3046
3056
  isLoading: !1,
3047
- error: L
3048
- })), n.onError && n.onError(L, x);
3057
+ error: $
3058
+ })), n.onError && n.onError($, x);
3049
3059
  });
3050
3060
  } catch (x) {
3051
- const L = G(x);
3052
- U((y) => ({
3061
+ const $ = q(x);
3062
+ _((y) => ({
3053
3063
  ...y,
3054
3064
  isError: !0,
3055
3065
  isLoading: !1,
3056
- error: L
3057
- })), n.onError && n.onError(L, x);
3066
+ error: $
3067
+ })), n.onError && n.onError($, x);
3058
3068
  }
3059
3069
  }
3060
- }, [ee, I.name, n.onError]), E = l((p) => {
3061
- S.current || (p.addListener(D), S.current = !0);
3062
- }, [D]), A = l((p) => {
3063
- S.current && (p.removeListener(D), S.current = !1);
3070
+ }, [ee, I.name, n.onError]), S = u((p) => {
3071
+ E.current || (p.addListener(D), E.current = !0);
3072
+ }, [D]), A = u((p) => {
3073
+ E.current && (p.removeListener(D), E.current = !1);
3064
3074
  }, [D]);
3065
- J(() => {
3075
+ K(() => {
3066
3076
  try {
3067
- return E(I.dataSource), u && I.loadDataCount === 0 ? (U((p) => ({ ...p, isLoading: !0 })), ee(
3077
+ return S(I.dataSource), l && I.loadDataCount === 0 ? (_((p) => ({ ...p, isLoading: !0 })), ee(
3068
3078
  I.name,
3069
- z,
3070
- $,
3079
+ d,
3080
+ N,
3071
3081
  I.filter,
3072
3082
  I.sort,
3073
3083
  I.id
3074
3084
  ).catch((p) => {
3075
- const v = G(p);
3076
- U((x) => ({
3085
+ const v = q(p);
3086
+ _((x) => ({
3077
3087
  ...x,
3078
3088
  isError: !0,
3079
3089
  isLoading: !1,
@@ -3083,8 +3093,8 @@ function Dt(n) {
3083
3093
  f && (A(I.dataSource), f(I.dataSource));
3084
3094
  };
3085
3095
  } catch (p) {
3086
- const v = G(p);
3087
- U((x) => ({
3096
+ const v = q(p);
3097
+ _((x) => ({
3088
3098
  ...x,
3089
3099
  isError: !0,
3090
3100
  isLoading: !1,
@@ -3099,8 +3109,8 @@ function Dt(n) {
3099
3109
  I.currentPage,
3100
3110
  I.pageSize
3101
3111
  ]);
3102
- const P = () => {
3103
- U((p) => ({
3112
+ const B = () => {
3113
+ _((p) => ({
3104
3114
  ...p,
3105
3115
  isError: !1,
3106
3116
  isLoading: !1,
@@ -3112,19 +3122,19 @@ function Dt(n) {
3112
3122
  isError: I.isError,
3113
3123
  error: I.error,
3114
3124
  dataSource: I.dataSource,
3115
- clearError: P
3125
+ clearError: B
3116
3126
  };
3117
3127
  }
3118
- function Ze(n) {
3128
+ function Ye(n) {
3119
3129
  return n.totalElements || n.totalElements === 0 ? n.totalElements : n.page.totalElements;
3120
3130
  }
3121
- function et(n) {
3131
+ function Xe(n) {
3122
3132
  return n.totalPages || n.totalPages === 0 ? n.totalPages : n.page.totalPages;
3123
3133
  }
3124
- function tt(n) {
3134
+ function Ze(n) {
3125
3135
  return n.pageable ? n.pageable.pageNumber : n.page.number;
3126
3136
  }
3127
- function Vt(n) {
3137
+ function bt(n) {
3128
3138
  const {
3129
3139
  name: e,
3130
3140
  service: t,
@@ -3135,141 +3145,141 @@ function Vt(n) {
3135
3145
  onDestroy: c,
3136
3146
  filterData: f,
3137
3147
  findAll: R,
3138
- findAllWithSort: b,
3139
- findAllWithFilter: N,
3140
- findAllWithFilterAndSort: W,
3141
- initialDataSource: T,
3142
- pageSize: O = 50,
3143
- currentPage: $ = 0,
3144
- loadOnStart: z = !0,
3145
- store: u,
3146
- validator: a
3147
- } = n, V = () => !!(u && u.existsValue(e) || T), X = () => u && u.existsValue(e) ? u.getValue(e) : T || new _e(t, e, {
3148
+ findAllWithSort: C,
3149
+ findAllWithFilter: H,
3150
+ findAllWithFilterAndSort: z,
3151
+ initialDataSource: O,
3152
+ pageSize: P = 50,
3153
+ currentPage: N = 0,
3154
+ loadOnStart: d = !0,
3155
+ store: l,
3156
+ validator: b
3157
+ } = n, L = () => !!(l && l.existsValue(e) || O), h = () => l && l.existsValue(e) ? l.getValue(e) : O || new _e(t, e, {
3148
3158
  records: [],
3149
3159
  grandTotalRecords: 0,
3150
- currentPage: $,
3160
+ currentPage: N,
3151
3161
  totalPages: 0,
3152
- pageSize: O,
3153
- validator: a
3154
- }), [S, h] = C({
3155
- dataSource: X(),
3162
+ pageSize: P,
3163
+ validator: b
3164
+ }), [E, j] = V({
3165
+ dataSource: h(),
3156
3166
  isLoading: !1,
3157
3167
  isError: !1,
3158
3168
  error: "",
3159
3169
  name: e,
3160
3170
  filter: r,
3161
3171
  sort: i,
3162
- currentPage: $,
3163
- pageSize: O,
3164
- loadDataCount: V() ? 1 : 0
3165
- }), Q = async (D, E, A, P, p, v, x, L) => {
3172
+ currentPage: N,
3173
+ pageSize: P,
3174
+ loadDataCount: L() ? 1 : 0
3175
+ }), X = async (D, S, A, B, p, v, x, $) => {
3166
3176
  let y;
3167
- W && P && p && p.length > 0 ? y = await W(P, E, A, p) : N && P ? y = await N(P, E, A) : b && p && p.length > 0 ? y = await b(E, A, p) : R ? y = await R(E, A) : P && p && p.length > 0 ? y = await t.findAllWithFilterAndSort(P, E, A, p) : P ? y = await t.findAllWithFilter(P, E, A) : p && p.length > 0 ? y = await t.findAllWithSort(E, A, p) : y = await t.findAll(E, A), f && (y = f(y)), s && (y = s(y)), h((q) => {
3177
+ z && B && p && p.length > 0 ? y = await z(B, S, A, p) : H && B ? y = await H(B, S, A) : C && p && p.length > 0 ? y = await C(S, A, p) : R ? y = await R(S, A) : B && p && p.length > 0 ? y = await t.findAllWithFilterAndSort(B, S, A, p) : B ? y = await t.findAllWithFilter(B, S, A) : p && p.length > 0 ? y = await t.findAllWithSort(S, A, p) : y = await t.findAll(S, A), f && (y = f(y)), s && (y = s(y)), j((J) => {
3168
3178
  const te = {
3169
3179
  records: y.content,
3170
- grandTotalRecords: Ze(y),
3171
- totalPages: et(y),
3172
- currentPage: tt(y),
3180
+ grandTotalRecords: Ye(y),
3181
+ totalPages: Xe(y),
3182
+ currentPage: Ze(y),
3173
3183
  pageSize: A,
3174
- filter: P,
3184
+ filter: B,
3175
3185
  sort: p,
3176
3186
  originFilter: v,
3177
- originGlobalFilter: L,
3187
+ originGlobalFilter: $,
3178
3188
  originSort: x,
3179
- validator: a
3189
+ validator: b
3180
3190
  };
3181
- return q.dataSource.isActive() ? q.dataSource.setData(te) : q.dataSource.open(te), {
3182
- ...q,
3183
- currentPage: E,
3191
+ return J.dataSource.isActive() ? J.dataSource.setData(te) : J.dataSource.open(te), {
3192
+ ...J,
3193
+ currentPage: S,
3184
3194
  pageSize: A,
3185
- filter: P,
3195
+ filter: B,
3186
3196
  sort: p,
3187
3197
  isLoading: !1,
3188
3198
  isError: !1,
3189
3199
  error: "",
3190
- loadDataCount: q.loadDataCount + 1
3200
+ loadDataCount: J.loadDataCount + 1
3191
3201
  };
3192
- }), u && u.setValue(e, S.dataSource), o && o(S.dataSource);
3202
+ }), l && l.setValue(e, E.dataSource), o && o(E.dataSource);
3193
3203
  }, Z = (D) => {
3194
- if (D.type === d.refreshData) {
3195
- const E = D.options;
3204
+ if (D.type === a.refreshData) {
3205
+ const S = D.options;
3196
3206
  try {
3197
- h((A) => ({
3207
+ j((A) => ({
3198
3208
  ...A,
3199
3209
  isLoading: !0,
3200
- filter: E.filter,
3201
- sort: E.sort,
3202
- currentPage: E.currentPage
3203
- })), Q(
3204
- S.name,
3205
- E.currentPage,
3206
- E.pageSize,
3207
- E.filter,
3208
- E.sort,
3209
- E.originFilter,
3210
- E.originSort,
3211
- E.originGlobalFilter
3210
+ filter: S.filter,
3211
+ sort: S.sort,
3212
+ currentPage: S.currentPage
3213
+ })), X(
3214
+ E.name,
3215
+ S.currentPage,
3216
+ S.pageSize,
3217
+ S.filter,
3218
+ S.sort,
3219
+ S.originFilter,
3220
+ S.originSort,
3221
+ S.originGlobalFilter
3212
3222
  ).catch((A) => {
3213
- const P = G(A);
3214
- h((p) => ({
3223
+ const B = q(A);
3224
+ j((p) => ({
3215
3225
  ...p,
3216
3226
  isError: !0,
3217
3227
  isLoading: !1,
3218
- error: P
3219
- })), n.onError && n.onError(P, A);
3228
+ error: B
3229
+ })), n.onError && n.onError(B, A);
3220
3230
  });
3221
3231
  } catch (A) {
3222
- const P = G(A);
3223
- h((p) => ({
3232
+ const B = q(A);
3233
+ j((p) => ({
3224
3234
  ...p,
3225
3235
  isError: !0,
3226
3236
  isLoading: !1,
3227
- error: P
3228
- })), n.onError && n.onError(P, A);
3237
+ error: B
3238
+ })), n.onError && n.onError(B, A);
3229
3239
  }
3230
3240
  }
3231
3241
  }, I = (D) => {
3232
3242
  D.addListener(Z);
3233
- }, U = (D) => {
3243
+ }, _ = (D) => {
3234
3244
  D.removeListener(Z);
3235
3245
  };
3236
- J(() => {
3246
+ K(() => {
3237
3247
  try {
3238
- return I(S.dataSource), z && S.loadDataCount === 0 && (h((D) => ({ ...D, isLoading: !0 })), Q(
3239
- S.name,
3240
- $,
3241
- O,
3242
- S.filter,
3243
- S.sort
3248
+ return I(E.dataSource), d && E.loadDataCount === 0 && (j((D) => ({ ...D, isLoading: !0 })), X(
3249
+ E.name,
3250
+ N,
3251
+ P,
3252
+ E.filter,
3253
+ E.sort
3244
3254
  ).catch((D) => {
3245
- const E = G(D);
3246
- h((A) => ({
3255
+ const S = q(D);
3256
+ j((A) => ({
3247
3257
  ...A,
3248
3258
  isError: !0,
3249
3259
  isLoading: !1,
3250
- error: E
3251
- })), n.onError && n.onError(E, D);
3260
+ error: S
3261
+ })), n.onError && n.onError(S, D);
3252
3262
  })), () => {
3253
- c && (U(S.dataSource), c(S.dataSource));
3263
+ c && (_(E.dataSource), c(E.dataSource));
3254
3264
  };
3255
3265
  } catch (D) {
3256
- const E = G(D);
3257
- h((A) => ({
3266
+ const S = q(D);
3267
+ j((A) => ({
3258
3268
  ...A,
3259
3269
  isError: !0,
3260
3270
  isLoading: !1,
3261
- error: E
3262
- })), n.onError && n.onError(E, D);
3271
+ error: S
3272
+ })), n.onError && n.onError(S, D);
3263
3273
  }
3264
3274
  }, [
3265
- S.name,
3266
- S.sort,
3267
- S.filter,
3268
- S.currentPage,
3269
- S.pageSize
3275
+ E.name,
3276
+ E.sort,
3277
+ E.filter,
3278
+ E.currentPage,
3279
+ E.pageSize
3270
3280
  ]);
3271
3281
  const ee = () => {
3272
- h((D) => ({
3282
+ j((D) => ({
3273
3283
  ...D,
3274
3284
  isError: !1,
3275
3285
  isLoading: !1,
@@ -3277,46 +3287,46 @@ function Vt(n) {
3277
3287
  }));
3278
3288
  };
3279
3289
  return {
3280
- isLoading: S.isLoading,
3281
- isError: S.isError,
3282
- error: S.error,
3283
- dataSource: S.dataSource,
3290
+ isLoading: E.isLoading,
3291
+ isError: E.isError,
3292
+ error: E.error,
3293
+ dataSource: E.dataSource,
3284
3294
  clearError: ee
3285
3295
  };
3286
3296
  }
3287
- function Tt(n) {
3288
- return ze((e) => e.get(n));
3297
+ function Dt(n) {
3298
+ return He((e) => e.get(n));
3289
3299
  }
3290
- function Ot(n) {
3291
- J(() => {
3300
+ function Vt(n) {
3301
+ K(() => {
3292
3302
  n();
3293
3303
  }, []);
3294
3304
  }
3295
- function Pt(n, e) {
3296
- J(() => {
3305
+ function Tt(n, e) {
3306
+ K(() => {
3297
3307
  n();
3298
3308
  }, e);
3299
3309
  }
3300
- function Lt(n) {
3301
- J(() => () => {
3310
+ function Ot(n) {
3311
+ K(() => () => {
3302
3312
  n();
3303
3313
  }, []);
3304
3314
  }
3305
- function Bt() {
3306
- const [, n] = C(0);
3307
- return l(() => {
3315
+ function Pt() {
3316
+ const [, n] = V(0);
3317
+ return u(() => {
3308
3318
  n((t) => t + 1);
3309
3319
  }, []);
3310
3320
  }
3311
- const rt = (n) => (n + 1) % 1e6;
3312
- function it() {
3313
- const [, n] = We(rt, 0);
3321
+ const et = (n) => (n + 1) % 1e6;
3322
+ function tt() {
3323
+ const [, n] = Ne(et, 0);
3314
3324
  return n;
3315
3325
  }
3316
- function $t() {
3317
- return it();
3326
+ function Lt() {
3327
+ return tt();
3318
3328
  }
3319
- const st = Me((n, e) => ({
3329
+ const rt = We((n, e) => ({
3320
3330
  values: /* @__PURE__ */ new Map(),
3321
3331
  setValue: (t, r) => n((i) => {
3322
3332
  const s = new Map(i.values);
@@ -3330,24 +3340,24 @@ const st = Me((n, e) => ({
3330
3340
  }),
3331
3341
  clearAllValues: () => n((t) => ({ values: /* @__PURE__ */ new Map() })),
3332
3342
  reset: () => n((t) => ({ values: /* @__PURE__ */ new Map() }))
3333
- })), nt = je(st), Nt = (n = "default") => {
3334
- const e = nt();
3335
- return { setValue: (R, b) => {
3336
- e.setValue(`${n}.${R}`, b);
3343
+ })), it = ze(rt), Bt = (n = "default") => {
3344
+ const e = it();
3345
+ return { setValue: (R, C) => {
3346
+ e.setValue(`${n}.${R}`, C);
3337
3347
  }, getValue: (R) => e.getValue(`${n}.${R}`), clearValue: (R) => {
3338
3348
  e.clearValue(`${n}.${R}`);
3339
3349
  }, existsValue: (R) => e.existsValue(`${n}.${R}`), clearAllValues: () => {
3340
- for (const [R, b] of e.values.entries())
3350
+ for (const [R, C] of e.values.entries())
3341
3351
  R.startsWith(`${n}.`) && e.clearValue(R);
3342
3352
  }, reset: () => {
3343
3353
  e.clearAllValues();
3344
3354
  }, values: e.values };
3345
3355
  };
3346
- function Ht(n, e, t = window) {
3347
- const r = le(e);
3348
- J(() => {
3356
+ function $t(n, e, t = window) {
3357
+ const r = ce(e);
3358
+ K(() => {
3349
3359
  r.current = e;
3350
- }, [e]), J(
3360
+ }, [e]), K(
3351
3361
  () => {
3352
3362
  if (t && t.addEventListener && r.current) {
3353
3363
  const s = (o) => r.current(o);
@@ -3361,46 +3371,46 @@ function Ht(n, e, t = window) {
3361
3371
  );
3362
3372
  }
3363
3373
  export {
3364
- Mt as ADVANCED,
3365
- jt as ARCHBASE_IOC_API_TYPE,
3366
- At as ARCHBASE_QUERY_DEFAULTS,
3367
- Ve as ArchbaseAxiosRemoteApiClient,
3368
- Ie as ArchbaseDataSource,
3369
- k as ArchbaseDataSourceV2,
3370
- Ge as ArchbaseLocalFilterDataSource,
3371
- Ft as ArchbaseQueryUtils,
3372
- Qe as ArchbaseRemoteApiService,
3373
- Ce as ArchbaseRemoteDataSource,
3374
- Je as ArchbaseRemoteDataSourceV2,
3374
+ Wt as ADVANCED,
3375
+ zt as ARCHBASE_IOC_API_TYPE,
3376
+ St as ARCHBASE_QUERY_DEFAULTS,
3377
+ be as ArchbaseAxiosRemoteApiClient,
3378
+ ye as ArchbaseDataSource,
3379
+ U as ArchbaseDataSourceV2,
3380
+ ke as ArchbaseLocalFilterDataSource,
3381
+ Et as ArchbaseQueryUtils,
3382
+ qe as ArchbaseRemoteApiService,
3383
+ Ae as ArchbaseRemoteDataSource,
3384
+ Ge as ArchbaseRemoteDataSourceV2,
3375
3385
  _e as ArchbaseRemoteFilterDataSource,
3376
- d as DataSourceEventNames,
3377
- ge as DefaultPage,
3378
- kt as FILTER_TYPE,
3379
- Ue as LocalFilter,
3380
- yt as MigrationValidation,
3381
- Ut as NORMAL,
3382
- Gt as QUICK,
3383
- qe as RemoteFilter,
3384
- vt as USAGE_EXAMPLE,
3385
- qt as useArchbaseBool,
3386
- xt as useArchbaseDataSource,
3387
- Ct as useArchbaseDataSourceListener,
3388
- be as useArchbaseDataSourceV2,
3389
- wt as useArchbaseDataSourceV2Editor,
3390
- It as useArchbaseDataSourceV2ReadOnly,
3391
- Ot as useArchbaseDidMount,
3392
- Pt as useArchbaseDidUpdate,
3393
- Ht as useArchbaseEventListener,
3394
- Bt as useArchbaseForceRerender,
3395
- $t as useArchbaseForceUpdate,
3396
- bt as useArchbaseLocalFilterDataSource,
3397
- Dt as useArchbaseRemoteDataSource,
3398
- De as useArchbaseRemoteDataSourceV2,
3399
- St as useArchbaseRemoteDataSourceV2Editor,
3400
- Et as useArchbaseRemoteDataSourceV2ReadOnly,
3401
- Vt as useArchbaseRemoteFilterDataSource,
3402
- Tt as useArchbaseRemoteServiceApi,
3403
- Nt as useArchbaseStore,
3404
- pt as useArchbaseV1V2Compatibility,
3405
- Lt as useArchbaseWillUnmount
3386
+ a as DataSourceEventNames,
3387
+ le as DefaultPage,
3388
+ Mt as FILTER_TYPE,
3389
+ je as LocalFilter,
3390
+ Rt as MigrationValidation,
3391
+ jt as NORMAL,
3392
+ kt as QUICK,
3393
+ Ue as RemoteFilter,
3394
+ pt as USAGE_EXAMPLE,
3395
+ Ut as useArchbaseBool,
3396
+ Ft as useArchbaseDataSource,
3397
+ At as useArchbaseDataSourceListener,
3398
+ xe as useArchbaseDataSourceV2,
3399
+ vt as useArchbaseDataSourceV2Editor,
3400
+ yt as useArchbaseDataSourceV2ReadOnly,
3401
+ Vt as useArchbaseDidMount,
3402
+ Tt as useArchbaseDidUpdate,
3403
+ $t as useArchbaseEventListener,
3404
+ Pt as useArchbaseForceRerender,
3405
+ Lt as useArchbaseForceUpdate,
3406
+ xt as useArchbaseLocalFilterDataSource,
3407
+ Ct as useArchbaseRemoteDataSource,
3408
+ Ce as useArchbaseRemoteDataSourceV2,
3409
+ wt as useArchbaseRemoteDataSourceV2Editor,
3410
+ It as useArchbaseRemoteDataSourceV2ReadOnly,
3411
+ bt as useArchbaseRemoteFilterDataSource,
3412
+ Dt as useArchbaseRemoteServiceApi,
3413
+ Bt as useArchbaseStore,
3414
+ mt as useArchbaseV1V2Compatibility,
3415
+ Ot as useArchbaseWillUnmount
3406
3416
  };