@firecms/collection_editor 3.0.0-canary.2 → 3.0.0-canary.21

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 (28) hide show
  1. package/dist/index.es.js +390 -397
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.umd.js +2 -2
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/types/persisted_collection.d.ts +1 -1
  6. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +1 -1
  7. package/dist/ui/collection_editor/utils/supported_fields.d.ts +2 -2
  8. package/package.json +18 -18
  9. package/src/ConfigControllerProvider.tsx +1 -1
  10. package/src/types/persisted_collection.ts +1 -1
  11. package/src/ui/MissingReferenceWidget.tsx +2 -1
  12. package/src/ui/NewCollectionButton.tsx +12 -10
  13. package/src/ui/collection_editor/CollectionDetailsForm.tsx +17 -18
  14. package/src/ui/collection_editor/CollectionEditorDialog.tsx +13 -9
  15. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +1 -1
  16. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +1 -1
  17. package/src/ui/collection_editor/EnumForm.tsx +3 -4
  18. package/src/ui/collection_editor/PropertyEditView.tsx +4 -4
  19. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +1 -1
  20. package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +7 -8
  21. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +7 -8
  22. package/src/ui/collection_editor/properties/MapPropertyField.tsx +3 -4
  23. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +3 -4
  24. package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +3 -4
  25. package/src/ui/collection_editor/utils/supported_fields.tsx +3 -3
  26. package/src/useCollectionEditorPlugin.tsx +2 -4
  27. package/dist/ui/collection_editor/properties/FieldHelperView.d.ts +0 -4
  28. package/src/ui/collection_editor/properties/FieldHelperView.tsx +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.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/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, { 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 { Field, getIn, useFormex } from \"@firecms/formex\";\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 (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 const showErrors = submitCount > 0;\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={showErrors && 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={showErrors && 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={showErrors && 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 {showErrors && 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={showErrors && 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={showErrors && Boolean(errors.singularName)}\n name={\"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={showErrors && Boolean(errors.singularName)}>\n {showErrors && 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={showErrors && Boolean(errors.description)}\n name=\"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={showErrors && Boolean(errors.description)}>\n {showErrors && 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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\nimport { 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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 = ({\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\n const currentPropertiesOrder = values.propertiesOrder ?? Object.keys(values.properties ?? {});\n const newPropertiesOrder = currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id];\n setFieldValue(\"propertiesOrder\", newPropertiesOrder, false);\n\n setPropertyDialogOpen(false);\n };\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 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 <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 </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, { useState } from \"react\";\nimport { ArrayProperty, getFieldConfig, Property, PropertyConfig } from \"@firecms/core\";\nimport { Button, Paper, Typography } from \"@firecms/ui\";\nimport { Field, getIn, useFormex } from \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 onPropertyChanged = ({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n\n setFieldValue(\"oneOf.properties\", {\n ...(values.oneOf?.properties ?? {}),\n [id]: property\n }, false);\n const currentPropertiesOrder = values.oneOf?.propertiesOrder ?? Object.keys(values.oneOf?.properties ?? {});\n const newPropertiesOrder = currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id];\n setFieldValue(\"oneOf.propertiesOrder\", newPropertiesOrder, false);\n setPropertyDialogOpen(false);\n };\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={onPropertyChanged}\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 && Boolean(pathValue)) || disabled}\n value={pathValue}\n error={pathError}\n handleChange={handleChange}\n as={CollectionsSelect}/>\n\n </div>\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 autoComplete={\"off\"}\n onSubmit={(e) => {\n e.preventDefault();\n e.stopPropagation();\n formexRef.current?.handleSubmit(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, useFormex } from \"@firecms/formex\";\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?: 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 {\n [key: string]: PropertyOrBuilder\n }),\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\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 console.debug(\"onPropertyChanged, id change\", {\n id,\n property,\n previousId,\n namespace\n })\n\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 <div className={\"w-full flex flex-col items-center justify-center h-full gap-4\"}>\n <Typography variant={\"label\"} className=\"\">\n {emptyCollection\n ? \"Now you can add your first property\"\n : \"Select a property to edit it\"}\n </Typography>\n <Button variant={\"outlined\"}\n onClick={() => setNewPropertyDialogOpen(true)}\n >\n <AddIcon/>\n Add new property\n </Button>\n </div>}\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 \"@firecms/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 editedCollectionId?: 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 <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n {subcollections && subcollections.length > 0 && <Table>\n <TableBody>\n {subcollections.map((subcollection) => (\n <TableRow key={subcollection.path}\n onClick={() => setCurrentDialog({\n isNewCollection: false,\n editedCollectionId: subcollection.id\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\n <Button\n onClick={() => {\n setCurrentDialog({\n isNewCollection: true\n });\n }}\n variant={\"text\"}\n startIcon={<AddIcon/>}>\n Add subcollection\n </Button>\n\n </Paper>\n\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 <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 them with the CLI.\n </Alert>\n }\n\n {<>\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\n <Button\n onClick={() => {\n setAddEntityViewDialogOpen(true);\n }}\n variant={\"text\"}\n startIcon={<AddIcon/>}>\n Add custom entity view\n </Button>\n </Paper>\n\n </>}\n\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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\"}>\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 \"@firecms/formex\";\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 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 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.handleSubmit}\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={(importData) => {\n if (importData) {\n onImportDataSet(importData);\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={async (importedCollection) => {\n snackbarController.open({\n type: \"info\",\n message: \"Data imported successfully\"\n });\n await saveCollection(values);\n handleClose(importedCollection);\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 const current = removeUndefined({\n ...propertyErrorsRef.current,\n [getFullIdPath(propertyKey, namespace)]: removeUndefined(error, true)\n }, true);\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 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 >\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, CircularProgress, Collapse, Typography, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport React from \"react\";\n\nexport function RootCollectionSuggestions({ introMode }: { introMode?: \"new_project\" | \"existing_project\" }) {\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 const forceShowSuggestions = introMode === \"existing_project\";\n return <Collapse\n in={forceShowSuggestions || showSuggestions}>\n\n <div\n className={\"flex flex-col gap-1 p-2 my-4\"}>\n\n {!introMode && <Typography variant={\"body2\"} color={\"secondary\"}>\n Create a collection <b>automatically</b> from your data:\n </Typography>}\n\n {introMode === \"existing_project\" && <Typography>\n You will see your <b>database collections</b> here, a few seconds after project creation\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 {rootPathSuggestions === undefined && <CircularProgress size={\"small\"}/>}\n {rootPathSuggestions?.length === 0 && <Typography variant={\"caption\"}>No suggestions</Typography>}\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 { FireCMSPlugin, useAuthController, useNavigationController, User } 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\";\nimport { AddIcon, Button, Typography } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"./useCollectionEditorController\";\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 /**\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 introMode?: \"new_project\" | \"existing_project\";\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 introMode,\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 return {\n name: \"Collection Editor\",\n loading: collectionConfigController.loading,\n collections: {\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 additionalChildrenStart: introMode ? <IntroWidget introMode={introMode}/> : undefined,\n additionalChildrenEnd: <RootCollectionSuggestions introMode={introMode}/>,\n CollectionActions: HomePageEditorCollectionAction,\n AdditionalCards: introMode ? undefined : NewCollectionCard,\n },\n collectionView: {\n HeaderAction: CollectionViewHeaderAction,\n AddColumnComponent: PropertyAddColumnComponent\n }\n };\n}\n\nexport function IntroWidget({ introMode }: {\n introMode?: \"new_project\" | \"existing_project\";\n}) {\n\n const navigation = useNavigationController();\n if (!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 <div className={\"mt-8 flex flex-col mt-8 p-2\"}>\n <Typography variant={\"h4\"} className=\"mb-4\">Welcome</Typography>\n <Typography paragraph={true}>Your admin panel is ready ✌️</Typography>\n <Typography paragraph={true}>\n Start building collections in FireCMS easily. Map them to your existing\n database data, import from files, or use our templates. Simplify your data management process\n now.\n </Typography>\n {canCreateCollections && <Button\n className={\"mt-4\"}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n parentCollectionIds: [],\n redirect: true,\n sourceClick: \"new_collection_card\"\n })\n : undefined}>\n <AddIcon/>Create your first collection\n </Button>}\n </div>\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","CollectionDetailsForm","isNewCollection","reservedGroups","existingPaths","existingIds","groups","parentCollection","groupRef","React","values","setFieldValue","handleChange","touched","errors","setFieldTouched","isSubmitting","submitCount","useFormex","iconDialogOpen","setIconDialogOpen","useState","advancedPanelExpanded","setAdvancedPanelExpanded","updateName","name","getIn","toSnakeCase","singular","useEffect","collectionIcon","IconForView","groupOptions","group","inputFocused","autoCompleteOpen","setAutoCompleteOpen","useAutoComplete","isSubcollection","customIdValue","showErrors","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","getFullIdPath","keyWithNamespace","EnumForm","enumValues","onValuesChanged","onError","updateIds","disabled","allowDataInference","getData","formex","useCreateFormex","enumValue","hasError","Formex","EnumFormFields","enumValuesPath","shouldUpdateId","lastInternalIdAdded","setLastInternalIdAdded","editDialogIndex","setEditDialogIndex","inferring","setInferring","inferredValues","buildEntry","internalId","justAdded","entryError","EnumEntry","inferValues","data","flatData","fieldData","currentEnumValues","newEnumValues","extractEnumFromValues","ListIcon","Button","CircularProgress","AutoAwesomeIcon","Paper","ArrayContainer","EnumEntryDialog","updateId","autoFocus","onDialogOpen","inferredEntry","shouldUpdateIdRef","idValue","labelValue","currentLabelRef","Fragment","Badge","prevProps","nextProps","equal","open","onClose","idError","DialogContent","DialogActions","SwitchControl","field","form","label","tooltip","size","allowIndeterminate","formControlLabel","checked","GeneralPropertyValidation","validationRequired","validationRequiredMessage","StringPropertyValidation","length","lowercase","matches","max","min","trim","uppercase","validationLength","validationMin","validationMax","validationTrim","validationMatches","validationLowercase","validationUppercase","matchesError","matchesValue","matchesStringValue","serializeRegExp","ArrayPropertyValidation","ValidationPanel","RuleIcon","EnumPropertyField","multiselect","setFieldError","snackbarContext","useSnackbarController","defaultValue","valuesEnumValues","useMemo","resolveEnumValues","enumIds","res","d","fileTypes","StoragePropertyField","multiple","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","_","key","propertyOrBuilder","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","className","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","currentPropertiesOrder","deleteProperty","propertiesPath","propertiesOrderPath","p","selectedPropertyFullId","selectedProperty","empty","AddIcon","PropertyFormDialog","RepeatPropertyField","ofProperty","ofPropertyError","onPropertyChanged","widget","CommonPropertyFields","disabledId","autoUpdateId","isNewProperty","ref","validate","nameError","description","descriptionError","newNameValue","newIdValue","unslugify","StringPropertyField","widgetId","BooleanPropertyField","BlockPropertyField","addChildButton","NumberPropertyValidation","validationLessThan","validationMoreThan","NumberPropertyField","ReferencePropertyField","useNavigationController","pathPath","pathValue","pathError","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","a","PropertyForm","includeIdAndName","autoOpenTypeSelect","existingProperty","inArray","existingPropertyKeys","onPropertyChangedImmediate","onDelete","initialErrors","forceShowErrors","getController","initialValue","lastSubmittedProperty","useRef","doOnPropertyChanged","params","formexController","newPropertyWithId","controller","validateName","validateId","isValidRegExp","PropertyEditFormFields","onCancel","onOkClicked","formProps","formexRef","helpers","setValues","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","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","Alert","CollectionEditorDialog","selectedViewKey","productsCollectionTemplate","blogCollectionTemplate","usersCollectionTemplate","pagesCollectionTemplate","CollectionEditorWelcomeView","path","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","initialValues","applyPropertyConfigs","coolIconKeys","CircularProgressCenter","CollectionEditorInternal","editedCollectionId","fullPath","handleClose","extraView","useImportConfig","initialView","currentView","setCurrentView","setError","saveCollection","updatedCollection","setNextMode","inferCollectionFromData","inferredCollection","onSubmit","newCollectionState","validation","schema","err","validatePath","formController","updatedFullPath","parentPaths","resolvedPath","getDataWithPath","onImportDataSet","buildEntityPropertiesFromData","validValues","onImportMappingComplete","Tabs","Tab","importData","ImportSaveInProgress","importedCollection","current","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","sourceClick","getPathSuggestions","url","useCollectionEditorController","useContext","useCollectionsConfigController","EditorCollectionAction","tableController","navigationController","collectionEditorController","canEditCollection","saveDefaultFilterButton","getObjectOrNull","UndoIcon","SaveIcon","editorButton","o","HomePageEditorCollectionAction","permissions","onEditCollectionClicked","deleteRequested","setDeleteRequested","deleteCollection","Menu","MoreVertIcon","MenuItem","NewCollectionCard","context","canCreateCollections","RootCollectionSuggestions","introMode","showSuggestions","forceShowSuggestions","Collapse","CollectionViewHeaderAction","onHover","PropertyAddColumnComponent","getDefaultPropertiesOrder","NewCollectionButton","useCollectionEditorPlugin","IntroWidget","MissingReferenceWidget","pathProp","getLastSegment","collectionEditor","segments"],"mappings":"ywCAEaA,GAAYC,GAAI,OAAO,EAAE,MAAM,CACxC,GAAIA,GAAI,SAAS,SAAS,UAAU,EACpC,KAAMA,GAAI,SAAS,SAAS,UAAU,EACtC,KAAMA,GAAI,SAAS,SAAS,UAAU,CAC1C,CAAC,ECJM,SAASC,EAAgB,CACI,MAAAC,EACA,SAAAC,CACJ,EAAoD,CAChF,OAAKA,EAEDC,EAAA,IAACC,EAAW,WAAA,CAAA,QAAS,UAAW,MAAOH,EAAQ,QAAU,YAAa,UAAW,gBAC5E,SAAAC,CACL,CAAA,EAJkB,IAM1B,CCaO,SAASG,GAAsB,CACI,gBAAAC,EACA,eAAAC,EACA,cAAAC,EACA,YAAAC,EACA,OAAAC,EACA,iBAAAC,CACJ,EAQnC,CAEO,MAAAC,EAAWC,EAAM,OAAyB,IAAI,EAC9C,CACF,OAAAC,EACA,cAAAC,EACA,aAAAC,EACA,QAAAC,EACA,OAAAC,EACA,gBAAAC,EACA,aAAAC,EACA,YAAAC,GACAC,EAA4B,UAAA,EAE1B,CAACC,EAAgBC,CAAiB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ionYupValidation.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 React, { useEffect, useState } from \"react\";\nimport { EntityCollection, FieldCaption, 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 { Field, getIn, useFormex } from \"@firecms/formex\";\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 (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 const showErrors = submitCount > 0;\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={showErrors && Boolean(errors.name)}/>\n <FieldCaption 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 </FieldCaption>\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={showErrors && Boolean(errors.path)}/>\n\n <FieldCaption 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 </FieldCaption>\n\n </div>\n\n {!isSubcollection && <div className={\"col-span-12 sm:col-span-4 relative\"}>\n\n <TextField error={showErrors && 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 <FieldCaption>\n {showErrors && Boolean(errors.group) ? errors.group : \"Group of the collection\"}\n </FieldCaption>\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={showErrors && Boolean(errors.id)}/>\n <FieldCaption error={touched.id && Boolean(errors.id)}>\n {touched.id && Boolean(errors.id) ? errors.id : \"This id identifies this collection\"}\n </FieldCaption>\n </div>\n\n <div className={\"col-span-12\"}>\n <TextField\n error={showErrors && Boolean(errors.singularName)}\n name={\"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 <FieldCaption error={showErrors && Boolean(errors.singularName)}>\n {showErrors && Boolean(errors.singularName) ? errors.singularName : \"Optionally define a singular name for your entities\"}\n </FieldCaption>\n </div>\n <div className={\"col-span-12\"}>\n <TextField\n error={showErrors && Boolean(errors.description)}\n name=\"description\"\n value={values.description ?? \"\"}\n onChange={handleChange}\n multiline\n rows={2}\n aria-describedby=\"description-helper-text\"\n label=\"Description\"\n />\n <FieldCaption error={showErrors && Boolean(errors.description)}>\n {showErrors && Boolean(errors.description) ? errors.description : \"Description of the collection, you can use markdown\"}\n </FieldCaption>\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 <FieldCaption>\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 </FieldCaption>\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 <FieldCaption>\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 </FieldCaption>\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, FieldCaption, } 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 { extractEnumFromValues } from \"@firecms/schema_inference\";\nimport { Field, Formex, getIn, useCreateFormex, useFormex } from \"@firecms/formex\";\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 <FieldCaption error={Boolean(idError)}>\n {idError ?? \"Value saved in the data source\"}\n </FieldCaption>\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\nimport { FieldCaption, serializeRegExp } from \"@firecms/core\";\nimport { DebouncedTextField, } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\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 <FieldCaption error={Boolean(matchesError)}>\n {matchesError ? \"Not a valid regexp\" : \"e.g. /^\\\\d+$/ for digits only\"}\n </FieldCaption>\n </div>}\n\n </div>\n );\n\n}\n","import React from \"react\";\n\nimport { getIn, useFormex } from \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 { FieldCaption, MapProperty, Property, PropertyConfig, } from \"@firecms/core\";\nimport { AddIcon, BooleanSwitchWithLabel, Button, Paper, Typography } from \"@firecms/ui\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { getIn, useFormex } from \"@firecms/formex\";\nimport { PropertyTree } from \"../PropertyTree\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from \"../util\";\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 = ({\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\n const currentPropertiesOrder = values.propertiesOrder ?? Object.keys(values.properties ?? {});\n const newPropertiesOrder = currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id];\n setFieldValue(\"propertiesOrder\", newPropertiesOrder, false);\n\n setPropertyDialogOpen(false);\n };\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 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 <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 </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 <FieldCaption>\n Set this flag to true if you want to display the children of this group as individual columns.\n </FieldCaption>\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, { useState } from \"react\";\nimport { ArrayProperty, getFieldConfig, Property, PropertyConfig } from \"@firecms/core\";\nimport { Button, Paper, Typography } from \"@firecms/ui\";\nimport { Field, getIn, useFormex } from \"@firecms/formex\";\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 \"@firecms/formex\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { PropertyWithId } from \"../PropertyEditView\";\nimport React from \"react\";\nimport { FieldCaption, 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 <FieldCaption error={Boolean(nameError)}>\n {nameError}\n </FieldCaption>\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 <FieldCaption error={Boolean(idError)}>\n {idError}\n </FieldCaption>\n </div>\n\n <div>\n <Field name={description}\n as={DebouncedTextField}\n label={\"Description\"}\n disabled={disabled}\n error={Boolean(descriptionError)}/>\n <FieldCaption error={Boolean(descriptionError)}>\n {descriptionError}\n </FieldCaption>\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 onPropertyChanged = ({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n\n setFieldValue(\"oneOf.properties\", {\n ...(values.oneOf?.properties ?? {}),\n [id]: property\n }, false);\n const currentPropertiesOrder = values.oneOf?.propertiesOrder ?? Object.keys(values.oneOf?.properties ?? {});\n const newPropertiesOrder = currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id];\n setFieldValue(\"oneOf.propertiesOrder\", newPropertiesOrder, false);\n setPropertyDialogOpen(false);\n };\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={onPropertyChanged}\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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 \"@firecms/formex\";\nimport { FieldCaption, IconForView, NumberProperty, StringProperty, useNavigationController } from \"@firecms/core\";\nimport { CircularProgress, Select, SelectGroup, SelectItem, Typography, } from \"@firecms/ui\";\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 && Boolean(pathValue)) || disabled}\n value={pathValue}\n error={pathError}\n handleChange={handleChange}\n as={CollectionsSelect}/>\n\n </div>\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 <FieldCaption>\n You can only edit the reference collection upon field\n creation.\n </FieldCaption>\n </>\n );\n}\n","import React from \"react\";\nimport { getIn, useFormex } from \"@firecms/formex\";\nimport { FieldCaption, NumberProperty, StringProperty } from \"@firecms/core\";\nimport { Select, SelectItem } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\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 <FieldCaption error={Boolean(modeError)}>\n {modeError}\n </FieldCaption>\n\n <Select name={autoValuePath}\n disabled={disabled}\n value={autoValueValue ?? \"\"}\n onValueChange={(v) => setFieldValue(autoValuePath, v === \"none\" ? null : 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\"}> None </SelectItem>\n <SelectItem value={\"on_create\"}> On create </SelectItem>\n <SelectItem value={\"on_update\"}> On any update </SelectItem>\n </Select>\n <FieldCaption error={Boolean(autoValueError)}>\n {autoValueError ?? \"Update this field automatically when creating or updating the entity\"}\n </FieldCaption>\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 \"@firecms/formex\";\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 \"@firecms/formex\";\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, PropertyConfigId, PropertyConfig } from \"@firecms/core\";\n\nexport const supportedFieldsIds: PropertyConfigId[] = [\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 PropertyConfigId))\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 \"@firecms/formex\";\nimport {\n DEFAULT_FIELD_CONFIGS,\n DeleteConfirmationDialog,\n PropertyConfigId,\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 autoComplete={\"off\"}\n onSubmit={(e) => {\n e.preventDefault();\n e.stopPropagation();\n formexRef.current?.handleSubmit(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: PropertyConfigId) => {\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 PropertyConfigId;\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 PropertyConfigId);\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, useFormex } from \"@firecms/formex\";\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?: 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 {\n [key: string]: PropertyOrBuilder\n }),\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\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 console.debug(\"onPropertyChanged, id change\", {\n id,\n property,\n previousId,\n namespace\n })\n\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(() => values.ownerId ? getUser(values.ownerId) : null, [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 <div className={\"w-full flex flex-col items-center justify-center h-full gap-4\"}>\n <Typography variant={\"label\"} className=\"\">\n {emptyCollection\n ? \"Now you can add your first property\"\n : \"Select a property to edit it\"}\n </Typography>\n <Button variant={\"outlined\"}\n onClick={() => setNewPropertyDialogOpen(true)}\n >\n <AddIcon/>\n Add new property\n </Button>\n </div>}\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 \"@firecms/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 editedCollectionId?: 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 <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n {subcollections && subcollections.length > 0 && <Table>\n <TableBody>\n {subcollections.map((subcollection) => (\n <TableRow key={subcollection.path}\n onClick={() => setCurrentDialog({\n isNewCollection: false,\n editedCollectionId: subcollection.id\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\n <Button\n onClick={() => {\n setCurrentDialog({\n isNewCollection: true\n });\n }}\n variant={\"text\"}\n startIcon={<AddIcon/>}>\n Add subcollection\n </Button>\n\n </Paper>\n\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 <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 them with the CLI.\n </Alert>\n }\n\n {<>\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\n <Button\n onClick={() => {\n setAddEntityViewDialogOpen(true);\n }}\n variant={\"text\"}\n startIcon={<AddIcon/>}>\n Add custom entity view\n </Button>\n </Paper>\n\n </>}\n\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 \"@firecms/formex\";\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-slate-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 \"@firecms/formex\";\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\"}>\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 ?? undefined)}\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 \"@firecms/formex\";\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(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<any> | 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([...(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<any> = 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,\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 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 // TODO: getting data is only working in root collections with this code\n const path = values.path;\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 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.handleSubmit}\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={(importData) => {\n if (importData) {\n onImportDataSet(importData);\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 path={path}\n onImportSuccess={async (importedCollection) => {\n snackbarController.open({\n type: \"info\",\n message: \"Data imported successfully\"\n });\n await saveCollection(values);\n handleClose(importedCollection);\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 const current = removeUndefined({\n ...propertyErrorsRef.current,\n [getFullIdPath(propertyKey, namespace)]: removeUndefined(error, true)\n }, true);\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 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 >\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 if (properties) {\n Object.keys(properties).forEach((key) => {\n propertiesResult[key] = applyPropertiesConfig(properties[key] as PropertyOrBuilder, propertyConfigs);\n });\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, CircularProgress, Collapse, Typography, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport React from \"react\";\n\nexport function RootCollectionSuggestions({ introMode }: { introMode?: \"new_project\" | \"existing_project\" }) {\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 const forceShowSuggestions = introMode === \"existing_project\";\n return <Collapse\n in={forceShowSuggestions || showSuggestions}>\n\n <div\n className={\"flex flex-col gap-1 p-2 my-4\"}>\n\n {!introMode && <Typography variant={\"body2\"} color={\"secondary\"}>\n Create a collection <b>automatically</b> from your data:\n </Typography>}\n\n {introMode === \"existing_project\" && <Typography>\n You will see your <b>database collections</b> here, a few seconds after project creation\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 {rootPathSuggestions === undefined && <CircularProgress size={\"small\"}/>}\n {rootPathSuggestions?.length === 0 && <Typography variant={\"caption\"}>No suggestions</Typography>}\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 <div className={\"bg-gray-50 dark:bg-gray-900 min-w-fit rounded\"}>\n <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 </div>\n}\n","import React from \"react\";\nimport { FireCMSPlugin, useAuthController, useNavigationController, User } 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\";\nimport { AddIcon, Button, Typography } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"./useCollectionEditorController\";\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 /**\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 introMode?: \"new_project\" | \"existing_project\";\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 introMode,\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 return {\n key: \"collection_editor\",\n loading: collectionConfigController.loading,\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 additionalChildrenStart: introMode ? <IntroWidget introMode={introMode}/> : undefined,\n additionalChildrenEnd: <RootCollectionSuggestions introMode={introMode}/>,\n CollectionActions: HomePageEditorCollectionAction,\n AdditionalCards: introMode ? undefined : NewCollectionCard,\n },\n collectionView: {\n CollectionActions: EditorCollectionAction,\n HeaderAction: CollectionViewHeaderAction,\n AddColumnComponent: PropertyAddColumnComponent\n }\n };\n}\n\nexport function IntroWidget({ introMode }: {\n introMode?: \"new_project\" | \"existing_project\";\n}) {\n\n const navigation = useNavigationController();\n if (!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 <div className={\"mt-8 flex flex-col mt-8 p-2\"}>\n <Typography variant={\"h4\"} className=\"mb-4\">Welcome</Typography>\n <Typography paragraph={true}>Your admin panel is ready ✌️</Typography>\n <Typography paragraph={true}>\n Start building collections in FireCMS easily. Map them to your existing\n database data, import from files, or use our templates. Simplify your data management process\n now.\n </Typography>\n {canCreateCollections && <Button\n className={\"mt-4\"}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n parentCollectionIds: [],\n redirect: true,\n sourceClick: \"new_collection_card\"\n })\n : undefined}>\n <AddIcon/>Create your first collection\n </Button>}\n </div>\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\"}\n 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","CollectionDetailsForm","isNewCollection","reservedGroups","existingPaths","existingIds","groups","parentCollection","groupRef","React","values","setFieldValue","handleChange","touched","errors","setFieldTouched","isSubmitting","submitCount","useFormex","iconDialogOpen","setIconDialogOpen","useState","advancedPanelExpanded","setAdvancedPanelExpanded","updateName","name","getIn","toSnakeCase","singular","useEffect","collectionIcon","jsx","IconForView","groupOptions","group","inputFocused","autoCompleteOpen","setAutoCompleteOpen","useAutoComplete","isSubcollection","customIdValue","showErrors","Container","jsxs","Typography","Tooltip","IconButton","Chip","TextField","e","FieldCaption","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","getFullIdPath","keyWithNamespace","EnumForm","enumValues","onValuesChanged","onError","updateIds","disabled","allowDataInference","getData","formex","useCreateFormex","enumValue","hasError","Formex","EnumFormFields","enumValuesPath","shouldUpdateId","lastInternalIdAdded","setLastInternalIdAdded","editDialogIndex","setEditDialogIndex","inferring","setInferring","inferredValues","buildEntry","internalId","justAdded","entryError","EnumEntry","inferValues","data","flatData","fieldData","currentEnumValues","newEnumValues","extractEnumFromValues","ListIcon","Button","CircularProgress","AutoAwesomeIcon","Paper","ArrayContainer","EnumEntryDialog","updateId","autoFocus","onDialogOpen","inferredEntry","shouldUpdateIdRef","idValue","labelValue","currentLabelRef","Fragment","Badge","prevProps","nextProps","equal","open","onClose","idError","DialogContent","DialogActions","SwitchControl","field","form","label","tooltip","size","allowIndeterminate","formControlLabel","checked","GeneralPropertyValidation","validationRequired","validationRequiredMessage","StringPropertyValidation","length","lowercase","matches","max","min","trim","uppercase","validationLength","validationMin","validationMax","validationTrim","validationMatches","validationLowercase","validationUppercase","matchesError","matchesValue","matchesStringValue","serializeRegExp","ArrayPropertyValidation","ValidationPanel","children","RuleIcon","EnumPropertyField","multiselect","setFieldError","snackbarContext","useSnackbarController","defaultValue","valuesEnumValues","useMemo","resolveEnumValues","enumIds","res","d","fileTypes","StoragePropertyField","multiple","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","_","key","propertyOrBuilder","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","className","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","currentPropertiesOrder","deleteProperty","propertiesPath","propertiesOrderPath","p","selectedPropertyFullId","selectedProperty","empty","AddIcon","PropertyFormDialog","RepeatPropertyField","ofProperty","ofPropertyError","onPropertyChanged","widget","CommonPropertyFields","disabledId","autoUpdateId","isNewProperty","ref","validate","nameError","description","descriptionError","newNameValue","newIdValue","unslugify","StringPropertyField","widgetId","BooleanPropertyField","BlockPropertyField","addChildButton","NumberPropertyValidation","validationLessThan","validationMoreThan","NumberPropertyField","ReferencePropertyField","useNavigationController","pathPath","pathValue","pathError","CollectionsSelect","error","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","a","PropertyForm","includeIdAndName","autoOpenTypeSelect","existingProperty","inArray","existingPropertyKeys","onPropertyChangedImmediate","onDelete","initialErrors","forceShowErrors","getController","initialValue","lastSubmittedProperty","useRef","doOnPropertyChanged","params","formexController","newPropertyWithId","controller","validateName","validateId","isValidRegExp","PropertyEditFormFields","onCancel","onOkClicked","formProps","formexRef","helpers","setValues","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","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","Alert","CollectionEditorDialog","selectedViewKey","productsCollectionTemplate","blogCollectionTemplate","usersCollectionTemplate","pagesCollectionTemplate","CollectionEditorWelcomeView","path","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","initialValues","applyPropertyConfigs","coolIconKeys","CircularProgressCenter","CollectionEditorInternal","editedCollectionId","fullPath","handleClose","extraView","useImportConfig","initialView","currentView","setCurrentView","setError","saveCollection","updatedCollection","setNextMode","inferCollectionFromData","inferredCollection","onSubmit","newCollectionState","validation","schema","err","validatePath","formController","updatedFullPath","parentPaths","resolvedPath","getDataWithPath","onImportDataSet","buildEntityPropertiesFromData","validValues","onImportMappingComplete","Tabs","Tab","importData","ImportSaveInProgress","importedCollection","current","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","sourceClick","getPathSuggestions","url","useCollectionEditorController","useContext","useCollectionsConfigController","EditorCollectionAction","tableController","navigationController","collectionEditorController","canEditCollection","saveDefaultFilterButton","getObjectOrNull","UndoIcon","SaveIcon","editorButton","o","HomePageEditorCollectionAction","permissions","onEditCollectionClicked","deleteRequested","setDeleteRequested","deleteCollection","Menu","MoreVertIcon","MenuItem","NewCollectionCard","context","canCreateCollections","RootCollectionSuggestions","introMode","showSuggestions","forceShowSuggestions","Collapse","CollectionViewHeaderAction","onHover","PropertyAddColumnComponent","getDefaultPropertiesOrder","NewCollectionButton","useCollectionEditorPlugin","IntroWidget","MissingReferenceWidget","pathProp","getLastSegment","collectionEditor","segments"],"mappings":"ywCAEaA,GAAYC,GAAI,OAAO,EAAE,MAAM,CACxC,GAAIA,GAAI,SAAS,SAAS,UAAU,EACpC,KAAMA,GAAI,SAAS,SAAS,UAAU,EACtC,KAAMA,GAAI,SAAS,SAAS,UAAU,CAC1C,CAAC,ECkBM,SAASC,GAAsB,CACI,gBAAAC,EACA,eAAAC,EACA,cAAAC,EACA,YAAAC,EACA,OAAAC,EACA,iBAAAC,CACJ,EAQnC,CAEO,MAAAC,EAAWC,EAAM,OAAyB,IAAI,EAC9C,CACF,OAAAC,EACA,cAAAC,EACA,aAAAC,EACA,QAAAC,EACA,OAAAC,EACA,gBAAAC,EACA,aAAAC,EACA,YAAAC,GACAC,EAA4B,UAAA,EAE1B,CAACC,EAAgBC,CAAiB,EAAIC,WAAS,EAAK,EACpD,CAACC,EAAuBC,CAAwB,EAAIF,WAAS,EAAK,EAElEG,EAAcC,GAAiB,CACjCd,EAAc,OAAQc,CAAI,EAGtB,CADgBC,EAAAA,MAAMb,EAAS,MAAM,GACrBX,GAAmBuB,GACrBd,EAAA,OAAQgB,cAAYF,CAAI,CAAC,EAIvC,CADcC,EAAAA,MAAMb,EAAS,IAAI,GACnBX,GAAmBuB,GACnBd,EAAA,KAAMgB,cAAYF,CAAI,CAAC,EAIrC,CADwBC,EAAAA,MAAMb,EAAS,cAAc,GAC7BX,GAAmBuB,GAC7Bd,EAAA,eAAgBiB,WAASH,CAAI,CAAC,CAChD,EAIJI,EAAAA,UAAU,IAAM,CACRf,EAAO,IACPS,EAAyB,EAAI,CACjC,EACD,CAACT,EAAO,EAAE,CAAC,EAEd,MAAMgB,EAAiBC,EAAAA,IAACC,EAAAA,YAAY,CAAA,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