@firecms/collection_editor 3.0.0-beta.2-pre.2 → 3.0.0-beta.2-pre.3

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 (71) hide show
  1. package/dist/form/Field.d.ts +53 -0
  2. package/dist/form/Formex.d.ts +4 -0
  3. package/dist/form/index.d.ts +5 -0
  4. package/dist/form/types.d.ts +25 -0
  5. package/dist/form/useCreateFormex.d.ts +9 -0
  6. package/dist/form/utils.d.ts +44 -0
  7. package/dist/index.es.js +2612 -2328
  8. package/dist/index.es.js.map +1 -1
  9. package/dist/index.umd.js +2 -2
  10. package/dist/index.umd.js.map +1 -1
  11. package/dist/types/collection_editor_controller.d.ts +3 -2
  12. package/dist/types/config_controller.d.ts +3 -3
  13. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +3 -5
  14. package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +2 -2
  15. package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -2
  16. package/dist/ui/collection_editor/EnumForm.d.ts +1 -2
  17. package/dist/ui/collection_editor/PropertyEditView.d.ts +5 -5
  18. package/dist/ui/collection_editor/PropertyTree.d.ts +14 -13
  19. package/dist/ui/collection_editor/SwitchControl.d.ts +8 -0
  20. package/dist/ui/collection_editor/properties/CommonPropertyFields.d.ts +0 -1
  21. package/dist/ui/collection_editor/util.d.ts +1 -0
  22. package/package.json +5 -5
  23. package/src/ConfigControllerProvider.tsx +23 -21
  24. package/src/form/Field.tsx +162 -0
  25. package/src/form/Formex.tsx +8 -0
  26. package/src/form/README.md +165 -0
  27. package/src/form/index.ts +5 -0
  28. package/src/form/types.ts +27 -0
  29. package/src/form/useCreateFormex.tsx +137 -0
  30. package/src/form/utils.ts +169 -0
  31. package/src/types/collection_editor_controller.tsx +4 -3
  32. package/src/types/config_controller.tsx +3 -3
  33. package/src/ui/CollectionViewHeaderAction.tsx +1 -1
  34. package/src/ui/EditorCollectionAction.tsx +3 -3
  35. package/src/ui/HomePageEditorCollectionAction.tsx +2 -2
  36. package/src/ui/MissingReferenceWidget.tsx +2 -1
  37. package/src/ui/NewCollectionButton.tsx +3 -3
  38. package/src/ui/NewCollectionCard.tsx +2 -1
  39. package/src/ui/PropertyAddColumnComponent.tsx +1 -1
  40. package/src/ui/RootCollectionSuggestions.tsx +2 -1
  41. package/src/ui/collection_editor/CollectionDetailsForm.tsx +2 -2
  42. package/src/ui/collection_editor/CollectionEditorDialog.tsx +422 -374
  43. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +19 -12
  44. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +26 -18
  45. package/src/ui/collection_editor/EnumForm.tsx +118 -114
  46. package/src/ui/collection_editor/GetCodeDialog.tsx +1 -1
  47. package/src/ui/collection_editor/PropertyEditView.tsx +198 -142
  48. package/src/ui/collection_editor/PropertyFieldPreview.tsx +5 -1
  49. package/src/ui/collection_editor/PropertyTree.tsx +132 -113
  50. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +18 -11
  51. package/src/ui/collection_editor/SwitchControl.tsx +39 -0
  52. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +10 -2
  53. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +2 -2
  54. package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +13 -9
  55. package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +11 -37
  56. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +2 -2
  57. package/src/ui/collection_editor/properties/EnumPropertyField.tsx +3 -6
  58. package/src/ui/collection_editor/properties/MapPropertyField.tsx +2 -2
  59. package/src/ui/collection_editor/properties/NumberPropertyField.tsx +2 -2
  60. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +11 -14
  61. package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +10 -9
  62. package/src/ui/collection_editor/properties/StoragePropertyField.tsx +15 -9
  63. package/src/ui/collection_editor/properties/StringPropertyField.tsx +2 -2
  64. package/src/ui/collection_editor/properties/UrlPropertyField.tsx +2 -2
  65. package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +27 -18
  66. package/src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +2 -2
  67. package/src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +27 -16
  68. package/src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +33 -18
  69. package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +99 -80
  70. package/src/ui/collection_editor/util.ts +7 -0
  71. package/src/ui/collection_editor/utils/strings.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/ui/collection_editor/CollectionYupValidation.tsx","../src/ui/collection_editor/properties/FieldHelperView.tsx","../src/ui/collection_editor/CollectionDetailsForm.tsx","../src/ui/collection_editor/util.ts","../src/ui/collection_editor/EnumForm.tsx","../src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/ValidationPanel.tsx","../src/ui/collection_editor/properties/EnumPropertyField.tsx","../src/ui/collection_editor/properties/StoragePropertyField.tsx","../src/utils/entities.ts","../src/ui/collection_editor/PropertyFieldPreview.tsx","../src/ui/collection_editor/PropertyTree.tsx","../src/ui/collection_editor/properties/MapPropertyField.tsx","../src/ui/collection_editor/properties/RepeatPropertyField.tsx","../src/ui/collection_editor/properties/CommonPropertyFields.tsx","../src/ui/collection_editor/properties/StringPropertyField.tsx","../src/ui/collection_editor/properties/BooleanPropertyField.tsx","../src/ui/collection_editor/properties/BlockPropertyField.tsx","../src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx","../src/ui/collection_editor/properties/NumberPropertyField.tsx","../src/ui/collection_editor/properties/ReferencePropertyField.tsx","../src/ui/collection_editor/properties/DateTimePropertyField.tsx","../src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx","../src/ui/collection_editor/properties/KeyValuePropertyField.tsx","../src/ui/collection_editor/utils/update_property_for_widget.ts","../src/ui/collection_editor/PropertySelectItem.tsx","../src/ui/collection_editor/properties/UrlPropertyField.tsx","../src/ui/collection_editor/utils/supported_fields.tsx","../src/ui/collection_editor/PropertyEditView.tsx","../src/ui/collection_editor/utils/strings.ts","../src/ui/collection_editor/GetCodeDialog.tsx","../src/ui/collection_editor/CollectionPropertiesEditorForm.tsx","../src/ui/collection_editor/UnsavedChangesDialog.tsx","../src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx","../src/ui/collection_editor/SubcollectionsEditTab.tsx","../src/ui/collection_editor/templates/products_template.ts","../src/ui/collection_editor/templates/blog_template.ts","../src/ui/collection_editor/templates/users_template.ts","../src/ui/collection_editor/templates/pages_template.ts","../src/ui/collection_editor/CollectionEditorWelcomeView.tsx","../src/ui/collection_editor/import/CollectionEditorImportMapping.tsx","../src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx","../src/ui/collection_editor/import/clean_import_data.ts","../src/ui/collection_editor/CollectionEditorDialog.tsx","../src/ConfigControllerProvider.tsx","../src/useCollectionEditorController.tsx","../src/useCollectionsConfigController.tsx","../src/ui/EditorCollectionAction.tsx","../src/ui/HomePageEditorCollectionAction.tsx","../src/ui/NewCollectionCard.tsx","../src/ui/RootCollectionSuggestions.tsx","../src/ui/CollectionViewHeaderAction.tsx","../src/ui/PropertyAddColumnComponent.tsx","../src/ui/NewCollectionButton.tsx","../src/useCollectionEditorPlugin.tsx","../src/ui/MissingReferenceWidget.tsx"],"sourcesContent":["import * as Yup from \"yup\";\n\nexport const YupSchema = Yup.object().shape({\n id: Yup.string().required(\"Required\"),\n name: Yup.string().required(\"Required\"),\n path: Yup.string().required(\"Required\")\n});\n","import { Typography } from \"@firecms/ui\";\n\nexport function FieldHelperView({\n error,\n children\n }: { error?: boolean, children?: React.ReactNode }) {\n if (!children) return null;\n return (\n <Typography variant={\"caption\"} color={error ? \"error\" : \"secondary\"} className={\"ml-3.5 mt-0.5\"}>\n {children}\n </Typography>\n );\n}\n","import React, { useEffect, useState } from \"react\";\nimport { EntityCollection, IconForView, SearchIconsView, singular, toSnakeCase, } from \"@firecms/core\";\nimport {\n Autocomplete,\n AutocompleteItem,\n BooleanSwitchWithLabel,\n Chip,\n cn,\n Container,\n DebouncedTextField,\n Dialog,\n ExpandablePanel,\n IconButton,\n Select,\n SelectItem,\n SettingsIcon,\n TextField,\n Tooltip,\n Typography,\n useAutoComplete\n} from \"@firecms/ui\";\nimport { Field, getIn, useFormikContext } from \"formik\";\n\nimport { FieldHelperView } from \"./properties/FieldHelperView\";\n\nexport function CollectionDetailsForm({\n isNewCollection,\n reservedGroups,\n existingPaths,\n existingIds,\n groups,\n parentCollection\n }: {\n isNewCollection: boolean,\n reservedGroups?: string[];\n existingPaths?: string[];\n existingIds?: string[];\n groups: string[] | null;\n parentCollection?: EntityCollection;\n parentCollectionIds?: string[];\n}) {\n\n const groupRef = React.useRef<HTMLInputElement>(null);\n const {\n values,\n setFieldValue,\n handleChange,\n touched,\n errors,\n setFieldTouched,\n isSubmitting,\n submitCount\n } = useFormikContext<EntityCollection>();\n\n const [iconDialogOpen, setIconDialogOpen] = useState(false);\n const [advancedPanelExpanded, setAdvancedPanelExpanded] = useState(false);\n\n const updateName = (name: string) => {\n setFieldValue(\"name\", name);\n\n const pathTouched = getIn(touched, \"path\");\n if (!pathTouched && isNewCollection && name) {\n setFieldValue(\"path\", toSnakeCase(name));\n }\n\n const idTouched = getIn(touched, \"id\");\n if (!idTouched && isNewCollection && name) {\n setFieldValue(\"id\", toSnakeCase(name));\n }\n\n const singularNameTouched = getIn(touched, \"singularName\");\n if (!singularNameTouched && isNewCollection && name) {\n setFieldValue(\"singularName\", singular(name))\n }\n\n };\n\n useEffect(() => {\n if (errors.id) {\n setAdvancedPanelExpanded(true);\n }\n }, [errors.id]);\n\n const collectionIcon = <IconForView collectionOrView={values}/>;\n\n const groupOptions = groups?.filter((group) => !reservedGroups?.includes(group));\n\n const {\n inputFocused,\n autoCompleteOpen,\n setAutoCompleteOpen\n } = useAutoComplete({\n ref: groupRef\n });\n\n const isSubcollection = !!parentCollection;\n\n let customIdValue: \"true\" | \"false\" | \"optional\" | \"code_defined\" | undefined;\n if (customIdValue) {\n if (typeof values.customId === \"object\") {\n customIdValue = \"code_defined\";\n } else if (values.customId === true) {\n customIdValue = \"true\";\n } else if (values.customId === false) {\n customIdValue = \"false\";\n } else if (values.customId === \"optional\") {\n customIdValue = \"optional\";\n }\n }\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"4xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <div>\n <div\n className=\"flex flex-row py-2 pt-3 items-center\">\n <Typography variant={!isNewCollection ? \"h5\" : \"h4\"} className={\"flex-grow\"}>\n {isNewCollection ? \"New collection\" : `${values?.name} collection`}\n </Typography>\n <Tooltip title={\"Change icon\"}>\n <IconButton\n shape={\"square\"}\n onClick={() => setIconDialogOpen(true)}>\n {collectionIcon}\n </IconButton>\n </Tooltip>\n </div>\n\n {parentCollection && <Chip colorScheme={\"tealDarker\"}>\n <Typography variant={\"caption\"}>\n This is a subcollection of <b>{parentCollection.name}</b>\n </Typography>\n </Chip>}\n\n </div>\n <div className={\"grid grid-cols-12 gap-4\"}>\n\n <div className={\"col-span-12\"}>\n <TextField\n value={values.name ?? \"\"}\n onChange={(e: any) => updateName(e.target.value)}\n label={\"Name\"}\n required\n error={touched.name && Boolean(errors.name)}/>\n <FieldHelperView error={touched.name && Boolean(errors.name)}>\n {touched.name && Boolean(errors.name) ? errors.name : \"Name of in this collection, usually a plural name (e.g. Products)\"}\n </FieldHelperView>\n </div>\n\n <div className={cn(\"col-span-12 \", isSubcollection ? \"\" : \"sm:col-span-8\")}>\n <Field name={\"path\"}\n as={DebouncedTextField}\n label={\"Path\"}\n disabled={!isNewCollection}\n required\n error={touched.path && Boolean(errors.path)}/>\n\n <FieldHelperView error={touched.path && Boolean(errors.path)}>\n {touched.path && Boolean(errors.path)\n ? errors.path\n : isSubcollection ? \"Relative path to the parent (no need to include the parent path)\" : \"Path that this collection is stored in, in the database\"}\n </FieldHelperView>\n\n </div>\n\n {!isSubcollection && <div className={\"col-span-12 sm:col-span-4 relative\"}>\n\n <TextField error={touched.group && Boolean(errors.group)}\n disabled={isSubmitting}\n value={values.group ?? \"\"}\n autoComplete=\"off\"\n onChange={(event) => setFieldValue(\"group\", event.target.value)}\n name={\"group\"}\n inputRef={groupRef}\n label=\"Group\"/>\n <Autocomplete\n open={autoCompleteOpen && (groupOptions ?? []).length > 0}\n setOpen={setAutoCompleteOpen}>\n {groupOptions?.map((group, index) => {\n return <AutocompleteItem\n key={index + \"_\" + group}\n onClick={() => {\n setAutoCompleteOpen(false);\n setFieldValue(\"group\", group ?? null);\n }}\n >\n <div className={\"flex-grow\"}>\n {group}\n </div>\n </AutocompleteItem>;\n })}\n </Autocomplete>\n <FieldHelperView>\n {touched.group && Boolean(errors.group) ? errors.group : \"Group of the collection\"}\n </FieldHelperView>\n </div>}\n\n <div className={\"col-span-12\"}>\n <ExpandablePanel\n expanded={advancedPanelExpanded}\n onExpandedChange={setAdvancedPanelExpanded}\n title={\n <div className=\"flex flex-row text-gray-500\">\n <SettingsIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n Advanced\n </Typography>\n </div>}\n initiallyExpanded={false}>\n <div className={\"grid grid-cols-12 gap-4 p-4\"}>\n\n <div className={\"col-span-12\"}>\n <Field name={\"id\"}\n as={DebouncedTextField}\n disabled={!isNewCollection}\n label={\"Collection id\"}\n error={touched.id && Boolean(errors.id)}/>\n <FieldHelperView error={touched.id && Boolean(errors.id)}>\n {touched.id && Boolean(errors.id) ? errors.id : \"This id identifies this collection\"}\n </FieldHelperView>\n </div>\n\n <div className={\"col-span-12\"}>\n <TextField\n error={touched.singularName && Boolean(errors.singularName)}\n id={\"singularName\"}\n aria-describedby={\"singularName-helper\"}\n onChange={(e) => {\n setFieldTouched(\"singularName\", true);\n return handleChange(e);\n }}\n value={values.singularName ?? \"\"}\n label={\"Singular name\"}/>\n <FieldHelperView error={touched.singularName && Boolean(errors.singularName)}>\n {touched.singularName && Boolean(errors.singularName) ? errors.singularName : \"Optionally define a singular name for your entities\"}\n </FieldHelperView>\n </div>\n <div className={\"col-span-12\"}>\n <TextField\n error={touched.description && Boolean(errors.description)}\n id=\"description\"\n value={values.description ?? \"\"}\n onChange={handleChange}\n multiline\n rows={2}\n aria-describedby=\"description-helper-text\"\n label=\"Description\"\n />\n <FieldHelperView error={touched.description && Boolean(errors.description)}>\n {touched.description && Boolean(errors.description) ? errors.description : \"Description of the collection, you can use markdown\"}\n </FieldHelperView>\n </div>\n\n <div className={\"col-span-12\"}>\n <Select\n name=\"defaultSize\"\n label=\"Default row size\"\n position={\"item-aligned\"}\n onChange={handleChange}\n value={values.defaultSize ?? \"\"}\n renderValue={(value: any) => value.toUpperCase()}\n >\n {[\"xs\", \"s\", \"m\", \"l\", \"xl\"].map((value) => (\n <SelectItem\n key={`size-select-${value}`}\n value={value}>\n {value.toUpperCase()}\n </SelectItem>\n ))}\n </Select>\n </div>\n <div className={\"col-span-12\"}>\n <Select\n name=\"customId\"\n label=\"Data IDs generation\"\n position={\"item-aligned\"}\n disabled={customIdValue === \"code_defined\"}\n onValueChange={(v) => {\n if (v === \"code_defined\")\n throw new Error(\"This should not happen\");\n else if (v === \"true\")\n setFieldValue(\"customId\", true);\n else if (v === \"false\")\n setFieldValue(\"customId\", false);\n else if (v === \"optional\")\n setFieldValue(\"customId\", \"optional\");\n }}\n value={customIdValue ?? \"\"}\n renderValue={(value: any) => {\n if (value === \"code_defined\")\n return \"Code defined\";\n else if (value === \"true\")\n return \"Users must define an ID\";\n else if (value === \"optional\")\n return \"Users can define an ID, but it is not required\";\n else\n return \"Document ID is generated automatically\";\n }}\n >\n <SelectItem value={\"false\"}>\n Document ID is generated automatically\n </SelectItem>\n <SelectItem value={\"true\"}>\n Users must define an ID\n </SelectItem>\n <SelectItem value={\"optional\"}>\n Users can define an ID, but it is not required\n </SelectItem>\n </Select>\n </div>\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n label=\"Collection group\"\n onValueChange={(v) => setFieldValue(\"collectionGroup\", v)}\n value={values.collectionGroup ?? false}\n />\n <FieldHelperView>\n A collection group consists of all collections with the same path. This allows\n you\n to query over multiple collections at once.\n </FieldHelperView>\n </div>\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n label=\"Enable text search for this collection\"\n onValueChange={(v) => setFieldValue(\"textSearchEnabled\", v)}\n value={values.textSearchEnabled ?? false}\n />\n <FieldHelperView>\n Allow text search for this collection. If you have not specified a text search\n delegate, this will use the built-in local text search. This is not recommended\n for large collections, as it may incur in performance and cost issues.\n </FieldHelperView>\n </div>\n </div>\n </ExpandablePanel>\n\n </div>\n\n </div>\n\n <div style={{ height: \"52px\" }}/>\n\n <Dialog\n open={iconDialogOpen}\n onOpenChange={setIconDialogOpen}\n maxWidth={\"xl\"}\n fullWidth\n >\n <div className={\"p-4 overflow-auto min-h-[200px]\"}>\n <SearchIconsView selectedIcon={values.icon}\n onIconSelected={(icon: string) => {\n setIconDialogOpen(false);\n setFieldValue(\"icon\", icon);\n }}/>\n </div>\n\n </Dialog>\n\n </Container>\n </div>\n );\n}\n","export function idToPropertiesPath(id: string): string {\n return \"properties.\" + id.replaceAll(\".\", \".properties.\");\n}\n\nexport function namespaceToPropertiesPath(namespace?: string): string {\n return namespace\n ? \"properties.\" + namespace.replaceAll(\".\", \".properties.\") + \".properties\"\n : \"properties\";\n}\n\nexport function namespaceToPropertiesOrderPath(namespace?: string): string {\n return namespace\n ? \"properties.\" + namespace.replaceAll(\".\", \".properties.\") + \".propertiesOrder\"\n : \"propertiesOrder\";\n}\n\nexport function getFullId(propertyKey: string, propertyNamespace?: string): string {\n return propertyNamespace\n ? `${propertyNamespace}.${propertyKey}`\n : propertyKey;\n}\n","import React, { useEffect } from \"react\";\n\nimport { FastField, Formik, getIn, useFormikContext } from \"formik\";\nimport { EnumValueConfig, EnumValues, FormikArrayContainer, } from \"@firecms/core\";\nimport {\n AutoAwesomeIcon,\n Button,\n CircularProgress,\n DebouncedTextField,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n ListIcon,\n Paper,\n SettingsIcon,\n Typography\n} from \"@firecms/ui\";\nimport { FieldHelperView } from \"./properties/FieldHelperView\";\nimport { extractEnumFromValues } from \"@firecms/schema_inference\";\n\ntype EnumFormProps = {\n enumValues: EnumValueConfig[];\n onValuesChanged?: (enumValues: EnumValueConfig[]) => void;\n onError?: (error: boolean) => void;\n updateIds: boolean;\n disabled: boolean;\n allowDataInference?: boolean;\n getData?: () => Promise<string[]>;\n};\nexport const EnumForm = React.memo(\n function EnumForm({\n enumValues,\n onValuesChanged,\n onError,\n updateIds,\n disabled,\n allowDataInference,\n getData\n }: EnumFormProps) {\n\n return (\n <Formik initialValues={{ enumValues }}\n // enableReinitialize={true}\n validateOnMount={true}\n onSubmit={(data: { enumValues: EnumValueConfig[] }, formikHelpers) => {\n }}\n >\n {\n ({\n values,\n errors\n }) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (onValuesChanged) {\n onValuesChanged(values.enumValues);\n }\n }, [values.enumValues]);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (onError)\n onError(Boolean(errors?.enumValues ?? false));\n }, [errors]);\n\n return <EnumFormFields enumValuesPath={\"enumValues\"}\n values={values}\n errors={errors}\n shouldUpdateId={updateIds}\n disabled={disabled}\n allowDataInference={allowDataInference}\n getData={getData}/>\n }\n }\n </Formik>\n\n );\n },\n function areEqual(prevProps: EnumFormProps, nextProps: EnumFormProps) {\n return prevProps.enumValues.length === nextProps.enumValues.length &&\n prevProps.onValuesChanged === nextProps.onValuesChanged &&\n prevProps.getData === nextProps.getData\n ;\n }\n);\n\ntype EnumFormFieldsProps = {\n values: { enumValues: EnumValueConfig[] };\n errors: any;\n enumValuesPath: string;\n shouldUpdateId: boolean;\n disabled: boolean;\n getData?: () => Promise<string[]>;\n allowDataInference?: boolean;\n};\n\n// const EnumFormFields = React.memo(\nfunction EnumFormFields({\n values,\n errors,\n disabled,\n enumValuesPath,\n shouldUpdateId,\n allowDataInference,\n getData,\n }: EnumFormFieldsProps) {\n\n const {\n setFieldValue\n } = useFormikContext();\n\n const [lastInternalIdAdded, setLastInternalIdAdded] = React.useState<number | undefined>();\n const [editDialogIndex, setEditDialogIndex] = React.useState<number | undefined>();\n const [inferring, setInferring] = React.useState(false);\n\n const inferredValuesRef = React.useRef(new Set());\n const inferredValues = inferredValuesRef.current;\n\n const buildEntry = (index: number, internalId: number) => {\n const justAdded = lastInternalIdAdded === internalId;\n return <EnumEntry index={index}\n disabled={disabled}\n enumValuesPath={enumValuesPath}\n autoFocus={justAdded}\n shouldUpdateId={shouldUpdateId || justAdded}\n onDialogOpen={() => setEditDialogIndex(index)}\n inferredEntry={inferredValues.has(values.enumValues[index]?.id as string)}\n key={`${internalId}`}/>;\n };\n\n const inferValues = async () => {\n if (!getData)\n return;\n setInferring(true);\n getData?.().then((data) => {\n if (!data)\n return;\n\n const flatData = data.flat();\n\n const fieldData = Array.from(new Set(flatData));\n\n const currentEnumValues = values.enumValues;\n const foundEnumValues = extractEnumFromValues(fieldData);\n\n // add only new enum values\n const newEnumValues = foundEnumValues.filter((enumValue) => {\n return !currentEnumValues?.some((v: any) => v.id === enumValue.id);\n });\n\n newEnumValues.forEach((enumValue) => {\n inferredValues.add(enumValue.id);\n });\n setFieldValue(enumValuesPath, [...newEnumValues, ...currentEnumValues]);\n }).catch(e => {\n console.error(e);\n })\n .finally(() => setInferring(false));\n }\n\n return (\n <div className={\"col-span-12\"}>\n <div className=\"ml-3.5 flex flex-row items-center\">\n <ListIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2 grow\">\n Values\n </Typography>\n {allowDataInference &&\n <Button loading={inferring}\n disabled={disabled || inferring}\n variant={\"text\"}\n size={\"small\"}\n onClick={inferValues}>\n {inferring ? <CircularProgress size={\"small\"}/> : <AutoAwesomeIcon/>}\n Infer values from data\n </Button>}\n </div>\n\n <Paper className=\"p-4 m-1\">\n\n <FormikArrayContainer\n value={values.enumValues}\n addLabel={\"Add enum value\"}\n name={enumValuesPath}\n buildEntry={buildEntry}\n disabled={disabled}\n onInternalIdAdded={setLastInternalIdAdded}\n small={true}\n setFieldValue={setFieldValue}\n includeAddButton={true}/>\n\n <EnumEntryDialog index={editDialogIndex}\n open={editDialogIndex !== undefined}\n enumValuesPath={enumValuesPath}\n onClose={() => setEditDialogIndex(undefined)}/>\n </Paper>\n </div>\n );\n}\n\ntype EnumEntryProps = {\n index: number,\n enumValuesPath: string,\n shouldUpdateId: boolean,\n autoFocus: boolean,\n onDialogOpen: () => void;\n disabled: boolean;\n inferredEntry?: boolean;\n};\n\nconst EnumEntry = React.memo(\n function EnumEntryInternal({\n index,\n shouldUpdateId: updateId,\n enumValuesPath,\n autoFocus,\n onDialogOpen,\n disabled,\n inferredEntry\n }: EnumEntryProps) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormikContext<EnumValues>();\n\n const shouldUpdateIdRef = React.useRef(!getIn(values, `${enumValuesPath}[${index}].id`));\n const shouldUpdateId = updateId || shouldUpdateIdRef.current;\n\n const idValue = getIn(values, `${enumValuesPath}[${index}].id`);\n const labelValue = getIn(values, `${enumValuesPath}[${index}].label`);\n\n const labelError = getIn(errors, `${enumValuesPath}[${index}].label`);\n\n const currentLabelRef = React.useRef(labelValue);\n\n React.useEffect(() => {\n if ((currentLabelRef.current === idValue || !idValue) && shouldUpdateId) {\n setFieldValue(`${enumValuesPath}[${index}].id`, labelValue);\n }\n currentLabelRef.current = labelValue;\n }, [labelValue]);\n\n return (\n <div className={\"flex w-full align-center justify-center\"}>\n <FastField name={`${enumValuesPath}[${index}].label`}\n as={DebouncedTextField}\n className={\"flex-grow\"}\n required\n disabled={disabled}\n size=\"small\"\n validate={validateLabel}\n autoFocus={autoFocus}\n autoComplete=\"off\"\n endAdornment={inferredEntry && <AutoAwesomeIcon size={\"small\"}/>}\n error={Boolean(labelError)}/>\n\n {!disabled &&\n <IconButton\n size=\"small\"\n aria-label=\"edit\"\n className={\"m-1\"}\n onClick={() => onDialogOpen()}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>}\n\n </div>);\n },\n function areEqual(prevProps: EnumEntryProps, nextProps: EnumEntryProps) {\n return prevProps.index === nextProps.index &&\n prevProps.enumValuesPath === nextProps.enumValuesPath &&\n prevProps.shouldUpdateId === nextProps.shouldUpdateId &&\n prevProps.inferredEntry === nextProps.inferredEntry &&\n prevProps.autoFocus === nextProps.autoFocus;\n }\n);\n\nfunction EnumEntryDialog({\n index,\n open,\n onClose,\n enumValuesPath\n }: {\n index?: number;\n open: boolean;\n enumValuesPath: string;\n onClose: () => void;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormikContext<EnumValues>();\n\n const idError = index !== undefined ? getIn(errors, `${enumValuesPath}[${index}].id`) : undefined;\n return <Dialog\n maxWidth=\"md\"\n aria-labelledby=\"enum-edit-dialog\"\n open={open}\n onOpenChange={(open) => !open ? onClose() : undefined}\n >\n\n <DialogContent>\n {index !== undefined &&\n <div><FastField name={`${enumValuesPath}[${index}]id`}\n as={DebouncedTextField}\n required\n validate={validateId}\n label={\"ID\"}\n size=\"small\"\n autoComplete=\"off\"\n error={Boolean(idError)}/>\n\n <FieldHelperView error={Boolean(idError)}>\n {idError ?? \"Value saved in the data source\"}\n </FieldHelperView>\n </div>}\n </DialogContent>\n\n <DialogActions>\n <Button\n autoFocus\n variant=\"outlined\"\n onClick={onClose}\n color=\"primary\">\n Ok\n </Button>\n </DialogActions>\n\n </Dialog>\n}\n\nfunction validateLabel(value: string) {\n let error;\n if (!value) {\n error = \"You must specify a label\";\n }\n return error;\n}\n\nfunction validateId(value: string) {\n let error;\n if (!value) {\n error = \"You must specify an ID\";\n }\n return error;\n}\n","import React from \"react\";\n\nimport { FastField, getIn, useFormikContext } from \"formik\";\nimport { SwitchControl } from \"@firecms/core\";\nimport { DebouncedTextField } from \"@firecms/ui\";\n\nexport function GeneralPropertyValidation({ disabled }: {\n required?: boolean;\n disabled:boolean;\n}) {\n\n const { values, handleChange } = useFormikContext();\n\n const validationRequired = \"validation.required\";\n const validationRequiredMessage = \"validation.requiredMessage\";\n const validationUnique = \"validation.unique\";\n const validationUniqueInArray = \"validation.uniqueInArray\";\n\n return (\n <>\n <div className={\"col-span-6\"}>\n <FastField type=\"checkbox\"\n disabled={disabled}\n name={validationRequired}\n label={\"Required\"}\n tooltip={\"You won't be able to save this entity if this value is not set\"}\n component={SwitchControl}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <FastField type=\"checkbox\"\n disabled={disabled}\n name={validationUnique}\n label={\"Unique\"}\n tooltip={\"There cannot be multiple entities with the same value\"}\n component={SwitchControl}/>\n </div>\n\n {getIn(values, validationRequired) && <div className={\"col-span-12\"}>\n <DebouncedTextField\n disabled={disabled}\n value={getIn(values, validationRequiredMessage)}\n label={\"Required message\"}\n name={validationRequiredMessage}\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n </>\n );\n}\n","import React from \"react\";\n\nimport { FastField, getIn, useFormikContext } from \"formik\";\nimport { isValidRegExp, serializeRegExp, SwitchControl } from \"@firecms/core\";\nimport { DebouncedTextField, } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\nimport { FieldHelperView } from \"../FieldHelperView\";\n\nexport function StringPropertyValidation({\n length,\n lowercase,\n matches,\n max,\n min,\n trim,\n uppercase,\n disabled,\n showErrors\n }: {\n length?: boolean;\n min?: boolean;\n max?: boolean;\n trim?: boolean;\n matches?: boolean;\n lowercase?: boolean;\n uppercase?: boolean;\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const {\n values,\n handleChange,\n errors\n } = useFormikContext();\n\n const validationLength = \"validation.length\";\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n const validationTrim = \"validation.trim\";\n const validationMatches = \"validation.matches\";\n const validationLowercase = \"validation.lowercase\";\n const validationUppercase = \"validation.uppercase\";\n\n const matchesError = getIn(errors, validationMatches);\n\n const matchesValue = getIn(values, validationMatches);\n const matchesStringValue = typeof matchesValue === \"string\" ? matchesValue : serializeRegExp(matchesValue);\n return (\n <div className={\"grid grid-cols-12 gap-2\"}>\n\n <GeneralPropertyValidation disabled={disabled}/>\n\n <div className={\"grid grid-cols-12 gap-2 col-span-12\"}>\n {lowercase && <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationLowercase}\n label={\"Lowercase\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>}\n {uppercase && <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationUppercase}\n label={\"Uppercase\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>}\n {trim && <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationTrim}\n label={\"Trim\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>}\n </div>\n\n <div className={\"grid grid-cols-12 gap-2 col-span-12\"}>\n {length && <div className={\"col-span-4\"}>\n <DebouncedTextField\n value={getIn(values, validationLength)}\n label={\"Exact length\"}\n name={validationLength}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n {min && <div className={\"col-span-4\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n label={\"Min length\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n {max && <div className={\"col-span-4\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n label={\"Max length\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n </div>\n\n {matches && <div className={\"col-span-12\"}>\n <FastField name={validationMatches}\n as={DebouncedTextField}\n validate={(value: string) => value && !isValidRegExp(value)}\n label={\"Matches regex\"}\n size=\"small\"\n disabled={disabled}\n value={matchesStringValue}\n error={Boolean(matchesError)}/>\n <FieldHelperView error={Boolean(matchesError)}>\n {matchesError ? \"Not a valid regexp\" : \"e.g. /^\\\\d+$/ for digits only\"}\n </FieldHelperView>\n </div>}\n\n </div>\n );\n\n}\n","import React from \"react\";\n\nimport { getIn, useFormikContext } from \"formik\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\n\nexport function ArrayPropertyValidation({\n max = true,\n min = true,\n disabled\n }: {\n min?: boolean;\n max?: boolean;\n disabled: boolean;\n}) {\n\n const {\n values,\n handleChange\n } = useFormikContext();\n\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n\n return (\n <div className={\"grid grid-cols-12 gap-2\"}>\n\n <GeneralPropertyValidation disabled={disabled}/>\n\n {min && <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n disabled={disabled}\n label={\"Min length\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n {max && <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n disabled={disabled}\n label={\"Max length\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n </div>\n );\n}\n","import { PropsWithChildren } from \"react\";\n\nimport { ExpandablePanel, RuleIcon, Typography } from \"@firecms/ui\";\n\nexport function ValidationPanel({\n children\n }: PropsWithChildren<{}>) {\n\n return (\n <ExpandablePanel\n initiallyExpanded={false}\n asField={true}\n className=\"p-4\"\n title={\n <div className=\"flex flex-row text-gray-500\">\n <RuleIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n Validation\n </Typography>\n </div>\n }>\n\n {children}\n\n </ExpandablePanel>\n )\n}\n","import React, { useMemo } from \"react\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { EnumValueConfig, resolveEnumValues, useSnackbarController } from \"@firecms/core\";\nimport { Select, SelectItem } from \"@firecms/ui\";\nimport { EnumForm } from \"../EnumForm\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { PropertyWithId } from \"../PropertyEditView\";\n\nexport function EnumPropertyField({\n multiselect,\n updateIds,\n disabled,\n showErrors,\n allowDataInference,\n getData\n }: {\n multiselect: boolean;\n updateIds: boolean;\n disabled: boolean;\n showErrors: boolean;\n allowDataInference?: boolean;\n getData?: () => Promise<object[]>;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n touched,\n setFieldError,\n setFieldValue\n } = useFormikContext<PropertyWithId>();\n\n const snackbarContext = useSnackbarController();\n\n const enumValuesPath = multiselect ? \"of.enumValues\" : \"enumValues\";\n\n const defaultValue = getIn(values, \"defaultValue\");\n\n const valuesEnumValues = getIn(values, enumValuesPath);\n const enumValues: EnumValueConfig[] = useMemo(() => {\n if (!valuesEnumValues || typeof valuesEnumValues === \"boolean\")\n return [] as EnumValueConfig[];\n return resolveEnumValues(valuesEnumValues) ?? [] as EnumValueConfig[];\n }, [valuesEnumValues]);\n\n const onValuesChanged = (value: EnumValueConfig[]) => {\n if (!values)\n return;\n setFieldValue(enumValuesPath, value);\n if (!multiselect) {\n const enumIds = value.filter(v => Boolean(v?.id)).map((v: any) => v.id);\n if (defaultValue && !enumIds.includes(defaultValue)) {\n setFieldValue(\"defaultValue\", undefined);\n snackbarContext.open({\n type: \"warning\",\n message: \"Default value was cleared\"\n })\n }\n }\n };\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <EnumForm enumValues={enumValues}\n updateIds={updateIds}\n disabled={disabled}\n allowDataInference={allowDataInference}\n onError={(hasError) => {\n setFieldError(enumValuesPath, hasError ? \"\" : undefined);\n }}\n getData={getData\n ? () => getData()\n .then(res => res.map(d => values.id && getIn(d, values.id)).filter(Boolean))\n : undefined}\n onValuesChanged={onValuesChanged}/>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n {!multiselect &&\n <StringPropertyValidation disabled={disabled}\n showErrors={showErrors}/>}\n {multiselect &&\n <ArrayPropertyValidation disabled={disabled}/>}\n </ValidationPanel>\n\n </div>\n\n {!multiselect && <div className={\"col-span-12\"}>\n\n <Select\n disabled={disabled}\n position={\"item-aligned\"}\n onValueChange={(value: string) => {\n setFieldValue(\"defaultValue\", value);\n }}\n label={\"Default value\"}\n value={defaultValue ?? \"\"}>\n {enumValues\n .filter((enumValue) => Boolean(enumValue?.id))\n .map((enumValue) => (\n <SelectItem key={enumValue.id}\n value={enumValue.id?.toString()}>\n {enumValue.label}\n </SelectItem>\n ))}\n </Select>\n\n </div>}\n </>\n );\n}\n","import React from \"react\";\nimport { SwitchControl, } from \"@firecms/core\";\nimport {\n Button,\n Checkbox,\n DebouncedTextField,\n ExpandablePanel,\n FileUploadIcon,\n MultiSelect,\n MultiSelectItem,\n Typography\n} from \"@firecms/ui\";\n\nimport { Field, getIn, useFormikContext } from \"formik\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\n\nconst fileTypes: Record<string, string> = {\n \"image/*\": \"Images\",\n \"video/*\": \"Videos\",\n \"audio/*\": \"Audio files\",\n \"application/*\": \"Files (pdf, zip, csv, excel...)\",\n \"text/*\": \"Text files\"\n}\n\nexport function StoragePropertyField({\n multiple,\n existing,\n disabled\n }: {\n multiple: boolean;\n existing: boolean;\n disabled: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormikContext();\n\n const baseStoragePath = multiple ? \"of.storage\" : \"storage\";\n const acceptedFiles = `${baseStoragePath}.acceptedFiles`;\n\n const metadata = `${baseStoragePath}.metadata`;\n const fileName = `${baseStoragePath}.fileName`;\n const storagePath = `${baseStoragePath}.storagePath`;\n const storeUrl = `${baseStoragePath}.storeUrl`;\n\n const fileNameValue = getIn(values, fileName) ?? \"{rand}_{file}\";\n const storagePathValue = getIn(values, storagePath) ?? \"/\";\n\n const storedValue = getIn(values, acceptedFiles);\n const fileTypesValue: string[] | undefined = Array.isArray(storedValue) ? storedValue : undefined;\n const allFileTypesSelected = !fileTypesValue || fileTypesValue.length === 0;\n\n const handleTypesChange = (value: string[]) => {\n if (!value) setFieldValue(acceptedFiles, undefined);\n else if (value.includes(\"all\")) setFieldValue(acceptedFiles, undefined);\n else if (value.length >= Object.keys(fileTypes).length) setFieldValue(acceptedFiles, undefined);\n else if (allFileTypesSelected)\n setFieldValue(acceptedFiles, Object.keys(fileTypes).filter((v) => !value.includes(v)));\n else setFieldValue(acceptedFiles, value);\n };\n\n const hasFilenameCallback = typeof fileNameValue === \"function\";\n const hasStoragePathCallback = typeof storagePathValue === \"function\";\n\n return (\n <>\n\n <div className={\"col-span-12\"}>\n\n <ExpandablePanel\n title={\n <div className=\"flex flex-row text-gray-500\">\n <FileUploadIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n File upload config\n </Typography>\n </div>\n }>\n\n <div className={\"grid grid-cols-12 gap-2 p-4\"}>\n\n <div className={\"col-span-12\"}>\n\n <MultiSelect\n disabled={disabled}\n name={acceptedFiles}\n value={fileTypesValue ?? []}\n onMultiValueChange={handleTypesChange}\n label={allFileTypesSelected ? undefined : \"Allowed file types\"}\n renderValues={(selected) => {\n if (!selected || selected.length === 0) return \"All file types allowed\";\n return selected.map((v: string) => fileTypes[v])\n .filter((v: string) => Boolean(v))\n .join(\", \");\n }}>\n\n <MultiSelectItem key={\"all\"} value={\"all\"} className={\"flex items-center gap-2\"}>\n <Checkbox\n checked={!fileTypesValue}/>\n All\n </MultiSelectItem>\n\n {Object.entries(fileTypes).map(([value, label]) => (\n <MultiSelectItem key={value} value={value} className={\"flex items-center gap-2\"}>\n <Checkbox\n checked={allFileTypesSelected || fileTypesValue.indexOf(value) > -1}/>\n <div className={\"flex-grow\"}>\n {label}\n </div>\n <Button size={\"small\"}\n variant={\"outlined\"}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n return setFieldValue(acceptedFiles, [value]);\n }}>\n Only\n </Button>\n </MultiSelectItem>\n ))}\n\n </MultiSelect>\n </div>\n\n <div className={\"col-span-12\"}>\n <Field name={fileName}\n as={DebouncedTextField}\n label={\"File name\"}\n size={\"small\"}\n disabled={hasFilenameCallback || disabled}\n value={hasFilenameCallback ? \"-\" : fileNameValue}\n />\n </div>\n <div className={\"col-span-12\"}>\n <Field name={storagePath}\n as={DebouncedTextField}\n label={\"Storage path\"}\n disabled={hasStoragePathCallback || disabled}\n size={\"small\"}\n value={hasStoragePathCallback ? \"-\" : storagePathValue}\n />\n <Typography variant={\"caption\"} className={\"ml-3.5 mt-1 mb-2\"}>\n <p>You can use the following placeholders in\n the file name\n and storage path values:</p>\n <ul>\n <li>{\"{file} - Full name of the uploaded file\"}</li>\n <li>{\"{file.name} - Name of the uploaded file without extension\"}</li>\n <li>{\"{file.ext} - Extension of the uploaded file\"}</li>\n <li>{\"{entityId} - ID of the entity\"}</li>\n <li>{\"{propertyKey} - ID of this field\"}</li>\n <li>{\"{path} - Path of this entity\"}</li>\n <li>{\"{rand} - Random value used to avoid name collisions\"}</li>\n </ul>\n </Typography>\n <Field type=\"checkbox\"\n name={storeUrl}\n label={\"Save URL instead of storage path\"}\n disabled={existing || disabled}\n component={SwitchControl}/>\n <br/>\n <Typography variant={\"caption\"} className={\"ml-3.5 mt-1 mb-2\"}>\n Turn this setting on, if you prefer to save\n the download\n URL of the uploaded file instead of the\n storage path.\n You can only change this prop upon creation.\n </Typography>\n </div>\n </div>\n </ExpandablePanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n {!multiple && <div className={\"grid grid-cols-12 gap-2\"}>\n <GeneralPropertyValidation disabled={disabled}/>\n </div>}\n {multiple && <div className={\"col-span-12\"}>\n <ArrayPropertyValidation disabled={disabled}/>\n </div>}\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import { isPropertyBuilder, Properties, PropertiesOrBuilders, Property, PropertyOrBuilder } from \"@firecms/core\";\n\nexport function editableProperty(property: PropertyOrBuilder | PropertyOrBuilder): boolean {\n if (isPropertyBuilder(property))\n return false;\n if (isPropertyBuilder(property as PropertyOrBuilder))\n return false;\n else {\n const eProperty = property as Property;\n if (eProperty.dataType === \"array\" && typeof eProperty.of === \"function\")\n return false;\n else if (eProperty.dataType === \"array\" && Array.isArray(eProperty.of))\n return false;\n return Boolean(eProperty.editable);\n }\n}\n\nexport function removeNonEditableProperties(properties: PropertiesOrBuilders<any>): Properties {\n return Object.entries(properties)\n .filter(([_, property]) => editableProperty(property))\n .map(([key, propertyOrBuilder]) => {\n const property = propertyOrBuilder as Property;\n if (!editableProperty(property)) {\n return undefined;\n } else if (property.dataType === \"map\" && property.properties) {\n return {\n [key]: {\n ...property,\n properties: removeNonEditableProperties(property.properties as PropertiesOrBuilders)\n }\n };\n } else {\n return { [key]: property };\n }\n })\n .filter((e) => Boolean(e))\n .reduce((a, b) => ({ ...a, ...b }), {}) as Properties;\n}\n","import {\n ErrorBoundary,\n PropertyConfigBadge,\n getFieldConfig,\n isPropertyBuilder,\n Property,\n PropertyOrBuilder,\n useCustomizationController,\n} from \"@firecms/core\";\nimport {\n cardClickableMixin,\n cardMixin,\n cardSelectedMixin,\n cn,\n FunctionsIcon,\n Paper,\n RemoveCircleIcon,\n Typography,\n} from \"@firecms/ui\";\n\nimport { editableProperty } from \"../../utils/entities\";\n\nexport function PropertyFieldPreview({\n property,\n onClick,\n hasError,\n includeName,\n includeEditButton,\n selected\n }: {\n property: Property,\n hasError?: boolean,\n selected?: boolean,\n includeName?: boolean,\n includeEditButton?: boolean;\n onClick?: () => void\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n\n const propertyConfig = getFieldConfig(property, propertyConfigs);\n const disabled = !editableProperty(property);\n\n const borderColorClass = hasError\n ? \"border-red-500\"\n : (selected ? \"border-primary\" : \"border-transparent\");\n\n return <ErrorBoundary>\n <div\n onClick={onClick}\n className=\"flex flex-row w-full cursor-pointer\">\n <div className={\"m-4\"}>\n <PropertyConfigBadge propertyConfig={propertyConfig}/>\n </div>\n <Paper\n className={cn(\n \"pl-2 w-full flex flex-row gap-4 items-center\",\n cardMixin,\n onClick ? cardClickableMixin : \"\",\n selected ? cardSelectedMixin : \"\",\n \"flex-grow p-4 border transition-colors duration-200\",\n borderColorClass\n )}\n >\n\n <div className=\"w-full flex flex-col\">\n\n {includeName &&\n <ErrorBoundary>\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"flex-grow pr-2\">\n {property.name\n ? property.name\n : \"\\u00a0\"\n }\n </Typography>\n </ErrorBoundary>}\n\n <div className=\"flex flex-row items-center\">\n <ErrorBoundary>\n <Typography className=\"flex-grow pr-2\"\n variant={includeName ? \"body2\" : \"subtitle1\"}\n component=\"span\"\n color=\"secondary\">\n {propertyConfig?.name}\n </Typography>\n </ErrorBoundary>\n <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n {property.dataType}\n </Typography>\n </ErrorBoundary>\n\n </div>\n </div>\n\n {includeEditButton && <Typography variant={\"button\"}>\n EDIT\n </Typography>}\n\n </Paper>\n </div>\n </ErrorBoundary>\n}\n\nexport function NonEditablePropertyPreview({\n name,\n selected,\n onClick,\n property\n }: {\n name: string,\n selected: boolean,\n onClick?: () => void,\n property?: PropertyOrBuilder\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n\n const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, propertyConfigs) : undefined;\n\n return (\n <div\n onClick={onClick}\n className=\"flex flex-row w-full cursor-pointer\">\n <div className={\"relative m-4\"}>\n {propertyConfig && <PropertyConfigBadge propertyConfig={propertyConfig}/>}\n {!propertyConfig && <div\n className={\"h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500\"}>\n <FunctionsIcon color={\"inherit\"} size={\"medium\"}/>\n </div>}\n <RemoveCircleIcon color={\"disabled\"} size={\"small\"} className={\"absolute -right-2 -top-2\"}/>\n </div>\n <Paper\n className={cn(\n \"pl-2 w-full flex flex-row gap-4 items-center\",\n cardMixin,\n onClick ? cardClickableMixin : \"\",\n selected ? cardSelectedMixin : \"\",\n \"flex-grow p-4 border transition-colors duration-200\",\n selected ? \"border-primary\" : \"border-transparent\")}\n >\n\n <div className=\"w-full flex flex-col\">\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"flex-grow pr-2\">\n {property?.name\n ? property.name\n : name\n }\n </Typography>\n\n <div className=\"flex flex-row items-center\">\n {propertyConfig && <Typography className=\"flex-grow pr-2\"\n variant={\"body2\"}\n component=\"span\"\n color=\"secondary\">\n {propertyConfig?.name}\n </Typography>}\n\n {property && !isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n {property.dataType}\n </Typography>\n </ErrorBoundary>}\n\n {property && isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n This property is defined as a property builder in code\n </Typography>\n </ErrorBoundary>}\n\n {!property && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n This field is defined as an additional field in code\n </Typography>\n </ErrorBoundary>}\n\n </div>\n\n {/*<div className=\"flex flex-row text-xs\">*/}\n {/* <Typography className=\"flex-grow pr-2\"*/}\n {/* variant=\"body2\"*/}\n {/* component=\"span\"*/}\n {/* color=\"secondary\">*/}\n {/* This field can only be edited in code*/}\n {/* </Typography>*/}\n {/*</div>*/}\n </div>\n\n </Paper>\n </div>)\n}\n","import {\n AdditionalFieldDelegate,\n CMSType,\n ErrorBoundary,\n isPropertyBuilder,\n PropertiesOrBuilders,\n PropertyOrBuilder,\n} from \"@firecms/core\";\nimport { AutoAwesomeIcon, defaultBorderMixin, DragHandleIcon, IconButton, RemoveIcon, Tooltip } from \"@firecms/ui\";\nimport { NonEditablePropertyPreview, PropertyFieldPreview } from \"./PropertyFieldPreview\";\nimport { DragDropContext, Draggable, DraggableProvided, Droppable } from \"@hello-pangea/dnd\";\nimport { getFullId, idToPropertiesPath } from \"./util\";\nimport { getIn } from \"formik\";\nimport { editableProperty } from \"../../utils/entities\";\nimport { useCallback } from \"react\";\n\nexport function PropertyTree<M extends {\n [Key: string]: CMSType\n}>({\n namespace,\n selectedPropertyKey,\n onPropertyClick,\n properties,\n propertiesOrder: propertiesOrderProp,\n additionalFields,\n errors,\n onPropertyMove,\n onPropertyRemove,\n className,\n inferredPropertyKeys,\n collectionEditable,\n }: {\n namespace?: string;\n selectedPropertyKey?: string;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n properties: PropertiesOrBuilders<M>;\n propertiesOrder?: string[];\n additionalFields?: AdditionalFieldDelegate<M>[];\n errors: Record<string, any>;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n className?: string;\n inferredPropertyKeys?: string[];\n collectionEditable: boolean;\n}) {\n\n const propertiesOrder = propertiesOrderProp ?? Object.keys(properties);\n\n const onDragEnd = useCallback((result: any) => {\n // dropped outside the list\n if (!result.destination) {\n return;\n }\n const startIndex = result.source.index;\n const endIndex = result.destination.index;\n\n const newPropertiesOrder = Array.from(propertiesOrder);\n const [removed] = newPropertiesOrder.splice(startIndex, 1);\n newPropertiesOrder.splice(endIndex, 0, removed);\n if (onPropertyMove)\n onPropertyMove(newPropertiesOrder, namespace);\n }, [namespace, onPropertyMove, propertiesOrder])\n\n return (\n <>\n\n <DragDropContext onDragEnd={onDragEnd}>\n <Droppable droppableId={`droppable_${namespace}`}>\n {(droppableProvided, droppableSnapshot) => (\n <div\n {...droppableProvided.droppableProps}\n ref={droppableProvided.innerRef}\n className={className}>\n {propertiesOrder && propertiesOrder\n // .filter((propertyKey) => Boolean(properties[propertyKey]))\n .map((propertyKey: string, index: number) => {\n const property = properties[propertyKey] as PropertyOrBuilder;\n const additionalField = additionalFields?.find(field => field.key === propertyKey);\n\n if (!property && !additionalField) {\n console.warn(`Property ${propertyKey} not found in properties or additionalFields`);\n return null;\n }\n return (\n <Draggable\n key={`array_field_${namespace}_${propertyKey}}`}\n draggableId={`array_field_${namespace}_${propertyKey}}`}\n index={index}>\n {(provided, snapshot) => {\n return (\n <ErrorBoundary>\n <PropertyTreeEntry\n propertyKey={propertyKey as string}\n propertyOrBuilder={property}\n additionalField={additionalField}\n provided={provided}\n errors={errors}\n namespace={namespace}\n inferredPropertyKeys={inferredPropertyKeys}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n onPropertyClick={snapshot.isDragging ? undefined : onPropertyClick}\n selectedPropertyKey={selectedPropertyKey}\n collectionEditable={collectionEditable}\n />\n </ErrorBoundary>\n );\n }}\n </Draggable>);\n }).filter(Boolean)}\n\n {droppableProvided.placeholder}\n\n </div>\n )}\n </Droppable>\n </DragDropContext>\n\n </>\n );\n}\n\nexport function PropertyTreeEntry({\n propertyKey,\n namespace,\n propertyOrBuilder,\n additionalField,\n provided,\n selectedPropertyKey,\n errors,\n onPropertyClick,\n onPropertyMove,\n onPropertyRemove,\n inferredPropertyKeys,\n collectionEditable,\n }: {\n propertyKey: string;\n namespace?: string;\n propertyOrBuilder: PropertyOrBuilder;\n additionalField?: AdditionalFieldDelegate<any>;\n selectedPropertyKey?: string;\n provided: DraggableProvided;\n errors: Record<string, any>;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n inferredPropertyKeys?: string[];\n collectionEditable: boolean;\n}) {\n\n const isPropertyInferred = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);\n\n const fullId = getFullId(propertyKey, namespace);\n\n let subtree;\n if (typeof propertyOrBuilder === \"object\") {\n const property = propertyOrBuilder;\n if (property.dataType === \"map\" && property.properties) {\n subtree = <PropertyTree\n selectedPropertyKey={selectedPropertyKey}\n namespace={fullId}\n properties={property.properties}\n propertiesOrder={property.propertiesOrder}\n errors={errors}\n onPropertyClick={onPropertyClick}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n collectionEditable={collectionEditable}\n />\n }\n }\n\n const hasError = fullId ? getIn(errors, idToPropertiesPath(fullId)) : false;\n const selected = selectedPropertyKey === fullId;\n const editable = propertyOrBuilder && ((collectionEditable && !isPropertyBuilder(propertyOrBuilder)) || editableProperty(propertyOrBuilder));\n\n return (\n <div\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n className=\"relative -ml-8\"\n >\n {subtree && <div\n className={\"absolute border-l \" + defaultBorderMixin}\n style={{\n left: \"32px\",\n top: \"64px\",\n bottom: \"16px\"\n }}/>}\n\n {!isPropertyBuilder(propertyOrBuilder) && !additionalField && editable\n ? <PropertyFieldPreview\n property={propertyOrBuilder}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n includeName={true}\n selected={selected}\n hasError={hasError}/>\n : <NonEditablePropertyPreview name={propertyKey}\n property={propertyOrBuilder}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n selected={selected}/>}\n\n <div className=\"absolute top-2 right-2 flex flex-row \">\n\n {isPropertyInferred && <Tooltip title={\"Inferred property\"}>\n <AutoAwesomeIcon size=\"small\" className={\"p-2\"}/>\n </Tooltip>}\n\n {onPropertyRemove && <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n color=\"inherit\"\n onClick={() => onPropertyRemove(propertyKey, namespace)}>\n <RemoveIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>}\n\n {onPropertyMove && <Tooltip title={\"Move\"}>\n <IconButton\n component={\"span\"}\n size=\"small\"\n >\n <DragHandleIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>}\n </div>\n\n\n {subtree && <div className={\"ml-16\"}>{subtree}</div>}\n </div>\n );\n\n}\n","import React, { useCallback, useState } from \"react\";\nimport { MapProperty, Property, PropertyConfig, } from \"@firecms/core\";\nimport { AddIcon, BooleanSwitchWithLabel, Button, Paper, Typography } from \"@firecms/ui\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { PropertyTree } from \"../PropertyTree\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from \"../util\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function MapPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {\n disabled: boolean;\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormikContext<MapProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState<boolean>(false);\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const propertiesOrder = values.propertiesOrder ?? Object.keys(values.properties ?? {});\n const onPropertyCreated = useCallback(({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n setFieldValue(\"properties\", {\n ...(values.properties ?? {}),\n [id]: property\n }, false);\n setFieldValue(\"propertiesOrder\", [...propertiesOrder, id], false);\n setPropertyDialogOpen(false);\n }, [values.properties, propertiesOrder]);\n\n const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n const propertiesPath = idToPropertiesPath(fullId);\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)));\n\n setFieldValue(propertiesPath, undefined, false);\n setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);\n\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }, [setFieldValue, values]);\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n\n const addChildButton = <Button\n color=\"primary\"\n variant={\"outlined\"}\n onClick={() => setPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}\n >\n Add property to {values.name ?? \"this group\"}\n </Button>;\n\n const empty = !propertiesOrder || propertiesOrder.length < 1;\n\n const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {\n setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);\n }, []);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <div className=\"flex justify-between items-end my-4\">\n <Typography variant={\"subtitle2\"}>Properties in this group</Typography>\n {addChildButton}\n </div>\n <Paper className=\"p-2 pl-8\">\n <PropertyTree\n properties={values.properties ?? {}}\n propertiesOrder={propertiesOrder}\n errors={{}}\n collectionEditable={collectionEditable}\n onPropertyClick={(propertyKey, namespace) => {\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n setPropertyDialogOpen(true);\n }}\n onPropertyMove={onPropertyMove}/>\n\n {empty &&\n <Typography variant={\"label\"}\n className=\"h-full flex items-center justify-center p-4\">\n Add the first property to this group\n </Typography>}\n </Paper>\n </div>\n\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n size={\"small\"}\n label=\"Spread children as columns\"\n onValueChange={(v) => setFieldValue(\"spreadChildren\", v)}\n value={values.spreadChildren ?? false}\n />\n <FieldHelperView>\n Set this flag to true if you want to display the children of this group as individual columns.\n </FieldHelperView>\n </div>\n\n <PropertyFormDialog\n inArray={false}\n forceShowErrors={false}\n open={propertyDialogOpen}\n allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n onCancel={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n onOkClicked={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n getData={getData}\n onDelete={deleteProperty}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n existingProperty={Boolean(selectedPropertyKey)}\n autoUpdateId={!selectedPropertyKey}\n autoOpenTypeSelect={!selectedPropertyKey}\n onPropertyChanged={onPropertyCreated}\n existingPropertyKeys={selectedPropertyKey ? undefined : propertiesOrder}\n propertyConfigs={propertyConfigs}\n />\n\n </>);\n}\n","import React, { useCallback, useState } from \"react\";\nimport { ArrayProperty, getFieldConfig, Property, PropertyConfig } from \"@firecms/core\";\nimport { Button, Paper, Typography } from \"@firecms/ui\";\nimport { Field, getIn, useFormikContext } from \"formik\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { PropertyFieldPreview } from \"../PropertyFieldPreview\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\n\nexport function RepeatPropertyField({\n showErrors,\n existing,\n disabled,\n getData,\n allowDataInference,\n propertyConfigs,\n collectionEditable\n }: {\n showErrors: boolean,\n existing: boolean,\n disabled: boolean,\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormikContext<ArrayProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState(false);\n const ofProperty = getIn(values, \"of\");\n const ofPropertyError = getIn(touched, \"of\") && getIn(errors, \"of\");\n\n const onPropertyChanged = useCallback(({ id, property, namespace }:\n { id?: string, property: Property, namespace?: string }) => {\n setFieldValue(\"of\", property);\n }, []);\n\n const widget = ofProperty && getFieldConfig(ofProperty, propertyConfigs);\n return (\n <>\n <div className={\"col-span-12\"}>\n <Typography variant={\"subtitle2\"}>\n Repeat component\n </Typography>\n <Field\n name={\"of\"}\n value={ofProperty}\n validate={(property: Property) => {\n return property?.dataType ? undefined : \"You need to specify a repeat field\";\n }}\n >\n {() => (\n <Paper className=\"p-2 mt-4\">\n\n {ofProperty && <PropertyFieldPreview\n property={ofProperty}\n onClick={disabled ? undefined : () => setPropertyDialogOpen(true)}\n includeName={false}\n includeEditButton={true}\n selected={false}\n hasError={false}/>}\n\n {!disabled && !ofProperty && <Button variant={\"text\"}\n size={\"large\"}\n color={ofPropertyError ? \"error\" : \"primary\"}\n onClick={() => setPropertyDialogOpen(true)}>\n Edit {`${widget ? widget.name : \"repeat component\"}`}\n </Button>}\n\n <PropertyFormDialog\n inArray={true}\n open={propertyDialogOpen}\n existingProperty={existing}\n getData={getData}\n autoUpdateId={!existing}\n autoOpenTypeSelect={!existing}\n onOkClicked={() => setPropertyDialogOpen(false)}\n allowDataInference={allowDataInference}\n property={ofProperty}\n includeIdAndName={false}\n onPropertyChanged={onPropertyChanged}\n forceShowErrors={showErrors}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n />\n </Paper>\n )}\n </Field>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <ArrayPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import { Field, getIn, useFormikContext } from \"formik\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { PropertyWithId } from \"../PropertyEditView\";\nimport React from \"react\";\nimport { FieldHelperView } from \"./FieldHelperView\";\nimport { toSnakeCase, unslugify } from \"@firecms/core\";\n\ntype CommonPropertyFieldsProps = {\n showErrors: boolean,\n disabledId: boolean,\n existingPropertyKeys?: string[];\n disabled: boolean;\n isNewProperty: boolean;\n autoUpdateId: boolean;\n};\n\nexport const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPropertyFieldsProps>(\n function CommonPropertyFields({\n showErrors,\n disabledId,\n existingPropertyKeys,\n disabled,\n autoUpdateId,\n isNewProperty\n }, ref) {\n\n const {\n errors,\n values,\n setFieldValue,\n setFieldTouched,\n touched\n } = useFormikContext<PropertyWithId>();\n\n const name = \"name\";\n const nameError = showErrors && getIn(errors, name);\n\n const id = \"id\";\n const idError = showErrors && getIn(errors, id);\n\n const description = \"description\";\n const descriptionError = showErrors && getIn(errors, description);\n\n return (\n <div className={\"flex flex-col gap-2 col-span-12\"}>\n\n <div>\n <Field\n inputRef={ref}\n as={DebouncedTextField}\n value={values[name]}\n onChange={(e: any) => {\n const newNameValue = e.target.value;\n setFieldValue(name, newNameValue);\n setFieldTouched(name, true, true);\n const idTouched = getIn(touched, id);\n if (!idTouched && autoUpdateId) {\n setFieldValue(id, newNameValue ? toSnakeCase(newNameValue) : \"\")\n }\n }}\n style={{ fontSize: 20 }}\n validate={validateName}\n placeholder={\"Field name\"}\n required\n disabled={disabled}\n error={Boolean(nameError)}/>\n\n <FieldHelperView error={Boolean(nameError)}>\n {nameError}\n </FieldHelperView>\n </div>\n\n <div>\n <Field\n as={DebouncedTextField}\n label={\"ID\"}\n value={values[id]}\n onChange={(e: any) => {\n const newIdValue = e.target.value;\n setFieldValue(id, newIdValue);\n setFieldTouched(id, true, true);\n const nameTouched = getIn(touched, name);\n if (!nameTouched && autoUpdateId) {\n setFieldValue(name, newIdValue ? unslugify(newIdValue) : \"\")\n }\n }}\n validate={() => validateId(values[id], existingPropertyKeys)}\n disabled={disabledId || disabled}\n required\n size=\"small\"\n error={Boolean(idError)}/>\n <FieldHelperView error={Boolean(idError)}>\n {idError}\n </FieldHelperView>\n </div>\n\n <div>\n <Field name={description}\n as={DebouncedTextField}\n label={\"Description\"}\n disabled={disabled}\n error={Boolean(descriptionError)}/>\n <FieldHelperView error={Boolean(descriptionError)}>\n {descriptionError}\n </FieldHelperView>\n </div>\n\n </div>\n );\n\n }\n);\n\nconst idRegEx = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\nfunction validateId(value?: string, existingPropertyKeys?: string[]) {\n\n let error;\n if (!value) {\n error = \"You must specify an id for the field\";\n }\n if (value && !value.match(idRegEx)) {\n error = \"The id can only contain letters, numbers and underscores (_), and not start with a number\";\n }\n if (value && existingPropertyKeys && existingPropertyKeys.includes(value)) {\n error = \"There is another field with this ID already\";\n }\n return error;\n}\n\nfunction validateName(value: string) {\n let error;\n if (!value) {\n error = \"You must specify a title for the field\";\n }\n return error;\n}\n","import React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormikContext } from \"formik\";\n\nimport { TextField } from \"@firecms/ui\";\n\nexport function StringPropertyField({\n widgetId,\n disabled,\n showErrors\n }: {\n widgetId: \"text_field\" | \"multiline\" | \"markdown\" | \"email\";\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue } = useFormikContext();\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 === \"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 {widgetId === \"markdown\" &&\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\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import React from \"react\";\nimport { FastField, getIn, useFormikContext } from \"formik\";\n\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { SwitchControl } from \"@firecms/core\";\n\nexport function BooleanPropertyField({ disabled }: {\n disabled: boolean;\n}) {\n const { values } = useFormikContext();\n const defaultValue = getIn(values, \"defaultValue\");\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <FastField type=\"checkbox\"\n name={\"defaultValue\"}\n label={defaultValue === null || defaultValue === undefined ? \"Default value not set\" : (\"Default value is \" + defaultValue.toString())}\n disabled={disabled}\n allowIndeterminate={true}\n component={SwitchControl}/>\n\n </div>\n </>\n );\n}\n","import React, { useCallback, useState } from \"react\";\nimport { AddIcon, Button, Paper, Typography } from \"@firecms/ui\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"../util\";\nimport { PropertyTree } from \"../PropertyTree\";\nimport { ArrayProperty, Property, PropertyConfig } from \"@firecms/core\";\n\nexport function BlockPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {\n disabled: boolean;\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormikContext<ArrayProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState<boolean>(false);\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const onPropertyCreated = useCallback(({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n setFieldValue(\"oneOf.properties\", {\n ...(values.oneOf?.properties ?? {}),\n [id]: property\n }, false);\n setFieldValue(\"oneOf.propertiesOrder\", [...(values.oneOf?.propertiesOrder ?? Object.keys(values.oneOf?.properties ?? {})), id], false);\n setPropertyDialogOpen(false);\n }, [values.oneOf?.properties, values.oneOf?.propertiesOrder]);\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.oneOf?.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n\n const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n setFieldValue(`oneOf.${idToPropertiesPath(fullId)}`, undefined, false);\n const propertiesOrderPath = `oneOf.${namespaceToPropertiesOrderPath(namespace)}`;\n const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath);\n setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);\n\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }, [setFieldValue, values]);\n\n const addChildButton = <Button\n autoFocus\n color=\"primary\"\n\n onClick={() => setPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}\n >\n Add property to {values.name ?? \"this block\"}\n </Button>;\n\n const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {\n setFieldValue(`oneOf.${namespaceToPropertiesOrderPath(namespace)}`, propertiesOrder, false);\n }, []);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <div className={\"flex justify-between items-end mt-8 mb-4\"}>\n <Typography variant={\"subtitle2\"}>Properties in this\n block</Typography>\n {addChildButton}\n </div>\n <Paper className=\"p-2 pl-8\">\n\n <PropertyTree\n properties={values.oneOf?.properties ?? {}}\n propertiesOrder={values.oneOf?.propertiesOrder}\n errors={{}}\n collectionEditable={collectionEditable}\n onPropertyClick={disabled\n ? undefined\n : (propertyKey, namespace) => {\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n setPropertyDialogOpen(true);\n }}\n onPropertyMove={disabled\n ? undefined\n : onPropertyMove}/>\n\n {!disabled && !values.oneOf?.propertiesOrder?.length &&\n <div className=\"h-full flex items-center justify-center p-4\">\n Add the first property to this block\n </div>}\n\n </Paper>\n </div>\n\n {!disabled && <PropertyFormDialog\n inArray={false}\n forceShowErrors={false}\n open={propertyDialogOpen}\n getData={getData}\n allowDataInference={allowDataInference}\n onCancel={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n onOkClicked={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n collectionEditable={collectionEditable}\n onDelete={deleteProperty}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n existingProperty={Boolean(selectedPropertyKey)}\n autoUpdateId={!selectedPropertyKey}\n autoOpenTypeSelect={!selectedPropertyKey}\n onPropertyChanged={onPropertyCreated}\n existingPropertyKeys={selectedPropertyKey ? undefined : values.oneOf?.propertiesOrder}\n propertyConfigs={propertyConfigs}/>}\n\n </>);\n}\n","import React from \"react\";\n\nimport { FastField, getIn, useFormikContext } from \"formik\";\nimport { SwitchControl } from \"@firecms/core\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\n\nexport function NumberPropertyValidation({ disabled }: {\n disabled: boolean;\n}) {\n\n const {\n values,\n handleChange\n } = useFormikContext();\n\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n const validationLessThan = \"validation.lessThan\";\n const validationMoreThan = \"validation.moreThan\";\n const validationPositive = \"validation.positive\";\n const validationNegative = \"validation.negative\";\n const validationInteger = \"validation.integer\";\n\n return (\n\n <div className={\"grid grid-cols-12 gap-2\"}>\n <GeneralPropertyValidation disabled={disabled}/>\n\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n label={\"Min value\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n label={\"Max value\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField\n value={getIn(values, validationLessThan)}\n label={\"Less than\"}\n name={validationLessThan}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField\n value={getIn(values, validationMoreThan)}\n label={\"More than\"}\n name={validationMoreThan}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationPositive}\n label={\"Positive value\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>\n <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationNegative}\n label={\"Negative value\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>\n <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationInteger}\n label={\"Integer value\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>\n </div>\n );\n}\n","import React from \"react\";\nimport { NumberPropertyValidation } from \"./validation/NumberPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { TextField } from \"@firecms/ui\";\nimport { getIn, useFormikContext } from \"formik\";\n\nexport function NumberPropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n const { values, setFieldValue } = useFormikContext();\n\n return (\n <>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <NumberPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n type={\"number\"}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : parseFloat(e.target.value));\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import React from \"react\";\nimport { Field, getIn, useFormikContext } from \"formik\";\nimport { IconForView, NumberProperty, StringProperty, useNavigationController } from \"@firecms/core\";\nimport { CircularProgress, Select, SelectGroup, SelectItem, Typography, } from \"@firecms/ui\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function ReferencePropertyField({\n existing,\n multiple,\n disabled,\n showErrors\n }: { existing: boolean, multiple: boolean, disabled: boolean, showErrors: boolean }) {\n\n const {\n values,\n handleChange,\n errors,\n } = useFormikContext<StringProperty | NumberProperty>();\n\n const navigation = useNavigationController();\n\n if (!navigation)\n return <div className={\"col-span-12\"}>\n <CircularProgress/>\n </div>;\n\n const pathPath = multiple ? \"of.path\" : \"path\";\n const pathValue: string | undefined = getIn(values, pathPath);\n const pathError: string | undefined = showErrors && getIn(errors, pathPath);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <Field required\n name={pathPath}\n pathPath={pathPath}\n type=\"select\"\n validate={validatePath}\n disabled={existing || disabled}\n value={pathValue}\n error={pathError}\n handleChange={handleChange}\n component={CollectionsSelect}/>\n\n </div>\n\n </>\n );\n}\n\nfunction validatePath(value?: string) {\n let error;\n if (!value) {\n error = \"You must specify a target collection for the field\";\n }\n return error;\n}\n\nexport function CollectionsSelect({\n disabled,\n pathPath,\n value,\n handleChange,\n error,\n ...props\n }: {\n disabled: boolean,\n pathPath: string,\n value?: string,\n handleChange: (event: any) => void,\n error?: string\n}) {\n\n const navigation = useNavigationController();\n\n if (!navigation)\n return <div className={\"col-span-12\"}>\n <CircularProgress/>\n </div>;\n\n const collections = navigation?.collections ?? [];\n\n const groups: string[] = Array.from(new Set(\n Object.values(collections).map(e => e.group).filter(Boolean) as string[]\n ).values());\n\n const ungroupedCollections = collections.filter((col) => !col.group);\n\n return (\n <>\n <Select\n error={Boolean(error)}\n disabled={disabled}\n value={value ?? \"\"}\n position={\"item-aligned\"}\n name={pathPath}\n onChange={handleChange}\n label={\"Target collection\"}\n renderValue={(selected) => {\n const selectedCollection = collections.find(collection => collection.id === selected || collection.path === selected);\n if (!selectedCollection) return null;\n return (\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={selectedCollection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {selectedCollection?.name.toUpperCase()}\n </Typography>\n </div>)\n }}\n {...props}>\n\n {groups.flatMap((group) => (\n <SelectGroup label={group || \"Views\"}\n key={`group_${group}`}>\n {\n collections.filter(collection => collection.group === group)\n .map((collection) => {\n return <SelectItem\n key={`${collection.id ?? collection.path}-${group}`}\n value={collection.id ?? collection.path}>\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={collection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {collection?.name.toUpperCase()}\n </Typography>\n </div>\n </SelectItem>;\n })\n\n }\n </SelectGroup>\n ))}\n\n {ungroupedCollections && <SelectGroup label={\"Views\"}>\n {ungroupedCollections\n .map((collection) => {\n return <SelectItem key={collection.id ?? collection.path}\n value={collection.id ?? collection.path}>\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={collection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {collection?.name.toUpperCase()}\n </Typography>\n </div>\n </SelectItem>;\n })\n\n }\n </SelectGroup>}\n\n </Select>\n\n <FieldHelperView>\n You can only edit the reference collection upon field\n creation.\n </FieldHelperView>\n </>\n );\n}\n","import React from \"react\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { NumberProperty, StringProperty } from \"@firecms/core\";\nimport { Select, SelectItem } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function DateTimePropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n const {\n values,\n errors,\n touched,\n setFieldValue\n } = useFormikContext<StringProperty | NumberProperty>();\n\n const modePath = \"mode\";\n const modeValue: string | undefined = getIn(values, modePath);\n const modeError: string | undefined = getIn(touched, modePath) && getIn(errors, modePath);\n\n const autoValuePath = \"autoValue\";\n const autoValueValue: string | undefined = getIn(values, autoValuePath);\n const autoValueError: string | undefined = getIn(touched, autoValuePath) && getIn(errors, autoValuePath);\n\n return (\n <>\n <div className={\"flex flex-col col-span-12\"}>\n <Select name={modePath}\n value={modeValue ?? \"date\"}\n error={Boolean(modeError)}\n onValueChange={(v) => setFieldValue(modePath, v)}\n label={\"Mode\"}\n renderValue={(v) => {\n switch (v) {\n case \"date_time\":\n return \"Date/Time\";\n case \"date\":\n return \"Date\";\n default:\n return \"\";\n }\n }}\n disabled={disabled}>\n <SelectItem value={\"date_time\"}> Date/Time </SelectItem>\n <SelectItem value={\"date\"}> Date </SelectItem>\n </Select>\n <FieldHelperView error={Boolean(modeError)}>\n {modeError}\n </FieldHelperView>\n\n <Select name={autoValuePath}\n disabled={disabled}\n value={autoValueValue ?? \"\"}\n onValueChange={(v) => setFieldValue(autoValuePath, v)}\n renderValue={(v) => {\n switch (v) {\n case \"on_create\":\n return \"On create\";\n case \"on_update\":\n return \"On any update\";\n default:\n return \"None\";\n }\n }}\n error={Boolean(autoValueError)}\n label={\"Automatic value\"}>\n <SelectItem value={\"\"}> None </SelectItem>\n <SelectItem value={\"on_create\"}> On create </SelectItem>\n <SelectItem value={\"on_update\"}> On any update </SelectItem>\n </Select>\n <FieldHelperView error={Boolean(autoValueError)}>\n {autoValueError ?? \"Update this field automatically when creating or updating the entity\"}\n </FieldHelperView>\n\n </div>\n\n <div className={\"col-span-12\"}>\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n </div>\n </>\n );\n}\n","import React from \"react\";\n\nimport { FastField, useFormikContext } from \"formik\";\nimport { SwitchControl } from \"@firecms/core\";\n\nexport function AdvancedPropertyValidation({ disabled }: {disabled: boolean}) {\n\n const { values, handleChange } = useFormikContext();\n\n const columnWidth = \"columnWidth\";\n const hideFromCollection = \"hideFromCollection\";\n const readOnly = \"readOnly\";\n\n return (\n\n <div className={\"grid grid-cols-12 gap-2\"} >\n <div className={\"col-span-12\"}>\n <FastField type=\"checkbox\"\n name={hideFromCollection}\n label={\"Hide from collection\"}\n disabled={disabled}\n tooltip={\"Hide this field from the collection view. It will still be visible in the form view\"}\n component={SwitchControl}/>\n </div>\n\n <div className={\"col-span-12\"}>\n <FastField type=\"checkbox\"\n name={readOnly}\n label={\"Read only\"}\n disabled={disabled}\n tooltip={\"Is this a read only field. Display only as a preview\"}\n component={SwitchControl}/>\n </div>\n </div>\n );\n}\n","import React from \"react\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\n\nexport function KeyValuePropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import {\n ArrayProperty,\n BooleanProperty,\n DateProperty,\n MapProperty,\n mergeDeep,\n NumberProperty,\n Property,\n PropertyConfig,\n StringProperty\n} from \"@firecms/core\";\n\nexport function updatePropertyFromWidget(propertyData: any,\n selectedWidgetId: string | undefined,\n propertyConfigs: Record<string, PropertyConfig>): Property {\n\n let updatedProperty;\n if (selectedWidgetId === \"text_field\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"text_field\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multiline\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"multiline\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n multiline: true,\n storage: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"markdown\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"markdown\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: true,\n email: undefined,\n url: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"url\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"url\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: true,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"email\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"email\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: true,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: propertyData.enumValues ?? []\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multi_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"string\",\n enumValues: propertyData.of?.enumValues ?? []\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"number_input\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"number\",\n propertyConfig: \"number_input\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n enumValues: undefined\n } satisfies NumberProperty\n );\n } else if (selectedWidgetId === \"number_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"number\",\n propertyConfig: \"number_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n enumValues: propertyData.enumValues ?? []\n } satisfies NumberProperty\n );\n } else if (selectedWidgetId === \"multi_number_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_number_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"number\",\n enumValues: propertyData.of?.enumValues ?? []\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"file_upload\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"file_upload\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: {\n storagePath: \"/\"\n }\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multi_file_upload\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_file_upload\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"string\",\n storage: propertyData.of?.storage ?? {\n storagePath: \"/\"\n }\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"group\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"map\",\n propertyConfig: \"group\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n keyValue: false,\n properties: propertyData.properties ?? {}\n } satisfies MapProperty\n );\n } else if (selectedWidgetId === \"key_value\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"map\",\n propertyConfig: \"key_value\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n keyValue: true,\n properties: undefined\n } satisfies MapProperty\n );\n } else if (selectedWidgetId === \"reference\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"reference\",\n propertyConfig: \"reference\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies Property\n );\n } else if (selectedWidgetId === \"multi_references\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_references\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"reference\"\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"switch\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"boolean\",\n propertyConfig: \"switch\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies BooleanProperty\n );\n } else if (selectedWidgetId === \"date_time\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"date\",\n propertyConfig: \"date_time\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n mode: \"date_time\"\n } satisfies DateProperty\n );\n } else if (selectedWidgetId === \"repeat\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"repeat\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"block\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"block\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n oneOf: {\n properties: {}\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId && propertyConfigs[selectedWidgetId]) {\n updatedProperty = {\n ...propertyConfigs[selectedWidgetId].property,\n propertyConfig: selectedWidgetId\n };\n }\n\n return updatedProperty;\n}\n","import { PropertyConfigBadge, PropertyConfig } from \"@firecms/core\";\nimport { cn, SelectItem, Typography } from \"@firecms/ui\";\n\nexport interface PropertySelectItemProps {\n value: string;\n optionDisabled: boolean;\n propertyConfig: PropertyConfig;\n existing: boolean;\n}\n\nexport function PropertySelectItem({ value, optionDisabled, propertyConfig, existing }: PropertySelectItemProps) {\n return <SelectItem value={value}\n disabled={optionDisabled}\n className={\"flex flex-row items-center\"}>\n <div\n className={cn(\n \"flex flex-row items-center text-base min-h-[52px]\",\n optionDisabled ? \"w-full\" : \"\")}>\n <div className={\"mr-8\"}>\n <PropertyConfigBadge propertyConfig={propertyConfig}/>\n </div>\n <div>\n <div>{propertyConfig.name}</div>\n <Typography variant={\"caption\"}\n color={\"disabled\"}\n className={\"max-w-sm\"}>\n {existing && optionDisabled ? \"You can only switch to widgets that use the same data type\" : propertyConfig.description}\n </Typography>\n </div>\n </div>\n </SelectItem>\n}\n","import React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormikContext } from \"formik\";\n\nimport { Select, SelectItem, TextField } from \"@firecms/ui\";\n\nexport function UrlPropertyField({\n disabled,\n showErrors\n }: {\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue } = useFormikContext();\n\n const urlValue = getIn(values, \"url\");\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <Select\n disabled={disabled}\n position={\"item-aligned\"}\n onValueChange={(value: string) => {\n if (value === \"[NONE]\")\n setFieldValue(\"url\", true);\n else\n setFieldValue(\"url\", value);\n }}\n label={\"Preview type\"}\n renderValue={(value: string) => {\n switch (value) {\n case \"image\":\n return \"Image\";\n case \"video\":\n return \"Video\";\n case \"audio\":\n return \"Audio\";\n default:\n return \"Display URL\";\n }\n }}\n value={urlValue ?? \"[NONE]\"}>\n <SelectItem value={\"[NONE]\"}>\n Display URL\n </SelectItem>\n <SelectItem value={\"image\"}>\n Image\n </SelectItem>\n <SelectItem value={\"video\"}>\n Video\n </SelectItem>\n <SelectItem value={\"audio\"}>\n Audio\n </SelectItem>\n </Select>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n\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\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import { DEFAULT_FIELD_CONFIGS, FieldConfigId, PropertyConfig } from \"@firecms/core\";\n\nexport const supportedFieldsIds: FieldConfigId[] = [\n \"text_field\",\n \"multiline\",\n \"markdown\",\n \"url\",\n \"email\",\n \"select\",\n \"multi_select\",\n \"number_input\",\n \"number_select\",\n \"multi_number_select\",\n \"file_upload\",\n \"multi_file_upload\",\n \"reference\",\n \"multi_references\",\n \"switch\",\n \"date_time\",\n \"group\",\n \"key_value\",\n \"repeat\",\n \"block\"\n];\n\nexport const supportedFields: Record<string, PropertyConfig> = Object.entries(DEFAULT_FIELD_CONFIGS)\n .filter(([id]) => supportedFieldsIds.includes(id as FieldConfigId))\n .map(([id, config]) => ({ [id]: config }))\n .reduce((a, b) => ({ ...a, ...b }), {});\n","import React, { useDeferredValue, useEffect, useRef, useState } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport { Formik, FormikErrors, FormikProps, getIn } from \"formik\";\nimport {\n DEFAULT_FIELD_CONFIGS,\n DeleteConfirmationDialog,\n PropertyConfigBadge,\n FieldConfigId,\n getFieldConfig,\n getFieldId,\n isPropertyBuilder,\n mergeDeep,\n Property,\n PropertyConfig,\n} from \"@firecms/core\";\nimport {\n Button,\n cn,\n DeleteIcon,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n InfoLabel,\n Select,\n Typography\n} from \"@firecms/ui\";\nimport { EnumPropertyField } from \"./properties/EnumPropertyField\";\nimport { StoragePropertyField } from \"./properties/StoragePropertyField\";\nimport { MapPropertyField } from \"./properties/MapPropertyField\";\nimport { RepeatPropertyField } from \"./properties/RepeatPropertyField\";\nimport { CommonPropertyFields } from \"./properties/CommonPropertyFields\";\nimport { StringPropertyField } from \"./properties/StringPropertyField\";\nimport { BooleanPropertyField } from \"./properties/BooleanPropertyField\";\nimport { BlockPropertyField } from \"./properties/BlockPropertyField\";\nimport { NumberPropertyField } from \"./properties/NumberPropertyField\";\nimport { ReferencePropertyField } from \"./properties/ReferencePropertyField\";\nimport { DateTimePropertyField } from \"./properties/DateTimePropertyField\";\nimport { AdvancedPropertyValidation } from \"./properties/advanced/AdvancedPropertyValidation\";\nimport { editableProperty } from \"../../utils/entities\";\nimport { KeyValuePropertyField } from \"./properties/KeyValuePropertyField\";\nimport { updatePropertyFromWidget } from \"./utils/update_property_for_widget\";\nimport { PropertySelectItem } from \"./PropertySelectItem\";\nimport { UrlPropertyField } from \"./properties/UrlPropertyField\";\nimport { supportedFields } from \"./utils/supported_fields\";\n\nexport type PropertyWithId = Property & {\n id?: string\n};\n\nexport type OnPropertyChangedParams = {\n id?: string,\n property: Property,\n namespace?: string,\n previousId?: string\n};\n\nexport type PropertyFormProps = {\n includeIdAndName?: boolean;\n existingProperty: boolean;\n autoUpdateId?: boolean;\n autoOpenTypeSelect: boolean;\n inArray: boolean;\n propertyKey?: string;\n propertyNamespace?: string;\n property?: Property;\n onPropertyChanged?: (params: OnPropertyChangedParams) => void;\n onPropertyChangedImmediate?: boolean;\n onDelete?: (id?: string, namespace?: string) => void;\n onError?: (id: string, namespace?: string, error?: FormikErrors<any>) => void;\n initialErrors?: FormikErrors<any>;\n forceShowErrors?: boolean;\n existingPropertyKeys?: string[];\n allowDataInference: boolean;\n getData?: () => Promise<object[]>;\n getHelpers?: (formikProps: FormikProps<PropertyWithId>) => void;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n};\n\nexport const PropertyForm = React.memo(\n function PropertyForm({\n includeIdAndName = true,\n autoOpenTypeSelect,\n existingProperty,\n autoUpdateId,\n inArray,\n propertyKey,\n propertyNamespace,\n property,\n onPropertyChanged,\n onPropertyChangedImmediate = true,\n onDelete,\n onError,\n initialErrors,\n forceShowErrors,\n existingPropertyKeys,\n allowDataInference,\n getHelpers,\n getData,\n propertyConfigs,\n collectionEditable\n }: PropertyFormProps) {\n\n const initialValue: PropertyWithId = {\n id: \"\",\n name: \"\"\n } as PropertyWithId;\n\n const disabled = (Boolean(property && !editableProperty(property)) && !collectionEditable);\n\n const lastSubmittedProperty = useRef<OnPropertyChangedParams | undefined>(property ? {\n id: propertyKey,\n previousId: propertyKey,\n property\n } : undefined);\n\n const doOnPropertyChanged = ({\n id,\n property\n }: OnPropertyChangedParams) => {\n const params = {\n id,\n previousId: lastSubmittedProperty.current?.id,\n property,\n namespace: propertyNamespace\n };\n lastSubmittedProperty.current = params;\n onPropertyChanged?.(params);\n };\n\n return <Formik\n key={`property_view_${propertyKey}`}\n initialErrors={initialErrors}\n initialValues={property\n ? { id: propertyKey, ...property } as PropertyWithId\n : initialValue}\n onSubmit={(newPropertyWithId: PropertyWithId, helpers) => {\n console.debug(\"onSubmit\", newPropertyWithId);\n const {\n id,\n ...property\n } = newPropertyWithId;\n doOnPropertyChanged({\n id,\n property: { ...property, editable: property.editable ?? true }\n });\n if (!existingProperty)\n helpers.resetForm({ values: initialValue });\n }}\n // validate={(values) => {\n // console.log(\"validate property\", values)\n // const errors: any = {};\n // if (!values?.dataType || !getFieldConfig(values)) {\n // errors.selectedWidget = \"Required\";\n // }\n // if (existingPropertyKeys && values?.id && existingPropertyKeys.includes(values?.id)) {\n // errors.id = \"\";\n // }\n // console.log(\"errors\", errors)\n // return errors;\n // }}\n >\n {(props) => {\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n getHelpers?.(props);\n }, [props]);\n\n return <PropertyEditView\n onPropertyChanged={onPropertyChangedImmediate\n ? doOnPropertyChanged\n : undefined}\n onDelete={onDelete}\n includeIdAndTitle={includeIdAndName}\n propertyNamespace={propertyNamespace}\n onError={onError}\n showErrors={forceShowErrors || props.submitCount > 0}\n existing={existingProperty}\n autoUpdateId={autoUpdateId}\n inArray={inArray}\n autoOpenTypeSelect={autoOpenTypeSelect}\n existingPropertyKeys={existingPropertyKeys}\n disabled={disabled}\n getData={getData}\n allowDataInference={allowDataInference}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n {...props}/>;\n\n }}\n\n </Formik>\n }, (a, b) =>\n a.getData === b.getData &&\n a.includeIdAndName === b.includeIdAndName &&\n a.autoOpenTypeSelect === b.autoOpenTypeSelect &&\n a.autoUpdateId === b.autoUpdateId &&\n a.existingProperty === b.existingProperty\n);\n\nexport function PropertyFormDialog({\n open,\n onCancel,\n onOkClicked,\n onPropertyChanged,\n getData,\n collectionEditable,\n ...formProps\n }: PropertyFormProps & {\n open?: boolean;\n onOkClicked?: () => void;\n onCancel?: () => void;\n}) {\n const helpersRef = useRef<FormikProps<PropertyWithId>>();\n const getHelpers = (helpers: FormikProps<PropertyWithId>) => {\n helpersRef.current = helpers;\n };\n\n return <Dialog\n open={open ?? false}\n maxWidth={\"xl\"}\n fullWidth={true}\n >\n\n <DialogContent>\n <PropertyForm {...formProps}\n onPropertyChanged={(params) => {\n onPropertyChanged?.(params);\n onOkClicked?.();\n }}\n collectionEditable={collectionEditable}\n onPropertyChangedImmediate={false}\n getHelpers={getHelpers}\n getData={getData}\n />\n </DialogContent>\n\n <DialogActions>\n\n {onCancel && <Button\n variant={\"text\"}\n onClick={() => {\n onCancel();\n helpersRef.current?.resetForm();\n }}>\n Cancel\n </Button>}\n\n <Button variant=\"outlined\"\n color=\"primary\"\n onClick={() => helpersRef.current?.submitForm()}>\n Ok\n </Button>\n </DialogActions>\n </Dialog>;\n\n}\n\nfunction PropertyEditView({\n values,\n errors,\n touched,\n setValues,\n setFieldValue,\n existing,\n autoUpdateId = false,\n autoOpenTypeSelect,\n includeIdAndTitle,\n onPropertyChanged,\n onDelete,\n propertyNamespace,\n onError,\n showErrors,\n disabled,\n inArray,\n existingPropertyKeys,\n getData,\n allowDataInference,\n propertyConfigs,\n collectionEditable\n }: {\n includeIdAndTitle?: boolean;\n existing: boolean;\n autoUpdateId?: boolean;\n autoOpenTypeSelect: boolean;\n propertyNamespace?: string;\n onPropertyChanged?: (params: OnPropertyChangedParams) => void;\n onDelete?: (id?: string, namespace?: string) => void;\n onError?: (id: string, namespace?: string, error?: FormikErrors<any>) => void;\n showErrors: boolean;\n inArray: boolean;\n disabled: boolean;\n existingPropertyKeys?: string[];\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n} & FormikProps<PropertyWithId>) {\n\n const [selectOpen, setSelectOpen] = useState(autoOpenTypeSelect);\n const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);\n const [selectedFieldConfigId, setSelectedFieldConfigId] = useState<string | undefined>(values?.dataType ? getFieldId(values) : undefined);\n\n const allSupportedFields = Object.entries(supportedFields).concat(Object.entries(propertyConfigs));\n\n const displayedWidgets = inArray\n ? allSupportedFields.filter(([_, propertyConfig]) => !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.dataType !== \"array\")\n : allSupportedFields;\n\n const deferredValues = useDeferredValue(values);\n const nameFieldRef = useRef<HTMLInputElement>(null);\n\n const lastSubmittedProperty = useRef<object>(values);\n\n const selectedWidgetError = showErrors && getIn(errors, \"selectedWidget\");\n\n useEffect(() => {\n if (onPropertyChanged) {\n if ((!includeIdAndTitle || deferredValues.id)) {\n const {\n id,\n ...property\n } = deferredValues;\n if (!equal(deferredValues, lastSubmittedProperty.current)) {\n onPropertyChanged({\n id,\n property,\n namespace: propertyNamespace\n });\n lastSubmittedProperty.current = deferredValues;\n }\n }\n }\n }, [deferredValues, includeIdAndTitle, onPropertyChanged, propertyNamespace]);\n\n useEffect(() => {\n if (values?.id && onError && Object.keys(errors).length > 0) {\n onError(values?.id, propertyNamespace, errors);\n }\n }, [errors, onError, propertyNamespace, values?.id]);\n\n const onWidgetSelectChanged = (newSelectedWidgetId: FieldConfigId) => {\n setSelectedFieldConfigId(newSelectedWidgetId);\n setValues(updatePropertyFromWidget(values, newSelectedWidgetId, propertyConfigs));\n // Ugly hack to autofocus the name field\n setTimeout(() => {\n nameFieldRef.current?.focus();\n }, 0);\n };\n\n let childComponent;\n if (selectedFieldConfigId === \"text_field\" ||\n selectedFieldConfigId === \"multiline\" ||\n selectedFieldConfigId === \"markdown\" ||\n selectedFieldConfigId === \"email\") {\n childComponent =\n <StringPropertyField widgetId={selectedFieldConfigId}\n disabled={disabled}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"url\") {\n childComponent =\n <UrlPropertyField disabled={disabled}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"select\" ||\n selectedFieldConfigId === \"number_select\") {\n childComponent = <EnumPropertyField\n multiselect={false}\n allowDataInference={allowDataInference}\n updateIds={!existing}\n disabled={disabled}\n getData={getData}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"multi_select\" ||\n selectedFieldConfigId === \"multi_number_select\") {\n childComponent = <EnumPropertyField\n multiselect={true}\n updateIds={!existing}\n disabled={disabled}\n allowDataInference={allowDataInference}\n getData={getData}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"file_upload\") {\n childComponent =\n <StoragePropertyField existing={existing}\n multiple={false}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"multi_file_upload\") {\n childComponent =\n <StoragePropertyField existing={existing}\n multiple={true}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"switch\") {\n childComponent = <BooleanPropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"number_input\") {\n childComponent = <NumberPropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"group\") {\n childComponent =\n <MapPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"block\") {\n childComponent =\n <BlockPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"reference\") {\n childComponent =\n <ReferencePropertyField showErrors={showErrors}\n existing={existing}\n multiple={false}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"date_time\") {\n childComponent = <DateTimePropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"multi_references\") {\n childComponent =\n <ReferencePropertyField showErrors={showErrors}\n existing={existing}\n multiple={true}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"repeat\") {\n childComponent =\n <RepeatPropertyField showErrors={showErrors}\n existing={existing}\n getData={getData}\n allowDataInference={allowDataInference}\n disabled={disabled}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"key_value\") {\n childComponent =\n <KeyValuePropertyField disabled={disabled}/>;\n } else {\n childComponent = null;\n }\n\n return (\n <>\n {disabled && <InfoLabel mode={\"warn\"}>\n <Typography>This property can&apos;t be edited</Typography>\n <Typography variant={\"caption\"}>\n You may not have permission to\n edit it or it is defined in code with no <code>editable</code> flag\n </Typography>\n </InfoLabel>}\n\n <div className=\"flex mt-2 justify-between\">\n <div className={\"w-full flex flex-col gap-2\"}>\n <Select\n // className={\"w-full\"}\n error={Boolean(selectedWidgetError)}\n value={selectedFieldConfigId ?? \"\"}\n placeholder={\"Select a property widget\"}\n open={selectOpen}\n onOpenChange={setSelectOpen}\n position={\"item-aligned\"}\n disabled={disabled}\n renderValue={(value) => {\n if (!value) {\n return <em>Select a property\n widget</em>;\n }\n const key = value as FieldConfigId;\n const propertyConfig = DEFAULT_FIELD_CONFIGS[key] ?? propertyConfigs[key];\n const baseProperty = propertyConfig.property;\n const baseFieldConfig = baseProperty && !isPropertyBuilder(baseProperty) ? getFieldConfig(baseProperty, propertyConfigs) : undefined;\n const optionDisabled = isPropertyBuilder(baseProperty) || (existing && baseProperty.dataType !== values?.dataType);\n const computedFieldConfig = baseFieldConfig ? mergeDeep(baseFieldConfig, propertyConfig) : propertyConfig;\n return <div\n onClick={(e) => {\n if (optionDisabled) {\n e.stopPropagation();\n e.preventDefault();\n }\n }}\n className={cn(\n \"flex items-center\",\n optionDisabled ? \"w-full pointer-events-none opacity-50\" : \"\")}>\n <div className={\"mr-8\"}>\n <PropertyConfigBadge propertyConfig={computedFieldConfig}/>\n </div>\n <div className={\"flex flex-col items-start text-base text-left\"}>\n <div>{computedFieldConfig.name}</div>\n <Typography variant={\"caption\"}\n color={\"disabled\"}>\n {optionDisabled ? \"You can only switch to widgets that use the same data type\" : computedFieldConfig.description}\n </Typography>\n </div>\n </div>\n }}\n onValueChange={(value) => {\n onWidgetSelectChanged(value as FieldConfigId);\n }}>\n {displayedWidgets.map(([key, propertyConfig]) => {\n const baseProperty = propertyConfig.property;\n const optionDisabled = existing && !isPropertyBuilder(baseProperty) && baseProperty.dataType !== values?.dataType;\n return <PropertySelectItem\n key={key}\n value={key}\n optionDisabled={optionDisabled}\n propertyConfig={propertyConfig}\n existing={existing}/>;\n })}\n </Select>\n\n {selectedWidgetError &&\n <Typography variant=\"caption\"\n className={\"ml-3.5\"}\n color={\"error\"}>Required</Typography>}\n\n {/*<Typography variant=\"caption\" className={\"ml-3.5\"}>Define your own custom properties and*/}\n {/* components</Typography>*/}\n\n </div>\n\n {onDelete && values?.id &&\n <IconButton\n variant={\"ghost\"}\n className=\"m-4\"\n disabled={disabled}\n onClick={() => setDeleteDialogOpen(true)}>\n <DeleteIcon/>\n </IconButton>}\n </div>\n\n <div className={\"grid grid-cols-12 gap-y-12 mt-8 mb-8\"}>\n {includeIdAndTitle &&\n <CommonPropertyFields showErrors={showErrors}\n disabledId={existing}\n isNewProperty={!existing}\n existingPropertyKeys={existingPropertyKeys}\n disabled={disabled}\n autoUpdateId={autoUpdateId}\n ref={nameFieldRef}/>}\n\n {childComponent}\n\n <div className={\"col-span-12\"}>\n <AdvancedPropertyValidation disabled={disabled}/>\n </div>\n </div>\n\n {onDelete &&\n <DeleteConfirmationDialog open={deleteDialogOpen}\n onAccept={() => onDelete(values?.id, propertyNamespace)}\n onCancel={() => setDeleteDialogOpen(false)}\n title={<div>Delete this property?</div>}\n body={\n <div> This will <b>not delete any\n data</b>, only modify the\n collection.</div>\n }/>}\n\n </>\n );\n}\n","export function camelCase(str: string): string {\n return (str.slice(0, 1).toLowerCase() + str.slice(1))\n .replace(/([-_ ]){1,}/g, ' ')\n .split(/[-_ ]/)\n .reduce((cur, acc) => {\n return cur + acc[0].toUpperCase() + acc.substring(1);\n }, \"\");\n}\n","import { EntityCollection, useSnackbarController } from \"@firecms/core\";\nimport { Button, ContentCopyIcon, Dialog, DialogActions, DialogContent, Typography, } from \"@firecms/ui\";\nimport React from \"react\";\nimport JSON5 from \"json5\";\nimport { Highlight, themes } from \"prism-react-renderer\"\nimport { camelCase } from \"./utils/strings\";\n\nexport function GetCodeDialog({ collection, onOpenChange, open }: { onOpenChange: (open: boolean) => void, collection: any, open: any }) {\n\n const snackbarController = useSnackbarController();\n\n const code = \"import { EntityCollection } from \\\"firecms\\\";\\n\\nconst \" + camelCase(collection.name) + \"Collection:EntityCollection = \" + JSON5.stringify(collectionToCode(collection), null, \"\\t\");\n return <Dialog open={open}\n onOpenChange={onOpenChange}\n maxWidth={\"4xl\"}>\n <DialogContent>\n <Typography variant={\"h6\"} className={\"my-4\"}>\n Code for {collection.name}\n </Typography>\n <Typography variant={\"body2\"} className={\"my-4 mb-8\"}>\n If you want to customise the collection in code, you can add this collection code to your CMS\n app configuration.\n More info in the <a\n rel=\"noopener noreferrer\"\n href={\"https://firecms.co/docs/customization_quickstart\"}>docs</a>.\n </Typography>\n <Highlight\n theme={themes.vsDark}\n code={code}\n language=\"typescript\"\n >\n {({ className, style, tokens, getLineProps, getTokenProps }) => (\n <pre style={style} className={\"p-4 rounded text-sm\"}>\n {tokens.map((line, i) => (\n <div key={i} {...getLineProps({ line })}>\n {line.map((token, key) => (\n <span key={key} {...getTokenProps({ token })} />\n ))}\n </div>\n ))}\n </pre>\n )}\n </Highlight>\n\n </DialogContent>\n <DialogActions>\n <Button\n variant={\"text\"}\n size={\"small\"}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n snackbarController.open({\n type: \"success\",\n message: `Copied`\n })\n return navigator.clipboard.writeText(code);\n }}>\n <ContentCopyIcon size={\"small\"}/>\n Copy to clipboard\n </Button>\n <Button onClick={() => onOpenChange(false)}>Close</Button>\n </DialogActions>\n </Dialog>;\n}\n\nfunction collectionToCode(collection: EntityCollection): object {\n\n const propertyCleanup = (property: any) => {\n\n const updatedProperty = {\n ...property\n };\n\n delete updatedProperty.fromBuilder;\n delete updatedProperty.resolved;\n delete updatedProperty.propertiesOrder;\n delete updatedProperty.editable;\n\n if (updatedProperty.type === \"map\") {\n return {\n ...updatedProperty,\n properties: updatedProperty.properties.map(propertyCleanup)\n }\n }\n return updatedProperty;\n }\n\n return {\n id: collection.id,\n name: collection.name,\n singularName: collection.singularName,\n path: collection.path,\n description: collection.description,\n editable: true,\n collectionGroup: collection.collectionGroup,\n icon: collection.icon,\n group: collection.group,\n customId: collection.customId,\n initialFilter: collection.initialFilter,\n initialSort: collection.initialSort,\n properties: Object.entries(collection.properties)\n .map(([key, value]) => ({\n [key]: propertyCleanup(value)\n }))\n .reduce((a, b) => ({ ...a, ...b }), {}),\n subcollections: (collection.subcollections ?? []).map(collectionToCode)\n }\n\n}\n","import React, { useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { Field, FormikErrors, getIn, useFormikContext } from \"formik\";\nimport {\n EntityCollection,\n ErrorBoundary,\n isPropertyBuilder,\n makePropertiesEditable,\n Properties,\n Property,\n PropertyConfig,\n PropertyOrBuilder,\n useLargeLayout,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport {\n AddIcon,\n AutoAwesomeIcon,\n Button,\n CircularProgress,\n cn,\n CodeIcon,\n DebouncedTextField,\n defaultBorderMixin,\n IconButton,\n Paper,\n Tooltip,\n Typography,\n} from \"@firecms/ui\";\n\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"./util\";\nimport { OnPropertyChangedParams, PropertyForm, PropertyFormDialog } from \"./PropertyEditView\";\nimport { PropertyTree } from \"./PropertyTree\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\nimport { GetCodeDialog } from \"./GetCodeDialog\";\n\ntype CollectionEditorFormProps = {\n showErrors: boolean;\n isNewCollection: boolean;\n propertyErrorsRef?: React.MutableRefObject<any>;\n onPropertyError: (propertyKey: string, namespace: string | undefined, error?: FormikErrors<any>) => void;\n setDirty?: (dirty: boolean) => void;\n reservedGroups?: string[];\n extraIcon: React.ReactNode;\n getUser: (uid: string) => User | null;\n getData?: () => Promise<object[]>;\n doCollectionInference: (collection: PersistedCollection) => Promise<Partial<EntityCollection> | null> | undefined;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n};\n\nexport function CollectionPropertiesEditorForm({\n showErrors,\n isNewCollection,\n propertyErrorsRef,\n onPropertyError,\n setDirty,\n reservedGroups,\n extraIcon,\n getUser,\n getData,\n doCollectionInference,\n propertyConfigs,\n collectionEditable\n }: CollectionEditorFormProps) {\n\n const {\n values,\n setFieldValue,\n setFieldError,\n setFieldTouched,\n errors,\n dirty\n } = useFormikContext<PersistedCollection>();\n\n const snackbarController = useSnackbarController();\n\n const largeLayout = useLargeLayout();\n const asDialog = !largeLayout\n\n // index of the selected property within the namespace\n const [selectedPropertyIndex, setSelectedPropertyIndex] = useState<number | undefined>();\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n const [codeDialogOpen, setCodeDialogOpen] = useState<boolean>(false);\n\n const [inferringProperties, setInferringProperties] = useState<boolean>(false);\n\n const [newPropertyDialogOpen, setNewPropertyDialogOpen] = useState<boolean>(false);\n const [inferredPropertyKeys, setInferredPropertyKeys] = useState<string[]>([]);\n\n const currentPropertiesOrderRef = React.useRef<{\n [key: string]: string[]\n }>(values.propertiesOrder ? { \"\": values.propertiesOrder } : {});\n\n useEffect(() => {\n if (setDirty)\n setDirty(dirty);\n }, [dirty]);\n\n const inferPropertiesFromData = doCollectionInference\n ? (): void => {\n if (!doCollectionInference)\n return;\n\n setInferringProperties(true);\n // @ts-ignore\n doCollectionInference(values)\n .then((newCollection) => {\n\n if (newCollection)\n makePropertiesEditable(newCollection.properties as Properties);\n\n if (!newCollection) {\n snackbarController.open({\n type: \"error\",\n message: \"Could not infer properties from data\"\n });\n return;\n }\n // find properties in the new collection, not present in the current one\n const newPropertyKeys = (newCollection.properties ? Object.keys(newCollection.properties) : [])\n .filter((propertyKey) => !values.properties[propertyKey]);\n if (newPropertyKeys.length === 0) {\n snackbarController.open({\n type: \"info\",\n message: \"No new properties found in existing data\"\n });\n return;\n }\n // add them to the current collection\n const updatedProperties = {\n ...newPropertyKeys.reduce((acc, propertyKey) => {\n acc[propertyKey] = (newCollection.properties ?? {})[propertyKey];\n return acc;\n }, {} as { [key: string]: PropertyOrBuilder }),\n ...values.properties\n };\n const updatedPropertiesOrder = [\n ...newPropertyKeys,\n ...(values.propertiesOrder ?? [])\n ];\n setFieldValue(\"properties\", updatedProperties, false);\n\n updatePropertiesOrder(updatedPropertiesOrder);\n\n setInferredPropertyKeys(newPropertyKeys);\n })\n .finally(() => {\n setInferringProperties(false);\n })\n }\n : undefined;\n\n const getCurrentPropertiesOrder = (namespace?: string) => {\n if (!namespace) return currentPropertiesOrderRef.current[\"\"];\n return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));\n }\n\n const updatePropertiesOrder = (newPropertiesOrder: string[], namespace?: string) => {\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n setFieldValue(propertiesOrderPath, newPropertiesOrder, false);\n currentPropertiesOrderRef.current[namespace ?? \"\"] = newPropertiesOrder;\n\n };\n\n const deleteProperty = (propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n setFieldValue(idToPropertiesPath(fullId), undefined, false);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n const newPropertiesOrder = currentPropertiesOrder.filter((p) => p !== propertyKey);\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n setNewPropertyDialogOpen(false);\n\n setSelectedPropertyIndex(undefined);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n };\n\n const onPropertyMove = (propertiesOrder: string[], namespace?: string) => {\n setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);\n };\n\n const onPropertyCreated = ({\n id,\n property\n }: {\n id?: string,\n property: Property\n }) => {\n if (!id) {\n throw Error(\"Need to include an ID when creating a new property\")\n }\n setFieldValue(\"properties\", {\n ...(values.properties ?? {}),\n [id]: property\n }, false);\n const newPropertiesOrder = [...(values.propertiesOrder ?? Object.keys(values.properties)), id];\n\n updatePropertiesOrder(newPropertiesOrder);\n\n setNewPropertyDialogOpen(false);\n if (largeLayout) {\n setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n setSelectedPropertyKey(id);\n }\n setSelectedPropertyNamespace(undefined);\n };\n\n const onPropertyChanged = ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => {\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // If the id has changed we need to a little cleanup\n if (previousId && previousId !== id) {\n const previousFullId = getFullId(previousId, namespace);\n const previousPropertyPath = idToPropertiesPath(previousFullId);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n\n // replace previousId with id in propertiesOrder\n const newPropertiesOrder = currentPropertiesOrder\n .map((p) => p === previousId ? id : p)\n .filter((p) => p !== undefined) as string[];\n\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n if (id) {\n setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n setSelectedPropertyKey(id);\n }\n setFieldValue(previousPropertyPath, undefined, false);\n setFieldTouched(previousPropertyPath, false, false);\n }\n\n console.debug(\"onPropertyChanged\", {\n id,\n property,\n previousId,\n namespace,\n propertyPath\n })\n\n if (propertyPath) {\n setFieldValue(propertyPath, property, false);\n setFieldTouched(propertyPath, true, false);\n }\n\n };\n\n const onPropertyErrorInternal = useCallback((id: string, namespace?: string, error?: FormikErrors<any>) => {\n const propertyPath = id ? getFullId(id, namespace) : undefined;\n console.warn(\"onPropertyErrorInternal\", {\n id,\n namespace,\n error,\n propertyPath\n });\n if (propertyPath) {\n const hasError = error && Object.keys(error).length > 0;\n onPropertyError(id, namespace, hasError ? error : undefined);\n setFieldError(idToPropertiesPath(propertyPath), hasError ? \"Property error\" : undefined);\n }\n }, [])\n\n const closePropertyDialog = () => {\n setSelectedPropertyIndex(undefined);\n setSelectedPropertyKey(undefined);\n };\n\n const initialErrors = selectedPropertyKey && propertyErrorsRef?.current?.properties ? propertyErrorsRef.current.properties[selectedPropertyKey] : undefined;\n\n const emptyCollection = values?.propertiesOrder === undefined || values.propertiesOrder.length === 0;\n\n const usedPropertiesOrder = (values.propertiesOrder\n ? values.propertiesOrder\n : Object.keys(values.properties)) as string[];\n\n const owner = useMemo(() => getUser(values.ownerId), [getUser, values.ownerId]);\n const body = (\n <div className={\"grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900\"}>\n <div className={cn(\n \"p-4 md:p-8 pb-20 md:pb-20\",\n \"col-span-12 lg:col-span-5 h-full overflow-auto\",\n !asDialog && \"border-r \" + defaultBorderMixin\n )}>\n\n <div className=\"flex my-2\">\n\n <div className=\"flex-grow mb-4\">\n\n <Field\n name={\"name\"}\n as={DebouncedTextField}\n invisible={true}\n className=\"-ml-1\"\n inputClassName=\"text-2xl font-headers\"\n placeholder={\"Collection name\"}\n size={\"small\"}\n required\n error={Boolean(errors?.name)}/>\n\n {owner &&\n <Typography variant={\"body2\"}\n className={\"ml-2\"}\n color={\"secondary\"}>\n Created by {owner.displayName}\n </Typography>}\n </div>\n\n {extraIcon && <div className=\"ml-4\">\n {extraIcon}\n </div>}\n\n <div className=\"ml-1 mt-2 flex flex-row gap-2\">\n <Tooltip title={\"Get the code for this collection\"}>\n <IconButton\n variant={\"filled\"}\n disabled={inferringProperties}\n onClick={() => setCodeDialogOpen(true)}>\n <CodeIcon/>\n </IconButton>\n </Tooltip>\n {inferPropertiesFromData && <Tooltip title={\"Add new properties based on data\"}>\n <IconButton\n variant={\"filled\"}\n disabled={inferringProperties}\n onClick={inferPropertiesFromData}>\n {inferringProperties ? <CircularProgress size={\"small\"}/> : <AutoAwesomeIcon/>}\n </IconButton>\n </Tooltip>}\n <Tooltip title={\"Add new property\"}>\n <Button\n variant={\"outlined\"}\n onClick={() => setNewPropertyDialogOpen(true)}>\n <AddIcon/>\n </Button>\n </Tooltip>\n </div>\n </div>\n\n <ErrorBoundary>\n <PropertyTree\n className={\"pl-8\"}\n onPropertyClick={(propertyKey, namespace) => {\n setSelectedPropertyIndex(usedPropertiesOrder.indexOf(propertyKey));\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n }}\n inferredPropertyKeys={inferredPropertyKeys}\n selectedPropertyKey={selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined}\n properties={values.properties}\n additionalFields={values.additionalFields}\n propertiesOrder={usedPropertiesOrder}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={isNewCollection ? deleteProperty : undefined}\n collectionEditable={collectionEditable}\n errors={showErrors ? errors : {}}/>\n </ErrorBoundary>\n\n <Button className={\"mt-8 w-full\"}\n color=\"primary\"\n variant={\"outlined\"}\n size={\"large\"}\n onClick={() => setNewPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}>\n Add new property\n </Button>\n </div>\n\n {!asDialog &&\n <div className={\"col-span-12 lg:col-span-7 ml-2 p-4 md:p-8 h-full overflow-auto pb-20 md:pb-20\"}>\n <Paper\n className=\"sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center \">\n\n {selectedPropertyFullId &&\n selectedProperty &&\n !isPropertyBuilder(selectedProperty) &&\n <PropertyForm\n inArray={false}\n key={`edit_view_${selectedPropertyIndex}`}\n existingProperty={!isNewCollection}\n autoUpdateId={false}\n allowDataInference={!isNewCollection}\n autoOpenTypeSelect={false}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n onPropertyChanged={onPropertyChanged}\n onDelete={deleteProperty}\n onError={onPropertyErrorInternal}\n forceShowErrors={showErrors}\n initialErrors={initialErrors}\n getData={getData}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n />}\n\n {!selectedProperty &&\n <Typography variant={\"label\"} className=\"flex items-center justify-center h-full\">\n {emptyCollection\n ? \"Now you can add your first property\"\n : \"Select a property to edit it\"}\n </Typography>}\n\n {selectedProperty && isPropertyBuilder(selectedProperty) &&\n <Typography variant={\"label\"} className=\"flex items-center justify-center\">\n {\"This property is defined as a property builder in code\"}\n </Typography>}\n </Paper>\n </div>}\n\n {asDialog && <PropertyFormDialog\n inArray={false}\n open={selectedPropertyIndex !== undefined}\n key={`edit_view_${selectedPropertyIndex}`}\n autoUpdateId={!selectedProperty}\n allowDataInference={!isNewCollection}\n existingProperty={true}\n autoOpenTypeSelect={false}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n onPropertyChanged={onPropertyChanged}\n onDelete={deleteProperty}\n onError={onPropertyErrorInternal}\n forceShowErrors={showErrors}\n initialErrors={initialErrors}\n getData={getData}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n onOkClicked={asDialog\n ? closePropertyDialog\n : undefined\n }/>}\n\n </div>);\n\n return (<>\n\n {body}\n\n {/* This is the dialog used for new properties*/}\n <PropertyFormDialog\n inArray={false}\n existingProperty={false}\n autoOpenTypeSelect={true}\n autoUpdateId={true}\n forceShowErrors={showErrors}\n open={newPropertyDialogOpen}\n onCancel={() => setNewPropertyDialogOpen(false)}\n onPropertyChanged={onPropertyCreated}\n getData={getData}\n allowDataInference={!isNewCollection}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n existingPropertyKeys={values.propertiesOrder as string[]}/>\n\n <GetCodeDialog\n collection={values}\n open={codeDialogOpen}\n onOpenChange={setCodeDialogOpen}/>\n\n </>\n );\n}\n","import React from \"react\";\nimport { Button, Dialog, DialogActions, DialogContent, Typography } from \"@firecms/ui\";\n\nexport interface UnsavedChangesDialogProps {\n open: boolean;\n body?: React.ReactNode;\n title?: string;\n handleOk: () => void;\n handleCancel: () => void;\n}\n\nexport function UnsavedChangesDialog({\n open,\n handleOk,\n handleCancel,\n body,\n title\n }: UnsavedChangesDialogProps) {\n\n return (\n <Dialog\n open={open}\n onOpenChange={(open) => open ? handleCancel() : handleOk()}\n aria-labelledby=\"alert-dialog-title\"\n aria-describedby=\"alert-dialog-description\"\n >\n <DialogContent>\n <Typography variant={\"h6\"}>\n {title ?? \"Unsaved changes\"}\n </Typography>\n\n {body && <Typography>\n {body}\n </Typography>}\n <Typography>\n Are you sure?\n </Typography>\n\n </DialogContent>\n\n <DialogActions>\n <Button variant=\"text\" onClick={handleCancel} autoFocus> Cancel </Button>\n <Button onClick={handleOk}> Ok </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import { useCustomizationController } from \"@firecms/core\";\nimport { Button, Dialog, DialogActions, DialogContent, Typography } from \"@firecms/ui\";\nimport React from \"react\";\n\nexport function EntityCustomViewsSelectDialog({ open, onClose }: { open: boolean, onClose: (selectedViewKey?: string) => void }) {\n const {\n entityViews,\n } = useCustomizationController();\n\n return <Dialog\n maxWidth={\"md\"}\n open={open}>\n <DialogContent className={\"flex flex-col gap-4\"}>\n <Typography variant={\"h6\"}>\n Select view\n </Typography>\n {entityViews?.map((view) => {\n return <Button\n key={view.key}\n onClick={() => onClose(view.key)}\n fullWidth\n variant={\"text\"}\n >\n {view.name} ({view.key})\n </Button>;\n })}\n {(entityViews ?? []).length === 0 &&\n <Typography variant={\"body2\"}>\n No custom views defined\n </Typography>\n }\n </DialogContent>\n <DialogActions>\n <Button variant={\"outlined\"} onClick={() => onClose()}>Cancel</Button>\n </DialogActions>\n </Dialog>\n}\n","import React from \"react\";\nimport {\n DeleteConfirmationDialog,\n EntityCollection,\n EntityCustomView,\n resolveEntityView,\n useCustomizationController,\n User\n} from \"@firecms/core\";\nimport {\n AddIcon,\n Button,\n Container,\n DeleteIcon,\n IconButton,\n InfoLabel,\n Paper,\n Table,\n TableBody,\n TableCell,\n TableRow,\n Tooltip,\n Typography,\n} from \"@firecms/ui\";\nimport { useFormikContext } from \"formik\";\nimport { CollectionEditorDialog } from \"./CollectionEditorDialog\";\nimport { CollectionsConfigController } from \"../../types/config_controller\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\nimport { CollectionInference } from \"../../types/collection_inference\";\nimport { EntityCustomViewsSelectDialog } from \"./EntityCustomViewsSelectDialog\";\n\nexport function SubcollectionsEditTab({\n collection,\n parentCollection,\n configController,\n collectionInference,\n getUser,\n parentCollectionIds\n }: {\n collection: PersistedCollection,\n parentCollection?: EntityCollection,\n configController: CollectionsConfigController;\n collectionInference?: CollectionInference;\n getUser: (uid: string) => User | null;\n parentCollectionIds?: string[];\n}) {\n\n const { entityViews: contextEntityViews } = useCustomizationController();\n\n const [subcollectionToDelete, setSubcollectionToDelete] = React.useState<string | undefined>();\n const [addEntityViewDialogOpen, setAddEntityViewDialogOpen] = React.useState<boolean>(false);\n const [viewToDelete, setViewToDelete] = React.useState<string | undefined>();\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n editedCollectionPath?: string,\n }>();\n\n const {\n values,\n setFieldValue,\n } = useFormikContext<EntityCollection>();\n\n const subcollections = collection.subcollections ?? [];\n const resolvedEntityViews = values.entityViews?.filter(e => typeof e === \"string\")\n .map(e => resolveEntityView(e, contextEntityViews))\n .filter(Boolean) as EntityCustomView[] ?? [];\n const hardCodedEntityViews = collection.entityViews?.filter(e => typeof e !== \"string\") as EntityCustomView[] ?? [];\n const totalEntityViews = resolvedEntityViews.length + hardCodedEntityViews.length;\n\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"2xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n <div className={\"flex flex-col gap-16\"}>\n\n <div className={\"flex-grow flex flex-col gap-4 items-start\"}>\n <Typography variant={\"h5\"}>\n Subcollections of {values.name}\n </Typography>\n\n {subcollections && subcollections.length > 0 &&\n <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n <Table>\n <TableBody>\n {subcollections.map((subcollection) => (\n <TableRow key={subcollection.path}\n onClick={() => setCurrentDialog({\n isNewCollection: false,\n editedCollectionPath: subcollection.path,\n })}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {subcollection.name}\n </Typography>\n </TableCell>\n <TableCell\n align=\"right\">\n <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n setSubcollectionToDelete(subcollection.path);\n }}\n color=\"inherit\">\n <DeleteIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Paper>}\n\n <Button\n onClick={() => {\n setCurrentDialog({\n isNewCollection: true\n });\n }}\n variant={\"outlined\"}\n startIcon={<AddIcon/>}>\n Add subcollection\n </Button>\n </div>\n\n <div className={\"flex-grow flex flex-col gap-4 items-start\"}>\n <Typography variant={\"h5\"}>\n Custom views\n </Typography>\n\n {totalEntityViews > 0 && <>\n <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n <Table>\n <TableBody>\n {resolvedEntityViews.map((view) => (\n <TableRow key={view.key}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {view.name}\n </Typography>\n </TableCell>\n <TableCell\n align=\"right\">\n <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n setViewToDelete(view.key);\n }}\n color=\"inherit\">\n <DeleteIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n </TableCell>\n </TableRow>\n ))}\n {hardCodedEntityViews.map((view) => (\n <TableRow key={view.key}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {view.name}\n </Typography>\n <Typography variant={\"caption\"} className={\"flex-grow\"}>\n This view is defined in code with\n key <code>{view.key}</code>\n </Typography>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Paper>\n\n </>}\n\n {totalEntityViews === 0 &&\n <InfoLabel>\n <b>COMING SOON</b> Define your own custom views by uploading it with the CLI\n </InfoLabel>\n }\n\n <Button\n onClick={() => {\n setAddEntityViewDialogOpen(true);\n }}\n variant={\"outlined\"}\n startIcon={<AddIcon/>}>\n Add custom entity view\n </Button>\n\n </div>\n\n </div>\n </Container>\n\n <div style={{ height: \"52px\" }}/>\n\n {subcollectionToDelete &&\n <DeleteConfirmationDialog open={Boolean(subcollectionToDelete)}\n onAccept={() => {\n configController.deleteCollection({\n path: subcollectionToDelete,\n parentCollectionIds: [...(parentCollectionIds ?? []), collection.path]\n });\n setSubcollectionToDelete(undefined);\n }}\n onCancel={() => setSubcollectionToDelete(undefined)}\n title={<>Delete this subcollection?</>}\n body={<> This will <b>not\n delete any data</b>, only\n the collection in the CMS</>}/>}\n {viewToDelete &&\n <DeleteConfirmationDialog open={Boolean(viewToDelete)}\n onAccept={() => {\n setFieldValue(\"entityViews\", values.entityViews?.filter(e => e !== viewToDelete));\n setViewToDelete(undefined);\n }}\n onCancel={() => setViewToDelete(undefined)}\n title={<>Remove this view?</>}\n body={<>This will <b>not\n delete any data</b>, only\n the view in the CMS</>}/>}\n\n <CollectionEditorDialog\n open={Boolean(currentDialog)}\n configController={configController}\n parentCollection={collection}\n collectionInference={collectionInference}\n parentCollectionIds={[...parentCollectionIds ?? [], values.id]}\n isNewCollection={false}\n {...currentDialog}\n getUser={getUser}\n handleClose={() => {\n setCurrentDialog(undefined);\n }}/>\n\n <EntityCustomViewsSelectDialog\n open={addEntityViewDialogOpen}\n onClose={(selectedViewKey) => {\n if (selectedViewKey) {\n setFieldValue(\"entityViews\", [...(values.entityViews ?? []), selectedViewKey]);\n }\n setAddEntityViewDialogOpen(false);\n }}/>\n </div>\n );\n}\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const productsCollectionTemplate: EntityCollection = {\n id: \"products\",\n path: \"products\",\n name: \"Products\",\n singularName: \"Product\",\n icon: \"shopping_cart\",\n description: \"List of the products currently sold in your shop\",\n properties: makePropertiesEditable({\n name: {\n dataType: \"string\",\n name: \"Name\",\n description: \"Name of this product\",\n validation: {\n required: true\n }\n },\n brand: {\n dataType: \"string\",\n name: \"Brand\",\n validation: {\n required: true\n }\n },\n description: {\n dataType: \"string\",\n name: \"Description\",\n description: \"Description of this product, supports markdown\",\n markdown: true\n },\n main_image: {\n dataType: \"string\",\n name: \"Image\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n },\n description: \"Upload field for images\"\n },\n available: {\n dataType: \"boolean\",\n name: \"Available\",\n columnWidth: 100,\n description: \"Is this product available in the website\"\n },\n price: {\n dataType: \"number\",\n name: \"Price\",\n validation: {\n requiredMessage: \"You must set a positive price\",\n min: 0\n }\n },\n images: {\n dataType: \"array\",\n name: \"Images\",\n hideFromCollection: true,\n of: {\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"]\n }\n }\n },\n related_products: {\n dataType: \"array\",\n name: \"Related products\",\n description: \"Products related to this one\",\n of: {\n dataType: \"reference\",\n path: \"products\"\n }\n },\n metadata: {\n name: \"Metadata\",\n description: \"This is an example of a map property\",\n dataType: \"map\",\n keyValue: true\n },\n added_on: {\n dataType: \"date\",\n name: \"Added on\",\n autoValue: \"on_create\"\n }\n })\n};\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const blogCollectionTemplate:EntityCollection = {\n id: \"blog\",\n path: \"blog\",\n name: \"Blog\",\n singularName: \"Blog entry\",\n icon: \"article\",\n description: \"A collection of blog entries\",\n defaultSize: \"l\",\n properties: makePropertiesEditable({\n name: {\n name: \"Name\",\n validation: { required: true },\n dataType: \"string\"\n },\n header_image: {\n name: \"Header image\",\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n metadata: {\n cacheControl: \"max-age=1000000\"\n }\n }\n },\n content: {\n name: \"Content\",\n description: \"Content blocks for the blog entry\",\n validation: { required: true },\n dataType: \"array\",\n oneOf: {\n typeField: \"type\",\n valueField: \"value\",\n properties: {\n text: {\n dataType: \"string\",\n name: \"Text\",\n markdown: true\n },\n quote: {\n dataType: \"string\",\n name: \"Quote\",\n multiline: true\n },\n images: {\n name: \"Images\",\n dataType: \"array\",\n of: {\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n metadata: {\n cacheControl: \"max-age=1000000\"\n }\n }\n },\n description: \"This fields allows uploading multiple images at once and reordering\"\n },\n products: {\n name: \"Products\",\n dataType: \"array\",\n of: {\n dataType: \"reference\",\n path: \"products\",\n previewProperties: [\"name\", \"main_image\"]\n }\n }\n },\n propertiesOrder: [\"text\", \"quote\", \"images\", \"products\"]\n }\n },\n created_on: {\n name: \"Created on\",\n dataType: \"date\",\n autoValue: \"on_create\"\n },\n status: {\n name: \"Status\",\n validation: { required: true },\n dataType: \"string\",\n enumValues: {\n published: {\n id: \"published\",\n label: \"Published\",\n },\n draft: \"Draft\"\n },\n defaultValue: \"draft\"\n },\n publish_date: {\n name: \"Publish date\",\n dataType: \"date\",\n clearable: true\n },\n reviewed: {\n name: \"Reviewed\",\n dataType: \"boolean\"\n },\n tags: {\n name: \"Tags\",\n description: \"Example of generic array\",\n dataType: \"array\",\n of: {\n dataType: \"string\",\n previewAsTag: true\n }\n }\n }),\n initialFilter: {\n status: [\"==\", \"published\"]\n }\n};\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const usersCollectionTemplate: EntityCollection = {\n id: \"users\",\n path: \"users\",\n name: \"Users\",\n singularName: \"User\",\n description: \"Registered users in the app/web\",\n icon: \"person\",\n properties: makePropertiesEditable({\n displayName: {\n name: \"Display name\",\n dataType: \"string\"\n },\n email: {\n name: \"Email\",\n dataType: \"string\",\n email: true\n },\n emailVerified: {\n name: \"Email verified\",\n dataType: \"boolean\"\n },\n phone: {\n name: \"Phone\",\n dataType: \"string\"\n },\n favourite_products: {\n name: \"Favourite products\",\n dataType: \"array\",\n of: {\n dataType: \"reference\",\n path: \"products\"\n }\n },\n photoURL: {\n name: \"Photo URL\",\n dataType: \"string\",\n url: \"image\"\n }\n }),\n};\n","import { EntityCollection } from \"@firecms/core\";\n\nexport const pagesCollectionTemplate: EntityCollection = {\n id: \"pages\",\n path: \"pages\",\n name: \"Pages\",\n singularName: \"Page\",\n icon: \"insert_drive_file\",\n description: \"List of website pages that can be edited here\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Page Title\",\n validation: { required: true }\n },\n slug: {\n dataType: \"string\",\n name: \"URL Slug\",\n validation: {\n required: true,\n unique: true,\n matches: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n matchesMessage: \"Must be lowercase, alphanumeric, and hyphenated\"\n }\n },\n hero_section: {\n dataType: \"map\",\n name: \"Hero Section\",\n properties: {\n headline: {\n dataType: \"string\",\n name: \"Headline\",\n validation: { required: true }\n },\n subhead: {\n dataType: \"string\",\n name: \"Subheadline\"\n },\n background_image: {\n dataType: \"string\",\n name: \"Background Image\",\n storage: {\n storagePath: \"page_hero/images\",\n acceptedFiles: [\"image/*\"],\n }\n },\n call_to_action: {\n dataType: \"string\",\n name: \"Call to Action\"\n },\n call_to_action_link: {\n dataType: \"string\",\n name: \"CTA Link\",\n url: true\n }\n }\n },\n content: {\n dataType: \"array\",\n name: \"Content\",\n oneOf: {\n properties: {\n section: {\n dataType: \"map\",\n name: \"Section\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Section Title\",\n validation: { required: true }\n },\n content: {\n dataType: \"string\",\n name: \"Section Content\",\n markdown: true\n },\n image: {\n dataType: \"string\",\n name: \"Section Image\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n },\n link: {\n dataType: \"string\",\n name: \"Section Link\",\n url: true\n }\n }\n },\n image: {\n dataType: \"string\",\n name: \"Image\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n },\n slider: {\n dataType: \"array\",\n name: \"Slider\",\n of: {\n dataType: \"map\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Title\",\n validation: { required: true }\n },\n image: {\n dataType: \"string\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n }\n }\n }\n },\n }\n }\n },\n sidebar: {\n dataType: \"map\",\n name: \"Sidebar\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Sidebar Title\",\n validation: { required: false }\n },\n content: {\n dataType: \"string\",\n name: \"Sidebar Content\",\n markdown: true\n }\n }\n },\n seo_metadata: {\n dataType: \"map\",\n name: \"SEO Metadata\",\n properties: {\n meta_title: {\n dataType: \"string\",\n name: \"Meta Title\"\n },\n meta_description: {\n dataType: \"string\",\n name: \"Meta Description\"\n },\n focus_keywords: {\n dataType: \"array\",\n name: \"Focus Keywords\",\n of: {\n dataType: \"string\"\n }\n }\n }\n },\n footer_override: {\n dataType: \"string\",\n name: \"Footer Override\",\n markdown: true\n },\n publish_date: {\n dataType: \"date\",\n name: \"Publish Date\",\n validation: { required: true }\n },\n last_updated: {\n dataType: \"date\",\n name: \"Last Updated\",\n autoValue: \"on_update\"\n },\n is_published: {\n dataType: \"boolean\",\n name: \"Is Published\",\n columnWidth: 100,\n description: \"Should this page be live on the site?\"\n },\n author_uid: {\n dataType: \"reference\",\n name: \"Author\",\n path: \"users\"\n }\n }\n};\n","import React, { useEffect, useState } from \"react\";\nimport { EntityCollection, unslugify, } from \"@firecms/core\";\nimport { Button, Card, Chip, CircularProgress, cn, Container, Icon, Tooltip, Typography, } from \"@firecms/ui\";\nimport { useFormikContext } from \"formik\";\n\nimport { productsCollectionTemplate } from \"./templates/products_template\";\nimport { blogCollectionTemplate } from \"./templates/blog_template\";\nimport { usersCollectionTemplate } from \"./templates/users_template\";\nimport { ImportFileUpload } from \"@firecms/data_import_export\";\nimport { pagesCollectionTemplate } from \"./templates/pages_template\";\n\nexport function CollectionEditorWelcomeView({\n path,\n pathSuggestions,\n parentCollection,\n onContinue,\n collections\n }: {\n path: string;\n pathSuggestions?: (path: string) => Promise<string[]>;\n parentCollection?: EntityCollection;\n onContinue: (importData?: object[]) => void;\n collections?: EntityCollection[];\n}) {\n\n const [loadingPathSuggestions, setLoadingPathSuggestions] = useState(false);\n const [filteredPathSuggestions, setFilteredPathSuggestions] = useState<string[] | undefined>();\n useEffect(() => {\n if (pathSuggestions && collections) {\n setLoadingPathSuggestions(true);\n pathSuggestions(path)\n .then(suggestions => {\n const filteredSuggestions = suggestions.filter(s => !collections.find(c => c.path.trim().toLowerCase() === s.trim().toLowerCase()));\n setFilteredPathSuggestions(filteredSuggestions);\n })\n .finally(() => setLoadingPathSuggestions(false));\n }\n }, [collections, path, pathSuggestions]);\n\n const {\n values,\n setFieldValue,\n setValues,\n handleChange,\n touched,\n errors,\n setFieldTouched,\n isSubmitting,\n submitCount\n } = useFormikContext<EntityCollection>();\n\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"4xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <div\n className=\"flex flex-row py-2 pt-3 items-center\">\n <Typography variant={\"h4\"} className={\"flex-grow\"}>\n New collection\n </Typography>\n </div>\n\n {parentCollection && <Chip colorScheme={\"tealDarker\"}>\n <Typography variant={\"caption\"}>\n This is a subcollection of <b>{parentCollection.name}</b>\n </Typography>\n </Chip>}\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Use one of the existing paths in your database:\n </Typography>\n <div className={\"flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7\"}>\n\n {loadingPathSuggestions && !filteredPathSuggestions && <CircularProgress size={\"small\"}/>}\n\n {filteredPathSuggestions?.map((suggestion, index) => (\n <Chip key={suggestion}\n colorScheme={\"cyanLighter\"}\n onClick={() => {\n setFieldValue(\"name\", unslugify(suggestion));\n setFieldValue(\"id\", suggestion);\n setFieldValue(\"path\", suggestion);\n setFieldValue(\"properties\", undefined);\n onContinue();\n }}\n size=\"small\">\n {suggestion}\n </Chip>\n ))}\n\n {!loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0 &&\n <Typography variant={\"caption\"}>\n No suggestions\n </Typography>\n }\n\n </div>\n\n </div>\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Select a template:\n </Typography>\n\n <div className={\"flex gap-4\"}>\n <TemplateButton title={\"Products\"}\n subtitle={\"A collection of products with images, prices and stock\"}\n icon={<Icon size={\"small\"} iconKey={productsCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(productsCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Users\"}\n subtitle={\"A collection of users with emails, names and roles\"}\n icon={<Icon size={\"small\"} iconKey={usersCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(usersCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Blog posts\"}\n subtitle={\"A collection of blog posts with images, authors and complex content\"}\n icon={<Icon size={\"small\"} iconKey={blogCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(blogCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Pages\"}\n subtitle={\"A collection of pages with images, authors and complex content\"}\n icon={<Icon size={\"small\"} iconKey={pagesCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(pagesCollectionTemplate);\n onContinue();\n }}/>\n </div>\n\n </div>\n\n {!parentCollection && <div>\n\n <Typography variant={\"caption\"}\n color={\"secondary\"}\n className={\"mb-2\"}>\n ● Create a collection from a file (csv, json, xls, xslx...)\n </Typography>\n\n <ImportFileUpload onDataAdded={(data) => onContinue(data)}/>\n\n </div>}\n\n <div>\n\n <Button variant={\"text\"} onClick={() => onContinue()} className={\"my-2\"}>\n Continue from scratch\n </Button>\n </div>\n\n {/*<div style={{ height: \"52px\" }}/>*/}\n\n </Container>\n </div>\n );\n}\n\nexport function TemplateButton({\n title,\n subtitle,\n icon,\n onClick\n }: {\n title: string,\n icon: React.ReactNode,\n subtitle: string,\n onClick?: () => void\n}) {\n\n return (\n <Tooltip title={subtitle}>\n <Card\n onClick={onClick}\n className={cn(\n \"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center\",\n \"text-gray-700 dark:text-gray-300\",\n \"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary\",\n \"border-gray-400 dark:border-gray-600 \"\n )}\n >\n {icon}\n <div className={\"flex flex-col items-start\"}>\n\n <Typography variant={\"subtitle1\"}>\n {title}\n </Typography>\n {/*<Typography>*/}\n {/* {subtitle}*/}\n {/*</Typography>*/}\n\n </div>\n </Card>\n </Tooltip>\n );\n\n}\n","import {\n DataNewPropertiesMapping,\n getInferenceType,\n ImportConfig,\n ImportNewPropertyFieldPreview\n} from \"@firecms/data_import_export\";\nimport { getIn, useFormikContext } from \"formik\";\n\nimport { PropertyConfigBadge, getFieldConfig, getFieldId, Properties, Property, PropertyConfig, } from \"@firecms/core\";\nimport { Container, Select, Tooltip, Typography } from \"@firecms/ui\";\nimport React, { useState } from \"react\";\nimport { OnPropertyChangedParams, PropertyFormDialog, PropertyWithId } from \"../PropertyEditView\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"../util\";\nimport { PersistedCollection } from \"../../../types/persisted_collection\";\nimport { updatePropertyFromWidget } from \"../utils/update_property_for_widget\";\nimport { PropertySelectItem } from \"../PropertySelectItem\";\nimport { supportedFields } from \"../utils/supported_fields\";\nimport { buildPropertyFromData } from \"@firecms/schema_inference\";\n\nexport function CollectionEditorImportMapping({\n importConfig,\n propertyConfigs,\n collectionEditable\n }:\n {\n importConfig: ImportConfig,\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean\n }) {\n\n const {\n setFieldValue,\n setFieldTouched,\n values\n } = useFormikContext<PersistedCollection>();\n const [selectedProperty, setSelectedProperty] = useState<PropertyWithId | undefined>(undefined);\n\n const currentPropertiesOrderRef = React.useRef<{\n [key: string]: string[]\n }>(values.propertiesOrder ? { \"\": values.propertiesOrder } : {});\n\n const propertyKey = selectedProperty ? selectedProperty.id : undefined;\n const property = selectedProperty || undefined;\n\n const onPropertyChanged = ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => {\n\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // setSelectedProperty(property);\n const getCurrentPropertiesOrder = (namespace?: string) => {\n if (!namespace) return currentPropertiesOrderRef.current[\"\"];\n return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));\n }\n\n const updatePropertiesOrder = (newPropertiesOrder: string[], namespace?: string) => {\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n setFieldValue(propertiesOrderPath, newPropertiesOrder, false);\n currentPropertiesOrderRef.current[namespace ?? \"\"] = newPropertiesOrder;\n\n };\n\n // If the id has changed we need to a little cleanup\n if (previousId && previousId !== id) {\n const previousFullId = getFullId(previousId, namespace);\n const previousPropertyPath = idToPropertiesPath(previousFullId);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n\n // replace previousId with id in propertiesOrder\n const newPropertiesOrder = currentPropertiesOrder\n .map((p) => p === previousId ? id : p)\n .filter((p) => p !== undefined) as string[];\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n // replace previousId with id in headersMapping\n const newHeadersMapping = { ...importConfig.headersMapping };\n Object.keys(newHeadersMapping).forEach((key) => {\n if (newHeadersMapping[key] === previousId) {\n newHeadersMapping[key] = id ?? \"\";\n }\n });\n importConfig.setHeadersMapping(newHeadersMapping);\n\n // if (id) {\n // setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n // setSelectedPropertyKey(id);\n // }\n setFieldValue(previousPropertyPath, undefined, false);\n setFieldTouched(previousPropertyPath, false, false);\n }\n\n if (propertyPath) {\n setFieldValue(propertyPath, property, false);\n setFieldTouched(propertyPath, true, false);\n }\n };\n const onPropertyTypeChanged = async ({\n id,\n importKey,\n property,\n namespace\n }: OnPropertyChangedParams & {\n importKey: string\n }) => {\n\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // we try to infer the rest of the properties of a property, from the type and the data\n const propertyData = importConfig.importData.map((d) => getIn(d, importKey));\n const inferredNewProperty = {\n ...buildPropertyFromData(propertyData, property, getInferenceType),\n editable: true\n };\n\n if (propertyPath) {\n if (inferredNewProperty) {\n setFieldValue(propertyPath, inferredNewProperty, false);\n } else {\n setFieldValue(propertyPath, property, false);\n }\n setFieldTouched(propertyPath, true, false);\n }\n };\n\n return (\n\n <div className={\"overflow-auto my-auto bg-gray-50 dark:bg-gray-900\"}>\n <Container maxWidth={\"6xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <Typography variant=\"h6\" className={\"mt-4\"}>Data property mapping</Typography>\n\n <DataNewPropertiesMapping headersMapping={importConfig.headersMapping}\n idColumn={importConfig.idColumn}\n originProperties={importConfig.originProperties}\n destinationProperties={values.properties as Properties}\n onIdPropertyChanged={(value) => importConfig.setIdColumn(value)}\n buildPropertyView={({\n property,\n propertyKey,\n importKey\n }) => {\n return <ImportNewPropertyFieldPreview\n property={property}\n propertyKey={propertyKey}\n onPropertyNameChanged={(propertyKey: string, value: string) => setFieldValue(`properties.${propertyKey}.name`, value, false)}\n onEditClick={() => {\n if (!propertyKey || !property) return;\n setSelectedProperty({\n ...property,\n id: propertyKey,\n editable: true\n });\n }}\n propertyTypeView={<PropertySelect property={property}\n disabled={false}\n onPropertyChanged={(props) => onPropertyTypeChanged({\n ...props,\n importKey\n })}\n propertyKey={propertyKey}\n propertyConfigs={propertyConfigs}/>}\n />;\n }}/>\n </Container>\n\n <PropertyFormDialog\n open={selectedProperty !== undefined}\n propertyKey={propertyKey}\n property={property}\n inArray={false}\n autoUpdateId={false}\n onPropertyChanged={onPropertyChanged}\n allowDataInference={false}\n collectionEditable={collectionEditable}\n onOkClicked={() => {\n setSelectedProperty(undefined);\n }}\n onCancel={() => {\n setSelectedProperty(undefined);\n }}\n autoOpenTypeSelect={false}\n existingProperty={false}\n propertyConfigs={propertyConfigs}/>\n\n <div style={{ height: \"52px\" }}/>\n </div>\n );\n\n}\n\nfunction PropertySelect({\n property,\n onPropertyChanged,\n propertyKey,\n propertyConfigs,\n disabled\n }: {\n property: Property | null,\n propertyKey: string | null,\n onPropertyChanged: ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => void,\n propertyConfigs: Record<string, PropertyConfig>,\n disabled?: boolean\n}) {\n\n const fieldId = property ? getFieldId(property) : null;\n const widget = property ? getFieldConfig(property, propertyConfigs) : null;\n\n const [selectOpen, setSelectOpen] = useState(false);\n\n return <Tooltip title={property && widget ? `${widget?.name} - ${property.dataType}` : undefined}\n open={selectOpen ? false : undefined}>\n <Select\n open={selectOpen}\n onOpenChange={setSelectOpen}\n invisible={true}\n className={\"w-full\"}\n disabled={disabled}\n error={!widget}\n value={fieldId ?? \"\"}\n placeholder={\"Select a property widget\"}\n position={\"item-aligned\"}\n renderValue={(value) => {\n if (!widget) return null;\n return <PropertyConfigBadge propertyConfig={widget}/>\n }}\n onValueChange={(newSelectedWidgetId) => {\n const newProperty = updatePropertyFromWidget(property, newSelectedWidgetId, propertyConfigs)\n if (!propertyKey) return;\n onPropertyChanged({\n id: propertyKey,\n property: newProperty,\n previousId: propertyKey,\n namespace: undefined\n });\n }}>\n {Object.entries(supportedFields).map(([key, widget]) => {\n return <PropertySelectItem\n key={key}\n value={key}\n optionDisabled={false}\n propertyConfig={widget}\n existing={false}/>;\n })\n }\n </Select>\n </Tooltip>;\n}\n","import { convertDataToEntity, getPropertiesMapping, ImportConfig } from \"@firecms/data_import_export\";\nimport { EntityCollectionTable, Properties, useSelectionController } from \"@firecms/core\";\nimport { useEffect } from \"react\";\nimport { Typography } from \"@firecms/ui\";\n\nexport function CollectionEditorImportDataPreview({ importConfig, properties, propertiesOrder }: {\n importConfig: ImportConfig,\n properties: Properties,\n propertiesOrder: string[]\n}) {\n\n useEffect(() => {\n const propertiesMapping = getPropertiesMapping(importConfig.originProperties, properties);\n const mappedData = importConfig.importData.map(d => convertDataToEntity(d, importConfig.idColumn, importConfig.headersMapping, properties, propertiesMapping, \"TEMP_PATH\"));\n importConfig.setEntities(mappedData);\n }, []);\n\n const selectionController = useSelectionController();\n\n return <EntityCollectionTable\n title={<div>\n <Typography variant={\"subtitle2\"}>Imported data preview</Typography>\n <Typography variant={\"caption\"}>Entities with the same id will be overwritten</Typography>\n </div>}\n tableController={{\n data: importConfig.entities,\n dataLoading: false,\n noMoreToLoad: false\n }}\n endAdornment={<div className={\"h-12\"}/>}\n filterable={false}\n sortable={false}\n selectionController={selectionController}\n displayedColumnIds={propertiesOrder.map(p => ({ key: p, disabled: false }))}\n properties={properties}/>\n\n}\n","import { Properties, slugify } from \"@firecms/core\";\nimport { ImportConfig } from \"@firecms/data_import_export\";\n\nexport function cleanPropertiesFromImport(properties: Properties, parentSlug = \"\"): {\n headersMapping: ImportConfig[\"headersMapping\"],\n properties: Properties,\n idColumn?: ImportConfig[\"idColumn\"],\n} {\n\n const result = Object.keys(properties).reduce((acc, key) => {\n const property = properties[key];\n const slug = slugify(key);\n const fullSlug = parentSlug ? `${parentSlug}.${slug}` : slug;\n\n if (property.dataType === \"map\" && property.properties) {\n const slugifiedResult = cleanPropertiesFromImport(property.properties as Properties, fullSlug);\n return {\n headersMapping: { ...acc.headersMapping, [key]: fullSlug },\n properties: {\n ...acc.properties,\n [slug]: {\n ...property,\n properties: slugifiedResult.properties,\n propertiesOrder: Object.keys(slugifiedResult.properties)\n }\n }\n }\n }\n\n const updatedProperties = {\n ...acc.properties,\n [slug]: property\n } as Properties;\n\n const headersMapping = { ...acc.headersMapping, [key]: fullSlug } as Record<string, string>;\n\n return {\n headersMapping,\n properties: updatedProperties,\n }\n }, { headersMapping: {}, properties: {} });\n\n const firstKey = Object.keys(result.headersMapping)?.[0];\n let idColumn: string | undefined;\n if (firstKey?.includes(\"id\") || firstKey?.includes(\"key\")) {\n idColumn = firstKey;\n }\n\n return {\n ...result,\n idColumn\n };\n}\n","import * as React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n CircularProgressCenter,\n CMSType,\n EntityCollection,\n ErrorView,\n isPropertyBuilder,\n MapProperty,\n mergeDeep,\n Properties,\n PropertiesOrBuilders,\n Property,\n PropertyConfig,\n PropertyOrBuilder,\n randomString,\n removeInitialAndTrailingSlashes,\n removeUndefined,\n TopNavigationResult,\n useAuthController,\n useCustomizationController,\n useNavigationController,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport {\n ArrowBackIcon,\n Button,\n cn,\n coolIconKeys,\n defaultBorderMixin,\n Dialog,\n DialogActions,\n DialogContent,\n DoneIcon,\n IconButton,\n LoadingButton,\n Tab,\n Tabs,\n} from \"@firecms/ui\";\nimport { Form, Formik, FormikHelpers } from \"formik\";\nimport { YupSchema } from \"./CollectionYupValidation\";\nimport { CollectionDetailsForm } from \"./CollectionDetailsForm\";\nimport { CollectionPropertiesEditorForm } from \"./CollectionPropertiesEditorForm\";\nimport { UnsavedChangesDialog } from \"./UnsavedChangesDialog\";\nimport { SubcollectionsEditTab } from \"./SubcollectionsEditTab\";\nimport { CollectionsConfigController } from \"../../types/config_controller\";\nimport { CollectionEditorWelcomeView } from \"./CollectionEditorWelcomeView\";\nimport { CollectionInference } from \"../../types/collection_inference\";\nimport { getInferenceType, ImportSaveInProgress, useImportConfig } from \"@firecms/data_import_export\";\nimport { buildEntityPropertiesFromData } from \"@firecms/schema_inference\";\nimport { CollectionEditorImportMapping } from \"./import/CollectionEditorImportMapping\";\nimport { CollectionEditorImportDataPreview } from \"./import/CollectionEditorImportDataPreview\";\nimport { cleanPropertiesFromImport } from \"./import/clean_import_data\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\n\nexport interface CollectionEditorDialogProps {\n open: boolean;\n isNewCollection: boolean;\n initialValues?: {\n group?: string,\n path?: string,\n name?: string,\n }\n editedCollectionPath?: string; // last segment of the path, like `locales`\n fullPath?: string; // full path of this particular collection, like `products/123/locales`\n parentCollectionIds?: string[]; // path ids of the parent collection, like [`products`]\n handleClose: (collection?: EntityCollection) => void;\n configController: CollectionsConfigController;\n reservedGroups?: string[];\n collectionInference?: CollectionInference;\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n pathSuggestions?: (path?: string) => Promise<string[]>;\n getUser: (uid: string) => User | null;\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n parentCollection?: PersistedCollection;\n}\n\nexport function CollectionEditorDialog(props: CollectionEditorDialogProps) {\n\n const open = props.open;\n\n const [formDirty, setFormDirty] = React.useState<boolean>(false);\n const [unsavedChangesDialogOpen, setUnsavedChangesDialogOpen] = React.useState<boolean>(false);\n\n const handleCancel = useCallback(() => {\n if (!formDirty) {\n props.handleClose(undefined);\n } else {\n setUnsavedChangesDialogOpen(true);\n }\n }, [formDirty, props.handleClose]);\n\n useEffect(() => {\n if (!open) {\n setFormDirty(false);\n setUnsavedChangesDialogOpen(false);\n }\n }, [open]);\n\n return (\n <Dialog\n open={open}\n fullWidth={true}\n fullHeight={true}\n scrollable={false}\n maxWidth={\"7xl\"}\n onOpenChange={(open) => !open ? handleCancel() : undefined}\n >\n {open && <CollectionEditorDialogInternal {...props}\n handleCancel={handleCancel}\n setFormDirty={setFormDirty}/>}\n\n <UnsavedChangesDialog\n open={unsavedChangesDialogOpen}\n handleOk={() => props.handleClose(undefined)}\n handleCancel={() => setUnsavedChangesDialogOpen(false)}\n body={\"There are unsaved changes in this collection\"}/>\n\n </Dialog>\n );\n}\n\ntype EditorView = \"welcome\"\n | \"details\"\n | \"import_data_mapping\"\n | \"import_data_preview\"\n | \"import_data_saving\"\n | \"properties\"\n | \"loading\"\n | \"extra_view\"\n | \"subcollections\";\n\nexport function CollectionEditorDialogInternal<M extends {\n [Key: string]: CMSType\n}>({\n isNewCollection,\n initialValues: initialValuesProp,\n configController,\n editedCollectionPath,\n parentCollectionIds,\n fullPath,\n collectionInference,\n handleClose,\n reservedGroups,\n extraView,\n handleCancel,\n setFormDirty,\n pathSuggestions,\n getUser,\n parentCollection,\n getData\n }: CollectionEditorDialogProps & {\n handleCancel: () => void,\n setFormDirty: (dirty: boolean) => void\n }\n) {\n\n const { propertyConfigs } = useCustomizationController();\n const navigation = useNavigationController();\n const {\n topLevelNavigation,\n collections\n } = navigation;\n\n const includeTemplates = !initialValuesProp?.path && (parentCollectionIds ?? []).length === 0;\n const collectionsInThisLevel = (parentCollection ? parentCollection.subcollections : collections) ?? [];\n const existingPaths = collectionsInThisLevel.map(col => col.path.trim().toLowerCase());\n const existingIds = collectionsInThisLevel.map(col => col.id?.trim().toLowerCase()).filter(Boolean) as string[];\n\n const importConfig = useImportConfig();\n\n if (!topLevelNavigation) {\n throw Error(\"Internal: Navigation not ready in collection editor\");\n }\n\n const {\n groups\n }: TopNavigationResult = topLevelNavigation;\n\n const snackbarController = useSnackbarController();\n const authController = useAuthController();\n\n // Use this ref to store which properties have errors\n const propertyErrorsRef = useRef({});\n\n const initialView = isNewCollection ? (includeTemplates ? \"welcome\" : \"details\") : \"properties\";\n const [currentView, setCurrentView] = useState<EditorView>(initialView); // this view can edit either the details view or the properties one\n\n const [error, setError] = React.useState<Error | undefined>();\n\n const [collection, setCollection] = React.useState<PersistedCollection<M> | undefined>();\n const [initialLoadingCompleted, setInitialLoadingCompleted] = React.useState(false);\n const [initialError, setInitialError] = React.useState<Error | undefined>();\n\n useEffect(() => {\n try {\n if (navigation.initialised) {\n if (editedCollectionPath) {\n setCollection(navigation.getCollectionFromPaths<PersistedCollection<M>>([...(parentCollectionIds ?? []), editedCollectionPath]));\n } else {\n setCollection(undefined);\n }\n setInitialLoadingCompleted(true);\n }\n } catch (e) {\n console.error(e);\n setInitialError(initialError);\n }\n }, [navigation.getCollectionFromPaths, editedCollectionPath, initialError, navigation.initialised]);\n\n const saveCollection = (updatedCollection: PersistedCollection<M>): Promise<boolean> => {\n const fullPath = updatedCollection.id || updatedCollection.path;\n return configController.saveCollection({\n id: fullPath,\n collectionData: updatedCollection,\n previousPath: editedCollectionPath,\n parentCollectionIds\n })\n .then(() => {\n setError(undefined);\n return true;\n })\n .catch((e) => {\n setError(e);\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n };\n\n const initialCollection = collection\n ? {\n ...collection,\n id: collection.id ?? collection.path ?? randomString(16)\n }\n : undefined;\n\n const initialValues: PersistedCollection<M> = initialCollection\n ? applyPropertyConfigs(initialCollection, propertyConfigs)\n : {\n id: initialValuesProp?.path ?? randomString(16),\n path: initialValuesProp?.path ?? \"\",\n name: initialValuesProp?.name ?? \"\",\n group: initialValuesProp?.group ?? \"\",\n properties: {} as PropertiesOrBuilders<M>,\n propertiesOrder: [],\n icon: coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)],\n ownerId: authController.user?.uid ?? \"\"\n };\n\n const setNextMode = useCallback(() => {\n if (currentView === \"details\") {\n if (importConfig.inUse) {\n setCurrentView(\"import_data_saving\");\n } else if (extraView) {\n setCurrentView(\"extra_view\");\n } else {\n setCurrentView(\"properties\");\n }\n } else if (currentView === \"welcome\") {\n setCurrentView(\"details\");\n } else if (currentView === \"import_data_mapping\") {\n setCurrentView(\"import_data_preview\");\n } else if (currentView === \"import_data_preview\") {\n setCurrentView(\"details\");\n } else if (currentView === \"extra_view\") {\n setCurrentView(\"properties\");\n } else {\n setCurrentView(\"details\");\n }\n\n }, [currentView, importConfig.inUse, extraView]);\n\n const doCollectionInference = useCallback((collection: PersistedCollection<any>) => {\n if (!collectionInference) return undefined;\n return collectionInference?.(collection.path, collection.collectionGroup ?? false, parentCollectionIds ?? []);\n }, [collectionInference, parentCollectionIds]);\n\n const inferCollectionFromData = useCallback(async (newCollection: PersistedCollection<M>) => {\n\n try {\n if (!doCollectionInference) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n\n setCurrentView(\"loading\");\n\n const inferredCollection = await doCollectionInference?.(newCollection);\n\n if (!inferredCollection) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n const values = {\n ...(newCollection ?? {})\n };\n\n if (Object.keys(inferredCollection.properties ?? {}).length > 0) {\n values.properties = inferredCollection.properties as PropertiesOrBuilders<M>;\n values.propertiesOrder = inferredCollection.propertiesOrder as Extract<keyof M, string>[];\n }\n\n if (!values.propertiesOrder) {\n values.propertiesOrder = Object.keys(values.properties) as Extract<keyof M, string>[];\n return values;\n }\n\n setCollection(values);\n console.log(\"Inferred collection\", {\n newCollection: newCollection ?? {},\n values\n });\n return values;\n } catch (e: any) {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error inferring collection: \" + (e.message ?? \"Details in the console\")\n });\n return newCollection;\n }\n }, [parentCollectionIds, doCollectionInference]);\n\n const onSubmit = (newCollectionState: PersistedCollection<M>, formikHelpers: FormikHelpers<PersistedCollection<M>>) => {\n try {\n\n console.log(\"Submitting collection\", newCollectionState)\n if (!isNewCollection) {\n saveCollection(newCollectionState).then(() => {\n formikHelpers.resetForm({ values: initialValues });\n // setNextMode();\n handleClose(newCollectionState);\n });\n return;\n }\n\n if (currentView === \"welcome\") {\n setNextMode();\n formikHelpers.resetForm({ values: newCollectionState });\n } else if (currentView === \"details\") {\n if (extraView || importConfig.inUse) {\n formikHelpers.resetForm({ values: newCollectionState });\n setNextMode();\n } else if (isNewCollection) {\n inferCollectionFromData(newCollectionState)\n .then((values) => {\n formikHelpers.resetForm({\n values: values ?? newCollectionState,\n touched: {\n path: true,\n name: true\n }\n });\n }).finally(() => {\n setNextMode();\n });\n } else {\n formikHelpers.resetForm({ values: newCollectionState });\n setNextMode();\n }\n } else if (currentView === \"extra_view\") {\n setNextMode();\n formikHelpers.resetForm({ values: newCollectionState });\n } else if (currentView === \"import_data_mapping\") {\n setNextMode();\n } else if (currentView === \"import_data_preview\") {\n setNextMode();\n } else if (currentView === \"properties\") {\n saveCollection(newCollectionState).then(() => {\n formikHelpers.resetForm({ values: initialValues });\n setNextMode();\n handleClose(newCollectionState);\n });\n } else {\n setNextMode();\n formikHelpers.resetForm({ values: newCollectionState });\n }\n } catch (e: any) {\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e.message ?? \"Details in the console\")\n });\n console.error(e);\n formikHelpers.resetForm({ values: newCollectionState });\n }\n };\n\n if (!isNewCollection && (!navigation.initialised || !initialLoadingCompleted)) {\n return <CircularProgressCenter/>;\n }\n\n return <DialogContent fullHeight={true}>\n <Formik\n initialValues={initialValues}\n validationSchema={(currentView === \"properties\" || currentView === \"subcollections\" || currentView === \"details\") && YupSchema}\n validate={(v) => {\n if (currentView === \"properties\") {\n // return the errors for the properties form\n return propertyErrorsRef.current;\n }\n const errors: Record<string, any> = {};\n if (currentView === \"details\") {\n const pathError = validatePath(v.path, isNewCollection, existingPaths, v.id);\n if (pathError) {\n errors.path = pathError;\n }\n const idError = validateId(v.id, isNewCollection, existingPaths, existingIds);\n if (idError) {\n errors.id = idError;\n }\n }\n return errors;\n }}\n onSubmit={onSubmit}\n >\n {(formikHelpers) => {\n const {\n values,\n errors,\n setFieldValue,\n isSubmitting,\n dirty,\n submitCount\n } = formikHelpers;\n\n const path = values.path ?? editedCollectionPath;\n const updatedFullPath = fullPath?.includes(\"/\") ? fullPath?.split(\"/\").slice(0, -1).join(\"/\") + \"/\" + path : path; // TODO: this path is wrong\n const pathError = validatePath(path, isNewCollection, existingPaths, values.id);\n\n const parentPaths = !pathError && parentCollectionIds ? navigation.convertIdsToPaths(parentCollectionIds) : undefined;\n const resolvedPath = !pathError ? navigation.resolveAliasesFrom(updatedFullPath) : undefined;\n const getDataWithPath = resolvedPath && getData ? () => getData(resolvedPath, parentPaths ?? []) : undefined;\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n setFormDirty(dirty);\n }, [dirty]);\n\n function onImportDataSet(data: object[]) {\n importConfig.setInUse(true);\n buildEntityPropertiesFromData(data, getInferenceType)\n .then((properties) => {\n const res = cleanPropertiesFromImport(properties);\n\n setFieldValue(\"properties\", res.properties);\n setFieldValue(\"propertiesOrder\", Object.keys(res.properties));\n\n importConfig.setIdColumn(res.idColumn);\n importConfig.setImportData(data);\n importConfig.setHeadersMapping(res.headersMapping);\n importConfig.setOriginProperties(res.properties);\n });\n }\n\n const validValues = Boolean(values.name) && Boolean(values.id);\n\n const onImportMappingComplete = () => {\n const updatedProperties = { ...values.properties };\n if (importConfig.idColumn)\n delete updatedProperties[importConfig.idColumn];\n setFieldValue(\"properties\", updatedProperties);\n // setFieldValue(\"propertiesOrder\", Object.values(importConfig.headersMapping));\n setNextMode();\n };\n\n const editable = collection?.editable === undefined || collection?.editable === true;\n const collectionEditable = editable || isNewCollection;\n return (\n <>\n {!isNewCollection && <Tabs value={currentView}\n className={cn(defaultBorderMixin, \"justify-end bg-gray-50 dark:bg-gray-950 border-b\")}\n onValueChange={(v) => setCurrentView(v as EditorView)}>\n <Tab value={\"details\"}>\n Details\n </Tab>\n <Tab value={\"properties\"}>\n Properties\n </Tab>\n <Tab value={\"subcollections\"}>\n Additional views\n </Tab>\n </Tabs>}\n\n <Form noValidate\n className={cn(\n isNewCollection ? \"h-full\" : \"h-[calc(100%-48px)]\",\n \"flex-grow flex flex-col relative\")}>\n\n {currentView === \"loading\" &&\n <CircularProgressCenter/>}\n\n {currentView === \"extra_view\" &&\n path &&\n extraView?.View &&\n <extraView.View path={path}/>}\n\n {currentView === \"welcome\" &&\n <CollectionEditorWelcomeView\n path={path}\n onContinue={(data) => {\n if (data) {\n onImportDataSet(data);\n setCurrentView(\"import_data_mapping\");\n } else {\n setCurrentView(\"details\");\n }\n }}\n collections={collections}\n parentCollection={parentCollection}\n pathSuggestions={pathSuggestions}/>}\n\n {currentView === \"import_data_mapping\" && importConfig &&\n <CollectionEditorImportMapping importConfig={importConfig}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>}\n\n {currentView === \"import_data_preview\" && importConfig &&\n <CollectionEditorImportDataPreview importConfig={importConfig}\n properties={values.properties as Properties}\n propertiesOrder={values.propertiesOrder as string[]}/>}\n\n {currentView === \"import_data_saving\" && importConfig &&\n <ImportSaveInProgress importConfig={importConfig}\n collection={values}\n onImportSuccess={(importedCollection) => {\n handleClose(importedCollection);\n snackbarController.open({\n type: \"info\",\n message: \"Data imported successfully\"\n });\n }}\n />}\n\n {currentView === \"details\" &&\n <CollectionDetailsForm\n existingPaths={existingPaths}\n existingIds={existingIds}\n groups={groups}\n parentCollectionIds={parentCollectionIds}\n parentCollection={parentCollection}\n isNewCollection={isNewCollection}/>}\n\n {currentView === \"subcollections\" && collection &&\n <SubcollectionsEditTab\n parentCollection={parentCollection}\n configController={configController}\n getUser={getUser}\n collectionInference={collectionInference}\n parentCollectionIds={parentCollectionIds}\n collection={collection}/>}\n\n {currentView === \"properties\" &&\n <CollectionPropertiesEditorForm\n showErrors={submitCount > 0}\n isNewCollection={isNewCollection}\n reservedGroups={reservedGroups}\n onPropertyError={(propertyKey, namespace, error) => {\n propertyErrorsRef.current = removeUndefined({\n ...propertyErrorsRef.current,\n [propertyKey]: error\n }, true);\n }}\n getUser={getUser}\n getData={getDataWithPath}\n doCollectionInference={doCollectionInference}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n extraIcon={extraView?.icon &&\n <IconButton\n color={\"primary\"}\n onClick={() => setCurrentView(\"extra_view\")}>\n {extraView.icon}\n </IconButton>}/>\n }\n\n {currentView !== \"welcome\" && <DialogActions\n position={\"absolute\"}>\n {error && <ErrorView error={error}/>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_mapping\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n importConfig.setInUse(false);\n return setCurrentView(\"welcome\");\n }}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_preview\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n saveCollection(values);\n setCurrentView(\"import_data_mapping\");\n }}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"details\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => setCurrentView(\"welcome\")}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && currentView === \"properties\" && <Button variant={\"text\"}\n type=\"button\"\n onClick={() => setCurrentView(\"details\")}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n <Button variant={\"text\"}\n onClick={() => {\n handleCancel();\n }}>\n Cancel\n </Button>\n\n {isNewCollection && currentView === \"import_data_mapping\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={onImportMappingComplete}\n >\n Next\n </Button>}\n\n {isNewCollection && currentView === \"import_data_preview\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={() => {\n setNextMode();\n }}\n >\n Next\n </Button>}\n\n {isNewCollection && (currentView === \"details\" || currentView === \"properties\") &&\n <LoadingButton\n variant={\"filled\"}\n color=\"primary\"\n type=\"submit\"\n loading={isSubmitting}\n disabled={isSubmitting || (currentView === \"details\" && !validValues)}\n startIcon={currentView === \"properties\"\n ? <DoneIcon/>\n : undefined}\n >\n {currentView === \"details\" && \"Next\"}\n {currentView === \"properties\" && \"Create collection\"}\n </LoadingButton>}\n\n {!isNewCollection && <LoadingButton\n variant=\"filled\"\n color=\"primary\"\n type=\"submit\"\n loading={isSubmitting}\n // disabled={isSubmitting || !dirty}\n >\n Update collection\n </LoadingButton>}\n\n </DialogActions>}\n </Form>\n </>\n );\n }}\n\n </Formik>\n </DialogContent>\n\n}\n\nfunction applyPropertyConfigs<M extends Record<string, any> = any>(collection: PersistedCollection<M>, propertyConfigs: Record<string, PropertyConfig<any>>): PersistedCollection<M> {\n const { properties, ...rest } = collection;\n const propertiesResult: PropertiesOrBuilders<any> = {};\n Object.keys(properties).forEach((key) => {\n propertiesResult[key] = applyPropertiesConfig(properties[key] as PropertyOrBuilder, propertyConfigs);\n });\n\n return { ...rest, properties: propertiesResult };\n}\n\nfunction applyPropertiesConfig(property: PropertyOrBuilder, propertyConfigs: Record<string, PropertyConfig<any>>) {\n let internalProperty = property;\n if (propertyConfigs && typeof internalProperty === \"object\" && internalProperty.propertyConfig) {\n const propertyConfig = propertyConfigs[internalProperty.propertyConfig];\n if (propertyConfig && isPropertyBuilder(propertyConfig.property)) {\n internalProperty = propertyConfig.property;\n } else {\n\n if (propertyConfig) {\n internalProperty = mergeDeep(propertyConfig.property, internalProperty);\n }\n\n if (!isPropertyBuilder(internalProperty) && internalProperty.dataType === \"map\" && internalProperty.properties) {\n const properties: Record<string, PropertyOrBuilder> = {};\n Object.keys(internalProperty.properties).forEach((key) => {\n properties[key] = applyPropertiesConfig(((internalProperty as MapProperty).properties as Properties)[key] as Property, propertyConfigs);\n });\n internalProperty = { ...internalProperty, properties };\n }\n\n }\n }\n return internalProperty;\n\n}\n\nconst validatePath = (value: string, isNewCollection: boolean, existingPaths: string[], idValue?: string) => {\n let error;\n if (!value) {\n error = \"You must specify a path in the database for this collection\";\n }\n // if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n // error = \"There is already a collection which uses this path as an id\";\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()) && !idValue)\n error = \"There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids\";\n\n const subpaths = removeInitialAndTrailingSlashes(value).split(\"/\");\n if (subpaths.length % 2 === 0) {\n error = `Collection paths must have an odd number of segments: ${value}`;\n }\n return error;\n};\n\nconst validateId = (value: string, isNewCollection: boolean, existingPaths: string[], existingIds: string[]) => {\n if (!value) return undefined;\n let error;\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection that uses this value as a path\";\n if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection which uses this id\";\n // if (error) {\n // setAdvancedPanelExpanded(true);\n // }\n return error;\n};\n","import React, { PropsWithChildren, useCallback, useEffect } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport {\n Property,\n useCustomizationController,\n useNavigationController,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport { CollectionEditorDialog } from \"./ui/collection_editor/CollectionEditorDialog\";\nimport { useNavigate } from \"react-router\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionEditorPermissionsBuilder } from \"./types/config_permissions\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { PropertyFormDialog } from \"./ui/collection_editor/PropertyEditView\";\nimport { PersistedCollection } from \"./types/persisted_collection\";\n\nexport const ConfigControllerContext = React.createContext<CollectionsConfigController>({} as any);\nexport const CollectionEditorContext = React.createContext<CollectionEditorController>({} as any);\n\nexport interface ConfigControllerProviderProps {\n /**\n * Controller for managing the collections' config.\n */\n collectionConfigController: CollectionsConfigController;\n\n /**\n * Callback used to infer the schema from the data.\n */\n collectionInference?: CollectionInference;\n\n /**\n * Use this builder to define the permissions for the configuration per user.\n */\n configPermissions?: CollectionEditorPermissionsBuilder;\n\n /**\n * Groups that cannot be used to create new collections.\n */\n reservedGroups?: string[];\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: (path?: string) => Promise<string[]>;\n\n getUser: (uid: string) => User | null\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n}\n\nexport const ConfigControllerProvider = React.memo(\n function ConfigControllerProvider({\n children,\n collectionConfigController,\n configPermissions,\n reservedGroups,\n collectionInference,\n extraView,\n pathSuggestions,\n getUser,\n getData,\n onAnalyticsEvent\n }: PropsWithChildren<ConfigControllerProviderProps>) {\n\n const navigation = useNavigationController();\n const navigate = useNavigate();\n const snackbarController = useSnackbarController();\n const { propertyConfigs } = useCustomizationController();\n\n const {\n collections\n } = navigation;\n const existingPaths = collections.map(col => col.path.trim().toLowerCase());\n\n const [rootPathSuggestions, setRootPathSuggestions] = React.useState<string[] | undefined>();\n useEffect(() => {\n if (pathSuggestions) {\n pathSuggestions().then((paths) => {\n setRootPathSuggestions(paths.filter(p => !existingPaths.includes(p.trim().toLowerCase())));\n });\n }\n }, [pathSuggestions]);\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n parentCollection?: PersistedCollection,\n editedCollectionPath?: string,\n fullPath?: string,\n parentCollectionIds: string[],\n initialValues?: {\n path?: string,\n group?: string,\n name?: string\n },\n redirect: boolean\n }>();\n\n const [currentPropertyDialog, setCurrentPropertyDialog] = React.useState<{\n propertyKey?: string,\n property?: Property,\n namespace?: string,\n parentCollection?: PersistedCollection,\n currentPropertiesOrder?: string[],\n editedCollectionPath: string,\n fullPath?: string,\n parentCollectionIds: string[],\n collectionEditable: boolean;\n }>();\n\n const defaultConfigPermissions: CollectionEditorPermissionsBuilder = useCallback(() => ({\n createCollections: true,\n editCollections: true,\n deleteCollections: true\n }), []);\n\n const editCollection = useCallback(({\n path,\n fullPath,\n parentCollectionIds,\n parentCollection\n }: {\n path?: string,\n fullPath?: string,\n parentCollectionIds: string[],\n parentCollection?: PersistedCollection\n }) => {\n console.debug(\"edit collection\", path, fullPath, parentCollectionIds, parentCollection);\n onAnalyticsEvent?.(\"edit_collection\", { path, fullPath });\n setCurrentDialog({\n editedCollectionPath: path,\n fullPath,\n parentCollectionIds,\n isNewCollection: false,\n parentCollection,\n redirect: false\n });\n }, []);\n\n const editProperty = useCallback(({\n propertyKey,\n property,\n editedCollectionPath,\n currentPropertiesOrder,\n parentCollectionIds,\n collection\n }: {\n propertyKey?: string,\n property?: Property,\n currentPropertiesOrder?: string[],\n editedCollectionPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection,\n }) => {\n console.debug(\"edit property\", propertyKey, property, editedCollectionPath, currentPropertiesOrder, parentCollectionIds, collection);\n onAnalyticsEvent?.(\"edit_property\", { propertyKey, editedCollectionPath });\n // namespace is all the path until the last dot\n const namespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(0, propertyKey.lastIndexOf(\".\"))\n : undefined;\n const propertyKeyWithoutNamespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(propertyKey.lastIndexOf(\".\") + 1)\n : propertyKey;\n setCurrentPropertyDialog({\n propertyKey: propertyKeyWithoutNamespace,\n property,\n namespace,\n currentPropertiesOrder,\n editedCollectionPath,\n parentCollectionIds,\n collectionEditable: collection?.editable ?? false\n });\n }, []);\n\n const createCollection = React.useCallback(({\n parentCollectionIds,\n parentCollection,\n initialValues,\n redirect\n }: {\n parentCollectionIds: string[],\n parentCollection?: PersistedCollection\n initialValues?: {\n group?: string,\n path?: string,\n name?: string\n },\n redirect: boolean\n }) => {\n console.debug(\"create collection\", parentCollectionIds, parentCollection, initialValues, redirect);\n onAnalyticsEvent?.(\"create_collection\", { parentCollectionIds, parentCollection, initialValues, redirect });\n setCurrentDialog({\n isNewCollection: true,\n parentCollectionIds,\n parentCollection,\n initialValues,\n redirect\n });\n }, []);\n\n const getPathSuggestions = !pathSuggestions\n ? undefined\n : (path?: string) => {\n if (!path && rootPathSuggestions)\n return Promise.resolve(rootPathSuggestions);\n else {\n return pathSuggestions?.(path);\n }\n }\n\n return (\n <ConfigControllerContext.Provider value={collectionConfigController}>\n <CollectionEditorContext.Provider\n value={{\n editCollection,\n createCollection,\n editProperty,\n configPermissions: configPermissions ?? defaultConfigPermissions,\n rootPathSuggestions\n }}>\n\n {children}\n\n <CollectionEditorDialog\n open={Boolean(currentDialog)}\n configController={collectionConfigController}\n isNewCollection={false}\n collectionInference={collectionInference}\n {...currentDialog}\n getData={getData}\n reservedGroups={reservedGroups}\n extraView={extraView}\n pathSuggestions={getPathSuggestions}\n getUser={getUser}\n handleClose={(collection) => {\n if (currentDialog?.redirect) {\n if (collection && currentDialog?.isNewCollection && !currentDialog.parentCollectionIds.length) {\n const url = navigation.buildUrlCollectionPath(collection.id ?? collection.path);\n navigate(url);\n }\n }\n setCurrentDialog(undefined);\n }}/>\n\n {/* Used for editing properties*/}\n <PropertyFormDialog\n open={Boolean(currentPropertyDialog)}\n includeIdAndName={true}\n existingProperty={Boolean(currentPropertyDialog?.propertyKey)}\n autoUpdateId={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}\n autoOpenTypeSelect={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}\n inArray={false}\n collectionEditable={currentPropertyDialog?.collectionEditable ?? false}\n getData={getData && currentPropertyDialog?.editedCollectionPath\n ? () => {\n console.debug(\"get data for property\", currentPropertyDialog?.editedCollectionPath);\n const resolvedPath = navigation.resolveAliasesFrom(currentPropertyDialog.editedCollectionPath!)\n return getData(resolvedPath, []);\n }\n : undefined}\n onPropertyChanged={({\n id,\n property\n }) => {\n if (!currentPropertyDialog) return;\n if (!id) return;\n const newProperty = !(currentPropertyDialog.propertyKey);\n return collectionConfigController.saveProperty({\n path: currentPropertyDialog?.editedCollectionPath,\n property,\n propertyKey: id,\n newPropertiesOrder: newProperty && currentPropertyDialog.currentPropertiesOrder ? [...currentPropertyDialog.currentPropertiesOrder, id] : undefined,\n namespace: currentPropertyDialog.namespace,\n parentCollectionIds: currentPropertyDialog.parentCollectionIds\n })\n .catch((e) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n }}\n onPropertyChangedImmediate={false}\n onDelete={() => {\n if (!currentPropertyDialog?.propertyKey) return;\n const newPropertiesOrder = currentPropertyDialog?.currentPropertiesOrder?.filter(p => p !== currentPropertyDialog?.propertyKey);\n return collectionConfigController.deleteProperty({\n path: currentPropertyDialog?.editedCollectionPath,\n propertyKey: currentPropertyDialog?.propertyKey,\n namespace: currentPropertyDialog?.namespace,\n newPropertiesOrder,\n parentCollectionIds: currentPropertyDialog?.parentCollectionIds\n })\n .then(() => {\n setCurrentPropertyDialog(undefined);\n }).catch((e) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error deleting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n }}\n onError={() => {\n }}\n onOkClicked={() => {\n setCurrentPropertyDialog(undefined);\n }}\n onCancel={() => {\n setCurrentPropertyDialog(undefined);\n }}\n initialErrors={{}}\n forceShowErrors={false}\n existingPropertyKeys={[]}\n allowDataInference={true}\n propertyConfigs={propertyConfigs}\n property={currentPropertyDialog?.property}\n propertyKey={currentPropertyDialog?.propertyKey}/>\n\n </CollectionEditorContext.Provider>\n\n </ConfigControllerContext.Provider>\n );\n }, equal);\n","import { useContext } from \"react\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionEditorContext } from \"./ConfigControllerProvider\";\n\n/**\n * Hook to access the collection editor controller.\n * The methods in this controller can be used to open the collection editor dialog.\n */\nexport const useCollectionEditorController = (): CollectionEditorController => useContext(CollectionEditorContext);\n","import { useContext } from \"react\";\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport { ConfigControllerContext } from \"./ConfigControllerProvider\";\n\n/**\n * Use this hook to access the configuration controller.\n * You can use it to get the list of collections, and to save/delete collections.\n */\nexport const useCollectionsConfigController = (): CollectionsConfigController => useContext(ConfigControllerContext);\n","import equal from \"react-fast-compare\"\n\nimport {\n CollectionActionsProps,\n mergeDeep,\n useAuthController,\n useNavigationController,\n useSnackbarController\n} from \"@firecms/core\";\nimport { Button, IconButton, SaveIcon, SettingsIcon, Tooltip, UndoIcon, } from \"@firecms/ui\";\n\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { useCollectionsConfigController } from \"../useCollectionsConfigController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function EditorCollectionAction({\n path: fullPath,\n parentCollectionIds,\n collection,\n tableController\n }: CollectionActionsProps) {\n\n const authController = useAuthController();\n const navigationController = useNavigationController();\n const collectionEditorController = useCollectionEditorController();\n const configController = useCollectionsConfigController();\n const snackbarController = useSnackbarController();\n\n const parentCollection = navigationController.getCollectionFromIds(parentCollectionIds);\n\n const canEditCollection = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n collection\n }).editCollections\n : true;\n\n let saveDefaultFilterButton = null;\n if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.initialFilter)) ||\n !equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {\n saveDefaultFilterButton = <>\n {collection.initialFilter || collection.initialSort && <Tooltip\n title={\"Reset to default filter and sort\"}>\n <Button\n color={\"primary\"}\n size={\"small\"}\n variant={\"text\"}\n onClick={() => {\n tableController.clearFilter?.();\n if (collection?.initialFilter)\n tableController.setFilterValues?.(collection?.initialFilter);\n if (collection?.initialSort)\n tableController.setSortBy?.(collection?.initialSort);\n }}>\n <UndoIcon/>\n </Button>\n </Tooltip>}\n\n <Tooltip\n title={tableController.sortBy || tableController.filterValues ? \"Save default filter and sort\" : \"Clear default filter and sort\"}>\n <Button\n color={\"primary\"}\n size={\"small\"}\n variant={\"outlined\"}\n onClick={() => configController\n ?.saveCollection({\n id: collection.path,\n parentCollectionIds,\n collectionData: mergeDeep(collection as PersistedCollection,\n {\n initialFilter: tableController.filterValues ?? null,\n initialSort: tableController.sortBy ?? null\n })\n }).then(() => {\n snackbarController.open({\n type: \"success\",\n message: \"Default config saved\"\n });\n })}>\n <SaveIcon/>\n </Button>\n </Tooltip>\n </>;\n }\n\n const editorButton = <Tooltip\n title={canEditCollection ? \"Edit collection\" : \"You don't have permissions to edit this collection\"}>\n <IconButton\n color={\"primary\"}\n disabled={!canEditCollection}\n onClick={canEditCollection\n ? () => collectionEditorController?.editCollection({ path: collection.path, fullPath, parentCollectionIds, parentCollection: parentCollection as PersistedCollection })\n : undefined}>\n <SettingsIcon/>\n </IconButton>\n </Tooltip>;\n\n return <>\n {canEditCollection && saveDefaultFilterButton}\n {editorButton}\n </>\n\n}\n\nfunction getObjectOrNull(o?: object): object | null {\n if (o && Object.keys(o).length === 0)\n return o\n return o ?? null;\n}\n","import {\n DeleteConfirmationDialog,\n PluginHomePageActionsProps,\n useAuthController,\n useSnackbarController\n} from \"@firecms/core\";\nimport { DeleteIcon, IconButton, Menu, MenuItem, MoreVertIcon, SettingsIcon, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { useCallback, useState } from \"react\";\nimport { useCollectionsConfigController } from \"../useCollectionsConfigController\";\n\nexport function HomePageEditorCollectionAction({\n path,\n collection\n }: PluginHomePageActionsProps) {\n\n const snackbarController = useSnackbarController();\n const authController = useAuthController();\n const configController = useCollectionsConfigController();\n const collectionEditorController = useCollectionEditorController();\n\n const permissions = collectionEditorController.configPermissions({\n user: authController.user,\n collection\n });\n\n const onEditCollectionClicked = useCallback(() => {\n collectionEditorController?.editCollection({ path, parentCollectionIds: [] });\n }, [collectionEditorController, path]);\n\n const [deleteRequested, setDeleteRequested] = useState(false);\n\n const deleteCollection = useCallback(() => {\n configController?.deleteCollection({ path }).then(() => {\n setDeleteRequested(false);\n snackbarController.open({\n message: \"Collection deleted\",\n type: \"success\"\n });\n });\n }, [path, configController]);\n\n return <>\n\n <div>\n {permissions.deleteCollections &&\n <Menu\n trigger={<IconButton>\n <MoreVertIcon size={\"small\"}/>\n </IconButton>}\n >\n <MenuItem onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n setDeleteRequested(true);\n }}>\n <DeleteIcon/>\n Delete\n </MenuItem>\n\n </Menu>\n\n }\n\n {permissions.editCollections &&\n <IconButton\n onClick={(event) => {\n onEditCollectionClicked();\n }}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>}\n </div>\n\n <DeleteConfirmationDialog\n open={deleteRequested}\n onAccept={deleteCollection}\n onCancel={() => setDeleteRequested(false)}\n title={<>Delete this collection?</>}\n body={<> This will <b>not\n delete any data</b>, only\n the collection in the CMS</>}/>\n </>;\n\n}\n","import { PluginHomePageAdditionalCardsProps, useAuthController } from \"@firecms/core\";\nimport { AddIcon, Card, cn, Typography } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\n\nexport function NewCollectionCard({\n group,\n context\n }: PluginHomePageAdditionalCardsProps) {\n\n if (!context.navigation.topLevelNavigation)\n throw Error(\"Navigation not ready in FireCMSHomePage\");\n\n const authController = useAuthController();\n\n const collectionEditorController = useCollectionEditorController();\n const canCreateCollections = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n }).createCollections\n : true;\n\n return (\n <Card className={cn(\"h-full p-4 min-h-[124px]\")}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n initialValues: group ? { group } : undefined,\n parentCollectionIds: [],\n redirect: true\n })\n : undefined}>\n\n <div\n className=\"flex flex-col items-start h-full w-full items-center justify-center h-full w-full flex-grow flex-col\">\n <AddIcon color=\"primary\" size={\"large\"}/>\n <Typography color=\"primary\"\n variant={\"caption\"}\n className={\"font-medium\"}>{\"Add new collection\".toUpperCase()}</Typography>\n\n {!canCreateCollections &&\n <Typography variant={\"caption\"}>You don&apos;t have permissions to create\n collections</Typography>\n }\n </div>\n\n </Card>\n );\n}\n","import { unslugify, useAuthController, useNavigationController } from \"@firecms/core\";\nimport { AddIcon, Chip, Collapse, Typography, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport React from \"react\";\n\nexport function RootCollectionSuggestions() {\n\n const authController = useAuthController();\n const navigationController = useNavigationController();\n\n const collectionEditorController = useCollectionEditorController();\n const canCreateCollections = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user\n }).createCollections\n : true;\n\n const rootPathSuggestions = collectionEditorController.rootPathSuggestions ?? [];\n\n const showSuggestions = rootPathSuggestions.length > 3 || (navigationController.collections.length === 0 && rootPathSuggestions.length > 0);\n return <Collapse\n in={showSuggestions}>\n\n <div\n className={\"flex flex-col gap-1 p-2 my-4\"}>\n\n <Typography variant={\"body2\"} color={\"secondary\"}>\n Create a collection from your data:\n </Typography>\n\n <div\n className={\"flex flex-row gap-1 overflow-scroll no-scrollbar \"}>\n {rootPathSuggestions.map((path) => {\n return (\n <div key={path}>\n <Chip\n icon={<AddIcon size={\"small\"}/>}\n colorScheme={\"cyanLighter\"}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n initialValues: { path, name: unslugify(path) },\n parentCollectionIds: [],\n redirect: true\n })\n : undefined}\n size=\"small\">\n {path}\n </Chip>\n </div>\n );\n })}\n </div>\n </div>\n </Collapse>\n}\n","import { ResolvedProperty } from \"@firecms/core\";\nimport { IconButton, SettingsIcon, Tooltip } from \"@firecms/ui\";\nimport React from \"react\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function CollectionViewHeaderAction({\n propertyKey,\n onHover,\n property,\n fullPath,\n parentCollectionIds,\n collection\n }: {\n property: ResolvedProperty,\n propertyKey: string,\n onHover: boolean,\n fullPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection;\n}) {\n\n const collectionEditorController = useCollectionEditorController();\n\n return (\n <Tooltip title={\"Edit\"}>\n <IconButton\n className={onHover ? \"bg-white dark:bg-gray-950\" : \"hidden\"}\n onClick={() => {\n collectionEditorController.editProperty({\n propertyKey,\n property,\n editedCollectionPath: fullPath,\n parentCollectionIds,\n collection\n });\n }}\n size={\"small\"}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n )\n}\n","import { getDefaultPropertiesOrder, useAuthController } from \"@firecms/core\";\nimport { AddIcon, Tooltip } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function PropertyAddColumnComponent({\n fullPath,\n parentCollectionIds,\n collection\n }: {\n fullPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection;\n}) {\n\n const authController = useAuthController();\n const collectionEditorController = useCollectionEditorController();\n const canEditCollection = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n collection\n }).editCollections\n : true;\n\n return (\n <Tooltip title={canEditCollection ? \"Add new property\" : \"You don't have permission to add new properties\"}>\n <div\n className={\"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-gray-100 bg-opacity-40 hover:bg-gray-100 dark:bg-gray-950 dark:bg-opacity-40 dark:hover:bg-gray-950\"}\n // className={onHover ? \"bg-white dark:bg-gray-950\" : undefined}\n onClick={() => {\n collectionEditorController.editProperty({\n editedCollectionPath: fullPath,\n parentCollectionIds,\n currentPropertiesOrder: getDefaultPropertiesOrder(collection),\n collection\n });\n }}>\n <AddIcon color={\"inherit\"}/>\n </div>\n </Tooltip>\n )\n}\n","import { AddIcon, Button } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\n\nexport function NewCollectionButton() {\n const collectionEditorController = useCollectionEditorController();\n return <Button className={\"min-w-fit\"}\n variant={\"outlined\"}\n onClick={() => collectionEditorController.createCollection({\n parentCollectionIds: [],\n redirect: true\n })\n }>\n <AddIcon/>\n New collection\n </Button>\n}\n","import React from \"react\";\nimport {\n EntityCollection,\n FireCMSPlugin,\n joinCollectionLists,\n makePropertiesEditable,\n ModifyCollectionProps,\n Properties,\n User\n} from \"@firecms/core\";\nimport { ConfigControllerProvider } from \"./ConfigControllerProvider\";\nimport { CollectionEditorPermissionsBuilder } from \"./types/config_permissions\";\nimport { EditorCollectionAction } from \"./ui/EditorCollectionAction\";\nimport { HomePageEditorCollectionAction } from \"./ui/HomePageEditorCollectionAction\";\nimport { NewCollectionCard } from \"./ui/NewCollectionCard\";\nimport { PersistedCollection } from \"./types/persisted_collection\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport { RootCollectionSuggestions } from \"./ui/RootCollectionSuggestions\";\nimport { CollectionViewHeaderAction } from \"./ui/CollectionViewHeaderAction\";\nimport { PropertyAddColumnComponent } from \"./ui/PropertyAddColumnComponent\";\nimport { NewCollectionButton } from \"./ui/NewCollectionButton\";\n\nexport interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, UserType extends User = User> {\n\n /**\n * Firebase app where the configuration is saved.\n */\n collectionConfigController: CollectionsConfigController;\n\n modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | void;\n\n /**\n * Define what actions can be performed on the configuration.\n */\n configPermissions?: CollectionEditorPermissionsBuilder<UserType, EC>;\n\n /**\n * The words you define here will not be allowed to be used as group\n * names when creating collections.\n * e.g. [\"admin\"]\n */\n reservedGroups: string[];\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: (path: string) => Promise<string[]>;\n\n collectionInference?: CollectionInference;\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n getUser: (uid: string) => UserType | null;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n}\n\n/**\n * Use this hook to initialise the Collection Editor plugin.\n * This is likely the only hook you will need to use.\n * @param firebaseApp Firebase app where your project data lives.\n * @param configPermissions\n * @param reservedGroups\n * @param extraView\n * @param pathSuggestions\n * @param getUser\n * @param collectionInference\n */\nexport function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>\n({\n collectionConfigController,\n modifyCollection,\n configPermissions,\n reservedGroups,\n extraView,\n pathSuggestions,\n getUser,\n collectionInference,\n getData,\n onAnalyticsEvent\n }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection> {\n\n const injectCollections = (baseCollections: EntityCollection[]) => {\n\n const markAsEditable = (c: PersistedCollection) => {\n makePropertiesEditable(c.properties as Properties);\n c.subcollections?.forEach(markAsEditable);\n };\n const storedCollections = collectionConfigController.collections ?? [];\n storedCollections.forEach(markAsEditable);\n\n console.debug(\"Collections specified in code:\", baseCollections);\n console.debug(\"Collections stored in the backend\", storedCollections);\n const result = joinCollectionLists(baseCollections, storedCollections, [], modifyCollection);\n console.debug(\"Collections after joining:\", result);\n return result;\n };\n\n return {\n name: \"Collection Editor\",\n loading: collectionConfigController.loading,\n collections: {\n injectCollections,\n CollectionActions: EditorCollectionAction\n },\n provider: {\n Component: ConfigControllerProvider,\n props: {\n collectionConfigController,\n configPermissions,\n collectionInference,\n reservedGroups,\n extraView,\n pathSuggestions,\n getUser,\n getData,\n onAnalyticsEvent\n }\n },\n homePage: {\n additionalActions: <NewCollectionButton/>,\n additionalChildrenEnd: <RootCollectionSuggestions/>,\n CollectionActions: HomePageEditorCollectionAction,\n AdditionalCards: NewCollectionCard,\n },\n collectionView: {\n HeaderAction: CollectionViewHeaderAction,\n AddColumnComponent: PropertyAddColumnComponent\n }\n };\n}\n","import { ErrorView, unslugify, useNavigationController } from \"@firecms/core\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { Button } from \"@firecms/ui\";\n\nexport function MissingReferenceWidget({ path: pathProp }: {\n path: string\n}) {\n const navigation = useNavigationController();\n const path = getLastSegment(pathProp);\n const parentCollectionIds = navigation.getParentCollectionIds(pathProp);\n const collectionEditor = useCollectionEditorController();\n return <div className={\"p-1 flex flex-col items-center\"}>\n <ErrorView error={\"No collection for path: \" + path}/>\n <Button className={\"mx-2\"} variant={\"outlined\"} size={\"small\"}\n onClick={() => {\n collectionEditor.createCollection({\n initialValues: { path, name: unslugify(path) },\n parentCollectionIds,\n redirect: false\n });\n }}>\n Create\n </Button>\n </div>;\n}\n\nfunction getParentPathSegments(path: string): string[] {\n const segments = path.split(\"/\");\n return segments.filter((segment, index) => index % 2 === 0 && index !== segments.length - 1);\n}\n\nfunction getLastSegment(path: string): string {\n const segments = path.split(\"/\");\n return segments[segments.length - 1];\n}\n"],"names":["YupSchema","Yup","FieldHelperView","error","children","jsx","Typography","CollectionDetailsForm","isNewCollection","reservedGroups","existingPaths","existingIds","groups","parentCollection","groupRef","React","values","setFieldValue","handleChange","touched","errors","setFieldTouched","isSubmitting","submitCount","useFormikContext","iconDialogOpen","setIconDialogOpen","useState","advancedPanelExpanded","setAdvancedPanelExpanded","updateName","name","getIn","toSnakeCase","singular","useEffect","collectionIcon","IconForView","groupOptions","group","inputFocused","autoCompleteOpen","setAutoCompleteOpen","useAutoComplete","isSubcollection","customIdValue","Container","jsxs","Tooltip","IconButton","Chip","TextField","e","cn","Field","DebouncedTextField","event","Autocomplete","index","AutocompleteItem","ExpandablePanel","SettingsIcon","Select","value","SelectItem","v","BooleanSwitchWithLabel","Dialog","SearchIconsView","icon","idToPropertiesPath","id","namespaceToPropertiesPath","namespace","namespaceToPropertiesOrderPath","getFullId","propertyKey","propertyNamespace","EnumForm","enumValues","onValuesChanged","onError","updateIds","disabled","allowDataInference","getData","Formik","data","formikHelpers","EnumFormFields","prevProps","nextProps","enumValuesPath","shouldUpdateId","lastInternalIdAdded","setLastInternalIdAdded","editDialogIndex","setEditDialogIndex","inferring","setInferring","inferredValues","buildEntry","internalId","justAdded","EnumEntry","ListIcon","Button","flatData","fieldData","currentEnumValues","newEnumValues","extractEnumFromValues","enumValue","CircularProgress","AutoAwesomeIcon","Paper","FormikArrayContainer","EnumEntryDialog","updateId","autoFocus","onDialogOpen","inferredEntry","shouldUpdateIdRef","idValue","labelValue","labelError","currentLabelRef","FastField","validateLabel","open","onClose","idError","DialogContent","validateId","DialogActions","GeneralPropertyValidation","validationRequired","validationRequiredMessage","Fragment","SwitchControl","StringPropertyValidation","length","lowercase","matches","max","min","trim","uppercase","showErrors","validationLength","validationMin","validationMax","validationTrim","validationMatches","validationLowercase","validationUppercase","matchesError","matchesValue","matchesStringValue","serializeRegExp","isValidRegExp","ArrayPropertyValidation","ValidationPanel","RuleIcon","EnumPropertyField","multiselect","setFieldError","snackbarContext","useSnackbarController","defaultValue","valuesEnumValues","useMemo","resolveEnumValues","hasError","res","d","enumIds","fileTypes","StoragePropertyField","multiple","existing","baseStoragePath","acceptedFiles","fileName","storagePath","storeUrl","fileNameValue","storagePathValue","storedValue","fileTypesValue","allFileTypesSelected","handleTypesChange","hasFilenameCallback","hasStoragePathCallback","FileUploadIcon","MultiSelect","selected","MultiSelectItem","Checkbox","label","editableProperty","property","isPropertyBuilder","eProperty","removeNonEditableProperties","properties","_","key","propertyOrBuilder","a","b","PropertyFieldPreview","onClick","includeName","includeEditButton","propertyConfigs","useCustomizationController","propertyConfig","getFieldConfig","ErrorBoundary","PropertyConfigBadge","cardMixin","cardClickableMixin","cardSelectedMixin","NonEditablePropertyPreview","FunctionsIcon","RemoveCircleIcon","PropertyTree","selectedPropertyKey","onPropertyClick","propertiesOrderProp","additionalFields","onPropertyMove","onPropertyRemove","className","inferredPropertyKeys","collectionEditable","propertiesOrder","onDragEnd","useCallback","result","startIndex","endIndex","newPropertiesOrder","removed","DragDropContext","Droppable","droppableProvided","droppableSnapshot","additionalField","field","Draggable","provided","snapshot","PropertyTreeEntry","isPropertyInferred","fullId","subtree","editable","defaultBorderMixin","RemoveIcon","DragHandleIcon","MapPropertyField","propertyDialogOpen","setPropertyDialogOpen","setSelectedPropertyKey","selectedPropertyNamespace","setSelectedPropertyNamespace","onPropertyCreated","deleteProperty","propertiesPath","propertiesOrderPath","currentPropertiesOrder","p","selectedPropertyFullId","selectedProperty","addChildButton","AddIcon","empty","PropertyFormDialog","RepeatPropertyField","ofProperty","ofPropertyError","onPropertyChanged","widget","CommonPropertyFields","disabledId","existingPropertyKeys","autoUpdateId","isNewProperty","ref","nameError","description","descriptionError","newNameValue","validateName","newIdValue","unslugify","idRegEx","StringPropertyField","widgetId","BooleanPropertyField","BlockPropertyField","NumberPropertyValidation","validationLessThan","validationMoreThan","validationPositive","validationNegative","validationInteger","NumberPropertyField","ReferencePropertyField","useNavigationController","pathPath","pathValue","pathError","validatePath","CollectionsSelect","props","navigation","collections","ungroupedCollections","col","selectedCollection","collection","SelectGroup","DateTimePropertyField","modePath","modeValue","modeError","autoValuePath","autoValueValue","autoValueError","AdvancedPropertyValidation","KeyValuePropertyField","updatePropertyFromWidget","propertyData","selectedWidgetId","updatedProperty","mergeDeep","PropertySelectItem","optionDisabled","UrlPropertyField","urlValue","supportedFieldsIds","supportedFields","DEFAULT_FIELD_CONFIGS","config","PropertyForm","includeIdAndName","autoOpenTypeSelect","existingProperty","inArray","onPropertyChangedImmediate","onDelete","initialErrors","forceShowErrors","getHelpers","initialValue","lastSubmittedProperty","useRef","doOnPropertyChanged","params","newPropertyWithId","helpers","PropertyEditView","onCancel","onOkClicked","formProps","helpersRef","setValues","includeIdAndTitle","selectOpen","setSelectOpen","deleteDialogOpen","setDeleteDialogOpen","selectedFieldConfigId","setSelectedFieldConfigId","getFieldId","allSupportedFields","displayedWidgets","deferredValues","useDeferredValue","nameFieldRef","selectedWidgetError","equal","onWidgetSelectChanged","newSelectedWidgetId","childComponent","InfoLabel","baseProperty","baseFieldConfig","computedFieldConfig","DeleteIcon","DeleteConfirmationDialog","camelCase","str","cur","acc","GetCodeDialog","onOpenChange","snackbarController","code","JSON5","collectionToCode","Highlight","themes","style","tokens","getLineProps","getTokenProps","line","i","token","ContentCopyIcon","propertyCleanup","CollectionPropertiesEditorForm","propertyErrorsRef","onPropertyError","setDirty","extraIcon","getUser","doCollectionInference","dirty","largeLayout","useLargeLayout","asDialog","selectedPropertyIndex","setSelectedPropertyIndex","codeDialogOpen","setCodeDialogOpen","inferringProperties","setInferringProperties","newPropertyDialogOpen","setNewPropertyDialogOpen","setInferredPropertyKeys","currentPropertiesOrderRef","inferPropertiesFromData","newCollection","makePropertiesEditable","newPropertyKeys","updatedProperties","updatedPropertiesOrder","updatePropertiesOrder","getCurrentPropertiesOrder","previousId","propertyPath","previousFullId","previousPropertyPath","onPropertyErrorInternal","closePropertyDialog","emptyCollection","usedPropertiesOrder","owner","body","CodeIcon","UnsavedChangesDialog","handleOk","handleCancel","title","EntityCustomViewsSelectDialog","entityViews","view","SubcollectionsEditTab","configController","collectionInference","parentCollectionIds","contextEntityViews","subcollectionToDelete","setSubcollectionToDelete","addEntityViewDialogOpen","setAddEntityViewDialogOpen","viewToDelete","setViewToDelete","currentDialog","setCurrentDialog","subcollections","resolvedEntityViews","resolveEntityView","hardCodedEntityViews","totalEntityViews","Table","TableBody","subcollection","TableRow","TableCell","CollectionEditorDialog","selectedViewKey","productsCollectionTemplate","blogCollectionTemplate","usersCollectionTemplate","pagesCollectionTemplate","CollectionEditorWelcomeView","path","pathSuggestions","onContinue","loadingPathSuggestions","setLoadingPathSuggestions","filteredPathSuggestions","setFilteredPathSuggestions","suggestions","filteredSuggestions","c","s","suggestion","TemplateButton","Icon","ImportFileUpload","subtitle","Card","CollectionEditorImportMapping","importConfig","setSelectedProperty","newHeadersMapping","onPropertyTypeChanged","importKey","inferredNewProperty","buildPropertyFromData","getInferenceType","DataNewPropertiesMapping","ImportNewPropertyFieldPreview","PropertySelect","fieldId","newProperty","CollectionEditorImportDataPreview","propertiesMapping","getPropertiesMapping","mappedData","convertDataToEntity","selectionController","useSelectionController","EntityCollectionTable","cleanPropertiesFromImport","parentSlug","slug","slugify","fullSlug","slugifiedResult","firstKey","idColumn","formDirty","setFormDirty","unsavedChangesDialogOpen","setUnsavedChangesDialogOpen","CollectionEditorDialogInternal","initialValuesProp","editedCollectionPath","fullPath","handleClose","extraView","topLevelNavigation","includeTemplates","collectionsInThisLevel","useImportConfig","authController","useAuthController","initialView","currentView","setCurrentView","setError","setCollection","initialLoadingCompleted","setInitialLoadingCompleted","initialError","setInitialError","saveCollection","updatedCollection","initialCollection","randomString","initialValues","applyPropertyConfigs","coolIconKeys","setNextMode","inferCollectionFromData","inferredCollection","onSubmit","newCollectionState","CircularProgressCenter","updatedFullPath","parentPaths","resolvedPath","getDataWithPath","onImportDataSet","buildEntityPropertiesFromData","validValues","onImportMappingComplete","Tabs","Tab","Form","ImportSaveInProgress","importedCollection","removeUndefined","ErrorView","ArrowBackIcon","LoadingButton","DoneIcon","rest","propertiesResult","applyPropertiesConfig","internalProperty","removeInitialAndTrailingSlashes","ConfigControllerContext","CollectionEditorContext","ConfigControllerProvider","collectionConfigController","configPermissions","onAnalyticsEvent","navigate","useNavigate","rootPathSuggestions","setRootPathSuggestions","paths","currentPropertyDialog","setCurrentPropertyDialog","defaultConfigPermissions","editCollection","editProperty","propertyKeyWithoutNamespace","createCollection","redirect","getPathSuggestions","url","useCollectionEditorController","useContext","useCollectionsConfigController","EditorCollectionAction","tableController","navigationController","collectionEditorController","canEditCollection","saveDefaultFilterButton","getObjectOrNull","UndoIcon","SaveIcon","o","HomePageEditorCollectionAction","permissions","onEditCollectionClicked","deleteRequested","setDeleteRequested","deleteCollection","Menu","MoreVertIcon","MenuItem","NewCollectionCard","context","canCreateCollections","RootCollectionSuggestions","showSuggestions","Collapse","CollectionViewHeaderAction","onHover","PropertyAddColumnComponent","getDefaultPropertiesOrder","NewCollectionButton","useCollectionEditorPlugin","modifyCollection","injectCollections","baseCollections","markAsEditable","storedCollections","joinCollectionLists","MissingReferenceWidget","pathProp","getLastSegment","coll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;AAAA,MAAA;AAAA,IAEX;AAAA,EACJ,EAAA,CAAA;AACJ;AAOA,SAASsM,GAAe3K,GAAsB;AACpC,QAAA6K,IAAW7K,EAAK,MAAM,GAAG;AACxB,SAAA6K,EAASA,EAAS,SAAS,CAAC;AACvC;"}
1
+ {"version":3,"file":"index.es.js","sources":["../src/ui/collection_editor/CollectionYupValidation.tsx","../src/ui/collection_editor/properties/FieldHelperView.tsx","../src/form/Formex.tsx","../src/form/utils.ts","../src/form/Field.tsx","../src/form/useCreateFormex.tsx","../src/ui/collection_editor/CollectionDetailsForm.tsx","../src/ui/collection_editor/util.ts","../src/ui/collection_editor/EnumForm.tsx","../src/ui/collection_editor/SwitchControl.tsx","../src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/ValidationPanel.tsx","../src/ui/collection_editor/properties/EnumPropertyField.tsx","../src/ui/collection_editor/properties/StoragePropertyField.tsx","../src/utils/entities.ts","../src/ui/collection_editor/PropertyFieldPreview.tsx","../src/ui/collection_editor/PropertyTree.tsx","../src/ui/collection_editor/properties/MapPropertyField.tsx","../src/ui/collection_editor/properties/RepeatPropertyField.tsx","../src/ui/collection_editor/properties/CommonPropertyFields.tsx","../src/ui/collection_editor/properties/StringPropertyField.tsx","../src/ui/collection_editor/properties/BooleanPropertyField.tsx","../src/ui/collection_editor/properties/BlockPropertyField.tsx","../src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx","../src/ui/collection_editor/properties/NumberPropertyField.tsx","../src/ui/collection_editor/properties/ReferencePropertyField.tsx","../src/ui/collection_editor/properties/DateTimePropertyField.tsx","../src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx","../src/ui/collection_editor/properties/KeyValuePropertyField.tsx","../src/ui/collection_editor/utils/update_property_for_widget.ts","../src/ui/collection_editor/PropertySelectItem.tsx","../src/ui/collection_editor/properties/UrlPropertyField.tsx","../src/ui/collection_editor/utils/supported_fields.tsx","../src/ui/collection_editor/PropertyEditView.tsx","../src/ui/collection_editor/utils/strings.ts","../src/ui/collection_editor/GetCodeDialog.tsx","../src/ui/collection_editor/CollectionPropertiesEditorForm.tsx","../src/ui/collection_editor/UnsavedChangesDialog.tsx","../src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx","../src/ui/collection_editor/SubcollectionsEditTab.tsx","../src/ui/collection_editor/templates/products_template.ts","../src/ui/collection_editor/templates/blog_template.ts","../src/ui/collection_editor/templates/users_template.ts","../src/ui/collection_editor/templates/pages_template.ts","../src/ui/collection_editor/CollectionEditorWelcomeView.tsx","../src/ui/collection_editor/import/CollectionEditorImportMapping.tsx","../src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx","../src/ui/collection_editor/import/clean_import_data.ts","../src/ui/collection_editor/CollectionEditorDialog.tsx","../src/ConfigControllerProvider.tsx","../src/useCollectionEditorController.tsx","../src/useCollectionsConfigController.tsx","../src/ui/EditorCollectionAction.tsx","../src/ui/HomePageEditorCollectionAction.tsx","../src/ui/NewCollectionCard.tsx","../src/ui/RootCollectionSuggestions.tsx","../src/ui/CollectionViewHeaderAction.tsx","../src/ui/PropertyAddColumnComponent.tsx","../src/ui/NewCollectionButton.tsx","../src/useCollectionEditorPlugin.tsx","../src/ui/MissingReferenceWidget.tsx"],"sourcesContent":["import * as Yup from \"yup\";\n\nexport const YupSchema = Yup.object().shape({\n id: Yup.string().required(\"Required\"),\n name: Yup.string().required(\"Required\"),\n path: Yup.string().required(\"Required\")\n});\n","import { Typography } from \"@firecms/ui\";\n\nexport function FieldHelperView({\n error,\n children\n }: { error?: boolean, children?: React.ReactNode }) {\n if (!children) return null;\n return (\n <Typography variant={\"caption\"} color={error ? \"error\" : \"secondary\"} className={\"ml-3.5 mt-0.5\"}>\n {children}\n </Typography>\n );\n}\n","import React, { useContext } from \"react\";\nimport { FormexController } from \"./types\";\n\nconst FormexContext = React.createContext<FormexController<any>>({} as any);\n\nexport const useFormex = <T extends object>() => useContext<FormexController<T>>(FormexContext);\n\nexport const Formex = FormexContext.Provider;\n","import * as React from \"react\";\n\n/** @private is the value an empty array? */\nexport const isEmptyArray = (value?: any) =>\n Array.isArray(value) && value.length === 0;\n\n/** @private is the given object a Function? */\nexport const isFunction = (obj: any): obj is Function =>\n typeof obj === \"function\";\n\n/** @private is the given object an Object? */\nexport const isObject = (obj: any): obj is Object =>\n obj !== null && typeof obj === \"object\";\n\n/** @private is the given object an integer? */\nexport const isInteger = (obj: any): boolean =>\n String(Math.floor(Number(obj))) === obj;\n\n/** @private is the given object a string? */\nexport const isString = (obj: any): obj is string =>\n Object.prototype.toString.call(obj) === \"[object String]\";\n\n/** @private is the given object a NaN? */\n// eslint-disable-next-line no-self-compare\nexport const isNaN = (obj: any): boolean => obj !== obj;\n\n/** @private Does a React component have exactly 0 children? */\nexport const isEmptyChildren = (children: any): boolean =>\n React.Children.count(children) === 0;\n\n/** @private is the given object/value a promise? */\nexport const isPromise = (value: any): value is PromiseLike<any> =>\n isObject(value) && isFunction(value.then);\n\n/** @private is the given object/value a type of synthetic event? */\nexport const isInputEvent = (value: any): value is React.SyntheticEvent<any> =>\n value && isObject(value) && isObject(value.target);\n\n/**\n * Same as document.activeElement but wraps in a try-catch block. In IE it is\n * not safe to call document.activeElement if there is nothing focused.\n *\n * The activeElement will be null only if the document or document body is not\n * yet defined.\n *\n * @param {?Document} doc Defaults to current document.\n * @return {Element | null}\n * @see https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/dom/getActiveElement.js\n */\nexport function getActiveElement(doc?: Document): Element | null {\n doc = doc || (typeof document !== \"undefined\" ? document : undefined);\n if (typeof doc === \"undefined\") {\n return null;\n }\n try {\n return doc.activeElement || doc.body;\n } catch (e) {\n return doc.body;\n }\n}\n\n/**\n * Deeply get a value from an object via its path.\n */\nexport function getIn(\n obj: any,\n key: string | string[],\n def?: any,\n p = 0\n) {\n const path = toPath(key);\n while (obj && p < path.length) {\n obj = obj[path[p++]];\n }\n\n // check if path is not in the end\n if (p !== path.length && !obj) {\n return def;\n }\n\n return obj === undefined ? def : obj;\n}\n\nexport function setIn(obj: any, path: string, value: any): any {\n const res: any = clone(obj); // this keeps inheritance when obj is a class\n let resVal: any = res;\n let i = 0;\n const pathArray = toPath(path);\n\n for (; i < pathArray.length - 1; i++) {\n const currentPath: string = pathArray[i];\n const currentObj: any = getIn(obj, pathArray.slice(0, i + 1));\n\n if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {\n resVal = resVal[currentPath] = clone(currentObj);\n } else {\n const nextPath: string = pathArray[i + 1];\n resVal = resVal[currentPath] =\n isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};\n }\n }\n\n // Return original object if new value is the same as current\n if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {\n return obj;\n }\n\n if (value === undefined) {\n delete resVal[pathArray[i]];\n } else {\n resVal[pathArray[i]] = value;\n }\n\n // If the path array has a single element, the loop did not run.\n // Deleting on `resVal` had no effect in this scenario, so we delete on the result instead.\n if (i === 0 && value === undefined) {\n delete res[pathArray[i]];\n }\n\n return res;\n}\n\n/**\n * Recursively a set the same value for all keys and arrays nested object, cloning\n * @param object\n * @param value\n * @param visited\n * @param response\n */\nexport function setNestedObjectValues<T>(\n object: any,\n value: any,\n visited: any = new WeakMap(),\n response: any = {}\n): T {\n for (const k of Object.keys(object)) {\n const val = object[k];\n if (isObject(val)) {\n if (!visited.get(val)) {\n visited.set(val, true);\n // In order to keep array values consistent for both dot path and\n // bracket syntax, we need to check if this is an array so that\n // this will output { friends: [true] } and not { friends: { \"0\": true } }\n response[k] = Array.isArray(val) ? [] : {};\n setNestedObjectValues(val, value, visited, response[k]);\n }\n } else {\n response[k] = value;\n }\n }\n\n return response;\n}\n\nfunction clone(value: any) {\n if (Array.isArray(value)) {\n return [...value];\n } else if (typeof value === \"object\" && value !== null) {\n return { ...value };\n } else {\n return value; // This is for primitive types which do not need cloning.\n }\n}\n\nfunction toPath(value: string | string[]) {\n if (Array.isArray(value)) return value; // Already in path array form.\n // Replace brackets with dots, remove leading/trailing dots, then split by dot.\n return value.replace(/\\[(\\d+)]/g, \".$1\").replace(/^\\./, \"\").replace(/\\.$/, \"\").split(\".\");\n}\n","import * as React from \"react\";\nimport { useFormex } from \"./Formex\";\nimport { getIn, isFunction, isObject } from \"./utils\";\nimport { FormexController } from \"./types\";\n\nexport interface FieldInputProps<Value> {\n /** Value of the field */\n value: Value;\n /** Name of the field */\n name: string;\n /** Multiple select? */\n multiple?: boolean;\n /** Is the field checked? */\n checked?: boolean;\n /** Change event handler */\n onChange: (event: React.SyntheticEvent) => void,\n /** Blur event handler */\n onBlur: (event: React.FocusEvent) => void,\n}\n\nexport interface FormexFieldProps<Value = any, FormValues extends object = any> {\n field: FieldInputProps<Value>;\n form: FormexController<FormValues>;\n}\n\nexport type FieldValidator = (\n value: any\n) => string | void | Promise<string | void>;\n\nexport interface FieldConfig<V = any, C extends React.ElementType | undefined = undefined> {\n\n /**\n * Component to render. Can either be a string e.g. 'select', 'input', or 'textarea', or a component.\n */\n as?:\n | C\n | string\n | React.ForwardRefExoticComponent<any>;\n\n /**\n * Children render function <Field name>{props => ...}</Field>)\n */\n children?: ((props: FormexFieldProps<V>) => React.ReactNode) | React.ReactNode;\n\n /**\n * Validate a single field value independently\n */\n // validate?: FieldValidator;\n\n /**\n * Used for 'select' and related input types.\n */\n multiple?: boolean;\n\n /**\n * Field name\n */\n name: string;\n\n /** HTML input type */\n type?: string;\n\n /** Field value */\n value?: any;\n\n /** Inner ref */\n innerRef?: (instance: any) => void;\n\n}\n\nexport type FieldProps<T, C extends React.ElementType | undefined> = {\n as?: C;\n} & (C extends React.ElementType ? (React.ComponentProps<C> & FieldConfig<T, C>) : FieldConfig<T, C>);\n\nexport function Field<T, C extends React.ElementType | undefined = undefined>({\n validate,\n name,\n children,\n as: is, // `as` is reserved in typescript lol\n // component,\n className,\n ...props\n }: FieldProps<T, C>) {\n const formex = useFormex();\n\n const field = getFieldProps({ name, ...props }, formex);\n\n if (isFunction(children)) {\n return children({ field, form: formex });\n }\n\n // if (component) {\n // if (typeof component === \"string\") {\n // const { innerRef, ...rest } = props;\n // return React.createElement(\n // component,\n // { ref: innerRef, ...field, ...rest, className },\n // children\n // );\n // }\n // return React.createElement(\n // component,\n // { field, form: formex, ...props, className },\n // children\n // );\n // }\n\n // default to input here so we can check for both `as` and `children` above\n const asElement = is || \"input\";\n\n if (typeof asElement === \"string\") {\n const { innerRef, ...rest } = props;\n return React.createElement(\n asElement,\n { ref: innerRef, ...field, ...rest, className },\n children\n );\n }\n\n return React.createElement(asElement, { ...field, ...props, className }, children);\n}\n\nconst getFieldProps = (nameOrOptions: string | FieldConfig<any>, formex:FormexController<any>): FieldInputProps<any> => {\n const isAnObject = isObject(nameOrOptions);\n const name = isAnObject\n ? (nameOrOptions as FieldConfig<any>).name\n : nameOrOptions;\n const valueState = getIn(formex.values, name);\n\n const field: FieldInputProps<any> = {\n name,\n value: valueState,\n onChange: formex.handleChange,\n onBlur: formex.handleBlur,\n };\n if (isAnObject) {\n const {\n type,\n value: valueProp, // value is special for checkboxes\n as: is,\n multiple,\n } = nameOrOptions as FieldConfig<any>;\n\n if (type === \"checkbox\") {\n if (valueProp === undefined) {\n field.checked = !!valueState;\n } else {\n field.checked = !!(\n Array.isArray(valueState) && ~valueState.indexOf(valueProp)\n );\n field.value = valueProp;\n }\n } else if (type === \"radio\") {\n field.checked = valueState === valueProp;\n field.value = valueProp;\n } else if (is === \"select\" && multiple) {\n field.value = field.value || [];\n field.multiple = true;\n }\n }\n return field;\n};\n","import React, { FormEvent, useEffect, useState } from \"react\";\nimport { setIn } from \"./utils\";\nimport { FormexController, FormexResetProps } from \"./types\";\n\nexport function useCreateFormex<T extends object>({ initialValues, initialErrors, validation, validateOnChange = false, onSubmit, validateOnInitialRender = false }: {\n initialValues: T,\n initialErrors?: Record<string, string>,\n validateOnChange?: boolean,\n validateOnInitialRender?: boolean,\n validation?: (values: T) => Record<string, string>,\n onSubmit?: (values: T, controller: FormexController<T>) => void | Promise<void>\n}): FormexController<T> {\n\n const valuesRef = React.useRef<T>(initialValues);\n\n const [values, setValuesInner] = useState<T>(initialValues);\n const [touchedState, setTouchedState] = useState<Record<string, boolean>>({});\n const [errors, setErrors] = useState<Record<string, string>>(initialErrors ?? {});\n const [dirty, setDirty] = useState(false);\n const [submitCount, setSubmitCount] = useState(0);\n const [isSubmitting, setIsSubmitting] = useState(false);\n\n useEffect(() => {\n if (validateOnInitialRender) {\n validate();\n }\n }, []);\n\n const setValues = (newValues: T) => {\n valuesRef.current = newValues;\n setValuesInner(newValues);\n }\n\n const validate = () => {\n const values = valuesRef.current;\n const validationErrors = validation?.(values);\n setErrors(validationErrors ?? {});\n return validationErrors;\n }\n\n const setFieldValue = (key: string, value: any, shouldValidate?: boolean) => {\n const newValues = setIn(valuesRef.current, key, value);\n valuesRef.current = newValues;\n setValues(newValues);\n if (shouldValidate) {\n validate();\n }\n }\n\n const setFieldError = (key: string, error: string | undefined) => {\n console.log(\"setFieldError\", {key, error, errors })\n const newErrors = { ...errors };\n if (error) {\n newErrors[key] = error;\n } else {\n delete newErrors[key];\n }\n setErrors(newErrors);\n }\n\n const setFieldTouched = (key: string, touched: boolean, shouldValidate?: boolean | undefined) => {\n const newTouched = { ...touchedState };\n newTouched[key] = touched;\n setTouchedState(newTouched);\n if (shouldValidate) {\n validate();\n }\n }\n\n const handleChange = (event: React.SyntheticEvent) => {\n const target = event.target as HTMLInputElement;\n const value = target.type === \"checkbox\" ? target.checked : target.value;\n const name = target.name;\n setFieldValue(name, value, validateOnChange);\n setFieldTouched(name, true);\n }\n\n const handleBlur = (event: React.FocusEvent) => {\n console.log(\"handleBlur\")\n const target = event.target as HTMLInputElement;\n const name = target.name;\n setFieldTouched(name, true);\n }\n\n const submit = async (e?: FormEvent<HTMLFormElement>) => {\n e?.preventDefault();\n e?.stopPropagation();\n setIsSubmitting(true);\n setSubmitCount(submitCount + 1);\n const validationErrors = validation?.(valuesRef.current);\n if (validationErrors && Object.keys(validationErrors).length > 0) {\n setErrors(validationErrors);\n } else {\n setErrors({});\n await onSubmit?.(valuesRef.current, controllerRef.current);\n }\n setIsSubmitting(false);\n }\n\n const resetForm = (props?: FormexResetProps<T>) => {\n const {\n values: valuesProp,\n errors: errorsProp,\n touched: touchedProp\n } = props ?? {};\n valuesRef.current = valuesProp ?? initialValues;\n setValues(valuesProp ?? initialValues);\n setErrors(errorsProp ?? {});\n setTouchedState(touchedProp ?? {});\n setDirty(false);\n setSubmitCount(0);\n }\n\n const controller: FormexController<T> = {\n values,\n handleChange,\n isSubmitting,\n setValues,\n setFieldValue,\n errors,\n setFieldError,\n touched: touchedState,\n setFieldTouched,\n dirty,\n setDirty,\n submitForm: submit,\n submitCount,\n setSubmitCount,\n handleBlur,\n validate,\n resetForm\n };\n\n const controllerRef = React.useRef<FormexController<T>>(controller);\n controllerRef.current = controller;\n return controller\n}\n","import React, { useEffect, useState } from \"react\";\nimport { EntityCollection, IconForView, SearchIconsView, singular, toSnakeCase, } from \"@firecms/core\";\nimport {\n Autocomplete,\n AutocompleteItem,\n BooleanSwitchWithLabel,\n Chip,\n cn,\n Container,\n DebouncedTextField,\n Dialog,\n ExpandablePanel,\n IconButton,\n Select,\n SelectItem,\n SettingsIcon,\n TextField,\n Tooltip,\n Typography,\n useAutoComplete\n} from \"@firecms/ui\";\n\nimport { FieldHelperView } from \"./properties/FieldHelperView\";\nimport { useFormex, Field, getIn } from \"../../form\";\n\nexport function CollectionDetailsForm({\n isNewCollection,\n reservedGroups,\n existingPaths,\n existingIds,\n groups,\n parentCollection\n }: {\n isNewCollection: boolean,\n reservedGroups?: string[];\n existingPaths?: string[];\n existingIds?: string[];\n groups: string[] | null;\n parentCollection?: EntityCollection;\n parentCollectionIds?: string[];\n}) {\n\n const groupRef = React.useRef<HTMLInputElement>(null);\n const {\n values,\n setFieldValue,\n handleChange,\n touched,\n errors,\n setFieldTouched,\n isSubmitting,\n submitCount\n } = useFormex<EntityCollection>();\n\n const [iconDialogOpen, setIconDialogOpen] = useState(false);\n const [advancedPanelExpanded, setAdvancedPanelExpanded] = useState(false);\n\n const updateName = (name: string) => {\n setFieldValue(\"name\", name);\n\n const pathTouched = getIn(touched, \"path\");\n if (!pathTouched && isNewCollection && name) {\n setFieldValue(\"path\", toSnakeCase(name));\n }\n\n const idTouched = getIn(touched, \"id\");\n if (!idTouched && isNewCollection && name) {\n setFieldValue(\"id\", toSnakeCase(name));\n }\n\n const singularNameTouched = getIn(touched, \"singularName\");\n if (!singularNameTouched && isNewCollection && name) {\n setFieldValue(\"singularName\", singular(name))\n }\n\n };\n\n useEffect(() => {\n if (errors.id) {\n setAdvancedPanelExpanded(true);\n }\n }, [errors.id]);\n\n const collectionIcon = <IconForView collectionOrView={values}/>;\n\n const groupOptions = groups?.filter((group) => !reservedGroups?.includes(group));\n\n const {\n inputFocused,\n autoCompleteOpen,\n setAutoCompleteOpen\n } = useAutoComplete({\n ref: groupRef\n });\n\n const isSubcollection = !!parentCollection;\n\n let customIdValue: \"true\" | \"false\" | \"optional\" | \"code_defined\" | undefined;\n if (customIdValue) {\n if (typeof values.customId === \"object\") {\n customIdValue = \"code_defined\";\n } else if (values.customId === true) {\n customIdValue = \"true\";\n } else if (values.customId === false) {\n customIdValue = \"false\";\n } else if (values.customId === \"optional\") {\n customIdValue = \"optional\";\n }\n }\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"4xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <div>\n <div\n className=\"flex flex-row py-2 pt-3 items-center\">\n <Typography variant={!isNewCollection ? \"h5\" : \"h4\"} className={\"flex-grow\"}>\n {isNewCollection ? \"New collection\" : `${values?.name} collection`}\n </Typography>\n <Tooltip title={\"Change icon\"}>\n <IconButton\n shape={\"square\"}\n onClick={() => setIconDialogOpen(true)}>\n {collectionIcon}\n </IconButton>\n </Tooltip>\n </div>\n\n {parentCollection && <Chip colorScheme={\"tealDarker\"}>\n <Typography variant={\"caption\"}>\n This is a subcollection of <b>{parentCollection.name}</b>\n </Typography>\n </Chip>}\n\n </div>\n <div className={\"grid grid-cols-12 gap-4\"}>\n\n <div className={\"col-span-12\"}>\n <TextField\n value={values.name ?? \"\"}\n onChange={(e: any) => updateName(e.target.value)}\n label={\"Name\"}\n required\n error={touched.name && Boolean(errors.name)}/>\n <FieldHelperView error={touched.name && Boolean(errors.name)}>\n {touched.name && Boolean(errors.name) ? errors.name : \"Name of in this collection, usually a plural name (e.g. Products)\"}\n </FieldHelperView>\n </div>\n\n <div className={cn(\"col-span-12 \", isSubcollection ? \"\" : \"sm:col-span-8\")}>\n <Field name={\"path\"}\n as={DebouncedTextField}\n label={\"Path\"}\n disabled={!isNewCollection}\n required\n error={touched.path && Boolean(errors.path)}/>\n\n <FieldHelperView error={touched.path && Boolean(errors.path)}>\n {touched.path && Boolean(errors.path)\n ? errors.path\n : isSubcollection ? \"Relative path to the parent (no need to include the parent path)\" : \"Path that this collection is stored in, in the database\"}\n </FieldHelperView>\n\n </div>\n\n {!isSubcollection && <div className={\"col-span-12 sm:col-span-4 relative\"}>\n\n <TextField error={touched.group && Boolean(errors.group)}\n disabled={isSubmitting}\n value={values.group ?? \"\"}\n autoComplete=\"off\"\n onChange={(event) => setFieldValue(\"group\", event.target.value)}\n name={\"group\"}\n inputRef={groupRef}\n label=\"Group\"/>\n <Autocomplete\n open={autoCompleteOpen && (groupOptions ?? []).length > 0}\n setOpen={setAutoCompleteOpen}>\n {groupOptions?.map((group, index) => {\n return <AutocompleteItem\n key={index + \"_\" + group}\n onClick={() => {\n setAutoCompleteOpen(false);\n setFieldValue(\"group\", group ?? null);\n }}\n >\n <div className={\"flex-grow\"}>\n {group}\n </div>\n </AutocompleteItem>;\n })}\n </Autocomplete>\n <FieldHelperView>\n {touched.group && Boolean(errors.group) ? errors.group : \"Group of the collection\"}\n </FieldHelperView>\n </div>}\n\n <div className={\"col-span-12\"}>\n <ExpandablePanel\n expanded={advancedPanelExpanded}\n onExpandedChange={setAdvancedPanelExpanded}\n title={\n <div className=\"flex flex-row text-gray-500\">\n <SettingsIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n Advanced\n </Typography>\n </div>}\n initiallyExpanded={false}>\n <div className={\"grid grid-cols-12 gap-4 p-4\"}>\n\n <div className={\"col-span-12\"}>\n <Field name={\"id\"}\n as={DebouncedTextField}\n disabled={!isNewCollection}\n label={\"Collection id\"}\n error={touched.id && Boolean(errors.id)}/>\n <FieldHelperView error={touched.id && Boolean(errors.id)}>\n {touched.id && Boolean(errors.id) ? errors.id : \"This id identifies this collection\"}\n </FieldHelperView>\n </div>\n\n <div className={\"col-span-12\"}>\n <TextField\n error={touched.singularName && Boolean(errors.singularName)}\n id={\"singularName\"}\n aria-describedby={\"singularName-helper\"}\n onChange={(e) => {\n setFieldTouched(\"singularName\", true);\n return handleChange(e);\n }}\n value={values.singularName ?? \"\"}\n label={\"Singular name\"}/>\n <FieldHelperView error={touched.singularName && Boolean(errors.singularName)}>\n {touched.singularName && Boolean(errors.singularName) ? errors.singularName : \"Optionally define a singular name for your entities\"}\n </FieldHelperView>\n </div>\n <div className={\"col-span-12\"}>\n <TextField\n error={touched.description && Boolean(errors.description)}\n id=\"description\"\n value={values.description ?? \"\"}\n onChange={handleChange}\n multiline\n rows={2}\n aria-describedby=\"description-helper-text\"\n label=\"Description\"\n />\n <FieldHelperView error={touched.description && Boolean(errors.description)}>\n {touched.description && Boolean(errors.description) ? errors.description : \"Description of the collection, you can use markdown\"}\n </FieldHelperView>\n </div>\n\n <div className={\"col-span-12\"}>\n <Select\n name=\"defaultSize\"\n label=\"Default row size\"\n position={\"item-aligned\"}\n onChange={handleChange}\n value={values.defaultSize ?? \"\"}\n renderValue={(value: any) => value.toUpperCase()}\n >\n {[\"xs\", \"s\", \"m\", \"l\", \"xl\"].map((value) => (\n <SelectItem\n key={`size-select-${value}`}\n value={value}>\n {value.toUpperCase()}\n </SelectItem>\n ))}\n </Select>\n </div>\n <div className={\"col-span-12\"}>\n <Select\n name=\"customId\"\n label=\"Data IDs generation\"\n position={\"item-aligned\"}\n disabled={customIdValue === \"code_defined\"}\n onValueChange={(v) => {\n if (v === \"code_defined\")\n throw new Error(\"This should not happen\");\n else if (v === \"true\")\n setFieldValue(\"customId\", true);\n else if (v === \"false\")\n setFieldValue(\"customId\", false);\n else if (v === \"optional\")\n setFieldValue(\"customId\", \"optional\");\n }}\n value={customIdValue ?? \"\"}\n renderValue={(value: any) => {\n if (value === \"code_defined\")\n return \"Code defined\";\n else if (value === \"true\")\n return \"Users must define an ID\";\n else if (value === \"optional\")\n return \"Users can define an ID, but it is not required\";\n else\n return \"Document ID is generated automatically\";\n }}\n >\n <SelectItem value={\"false\"}>\n Document ID is generated automatically\n </SelectItem>\n <SelectItem value={\"true\"}>\n Users must define an ID\n </SelectItem>\n <SelectItem value={\"optional\"}>\n Users can define an ID, but it is not required\n </SelectItem>\n </Select>\n </div>\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n label=\"Collection group\"\n onValueChange={(v) => setFieldValue(\"collectionGroup\", v)}\n value={values.collectionGroup ?? false}\n />\n <FieldHelperView>\n A collection group consists of all collections with the same path. This allows\n you\n to query over multiple collections at once.\n </FieldHelperView>\n </div>\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n label=\"Enable text search for this collection\"\n onValueChange={(v) => setFieldValue(\"textSearchEnabled\", v)}\n value={values.textSearchEnabled ?? false}\n />\n <FieldHelperView>\n Allow text search for this collection. If you have not specified a text search\n delegate, this will use the built-in local text search. This is not recommended\n for large collections, as it may incur in performance and cost issues.\n </FieldHelperView>\n </div>\n </div>\n </ExpandablePanel>\n\n </div>\n\n </div>\n\n <div style={{ height: \"52px\" }}/>\n\n <Dialog\n open={iconDialogOpen}\n onOpenChange={setIconDialogOpen}\n maxWidth={\"xl\"}\n fullWidth\n >\n <div className={\"p-4 overflow-auto min-h-[200px]\"}>\n <SearchIconsView selectedIcon={values.icon}\n onIconSelected={(icon: string) => {\n setIconDialogOpen(false);\n setFieldValue(\"icon\", icon);\n }}/>\n </div>\n\n </Dialog>\n\n </Container>\n </div>\n );\n}\n","export function idToPropertiesPath(id: string): string {\n return \"properties.\" + id.replaceAll(\".\", \".properties.\");\n}\n\nexport function namespaceToPropertiesPath(namespace?: string): string {\n return namespace\n ? \"properties.\" + namespace.replaceAll(\".\", \".properties.\") + \".properties\"\n : \"properties\";\n}\n\nexport function namespaceToPropertiesOrderPath(namespace?: string): string {\n return namespace\n ? \"properties.\" + namespace.replaceAll(\".\", \".properties.\") + \".propertiesOrder\"\n : \"propertiesOrder\";\n}\n\nexport function getFullId(propertyKey: string, propertyNamespace?: string): string {\n return propertyNamespace\n ? `${propertyNamespace}.${propertyKey}`\n : propertyKey;\n}\n\nexport function getFullIdPath(propertyKey: string, propertyNamespace?: string): string {\n const keyWithNamespace = propertyNamespace\n ? `${propertyNamespace}.${propertyKey}`\n : propertyKey;\n return idToPropertiesPath(keyWithNamespace);\n}\n","import React, { useEffect } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport { ArrayContainer, EnumValueConfig, EnumValues, } from \"@firecms/core\";\nimport {\n AutoAwesomeIcon,\n Badge,\n Button,\n CircularProgress,\n DebouncedTextField,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n ListIcon,\n Paper,\n SettingsIcon,\n Typography\n} from \"@firecms/ui\";\nimport { FieldHelperView } from \"./properties/FieldHelperView\";\nimport { extractEnumFromValues } from \"@firecms/schema_inference\";\nimport { Field, Formex, getIn, useCreateFormex, useFormex } from \"../../form\";\n\ntype EnumFormProps = {\n enumValues: EnumValueConfig[];\n onValuesChanged?: (enumValues: EnumValueConfig[]) => void;\n onError?: (error: boolean) => void;\n updateIds: boolean;\n disabled: boolean;\n allowDataInference?: boolean;\n getData?: () => Promise<string[]>;\n};\n\nexport function EnumForm({\n enumValues,\n onValuesChanged,\n onError,\n updateIds,\n disabled,\n allowDataInference,\n getData\n }: EnumFormProps) {\n\n const formex = useCreateFormex<{\n enumValues: EnumValueConfig[]\n }>({\n initialValues: { enumValues },\n validateOnChange: true,\n validation: (values) => {\n const errors: any = {};\n if (values.enumValues) {\n values.enumValues.forEach((enumValue, index) => {\n if (!enumValue?.label) {\n errors.enumValues = errors.enumValues ?? [];\n errors.enumValues[index] = errors.enumValues[index] ?? {};\n errors.enumValues[index].label = \"You must specify a label for this enum value entry\";\n }\n if (!enumValue?.id) {\n errors.enumValues = errors.enumValues ?? [];\n errors.enumValues[index] = errors.enumValues[index] ?? {};\n errors.enumValues[index].id = \"You must specify an ID for this enum value entry\";\n }\n });\n }\n const hasError = Boolean(errors?.enumValues && Object.keys(errors?.enumValues).length > 0);\n onError?.(hasError);\n return errors;\n }\n });\n\n const { values, errors } = formex;\n\n useEffect(() => {\n if (onValuesChanged) {\n onValuesChanged(values.enumValues);\n }\n }, [values.enumValues]);\n\n return <Formex value={formex}>\n <EnumFormFields enumValuesPath={\"enumValues\"}\n values={values}\n errors={errors}\n shouldUpdateId={updateIds}\n disabled={disabled}\n allowDataInference={allowDataInference}\n getData={getData}/>\n </Formex>\n\n}\n\ntype EnumFormFieldsProps = {\n values: {\n enumValues: EnumValueConfig[]\n };\n errors: any;\n enumValuesPath: string;\n shouldUpdateId: boolean;\n disabled: boolean;\n getData?: () => Promise<string[]>;\n allowDataInference?: boolean;\n};\n\n// const EnumFormFields = React.memo(\nfunction EnumFormFields({\n values,\n errors,\n disabled,\n enumValuesPath,\n shouldUpdateId,\n allowDataInference,\n getData,\n }: EnumFormFieldsProps) {\n\n const {\n setFieldValue\n } = useFormex();\n\n const [lastInternalIdAdded, setLastInternalIdAdded] = React.useState<number | undefined>();\n const [editDialogIndex, setEditDialogIndex] = React.useState<number | undefined>();\n const [inferring, setInferring] = React.useState(false);\n\n const inferredValuesRef = React.useRef(new Set());\n const inferredValues = inferredValuesRef.current;\n\n const buildEntry = (index: number, internalId: number) => {\n const justAdded = lastInternalIdAdded === internalId;\n const entryError = errors?.enumValues && errors?.enumValues[index];\n return <EnumEntry index={index}\n disabled={disabled}\n enumValuesPath={enumValuesPath}\n autoFocus={justAdded}\n entryError={entryError}\n shouldUpdateId={shouldUpdateId || justAdded}\n onDialogOpen={() => setEditDialogIndex(index)}\n inferredEntry={inferredValues.has(values.enumValues[index]?.id as string)}\n key={`${internalId}`}/>;\n };\n\n const inferValues = async () => {\n if (!getData)\n return;\n setInferring(true);\n getData?.().then((data) => {\n if (!data)\n return;\n\n const flatData = data.flat();\n\n const fieldData = Array.from(new Set(flatData));\n\n const currentEnumValues = values.enumValues;\n const foundEnumValues = extractEnumFromValues(fieldData);\n\n // add only new enum values\n const newEnumValues = foundEnumValues.filter((enumValue) => {\n return !currentEnumValues?.some((v: any) => v.id === enumValue.id);\n });\n\n newEnumValues.forEach((enumValue) => {\n inferredValues.add(enumValue.id);\n });\n setFieldValue(enumValuesPath, [...newEnumValues, ...currentEnumValues], true);\n }).catch(e => {\n console.error(e);\n })\n .finally(() => setInferring(false));\n }\n\n return (\n <div className={\"col-span-12\"}>\n <div className=\"ml-3.5 flex flex-row items-center\">\n <ListIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2 grow\">\n Values\n </Typography>\n {allowDataInference &&\n <Button loading={inferring}\n disabled={disabled || inferring}\n variant={\"text\"}\n size={\"small\"}\n onClick={inferValues}>\n {inferring ? <CircularProgress size={\"small\"}/> : <AutoAwesomeIcon/>}\n Infer values from data\n </Button>}\n </div>\n\n <Paper className=\"p-4 m-1\">\n\n <ArrayContainer droppableId={enumValuesPath}\n addLabel={\"Add enum value\"}\n value={values.enumValues}\n disabled={disabled}\n size={\"small\"}\n buildEntry={buildEntry}\n onInternalIdAdded={setLastInternalIdAdded}\n includeAddButton={true}\n onValueChange={(value) => setFieldValue(enumValuesPath, value)}\n newDefaultEntry={{ id: \"\", label: \"\" }}/>\n\n <EnumEntryDialog index={editDialogIndex}\n open={editDialogIndex !== undefined}\n enumValuesPath={enumValuesPath}\n onClose={() => setEditDialogIndex(undefined)}/>\n </Paper>\n </div>\n );\n}\n\ntype EnumEntryProps = {\n index: number,\n enumValuesPath: string,\n shouldUpdateId: boolean,\n autoFocus: boolean,\n onDialogOpen: () => void;\n disabled: boolean;\n inferredEntry?: boolean;\n entryError?: { label?: string, id?: string }\n};\n\nconst EnumEntry = React.memo(\n function EnumEntryInternal({\n index,\n shouldUpdateId: updateId,\n enumValuesPath,\n autoFocus,\n onDialogOpen,\n disabled,\n inferredEntry,\n entryError\n }: EnumEntryProps) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormex<EnumValues>();\n\n const shouldUpdateIdRef = React.useRef(!getIn(values, `${enumValuesPath}[${index}].id`));\n const shouldUpdateId = updateId || shouldUpdateIdRef.current;\n\n const idValue = getIn(values, `${enumValuesPath}[${index}].id`);\n const labelValue = getIn(values, `${enumValuesPath}[${index}].label`);\n\n const currentLabelRef = React.useRef(labelValue);\n\n React.useEffect(() => {\n if ((currentLabelRef.current === idValue || !idValue) && shouldUpdateId) {\n setFieldValue(`${enumValuesPath}[${index}].id`, labelValue);\n }\n currentLabelRef.current = labelValue;\n }, [labelValue]);\n\n return (\n <>\n <div className={\"flex w-full align-center justify-center\"}>\n <Field name={`${enumValuesPath}[${index}].label`}\n as={DebouncedTextField}\n className={\"flex-grow\"}\n required\n disabled={disabled}\n size=\"small\"\n autoFocus={autoFocus}\n autoComplete=\"off\"\n endAdornment={inferredEntry && <AutoAwesomeIcon size={\"small\"}/>}\n error={Boolean(entryError?.label)}/>\n\n {!disabled &&\n <Badge color={\"error\"} invisible={!entryError?.id}>\n <IconButton\n size=\"small\"\n aria-label=\"edit\"\n className={\"m-1\"}\n onClick={() => onDialogOpen()}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>\n </Badge>}\n\n </div>\n\n {entryError?.label && <Typography variant={\"caption\"}\n className={\"ml-3.5 text-red-500 dark:text-red-500\"}>\n {entryError?.label}\n </Typography>}\n\n {entryError?.id && <Typography variant={\"caption\"}\n className={\"ml-3.5 text-red-500 dark:text-red-500\"}>\n {entryError?.id}\n </Typography>}\n\n </>);\n },\n function areEqual(prevProps: EnumEntryProps, nextProps: EnumEntryProps) {\n return prevProps.index === nextProps.index &&\n prevProps.enumValuesPath === nextProps.enumValuesPath &&\n prevProps.shouldUpdateId === nextProps.shouldUpdateId &&\n prevProps.inferredEntry === nextProps.inferredEntry &&\n equal(prevProps.entryError, nextProps.entryError) &&\n prevProps.autoFocus === nextProps.autoFocus;\n }\n);\n\nfunction EnumEntryDialog({\n index,\n open,\n onClose,\n enumValuesPath\n }: {\n index?: number;\n open: boolean;\n enumValuesPath: string;\n onClose: () => void;\n}) {\n\n const {\n errors,\n } = useFormex<EnumValues>();\n\n const idError = index !== undefined ? getIn(errors, `${enumValuesPath}[${index}].id`) : undefined;\n return <Dialog\n maxWidth=\"md\"\n aria-labelledby=\"enum-edit-dialog\"\n open={open}\n onOpenChange={(open) => !open ? onClose() : undefined}\n >\n\n <DialogContent>\n {index !== undefined &&\n <div>\n <Field name={`${enumValuesPath}[${index}].id`}\n as={DebouncedTextField}\n required\n label={\"ID\"}\n size=\"small\"\n autoComplete=\"off\"\n error={Boolean(idError)}/>\n\n <FieldHelperView error={Boolean(idError)}>\n {idError ?? \"Value saved in the data source\"}\n </FieldHelperView>\n </div>}\n </DialogContent>\n\n <DialogActions>\n <Button\n autoFocus\n variant=\"outlined\"\n onClick={onClose}\n color=\"primary\">\n Ok\n </Button>\n </DialogActions>\n\n </Dialog>\n}\n\n","import React from \"react\";\n\nimport { BooleanSwitchWithLabel, Tooltip } from \"@firecms/ui\";\nimport { FormexFieldProps } from \"../../form\";\n\nexport function SwitchControl({\n field,\n form,\n label,\n tooltip,\n disabled,\n size = \"small\",\n allowIndeterminate\n }: FormexFieldProps & {\n label: string,\n tooltip?: string,\n disabled?: boolean,\n size?: \"small\" | \"medium\",\n allowIndeterminate?: boolean\n}) {\n\n const formControlLabel = <BooleanSwitchWithLabel\n label={label}\n size={size}\n position={\"start\"}\n value={field.value}\n disabled={disabled}\n allowIndeterminate={allowIndeterminate}\n onValueChange={(checked:boolean | null) => form.setFieldValue(field.name, checked)}/>;\n\n if (tooltip)\n return (\n <Tooltip\n title={tooltip}>\n {formControlLabel}\n </Tooltip>\n );\n return formControlLabel;\n}\n","import React from \"react\";\n\nimport { Field, FormexFieldProps, getIn, useFormex } from \"../../../../form\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { SwitchControl } from \"../../SwitchControl\";\n\nexport function GeneralPropertyValidation({ disabled }: {\n required?: boolean;\n disabled: boolean;\n}) {\n\n const { values, handleChange } = useFormex();\n\n const validationRequired = \"validation.required\";\n const validationRequiredMessage = \"validation.requiredMessage\";\n const validationUnique = \"validation.unique\";\n const validationUniqueInArray = \"validation.uniqueInArray\";\n\n return (\n <>\n <div className={\"col-span-6\"}>\n <Field name={validationRequired}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n disabled={disabled}\n label={\"Required\"}\n tooltip={\"You won't be able to save this entity if this value is not set\"}\n form={form}\n field={field}/>\n }}\n </Field>\n </div>\n\n <div className={\"col-span-6\"}>\n\n <Field name={validationUnique}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n disabled={disabled}\n label={\"Unique\"}\n tooltip={\"There cannot be multiple entities with the same value\"}\n form={form}\n field={field}/>\n }}\n </Field>\n </div>\n\n {getIn(values, validationRequired) && <div className={\"col-span-12\"}>\n <DebouncedTextField\n disabled={disabled}\n value={getIn(values, validationRequiredMessage)}\n label={\"Required message\"}\n name={validationRequiredMessage}\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n </>\n );\n}\n","import React from \"react\";\n\nimport { Field, FormexFieldProps, getIn, useFormex } from \"../../../../form\";\nimport { isValidRegExp, serializeRegExp } from \"@firecms/core\";\nimport { DebouncedTextField, } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\nimport { FieldHelperView } from \"../FieldHelperView\";\nimport { SwitchControl } from \"../../SwitchControl\";\n\nexport function StringPropertyValidation({\n length,\n lowercase,\n matches,\n max,\n min,\n trim,\n uppercase,\n disabled,\n showErrors\n }: {\n length?: boolean;\n min?: boolean;\n max?: boolean;\n trim?: boolean;\n matches?: boolean;\n lowercase?: boolean;\n uppercase?: boolean;\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const {\n values,\n handleChange,\n errors\n } = useFormex();\n\n const validationLength = \"validation.length\";\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n const validationTrim = \"validation.trim\";\n const validationMatches = \"validation.matches\";\n const validationLowercase = \"validation.lowercase\";\n const validationUppercase = \"validation.uppercase\";\n\n const matchesError = getIn(errors, validationMatches);\n\n const matchesValue = getIn(values, validationMatches);\n const matchesStringValue = typeof matchesValue === \"string\" ? matchesValue : serializeRegExp(matchesValue);\n return (\n <div className={\"grid grid-cols-12 gap-2\"}>\n\n <GeneralPropertyValidation disabled={disabled}/>\n\n <div className={\"grid grid-cols-12 gap-2 col-span-12\"}>\n\n {lowercase && <div className={\"col-span-4\"}>\n <Field name={validationLowercase}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={\"Lowercase\"}\n disabled={disabled}\n form={form}\n field={field}/>\n }}\n </Field>\n </div>}\n\n {uppercase && <div className={\"col-span-4\"}>\n <Field name={validationUppercase}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={\"Uppercase\"}\n disabled={disabled}\n form={form}\n field={field}/>\n }}\n </Field>\n </div>}\n\n {trim && <div className={\"col-span-4\"}>\n <Field name={validationTrim}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={\"Trim\"}\n disabled={disabled}\n form={form}\n field={field}/>\n }}\n </Field>\n </div>}\n\n </div>\n\n <div className={\"grid grid-cols-12 gap-2 col-span-12\"}>\n {length && <div className={\"col-span-4\"}>\n <DebouncedTextField\n value={getIn(values, validationLength)}\n label={\"Exact length\"}\n name={validationLength}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n {min && <div className={\"col-span-4\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n label={\"Min length\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n {max && <div className={\"col-span-4\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n label={\"Max length\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n </div>\n\n {matches && <div className={\"col-span-12\"}>\n <Field name={validationMatches}\n as={DebouncedTextField}\n label={\"Matches regex\"}\n size=\"small\"\n disabled={disabled}\n value={matchesStringValue}\n error={Boolean(matchesError)}/>\n <FieldHelperView error={Boolean(matchesError)}>\n {matchesError ? \"Not a valid regexp\" : \"e.g. /^\\\\d+$/ for digits only\"}\n </FieldHelperView>\n </div>}\n\n </div>\n );\n\n}\n","import React from \"react\";\n\nimport { getIn, useFormex } from \"../../../../form\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\n\nexport function ArrayPropertyValidation({\n max = true,\n min = true,\n disabled\n }: {\n min?: boolean;\n max?: boolean;\n disabled: boolean;\n}) {\n\n const {\n values,\n handleChange\n } = useFormex();\n\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n\n return (\n <div className={\"grid grid-cols-12 gap-2\"}>\n\n <GeneralPropertyValidation disabled={disabled}/>\n\n {min && <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n disabled={disabled}\n label={\"Min length\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n {max && <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n disabled={disabled}\n label={\"Max length\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n </div>\n );\n}\n","import { PropsWithChildren } from \"react\";\n\nimport { ExpandablePanel, RuleIcon, Typography } from \"@firecms/ui\";\n\nexport function ValidationPanel({\n children\n }: PropsWithChildren<{}>) {\n\n return (\n <ExpandablePanel\n initiallyExpanded={false}\n asField={true}\n className=\"p-4\"\n title={\n <div className=\"flex flex-row text-gray-500\">\n <RuleIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n Validation\n </Typography>\n </div>\n }>\n\n {children}\n\n </ExpandablePanel>\n )\n}\n","import React, { useMemo } from \"react\";\nimport { getIn, useFormex } from \"../../../form\";\nimport { EnumValueConfig, resolveEnumValues, useSnackbarController } from \"@firecms/core\";\nimport { Select, SelectItem } from \"@firecms/ui\";\nimport { EnumForm } from \"../EnumForm\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { PropertyWithId } from \"../PropertyEditView\";\n\nexport function EnumPropertyField({\n multiselect,\n updateIds,\n disabled,\n showErrors,\n allowDataInference,\n getData\n }: {\n multiselect: boolean;\n updateIds: boolean;\n disabled: boolean;\n showErrors: boolean;\n allowDataInference?: boolean;\n getData?: () => Promise<object[]>;\n}) {\n\n const {\n values,\n setFieldError,\n setFieldValue\n } = useFormex<PropertyWithId>();\n\n const snackbarContext = useSnackbarController();\n\n const enumValuesPath = multiselect ? \"of.enumValues\" : \"enumValues\";\n\n const defaultValue = getIn(values, \"defaultValue\");\n\n const valuesEnumValues = getIn(values, enumValuesPath);\n const enumValues: EnumValueConfig[] = useMemo(() => {\n if (!valuesEnumValues || typeof valuesEnumValues === \"boolean\")\n return [] as EnumValueConfig[];\n return resolveEnumValues(valuesEnumValues) ?? [] as EnumValueConfig[];\n }, [valuesEnumValues]);\n\n const onValuesChanged = (value: EnumValueConfig[]) => {\n if (!values)\n return;\n setFieldValue(enumValuesPath, value);\n if (!multiselect) {\n const enumIds = value.filter(v => Boolean(v?.id)).map((v: any) => v.id);\n if (defaultValue && !enumIds.includes(defaultValue)) {\n setFieldValue(\"defaultValue\", undefined);\n snackbarContext.open({\n type: \"warning\",\n message: \"Default value was cleared\"\n })\n }\n }\n };\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <EnumForm enumValues={enumValues}\n updateIds={updateIds}\n disabled={disabled}\n allowDataInference={allowDataInference}\n onError={(hasError) => {\n setFieldError(enumValuesPath, hasError ? \"This enum property is missing some values\" : undefined);\n }}\n getData={getData\n ? () => getData()\n .then(res => res.map(d => values.id && getIn(d, values.id)).filter(Boolean))\n : undefined}\n onValuesChanged={onValuesChanged}/>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n {!multiselect &&\n <StringPropertyValidation disabled={disabled}\n showErrors={showErrors}/>}\n {multiselect &&\n <ArrayPropertyValidation disabled={disabled}/>}\n </ValidationPanel>\n\n </div>\n\n {!multiselect && <div className={\"col-span-12\"}>\n\n <Select\n disabled={disabled}\n position={\"item-aligned\"}\n onValueChange={(value: string) => {\n setFieldValue(\"defaultValue\", value);\n }}\n label={\"Default value\"}\n value={defaultValue ?? \"\"}>\n {enumValues\n .filter((enumValue) => Boolean(enumValue?.id))\n .map((enumValue) => (\n <SelectItem key={enumValue.id}\n value={enumValue.id?.toString()}>\n {enumValue.label}\n </SelectItem>\n ))}\n </Select>\n\n </div>}\n </>\n );\n}\n","import React from \"react\";\nimport {\n Button,\n Checkbox,\n DebouncedTextField,\n ExpandablePanel,\n FileUploadIcon,\n MultiSelect,\n MultiSelectItem,\n Typography\n} from \"@firecms/ui\";\n\nimport { Field, FormexFieldProps, getIn, useFormex } from \"../../../form\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { SwitchControl } from \"../SwitchControl\";\n\nconst fileTypes: Record<string, string> = {\n \"image/*\": \"Images\",\n \"video/*\": \"Videos\",\n \"audio/*\": \"Audio files\",\n \"application/*\": \"Files (pdf, zip, csv, excel...)\",\n \"text/*\": \"Text files\"\n}\n\nexport function StoragePropertyField({\n multiple,\n existing,\n disabled\n }: {\n multiple: boolean;\n existing: boolean;\n disabled: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormex();\n\n const baseStoragePath = multiple ? \"of.storage\" : \"storage\";\n const acceptedFiles = `${baseStoragePath}.acceptedFiles`;\n\n const metadata = `${baseStoragePath}.metadata`;\n const fileName = `${baseStoragePath}.fileName`;\n const storagePath = `${baseStoragePath}.storagePath`;\n const storeUrl = `${baseStoragePath}.storeUrl`;\n\n const fileNameValue = getIn(values, fileName) ?? \"{rand}_{file}\";\n const storagePathValue = getIn(values, storagePath) ?? \"/\";\n\n const storedValue = getIn(values, acceptedFiles);\n const fileTypesValue: string[] | undefined = Array.isArray(storedValue) ? storedValue : undefined;\n const allFileTypesSelected = !fileTypesValue || fileTypesValue.length === 0;\n\n const handleTypesChange = (value: string[]) => {\n if (!value) setFieldValue(acceptedFiles, undefined);\n else if (value.includes(\"all\")) setFieldValue(acceptedFiles, undefined);\n else if (value.length >= Object.keys(fileTypes).length) setFieldValue(acceptedFiles, undefined);\n else if (allFileTypesSelected)\n setFieldValue(acceptedFiles, Object.keys(fileTypes).filter((v) => !value.includes(v)));\n else setFieldValue(acceptedFiles, value);\n };\n\n const hasFilenameCallback = typeof fileNameValue === \"function\";\n const hasStoragePathCallback = typeof storagePathValue === \"function\";\n\n return (\n <>\n\n <div className={\"col-span-12\"}>\n\n <ExpandablePanel\n title={\n <div className=\"flex flex-row text-gray-500\">\n <FileUploadIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n File upload config\n </Typography>\n </div>\n }>\n\n <div className={\"grid grid-cols-12 gap-2 p-4\"}>\n\n <div className={\"col-span-12\"}>\n\n <MultiSelect\n disabled={disabled}\n name={acceptedFiles}\n value={fileTypesValue ?? []}\n onMultiValueChange={handleTypesChange}\n label={allFileTypesSelected ? undefined : \"Allowed file types\"}\n renderValues={(selected) => {\n if (!selected || selected.length === 0) return \"All file types allowed\";\n return selected.map((v: string) => fileTypes[v])\n .filter((v: string) => Boolean(v))\n .join(\", \");\n }}>\n\n <MultiSelectItem key={\"all\"} value={\"all\"} className={\"flex items-center gap-2\"}>\n <Checkbox\n checked={!fileTypesValue}/>\n All\n </MultiSelectItem>\n\n {Object.entries(fileTypes).map(([value, label]) => (\n <MultiSelectItem key={value} value={value} className={\"flex items-center gap-2\"}>\n <Checkbox\n checked={allFileTypesSelected || fileTypesValue.indexOf(value) > -1}/>\n <div className={\"flex-grow\"}>\n {label}\n </div>\n <Button size={\"small\"}\n variant={\"outlined\"}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n return setFieldValue(acceptedFiles, [value]);\n }}>\n Only\n </Button>\n </MultiSelectItem>\n ))}\n\n </MultiSelect>\n </div>\n\n <div className={\"col-span-12\"}>\n <Field name={fileName}\n as={DebouncedTextField}\n label={\"File name\"}\n size={\"small\"}\n disabled={hasFilenameCallback || disabled}\n value={hasFilenameCallback ? \"-\" : fileNameValue}\n />\n </div>\n <div className={\"col-span-12\"}>\n <Field name={storagePath}\n as={DebouncedTextField}\n label={\"Storage path\"}\n disabled={hasStoragePathCallback || disabled}\n size={\"small\"}\n value={hasStoragePathCallback ? \"-\" : storagePathValue}\n />\n <Typography variant={\"caption\"} className={\"ml-3.5 mt-1 mb-2\"}>\n <p>You can use the following placeholders in\n the file name\n and storage path values:</p>\n <ul>\n <li>{\"{file} - Full name of the uploaded file\"}</li>\n <li>{\"{file.name} - Name of the uploaded file without extension\"}</li>\n <li>{\"{file.ext} - Extension of the uploaded file\"}</li>\n <li>{\"{entityId} - ID of the entity\"}</li>\n <li>{\"{propertyKey} - ID of this field\"}</li>\n <li>{\"{path} - Path of this entity\"}</li>\n <li>{\"{rand} - Random value used to avoid name collisions\"}</li>\n </ul>\n </Typography>\n\n <Field name={storeUrl}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={\"Save URL instead of storage path\"}\n disabled={existing || disabled}\n form={form}\n field={field}/>\n }}\n </Field>\n\n <Typography variant={\"caption\"} className={\"ml-3.5 mt-1 mb-2\"}>\n Turn this setting on, if you prefer to save\n the download\n URL of the uploaded file instead of the\n storage path.\n You can only change this prop upon creation.\n </Typography>\n </div>\n </div>\n </ExpandablePanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n {!multiple && <div className={\"grid grid-cols-12 gap-2\"}>\n <GeneralPropertyValidation disabled={disabled}/>\n </div>}\n {multiple && <div className={\"col-span-12\"}>\n <ArrayPropertyValidation disabled={disabled}/>\n </div>}\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import { isPropertyBuilder, Properties, PropertiesOrBuilders, Property, PropertyOrBuilder } from \"@firecms/core\";\n\nexport function editableProperty(property: PropertyOrBuilder | PropertyOrBuilder): boolean {\n if (isPropertyBuilder(property))\n return false;\n if (isPropertyBuilder(property as PropertyOrBuilder))\n return false;\n else {\n const eProperty = property as Property;\n if (eProperty.dataType === \"array\" && typeof eProperty.of === \"function\")\n return false;\n else if (eProperty.dataType === \"array\" && Array.isArray(eProperty.of))\n return false;\n return Boolean(eProperty.editable);\n }\n}\n\nexport function removeNonEditableProperties(properties: PropertiesOrBuilders<any>): Properties {\n return Object.entries(properties)\n .filter(([_, property]) => editableProperty(property))\n .map(([key, propertyOrBuilder]) => {\n const property = propertyOrBuilder as Property;\n if (!editableProperty(property)) {\n return undefined;\n } else if (property.dataType === \"map\" && property.properties) {\n return {\n [key]: {\n ...property,\n properties: removeNonEditableProperties(property.properties as PropertiesOrBuilders)\n }\n };\n } else {\n return { [key]: property };\n }\n })\n .filter((e) => Boolean(e))\n .reduce((a, b) => ({ ...a, ...b }), {}) as Properties;\n}\n","import {\n ErrorBoundary,\n PropertyConfigBadge,\n getFieldConfig,\n isPropertyBuilder,\n Property,\n PropertyOrBuilder,\n useCustomizationController,\n} from \"@firecms/core\";\nimport {\n cardClickableMixin,\n cardMixin,\n cardSelectedMixin,\n cn,\n FunctionsIcon,\n Paper,\n RemoveCircleIcon,\n Typography,\n} from \"@firecms/ui\";\n\nimport { editableProperty } from \"../../utils/entities\";\n\nexport function PropertyFieldPreview({\n property,\n onClick,\n hasError,\n includeName,\n includeEditButton,\n selected\n }: {\n property: Property,\n hasError?: boolean,\n selected?: boolean,\n includeName?: boolean,\n includeEditButton?: boolean;\n onClick?: () => void\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n\n const propertyConfig = getFieldConfig(property, propertyConfigs);\n const disabled = !editableProperty(property);\n\n const borderColorClass = hasError\n ? \"border-red-500 dark:border-red-500 border-opacity-100 dark:border-opacity-100 ring-0 dark:ring-0\"\n : (selected ? \"border-primary\" : \"border-transparent\");\n\n if(hasError)\n console.log(\"PropertyFieldPreview\", property)\n\n return <ErrorBoundary>\n <div\n onClick={onClick}\n className=\"flex flex-row w-full cursor-pointer\">\n <div className={\"m-4\"}>\n <PropertyConfigBadge propertyConfig={propertyConfig}/>\n </div>\n <Paper\n className={cn(\n \"border\",\n \"pl-2 w-full flex flex-row gap-4 items-center\",\n cardMixin,\n onClick ? cardClickableMixin : \"\",\n selected ? cardSelectedMixin : \"\",\n \"flex-grow p-4 border transition-colors duration-200\",\n borderColorClass\n )}\n >\n\n <div className=\"w-full flex flex-col\">\n\n {includeName &&\n <ErrorBoundary>\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"flex-grow pr-2\">\n {property.name\n ? property.name\n : \"\\u00a0\"\n }\n </Typography>\n </ErrorBoundary>}\n\n <div className=\"flex flex-row items-center\">\n <ErrorBoundary>\n <Typography className=\"flex-grow pr-2\"\n variant={includeName ? \"body2\" : \"subtitle1\"}\n component=\"span\"\n color=\"secondary\">\n {propertyConfig?.name}\n </Typography>\n </ErrorBoundary>\n <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n {property.dataType}\n </Typography>\n </ErrorBoundary>\n\n </div>\n </div>\n\n {includeEditButton && <Typography variant={\"button\"}>\n EDIT\n </Typography>}\n\n </Paper>\n </div>\n </ErrorBoundary>\n}\n\nexport function NonEditablePropertyPreview({\n name,\n selected,\n onClick,\n property\n }: {\n name: string,\n selected: boolean,\n onClick?: () => void,\n property?: PropertyOrBuilder\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n\n const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, propertyConfigs) : undefined;\n\n return (\n <div\n onClick={onClick}\n className=\"flex flex-row w-full cursor-pointer\">\n <div className={\"relative m-4\"}>\n {propertyConfig && <PropertyConfigBadge propertyConfig={propertyConfig}/>}\n {!propertyConfig && <div\n className={\"h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500\"}>\n <FunctionsIcon color={\"inherit\"} size={\"medium\"}/>\n </div>}\n <RemoveCircleIcon color={\"disabled\"} size={\"small\"} className={\"absolute -right-2 -top-2\"}/>\n </div>\n <Paper\n className={cn(\n \"pl-2 w-full flex flex-row gap-4 items-center\",\n cardMixin,\n onClick ? cardClickableMixin : \"\",\n selected ? cardSelectedMixin : \"\",\n \"flex-grow p-4 border transition-colors duration-200\",\n selected ? \"border-primary\" : \"border-transparent\")}\n >\n\n <div className=\"w-full flex flex-col\">\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"flex-grow pr-2\">\n {property?.name\n ? property.name\n : name\n }\n </Typography>\n\n <div className=\"flex flex-row items-center\">\n {propertyConfig && <Typography className=\"flex-grow pr-2\"\n variant={\"body2\"}\n component=\"span\"\n color=\"secondary\">\n {propertyConfig?.name}\n </Typography>}\n\n {property && !isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n {property.dataType}\n </Typography>\n </ErrorBoundary>}\n\n {property && isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n This property is defined as a property builder in code\n </Typography>\n </ErrorBoundary>}\n\n {!property && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n This field is defined as an additional field in code\n </Typography>\n </ErrorBoundary>}\n\n </div>\n\n {/*<div className=\"flex flex-row text-xs\">*/}\n {/* <Typography className=\"flex-grow pr-2\"*/}\n {/* variant=\"body2\"*/}\n {/* component=\"span\"*/}\n {/* color=\"secondary\">*/}\n {/* This field can only be edited in code*/}\n {/* </Typography>*/}\n {/*</div>*/}\n </div>\n\n </Paper>\n </div>)\n}\n","import React, { useCallback } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport {\n AdditionalFieldDelegate,\n CMSType,\n ErrorBoundary,\n isPropertyBuilder,\n PropertiesOrBuilders,\n PropertyOrBuilder\n} from \"@firecms/core\";\nimport { AutoAwesomeIcon, defaultBorderMixin, DragHandleIcon, IconButton, RemoveIcon, Tooltip } from \"@firecms/ui\";\nimport { NonEditablePropertyPreview, PropertyFieldPreview } from \"./PropertyFieldPreview\";\nimport { DragDropContext, Draggable, DraggableProvided, Droppable } from \"@hello-pangea/dnd\";\nimport { getFullId, getFullIdPath } from \"./util\";\nimport { editableProperty } from \"../../utils/entities\";\n\nexport const PropertyTree = React.memo(\n function PropertyTree<M extends {\n [Key: string]: CMSType\n }>({\n namespace,\n selectedPropertyKey,\n onPropertyClick,\n properties,\n propertiesOrder: propertiesOrderProp,\n additionalFields,\n errors,\n onPropertyMove,\n onPropertyRemove,\n className,\n inferredPropertyKeys,\n collectionEditable\n }: {\n namespace?: string;\n selectedPropertyKey?: string;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n properties: PropertiesOrBuilders<M>;\n propertiesOrder?: string[];\n additionalFields?: AdditionalFieldDelegate<M>[];\n errors: Record<string, any>;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n className?: string;\n inferredPropertyKeys?: string[];\n collectionEditable: boolean;\n }) {\n\n const propertiesOrder = propertiesOrderProp ?? Object.keys(properties);\n\n const onDragEnd = useCallback((result: any) => {\n // dropped outside the list\n if (!result.destination) {\n return;\n }\n const startIndex = result.source.index;\n const endIndex = result.destination.index;\n\n const newPropertiesOrder = Array.from(propertiesOrder);\n const [removed] = newPropertiesOrder.splice(startIndex, 1);\n newPropertiesOrder.splice(endIndex, 0, removed);\n if (onPropertyMove)\n onPropertyMove(newPropertiesOrder, namespace);\n }, [namespace, onPropertyMove, propertiesOrder])\n\n return (\n <>\n\n <DragDropContext onDragEnd={onDragEnd}>\n <Droppable droppableId={`droppable_${namespace}`}>\n {(droppableProvided, droppableSnapshot) => (\n <div\n {...droppableProvided.droppableProps}\n ref={droppableProvided.innerRef}\n className={className}>\n {propertiesOrder && propertiesOrder\n .map((propertyKey: string, index: number) => {\n const property = properties[propertyKey] as PropertyOrBuilder;\n const additionalField = additionalFields?.find(field => field.key === propertyKey);\n\n if (!property && !additionalField) {\n console.warn(`Property ${propertyKey} not found in properties or additionalFields`);\n return null;\n }\n return (\n <Draggable\n key={`array_field_${namespace}_${propertyKey}}`}\n draggableId={`array_field_${namespace}_${propertyKey}}`}\n index={index}>\n {(provided, snapshot) => {\n return (\n <ErrorBoundary>\n <PropertyTreeEntry\n propertyKey={propertyKey as string}\n propertyOrBuilder={property}\n additionalField={additionalField}\n provided={provided}\n errors={errors}\n namespace={namespace}\n inferredPropertyKeys={inferredPropertyKeys}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n onPropertyClick={snapshot.isDragging ? undefined : onPropertyClick}\n selectedPropertyKey={selectedPropertyKey}\n collectionEditable={collectionEditable}\n />\n </ErrorBoundary>\n );\n }}\n </Draggable>);\n }).filter(Boolean)}\n\n {droppableProvided.placeholder}\n\n </div>\n )}\n </Droppable>\n </DragDropContext>\n\n </>\n );\n },\n (prevProps, nextProps) => {\n\n const isSelected = nextProps.selectedPropertyKey?.startsWith(nextProps.namespace ?? \"\");\n const wasSelected = prevProps.selectedPropertyKey?.startsWith(prevProps.namespace ?? \"\");\n if (isSelected || wasSelected)\n return false;\n\n return equal(prevProps.properties, nextProps.properties) &&\n prevProps.propertiesOrder === nextProps.propertiesOrder &&\n equal(prevProps.additionalFields, nextProps.additionalFields) &&\n equal(prevProps.errors, nextProps.errors) &&\n equal(prevProps.onPropertyClick, nextProps.onPropertyClick) &&\n // equal(prevProps.onPropertyMove, nextProps.onPropertyMove) &&\n // equal(prevProps.onPropertyRemove, nextProps.onPropertyRemove) &&\n prevProps.namespace === nextProps.namespace &&\n prevProps.collectionEditable === nextProps.collectionEditable;\n }\n);\n\nexport function PropertyTreeEntry({\n propertyKey,\n namespace,\n propertyOrBuilder,\n additionalField,\n provided,\n selectedPropertyKey,\n errors,\n onPropertyClick,\n onPropertyMove,\n onPropertyRemove,\n inferredPropertyKeys,\n collectionEditable\n }: {\n propertyKey: string;\n namespace?: string;\n propertyOrBuilder: PropertyOrBuilder;\n additionalField?: AdditionalFieldDelegate<any>;\n selectedPropertyKey?: string;\n provided: DraggableProvided;\n errors: Record<string, any>;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n inferredPropertyKeys?: string[];\n collectionEditable: boolean;\n}) {\n\n const isPropertyInferred = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);\n const fullId = getFullId(propertyKey, namespace);\n const fullIdPath = getFullIdPath(propertyKey, namespace);\n const hasError = fullIdPath in errors;\n\n let subtree;\n if (typeof propertyOrBuilder === \"object\") {\n const property = propertyOrBuilder;\n if (property.dataType === \"map\" && property.properties) {\n subtree = <PropertyTree\n selectedPropertyKey={selectedPropertyKey}\n namespace={fullId}\n properties={property.properties}\n propertiesOrder={property.propertiesOrder}\n errors={errors}\n onPropertyClick={onPropertyClick}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n collectionEditable={collectionEditable}\n />\n }\n }\n\n // const hasError = fullId ? getIn(errors, idToPropertiesPath(fullId)) : false;\n const selected = selectedPropertyKey === fullId;\n const editable = propertyOrBuilder && ((collectionEditable && !isPropertyBuilder(propertyOrBuilder)) || editableProperty(propertyOrBuilder));\n\n return (\n <div\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n className=\"relative -ml-8\"\n >\n {subtree && <div\n className={\"absolute border-l \" + defaultBorderMixin}\n style={{\n left: \"32px\",\n top: \"64px\",\n bottom: \"16px\"\n }}/>}\n\n {!isPropertyBuilder(propertyOrBuilder) && !additionalField && editable\n ? <PropertyFieldPreview\n property={propertyOrBuilder}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n includeName={true}\n selected={selected}\n hasError={hasError}/>\n : <NonEditablePropertyPreview name={propertyKey}\n property={propertyOrBuilder}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n selected={selected}/>}\n\n <div className=\"absolute top-2 right-2 flex flex-row \">\n\n {isPropertyInferred && <Tooltip title={\"Inferred property\"}>\n <AutoAwesomeIcon size=\"small\" className={\"p-2\"}/>\n </Tooltip>}\n\n {onPropertyRemove && <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n color=\"inherit\"\n onClick={() => onPropertyRemove(propertyKey, namespace)}>\n <RemoveIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>}\n\n {onPropertyMove && <Tooltip title={\"Move\"}>\n <IconButton\n component={\"span\"}\n size=\"small\"\n >\n <DragHandleIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>}\n </div>\n\n {subtree && <div className={\"ml-16\"}>{subtree}</div>}\n </div>\n );\n\n}\n","import React, { useCallback, useState } from \"react\";\nimport { MapProperty, Property, PropertyConfig, } from \"@firecms/core\";\nimport { AddIcon, BooleanSwitchWithLabel, Button, Paper, Typography } from \"@firecms/ui\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { getIn, useFormex } from \"../../../form\";\nimport { PropertyTree } from \"../PropertyTree\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from \"../util\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function MapPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {\n disabled: boolean;\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormex<MapProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState<boolean>(false);\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const propertiesOrder = values.propertiesOrder ?? Object.keys(values.properties ?? {});\n const onPropertyCreated = useCallback(({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n setFieldValue(\"properties\", {\n ...(values.properties ?? {}),\n [id]: property\n }, false);\n setFieldValue(\"propertiesOrder\", [...propertiesOrder, id], false);\n setPropertyDialogOpen(false);\n }, [values.properties, propertiesOrder]);\n\n const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n const propertiesPath = idToPropertiesPath(fullId);\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)));\n\n setFieldValue(propertiesPath, undefined, false);\n setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);\n\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }, [setFieldValue, values]);\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n\n const addChildButton = <Button\n color=\"primary\"\n variant={\"outlined\"}\n onClick={() => setPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}\n >\n Add property to {values.name ?? \"this group\"}\n </Button>;\n\n const empty = !propertiesOrder || propertiesOrder.length < 1;\n\n const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {\n setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);\n }, []);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <div className=\"flex justify-between items-end my-4\">\n <Typography variant={\"subtitle2\"}>Properties in this group</Typography>\n {addChildButton}\n </div>\n <Paper className=\"p-2 pl-8\">\n <PropertyTree\n properties={values.properties ?? {}}\n propertiesOrder={propertiesOrder}\n errors={{}}\n collectionEditable={collectionEditable}\n onPropertyClick={(propertyKey, namespace) => {\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n setPropertyDialogOpen(true);\n }}\n onPropertyMove={onPropertyMove}/>\n\n {empty &&\n <Typography variant={\"label\"}\n className=\"h-full flex items-center justify-center p-4\">\n Add the first property to this group\n </Typography>}\n </Paper>\n </div>\n\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n size={\"small\"}\n label=\"Spread children as columns\"\n onValueChange={(v) => setFieldValue(\"spreadChildren\", v)}\n value={values.spreadChildren ?? false}\n />\n <FieldHelperView>\n Set this flag to true if you want to display the children of this group as individual columns.\n </FieldHelperView>\n </div>\n\n <PropertyFormDialog\n inArray={false}\n forceShowErrors={false}\n open={propertyDialogOpen}\n allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n onCancel={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n onOkClicked={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n getData={getData}\n onDelete={deleteProperty}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n existingProperty={Boolean(selectedPropertyKey)}\n autoUpdateId={!selectedPropertyKey}\n autoOpenTypeSelect={!selectedPropertyKey}\n onPropertyChanged={onPropertyCreated}\n existingPropertyKeys={selectedPropertyKey ? undefined : propertiesOrder}\n propertyConfigs={propertyConfigs}\n />\n\n </>);\n}\n","import React, { useCallback, useState } from \"react\";\nimport { ArrayProperty, getFieldConfig, Property, PropertyConfig } from \"@firecms/core\";\nimport { Button, Paper, Typography } from \"@firecms/ui\";\nimport { Field, getIn, useFormex } from \"../../../form\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { PropertyFieldPreview } from \"../PropertyFieldPreview\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\n\nexport function RepeatPropertyField({\n showErrors,\n existing,\n disabled,\n getData,\n allowDataInference,\n propertyConfigs,\n collectionEditable\n }: {\n showErrors: boolean,\n existing: boolean,\n disabled: boolean,\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormex<ArrayProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState(false);\n const ofProperty = getIn(values, \"of\");\n const ofPropertyError = getIn(touched, \"of\") && getIn(errors, \"of\");\n\n const onPropertyChanged = ({ id, property, namespace }:\n { id?: string, property: Property, namespace?: string }) => {\n console.log(\"onPropertyChanged\", id, property, namespace);\n setFieldValue(\"of\", property);\n };\n\n const widget = ofProperty && getFieldConfig(ofProperty, propertyConfigs);\n return (\n <>\n <div className={\"col-span-12\"}>\n <Typography variant={\"subtitle2\"}>\n Repeat component\n </Typography>\n <Field\n name={\"of\"}\n value={ofProperty}\n // validate={(property: Property) => {\n // return property?.dataType ? undefined : \"You need to specify a repeat field\";\n // }}\n >\n {({}) => (\n <Paper className=\"p-2 mt-4\">\n\n {ofProperty && <PropertyFieldPreview\n property={ofProperty}\n onClick={disabled ? undefined : () => setPropertyDialogOpen(true)}\n includeName={false}\n includeEditButton={true}\n selected={false}\n hasError={false}/>}\n\n {!disabled && !ofProperty && <Button variant={\"text\"}\n size={\"large\"}\n color={ofPropertyError ? \"error\" : \"primary\"}\n onClick={() => setPropertyDialogOpen(true)}>\n Edit {`${widget ? widget.name : \"repeat component\"}`}\n </Button>}\n\n <PropertyFormDialog\n inArray={true}\n open={propertyDialogOpen}\n existingProperty={existing}\n getData={getData}\n autoUpdateId={!existing}\n autoOpenTypeSelect={!existing}\n onOkClicked={() => setPropertyDialogOpen(false)}\n allowDataInference={allowDataInference}\n property={ofProperty}\n includeIdAndName={false}\n onPropertyChanged={onPropertyChanged}\n forceShowErrors={showErrors}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n />\n </Paper>\n )}\n </Field>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <ArrayPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import { Field, getIn, useFormex } from \"../../../form\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { PropertyWithId } from \"../PropertyEditView\";\nimport React from \"react\";\nimport { FieldHelperView } from \"./FieldHelperView\";\nimport { toSnakeCase, unslugify } from \"@firecms/core\";\n\ntype CommonPropertyFieldsProps = {\n showErrors: boolean,\n disabledId: boolean,\n disabled: boolean;\n isNewProperty: boolean;\n autoUpdateId: boolean;\n};\n\nexport const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPropertyFieldsProps>(\n function CommonPropertyFields({\n showErrors,\n disabledId,\n disabled,\n autoUpdateId,\n isNewProperty\n }, ref) {\n\n const {\n errors,\n values,\n setFieldValue,\n setFieldTouched,\n touched,\n validate\n } = useFormex<PropertyWithId>();\n\n const name = \"name\";\n const nameError = showErrors && getIn(errors, name);\n\n const id = \"id\";\n const idError = showErrors && getIn(errors, id);\n\n const description = \"description\";\n const descriptionError = showErrors && getIn(errors, description);\n\n return (\n <div className={\"flex flex-col gap-2 col-span-12\"}>\n\n <div>\n <Field\n name={name}\n inputRef={ref}\n as={DebouncedTextField}\n value={values[name]}\n onChange={(e: any) => {\n const newNameValue = e.target.value;\n const idTouched = getIn(touched, id);\n if (!idTouched && autoUpdateId) {\n setFieldValue(id, newNameValue ? toSnakeCase(newNameValue) : \"\", false)\n }\n setFieldValue(name, newNameValue, true);\n setFieldTouched(name, true);\n }}\n style={{ fontSize: 20 }}\n placeholder={\"Field name\"}\n required\n disabled={disabled}\n error={Boolean(nameError)}/>\n\n <FieldHelperView error={Boolean(nameError)}>\n {nameError}\n </FieldHelperView>\n </div>\n\n <div>\n <Field\n name={id}\n as={DebouncedTextField}\n label={\"ID\"}\n value={values[id]}\n onChange={(e: any) => {\n const newIdValue = e.target.value;\n const nameTouched = getIn(touched, name);\n if (!nameTouched && autoUpdateId) {\n setFieldValue(name, newIdValue ? unslugify(newIdValue) : \"\")\n }\n setFieldValue(id, newIdValue, true);\n setFieldTouched(id, true);\n }}\n disabled={disabledId || disabled}\n required\n size=\"small\"\n error={Boolean(idError)}/>\n <FieldHelperView error={Boolean(idError)}>\n {idError}\n </FieldHelperView>\n </div>\n\n <div>\n <Field name={description}\n as={DebouncedTextField}\n label={\"Description\"}\n disabled={disabled}\n error={Boolean(descriptionError)}/>\n <FieldHelperView error={Boolean(descriptionError)}>\n {descriptionError}\n </FieldHelperView>\n </div>\n\n </div>\n );\n\n }\n);\n","import React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormex } from \"../../../form\";\n\nimport { TextField } from \"@firecms/ui\";\n\nexport function StringPropertyField({\n widgetId,\n disabled,\n showErrors\n }: {\n widgetId: \"text_field\" | \"multiline\" | \"markdown\" | \"email\";\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue } = useFormex();\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 === \"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 {widgetId === \"markdown\" &&\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\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import React from \"react\";\nimport { Field, FormexFieldProps, getIn, useFormex } from \"../../../form\";\n\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { SwitchControl } from \"../SwitchControl\";\n\nexport function BooleanPropertyField({ disabled }: {\n disabled: boolean;\n}) {\n const { values } = useFormex();\n const defaultValue = getIn(values, \"defaultValue\");\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <Field\n name={\"defaultValue\"}>\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={defaultValue === null || defaultValue === undefined ? \"Default value not set\" : (\"Default value is \" + defaultValue.toString())}\n disabled={disabled}\n allowIndeterminate={true} field={field}\n form={form}/>\n }}\n </Field>\n\n </div>\n </>\n );\n}\n","import React, { useCallback, useState } from \"react\";\nimport { AddIcon, Button, Paper, Typography } from \"@firecms/ui\";\nimport { getIn, useFormex } from \"../../../form\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"../util\";\nimport { PropertyTree } from \"../PropertyTree\";\nimport { ArrayProperty, Property, PropertyConfig } from \"@firecms/core\";\n\nexport function BlockPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {\n disabled: boolean;\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormex<ArrayProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState<boolean>(false);\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const onPropertyCreated = useCallback(({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n setFieldValue(\"oneOf.properties\", {\n ...(values.oneOf?.properties ?? {}),\n [id]: property\n }, false);\n setFieldValue(\"oneOf.propertiesOrder\", [...(values.oneOf?.propertiesOrder ?? Object.keys(values.oneOf?.properties ?? {})), id], false);\n setPropertyDialogOpen(false);\n }, [values.oneOf?.properties, values.oneOf?.propertiesOrder]);\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.oneOf?.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n\n const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n setFieldValue(`oneOf.${idToPropertiesPath(fullId)}`, undefined, false);\n const propertiesOrderPath = `oneOf.${namespaceToPropertiesOrderPath(namespace)}`;\n const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath);\n setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);\n\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }, [setFieldValue, values]);\n\n const addChildButton = <Button\n autoFocus\n color=\"primary\"\n\n onClick={() => setPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}\n >\n Add property to {values.name ?? \"this block\"}\n </Button>;\n\n const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {\n setFieldValue(`oneOf.${namespaceToPropertiesOrderPath(namespace)}`, propertiesOrder, false);\n }, []);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <div className={\"flex justify-between items-end mt-8 mb-4\"}>\n <Typography variant={\"subtitle2\"}>Properties in this\n block</Typography>\n {addChildButton}\n </div>\n <Paper className=\"p-2 pl-8\">\n\n <PropertyTree\n properties={values.oneOf?.properties ?? {}}\n propertiesOrder={values.oneOf?.propertiesOrder}\n errors={{}}\n collectionEditable={collectionEditable}\n onPropertyClick={disabled\n ? undefined\n : (propertyKey, namespace) => {\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n setPropertyDialogOpen(true);\n }}\n onPropertyMove={disabled\n ? undefined\n : onPropertyMove}/>\n\n {!disabled && !values.oneOf?.propertiesOrder?.length &&\n <div className=\"h-full flex items-center justify-center p-4\">\n Add the first property to this block\n </div>}\n\n </Paper>\n </div>\n\n {!disabled && <PropertyFormDialog\n inArray={false}\n forceShowErrors={false}\n open={propertyDialogOpen}\n getData={getData}\n allowDataInference={allowDataInference}\n onCancel={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n onOkClicked={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n collectionEditable={collectionEditable}\n onDelete={deleteProperty}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n existingProperty={Boolean(selectedPropertyKey)}\n autoUpdateId={!selectedPropertyKey}\n autoOpenTypeSelect={!selectedPropertyKey}\n onPropertyChanged={onPropertyCreated}\n existingPropertyKeys={selectedPropertyKey ? undefined : values.oneOf?.propertiesOrder}\n propertyConfigs={propertyConfigs}/>}\n\n </>);\n}\n","import React from \"react\";\n\nimport { Field, FormexFieldProps, getIn, useFormex } from \"../../../../form\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\nimport { SwitchControl } from \"../../SwitchControl\";\n\nexport function NumberPropertyValidation({ disabled }: {\n disabled: boolean;\n}) {\n\n const {\n values,\n handleChange\n } = useFormex();\n\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n const validationLessThan = \"validation.lessThan\";\n const validationMoreThan = \"validation.moreThan\";\n const validationPositive = \"validation.positive\";\n const validationNegative = \"validation.negative\";\n const validationInteger = \"validation.integer\";\n\n return (\n\n <div className={\"grid grid-cols-12 gap-2\"}>\n <GeneralPropertyValidation disabled={disabled}/>\n\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n label={\"Min value\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n label={\"Max value\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField\n value={getIn(values, validationLessThan)}\n label={\"Less than\"}\n name={validationLessThan}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField\n value={getIn(values, validationMoreThan)}\n label={\"More than\"}\n name={validationMoreThan}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-4\"}>\n <Field name={validationPositive}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={\"Positive value\"}\n disabled={disabled}\n form={form}\n field={field}/>\n }}\n </Field>\n </div>\n <div className={\"col-span-4\"}>\n <Field name={validationNegative}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={\"Negative value\"}\n disabled={disabled}\n form={form}\n field={field}/>\n }}\n </Field>\n </div>\n <div className={\"col-span-4\"}>\n <Field name={validationInteger}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={\"Integer value\"}\n disabled={disabled}\n form={form}\n field={field}/>\n }}\n </Field>\n </div>\n </div>\n );\n}\n","import React from \"react\";\nimport { NumberPropertyValidation } from \"./validation/NumberPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { TextField } from \"@firecms/ui\";\nimport { getIn, useFormex } from \"../../../form\";\n\nexport function NumberPropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n const { values, setFieldValue } = useFormex();\n\n return (\n <>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <NumberPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n type={\"number\"}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : parseFloat(e.target.value));\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import React from \"react\";\nimport { Field, getIn, useFormex } from \"../../../form\";\nimport { IconForView, NumberProperty, StringProperty, useNavigationController } from \"@firecms/core\";\nimport { CircularProgress, Select, SelectGroup, SelectItem, Typography, } from \"@firecms/ui\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function ReferencePropertyField({\n existing,\n multiple,\n disabled,\n showErrors\n }: {\n existing: boolean,\n multiple: boolean,\n disabled: boolean,\n showErrors: boolean\n}) {\n\n const {\n values,\n handleChange,\n errors,\n } = useFormex<StringProperty | NumberProperty>();\n\n const navigation = useNavigationController();\n\n if (!navigation)\n return <div className={\"col-span-12\"}>\n <CircularProgress/>\n </div>;\n\n const pathPath = multiple ? \"of.path\" : \"path\";\n const pathValue: string | undefined = getIn(values, pathPath);\n const pathError: string | undefined = showErrors && getIn(errors, pathPath);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <Field name={pathPath}\n pathPath={pathPath}\n type=\"select\"\n disabled={existing || disabled}\n value={pathValue}\n error={pathError}\n handleChange={handleChange}\n as={CollectionsSelect}/>\n\n </div>\n\n </>\n );\n}\n\n\nexport function CollectionsSelect({\n disabled,\n pathPath,\n value,\n handleChange,\n error,\n ...props\n }: {\n disabled: boolean,\n pathPath: string,\n value?: string,\n handleChange: (event: any) => void,\n error?: string\n}) {\n\n const navigation = useNavigationController();\n\n if (!navigation)\n return <div className={\"col-span-12\"}>\n <CircularProgress/>\n </div>;\n\n const collections = navigation?.collections ?? [];\n\n const groups: string[] = Array.from(new Set(\n Object.values(collections).map(e => e.group).filter(Boolean) as string[]\n ).values());\n\n const ungroupedCollections = collections.filter((col) => !col.group);\n\n return (\n <>\n <Select\n error={Boolean(error)}\n disabled={disabled}\n value={value ?? \"\"}\n position={\"item-aligned\"}\n name={pathPath}\n onChange={handleChange}\n label={\"Target collection\"}\n renderValue={(selected) => {\n const selectedCollection = collections.find(collection => collection.id === selected || collection.path === selected);\n if (!selectedCollection) return null;\n return (\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={selectedCollection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {selectedCollection?.name.toUpperCase()}\n </Typography>\n </div>)\n }}\n {...props}>\n\n {groups.flatMap((group) => (\n <SelectGroup label={group || \"Views\"}\n key={`group_${group}`}>\n {\n collections.filter(collection => collection.group === group)\n .map((collection) => {\n return <SelectItem\n key={`${collection.id ?? collection.path}-${group}`}\n value={collection.id ?? collection.path}>\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={collection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {collection?.name.toUpperCase()}\n </Typography>\n </div>\n </SelectItem>;\n })\n\n }\n </SelectGroup>\n ))}\n\n {ungroupedCollections && <SelectGroup label={\"Views\"}>\n {ungroupedCollections\n .map((collection) => {\n return <SelectItem key={collection.id ?? collection.path}\n value={collection.id ?? collection.path}>\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={collection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {collection?.name.toUpperCase()}\n </Typography>\n </div>\n </SelectItem>;\n })\n\n }\n </SelectGroup>}\n\n </Select>\n\n <FieldHelperView>\n You can only edit the reference collection upon field\n creation.\n </FieldHelperView>\n </>\n );\n}\n","import React from \"react\";\nimport { getIn, useFormex } from \"../../../form\";\nimport { NumberProperty, StringProperty } from \"@firecms/core\";\nimport { Select, SelectItem } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function DateTimePropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n const {\n values,\n errors,\n touched,\n setFieldValue\n } = useFormex<StringProperty | NumberProperty>();\n\n const modePath = \"mode\";\n const modeValue: string | undefined = getIn(values, modePath);\n const modeError: string | undefined = getIn(touched, modePath) && getIn(errors, modePath);\n\n const autoValuePath = \"autoValue\";\n const autoValueValue: string | undefined = getIn(values, autoValuePath);\n const autoValueError: string | undefined = getIn(touched, autoValuePath) && getIn(errors, autoValuePath);\n\n return (\n <>\n <div className={\"flex flex-col col-span-12\"}>\n <Select name={modePath}\n value={modeValue ?? \"date\"}\n error={Boolean(modeError)}\n onValueChange={(v) => setFieldValue(modePath, v)}\n label={\"Mode\"}\n renderValue={(v) => {\n switch (v) {\n case \"date_time\":\n return \"Date/Time\";\n case \"date\":\n return \"Date\";\n default:\n return \"\";\n }\n }}\n disabled={disabled}>\n <SelectItem value={\"date_time\"}> Date/Time </SelectItem>\n <SelectItem value={\"date\"}> Date </SelectItem>\n </Select>\n <FieldHelperView error={Boolean(modeError)}>\n {modeError}\n </FieldHelperView>\n\n <Select name={autoValuePath}\n disabled={disabled}\n value={autoValueValue ?? \"\"}\n onValueChange={(v) => setFieldValue(autoValuePath, v)}\n renderValue={(v) => {\n switch (v) {\n case \"on_create\":\n return \"On create\";\n case \"on_update\":\n return \"On any update\";\n default:\n return \"None\";\n }\n }}\n error={Boolean(autoValueError)}\n label={\"Automatic value\"}>\n <SelectItem value={\"\"}> None </SelectItem>\n <SelectItem value={\"on_create\"}> On create </SelectItem>\n <SelectItem value={\"on_update\"}> On any update </SelectItem>\n </Select>\n <FieldHelperView error={Boolean(autoValueError)}>\n {autoValueError ?? \"Update this field automatically when creating or updating the entity\"}\n </FieldHelperView>\n\n </div>\n\n <div className={\"col-span-12\"}>\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n </div>\n </>\n );\n}\n","import React from \"react\";\n\nimport { Field, FormexFieldProps } from \"../../../../form\";\nimport { SwitchControl } from \"../../SwitchControl\";\n\nexport function AdvancedPropertyValidation({ disabled }: {\n disabled: boolean\n}) {\n\n const columnWidth = \"columnWidth\";\n const hideFromCollection = \"hideFromCollection\";\n const readOnly = \"readOnly\";\n\n return (\n\n <div className={\"grid grid-cols-12 gap-2\"}>\n <div className={\"col-span-12\"}>\n <Field type=\"checkbox\" name={hideFromCollection}>\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={\"Hide from collection\"}\n disabled={disabled}\n form={form}\n tooltip={\"Hide this field from the collection view. It will still be visible in the form view\"}\n field={field}/>\n }}\n </Field>\n </div>\n\n <div className={\"col-span-12\"}>\n <Field name={readOnly}\n type=\"checkbox\">\n {({ field, form }: FormexFieldProps) => {\n return <SwitchControl\n label={\"Read only\"}\n disabled={disabled}\n tooltip={\"Is this a read only field. Display only as a preview\"}\n form={form}\n field={field}/>\n }}\n </Field>\n </div>\n </div>\n );\n}\n","import React from \"react\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\n\nexport function KeyValuePropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import {\n ArrayProperty,\n BooleanProperty,\n DateProperty,\n MapProperty,\n mergeDeep,\n NumberProperty,\n Property,\n PropertyConfig,\n StringProperty\n} from \"@firecms/core\";\n\nexport function updatePropertyFromWidget(propertyData: any,\n selectedWidgetId: string | undefined,\n propertyConfigs: Record<string, PropertyConfig>): Property {\n\n let updatedProperty;\n if (selectedWidgetId === \"text_field\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"text_field\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multiline\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"multiline\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n multiline: true,\n storage: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"markdown\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"markdown\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: true,\n email: undefined,\n url: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"url\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"url\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: true,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"email\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"email\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: true,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: propertyData.enumValues ?? []\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multi_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"string\",\n enumValues: propertyData.of?.enumValues ?? []\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"number_input\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"number\",\n propertyConfig: \"number_input\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n enumValues: undefined\n } satisfies NumberProperty\n );\n } else if (selectedWidgetId === \"number_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"number\",\n propertyConfig: \"number_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n enumValues: propertyData.enumValues ?? []\n } satisfies NumberProperty\n );\n } else if (selectedWidgetId === \"multi_number_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_number_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"number\",\n enumValues: propertyData.of?.enumValues ?? []\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"file_upload\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"file_upload\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: {\n storagePath: \"/\"\n }\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multi_file_upload\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_file_upload\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"string\",\n storage: propertyData.of?.storage ?? {\n storagePath: \"/\"\n }\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"group\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"map\",\n propertyConfig: \"group\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n keyValue: false,\n properties: propertyData.properties ?? {}\n } satisfies MapProperty\n );\n } else if (selectedWidgetId === \"key_value\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"map\",\n propertyConfig: \"key_value\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n keyValue: true,\n properties: undefined\n } satisfies MapProperty\n );\n } else if (selectedWidgetId === \"reference\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"reference\",\n propertyConfig: \"reference\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies Property\n );\n } else if (selectedWidgetId === \"multi_references\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_references\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"reference\"\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"switch\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"boolean\",\n propertyConfig: \"switch\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies BooleanProperty\n );\n } else if (selectedWidgetId === \"date_time\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"date\",\n propertyConfig: \"date_time\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n mode: \"date_time\"\n } satisfies DateProperty\n );\n } else if (selectedWidgetId === \"repeat\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"repeat\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"block\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"block\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n oneOf: {\n properties: {}\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId && propertyConfigs[selectedWidgetId]) {\n updatedProperty = {\n ...propertyConfigs[selectedWidgetId].property,\n propertyConfig: selectedWidgetId\n };\n }\n\n return updatedProperty;\n}\n","import { PropertyConfigBadge, PropertyConfig } from \"@firecms/core\";\nimport { cn, SelectItem, Typography } from \"@firecms/ui\";\n\nexport interface PropertySelectItemProps {\n value: string;\n optionDisabled: boolean;\n propertyConfig: PropertyConfig;\n existing: boolean;\n}\n\nexport function PropertySelectItem({ value, optionDisabled, propertyConfig, existing }: PropertySelectItemProps) {\n return <SelectItem value={value}\n disabled={optionDisabled}\n className={\"flex flex-row items-center\"}>\n <div\n className={cn(\n \"flex flex-row items-center text-base min-h-[52px]\",\n optionDisabled ? \"w-full\" : \"\")}>\n <div className={\"mr-8\"}>\n <PropertyConfigBadge propertyConfig={propertyConfig}/>\n </div>\n <div>\n <div>{propertyConfig.name}</div>\n <Typography variant={\"caption\"}\n color={\"disabled\"}\n className={\"max-w-sm\"}>\n {existing && optionDisabled ? \"You can only switch to widgets that use the same data type\" : propertyConfig.description}\n </Typography>\n </div>\n </div>\n </SelectItem>\n}\n","import React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormex } from \"../../../form\";\n\nimport { Select, SelectItem, TextField } from \"@firecms/ui\";\n\nexport function UrlPropertyField({\n disabled,\n showErrors\n }: {\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue } = useFormex();\n\n const urlValue = getIn(values, \"url\");\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <Select\n disabled={disabled}\n position={\"item-aligned\"}\n onValueChange={(value: string) => {\n if (value === \"[NONE]\")\n setFieldValue(\"url\", true);\n else\n setFieldValue(\"url\", value);\n }}\n label={\"Preview type\"}\n renderValue={(value: string) => {\n switch (value) {\n case \"image\":\n return \"Image\";\n case \"video\":\n return \"Video\";\n case \"audio\":\n return \"Audio\";\n default:\n return \"Display URL\";\n }\n }}\n value={urlValue ?? \"[NONE]\"}>\n <SelectItem value={\"[NONE]\"}>\n Display URL\n </SelectItem>\n <SelectItem value={\"image\"}>\n Image\n </SelectItem>\n <SelectItem value={\"video\"}>\n Video\n </SelectItem>\n <SelectItem value={\"audio\"}>\n Audio\n </SelectItem>\n </Select>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n\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\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import { DEFAULT_FIELD_CONFIGS, FieldConfigId, PropertyConfig } from \"@firecms/core\";\n\nexport const supportedFieldsIds: FieldConfigId[] = [\n \"text_field\",\n \"multiline\",\n \"markdown\",\n \"url\",\n \"email\",\n \"select\",\n \"multi_select\",\n \"number_input\",\n \"number_select\",\n \"multi_number_select\",\n \"file_upload\",\n \"multi_file_upload\",\n \"reference\",\n \"multi_references\",\n \"switch\",\n \"date_time\",\n \"group\",\n \"key_value\",\n \"repeat\",\n \"block\"\n];\n\nexport const supportedFields: Record<string, PropertyConfig> = Object.entries(DEFAULT_FIELD_CONFIGS)\n .filter(([id]) => supportedFieldsIds.includes(id as FieldConfigId))\n .map(([id, config]) => ({ [id]: config }))\n .reduce((a, b) => ({ ...a, ...b }), {});\n","import React, { useDeferredValue, useEffect, useRef, useState } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport { Formex, FormexController, getIn, useCreateFormex } from \"../../form\";\nimport {\n DEFAULT_FIELD_CONFIGS,\n DeleteConfirmationDialog,\n FieldConfigId,\n getFieldConfig,\n getFieldId,\n isPropertyBuilder,\n isValidRegExp,\n mergeDeep,\n Property,\n PropertyConfig,\n PropertyConfigBadge,\n} from \"@firecms/core\";\nimport {\n Button,\n cn,\n DeleteIcon,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n InfoLabel,\n Select,\n Typography\n} from \"@firecms/ui\";\nimport { EnumPropertyField } from \"./properties/EnumPropertyField\";\nimport { StoragePropertyField } from \"./properties/StoragePropertyField\";\nimport { MapPropertyField } from \"./properties/MapPropertyField\";\nimport { RepeatPropertyField } from \"./properties/RepeatPropertyField\";\nimport { CommonPropertyFields } from \"./properties/CommonPropertyFields\";\nimport { StringPropertyField } from \"./properties/StringPropertyField\";\nimport { BooleanPropertyField } from \"./properties/BooleanPropertyField\";\nimport { BlockPropertyField } from \"./properties/BlockPropertyField\";\nimport { NumberPropertyField } from \"./properties/NumberPropertyField\";\nimport { ReferencePropertyField } from \"./properties/ReferencePropertyField\";\nimport { DateTimePropertyField } from \"./properties/DateTimePropertyField\";\nimport { AdvancedPropertyValidation } from \"./properties/advanced/AdvancedPropertyValidation\";\nimport { editableProperty } from \"../../utils/entities\";\nimport { KeyValuePropertyField } from \"./properties/KeyValuePropertyField\";\nimport { updatePropertyFromWidget } from \"./utils/update_property_for_widget\";\nimport { PropertySelectItem } from \"./PropertySelectItem\";\nimport { UrlPropertyField } from \"./properties/UrlPropertyField\";\nimport { supportedFields } from \"./utils/supported_fields\";\n\nexport type PropertyWithId = Property & {\n id?: string\n};\n\nexport type OnPropertyChangedParams = {\n id?: string,\n property: Property,\n namespace?: string,\n previousId?: string\n};\n\nexport type PropertyFormProps = {\n includeIdAndName?: boolean;\n existingProperty: boolean;\n autoUpdateId?: boolean;\n autoOpenTypeSelect: boolean;\n inArray: boolean;\n propertyKey?: string;\n propertyNamespace?: string;\n property?: Property;\n onPropertyChanged?: (params: OnPropertyChangedParams) => void;\n onPropertyChangedImmediate?: boolean;\n onDelete?: (id?: string, namespace?: string) => void;\n onError?: (id: string, namespace?: string, error?: Record<string, any>) => void;\n initialErrors?: Record<string, any>;\n existingPropertyKeys?: string[];\n forceShowErrors?: boolean;\n allowDataInference: boolean;\n getData?: () => Promise<object[]>;\n getController?: (formex: FormexController<PropertyWithId>) => void;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n};\n\nexport const PropertyForm = React.memo(\n function PropertyForm(props: PropertyFormProps) {\n\n const {\n includeIdAndName = true,\n autoOpenTypeSelect,\n existingProperty,\n autoUpdateId,\n inArray,\n propertyKey,\n existingPropertyKeys,\n propertyNamespace,\n property,\n onPropertyChanged,\n onPropertyChangedImmediate = true,\n onDelete,\n onError,\n initialErrors,\n forceShowErrors,\n allowDataInference,\n getController,\n getData,\n propertyConfigs,\n collectionEditable\n } = props;\n\n const initialValue: PropertyWithId = {\n id: \"\",\n name: \"\"\n } as PropertyWithId;\n\n const disabled = (Boolean(property && !editableProperty(property)) && !collectionEditable);\n\n const lastSubmittedProperty = useRef<OnPropertyChangedParams | undefined>(property ? {\n id: propertyKey,\n previousId: propertyKey,\n property\n } : undefined);\n\n const doOnPropertyChanged = ({\n id,\n property\n }: OnPropertyChangedParams) => {\n const params = {\n id,\n previousId: lastSubmittedProperty.current?.id,\n property,\n namespace: propertyNamespace\n };\n lastSubmittedProperty.current = params;\n onPropertyChanged?.(params);\n };\n\n const formexController = useCreateFormex<PropertyWithId>({\n initialValues: property\n ? { id: propertyKey, ...property } as PropertyWithId\n : initialValue,\n initialErrors,\n validateOnChange: true,\n validateOnInitialRender: true,\n onSubmit: (newPropertyWithId, controller) => {\n console.debug(\"onSubmit\", newPropertyWithId);\n const {\n id,\n ...property\n } = newPropertyWithId;\n doOnPropertyChanged({\n id,\n property: { ...property, editable: property.editable ?? true }\n });\n if (!existingProperty)\n controller.resetForm({ values: initialValue });\n },\n validation: (values) => {\n const errors: Record<string, any> = {};\n if (includeIdAndName) {\n if (!values.name) {\n errors.name = \"Required\";\n } else {\n const nameError = validateName(values.name);\n if (nameError)\n errors.name = nameError;\n }\n if (!values.id) {\n errors.id = \"Required\";\n } else {\n const idError = validateId(values.id, existingPropertyKeys);\n if (idError)\n errors.id = idError;\n }\n }\n\n if (values.dataType === \"string\") {\n if (values.validation?.matches && !isValidRegExp(values.validation?.matches.toString())) {\n errors.validation = {\n matches: \"Invalid regular expression\"\n }\n }\n }\n if (values.dataType === \"reference\" && !values.path) {\n errors.path = \"You must specify a target collection for the field\";\n }\n if (values.propertyConfig === \"repeat\") {\n if (!(values as any).of) {\n errors.of = \"You need to specify a repeat field\";\n }\n }\n if (values.propertyConfig === \"block\") {\n if (!(values as any).oneOf) {\n errors.oneOf = \"You need to specify the properties of this block\";\n }\n }\n return errors;\n }\n });\n\n useEffect(() => {\n getController?.(formexController);\n }, [formexController, getController]);\n\n return <Formex value={formexController}>\n <PropertyEditFormFields\n onPropertyChanged={onPropertyChangedImmediate\n ? doOnPropertyChanged\n : undefined}\n onDelete={onDelete}\n includeIdAndTitle={includeIdAndName}\n propertyNamespace={propertyNamespace}\n onError={onError}\n showErrors={forceShowErrors || formexController.submitCount > 0}\n existing={existingProperty}\n autoUpdateId={autoUpdateId}\n inArray={inArray}\n autoOpenTypeSelect={autoOpenTypeSelect}\n disabled={disabled}\n getData={getData}\n allowDataInference={allowDataInference}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n {...formexController}/>\n </Formex>;\n }, (a, b) =>\n a.getData === b.getData &&\n a.propertyKey === b.propertyKey &&\n a.propertyNamespace === b.propertyNamespace &&\n a.includeIdAndName === b.includeIdAndName &&\n a.autoOpenTypeSelect === b.autoOpenTypeSelect &&\n a.autoUpdateId === b.autoUpdateId &&\n a.existingProperty === b.existingProperty\n);\n\nexport function PropertyFormDialog({\n open,\n onCancel,\n onOkClicked,\n onPropertyChanged,\n getData,\n collectionEditable,\n ...formProps\n }: PropertyFormProps & {\n open?: boolean;\n onOkClicked?: () => void;\n onCancel?: () => void;\n}) {\n const formexRef = useRef<FormexController<PropertyWithId>>();\n const getController = (helpers: FormexController<PropertyWithId>) => {\n formexRef.current = helpers;\n };\n\n return <Dialog\n open={open ?? false}\n maxWidth={\"xl\"}\n fullWidth={true}\n >\n <form noValidate={true}\n onSubmit={(e) => {\n e.preventDefault();\n e.stopPropagation();\n formexRef.current?.submitForm(e)\n }}>\n <DialogContent>\n <PropertyForm {...formProps}\n onPropertyChanged={(params) => {\n onPropertyChanged?.(params);\n onOkClicked?.();\n }}\n collectionEditable={collectionEditable}\n onPropertyChangedImmediate={false}\n getController={getController}\n getData={getData}\n />\n </DialogContent>\n\n <DialogActions>\n\n {onCancel && <Button\n variant={\"text\"}\n onClick={() => {\n onCancel();\n formexRef.current?.resetForm();\n }}>\n Cancel\n </Button>}\n\n <Button variant=\"outlined\"\n type={\"submit\"}\n color=\"primary\">\n Ok\n </Button>\n </DialogActions>\n </form>\n </Dialog>;\n\n}\n\nfunction PropertyEditFormFields({\n values,\n errors,\n setValues,\n existing,\n autoUpdateId = false,\n autoOpenTypeSelect,\n includeIdAndTitle,\n onPropertyChanged,\n onDelete,\n propertyNamespace,\n onError,\n showErrors,\n disabled,\n inArray,\n getData,\n allowDataInference,\n propertyConfigs,\n collectionEditable\n }: {\n includeIdAndTitle?: boolean;\n existing: boolean;\n autoUpdateId?: boolean;\n autoOpenTypeSelect: boolean;\n propertyNamespace?: string;\n onPropertyChanged?: (params: OnPropertyChangedParams) => void;\n onDelete?: (id?: string, namespace?: string) => void;\n onError?: (id: string, namespace?: string, error?: Record<string, any>) => void;\n showErrors: boolean;\n inArray: boolean;\n disabled: boolean;\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n} & FormexController<PropertyWithId>) {\n\n const [selectOpen, setSelectOpen] = useState(autoOpenTypeSelect);\n const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);\n const [selectedFieldConfigId, setSelectedFieldConfigId] = useState<string | undefined>(values?.dataType ? getFieldId(values) : undefined);\n\n const allSupportedFields = Object.entries(supportedFields).concat(Object.entries(propertyConfigs));\n\n const displayedWidgets = inArray\n ? allSupportedFields.filter(([_, propertyConfig]) => !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.dataType !== \"array\")\n : allSupportedFields;\n\n const deferredValues = useDeferredValue(values);\n const nameFieldRef = useRef<HTMLInputElement>(null);\n\n const lastSubmittedProperty = useRef<object>(values);\n\n const selectedWidgetError = showErrors && getIn(errors, \"selectedWidget\");\n\n useEffect(() => {\n if (onPropertyChanged) {\n if ((!includeIdAndTitle || deferredValues.id)) {\n const {\n id,\n ...property\n } = deferredValues;\n if (!equal(deferredValues, lastSubmittedProperty.current)) {\n onPropertyChanged({\n id,\n property,\n namespace: propertyNamespace\n });\n lastSubmittedProperty.current = deferredValues;\n }\n }\n }\n }, [deferredValues, includeIdAndTitle, onPropertyChanged, propertyNamespace]);\n\n useEffect(() => {\n if (values?.id && onError) {\n onError(values?.id, propertyNamespace, errors);\n }\n }, [errors, onError, propertyNamespace, values?.id]);\n\n const onWidgetSelectChanged = (newSelectedWidgetId: FieldConfigId) => {\n setSelectedFieldConfigId(newSelectedWidgetId);\n setValues(updatePropertyFromWidget(values, newSelectedWidgetId, propertyConfigs));\n // Ugly hack to autofocus the name field\n setTimeout(() => {\n nameFieldRef.current?.focus();\n }, 0);\n };\n\n let childComponent;\n if (selectedFieldConfigId === \"text_field\" ||\n selectedFieldConfigId === \"multiline\" ||\n selectedFieldConfigId === \"markdown\" ||\n selectedFieldConfigId === \"email\") {\n childComponent =\n <StringPropertyField widgetId={selectedFieldConfigId}\n disabled={disabled}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"url\") {\n childComponent =\n <UrlPropertyField disabled={disabled}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"select\" ||\n selectedFieldConfigId === \"number_select\") {\n childComponent = <EnumPropertyField\n multiselect={false}\n allowDataInference={allowDataInference}\n updateIds={!existing}\n disabled={disabled}\n getData={getData}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"multi_select\" ||\n selectedFieldConfigId === \"multi_number_select\") {\n childComponent = <EnumPropertyField\n multiselect={true}\n updateIds={!existing}\n disabled={disabled}\n allowDataInference={allowDataInference}\n getData={getData}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"file_upload\") {\n childComponent =\n <StoragePropertyField existing={existing}\n multiple={false}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"multi_file_upload\") {\n childComponent =\n <StoragePropertyField existing={existing}\n multiple={true}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"switch\") {\n childComponent = <BooleanPropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"number_input\") {\n childComponent = <NumberPropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"group\") {\n childComponent =\n <MapPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"block\") {\n childComponent =\n <BlockPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"reference\") {\n childComponent =\n <ReferencePropertyField showErrors={showErrors}\n existing={existing}\n multiple={false}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"date_time\") {\n childComponent = <DateTimePropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"multi_references\") {\n childComponent =\n <ReferencePropertyField showErrors={showErrors}\n existing={existing}\n multiple={true}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"repeat\") {\n childComponent =\n <RepeatPropertyField showErrors={showErrors}\n existing={existing}\n getData={getData}\n allowDataInference={allowDataInference}\n disabled={disabled}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"key_value\") {\n childComponent =\n <KeyValuePropertyField disabled={disabled}/>;\n } else {\n childComponent = null;\n }\n\n return (\n <>\n {disabled && <InfoLabel mode={\"warn\"}>\n <Typography>This property can&apos;t be edited</Typography>\n <Typography variant={\"caption\"}>\n You may not have permission to\n edit it or it is defined in code with no <code>editable</code> flag\n </Typography>\n </InfoLabel>}\n\n <div className=\"flex mt-2 justify-between\">\n <div className={\"w-full flex flex-col gap-2\"}>\n <Select\n // className={\"w-full\"}\n error={Boolean(selectedWidgetError)}\n value={selectedFieldConfigId ?? \"\"}\n placeholder={\"Select a property widget\"}\n open={selectOpen}\n onOpenChange={setSelectOpen}\n position={\"item-aligned\"}\n disabled={disabled}\n renderValue={(value) => {\n if (!value) {\n return <em>Select a property\n widget</em>;\n }\n const key = value as FieldConfigId;\n const propertyConfig = DEFAULT_FIELD_CONFIGS[key] ?? propertyConfigs[key];\n const baseProperty = propertyConfig.property;\n const baseFieldConfig = baseProperty && !isPropertyBuilder(baseProperty) ? getFieldConfig(baseProperty, propertyConfigs) : undefined;\n const optionDisabled = isPropertyBuilder(baseProperty) || (existing && baseProperty.dataType !== values?.dataType);\n const computedFieldConfig = baseFieldConfig ? mergeDeep(baseFieldConfig, propertyConfig) : propertyConfig;\n return <div\n onClick={(e) => {\n if (optionDisabled) {\n e.stopPropagation();\n e.preventDefault();\n }\n }}\n className={cn(\n \"flex items-center\",\n optionDisabled ? \"w-full pointer-events-none opacity-50\" : \"\")}>\n <div className={\"mr-8\"}>\n <PropertyConfigBadge propertyConfig={computedFieldConfig}/>\n </div>\n <div className={\"flex flex-col items-start text-base text-left\"}>\n <div>{computedFieldConfig.name}</div>\n <Typography variant={\"caption\"}\n color={\"disabled\"}>\n {optionDisabled ? \"You can only switch to widgets that use the same data type\" : computedFieldConfig.description}\n </Typography>\n </div>\n </div>\n }}\n onValueChange={(value) => {\n onWidgetSelectChanged(value as FieldConfigId);\n }}>\n {displayedWidgets.map(([key, propertyConfig]) => {\n const baseProperty = propertyConfig.property;\n const optionDisabled = existing && !isPropertyBuilder(baseProperty) && baseProperty.dataType !== values?.dataType;\n return <PropertySelectItem\n key={key}\n value={key}\n optionDisabled={optionDisabled}\n propertyConfig={propertyConfig}\n existing={existing}/>;\n })}\n </Select>\n\n {selectedWidgetError &&\n <Typography variant=\"caption\"\n className={\"ml-3.5\"}\n color={\"error\"}>Required</Typography>}\n\n {/*<Typography variant=\"caption\" className={\"ml-3.5\"}>Define your own custom properties and*/}\n {/* components</Typography>*/}\n\n </div>\n\n {onDelete && values?.id &&\n <IconButton\n variant={\"ghost\"}\n className=\"m-4\"\n disabled={disabled}\n onClick={() => setDeleteDialogOpen(true)}>\n <DeleteIcon/>\n </IconButton>}\n </div>\n\n <div className={\"grid grid-cols-12 gap-y-12 mt-8 mb-8\"}>\n {includeIdAndTitle &&\n <CommonPropertyFields showErrors={showErrors}\n disabledId={existing}\n isNewProperty={!existing}\n disabled={disabled}\n autoUpdateId={autoUpdateId}\n ref={nameFieldRef}/>}\n\n {childComponent}\n\n <div className={\"col-span-12\"}>\n <AdvancedPropertyValidation disabled={disabled}/>\n </div>\n </div>\n\n {onDelete &&\n <DeleteConfirmationDialog open={deleteDialogOpen}\n onAccept={() => onDelete(values?.id, propertyNamespace)}\n onCancel={() => setDeleteDialogOpen(false)}\n title={<div>Delete this property?</div>}\n body={\n <div> This will <b>not delete any\n data</b>, only modify the\n collection.</div>\n }/>}\n\n </>\n );\n}\n\nconst idRegEx = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\nfunction validateId(value?: string, existingPropertyKeys?: string[]) {\n\n let error;\n if (!value) {\n error = \"You must specify an id for the field\";\n }\n if (value && !value.match(idRegEx)) {\n error = \"The id can only contain letters, numbers and underscores (_), and not start with a number\";\n }\n if (value && existingPropertyKeys && existingPropertyKeys.includes(value)) {\n error = \"There is another field with this ID already\";\n }\n return error;\n}\n\nfunction validateName(value: string) {\n let error;\n if (!value) {\n error = \"You must specify a title for the field\";\n }\n return error;\n}\n","export function camelCase(str: string): string {\n if (!str) return \"\";\n return (str.slice(0, 1).toLowerCase() + str.slice(1))\n .replace(/([-_ ]){1,}/g, \" \")\n .split(/[-_ ]/)\n .reduce((cur, acc) => {\n return cur + acc[0].toUpperCase() + acc.substring(1);\n }, \"\");\n}\n","import { EntityCollection, useSnackbarController } from \"@firecms/core\";\nimport { Button, ContentCopyIcon, Dialog, DialogActions, DialogContent, Typography, } from \"@firecms/ui\";\nimport React from \"react\";\nimport JSON5 from \"json5\";\nimport { Highlight, themes } from \"prism-react-renderer\"\nimport { camelCase } from \"./utils/strings\";\n\nexport function GetCodeDialog({ collection, onOpenChange, open }: { onOpenChange: (open: boolean) => void, collection: any, open: any }) {\n\n const snackbarController = useSnackbarController();\n\n const code = \"import { EntityCollection } from \\\"firecms\\\";\\n\\nconst \" + (collection.name ? camelCase(collection.name) : \"my\") + \"Collection:EntityCollection = \" + JSON5.stringify(collectionToCode(collection), null, \"\\t\");\n return <Dialog open={open}\n onOpenChange={onOpenChange}\n maxWidth={\"4xl\"}>\n <DialogContent>\n <Typography variant={\"h6\"} className={\"my-4\"}>\n Code for {collection.name}\n </Typography>\n <Typography variant={\"body2\"} className={\"my-4 mb-8\"}>\n If you want to customise the collection in code, you can add this collection code to your CMS\n app configuration.\n More info in the <a\n rel=\"noopener noreferrer\"\n href={\"https://firecms.co/docs/customization_quickstart\"}>docs</a>.\n </Typography>\n <Highlight\n theme={themes.vsDark}\n code={code}\n language=\"typescript\"\n >\n {({ className, style, tokens, getLineProps, getTokenProps }) => (\n <pre style={style} className={\"p-4 rounded text-sm\"}>\n {tokens.map((line, i) => (\n <div key={i} {...getLineProps({ line })}>\n {line.map((token, key) => (\n <span key={key} {...getTokenProps({ token })} />\n ))}\n </div>\n ))}\n </pre>\n )}\n </Highlight>\n\n </DialogContent>\n <DialogActions>\n <Button\n variant={\"text\"}\n size={\"small\"}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n snackbarController.open({\n type: \"success\",\n message: `Copied`\n })\n return navigator.clipboard.writeText(code);\n }}>\n <ContentCopyIcon size={\"small\"}/>\n Copy to clipboard\n </Button>\n <Button onClick={() => onOpenChange(false)}>Close</Button>\n </DialogActions>\n </Dialog>;\n}\n\nfunction collectionToCode(collection: EntityCollection): object {\n\n const propertyCleanup = (property: any) => {\n\n const updatedProperty = {\n ...property\n };\n\n delete updatedProperty.fromBuilder;\n delete updatedProperty.resolved;\n delete updatedProperty.propertiesOrder;\n delete updatedProperty.editable;\n\n if (updatedProperty.type === \"map\") {\n return {\n ...updatedProperty,\n properties: updatedProperty.properties.map(propertyCleanup)\n }\n }\n return updatedProperty;\n }\n\n return {\n id: collection.id,\n name: collection.name,\n singularName: collection.singularName,\n path: collection.path,\n description: collection.description,\n editable: true,\n collectionGroup: collection.collectionGroup,\n icon: collection.icon,\n group: collection.group,\n customId: collection.customId,\n initialFilter: collection.initialFilter,\n initialSort: collection.initialSort,\n properties: Object.entries(collection.properties)\n .map(([key, value]) => ({\n [key]: propertyCleanup(value)\n }))\n .reduce((a, b) => ({ ...a, ...b }), {}),\n subcollections: (collection.subcollections ?? []).map(collectionToCode)\n }\n\n}\n","import React, { useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { Field, getIn } from \"../../form\";\nimport {\n EntityCollection,\n ErrorBoundary,\n isPropertyBuilder,\n makePropertiesEditable,\n Properties,\n Property,\n PropertyConfig,\n PropertyOrBuilder,\n useLargeLayout,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport {\n AddIcon,\n AutoAwesomeIcon,\n Button,\n CircularProgress,\n cn,\n CodeIcon,\n DebouncedTextField,\n defaultBorderMixin,\n IconButton,\n Paper,\n Tooltip,\n Typography,\n} from \"@firecms/ui\";\n\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"./util\";\nimport { OnPropertyChangedParams, PropertyForm, PropertyFormDialog } from \"./PropertyEditView\";\nimport { PropertyTree } from \"./PropertyTree\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\nimport { GetCodeDialog } from \"./GetCodeDialog\";\nimport { useFormex } from \"../../form/Formex\";\n\ntype CollectionEditorFormProps = {\n showErrors: boolean;\n isNewCollection: boolean;\n propertyErrorsRef?: React.MutableRefObject<any>;\n onPropertyError: (propertyKey: string, namespace: string | undefined, error?: Record<string, any>) => void;\n setDirty?: (dirty: boolean) => void;\n reservedGroups?: string[];\n extraIcon: React.ReactNode;\n getUser: (uid: string) => User | null;\n getData?: () => Promise<object[]>;\n doCollectionInference: (collection: PersistedCollection) => Promise<Partial<EntityCollection> | null> | undefined;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n};\n\nexport function CollectionPropertiesEditorForm({\n showErrors,\n isNewCollection,\n propertyErrorsRef,\n onPropertyError,\n setDirty,\n reservedGroups,\n extraIcon,\n getUser,\n getData,\n doCollectionInference,\n propertyConfigs,\n collectionEditable\n }: CollectionEditorFormProps) {\n\n const {\n values,\n setFieldValue,\n setFieldError,\n setFieldTouched,\n errors,\n dirty\n } = useFormex<PersistedCollection>();\n\n const snackbarController = useSnackbarController();\n\n const largeLayout = useLargeLayout();\n const asDialog = !largeLayout\n\n // index of the selected property within the namespace\n const [selectedPropertyIndex, setSelectedPropertyIndex] = useState<number | undefined>();\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n const [codeDialogOpen, setCodeDialogOpen] = useState<boolean>(false);\n\n const [inferringProperties, setInferringProperties] = useState<boolean>(false);\n\n const [newPropertyDialogOpen, setNewPropertyDialogOpen] = useState<boolean>(false);\n const [inferredPropertyKeys, setInferredPropertyKeys] = useState<string[]>([]);\n\n const currentPropertiesOrderRef = React.useRef<{\n [key: string]: string[]\n }>(values.propertiesOrder ? { \"\": values.propertiesOrder } : {});\n\n useEffect(() => {\n if (setDirty)\n setDirty(dirty);\n }, [dirty]);\n\n const inferPropertiesFromData = doCollectionInference\n ? (): void => {\n if (!doCollectionInference)\n return;\n\n setInferringProperties(true);\n // @ts-ignore\n doCollectionInference(values)\n .then((newCollection) => {\n\n if (newCollection)\n makePropertiesEditable(newCollection.properties as Properties);\n\n if (!newCollection) {\n snackbarController.open({\n type: \"error\",\n message: \"Could not infer properties from data\"\n });\n return;\n }\n // find properties in the new collection, not present in the current one\n const newPropertyKeys = (newCollection.properties ? Object.keys(newCollection.properties) : [])\n .filter((propertyKey) => !values.properties[propertyKey]);\n if (newPropertyKeys.length === 0) {\n snackbarController.open({\n type: \"info\",\n message: \"No new properties found in existing data\"\n });\n return;\n }\n // add them to the current collection\n const updatedProperties = {\n ...newPropertyKeys.reduce((acc, propertyKey) => {\n acc[propertyKey] = (newCollection.properties ?? {})[propertyKey];\n return acc;\n }, {} as { [key: string]: PropertyOrBuilder }),\n ...values.properties\n };\n const updatedPropertiesOrder = [\n ...newPropertyKeys,\n ...(values.propertiesOrder ?? [])\n ];\n setFieldValue(\"properties\", updatedProperties, false);\n\n updatePropertiesOrder(updatedPropertiesOrder);\n\n setInferredPropertyKeys(newPropertyKeys);\n })\n .finally(() => {\n setInferringProperties(false);\n })\n }\n : undefined;\n\n const getCurrentPropertiesOrder = useCallback((namespace?: string) => {\n if (!namespace) return currentPropertiesOrderRef.current[\"\"];\n return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));\n }, [values]);\n\n const updatePropertiesOrder = useCallback((newPropertiesOrder: string[], namespace?: string) => {\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n setFieldValue(propertiesOrderPath, newPropertiesOrder, false);\n currentPropertiesOrderRef.current[namespace ?? \"\"] = newPropertiesOrder;\n\n }, [setFieldValue]);\n\n const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n setFieldValue(idToPropertiesPath(fullId), undefined, false);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n const newPropertiesOrder = currentPropertiesOrder.filter((p) => p !== propertyKey);\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n setNewPropertyDialogOpen(false);\n\n setSelectedPropertyIndex(undefined);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }, [getCurrentPropertiesOrder, setFieldValue, updatePropertiesOrder]);\n\n const onPropertyMove = (propertiesOrder: string[], namespace?: string) => {\n setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);\n };\n\n const onPropertyCreated = ({\n id,\n property\n }: {\n id?: string,\n property: Property\n }) => {\n if (!id) {\n throw Error(\"Need to include an ID when creating a new property\")\n }\n setFieldValue(\"properties\", {\n ...(values.properties ?? {}),\n [id]: property\n }, false);\n const newPropertiesOrder = [...(values.propertiesOrder ?? Object.keys(values.properties)), id];\n\n updatePropertiesOrder(newPropertiesOrder);\n\n setNewPropertyDialogOpen(false);\n if (largeLayout) {\n setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n setSelectedPropertyKey(id);\n }\n setSelectedPropertyNamespace(undefined);\n };\n\n const onPropertyChanged = ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => {\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // If the id has changed we need to a little cleanup\n if (previousId && previousId !== id) {\n const previousFullId = getFullId(previousId, namespace);\n const previousPropertyPath = idToPropertiesPath(previousFullId);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n\n // replace previousId with id in propertiesOrder\n const newPropertiesOrder = currentPropertiesOrder\n .map((p) => p === previousId ? id : p)\n .filter((p) => p !== undefined) as string[];\n\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n if (id) {\n setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n setSelectedPropertyKey(id);\n }\n setFieldValue(previousPropertyPath, undefined, false);\n setFieldTouched(previousPropertyPath, false, false);\n }\n\n console.debug(\"onPropertyChanged\", {\n id,\n property,\n previousId,\n namespace,\n propertyPath\n })\n\n if (propertyPath) {\n setFieldValue(propertyPath, property, false);\n setFieldTouched(propertyPath, true, false);\n }\n\n };\n\n const onPropertyErrorInternal = useCallback((id: string, namespace?: string, error?: Record<string, any>) => {\n const propertyPath = id ? getFullId(id, namespace) : undefined;\n console.debug(\"onPropertyErrorInternal\", {\n id,\n namespace,\n error,\n propertyPath\n });\n if (propertyPath) {\n const hasError = error && Object.keys(error).length > 0;\n onPropertyError(id, namespace, hasError ? error : undefined);\n setFieldError(idToPropertiesPath(propertyPath), hasError ? \"Property error\" : undefined);\n }\n }, [])\n\n const closePropertyDialog = () => {\n setSelectedPropertyIndex(undefined);\n setSelectedPropertyKey(undefined);\n };\n\n const initialErrors = selectedPropertyKey && propertyErrorsRef?.current?.properties ? propertyErrorsRef.current.properties[selectedPropertyKey] : undefined;\n\n const emptyCollection = values?.propertiesOrder === undefined || values.propertiesOrder.length === 0;\n\n const usedPropertiesOrder = (values.propertiesOrder\n ? values.propertiesOrder\n : Object.keys(values.properties)) as string[];\n\n const owner = useMemo(() => getUser(values.ownerId), [getUser, values.ownerId]);\n\n const onPropertyClick = useCallback((propertyKey: string, namespace?: string) => {\n console.debug(\"CollectionEditor: onPropertyClick\", {\n propertyKey,\n namespace\n });\n setSelectedPropertyIndex(usedPropertiesOrder.indexOf(propertyKey));\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n }, [usedPropertiesOrder]);\n\n const body = (\n <div className={\"grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900\"}>\n <div className={cn(\n \"p-4 md:p-8 pb-20 md:pb-20\",\n \"col-span-12 lg:col-span-5 h-full overflow-auto\",\n !asDialog && \"border-r \" + defaultBorderMixin\n )}>\n\n <div className=\"flex my-2\">\n\n <div className=\"flex-grow mb-4\">\n\n <Field\n name={\"name\"}\n as={DebouncedTextField}\n invisible={true}\n className=\"-ml-1\"\n inputClassName=\"text-2xl font-headers\"\n placeholder={\"Collection name\"}\n size={\"small\"}\n required\n error={Boolean(errors?.name)}/>\n\n {owner &&\n <Typography variant={\"body2\"}\n className={\"ml-2\"}\n color={\"secondary\"}>\n Created by {owner.displayName}\n </Typography>}\n </div>\n\n {extraIcon && <div className=\"ml-4\">\n {extraIcon}\n </div>}\n\n <div className=\"ml-1 mt-2 flex flex-row gap-2\">\n <Tooltip title={\"Get the code for this collection\"}>\n <IconButton\n variant={\"filled\"}\n disabled={inferringProperties}\n onClick={() => setCodeDialogOpen(true)}>\n <CodeIcon/>\n </IconButton>\n </Tooltip>\n {inferPropertiesFromData && <Tooltip title={\"Add new properties based on data\"}>\n <IconButton\n variant={\"filled\"}\n disabled={inferringProperties}\n onClick={inferPropertiesFromData}>\n {inferringProperties ? <CircularProgress size={\"small\"}/> : <AutoAwesomeIcon/>}\n </IconButton>\n </Tooltip>}\n <Tooltip title={\"Add new property\"}>\n <Button\n variant={\"outlined\"}\n onClick={() => setNewPropertyDialogOpen(true)}>\n <AddIcon/>\n </Button>\n </Tooltip>\n </div>\n </div>\n\n <ErrorBoundary>\n <PropertyTree\n className={\"pl-8\"}\n inferredPropertyKeys={inferredPropertyKeys}\n selectedPropertyKey={selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined}\n properties={values.properties}\n additionalFields={values.additionalFields}\n propertiesOrder={usedPropertiesOrder}\n onPropertyClick={onPropertyClick}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={isNewCollection ? deleteProperty : undefined}\n collectionEditable={collectionEditable}\n errors={errors}/>\n </ErrorBoundary>\n\n <Button className={\"mt-8 w-full\"}\n color=\"primary\"\n variant={\"outlined\"}\n size={\"large\"}\n onClick={() => setNewPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}>\n Add new property\n </Button>\n </div>\n\n {!asDialog &&\n <div className={\"col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto pb-20 md:pb-20\"}>\n <Paper\n className=\"sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center \">\n\n {selectedPropertyFullId &&\n selectedProperty &&\n !isPropertyBuilder(selectedProperty) &&\n <PropertyForm\n inArray={false}\n key={`edit_view_${selectedPropertyIndex}`}\n existingProperty={!isNewCollection}\n autoUpdateId={false}\n allowDataInference={!isNewCollection}\n autoOpenTypeSelect={false}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n onPropertyChanged={onPropertyChanged}\n onDelete={deleteProperty}\n onError={onPropertyErrorInternal}\n forceShowErrors={showErrors}\n initialErrors={initialErrors}\n getData={getData}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n />}\n\n {!selectedProperty &&\n <Typography variant={\"label\"} className=\"flex items-center justify-center h-full\">\n {emptyCollection\n ? \"Now you can add your first property\"\n : \"Select a property to edit it\"}\n </Typography>}\n\n {selectedProperty && isPropertyBuilder(selectedProperty) &&\n <Typography variant={\"label\"} className=\"flex items-center justify-center\">\n {\"This property is defined as a property builder in code\"}\n </Typography>}\n </Paper>\n </div>}\n\n {asDialog && <PropertyFormDialog\n inArray={false}\n open={selectedPropertyIndex !== undefined}\n key={`edit_view_${selectedPropertyIndex}`}\n autoUpdateId={!selectedProperty}\n allowDataInference={!isNewCollection}\n existingProperty={true}\n autoOpenTypeSelect={false}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n onPropertyChanged={onPropertyChanged}\n onDelete={deleteProperty}\n onError={onPropertyErrorInternal}\n forceShowErrors={showErrors}\n initialErrors={initialErrors}\n getData={getData}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n onOkClicked={asDialog\n ? closePropertyDialog\n : undefined\n }/>}\n\n </div>);\n\n return (<>\n\n {body}\n\n {/* This is the dialog used for new properties*/}\n <PropertyFormDialog\n inArray={false}\n existingProperty={false}\n autoOpenTypeSelect={true}\n autoUpdateId={true}\n forceShowErrors={showErrors}\n open={newPropertyDialogOpen}\n onCancel={() => setNewPropertyDialogOpen(false)}\n onPropertyChanged={onPropertyCreated}\n getData={getData}\n allowDataInference={!isNewCollection}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n existingPropertyKeys={values.propertiesOrder as string[]}/>\n\n <GetCodeDialog\n collection={values}\n open={codeDialogOpen}\n onOpenChange={setCodeDialogOpen}/>\n\n </>\n );\n}\n","import React from \"react\";\nimport { Button, Dialog, DialogActions, DialogContent, Typography } from \"@firecms/ui\";\n\nexport interface UnsavedChangesDialogProps {\n open: boolean;\n body?: React.ReactNode;\n title?: string;\n handleOk: () => void;\n handleCancel: () => void;\n}\n\nexport function UnsavedChangesDialog({\n open,\n handleOk,\n handleCancel,\n body,\n title\n }: UnsavedChangesDialogProps) {\n\n return (\n <Dialog\n open={open}\n onOpenChange={(open) => open ? handleCancel() : handleOk()}\n aria-labelledby=\"alert-dialog-title\"\n aria-describedby=\"alert-dialog-description\"\n >\n <DialogContent>\n <Typography variant={\"h6\"}>\n {title ?? \"Unsaved changes\"}\n </Typography>\n\n {body && <Typography>\n {body}\n </Typography>}\n <Typography>\n Are you sure?\n </Typography>\n\n </DialogContent>\n\n <DialogActions>\n <Button variant=\"text\" onClick={handleCancel} autoFocus> Cancel </Button>\n <Button onClick={handleOk}> Ok </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import { useCustomizationController } from \"@firecms/core\";\nimport { Button, Dialog, DialogActions, DialogContent, Typography } from \"@firecms/ui\";\nimport React from \"react\";\n\nexport function EntityCustomViewsSelectDialog({ open, onClose }: { open: boolean, onClose: (selectedViewKey?: string) => void }) {\n const {\n entityViews,\n } = useCustomizationController();\n\n return <Dialog\n maxWidth={\"md\"}\n open={open}>\n <DialogContent className={\"flex flex-col gap-4\"}>\n <Typography variant={\"h6\"}>\n Select view\n </Typography>\n {entityViews?.map((view) => {\n return <Button\n key={view.key}\n onClick={() => onClose(view.key)}\n fullWidth\n variant={\"text\"}\n >\n {view.name} ({view.key})\n </Button>;\n })}\n {(entityViews ?? []).length === 0 &&\n <Typography variant={\"body2\"}>\n No custom views defined\n </Typography>\n }\n </DialogContent>\n <DialogActions>\n <Button variant={\"outlined\"} onClick={() => onClose()}>Cancel</Button>\n </DialogActions>\n </Dialog>\n}\n","import React from \"react\";\nimport {\n DeleteConfirmationDialog,\n EntityCollection,\n EntityCustomView,\n resolveEntityView,\n useCustomizationController,\n User\n} from \"@firecms/core\";\nimport {\n AddIcon,\n Alert,\n Button,\n Container,\n DeleteIcon,\n IconButton,\n Paper,\n Table,\n TableBody,\n TableCell,\n TableRow,\n Tooltip,\n Typography,\n} from \"@firecms/ui\";\nimport { CollectionEditorDialog } from \"./CollectionEditorDialog\";\nimport { CollectionsConfigController } from \"../../types/config_controller\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\nimport { CollectionInference } from \"../../types/collection_inference\";\nimport { EntityCustomViewsSelectDialog } from \"./EntityCustomViewsSelectDialog\";\nimport { useFormex } from \"../../form/Formex\";\n\nexport function SubcollectionsEditTab({\n collection,\n parentCollection,\n configController,\n collectionInference,\n getUser,\n parentCollectionIds\n }: {\n collection: PersistedCollection,\n parentCollection?: EntityCollection,\n configController: CollectionsConfigController;\n collectionInference?: CollectionInference;\n getUser: (uid: string) => User | null;\n parentCollectionIds?: string[];\n}) {\n\n const { entityViews: contextEntityViews } = useCustomizationController();\n\n const [subcollectionToDelete, setSubcollectionToDelete] = React.useState<string | undefined>();\n const [addEntityViewDialogOpen, setAddEntityViewDialogOpen] = React.useState<boolean>(false);\n const [viewToDelete, setViewToDelete] = React.useState<string | undefined>();\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n editedCollectionPath?: string,\n }>();\n\n const {\n values,\n setFieldValue,\n } = useFormex<EntityCollection>();\n\n const subcollections = collection.subcollections ?? [];\n const resolvedEntityViews = values.entityViews?.filter(e => typeof e === \"string\")\n .map(e => resolveEntityView(e, contextEntityViews))\n .filter(Boolean) as EntityCustomView[] ?? [];\n const hardCodedEntityViews = collection.entityViews?.filter(e => typeof e !== \"string\") as EntityCustomView[] ?? [];\n const totalEntityViews = resolvedEntityViews.length + hardCodedEntityViews.length;\n\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"2xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n <div className={\"flex flex-col gap-16\"}>\n\n <div className={\"flex-grow flex flex-col gap-4 items-start\"}>\n <Typography variant={\"h5\"}>\n Subcollections of {values.name}\n </Typography>\n\n {subcollections && subcollections.length > 0 &&\n <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n <Table>\n <TableBody>\n {subcollections.map((subcollection) => (\n <TableRow key={subcollection.path}\n onClick={() => setCurrentDialog({\n isNewCollection: false,\n editedCollectionPath: subcollection.path,\n })}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {subcollection.name}\n </Typography>\n </TableCell>\n <TableCell\n align=\"right\">\n <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n setSubcollectionToDelete(subcollection.id);\n }}\n color=\"inherit\">\n <DeleteIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Paper>}\n\n <Button\n onClick={() => {\n setCurrentDialog({\n isNewCollection: true\n });\n }}\n variant={\"outlined\"}\n startIcon={<AddIcon/>}>\n Add subcollection\n </Button>\n </div>\n\n <div className={\"flex-grow flex flex-col gap-4 items-start\"}>\n <Typography variant={\"h5\"}>\n Custom views\n </Typography>\n\n {totalEntityViews > 0 && <>\n <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n <Table>\n <TableBody>\n {resolvedEntityViews.map((view) => (\n <TableRow key={view.key}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {view.name}\n </Typography>\n </TableCell>\n <TableCell\n align=\"right\">\n <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n setViewToDelete(view.key);\n }}\n color=\"inherit\">\n <DeleteIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n </TableCell>\n </TableRow>\n ))}\n {hardCodedEntityViews.map((view) => (\n <TableRow key={view.key}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {view.name}\n </Typography>\n <Typography variant={\"caption\"} className={\"flex-grow\"}>\n This view is defined in code with\n key <code>{view.key}</code>\n </Typography>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Paper>\n\n </>}\n\n {totalEntityViews === 0 &&\n <Alert action={<Button variant=\"text\"\n size={\"small\"}\n href={\"https://firecms.co/docs/customization_quickstart\"}\n component={\"a\"}\n rel=\"noopener noreferrer\"\n target=\"_blank\">More info</Button>}>\n Define your own custom views by uploading it with the CLI.\n </Alert>\n }\n\n <Button\n onClick={() => {\n setAddEntityViewDialogOpen(true);\n }}\n variant={\"outlined\"}\n startIcon={<AddIcon/>}>\n Add custom entity view\n </Button>\n\n </div>\n\n </div>\n </Container>\n\n <div style={{ height: \"52px\" }}/>\n\n {subcollectionToDelete &&\n <DeleteConfirmationDialog open={Boolean(subcollectionToDelete)}\n onAccept={() => {\n const props = {\n id: subcollectionToDelete,\n parentCollectionIds: [...(parentCollectionIds ?? []), collection.id]\n };\n console.debug(\"Deleting subcollection\", props)\n configController.deleteCollection(props);\n setSubcollectionToDelete(undefined);\n }}\n onCancel={() => setSubcollectionToDelete(undefined)}\n title={<>Delete this subcollection?</>}\n body={<> This will <b>not\n delete any data</b>, only\n the collection in the CMS</>}/>}\n {viewToDelete &&\n <DeleteConfirmationDialog open={Boolean(viewToDelete)}\n onAccept={() => {\n setFieldValue(\"entityViews\", values.entityViews?.filter(e => e !== viewToDelete));\n setViewToDelete(undefined);\n }}\n onCancel={() => setViewToDelete(undefined)}\n title={<>Remove this view?</>}\n body={<>This will <b>not\n delete any data</b>, only\n the view in the CMS</>}/>}\n\n <CollectionEditorDialog\n open={Boolean(currentDialog)}\n configController={configController}\n parentCollection={collection}\n collectionInference={collectionInference}\n parentCollectionIds={[...parentCollectionIds ?? [], values.id]}\n isNewCollection={false}\n {...currentDialog}\n getUser={getUser}\n handleClose={() => {\n setCurrentDialog(undefined);\n }}/>\n\n <EntityCustomViewsSelectDialog\n open={addEntityViewDialogOpen}\n onClose={(selectedViewKey) => {\n if (selectedViewKey) {\n setFieldValue(\"entityViews\", [...(values.entityViews ?? []), selectedViewKey]);\n }\n setAddEntityViewDialogOpen(false);\n }}/>\n </div>\n );\n}\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const productsCollectionTemplate: EntityCollection = {\n id: \"products\",\n path: \"products\",\n name: \"Products\",\n singularName: \"Product\",\n icon: \"shopping_cart\",\n description: \"List of the products currently sold in your shop\",\n properties: makePropertiesEditable({\n name: {\n dataType: \"string\",\n name: \"Name\",\n description: \"Name of this product\",\n validation: {\n required: true\n }\n },\n brand: {\n dataType: \"string\",\n name: \"Brand\",\n validation: {\n required: true\n }\n },\n description: {\n dataType: \"string\",\n name: \"Description\",\n description: \"Description of this product, supports markdown\",\n markdown: true\n },\n main_image: {\n dataType: \"string\",\n name: \"Image\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n },\n description: \"Upload field for images\"\n },\n available: {\n dataType: \"boolean\",\n name: \"Available\",\n columnWidth: 100,\n description: \"Is this product available in the website\"\n },\n price: {\n dataType: \"number\",\n name: \"Price\",\n validation: {\n requiredMessage: \"You must set a positive price\",\n min: 0\n }\n },\n images: {\n dataType: \"array\",\n name: \"Images\",\n hideFromCollection: true,\n of: {\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"]\n }\n }\n },\n related_products: {\n dataType: \"array\",\n name: \"Related products\",\n description: \"Products related to this one\",\n of: {\n dataType: \"reference\",\n path: \"products\"\n }\n },\n metadata: {\n name: \"Metadata\",\n description: \"This is an example of a map property\",\n dataType: \"map\",\n keyValue: true\n },\n added_on: {\n dataType: \"date\",\n name: \"Added on\",\n autoValue: \"on_create\"\n }\n })\n};\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const blogCollectionTemplate:EntityCollection = {\n id: \"blog\",\n path: \"blog\",\n name: \"Blog\",\n singularName: \"Blog entry\",\n icon: \"article\",\n description: \"A collection of blog entries\",\n defaultSize: \"l\",\n properties: makePropertiesEditable({\n name: {\n name: \"Name\",\n validation: { required: true },\n dataType: \"string\"\n },\n header_image: {\n name: \"Header image\",\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n metadata: {\n cacheControl: \"max-age=1000000\"\n }\n }\n },\n content: {\n name: \"Content\",\n description: \"Content blocks for the blog entry\",\n validation: { required: true },\n dataType: \"array\",\n oneOf: {\n typeField: \"type\",\n valueField: \"value\",\n properties: {\n text: {\n dataType: \"string\",\n name: \"Text\",\n markdown: true\n },\n quote: {\n dataType: \"string\",\n name: \"Quote\",\n multiline: true\n },\n images: {\n name: \"Images\",\n dataType: \"array\",\n of: {\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n metadata: {\n cacheControl: \"max-age=1000000\"\n }\n }\n },\n description: \"This fields allows uploading multiple images at once and reordering\"\n },\n products: {\n name: \"Products\",\n dataType: \"array\",\n of: {\n dataType: \"reference\",\n path: \"products\",\n previewProperties: [\"name\", \"main_image\"]\n }\n }\n },\n propertiesOrder: [\"text\", \"quote\", \"images\", \"products\"]\n }\n },\n created_on: {\n name: \"Created on\",\n dataType: \"date\",\n autoValue: \"on_create\"\n },\n status: {\n name: \"Status\",\n validation: { required: true },\n dataType: \"string\",\n enumValues: {\n published: {\n id: \"published\",\n label: \"Published\",\n },\n draft: \"Draft\"\n },\n defaultValue: \"draft\"\n },\n publish_date: {\n name: \"Publish date\",\n dataType: \"date\",\n clearable: true\n },\n reviewed: {\n name: \"Reviewed\",\n dataType: \"boolean\"\n },\n tags: {\n name: \"Tags\",\n description: \"Example of generic array\",\n dataType: \"array\",\n of: {\n dataType: \"string\",\n previewAsTag: true\n }\n }\n }),\n initialFilter: {\n status: [\"==\", \"published\"]\n }\n};\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const usersCollectionTemplate: EntityCollection = {\n id: \"users\",\n path: \"users\",\n name: \"Users\",\n singularName: \"User\",\n description: \"Registered users in the app/web\",\n icon: \"person\",\n properties: makePropertiesEditable({\n displayName: {\n name: \"Display name\",\n dataType: \"string\"\n },\n email: {\n name: \"Email\",\n dataType: \"string\",\n email: true\n },\n emailVerified: {\n name: \"Email verified\",\n dataType: \"boolean\"\n },\n phone: {\n name: \"Phone\",\n dataType: \"string\"\n },\n favourite_products: {\n name: \"Favourite products\",\n dataType: \"array\",\n of: {\n dataType: \"reference\",\n path: \"products\"\n }\n },\n photoURL: {\n name: \"Photo URL\",\n dataType: \"string\",\n url: \"image\"\n }\n }),\n};\n","import { EntityCollection } from \"@firecms/core\";\n\nexport const pagesCollectionTemplate: EntityCollection = {\n id: \"pages\",\n path: \"pages\",\n name: \"Pages\",\n singularName: \"Page\",\n icon: \"insert_drive_file\",\n description: \"List of website pages that can be edited here\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Page Title\",\n validation: { required: true }\n },\n slug: {\n dataType: \"string\",\n name: \"URL Slug\",\n validation: {\n required: true,\n unique: true,\n matches: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n matchesMessage: \"Must be lowercase, alphanumeric, and hyphenated\"\n }\n },\n hero_section: {\n dataType: \"map\",\n name: \"Hero Section\",\n properties: {\n headline: {\n dataType: \"string\",\n name: \"Headline\",\n validation: { required: true }\n },\n subhead: {\n dataType: \"string\",\n name: \"Subheadline\"\n },\n background_image: {\n dataType: \"string\",\n name: \"Background Image\",\n storage: {\n storagePath: \"page_hero/images\",\n acceptedFiles: [\"image/*\"],\n }\n },\n call_to_action: {\n dataType: \"string\",\n name: \"Call to Action\"\n },\n call_to_action_link: {\n dataType: \"string\",\n name: \"CTA Link\",\n url: true\n }\n }\n },\n content: {\n dataType: \"array\",\n name: \"Content\",\n oneOf: {\n properties: {\n section: {\n dataType: \"map\",\n name: \"Section\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Section Title\",\n validation: { required: true }\n },\n content: {\n dataType: \"string\",\n name: \"Section Content\",\n markdown: true\n },\n image: {\n dataType: \"string\",\n name: \"Section Image\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n },\n link: {\n dataType: \"string\",\n name: \"Section Link\",\n url: true\n }\n }\n },\n image: {\n dataType: \"string\",\n name: \"Image\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n },\n slider: {\n dataType: \"array\",\n name: \"Slider\",\n of: {\n dataType: \"map\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Title\",\n validation: { required: true }\n },\n image: {\n dataType: \"string\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n }\n }\n }\n },\n }\n }\n },\n sidebar: {\n dataType: \"map\",\n name: \"Sidebar\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Sidebar Title\",\n validation: { required: false }\n },\n content: {\n dataType: \"string\",\n name: \"Sidebar Content\",\n markdown: true\n }\n }\n },\n seo_metadata: {\n dataType: \"map\",\n name: \"SEO Metadata\",\n properties: {\n meta_title: {\n dataType: \"string\",\n name: \"Meta Title\"\n },\n meta_description: {\n dataType: \"string\",\n name: \"Meta Description\"\n },\n focus_keywords: {\n dataType: \"array\",\n name: \"Focus Keywords\",\n of: {\n dataType: \"string\"\n }\n }\n }\n },\n footer_override: {\n dataType: \"string\",\n name: \"Footer Override\",\n markdown: true\n },\n publish_date: {\n dataType: \"date\",\n name: \"Publish Date\",\n validation: { required: true }\n },\n last_updated: {\n dataType: \"date\",\n name: \"Last Updated\",\n autoValue: \"on_update\"\n },\n is_published: {\n dataType: \"boolean\",\n name: \"Is Published\",\n columnWidth: 100,\n description: \"Should this page be live on the site?\"\n },\n author_uid: {\n dataType: \"reference\",\n name: \"Author\",\n path: \"users\"\n }\n }\n};\n","import React, { useEffect, useState } from \"react\";\nimport { EntityCollection, unslugify, } from \"@firecms/core\";\nimport { Button, Card, Chip, CircularProgress, cn, Container, Icon, Tooltip, Typography, } from \"@firecms/ui\";\n\nimport { productsCollectionTemplate } from \"./templates/products_template\";\nimport { blogCollectionTemplate } from \"./templates/blog_template\";\nimport { usersCollectionTemplate } from \"./templates/users_template\";\nimport { ImportFileUpload } from \"@firecms/data_import_export\";\nimport { pagesCollectionTemplate } from \"./templates/pages_template\";\nimport { useFormex } from \"../../form\";\n\nexport function CollectionEditorWelcomeView({\n path,\n pathSuggestions,\n parentCollection,\n onContinue,\n existingCollectionPaths\n }: {\n path: string;\n pathSuggestions?: (path: string) => Promise<string[]>;\n parentCollection?: EntityCollection;\n onContinue: (importData?: object[]) => void;\n existingCollectionPaths?: string[];\n}) {\n\n const [loadingPathSuggestions, setLoadingPathSuggestions] = useState(false);\n const [filteredPathSuggestions, setFilteredPathSuggestions] = useState<string[] | undefined>();\n useEffect(() => {\n if (pathSuggestions && existingCollectionPaths) {\n setLoadingPathSuggestions(true);\n pathSuggestions(path)\n .then(suggestions => {\n const filteredSuggestions = suggestions.filter(s => !(existingCollectionPaths ?? []).find(c => c.trim().toLowerCase() === s.trim().toLowerCase()));\n setFilteredPathSuggestions(filteredSuggestions);\n })\n .finally(() => setLoadingPathSuggestions(false));\n }\n }, [existingCollectionPaths, path, pathSuggestions]);\n\n // const {\n // values,\n // setFieldValue,\n // setValues,\n // handleChange,\n // touched,\n // errors,\n // setFieldTouched,\n // isSubmitting,\n // submitCount\n // } = useFormex<EntityCollection>();\n\n const {\n values,\n setFieldValue,\n setValues,\n submitCount\n } = useFormex<EntityCollection>();\n\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"4xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <div\n className=\"flex flex-row py-2 pt-3 items-center\">\n <Typography variant={\"h4\"} className={\"flex-grow\"}>\n New collection\n </Typography>\n </div>\n\n {parentCollection && <Chip colorScheme={\"tealDarker\"}>\n <Typography variant={\"caption\"}>\n This is a subcollection of <b>{parentCollection.name}</b>\n </Typography>\n </Chip>}\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Use one of the existing paths in your database:\n </Typography>\n <div className={\"flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7\"}>\n\n {loadingPathSuggestions && !filteredPathSuggestions && <CircularProgress size={\"small\"}/>}\n\n {filteredPathSuggestions?.map((suggestion, index) => (\n <Chip key={suggestion}\n colorScheme={\"cyanLighter\"}\n onClick={() => {\n setFieldValue(\"name\", unslugify(suggestion));\n setFieldValue(\"id\", suggestion);\n setFieldValue(\"path\", suggestion);\n setFieldValue(\"properties\", undefined);\n onContinue();\n }}\n size=\"small\">\n {suggestion}\n </Chip>\n ))}\n\n {!loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0 &&\n <Typography variant={\"caption\"}>\n No suggestions\n </Typography>\n }\n\n </div>\n\n </div>\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Select a template:\n </Typography>\n\n <div className={\"flex gap-4\"}>\n <TemplateButton title={\"Products\"}\n subtitle={\"A collection of products with images, prices and stock\"}\n icon={<Icon size={\"small\"} iconKey={productsCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(productsCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Users\"}\n subtitle={\"A collection of users with emails, names and roles\"}\n icon={<Icon size={\"small\"} iconKey={usersCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(usersCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Blog posts\"}\n subtitle={\"A collection of blog posts with images, authors and complex content\"}\n icon={<Icon size={\"small\"} iconKey={blogCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(blogCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Pages\"}\n subtitle={\"A collection of pages with images, authors and complex content\"}\n icon={<Icon size={\"small\"} iconKey={pagesCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(pagesCollectionTemplate);\n onContinue();\n }}/>\n </div>\n\n </div>\n\n {!parentCollection && <div>\n\n <Typography variant={\"caption\"}\n color={\"secondary\"}\n className={\"mb-2\"}>\n ● Create a collection from a file (csv, json, xls, xslx...)\n </Typography>\n\n <ImportFileUpload onDataAdded={(data) => onContinue(data)}/>\n\n </div>}\n\n <div>\n\n <Button variant={\"text\"} onClick={() => onContinue()} className={\"my-2\"}>\n Continue from scratch\n </Button>\n </div>\n\n {/*<div style={{ height: \"52px\" }}/>*/}\n\n </Container>\n </div>\n );\n}\n\nexport function TemplateButton({\n title,\n subtitle,\n icon,\n onClick\n }: {\n title: string,\n icon: React.ReactNode,\n subtitle: string,\n onClick?: () => void\n}) {\n\n return (\n <Tooltip title={subtitle}>\n <Card\n onClick={onClick}\n className={cn(\n \"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center\",\n \"text-gray-700 dark:text-gray-300\",\n \"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary\",\n \"border-gray-400 dark:border-gray-600 \"\n )}\n >\n {icon}\n <div className={\"flex flex-col items-start\"}>\n\n <Typography variant={\"subtitle1\"}>\n {title}\n </Typography>\n {/*<Typography>*/}\n {/* {subtitle}*/}\n {/*</Typography>*/}\n\n </div>\n </Card>\n </Tooltip>\n );\n\n}\n","import {\n DataNewPropertiesMapping,\n getInferenceType,\n ImportConfig,\n ImportNewPropertyFieldPreview\n} from \"@firecms/data_import_export\";\nimport { getIn, useFormex } from \"../../../form\";\n\nimport { PropertyConfigBadge, getFieldConfig, getFieldId, Properties, Property, PropertyConfig, } from \"@firecms/core\";\nimport { Container, Select, Tooltip, Typography } from \"@firecms/ui\";\nimport React, { useState } from \"react\";\nimport { OnPropertyChangedParams, PropertyFormDialog, PropertyWithId } from \"../PropertyEditView\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"../util\";\nimport { PersistedCollection } from \"../../../types/persisted_collection\";\nimport { updatePropertyFromWidget } from \"../utils/update_property_for_widget\";\nimport { PropertySelectItem } from \"../PropertySelectItem\";\nimport { supportedFields } from \"../utils/supported_fields\";\nimport { buildPropertyFromData } from \"@firecms/schema_inference\";\n\nexport function CollectionEditorImportMapping({\n importConfig,\n propertyConfigs,\n collectionEditable\n }:\n {\n importConfig: ImportConfig,\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean\n }) {\n\n // const {\n // values,\n // setFieldValue,\n // setFieldTouched,\n // setValues,\n // submitCount\n // } = useFormex();\n\n const {\n setFieldValue,\n setFieldTouched,\n values\n } = useFormex<PersistedCollection>();\n const [selectedProperty, setSelectedProperty] = useState<PropertyWithId | undefined>(undefined);\n\n const currentPropertiesOrderRef = React.useRef<{\n [key: string]: string[]\n }>(values.propertiesOrder ? { \"\": values.propertiesOrder } : {});\n\n const propertyKey = selectedProperty ? selectedProperty.id : undefined;\n const property = selectedProperty || undefined;\n\n const onPropertyChanged = ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => {\n\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // setSelectedProperty(property);\n const getCurrentPropertiesOrder = (namespace?: string) => {\n if (!namespace) return currentPropertiesOrderRef.current[\"\"];\n return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));\n }\n\n const updatePropertiesOrder = (newPropertiesOrder: string[], namespace?: string) => {\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n setFieldValue(propertiesOrderPath, newPropertiesOrder, false);\n currentPropertiesOrderRef.current[namespace ?? \"\"] = newPropertiesOrder;\n\n };\n\n // If the id has changed we need to a little cleanup\n if (previousId && previousId !== id) {\n const previousFullId = getFullId(previousId, namespace);\n const previousPropertyPath = idToPropertiesPath(previousFullId);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n\n // replace previousId with id in propertiesOrder\n const newPropertiesOrder = currentPropertiesOrder\n .map((p) => p === previousId ? id : p)\n .filter((p) => p !== undefined) as string[];\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n // replace previousId with id in headersMapping\n const newHeadersMapping = { ...importConfig.headersMapping };\n Object.keys(newHeadersMapping).forEach((key) => {\n if (newHeadersMapping[key] === previousId) {\n newHeadersMapping[key] = id ?? \"\";\n }\n });\n importConfig.setHeadersMapping(newHeadersMapping);\n\n // if (id) {\n // setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n // setSelectedPropertyKey(id);\n // }\n setFieldValue(previousPropertyPath, undefined, false);\n setFieldTouched(previousPropertyPath, false, false);\n }\n\n if (propertyPath) {\n setFieldValue(propertyPath, property, false);\n setFieldTouched(propertyPath, true, false);\n }\n };\n const onPropertyTypeChanged = async ({\n id,\n importKey,\n property,\n namespace\n }: OnPropertyChangedParams & {\n importKey: string\n }) => {\n\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // we try to infer the rest of the properties of a property, from the type and the data\n const propertyData = importConfig.importData.map((d) => getIn(d, importKey));\n const inferredNewProperty = {\n ...buildPropertyFromData(propertyData, property, getInferenceType),\n editable: true\n };\n\n if (propertyPath) {\n if (inferredNewProperty) {\n setFieldValue(propertyPath, inferredNewProperty, false);\n } else {\n setFieldValue(propertyPath, property, false);\n }\n setFieldTouched(propertyPath, true, false);\n }\n };\n\n return (\n\n <div className={\"overflow-auto my-auto bg-gray-50 dark:bg-gray-900\"}>\n <Container maxWidth={\"6xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <Typography variant=\"h6\" className={\"mt-4\"}>Data property mapping</Typography>\n\n <DataNewPropertiesMapping headersMapping={importConfig.headersMapping}\n idColumn={importConfig.idColumn}\n originProperties={importConfig.originProperties}\n destinationProperties={values.properties as Properties}\n onIdPropertyChanged={(value) => importConfig.setIdColumn(value)}\n buildPropertyView={({\n property,\n propertyKey,\n importKey\n }) => {\n return <ImportNewPropertyFieldPreview\n property={property}\n propertyKey={propertyKey}\n onPropertyNameChanged={(propertyKey: string, value: string) => setFieldValue(`properties.${propertyKey}.name`, value, false)}\n onEditClick={() => {\n if (!propertyKey || !property) return;\n setSelectedProperty({\n ...property,\n id: propertyKey,\n editable: true\n });\n }}\n propertyTypeView={<PropertySelect property={property}\n disabled={false}\n onPropertyChanged={(props) => onPropertyTypeChanged({\n ...props,\n importKey\n })}\n propertyKey={propertyKey}\n propertyConfigs={propertyConfigs}/>}\n />;\n }}/>\n </Container>\n\n <PropertyFormDialog\n open={selectedProperty !== undefined}\n propertyKey={propertyKey}\n property={property}\n inArray={false}\n autoUpdateId={false}\n onPropertyChanged={onPropertyChanged}\n allowDataInference={false}\n collectionEditable={collectionEditable}\n onOkClicked={() => {\n setSelectedProperty(undefined);\n }}\n onCancel={() => {\n setSelectedProperty(undefined);\n }}\n autoOpenTypeSelect={false}\n existingProperty={false}\n propertyConfigs={propertyConfigs}/>\n\n <div style={{ height: \"52px\" }}/>\n </div>\n );\n\n}\n\nfunction PropertySelect({\n property,\n onPropertyChanged,\n propertyKey,\n propertyConfigs,\n disabled\n }: {\n property: Property | null,\n propertyKey: string | null,\n onPropertyChanged: ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => void,\n propertyConfigs: Record<string, PropertyConfig>,\n disabled?: boolean\n}) {\n\n const fieldId = property ? getFieldId(property) : null;\n const widget = property ? getFieldConfig(property, propertyConfigs) : null;\n\n const [selectOpen, setSelectOpen] = useState(false);\n\n return <Tooltip title={property && widget ? `${widget?.name} - ${property.dataType}` : undefined}\n open={selectOpen ? false : undefined}>\n <Select\n open={selectOpen}\n onOpenChange={setSelectOpen}\n invisible={true}\n className={\"w-full\"}\n disabled={disabled}\n error={!widget}\n value={fieldId ?? \"\"}\n placeholder={\"Select a property widget\"}\n position={\"item-aligned\"}\n renderValue={(value) => {\n if (!widget) return null;\n return <PropertyConfigBadge propertyConfig={widget}/>\n }}\n onValueChange={(newSelectedWidgetId) => {\n const newProperty = updatePropertyFromWidget(property, newSelectedWidgetId, propertyConfigs)\n if (!propertyKey) return;\n onPropertyChanged({\n id: propertyKey,\n property: newProperty,\n previousId: propertyKey,\n namespace: undefined\n });\n }}>\n {Object.entries(supportedFields).map(([key, widget]) => {\n return <PropertySelectItem\n key={key}\n value={key}\n optionDisabled={false}\n propertyConfig={widget}\n existing={false}/>;\n })\n }\n </Select>\n </Tooltip>;\n}\n","import { convertDataToEntity, getPropertiesMapping, ImportConfig } from \"@firecms/data_import_export\";\nimport { EntityCollectionTable, Properties, useSelectionController } from \"@firecms/core\";\nimport { useEffect } from \"react\";\nimport { Typography } from \"@firecms/ui\";\n\nexport function CollectionEditorImportDataPreview({ importConfig, properties, propertiesOrder }: {\n importConfig: ImportConfig,\n properties: Properties,\n propertiesOrder: string[]\n}) {\n\n useEffect(() => {\n const propertiesMapping = getPropertiesMapping(importConfig.originProperties, properties);\n const mappedData = importConfig.importData.map(d => convertDataToEntity(d, importConfig.idColumn, importConfig.headersMapping, properties, propertiesMapping, \"TEMP_PATH\"));\n importConfig.setEntities(mappedData);\n }, []);\n\n const selectionController = useSelectionController();\n\n return <EntityCollectionTable\n title={<div>\n <Typography variant={\"subtitle2\"}>Imported data preview</Typography>\n <Typography variant={\"caption\"}>Entities with the same id will be overwritten</Typography>\n </div>}\n tableController={{\n data: importConfig.entities,\n dataLoading: false,\n noMoreToLoad: false\n }}\n endAdornment={<div className={\"h-12\"}/>}\n filterable={false}\n sortable={false}\n selectionController={selectionController}\n displayedColumnIds={propertiesOrder.map(p => ({ key: p, disabled: false }))}\n properties={properties}/>\n\n}\n","import { Properties, slugify } from \"@firecms/core\";\nimport { ImportConfig } from \"@firecms/data_import_export\";\n\nexport function cleanPropertiesFromImport(properties: Properties, parentSlug = \"\"): {\n headersMapping: ImportConfig[\"headersMapping\"],\n properties: Properties,\n idColumn?: ImportConfig[\"idColumn\"],\n} {\n\n const result = Object.keys(properties).reduce((acc, key) => {\n const property = properties[key];\n const slug = slugify(key);\n const fullSlug = parentSlug ? `${parentSlug}.${slug}` : slug;\n\n if (property.dataType === \"map\" && property.properties) {\n const slugifiedResult = cleanPropertiesFromImport(property.properties as Properties, fullSlug);\n return {\n headersMapping: { ...acc.headersMapping, [key]: fullSlug },\n properties: {\n ...acc.properties,\n [slug]: {\n ...property,\n properties: slugifiedResult.properties,\n propertiesOrder: Object.keys(slugifiedResult.properties)\n }\n }\n }\n }\n\n const updatedProperties = {\n ...acc.properties,\n [slug]: property\n } as Properties;\n\n const headersMapping = { ...acc.headersMapping, [key]: fullSlug } as Record<string, string>;\n\n return {\n headersMapping,\n properties: updatedProperties,\n }\n }, { headersMapping: {}, properties: {} });\n\n const firstKey = Object.keys(result.headersMapping)?.[0];\n let idColumn: string | undefined;\n if (firstKey?.includes(\"id\") || firstKey?.includes(\"key\")) {\n idColumn = firstKey;\n }\n\n return {\n ...result,\n idColumn\n };\n}\n","import * as React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n CircularProgressCenter,\n EntityCollection,\n ErrorView,\n isPropertyBuilder,\n MapProperty,\n mergeDeep,\n Properties,\n PropertiesOrBuilders,\n Property,\n PropertyConfig,\n PropertyOrBuilder,\n randomString,\n removeInitialAndTrailingSlashes,\n removeUndefined,\n TopNavigationResult,\n useAuthController,\n useCustomizationController,\n useNavigationController,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport {\n ArrowBackIcon,\n Button,\n cn,\n coolIconKeys,\n defaultBorderMixin,\n Dialog,\n DialogActions,\n DialogContent,\n DoneIcon,\n IconButton,\n LoadingButton,\n Tab,\n Tabs\n} from \"@firecms/ui\";\nimport { YupSchema } from \"./CollectionYupValidation\";\nimport { CollectionDetailsForm } from \"./CollectionDetailsForm\";\nimport { CollectionPropertiesEditorForm } from \"./CollectionPropertiesEditorForm\";\nimport { UnsavedChangesDialog } from \"./UnsavedChangesDialog\";\nimport { SubcollectionsEditTab } from \"./SubcollectionsEditTab\";\nimport { CollectionsConfigController } from \"../../types/config_controller\";\nimport { CollectionEditorWelcomeView } from \"./CollectionEditorWelcomeView\";\nimport { CollectionInference } from \"../../types/collection_inference\";\nimport { getInferenceType, ImportSaveInProgress, useImportConfig } from \"@firecms/data_import_export\";\nimport { buildEntityPropertiesFromData } from \"@firecms/schema_inference\";\nimport { CollectionEditorImportMapping } from \"./import/CollectionEditorImportMapping\";\nimport { CollectionEditorImportDataPreview } from \"./import/CollectionEditorImportDataPreview\";\nimport { cleanPropertiesFromImport } from \"./import/clean_import_data\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\nimport { Formex, FormexController, useCreateFormex } from \"../../form\";\nimport { getFullIdPath } from \"./util\";\n\nexport interface CollectionEditorDialogProps {\n open: boolean;\n isNewCollection: boolean;\n initialValues?: {\n group?: string,\n path?: string,\n name?: string,\n }\n editedCollectionId?: string;\n fullPath?: string; // full path of this particular collection, like `products/123/locales`\n parentCollectionIds?: string[]; // path ids of the parent collection, like [`products`]\n handleClose: (collection?: EntityCollection) => void;\n configController: CollectionsConfigController;\n reservedGroups?: string[];\n collectionInference?: CollectionInference;\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n pathSuggestions?: (path?: string) => Promise<string[]>;\n getUser: (uid: string) => User | null;\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n parentCollection?: PersistedCollection;\n}\n\nexport function CollectionEditorDialog(props: CollectionEditorDialogProps) {\n\n const open = props.open;\n\n const [formDirty, setFormDirty] = React.useState<boolean>(false);\n const [unsavedChangesDialogOpen, setUnsavedChangesDialogOpen] = React.useState<boolean>(false);\n\n const handleCancel = useCallback(() => {\n if (!formDirty) {\n props.handleClose(undefined);\n } else {\n setUnsavedChangesDialogOpen(true);\n }\n }, [formDirty, props.handleClose]);\n\n useEffect(() => {\n if (!open) {\n setFormDirty(false);\n setUnsavedChangesDialogOpen(false);\n }\n }, [open]);\n\n return (\n <Dialog\n open={open}\n fullWidth={true}\n fullHeight={true}\n scrollable={false}\n maxWidth={\"7xl\"}\n onOpenChange={(open) => !open ? handleCancel() : undefined}\n >\n {open && <CollectionEditor {...props}\n handleCancel={handleCancel}\n setFormDirty={setFormDirty}/>}\n\n <UnsavedChangesDialog\n open={unsavedChangesDialogOpen}\n handleOk={() => props.handleClose(undefined)}\n handleCancel={() => setUnsavedChangesDialogOpen(false)}\n body={\"There are unsaved changes in this collection\"}/>\n\n </Dialog>\n );\n}\n\ntype EditorView = \"welcome\"\n | \"details\"\n | \"import_data_mapping\"\n | \"import_data_preview\"\n | \"import_data_saving\"\n | \"properties\"\n | \"loading\"\n | \"extra_view\"\n | \"subcollections\";\n\nexport function CollectionEditor<M extends Record<string, any>>(props: CollectionEditorDialogProps & {\n handleCancel: () => void,\n setFormDirty: (dirty: boolean) => void\n}) {\n const { propertyConfigs } = useCustomizationController();\n const navigation = useNavigationController();\n const authController = useAuthController();\n\n const {\n topLevelNavigation,\n collections\n } = navigation;\n\n const initialValuesProp = props.initialValues;\n const includeTemplates = !initialValuesProp?.path && (props.parentCollectionIds ?? []).length === 0;\n const collectionsInThisLevel = (props.parentCollection ? props.parentCollection.subcollections : collections) ?? [];\n const existingPaths = collectionsInThisLevel.map(col => col.path.trim().toLowerCase());\n const existingIds = collectionsInThisLevel.map(col => col.id?.trim().toLowerCase()).filter(Boolean) as string[];\n const [collection, setCollection] = React.useState<PersistedCollection<M> | undefined>();\n const [initialLoadingCompleted, setInitialLoadingCompleted] = React.useState(false);\n\n useEffect(() => {\n try {\n if (navigation.initialised) {\n if (props.editedCollectionId) {\n setCollection(navigation.getCollectionFromPaths<PersistedCollection<M>>([...(props.parentCollectionIds ?? []), props.editedCollectionId]));\n } else {\n setCollection(undefined);\n }\n setInitialLoadingCompleted(true);\n }\n } catch (e) {\n console.error(e);\n }\n }, [navigation.getCollectionFromPaths, props.editedCollectionId, props.parentCollectionIds, navigation.initialised]);\n if (!topLevelNavigation) {\n throw Error(\"Internal: Navigation not ready in collection editor\");\n }\n\n const {\n groups\n }: TopNavigationResult = topLevelNavigation;\n\n const initialCollection = collection\n ? {\n ...collection,\n id: collection.id ?? collection.path ?? randomString(16)\n }\n : undefined;\n\n const initialValues: PersistedCollection<M> = initialCollection\n ? applyPropertyConfigs(initialCollection, propertyConfigs)\n : {\n id: initialValuesProp?.path ?? randomString(16),\n path: initialValuesProp?.path ?? \"\",\n name: initialValuesProp?.name ?? \"\",\n group: initialValuesProp?.group ?? \"\",\n properties: {} as PropertiesOrBuilders<M>,\n propertiesOrder: [],\n icon: coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)],\n ownerId: authController.user?.uid ?? \"\"\n };\n\n if (!initialLoadingCompleted) {\n return <CircularProgressCenter/>;\n }\n\n if (!props.isNewCollection && (!navigation.initialised || !initialLoadingCompleted)) {\n return <CircularProgressCenter/>;\n }\n\n return <CollectionEditorInternal\n {...props}\n initialValues={initialValues}\n existingPaths={existingPaths}\n existingIds={existingIds}\n includeTemplates={includeTemplates}\n collection={collection}\n setCollection={setCollection}\n groups={groups}\n propertyConfigs={propertyConfigs}/>\n\n}\n\nfunction CollectionEditorInternal<M extends Record<string, any>>({\n isNewCollection,\n configController,\n editedCollectionId,\n parentCollectionIds,\n fullPath,\n collectionInference,\n handleClose,\n reservedGroups,\n extraView,\n handleCancel,\n setFormDirty,\n pathSuggestions,\n getUser,\n parentCollection,\n getData,\n existingPaths,\n existingIds,\n includeTemplates,\n collection,\n setCollection,\n initialValues,\n propertyConfigs,\n groups\n }: CollectionEditorDialogProps & {\n handleCancel: () => void,\n setFormDirty: (dirty: boolean) => void,\n initialValues: PersistedCollection<M>,\n existingPaths: string[],\n existingIds: string[],\n includeTemplates: boolean,\n collection: PersistedCollection<M> | undefined,\n setCollection: (collection: PersistedCollection<M>) => void,\n propertyConfigs: Record<string, PropertyConfig<any>>,\n groups: string[],\n }\n) {\n\n const importConfig = useImportConfig();\n const navigation = useNavigationController();\n const snackbarController = useSnackbarController();\n\n // Use this ref to store which properties have errors\n const propertyErrorsRef = useRef({});\n\n const initialView = isNewCollection ? (includeTemplates ? \"welcome\" : \"details\") : \"properties\";\n const [currentView, setCurrentView] = useState<EditorView>(initialView); // this view can edit either the details view or the properties one\n\n const [error, setError] = React.useState<Error | undefined>();\n\n const saveCollection = (updatedCollection: PersistedCollection<M>): Promise<boolean> => {\n const id = updatedCollection.id || updatedCollection.path;\n return configController.saveCollection({\n id,\n collectionData: updatedCollection,\n previousId: editedCollectionId,\n parentCollectionIds\n })\n .then(() => {\n setError(undefined);\n return true;\n })\n .catch((e) => {\n setError(e);\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n };\n\n const setNextMode = useCallback(() => {\n if (currentView === \"details\") {\n if (importConfig.inUse) {\n setCurrentView(\"import_data_saving\");\n } else if (extraView) {\n setCurrentView(\"extra_view\");\n } else {\n setCurrentView(\"properties\");\n }\n } else if (currentView === \"welcome\") {\n setCurrentView(\"details\");\n } else if (currentView === \"import_data_mapping\") {\n setCurrentView(\"import_data_preview\");\n } else if (currentView === \"import_data_preview\") {\n setCurrentView(\"details\");\n } else if (currentView === \"extra_view\") {\n setCurrentView(\"properties\");\n } else {\n setCurrentView(\"details\");\n }\n\n }, [currentView, importConfig.inUse, extraView]);\n\n const doCollectionInference = useCallback((collection: PersistedCollection<any>) => {\n if (!collectionInference) return undefined;\n return collectionInference?.(collection.path, collection.collectionGroup ?? false, parentCollectionIds ?? []);\n }, [collectionInference, parentCollectionIds]);\n\n const inferCollectionFromData = useCallback(async (newCollection: PersistedCollection<M>) => {\n\n try {\n if (!doCollectionInference) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n\n setCurrentView(\"loading\");\n\n const inferredCollection = await doCollectionInference?.(newCollection);\n\n if (!inferredCollection) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n const values = {\n ...(newCollection ?? {})\n };\n\n if (Object.keys(inferredCollection.properties ?? {}).length > 0) {\n values.properties = inferredCollection.properties as PropertiesOrBuilders<M>;\n values.propertiesOrder = inferredCollection.propertiesOrder as Extract<keyof M, string>[];\n }\n\n if (!values.propertiesOrder) {\n values.propertiesOrder = Object.keys(values.properties) as Extract<keyof M, string>[];\n return values;\n }\n\n setCollection(values);\n console.debug(\"Inferred collection\", {\n newCollection: newCollection ?? {},\n values\n });\n return values;\n } catch (e: any) {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error inferring collection: \" + (e.message ?? \"Details in the console\")\n });\n return newCollection;\n }\n }, [parentCollectionIds, doCollectionInference]);\n\n const onSubmit = (newCollectionState: PersistedCollection<M>, formexController: FormexController<PersistedCollection<M>>) => {\n console.log(\"Submitting collection\", newCollectionState);\n try {\n\n if (!isNewCollection) {\n saveCollection(newCollectionState).then(() => {\n formexController.resetForm({ values: initialValues });\n // setNextMode();\n handleClose(newCollectionState);\n });\n return;\n }\n\n if (currentView === \"welcome\") {\n setNextMode();\n formexController.resetForm({ values: newCollectionState });\n } else if (currentView === \"details\") {\n if (extraView || importConfig.inUse) {\n formexController.resetForm({ values: newCollectionState });\n setNextMode();\n } else if (isNewCollection) {\n inferCollectionFromData(newCollectionState)\n .then((values) => {\n formexController.resetForm({\n values: values ?? newCollectionState,\n touched: {\n path: true,\n name: true\n }\n });\n }).finally(() => {\n setNextMode();\n });\n } else {\n formexController.resetForm({ values: newCollectionState });\n setNextMode();\n }\n } else if (currentView === \"extra_view\") {\n setNextMode();\n formexController.resetForm({ values: newCollectionState });\n } else if (currentView === \"import_data_mapping\") {\n setNextMode();\n } else if (currentView === \"import_data_preview\") {\n setNextMode();\n } else if (currentView === \"properties\") {\n saveCollection(newCollectionState).then(() => {\n formexController.resetForm({ values: initialValues });\n setNextMode();\n handleClose(newCollectionState);\n });\n } else {\n setNextMode();\n formexController.resetForm({ values: newCollectionState });\n }\n } catch (e: any) {\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e.message ?? \"Details in the console\")\n });\n console.error(e);\n formexController.resetForm({ values: newCollectionState });\n }\n };\n\n const validation = (col: PersistedCollection) => {\n\n let errors: Record<string, any> = {};\n const schema = (currentView === \"properties\" || currentView === \"subcollections\" || currentView === \"details\") && YupSchema;\n if (schema) {\n try {\n schema.validateSync(col, { abortEarly: false });\n } catch (e: any) {\n e.inner.forEach((err: any) => {\n errors[err.path] = err.message;\n });\n }\n }\n if (currentView === \"properties\") {\n errors = { ...errors, ...propertyErrorsRef.current };\n }\n if (currentView === \"details\") {\n const pathError = validatePath(col.path, isNewCollection, existingPaths, col.id);\n if (pathError) {\n errors.path = pathError;\n }\n const idError = validateId(col.id, isNewCollection, existingPaths, existingIds);\n if (idError) {\n errors.id = idError;\n }\n }\n return errors;\n };\n\n const formController = useCreateFormex<PersistedCollection<M>>({\n initialValues,\n onSubmit,\n validation\n });\n\n const {\n values,\n setFieldValue,\n isSubmitting,\n dirty,\n submitCount\n } = formController;\n\n const path = values.path ?? editedCollectionId;\n const updatedFullPath = fullPath?.includes(\"/\") ? fullPath?.split(\"/\").slice(0, -1).join(\"/\") + \"/\" + path : path; // TODO: this path is wrong\n const pathError = validatePath(path, isNewCollection, existingPaths, values.id);\n\n const parentPaths = !pathError && parentCollectionIds ? navigation.convertIdsToPaths(parentCollectionIds) : undefined;\n const resolvedPath = !pathError ? navigation.resolveAliasesFrom(updatedFullPath) : undefined;\n const getDataWithPath = resolvedPath && getData ? () => getData(resolvedPath, parentPaths ?? []) : undefined;\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n setFormDirty(dirty);\n }, [dirty]);\n\n function onImportDataSet(data: object[]) {\n importConfig.setInUse(true);\n buildEntityPropertiesFromData(data, getInferenceType)\n .then((properties) => {\n const res = cleanPropertiesFromImport(properties);\n\n setFieldValue(\"properties\", res.properties);\n setFieldValue(\"propertiesOrder\", Object.keys(res.properties));\n\n importConfig.setIdColumn(res.idColumn);\n importConfig.setImportData(data);\n importConfig.setHeadersMapping(res.headersMapping);\n importConfig.setOriginProperties(res.properties);\n });\n }\n\n const validValues = Boolean(values.name) && Boolean(values.id);\n\n const onImportMappingComplete = () => {\n const updatedProperties = { ...values.properties };\n if (importConfig.idColumn)\n delete updatedProperties[importConfig.idColumn];\n setFieldValue(\"properties\", updatedProperties);\n // setFieldValue(\"propertiesOrder\", Object.values(importConfig.headersMapping));\n setNextMode();\n };\n\n const editable = collection?.editable === undefined || collection?.editable === true;\n const collectionEditable = editable || isNewCollection;\n\n return <DialogContent fullHeight={true}>\n <Formex value={formController}>\n\n <>\n {!isNewCollection && <Tabs value={currentView}\n className={cn(defaultBorderMixin, \"justify-end bg-gray-50 dark:bg-gray-950 border-b\")}\n onValueChange={(v) => setCurrentView(v as EditorView)}>\n <Tab value={\"details\"}>\n Details\n </Tab>\n <Tab value={\"properties\"}>\n Properties\n </Tab>\n <Tab value={\"subcollections\"}>\n Additional views\n </Tab>\n </Tabs>}\n\n <form noValidate\n onSubmit={formController.submitForm}\n className={cn(\n isNewCollection ? \"h-full\" : \"h-[calc(100%-48px)]\",\n \"flex-grow flex flex-col relative\")}>\n\n {currentView === \"loading\" &&\n <CircularProgressCenter/>}\n\n {currentView === \"extra_view\" &&\n path &&\n extraView?.View &&\n <extraView.View path={path}/>}\n\n {currentView === \"welcome\" &&\n <CollectionEditorWelcomeView\n path={path}\n onContinue={(data) => {\n if (data) {\n onImportDataSet(data);\n setCurrentView(\"import_data_mapping\");\n } else {\n setCurrentView(\"details\");\n }\n }}\n existingCollectionPaths={existingPaths}\n parentCollection={parentCollection}\n pathSuggestions={pathSuggestions}/>}\n\n {currentView === \"import_data_mapping\" && importConfig &&\n <CollectionEditorImportMapping importConfig={importConfig}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>}\n\n {currentView === \"import_data_preview\" && importConfig &&\n <CollectionEditorImportDataPreview importConfig={importConfig}\n properties={values.properties as Properties}\n propertiesOrder={values.propertiesOrder as string[]}/>}\n\n {currentView === \"import_data_saving\" && importConfig &&\n <ImportSaveInProgress importConfig={importConfig}\n collection={values}\n onImportSuccess={(importedCollection) => {\n handleClose(importedCollection);\n snackbarController.open({\n type: \"info\",\n message: \"Data imported successfully\"\n });\n }}\n />}\n\n {currentView === \"details\" &&\n <CollectionDetailsForm\n existingPaths={existingPaths}\n existingIds={existingIds}\n groups={groups}\n parentCollectionIds={parentCollectionIds}\n parentCollection={parentCollection}\n isNewCollection={isNewCollection}/>}\n\n {currentView === \"subcollections\" && collection &&\n <SubcollectionsEditTab\n parentCollection={parentCollection}\n configController={configController}\n getUser={getUser}\n collectionInference={collectionInference}\n parentCollectionIds={parentCollectionIds}\n collection={collection}/>}\n\n {currentView === \"properties\" &&\n <CollectionPropertiesEditorForm\n showErrors={submitCount > 0}\n isNewCollection={isNewCollection}\n reservedGroups={reservedGroups}\n onPropertyError={(propertyKey, namespace, error) => {\n console.debug(\"!!!onPropertyError\", { propertyKey, namespace, error })\n const current = removeUndefined({\n ...propertyErrorsRef.current,\n [getFullIdPath(propertyKey, namespace)]: removeUndefined(error, true)\n }, true);\n console.debug(\"aa!!!onPropertyError\", { current })\n propertyErrorsRef.current = current;\n formController.validate();\n }}\n getUser={getUser}\n getData={getDataWithPath}\n doCollectionInference={doCollectionInference}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n extraIcon={extraView?.icon &&\n <IconButton\n color={\"primary\"}\n onClick={() => setCurrentView(\"extra_view\")}>\n {extraView.icon}\n </IconButton>}/>\n }\n\n {currentView !== \"welcome\" && <DialogActions\n position={\"absolute\"}>\n {error && <ErrorView error={error}/>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_mapping\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n importConfig.setInUse(false);\n return setCurrentView(\"welcome\");\n }}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_preview\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n saveCollection(values);\n setCurrentView(\"import_data_mapping\");\n }}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"details\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => setCurrentView(\"welcome\")}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && currentView === \"properties\" && <Button variant={\"text\"}\n type=\"button\"\n onClick={() => setCurrentView(\"details\")}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n <Button variant={\"text\"}\n onClick={() => {\n handleCancel();\n }}>\n Cancel\n </Button>\n\n {isNewCollection && currentView === \"import_data_mapping\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={onImportMappingComplete}\n >\n Next\n </Button>}\n\n {isNewCollection && currentView === \"import_data_preview\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={() => {\n setNextMode();\n }}\n >\n Next\n </Button>}\n\n {isNewCollection && (currentView === \"details\" || currentView === \"properties\") &&\n <LoadingButton\n variant={\"filled\"}\n color=\"primary\"\n type=\"submit\"\n loading={isSubmitting}\n disabled={isSubmitting || (currentView === \"details\" && !validValues)}\n startIcon={currentView === \"properties\"\n ? <DoneIcon/>\n : undefined}\n >\n {currentView === \"details\" && \"Next\"}\n {currentView === \"properties\" && \"Create collection\"}\n </LoadingButton>}\n\n {!isNewCollection && <LoadingButton\n variant=\"filled\"\n color=\"primary\"\n type=\"submit\"\n loading={isSubmitting}\n // disabled={isSubmitting || !dirty}\n >\n Update collection\n </LoadingButton>}\n\n </DialogActions>}\n </form>\n </>\n\n </Formex>\n\n </DialogContent>\n\n}\n\nfunction applyPropertyConfigs<M extends Record<string, any> = any>(collection: PersistedCollection<M>, propertyConfigs: Record<string, PropertyConfig<any>>): PersistedCollection<M> {\n const { properties, ...rest } = collection;\n const propertiesResult: PropertiesOrBuilders<any> = {};\n Object.keys(properties).forEach((key) => {\n propertiesResult[key] = applyPropertiesConfig(properties[key] as PropertyOrBuilder, propertyConfigs);\n });\n\n return { ...rest, properties: propertiesResult };\n}\n\nfunction applyPropertiesConfig(property: PropertyOrBuilder, propertyConfigs: Record<string, PropertyConfig<any>>) {\n let internalProperty = property;\n if (propertyConfigs && typeof internalProperty === \"object\" && internalProperty.propertyConfig) {\n const propertyConfig = propertyConfigs[internalProperty.propertyConfig];\n if (propertyConfig && isPropertyBuilder(propertyConfig.property)) {\n internalProperty = propertyConfig.property;\n } else {\n\n if (propertyConfig) {\n internalProperty = mergeDeep(propertyConfig.property, internalProperty);\n }\n\n if (!isPropertyBuilder(internalProperty) && internalProperty.dataType === \"map\" && internalProperty.properties) {\n const properties: Record<string, PropertyOrBuilder> = {};\n Object.keys(internalProperty.properties).forEach((key) => {\n properties[key] = applyPropertiesConfig(((internalProperty as MapProperty).properties as Properties)[key] as Property, propertyConfigs);\n });\n internalProperty = { ...internalProperty, properties };\n }\n\n }\n }\n return internalProperty;\n\n}\n\nconst validatePath = (value: string, isNewCollection: boolean, existingPaths: string[], idValue?: string) => {\n let error;\n if (!value) {\n error = \"You must specify a path in the database for this collection\";\n }\n // if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n // error = \"There is already a collection which uses this path as an id\";\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()) && !idValue)\n error = \"There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids\";\n\n const subpaths = removeInitialAndTrailingSlashes(value).split(\"/\");\n if (subpaths.length % 2 === 0) {\n error = `Collection paths must have an odd number of segments: ${value}`;\n }\n return error;\n};\n\nconst validateId = (value: string, isNewCollection: boolean, existingPaths: string[], existingIds: string[]) => {\n if (!value) return undefined;\n let error;\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection that uses this value as a path\";\n if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection which uses this id\";\n // if (error) {\n // setAdvancedPanelExpanded(true);\n // }\n return error;\n};\n","import React, { PropsWithChildren, useCallback, useEffect } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport {\n Property,\n useCustomizationController,\n useNavigationController,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport { CollectionEditorDialog } from \"./ui/collection_editor/CollectionEditorDialog\";\nimport { useNavigate } from \"react-router\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionEditorPermissionsBuilder } from \"./types/config_permissions\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { PropertyFormDialog } from \"./ui/collection_editor/PropertyEditView\";\nimport { PersistedCollection } from \"./types/persisted_collection\";\n\nexport const ConfigControllerContext = React.createContext<CollectionsConfigController>({} as any);\nexport const CollectionEditorContext = React.createContext<CollectionEditorController>({} as any);\n\nexport interface ConfigControllerProviderProps {\n /**\n * Controller for managing the collections' config.\n */\n collectionConfigController: CollectionsConfigController;\n\n /**\n * Callback used to infer the schema from the data.\n */\n collectionInference?: CollectionInference;\n\n /**\n * Use this builder to define the permissions for the configuration per user.\n */\n configPermissions?: CollectionEditorPermissionsBuilder;\n\n /**\n * Groups that cannot be used to create new collections.\n */\n reservedGroups?: string[];\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: (path?: string) => Promise<string[]>;\n\n getUser: (uid: string) => User | null\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n}\n\nexport const ConfigControllerProvider = React.memo(\n function ConfigControllerProvider({\n children,\n collectionConfigController,\n configPermissions,\n reservedGroups,\n collectionInference,\n extraView,\n pathSuggestions,\n getUser,\n getData,\n onAnalyticsEvent\n }: PropsWithChildren<ConfigControllerProviderProps>) {\n\n const navigation = useNavigationController();\n const navigate = useNavigate();\n const snackbarController = useSnackbarController();\n const { propertyConfigs } = useCustomizationController();\n\n const {\n collections\n } = navigation;\n const existingPaths = collections.map(col => col.path.trim().toLowerCase());\n\n const [rootPathSuggestions, setRootPathSuggestions] = React.useState<string[] | undefined>();\n useEffect(() => {\n if (pathSuggestions) {\n pathSuggestions().then((paths) => {\n setRootPathSuggestions(paths.filter(p => !existingPaths.includes(p.trim().toLowerCase())));\n });\n }\n }, [pathSuggestions]);\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n parentCollection?: PersistedCollection,\n editedCollectionId?: string,\n fullPath?: string,\n parentCollectionIds: string[],\n initialValues?: {\n path?: string,\n group?: string,\n name?: string\n },\n redirect: boolean\n }>();\n\n const [currentPropertyDialog, setCurrentPropertyDialog] = React.useState<{\n propertyKey?: string,\n property?: Property,\n namespace?: string,\n parentCollection?: PersistedCollection,\n currentPropertiesOrder?: string[],\n editedCollectionId: string,\n fullPath?: string,\n parentCollectionIds: string[],\n collectionEditable: boolean;\n }>();\n\n const defaultConfigPermissions: CollectionEditorPermissionsBuilder = useCallback(() => ({\n createCollections: true,\n editCollections: true,\n deleteCollections: true\n }), []);\n\n const editCollection = useCallback(({\n id,\n fullPath,\n parentCollectionIds,\n parentCollection\n }: {\n id?: string,\n fullPath?: string,\n parentCollectionIds: string[],\n parentCollection?: PersistedCollection\n }) => {\n console.debug(\"Edit collection\", id, fullPath, parentCollectionIds, parentCollection);\n onAnalyticsEvent?.(\"edit_collection\", { id, fullPath });\n setCurrentDialog({\n editedCollectionId: id,\n fullPath,\n parentCollectionIds,\n isNewCollection: false,\n parentCollection,\n redirect: false\n });\n }, []);\n\n const editProperty = useCallback(({\n propertyKey,\n property,\n editedCollectionId,\n currentPropertiesOrder,\n parentCollectionIds,\n collection\n }: {\n propertyKey?: string,\n property?: Property,\n currentPropertiesOrder?: string[],\n editedCollectionId: string,\n parentCollectionIds: string[],\n collection: PersistedCollection,\n }) => {\n console.debug(\"edit property\", propertyKey, property, editedCollectionId, currentPropertiesOrder, parentCollectionIds, collection);\n onAnalyticsEvent?.(\"edit_property\", { propertyKey, editedCollectionId });\n // namespace is all the path until the last dot\n const namespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(0, propertyKey.lastIndexOf(\".\"))\n : undefined;\n const propertyKeyWithoutNamespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(propertyKey.lastIndexOf(\".\") + 1)\n : propertyKey;\n setCurrentPropertyDialog({\n propertyKey: propertyKeyWithoutNamespace,\n property,\n namespace,\n currentPropertiesOrder,\n editedCollectionId: editedCollectionId,\n parentCollectionIds,\n collectionEditable: collection?.editable ?? false\n });\n }, []);\n\n const createCollection = React.useCallback(({\n parentCollectionIds,\n parentCollection,\n initialValues,\n redirect,\n sourceClick\n }: {\n parentCollectionIds: string[],\n parentCollection?: PersistedCollection\n initialValues?: {\n group?: string,\n path?: string,\n name?: string\n },\n redirect: boolean,\n sourceClick?: string\n }) => {\n console.debug(\"Create collection\", { parentCollectionIds, parentCollection, initialValues, redirect, sourceClick });\n onAnalyticsEvent?.(\"create_collection\", { parentCollectionIds, parentCollection, initialValues, redirect, sourceClick });\n setCurrentDialog({\n isNewCollection: true,\n parentCollectionIds,\n parentCollection,\n initialValues,\n redirect\n });\n }, []);\n\n const getPathSuggestions = !pathSuggestions\n ? undefined\n : (path?: string) => {\n if (!path && rootPathSuggestions)\n return Promise.resolve(rootPathSuggestions);\n else {\n return pathSuggestions?.(path);\n }\n }\n\n return (\n <ConfigControllerContext.Provider value={collectionConfigController}>\n <CollectionEditorContext.Provider\n value={{\n editCollection,\n createCollection,\n editProperty,\n configPermissions: configPermissions ?? defaultConfigPermissions,\n rootPathSuggestions\n }}>\n\n {children}\n\n <CollectionEditorDialog\n open={Boolean(currentDialog)}\n configController={collectionConfigController}\n isNewCollection={false}\n collectionInference={collectionInference}\n {...currentDialog}\n getData={getData}\n reservedGroups={reservedGroups}\n extraView={extraView}\n pathSuggestions={getPathSuggestions}\n getUser={getUser}\n handleClose={(collection) => {\n if (currentDialog?.redirect) {\n if (collection && currentDialog?.isNewCollection && !currentDialog.parentCollectionIds.length) {\n const url = navigation.buildUrlCollectionPath(collection.id ?? collection.path);\n navigate(url);\n }\n }\n setCurrentDialog(undefined);\n }}/>\n\n {/* Used for editing properties*/}\n <PropertyFormDialog\n open={Boolean(currentPropertyDialog)}\n includeIdAndName={true}\n existingProperty={Boolean(currentPropertyDialog?.propertyKey)}\n autoUpdateId={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}\n autoOpenTypeSelect={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}\n inArray={false}\n collectionEditable={currentPropertyDialog?.collectionEditable ?? false}\n getData={getData && currentPropertyDialog?.editedCollectionId\n ? () => {\n console.debug(\"get data for property\", currentPropertyDialog?.editedCollectionId);\n const resolvedPath = navigation.resolveAliasesFrom(currentPropertyDialog.editedCollectionId!)\n return getData(resolvedPath, []);\n }\n : undefined}\n onPropertyChanged={({\n id,\n property\n }) => {\n if (!currentPropertyDialog) return;\n if (!id) return;\n const newProperty = !(currentPropertyDialog.propertyKey);\n return collectionConfigController.saveProperty({\n path: currentPropertyDialog?.editedCollectionId,\n property,\n propertyKey: id,\n newPropertiesOrder: newProperty && currentPropertyDialog.currentPropertiesOrder ? [...currentPropertyDialog.currentPropertiesOrder, id] : undefined,\n namespace: currentPropertyDialog.namespace,\n parentCollectionIds: currentPropertyDialog.parentCollectionIds\n })\n .catch((e) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n }}\n onPropertyChangedImmediate={false}\n onDelete={() => {\n if (!currentPropertyDialog?.propertyKey) return;\n const newPropertiesOrder = currentPropertyDialog?.currentPropertiesOrder?.filter(p => p !== currentPropertyDialog?.propertyKey);\n return collectionConfigController.deleteProperty({\n path: currentPropertyDialog?.editedCollectionId,\n propertyKey: currentPropertyDialog?.propertyKey,\n namespace: currentPropertyDialog?.namespace,\n newPropertiesOrder,\n parentCollectionIds: currentPropertyDialog?.parentCollectionIds\n })\n .then(() => {\n setCurrentPropertyDialog(undefined);\n }).catch((e) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error deleting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n }}\n onError={() => {\n }}\n onOkClicked={() => {\n setCurrentPropertyDialog(undefined);\n }}\n onCancel={() => {\n setCurrentPropertyDialog(undefined);\n }}\n initialErrors={{}}\n forceShowErrors={false}\n existingPropertyKeys={[]}\n allowDataInference={true}\n propertyConfigs={propertyConfigs}\n property={currentPropertyDialog?.property}\n propertyKey={currentPropertyDialog?.propertyKey}/>\n\n </CollectionEditorContext.Provider>\n\n </ConfigControllerContext.Provider>\n );\n }, equal);\n","import { useContext } from \"react\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionEditorContext } from \"./ConfigControllerProvider\";\n\n/**\n * Hook to access the collection editor controller.\n * The methods in this controller can be used to open the collection editor dialog.\n */\nexport const useCollectionEditorController = (): CollectionEditorController => useContext(CollectionEditorContext);\n","import { useContext } from \"react\";\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport { ConfigControllerContext } from \"./ConfigControllerProvider\";\n\n/**\n * Use this hook to access the configuration controller.\n * You can use it to get the list of collections, and to save/delete collections.\n */\nexport const useCollectionsConfigController = (): CollectionsConfigController => useContext(ConfigControllerContext);\n","import equal from \"react-fast-compare\"\n\nimport {\n CollectionActionsProps,\n mergeDeep,\n useAuthController,\n useNavigationController,\n useSnackbarController\n} from \"@firecms/core\";\nimport { Button, IconButton, SaveIcon, SettingsIcon, Tooltip, UndoIcon, } from \"@firecms/ui\";\n\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { useCollectionsConfigController } from \"../useCollectionsConfigController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function EditorCollectionAction({\n path: fullPath,\n parentCollectionIds,\n collection,\n tableController\n }: CollectionActionsProps) {\n\n const authController = useAuthController();\n const navigationController = useNavigationController();\n const collectionEditorController = useCollectionEditorController();\n const configController = useCollectionsConfigController();\n const snackbarController = useSnackbarController();\n\n const parentCollection = navigationController.getCollectionFromIds(parentCollectionIds);\n\n const canEditCollection = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n collection\n }).editCollections\n : true;\n\n let saveDefaultFilterButton = null;\n if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.initialFilter)) ||\n !equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {\n saveDefaultFilterButton = <>\n {(collection.initialFilter || collection.initialSort) && <Tooltip\n title={\"Reset to default filter and sort\"}>\n <Button\n color={\"primary\"}\n size={\"small\"}\n variant={\"text\"}\n onClick={() => {\n tableController.clearFilter?.();\n if (collection?.initialFilter)\n tableController.setFilterValues?.(collection?.initialFilter);\n if (collection?.initialSort)\n tableController.setSortBy?.(collection?.initialSort);\n }}>\n <UndoIcon/>\n </Button>\n </Tooltip>}\n\n <Tooltip\n title={tableController.sortBy || tableController.filterValues ? \"Save default filter and sort\" : \"Clear default filter and sort\"}>\n <Button\n color={\"primary\"}\n size={\"small\"}\n variant={\"outlined\"}\n onClick={() => configController\n ?.saveCollection({\n id: collection.id,\n parentCollectionIds,\n collectionData: mergeDeep(collection as PersistedCollection,\n {\n initialFilter: tableController.filterValues ?? null,\n initialSort: tableController.sortBy ?? null\n })\n }).then(() => {\n snackbarController.open({\n type: \"success\",\n message: \"Default config saved\"\n });\n })}>\n <SaveIcon/>\n </Button>\n </Tooltip>\n </>;\n }\n\n const editorButton = <Tooltip\n title={canEditCollection ? \"Edit collection\" : \"You don't have permissions to edit this collection\"}>\n <IconButton\n color={\"primary\"}\n disabled={!canEditCollection}\n onClick={canEditCollection\n ? () => collectionEditorController?.editCollection({ id: collection.id, fullPath, parentCollectionIds, parentCollection: parentCollection as PersistedCollection })\n : undefined}>\n <SettingsIcon/>\n </IconButton>\n </Tooltip>;\n\n return <>\n {canEditCollection && saveDefaultFilterButton}\n {editorButton}\n </>\n\n}\n\nfunction getObjectOrNull(o?: object): object | null {\n if (o && Object.keys(o).length === 0)\n return o\n return o ?? null;\n}\n","import {\n DeleteConfirmationDialog,\n PluginHomePageActionsProps,\n useAuthController,\n useSnackbarController\n} from \"@firecms/core\";\nimport { DeleteIcon, IconButton, Menu, MenuItem, MoreVertIcon, SettingsIcon, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { useCallback, useState } from \"react\";\nimport { useCollectionsConfigController } from \"../useCollectionsConfigController\";\n\nexport function HomePageEditorCollectionAction({\n path,\n collection\n }: PluginHomePageActionsProps) {\n\n const snackbarController = useSnackbarController();\n const authController = useAuthController();\n const configController = useCollectionsConfigController();\n const collectionEditorController = useCollectionEditorController();\n\n const permissions = collectionEditorController.configPermissions({\n user: authController.user,\n collection\n });\n\n const onEditCollectionClicked = useCallback(() => {\n collectionEditorController?.editCollection({ id: collection.id, parentCollectionIds: [] });\n }, [collectionEditorController, path]);\n\n const [deleteRequested, setDeleteRequested] = useState(false);\n\n const deleteCollection = useCallback(() => {\n configController?.deleteCollection({ id: collection.id }).then(() => {\n setDeleteRequested(false);\n snackbarController.open({\n message: \"Collection deleted\",\n type: \"success\"\n });\n });\n }, [path, configController]);\n\n return <>\n\n <div>\n {permissions.deleteCollections &&\n <Menu\n trigger={<IconButton>\n <MoreVertIcon size={\"small\"}/>\n </IconButton>}\n >\n <MenuItem onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n setDeleteRequested(true);\n }}>\n <DeleteIcon/>\n Delete\n </MenuItem>\n\n </Menu>\n\n }\n\n {permissions.editCollections &&\n <IconButton\n onClick={(event) => {\n onEditCollectionClicked();\n }}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>}\n </div>\n\n <DeleteConfirmationDialog\n open={deleteRequested}\n onAccept={deleteCollection}\n onCancel={() => setDeleteRequested(false)}\n title={<>Delete this collection?</>}\n body={<> This will <b>not\n delete any data</b>, only\n the collection in the CMS</>}/>\n </>;\n\n}\n","import { PluginHomePageAdditionalCardsProps, useAuthController } from \"@firecms/core\";\nimport { AddIcon, Card, cn, Typography } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\n\nexport function NewCollectionCard({\n group,\n context\n }: PluginHomePageAdditionalCardsProps) {\n\n if (!context.navigation.topLevelNavigation)\n throw Error(\"Navigation not ready in FireCMSHomePage\");\n\n const authController = useAuthController();\n\n const collectionEditorController = useCollectionEditorController();\n const canCreateCollections = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n }).createCollections\n : true;\n\n return (\n <Card className={cn(\"h-full p-4 min-h-[124px]\")}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n initialValues: group ? { group } : undefined,\n parentCollectionIds: [],\n redirect: true,\n sourceClick: \"new_collection_card\"\n })\n : undefined}>\n\n <div\n className=\"flex flex-col items-start h-full w-full items-center justify-center h-full w-full flex-grow flex-col\">\n <AddIcon color=\"primary\" size={\"large\"}/>\n <Typography color=\"primary\"\n variant={\"caption\"}\n className={\"font-medium\"}>{\"Add new collection\".toUpperCase()}</Typography>\n\n {!canCreateCollections &&\n <Typography variant={\"caption\"}>You don&apos;t have permissions to create\n collections</Typography>\n }\n </div>\n\n </Card>\n );\n}\n","import { unslugify, useAuthController, useNavigationController } from \"@firecms/core\";\nimport { AddIcon, Chip, Collapse, Typography, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport React from \"react\";\n\nexport function RootCollectionSuggestions() {\n\n const authController = useAuthController();\n const navigationController = useNavigationController();\n\n const collectionEditorController = useCollectionEditorController();\n const canCreateCollections = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user\n }).createCollections\n : true;\n\n const rootPathSuggestions = collectionEditorController.rootPathSuggestions ?? [];\n\n const showSuggestions = rootPathSuggestions.length > 3 || (navigationController.collections.length === 0 && rootPathSuggestions.length > 0);\n return <Collapse\n in={showSuggestions}>\n\n <div\n className={\"flex flex-col gap-1 p-2 my-4\"}>\n\n <Typography variant={\"body2\"} color={\"secondary\"}>\n Create a collection from your data:\n </Typography>\n\n <div\n className={\"flex flex-row gap-1 overflow-scroll no-scrollbar \"}>\n {rootPathSuggestions.map((path) => {\n return (\n <div key={path}>\n <Chip\n icon={<AddIcon size={\"small\"}/>}\n colorScheme={\"cyanLighter\"}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n initialValues: { path, name: unslugify(path) },\n parentCollectionIds: [],\n redirect: true,\n sourceClick: \"root_collection_suggestion\"\n })\n : undefined}\n size=\"small\">\n {path}\n </Chip>\n </div>\n );\n })}\n </div>\n </div>\n </Collapse>\n}\n","import { ResolvedProperty } from \"@firecms/core\";\nimport { IconButton, SettingsIcon, Tooltip } from \"@firecms/ui\";\nimport React from \"react\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function CollectionViewHeaderAction({\n propertyKey,\n onHover,\n property,\n fullPath,\n parentCollectionIds,\n collection\n }: {\n property: ResolvedProperty,\n propertyKey: string,\n onHover: boolean,\n fullPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection;\n}) {\n\n const collectionEditorController = useCollectionEditorController();\n\n return (\n <Tooltip title={\"Edit\"}>\n <IconButton\n className={onHover ? \"bg-white dark:bg-gray-950\" : \"hidden\"}\n onClick={() => {\n collectionEditorController.editProperty({\n propertyKey,\n property,\n editedCollectionId: collection.id,\n parentCollectionIds,\n collection\n });\n }}\n size={\"small\"}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n )\n}\n","import { getDefaultPropertiesOrder, useAuthController } from \"@firecms/core\";\nimport { AddIcon, Tooltip } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function PropertyAddColumnComponent({\n fullPath,\n parentCollectionIds,\n collection\n }: {\n fullPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection;\n}) {\n\n const authController = useAuthController();\n const collectionEditorController = useCollectionEditorController();\n const canEditCollection = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n collection\n }).editCollections\n : true;\n\n return (\n <Tooltip title={canEditCollection ? \"Add new property\" : \"You don't have permission to add new properties\"}>\n <div\n className={\"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-gray-100 bg-opacity-40 hover:bg-gray-100 dark:bg-gray-950 dark:bg-opacity-40 dark:hover:bg-gray-950\"}\n // className={onHover ? \"bg-white dark:bg-gray-950\" : undefined}\n onClick={() => {\n collectionEditorController.editProperty({\n editedCollectionId: collection.id,\n parentCollectionIds,\n currentPropertiesOrder: getDefaultPropertiesOrder(collection),\n collection\n });\n }}>\n <AddIcon color={\"inherit\"}/>\n </div>\n </Tooltip>\n )\n}\n","import { AddIcon, Button } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\n\nexport function NewCollectionButton() {\n const collectionEditorController = useCollectionEditorController();\n return <Button className={\"min-w-fit\"}\n variant={\"outlined\"}\n onClick={() => collectionEditorController.createCollection({\n parentCollectionIds: [],\n redirect: true,\n sourceClick: \"new_collection_button\"\n })}>\n <AddIcon/>\n New collection\n </Button>\n}\n","import React from \"react\";\nimport {\n EntityCollection,\n FireCMSPlugin,\n joinCollectionLists,\n makePropertiesEditable,\n ModifyCollectionProps,\n Properties,\n User\n} from \"@firecms/core\";\nimport { ConfigControllerProvider } from \"./ConfigControllerProvider\";\nimport { CollectionEditorPermissionsBuilder } from \"./types/config_permissions\";\nimport { EditorCollectionAction } from \"./ui/EditorCollectionAction\";\nimport { HomePageEditorCollectionAction } from \"./ui/HomePageEditorCollectionAction\";\nimport { NewCollectionCard } from \"./ui/NewCollectionCard\";\nimport { PersistedCollection } from \"./types/persisted_collection\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport { RootCollectionSuggestions } from \"./ui/RootCollectionSuggestions\";\nimport { CollectionViewHeaderAction } from \"./ui/CollectionViewHeaderAction\";\nimport { PropertyAddColumnComponent } from \"./ui/PropertyAddColumnComponent\";\nimport { NewCollectionButton } from \"./ui/NewCollectionButton\";\n\nexport interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, UserType extends User = User> {\n\n /**\n * Firebase app where the configuration is saved.\n */\n collectionConfigController: CollectionsConfigController;\n\n modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | void;\n\n /**\n * Define what actions can be performed on the configuration.\n */\n configPermissions?: CollectionEditorPermissionsBuilder<UserType, EC>;\n\n /**\n * The words you define here will not be allowed to be used as group\n * names when creating collections.\n * e.g. [\"admin\"]\n */\n reservedGroups: string[];\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: (path: string) => Promise<string[]>;\n\n collectionInference?: CollectionInference;\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n getUser: (uid: string) => UserType | null;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n}\n\n/**\n * Use this hook to initialise the Collection Editor plugin.\n * This is likely the only hook you will need to use.\n * @param firebaseApp Firebase app where your project data lives.\n * @param configPermissions\n * @param reservedGroups\n * @param extraView\n * @param pathSuggestions\n * @param getUser\n * @param collectionInference\n */\nexport function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>\n({\n collectionConfigController,\n modifyCollection,\n configPermissions,\n reservedGroups,\n extraView,\n pathSuggestions,\n getUser,\n collectionInference,\n getData,\n onAnalyticsEvent\n }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection> {\n\n const injectCollections = (baseCollections: EntityCollection[]) => {\n\n const markAsEditable = (c: PersistedCollection) => {\n makePropertiesEditable(c.properties as Properties);\n c.subcollections?.forEach(markAsEditable);\n };\n const storedCollections = collectionConfigController.collections ?? [];\n storedCollections.forEach(markAsEditable);\n\n console.debug(\"Collections specified in code:\", baseCollections);\n console.debug(\"Collections stored in the backend\", storedCollections);\n const result = joinCollectionLists(baseCollections, storedCollections, [], modifyCollection);\n console.debug(\"Collections after joining:\", result);\n return result;\n };\n\n return {\n name: \"Collection Editor\",\n loading: collectionConfigController.loading,\n collections: {\n injectCollections,\n CollectionActions: EditorCollectionAction\n },\n provider: {\n Component: ConfigControllerProvider,\n props: {\n collectionConfigController,\n configPermissions,\n collectionInference,\n reservedGroups,\n extraView,\n pathSuggestions,\n getUser,\n getData,\n onAnalyticsEvent\n }\n },\n homePage: {\n additionalActions: <NewCollectionButton/>,\n additionalChildrenEnd: <RootCollectionSuggestions/>,\n CollectionActions: HomePageEditorCollectionAction,\n AdditionalCards: NewCollectionCard,\n },\n collectionView: {\n HeaderAction: CollectionViewHeaderAction,\n AddColumnComponent: PropertyAddColumnComponent\n }\n };\n}\n","import { ErrorView, unslugify, useNavigationController } from \"@firecms/core\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { Button } from \"@firecms/ui\";\n\nexport function MissingReferenceWidget({ path: pathProp }: {\n path: string\n}) {\n const navigation = useNavigationController();\n const path = getLastSegment(pathProp);\n const parentCollectionIds = navigation.getParentCollectionIds(pathProp);\n const collectionEditor = useCollectionEditorController();\n return <div className={\"p-1 flex flex-col items-center\"}>\n <ErrorView error={\"No collection for path: \" + path}/>\n <Button className={\"mx-2\"} variant={\"outlined\"} size={\"small\"}\n onClick={() => {\n collectionEditor.createCollection({\n initialValues: { path, name: unslugify(path) },\n parentCollectionIds,\n redirect: false,\n sourceClick: \"missing_reference\"\n });\n }}>\n Create\n </Button>\n </div>;\n}\n\nfunction getParentPathSegments(path: string): string[] {\n const segments = path.split(\"/\");\n return segments.filter((segment, index) => index % 2 === 0 && index !== segments.length - 1);\n}\n\nfunction getLastSegment(path: string): string {\n const segments = path.split(\"/\");\n return segments[segments.length - 1];\n}\n"],"names":["YupSchema","Yup","FieldHelperView","error","children","jsx","Typography","FormexContext","React","useFormex","useContext","Formex","isFunction","obj","isObject","isInteger","getIn","key","def","p","path","toPath","setIn","value","res","clone","resVal","i","pathArray","currentPath","currentObj","nextPath","Field","validate","name","is","className","props","formex","field","getFieldProps","asElement","innerRef","rest","nameOrOptions","isAnObject","valueState","type","valueProp","multiple","useCreateFormex","initialValues","initialErrors","validation","validateOnChange","onSubmit","validateOnInitialRender","valuesRef","values","setValuesInner","useState","touchedState","setTouchedState","errors","setErrors","dirty","setDirty","submitCount","setSubmitCount","isSubmitting","setIsSubmitting","useEffect","setValues","newValues","validationErrors","setFieldValue","shouldValidate","setFieldError","newErrors","setFieldTouched","touched","newTouched","controller","event","target","e","controllerRef","valuesProp","errorsProp","touchedProp","CollectionDetailsForm","isNewCollection","reservedGroups","existingPaths","existingIds","groups","parentCollection","groupRef","handleChange","iconDialogOpen","setIconDialogOpen","advancedPanelExpanded","setAdvancedPanelExpanded","updateName","toSnakeCase","singular","collectionIcon","IconForView","groupOptions","group","inputFocused","autoCompleteOpen","setAutoCompleteOpen","useAutoComplete","isSubcollection","customIdValue","Container","jsxs","Tooltip","IconButton","Chip","TextField","cn","DebouncedTextField","Autocomplete","index","AutocompleteItem","ExpandablePanel","SettingsIcon","Select","SelectItem","v","BooleanSwitchWithLabel","Dialog","SearchIconsView","icon","idToPropertiesPath","id","namespaceToPropertiesPath","namespace","namespaceToPropertiesOrderPath","getFullId","propertyKey","propertyNamespace","getFullIdPath","keyWithNamespace","EnumForm","enumValues","onValuesChanged","onError","updateIds","disabled","allowDataInference","getData","enumValue","hasError","EnumFormFields","enumValuesPath","shouldUpdateId","lastInternalIdAdded","setLastInternalIdAdded","editDialogIndex","setEditDialogIndex","inferring","setInferring","inferredValues","buildEntry","internalId","justAdded","entryError","EnumEntry","ListIcon","Button","data","flatData","fieldData","currentEnumValues","newEnumValues","extractEnumFromValues","CircularProgress","AutoAwesomeIcon","Paper","ArrayContainer","EnumEntryDialog","updateId","autoFocus","onDialogOpen","inferredEntry","shouldUpdateIdRef","idValue","labelValue","currentLabelRef","Fragment","Badge","prevProps","nextProps","equal","open","onClose","idError","DialogContent","DialogActions","SwitchControl","form","label","tooltip","size","allowIndeterminate","formControlLabel","checked","GeneralPropertyValidation","validationRequired","validationRequiredMessage","StringPropertyValidation","length","lowercase","matches","max","min","trim","uppercase","showErrors","validationLength","validationMin","validationMax","validationTrim","validationMatches","validationLowercase","validationUppercase","matchesError","matchesValue","matchesStringValue","serializeRegExp","ArrayPropertyValidation","ValidationPanel","RuleIcon","EnumPropertyField","multiselect","snackbarContext","useSnackbarController","defaultValue","valuesEnumValues","useMemo","resolveEnumValues","d","enumIds","fileTypes","StoragePropertyField","existing","baseStoragePath","acceptedFiles","fileName","storagePath","storeUrl","fileNameValue","storagePathValue","storedValue","fileTypesValue","allFileTypesSelected","handleTypesChange","hasFilenameCallback","hasStoragePathCallback","FileUploadIcon","MultiSelect","selected","MultiSelectItem","Checkbox","editableProperty","property","isPropertyBuilder","eProperty","removeNonEditableProperties","properties","_","propertyOrBuilder","a","b","PropertyFieldPreview","onClick","includeName","includeEditButton","propertyConfigs","useCustomizationController","propertyConfig","getFieldConfig","borderColorClass","ErrorBoundary","PropertyConfigBadge","cardMixin","cardClickableMixin","cardSelectedMixin","NonEditablePropertyPreview","FunctionsIcon","RemoveCircleIcon","PropertyTree","selectedPropertyKey","onPropertyClick","propertiesOrderProp","additionalFields","onPropertyMove","onPropertyRemove","inferredPropertyKeys","collectionEditable","propertiesOrder","onDragEnd","useCallback","result","startIndex","endIndex","newPropertiesOrder","removed","DragDropContext","Droppable","droppableProvided","droppableSnapshot","additionalField","Draggable","provided","snapshot","PropertyTreeEntry","isSelected","wasSelected","isPropertyInferred","fullId","subtree","editable","defaultBorderMixin","RemoveIcon","DragHandleIcon","MapPropertyField","propertyDialogOpen","setPropertyDialogOpen","setSelectedPropertyKey","selectedPropertyNamespace","setSelectedPropertyNamespace","onPropertyCreated","deleteProperty","propertiesPath","propertiesOrderPath","currentPropertiesOrder","selectedPropertyFullId","selectedProperty","addChildButton","AddIcon","empty","PropertyFormDialog","RepeatPropertyField","ofProperty","ofPropertyError","onPropertyChanged","widget","CommonPropertyFields","disabledId","autoUpdateId","isNewProperty","ref","nameError","description","descriptionError","newNameValue","newIdValue","unslugify","StringPropertyField","widgetId","BooleanPropertyField","BlockPropertyField","NumberPropertyValidation","validationLessThan","validationMoreThan","validationPositive","validationNegative","validationInteger","NumberPropertyField","ReferencePropertyField","useNavigationController","pathPath","pathValue","pathError","CollectionsSelect","navigation","collections","ungroupedCollections","col","selectedCollection","collection","SelectGroup","DateTimePropertyField","modePath","modeValue","modeError","autoValuePath","autoValueValue","autoValueError","AdvancedPropertyValidation","KeyValuePropertyField","updatePropertyFromWidget","propertyData","selectedWidgetId","updatedProperty","mergeDeep","PropertySelectItem","optionDisabled","UrlPropertyField","urlValue","supportedFieldsIds","supportedFields","DEFAULT_FIELD_CONFIGS","config","PropertyForm","includeIdAndName","autoOpenTypeSelect","existingProperty","inArray","existingPropertyKeys","onPropertyChangedImmediate","onDelete","forceShowErrors","getController","initialValue","lastSubmittedProperty","useRef","doOnPropertyChanged","params","formexController","newPropertyWithId","validateName","validateId","isValidRegExp","PropertyEditFormFields","onCancel","onOkClicked","formProps","formexRef","helpers","includeIdAndTitle","selectOpen","setSelectOpen","deleteDialogOpen","setDeleteDialogOpen","selectedFieldConfigId","setSelectedFieldConfigId","getFieldId","allSupportedFields","displayedWidgets","deferredValues","useDeferredValue","nameFieldRef","selectedWidgetError","onWidgetSelectChanged","newSelectedWidgetId","childComponent","InfoLabel","baseProperty","baseFieldConfig","computedFieldConfig","DeleteIcon","DeleteConfirmationDialog","idRegEx","camelCase","str","cur","acc","GetCodeDialog","onOpenChange","snackbarController","code","JSON5","collectionToCode","Highlight","themes","style","tokens","getLineProps","getTokenProps","line","token","ContentCopyIcon","propertyCleanup","CollectionPropertiesEditorForm","propertyErrorsRef","onPropertyError","extraIcon","getUser","doCollectionInference","largeLayout","useLargeLayout","asDialog","selectedPropertyIndex","setSelectedPropertyIndex","codeDialogOpen","setCodeDialogOpen","inferringProperties","setInferringProperties","newPropertyDialogOpen","setNewPropertyDialogOpen","setInferredPropertyKeys","currentPropertiesOrderRef","inferPropertiesFromData","newCollection","makePropertiesEditable","newPropertyKeys","updatedProperties","updatedPropertiesOrder","updatePropertiesOrder","getCurrentPropertiesOrder","previousId","propertyPath","previousFullId","previousPropertyPath","onPropertyErrorInternal","closePropertyDialog","emptyCollection","usedPropertiesOrder","owner","body","CodeIcon","UnsavedChangesDialog","handleOk","handleCancel","title","EntityCustomViewsSelectDialog","entityViews","view","SubcollectionsEditTab","configController","collectionInference","parentCollectionIds","contextEntityViews","subcollectionToDelete","setSubcollectionToDelete","addEntityViewDialogOpen","setAddEntityViewDialogOpen","viewToDelete","setViewToDelete","currentDialog","setCurrentDialog","subcollections","resolvedEntityViews","resolveEntityView","hardCodedEntityViews","totalEntityViews","Table","TableBody","subcollection","TableRow","TableCell","Alert","CollectionEditorDialog","selectedViewKey","productsCollectionTemplate","blogCollectionTemplate","usersCollectionTemplate","pagesCollectionTemplate","CollectionEditorWelcomeView","pathSuggestions","onContinue","existingCollectionPaths","loadingPathSuggestions","setLoadingPathSuggestions","filteredPathSuggestions","setFilteredPathSuggestions","suggestions","filteredSuggestions","s","c","suggestion","TemplateButton","Icon","ImportFileUpload","subtitle","Card","CollectionEditorImportMapping","importConfig","setSelectedProperty","newHeadersMapping","onPropertyTypeChanged","importKey","inferredNewProperty","buildPropertyFromData","getInferenceType","DataNewPropertiesMapping","ImportNewPropertyFieldPreview","PropertySelect","fieldId","newProperty","CollectionEditorImportDataPreview","propertiesMapping","getPropertiesMapping","mappedData","convertDataToEntity","selectionController","useSelectionController","EntityCollectionTable","cleanPropertiesFromImport","parentSlug","slug","slugify","fullSlug","slugifiedResult","firstKey","idColumn","formDirty","setFormDirty","unsavedChangesDialogOpen","setUnsavedChangesDialogOpen","CollectionEditor","authController","useAuthController","topLevelNavigation","initialValuesProp","includeTemplates","collectionsInThisLevel","setCollection","initialLoadingCompleted","setInitialLoadingCompleted","initialCollection","randomString","applyPropertyConfigs","coolIconKeys","CircularProgressCenter","CollectionEditorInternal","editedCollectionId","fullPath","handleClose","extraView","useImportConfig","initialView","currentView","setCurrentView","setError","saveCollection","updatedCollection","setNextMode","inferCollectionFromData","inferredCollection","formController","newCollectionState","schema","err","validatePath","updatedFullPath","parentPaths","resolvedPath","getDataWithPath","onImportDataSet","buildEntityPropertiesFromData","validValues","onImportMappingComplete","Tabs","Tab","ImportSaveInProgress","importedCollection","current","removeUndefined","ErrorView","ArrowBackIcon","LoadingButton","DoneIcon","propertiesResult","applyPropertiesConfig","internalProperty","removeInitialAndTrailingSlashes","ConfigControllerContext","CollectionEditorContext","ConfigControllerProvider","collectionConfigController","configPermissions","onAnalyticsEvent","navigate","useNavigate","rootPathSuggestions","setRootPathSuggestions","paths","currentPropertyDialog","setCurrentPropertyDialog","defaultConfigPermissions","editCollection","editProperty","propertyKeyWithoutNamespace","createCollection","redirect","sourceClick","getPathSuggestions","url","useCollectionEditorController","useCollectionsConfigController","EditorCollectionAction","tableController","navigationController","collectionEditorController","canEditCollection","saveDefaultFilterButton","getObjectOrNull","UndoIcon","SaveIcon","o","HomePageEditorCollectionAction","permissions","onEditCollectionClicked","deleteRequested","setDeleteRequested","deleteCollection","Menu","MoreVertIcon","MenuItem","NewCollectionCard","context","canCreateCollections","RootCollectionSuggestions","showSuggestions","Collapse","CollectionViewHeaderAction","onHover","PropertyAddColumnComponent","getDefaultPropertiesOrder","NewCollectionButton","useCollectionEditorPlugin","modifyCollection","injectCollections","baseCollections","markAsEditable","storedCollections","joinCollectionLists","MissingReferenceWidget","pathProp","getLastSegment","collectionEditor","segments"],"mappings":";;;;;;;;;;;;;AAEO,MAAMA,KAAYC,GAAI,OAAO,EAAE,MAAM;AAAA,EACxC,IAAIA,GAAI,SAAS,SAAS,UAAU;AAAA,EACpC,MAAMA,GAAI,SAAS,SAAS,UAAU;AAAA,EACtC,MAAMA,GAAI,SAAS,SAAS,UAAU;AAC1C,CAAC;ACJM,SAASC,GAAgB;AAAA,EACI,OAAAC;AAAA,EACA,UAAAC;AACJ,GAAoD;AAChF,SAAKA,IAED,gBAAAC,EAACC,GAAW,EAAA,SAAS,WAAW,OAAOH,IAAQ,UAAU,aAAa,WAAW,iBAC5E,UAAAC,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