@rebasepro/cms 0.24.1-canary.gcb918fc → 0.25.0-canary.g70dad01

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 (23) hide show
  1. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +3 -3
  2. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -1
  3. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.d.ts +10 -0
  4. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +95 -34
  5. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -1
  6. package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +1 -1
  7. package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -1
  8. package/dist/components/CollectionViewBinding/CollectionViewActions.js +6 -3
  9. package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
  10. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +4 -2
  11. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
  12. package/dist/components/CollectionViewBinding/FiltersDialog.js +12 -2
  13. package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -1
  14. package/dist/components/PropertyConfigBadge.js +1 -1
  15. package/dist/components/PropertyConfigBadge.js.map +1 -1
  16. package/dist/components/app/Scaffold.js.map +1 -1
  17. package/dist/editor/editor.js +21 -15
  18. package/dist/editor/editor.js.map +1 -1
  19. package/dist/editor/extensions/drag-and-drop.js +1 -1
  20. package/dist/editor/extensions/drag-and-drop.js.map +1 -1
  21. package/dist/preview/components/storageRenditions.js +6 -4
  22. package/dist/preview/components/storageRenditions.js.map +1 -1
  23. package/package.json +9 -9
@@ -68,8 +68,8 @@ function StringPropertyField({ widgetId, disabled, showErrors }) {
68
68
  case "text": return "text (unlimited)";
69
69
  case "char": return "char (fixed length)";
70
70
  case "varchar": return "varchar (variable length)";
71
- case "_default_": return "Default (varchar)";
72
- default: return "Default (varchar)";
71
+ case "_default_": return "Default (text)";
72
+ default: return "Default (text)";
73
73
  }
74
74
  },
75
75
  error: Boolean(columnTypeError),
@@ -81,7 +81,7 @@ function StringPropertyField({ widgetId, disabled, showErrors }) {
81
81
  }),
82
82
  /* @__PURE__ */ jsx(SelectItem, {
83
83
  value: "_default_",
84
- children: " Default (varchar) "
84
+ children: " Default (text) "
85
85
  }),
