@easyvision/easyvision-ui 1.12.0 → 1.13.0

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/README.md CHANGED
@@ -681,7 +681,7 @@ Override per field with `toCondition: (value) => unknown` (return either a primi
681
681
 
682
682
  - **Guardar** names what is *applied* (the last Buscar), not what is staged; with nothing applied the form is disabled. A repeated name replaces the old one in place.
683
683
  - **Click a name** to replace the filters with it and search at once.
684
- - **★** makes it the default: a multifilter that opens clean (nothing persisted) opens with it and performs it, so a bound table loads already filtered. One default at most; ★ again removes it.
684
+ - **★** makes it the default: a multifilter that opens clean (nothing persisted) opens with it and performs it, so a bound table loads already filtered. One default at most; ★ again removes it. `openWithDefault: false` turns that off for one mount, for a page that arrived with its own filters (a shared link): the host seeds them as `defaultValue`s and sets `performOnMount`.
685
685
  - **🗑** deletes it (and the default, if it was).
686
686
 
687
687
  Storage is `localStorage[storageKey]`, so it is personal and per browser. Make the key unique per table **and** per account if people may share a browser. The shape is the one nml-vision v3's data-table writes, so a host that keeps v3's key (`nml.table.view:<viewKey>.saved.<userId>`) and field ids reads what people already saved there:
@@ -691,7 +691,7 @@ Storage is `localStorage[storageKey]`, so it is personal and per browser. Make t
691
691
  "defaultName": "Fallidas" }
692
692
  ```
693
693
 
694
- `filters` is keyed by field id; dates are stored as local `YYYY-MM-DD` days and come back as `Date`s; a single string where a multiselect expects a list is read as a one-item list. Nested `multifilter` fields are not saved. Field ids the config no longer has are ignored.
694
+ `savedFilters.searchFieldId` names the text field that holds the search terms: they are stored in `search` (as v3 does) instead of in `filters`, and read back into that field. `filters` is keyed by field id; dates are stored as local `YYYY-MM-DD` days and come back as `Date`s; a single string where a multiselect expects a list is read as a one-item list. Nested `multifilter` fields are not saved. Field ids the config no longer has are ignored.
695
695
 
696
696
  ```tsx
697
697
  <EasyVisionTable
@@ -1227,11 +1227,15 @@ The toolbar row is hidden entirely when none of `toolbarLeft`, `toolbarRight`, o
1227
1227
  | `data` | `T[]` | — for local mode |
1228
1228
  | `fetchData` | `(params) => Promise<{rows, totalCount}>` | — for api mode |
1229
1229
  | `loopback` | `CreateLoopbackTableFetcherOptions<T>` | — declarative LoopBack shortcut; auto-builds `fetchData` and forces `paginationMode`/`orderingMode` to `'api'` (see [API adapters: LoopBack](#api-adapters-loopback)) |
1230
+ | `defaultSort` | `{ column, descending }` | — api mode: the order the server applies when no sort is chosen. Its column shows the arrow and `aria-sort`; a click turns it around, and coming back to it clears the sort (so `fetchData` gets `sort: null` again) |
1230
1231
  | `onDataLoaded` | `(rows, totalCount) => void` | — fires after every successful API fetch; mirror the loaded slice into another store without wrapping `fetchData` |
1231
1232
  | `multifilter` | `EasyVisionMultifilterProps` | — |
1232
1233
  | `externalFilter` | `{ where?: Record<string, unknown> }` | — merged into every fetch |
1233
1234
  | `localMatch` | `(row, where) => boolean` | `matchLoopbackWhere` — local-mode predicate; override or compose to extend the DSL (see [Local mode filtering](#local-mode-filtering-with-the-same-dsl--matchloopbackwhere)) |
1234
1235
  | `refetchSignal` | `unknown` | — changing it refetches and resets `page` to 1 |
1236
+ | `getRowLabel` | `(row) => string` | — names each row's checkbox (`labels.selectRow` + the label) |
1237
+ | `ariaLabel` | `string` | — the table's accessible name (`aria-label` on `<table>`) |
1238
+ | `reloadSignal` | `unknown` | — changing it refetches and keeps the page: rows changed under the same query (an edit), not a new query |
1235
1239
  | `getRowId` | `(row) => string` | `(row) => String(row.id)` — override only for non-standard shapes |
1236
1240
  | `itemsPerPage` | `number` | `10` |
1237
1241
  | `itemsPerPageOptions` | `number[]` | `[10, 15, 20]` |
@@ -1243,7 +1247,7 @@ The toolbar row is hidden entirely when none of `toolbarLeft`, `toolbarRight`, o
1243
1247
  | `isLoading` | `boolean` | `false` |
1244
1248
  | `emptyMessage` | `string` | labels.noData |
1245
1249
  | `emptyAction` | `ReactNode` | — |
1246
- | `onRowClick` | `(row) => void` | — |
1250
+ | `onRowClick` | `(row) => void` | — not fired by clicks on a cell's own controls (links, buttons, menus, checkboxes) nor by clicks that bubble from a portal |
1247
1251
  | `isRowHighlighted` | `(row) => boolean` | — |
1248
1252
  | `toolbarLeft`, `toolbarRight` | `ReactNode` | — |
1249
1253
  | `showColumnVisibility` | `boolean` | `true` |
package/dist/index.cjs CHANGED
@@ -589,7 +589,13 @@ function EasyVisionSelector({
589
589
  ] })
590
590
  ] });
