nuxt-ui-tools 1.25.1 → 1.27.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.
Files changed (49) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/file-preview/components/shell/file-preview-header.d.vue.ts +2 -0
  3. package/dist/runtime/file-preview/components/shell/file-preview-header.vue +13 -7
  4. package/dist/runtime/file-preview/components/shell/file-preview-header.vue.d.ts +2 -0
  5. package/dist/runtime/file-preview/components/shell/file-preview-shell.vue +6 -0
  6. package/dist/runtime/file-preview/components/shell/file-preview-stage.d.vue.ts +5 -3
  7. package/dist/runtime/file-preview/components/shell/file-preview-stage.vue +4 -10
  8. package/dist/runtime/file-preview/components/shell/file-preview-stage.vue.d.ts +5 -3
  9. package/dist/runtime/form/components/root/form.vue +1 -0
  10. package/dist/runtime/form/composables/use-field-options.js +3 -1
  11. package/dist/runtime/form/composables/use-form-overlay-controller.js +1 -1
  12. package/dist/runtime/form/composables/use-form-root.d.ts +3 -1
  13. package/dist/runtime/form/composables/use-form-root.js +26 -11
  14. package/dist/runtime/form/composables/use-form-runtime.js +14 -4
  15. package/dist/runtime/form/composables/use-form-validation.d.ts +5 -2
  16. package/dist/runtime/form/composables/use-form-validation.js +51 -5
  17. package/dist/runtime/form/fields/custom-component/component.vue +2 -3
  18. package/dist/runtime/form/fields/date-family/component.vue +7 -6
  19. package/dist/runtime/form/fields/date-family/utils.d.ts +5 -0
  20. package/dist/runtime/form/fields/date-family/utils.js +13 -0
  21. package/dist/runtime/form/fields/number/component.vue +11 -5
  22. package/dist/runtime/form/fields/phone-number/component.vue +20 -1
  23. package/dist/runtime/form/types/api.d.ts +9 -2
  24. package/dist/runtime/form/types/options.d.ts +4 -1
  25. package/dist/runtime/form/types/runtime.d.ts +10 -0
  26. package/dist/runtime/form/types/schema.d.ts +5 -1
  27. package/dist/runtime/form/utils/api.js +1 -0
  28. package/dist/runtime/i18n/locales/en.js +12 -3
  29. package/dist/runtime/i18n/locales/fr.js +12 -3
  30. package/dist/runtime/i18n/types.d.ts +16 -0
  31. package/dist/runtime/table/components/filters/tags/date-filter-tag.vue +4 -0
  32. package/dist/runtime/table/composables/use-filter-persistence.d.ts +14 -0
  33. package/dist/runtime/table/composables/use-filter-persistence.js +77 -0
  34. package/dist/runtime/table/composables/use-query-state.js +31 -26
  35. package/dist/runtime/table/composables/use-table-api.js +4 -0
  36. package/dist/runtime/table/composables/use-table-data.js +3 -2
  37. package/dist/runtime/table/composables/use-table-state.d.ts +1 -0
  38. package/dist/runtime/table/composables/use-table-state.js +13 -2
  39. package/dist/runtime/table/types/filters.d.ts +28 -0
  40. package/dist/runtime/table/types/table-api.d.ts +5 -0
  41. package/dist/runtime/table/utils/filter-persistence.d.ts +16 -0
  42. package/dist/runtime/table/utils/filter-persistence.js +42 -0
  43. package/dist/runtime/table/utils/filters/options.js +2 -1
  44. package/dist/runtime/table/utils/filters/preview/option-preview.js +4 -1
  45. package/dist/runtime/table/utils/index.d.ts +1 -0
  46. package/dist/runtime/table/utils/index.js +1 -0
  47. package/dist/runtime/table/utils/resolved-filters.d.ts +8 -0
  48. package/dist/runtime/table/utils/resolved-filters.js +6 -0
  49. package/package.json +1 -1
@@ -21,9 +21,10 @@ export function resolveFilterOptionEntries(options) {
21
21
  return [];
22
22
  }