86
86
  /* @__PURE__ */ jsx(SelectItem, {
87
87
  value: "varchar",
@@ -1 +1 @@
1
- {"version":3,"file":"StringPropertyField.js","names":[],"sources":["../../../../../src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx"],"sourcesContent":["import { FieldCaption } from \"../../../_cms_internals\";\nimport React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormex } from \"@rebasepro/forms\";\nimport { useTranslation } from \"@rebasepro/app\";\n;\nimport { Select, SelectItem, TextField } from \"@rebasepro/ui\";\n\nexport function StringPropertyField({\n widgetId,\n disabled,\n showErrors\n}: {\n widgetId: \"text_field\" | \"multiline\" | \"email\" | \"user_select\";\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue, touched, errors } = useFormex();\n const { t } = useTranslation();\n\n const columnTypePath = \"columnType\";\n const columnTypeValue: string | undefined = getIn(values, columnTypePath) as string | undefined;\n const columnTypeError: string | undefined = (getIn(touched, columnTypePath) && getIn(errors, columnTypePath)) as string | undefined;\n\n const isIdPath = \"isId\";\n const isIdValue: string | boolean | undefined = getIn(values, isIdPath) as string | boolean | undefined;\n const isIdError: string | undefined = (getIn(touched, isIdPath) && getIn(errors, isIdPath)) as string | undefined;\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n\n {widgetId === \"text_field\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n matches={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n {widgetId === \"user_select\" &&\n <StringPropertyValidation disabled={disabled}\n showErrors={showErrors}/>}\n\n {widgetId === \"multiline\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n\n {widgetId === \"email\" &&\n <StringPropertyValidation disabled={disabled}\n max={true}\n min={true}\n trim={true}\n showErrors={showErrors}/>}\n\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n <Select name={columnTypePath}\n disabled={disabled || Boolean(isIdValue)}\n fullWidth={true}\n value={isIdValue === \"uuid\" ? \"uuid\" : (columnTypeValue ?? \"_default_\")}\n onValueChange={(v) => setFieldValue(columnTypePath, v === \"_default_\" ? undefined : v)}\n renderValue={(v) => {\n if (isIdValue === \"uuid\") return \"uuid (forced by Primary Key)\";\n switch (v) {\n case \"text\": return \"text (unlimited)\";\n case \"char\": return \"char (fixed length)\";\n case \"varchar\": return \"varchar (variable length)\";\n case \"_default_\": return \"Default (varchar)\";\n default: return \"Default (varchar)\";\n }\n }}\n error={Boolean(columnTypeError)}\n label={t(\"db_column_type\")}>\n {isIdValue === \"uuid\" && <SelectItem value={\"uuid\"}> uuid (forced by Primary Key) </SelectItem>}\n <SelectItem value={\"_default_\"}> Default (varchar) </SelectItem>\n <SelectItem value={\"varchar\"}> varchar (variable length) </SelectItem>\n <SelectItem value={\"text\"}> text (unlimited) </SelectItem>\n <SelectItem value={\"char\"}> char (fixed length) </SelectItem>\n </Select>\n <FieldCaption error={Boolean(columnTypeError)}>\n {columnTypeError ?? \"Optional database override for this string field.\"}\n </FieldCaption>\n </div>\n\n <div className={\"col-span-12\"}>\n <Select name={isIdPath}\n disabled={disabled}\n fullWidth={true}\n value={isIdValue === true ? \"true\" : (isIdValue === false ? \"false\" : (isIdValue ?? \"_default_\"))}\n onValueChange={(v) => {\n if (v === \"_default_\" || v === \"false\") setFieldValue(isIdPath, undefined);\n else if (v === \"true\") setFieldValue(isIdPath, true);\n else setFieldValue(isIdPath, v);\n }}\n renderValue={(v) => {\n switch (v) {\n case \"true\": return \"Yes (Auto-generated UUID/String)\";\n case \"manual\": return \"Yes (Manual input)\";\n case \"uuid\": return \"Yes (UUID)\";\n case \"cuid\": return \"Yes (CUID)\";\n case \"false\":\n case \"_default_\": return \"No\";\n default: return `Yes (${v})`;\n }\n }}\n error={Boolean(isIdError)}\n label={t(\"primary_key_unique_id\")}>\n <SelectItem value={\"_default_\"}> No </SelectItem>\n <SelectItem value={\"manual\"}> Yes (Manual input) </SelectItem>\n <SelectItem value={\"true\"}> Yes (Auto-generated UUID/String) </SelectItem>\n <SelectItem value={\"uuid\"}> Yes (UUID) </SelectItem>\n <SelectItem value={\"cuid\"}> Yes (CUID) </SelectItem>\n </Select>\n <FieldCaption error={Boolean(isIdError)}>\n {isIdError ?? \"Set as Primary Key and configure ID generation strategy.\"}\n </FieldCaption>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={t(\"default_value\")}\n value={(getIn(values, \"defaultValue\") as string | undefined) ?? \"\"}/>\n\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,oBAAoB,EAChC,UACA,UACA,cAKD;CAEC,MAAM,EAAE,QAAQ,eAAe,SAAS,WAAW,UAAU;CAC7D,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,iBAAiB;CACvB,MAAM,kBAAsC,MAAM,QAAQ,cAAc;CACxE,MAAM,kBAAuC,MAAM,SAAS,cAAc,KAAK,MAAM,QAAQ,cAAc;CAE3G,MAAM,WAAW;CACjB,MAAM,YAA0C,MAAM,QAAQ,QAAQ;CACtE,MAAM,YAAiC,MAAM,SAAS,QAAQ,KAAK,MAAM,QAAQ,QAAQ;CAEzF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Ae;IACxB,OAAQ,MAAM,QAAQ,cAAc,KAA4B;GAAI,CAAA;EAEvE,CAAA;CACP,EAAA,CAAA;AAEV"}
1
+ {"version":3,"file":"StringPropertyField.js","names":[],"sources":["../../../../../src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx"],"sourcesContent":["import { FieldCaption } from \"../../../_cms_internals\";\nimport React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormex } from \"@rebasepro/forms\";\nimport { useTranslation } from \"@rebasepro/app\";\n;\nimport { Select, SelectItem, TextField } from \"@rebasepro/ui\";\n\nexport function StringPropertyField({\n widgetId,\n disabled,\n showErrors\n}: {\n widgetId: \"text_field\" | \"multiline\" | \"email\" | \"user_select\";\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue, touched, errors } = useFormex();\n const { t } = useTranslation();\n\n const columnTypePath = \"columnType\";\n const columnTypeValue: string | undefined = getIn(values, columnTypePath) as string | undefined;\n const columnTypeError: string | undefined = (getIn(touched, columnTypePath) && getIn(errors, columnTypePath)) as string | undefined;\n\n const isIdPath = \"isId\";\n const isIdValue: string | boolean | undefined = getIn(values, isIdPath) as string | boolean | undefined;\n const isIdError: string | undefined = (getIn(touched, isIdPath) && getIn(errors, isIdPath)) as string | undefined;\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n\n {widgetId === \"text_field\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n matches={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n {widgetId === \"user_select\" &&\n <StringPropertyValidation disabled={disabled}\n showErrors={showErrors}/>}\n\n {widgetId === \"multiline\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n\n {widgetId === \"email\" &&\n <StringPropertyValidation disabled={disabled}\n max={true}\n min={true}\n trim={true}\n showErrors={showErrors}/>}\n\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n <Select name={columnTypePath}\n disabled={disabled || Boolean(isIdValue)}\n fullWidth={true}\n value={isIdValue === \"uuid\" ? \"uuid\" : (columnTypeValue ?? \"_default_\")}\n onValueChange={(v) => setFieldValue(columnTypePath, v === \"_default_\" ? undefined : v)}\n renderValue={(v) => {\n if (isIdValue === \"uuid\") return \"uuid (forced by Primary Key)\";\n switch (v) {\n case \"text\": return \"text (unlimited)\";\n case \"char\": return \"char (fixed length)\";\n case \"varchar\": return \"varchar (variable length)\";\n // No `columnType` is a TEXT column: what the schema\n // planner creates for a string that names none.\n case \"_default_\": return \"Default (text)\";\n default: return \"Default (text)\";\n }\n }}\n error={Boolean(columnTypeError)}\n label={t(\"db_column_type\")}>\n {isIdValue === \"uuid\" && <SelectItem value={\"uuid\"}> uuid (forced by Primary Key) </SelectItem>}\n <SelectItem value={\"_default_\"}> Default (text) </SelectItem>\n <SelectItem value={\"varchar\"}> varchar (variable length) </SelectItem>\n <SelectItem value={\"text\"}> text (unlimited) </SelectItem>\n <SelectItem value={\"char\"}> char (fixed length) </SelectItem>\n </Select>\n <FieldCaption error={Boolean(columnTypeError)}>\n {columnTypeError ?? \"Optional database override for this string field.\"}\n </FieldCaption>\n </div>\n\n <div className={\"col-span-12\"}>\n <Select name={isIdPath}\n disabled={disabled}\n fullWidth={true}\n value={isIdValue === true ? \"true\" : (isIdValue === false ? \"false\" : (isIdValue ?? \"_default_\"))}\n onValueChange={(v) => {\n if (v === \"_default_\" || v === \"false\") setFieldValue(isIdPath, undefined);\n else if (v === \"true\") setFieldValue(isIdPath, true);\n else setFieldValue(isIdPath, v);\n }}\n renderValue={(v) => {\n switch (v) {\n case \"true\": return \"Yes (Auto-generated UUID/String)\";\n case \"manual\": return \"Yes (Manual input)\";\n case \"uuid\": return \"Yes (UUID)\";\n case \"cuid\": return \"Yes (CUID)\";\n case \"false\":\n case \"_default_\": return \"No\";\n default: return `Yes (${v})`;\n }\n }}\n error={Boolean(isIdError)}\n label={t(\"primary_key_unique_id\")}>\n <SelectItem value={\"_default_\"}> No </SelectItem>\n <SelectItem value={\"manual\"}> Yes (Manual input) </SelectItem>\n <SelectItem value={\"true\"}> Yes (Auto-generated UUID/String) </SelectItem>\n <SelectItem value={\"uuid\"}> Yes (UUID) </SelectItem>\n <SelectItem value={\"cuid\"}> Yes (CUID) </SelectItem>\n </Select>\n <FieldCaption error={Boolean(isIdError)}>\n {isIdError ?? \"Set as Primary Key and configure ID generation strategy.\"}\n </FieldCaption>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={t(\"default_value\")}\n value={(getIn(values, \"defaultValue\") as string | undefined) ?? \"\"}/>\n\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,oBAAoB,EAChC,UACA,UACA,cAKD;CAEC,MAAM,EAAE,QAAQ,eAAe,SAAS,WAAW,UAAU;CAC7D,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,iBAAiB;CACvB,MAAM,kBAAsC,MAAM,QAAQ,cAAc;CACxE,MAAM,kBAAuC,MAAM,SAAS,cAAc,KAAK,MAAM,QAAQ,cAAc;CAE3G,MAAM,WAAW;CACjB,MAAM,YAA0C,MAAM,QAAQ,QAAQ;CACtE,MAAM,YAAiC,MAAM,SAAS,QAAQ,KAAK,MAAM,QAAQ,QAAQ;CAEzF,OACI,qBAAA,UAAA,EAAA,UAAA;EACI,oBAAC,OAAD;GAAK,WAAW;aAEZ,qBAAC,iBAAD,EAAA,UAAA;IAEK,aAAa,gBACV,oBAAC,0BAAD;KAAoC;KAChC,QAAQ;KACR,WAAW;KACX,SAAS;KACT,KAAK;KACL,KAAK;KAC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sits in has room for its controls' labels
26
+ * ("Filters", "Add existing", "Add Tag"), or wants their icon-only forms.
27
+ *
28
+ * Decided by the toolbar's own width, not the window's: a relation tab beside
29
+ * the split list is a narrow toolbar in a wide window, and its labelled
30
+ * controls overflowed the left group and were drawn over the search bar.
31
+ * `true` outside a toolbar.
32
+ */
33
+ export declare function useToolbarLabels(): boolean;
24
34
  export declare function CollectionTableToolbar({ actions, actionsStart, loading, onTextSearch, title, viewModeToggle, initialSearchText, compact }: CollectionTableToolbarProps): React.JSX.Element;
25
35
  export {};
@@ -1,50 +1,111 @@
1
- import React from "react";
1
+ import React, { useContext, useLayoutEffect, useRef, useState } from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { CircularProgress, SearchBar, cls } from "@rebasepro/ui";
4
4
  import { useLargeLayout, useTranslation } from "@rebasepro/app";
5
5
  //#region src/components/CollectionTableBinding/internal/CollectionTableToolbar.tsx
6
+ var ToolbarLabelsContext = React.createContext(true);
7
+ /**
8
+ * Whether the toolbar this control sits in has room for its controls' labels
9
+ * ("Filters", "Add existing", "Add Tag"), or wants their icon-only forms.
10
+ *
11
+ * Decided by the toolbar's own width, not the window's: a relation tab beside
12
+ * the split list is a narrow toolbar in a wide window, and its labelled
13
+ * controls overflowed the left group and were drawn over the search bar.
14
+ * `true` outside a toolbar.
15
+ */
16
+ function useToolbarLabels() {
17
+ return useContext(ToolbarLabelsContext);
18
+ }
19
+ /**
20
+ * Whether `row` — the toolbar's controls at their natural width — fits in
21
+ * `container`. Once it has not, the width the labelled controls needed is kept,
22
+ * and the labels come back only when the container has that much room again:
23
+ * measured on the icon-only row, they would always seem to fit.
24
+ */
25
+ function useLabelsFit(container, row) {
26
+ const [labelled, setLabelled] = useState(true);
27
+ const labelledRef = useRef(true);
28
+ const labelledWidth = useRef(void 0);
29
+ useLayoutEffect(() => {
30
+ const containerElement = container.current;
31
+ const rowElement = row.current;
32
+ if (!containerElement || !rowElement || typeof ResizeObserver === "undefined") return void 0;
33
+ const measure = () => {
34
+ const available = containerElement.clientWidth;
35
+ let next = labelledRef.current;
36
+ if (labelledRef.current) {
37
+ const needed = rowElement.scrollWidth;
38
+ if (needed > available + 1) {
39
+ labelledWidth.current = needed;
40
+ next = false;
41
+ }
42
+ } else if (labelledWidth.current !== void 0 && available >= labelledWidth.current) next = true;
43
+ if (next !== labelledRef.current) {
44
+ labelledRef.current = next;
45
+ setLabelled(next);
46
+ }
47
+ };
48
+ const observer = new ResizeObserver(measure);
49
+ observer.observe(containerElement);
50
+ observer.observe(rowElement);
51
+ measure();
52
+ return () => observer.disconnect();
53
+ }, [container, row]);
54
+ return labelled;
55
+ }
6
56
  function CollectionTableToolbar({ actions, actionsStart, loading, onTextSearch, title, viewModeToggle, initialSearchText, compact = false }) {
7
57
  const largeLayout = useLargeLayout();
8
58
  const { t } = useTranslation();
59
+ const containerRef = useRef(null);
60
+ const rowRef = useRef(null);
61
+ const labelled = useLabelsFit(containerRef, rowRef);
9
62
  const actionChildren = React.Children.toArray(actions);
10
63
  const addButton = actionChildren.length > 0 ? actionChildren[actionChildren.length - 1] : null;
11
64
  const secondaryActions = actionChildren.slice(0, -1);
12
- return /* @__PURE__ */ jsxs("div", {
13
- className: cls("no-scrollbar min-h-[52px] overflow-x-auto px-2 md:px-4 bg-surface-sheet flex flex-row justify-between items-center w-full"),
14
- children: [/* @__PURE__ */ jsxs("div", {
15
- className: "flex items-center gap-1 md:mr-4 mr-2 min-w-0",
16
- children: [
17
- !compact && viewModeToggle,
18
- title && /* @__PURE__ */ jsx("div", {
19
- className: "flex items-center",
20
- children: title
21
- }),
22
- actionsStart
23
- ]
24
- }), /* @__PURE__ */ jsxs("div", {
25
- className: "flex items-center gap-1",
26
- children: [
27
- largeLayout && !compact && loading && /* @__PURE__ */ jsx("div", {
28
- className: "mr-4",
29
- children: /* @__PURE__ */ jsx(CircularProgress, { size: "smallest" })
30
- }),
31
- !compact && onTextSearch && /* @__PURE__ */ jsx(SearchBar, {
32
- size: "small",
33
- placeholder: t("search"),
34
- onTextSearch,
35
- expandable: true,
36
- initialValue: initialSearchText
37
- }, "search-bar"),
38
- /* @__PURE__ */ jsx("div", {
65
+ return /* @__PURE__ */ jsx("div", {
66
+ ref: containerRef,
67
+ className: cls("no-scrollbar min-h-[52px] overflow-x-auto bg-surface-sheet flex w-full"),
68
+ children: /* @__PURE__ */ jsx("div", {
69
+ ref: rowRef,
70
+ className: "px-2 md:px-4 flex flex-row justify-between items-center min-w-full w-max",
71
+ children: /* @__PURE__ */ jsxs(ToolbarLabelsContext.Provider, {
72
+ value: labelled,
73
+ children: [/* @__PURE__ */ jsxs("div", {
74
+ className: "flex items-center gap-1 md:mr-4 mr-2",
75
+ children: [
76
+ !compact && viewModeToggle,
77
+ title && /* @__PURE__ */ jsx("div", {
78
+ className: "flex items-center",
79
+ children: title
80
+ }),
81
+ actionsStart
82
+ ]
83
+ }), /* @__PURE__ */ jsxs("div", {
39
84
  className: "flex items-center gap-1",
40
- children: secondaryActions
41
- }),
42
- addButton
43
- ]
44
- })]
85
+ children: [
86
+ largeLayout && !compact && loading && /* @__PURE__ */ jsx("div", {
87
+ className: "mr-4",
88
+ children: /* @__PURE__ */ jsx(CircularProgress, { size: "smallest" })
89
+ }),
90
+ !compact && onTextSearch && /* @__PURE__ */ jsx(SearchBar, {
91
+ size: "small",
92
+ placeholder: t("search"),
93
+ onTextSearch,
94
+ expandable: true,
95
+ initialValue: initialSearchText
96
+ }, "search-bar"),
97
+ /* @__PURE__ */ jsx("div", {
98
+ className: "flex items-center gap-1",
99
+ children: secondaryActions
100
+ }),
101
+ addButton
102
+ ]
103
+ })]
104
+ })
105
+ })
45
106
  });
46
107
  }
47
108
  //#endregion
48
- export { CollectionTableToolbar };
109
+ export { CollectionTableToolbar, useToolbarLabels };
49
110
 
50
111
  //# sourceMappingURL=CollectionTableToolbar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionTableToolbar.js","names":[],"sources":["../../../../src/components/CollectionTableBinding/internal/CollectionTableToolbar.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { CircularProgress, cls, SearchBar } from \"@rebasepro/ui\";\nimport { useLargeLayout, useTranslation } from \"@rebasepro/app\";\n\ninterface CollectionTableToolbarProps {\n loading: boolean;\n actionsStart?: React.ReactNode;\n actions?: React.ReactNode;\n /**\n * View mode toggle button, positioned left of the search bar.\n */\n viewModeToggle?: React.ReactNode;\n title?: React.ReactNode,\n onTextSearch?: (searchString?: string) => void;\n /**\n * Initial search string to pre-populate the search bar (e.g. from URL params).\n */\n initialSearchText?: string;\n /**\n * When true the toolbar is in \"compact\" mode for the split-view left panel.\n * - Search bar, loading spinner, and view-mode toggle are hidden.\n * - Secondary actions remain inline (displayed horizontally).\n * - Only `actionsStart` (filters) and the add button (last child of `actions`) remain visible.\n */\n compact?: boolean;\n}\n\nexport function CollectionTableToolbar({\n actions,\n actionsStart,\n loading,\n onTextSearch,\n title,\n viewModeToggle,\n initialSearchText,\n compact = false\n}: CollectionTableToolbarProps) {\n\n const largeLayout = useLargeLayout();\n const { t } = useTranslation();\n\n // Split actions into \"primary\" (add button = last child) and \"secondary\" (everything else)\n const actionChildren = React.Children.toArray(actions);\n const addButton = actionChildren.length > 0 ? actionChildren[actionChildren.length - 1] : null;\n const secondaryActions = actionChildren.slice(0, -1);\n\n return (\n <div\n className={cls(\"no-scrollbar min-h-[52px] overflow-x-auto px-2 md:px-4 bg-surface-sheet flex flex-row justify-between items-center w-full\")}>\n\n <div className=\"flex items-center gap-1 md:mr-4 mr-2 min-w-0\">\n\n {/* View toggle — hidden in compact */}\n {!compact && viewModeToggle}\n\n {title && <div className={\"flex items-center\"}>\n {title}\n </div>}\n\n {actionsStart}\n\n </div>\n\n <div className=\"flex items-center gap-1\">\n\n {/* Loading spinner — hidden in compact */}\n {largeLayout && !compact && loading && (\n <div className=\"mr-4\">\n <CircularProgress size={\"smallest\"}/>\n </div>\n )}\n\n {/* Search bar — hidden in compact */}\n {!compact && onTextSearch &&\n <SearchBar\n key={\"search-bar\"}\n size={\"small\"}\n placeholder={t(\"search\")}\n onTextSearch={onTextSearch}\n expandable={true}\n initialValue={initialSearchText}/>}\n\n {/* Secondary actions — always inline */}\n <div className=\"flex items-center gap-1\">\n {secondaryActions}\n </div>\n\n {/* Add button — always visible */}\n {addButton}\n\n </div>\n\n </div>\n );\n}\n"],"mappings":";;;;;AA4BA,SAAgB,uBAAuB,EACnC,SACA,cACA,SACA,cACA,OACA,gBACA,mBACA,UAAU,SACkB;CAE5B,MAAM,cAAc,eAAe;CACnC,MAAM,EAAE,MAAM,eAAe;CAG7B,MAAM,iBAAiB,MAAM,SAAS,QAAQ,OAAO;CACrD,MAAM,YAAY,eAAe,SAAS,IAAI,eAAe,eAAe,SAAS,KAAK;CAC1F,MAAM,mBAAmB,eAAe,MAAM,GAAG,EAAE;CAEnD,OACI,qBAAC,OAAD;EACI,WAAW,IAAI,2HAA2H;YAD9I,CAGI,qBAAC,OAAD;GAAK,WAAU;aAAf;IAGK,CAAC,WAAW;IAEZ,SAAS,oBAAC,OAAD;KAAK,WAAW;eACrB;IACA,CAAA;IAEJ;GAEA;MAEL,qBAAC,OAAD;GAAK,WAAU;aAAf;IAGK,eAAe,CAAC,WAAW,WACxB,oBAAC,OAAD;KAAK,WAAU;eACX,oBAAC,kBAAD,EAAkB,MAAM,WAAY,CAAA;IACnC,CAAA;IAIR,CAAC,WAAW,gBACT,oBAAC,WAAD;KAEI,MAAM;KACN,aAAa,EAAE,QAAQ;KACT;KACd,YAAY;KACZ,cAAc;IAAmB,GAL5B,YAK4B;IAGzC,oBAAC,OAAD;KAAK,WAAU;eACV;IACA,CAAA;IAGJ;GAEA;IAEJ;;AAEb"}
1
+ {"version":3,"file":"CollectionTableToolbar.js","names":[],"sources":["../../../../src/components/CollectionTableBinding/internal/CollectionTableToolbar.tsx"],"sourcesContent":["import React, { useContext, useLayoutEffect, useRef, useState } from \"react\";\n\nimport { CircularProgress, cls, SearchBar } from \"@rebasepro/ui\";\nimport { useLargeLayout, useTranslation } from \"@rebasepro/app\";\n\ninterface CollectionTableToolbarProps {\n loading: boolean;\n actionsStart?: React.ReactNode;\n actions?: React.ReactNode;\n /**\n * View mode toggle button, positioned left of the search bar.\n */\n viewModeToggle?: React.ReactNode;\n title?: React.ReactNode,\n onTextSearch?: (searchString?: string) => void;\n /**\n * Initial search string to pre-populate the search bar (e.g. from URL params).\n */\n initialSearchText?: string;\n /**\n * When true the toolbar is in \"compact\" mode for the split-view left panel.\n * - Search bar, loading spinner, and view-mode toggle are hidden.\n * - Secondary actions remain inline (displayed horizontally).\n * - Only `actionsStart` (filters) and the add button (last child of `actions`) remain visible.\n */\n compact?: boolean;\n}\n\nconst ToolbarLabelsContext = React.createContext(true);\n\n/**\n * Whether the toolbar this control sits in has room for its controls' labels\n * (\"Filters\", \"Add existing\", \"Add Tag\"), or wants their icon-only forms.\n *\n * Decided by the toolbar's own width, not the window's: a relation tab beside\n * the split list is a narrow toolbar in a wide window, and its labelled\n * controls overflowed the left group and were drawn over the search bar.\n * `true` outside a toolbar.\n */\nexport function useToolbarLabels(): boolean {\n return useContext(ToolbarLabelsContext);\n}\n\n/**\n * Whether `row` — the toolbar's controls at their natural width — fits in\n * `container`. Once it has not, the width the labelled controls needed is kept,\n * and the labels come back only when the container has that much room again:\n * measured on the icon-only row, they would always seem to fit.\n */\nfunction useLabelsFit(\n container: React.RefObject<HTMLDivElement | null>,\n row: React.RefObject<HTMLDivElement | null>\n): boolean {\n const [labelled, setLabelled] = useState(true);\n const labelledRef = useRef(true);\n const labelledWidth = useRef<number | undefined>(undefined);\n\n useLayoutEffect(() => {\n const containerElement = container.current;\n const rowElement = row.current;\n if (!containerElement || !rowElement || typeof ResizeObserver === \"undefined\") return undefined;\n\n const measure = () => {\n const available = containerElement.clientWidth;\n let next = labelledRef.current;\n if (labelledRef.current) {\n const needed = rowElement.scrollWidth;\n if (needed > available + 1) {\n labelledWidth.current = needed;\n next = false;\n }\n } else if (labelledWidth.current !== undefined && available >= labelledWidth.current) {\n next = true;\n }\n if (next !== labelledRef.current) {\n labelledRef.current = next;\n setLabelled(next);\n }\n };\n\n // The container for the room there is, the row for what the controls\n // take — a selection count appearing widens the row, not the toolbar.\n const observer = new ResizeObserver(measure);\n observer.observe(containerElement);\n observer.observe(rowElement);\n measure();\n return () => observer.disconnect();\n }, [container, row]);\n\n return labelled;\n}\n\nexport function CollectionTableToolbar({\n actions,\n actionsStart,\n loading,\n onTextSearch,\n title,\n viewModeToggle,\n initialSearchText,\n compact = false\n}: CollectionTableToolbarProps) {\n\n const largeLayout = useLargeLayout();\n const { t } = useTranslation();\n\n const containerRef = useRef<HTMLDivElement>(null);\n const rowRef = useRef<HTMLDivElement>(null);\n const labelled = useLabelsFit(containerRef, rowRef);\n\n // Split actions into \"primary\" (add button = last child) and \"secondary\" (everything else)\n const actionChildren = React.Children.toArray(actions);\n const addButton = actionChildren.length > 0 ? actionChildren[actionChildren.length - 1] : null;\n const secondaryActions = actionChildren.slice(0, -1);\n\n return (\n <div\n ref={containerRef}\n className={cls(\"no-scrollbar min-h-[52px] overflow-x-auto bg-surface-sheet flex w-full\")}>\n\n {/* At least as wide as the toolbar, and never narrower than its\n controls: the two groups cannot be squeezed into each other.\n When even the icon-only controls do not fit, the toolbar\n scrolls. */}\n <div\n ref={rowRef}\n className={\"px-2 md:px-4 flex flex-row justify-between items-center min-w-full w-max\"}>\n\n <ToolbarLabelsContext.Provider value={labelled}>\n\n <div className=\"flex items-center gap-1 md:mr-4 mr-2\">\n\n {/* View toggle — hidden in compact */}\n {!compact && viewModeToggle}\n\n {title && <div className={\"flex items-center\"}>\n {title}\n </div>}\n\n {actionsStart}\n\n </div>\n\n <div className=\"flex items-center gap-1\">\n\n {/* Loading spinner — hidden in compact */}\n {largeLayout && !compact && loading && (\n <div className=\"mr-4\">\n <CircularProgress size={\"smallest\"}/>\n </div>\n )}\n\n {/* Search bar — hidden in compact */}\n {!compact && onTextSearch &&\n <SearchBar\n key={\"search-bar\"}\n size={\"small\"}\n placeholder={t(\"search\")}\n onTextSearch={onTextSearch}\n expandable={true}\n initialValue={initialSearchText}/>}\n\n {/* Secondary actions — always inline */}\n <div className=\"flex items-center gap-1\">\n {secondaryActions}\n </div>\n\n {/* Add button — always visible */}\n {addButton}\n\n </div>\n\n </ToolbarLabelsContext.Provider>\n\n </div>\n\n </div>\n );\n}\n"],"mappings":";;;;;AA4BA,IAAM,uBAAuB,MAAM,cAAc,IAAI;;;;;;;;;;AAWrD,SAAgB,mBAA4B;CACxC,OAAO,WAAW,oBAAoB;AAC1C;;;;;;;AAQA,SAAS,aACL,WACA,KACO;CACP,MAAM,CAAC,UAAU,eAAe,SAAS,IAAI;CAC7C,MAAM,cAAc,OAAO,IAAI;CAC/B,MAAM,gBAAgB,OAA2B,KAAA,CAAS;CAE1D,sBAAsB;EAClB,MAAM,mBAAmB,UAAU;EACnC,MAAM,aAAa,IAAI;EACvB,IAAI,CAAC,oBAAoB,CAAC,cAAc,OAAO,mBAAmB,aAAa,OAAO,KAAA;EAEtF,MAAM,gBAAgB;GAClB,MAAM,YAAY,iBAAiB;GACnC,IAAI,OAAO,YAAY;GACvB,IAAI,YAAY,SAAS;IACrB,MAAM,SAAS,WAAW;IAC1B,IAAI,SAAS,YAAY,GAAG;KACxB,cAAc,UAAU;KACxB,OAAO;IACX;GACJ,OAAO,IAAI,cAAc,YAAY,KAAA,KAAa,aAAa,cAAc,SACzE,OAAO;GAEX,IAAI,SAAS,YAAY,SAAS;IAC9B,YAAY,UAAU;IACtB,YAAY,IAAI;GACpB;EACJ;EAIA,MAAM,WAAW,IAAI,eAAe,OAAO;EAC3C,SAAS,QAAQ,gBAAgB;EACjC,SAAS,QAAQ,UAAU;EAC3B,QAAQ;EACR,aAAa,SAAS,WAAW;CACrC,GAAG,CAAC,WAAW,GAAG,CAAC;CAEnB,OAAO;AACX;AAEA,SAAgB,uBAAuB,EACnC,SACA,cACA,SACA,cACA,OACA,gBACA,mBACA,UAAU,SACkB;CAE5B,MAAM,cAAc,eAAe;CACnC,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,SAAS,OAAuB,IAAI;CAC1C,MAAM,WAAW,aAAa,cAAc,MAAM;CAGlD,MAAM,iBAAiB,MAAM,SAAS,QAAQ,OAAO;CACrD,MAAM,YAAY,eAAe,SAAS,IAAI,eAAe,eAAe,SAAS,KAAK;CAC1F,MAAM,mBAAmB,eAAe,MAAM,GAAG,EAAE;CAEnD,OACI,oBAAC,OAAD;EACI,KAAK;EACL,WAAW,IAAI,wEAAwE;YAMvF,oBAAC,OAAD;GACI,KAAK;GACL,WAAW;aAEX,qBAAC,qBAAqB,UAAtB;IAA+B,OAAO;cAAtC,CAEI,qBAAC,OAAD;KAAK,WAAU;eAAf;MAGK,CAAC,WAAW;MAEZ,SAAS,oBAAC,OAAD;OAAK,WAAW;iBACrB;MACA,CAAA;MAEJ;KAEA;QAEL,qBAAC,OAAD;KAAK,WAAU;eAAf;MAGK,eAAe,CAAC,WAAW,WACxB,oBAAC,OAAD;OAAK,WAAU;iBACX,oBAAC,kBAAD,EAAkB,MAAM,WAAY,CAAA;MACnC,CAAA;MAIR,CAAC,WAAW,gBACT,oBAAC,WAAD;OAEI,MAAM;OACN,aAAa,EAAE,QAAQ;OACT;OACd,YAAY;OACZ,cAAc;MAAmB,GAL5B,YAK4B;MAGzC,oBAAC,OAAD;OAAK,WAAU;iBACV;MACA,CAAA;MAGJ;KAEA;MAEsB;;EAE9B,CAAA;CAEJ,CAAA;AAEb"}
@@ -24,7 +24,7 @@ function EntityTableCellActions({ showError, disabled, showExpandIcon, selected,
24
24
  size: "small",
25
25
  onClick: doOpenPopup,
26
26
  children: /* @__PURE__ */ jsxs("svg", {
27
- fill: "#888",
27
+ fill: "#838991",
28
28
  width: "20",
29
29
  height: "20",
30
30
  viewBox: "0 0 24 24",
@@ -1 +1 @@
1
- {"version":3,"file":"EntityTableCellActions.js","names":[],"sources":["../../../../src/components/CollectionTableBinding/internal/EntityTableCellActions.tsx"],"sourcesContent":["import { AlertCircleIcon, IconButton } from \"@rebasepro/ui\";\nimport { ErrorTooltip, useTranslation } from \"@rebasepro/app\";\nimport { useCallback, useEffect, useRef } from \"react\";\n\nexport interface EntityTableCellActionsProps {\n showError: false | Error | undefined;\n disabled: boolean;\n showExpandIcon: boolean | undefined;\n selected: boolean | undefined;\n openPopup?: (cellRect: DOMRect | undefined) => void;\n children?: React.ReactNode;\n}\n\nexport function EntityTableCellActions({\n showError,\n disabled,\n showExpandIcon,\n selected,\n openPopup,\n children\n}: EntityTableCellActionsProps) {\n const { t } = useTranslation();\n\n const ref = useRef<HTMLDivElement>(null);\n const doOpenPopup = useCallback(() => {\n if (openPopup) {\n const cellRect = ref && ref?.current?.getBoundingClientRect();\n openPopup(cellRect);\n }\n }, []);\n\n const iconRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (iconRef.current && selected) {\n iconRef.current.focus({ preventScroll: true });\n }\n }, [selected]);\n\n return <>\n {(showError || (!disabled && showExpandIcon)) &&\n <div ref={ref} className=\"absolute top-0.5 right-0.5 flex items-center\">\n {selected && children}\n\n {selected && !disabled && showExpandIcon &&\n <IconButton aria-label={t(\"expand\")}\n ref={iconRef}\n size={\"small\"}\n onClick={doOpenPopup}>\n <svg\n fill={\"#888\"}\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\">\n <path className=\"cls-2\"\n d=\"M20,5a1,1,0,0,0-1-1L14,4h0a1,1,0,0,0,0,2h2.57L13.29,9.29a1,1,0,0,0,0,1.42,1,1,0,0,0,1.42,0L18,7.42V10a1,1,0,0,0,1,1h0a1,1,0,0,0,1-1Z\"/>\n <path className=\"cls-2\"\n d=\"M10.71,13.29a1,1,0,0,0-1.42,0L6,16.57V14a1,1,0,0,0-1-1H5a1,1,0,0,0-1,1l0,5a1,1,0,0,0,1,1h5a1,1,0,0,0,0-2H7.42l3.29-3.29A1,1,0,0,0,10.71,13.29Z\"/>\n </svg>\n </IconButton>\n }\n\n {showError && <ErrorTooltip\n side={\"left\"}\n title={showError.message}>\n <div\n className={\"flex items-center justify-center\"}\n style={{\n width: 32,\n height: 32\n }}>\n <AlertCircleIcon\n />\n </div>\n </ErrorTooltip>\n }\n\n </div>\n }\n </>;\n}\n"],"mappings":";;;;;AAaA,SAAgB,uBAAuB,EACnC,WACA,UACA,gBACA,UACA,WACA,YAC4B;CAC5B,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,cAAc,kBAAkB;EAClC,IAAI,WAEA,UADiB,OAAO,KAAK,SAAS,sBAAsB,CAC1C;CAE1B,GAAG,CAAC,CAAC;CAEL,MAAM,UAAU,OAA0B,IAAI;CAC9C,gBAAgB;EACZ,IAAI,QAAQ,WAAW,UACnB,QAAQ,QAAQ,MAAM,EAAE,eAAe,KAAK,CAAC;CAErD,GAAG,CAAC,QAAQ,CAAC;CAEb,OAAO,oBAAA,UAAA,EAAA,WACD,aAAc,CAAC,YAAY,mBACzB,qBAAC,OAAD;EAAU;EAAK,WAAU;YAAzB;GACK,YAAY;GAEZ,YAAY,CAAC,YAAY,kBACtB,oBAAC,YAAD;IAAY,cAAY,EAAE,QAAQ;IAC9B,KAAK;IACL,MAAM;IACN,SAAS;cACT,qBAAC,OAAD;KACI,MAAM;KACN,OAAM;KACN,QAAO;KACP,SAAQ;eAJZ,CAKI,oBAAC,QAAD;MAAM,WAAU;MACZ,GAAE;KAAuI,CAAA,GAC7I,oBAAC,QAAD;MAAM,WAAU;MACZ,GAAE;KAAiJ,CAAA,CACtJ;;GACG,CAAA;GAGf,aAAa,oBAAC,cAAD;IACV,MAAM;IACN,OAAO,UAAU;cACjB,oBAAC,OAAD;KACI,WAAW;KACX,OAAO;MACH,OAAO;MACP,QAAQ;KACZ;eACA,oBAAC,iBAAD,CACC,CAAA;IACA,CAAA;GACK,CAAA;EAGb;IAEX,CAAA;AACN"}
1
+ {"version":3,"file":"EntityTableCellActions.js","names":[],"sources":["../../../../src/components/CollectionTableBinding/internal/EntityTableCellActions.tsx"],"sourcesContent":["import { AlertCircleIcon, IconButton } from \"@rebasepro/ui\";\nimport { ErrorTooltip, useTranslation } from \"@rebasepro/app\";\nimport { useCallback, useEffect, useRef } from \"react\";\n\nexport interface EntityTableCellActionsProps {\n showError: false | Error | undefined;\n disabled: boolean;\n showExpandIcon: boolean | undefined;\n selected: boolean | undefined;\n openPopup?: (cellRect: DOMRect | undefined) => void;\n children?: React.ReactNode;\n}\n\nexport function EntityTableCellActions({\n showError,\n disabled,\n showExpandIcon,\n selected,\n openPopup,\n children\n}: EntityTableCellActionsProps) {\n const { t } = useTranslation();\n\n const ref = useRef<HTMLDivElement>(null);\n const doOpenPopup = useCallback(() => {\n if (openPopup) {\n const cellRect = ref && ref?.current?.getBoundingClientRect();\n openPopup(cellRect);\n }\n }, []);\n\n const iconRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (iconRef.current && selected) {\n iconRef.current.focus({ preventScroll: true });\n }\n }, [selected]);\n\n return <>\n {(showError || (!disabled && showExpandIcon)) &&\n <div ref={ref} className=\"absolute top-0.5 right-0.5 flex items-center\">\n {selected && children}\n\n {selected && !disabled && showExpandIcon &&\n <IconButton aria-label={t(\"expand\")}\n ref={iconRef}\n size={\"small\"}\n onClick={doOpenPopup}>\n <svg\n fill={\"#838991\"}\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\">\n <path className=\"cls-2\"\n d=\"M20,5a1,1,0,0,0-1-1L14,4h0a1,1,0,0,0,0,2h2.57L13.29,9.29a1,1,0,0,0,0,1.42,1,1,0,0,0,1.42,0L18,7.42V10a1,1,0,0,0,1,1h0a1,1,0,0,0,1-1Z\"/>\n <path className=\"cls-2\"\n d=\"M10.71,13.29a1,1,0,0,0-1.42,0L6,16.57V14a1,1,0,0,0-1-1H5a1,1,0,0,0-1,1l0,5a1,1,0,0,0,1,1h5a1,1,0,0,0,0-2H7.42l3.29-3.29A1,1,0,0,0,10.71,13.29Z\"/>\n </svg>\n </IconButton>\n }\n\n {showError && <ErrorTooltip\n side={\"left\"}\n title={showError.message}>\n <div\n className={\"flex items-center justify-center\"}\n style={{\n width: 32,\n height: 32\n }}>\n <AlertCircleIcon\n />\n </div>\n </ErrorTooltip>\n }\n\n </div>\n }\n </>;\n}\n"],"mappings":";;;;;AAaA,SAAgB,uBAAuB,EACnC,WACA,UACA,gBACA,UACA,WACA,YAC4B;CAC5B,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,cAAc,kBAAkB;EAClC,IAAI,WAEA,UADiB,OAAO,KAAK,SAAS,sBAAsB,CAC1C;CAE1B,GAAG,CAAC,CAAC;CAEL,MAAM,UAAU,OAA0B,IAAI;CAC9C,gBAAgB;EACZ,IAAI,QAAQ,WAAW,UACnB,QAAQ,QAAQ,MAAM,EAAE,eAAe,KAAK,CAAC;CAErD,GAAG,CAAC,QAAQ,CAAC;CAEb,OAAO,oBAAA,UAAA,EAAA,WACD,aAAc,CAAC,YAAY,mBACzB,qBAAC,OAAD;EAAU;EAAK,WAAU;YAAzB;GACK,YAAY;GAEZ,YAAY,CAAC,YAAY,kBACtB,oBAAC,YAAD;IAAY,cAAY,EAAE,QAAQ;IAC9B,KAAK;IACL,MAAM;IACN,SAAS;cACT,qBAAC,OAAD;KACI,MAAM;KACN,OAAM;KACN,QAAO;KACP,SAAQ;eAJZ,CAKI,oBAAC,QAAD;MAAM,WAAU;MACZ,GAAE;KAAuI,CAAA,GAC7I,oBAAC,QAAD;MAAM,WAAU;MACZ,GAAE;KAAiJ,CAAA,CACtJ;;GACG,CAAA;GAGf,aAAa,oBAAC,cAAD;IACV,MAAM;IACN,OAAO,UAAU;cACjB,oBAAC,OAAD;KACI,WAAW;KACX,OAAO;MACH,OAAO;MACP,QAAQ;KACZ;eACA,oBAAC,iBAAD,CACC,CAAA;IACA,CAAA;GACK,CAAA;EAGb;IAEX,CAAA;AACN"}
@@ -1,4 +1,5 @@
1
1
  import { useAdminContext } from "../../hooks/useAdminContext.js";
2
+ import { useToolbarLabels } from "../CollectionTableBinding/internal/CollectionTableToolbar.js";
2
3
  import { useCollectionEditorController } from "../../collection_editor/useCollectionEditorController.js";
3
4
  import { EditorCollectionAction } from "../../collection_editor/ui/EditorCollectionAction.js";
4
5
  import React, { Suspense } from "react";
@@ -13,11 +14,13 @@ function CollectionViewActions({ collection, relativePath, parentCollectionSlugs
13
14
  const context = useAdminContext();
14
15
  const { canCreate, canDelete } = usePermissions();
15
16
  const largeLayout = useLargeLayout();
17
+ const toolbarLabels = useToolbarLabels();
18
+ const labelled = largeLayout && !compact && toolbarLabels;
16
19
  const { t } = useTranslation();
17
20
  const collectionEditorController = useCollectionEditorController();
18
21
  const hasCollectionEditor = Boolean(collectionEditorController?.editCollection);
19
22
  const { selectedCount, hasSelection } = selectionController;
20
- const addButton = canCreate(collection, path) && onNewClick && (largeLayout && !compact ? /* @__PURE__ */ jsx(Button, {
23
+ const addButton = canCreate(collection, path) && onNewClick && (labelled ? /* @__PURE__ */ jsx(Button, {
21
24
  id: `add_entity_${path}`,
22
25
  onClick: onNewClick,
23
26
  startIcon: /* @__PURE__ */ jsx(PlusIcon, { size: iconSize.small }),
@@ -34,7 +37,7 @@ function CollectionViewActions({ collection, relativePath, parentCollectionSlugs
34
37
  "aria-label": t("add_specific", { name: collection.singularName ?? collection.name }),
35
38
  children: /* @__PURE__ */ jsx(PlusIcon, { size: iconSize.small })
36
39
  }));
37
- const linkButton = onAddExistingClick && (largeLayout && !compact ? /* @__PURE__ */ jsx(Button, {
40
+ const linkButton = onAddExistingClick && (labelled ? /* @__PURE__ */ jsx(Button, {
38
41
  id: `link_entity_${path}`,
39
42
  onClick: onAddExistingClick,
40
43
  startIcon: /* @__PURE__ */ jsx(Link2Icon, { size: iconSize.small }),
@@ -58,7 +61,7 @@ function CollectionViewActions({ collection, relativePath, parentCollectionSlugs
58
61
  let multipleDeleteButton;
59
62
  if (hasSelection) {
60
63
  const RemoveIcon = removeUnlinks ? Unlink2Icon : Trash2Icon;
61
- const button = largeLayout && !compact ? /* @__PURE__ */ jsxs(Button, {
64
+ const button = labelled ? /* @__PURE__ */ jsxs(Button, {
62
65
  variant: "text",
63
66
  disabled: !multipleDeleteEnabled,
64
67
  startIcon: /* @__PURE__ */ jsx(RemoveIcon, {
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionViewActions.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewActions.tsx"],"sourcesContent":["\n\nimport React, { Suspense } from \"react\";\n\nimport { useLargeLayout, useTranslation, useSlot, resolveComponentRef } from \"@rebasepro/app\";\nimport { CollectionActionsProps, EntityTableController, SelectionController, AdminCollection } from \"@rebasepro/cms-types\";\nimport { Button, IconButton, Tooltip, Popover, iconSize, lazyChunk } from \"@rebasepro/ui\";\nimport { ErrorBoundary, Link2Icon, MoreVerticalIcon, PlusIcon, Trash2Icon, Unlink2Icon } from \"@rebasepro/ui\";\nimport { usePermissions } from \"@rebasepro/app\";\nimport { toArray } from \"@rebasepro/utils\";\n// Lazy-load import/export — pulls in exceljs only on demand\nconst ImportCollectionAction = lazyChunk(() => import(\"../../data_import/import\").then(m => ({ default: m.ImportCollectionAction })));\nconst ExportCollectionAction = lazyChunk(() => import(\"../../data_export/export\").then(m => ({ default: m.ExportCollectionAction })));\nimport { EditorCollectionAction } from \"../../collection_editor/ui/EditorCollectionAction\";\nimport { useCollectionEditorController } from \"../../collection_editor/useCollectionEditorController\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\n\nexport type CollectionViewActionsProps<M extends Record<string, unknown>> = {\n collection: AdminCollection<M>;\n path: string;\n relativePath: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n selectionEnabled: boolean;\n onNewClick: () => void;\n /**\n * Attach a row that already exists to this parent. Only supplied for a\n * junction-backed tab, where the parent owns the link rather than the row.\n */\n onAddExistingClick?: () => void;\n onMultipleDeleteClick: () => void;\n /**\n * The rows are shared with other records through a junction, so removing\n * them unlinks them from this record and deletes nothing. The bin says so.\n */\n removeUnlinks?: boolean;\n selectionController: SelectionController<M>;\n tableController: EntityTableController<M>;\n collectionEntitiesCount?: number;\n compact?: boolean;\n children?: React.ReactNode;\n openNewDocument: (defaultValues?: Record<string, unknown>) => void;\n}\n\nexport function CollectionViewActions<M extends Record<string, unknown>>({\n collection,\n relativePath,\n parentCollectionSlugs, parentEntityIds,\n onNewClick,\n onAddExistingClick,\n onMultipleDeleteClick,\n removeUnlinks,\n selectionEnabled,\n path,\n selectionController,\n tableController,\n collectionEntitiesCount,\n compact,\n children,\n openNewDocument\n}: CollectionViewActionsProps<M>) {\n const context = useAdminContext();\n\n const { canCreate, canDelete } = usePermissions();\n\n const largeLayout = useLargeLayout();\n const { t } = useTranslation();\n\n // Check if the collection editor context is available (ConfigControllerProvider present)\n const collectionEditorController = useCollectionEditorController();\n const hasCollectionEditor = Boolean(collectionEditorController?.editCollection);\n\n const { selectedCount, hasSelection } = selectionController;\n\n const addButton = canCreate(collection, path) &&\n onNewClick && (largeLayout && !compact\n ? <Button\n id={`add_entity_${path}`}\n onClick={onNewClick}\n startIcon={<PlusIcon size={iconSize.small}/>}\n size=\"small\"\n variant=\"filled\"\n color=\"primary\">\n {t(\"add_specific\", { name: collection.singularName ?? collection.name })}\n </Button>\n // In the compact split-list toolbar the add action is the one filled\n // control: a rounded square, so it reads as a button and not a badge.\n : <IconButton\n id={`add_entity_${path}`}\n onClick={onNewClick}\n variant=\"filled\"\n shape=\"square\"\n size=\"small\"\n aria-label={t(\"add_specific\", { name: collection.singularName ?? collection.name })}\n >\n <PlusIcon size={iconSize.small}/>\n </IconButton>);\n\n // On a junction-backed tab, creating a row is only half of what \"add\" means:\n // the far more common act is attaching one that already exists. There was no\n // way to do that at all — the junction row was only ever written alongside an\n // insert — so a shared vocabulary could only ever grow.\n const linkButton = onAddExistingClick && (largeLayout && !compact\n ? <Button\n id={`link_entity_${path}`}\n onClick={onAddExistingClick}\n startIcon={<Link2Icon size={iconSize.small}/>}\n size=\"small\"\n variant=\"outlined\"\n color=\"neutral\">\n {t(\"add_existing\")}\n </Button>\n : <Tooltip title={t(\"add_existing\")}>\n <Button\n id={`link_entity_${path}`}\n onClick={onAddExistingClick}\n variant=\"outlined\"\n color=\"neutral\"\n size=\"small\">\n <Link2Icon size={iconSize.small}/>\n </Button>\n </Tooltip>);\n\n const multipleDeleteEnabled = canDelete(collection, path, null);\n\n // Only once something is selected. A permanently-disabled bin sat in every\n // collection toolbar — and in the split view, where the toolbar is a narrow\n // strip above the list, it was a third of the visible controls doing\n // nothing. It appears the moment you tick a row, which is when you want it.\n\n // `undefined` is \"every matching row, and nobody knows how many\" — a full\n // selection against an accessor with no `count`. Rendering it as 0 would\n // say the opposite of what is true.\n const countLabel = selectedCount === undefined ? \"…\" : selectedCount.toLocaleString();\n\n let multipleDeleteButton: React.ReactNode | undefined;\n if (hasSelection) {\n const RemoveIcon = removeUnlinks ? Unlink2Icon : Trash2Icon;\n const button = largeLayout && !compact\n // `min-w`, not `w`. A fixed 80px was enough for the one- and\n // two-digit counts you could reach by ticking rows; \"select all\n // matching\" put six digits in here, and a flex child over its width\n // compresses — so the bin itself was what gave way, shrinking to a\n // sliver beside the number. The width is a floor now, so the\n // control still holds its place in the toolbar when the count is\n // short, and `shrink-0` means the icon can never be the thing that\n // gives.\n ? <Button\n variant={\"text\"}\n disabled={!multipleDeleteEnabled}\n startIcon={<RemoveIcon size={iconSize.small} className={\"shrink-0\"}/>}\n onClick={onMultipleDeleteClick}\n color={\"neutral\"}\n className=\"lg:min-w-20\"\n >\n ({countLabel})\n </Button>\n : <IconButton aria-label={t(\"delete_selected\")}\n size={\"small\"}\n disabled={!multipleDeleteEnabled}\n onClick={onMultipleDeleteClick}>\n <RemoveIcon size={iconSize.small}/>\n </IconButton>;\n multipleDeleteButton =\n <Tooltip\n title={multipleDeleteEnabled\n ? (removeUnlinks ? t(\"remove_from_record\") : t(\"delete\"))\n : t(\"delete_not_allowed\")}>\n {button}\n </Tooltip>\n }\n\n const actionProps: CollectionActionsProps<M> = {\n path,\n relativePath,\n parentCollectionSlugs,\nparentEntityIds,\n collection,\n selectionController,\n context,\n tableController,\n collectionEntitiesCount,\n openNewDocument\n };\n\n const actions = toArray(collection.Actions)\n .map((actionRef, i) => {\n const Action = resolveComponentRef(actionRef);\n if (!Action) return null;\n return (\n <ErrorBoundary key={`actions_${i}`}>\n <Suspense fallback={null}>\n <Action {...actionProps}/>\n </Suspense>\n </ErrorBoundary>\n );\n });\n\n const pluginActions = useSlot(\"collection.actions\", actionProps as CollectionActionsProps);\n\n const secondaryActions = (\n <>\n {children}\n <ErrorBoundary>\n {actions}\n {pluginActions}\n </ErrorBoundary>\n <ErrorBoundary>\n <Suspense fallback={null}>\n <ImportCollectionAction {...(actionProps as CollectionActionsProps)}/>\n </Suspense>\n </ErrorBoundary>\n <ErrorBoundary>\n <Suspense fallback={null}>\n <ExportCollectionAction {...(actionProps as CollectionActionsProps)}/>\n </Suspense>\n </ErrorBoundary>\n {hasCollectionEditor && (\n <ErrorBoundary>\n <EditorCollectionAction {...(actionProps as CollectionActionsProps)}/>\n </ErrorBoundary>\n )}\n </>\n );\n\n const [overflowOpen, setOverflowOpen] = React.useState(false);\n\n return (\n <div className=\"flex items-center gap-1\">\n {!compact ? (\n secondaryActions\n ) : (\n <Popover\n open={overflowOpen}\n onOpenChange={setOverflowOpen}\n trigger={\n <IconButton aria-label={t(\"more_actions\")} size=\"small\">\n <MoreVerticalIcon size={iconSize.smallest}/>\n </IconButton>\n }>\n <div className=\"flex flex-row items-center gap-1 p-2\">\n {secondaryActions}\n </div>\n </Popover>\n )}\n {multipleDeleteButton}\n {linkButton}\n {addButton}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAWA,IAAM,yBAAyB,gBAAgB,OAAO,oCAA2B,CAAC,MAAK,OAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AACpI,IAAM,yBAAyB,gBAAgB,OAAO,oCAA2B,CAAC,MAAK,O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,oBAAC,wBAAD,EAAwB,GAAK,YAAwC,CAAA;EAC/D,CAAA,EACC,CAAA;EACf,oBAAC,eAAD,EAAA,UACI,oBAAC,UAAD;GAAU,UAAU;aAChB,oBAAC,wBAAD,EAAwB,GAAK,YAAwC,CAAA;EAC/D,CAAA,EACC,CAAA;EACd,uBACG,oBAAC,eAAD,EAAA,UACI,oBAAC,wBAAD,EAAwB,GAAK,YAAwC,CAAA,EAC1D,CAAA;CAErB,EAAA,CAAA;CAGN,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAS,KAAK;CAE5D,OACI,qBAAC,OAAD;EAAK,WAAU;YAAf;GACK,CAAC,UACE,mBAEA,oBAAC,SAAD;IACI,MAAM;IACN,cAAc;IACd,SACI,oBAAC,YAAD;KAAY,cAAY,EAAE,cAAc;KAAG,MAAK;eAC5C,oBAAC,kBAAD,EAAkB,MAAM,SAAS,SAAU,CAAA;IACnC,CAAA;cAEhB,oBAAC,OAAD;KAAK,WAAU;eACV;IACA,CAAA;GACA,CAAA;GAEZ;GACA;GACA;EACA;;AAEb"}
1
+ {"version":3,"file":"CollectionViewActions.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewActions.tsx"],"sourcesContent":["\n\nimport React, { Suspense } from \"react\";\n\nimport { useLargeLayout, useTranslation, useSlot, resolveComponentRef } from \"@rebasepro/app\";\nimport { CollectionActionsProps, EntityTableController, SelectionController, AdminCollection } from \"@rebasepro/cms-types\";\nimport { Button, IconButton, Tooltip, Popover, iconSize, lazyChunk } from \"@rebasepro/ui\";\nimport { ErrorBoundary, Link2Icon, MoreVerticalIcon, PlusIcon, Trash2Icon, Unlink2Icon } from \"@rebasepro/ui\";\nimport { usePermissions } from \"@rebasepro/app\";\nimport { toArray } from \"@rebasepro/utils\";\n// Lazy-load import/export — pulls in exceljs only on demand\nconst ImportCollectionAction = lazyChunk(() => import(\"../../data_import/import\").then(m => ({ default: m.ImportCollectionAction })));\nconst ExportCollectionAction = lazyChunk(() => import(\"../../data_export/export\").then(m => ({ default: m.ExportCollectionAction })));\nimport { EditorCollectionAction } from \"../../collection_editor/ui/EditorCollectionAction\";\nimport { useCollectionEditorController } from \"../../collection_editor/useCollectionEditorController\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { useToolbarLabels } from \"../CollectionTableBinding/internal/CollectionTableToolbar\";\n\nexport type CollectionViewActionsProps<M extends Record<string, unknown>> = {\n collection: AdminCollection<M>;\n path: string;\n relativePath: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n selectionEnabled: boolean;\n onNewClick: () => void;\n /**\n * Attach a row that already exists to this parent. Only supplied for a\n * junction-backed tab, where the parent owns the link rather than the row.\n */\n onAddExistingClick?: () => void;\n onMultipleDeleteClick: () => void;\n /**\n * The rows are shared with other records through a junction, so removing\n * them unlinks them from this record and deletes nothing. The bin says so.\n */\n removeUnlinks?: boolean;\n selectionController: SelectionController<M>;\n tableController: EntityTableController<M>;\n collectionEntitiesCount?: number;\n compact?: boolean;\n children?: React.ReactNode;\n openNewDocument: (defaultValues?: Record<string, unknown>) => void;\n}\n\nexport function CollectionViewActions<M extends Record<string, unknown>>({\n collection,\n relativePath,\n parentCollectionSlugs, parentEntityIds,\n onNewClick,\n onAddExistingClick,\n onMultipleDeleteClick,\n removeUnlinks,\n selectionEnabled,\n path,\n selectionController,\n tableController,\n collectionEntitiesCount,\n compact,\n children,\n openNewDocument\n}: CollectionViewActionsProps<M>) {\n const context = useAdminContext();\n\n const { canCreate, canDelete } = usePermissions();\n\n const largeLayout = useLargeLayout();\n const toolbarLabels = useToolbarLabels();\n // Labelled controls on a wide layout whose toolbar has room for them;\n // their icon-only forms otherwise.\n const labelled = largeLayout && !compact && toolbarLabels;\n const { t } = useTranslation();\n\n // Check if the collection editor context is available (ConfigControllerProvider present)\n const collectionEditorController = useCollectionEditorController();\n const hasCollectionEditor = Boolean(collectionEditorController?.editCollection);\n\n const { selectedCount, hasSelection } = selectionController;\n\n const addButton = canCreate(collection, path) &&\n onNewClick && (labelled\n ? <Button\n id={`add_entity_${path}`}\n onClick={onNewClick}\n startIcon={<PlusIcon size={iconSize.small}/>}\n size=\"small\"\n variant=\"filled\"\n color=\"primary\">\n {t(\"add_specific\", { name: collection.singularName ?? collection.name })}\n </Button>\n // In the compact split-list toolbar the add action is the one filled\n // control: a rounded square, so it reads as a button and not a badge.\n : <IconButton\n id={`add_entity_${path}`}\n onClick={onNewClick}\n variant=\"filled\"\n shape=\"square\"\n size=\"small\"\n aria-label={t(\"add_specific\", { name: collection.singularName ?? collection.name })}\n >\n <PlusIcon size={iconSize.small}/>\n </IconButton>);\n\n // On a junction-backed tab, creating a row is only half of what \"add\" means:\n // the far more common act is attaching one that already exists. There was no\n // way to do that at all — the junction row was only ever written alongside an\n // insert — so a shared vocabulary could only ever grow.\n const linkButton = onAddExistingClick && (labelled\n ? <Button\n id={`link_entity_${path}`}\n onClick={onAddExistingClick}\n startIcon={<Link2Icon size={iconSize.small}/>}\n size=\"small\"\n variant=\"outlined\"\n color=\"neutral\">\n {t(\"add_existing\")}\n </Button>\n : <Tooltip title={t(\"add_existing\")}>\n <Button\n id={`link_entity_${path}`}\n onClick={onAddExistingClick}\n variant=\"outlined\"\n color=\"neutral\"\n size=\"small\">\n <Link2Icon size={iconSize.small}/>\n </Button>\n </Tooltip>);\n\n const multipleDeleteEnabled = canDelete(collection, path, null);\n\n // Only once something is selected. A permanently-disabled bin sat in every\n // collection toolbar — and in the split view, where the toolbar is a narrow\n // strip above the list, it was a third of the visible controls doing\n // nothing. It appears the moment you tick a row, which is when you want it.\n\n // `undefined` is \"every matching row, and nobody knows how many\" — a full\n // selection against an accessor with no `count`. Rendering it as 0 would\n // say the opposite of what is true.\n const countLabel = selectedCount === undefined ? \"…\" : selectedCount.toLocaleString();\n\n let multipleDeleteButton: React.ReactNode | undefined;\n if (hasSelection) {\n const RemoveIcon = removeUnlinks ? Unlink2Icon : Trash2Icon;\n const button = labelled\n // `min-w`, not `w`. A fixed 80px was enough for the one- and\n // two-digit counts you could reach by ticking rows; \"select all\n // matching\" put six digits in here, and a flex child over its width\n // compresses — so the bin itself was what gave way, shrinking to a\n // sliver beside the number. The width is a floor now, so the\n // control still holds its place in the toolbar when the count is\n // short, and `shrink-0` means the icon can never be the thing that\n // gives.\n ? <Button\n variant={\"text\"}\n disabled={!multipleDeleteEnabled}\n startIcon={<RemoveIcon size={iconSize.small} className={\"shrink-0\"}/>}\n onClick={onMultipleDeleteClick}\n color={\"neutral\"}\n className=\"lg:min-w-20\"\n >\n ({countLabel})\n </Button>\n : <IconButton aria-label={t(\"delete_selected\")}\n size={\"small\"}\n disabled={!multipleDeleteEnabled}\n onClick={onMultipleDeleteClick}>\n <RemoveIcon size={iconSize.small}/>\n </IconButton>;\n multipleDeleteButton =\n <Tooltip\n title={multipleDeleteEnabled\n ? (removeUnlinks ? t(\"remove_from_record\") : t(\"delete\"))\n : t(\"delete_not_allowed\")}>\n {button}\n </Tooltip>\n }\n\n const actionProps: CollectionActionsProps<M> = {\n path,\n relativePath,\n parentCollectionSlugs,\nparentEntityIds,\n collection,\n selectionController,\n context,\n tableController,\n collectionEntitiesCount,\n openNewDocument\n };\n\n const actions = toArray(collection.Actions)\n .map((actionRef, i) => {\n const Action = resolveComponentRef(actionRef);\n if (!Action) return null;\n return (\n <ErrorBoundary key={`actions_${i}`}>\n <Suspense fallback={null}>\n <Action {...actionProps}/>\n </Suspense>\n </ErrorBoundary>\n );\n });\n\n const pluginActions = useSlot(\"collection.actions\", actionProps as CollectionActionsProps);\n\n const secondaryActions = (\n <>\n {children}\n <ErrorBoundary>\n {actions}\n {pluginActions}\n </ErrorBoundary>\n <ErrorBoundary>\n <Suspense fallback={null}>\n <ImportCollectionAction {...(actionProps as CollectionActionsProps)}/>\n </Suspense>\n </ErrorBoundary>\n <ErrorBoundary>\n <Suspense fallback={null}>\n <ExportCollectionAction {...(actionProps as CollectionActionsProps)}/>\n </Suspense>\n </ErrorBoundary>\n {hasCollectionEditor && (\n <ErrorBoundary>\n <EditorCollectionAction {...(actionProps as CollectionActionsProps)}/>\n </ErrorBoundary>\n )}\n </>\n );\n\n const [overflowOpen, setOverflowOpen] = React.useState(false);\n\n return (\n <div className=\"flex items-center gap-1\">\n {!compact ? (\n secondaryActions\n ) : (\n <Popover\n open={overflowOpen}\n onOpenChange={setOverflowOpen}\n trigger={\n <IconButton aria-label={t(\"more_actions\")} size=\"small\">\n <MoreVerticalIcon size={iconSize.smallest}/>\n </IconButton>\n }>\n <div className=\"flex flex-row items-center gap-1 p-2\">\n {secondaryActions}\n </div>\n </Popover>\n )}\n {multipleDeleteButton}\n {linkButton}\n {addButton}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAM,yBAAyB,gBAAgB,OAAO,oCAA2B,CAAC,MAAK,OAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AACpI,IAAM,yBAAyB,gBAAgB,OAAO,oCAA2B,CAAC,MAAK,OAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAgCpI,SAAgB,sBAAyD,EACrE,YACA,cACA,uBAAuB,iBACvB,YACA,oBACA,uBACA,eACA,kBACA,MACA,qBACA,iBACA,yBACA,SACA,UACA,mBAC8B;CAC9B,MAAM,UAAU,gBAAgB;CAEhC,MAAM,EAAE,WAAW,cAAc,eAAe;CAEhD,MAAM,cAAc,eAAe;CACnC,MAAM,gBAAgB,iBAAiB;CAGvC,MAAM,WAAW,eAAe,CAAC,WAAW;CAC5C,MAAM,EAAE,MAAM,eAAe;CAG7B,MAAM,6BAA6B,8BAA8B;CACjE,MAAM,sBAAsB,QAAQ,4BAA4B,cAAc;CAE9E,MAAM,EAAE,eAAe,iBAAiB;CAExC,MAAM,YAAY,UAAU,YAAY,IAAI,KACxC,eAAe,WACT,oBAAC,QAAD;EACE,IAAI,cAAc;EAClB,SAAS;EACT,WAAW,oBAAC,UAAD,EAAU,MAAM,SAAS,MAAO,CAAA;EAC3C,MAAK;EACL,SAAQ;EACR,OAAM;YACL,E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ACA,CAAA;GAEZ;GACA;GACA;EACA;;AAEb"}
@@ -1,5 +1,6 @@
1
1
  import { useUrlController } from "../../hooks/navigation/contexts/UrlContext.js";
2
2
  import { useAdminContext } from "../../hooks/useAdminContext.js";
3
+ import { useToolbarLabels } from "../CollectionTableBinding/internal/CollectionTableToolbar.js";
3
4
  import { withListState } from "../../util/view_mode.js";
4
5
  import { SelectionMenu } from "../../selection/SelectionMenu.js";
5
6
  import { useSplitView } from "./SplitViewContext.js";
@@ -16,6 +17,7 @@ import { useNavigate } from "react-router";
16
17
  function CollectionViewStartActions({ collection, relativePath, parentCollectionSlugs, parentEntityIds, path, selectionController, tableController, collectionEntitiesCount, entitiesCount, resolvedProperties, viewMode, selectionEnabled, selectionQuery, compact, openNewDocument }) {
17
18
  const context = useAdminContext();
18
19
  const largeLayout = useLargeLayout();
20
+ const toolbarLabels = useToolbarLabels();
19
21
  const { t } = useTranslation();
20
22
  const navigate = useNavigate();
21
23
  const urlController = useUrlController();
@@ -53,13 +55,13 @@ function CollectionViewStartActions({ collection, relativePath, parentCollection
53
55
  children: /* @__PURE__ */ jsx(XIcon, { size: iconSize.smallest })
54
56
  })
55
57
  }, "close_tooltip");
56
- const iconOnlyToolbar = !largeLayout || Boolean(compact);
58
+ const iconOnlyToolbar = !largeLayout || Boolean(compact) || !toolbarLabels;
57
59
  const filtersButton = resolvedProperties && tableController.setFilterValues && /* @__PURE__ */ jsx(Tooltip, {
58
60
  title: t("filters"),
59
61
  children: /* @__PURE__ */ jsx(Badge, {
60
62
  color: "primary",
61
63
  invisible: activeFilterCount === 0,
62
- children: largeLayout && !compact ? /* @__PURE__ */ jsx(Button, {
64
+ children: !iconOnlyToolbar ? /* @__PURE__ */ jsx(Button, {
63
65
  variant: "text",
64
66
  size: "small",
65
67
  onClick: () => setFiltersDialogOpen(true),
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionViewStartActions.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewStartActions.tsx"],"sourcesContent":["import type { Properties } from \"@rebasepro/types\";\n\nimport React, { useState, useCallback } from \"react\";\nimport { useAuthController, useLargeLayout, useTranslation, useSlot } from \"@rebasepro/app\";\nimport { CollectionActionsProps, EntityTableController, SelectionController, SelectionQuery, AdminCollection, ViewMode } from \"@rebasepro/cms-types\";\nimport { ErrorBoundary, iconSize } from \"@rebasepro/ui\";\nimport { Badge, Button, cls, FilterIcon, IconButton, Skeleton, Tooltip, XIcon } from \"@rebasepro/ui\";\nimport { ClearFilterSortButton } from \"../ClearFilterSortButton\";\nimport { FiltersDialog } from \"./FiltersDialog\";\nimport { FilterPresetsButton } from \"./FilterPresetsButton\";\nimport { SortButton } from \"./SortButton\";\nimport { toArray } from \"@rebasepro/utils\";\nimport { useNavigate } from \"react-router\";\nimport { useUrlController } from \"../../hooks/navigation/contexts/UrlContext\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { withListState } from \"../../util/view_mode\";\nimport { useSplitView } from \"./SplitViewContext\";\nimport { SelectionMenu } from \"../../selection\";\n\nexport type CollectionViewStartActionsProps<M extends Record<string, unknown>> = {\n collection: AdminCollection<M>;\n path: string;\n relativePath: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n selectionController: SelectionController<M>;\n tableController: EntityTableController<M>;\n collectionEntitiesCount?: number;\n /**\n * Number of records the current filters and search resolve to, rendered at\n * the end of this group.\n * - `undefined`: not applicable\n * - `null`: still counting\n * - number: the count\n */\n entitiesCount?: number | null;\n /**\n * Resolved properties from the collection for the filters dialog\n */\n resolvedProperties?: Properties;\n /**\n * Which view is being displayed. Decides whether the sort control is\n * offered — see `sortButton`.\n */\n viewMode?: ViewMode;\n /** Whether rows can be selected at all in this mount. */\n selectionEnabled?: boolean;\n /** The view's live query — what the menu's \"all matching\" item stands for. */\n selectionQuery?: SelectionQuery<M>;\n compact?: boolean;\n openNewDocument: (defaultValues?: Record<string, unknown>) => void;\n}\n\nexport function CollectionViewStartActions<M extends Record<string, unknown>>({\n collection,\n relativePath,\n parentCollectionSlugs, parentEntityIds,\n path,\n selectionController,\n tableController,\n collectionEntitiesCount,\n entitiesCount,\n resolvedProperties,\n viewMode,\n selectionEnabled,\n selectionQuery,\n compact,\n openNewDocument\n}: CollectionViewStartActionsProps<M>) {\n\n const context = useAdminContext();\n const largeLayout = useLargeLayout();\n const { t } = useTranslation();\n\n const navigate = useNavigate();\n const urlController = useUrlController();\n const splitView = useSplitView();\n\n // Filters dialog state\n const [filtersDialogOpen, setFiltersDialogOpen] = useState(false);\n\n // Count active filters (excluding force filters)\n const filterValues = tableController.filterValues;\n const fixedFilter = collection.fixedFilter;\n const activeFilterCount = filterValues\n ? Object.keys(filterValues).filter(key => !fixedFilter || !(key in fixedFilter)).length\n : 0;\n\n const actionProps: CollectionActionsProps<M> = {\n path,\n relativePath,\n parentCollectionSlugs,\nparentEntityIds,\n collection,\n selectionController,\n context,\n tableController,\n collectionEntitiesCount,\n openNewDocument\n };\n\n const handleBackClick = useCallback(() => {\n navigate(withListState(urlController.buildUrlCollectionPath(path)));\n }, [navigate, urlController, path]);\n\n // In a split view the control that closes the list lives at the leading\n // edge of the record's app bar (`SplitListCloseButton`), not here.\n //\n // Outside one — a compact list with no record open beside it — the only\n // thing this can mean is \"leave the record behind\".\n const backButton = compact && !splitView?.detailOpen && (\n <Tooltip title={t(\"close\")} key={\"close_tooltip\"}>\n <IconButton\n size=\"small\"\n onClick={handleBackClick}\n aria-label={t(\"close\")}\n className=\"mr-1\"\n >\n <XIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n );\n\n // Whether the toolbar is showing icon-only controls. The filters button\n // drops its label — and its icon a size with it — on a narrow layout as\n // well as in the split view, and the sort and clear controls beside it\n // follow: keyed on `compact` alone they stayed 20px next to a 16px filter\n // icon at every width below `largeLayout`.\n const iconOnlyToolbar = !largeLayout || Boolean(compact);\n\n const filtersButton = resolvedProperties && tableController.setFilterValues && (\n <Tooltip title={t(\"filters\")}\n key={\"filters_tooltip\"}>\n <Badge\n color=\"primary\"\n invisible={activeFilterCount === 0}\n >\n {largeLayout && !compact ? (\n <Button\n variant=\"text\"\n size=\"small\"\n onClick={() => setFiltersDialogOpen(true)}\n startIcon={<FilterIcon size={iconSize.small}/>}\n className={cls(activeFilterCount > 0 && \"text-primary\")}\n >\n {activeFilterCount > 0 ? `(${activeFilterCount})` : t(\"filters\")}\n </Button>\n ) : (\n <IconButton aria-label={t(\"filters\")}\n size={\"small\"}\n onClick={() => setFiltersDialogOpen(true)}\n className={cls(activeFilterCount > 0 && \"text-primary\")}\n >\n <FilterIcon size={iconSize.smallest}/>\n </IconButton>\n )}\n </Badge>\n </Tooltip>\n );\n\n // Everywhere a `sortBy` means something — which is every view but the\n // board, whose columns are ordered by their own order key and which ignores\n // `sortBy` entirely, so the control would appear to do nothing.\n //\n // Including the table, whose headers were once thought to cover it. They\n // build a multi-key sort (shift-click) and they show its ranks, but they\n // cannot *re-rank* it: promoting the third key above the first means\n // clearing the sort and shift-clicking all three back in the new order.\n // Nor can they remove a middle key without cycling it through descending\n // first. This popover is the only place either is one click, and a table\n // with a three-key sort needs it more than a card grid does, not less.\n const sortButton = resolvedProperties && viewMode !== \"kanban\" && (\n <SortButton\n key={\"sort_button\"}\n tableController={tableController}\n properties={resolvedProperties}\n compact={iconOnlyToolbar}\n />\n );\n\n // Not in the split view. The toolbar there is a strip a few hundred pixels\n // wide above the list, and a row of preset chips crowded out the controls\n // that act on what you are looking at. The presets are still one click away\n // inside the filters dialog.\n const filterPresetsButton = !compact && collection.filterPresets?.length ? (\n <FilterPresetsButton\n key={\"filter_presets\"}\n filterPresets={collection.filterPresets}\n tableController={tableController}\n compact={compact}\n />\n ) : null;\n\n // The count closes the group the filter, sort and preset controls open: it\n // is what they resolve to. It used to live in the breadcrumb trail, which\n // the app bar owns — and a collection rendered without an app bar has no\n // breadcrumbs, so the number simply disappeared.\n //\n // Hidden on the same layouts the trail was (`hidden lg:block` there) and in\n // the split view, where this toolbar is a few hundred pixels wide and\n // scrolls: a passive readout is the first thing that should give up its\n // room to the controls.\n const countBadge = !iconOnlyToolbar && entitiesCount !== undefined ? (\n <Tooltip title={t(\"records_in_view\")} key={\"entities_count\"}>\n {entitiesCount === null\n ? <Skeleton className={\"w-8 h-4 rounded-md mx-1\"}/>\n : <span\n className={\"mx-1 text-xs font-mono tabular-nums text-text-secondary dark:text-text-secondary-dark\"}>\n {entitiesCount.toLocaleString()}\n </span>}\n </Tooltip>\n ) : null;\n\n // One control, in one place, for every view — the leading edge of the\n // toolbar, which in a table sits directly above the checkbox column anyway.\n // The table used to carry its own in the ID column header, which meant two\n // controls that did different amounts.\n const selectionMenu = selectionEnabled && selectionQuery ? (\n <div key={\"select_all\"} className={\"mr-1 flex items-center\"}>\n <SelectionMenu\n selectionController={selectionController}\n loadedEntities={tableController.data}\n query={selectionQuery}\n collectionEntitiesCount={collectionEntitiesCount}\n collectionName={collection.name}/>\n </div>\n ) : null;\n\n const actions: React.ReactNode[] = [\n backButton,\n selectionMenu,\n filtersButton,\n sortButton,\n <ClearFilterSortButton\n key={\"clear_filter\"}\n tableController={tableController}\n compact={iconOnlyToolbar}\n fixedFilter={collection.fixedFilter}\n enabled={true}/>,\n filterPresetsButton,\n countBadge\n ];\n\n const pluginActionsStart = useSlot(\"collection.actions.start\", actionProps);\n\n return (\n <>\n {actions}\n {pluginActionsStart}\n\n {/* Filters Dialog */}\n {resolvedProperties && tableController.setFilterValues && (\n <FiltersDialog\n open={filtersDialogOpen}\n onOpenChange={setFiltersDialogOpen}\n properties={resolvedProperties}\n filterValues={tableController.filterValues}\n setFilterValues={(filterValues) => tableController.setFilterValues?.(filterValues ?? {})}\n fixedFilter={collection.fixedFilter}\n />\n )}\n </>\n );\n}\n\n"],"mappings":";;;;;;;;;;;;;;;AAoDA,SAAgB,2BAA8D,EAC1E,YACA,cACA,uBAAuB,iBACvB,MACA,qBACA,iBACA,yBACA,eACA,oBACA,UACA,kBACA,gBACA,SACA,mBACmC;CAEnC,MAAM,UAAU,gBAAgB;CA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}
1
+ {"version":3,"file":"CollectionViewStartActions.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewStartActions.tsx"],"sourcesContent":["import type { Properties } from \"@rebasepro/types\";\n\nimport React, { useState, useCallback } from \"react\";\nimport { useAuthController, useLargeLayout, useTranslation, useSlot } from \"@rebasepro/app\";\nimport { CollectionActionsProps, EntityTableController, SelectionController, SelectionQuery, AdminCollection, ViewMode } from \"@rebasepro/cms-types\";\nimport { ErrorBoundary, iconSize } from \"@rebasepro/ui\";\nimport { Badge, Button, cls, FilterIcon, IconButton, Skeleton, Tooltip, XIcon } from \"@rebasepro/ui\";\nimport { ClearFilterSortButton } from \"../ClearFilterSortButton\";\nimport { FiltersDialog } from \"./FiltersDialog\";\nimport { FilterPresetsButton } from \"./FilterPresetsButton\";\nimport { SortButton } from \"./SortButton\";\nimport { toArray } from \"@rebasepro/utils\";\nimport { useNavigate } from \"react-router\";\nimport { useUrlController } from \"../../hooks/navigation/contexts/UrlContext\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { withListState } from \"../../util/view_mode\";\nimport { useSplitView } from \"./SplitViewContext\";\nimport { SelectionMenu } from \"../../selection\";\nimport { useToolbarLabels } from \"../CollectionTableBinding/internal/CollectionTableToolbar\";\n\nexport type CollectionViewStartActionsProps<M extends Record<string, unknown>> = {\n collection: AdminCollection<M>;\n path: string;\n relativePath: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n selectionController: SelectionController<M>;\n tableController: EntityTableController<M>;\n collectionEntitiesCount?: number;\n /**\n * Number of records the current filters and search resolve to, rendered at\n * the end of this group.\n * - `undefined`: not applicable\n * - `null`: still counting\n * - number: the count\n */\n entitiesCount?: number | null;\n /**\n * Resolved properties from the collection for the filters dialog\n */\n resolvedProperties?: Properties;\n /**\n * Which view is being displayed. Decides whether the sort control is\n * offered — see `sortButton`.\n */\n viewMode?: ViewMode;\n /** Whether rows can be selected at all in this mount. */\n selectionEnabled?: boolean;\n /** The view's live query — what the menu's \"all matching\" item stands for. */\n selectionQuery?: SelectionQuery<M>;\n compact?: boolean;\n openNewDocument: (defaultValues?: Record<string, unknown>) => void;\n}\n\nexport function CollectionViewStartActions<M extends Record<string, unknown>>({\n collection,\n relativePath,\n parentCollectionSlugs, parentEntityIds,\n path,\n selectionController,\n tableController,\n collectionEntitiesCount,\n entitiesCount,\n resolvedProperties,\n viewMode,\n selectionEnabled,\n selectionQuery,\n compact,\n openNewDocument\n}: CollectionViewStartActionsProps<M>) {\n\n const context = useAdminContext();\n const largeLayout = useLargeLayout();\n const toolbarLabels = useToolbarLabels();\n const { t } = useTranslation();\n\n const navigate = useNavigate();\n const urlController = useUrlController();\n const splitView = useSplitView();\n\n // Filters dialog state\n const [filtersDialogOpen, setFiltersDialogOpen] = useState(false);\n\n // Count active filters (excluding force filters)\n const filterValues = tableController.filterValues;\n const fixedFilter = collection.fixedFilter;\n const activeFilterCount = filterValues\n ? Object.keys(filterValues).filter(key => !fixedFilter || !(key in fixedFilter)).length\n : 0;\n\n const actionProps: CollectionActionsProps<M> = {\n path,\n relativePath,\n parentCollectionSlugs,\nparentEntityIds,\n collection,\n selectionController,\n context,\n tableController,\n collectionEntitiesCount,\n openNewDocument\n };\n\n const handleBackClick = useCallback(() => {\n navigate(withListState(urlController.buildUrlCollectionPath(path)));\n }, [navigate, urlController, path]);\n\n // In a split view the control that closes the list lives at the leading\n // edge of the record's app bar (`SplitListCloseButton`), not here.\n //\n // Outside one — a compact list with no record open beside it — the only\n // thing this can mean is \"leave the record behind\".\n const backButton = compact && !splitView?.detailOpen && (\n <Tooltip title={t(\"close\")} key={\"close_tooltip\"}>\n <IconButton\n size=\"small\"\n onClick={handleBackClick}\n aria-label={t(\"close\")}\n className=\"mr-1\"\n >\n <XIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n );\n\n // Whether the toolbar is showing icon-only controls. The filters button\n // drops its label — and its icon a size with it — on a narrow layout as\n // well as in the split view, and the sort and clear controls beside it\n // follow: keyed on `compact` alone they stayed 20px next to a 16px filter\n // icon at every width below `largeLayout`. A toolbar too narrow for its\n // labels (`useToolbarLabels`) is a narrow layout too, whatever the window.\n const iconOnlyToolbar = !largeLayout || Boolean(compact) || !toolbarLabels;\n\n const filtersButton = resolvedProperties && tableController.setFilterValues && (\n <Tooltip title={t(\"filters\")}\n key={\"filters_tooltip\"}>\n <Badge\n color=\"primary\"\n invisible={activeFilterCount === 0}\n >\n {!iconOnlyToolbar ? (\n <Button\n variant=\"text\"\n size=\"small\"\n onClick={() => setFiltersDialogOpen(true)}\n startIcon={<FilterIcon size={iconSize.small}/>}\n className={cls(activeFilterCount > 0 && \"text-primary\")}\n >\n {activeFilterCount > 0 ? `(${activeFilterCount})` : t(\"filters\")}\n </Button>\n ) : (\n <IconButton aria-label={t(\"filters\")}\n size={\"small\"}\n onClick={() => setFiltersDialogOpen(true)}\n className={cls(activeFilterCount > 0 && \"text-primary\")}\n >\n <FilterIcon size={iconSize.smallest}/>\n </IconButton>\n )}\n </Badge>\n </Tooltip>\n );\n\n // Everywhere a `sortBy` means something — which is every view but the\n // board, whose columns are ordered by their own order key and which ignores\n // `sortBy` entirely, so the control would appear to do nothing.\n //\n // Including the table, whose headers were once thought to cover it. They\n // build a multi-key sort (shift-click) and they show its ranks, but they\n // cannot *re-rank* it: promoting the third key above the first means\n // clearing the sort and shift-clicking all three back in the new order.\n // Nor can they remove a middle key without cycling it through descending\n // first. This popover is the only place either is one click, and a table\n // with a three-key sort needs it more than a card grid does, not less.\n const sortButton = resolvedProperties && viewMode !== \"kanban\" && (\n <SortButton\n key={\"sort_button\"}\n tableController={tableController}\n properties={resolvedProperties}\n compact={iconOnlyToolbar}\n />\n );\n\n // Not in the split view. The toolbar there is a strip a few hundred pixels\n // wide above the list, and a row of preset chips crowded out the controls\n // that act on what you are looking at. The presets are still one click away\n // inside the filters dialog.\n const filterPresetsButton = !compact && collection.filterPresets?.length ? (\n <FilterPresetsButton\n key={\"filter_presets\"}\n filterPresets={collection.filterPresets}\n tableController={tableController}\n compact={compact}\n />\n ) : null;\n\n // The count closes the group the filter, sort and preset controls open: it\n // is what they resolve to. It used to live in the breadcrumb trail, which\n // the app bar owns — and a collection rendered without an app bar has no\n // breadcrumbs, so the number simply disappeared.\n //\n // Hidden on the same layouts the trail was (`hidden lg:block` there) and in\n // the split view, where this toolbar is a few hundred pixels wide and\n // scrolls: a passive readout is the first thing that should give up its\n // room to the controls.\n const countBadge = !iconOnlyToolbar && entitiesCount !== undefined ? (\n <Tooltip title={t(\"records_in_view\")} key={\"entities_count\"}>\n {entitiesCount === null\n ? <Skeleton className={\"w-8 h-4 rounded-md mx-1\"}/>\n : <span\n className={\"mx-1 text-xs font-mono tabular-nums text-text-secondary dark:text-text-secondary-dark\"}>\n {entitiesCount.toLocaleString()}\n </span>}\n </Tooltip>\n ) : null;\n\n // One control, in one place, for every view — the leading edge of the\n // toolbar, which in a table sits directly above the checkbox column anyway.\n // The table used to carry its own in the ID column header, which meant two\n // controls that did different amounts.\n const selectionMenu = selectionEnabled && selectionQuery ? (\n <div key={\"select_all\"} className={\"mr-1 flex items-center\"}>\n <SelectionMenu\n selectionController={selectionController}\n loadedEntities={tableController.data}\n query={selectionQuery}\n collectionEntitiesCount={collectionEntitiesCount}\n collectionName={collection.name}/>\n </div>\n ) : null;\n\n const actions: React.ReactNode[] = [\n backButton,\n selectionMenu,\n filtersButton,\n sortButton,\n <ClearFilterSortButton\n key={\"clear_filter\"}\n tableController={tableController}\n compact={iconOnlyToolbar}\n fixedFilter={collection.fixedFilter}\n enabled={true}/>,\n filterPresetsButton,\n countBadge\n ];\n\n const pluginActionsStart = useSlot(\"collection.actions.start\", actionProps);\n\n return (\n <>\n {actions}\n {pluginActionsStart}\n\n {/* Filters Dialog */}\n {resolvedProperties && tableController.setFilterValues && (\n <FiltersDialog\n open={filtersDialogOpen}\n onOpenChange={setFiltersDialogOpen}\n properties={resolvedProperties}\n filterValues={tableController.filterValues}\n setFilterValues={(filterValues) => tableController.setFilterValues?.(fil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JV,cAIU;GACnB;GACA;EAOK;EAJkB,QAAQ,4BAA4B,WAKtD;EAGA,sBAAsB,gBAAgB,mBACnC,oBAAC,eAAD;GACI,MAAM;GACN,cAAc;GACd,YAAY;GACZ,cAAc,gBAAgB;GAC9B,kBAAkB,iBAAiB,gBAAgB,kBAAkB,gBAAgB,CAAC,CAAC;GACvF,aAAa,WAAW;EAC3B,CAAA;CAEP,EAAA,CAAA;AAEV"}
@@ -24,6 +24,14 @@ function FiltersDialog({ open, onOpenChange, properties, filterValues, setFilter
24
24
  const engine = useCollectionScope()?.engine;
25
25
  const [localFilters, setLocalFilters] = useState(filterValues ?? {});
26
26
  const [hiddenFields, setHiddenFields] = useState({});
27
+ /**
28
+ * Bumped by "Clear all", and part of each field's key, so every field
29
+ * starts again from no value. A field keeps what it shows in its own
30
+ * state — an operator picked before any value is not a filter yet — and
31
+ * seeds it from `value` once, so emptying the filters alone left every
32
+ * field showing the value it had.
33
+ */
34
+ const [fieldsGeneration, setFieldsGeneration] = useState(0);
27
35
  React.useEffect(() => {
28
36
  if (open) setLocalFilters(filterValues ?? {});
29
37
  }, [open, filterValues]);
@@ -54,6 +62,7 @@ function FiltersDialog({ open, onOpenChange, properties, filterValues, setFilter
54
62
  ]);
55
63
  const handleClearAll = useCallback(() => {
56
64
  setLocalFilters({});
65
+ setFieldsGeneration((generation) => generation + 1);
57
66
  }, []);
58
67
  const setHiddenForField = useCallback((propertyKey, hidden) => {
59
68
  setHiddenFields((prev) => ({
@@ -74,13 +83,14 @@ function FiltersDialog({ open, onOpenChange, properties, filterValues, setFilter
74
83
  setValue,
75
84
  hidden: hiddenFields[propertyKey] ?? false,
76
85
  setHidden: (hidden) => setHiddenForField(propertyKey, hidden)
77
- });
86
+ }, `${propertyKey}:${fieldsGeneration}`);
78
87
  }, [
79
88
  localFilters,
80
89
  handleFilterChange,
81
90
  hiddenFields,
82
91
  setHiddenForField,
83
- engine
92
+ engine,
93
+ fieldsGeneration
84
94
  ]);
85
95
  return /* @__PURE__ */ jsxs(Dialog, {
86
96
  open,