591
591
  }
592
+ var WidgetLabelsContext = React10.createContext({
593
+ removeFilter: "Quitar filtro",
594
+ removeValue: "Quitar"
595
+ });
596
+ var useWidgetLabels = () => React10.useContext(WidgetLabelsContext);
592
597
  function TextWidget({ definition, value, onChange, onRemove }) {
598
+ const widgetLabels = useWidgetLabels();
593
599
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-mf-chip", children: [
594
600
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ev-mf-chip-label", children: [
595
601
  definition.label,
@@ -601,6 +607,7 @@ function TextWidget({ definition, value, onChange, onRemove }) {
601
607
  {
602
608
  className: "ev-mf-chip-input",
603
609
  placeholder: definition.placeholder,
610
+ "aria-label": definition.label,
604
611
  value: value ?? "",
605
612
  onChange: (e) => onChange(e.target.value)
606
613
  }
@@ -610,6 +617,7 @@ function TextWidget({ definition, value, onChange, onRemove }) {
610
617
  {
611
618
  type: "button",
612
619
  onClick: onRemove,
620
+ "aria-label": `${widgetLabels.removeFilter}: ${definition.label}`,
613
621
  className: "ev-mf-chip-remove",
614
622
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
615
623
  }
@@ -618,6 +626,7 @@ function TextWidget({ definition, value, onChange, onRemove }) {
618
626
  }
619
627
  var SENTINEL = "__easyvision_undef__";
620
628
  function SelectorWidget({ definition, value, onChange, onRemove }) {
629
+ const widgetLabels = useWidgetLabels();
621
630
  const [open, setOpen] = React10.useState(false);
622
631
  const [resolved, setResolved] = React10.useState(
623
632
  Array.isArray(definition.options) ? definition.options : null
@@ -668,6 +677,7 @@ function SelectorWidget({ definition, value, onChange, onRemove }) {
668
677
  {
669
678
  type: "button",
670
679
  onClick: onRemove,
680
+ "aria-label": `${widgetLabels.removeFilter}: ${definition.label}`,
671
681
  className: "ev-mf-chip-remove",
672
682
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
673
683
  }
@@ -690,6 +700,7 @@ function MultiSelectWidget({
690
700
  onChange,
691
701
  onRemove
692
702
  }) {
703
+ const widgetLabels = useWidgetLabels();
693
704
  const [search, setSearch] = React10.useState("");
694
705
  const [open, setOpen] = React10.useState(false);
695
706
  const searchFn = definition.searchOptions;
@@ -764,13 +775,14 @@ function MultiSelectWidget({
764
775
  {
765
776
  type: "button",
766
777
  onClick: () => removeOne(v),
778
+ "aria-label": `${widgetLabels.removeValue} ${labelOf(v)}`,
767
779
  className: "ev-mf-chip-badge-x",
768
780
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
769
781
  }
770
782
  )
771
783
  ] }, String(v))),
772
784
  /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
773
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "ev-mf-chip-caret", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {}) }) }),
785
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "ev-mf-chip-caret", "aria-label": definition.label, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {}) }) }),
774
786
  /* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { className: "ev-mf-ms-popover", align: "start", children: [
775
787
  /* @__PURE__ */ jsxRuntime.jsx(
776
788
  Input,
@@ -796,7 +808,16 @@ function MultiSelectWidget({
796
808
  ] })
