@firecms/collection_editor 3.0.0-alpha.70 → 3.0.0-alpha.72

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/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@firecms/collection_editor",
3
3
  "type": "module",
4
- "version": "3.0.0-alpha.70",
4
+ "version": "3.0.0-alpha.72",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "source": "src/index.ts",
9
9
  "dependencies": {
10
- "@firecms/data_import_export": "^3.0.0-alpha.70",
11
- "@firecms/schema_inference": "^3.0.0-alpha.70",
12
- "@firecms/ui": "^3.0.0-alpha.70",
10
+ "@firecms/data_import_export": "^3.0.0-alpha.72",
11
+ "@firecms/schema_inference": "^3.0.0-alpha.72",
12
+ "@firecms/ui": "^3.0.0-alpha.72",
13
13
  "json5": "^2.2.3",
14
14
  "prism-react-renderer": "^2.3.0"
15
15
  },
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "245fddde8eca08212aa7c83715cad3a4e3f80ed1"
75
+ "gitHead": "7f6599121c226abbb4fb4dccbe109b2c8ba6e23e"
76
76
  }
@@ -7,13 +7,7 @@ import {
7
7
  useNavigationController,
8
8
  useSnackbarController
9
9
  } from "@firecms/core";
10
- import {
11
- Button,
12
- IconButton,
13
- SaveIcon,
14
- SettingsIcon,
15
- Tooltip,
16
- } from "@firecms/ui";
10
+ import { Button, IconButton, SaveIcon, SettingsIcon, Tooltip, } from "@firecms/ui";
17
11
 
18
12
  import { useCollectionEditorController } from "../useCollectionEditorController";
19
13
  import { useCollectionsConfigController } from "../useCollectionsConfigController";
@@ -44,31 +38,49 @@ export function EditorCollectionAction({
44
38
  let saveDefaultFilterButton = null;
45
39
  if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.initialFilter)) ||
46
40
  !equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {
47
- saveDefaultFilterButton = <Tooltip
48
- title={tableController.sortBy || tableController.filterValues ? "Save default filter and sort" : "Clear default filter and sort"}>
49
- <Button
50
- color={"primary"}
51
- size={"small"}
52
- variant={"outlined"}
53
- onClick={() => configController
54
- ?.saveCollection({
55
- id: collection.path,
56
- parentCollectionIds,
57
- collectionData: mergeDeep(collection as PersistedCollection,
58
- {
59
- initialFilter: tableController.filterValues ?? null,
60
- initialSort: tableController.sortBy ?? null
61
- })
62
- }).then(() => {
63
- snackbarController.open({
64
- type: "success",
65
- message: "Default config saved"
66
- });
67
- })}>
68
- <SaveIcon/>
69
- {/*{tableController.sortBy || tableController.filterValues ? "Save default filter and sort" : "Clear default filter and sort"}*/}
70
- </Button>
71
- </Tooltip>;
41
+ saveDefaultFilterButton = <>
42
+ {collection.initialFilter || collection.initialSort && <Tooltip
43
+ title={"Reset to default filter and sort"}>
44
+ <Button
45
+ color={"primary"}
46
+ size={"small"}
47
+ variant={"text"}
48
+ onClick={() => {
49
+ tableController.clearFilter?.();
50
+ if (collection?.initialFilter)
51
+ tableController.setFilterValues?.(collection?.initialFilter);
52
+ if (collection?.initialSort)
53
+ tableController.setSortBy?.(collection?.initialSort);
54
+ }}>
55
+ <SaveIcon/>
56
+ </Button>
57
+ </Tooltip>}
58
+
59
+ <Tooltip
60
+ title={tableController.sortBy || tableController.filterValues ? "Save default filter and sort" : "Clear default filter and sort"}>
61
+ <Button
62
+ color={"primary"}
63
+ size={"small"}
64
+ variant={"outlined"}
65
+ onClick={() => configController
66
+ ?.saveCollection({
67
+ id: collection.path,
68
+ parentCollectionIds,
69
+ collectionData: mergeDeep(collection as PersistedCollection,
70
+ {
71
+ initialFilter: tableController.filterValues ?? null,
72
+ initialSort: tableController.sortBy ?? null
73
+ })
74
+ }).then(() => {
75
+ snackbarController.open({
76
+ type: "success",
77
+ message: "Default config saved"
78
+ });
79
+ })}>
80
+ <SaveIcon/>
81
+ </Button>
82
+ </Tooltip>
83
+ </>;
72
84
  }
73
85
 
74
86
  const editorButton = <Tooltip
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { EntityCollection, getIconForView, singular, toSnakeCase, } from "@firecms/core";
2
+ import { EntityCollection, getIconForView, SearchIconsView, singular, toSnakeCase, } from "@firecms/core";
3
3
  import {
4
4
  Autocomplete,
5
5
  AutocompleteItem,
@@ -21,8 +21,6 @@ import {
21
21
  } from "@firecms/ui";
22
22
  import { Field, getIn, useFormikContext } from "formik";
23
23
 
24
- //@ts-ignore
25
- import { SearchIcons } from "./SelectIcons";
26
24
  import { FieldHelperView } from "./properties/FieldHelperView";
27
25
 
28
26
  export function CollectionDetailsForm({
@@ -353,8 +351,8 @@ export function CollectionDetailsForm({
353
351
  fullWidth
354
352
  >
355
353
  <div className={"p-4 overflow-auto min-h-[200px]"}>
356
- <SearchIcons selectedIcon={values.icon}
357
- onIconSelected={(icon: string) => {
354
+ <SearchIconsView selectedIcon={values.icon}
355
+ onIconSelected={(icon: string) => {
358
356
  setIconDialogOpen(false);
359
357
  setFieldValue("icon", icon);
360
358
  }}/>
@@ -101,7 +101,7 @@ export function CollectionEditorWelcomeView({
101
101
  </Chip>
102
102
  ))}
103
103
 
104
- {!loadingPathSuggestions && filteredPathSuggestions?.length === 0 &&
104
+ {!loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0 &&
105
105
  <Typography variant={"caption"}>
106
106
  No suggestions
107
107
  </Typography>
@@ -335,7 +335,6 @@ function PropertyEditView({
335
335
  }
336
336
  }
337
337
  }, [deferredValues, includeIdAndTitle, onPropertyChanged, propertyNamespace]);
338
- console.log({ errors })
339
338
 
340
339
  useEffect(() => {
341
340
  if (values?.id && onError && Object.keys(errors).length > 0) {
@@ -4,5 +4,5 @@ export function camelCase(str: string): string {
4
4
  .split(/[-_ ]/)
5
5
  .reduce((cur, acc) => {
6
6
  return cur + acc[0].toUpperCase() + acc.substring(1);
7
- });
7
+ }, "");
8
8
  }
@@ -1,6 +0,0 @@
1
- interface SearchIconsProps {
2
- selectedIcon?: string;
3
- onIconSelected: (icon: string) => void;
4
- }
5
- export declare function SearchIcons({ selectedIcon, onIconSelected }: SearchIconsProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1 +0,0 @@
1
- export declare const iconsSearch: any;