23
23
  const configuredOptions = options.options ?? options.definition.source?.options ?? [];
24
+ const facetLabel = options.definition.source?.label;
24
25
  const sourceOptions = configuredOptions.length || options.authoritative ? configuredOptions : (options.facetCounts ?? []).map((entry) => ({
25
26
  count: entry.count,
26
- label: String(entry.value),
27
+ label: facetLabel?.(entry.value) ?? String(entry.value),
27
28
  value: entry.value
28
29
  }));
29
30
  const countByValue = new Map(
@@ -1,3 +1,5 @@
1
+ import { isBoolean, isNullish, isNumber, isString } from "../../../../shared/utils/predicate.js";
2
+ import { getFilterLabelText } from "../common.js";
1
3
  import { resolveBooleanFilterUi, resolveOptionFilterUi } from "../ui.js";
2
4
  export function buildOptionFilterPreview(options) {
3
5
  const values = Array.isArray(options.rule.value) ? options.rule.value : [options.rule.value];
@@ -48,7 +50,8 @@ function resolveOptionPreviewLabel(options) {
48
50
  );
49
51
  return options.value ? filterUi.labels.true : filterUi.labels.false;
50
52
  }
51
- return String(options.value ?? "");
53
+ const label = isString(options.value) || isNumber(options.value) || isBoolean(options.value) ? options.definition.source?.label?.(options.value) : void 0;
54
+ return isNullish(label) ? String(options.value ?? "") : getFilterLabelText({ label });
52
55
  }
53
56
  function resolveOptionPreview(options) {
54
57
  if (options.definition.kind === "boolean") {
@@ -4,6 +4,7 @@ export * from './columns/index.js';
4
4
  export * from './cursor-query.js';
5
5
  export * from './data-list-ui.js';
6
6
  export * from './facets.js';
7
+ export * from './filter-persistence.js';
7
8
  export * from './filters/index.js';
8
9
  export * from './pagination.js';
9
10
  export * from './prefetch.js';
@@ -4,6 +4,7 @@ export * from "./columns/index.js";
4
4
  export * from "./cursor-query.js";
5
5
  export * from "./data-list-ui.js";
6
6
  export * from "./facets.js";
7
+ export * from "./filter-persistence.js";
7
8
  export * from "./filters/index.js";
8
9
  export * from "./pagination.js";
9
10
  export * from "./prefetch.js";
@@ -5,3 +5,11 @@ export declare function createResolvedFilterState<TRow extends GenericObject = G
5
5
  staticFilters?: TableStaticFilterNode<TRow, TContext, TKey>[];
6
6
  context?: TContext;
7
7
  }): TableResolvedFilterGroup<string>;
8
+ /**
9
+ * Drops the rules of filters marked `behavior.applyTo: 'query'`, which feed the source query but
10
+ * never narrow client rows.
11
+ */
12
+ export declare function withoutQueryFilterRules(options: {
13
+ definitions: TableUiFilterDefinition[];
14
+ filters: TableFilterState;
15
+ }): TableFilterState;
@@ -67,3 +67,9 @@ function normalizeResolvedFilterNode(node) {
67
67
  function isResolvedFilterGroup(value) {
68
68
  return !!value && isObject(value) && "type" in value && value.type === "group" && "children" in value && isArray(value.children);
69
69
  }
70
+ export function withoutQueryFilterRules(options) {
71
+ const queryKeys = new Set(
72
+ options.definitions.filter((definition) => definition.behavior?.applyTo === "query").map((definition) => definition.key)
73
+ );
74
+ return queryKeys.size === 0 ? options.filters : { ...options.filters, ui: options.filters.ui.filter((rule) => !queryKeys.has(rule.key)) };
75
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-tools",
3
- "version": "1.25.1",
3
+ "version": "1.27.0",
4
4
  "description": "Nuxt module and runtime toolkit for UI-heavy Nuxt applications",
5
5
  "homepage": "https://github.com/ChronicStone/nuxt-ui-tools#readme",
6
6
  "bugs": "https://github.com/ChronicStone/nuxt-ui-tools/issues",