797
809
  ] })
798
810
  ] }),
799
- onRemove && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onRemove, className: "ev-mf-chip-remove", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}) })
811
+ onRemove && /* @__PURE__ */ jsxRuntime.jsx(
812
+ "button",
813
+ {
814
+ type: "button",
815
+ onClick: onRemove,
816
+ "aria-label": `${widgetLabels.removeFilter}: ${definition.label}`,
817
+ className: "ev-mf-chip-remove",
818
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
819
+ }
820
+ )
800
821
  ] });
801
822
  }
802
823
  function Calendar({
@@ -852,6 +873,7 @@ function DateRangeWidget({
852
873
  onChange,
853
874
  onRemove
854
875
  }) {
876
+ const widgetLabels = useWidgetLabels();
855
877
  const range = value ?? {};
856
878
  const label = (() => {
857
879
  if (range.from && range.to) {
@@ -888,6 +910,7 @@ function DateRangeWidget({
888
910
  {
889
911
  type: "button",
890
912
  onClick: onRemove,
913
+ "aria-label": `${widgetLabels.removeFilter}: ${definition.label}`,
891
914
  className: "ev-mf-chip-remove",
892
915
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
893
916
  }
@@ -900,6 +923,7 @@ function NumberRangeWidget({
900
923
  onChange,
901
924
  onRemove
902
925
  }) {
926
+ const widgetLabels = useWidgetLabels();
903
927
  const range = value ?? {};
904
928
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-mf-chip", children: [
905
929
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ev-mf-chip-label", children: [
@@ -913,6 +937,7 @@ function NumberRangeWidget({
913
937
  type: "number",
914
938
  className: "ev-mf-chip-number",
915
939
  placeholder: "Min",
940
+ "aria-label": `${definition.label} (min)`,
916
941
  value: range.min ?? "",
917
942
  onChange: (e) => onChange({ ...range, min: e.target.value ? Number(e.target.value) : void 0 })
918
943
  }
@@ -924,6 +949,7 @@ function NumberRangeWidget({
924
949
  type: "number",
925
950
  className: "ev-mf-chip-number",
926
951
  placeholder: "Max",
952
+ "aria-label": `${definition.label} (max)`,
927
953
  value: range.max ?? "",
928
954
  onChange: (e) => onChange({ ...range, max: e.target.value ? Number(e.target.value) : void 0 })
929
955
  }
@@ -933,6 +959,7 @@ function NumberRangeWidget({
933
959
  {
934
960
  type: "button",
935
961
  onClick: onRemove,
962
+ "aria-label": `${widgetLabels.removeFilter}: ${definition.label}`,
936
963
  className: "ev-mf-chip-remove",
937
964
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
938
965
  }
@@ -1242,8 +1269,8 @@ function useSavedFilters(storageKey) {
1242
1269
  [storage, storageKey]
1243
1270
  );
1244
1271
  const save = React10.useCallback(
1245
- (name, filters) => {
1246
- const saved = { name, filters, search: [] };
1272
+ (name, filters, search = []) => {
1273
+ const saved = { name, filters, search };
1247
1274
  const known = store.items.some((i) => i.name === name);
1248
1275
  const items = known ? store.items.map((i) => i.name === name ? saved : i) : [...store.items, saved];
1249
1276
  update({ ...store, items });
@@ -1375,7 +1402,9 @@ var DEFAULT_LABELS = {
1375
1402
  save: "Guardar",
1376
1403
  setDefault: "Abrir siempre con este",
1377
1404
  unsetDefault: "Dejar de abrir con este",
1378
- deleteSaved: "Borrar"
1405
+ deleteSaved: "Borrar",
1406
+ removeFilter: "Quitar filtro",
1407
+ removeValue: "Quitar"
1379
1408
  };
1380
1409
  function isFieldVisible(def, values) {
1381
1410
  if (def.visible === void 0) return true;
@@ -1434,17 +1463,19 @@ var EasyVisionMultifilter = React10.forwardRef(function EasyVisionMultifilter2(p
1434
1463
  const savedState = React10.useCallback(
1435
1464
  (item) => {
1436
1465
  const restored = fromStored(item.filters, config.fields);
1466
+ const searchId = savedFilters?.searchFieldId;
1467
+ if (searchId && item.search.length) restored[searchId] = item.search.join(" ");
1437
1468
  return {
1438
1469
  values: restored,
1439
1470
  activeFields: [.../* @__PURE__ */ new Set([...initialActive, ...Object.keys(restored)])]
1440
1471
  };
1441
1472
  },
1442
- [config.fields, initialActive]
1473
+ [config.fields, initialActive, savedFilters?.searchFieldId]
1443
1474
  );
1444
1475
  const openedWithDefaultRef = React10.useRef(false);
1445
1476
  const { slice, fullId, patch } = useEasyVisionSlice("multifilter", id, {
1446
1477
  init: () => {
1447
- if (saved.defaultFilter) {
1478
+ if (saved.defaultFilter && savedFilters?.openWithDefault !== false) {
1448
1479
  openedWithDefaultRef.current = true;
1449
1480
  return { kind: "multifilter", ...savedState(saved.defaultFilter), lastConfirmedSnapshotJSON: null };
1450
1481
  }
@@ -1738,123 +1769,135 @@ var EasyVisionMultifilter = React10.forwardRef(function EasyVisionMultifilter2(p
1738
1769
  f.id
1739
1770
  );
1740
1771
  };
1741
- return /* @__PURE__ */ jsxRuntime.jsx(NamespaceProvider, { fullId, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-mf-panel", children: [
1742
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-mf-row", children: [
1743
- prominentSlots.map(({ def, removable, isLegacySearchField }) => /* @__PURE__ */ jsxRuntime.jsxs(
1744
- "div",
1745
- {
1746
- className: "ev-mf-search-slot",
1747
- children: [
1748
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "ev-mf-search-icon" }),
1749
- /* @__PURE__ */ jsxRuntime.jsx(
1750
- "input",
1751
- {
1752
- className: ["ev-mf-search-input", removable ? "has-clear" : "no-clear"].filter(Boolean).join(" "),
1753
- placeholder: def.placeholder ?? def.label ?? labels.searchPlaceholder,
1754
- value: values[def.id] ?? "",
1755
- onChange: (e) => updateValue(def.id, e.target.value),
1756
- onKeyDown: (e) => {
1757
- if (e.key === "Enter" && performButton && performEnabled) {
1758
- performAction();
1772
+ return /* @__PURE__ */ jsxRuntime.jsx(NamespaceProvider, { fullId, children: /* @__PURE__ */ jsxRuntime.jsx(
1773
+ WidgetLabelsContext.Provider,
1774
+ {
1775
+ value: { removeFilter: labels.removeFilter, removeValue: labels.removeValue },
1776
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-mf-panel", children: [
1777
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-mf-row", children: [
1778
+ prominentSlots.map(({ def, removable, isLegacySearchField }) => /* @__PURE__ */ jsxRuntime.jsxs(
1779
+ "div",
1780
+ {
1781
+ className: "ev-mf-search-slot",
1782
+ children: [
1783
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "ev-mf-search-icon" }),
1784
+ /* @__PURE__ */ jsxRuntime.jsx(
1785
+ "input",
1786
+ {
1787
+ className: ["ev-mf-search-input", removable ? "has-clear" : "no-clear"].filter(Boolean).join(" "),
1788
+ placeholder: def.placeholder ?? def.label ?? labels.searchPlaceholder,
1789
+ value: values[def.id] ?? "",
1790
+ onChange: (e) => updateValue(def.id, e.target.value),
1791
+ onKeyDown: (e) => {
1792
+ if (e.key === "Enter" && performButton && performEnabled) {
1793
+ performAction();
1794
+ }
1795
+ }
1796
+ }
1797
+ ),
1798
+ removable && /* @__PURE__ */ jsxRuntime.jsx(
1799
+ "button",
1800
+ {
1801
+ type: "button",
1802
+ onClick: () => removeField(def.id),
1803
+ "aria-label": labels.clear,
1804
+ className: "ev-mf-search-clear",
1805
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
1759
1806
  }
1760
- }
1807
+ )
1808
+ ]
1809
+ },
1810
+ isLegacySearchField ? `__searchField__${def.id}` : def.id
1811
+ )),
1812
+ editable && availableToAdd.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
1813
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1814
+ Button,
1815
+ {
1816
+ variant: "outline",
1817
+ size: "sm",
1818
+ className: "ev-mf-add-btn",
1819
+ "aria-label": labels.addFilter,
1820
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {})
1761
1821
  }
1762
- ),
1763
- removable && /* @__PURE__ */ jsxRuntime.jsx(
1822
+ ) }),
1823
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "ev-mf-add-popover", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ev-mf-add-list", children: availableToAdd.map((f) => /* @__PURE__ */ jsxRuntime.jsxs(
1764
1824
  "button",
1765
1825
  {
1766
1826
  type: "button",
1767
- onClick: () => removeField(def.id),
1768
- "aria-label": labels.clear,
1769
- className: "ev-mf-search-clear",
1770
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
1771
- }
1772
- )
1773
- ]
1774
- },
1775
- isLegacySearchField ? `__searchField__${def.id}` : def.id
1776
- )),
1777
- editable && availableToAdd.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
1778
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1827
+ onClick: () => addField(f.id),
1828
+ className: "ev-mf-add-item",
1829
+ children: [
1830
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {}),
1831
+ f.label
1832
+ ]
1833
+ },
1834
+ f.id
1835
+ )) }) })
1836
+ ] }),
1837
+ performButton && performPosition === "inline" && /* @__PURE__ */ jsxRuntime.jsxs(
1838
+ Button,
1839
+ {
1840
+ size: "sm",
1841
+ onClick: performAction,
1842
+ disabled: !performEnabled,
1843
+ className: "ev-mf-perform",
1844
+ children: [
1845
+ performIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, {}),
1846
+ performLabelText
1847
+ ]
1848
+ }
1849
+ ),
1850
+ savedFilters && /* @__PURE__ */ jsxRuntime.jsx(
1851
+ SavedFiltersMenu,
1852
+ {
1853
+ items: saved.items,
1854
+ defaultName: saved.defaultName,
1855
+ canSave: Object.keys(appliedToSave).length > 0,
1856
+ labels,
1857
+ onApply: applySaved,
1858
+ onSave: (name) => {
1859
+ const searchId = savedFilters.searchFieldId;
1860
+ if (!searchId) return saved.save(name, appliedToSave);
1861
+ const { [searchId]: text, ...rest } = appliedToSave;
1862
+ const terms = typeof text === "string" && text.trim() ? [text.trim()] : [];
1863
+ saved.save(name, rest, terms);
1864
+ },
1865
+ onDelete: saved.remove,
1866
+ onSetDefault: saved.setDefault
1867
+ }
1868
+ ),
1869
+ showClear && /* @__PURE__ */ jsxRuntime.jsxs(
1870
+ Button,
1871
+ {
1872
+ variant: "ghost",
1873
+ size: "sm",
1874
+ onClick: clearAll,
1875
+ className: "ev-mf-clear",
1876
+ children: [
1877
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}),
1878
+ labels.clear
1879
+ ]
1880
+ }
1881
+ )
1882
+ ] }),
1883
+ pinnedFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ev-mf-row", children: pinnedFields.map(renderField) }),
1884
+ chipFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ev-mf-row", children: chipFields.map(renderField) }),
1885
+ performButton && performPosition === "belowRow" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ev-mf-below-row", children: /* @__PURE__ */ jsxRuntime.jsxs(
1779
1886
  Button,
1780
1887
  {
1781
- variant: "outline",
1782
1888
  size: "sm",
1783
- className: "ev-mf-add-btn",
1784
- "aria-label": labels.addFilter,
1785
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {})
1786
- }
1787
- ) }),
1788
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "ev-mf-add-popover", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ev-mf-add-list", children: availableToAdd.map((f) => /* @__PURE__ */ jsxRuntime.jsxs(
1789
- "button",
1790
- {
1791
- type: "button",
1792
- onClick: () => addField(f.id),
1793
- className: "ev-mf-add-item",
1889
+ onClick: performAction,
1890
+ disabled: !performEnabled,
1891
+ className: "ev-mf-perform",
1794
1892
  children: [
1795
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {}),
1796
- f.label
1893
+ performIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, {}),
1894
+ performLabelText
1797
1895
  ]
1798
- },
1799
- f.id
1800
- )) }) })
1801
- ] }),
1802
- performButton && performPosition === "inline" && /* @__PURE__ */ jsxRuntime.jsxs(
1803
- Button,
1804
- {
1805
- size: "sm",
1806
- onClick: performAction,
1807
- disabled: !performEnabled,
1808
- className: "ev-mf-perform",
1809
- children: [
1810
- performIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, {}),
1811
- performLabelText
1812
- ]
1813
- }
1814
- ),
1815
- savedFilters && /* @__PURE__ */ jsxRuntime.jsx(
1816
- SavedFiltersMenu,
1817
- {
1818
- items: saved.items,
1819
- defaultName: saved.defaultName,
1820
- canSave: Object.keys(appliedToSave).length > 0,
1821
- labels,
1822
- onApply: applySaved,
1823
- onSave: (name) => saved.save(name, appliedToSave),
1824
- onDelete: saved.remove,
1825
- onSetDefault: saved.setDefault
1826
- }
1827
- ),
1828
- showClear && /* @__PURE__ */ jsxRuntime.jsxs(
1829
- Button,
1830
- {
1831
- variant: "ghost",
1832
- size: "sm",
1833
- onClick: clearAll,
1834
- className: "ev-mf-clear",
1835
- children: [
1836
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}),
1837
- labels.clear
1838
- ]
1839
- }
1840
- )
1841
- ] }),
1842
- pinnedFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ev-mf-row", children: pinnedFields.map(renderField) }),
1843
- chipFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ev-mf-row", children: chipFields.map(renderField) }),
1844
- performButton && performPosition === "belowRow" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ev-mf-below-row", children: /* @__PURE__ */ jsxRuntime.jsxs(
1845
- Button,
1846
- {
1847
- size: "sm",
1848
- onClick: performAction,
1849
- disabled: !performEnabled,
1850
- className: "ev-mf-perform",
1851
- children: [
1852
- performIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, {}),
1853
- performLabelText
1854
- ]
1855
- }
1856
- ) })
1857
- ] }) }) });
1896
+ }
1897
+ ) })
1898
+ ] }) })
1899
+ }
1900
+ ) });
1858
1901
  });
