@easyvision/easyvision-ui 1.11.0 → 1.12.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
@@ -675,6 +675,38 @@ Override per field with `toCondition: (value) => unknown` (return either a primi
675
675
 
676
676
  > `transform` is the deprecated old name for `toCondition` and is still accepted as an alias.
677
677
 
678
+ ### Saved filters ("Guardados")
679
+
680
+ `savedFilters={{ storageKey }}` adds a **Guardados** button next to Limpiar. It keeps named queries per person:
681
+
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
+ - **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.
685
+ - **🗑** deletes it (and the default, if it was).
686
+
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:
688
+
689
+ ```json
690
+ { "items": [{ "name": "Fallidas", "filters": { "status": ["FAILED"], "score": { "min": 3 } }, "search": [] }],
691
+ "defaultName": "Fallidas" }
692
+ ```
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.
695
+
696
+ ```tsx
697
+ <EasyVisionTable
698
+ id="evaluations"
699
+ ingot={ingot}
700
+ multifilter={{
701
+ id: 'filters',
702
+ performButton: true,
703
+ config: { fields },
704
+ savedFilters: { storageKey: `nml.table.view:${view.key}.saved.${user.id}` },
705
+ }}
706
+ columns={columns}
707
+ />
708
+ ```
709
+
678
710
  ### Multifilter props
679
711
 
680
712
  | prop | type | default | notes |
@@ -695,6 +727,7 @@ Override per field with `toCondition: (value) => unknown` (return either a primi
695
727
  | `onStateChange` | `(snap) => void` | — | Same as `onChange`; provided for API symmetry. |
696
728
  | `showClearAll` | `boolean` | `editable` | Resets values & active fields to their initial state (`defaultValue`s and `pinned`/`initiallyActive` fields). |
697
729
  | `labels` | `Partial<MultifilterLabels>` | Spanish defaults | |
730
+ | `savedFilters` | `{ storageKey: string }` | — | Shows the **Guardados** menu. See [Saved filters](#saved-filters-guardados). |
698
731
  | `className`, `persist`, `clearWhen` | as in Input/Selector | | |
699
732
 
700
733
  ---
@@ -1149,6 +1149,90 @@
1149
1149
  height: 0.75rem;
1150
1150
  color: var(--ev-muted-foreground, hsl(var(--muted-foreground, 215 16% 47%)));
1151
1151
  }
1152
+ /* Saved filters ("Guardados") */
1153
+ .ev-mf-saved-btn {
1154
+ height: 2.25rem;
1155
+ font-size: 0.75rem;
1156
+ }
1157
+ .ev-mf-saved-btn svg {
1158
+ width: 0.875rem;
1159
+ height: 0.875rem;
1160
+ }
1161
+ .ev-mf-saved-popover {
1162
+ width: 18rem;
1163
+ padding: 0.25rem;
1164
+ }
1165
+ .ev-mf-saved-empty {
1166
+ margin: 0;
1167
+ padding: 0.5rem 0.75rem;
1168
+ font-size: 0.75rem;
1169
+ color: var(--ev-muted-foreground, hsl(var(--muted-foreground, 215 16% 47%)));
1170
+ }
1171
+ .ev-mf-saved-list {
1172
+ list-style: none;
1173
+ margin: 0;
1174
+ padding: 0;
1175
+ }
1176
+ .ev-mf-saved-item {
1177
+ display: flex;
1178
+ align-items: center;
1179
+ gap: 0.125rem;
1180
+ border-radius: 0.375rem;
1181
+ }
1182
+ .ev-mf-saved-item:hover {
1183
+ background: var(--ev-muted, hsl(var(--muted, 210 40% 96%)));
1184
+ }
1185
+ .ev-mf-saved-apply {
1186
+ flex: 1;
1187
+ min-width: 0;
1188
+ overflow: hidden;
1189
+ text-overflow: ellipsis;
1190
+ white-space: nowrap;
1191
+ text-align: left;
1192
+ padding: 0.5rem 0.75rem;
1193
+ font-size: 0.75rem;
1194
+ line-height: 1rem;
1195
+ border: 0;
1196
+ background: transparent;
1197
+ color: inherit;
1198
+ cursor: pointer;
1199
+ }
1200
+ .ev-mf-saved-icon {
1201
+ display: inline-flex;
1202
+ align-items: center;
1203
+ justify-content: center;
1204
+ width: 1.75rem;
1205
+ height: 1.75rem;
1206
+ border: 0;
1207
+ border-radius: 0.375rem;
1208
+ background: transparent;
1209
+ cursor: pointer;
1210
+ color: var(--ev-muted-foreground, hsl(var(--muted-foreground, 215 16% 47%)));
1211
+ }
1212
+ .ev-mf-saved-icon:hover {
1213
+ color: var(--ev-foreground, hsl(var(--foreground, 222 47% 11%)));
1214
+ }
1215
+ .ev-mf-saved-icon svg {
1216
+ width: 0.875rem;
1217
+ height: 0.875rem;
1218
+ }
1219
+ .ev-mf-saved-icon[data-active] {
1220
+ color: var(--ev-primary, hsl(var(--primary, 222 47% 11%)));
1221
+ }
1222
+ .ev-mf-saved-icon[data-active] svg {
1223
+ fill: currentColor;
1224
+ }
1225
+ .ev-mf-saved-form {
1226
+ display: flex;
1227
+ gap: 0.375rem;
1228
+ padding: 0.375rem;
1229
+ margin-top: 0.25rem;
1230
+ border-top: 1px solid var(--ev-border, hsl(var(--border, 220 13% 91%)));
1231
+ }
1232
+ .ev-mf-saved-form .ev-input {
1233
+ height: 2rem;
1234
+ font-size: 0.75rem;
1235
+ }
1152
1236
  .ev-mf-perform {
1153
1237
  height: 2.25rem;
1154
1238
  padding: 0 1rem;