1859
1902
  function buildChildQueryDirect(field, values) {
1860
1903
  const where = {};
@@ -2057,7 +2100,19 @@ function shouldDisableSorting(col, orderingMode, defaultSorting = "nonNested") {
2057
2100
  if (orderingMode === "api" && isNestedField(col.field)) return true;
2058
2101
  return false;
2059
2102
  }
2060
- function adaptColumns(columns, orderingMode, defaultSorting = "nonNested") {
2103
+ function stableCell(cache, field, render) {
2104
+ let entry = cache.get(field);
2105
+ if (!entry) {
2106
+ const created = {
2107
+ Comp: ({ row, getValue }) => created.render ? created.render(row.original) : React10.createElement("span", { className: "text-sm text-foreground" }, String(getValue() ?? "-"))
2108
+ };
2109
+ cache.set(field, created);
2110
+ entry = created;
2111
+ }
2112
+ entry.render = render;
2113
+ return entry.Comp;
2114
+ }
2115
+ function adaptColumns(columns, orderingMode, defaultSorting = "nonNested", cellCache = /* @__PURE__ */ new Map()) {
2061
2116
  return columns.map((c) => {
2062
2117
  const widthCss = typeof c.width === "number" ? `${c.width}px` : c.width;
2063
2118
  const numericWidth = typeof c.width === "number" ? c.width : typeof c.width === "string" && /^\d+px$/.test(c.width) ? parseInt(c.width, 10) : void 0;
@@ -2070,11 +2125,7 @@ function adaptColumns(columns, orderingMode, defaultSorting = "nonNested") {
2070
2125
  };
2071
2126
  const isUi = c.type === "ui";
2072
2127
  const userCell = c.cell;
2073
- const wrappedCell = userCell ? ({ row }) => userCell(row.original) : ({ getValue }) => React10.createElement(
2074
- "span",
2075
- { className: "text-sm text-foreground" },
2076
- String(getValue() ?? "-")
2077
- );
2128
+ const wrappedCell = stableCell(cellCache, c.field, userCell);
2078
2129
  const base = {
2079
2130
  id: c.field,
2080
2131
  header: c.header,
@@ -2435,6 +2486,7 @@ function PaginationFooter({
2435
2486
  className: "ev-table-footer-nav-btn",
2436
2487
  disabled: currentPage <= 1,
2437
2488
  onClick: () => onPageChange(currentPage - 1),
2489
+ "aria-label": labels.previousPage,
2438
2490
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "ev-table-footer-nav-icon" })
2439
2491
  }
2440
2492
  ),
@@ -2446,6 +2498,7 @@ function PaginationFooter({
2446
2498
  className: "ev-table-footer-nav-btn",
2447
2499
  disabled: currentPage >= totalPages,
2448
2500
  onClick: () => onPageChange(currentPage + 1),
2501
+ "aria-label": labels.nextPage,
2449
2502
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ev-table-footer-nav-icon" })
2450
2503
  }
2451
2504
  )
@@ -2766,8 +2819,19 @@ var DEFAULT_LABELS2 = {
2766
2819
  selectAllAll: "Seleccionar todo",
2767
2820
  selectedAllBanner: (n) => `Todos los ${n} registros seleccionados`,
2768
2821
  selectedCountBanner: (n) => `${n} ${n === 1 ? "registro seleccionado" : "registros seleccionados"}`,
2769
- clearSelection: "Limpiar selecci\xF3n"
2822
+ clearSelection: "Limpiar selecci\xF3n",
2823
+ selectRow: "Seleccionar",
2824
+ previousPage: "P\xE1gina anterior",
2825
+ nextPage: "P\xE1gina siguiente"
2770
2826
  };
2827
+ function isFromWithinControl(e) {
2828
+ const target = e.target;
2829
+ if (!target || !e.currentTarget.contains(target)) return true;
2830
+ const control = target.closest(
2831
+ 'a, button, input, select, textarea, label, [role="button"], [role="menuitem"], [role="checkbox"], [role="menu"]'
2832
+ );
2833
+ return !!control && e.currentTarget.contains(control) && control !== e.currentTarget;
2834
+ }
2771
2835
  function EasyVisionTable(props) {
2772
2836
  const {
2773
2837
  id,
@@ -2779,6 +2843,10 @@ function EasyVisionTable(props) {
2779
2843
  fetchData: fetchDataProp,
2780
2844
  loopback,
2781
2845
  ingot,
2846
+ defaultSort,
2847
+ reloadSignal,
2848
+ ariaLabel,
2849
+ getRowLabel,
2782
2850
  onDataLoaded,
2783
2851
  multifilter,
2784
2852
  multifilterRef,
@@ -2902,7 +2970,7 @@ function EasyVisionTable(props) {
2902
2970
  queueMicrotask(() => {
2903
2971
  if (fetchSeqRef.current === seq) void runFetch();
2904
2972
  });
2905
- }, [isApi, page, itemsPerPage, sort, refetchSignal]);
2973
+ }, [isApi, page, itemsPerPage, sort, refetchSignal, reloadSignal]);
2906
2974
  const resolveEagerAll = React10.useCallback(async () => {
2907
2975
  if (!fetchData) return;
2908
2976
  const collectRows = selectAllResolution === "eager";
@@ -2966,8 +3034,9 @@ function EasyVisionTable(props) {
2966
3034
  const rows = isApi ? apiRows : local.rows;
2967
3035
  const totalCount = isApi ? apiTotalCount : local.totalCount;
2968
3036
  const isLoading = isLoadingProp || apiLoading;
3037
+ const cellCacheRef = React10.useRef(/* @__PURE__ */ new Map());
2969
3038
  const tanstackColumns = React10.useMemo(
2970
- () => adaptColumns(columns, orderingMode, defaultSorting),
3039
+ () => adaptColumns(columns, orderingMode, defaultSorting, cellCacheRef.current),
2971
3040
  [columns, orderingMode, defaultSorting]
2972
3041
  );
2973
3042
  const allColumns = React10.useMemo(() => {
@@ -2982,7 +3051,7 @@ function EasyVisionTable(props) {
2982
3051
  checked: row.getIsSelected(),
2983
3052
  onCheckedChange: (v) => row.toggleSelected(!!v),
2984
3053
  onClick: (e) => e.stopPropagation(),
2985
- "aria-label": "Select row"
3054
+ "aria-label": getRowLabel ? `${labels.selectRow} ${getRowLabel(row.original)}` : labels.selectRow
2986
3055
  }
2987
3056
  ),
2988
3057
  enableSorting: false,
@@ -3058,7 +3127,9 @@ function EasyVisionTable(props) {
3058
3127
  for (const id2 of Object.keys(selection.ids)) r[id2] = true;
3059
3128
  return r;
3060
3129
  }, [selection]);
3061
- const sortingState = sort ? [{ id: sort.column, desc: sort.descending }] : [];
3130
+ const shownSort = sort ?? defaultSort ?? null;
3131
+ const sortingState = shownSort ? [{ id: shownSort.column, desc: shownSort.descending }] : [];
3132
+ const isDefaultSort = (s) => !!s && !!defaultSort && s.column === defaultSort.column && s.descending === defaultSort.descending;
3062
3133
  const isEagerWildcard = (selectAllResolution === "eager" || selectAllResolution === "eager-ids") && isApi && selection.scope === "all";
3063
3134
  const tableInstance = reactTable.useReactTable({
3064
3135
  data: rows,
@@ -3094,7 +3165,12 @@ function EasyVisionTable(props) {
3094
3165
  if (isEagerWildcard) return;
3095
3166
  const next = typeof updater === "function" ? updater(sortingState) : updater;
3096
3167
  const first = next[0];
3097
- const newSort = first ? { column: first.id, descending: !!first.desc } : null;
3168
+ let newSort = first ? { column: first.id, descending: !!first.desc } : null;
3169
+ if (!newSort && sort === null && defaultSort) {
3170
+ newSort = { column: defaultSort.column, descending: !defaultSort.descending };
3171
+ } else if (isDefaultSort(newSort)) {
3172
+ newSort = null;
3173
+ }
3098
3174
  patch({ sort: newSort });
3099
3175
  },
3100
3176
  getCoreRowModel: reactTable.getCoreRowModel(),
@@ -3355,7 +3431,7 @@ function EasyVisionTable(props) {
3355
3431
  style: maxBodyHeight !== void 0 ? {
3356
3432
  maxHeight: typeof maxBodyHeight === "number" ? `${maxBodyHeight}px` : maxBodyHeight
3357
3433
  } : void 0,
3358
- children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "ev-table", children: [
3434
+ children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "ev-table", "aria-label": ariaLabel, children: [
3359
3435
  /* @__PURE__ */ jsxRuntime.jsx(
3360
3436
  TableHeader,
3361
3437
  {
@@ -3387,6 +3463,7 @@ function EasyVisionTable(props) {
3387
3463
  TableHead,
3388
3464
  {
3389
3465
  style: headerWidthStyle,
3466
+ "aria-sort": header.column.getIsSorted() === "asc" ? "ascending" : header.column.getIsSorted() === "desc" ? "descending" : void 0,
3390
3467
  className: colMeta.largeScreensOnly ? "ev-table-large-only" : void 0,
3391
3468
  children: [
3392
3469
  header.isPlaceholder ? null : sortable ? /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3436,7 +3513,9 @@ function EasyVisionTable(props) {
3436
3513
  "data-state": row.getIsSelected() || isAllSelected ? "selected" : void 0,
3437
3514
  "data-highlighted": highlighted ? "true" : void 0,
3438
3515
  className: onRowClick ? "ev-table-row-clickable" : void 0,
3439
- onClick: () => onRowClick?.(row.original),
3516
+ onClick: (e) => {
3517
+ if (onRowClick && !isFromWithinControl(e)) onRowClick(row.original);
3518
+ },
3440
3519
  children: row.getVisibleCells().map((cell) => {
3441
3520
  if (cell.column.id === "_select" && selection.scope === "all") {
3442
3521
  return /* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntime.jsx(