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

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/ui/collection_editor/CollectionYupValidation.tsx","../src/ui/collection_editor/properties/FieldHelperView.tsx","../src/ui/collection_editor/CollectionDetailsForm.tsx","../src/ui/collection_editor/util.ts","../src/ui/collection_editor/EnumForm.tsx","../src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/ValidationPanel.tsx","../src/ui/collection_editor/properties/EnumPropertyField.tsx","../src/ui/collection_editor/properties/StoragePropertyField.tsx","../src/utils/entities.ts","../src/ui/collection_editor/PropertyFieldPreview.tsx","../src/ui/collection_editor/PropertyTree.tsx","../src/ui/collection_editor/properties/MapPropertyField.tsx","../src/ui/collection_editor/properties/RepeatPropertyField.tsx","../src/ui/collection_editor/properties/CommonPropertyFields.tsx","../src/ui/collection_editor/properties/StringPropertyField.tsx","../src/ui/collection_editor/properties/BooleanPropertyField.tsx","../src/ui/collection_editor/properties/BlockPropertyField.tsx","../src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx","../src/ui/collection_editor/properties/NumberPropertyField.tsx","../src/ui/collection_editor/properties/ReferencePropertyField.tsx","../src/ui/collection_editor/properties/DateTimePropertyField.tsx","../src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx","../src/ui/collection_editor/properties/KeyValuePropertyField.tsx","../src/ui/collection_editor/utils/update_property_for_widget.ts","../src/ui/collection_editor/PropertySelectItem.tsx","../src/ui/collection_editor/properties/UrlPropertyField.tsx","../src/ui/collection_editor/utils/supported_fields.tsx","../src/ui/collection_editor/PropertyEditView.tsx","../src/ui/collection_editor/utils/strings.ts","../src/ui/collection_editor/GetCodeDialog.tsx","../src/ui/collection_editor/CollectionPropertiesEditorForm.tsx","../src/ui/collection_editor/UnsavedChangesDialog.tsx","../src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx","../src/ui/collection_editor/SubcollectionsEditTab.tsx","../src/ui/collection_editor/templates/products_template.ts","../src/ui/collection_editor/templates/blog_template.ts","../src/ui/collection_editor/templates/users_template.ts","../src/ui/collection_editor/templates/pages_template.ts","../src/ui/collection_editor/CollectionEditorWelcomeView.tsx","../src/ui/collection_editor/import/CollectionEditorImportMapping.tsx","../src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx","../src/ui/collection_editor/import/clean_import_data.ts","../src/ui/collection_editor/CollectionEditorDialog.tsx","../src/ConfigControllerProvider.tsx","../src/useCollectionEditorController.tsx","../src/useCollectionsConfigController.tsx","../src/ui/EditorCollectionAction.tsx","../src/ui/HomePageEditorCollectionAction.tsx","../src/ui/NewCollectionCard.tsx","../src/ui/RootCollectionSuggestions.tsx","../src/ui/CollectionViewHeaderAction.tsx","../src/ui/PropertyAddColumnComponent.tsx","../src/ui/NewCollectionButton.tsx","../src/useCollectionEditorPlugin.tsx","../src/ui/MissingReferenceWidget.tsx"],"sourcesContent":["import * as Yup from \"yup\";\n\nexport const YupSchema = Yup.object().shape({\n id: Yup.string().required(\"Required\"),\n name: Yup.string().required(\"Required\"),\n path: Yup.string().required(\"Required\")\n});\n","import { Typography } from \"@firecms/ui\";\n\nexport function FieldHelperView({\n error,\n children\n }: { error?: boolean, children?: React.ReactNode }) {\n if (!children) return null;\n return (\n <Typography variant={\"caption\"} color={error ? \"error\" : \"secondary\"} className={\"ml-3.5 mt-0.5\"}>\n {children}\n </Typography>\n );\n}\n","import React, { useEffect, useState } from \"react\";\nimport { EntityCollection, IconForView, SearchIconsView, singular, toSnakeCase, } from \"@firecms/core\";\nimport {\n Autocomplete,\n AutocompleteItem,\n BooleanSwitchWithLabel,\n Chip,\n cn,\n Container,\n DebouncedTextField,\n Dialog,\n ExpandablePanel,\n IconButton,\n Select,\n SelectItem,\n SettingsIcon,\n TextField,\n Tooltip,\n Typography,\n useAutoComplete\n} from \"@firecms/ui\";\nimport { Field, getIn, useFormikContext } from \"formik\";\n\nimport { FieldHelperView } from \"./properties/FieldHelperView\";\n\nexport function CollectionDetailsForm({\n isNewCollection,\n reservedGroups,\n existingPaths,\n existingIds,\n groups,\n parentCollection\n }: {\n isNewCollection: boolean,\n reservedGroups?: string[];\n existingPaths?: string[];\n existingIds?: string[];\n groups: string[] | null;\n parentCollection?: EntityCollection;\n parentCollectionIds?: string[];\n}) {\n\n const groupRef = React.useRef<HTMLInputElement>(null);\n const {\n values,\n setFieldValue,\n handleChange,\n touched,\n errors,\n setFieldTouched,\n isSubmitting,\n submitCount\n } = useFormikContext<EntityCollection>();\n\n const [iconDialogOpen, setIconDialogOpen] = useState(false);\n const [advancedPanelExpanded, setAdvancedPanelExpanded] = useState(false);\n\n const updateName = (name: string) => {\n setFieldValue(\"name\", name);\n\n const pathTouched = getIn(touched, \"path\");\n if (!pathTouched && isNewCollection && name) {\n setFieldValue(\"path\", toSnakeCase(name));\n }\n\n const idTouched = getIn(touched, \"id\");\n if (!idTouched && isNewCollection && name) {\n setFieldValue(\"id\", toSnakeCase(name));\n }\n\n const singularNameTouched = getIn(touched, \"singularName\");\n if (!singularNameTouched && isNewCollection && name) {\n setFieldValue(\"singularName\", singular(name))\n }\n\n };\n\n useEffect(() => {\n if (errors.id) {\n setAdvancedPanelExpanded(true);\n }\n }, [errors.id]);\n\n const collectionIcon = <IconForView collectionOrView={values}/>;\n\n const groupOptions = groups?.filter((group) => !reservedGroups?.includes(group));\n\n const {\n inputFocused,\n autoCompleteOpen,\n setAutoCompleteOpen\n } = useAutoComplete({\n ref: groupRef\n });\n\n const isSubcollection = !!parentCollection;\n\n let customIdValue: \"true\" | \"false\" | \"optional\" | \"code_defined\" | undefined;\n if (customIdValue) {\n if (typeof values.customId === \"object\") {\n customIdValue = \"code_defined\";\n } else if (values.customId === true) {\n customIdValue = \"true\";\n } else if (values.customId === false) {\n customIdValue = \"false\";\n } else if (values.customId === \"optional\") {\n customIdValue = \"optional\";\n }\n }\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"4xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <div>\n <div\n className=\"flex flex-row py-2 pt-3 items-center\">\n <Typography variant={!isNewCollection ? \"h5\" : \"h4\"} className={\"flex-grow\"}>\n {isNewCollection ? \"New collection\" : `${values?.name} collection`}\n </Typography>\n <Tooltip title={\"Change icon\"}>\n <IconButton\n shape={\"square\"}\n onClick={() => setIconDialogOpen(true)}>\n {collectionIcon}\n </IconButton>\n </Tooltip>\n </div>\n\n {parentCollection && <Chip colorScheme={\"tealDarker\"}>\n <Typography variant={\"caption\"}>\n This is a subcollection of <b>{parentCollection.name}</b>\n </Typography>\n </Chip>}\n\n </div>\n <div className={\"grid grid-cols-12 gap-4\"}>\n\n <div className={\"col-span-12\"}>\n <TextField\n value={values.name ?? \"\"}\n onChange={(e: any) => updateName(e.target.value)}\n label={\"Name\"}\n required\n error={touched.name && Boolean(errors.name)}/>\n <FieldHelperView error={touched.name && Boolean(errors.name)}>\n {touched.name && Boolean(errors.name) ? errors.name : \"Name of in this collection, usually a plural name (e.g. Products)\"}\n </FieldHelperView>\n </div>\n\n <div className={cn(\"col-span-12 \", isSubcollection ? \"\" : \"sm:col-span-8\")}>\n <Field name={\"path\"}\n as={DebouncedTextField}\n label={\"Path\"}\n disabled={!isNewCollection}\n required\n error={touched.path && Boolean(errors.path)}/>\n\n <FieldHelperView error={touched.path && Boolean(errors.path)}>\n {touched.path && Boolean(errors.path)\n ? errors.path\n : isSubcollection ? \"Relative path to the parent (no need to include the parent path)\" : \"Path that this collection is stored in, in the database\"}\n </FieldHelperView>\n\n </div>\n\n {!isSubcollection && <div className={\"col-span-12 sm:col-span-4 relative\"}>\n\n <TextField error={touched.group && Boolean(errors.group)}\n disabled={isSubmitting}\n value={values.group ?? \"\"}\n autoComplete=\"off\"\n onChange={(event) => setFieldValue(\"group\", event.target.value)}\n name={\"group\"}\n inputRef={groupRef}\n label=\"Group\"/>\n <Autocomplete\n open={autoCompleteOpen && (groupOptions ?? []).length > 0}\n setOpen={setAutoCompleteOpen}>\n {groupOptions?.map((group, index) => {\n return <AutocompleteItem\n key={index + \"_\" + group}\n onClick={() => {\n setAutoCompleteOpen(false);\n setFieldValue(\"group\", group ?? null);\n }}\n >\n <div className={\"flex-grow\"}>\n {group}\n </div>\n </AutocompleteItem>;\n })}\n </Autocomplete>\n <FieldHelperView>\n {touched.group && Boolean(errors.group) ? errors.group : \"Group of the collection\"}\n </FieldHelperView>\n </div>}\n\n <div className={\"col-span-12\"}>\n <ExpandablePanel\n expanded={advancedPanelExpanded}\n onExpandedChange={setAdvancedPanelExpanded}\n title={\n <div className=\"flex flex-row text-gray-500\">\n <SettingsIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n Advanced\n </Typography>\n </div>}\n initiallyExpanded={false}>\n <div className={\"grid grid-cols-12 gap-4 p-4\"}>\n\n <div className={\"col-span-12\"}>\n <Field name={\"id\"}\n as={DebouncedTextField}\n disabled={!isNewCollection}\n label={\"Collection id\"}\n error={touched.id && Boolean(errors.id)}/>\n <FieldHelperView error={touched.id && Boolean(errors.id)}>\n {touched.id && Boolean(errors.id) ? errors.id : \"This id identifies this collection\"}\n </FieldHelperView>\n </div>\n\n <div className={\"col-span-12\"}>\n <TextField\n error={touched.singularName && Boolean(errors.singularName)}\n id={\"singularName\"}\n aria-describedby={\"singularName-helper\"}\n onChange={(e) => {\n setFieldTouched(\"singularName\", true);\n return handleChange(e);\n }}\n value={values.singularName ?? \"\"}\n label={\"Singular name\"}/>\n <FieldHelperView error={touched.singularName && Boolean(errors.singularName)}>\n {touched.singularName && Boolean(errors.singularName) ? errors.singularName : \"Optionally define a singular name for your entities\"}\n </FieldHelperView>\n </div>\n <div className={\"col-span-12\"}>\n <TextField\n error={touched.description && Boolean(errors.description)}\n id=\"description\"\n value={values.description ?? \"\"}\n onChange={handleChange}\n multiline\n rows={2}\n aria-describedby=\"description-helper-text\"\n label=\"Description\"\n />\n <FieldHelperView error={touched.description && Boolean(errors.description)}>\n {touched.description && Boolean(errors.description) ? errors.description : \"Description of the collection, you can use markdown\"}\n </FieldHelperView>\n </div>\n\n <div className={\"col-span-12\"}>\n <Select\n name=\"defaultSize\"\n label=\"Default row size\"\n position={\"item-aligned\"}\n onChange={handleChange}\n value={values.defaultSize ?? \"\"}\n renderValue={(value: any) => value.toUpperCase()}\n >\n {[\"xs\", \"s\", \"m\", \"l\", \"xl\"].map((value) => (\n <SelectItem\n key={`size-select-${value}`}\n value={value}>\n {value.toUpperCase()}\n </SelectItem>\n ))}\n </Select>\n </div>\n <div className={\"col-span-12\"}>\n <Select\n name=\"customId\"\n label=\"Data IDs generation\"\n position={\"item-aligned\"}\n disabled={customIdValue === \"code_defined\"}\n onValueChange={(v) => {\n if (v === \"code_defined\")\n throw new Error(\"This should not happen\");\n else if (v === \"true\")\n setFieldValue(\"customId\", true);\n else if (v === \"false\")\n setFieldValue(\"customId\", false);\n else if (v === \"optional\")\n setFieldValue(\"customId\", \"optional\");\n }}\n value={customIdValue ?? \"\"}\n renderValue={(value: any) => {\n if (value === \"code_defined\")\n return \"Code defined\";\n else if (value === \"true\")\n return \"Users must define an ID\";\n else if (value === \"optional\")\n return \"Users can define an ID, but it is not required\";\n else\n return \"Document ID is generated automatically\";\n }}\n >\n <SelectItem value={\"false\"}>\n Document ID is generated automatically\n </SelectItem>\n <SelectItem value={\"true\"}>\n Users must define an ID\n </SelectItem>\n <SelectItem value={\"optional\"}>\n Users can define an ID, but it is not required\n </SelectItem>\n </Select>\n </div>\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n label=\"Collection group\"\n onValueChange={(v) => setFieldValue(\"collectionGroup\", v)}\n value={values.collectionGroup ?? false}\n />\n <FieldHelperView>\n A collection group consists of all collections with the same path. This allows\n you\n to query over multiple collections at once.\n </FieldHelperView>\n </div>\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n label=\"Enable text search for this collection\"\n onValueChange={(v) => setFieldValue(\"textSearchEnabled\", v)}\n value={values.textSearchEnabled ?? false}\n />\n <FieldHelperView>\n Allow text search for this collection. If you have not specified a text search\n delegate, this will use the built-in local text search. This is not recommended\n for large collections, as it may incur in performance and cost issues.\n </FieldHelperView>\n </div>\n </div>\n </ExpandablePanel>\n\n </div>\n\n </div>\n\n <div style={{ height: \"52px\" }}/>\n\n <Dialog\n open={iconDialogOpen}\n onOpenChange={setIconDialogOpen}\n maxWidth={\"xl\"}\n fullWidth\n >\n <div className={\"p-4 overflow-auto min-h-[200px]\"}>\n <SearchIconsView selectedIcon={values.icon}\n onIconSelected={(icon: string) => {\n setIconDialogOpen(false);\n setFieldValue(\"icon\", icon);\n }}/>\n </div>\n\n </Dialog>\n\n </Container>\n </div>\n );\n}\n","export function idToPropertiesPath(id: string): string {\n return \"properties.\" + id.replaceAll(\".\", \".properties.\");\n}\n\nexport function namespaceToPropertiesPath(namespace?: string): string {\n return namespace\n ? \"properties.\" + namespace.replaceAll(\".\", \".properties.\") + \".properties\"\n : \"properties\";\n}\n\nexport function namespaceToPropertiesOrderPath(namespace?: string): string {\n return namespace\n ? \"properties.\" + namespace.replaceAll(\".\", \".properties.\") + \".propertiesOrder\"\n : \"propertiesOrder\";\n}\n\nexport function getFullId(propertyKey: string, propertyNamespace?: string): string {\n return propertyNamespace\n ? `${propertyNamespace}.${propertyKey}`\n : propertyKey;\n}\n","import React, { useEffect } from \"react\";\n\nimport { FastField, Formik, getIn, useFormikContext } from \"formik\";\nimport {\n EnumValueConfig,\n EnumValues,\n FormikArrayContainer,\n} from \"@firecms/core\";\nimport {\n AutoAwesomeIcon,\n Button,\n CircularProgress,\n DebouncedTextField,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n ListIcon,\n Paper,\n SettingsIcon,\n Typography\n} from \"@firecms/ui\";\nimport { FieldHelperView } from \"./properties/FieldHelperView\";\nimport { extractEnumFromValues } from \"@firecms/schema_inference\";\n\ntype EnumFormProps = {\n enumValues: EnumValueConfig[];\n onValuesChanged?: (enumValues: EnumValueConfig[]) => void;\n onError?: (error: boolean) => void;\n updateIds: boolean;\n disabled: boolean;\n allowDataInference?: boolean;\n getData?: () => Promise<string[]>;\n};\nexport const EnumForm = React.memo(\n function EnumForm({\n enumValues,\n onValuesChanged,\n onError,\n updateIds,\n disabled,\n allowDataInference,\n getData\n }: EnumFormProps) {\n\n return (\n <Formik initialValues={{ enumValues }}\n // enableReinitialize={true}\n validateOnMount={true}\n onSubmit={(data: { enumValues: EnumValueConfig[] }, formikHelpers) => {\n }}\n >\n {\n ({\n values,\n errors\n }) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (onValuesChanged) {\n onValuesChanged(values.enumValues);\n }\n }, [values.enumValues]);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (onError)\n onError(Boolean(errors?.enumValues ?? false));\n }, [errors]);\n\n return <EnumFormFields enumValuesPath={\"enumValues\"}\n values={values}\n errors={errors}\n shouldUpdateId={updateIds}\n disabled={disabled}\n allowDataInference={allowDataInference}\n getData={getData}/>\n }\n }\n </Formik>\n\n );\n },\n function areEqual(prevProps: EnumFormProps, nextProps: EnumFormProps) {\n return prevProps.enumValues.length === nextProps.enumValues.length &&\n prevProps.onValuesChanged === nextProps.onValuesChanged &&\n prevProps.getData === nextProps.getData\n ;\n }\n);\n\ntype EnumFormFieldsProps = {\n values: { enumValues: EnumValueConfig[] };\n errors: any;\n enumValuesPath: string;\n shouldUpdateId: boolean;\n disabled: boolean;\n getData?: () => Promise<string[]>;\n allowDataInference?: boolean;\n};\n\n// const EnumFormFields = React.memo(\nfunction EnumFormFields({\n values,\n errors,\n disabled,\n enumValuesPath,\n shouldUpdateId,\n allowDataInference,\n getData,\n }: EnumFormFieldsProps) {\n\n const {\n setFieldValue\n } = useFormikContext();\n\n const [lastInternalIdAdded, setLastInternalIdAdded] = React.useState<number | undefined>();\n const [editDialogIndex, setEditDialogIndex] = React.useState<number | undefined>();\n const [inferring, setInferring] = React.useState(false);\n\n const inferredValuesRef = React.useRef(new Set());\n const inferredValues = inferredValuesRef.current;\n\n const buildEntry = (index: number, internalId: number) => {\n const justAdded = lastInternalIdAdded === internalId;\n return <EnumEntry index={index}\n disabled={disabled}\n enumValuesPath={enumValuesPath}\n autoFocus={justAdded}\n shouldUpdateId={shouldUpdateId || justAdded}\n onDialogOpen={() => setEditDialogIndex(index)}\n inferredEntry={inferredValues.has(values.enumValues[index]?.id as string)}\n key={`${internalId}`}/>;\n };\n\n const inferValues = async () => {\n if (!getData)\n return;\n setInferring(true);\n getData?.().then((data) => {\n if (!data)\n return;\n\n const flatData = data.flat();\n\n const fieldData = Array.from(new Set(flatData));\n\n const currentEnumValues = values.enumValues;\n const foundEnumValues = extractEnumFromValues(fieldData);\n\n // add only new enum values\n const newEnumValues = foundEnumValues.filter((enumValue) => {\n return !currentEnumValues?.some((v: any) => v.id === enumValue.id);\n });\n\n newEnumValues.forEach((enumValue) => {\n inferredValues.add(enumValue.id);\n });\n setFieldValue(enumValuesPath, [...newEnumValues, ...currentEnumValues]);\n }).catch(e => {\n console.error(e);\n })\n .finally(() => setInferring(false));\n }\n\n return (\n <div className={\"col-span-12\"}>\n <div className=\"ml-3.5 flex flex-row items-center\">\n <ListIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2 grow\">\n Values\n </Typography>\n {allowDataInference &&\n <Button loading={inferring}\n disabled={disabled || inferring}\n variant={\"text\"}\n size={\"small\"}\n onClick={inferValues}>\n {inferring ? <CircularProgress size={\"small\"}/> : <AutoAwesomeIcon/>}\n Infer values from data\n </Button>}\n </div>\n\n <Paper className=\"p-4 m-1\">\n\n <FormikArrayContainer\n value={values.enumValues}\n addLabel={\"Add enum value\"}\n name={enumValuesPath}\n buildEntry={buildEntry}\n disabled={disabled}\n onInternalIdAdded={setLastInternalIdAdded}\n small={true}\n setFieldValue={setFieldValue}\n includeAddButton={true}/>\n\n <EnumEntryDialog index={editDialogIndex}\n open={editDialogIndex !== undefined}\n enumValuesPath={enumValuesPath}\n onClose={() => setEditDialogIndex(undefined)}/>\n </Paper>\n </div>\n );\n}\n\ntype EnumEntryProps = {\n index: number,\n enumValuesPath: string,\n shouldUpdateId: boolean,\n autoFocus: boolean,\n onDialogOpen: () => void;\n disabled: boolean;\n inferredEntry?: boolean;\n};\n\nconst EnumEntry = React.memo(\n function EnumEntryInternal({\n index,\n shouldUpdateId: updateId,\n enumValuesPath,\n autoFocus,\n onDialogOpen,\n disabled,\n inferredEntry\n }: EnumEntryProps) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormikContext<EnumValues>();\n\n const shouldUpdateIdRef = React.useRef(!getIn(values, `${enumValuesPath}[${index}].id`));\n const shouldUpdateId = updateId || shouldUpdateIdRef.current;\n\n const idValue = getIn(values, `${enumValuesPath}[${index}].id`);\n const labelValue = getIn(values, `${enumValuesPath}[${index}].label`);\n\n const labelError = getIn(errors, `${enumValuesPath}[${index}].label`);\n\n const currentLabelRef = React.useRef(labelValue);\n\n React.useEffect(() => {\n if ((currentLabelRef.current === idValue || !idValue) && shouldUpdateId) {\n setFieldValue(`${enumValuesPath}[${index}].id`, labelValue);\n }\n currentLabelRef.current = labelValue;\n }, [labelValue]);\n\n return (\n <div className={\"flex w-full align-center justify-center\"}>\n <FastField name={`${enumValuesPath}[${index}].label`}\n as={DebouncedTextField}\n className={\"flex-grow\"}\n required\n disabled={disabled}\n size=\"small\"\n validate={validateLabel}\n autoFocus={autoFocus}\n autoComplete=\"off\"\n endAdornment={inferredEntry && <AutoAwesomeIcon size={\"small\"}/>}\n error={Boolean(labelError)}/>\n\n {!disabled &&\n <IconButton\n size=\"small\"\n aria-label=\"edit\"\n className={\"m-1\"}\n onClick={() => onDialogOpen()}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>}\n\n </div>);\n },\n function areEqual(prevProps: EnumEntryProps, nextProps: EnumEntryProps) {\n return prevProps.index === nextProps.index &&\n prevProps.enumValuesPath === nextProps.enumValuesPath &&\n prevProps.shouldUpdateId === nextProps.shouldUpdateId &&\n prevProps.inferredEntry === nextProps.inferredEntry &&\n prevProps.autoFocus === nextProps.autoFocus;\n }\n);\n\nfunction EnumEntryDialog({\n index,\n open,\n onClose,\n enumValuesPath\n }: {\n index?: number;\n open: boolean;\n enumValuesPath: string;\n onClose: () => void;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormikContext<EnumValues>();\n\n const idError = index !== undefined ? getIn(errors, `${enumValuesPath}[${index}].id`) : undefined;\n return <Dialog\n maxWidth=\"md\"\n aria-labelledby=\"enum-edit-dialog\"\n open={open}\n onOpenChange={(open) => !open ? onClose() : undefined}\n >\n\n <DialogContent>\n {index !== undefined &&\n <div><FastField name={`${enumValuesPath}[${index}]id`}\n as={DebouncedTextField}\n required\n validate={validateId}\n label={\"ID\"}\n size=\"small\"\n autoComplete=\"off\"\n error={Boolean(idError)}/>\n\n <FieldHelperView error={Boolean(idError)}>\n {idError ?? \"Value saved in the data source\"}\n </FieldHelperView>\n </div>}\n </DialogContent>\n\n <DialogActions>\n <Button\n autoFocus\n variant=\"outlined\"\n onClick={onClose}\n color=\"primary\">\n Ok\n </Button>\n </DialogActions>\n\n </Dialog>\n}\n\nfunction validateLabel(value: string) {\n let error;\n if (!value) {\n error = \"You must specify a label\";\n }\n return error;\n}\n\nfunction validateId(value: string) {\n let error;\n if (!value) {\n error = \"You must specify an ID\";\n }\n return error;\n}\n","import React from \"react\";\n\nimport { FastField, getIn, useFormikContext } from \"formik\";\nimport { SwitchControl } from \"@firecms/core\";\nimport { DebouncedTextField } from \"@firecms/ui\";\n\nexport function GeneralPropertyValidation({ disabled }: {\n required?: boolean;\n disabled:boolean;\n}) {\n\n const { values, handleChange } = useFormikContext();\n\n const validationRequired = \"validation.required\";\n const validationRequiredMessage = \"validation.requiredMessage\";\n const validationUnique = \"validation.unique\";\n const validationUniqueInArray = \"validation.uniqueInArray\";\n\n return (\n <>\n <div className={\"col-span-6\"}>\n <FastField type=\"checkbox\"\n disabled={disabled}\n name={validationRequired}\n label={\"Required\"}\n tooltip={\"You won't be able to save this entity if this value is not set\"}\n component={SwitchControl}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <FastField type=\"checkbox\"\n disabled={disabled}\n name={validationUnique}\n label={\"Unique\"}\n tooltip={\"There cannot be multiple entities with the same value\"}\n component={SwitchControl}/>\n </div>\n\n {getIn(values, validationRequired) && <div className={\"col-span-12\"}>\n <DebouncedTextField\n disabled={disabled}\n value={getIn(values, validationRequiredMessage)}\n label={\"Required message\"}\n name={validationRequiredMessage}\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n </>\n );\n}\n","import React from \"react\";\n\nimport { FastField, getIn, useFormikContext } from \"formik\";\nimport { isValidRegExp, serializeRegExp, SwitchControl } from \"@firecms/core\";\nimport { DebouncedTextField, } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\nimport { FieldHelperView } from \"../FieldHelperView\";\n\nexport function StringPropertyValidation({\n length,\n lowercase,\n matches,\n max,\n min,\n trim,\n uppercase,\n disabled,\n showErrors\n }: {\n length?: boolean;\n min?: boolean;\n max?: boolean;\n trim?: boolean;\n matches?: boolean;\n lowercase?: boolean;\n uppercase?: boolean;\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const {\n values,\n handleChange,\n errors\n } = useFormikContext();\n\n const validationLength = \"validation.length\";\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n const validationTrim = \"validation.trim\";\n const validationMatches = \"validation.matches\";\n const validationLowercase = \"validation.lowercase\";\n const validationUppercase = \"validation.uppercase\";\n\n const matchesError = getIn(errors, validationMatches);\n\n const matchesValue = getIn(values, validationMatches);\n const matchesStringValue = typeof matchesValue === \"string\" ? matchesValue : serializeRegExp(matchesValue);\n return (\n <div className={\"grid grid-cols-12 gap-2\"}>\n\n <GeneralPropertyValidation disabled={disabled}/>\n\n <div className={\"grid grid-cols-12 gap-2 col-span-12\"}>\n {lowercase && <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationLowercase}\n label={\"Lowercase\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>}\n {uppercase && <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationUppercase}\n label={\"Uppercase\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>}\n {trim && <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationTrim}\n label={\"Trim\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>}\n </div>\n\n <div className={\"grid grid-cols-12 gap-2 col-span-12\"}>\n {length && <div className={\"col-span-4\"}>\n <DebouncedTextField\n value={getIn(values, validationLength)}\n label={\"Exact length\"}\n name={validationLength}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n {min && <div className={\"col-span-4\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n label={\"Min length\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n {max && <div className={\"col-span-4\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n label={\"Max length\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n </div>\n\n {matches && <div className={\"col-span-12\"}>\n <FastField name={validationMatches}\n as={DebouncedTextField}\n validate={(value: string) => value && !isValidRegExp(value)}\n label={\"Matches regex\"}\n size=\"small\"\n disabled={disabled}\n value={matchesStringValue}\n error={Boolean(matchesError)}/>\n <FieldHelperView error={Boolean(matchesError)}>\n {matchesError ? \"Not a valid regexp\" : \"e.g. /^\\\\d+$/ for digits only\"}\n </FieldHelperView>\n </div>}\n\n </div>\n );\n\n}\n","import React from \"react\";\n\nimport { getIn, useFormikContext } from \"formik\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\n\nexport function ArrayPropertyValidation({\n max = true,\n min = true,\n disabled\n }: {\n min?: boolean;\n max?: boolean;\n disabled: boolean;\n}) {\n\n const {\n values,\n handleChange\n } = useFormikContext();\n\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n\n return (\n <div className={\"grid grid-cols-12 gap-2\"}>\n\n <GeneralPropertyValidation disabled={disabled}/>\n\n {min && <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n disabled={disabled}\n label={\"Min length\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n {max && <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n disabled={disabled}\n label={\"Max length\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n </div>\n );\n}\n","import { PropsWithChildren } from \"react\";\n\nimport { ExpandablePanel, RuleIcon, Typography } from \"@firecms/ui\";\n\nexport function ValidationPanel({\n children\n }: PropsWithChildren<{}>) {\n\n return (\n <ExpandablePanel\n initiallyExpanded={false}\n asField={true}\n className=\"p-4\"\n title={\n <div className=\"flex flex-row text-gray-500\">\n <RuleIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n Validation\n </Typography>\n </div>\n }>\n\n {children}\n\n </ExpandablePanel>\n )\n}\n","import React, { useMemo } from \"react\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { EnumValueConfig, resolveEnumValues, useSnackbarController } from \"@firecms/core\";\nimport { Select, SelectItem } from \"@firecms/ui\";\nimport { EnumForm } from \"../EnumForm\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { PropertyWithId } from \"../PropertyEditView\";\n\nexport function EnumPropertyField({\n multiselect,\n updateIds,\n disabled,\n showErrors,\n allowDataInference,\n getData\n }: {\n multiselect: boolean;\n updateIds: boolean;\n disabled: boolean;\n showErrors: boolean;\n allowDataInference?: boolean;\n getData?: () => Promise<object[]>;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n touched,\n setFieldError,\n setFieldValue\n } = useFormikContext<PropertyWithId>();\n\n const snackbarContext = useSnackbarController();\n\n const enumValuesPath = multiselect ? \"of.enumValues\" : \"enumValues\";\n\n const defaultValue = getIn(values, \"defaultValue\");\n\n const valuesEnumValues = getIn(values, enumValuesPath);\n const enumValues: EnumValueConfig[] = useMemo(() => {\n if (!valuesEnumValues || typeof valuesEnumValues === \"boolean\")\n return [] as EnumValueConfig[];\n return resolveEnumValues(valuesEnumValues) ?? [] as EnumValueConfig[];\n }, [valuesEnumValues]);\n\n const onValuesChanged = (value: EnumValueConfig[]) => {\n if (!values)\n return;\n setFieldValue(enumValuesPath, value);\n if (!multiselect) {\n const enumIds = value.filter(v => Boolean(v?.id)).map((v: any) => v.id);\n if (defaultValue && !enumIds.includes(defaultValue)) {\n setFieldValue(\"defaultValue\", undefined);\n snackbarContext.open({\n type: \"warning\",\n message: \"Default value was cleared\"\n })\n }\n }\n };\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <EnumForm enumValues={enumValues}\n updateIds={updateIds}\n disabled={disabled}\n allowDataInference={allowDataInference}\n onError={(hasError) => {\n setFieldError(enumValuesPath, hasError ? \"\" : undefined);\n }}\n getData={getData\n ? () => getData()\n .then(res => res.map(d => values.id && getIn(d, values.id)).filter(Boolean))\n : undefined}\n onValuesChanged={onValuesChanged}/>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n {!multiselect &&\n <StringPropertyValidation disabled={disabled}\n showErrors={showErrors}/>}\n {multiselect &&\n <ArrayPropertyValidation disabled={disabled}/>}\n </ValidationPanel>\n\n </div>\n\n {!multiselect && <div className={\"col-span-12\"}>\n\n <Select\n disabled={disabled}\n position={\"item-aligned\"}\n onValueChange={(value: string) => {\n setFieldValue(\"defaultValue\", value);\n }}\n label={\"Default value\"}\n value={defaultValue ?? \"\"}>\n {enumValues\n .filter((enumValue) => Boolean(enumValue?.id))\n .map((enumValue) => (\n <SelectItem key={enumValue.id}\n value={enumValue.id?.toString()}>\n {enumValue.label}\n </SelectItem>\n ))}\n </Select>\n\n </div>}\n </>\n );\n}\n","import React from \"react\";\nimport { SwitchControl, } from \"@firecms/core\";\nimport {\n Button,\n Checkbox,\n DebouncedTextField,\n ExpandablePanel,\n FileUploadIcon,\n MultiSelect,\n MultiSelectItem,\n Typography\n} from \"@firecms/ui\";\n\nimport { Field, getIn, useFormikContext } from \"formik\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\n\nconst fileTypes: Record<string, string> = {\n \"image/*\": \"Images\",\n \"video/*\": \"Videos\",\n \"audio/*\": \"Audio files\",\n \"application/*\": \"Files (pdf, zip, csv, excel...)\",\n \"text/*\": \"Text files\"\n}\n\nexport function StoragePropertyField({\n multiple,\n existing,\n disabled\n }: {\n multiple: boolean;\n existing: boolean;\n disabled: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormikContext();\n\n const baseStoragePath = multiple ? \"of.storage\" : \"storage\";\n const acceptedFiles = `${baseStoragePath}.acceptedFiles`;\n\n const metadata = `${baseStoragePath}.metadata`;\n const fileName = `${baseStoragePath}.fileName`;\n const storagePath = `${baseStoragePath}.storagePath`;\n const storeUrl = `${baseStoragePath}.storeUrl`;\n\n const fileNameValue = getIn(values, fileName) ?? \"{rand}_{file}\";\n const storagePathValue = getIn(values, storagePath) ?? \"/\";\n\n const storedValue = getIn(values, acceptedFiles);\n const fileTypesValue: string[] | undefined = Array.isArray(storedValue) ? storedValue : undefined;\n const allFileTypesSelected = !fileTypesValue || fileTypesValue.length === 0;\n\n const handleTypesChange = (value: string[]) => {\n if (!value) setFieldValue(acceptedFiles, undefined);\n else if (value.includes(\"all\")) setFieldValue(acceptedFiles, undefined);\n else if (value.length >= Object.keys(fileTypes).length) setFieldValue(acceptedFiles, undefined);\n else if (allFileTypesSelected)\n setFieldValue(acceptedFiles, Object.keys(fileTypes).filter((v) => !value.includes(v)));\n else setFieldValue(acceptedFiles, value);\n };\n\n const hasFilenameCallback = typeof fileNameValue === \"function\";\n const hasStoragePathCallback = typeof storagePathValue === \"function\";\n\n return (\n <>\n\n <div className={\"col-span-12\"}>\n\n <ExpandablePanel\n title={\n <div className=\"flex flex-row text-gray-500\">\n <FileUploadIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n File upload config\n </Typography>\n </div>\n }>\n\n <div className={\"grid grid-cols-12 gap-2 p-4\"}>\n\n <div className={\"col-span-12\"}>\n\n <MultiSelect\n disabled={disabled}\n name={acceptedFiles}\n value={fileTypesValue ?? []}\n onMultiValueChange={handleTypesChange}\n label={allFileTypesSelected ? undefined : \"Allowed file types\"}\n renderValues={(selected) => {\n if (!selected || selected.length === 0) return \"All file types allowed\";\n return selected.map((v: string) => fileTypes[v])\n .filter((v: string) => Boolean(v))\n .join(\", \");\n }}>\n\n <MultiSelectItem key={\"all\"} value={\"all\"} className={\"flex items-center gap-2\"}>\n <Checkbox\n checked={!fileTypesValue}/>\n All\n </MultiSelectItem>\n\n {Object.entries(fileTypes).map(([value, label]) => (\n <MultiSelectItem key={value} value={value} className={\"flex items-center gap-2\"}>\n <Checkbox\n checked={allFileTypesSelected || fileTypesValue.indexOf(value) > -1}/>\n <div className={\"flex-grow\"}>\n {label}\n </div>\n <Button size={\"small\"}\n variant={\"outlined\"}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n return setFieldValue(acceptedFiles, [value]);\n }}>\n Only\n </Button>\n </MultiSelectItem>\n ))}\n\n </MultiSelect>\n </div>\n\n <div className={\"col-span-12\"}>\n <Field name={fileName}\n as={DebouncedTextField}\n label={\"File name\"}\n size={\"small\"}\n disabled={hasFilenameCallback || disabled}\n value={hasFilenameCallback ? \"-\" : fileNameValue}\n />\n </div>\n <div className={\"col-span-12\"}>\n <Field name={storagePath}\n as={DebouncedTextField}\n label={\"Storage path\"}\n disabled={hasStoragePathCallback || disabled}\n size={\"small\"}\n value={hasStoragePathCallback ? \"-\" : storagePathValue}\n />\n <Typography variant={\"caption\"} className={\"ml-3.5 mt-1 mb-2\"}>\n <p>You can use the following placeholders in\n the file name\n and storage path values:</p>\n <ul>\n <li>{\"{file} - Full name of the uploaded file\"}</li>\n <li>{\"{file.name} - Name of the uploaded file without extension\"}</li>\n <li>{\"{file.ext} - Extension of the uploaded file\"}</li>\n <li>{\"{entityId} - ID of the entity\"}</li>\n <li>{\"{propertyKey} - ID of this field\"}</li>\n <li>{\"{path} - Path of this entity\"}</li>\n <li>{\"{rand} - Random value used to avoid name collisions\"}</li>\n </ul>\n </Typography>\n <Field type=\"checkbox\"\n name={storeUrl}\n label={\"Save URL instead of storage path\"}\n disabled={existing || disabled}\n component={SwitchControl}/>\n <br/>\n <Typography variant={\"caption\"} className={\"ml-3.5 mt-1 mb-2\"}>\n Turn this setting on, if you prefer to save\n the download\n URL of the uploaded file instead of the\n storage path.\n You can only change this prop upon creation.\n </Typography>\n </div>\n </div>\n </ExpandablePanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n {!multiple && <div className={\"grid grid-cols-12 gap-2\"}>\n <GeneralPropertyValidation disabled={disabled}/>\n </div>}\n {multiple && <div className={\"col-span-12\"}>\n <ArrayPropertyValidation disabled={disabled}/>\n </div>}\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import { isPropertyBuilder, Properties, PropertiesOrBuilders, Property, PropertyOrBuilder } from \"@firecms/core\";\n\nexport function editableProperty(property: PropertyOrBuilder | PropertyOrBuilder): boolean {\n if (isPropertyBuilder(property))\n return false;\n if (isPropertyBuilder(property as PropertyOrBuilder))\n return false;\n else {\n const eProperty = property as Property;\n if (eProperty.dataType === \"array\" && typeof eProperty.of === \"function\")\n return false;\n else if (eProperty.dataType === \"array\" && Array.isArray(eProperty.of))\n return false;\n return Boolean(eProperty.editable);\n }\n}\n\nexport function removeNonEditableProperties(properties: PropertiesOrBuilders<any>): Properties {\n return Object.entries(properties)\n .filter(([_, property]) => editableProperty(property))\n .map(([key, propertyOrBuilder]) => {\n const property = propertyOrBuilder as Property;\n if (!editableProperty(property)) {\n return undefined;\n } else if (property.dataType === \"map\" && property.properties) {\n return {\n [key]: {\n ...property,\n properties: removeNonEditableProperties(property.properties as PropertiesOrBuilders)\n }\n };\n } else {\n return { [key]: property };\n }\n })\n .filter((e) => Boolean(e))\n .reduce((a, b) => ({ ...a, ...b }), {}) as Properties;\n}\n","import {\n ErrorBoundary,\n FieldConfigBadge,\n getFieldConfig,\n isPropertyBuilder,\n Property,\n PropertyOrBuilder,\n useCustomizationController,\n} from \"@firecms/core\";\nimport {\n cardClickableMixin,\n cardMixin,\n cardSelectedMixin,\n cn,\n FunctionsIcon,\n Paper,\n RemoveCircleIcon,\n Typography,\n} from \"@firecms/ui\";\n\nimport { editableProperty } from \"../../utils/entities\";\n\nexport function PropertyFieldPreview({\n property,\n onClick,\n hasError,\n includeName,\n includeEditButton,\n selected\n }: {\n property: Property,\n hasError?: boolean,\n selected?: boolean,\n includeName?: boolean,\n includeEditButton?: boolean;\n onClick?: () => void\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n\n const propertyConfig = getFieldConfig(property, propertyConfigs);\n const disabled = !editableProperty(property);\n\n const borderColorClass = hasError\n ? \"border-red-500\"\n : (selected ? \"border-blue-500\" : \"border-transparent\");\n\n return <ErrorBoundary>\n <div\n onClick={onClick}\n className=\"flex flex-row w-full cursor-pointer\">\n <div className={\"m-4\"}>\n <FieldConfigBadge propertyConfig={propertyConfig}/>\n </div>\n <Paper\n className={cn(\n \"pl-2 w-full flex flex-row gap-4 items-center\",\n cardMixin,\n onClick ? cardClickableMixin : \"\",\n selected ? cardSelectedMixin : \"\",\n \"flex-grow p-4 border transition-colors duration-200\",\n borderColorClass\n )}\n >\n\n <div className=\"w-full flex flex-col\">\n\n {includeName &&\n <ErrorBoundary>\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"flex-grow pr-2\">\n {property.name\n ? property.name\n : \"\\u00a0\"\n }\n </Typography>\n </ErrorBoundary>}\n\n <div className=\"flex flex-row items-center\">\n <ErrorBoundary>\n <Typography className=\"flex-grow pr-2\"\n variant={includeName ? \"body2\" : \"subtitle1\"}\n component=\"span\"\n color=\"secondary\">\n {propertyConfig?.name}\n </Typography>\n </ErrorBoundary>\n <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n {property.dataType}\n </Typography>\n </ErrorBoundary>\n\n </div>\n </div>\n\n {includeEditButton && <Typography variant={\"button\"}>\n EDIT\n </Typography>}\n\n </Paper>\n </div>\n </ErrorBoundary>\n}\n\nexport function NonEditablePropertyPreview({\n name,\n selected,\n onClick,\n property\n }: {\n name: string,\n selected: boolean,\n onClick?: () => void,\n property?: PropertyOrBuilder\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n\n const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, propertyConfigs) : undefined;\n\n return (\n <div\n onClick={onClick}\n className=\"flex flex-row w-full cursor-pointer\">\n <div className={\"relative m-4\"}>\n {propertyConfig && <FieldConfigBadge 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-blue-500\" : \"border-transparent\")}\n >\n\n <div className=\"w-full flex flex-col\">\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"flex-grow pr-2\">\n {property?.name\n ? property.name\n : name\n }\n </Typography>\n\n <div className=\"flex flex-row items-center\">\n {propertyConfig && <Typography className=\"flex-grow pr-2\"\n variant={\"body2\"}\n component=\"span\"\n color=\"secondary\">\n {propertyConfig?.name}\n </Typography>}\n\n {property && !isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n {property.dataType}\n </Typography>\n </ErrorBoundary>}\n\n {property && isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n This property is defined as a property builder in code\n </Typography>\n </ErrorBoundary>}\n\n {!property && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n This field is defined as an additional field in code\n </Typography>\n </ErrorBoundary>}\n\n </div>\n\n {/*<div className=\"flex flex-row text-xs\">*/}\n {/* <Typography className=\"flex-grow pr-2\"*/}\n {/* variant=\"body2\"*/}\n {/* component=\"span\"*/}\n {/* color=\"secondary\">*/}\n {/* This field can only be edited in code*/}\n {/* </Typography>*/}\n {/*</div>*/}\n </div>\n\n </Paper>\n </div>)\n}\n","import {\n AdditionalFieldDelegate,\n CMSType,\n ErrorBoundary,\n isPropertyBuilder,\n PropertiesOrBuilders,\n PropertyOrBuilder,\n} from \"@firecms/core\";\nimport { AutoAwesomeIcon, defaultBorderMixin, DragHandleIcon, IconButton, RemoveIcon, Tooltip } from \"@firecms/ui\";\nimport { NonEditablePropertyPreview, PropertyFieldPreview } from \"./PropertyFieldPreview\";\nimport { DragDropContext, Draggable, DraggableProvided, Droppable } from \"@hello-pangea/dnd\";\nimport { getFullId, idToPropertiesPath } from \"./util\";\nimport { getIn } from \"formik\";\nimport { editableProperty } from \"../../utils/entities\";\nimport { useCallback } from \"react\";\n\nexport function PropertyTree<M extends {\n [Key: string]: CMSType\n}>({\n namespace,\n selectedPropertyKey,\n onPropertyClick,\n properties,\n propertiesOrder: propertiesOrderProp,\n additionalFields,\n errors,\n onPropertyMove,\n onPropertyRemove,\n className,\n inferredPropertyKeys,\n collectionEditable,\n }: {\n namespace?: string;\n selectedPropertyKey?: string;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n properties: PropertiesOrBuilders<M>;\n propertiesOrder?: string[];\n additionalFields?: AdditionalFieldDelegate<M>[];\n errors: Record<string, any>;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n className?: string;\n inferredPropertyKeys?: string[];\n collectionEditable: boolean;\n}) {\n\n const propertiesOrder = propertiesOrderProp ?? Object.keys(properties);\n\n const onDragEnd = useCallback((result: any) => {\n // dropped outside the list\n if (!result.destination) {\n return;\n }\n const startIndex = result.source.index;\n const endIndex = result.destination.index;\n\n const newPropertiesOrder = Array.from(propertiesOrder);\n const [removed] = newPropertiesOrder.splice(startIndex, 1);\n newPropertiesOrder.splice(endIndex, 0, removed);\n if (onPropertyMove)\n onPropertyMove(newPropertiesOrder, namespace);\n }, [namespace, onPropertyMove, propertiesOrder])\n\n return (\n <>\n\n <DragDropContext onDragEnd={onDragEnd}>\n <Droppable droppableId={`droppable_${namespace}`}>\n {(droppableProvided, droppableSnapshot) => (\n <div\n {...droppableProvided.droppableProps}\n ref={droppableProvided.innerRef}\n className={className}>\n {propertiesOrder && propertiesOrder\n // .filter((propertyKey) => Boolean(properties[propertyKey]))\n .map((propertyKey: string, index: number) => {\n const property = properties[propertyKey] as PropertyOrBuilder;\n const additionalField = additionalFields?.find(field => field.key === propertyKey);\n\n if (!property && !additionalField) {\n console.warn(`Property ${propertyKey} not found in properties or additionalFields`);\n return null;\n }\n return (\n <Draggable\n key={`array_field_${namespace}_${propertyKey}}`}\n draggableId={`array_field_${namespace}_${propertyKey}}`}\n index={index}>\n {(provided, snapshot) => {\n return (\n <ErrorBoundary>\n <PropertyTreeEntry\n propertyKey={propertyKey as string}\n propertyOrBuilder={property}\n additionalField={additionalField}\n provided={provided}\n errors={errors}\n namespace={namespace}\n inferredPropertyKeys={inferredPropertyKeys}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n onPropertyClick={snapshot.isDragging ? undefined : onPropertyClick}\n selectedPropertyKey={selectedPropertyKey}\n collectionEditable={collectionEditable}\n />\n </ErrorBoundary>\n );\n }}\n </Draggable>);\n }).filter(Boolean)}\n\n {droppableProvided.placeholder}\n\n </div>\n )}\n </Droppable>\n </DragDropContext>\n\n </>\n );\n}\n\nexport function PropertyTreeEntry({\n propertyKey,\n namespace,\n propertyOrBuilder,\n additionalField,\n provided,\n selectedPropertyKey,\n errors,\n onPropertyClick,\n onPropertyMove,\n onPropertyRemove,\n inferredPropertyKeys,\n collectionEditable,\n }: {\n propertyKey: string;\n namespace?: string;\n propertyOrBuilder: PropertyOrBuilder;\n additionalField?: AdditionalFieldDelegate<any>;\n selectedPropertyKey?: string;\n provided: DraggableProvided;\n errors: Record<string, any>;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n inferredPropertyKeys?: string[];\n collectionEditable: boolean;\n}) {\n\n const isPropertyInferred = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);\n\n const fullId = getFullId(propertyKey, namespace);\n\n let subtree;\n if (typeof propertyOrBuilder === \"object\") {\n const property = propertyOrBuilder;\n if (property.dataType === \"map\" && property.properties) {\n subtree = <PropertyTree\n selectedPropertyKey={selectedPropertyKey}\n namespace={fullId}\n properties={property.properties}\n propertiesOrder={property.propertiesOrder}\n errors={errors}\n onPropertyClick={onPropertyClick}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n collectionEditable={collectionEditable}\n />\n }\n }\n\n const hasError = fullId ? getIn(errors, idToPropertiesPath(fullId)) : false;\n const selected = selectedPropertyKey === fullId;\n const editable = propertyOrBuilder && ((collectionEditable && !isPropertyBuilder(propertyOrBuilder)) || editableProperty(propertyOrBuilder));\n\n return (\n <div\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n className=\"relative -ml-8\"\n >\n {subtree && <div\n className={\"absolute border-l \" + defaultBorderMixin}\n style={{\n left: \"32px\",\n top: \"64px\",\n bottom: \"16px\"\n }}/>}\n\n {!isPropertyBuilder(propertyOrBuilder) && !additionalField && editable\n ? <PropertyFieldPreview\n property={propertyOrBuilder}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n includeName={true}\n selected={selected}\n hasError={hasError}/>\n : <NonEditablePropertyPreview name={propertyKey}\n property={propertyOrBuilder}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n selected={selected}/>}\n\n <div className=\"absolute top-2 right-2 flex flex-row \">\n\n {isPropertyInferred && <Tooltip title={\"Inferred property\"}>\n <AutoAwesomeIcon size=\"small\" className={\"p-2\"}/>\n </Tooltip>}\n\n {onPropertyRemove && <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n color=\"inherit\"\n onClick={() => onPropertyRemove(propertyKey, namespace)}>\n <RemoveIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>}\n\n {onPropertyMove && <Tooltip title={\"Move\"}>\n <IconButton\n component={\"span\"}\n size=\"small\"\n >\n <DragHandleIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>}\n </div>\n\n\n {subtree && <div className={\"ml-16\"}>{subtree}</div>}\n </div>\n );\n\n}\n","import React, { useCallback, useState } from \"react\";\nimport { MapProperty, Property, PropertyConfig, } from \"@firecms/core\";\nimport { AddIcon, BooleanSwitchWithLabel, Button, Paper, Typography } from \"@firecms/ui\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { PropertyTree } from \"../PropertyTree\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from \"../util\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function MapPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {\n disabled: boolean;\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormikContext<MapProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState<boolean>(false);\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const propertiesOrder = values.propertiesOrder ?? Object.keys(values.properties ?? {});\n const onPropertyCreated = useCallback(({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n setFieldValue(\"properties\", {\n ...(values.properties ?? {}),\n [id]: property\n }, false);\n setFieldValue(\"propertiesOrder\", [...propertiesOrder, id], false);\n setPropertyDialogOpen(false);\n }, [values.properties, propertiesOrder]);\n\n const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n const propertiesPath = idToPropertiesPath(fullId);\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)));\n\n setFieldValue(propertiesPath, undefined, false);\n setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);\n\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }, [setFieldValue, values]);\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n\n const addChildButton = <Button\n color=\"primary\"\n variant={\"outlined\"}\n onClick={() => setPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}\n >\n Add property to {values.name ?? \"this group\"}\n </Button>;\n\n const empty = !propertiesOrder || propertiesOrder.length < 1;\n\n const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {\n setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);\n }, []);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <div className=\"flex justify-between items-end my-4\">\n <Typography variant={\"subtitle2\"}>Properties in this group</Typography>\n {addChildButton}\n </div>\n <Paper className=\"p-2 pl-8\">\n <PropertyTree\n properties={values.properties ?? {}}\n propertiesOrder={propertiesOrder}\n errors={{}}\n collectionEditable={collectionEditable}\n onPropertyClick={(propertyKey, namespace) => {\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n setPropertyDialogOpen(true);\n }}\n onPropertyMove={onPropertyMove}/>\n\n {empty &&\n <Typography variant={\"label\"}\n className=\"h-full flex items-center justify-center p-4\">\n Add the first property to this group\n </Typography>}\n </Paper>\n </div>\n\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n size={\"small\"}\n label=\"Spread children as columns\"\n onValueChange={(v) => setFieldValue(\"spreadChildren\", v)}\n value={values.spreadChildren ?? false}\n />\n <FieldHelperView>\n Set this flag to true if you want to display the children of this group as individual columns.\n </FieldHelperView>\n </div>\n\n <PropertyFormDialog\n inArray={false}\n forceShowErrors={false}\n open={propertyDialogOpen}\n allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n onCancel={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n onOkClicked={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n getData={getData}\n onDelete={deleteProperty}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n existingProperty={Boolean(selectedPropertyKey)}\n autoUpdateId={!selectedPropertyKey}\n autoOpenTypeSelect={!selectedPropertyKey}\n onPropertyChanged={onPropertyCreated}\n existingPropertyKeys={selectedPropertyKey ? undefined : propertiesOrder}\n propertyConfigs={propertyConfigs}\n />\n\n </>);\n}\n","import React, { useCallback, useState } from \"react\";\nimport { ArrayProperty, getFieldConfig, Property, PropertyConfig } from \"@firecms/core\";\nimport { Button, Paper, Typography } from \"@firecms/ui\";\nimport { Field, getIn, useFormikContext } from \"formik\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { PropertyFieldPreview } from \"../PropertyFieldPreview\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\n\nexport function RepeatPropertyField({\n showErrors,\n existing,\n disabled,\n getData,\n allowDataInference,\n propertyConfigs,\n collectionEditable\n }: {\n showErrors: boolean,\n existing: boolean,\n disabled: boolean,\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormikContext<ArrayProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState(false);\n const ofProperty = getIn(values, \"of\");\n const ofPropertyError = getIn(touched, \"of\") && getIn(errors, \"of\");\n\n const onPropertyChanged = useCallback(({ id, property, namespace }:\n { id?: string, property: Property, namespace?: string }) => {\n setFieldValue(\"of\", property);\n }, []);\n\n const widget = ofProperty && getFieldConfig(ofProperty, propertyConfigs);\n return (\n <>\n <div className={\"col-span-12\"}>\n <Typography variant={\"subtitle2\"}>\n Repeat component\n </Typography>\n <Field\n name={\"of\"}\n value={ofProperty}\n validate={(property: Property) => {\n return property?.dataType ? undefined : \"You need to specify a repeat field\";\n }}\n >\n {() => (\n <Paper className=\"p-2 mt-4\">\n\n {ofProperty && <PropertyFieldPreview\n property={ofProperty}\n onClick={disabled ? undefined : () => setPropertyDialogOpen(true)}\n includeName={false}\n includeEditButton={true}\n selected={false}\n hasError={false}/>}\n\n {!disabled && !ofProperty && <Button variant={\"text\"}\n size={\"large\"}\n color={ofPropertyError ? \"error\" : \"primary\"}\n onClick={() => setPropertyDialogOpen(true)}>\n Edit {`${widget ? widget.name : \"repeat component\"}`}\n </Button>}\n\n <PropertyFormDialog\n inArray={true}\n open={propertyDialogOpen}\n existingProperty={existing}\n getData={getData}\n autoUpdateId={!existing}\n autoOpenTypeSelect={!existing}\n onOkClicked={() => setPropertyDialogOpen(false)}\n allowDataInference={allowDataInference}\n property={ofProperty}\n includeIdAndName={false}\n onPropertyChanged={onPropertyChanged}\n forceShowErrors={showErrors}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n />\n </Paper>\n )}\n </Field>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <ArrayPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import { Field, getIn, useFormikContext } from \"formik\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { PropertyWithId } from \"../PropertyEditView\";\nimport React from \"react\";\nimport { FieldHelperView } from \"./FieldHelperView\";\nimport { toSnakeCase, unslugify } from \"@firecms/core\";\n\ntype CommonPropertyFieldsProps = {\n showErrors: boolean,\n disabledId: boolean,\n existingPropertyKeys?: string[];\n disabled: boolean;\n isNewProperty: boolean;\n autoUpdateId: boolean;\n};\n\nexport const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPropertyFieldsProps>(\n function CommonPropertyFields({\n showErrors,\n disabledId,\n existingPropertyKeys,\n disabled,\n autoUpdateId,\n isNewProperty\n }, ref) {\n\n const {\n errors,\n values,\n setFieldValue,\n setFieldTouched,\n touched\n } = useFormikContext<PropertyWithId>();\n\n const name = \"name\";\n const nameError = showErrors && getIn(errors, name);\n\n const id = \"id\";\n const idError = showErrors && getIn(errors, id);\n\n const description = \"description\";\n const descriptionError = showErrors && getIn(errors, description);\n\n return (\n <div className={\"flex flex-col gap-2 col-span-12\"}>\n\n <div>\n <Field\n inputRef={ref}\n as={DebouncedTextField}\n value={values[name]}\n onChange={(e: any) => {\n const newNameValue = e.target.value;\n setFieldValue(name, newNameValue);\n setFieldTouched(name, true, true);\n const idTouched = getIn(touched, id);\n if (!idTouched && autoUpdateId) {\n setFieldValue(id, newNameValue ? toSnakeCase(newNameValue) : \"\")\n }\n }}\n style={{ fontSize: 20 }}\n validate={validateName}\n placeholder={\"Field name\"}\n required\n disabled={disabled}\n error={Boolean(nameError)}/>\n\n <FieldHelperView error={Boolean(nameError)}>\n {nameError}\n </FieldHelperView>\n </div>\n\n <div>\n <Field\n as={DebouncedTextField}\n label={\"ID\"}\n value={values[id]}\n onChange={(e: any) => {\n const newIdValue = e.target.value;\n setFieldValue(id, newIdValue);\n setFieldTouched(id, true, true);\n const nameTouched = getIn(touched, name);\n if (!nameTouched && autoUpdateId) {\n setFieldValue(name, newIdValue ? unslugify(newIdValue) : \"\")\n }\n }}\n validate={() => validateId(values[id], existingPropertyKeys)}\n disabled={disabledId || disabled}\n required\n size=\"small\"\n error={Boolean(idError)}/>\n <FieldHelperView error={Boolean(idError)}>\n {idError}\n </FieldHelperView>\n </div>\n\n <div>\n <Field name={description}\n as={DebouncedTextField}\n label={\"Description\"}\n disabled={disabled}\n error={Boolean(descriptionError)}/>\n <FieldHelperView error={Boolean(descriptionError)}>\n {descriptionError}\n </FieldHelperView>\n </div>\n\n </div>\n );\n\n }\n);\n\nconst idRegEx = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\nfunction validateId(value?: string, existingPropertyKeys?: string[]) {\n\n let error;\n if (!value) {\n error = \"You must specify an id for the field\";\n }\n if (value && !value.match(idRegEx)) {\n error = \"The id can only contain letters, numbers and underscores (_), and not start with a number\";\n }\n if (value && existingPropertyKeys && existingPropertyKeys.includes(value)) {\n error = \"There is another field with this ID already\";\n }\n return error;\n}\n\nfunction validateName(value: string) {\n let error;\n if (!value) {\n error = \"You must specify a title for the field\";\n }\n return error;\n}\n","import React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormikContext } from \"formik\";\n\nimport { TextField } from \"@firecms/ui\";\n\nexport function StringPropertyField({\n widgetId,\n disabled,\n showErrors\n }: {\n widgetId: \"text_field\" | \"multiline\" | \"markdown\" | \"email\";\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue } = useFormikContext();\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n\n {widgetId === \"text_field\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n matches={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n {widgetId === \"multiline\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n {widgetId === \"markdown\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n\n {widgetId === \"email\" &&\n <StringPropertyValidation disabled={disabled}\n max={true}\n min={true}\n trim={true}\n showErrors={showErrors}/>}\n\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import React from \"react\";\nimport { FastField, getIn, useFormikContext } from \"formik\";\n\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { SwitchControl } from \"@firecms/core\";\n\nexport function BooleanPropertyField({ disabled }: {\n disabled: boolean;\n}) {\n const { values } = useFormikContext();\n const defaultValue = getIn(values, \"defaultValue\");\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <FastField type=\"checkbox\"\n name={\"defaultValue\"}\n label={defaultValue === null || defaultValue === undefined ? \"Default value not set\" : (\"Default value is \" + defaultValue.toString())}\n disabled={disabled}\n allowIndeterminate={true}\n component={SwitchControl}/>\n\n </div>\n </>\n );\n}\n","import React, { useCallback, useState } from \"react\";\nimport { AddIcon, Button, Paper, Typography } from \"@firecms/ui\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"../util\";\nimport { PropertyTree } from \"../PropertyTree\";\nimport { ArrayProperty, Property, PropertyConfig } from \"@firecms/core\";\n\nexport function BlockPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {\n disabled: boolean;\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormikContext<ArrayProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState<boolean>(false);\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const onPropertyCreated = useCallback(({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n setFieldValue(\"oneOf.properties\", {\n ...(values.oneOf?.properties ?? {}),\n [id]: property\n }, false);\n setFieldValue(\"oneOf.propertiesOrder\", [...(values.oneOf?.propertiesOrder ?? Object.keys(values.oneOf?.properties ?? {})), id], false);\n setPropertyDialogOpen(false);\n }, [values.oneOf?.properties, values.oneOf?.propertiesOrder]);\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.oneOf?.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n\n const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n setFieldValue(`oneOf.${idToPropertiesPath(fullId)}`, undefined, false);\n const propertiesOrderPath = `oneOf.${namespaceToPropertiesOrderPath(namespace)}`;\n const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath);\n setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);\n\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }, [setFieldValue, values]);\n\n const addChildButton = <Button\n autoFocus\n color=\"primary\"\n\n onClick={() => setPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}\n >\n Add property to {values.name ?? \"this block\"}\n </Button>;\n\n const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {\n setFieldValue(`oneOf.${namespaceToPropertiesOrderPath(namespace)}`, propertiesOrder, false);\n }, []);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <div className={\"flex justify-between items-end mt-8 mb-4\"}>\n <Typography variant={\"subtitle2\"}>Properties in this\n block</Typography>\n {addChildButton}\n </div>\n <Paper className=\"p-2 pl-8\">\n\n <PropertyTree\n properties={values.oneOf?.properties ?? {}}\n propertiesOrder={values.oneOf?.propertiesOrder}\n errors={{}}\n collectionEditable={collectionEditable}\n onPropertyClick={disabled\n ? undefined\n : (propertyKey, namespace) => {\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n setPropertyDialogOpen(true);\n }}\n onPropertyMove={disabled\n ? undefined\n : onPropertyMove}/>\n\n {!disabled && !values.oneOf?.propertiesOrder?.length &&\n <div className=\"h-full flex items-center justify-center p-4\">\n Add the first property to this block\n </div>}\n\n </Paper>\n </div>\n\n {!disabled && <PropertyFormDialog\n inArray={false}\n forceShowErrors={false}\n open={propertyDialogOpen}\n getData={getData}\n allowDataInference={allowDataInference}\n onCancel={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n onOkClicked={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n collectionEditable={collectionEditable}\n onDelete={deleteProperty}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n existingProperty={Boolean(selectedPropertyKey)}\n autoUpdateId={!selectedPropertyKey}\n autoOpenTypeSelect={!selectedPropertyKey}\n onPropertyChanged={onPropertyCreated}\n existingPropertyKeys={selectedPropertyKey ? undefined : values.oneOf?.propertiesOrder}\n propertyConfigs={propertyConfigs}/>}\n\n </>);\n}\n","import React from \"react\";\n\nimport { FastField, getIn, useFormikContext } from \"formik\";\nimport { SwitchControl } from \"@firecms/core\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\n\nexport function NumberPropertyValidation({ disabled }: {\n disabled: boolean;\n}) {\n\n const {\n values,\n handleChange\n } = useFormikContext();\n\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n const validationLessThan = \"validation.lessThan\";\n const validationMoreThan = \"validation.moreThan\";\n const validationPositive = \"validation.positive\";\n const validationNegative = \"validation.negative\";\n const validationInteger = \"validation.integer\";\n\n return (\n\n <div className={\"grid grid-cols-12 gap-2\"}>\n <GeneralPropertyValidation disabled={disabled}/>\n\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n label={\"Min value\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n label={\"Max value\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField\n value={getIn(values, validationLessThan)}\n label={\"Less than\"}\n name={validationLessThan}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField\n value={getIn(values, validationMoreThan)}\n label={\"More than\"}\n name={validationMoreThan}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationPositive}\n label={\"Positive value\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>\n <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationNegative}\n label={\"Negative value\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>\n <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationInteger}\n label={\"Integer value\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>\n </div>\n );\n}\n","import React from \"react\";\nimport { NumberPropertyValidation } from \"./validation/NumberPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { TextField } from \"@firecms/ui\";\nimport { getIn, useFormikContext } from \"formik\";\n\nexport function NumberPropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n const { values, setFieldValue } = useFormikContext();\n\n return (\n <>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <NumberPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n type={\"number\"}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : parseFloat(e.target.value));\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import React from \"react\";\nimport { Field, getIn, useFormikContext } from \"formik\";\nimport { IconForView, NumberProperty, StringProperty, useNavigationController } from \"@firecms/core\";\nimport { CircularProgress, Select, SelectGroup, SelectItem, Typography, } from \"@firecms/ui\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function ReferencePropertyField({\n existing,\n multiple,\n disabled,\n showErrors\n }: { existing: boolean, multiple: boolean, disabled: boolean, showErrors: boolean }) {\n\n const {\n values,\n handleChange,\n errors,\n } = useFormikContext<StringProperty | NumberProperty>();\n\n const navigation = useNavigationController();\n\n if (!navigation)\n return <div className={\"col-span-12\"}>\n <CircularProgress/>\n </div>;\n\n const pathPath = multiple ? \"of.path\" : \"path\";\n const pathValue: string | undefined = getIn(values, pathPath);\n const pathError: string | undefined = showErrors && getIn(errors, pathPath);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <Field required\n name={pathPath}\n pathPath={pathPath}\n type=\"select\"\n validate={validatePath}\n disabled={existing || disabled}\n value={pathValue}\n error={pathError}\n handleChange={handleChange}\n component={CollectionsSelect}/>\n\n </div>\n\n </>\n );\n}\n\nfunction validatePath(value?: string) {\n let error;\n if (!value) {\n error = \"You must specify a target collection for the field\";\n }\n return error;\n}\n\nexport function CollectionsSelect({\n disabled,\n pathPath,\n value,\n handleChange,\n error,\n ...props\n }: {\n disabled: boolean,\n pathPath: string,\n value?: string,\n handleChange: (event: any) => void,\n error?: string\n}) {\n\n const navigation = useNavigationController();\n\n if (!navigation)\n return <div className={\"col-span-12\"}>\n <CircularProgress/>\n </div>;\n\n const collections = navigation?.collections ?? [];\n\n const groups: string[] = Array.from(new Set(\n Object.values(collections).map(e => e.group).filter(Boolean) as string[]\n ).values());\n\n const ungroupedCollections = collections.filter((col) => !col.group);\n\n return (\n <>\n <Select\n error={Boolean(error)}\n disabled={disabled}\n value={value ?? \"\"}\n position={\"item-aligned\"}\n name={pathPath}\n onChange={handleChange}\n label={\"Target collection\"}\n renderValue={(selected) => {\n const selectedCollection = collections.find(collection => collection.id === selected || collection.path === selected);\n if (!selectedCollection) return null;\n return (\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={selectedCollection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {selectedCollection?.name.toUpperCase()}\n </Typography>\n </div>)\n }}\n {...props}>\n\n {groups.flatMap((group) => (\n <SelectGroup label={group || \"Views\"}\n key={`group_${group}`}>\n {\n collections.filter(collection => collection.group === group)\n .map((collection) => {\n return <SelectItem\n key={`${collection.id ?? collection.path}-${group}`}\n value={collection.id ?? collection.path}>\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={collection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {collection?.name.toUpperCase()}\n </Typography>\n </div>\n </SelectItem>;\n })\n\n }\n </SelectGroup>\n ))}\n\n {ungroupedCollections && <SelectGroup label={\"Views\"}>\n {ungroupedCollections\n .map((collection) => {\n return <SelectItem key={collection.id ?? collection.path}\n value={collection.id ?? collection.path}>\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={collection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {collection?.name.toUpperCase()}\n </Typography>\n </div>\n </SelectItem>;\n })\n\n }\n </SelectGroup>}\n\n </Select>\n\n <FieldHelperView>\n You can only edit the reference collection upon field\n creation.\n </FieldHelperView>\n </>\n );\n}\n","import React from \"react\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { NumberProperty, StringProperty } from \"@firecms/core\";\nimport { Select, SelectItem } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function DateTimePropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n const {\n values,\n errors,\n touched,\n setFieldValue\n } = useFormikContext<StringProperty | NumberProperty>();\n\n const modePath = \"mode\";\n const modeValue: string | undefined = getIn(values, modePath);\n const modeError: string | undefined = getIn(touched, modePath) && getIn(errors, modePath);\n\n const autoValuePath = \"autoValue\";\n const autoValueValue: string | undefined = getIn(values, autoValuePath);\n const autoValueError: string | undefined = getIn(touched, autoValuePath) && getIn(errors, autoValuePath);\n\n return (\n <>\n <div className={\"flex flex-col col-span-12\"}>\n <Select name={modePath}\n value={modeValue ?? \"date\"}\n error={Boolean(modeError)}\n onValueChange={(v) => setFieldValue(modePath, v)}\n label={\"Mode\"}\n renderValue={(v) => {\n switch (v) {\n case \"date_time\":\n return \"Date/Time\";\n case \"date\":\n return \"Date\";\n default:\n return \"\";\n }\n }}\n disabled={disabled}>\n <SelectItem value={\"date_time\"}> Date/Time </SelectItem>\n <SelectItem value={\"date\"}> Date </SelectItem>\n </Select>\n <FieldHelperView error={Boolean(modeError)}>\n {modeError}\n </FieldHelperView>\n\n <Select name={autoValuePath}\n disabled={disabled}\n value={autoValueValue ?? \"\"}\n onValueChange={(v) => setFieldValue(autoValuePath, v)}\n renderValue={(v) => {\n switch (v) {\n case \"on_create\":\n return \"On create\";\n case \"on_update\":\n return \"On any update\";\n default:\n return \"None\";\n }\n }}\n error={Boolean(autoValueError)}\n label={\"Automatic value\"}>\n <SelectItem value={\"\"}> None </SelectItem>\n <SelectItem value={\"on_create\"}> On create </SelectItem>\n <SelectItem value={\"on_update\"}> On any update </SelectItem>\n </Select>\n <FieldHelperView error={Boolean(autoValueError)}>\n {autoValueError ?? \"Update this field automatically when creating or updating the entity\"}\n </FieldHelperView>\n\n </div>\n\n <div className={\"col-span-12\"}>\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n </div>\n </>\n );\n}\n","import React from \"react\";\n\nimport { FastField, useFormikContext } from \"formik\";\nimport { SwitchControl } from \"@firecms/core\";\n\nexport function AdvancedPropertyValidation({ disabled }: {disabled: boolean}) {\n\n const { values, handleChange } = useFormikContext();\n\n const columnWidth = \"columnWidth\";\n const hideFromCollection = \"hideFromCollection\";\n const readOnly = \"readOnly\";\n\n return (\n\n <div className={\"grid grid-cols-12 gap-2\"} >\n <div className={\"col-span-12\"}>\n <FastField type=\"checkbox\"\n name={hideFromCollection}\n label={\"Hide from collection\"}\n disabled={disabled}\n tooltip={\"Hide this field from the collection view. It will still be visible in the form view\"}\n component={SwitchControl}/>\n </div>\n\n <div className={\"col-span-12\"}>\n <FastField type=\"checkbox\"\n name={readOnly}\n label={\"Read only\"}\n disabled={disabled}\n tooltip={\"Is this a read only field. Display only as a preview\"}\n component={SwitchControl}/>\n </div>\n </div>\n );\n}\n","import React from \"react\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\n\nexport function KeyValuePropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import {\n ArrayProperty,\n BooleanProperty,\n DateProperty,\n MapProperty,\n mergeDeep,\n NumberProperty,\n Property,\n PropertyConfig,\n StringProperty\n} from \"@firecms/core\";\n\nexport function updatePropertyFromWidget(propertyData: any,\n selectedWidgetId: string | undefined,\n propertyConfigs: Record<string, PropertyConfig>): Property {\n\n let updatedProperty;\n if (selectedWidgetId === \"text_field\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"text_field\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multiline\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"multiline\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n multiline: true,\n storage: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"markdown\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"markdown\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: true,\n email: undefined,\n url: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"url\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"url\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: true,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"email\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"email\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: true,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: propertyData.enumValues ?? []\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multi_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"string\",\n enumValues: propertyData.of?.enumValues ?? []\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"number_input\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"number\",\n propertyConfig: \"number_input\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n enumValues: undefined\n } satisfies NumberProperty\n );\n } else if (selectedWidgetId === \"number_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"number\",\n propertyConfig: \"number_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n enumValues: propertyData.enumValues ?? []\n } satisfies NumberProperty\n );\n } else if (selectedWidgetId === \"multi_number_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_number_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"number\",\n enumValues: propertyData.of?.enumValues ?? []\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"file_upload\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"file_upload\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: {\n storagePath: \"/\"\n }\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multi_file_upload\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_file_upload\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"string\",\n storage: propertyData.of?.storage ?? {\n storagePath: \"/\"\n }\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"group\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"map\",\n propertyConfig: \"group\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n keyValue: false,\n properties: propertyData.properties ?? {}\n } satisfies MapProperty\n );\n } else if (selectedWidgetId === \"key_value\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"map\",\n propertyConfig: \"key_value\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n keyValue: true,\n properties: undefined\n } satisfies MapProperty\n );\n } else if (selectedWidgetId === \"reference\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"reference\",\n propertyConfig: \"reference\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies Property\n );\n } else if (selectedWidgetId === \"multi_references\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_references\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"reference\"\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"switch\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"boolean\",\n propertyConfig: \"switch\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies BooleanProperty\n );\n } else if (selectedWidgetId === \"date_time\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"date\",\n propertyConfig: \"date_time\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n mode: \"date_time\"\n } satisfies DateProperty\n );\n } else if (selectedWidgetId === \"repeat\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"repeat\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"block\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"block\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n oneOf: {\n properties: {}\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId && propertyConfigs[selectedWidgetId]) {\n updatedProperty = {\n ...propertyConfigs[selectedWidgetId].property,\n propertyConfig: selectedWidgetId\n };\n }\n\n return updatedProperty;\n}\n","import { FieldConfigBadge, 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 <FieldConfigBadge propertyConfig={propertyConfig}/>\n </div>\n <div>\n <div>{propertyConfig.name}</div>\n <Typography variant={\"caption\"}\n color={\"disabled\"}\n className={\"max-w-sm\"}>\n {existing && optionDisabled ? \"You can only switch to widgets that use the same data type\" : propertyConfig.description}\n </Typography>\n </div>\n </div>\n </SelectItem>\n}\n","import React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormikContext } from \"formik\";\n\nimport { Select, SelectItem, TextField } from \"@firecms/ui\";\n\nexport function UrlPropertyField({\n disabled,\n showErrors\n }: {\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue } = useFormikContext();\n\n const urlValue = getIn(values, \"url\");\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <Select\n disabled={disabled}\n position={\"item-aligned\"}\n onValueChange={(value: string) => {\n if (value === \"[NONE]\")\n setFieldValue(\"url\", true);\n else\n setFieldValue(\"url\", value);\n }}\n label={\"Preview type\"}\n renderValue={(value: string) => {\n switch (value) {\n case \"image\":\n return \"Image\";\n case \"video\":\n return \"Video\";\n case \"audio\":\n return \"Audio\";\n default:\n return \"Display URL\";\n }\n }}\n value={urlValue ?? \"[NONE]\"}>\n <SelectItem value={\"[NONE]\"}>\n Display URL\n </SelectItem>\n <SelectItem value={\"image\"}>\n Image\n </SelectItem>\n <SelectItem value={\"video\"}>\n Video\n </SelectItem>\n <SelectItem value={\"audio\"}>\n Audio\n </SelectItem>\n </Select>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n\n <StringPropertyValidation disabled={disabled}\n max={true}\n min={true}\n trim={true}\n showErrors={showErrors}/>\n\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import { DEFAULT_FIELD_CONFIGS, FieldConfigId, PropertyConfig } from \"@firecms/core\";\n\nexport const supportedFieldsIds: FieldConfigId[] = [\n \"text_field\",\n \"multiline\",\n \"markdown\",\n \"url\",\n \"email\",\n \"select\",\n \"multi_select\",\n \"number_input\",\n \"number_select\",\n \"multi_number_select\",\n \"file_upload\",\n \"multi_file_upload\",\n \"reference\",\n \"multi_references\",\n \"switch\",\n \"date_time\",\n \"group\",\n \"key_value\",\n \"repeat\",\n \"block\"\n];\n\nexport const supportedFields: Record<string, PropertyConfig> = Object.entries(DEFAULT_FIELD_CONFIGS)\n .filter(([id]) => supportedFieldsIds.includes(id as FieldConfigId))\n .map(([id, config]) => ({ [id]: config }))\n .reduce((a, b) => ({ ...a, ...b }), {});\n","import React, { useDeferredValue, useEffect, useRef, useState } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport { Formik, FormikErrors, FormikProps, getIn } from \"formik\";\nimport {\n DEFAULT_FIELD_CONFIGS,\n DeleteConfirmationDialog,\n FieldConfigBadge,\n FieldConfigId,\n getFieldConfig,\n getFieldId,\n isPropertyBuilder,\n mergeDeep,\n Property,\n PropertyConfig,\n} from \"@firecms/core\";\nimport {\n Button,\n cn,\n DeleteIcon,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n InfoLabel,\n Select,\n Typography\n} from \"@firecms/ui\";\nimport { EnumPropertyField } from \"./properties/EnumPropertyField\";\nimport { StoragePropertyField } from \"./properties/StoragePropertyField\";\nimport { MapPropertyField } from \"./properties/MapPropertyField\";\nimport { RepeatPropertyField } from \"./properties/RepeatPropertyField\";\nimport { CommonPropertyFields } from \"./properties/CommonPropertyFields\";\nimport { StringPropertyField } from \"./properties/StringPropertyField\";\nimport { BooleanPropertyField } from \"./properties/BooleanPropertyField\";\nimport { BlockPropertyField } from \"./properties/BlockPropertyField\";\nimport { NumberPropertyField } from \"./properties/NumberPropertyField\";\nimport { ReferencePropertyField } from \"./properties/ReferencePropertyField\";\nimport { DateTimePropertyField } from \"./properties/DateTimePropertyField\";\nimport { AdvancedPropertyValidation } from \"./properties/advanced/AdvancedPropertyValidation\";\nimport { editableProperty } from \"../../utils/entities\";\nimport { KeyValuePropertyField } from \"./properties/KeyValuePropertyField\";\nimport { updatePropertyFromWidget } from \"./utils/update_property_for_widget\";\nimport { PropertySelectItem } from \"./PropertySelectItem\";\nimport { UrlPropertyField } from \"./properties/UrlPropertyField\";\nimport { supportedFields } from \"./utils/supported_fields\";\n\nexport type PropertyWithId = Property & {\n id?: string\n};\n\nexport type OnPropertyChangedParams = {\n id?: string,\n property: Property,\n namespace?: string,\n previousId?: string\n};\n\nexport type PropertyFormProps = {\n includeIdAndName?: boolean;\n existingProperty: boolean;\n autoUpdateId?: boolean;\n autoOpenTypeSelect: boolean;\n inArray: boolean;\n propertyKey?: string;\n propertyNamespace?: string;\n property?: Property;\n onPropertyChanged?: (params: OnPropertyChangedParams) => void;\n onPropertyChangedImmediate?: boolean;\n onDelete?: (id?: string, namespace?: string) => void;\n onError?: (id: string, namespace?: string, error?: FormikErrors<any>) => void;\n initialErrors?: FormikErrors<any>;\n forceShowErrors?: boolean;\n existingPropertyKeys?: string[];\n allowDataInference: boolean;\n getData?: () => Promise<object[]>;\n getHelpers?: (formikProps: FormikProps<PropertyWithId>) => void;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n};\n\nexport const PropertyForm = React.memo(\n function PropertyForm({\n includeIdAndName = true,\n autoOpenTypeSelect,\n existingProperty,\n autoUpdateId,\n inArray,\n propertyKey,\n propertyNamespace,\n property,\n onPropertyChanged,\n onPropertyChangedImmediate = true,\n onDelete,\n onError,\n initialErrors,\n forceShowErrors,\n existingPropertyKeys,\n allowDataInference,\n getHelpers,\n getData,\n propertyConfigs,\n collectionEditable\n }: PropertyFormProps) {\n\n const initialValue: PropertyWithId = {\n id: \"\",\n name: \"\"\n } as PropertyWithId;\n\n const disabled = (Boolean(property && !editableProperty(property)) && !collectionEditable);\n\n const lastSubmittedProperty = useRef<OnPropertyChangedParams | undefined>(property ? {\n id: propertyKey,\n previousId: propertyKey,\n property\n } : undefined);\n\n const doOnPropertyChanged = ({\n id,\n property\n }: OnPropertyChangedParams) => {\n const params = {\n id,\n previousId: lastSubmittedProperty.current?.id,\n property,\n namespace: propertyNamespace\n };\n lastSubmittedProperty.current = params;\n onPropertyChanged?.(params);\n };\n\n return <Formik\n key={`property_view_${propertyKey}`}\n initialErrors={initialErrors}\n initialValues={property\n ? { id: propertyKey, ...property } as PropertyWithId\n : initialValue}\n onSubmit={(newPropertyWithId: PropertyWithId, helpers) => {\n console.debug(\"onSubmit\", newPropertyWithId);\n const {\n id,\n ...property\n } = newPropertyWithId;\n doOnPropertyChanged({\n id,\n property: { ...property, editable: property.editable ?? true }\n });\n if (!existingProperty)\n helpers.resetForm({ values: initialValue });\n }}\n // validate={(values) => {\n // console.log(\"validate property\", values)\n // const errors: any = {};\n // if (!values?.dataType || !getFieldConfig(values)) {\n // errors.selectedWidget = \"Required\";\n // }\n // if (existingPropertyKeys && values?.id && existingPropertyKeys.includes(values?.id)) {\n // errors.id = \"\";\n // }\n // console.log(\"errors\", errors)\n // return errors;\n // }}\n >\n {(props) => {\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n getHelpers?.(props);\n }, [props]);\n\n return <PropertyEditView\n onPropertyChanged={onPropertyChangedImmediate\n ? doOnPropertyChanged\n : undefined}\n onDelete={onDelete}\n includeIdAndTitle={includeIdAndName}\n propertyNamespace={propertyNamespace}\n onError={onError}\n showErrors={forceShowErrors || props.submitCount > 0}\n existing={existingProperty}\n autoUpdateId={autoUpdateId}\n inArray={inArray}\n autoOpenTypeSelect={autoOpenTypeSelect}\n existingPropertyKeys={existingPropertyKeys}\n disabled={disabled}\n getData={getData}\n allowDataInference={allowDataInference}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n {...props}/>;\n\n }}\n\n </Formik>\n }, (a, b) =>\n a.getData === b.getData &&\n a.includeIdAndName === b.includeIdAndName &&\n a.autoOpenTypeSelect === b.autoOpenTypeSelect &&\n a.autoUpdateId === b.autoUpdateId &&\n a.existingProperty === b.existingProperty\n);\n\nexport function PropertyFormDialog({\n open,\n onCancel,\n onOkClicked,\n onPropertyChanged,\n getData,\n collectionEditable,\n ...formProps\n }: PropertyFormProps & {\n open?: boolean;\n onOkClicked?: () => void;\n onCancel?: () => void;\n}) {\n const helpersRef = useRef<FormikProps<PropertyWithId>>();\n const getHelpers = (helpers: FormikProps<PropertyWithId>) => {\n helpersRef.current = helpers;\n };\n\n return <Dialog\n open={open ?? false}\n maxWidth={\"xl\"}\n fullWidth={true}\n >\n\n <DialogContent>\n <PropertyForm {...formProps}\n onPropertyChanged={(params) => {\n onPropertyChanged?.(params);\n onOkClicked?.();\n }}\n collectionEditable={collectionEditable}\n onPropertyChangedImmediate={false}\n getHelpers={getHelpers}\n getData={getData}\n />\n </DialogContent>\n\n <DialogActions>\n\n {onCancel && <Button\n variant={\"text\"}\n onClick={() => {\n onCancel();\n helpersRef.current?.resetForm();\n }}>\n Cancel\n </Button>}\n\n <Button variant=\"outlined\"\n color=\"primary\"\n onClick={() => helpersRef.current?.submitForm()}>\n Ok\n </Button>\n </DialogActions>\n </Dialog>;\n\n}\n\nfunction PropertyEditView({\n values,\n errors,\n touched,\n setValues,\n setFieldValue,\n existing,\n autoUpdateId = false,\n autoOpenTypeSelect,\n includeIdAndTitle,\n onPropertyChanged,\n onDelete,\n propertyNamespace,\n onError,\n showErrors,\n disabled,\n inArray,\n existingPropertyKeys,\n getData,\n allowDataInference,\n propertyConfigs,\n collectionEditable\n }: {\n includeIdAndTitle?: boolean;\n existing: boolean;\n autoUpdateId?: boolean;\n autoOpenTypeSelect: boolean;\n propertyNamespace?: string;\n onPropertyChanged?: (params: OnPropertyChangedParams) => void;\n onDelete?: (id?: string, namespace?: string) => void;\n onError?: (id: string, namespace?: string, error?: FormikErrors<any>) => void;\n showErrors: boolean;\n inArray: boolean;\n disabled: boolean;\n existingPropertyKeys?: string[];\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n} & FormikProps<PropertyWithId>) {\n\n const [selectOpen, setSelectOpen] = useState(autoOpenTypeSelect);\n const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);\n const [selectedFieldConfigId, setSelectedFieldConfigId] = useState<string | undefined>(values?.dataType ? getFieldId(values) : undefined);\n\n const allSupportedFields = Object.entries(supportedFields).concat(Object.entries(propertyConfigs));\n\n const displayedWidgets = inArray\n ? allSupportedFields.filter(([_, propertyConfig]) => !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.dataType !== \"array\")\n : allSupportedFields;\n\n const deferredValues = useDeferredValue(values);\n const nameFieldRef = useRef<HTMLInputElement>(null);\n\n const lastSubmittedProperty = useRef<object>(values);\n\n const selectedWidgetError = showErrors && getIn(errors, \"selectedWidget\");\n\n useEffect(() => {\n if (onPropertyChanged) {\n if ((!includeIdAndTitle || deferredValues.id)) {\n const {\n id,\n ...property\n } = deferredValues;\n if (!equal(deferredValues, lastSubmittedProperty.current)) {\n onPropertyChanged({\n id,\n property,\n namespace: propertyNamespace\n });\n lastSubmittedProperty.current = deferredValues;\n }\n }\n }\n }, [deferredValues, includeIdAndTitle, onPropertyChanged, propertyNamespace]);\n\n useEffect(() => {\n if (values?.id && onError && Object.keys(errors).length > 0) {\n onError(values?.id, propertyNamespace, errors);\n }\n }, [errors, onError, propertyNamespace, values?.id]);\n\n const onWidgetSelectChanged = (newSelectedWidgetId: FieldConfigId) => {\n setSelectedFieldConfigId(newSelectedWidgetId);\n setValues(updatePropertyFromWidget(values, newSelectedWidgetId, propertyConfigs));\n // Ugly hack to autofocus the name field\n setTimeout(() => {\n nameFieldRef.current?.focus();\n }, 0);\n };\n\n let childComponent;\n if (selectedFieldConfigId === \"text_field\" ||\n selectedFieldConfigId === \"multiline\" ||\n selectedFieldConfigId === \"markdown\" ||\n selectedFieldConfigId === \"email\") {\n childComponent =\n <StringPropertyField widgetId={selectedFieldConfigId}\n disabled={disabled}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"url\") {\n childComponent =\n <UrlPropertyField disabled={disabled}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"select\" ||\n selectedFieldConfigId === \"number_select\") {\n childComponent = <EnumPropertyField\n multiselect={false}\n allowDataInference={allowDataInference}\n updateIds={!existing}\n disabled={disabled}\n getData={getData}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"multi_select\" ||\n selectedFieldConfigId === \"multi_number_select\") {\n childComponent = <EnumPropertyField\n multiselect={true}\n updateIds={!existing}\n disabled={disabled}\n allowDataInference={allowDataInference}\n getData={getData}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"file_upload\") {\n childComponent =\n <StoragePropertyField existing={existing}\n multiple={false}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"multi_file_upload\") {\n childComponent =\n <StoragePropertyField existing={existing}\n multiple={true}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"switch\") {\n childComponent = <BooleanPropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"number_input\") {\n childComponent = <NumberPropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"group\") {\n childComponent =\n <MapPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"block\") {\n childComponent =\n <BlockPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"reference\") {\n childComponent =\n <ReferencePropertyField showErrors={showErrors}\n existing={existing}\n multiple={false}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"date_time\") {\n childComponent = <DateTimePropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"multi_references\") {\n childComponent =\n <ReferencePropertyField showErrors={showErrors}\n existing={existing}\n multiple={true}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"repeat\") {\n childComponent =\n <RepeatPropertyField showErrors={showErrors}\n existing={existing}\n getData={getData}\n allowDataInference={allowDataInference}\n disabled={disabled}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"key_value\") {\n childComponent =\n <KeyValuePropertyField disabled={disabled}/>;\n } else {\n childComponent = null;\n }\n\n return (\n <>\n {disabled && <InfoLabel mode={\"warn\"}>\n <Typography>This property can&apos;t be edited</Typography>\n <Typography variant={\"caption\"}>\n You may not have permission to\n edit it or it is defined in code with no <code>editable</code> flag\n </Typography>\n </InfoLabel>}\n\n <div className=\"flex mt-2 justify-between\">\n <div className={\"w-full flex flex-col gap-2\"}>\n <Select\n // className={\"w-full\"}\n error={Boolean(selectedWidgetError)}\n value={selectedFieldConfigId ?? \"\"}\n placeholder={\"Select a property widget\"}\n open={selectOpen}\n onOpenChange={setSelectOpen}\n position={\"item-aligned\"}\n disabled={disabled}\n renderValue={(value) => {\n if (!value) {\n return <em>Select a property\n widget</em>;\n }\n const key = value as FieldConfigId;\n const propertyConfig = DEFAULT_FIELD_CONFIGS[key] ?? propertyConfigs[key];\n const baseProperty = propertyConfig.property;\n const baseFieldConfig = baseProperty && !isPropertyBuilder(baseProperty) ? getFieldConfig(baseProperty, propertyConfigs) : undefined;\n const optionDisabled = isPropertyBuilder(baseProperty) || (existing && baseProperty.dataType !== values?.dataType);\n const computedFieldConfig = baseFieldConfig ? mergeDeep(baseFieldConfig, propertyConfig) : propertyConfig;\n return <div\n onClick={(e) => {\n if (optionDisabled) {\n e.stopPropagation();\n e.preventDefault();\n }\n }}\n className={cn(\n \"flex items-center\",\n optionDisabled ? \"w-full pointer-events-none opacity-50\" : \"\")}>\n <div className={\"mr-8\"}>\n <FieldConfigBadge propertyConfig={computedFieldConfig}/>\n </div>\n <div className={\"flex flex-col items-start text-base text-left\"}>\n <div>{computedFieldConfig.name}</div>\n <Typography variant={\"caption\"}\n color={\"disabled\"}>\n {optionDisabled ? \"You can only switch to widgets that use the same data type\" : computedFieldConfig.description}\n </Typography>\n </div>\n </div>\n }}\n onValueChange={(value) => {\n onWidgetSelectChanged(value as FieldConfigId);\n }}>\n {displayedWidgets.map(([key, propertyConfig]) => {\n const baseProperty = propertyConfig.property;\n const optionDisabled = existing && !isPropertyBuilder(baseProperty) && baseProperty.dataType !== values?.dataType;\n return <PropertySelectItem\n key={key}\n value={key}\n optionDisabled={optionDisabled}\n propertyConfig={propertyConfig}\n existing={existing}/>;\n })}\n </Select>\n\n {selectedWidgetError &&\n <Typography variant=\"caption\"\n className={\"ml-3.5\"}\n color={\"error\"}>Required</Typography>}\n\n {/*<Typography variant=\"caption\" className={\"ml-3.5\"}>Define your own custom properties and*/}\n {/* components</Typography>*/}\n\n </div>\n\n {onDelete && values?.id &&\n <IconButton\n variant={\"ghost\"}\n className=\"m-4\"\n disabled={disabled}\n onClick={() => setDeleteDialogOpen(true)}>\n <DeleteIcon/>\n </IconButton>}\n </div>\n\n <div className={\"grid grid-cols-12 gap-y-12 mt-8 mb-8\"}>\n {includeIdAndTitle &&\n <CommonPropertyFields showErrors={showErrors}\n disabledId={existing}\n isNewProperty={!existing}\n existingPropertyKeys={existingPropertyKeys}\n disabled={disabled}\n autoUpdateId={autoUpdateId}\n ref={nameFieldRef}/>}\n\n {childComponent}\n\n <div className={\"col-span-12\"}>\n <AdvancedPropertyValidation disabled={disabled}/>\n </div>\n </div>\n\n {onDelete &&\n <DeleteConfirmationDialog open={deleteDialogOpen}\n onAccept={() => onDelete(values?.id, propertyNamespace)}\n onCancel={() => setDeleteDialogOpen(false)}\n title={<div>Delete this property?</div>}\n body={\n <div> This will <b>not delete any\n data</b>, only modify the\n collection.</div>\n }/>}\n\n </>\n );\n}\n","export function camelCase(str: string): string {\n return (str.slice(0, 1).toLowerCase() + str.slice(1))\n .replace(/([-_ ]){1,}/g, ' ')\n .split(/[-_ ]/)\n .reduce((cur, acc) => {\n return cur + acc[0].toUpperCase() + acc.substring(1);\n }, \"\");\n}\n","import {\n EntityCollection,\n useSnackbarController\n} from \"@firecms/core\";\nimport {\n Button,\n ContentCopyIcon,\n Dialog,\n DialogActions,\n DialogContent,\n Typography,\n} from \"@firecms/ui\";\nimport React from \"react\";\nimport JSON5 from \"json5\";\nimport { Highlight, themes } from \"prism-react-renderer\"\nimport { camelCase } from \"./utils/strings\";\n\nexport function GetCodeDialog({ collection, onOpenChange, open }: { onOpenChange: (open: boolean) => void, collection: any, open: any }) {\n\n const snackbarController = useSnackbarController();\n\n const code = \"import { EntityCollection } from \\\"firecms\\\";\\n\\nconst \" + camelCase(collection.name) + \"Collection:EntityCollection = \" + JSON5.stringify(collectionToCode(collection), null, \"\\t\");\n return <Dialog open={open}\n onOpenChange={onOpenChange}\n maxWidth={\"4xl\"}>\n <DialogContent>\n <Typography variant={\"h6\"} className={\"my-4\"}>\n Code for {collection.name}\n </Typography>\n <Typography variant={\"body2\"} className={\"my-4 mb-8\"}>\n If you want to customise the collection in code, you can add this collection code to your CMS\n app configuration.\n More info in the <a\n rel=\"noopener noreferrer\"\n href={\"https://firecms.co/docs/customization_quickstart\"}>docs</a>.\n </Typography>\n <Highlight\n theme={themes.vsDark}\n code={code}\n language=\"typescript\"\n >\n {({ className, style, tokens, getLineProps, getTokenProps }) => (\n <pre style={style} className={\"p-4 rounded text-sm\"}>\n {tokens.map((line, i) => (\n <div key={i} {...getLineProps({ line })}>\n {line.map((token, key) => (\n <span key={key} {...getTokenProps({ token })} />\n ))}\n </div>\n ))}\n </pre>\n )}\n </Highlight>\n\n </DialogContent>\n <DialogActions>\n <Button\n variant={\"text\"}\n size={\"small\"}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n snackbarController.open({\n type: \"success\",\n message: `Copied`\n })\n return navigator.clipboard.writeText(code);\n }}>\n <ContentCopyIcon size={\"small\"}/>\n Copy to clipboard\n </Button>\n <Button onClick={() => onOpenChange(false)}>Close</Button>\n </DialogActions>\n </Dialog>;\n}\n\nfunction collectionToCode(collection: EntityCollection): object {\n\n const propertyCleanup = (property: any) => {\n\n const updatedProperty = {\n ...property\n };\n\n delete updatedProperty.fromBuilder;\n delete updatedProperty.resolved;\n delete updatedProperty.propertiesOrder;\n delete updatedProperty.editable;\n\n if (updatedProperty.type === \"map\") {\n return {\n ...updatedProperty,\n properties: updatedProperty.properties.map(propertyCleanup)\n }\n }\n return updatedProperty;\n }\n\n return {\n id: collection.id,\n name: collection.name,\n singularName: collection.singularName,\n path: collection.path,\n description: collection.description,\n editable: true,\n collectionGroup: collection.collectionGroup,\n icon: collection.icon,\n group: collection.group,\n customId: collection.customId,\n initialFilter: collection.initialFilter,\n initialSort: collection.initialSort,\n properties: Object.entries(collection.properties)\n .map(([key, value]) => ({\n [key]: propertyCleanup(value)\n }))\n .reduce((a, b) => ({ ...a, ...b }), {}),\n subcollections: (collection.subcollections ?? []).map(collectionToCode)\n }\n\n}\n","import React, { useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { Field, FormikErrors, getIn, useFormikContext } from \"formik\";\nimport {\n EntityCollection,\n ErrorBoundary,\n isPropertyBuilder,\n makePropertiesEditable,\n Properties,\n Property,\n PropertyConfig,\n PropertyOrBuilder,\n useLargeLayout,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport {\n AddIcon,\n AutoAwesomeIcon,\n Button,\n CircularProgress,\n cn,\n CodeIcon,\n DebouncedTextField,\n defaultBorderMixin,\n IconButton,\n Paper,\n Tooltip,\n Typography,\n} from \"@firecms/ui\";\n\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"./util\";\nimport { OnPropertyChangedParams, PropertyForm, PropertyFormDialog } from \"./PropertyEditView\";\nimport { PropertyTree } from \"./PropertyTree\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\nimport { GetCodeDialog } from \"./GetCodeDialog\";\n\ntype CollectionEditorFormProps = {\n showErrors: boolean;\n isNewCollection: boolean;\n propertyErrorsRef?: React.MutableRefObject<any>;\n onPropertyError: (propertyKey: string, namespace: string | undefined, error?: FormikErrors<any>) => void;\n setDirty?: (dirty: boolean) => void;\n reservedGroups?: string[];\n extraIcon: React.ReactNode;\n getUser: (uid: string) => User | null;\n getData?: () => Promise<object[]>;\n doCollectionInference: (collection: PersistedCollection) => Promise<Partial<EntityCollection> | null> | undefined;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n};\n\nexport function CollectionPropertiesEditorForm({\n showErrors,\n isNewCollection,\n propertyErrorsRef,\n onPropertyError,\n setDirty,\n reservedGroups,\n extraIcon,\n getUser,\n getData,\n doCollectionInference,\n propertyConfigs,\n collectionEditable\n }: CollectionEditorFormProps) {\n\n const {\n values,\n setFieldValue,\n setFieldError,\n setFieldTouched,\n errors,\n dirty\n } = useFormikContext<PersistedCollection>();\n\n const snackbarController = useSnackbarController();\n\n const largeLayout = useLargeLayout();\n const asDialog = !largeLayout\n\n // index of the selected property within the namespace\n const [selectedPropertyIndex, setSelectedPropertyIndex] = useState<number | undefined>();\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n const [codeDialogOpen, setCodeDialogOpen] = useState<boolean>(false);\n\n const [inferringProperties, setInferringProperties] = useState<boolean>(false);\n\n const [newPropertyDialogOpen, setNewPropertyDialogOpen] = useState<boolean>(false);\n const [inferredPropertyKeys, setInferredPropertyKeys] = useState<string[]>([]);\n\n const currentPropertiesOrderRef = React.useRef<{\n [key: string]: string[]\n }>(values.propertiesOrder ? { \"\": values.propertiesOrder } : {});\n\n useEffect(() => {\n if (setDirty)\n setDirty(dirty);\n }, [dirty]);\n\n const inferPropertiesFromData = doCollectionInference\n ? (): void => {\n if (!doCollectionInference)\n return;\n\n setInferringProperties(true);\n // @ts-ignore\n doCollectionInference(values)\n .then((newCollection) => {\n\n if (newCollection)\n makePropertiesEditable(newCollection.properties as Properties);\n\n if (!newCollection) {\n snackbarController.open({\n type: \"error\",\n message: \"Could not infer properties from data\"\n });\n return;\n }\n // find properties in the new collection, not present in the current one\n const newPropertyKeys = (newCollection.properties ? Object.keys(newCollection.properties) : [])\n .filter((propertyKey) => !values.properties[propertyKey]);\n if (newPropertyKeys.length === 0) {\n snackbarController.open({\n type: \"info\",\n message: \"No new properties found in existing data\"\n });\n return;\n }\n // add them to the current collection\n const updatedProperties = {\n ...newPropertyKeys.reduce((acc, propertyKey) => {\n acc[propertyKey] = (newCollection.properties ?? {})[propertyKey];\n return acc;\n }, {} as { [key: string]: PropertyOrBuilder }),\n ...values.properties\n };\n const updatedPropertiesOrder = [\n ...newPropertyKeys,\n ...(values.propertiesOrder ?? [])\n ];\n setFieldValue(\"properties\", updatedProperties, false);\n\n updatePropertiesOrder(updatedPropertiesOrder);\n\n setInferredPropertyKeys(newPropertyKeys);\n })\n .finally(() => {\n setInferringProperties(false);\n })\n }\n : undefined;\n\n const getCurrentPropertiesOrder = (namespace?: string) => {\n if (!namespace) return currentPropertiesOrderRef.current[\"\"];\n return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));\n }\n\n const updatePropertiesOrder = (newPropertiesOrder: string[], namespace?: string) => {\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n setFieldValue(propertiesOrderPath, newPropertiesOrder, false);\n currentPropertiesOrderRef.current[namespace ?? \"\"] = newPropertiesOrder;\n\n };\n\n const deleteProperty = (propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n setFieldValue(idToPropertiesPath(fullId), undefined, false);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n const newPropertiesOrder = currentPropertiesOrder.filter((p) => p !== propertyKey);\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n setNewPropertyDialogOpen(false);\n\n setSelectedPropertyIndex(undefined);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n };\n\n const onPropertyMove = (propertiesOrder: string[], namespace?: string) => {\n setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);\n };\n\n const onPropertyCreated = ({\n id,\n property\n }: {\n id?: string,\n property: Property\n }) => {\n if (!id) {\n throw Error(\"Need to include an ID when creating a new property\")\n }\n setFieldValue(\"properties\", {\n ...(values.properties ?? {}),\n [id]: property\n }, false);\n const newPropertiesOrder = [...(values.propertiesOrder ?? Object.keys(values.properties)), id];\n\n updatePropertiesOrder(newPropertiesOrder);\n\n setNewPropertyDialogOpen(false);\n if (largeLayout) {\n setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n setSelectedPropertyKey(id);\n }\n setSelectedPropertyNamespace(undefined);\n };\n\n const onPropertyChanged = ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => {\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // If the id has changed we need to a little cleanup\n if (previousId && previousId !== id) {\n const previousFullId = getFullId(previousId, namespace);\n const previousPropertyPath = idToPropertiesPath(previousFullId);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n\n // replace previousId with id in propertiesOrder\n const newPropertiesOrder = currentPropertiesOrder\n .map((p) => p === previousId ? id : p)\n .filter((p) => p !== undefined) as string[];\n\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n if (id) {\n setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n setSelectedPropertyKey(id);\n }\n setFieldValue(previousPropertyPath, undefined, false);\n setFieldTouched(previousPropertyPath, false, false);\n }\n\n console.debug(\"onPropertyChanged\", {\n id,\n property,\n previousId,\n namespace,\n propertyPath\n })\n\n if (propertyPath) {\n setFieldValue(propertyPath, property, false);\n setFieldTouched(propertyPath, true, false);\n }\n\n };\n\n const onPropertyErrorInternal = useCallback((id: string, namespace?: string, error?: FormikErrors<any>) => {\n const propertyPath = id ? getFullId(id, namespace) : undefined;\n console.warn(\"onPropertyErrorInternal\", {\n id,\n namespace,\n error,\n propertyPath\n });\n if (propertyPath) {\n const hasError = error && Object.keys(error).length > 0;\n onPropertyError(id, namespace, hasError ? error : undefined);\n setFieldError(idToPropertiesPath(propertyPath), hasError ? \"Property error\" : undefined);\n }\n }, [])\n\n const closePropertyDialog = () => {\n setSelectedPropertyIndex(undefined);\n setSelectedPropertyKey(undefined);\n };\n\n const initialErrors = selectedPropertyKey && propertyErrorsRef?.current?.properties ? propertyErrorsRef.current.properties[selectedPropertyKey] : undefined;\n\n const emptyCollection = values?.propertiesOrder === undefined || values.propertiesOrder.length === 0;\n\n const usedPropertiesOrder = (values.propertiesOrder\n ? values.propertiesOrder\n : Object.keys(values.properties)) as string[];\n\n const owner = useMemo(() => getUser(values.ownerId), [getUser, values.ownerId]);\n const body = (\n <div className={\"grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900\"}>\n <div className={cn(\n \"p-4 md:p-8 pb-20 md:pb-20\",\n \"col-span-12 lg:col-span-5 h-full overflow-auto\",\n !asDialog && \"border-r \" + defaultBorderMixin\n )}>\n\n <div className=\"flex my-2\">\n\n <div className=\"flex-grow mb-4\">\n\n <Field\n name={\"name\"}\n as={DebouncedTextField}\n invisible={true}\n className=\"-ml-1\"\n inputClassName=\"text-2xl font-headers\"\n placeholder={\"Collection name\"}\n size={\"small\"}\n required\n error={Boolean(errors?.name)}/>\n\n {owner &&\n <Typography variant={\"body2\"}\n className={\"ml-2\"}\n color={\"secondary\"}>\n Created by {owner.displayName}\n </Typography>}\n </div>\n\n {extraIcon && <div className=\"ml-4\">\n {extraIcon}\n </div>}\n\n <div className=\"ml-1 mt-2 flex flex-row gap-2\">\n <Tooltip title={\"Get the code for this collection\"}>\n <IconButton\n variant={\"filled\"}\n disabled={inferringProperties}\n onClick={() => setCodeDialogOpen(true)}>\n <CodeIcon/>\n </IconButton>\n </Tooltip>\n {inferPropertiesFromData && <Tooltip title={\"Add new properties based on data\"}>\n <IconButton\n variant={\"filled\"}\n disabled={inferringProperties}\n onClick={inferPropertiesFromData}>\n {inferringProperties ? <CircularProgress size={\"small\"}/> : <AutoAwesomeIcon/>}\n </IconButton>\n </Tooltip>}\n <Tooltip title={\"Add new property\"}>\n <Button\n variant={\"outlined\"}\n onClick={() => setNewPropertyDialogOpen(true)}>\n <AddIcon/>\n </Button>\n </Tooltip>\n </div>\n </div>\n\n <ErrorBoundary>\n <PropertyTree\n className={\"pl-8\"}\n onPropertyClick={(propertyKey, namespace) => {\n setSelectedPropertyIndex(usedPropertiesOrder.indexOf(propertyKey));\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n }}\n inferredPropertyKeys={inferredPropertyKeys}\n selectedPropertyKey={selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined}\n properties={values.properties}\n additionalFields={values.additionalFields}\n propertiesOrder={usedPropertiesOrder}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={isNewCollection ? deleteProperty : undefined}\n collectionEditable={collectionEditable}\n errors={showErrors ? errors : {}}/>\n </ErrorBoundary>\n\n <Button className={\"mt-8 w-full\"}\n color=\"primary\"\n variant={\"outlined\"}\n size={\"large\"}\n onClick={() => setNewPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}>\n Add new property\n </Button>\n </div>\n\n {!asDialog &&\n <div className={\"col-span-12 lg:col-span-7 ml-2 p-4 md:p-8 h-full overflow-auto pb-20 md:pb-20\"}>\n <Paper\n className=\"sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center \">\n\n {selectedPropertyFullId &&\n selectedProperty &&\n !isPropertyBuilder(selectedProperty) &&\n <PropertyForm\n inArray={false}\n key={`edit_view_${selectedPropertyIndex}`}\n existingProperty={!isNewCollection}\n autoUpdateId={false}\n allowDataInference={!isNewCollection}\n autoOpenTypeSelect={false}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n onPropertyChanged={onPropertyChanged}\n onDelete={deleteProperty}\n onError={onPropertyErrorInternal}\n forceShowErrors={showErrors}\n initialErrors={initialErrors}\n getData={getData}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n />}\n\n {!selectedProperty &&\n <Typography variant={\"label\"} className=\"flex items-center justify-center h-full\">\n {emptyCollection\n ? \"Now you can add your first property\"\n : \"Select a property to edit it\"}\n </Typography>}\n\n {selectedProperty && isPropertyBuilder(selectedProperty) &&\n <Typography variant={\"label\"} className=\"flex items-center justify-center\">\n {\"This property is defined as a property builder in code\"}\n </Typography>}\n </Paper>\n </div>}\n\n {asDialog && <PropertyFormDialog\n inArray={false}\n open={selectedPropertyIndex !== undefined}\n key={`edit_view_${selectedPropertyIndex}`}\n autoUpdateId={!selectedProperty}\n allowDataInference={!isNewCollection}\n existingProperty={true}\n autoOpenTypeSelect={false}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n onPropertyChanged={onPropertyChanged}\n onDelete={deleteProperty}\n onError={onPropertyErrorInternal}\n forceShowErrors={showErrors}\n initialErrors={initialErrors}\n getData={getData}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n onOkClicked={asDialog\n ? closePropertyDialog\n : undefined\n }/>}\n\n </div>);\n\n return (<>\n\n {body}\n\n {/* This is the dialog used for new properties*/}\n <PropertyFormDialog\n inArray={false}\n existingProperty={false}\n autoOpenTypeSelect={true}\n autoUpdateId={true}\n forceShowErrors={showErrors}\n open={newPropertyDialogOpen}\n onCancel={() => setNewPropertyDialogOpen(false)}\n onPropertyChanged={onPropertyCreated}\n getData={getData}\n allowDataInference={!isNewCollection}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n existingPropertyKeys={values.propertiesOrder as string[]}/>\n\n <GetCodeDialog\n collection={values}\n open={codeDialogOpen}\n onOpenChange={setCodeDialogOpen}/>\n\n </>\n );\n}\n","import React from \"react\";\nimport { Button, Dialog, DialogActions, DialogContent, Typography } from \"@firecms/ui\";\n\nexport interface UnsavedChangesDialogProps {\n open: boolean;\n body?: React.ReactNode;\n title?: string;\n handleOk: () => void;\n handleCancel: () => void;\n}\n\nexport function UnsavedChangesDialog({\n open,\n handleOk,\n handleCancel,\n body,\n title\n }: UnsavedChangesDialogProps) {\n\n return (\n <Dialog\n open={open}\n onOpenChange={(open) => open ? handleCancel() : handleOk()}\n aria-labelledby=\"alert-dialog-title\"\n aria-describedby=\"alert-dialog-description\"\n >\n <DialogContent>\n <Typography variant={\"h6\"}>\n {title ?? \"Unsaved changes\"}\n </Typography>\n\n {body && <Typography>\n {body}\n </Typography>}\n <Typography>\n Are you sure?\n </Typography>\n\n </DialogContent>\n\n <DialogActions>\n <Button variant=\"text\" onClick={handleCancel} autoFocus> Cancel </Button>\n <Button onClick={handleOk}> Ok </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import { useCustomizationController } from \"@firecms/core\";\nimport { Button, Dialog, DialogActions, DialogContent, Typography } from \"@firecms/ui\";\nimport React from \"react\";\n\nexport function EntityCustomViewsSelectDialog({ open, onClose }: { open: boolean, onClose: (selectedViewKey?: string) => void }) {\n const {\n entityViews,\n } = useCustomizationController();\n\n return <Dialog\n maxWidth={\"md\"}\n open={open}>\n <DialogContent className={\"flex flex-col gap-4\"}>\n <Typography variant={\"h6\"}>\n Select view\n </Typography>\n {entityViews?.map((view) => {\n return <Button\n key={view.key}\n onClick={() => onClose(view.key)}\n fullWidth\n variant={\"text\"}\n >\n {view.name} ({view.key})\n </Button>;\n })}\n {(entityViews ?? []).length === 0 &&\n <Typography variant={\"body2\"}>\n No custom views defined\n </Typography>\n }\n </DialogContent>\n <DialogActions>\n <Button variant={\"outlined\"} onClick={() => onClose()}>Cancel</Button>\n </DialogActions>\n </Dialog>\n}\n","import React from \"react\";\nimport {\n DeleteConfirmationDialog,\n EntityCollection,\n EntityCustomView,\n resolveEntityView,\n useCustomizationController,\n User\n} from \"@firecms/core\";\nimport {\n AddIcon,\n Button,\n Container,\n DeleteIcon,\n IconButton,\n InfoLabel,\n Paper,\n Table,\n TableBody,\n TableCell,\n TableRow,\n Tooltip,\n Typography,\n} from \"@firecms/ui\";\nimport { useFormikContext } from \"formik\";\nimport { CollectionEditorDialog } from \"./CollectionEditorDialog\";\nimport { CollectionsConfigController } from \"../../types/config_controller\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\nimport { CollectionInference } from \"../../types/collection_inference\";\nimport { EntityCustomViewsSelectDialog } from \"./EntityCustomViewsSelectDialog\";\n\nexport function SubcollectionsEditTab({\n collection,\n parentCollection,\n configController,\n collectionInference,\n getUser,\n parentCollectionIds\n }: {\n collection: PersistedCollection,\n parentCollection?: EntityCollection,\n configController: CollectionsConfigController;\n collectionInference?: CollectionInference;\n getUser: (uid: string) => User | null;\n parentCollectionIds?: string[];\n}) {\n\n const { entityViews: contextEntityViews } = useCustomizationController();\n\n const [subcollectionToDelete, setSubcollectionToDelete] = React.useState<string | undefined>();\n const [addEntityViewDialogOpen, setAddEntityViewDialogOpen] = React.useState<boolean>(false);\n const [viewToDelete, setViewToDelete] = React.useState<string | undefined>();\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n editedCollectionPath?: string,\n }>();\n\n const {\n values,\n setFieldValue,\n } = useFormikContext<EntityCollection>();\n\n const subcollections = collection.subcollections ?? [];\n const resolvedEntityViews = values.entityViews?.filter(e => typeof e === \"string\")\n .map(e => resolveEntityView(e, contextEntityViews))\n .filter(Boolean) as EntityCustomView[] ?? [];\n const hardCodedEntityViews = collection.entityViews?.filter(e => typeof e !== \"string\") as EntityCustomView[] ?? [];\n const totalEntityViews = resolvedEntityViews.length + hardCodedEntityViews.length;\n\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"2xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n <div className={\"flex flex-col gap-16\"}>\n\n <div className={\"flex-grow flex flex-col gap-4 items-start\"}>\n <Typography variant={\"h5\"}>\n Subcollections of {values.name}\n </Typography>\n\n {subcollections && subcollections.length > 0 &&\n <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n <Table>\n <TableBody>\n {subcollections.map((subcollection) => (\n <TableRow key={subcollection.path}\n onClick={() => setCurrentDialog({\n isNewCollection: false,\n editedCollectionPath: subcollection.path,\n })}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {subcollection.name}\n </Typography>\n </TableCell>\n <TableCell\n align=\"right\">\n <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n setSubcollectionToDelete(subcollection.path);\n }}\n color=\"inherit\">\n <DeleteIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Paper>}\n\n <Button\n onClick={() => {\n setCurrentDialog({\n isNewCollection: true\n });\n }}\n variant={\"outlined\"}\n startIcon={<AddIcon/>}>\n Add subcollection\n </Button>\n </div>\n\n <div className={\"flex-grow flex flex-col gap-4 items-start\"}>\n <Typography variant={\"h5\"}>\n Custom views\n </Typography>\n\n {totalEntityViews > 0 && <>\n <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n <Table>\n <TableBody>\n {resolvedEntityViews.map((view) => (\n <TableRow key={view.key}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {view.name}\n </Typography>\n </TableCell>\n <TableCell\n align=\"right\">\n <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n setViewToDelete(view.key);\n }}\n color=\"inherit\">\n <DeleteIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n </TableCell>\n </TableRow>\n ))}\n {hardCodedEntityViews.map((view) => (\n <TableRow key={view.key}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {view.name}\n </Typography>\n <Typography variant={\"caption\"} className={\"flex-grow\"}>\n This view is defined in code with\n key <code>{view.key}</code>\n </Typography>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Paper>\n\n </>}\n\n {totalEntityViews === 0 &&\n <InfoLabel>\n <b>COMING SOON</b> Define your own custom views by uploading it with the CLI\n </InfoLabel>\n }\n\n <Button\n onClick={() => {\n setAddEntityViewDialogOpen(true);\n }}\n variant={\"outlined\"}\n startIcon={<AddIcon/>}>\n Add custom entity view\n </Button>\n\n </div>\n\n </div>\n </Container>\n\n <div style={{ height: \"52px\" }}/>\n\n {subcollectionToDelete &&\n <DeleteConfirmationDialog open={Boolean(subcollectionToDelete)}\n onAccept={() => {\n configController.deleteCollection({\n path: subcollectionToDelete,\n parentCollectionIds: [...(parentCollectionIds ?? []), collection.path]\n });\n setSubcollectionToDelete(undefined);\n }}\n onCancel={() => setSubcollectionToDelete(undefined)}\n title={<>Delete this subcollection?</>}\n body={<> This will <b>not\n delete any data</b>, only\n the collection in the CMS</>}/>}\n {viewToDelete &&\n <DeleteConfirmationDialog open={Boolean(viewToDelete)}\n onAccept={() => {\n setFieldValue(\"entityViews\", values.entityViews?.filter(e => e !== viewToDelete));\n setViewToDelete(undefined);\n }}\n onCancel={() => setViewToDelete(undefined)}\n title={<>Remove this view?</>}\n body={<>This will <b>not\n delete any data</b>, only\n the view in the CMS</>}/>}\n\n <CollectionEditorDialog\n open={Boolean(currentDialog)}\n configController={configController}\n parentCollection={collection}\n collectionInference={collectionInference}\n parentCollectionIds={[...parentCollectionIds ?? [], values.id]}\n isNewCollection={false}\n {...currentDialog}\n getUser={getUser}\n handleClose={() => {\n setCurrentDialog(undefined);\n }}/>\n\n <EntityCustomViewsSelectDialog\n open={addEntityViewDialogOpen}\n onClose={(selectedViewKey) => {\n if (selectedViewKey) {\n setFieldValue(\"entityViews\", [...(values.entityViews ?? []), selectedViewKey]);\n }\n setAddEntityViewDialogOpen(false);\n }}/>\n </div>\n );\n}\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const productsCollectionTemplate: EntityCollection = {\n id: \"products\",\n path: \"products\",\n name: \"Products\",\n singularName: \"Product\",\n icon: \"shopping_cart\",\n description: \"List of the products currently sold in your shop\",\n properties: makePropertiesEditable({\n name: {\n dataType: \"string\",\n name: \"Name\",\n description: \"Name of this product\",\n validation: {\n required: true\n }\n },\n brand: {\n dataType: \"string\",\n name: \"Brand\",\n validation: {\n required: true\n }\n },\n description: {\n dataType: \"string\",\n name: \"Description\",\n description: \"Description of this product, supports markdown\",\n markdown: true\n },\n main_image: {\n dataType: \"string\",\n name: \"Image\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n },\n description: \"Upload field for images\"\n },\n available: {\n dataType: \"boolean\",\n name: \"Available\",\n columnWidth: 100,\n description: \"Is this product available in the website\"\n },\n price: {\n dataType: \"number\",\n name: \"Price\",\n validation: {\n requiredMessage: \"You must set a positive price\",\n min: 0\n }\n },\n images: {\n dataType: \"array\",\n name: \"Images\",\n hideFromCollection: true,\n of: {\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"]\n }\n }\n },\n related_products: {\n dataType: \"array\",\n name: \"Related products\",\n description: \"Products related to this one\",\n of: {\n dataType: \"reference\",\n path: \"products\"\n }\n },\n metadata: {\n name: \"Metadata\",\n description: \"This is an example of a map property\",\n dataType: \"map\",\n keyValue: true\n },\n added_on: {\n dataType: \"date\",\n name: \"Added on\",\n autoValue: \"on_create\"\n }\n })\n};\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const blogCollectionTemplate:EntityCollection = {\n id: \"blog\",\n path: \"blog\",\n name: \"Blog\",\n singularName: \"Blog entry\",\n icon: \"article\",\n description: \"A collection of blog entries\",\n defaultSize: \"l\",\n properties: makePropertiesEditable({\n name: {\n name: \"Name\",\n validation: { required: true },\n dataType: \"string\"\n },\n header_image: {\n name: \"Header image\",\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n metadata: {\n cacheControl: \"max-age=1000000\"\n }\n }\n },\n content: {\n name: \"Content\",\n description: \"Content blocks for the blog entry\",\n validation: { required: true },\n dataType: \"array\",\n oneOf: {\n typeField: \"type\",\n valueField: \"value\",\n properties: {\n text: {\n dataType: \"string\",\n name: \"Text\",\n markdown: true\n },\n quote: {\n dataType: \"string\",\n name: \"Quote\",\n multiline: true\n },\n images: {\n name: \"Images\",\n dataType: \"array\",\n of: {\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n metadata: {\n cacheControl: \"max-age=1000000\"\n }\n }\n },\n description: \"This fields allows uploading multiple images at once and reordering\"\n },\n products: {\n name: \"Products\",\n dataType: \"array\",\n of: {\n dataType: \"reference\",\n path: \"products\",\n previewProperties: [\"name\", \"main_image\"]\n }\n }\n },\n propertiesOrder: [\"text\", \"quote\", \"images\", \"products\"]\n }\n },\n created_on: {\n name: \"Created on\",\n dataType: \"date\",\n autoValue: \"on_create\"\n },\n status: {\n name: \"Status\",\n validation: { required: true },\n dataType: \"string\",\n enumValues: {\n published: {\n id: \"published\",\n label: \"Published\",\n },\n draft: \"Draft\"\n },\n defaultValue: \"draft\"\n },\n publish_date: {\n name: \"Publish date\",\n dataType: \"date\",\n clearable: true\n },\n reviewed: {\n name: \"Reviewed\",\n dataType: \"boolean\"\n },\n tags: {\n name: \"Tags\",\n description: \"Example of generic array\",\n dataType: \"array\",\n of: {\n dataType: \"string\",\n previewAsTag: true\n }\n }\n }),\n initialFilter: {\n status: [\"==\", \"published\"]\n }\n};\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const usersCollectionTemplate: EntityCollection = {\n id: \"users\",\n path: \"users\",\n name: \"Users\",\n singularName: \"User\",\n description: \"Registered users in the app/web\",\n icon: \"person\",\n properties: makePropertiesEditable({\n displayName: {\n name: \"Display name\",\n dataType: \"string\"\n },\n email: {\n name: \"Email\",\n dataType: \"string\",\n email: true\n },\n emailVerified: {\n name: \"Email verified\",\n dataType: \"boolean\"\n },\n phone: {\n name: \"Phone\",\n dataType: \"string\"\n },\n favourite_products: {\n name: \"Favourite products\",\n dataType: \"array\",\n of: {\n dataType: \"reference\",\n path: \"products\"\n }\n },\n photoURL: {\n name: \"Photo URL\",\n dataType: \"string\",\n url: \"image\"\n }\n }),\n};\n","import { EntityCollection } from \"@firecms/core\";\n\nexport const pagesCollectionTemplate: EntityCollection = {\n id: \"pages\",\n path: \"pages\",\n name: \"Pages\",\n singularName: \"Page\",\n icon: \"insert_drive_file\",\n description: \"List of website pages that can be edited here\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Page Title\",\n validation: { required: true }\n },\n slug: {\n dataType: \"string\",\n name: \"URL Slug\",\n validation: {\n required: true,\n unique: true,\n matches: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n matchesMessage: \"Must be lowercase, alphanumeric, and hyphenated\"\n }\n },\n hero_section: {\n dataType: \"map\",\n name: \"Hero Section\",\n properties: {\n headline: {\n dataType: \"string\",\n name: \"Headline\",\n validation: { required: true }\n },\n subhead: {\n dataType: \"string\",\n name: \"Subheadline\"\n },\n background_image: {\n dataType: \"string\",\n name: \"Background Image\",\n storage: {\n storagePath: \"page_hero/images\",\n acceptedFiles: [\"image/*\"],\n }\n },\n call_to_action: {\n dataType: \"string\",\n name: \"Call to Action\"\n },\n call_to_action_link: {\n dataType: \"string\",\n name: \"CTA Link\",\n url: true\n }\n }\n },\n content: {\n dataType: \"array\",\n name: \"Content\",\n oneOf: {\n properties: {\n section: {\n dataType: \"map\",\n name: \"Section\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Section Title\",\n validation: { required: true }\n },\n content: {\n dataType: \"string\",\n name: \"Section Content\",\n markdown: true\n },\n image: {\n dataType: \"string\",\n name: \"Section Image\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n },\n link: {\n dataType: \"string\",\n name: \"Section Link\",\n url: true\n }\n }\n },\n image: {\n dataType: \"string\",\n name: \"Image\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n },\n slider: {\n dataType: \"array\",\n name: \"Slider\",\n of: {\n dataType: \"map\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Title\",\n validation: { required: true }\n },\n image: {\n dataType: \"string\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n }\n }\n }\n },\n }\n }\n },\n sidebar: {\n dataType: \"map\",\n name: \"Sidebar\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Sidebar Title\",\n validation: { required: false }\n },\n content: {\n dataType: \"string\",\n name: \"Sidebar Content\",\n markdown: true\n }\n }\n },\n seo_metadata: {\n dataType: \"map\",\n name: \"SEO Metadata\",\n properties: {\n meta_title: {\n dataType: \"string\",\n name: \"Meta Title\"\n },\n meta_description: {\n dataType: \"string\",\n name: \"Meta Description\"\n },\n focus_keywords: {\n dataType: \"array\",\n name: \"Focus Keywords\",\n of: {\n dataType: \"string\"\n }\n }\n }\n },\n footer_override: {\n dataType: \"string\",\n name: \"Footer Override\",\n markdown: true\n },\n publish_date: {\n dataType: \"date\",\n name: \"Publish Date\",\n validation: { required: true }\n },\n last_updated: {\n dataType: \"date\",\n name: \"Last Updated\",\n autoValue: \"on_update\"\n },\n is_published: {\n dataType: \"boolean\",\n name: \"Is Published\",\n columnWidth: 100,\n description: \"Should this page be live on the site?\"\n },\n author_uid: {\n dataType: \"reference\",\n name: \"Author\",\n path: \"users\"\n }\n }\n};\n","import React, { useEffect, useState } from \"react\";\nimport { EntityCollection, unslugify, } from \"@firecms/core\";\nimport { Button, Card, Chip, CircularProgress, cn, Container, Icon, Tooltip, Typography, } from \"@firecms/ui\";\nimport { useFormikContext } from \"formik\";\n\nimport { productsCollectionTemplate } from \"./templates/products_template\";\nimport { blogCollectionTemplate } from \"./templates/blog_template\";\nimport { usersCollectionTemplate } from \"./templates/users_template\";\nimport { ImportFileUpload } from \"@firecms/data_import_export\";\nimport { pagesCollectionTemplate } from \"./templates/pages_template\";\n\nexport function CollectionEditorWelcomeView({\n path,\n pathSuggestions,\n parentCollection,\n onContinue,\n collections\n }: {\n path: string;\n pathSuggestions?: (path: string) => Promise<string[]>;\n parentCollection?: EntityCollection;\n onContinue: (importData?: object[]) => void;\n collections?: EntityCollection[];\n}) {\n\n const [loadingPathSuggestions, setLoadingPathSuggestions] = useState(false);\n const [filteredPathSuggestions, setFilteredPathSuggestions] = useState<string[] | undefined>();\n useEffect(() => {\n if (pathSuggestions && collections) {\n setLoadingPathSuggestions(true);\n pathSuggestions(path)\n .then(suggestions => {\n const filteredSuggestions = suggestions.filter(s => !collections.find(c => c.path.trim().toLowerCase() === s.trim().toLowerCase()));\n setFilteredPathSuggestions(filteredSuggestions);\n })\n .finally(() => setLoadingPathSuggestions(false));\n }\n }, [collections, path, pathSuggestions]);\n\n const {\n values,\n setFieldValue,\n setValues,\n handleChange,\n touched,\n errors,\n setFieldTouched,\n isSubmitting,\n submitCount\n } = useFormikContext<EntityCollection>();\n\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"4xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <div\n className=\"flex flex-row py-2 pt-3 items-center\">\n <Typography variant={\"h4\"} className={\"flex-grow\"}>\n New collection\n </Typography>\n </div>\n\n {parentCollection && <Chip colorScheme={\"tealDarker\"}>\n <Typography variant={\"caption\"}>\n This is a subcollection of <b>{parentCollection.name}</b>\n </Typography>\n </Chip>}\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Use one of the existing paths in your database:\n </Typography>\n <div className={\"flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7\"}>\n\n {loadingPathSuggestions && !filteredPathSuggestions && <CircularProgress size={\"small\"}/>}\n\n {filteredPathSuggestions?.map((suggestion, index) => (\n <Chip key={suggestion}\n colorScheme={\"cyanLighter\"}\n onClick={() => {\n setFieldValue(\"name\", unslugify(suggestion));\n setFieldValue(\"id\", suggestion);\n setFieldValue(\"path\", suggestion);\n setFieldValue(\"properties\", undefined);\n onContinue();\n }}\n size=\"small\">\n {suggestion}\n </Chip>\n ))}\n\n {!loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0 &&\n <Typography variant={\"caption\"}>\n No suggestions\n </Typography>\n }\n\n </div>\n\n </div>\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Select a template:\n </Typography>\n\n <div className={\"flex gap-4\"}>\n <TemplateButton title={\"Products\"}\n subtitle={\"A collection of products with images, prices and stock\"}\n icon={<Icon size={\"small\"} iconKey={productsCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(productsCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Users\"}\n subtitle={\"A collection of users with emails, names and roles\"}\n icon={<Icon size={\"small\"} iconKey={usersCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(usersCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Blog posts\"}\n subtitle={\"A collection of blog posts with images, authors and complex content\"}\n icon={<Icon size={\"small\"} iconKey={blogCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(blogCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Pages\"}\n subtitle={\"A collection of pages with images, authors and complex content\"}\n icon={<Icon size={\"small\"} iconKey={pagesCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(pagesCollectionTemplate);\n onContinue();\n }}/>\n </div>\n\n </div>\n\n {!parentCollection && <div>\n\n <Typography variant={\"caption\"}\n color={\"secondary\"}\n className={\"mb-2\"}>\n ● Create a collection from a file (csv, json, xls, xslx...)\n </Typography>\n\n <ImportFileUpload onDataAdded={(data) => onContinue(data)}/>\n\n </div>}\n\n <div>\n\n <Button variant={\"text\"} onClick={() => onContinue()} className={\"my-2\"}>\n Continue from scratch\n </Button>\n </div>\n\n {/*<div style={{ height: \"52px\" }}/>*/}\n\n </Container>\n </div>\n );\n}\n\nexport function TemplateButton({\n title,\n subtitle,\n icon,\n onClick\n }: {\n title: string,\n icon: React.ReactNode,\n subtitle: string,\n onClick?: () => void\n}) {\n\n return (\n <Tooltip title={subtitle}>\n <Card\n onClick={onClick}\n className={cn(\n \"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center\",\n \"text-gray-700 dark:text-gray-300\",\n \"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary\",\n \"border-gray-400 dark:border-gray-600 \"\n )}\n >\n {icon}\n <div className={\"flex flex-col items-start\"}>\n\n <Typography variant={\"subtitle1\"}>\n {title}\n </Typography>\n {/*<Typography>*/}\n {/* {subtitle}*/}\n {/*</Typography>*/}\n\n </div>\n </Card>\n </Tooltip>\n );\n\n}\n","import {\n DataNewPropertiesMapping,\n getInferenceType,\n ImportConfig,\n ImportNewPropertyFieldPreview\n} from \"@firecms/data_import_export\";\nimport { getIn, useFormikContext } from \"formik\";\n\nimport {\n FieldConfigBadge,\n getFieldConfig,\n getFieldId,\n Properties,\n Property,\n PropertyConfig,\n} from \"@firecms/core\";\nimport {\n Container,\n Select,\n Tooltip,\n Typography\n} from \"@firecms/ui\";\nimport React, { useState } from \"react\";\nimport { OnPropertyChangedParams, PropertyFormDialog, PropertyWithId } from \"../PropertyEditView\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"../util\";\nimport { PersistedCollection } from \"../../../types/persisted_collection\";\nimport { updatePropertyFromWidget } from \"../utils/update_property_for_widget\";\nimport { PropertySelectItem } from \"../PropertySelectItem\";\nimport { supportedFields } from \"../utils/supported_fields\";\nimport { buildPropertyFromData } from \"@firecms/schema_inference\";\n\nexport function CollectionEditorImportMapping({\n importConfig,\n propertyConfigs,\n collectionEditable\n }:\n {\n importConfig: ImportConfig,\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean\n }) {\n\n const {\n setFieldValue,\n setFieldTouched,\n values\n } = useFormikContext<PersistedCollection>();\n const [selectedProperty, setSelectedProperty] = useState<PropertyWithId | undefined>(undefined);\n\n const currentPropertiesOrderRef = React.useRef<{\n [key: string]: string[]\n }>(values.propertiesOrder ? { \"\": values.propertiesOrder } : {});\n\n const propertyKey = selectedProperty ? selectedProperty.id : undefined;\n const property = selectedProperty || undefined;\n\n const onPropertyChanged = ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => {\n\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // setSelectedProperty(property);\n const getCurrentPropertiesOrder = (namespace?: string) => {\n if (!namespace) return currentPropertiesOrderRef.current[\"\"];\n return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));\n }\n\n const updatePropertiesOrder = (newPropertiesOrder: string[], namespace?: string) => {\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n setFieldValue(propertiesOrderPath, newPropertiesOrder, false);\n currentPropertiesOrderRef.current[namespace ?? \"\"] = newPropertiesOrder;\n\n };\n\n // If the id has changed we need to a little cleanup\n if (previousId && previousId !== id) {\n const previousFullId = getFullId(previousId, namespace);\n const previousPropertyPath = idToPropertiesPath(previousFullId);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n\n // replace previousId with id in propertiesOrder\n const newPropertiesOrder = currentPropertiesOrder\n .map((p) => p === previousId ? id : p)\n .filter((p) => p !== undefined) as string[];\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n // replace previousId with id in headersMapping\n const newHeadersMapping = { ...importConfig.headersMapping };\n Object.keys(newHeadersMapping).forEach((key) => {\n if (newHeadersMapping[key] === previousId) {\n newHeadersMapping[key] = id ?? \"\";\n }\n });\n importConfig.setHeadersMapping(newHeadersMapping);\n\n // if (id) {\n // setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n // setSelectedPropertyKey(id);\n // }\n setFieldValue(previousPropertyPath, undefined, false);\n setFieldTouched(previousPropertyPath, false, false);\n }\n\n if (propertyPath) {\n setFieldValue(propertyPath, property, false);\n setFieldTouched(propertyPath, true, false);\n }\n };\n const onPropertyTypeChanged = async ({\n id,\n importKey,\n property,\n namespace\n }: OnPropertyChangedParams & {\n importKey: string\n }) => {\n\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // we try to infer the rest of the properties of a property, from the type and the data\n const propertyData = importConfig.importData.map((d) => getIn(d, importKey));\n const inferredNewProperty = {\n ...buildPropertyFromData(propertyData, property, getInferenceType),\n editable: true\n };\n\n if (propertyPath) {\n if (inferredNewProperty) {\n setFieldValue(propertyPath, inferredNewProperty, false);\n } else {\n setFieldValue(propertyPath, property, false);\n }\n setFieldTouched(propertyPath, true, false);\n }\n };\n\n return (\n\n <div className={\"overflow-auto my-auto bg-gray-50 dark:bg-gray-900\"}>\n <Container maxWidth={\"6xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <Typography variant=\"h6\" className={\"mt-4\"}>Data property mapping</Typography>\n\n <DataNewPropertiesMapping headersMapping={importConfig.headersMapping}\n idColumn={importConfig.idColumn}\n originProperties={importConfig.originProperties}\n destinationProperties={values.properties as Properties}\n onIdPropertyChanged={(value) => importConfig.setIdColumn(value)}\n buildPropertyView={({\n property,\n propertyKey,\n importKey\n }) => {\n return <ImportNewPropertyFieldPreview\n property={property}\n propertyKey={propertyKey}\n onPropertyNameChanged={(propertyKey: string, value: string) => setFieldValue(`properties.${propertyKey}.name`, value, false)}\n onEditClick={() => {\n if (!propertyKey || !property) return;\n setSelectedProperty({\n ...property,\n id: propertyKey,\n editable: true\n });\n }}\n propertyTypeView={<PropertySelect property={property}\n disabled={false}\n onPropertyChanged={(props) => onPropertyTypeChanged({\n ...props,\n importKey\n })}\n propertyKey={propertyKey}\n propertyConfigs={propertyConfigs}/>}\n />;\n }}/>\n </Container>\n\n <PropertyFormDialog\n open={selectedProperty !== undefined}\n propertyKey={propertyKey}\n property={property}\n inArray={false}\n autoUpdateId={false}\n onPropertyChanged={onPropertyChanged}\n allowDataInference={false}\n collectionEditable={collectionEditable}\n onOkClicked={() => {\n setSelectedProperty(undefined);\n }}\n onCancel={() => {\n setSelectedProperty(undefined);\n }}\n autoOpenTypeSelect={false}\n existingProperty={false}\n propertyConfigs={propertyConfigs}/>\n\n <div style={{ height: \"52px\" }}/>\n </div>\n );\n\n}\n\nfunction PropertySelect({\n property,\n onPropertyChanged,\n propertyKey,\n propertyConfigs,\n disabled\n }: {\n property: Property | null,\n propertyKey: string | null,\n onPropertyChanged: ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => void,\n propertyConfigs: Record<string, PropertyConfig>,\n disabled?: boolean\n}) {\n\n const fieldId = property ? getFieldId(property) : null;\n const widget = property ? getFieldConfig(property, propertyConfigs) : null;\n\n const [selectOpen, setSelectOpen] = useState(false);\n\n return <Tooltip title={property && widget ? `${widget?.name} - ${property.dataType}` : undefined}\n open={selectOpen ? false : undefined}>\n <Select\n open={selectOpen}\n onOpenChange={setSelectOpen}\n invisible={true}\n className={\"w-full\"}\n disabled={disabled}\n error={!widget}\n value={fieldId ?? \"\"}\n placeholder={\"Select a property widget\"}\n position={\"item-aligned\"}\n renderValue={(value) => {\n if (!widget) return null;\n return <FieldConfigBadge propertyConfig={widget}/>\n }}\n onValueChange={(newSelectedWidgetId) => {\n const newProperty = updatePropertyFromWidget(property, newSelectedWidgetId, propertyConfigs)\n if (!propertyKey) return;\n onPropertyChanged({\n id: propertyKey,\n property: newProperty,\n previousId: propertyKey,\n namespace: undefined\n });\n }}>\n {Object.entries(supportedFields).map(([key, widget]) => {\n return <PropertySelectItem\n key={key}\n value={key}\n optionDisabled={false}\n propertyConfig={widget}\n existing={false}/>;\n })\n }\n </Select>\n </Tooltip>;\n}\n","import { convertDataToEntity, getPropertiesMapping, ImportConfig } from \"@firecms/data_import_export\";\nimport { EntityCollectionTable, Properties, useSelectionController } from \"@firecms/core\";\nimport { useEffect } from \"react\";\nimport { Typography } from \"@firecms/ui\";\n\nexport function CollectionEditorImportDataPreview({ importConfig, properties, propertiesOrder }: {\n importConfig: ImportConfig,\n properties: Properties,\n propertiesOrder: string[]\n}) {\n\n useEffect(() => {\n const propertiesMapping = getPropertiesMapping(importConfig.originProperties, properties);\n const mappedData = importConfig.importData.map(d => convertDataToEntity(d, importConfig.idColumn, importConfig.headersMapping, properties, propertiesMapping, \"TEMP_PATH\"));\n importConfig.setEntities(mappedData);\n }, []);\n\n const selectionController = useSelectionController();\n\n return <EntityCollectionTable\n title={<div>\n <Typography variant={\"subtitle2\"}>Imported data preview</Typography>\n <Typography variant={\"caption\"}>Entities with the same id will be overwritten</Typography>\n </div>}\n tableController={{\n data: importConfig.entities,\n dataLoading: false,\n noMoreToLoad: false\n }}\n endAdornment={<div className={\"h-12\"}/>}\n filterable={false}\n sortable={false}\n selectionController={selectionController}\n displayedColumnIds={propertiesOrder.map(p => ({ key: p, disabled: false }))}\n properties={properties}/>\n\n}\n","import { Properties, slugify } from \"@firecms/core\";\nimport { ImportConfig } from \"@firecms/data_import_export\";\n\nexport function cleanPropertiesFromImport(properties: Properties, parentSlug = \"\"): {\n headersMapping: ImportConfig[\"headersMapping\"],\n properties: Properties,\n idColumn?: ImportConfig[\"idColumn\"],\n} {\n\n const result = Object.keys(properties).reduce((acc, key) => {\n const property = properties[key];\n const slug = slugify(key);\n const fullSlug = parentSlug ? `${parentSlug}.${slug}` : slug;\n\n if (property.dataType === \"map\" && property.properties) {\n const slugifiedResult = cleanPropertiesFromImport(property.properties as Properties, fullSlug);\n return {\n headersMapping: { ...acc.headersMapping, [key]: fullSlug },\n properties: {\n ...acc.properties,\n [slug]: {\n ...property,\n properties: slugifiedResult.properties,\n propertiesOrder: Object.keys(slugifiedResult.properties)\n }\n }\n }\n }\n\n const updatedProperties = {\n ...acc.properties,\n [slug]: property\n } as Properties;\n\n const headersMapping = { ...acc.headersMapping, [key]: fullSlug } as Record<string, string>;\n\n return {\n headersMapping,\n properties: updatedProperties,\n }\n }, { headersMapping: {}, properties: {} });\n\n const firstKey = Object.keys(result.headersMapping)?.[0];\n let idColumn: string | undefined;\n if (firstKey?.includes(\"id\") || firstKey?.includes(\"key\")) {\n idColumn = firstKey;\n }\n\n return {\n ...result,\n idColumn\n };\n}\n","import * as React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n CircularProgressCenter,\n CMSType,\n EntityCollection,\n ErrorView,\n isPropertyBuilder,\n MapProperty,\n mergeDeep,\n Properties,\n PropertiesOrBuilders,\n Property,\n PropertyConfig,\n PropertyOrBuilder,\n randomString,\n removeInitialAndTrailingSlashes,\n removeUndefined,\n TopNavigationResult,\n useAuthController,\n useCustomizationController,\n useNavigationController,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport {\n ArrowBackIcon,\n Button,\n cn,\n coolIconKeys,\n defaultBorderMixin,\n Dialog,\n DialogActions,\n DialogContent,\n DoneIcon,\n IconButton,\n LoadingButton,\n Tab,\n Tabs,\n} from \"@firecms/ui\";\nimport { Form, Formik, FormikHelpers } from \"formik\";\nimport { YupSchema } from \"./CollectionYupValidation\";\nimport { CollectionDetailsForm } from \"./CollectionDetailsForm\";\nimport { CollectionPropertiesEditorForm } from \"./CollectionPropertiesEditorForm\";\nimport { UnsavedChangesDialog } from \"./UnsavedChangesDialog\";\nimport { SubcollectionsEditTab } from \"./SubcollectionsEditTab\";\nimport { CollectionsConfigController } from \"../../types/config_controller\";\nimport { CollectionEditorWelcomeView } from \"./CollectionEditorWelcomeView\";\nimport { CollectionInference } from \"../../types/collection_inference\";\nimport { getInferenceType, ImportSaveInProgress, useImportConfig } from \"@firecms/data_import_export\";\nimport { buildEntityPropertiesFromData } from \"@firecms/schema_inference\";\nimport { CollectionEditorImportMapping } from \"./import/CollectionEditorImportMapping\";\nimport { CollectionEditorImportDataPreview } from \"./import/CollectionEditorImportDataPreview\";\nimport { cleanPropertiesFromImport } from \"./import/clean_import_data\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\n\nexport interface CollectionEditorDialogProps {\n open: boolean;\n isNewCollection: boolean;\n initialValues?: {\n group?: string,\n path?: string,\n name?: string,\n }\n editedCollectionPath?: string; // last segment of the path, like `locales`\n fullPath?: string; // full path of this particular collection, like `products/123/locales`\n parentCollectionIds?: string[]; // path ids of the parent collection, like [`products`]\n handleClose: (collection?: EntityCollection) => void;\n configController: CollectionsConfigController;\n reservedGroups?: string[];\n collectionInference?: CollectionInference;\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n pathSuggestions?: (path?: string) => Promise<string[]>;\n getUser: (uid: string) => User | null;\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n parentCollection?: PersistedCollection;\n}\n\nexport function CollectionEditorDialog(props: CollectionEditorDialogProps) {\n\n const open = props.open;\n\n const [formDirty, setFormDirty] = React.useState<boolean>(false);\n const [unsavedChangesDialogOpen, setUnsavedChangesDialogOpen] = React.useState<boolean>(false);\n\n const handleCancel = useCallback(() => {\n if (!formDirty) {\n props.handleClose(undefined);\n } else {\n setUnsavedChangesDialogOpen(true);\n }\n }, [formDirty, props.handleClose]);\n\n useEffect(() => {\n if (!open) {\n setFormDirty(false);\n setUnsavedChangesDialogOpen(false);\n }\n }, [open]);\n\n return (\n <Dialog\n open={open}\n fullWidth={true}\n fullHeight={true}\n scrollable={false}\n maxWidth={\"7xl\"}\n onOpenChange={(open) => !open ? handleCancel() : undefined}\n >\n {open && <CollectionEditorDialogInternal {...props}\n handleCancel={handleCancel}\n setFormDirty={setFormDirty}/>}\n\n <UnsavedChangesDialog\n open={unsavedChangesDialogOpen}\n handleOk={() => props.handleClose(undefined)}\n handleCancel={() => setUnsavedChangesDialogOpen(false)}\n body={\"There are unsaved changes in this collection\"}/>\n\n </Dialog>\n );\n}\n\ntype EditorView = \"welcome\"\n | \"details\"\n | \"import_data_mapping\"\n | \"import_data_preview\"\n | \"import_data_saving\"\n | \"properties\"\n | \"loading\"\n | \"extra_view\"\n | \"subcollections\";\n\nexport function CollectionEditorDialogInternal<M extends {\n [Key: string]: CMSType\n}>({\n isNewCollection,\n initialValues: initialValuesProp,\n configController,\n editedCollectionPath,\n parentCollectionIds,\n fullPath,\n collectionInference,\n handleClose,\n reservedGroups,\n extraView,\n handleCancel,\n setFormDirty,\n pathSuggestions,\n getUser,\n parentCollection,\n getData\n }: CollectionEditorDialogProps & {\n handleCancel: () => void,\n setFormDirty: (dirty: boolean) => void\n }\n) {\n\n const { propertyConfigs } = useCustomizationController();\n const navigation = useNavigationController();\n const {\n topLevelNavigation,\n collections\n } = navigation;\n\n const includeTemplates = !initialValuesProp?.path && (parentCollectionIds ?? []).length === 0;\n const collectionsInThisLevel = (parentCollection ? parentCollection.subcollections : collections) ?? [];\n const existingPaths = collectionsInThisLevel.map(col => col.path.trim().toLowerCase());\n const existingIds = collectionsInThisLevel.map(col => col.id?.trim().toLowerCase()).filter(Boolean) as string[];\n\n const importConfig = useImportConfig();\n\n if (!topLevelNavigation) {\n throw Error(\"Internal: Navigation not ready in collection editor\");\n }\n\n const {\n groups\n }: TopNavigationResult = topLevelNavigation;\n\n const snackbarController = useSnackbarController();\n const authController = useAuthController();\n\n // Use this ref to store which properties have errors\n const propertyErrorsRef = useRef({});\n\n const initialView = isNewCollection ? (includeTemplates ? \"welcome\" : \"details\") : \"properties\";\n const [currentView, setCurrentView] = useState<EditorView>(initialView); // this view can edit either the details view or the properties one\n\n const [error, setError] = React.useState<Error | undefined>();\n\n const [collection, setCollection] = React.useState<PersistedCollection<M> | undefined>();\n const [initialLoadingCompleted, setInitialLoadingCompleted] = React.useState(false);\n const [initialError, setInitialError] = React.useState<Error | undefined>();\n\n useEffect(() => {\n try {\n if (navigation.initialised) {\n if (editedCollectionPath) {\n setCollection(navigation.getCollectionFromPaths<PersistedCollection<M>>([...(parentCollectionIds ?? []), editedCollectionPath]));\n } else {\n setCollection(undefined);\n }\n setInitialLoadingCompleted(true);\n }\n } catch (e) {\n console.error(e);\n setInitialError(initialError);\n }\n }, [navigation.getCollectionFromPaths, editedCollectionPath, initialError, navigation.initialised]);\n\n const saveCollection = (updatedCollection: PersistedCollection<M>): Promise<boolean> => {\n const fullPath = updatedCollection.id || updatedCollection.path;\n return configController.saveCollection({\n id: fullPath,\n collectionData: updatedCollection,\n previousPath: editedCollectionPath,\n parentCollectionIds\n })\n .then(() => {\n setError(undefined);\n return true;\n })\n .catch((e) => {\n setError(e);\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n };\n\n const initialCollection = collection\n ? {\n ...collection,\n id: collection.id ?? collection.path ?? randomString(16)\n }\n : undefined;\n\n const initialValues: PersistedCollection<M> = initialCollection\n ? applyPropertyConfigs(initialCollection, propertyConfigs)\n : {\n id: initialValuesProp?.path ?? randomString(16),\n path: initialValuesProp?.path ?? \"\",\n name: initialValuesProp?.name ?? \"\",\n group: initialValuesProp?.group ?? \"\",\n properties: {} as PropertiesOrBuilders<M>,\n propertiesOrder: [],\n icon: coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)],\n ownerId: authController.user?.uid ?? \"\"\n };\n\n const setNextMode = useCallback(() => {\n if (currentView === \"details\") {\n if (importConfig.inUse) {\n setCurrentView(\"import_data_saving\");\n } else if (extraView) {\n setCurrentView(\"extra_view\");\n } else {\n setCurrentView(\"properties\");\n }\n } else if (currentView === \"welcome\") {\n setCurrentView(\"details\");\n } else if (currentView === \"import_data_mapping\") {\n setCurrentView(\"import_data_preview\");\n } else if (currentView === \"import_data_preview\") {\n setCurrentView(\"details\");\n } else if (currentView === \"extra_view\") {\n setCurrentView(\"properties\");\n } else {\n setCurrentView(\"details\");\n }\n\n }, [currentView, importConfig.inUse, extraView]);\n\n const doCollectionInference = useCallback((collection: PersistedCollection<any>) => {\n if (!collectionInference) return undefined;\n return collectionInference?.(collection.path, collection.collectionGroup ?? false, parentCollectionIds ?? []);\n }, [collectionInference, parentCollectionIds]);\n\n const inferCollectionFromData = useCallback(async (newCollection: PersistedCollection<M>) => {\n\n try {\n if (!doCollectionInference) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n\n setCurrentView(\"loading\");\n\n const inferredCollection = await doCollectionInference?.(newCollection);\n\n if (!inferredCollection) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n const values = {\n ...(newCollection ?? {})\n };\n\n if (Object.keys(inferredCollection.properties ?? {}).length > 0) {\n values.properties = inferredCollection.properties as PropertiesOrBuilders<M>;\n values.propertiesOrder = inferredCollection.propertiesOrder as Extract<keyof M, string>[];\n }\n\n if (!values.propertiesOrder) {\n values.propertiesOrder = Object.keys(values.properties) as Extract<keyof M, string>[];\n return values;\n }\n\n setCollection(values);\n console.log(\"Inferred collection\", {\n newCollection: newCollection ?? {},\n values\n });\n return values;\n } catch (e: any) {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error inferring collection: \" + (e.message ?? \"Details in the console\")\n });\n return newCollection;\n }\n }, [parentCollectionIds, doCollectionInference]);\n\n const onSubmit = (newCollectionState: PersistedCollection<M>, formikHelpers: FormikHelpers<PersistedCollection<M>>) => {\n try {\n\n console.log(\"Submitting collection\", newCollectionState)\n if (!isNewCollection) {\n saveCollection(newCollectionState).then(() => {\n formikHelpers.resetForm({ values: initialValues });\n // setNextMode();\n handleClose(newCollectionState);\n });\n return;\n }\n\n if (currentView === \"welcome\") {\n setNextMode();\n formikHelpers.resetForm({ values: newCollectionState });\n } else if (currentView === \"details\") {\n if (extraView || importConfig.inUse) {\n formikHelpers.resetForm({ values: newCollectionState });\n setNextMode();\n } else if (isNewCollection) {\n inferCollectionFromData(newCollectionState)\n .then((values) => {\n formikHelpers.resetForm({\n values: values ?? newCollectionState,\n touched: {\n path: true,\n name: true\n }\n });\n }).finally(() => {\n setNextMode();\n });\n } else {\n formikHelpers.resetForm({ values: newCollectionState });\n setNextMode();\n }\n } else if (currentView === \"extra_view\") {\n setNextMode();\n formikHelpers.resetForm({ values: newCollectionState });\n } else if (currentView === \"import_data_mapping\") {\n setNextMode();\n } else if (currentView === \"import_data_preview\") {\n setNextMode();\n } else if (currentView === \"properties\") {\n saveCollection(newCollectionState).then(() => {\n formikHelpers.resetForm({ values: initialValues });\n setNextMode();\n handleClose(newCollectionState);\n });\n } else {\n setNextMode();\n formikHelpers.resetForm({ values: newCollectionState });\n }\n } catch (e: any) {\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e.message ?? \"Details in the console\")\n });\n console.error(e);\n formikHelpers.resetForm({ values: newCollectionState });\n }\n };\n\n if (!isNewCollection && (!navigation.initialised || !initialLoadingCompleted)) {\n return <CircularProgressCenter/>;\n }\n\n return <DialogContent fullHeight={true}>\n <Formik\n initialValues={initialValues}\n validationSchema={(currentView === \"properties\" || currentView === \"subcollections\" || currentView === \"details\") && YupSchema}\n validate={(v) => {\n if (currentView === \"properties\") {\n // return the errors for the properties form\n return propertyErrorsRef.current;\n }\n const errors: Record<string, any> = {};\n if (currentView === \"details\") {\n const pathError = validatePath(v.path, isNewCollection, existingPaths, v.id);\n if (pathError) {\n errors.path = pathError;\n }\n const idError = validateId(v.id, isNewCollection, existingPaths, existingIds);\n if (idError) {\n errors.id = idError;\n }\n }\n return errors;\n }}\n onSubmit={onSubmit}\n >\n {(formikHelpers) => {\n const {\n values,\n errors,\n setFieldValue,\n isSubmitting,\n dirty,\n submitCount\n } = formikHelpers;\n\n const path = values.path ?? editedCollectionPath;\n const updatedFullPath = fullPath?.includes(\"/\") ? fullPath?.split(\"/\").slice(0, -1).join(\"/\") + \"/\" + path : path; // TODO: this path is wrong\n const pathError = validatePath(path, isNewCollection, existingPaths, values.id);\n\n const parentPaths = !pathError && parentCollectionIds ? navigation.convertIdsToPaths(parentCollectionIds) : undefined;\n const resolvedPath = !pathError ? navigation.resolveAliasesFrom(updatedFullPath) : undefined;\n const getDataWithPath = resolvedPath && getData ? () => getData(resolvedPath, parentPaths ?? []) : undefined;\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n setFormDirty(dirty);\n }, [dirty]);\n\n function onImportDataSet(data: object[]) {\n importConfig.setInUse(true);\n buildEntityPropertiesFromData(data, getInferenceType)\n .then((properties) => {\n const res = cleanPropertiesFromImport(properties);\n\n setFieldValue(\"properties\", res.properties);\n setFieldValue(\"propertiesOrder\", Object.keys(res.properties));\n\n importConfig.setIdColumn(res.idColumn);\n importConfig.setImportData(data);\n importConfig.setHeadersMapping(res.headersMapping);\n importConfig.setOriginProperties(res.properties);\n });\n }\n\n const validValues = Boolean(values.name) && Boolean(values.id);\n\n const onImportMappingComplete = () => {\n const updatedProperties = { ...values.properties };\n if (importConfig.idColumn)\n delete updatedProperties[importConfig.idColumn];\n setFieldValue(\"properties\", updatedProperties);\n // setFieldValue(\"propertiesOrder\", Object.values(importConfig.headersMapping));\n setNextMode();\n };\n\n const editable = collection?.editable === undefined || collection?.editable === true;\n const collectionEditable = editable || isNewCollection;\n return (\n <>\n {!isNewCollection && <Tabs value={currentView}\n className={cn(defaultBorderMixin, \"justify-end bg-gray-50 dark:bg-gray-950 border-b\")}\n onValueChange={(v) => setCurrentView(v as EditorView)}>\n <Tab value={\"details\"}>\n Details\n </Tab>\n <Tab value={\"properties\"}>\n Properties\n </Tab>\n <Tab value={\"subcollections\"}>\n Additional views\n </Tab>\n </Tabs>}\n\n <Form noValidate\n className={cn(\n isNewCollection ? \"h-full\" : \"h-[calc(100%-48px)]\",\n \"flex-grow flex flex-col relative\")}>\n\n {currentView === \"loading\" &&\n <CircularProgressCenter/>}\n\n {currentView === \"extra_view\" &&\n path &&\n extraView?.View &&\n <extraView.View path={path}/>}\n\n {currentView === \"welcome\" &&\n <CollectionEditorWelcomeView\n path={path}\n onContinue={(data) => {\n if (data) {\n onImportDataSet(data);\n setCurrentView(\"import_data_mapping\");\n } else {\n setCurrentView(\"details\");\n }\n }}\n collections={collections}\n parentCollection={parentCollection}\n pathSuggestions={pathSuggestions}/>}\n\n {currentView === \"import_data_mapping\" && importConfig &&\n <CollectionEditorImportMapping importConfig={importConfig}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>}\n\n {currentView === \"import_data_preview\" && importConfig &&\n <CollectionEditorImportDataPreview importConfig={importConfig}\n properties={values.properties as Properties}\n propertiesOrder={values.propertiesOrder as string[]}/>}\n\n {currentView === \"import_data_saving\" && importConfig &&\n <ImportSaveInProgress importConfig={importConfig}\n collection={values}\n onImportSuccess={(importedCollection) => {\n handleClose(importedCollection);\n snackbarController.open({\n type: \"info\",\n message: \"Data imported successfully\"\n });\n }}\n />}\n\n {currentView === \"details\" &&\n <CollectionDetailsForm\n existingPaths={existingPaths}\n existingIds={existingIds}\n groups={groups}\n parentCollectionIds={parentCollectionIds}\n parentCollection={parentCollection}\n isNewCollection={isNewCollection}/>}\n\n {currentView === \"subcollections\" && collection &&\n <SubcollectionsEditTab\n parentCollection={parentCollection}\n configController={configController}\n getUser={getUser}\n collectionInference={collectionInference}\n parentCollectionIds={parentCollectionIds}\n collection={collection}/>}\n\n {currentView === \"properties\" &&\n <CollectionPropertiesEditorForm\n showErrors={submitCount > 0}\n isNewCollection={isNewCollection}\n reservedGroups={reservedGroups}\n onPropertyError={(propertyKey, namespace, error) => {\n propertyErrorsRef.current = removeUndefined({\n ...propertyErrorsRef.current,\n [propertyKey]: error\n }, true);\n }}\n getUser={getUser}\n getData={getDataWithPath}\n doCollectionInference={doCollectionInference}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n extraIcon={extraView?.icon &&\n <IconButton\n color={\"primary\"}\n onClick={() => setCurrentView(\"extra_view\")}>\n {extraView.icon}\n </IconButton>}/>\n }\n\n {currentView !== \"welcome\" && <DialogActions\n position={\"absolute\"}>\n {error && <ErrorView error={error}/>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_mapping\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n importConfig.setInUse(false);\n return setCurrentView(\"welcome\");\n }}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_preview\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n saveCollection(values);\n setCurrentView(\"import_data_mapping\");\n }}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"details\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => setCurrentView(\"welcome\")}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && currentView === \"properties\" && <Button variant={\"text\"}\n type=\"button\"\n onClick={() => setCurrentView(\"details\")}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n <Button variant={\"text\"}\n onClick={() => {\n handleCancel();\n }}>\n Cancel\n </Button>\n\n {isNewCollection && currentView === \"import_data_mapping\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={onImportMappingComplete}\n >\n Next\n </Button>}\n\n {isNewCollection && currentView === \"import_data_preview\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={() => {\n setNextMode();\n }}\n >\n Next\n </Button>}\n\n {isNewCollection && (currentView === \"details\" || currentView === \"properties\") &&\n <LoadingButton\n variant={\"filled\"}\n color=\"primary\"\n type=\"submit\"\n loading={isSubmitting}\n disabled={isSubmitting || (currentView === \"details\" && !validValues)}\n startIcon={currentView === \"properties\"\n ? <DoneIcon/>\n : undefined}\n >\n {currentView === \"details\" && \"Next\"}\n {currentView === \"properties\" && \"Create collection\"}\n </LoadingButton>}\n\n {!isNewCollection && <LoadingButton\n variant=\"filled\"\n color=\"primary\"\n type=\"submit\"\n loading={isSubmitting}\n // disabled={isSubmitting || !dirty}\n >\n Update collection\n </LoadingButton>}\n\n </DialogActions>}\n </Form>\n </>\n );\n }}\n\n </Formik>\n </DialogContent>\n\n}\n\nfunction applyPropertyConfigs<M extends Record<string, any> = any>(collection: PersistedCollection<M>, propertyConfigs: Record<string, PropertyConfig<any>>): PersistedCollection<M> {\n const { properties, ...rest } = collection;\n const propertiesResult: PropertiesOrBuilders<any> = {};\n Object.keys(properties).forEach((key) => {\n propertiesResult[key] = applyPropertiesConfig(properties[key] as PropertyOrBuilder, propertyConfigs);\n });\n\n return { ...rest, properties: propertiesResult };\n}\n\nfunction applyPropertiesConfig(property: PropertyOrBuilder, propertyConfigs: Record<string, PropertyConfig<any>>) {\n let internalProperty = property;\n if (propertyConfigs && typeof internalProperty === \"object\" && internalProperty.propertyConfig) {\n const propertyConfig = propertyConfigs[internalProperty.propertyConfig];\n if (propertyConfig && isPropertyBuilder(propertyConfig.property)) {\n internalProperty = propertyConfig.property;\n } else {\n\n if (propertyConfig) {\n internalProperty = mergeDeep(propertyConfig.property, internalProperty);\n }\n\n if (!isPropertyBuilder(internalProperty) && internalProperty.dataType === \"map\" && internalProperty.properties) {\n const properties: Record<string, PropertyOrBuilder> = {};\n Object.keys(internalProperty.properties).forEach((key) => {\n properties[key] = applyPropertiesConfig(((internalProperty as MapProperty).properties as Properties)[key] as Property, propertyConfigs);\n });\n internalProperty = { ...internalProperty, properties };\n }\n\n }\n }\n return internalProperty;\n\n}\n\nconst validatePath = (value: string, isNewCollection: boolean, existingPaths: string[], idValue?: string) => {\n let error;\n if (!value) {\n error = \"You must specify a path in the database for this collection\";\n }\n // if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n // error = \"There is already a collection which uses this path as an id\";\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()) && !idValue)\n error = \"There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids\";\n\n const subpaths = removeInitialAndTrailingSlashes(value).split(\"/\");\n if (subpaths.length % 2 === 0) {\n error = `Collection paths must have an odd number of segments: ${value}`;\n }\n return error;\n};\n\nconst validateId = (value: string, isNewCollection: boolean, existingPaths: string[], existingIds: string[]) => {\n if (!value) return undefined;\n let error;\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection that uses this value as a path\";\n if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection which uses this id\";\n // if (error) {\n // setAdvancedPanelExpanded(true);\n // }\n return error;\n};\n","import React, { PropsWithChildren, useCallback, useEffect } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport {\n Property,\n useCustomizationController,\n useNavigationController,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport { CollectionEditorDialog } from \"./ui/collection_editor/CollectionEditorDialog\";\nimport { useNavigate } from \"react-router\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionEditorPermissionsBuilder } from \"./types/config_permissions\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { PropertyFormDialog } from \"./ui/collection_editor/PropertyEditView\";\nimport { PersistedCollection } from \"./types/persisted_collection\";\n\nexport const ConfigControllerContext = React.createContext<CollectionsConfigController>({} as any);\nexport const CollectionEditorContext = React.createContext<CollectionEditorController>({} as any);\n\nexport interface ConfigControllerProviderProps {\n /**\n * Controller for managing the collections' config.\n */\n collectionConfigController: CollectionsConfigController;\n\n /**\n * Callback used to infer the schema from the data.\n */\n collectionInference?: CollectionInference;\n\n /**\n * Use this builder to define the permissions for the configuration per user.\n */\n configPermissions?: CollectionEditorPermissionsBuilder;\n\n /**\n * Groups that cannot be used to create new collections.\n */\n reservedGroups?: string[];\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: (path?: string) => Promise<string[]>;\n\n getUser: (uid: string) => User | null\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n}\n\nexport const ConfigControllerProvider = React.memo(\n function ConfigControllerProvider({\n children,\n collectionConfigController,\n configPermissions,\n reservedGroups,\n collectionInference,\n extraView,\n pathSuggestions,\n getUser,\n getData,\n onAnalyticsEvent\n }: PropsWithChildren<ConfigControllerProviderProps>) {\n\n const navigation = useNavigationController();\n const navigate = useNavigate();\n const snackbarController = useSnackbarController();\n const { propertyConfigs } = useCustomizationController();\n\n const {\n collections\n } = navigation;\n const existingPaths = collections.map(col => col.path.trim().toLowerCase());\n\n const [rootPathSuggestions, setRootPathSuggestions] = React.useState<string[] | undefined>();\n useEffect(() => {\n if (pathSuggestions) {\n pathSuggestions().then((paths) => {\n setRootPathSuggestions(paths.filter(p => !existingPaths.includes(p.trim().toLowerCase())));\n });\n }\n }, [pathSuggestions]);\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n parentCollection?: PersistedCollection,\n editedCollectionPath?: string,\n fullPath?: string,\n parentCollectionIds: string[],\n initialValues?: {\n path?: string,\n group?: string,\n name?: string\n },\n redirect: boolean\n }>();\n\n const [currentPropertyDialog, setCurrentPropertyDialog] = React.useState<{\n propertyKey?: string,\n property?: Property,\n namespace?: string,\n parentCollection?: PersistedCollection,\n currentPropertiesOrder?: string[],\n editedCollectionPath: string,\n fullPath?: string,\n parentCollectionIds: string[],\n collectionEditable: boolean;\n }>();\n\n const defaultConfigPermissions: CollectionEditorPermissionsBuilder = useCallback(() => ({\n createCollections: true,\n editCollections: true,\n deleteCollections: true\n }), []);\n\n const editCollection = useCallback(({\n path,\n fullPath,\n parentCollectionIds,\n parentCollection\n }: {\n path?: string,\n fullPath?: string,\n parentCollectionIds: string[],\n parentCollection?: PersistedCollection\n }) => {\n console.debug(\"edit collection\", path, fullPath, parentCollectionIds, parentCollection);\n onAnalyticsEvent?.(\"edit_collection\", { path, fullPath });\n setCurrentDialog({\n editedCollectionPath: path,\n fullPath,\n parentCollectionIds,\n isNewCollection: false,\n parentCollection,\n redirect: false\n });\n }, []);\n\n const editProperty = useCallback(({\n propertyKey,\n property,\n editedCollectionPath,\n currentPropertiesOrder,\n parentCollectionIds,\n collection\n }: {\n propertyKey?: string,\n property?: Property,\n currentPropertiesOrder?: string[],\n editedCollectionPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection,\n }) => {\n console.debug(\"edit property\", propertyKey, property, editedCollectionPath, currentPropertiesOrder, parentCollectionIds, collection);\n onAnalyticsEvent?.(\"edit_property\", { propertyKey, editedCollectionPath });\n // namespace is all the path until the last dot\n const namespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(0, propertyKey.lastIndexOf(\".\"))\n : undefined;\n const propertyKeyWithoutNamespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(propertyKey.lastIndexOf(\".\") + 1)\n : propertyKey;\n setCurrentPropertyDialog({\n propertyKey: propertyKeyWithoutNamespace,\n property,\n namespace,\n currentPropertiesOrder,\n editedCollectionPath,\n parentCollectionIds,\n collectionEditable: collection?.editable ?? false\n });\n }, []);\n\n const createCollection = React.useCallback(({\n parentCollectionIds,\n parentCollection,\n initialValues,\n redirect\n }: {\n parentCollectionIds: string[],\n parentCollection?: PersistedCollection\n initialValues?: {\n group?: string,\n path?: string,\n name?: string\n },\n redirect: boolean\n }) => {\n console.debug(\"create collection\", parentCollectionIds, parentCollection, initialValues, redirect);\n onAnalyticsEvent?.(\"create_collection\", { parentCollectionIds, parentCollection, initialValues, redirect });\n setCurrentDialog({\n isNewCollection: true,\n parentCollectionIds,\n parentCollection,\n initialValues,\n redirect\n });\n }, []);\n\n const getPathSuggestions = !pathSuggestions\n ? undefined\n : (path?: string) => {\n if (!path && rootPathSuggestions)\n return Promise.resolve(rootPathSuggestions);\n else {\n return pathSuggestions?.(path);\n }\n }\n\n return (\n <ConfigControllerContext.Provider value={collectionConfigController}>\n <CollectionEditorContext.Provider\n value={{\n editCollection,\n createCollection,\n editProperty,\n configPermissions: configPermissions ?? defaultConfigPermissions,\n rootPathSuggestions\n }}>\n\n {children}\n\n <CollectionEditorDialog\n open={Boolean(currentDialog)}\n configController={collectionConfigController}\n isNewCollection={false}\n collectionInference={collectionInference}\n {...currentDialog}\n getData={getData}\n reservedGroups={reservedGroups}\n extraView={extraView}\n pathSuggestions={getPathSuggestions}\n getUser={getUser}\n handleClose={(collection) => {\n if (currentDialog?.redirect) {\n if (collection && currentDialog?.isNewCollection && !currentDialog.parentCollectionIds.length) {\n const url = navigation.buildUrlCollectionPath(collection.id ?? collection.path);\n navigate(url);\n }\n }\n setCurrentDialog(undefined);\n }}/>\n\n {/* Used for editing properties*/}\n <PropertyFormDialog\n open={Boolean(currentPropertyDialog)}\n includeIdAndName={true}\n existingProperty={Boolean(currentPropertyDialog?.propertyKey)}\n autoUpdateId={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}\n autoOpenTypeSelect={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}\n inArray={false}\n collectionEditable={currentPropertyDialog?.collectionEditable ?? false}\n getData={getData && currentPropertyDialog?.editedCollectionPath\n ? () => {\n console.debug(\"get data for property\", currentPropertyDialog?.editedCollectionPath);\n const resolvedPath = navigation.resolveAliasesFrom(currentPropertyDialog.editedCollectionPath!)\n return getData(resolvedPath, []);\n }\n : undefined}\n onPropertyChanged={({\n id,\n property\n }) => {\n if (!currentPropertyDialog) return;\n if (!id) return;\n const newProperty = !(currentPropertyDialog.propertyKey);\n return collectionConfigController.saveProperty({\n path: currentPropertyDialog?.editedCollectionPath,\n property,\n propertyKey: id,\n newPropertiesOrder: newProperty && currentPropertyDialog.currentPropertiesOrder ? [...currentPropertyDialog.currentPropertiesOrder, id] : undefined,\n namespace: currentPropertyDialog.namespace,\n parentCollectionIds: currentPropertyDialog.parentCollectionIds\n })\n .catch((e) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n }}\n onPropertyChangedImmediate={false}\n onDelete={() => {\n if (!currentPropertyDialog?.propertyKey) return;\n const newPropertiesOrder = currentPropertyDialog?.currentPropertiesOrder?.filter(p => p !== currentPropertyDialog?.propertyKey);\n return collectionConfigController.deleteProperty({\n path: currentPropertyDialog?.editedCollectionPath,\n propertyKey: currentPropertyDialog?.propertyKey,\n namespace: currentPropertyDialog?.namespace,\n newPropertiesOrder,\n parentCollectionIds: currentPropertyDialog?.parentCollectionIds\n })\n .then(() => {\n setCurrentPropertyDialog(undefined);\n }).catch((e) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error deleting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n }}\n onError={() => {\n }}\n onOkClicked={() => {\n setCurrentPropertyDialog(undefined);\n }}\n onCancel={() => {\n setCurrentPropertyDialog(undefined);\n }}\n initialErrors={{}}\n forceShowErrors={false}\n existingPropertyKeys={[]}\n allowDataInference={true}\n propertyConfigs={propertyConfigs}\n property={currentPropertyDialog?.property}\n propertyKey={currentPropertyDialog?.propertyKey}/>\n\n </CollectionEditorContext.Provider>\n\n </ConfigControllerContext.Provider>\n );\n }, equal);\n","import { useContext } from \"react\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionEditorContext } from \"./ConfigControllerProvider\";\n\n/**\n * Hook to access the collection editor controller.\n * The methods in this controller can be used to open the collection editor dialog.\n */\nexport const useCollectionEditorController = (): CollectionEditorController => useContext(CollectionEditorContext);\n","import { useContext } from \"react\";\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport { ConfigControllerContext } from \"./ConfigControllerProvider\";\n\n/**\n * Use this hook to access the configuration controller.\n * You can use it to get the list of collections, and to save/delete collections.\n */\nexport const useCollectionsConfigController = (): CollectionsConfigController => useContext(ConfigControllerContext);\n","import equal from \"react-fast-compare\"\n\nimport {\n CollectionActionsProps,\n mergeDeep,\n useAuthController,\n useNavigationController,\n useSnackbarController\n} from \"@firecms/core\";\nimport { Button, IconButton, SaveIcon, SettingsIcon, Tooltip, UndoIcon, } from \"@firecms/ui\";\n\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { useCollectionsConfigController } from \"../useCollectionsConfigController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function EditorCollectionAction({\n path: fullPath,\n parentCollectionIds,\n collection,\n tableController\n }: CollectionActionsProps) {\n\n const authController = useAuthController();\n const navigationController = useNavigationController();\n const collectionEditorController = useCollectionEditorController();\n const configController = useCollectionsConfigController();\n const snackbarController = useSnackbarController();\n\n const parentCollection = navigationController.getCollectionFromIds(parentCollectionIds);\n\n const canEditCollection = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n collection\n }).editCollections\n : true;\n\n let saveDefaultFilterButton = null;\n if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.initialFilter)) ||\n !equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {\n saveDefaultFilterButton = <>\n {collection.initialFilter || collection.initialSort && <Tooltip\n title={\"Reset to default filter and sort\"}>\n <Button\n color={\"primary\"}\n size={\"small\"}\n variant={\"text\"}\n onClick={() => {\n tableController.clearFilter?.();\n if (collection?.initialFilter)\n tableController.setFilterValues?.(collection?.initialFilter);\n if (collection?.initialSort)\n tableController.setSortBy?.(collection?.initialSort);\n }}>\n <UndoIcon/>\n </Button>\n </Tooltip>}\n\n <Tooltip\n title={tableController.sortBy || tableController.filterValues ? \"Save default filter and sort\" : \"Clear default filter and sort\"}>\n <Button\n color={\"primary\"}\n size={\"small\"}\n variant={\"outlined\"}\n onClick={() => configController\n ?.saveCollection({\n id: collection.path,\n parentCollectionIds,\n collectionData: mergeDeep(collection as PersistedCollection,\n {\n initialFilter: tableController.filterValues ?? null,\n initialSort: tableController.sortBy ?? null\n })\n }).then(() => {\n snackbarController.open({\n type: \"success\",\n message: \"Default config saved\"\n });\n })}>\n <SaveIcon/>\n </Button>\n </Tooltip>\n </>;\n }\n\n const editorButton = <Tooltip\n title={canEditCollection ? \"Edit collection\" : \"You don't have permissions to edit this collection\"}>\n <IconButton\n color={\"primary\"}\n disabled={!canEditCollection}\n onClick={canEditCollection\n ? () => collectionEditorController?.editCollection({ path: collection.path, fullPath, parentCollectionIds, parentCollection: parentCollection as PersistedCollection })\n : undefined}>\n <SettingsIcon/>\n </IconButton>\n </Tooltip>;\n\n return <>\n {canEditCollection && saveDefaultFilterButton}\n {editorButton}\n </>\n\n}\n\nfunction getObjectOrNull(o?: object): object | null {\n if (o && Object.keys(o).length === 0)\n return o\n return o ?? null;\n}\n","import {\n DeleteConfirmationDialog,\n PluginHomePageActionsProps,\n useAuthController,\n useSnackbarController\n} from \"@firecms/core\";\nimport { DeleteIcon, IconButton, Menu, MenuItem, MoreVertIcon, SettingsIcon, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { useCallback, useState } from \"react\";\nimport { useCollectionsConfigController } from \"../useCollectionsConfigController\";\n\nexport function HomePageEditorCollectionAction({\n path,\n collection\n }: PluginHomePageActionsProps) {\n\n const snackbarController = useSnackbarController();\n const authController = useAuthController();\n const configController = useCollectionsConfigController();\n const collectionEditorController = useCollectionEditorController();\n\n const permissions = collectionEditorController.configPermissions({\n user: authController.user,\n collection\n });\n\n const onEditCollectionClicked = useCallback(() => {\n collectionEditorController?.editCollection({ path, parentCollectionIds: [] });\n }, [collectionEditorController, path]);\n\n const [deleteRequested, setDeleteRequested] = useState(false);\n\n const deleteCollection = useCallback(() => {\n configController?.deleteCollection({ path }).then(() => {\n setDeleteRequested(false);\n snackbarController.open({\n message: \"Collection deleted\",\n type: \"success\"\n });\n });\n }, [path, configController]);\n\n return <>\n\n <div>\n {permissions.deleteCollections &&\n <Menu\n trigger={<IconButton>\n <MoreVertIcon size={\"small\"}/>\n </IconButton>}\n >\n <MenuItem onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n setDeleteRequested(true);\n }}>\n <DeleteIcon/>\n Delete\n </MenuItem>\n\n </Menu>\n\n }\n\n {permissions.editCollections &&\n <IconButton\n onClick={(event) => {\n onEditCollectionClicked();\n }}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>}\n </div>\n\n <DeleteConfirmationDialog\n open={deleteRequested}\n onAccept={deleteCollection}\n onCancel={() => setDeleteRequested(false)}\n title={<>Delete this collection?</>}\n body={<> This will <b>not\n delete any data</b>, only\n the collection in the CMS</>}/>\n </>;\n\n}\n","import { PluginHomePageAdditionalCardsProps, useAuthController } from \"@firecms/core\";\nimport { AddIcon, Card, cn, Typography } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\n\nexport function NewCollectionCard({\n group,\n context\n }: PluginHomePageAdditionalCardsProps) {\n\n if (!context.navigation.topLevelNavigation)\n throw Error(\"Navigation not ready in FireCMSHomePage\");\n\n const authController = useAuthController();\n\n const collectionEditorController = useCollectionEditorController();\n const canCreateCollections = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n }).createCollections\n : true;\n\n return (\n <Card className={cn(\"h-full p-4 min-h-[124px]\")}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n initialValues: group ? { group } : undefined,\n parentCollectionIds: [],\n redirect: true\n })\n : undefined}>\n\n <div\n className=\"flex flex-col items-start h-full w-full items-center justify-center h-full w-full flex-grow flex-col\">\n <AddIcon color=\"primary\" size={\"large\"}/>\n <Typography color=\"primary\"\n variant={\"caption\"}\n className={\"font-medium\"}>{\"Add new collection\".toUpperCase()}</Typography>\n\n {!canCreateCollections &&\n <Typography variant={\"caption\"}>You don&apos;t have permissions to create\n collections</Typography>\n }\n </div>\n\n </Card>\n );\n}\n","import { unslugify, useAuthController, useNavigationController } from \"@firecms/core\";\nimport { AddIcon, Chip, Collapse, Typography, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport React from \"react\";\n\nexport function RootCollectionSuggestions() {\n\n const authController = useAuthController();\n const navigationController = useNavigationController();\n\n const collectionEditorController = useCollectionEditorController();\n const canCreateCollections = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user\n }).createCollections\n : true;\n\n const rootPathSuggestions = collectionEditorController.rootPathSuggestions ?? [];\n\n const showSuggestions = rootPathSuggestions.length > 3 || (navigationController.collections.length === 0 && rootPathSuggestions.length > 0);\n return <Collapse\n in={showSuggestions}>\n\n <div\n className={\"flex flex-col gap-1 p-2 my-4\"}>\n\n <Typography variant={\"body2\"} color={\"secondary\"}>\n Create a collection from your data:\n </Typography>\n\n <div\n className={\"flex flex-row gap-1 overflow-scroll no-scrollbar \"}>\n {rootPathSuggestions.map((path) => {\n return (\n <div key={path}>\n <Chip\n icon={<AddIcon size={\"small\"}/>}\n colorScheme={\"cyanLighter\"}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n initialValues: { path, name: unslugify(path) },\n parentCollectionIds: [],\n redirect: true\n })\n : undefined}\n size=\"small\">\n {path}\n </Chip>\n </div>\n );\n })}\n </div>\n </div>\n </Collapse>\n}\n","import { ResolvedProperty } from \"@firecms/core\";\nimport { IconButton, SettingsIcon, Tooltip } from \"@firecms/ui\";\nimport React from \"react\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function CollectionViewHeaderAction({\n propertyKey,\n onHover,\n property,\n fullPath,\n parentCollectionIds,\n collection\n }: {\n property: ResolvedProperty,\n propertyKey: string,\n onHover: boolean,\n fullPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection;\n}) {\n\n const collectionEditorController = useCollectionEditorController();\n\n return (\n <Tooltip title={\"Edit\"}>\n <IconButton\n className={onHover ? \"bg-white dark:bg-gray-950\" : \"hidden\"}\n onClick={() => {\n collectionEditorController.editProperty({\n propertyKey,\n property,\n editedCollectionPath: fullPath,\n parentCollectionIds,\n collection\n });\n }}\n size={\"small\"}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n )\n}\n","import { getDefaultPropertiesOrder, useAuthController } from \"@firecms/core\";\nimport { AddIcon, Tooltip } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function PropertyAddColumnComponent({\n fullPath,\n parentCollectionIds,\n collection\n }: {\n fullPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection;\n}) {\n\n const authController = useAuthController();\n const collectionEditorController = useCollectionEditorController();\n const canEditCollection = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n collection\n }).editCollections\n : true;\n\n return (\n <Tooltip title={canEditCollection ? \"Add new property\" : \"You don't have permission to add new properties\"}>\n <div\n className={\"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-gray-100 bg-opacity-40 hover:bg-gray-100 dark:bg-gray-950 dark:bg-opacity-40 dark:hover:bg-gray-950\"}\n // className={onHover ? \"bg-white dark:bg-gray-950\" : undefined}\n onClick={() => {\n collectionEditorController.editProperty({\n editedCollectionPath: fullPath,\n parentCollectionIds,\n currentPropertiesOrder: getDefaultPropertiesOrder(collection),\n collection\n });\n }}>\n <AddIcon color={\"inherit\"}/>\n </div>\n </Tooltip>\n )\n}\n","import { AddIcon, Button } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\n\nexport function NewCollectionButton() {\n const collectionEditorController = useCollectionEditorController();\n return <Button className={\"min-w-fit\"}\n variant={\"outlined\"}\n onClick={() => collectionEditorController.createCollection({\n parentCollectionIds: [],\n redirect: true\n })\n }>\n <AddIcon/>\n New collection\n </Button>\n}\n","import React from \"react\";\nimport {\n EntityCollection,\n FireCMSPlugin,\n joinCollectionLists,\n makePropertiesEditable,\n ModifyCollectionProps,\n Properties,\n User\n} from \"@firecms/core\";\nimport { ConfigControllerProvider } from \"./ConfigControllerProvider\";\nimport { CollectionEditorPermissionsBuilder } from \"./types/config_permissions\";\nimport { EditorCollectionAction } from \"./ui/EditorCollectionAction\";\nimport { HomePageEditorCollectionAction } from \"./ui/HomePageEditorCollectionAction\";\nimport { NewCollectionCard } from \"./ui/NewCollectionCard\";\nimport { PersistedCollection } from \"./types/persisted_collection\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport { RootCollectionSuggestions } from \"./ui/RootCollectionSuggestions\";\nimport { CollectionViewHeaderAction } from \"./ui/CollectionViewHeaderAction\";\nimport { PropertyAddColumnComponent } from \"./ui/PropertyAddColumnComponent\";\nimport { NewCollectionButton } from \"./ui/NewCollectionButton\";\n\nexport interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, UserType extends User = User> {\n\n /**\n * Firebase app where the configuration is saved.\n */\n collectionConfigController: CollectionsConfigController;\n\n modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | void;\n\n /**\n * Define what actions can be performed on the configuration.\n */\n configPermissions?: CollectionEditorPermissionsBuilder<UserType, EC>;\n\n /**\n * The words you define here will not be allowed to be used as group\n * names when creating collections.\n * e.g. [\"admin\"]\n */\n reservedGroups: string[];\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: (path: string) => Promise<string[]>;\n\n collectionInference?: CollectionInference;\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n getUser: (uid: string) => UserType | null;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n}\n\n/**\n * Use this hook to initialise the Collection Editor plugin.\n * This is likely the only hook you will need to use.\n * @param firebaseApp Firebase app where your project data lives.\n * @param configPermissions\n * @param reservedGroups\n * @param extraView\n * @param pathSuggestions\n * @param getUser\n * @param collectionInference\n */\nexport function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>\n({\n collectionConfigController,\n modifyCollection,\n configPermissions,\n reservedGroups,\n extraView,\n pathSuggestions,\n getUser,\n collectionInference,\n getData,\n onAnalyticsEvent\n }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection> {\n\n const injectCollections = (baseCollections: EntityCollection[]) => {\n\n const markAsEditable = (c: PersistedCollection) => {\n makePropertiesEditable(c.properties as Properties);\n c.subcollections?.forEach(markAsEditable);\n };\n const storedCollections = collectionConfigController.collections ?? [];\n storedCollections.forEach(markAsEditable);\n\n console.debug(\"Collections specified in code:\", baseCollections);\n console.debug(\"Collections stored in the backend\", storedCollections);\n const result = joinCollectionLists(baseCollections, storedCollections, [], modifyCollection);\n console.debug(\"Collections after joining:\", result);\n return result;\n };\n\n return {\n name: \"Collection Editor\",\n loading: collectionConfigController.loading,\n collections: {\n injectCollections,\n CollectionActions: EditorCollectionAction\n },\n provider: {\n Component: ConfigControllerProvider,\n props: {\n collectionConfigController,\n configPermissions,\n collectionInference,\n reservedGroups,\n extraView,\n pathSuggestions,\n getUser,\n getData,\n onAnalyticsEvent\n }\n },\n homePage: {\n additionalActions: <NewCollectionButton/>,\n additionalChildrenEnd: <RootCollectionSuggestions/>,\n CollectionActions: HomePageEditorCollectionAction,\n AdditionalCards: NewCollectionCard,\n },\n collectionView: {\n HeaderAction: CollectionViewHeaderAction,\n AddColumnComponent: PropertyAddColumnComponent\n }\n };\n}\n","import { ErrorView, unslugify, useNavigationController } from \"@firecms/core\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { Button } from \"@firecms/ui\";\n\nexport function MissingReferenceWidget({ path: pathProp }: {\n path: string\n}) {\n const navigation = useNavigationController();\n const path = getLastSegment(pathProp);\n const parentCollectionIds = navigation.getParentCollectionIds(pathProp);\n const collectionEditor = useCollectionEditorController();\n return <div className={\"p-1 flex flex-col items-center\"}>\n <ErrorView error={\"No collection for path: \" + path}/>\n <Button className={\"mx-2\"} variant={\"outlined\"} size={\"small\"}\n onClick={() => {\n collectionEditor.createCollection({\n initialValues: { path, name: unslugify(path) },\n parentCollectionIds,\n redirect: false\n });\n }}>\n Create\n </Button>\n </div>;\n}\n\nfunction getParentPathSegments(path: string): string[] {\n const segments = path.split(\"/\");\n return segments.filter((segment, index) => index % 2 === 0 && index !== segments.length - 1);\n}\n\nfunction getLastSegment(path: string): string {\n const segments = path.split(\"/\");\n return segments[segments.length - 1];\n}\n"],"names":["YupSchema","Yup","FieldHelperView","error","children","jsx","Typography","CollectionDetailsForm","isNewCollection","reservedGroups","existingPaths","existingIds","groups","parentCollection","groupRef","React","values","setFieldValue","handleChange","touched","errors","setFieldTouched","isSubmitting","submitCount","useFormikContext","iconDialogOpen","setIconDialogOpen","useState","advancedPanelExpanded","setAdvancedPanelExpanded","updateName","name","getIn","toSnakeCase","singular","useEffect","collectionIcon","IconForView","groupOptions","group","inputFocused","autoCompleteOpen","setAutoCompleteOpen","useAutoComplete","isSubcollection","customIdValue","Container","jsxs","Tooltip","IconButton","Chip","TextField","e","cn","Field","DebouncedTextField","event","Autocomplete","index","AutocompleteItem","ExpandablePanel","SettingsIcon","Select","value","SelectItem","v","BooleanSwitchWithLabel","Dialog","SearchIconsView","icon","idToPropertiesPath","id","namespaceToPropertiesPath","namespace","namespaceToPropertiesOrderPath","getFullId","propertyKey","propertyNamespace","EnumForm","enumValues","onValuesChanged","onError","updateIds","disabled","allowDataInference","getData","Formik","data","formikHelpers","EnumFormFields","prevProps","nextProps","enumValuesPath","shouldUpdateId","lastInternalIdAdded","setLastInternalIdAdded","editDialogIndex","setEditDialogIndex","inferring","setInferring","inferredValues","buildEntry","internalId","justAdded","EnumEntry","ListIcon","Button","flatData","fieldData","currentEnumValues","newEnumValues","extractEnumFromValues","enumValue","CircularProgress","AutoAwesomeIcon","Paper","FormikArrayContainer","EnumEntryDialog","updateId","autoFocus","onDialogOpen","inferredEntry","shouldUpdateIdRef","idValue","labelValue","labelError","currentLabelRef","FastField","validateLabel","open","onClose","idError","DialogContent","validateId","DialogActions","GeneralPropertyValidation","validationRequired","validationRequiredMessage","Fragment","SwitchControl","StringPropertyValidation","length","lowercase","matches","max","min","trim","uppercase","showErrors","validationLength","validationMin","validationMax","validationTrim","validationMatches","validationLowercase","validationUppercase","matchesError","matchesValue","matchesStringValue","serializeRegExp","isValidRegExp","ArrayPropertyValidation","ValidationPanel","RuleIcon","EnumPropertyField","multiselect","setFieldError","snackbarContext","useSnackbarController","defaultValue","valuesEnumValues","useMemo","resolveEnumValues","hasError","res","d","enumIds","fileTypes","StoragePropertyField","multiple","existing","baseStoragePath","acceptedFiles","fileName","storagePath","storeUrl","fileNameValue","storagePathValue","storedValue","fileTypesValue","allFileTypesSelected","handleTypesChange","hasFilenameCallback","hasStoragePathCallback","FileUploadIcon","MultiSelect","selected","MultiSelectItem","Checkbox","label","editableProperty","property","isPropertyBuilder","eProperty","removeNonEditableProperties","properties","_","key","propertyOrBuilder","a","b","PropertyFieldPreview","onClick","includeName","includeEditButton","propertyConfigs","useCustomizationController","propertyConfig","getFieldConfig","ErrorBoundary","FieldConfigBadge","cardMixin","cardClickableMixin","cardSelectedMixin","NonEditablePropertyPreview","FunctionsIcon","RemoveCircleIcon","PropertyTree","selectedPropertyKey","onPropertyClick","propertiesOrderProp","additionalFields","onPropertyMove","onPropertyRemove","className","inferredPropertyKeys","collectionEditable","propertiesOrder","onDragEnd","useCallback","result","startIndex","endIndex","newPropertiesOrder","removed","DragDropContext","Droppable","droppableProvided","droppableSnapshot","additionalField","field","Draggable","provided","snapshot","PropertyTreeEntry","isPropertyInferred","fullId","subtree","editable","defaultBorderMixin","RemoveIcon","DragHandleIcon","MapPropertyField","propertyDialogOpen","setPropertyDialogOpen","setSelectedPropertyKey","selectedPropertyNamespace","setSelectedPropertyNamespace","onPropertyCreated","deleteProperty","propertiesPath","propertiesOrderPath","currentPropertiesOrder","p","selectedPropertyFullId","selectedProperty","addChildButton","AddIcon","empty","PropertyFormDialog","RepeatPropertyField","ofProperty","ofPropertyError","onPropertyChanged","widget","CommonPropertyFields","disabledId","existingPropertyKeys","autoUpdateId","isNewProperty","ref","nameError","description","descriptionError","newNameValue","validateName","newIdValue","unslugify","idRegEx","StringPropertyField","widgetId","BooleanPropertyField","BlockPropertyField","NumberPropertyValidation","validationLessThan","validationMoreThan","validationPositive","validationNegative","validationInteger","NumberPropertyField","ReferencePropertyField","useNavigationController","pathPath","pathValue","pathError","validatePath","CollectionsSelect","props","navigation","collections","ungroupedCollections","col","selectedCollection","collection","SelectGroup","DateTimePropertyField","modePath","modeValue","modeError","autoValuePath","autoValueValue","autoValueError","AdvancedPropertyValidation","KeyValuePropertyField","updatePropertyFromWidget","propertyData","selectedWidgetId","updatedProperty","mergeDeep","PropertySelectItem","optionDisabled","UrlPropertyField","urlValue","supportedFieldsIds","supportedFields","DEFAULT_FIELD_CONFIGS","config","PropertyForm","includeIdAndName","autoOpenTypeSelect","existingProperty","inArray","onPropertyChangedImmediate","onDelete","initialErrors","forceShowErrors","getHelpers","initialValue","lastSubmittedProperty","useRef","doOnPropertyChanged","params","newPropertyWithId","helpers","PropertyEditView","onCancel","onOkClicked","formProps","helpersRef","setValues","includeIdAndTitle","selectOpen","setSelectOpen","deleteDialogOpen","setDeleteDialogOpen","selectedFieldConfigId","setSelectedFieldConfigId","getFieldId","allSupportedFields","displayedWidgets","deferredValues","useDeferredValue","nameFieldRef","selectedWidgetError","equal","onWidgetSelectChanged","newSelectedWidgetId","childComponent","InfoLabel","baseProperty","baseFieldConfig","computedFieldConfig","DeleteIcon","DeleteConfirmationDialog","camelCase","str","cur","acc","GetCodeDialog","onOpenChange","snackbarController","code","JSON5","collectionToCode","Highlight","themes","style","tokens","getLineProps","getTokenProps","line","i","token","ContentCopyIcon","propertyCleanup","CollectionPropertiesEditorForm","propertyErrorsRef","onPropertyError","setDirty","extraIcon","getUser","doCollectionInference","dirty","largeLayout","useLargeLayout","asDialog","selectedPropertyIndex","setSelectedPropertyIndex","codeDialogOpen","setCodeDialogOpen","inferringProperties","setInferringProperties","newPropertyDialogOpen","setNewPropertyDialogOpen","setInferredPropertyKeys","currentPropertiesOrderRef","inferPropertiesFromData","newCollection","makePropertiesEditable","newPropertyKeys","updatedProperties","updatedPropertiesOrder","updatePropertiesOrder","getCurrentPropertiesOrder","previousId","propertyPath","previousFullId","previousPropertyPath","onPropertyErrorInternal","closePropertyDialog","emptyCollection","usedPropertiesOrder","owner","body","CodeIcon","UnsavedChangesDialog","handleOk","handleCancel","title","EntityCustomViewsSelectDialog","entityViews","view","SubcollectionsEditTab","configController","collectionInference","parentCollectionIds","contextEntityViews","subcollectionToDelete","setSubcollectionToDelete","addEntityViewDialogOpen","setAddEntityViewDialogOpen","viewToDelete","setViewToDelete","currentDialog","setCurrentDialog","subcollections","resolvedEntityViews","resolveEntityView","hardCodedEntityViews","totalEntityViews","Table","TableBody","subcollection","TableRow","TableCell","CollectionEditorDialog","selectedViewKey","productsCollectionTemplate","blogCollectionTemplate","usersCollectionTemplate","pagesCollectionTemplate","CollectionEditorWelcomeView","path","pathSuggestions","onContinue","loadingPathSuggestions","setLoadingPathSuggestions","filteredPathSuggestions","setFilteredPathSuggestions","suggestions","filteredSuggestions","c","s","suggestion","TemplateButton","Icon","ImportFileUpload","subtitle","Card","CollectionEditorImportMapping","importConfig","setSelectedProperty","newHeadersMapping","onPropertyTypeChanged","importKey","inferredNewProperty","buildPropertyFromData","getInferenceType","DataNewPropertiesMapping","ImportNewPropertyFieldPreview","PropertySelect","fieldId","newProperty","CollectionEditorImportDataPreview","propertiesMapping","getPropertiesMapping","mappedData","convertDataToEntity","selectionController","useSelectionController","EntityCollectionTable","cleanPropertiesFromImport","parentSlug","slug","slugify","fullSlug","slugifiedResult","firstKey","idColumn","formDirty","setFormDirty","unsavedChangesDialogOpen","setUnsavedChangesDialogOpen","CollectionEditorDialogInternal","initialValuesProp","editedCollectionPath","fullPath","handleClose","extraView","topLevelNavigation","includeTemplates","collectionsInThisLevel","useImportConfig","authController","useAuthController","initialView","currentView","setCurrentView","setError","setCollection","initialLoadingCompleted","setInitialLoadingCompleted","initialError","setInitialError","saveCollection","updatedCollection","initialCollection","randomString","initialValues","applyPropertyConfigs","coolIconKeys","setNextMode","inferCollectionFromData","inferredCollection","onSubmit","newCollectionState","CircularProgressCenter","updatedFullPath","parentPaths","resolvedPath","getDataWithPath","onImportDataSet","buildEntityPropertiesFromData","validValues","onImportMappingComplete","Tabs","Tab","Form","ImportSaveInProgress","importedCollection","removeUndefined","ErrorView","ArrowBackIcon","LoadingButton","DoneIcon","rest","propertiesResult","applyPropertiesConfig","internalProperty","removeInitialAndTrailingSlashes","ConfigControllerContext","CollectionEditorContext","ConfigControllerProvider","collectionConfigController","configPermissions","onAnalyticsEvent","navigate","useNavigate","rootPathSuggestions","setRootPathSuggestions","paths","currentPropertyDialog","setCurrentPropertyDialog","defaultConfigPermissions","editCollection","editProperty","propertyKeyWithoutNamespace","createCollection","redirect","getPathSuggestions","url","useCollectionEditorController","useContext","useCollectionsConfigController","EditorCollectionAction","tableController","navigationController","collectionEditorController","canEditCollection","saveDefaultFilterButton","getObjectOrNull","UndoIcon","SaveIcon","o","HomePageEditorCollectionAction","permissions","onEditCollectionClicked","deleteRequested","setDeleteRequested","deleteCollection","Menu","MoreVertIcon","MenuItem","NewCollectionCard","context","canCreateCollections","RootCollectionSuggestions","showSuggestions","Collapse","CollectionViewHeaderAction","onHover","PropertyAddColumnComponent","getDefaultPropertiesOrder","NewCollectionButton","useCollectionEditorPlugin","modifyCollection","injectCollections","baseCollections","markAsEditable","storedCollections","joinCollectionLists","MissingReferenceWidget","pathProp","getLastSegment","collectionEditor","segments"],"mappings":";;;;;;;;;;;;;;AAEO,MAAMA,KAAYC,GAAI,OAAO,EAAE,MAAM;AAAA,EACxC,IAAIA,GAAI,SAAS,SAAS,UAAU;AAAA,EACpC,MAAMA,GAAI,SAAS,SAAS,UAAU;AAAA,EACtC,MA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version":3,"file":"index.es.js","sources":["../src/ui/collection_editor/CollectionYupValidation.tsx","../src/ui/collection_editor/properties/FieldHelperView.tsx","../src/ui/collection_editor/CollectionDetailsForm.tsx","../src/ui/collection_editor/util.ts","../src/ui/collection_editor/EnumForm.tsx","../src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx","../src/ui/collection_editor/properties/validation/ValidationPanel.tsx","../src/ui/collection_editor/properties/EnumPropertyField.tsx","../src/ui/collection_editor/properties/StoragePropertyField.tsx","../src/utils/entities.ts","../src/ui/collection_editor/PropertyFieldPreview.tsx","../src/ui/collection_editor/PropertyTree.tsx","../src/ui/collection_editor/properties/MapPropertyField.tsx","../src/ui/collection_editor/properties/RepeatPropertyField.tsx","../src/ui/collection_editor/properties/CommonPropertyFields.tsx","../src/ui/collection_editor/properties/StringPropertyField.tsx","../src/ui/collection_editor/properties/BooleanPropertyField.tsx","../src/ui/collection_editor/properties/BlockPropertyField.tsx","../src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx","../src/ui/collection_editor/properties/NumberPropertyField.tsx","../src/ui/collection_editor/properties/ReferencePropertyField.tsx","../src/ui/collection_editor/properties/DateTimePropertyField.tsx","../src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx","../src/ui/collection_editor/properties/KeyValuePropertyField.tsx","../src/ui/collection_editor/utils/update_property_for_widget.ts","../src/ui/collection_editor/PropertySelectItem.tsx","../src/ui/collection_editor/properties/UrlPropertyField.tsx","../src/ui/collection_editor/utils/supported_fields.tsx","../src/ui/collection_editor/PropertyEditView.tsx","../src/ui/collection_editor/utils/strings.ts","../src/ui/collection_editor/GetCodeDialog.tsx","../src/ui/collection_editor/CollectionPropertiesEditorForm.tsx","../src/ui/collection_editor/UnsavedChangesDialog.tsx","../src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx","../src/ui/collection_editor/SubcollectionsEditTab.tsx","../src/ui/collection_editor/templates/products_template.ts","../src/ui/collection_editor/templates/blog_template.ts","../src/ui/collection_editor/templates/users_template.ts","../src/ui/collection_editor/templates/pages_template.ts","../src/ui/collection_editor/CollectionEditorWelcomeView.tsx","../src/ui/collection_editor/import/CollectionEditorImportMapping.tsx","../src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx","../src/ui/collection_editor/import/clean_import_data.ts","../src/ui/collection_editor/CollectionEditorDialog.tsx","../src/ConfigControllerProvider.tsx","../src/useCollectionEditorController.tsx","../src/useCollectionsConfigController.tsx","../src/ui/EditorCollectionAction.tsx","../src/ui/HomePageEditorCollectionAction.tsx","../src/ui/NewCollectionCard.tsx","../src/ui/RootCollectionSuggestions.tsx","../src/ui/CollectionViewHeaderAction.tsx","../src/ui/PropertyAddColumnComponent.tsx","../src/ui/NewCollectionButton.tsx","../src/useCollectionEditorPlugin.tsx","../src/ui/MissingReferenceWidget.tsx"],"sourcesContent":["import * as Yup from \"yup\";\n\nexport const YupSchema = Yup.object().shape({\n id: Yup.string().required(\"Required\"),\n name: Yup.string().required(\"Required\"),\n path: Yup.string().required(\"Required\")\n});\n","import { Typography } from \"@firecms/ui\";\n\nexport function FieldHelperView({\n error,\n children\n }: { error?: boolean, children?: React.ReactNode }) {\n if (!children) return null;\n return (\n <Typography variant={\"caption\"} color={error ? \"error\" : \"secondary\"} className={\"ml-3.5 mt-0.5\"}>\n {children}\n </Typography>\n );\n}\n","import React, { useEffect, useState } from \"react\";\nimport { EntityCollection, IconForView, SearchIconsView, singular, toSnakeCase, } from \"@firecms/core\";\nimport {\n Autocomplete,\n AutocompleteItem,\n BooleanSwitchWithLabel,\n Chip,\n cn,\n Container,\n DebouncedTextField,\n Dialog,\n ExpandablePanel,\n IconButton,\n Select,\n SelectItem,\n SettingsIcon,\n TextField,\n Tooltip,\n Typography,\n useAutoComplete\n} from \"@firecms/ui\";\nimport { Field, getIn, useFormikContext } from \"formik\";\n\nimport { FieldHelperView } from \"./properties/FieldHelperView\";\n\nexport function CollectionDetailsForm({\n isNewCollection,\n reservedGroups,\n existingPaths,\n existingIds,\n groups,\n parentCollection\n }: {\n isNewCollection: boolean,\n reservedGroups?: string[];\n existingPaths?: string[];\n existingIds?: string[];\n groups: string[] | null;\n parentCollection?: EntityCollection;\n parentCollectionIds?: string[];\n}) {\n\n const groupRef = React.useRef<HTMLInputElement>(null);\n const {\n values,\n setFieldValue,\n handleChange,\n touched,\n errors,\n setFieldTouched,\n isSubmitting,\n submitCount\n } = useFormikContext<EntityCollection>();\n\n const [iconDialogOpen, setIconDialogOpen] = useState(false);\n const [advancedPanelExpanded, setAdvancedPanelExpanded] = useState(false);\n\n const updateName = (name: string) => {\n setFieldValue(\"name\", name);\n\n const pathTouched = getIn(touched, \"path\");\n if (!pathTouched && isNewCollection && name) {\n setFieldValue(\"path\", toSnakeCase(name));\n }\n\n const idTouched = getIn(touched, \"id\");\n if (!idTouched && isNewCollection && name) {\n setFieldValue(\"id\", toSnakeCase(name));\n }\n\n const singularNameTouched = getIn(touched, \"singularName\");\n if (!singularNameTouched && isNewCollection && name) {\n setFieldValue(\"singularName\", singular(name))\n }\n\n };\n\n useEffect(() => {\n if (errors.id) {\n setAdvancedPanelExpanded(true);\n }\n }, [errors.id]);\n\n const collectionIcon = <IconForView collectionOrView={values}/>;\n\n const groupOptions = groups?.filter((group) => !reservedGroups?.includes(group));\n\n const {\n inputFocused,\n autoCompleteOpen,\n setAutoCompleteOpen\n } = useAutoComplete({\n ref: groupRef\n });\n\n const isSubcollection = !!parentCollection;\n\n let customIdValue: \"true\" | \"false\" | \"optional\" | \"code_defined\" | undefined;\n if (customIdValue) {\n if (typeof values.customId === \"object\") {\n customIdValue = \"code_defined\";\n } else if (values.customId === true) {\n customIdValue = \"true\";\n } else if (values.customId === false) {\n customIdValue = \"false\";\n } else if (values.customId === \"optional\") {\n customIdValue = \"optional\";\n }\n }\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"4xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <div>\n <div\n className=\"flex flex-row py-2 pt-3 items-center\">\n <Typography variant={!isNewCollection ? \"h5\" : \"h4\"} className={\"flex-grow\"}>\n {isNewCollection ? \"New collection\" : `${values?.name} collection`}\n </Typography>\n <Tooltip title={\"Change icon\"}>\n <IconButton\n shape={\"square\"}\n onClick={() => setIconDialogOpen(true)}>\n {collectionIcon}\n </IconButton>\n </Tooltip>\n </div>\n\n {parentCollection && <Chip colorScheme={\"tealDarker\"}>\n <Typography variant={\"caption\"}>\n This is a subcollection of <b>{parentCollection.name}</b>\n </Typography>\n </Chip>}\n\n </div>\n <div className={\"grid grid-cols-12 gap-4\"}>\n\n <div className={\"col-span-12\"}>\n <TextField\n value={values.name ?? \"\"}\n onChange={(e: any) => updateName(e.target.value)}\n label={\"Name\"}\n required\n error={touched.name && Boolean(errors.name)}/>\n <FieldHelperView error={touched.name && Boolean(errors.name)}>\n {touched.name && Boolean(errors.name) ? errors.name : \"Name of in this collection, usually a plural name (e.g. Products)\"}\n </FieldHelperView>\n </div>\n\n <div className={cn(\"col-span-12 \", isSubcollection ? \"\" : \"sm:col-span-8\")}>\n <Field name={\"path\"}\n as={DebouncedTextField}\n label={\"Path\"}\n disabled={!isNewCollection}\n required\n error={touched.path && Boolean(errors.path)}/>\n\n <FieldHelperView error={touched.path && Boolean(errors.path)}>\n {touched.path && Boolean(errors.path)\n ? errors.path\n : isSubcollection ? \"Relative path to the parent (no need to include the parent path)\" : \"Path that this collection is stored in, in the database\"}\n </FieldHelperView>\n\n </div>\n\n {!isSubcollection && <div className={\"col-span-12 sm:col-span-4 relative\"}>\n\n <TextField error={touched.group && Boolean(errors.group)}\n disabled={isSubmitting}\n value={values.group ?? \"\"}\n autoComplete=\"off\"\n onChange={(event) => setFieldValue(\"group\", event.target.value)}\n name={\"group\"}\n inputRef={groupRef}\n label=\"Group\"/>\n <Autocomplete\n open={autoCompleteOpen && (groupOptions ?? []).length > 0}\n setOpen={setAutoCompleteOpen}>\n {groupOptions?.map((group, index) => {\n return <AutocompleteItem\n key={index + \"_\" + group}\n onClick={() => {\n setAutoCompleteOpen(false);\n setFieldValue(\"group\", group ?? null);\n }}\n >\n <div className={\"flex-grow\"}>\n {group}\n </div>\n </AutocompleteItem>;\n })}\n </Autocomplete>\n <FieldHelperView>\n {touched.group && Boolean(errors.group) ? errors.group : \"Group of the collection\"}\n </FieldHelperView>\n </div>}\n\n <div className={\"col-span-12\"}>\n <ExpandablePanel\n expanded={advancedPanelExpanded}\n onExpandedChange={setAdvancedPanelExpanded}\n title={\n <div className=\"flex flex-row text-gray-500\">\n <SettingsIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n Advanced\n </Typography>\n </div>}\n initiallyExpanded={false}>\n <div className={\"grid grid-cols-12 gap-4 p-4\"}>\n\n <div className={\"col-span-12\"}>\n <Field name={\"id\"}\n as={DebouncedTextField}\n disabled={!isNewCollection}\n label={\"Collection id\"}\n error={touched.id && Boolean(errors.id)}/>\n <FieldHelperView error={touched.id && Boolean(errors.id)}>\n {touched.id && Boolean(errors.id) ? errors.id : \"This id identifies this collection\"}\n </FieldHelperView>\n </div>\n\n <div className={\"col-span-12\"}>\n <TextField\n error={touched.singularName && Boolean(errors.singularName)}\n id={\"singularName\"}\n aria-describedby={\"singularName-helper\"}\n onChange={(e) => {\n setFieldTouched(\"singularName\", true);\n return handleChange(e);\n }}\n value={values.singularName ?? \"\"}\n label={\"Singular name\"}/>\n <FieldHelperView error={touched.singularName && Boolean(errors.singularName)}>\n {touched.singularName && Boolean(errors.singularName) ? errors.singularName : \"Optionally define a singular name for your entities\"}\n </FieldHelperView>\n </div>\n <div className={\"col-span-12\"}>\n <TextField\n error={touched.description && Boolean(errors.description)}\n id=\"description\"\n value={values.description ?? \"\"}\n onChange={handleChange}\n multiline\n rows={2}\n aria-describedby=\"description-helper-text\"\n label=\"Description\"\n />\n <FieldHelperView error={touched.description && Boolean(errors.description)}>\n {touched.description && Boolean(errors.description) ? errors.description : \"Description of the collection, you can use markdown\"}\n </FieldHelperView>\n </div>\n\n <div className={\"col-span-12\"}>\n <Select\n name=\"defaultSize\"\n label=\"Default row size\"\n position={\"item-aligned\"}\n onChange={handleChange}\n value={values.defaultSize ?? \"\"}\n renderValue={(value: any) => value.toUpperCase()}\n >\n {[\"xs\", \"s\", \"m\", \"l\", \"xl\"].map((value) => (\n <SelectItem\n key={`size-select-${value}`}\n value={value}>\n {value.toUpperCase()}\n </SelectItem>\n ))}\n </Select>\n </div>\n <div className={\"col-span-12\"}>\n <Select\n name=\"customId\"\n label=\"Data IDs generation\"\n position={\"item-aligned\"}\n disabled={customIdValue === \"code_defined\"}\n onValueChange={(v) => {\n if (v === \"code_defined\")\n throw new Error(\"This should not happen\");\n else if (v === \"true\")\n setFieldValue(\"customId\", true);\n else if (v === \"false\")\n setFieldValue(\"customId\", false);\n else if (v === \"optional\")\n setFieldValue(\"customId\", \"optional\");\n }}\n value={customIdValue ?? \"\"}\n renderValue={(value: any) => {\n if (value === \"code_defined\")\n return \"Code defined\";\n else if (value === \"true\")\n return \"Users must define an ID\";\n else if (value === \"optional\")\n return \"Users can define an ID, but it is not required\";\n else\n return \"Document ID is generated automatically\";\n }}\n >\n <SelectItem value={\"false\"}>\n Document ID is generated automatically\n </SelectItem>\n <SelectItem value={\"true\"}>\n Users must define an ID\n </SelectItem>\n <SelectItem value={\"optional\"}>\n Users can define an ID, but it is not required\n </SelectItem>\n </Select>\n </div>\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n label=\"Collection group\"\n onValueChange={(v) => setFieldValue(\"collectionGroup\", v)}\n value={values.collectionGroup ?? false}\n />\n <FieldHelperView>\n A collection group consists of all collections with the same path. This allows\n you\n to query over multiple collections at once.\n </FieldHelperView>\n </div>\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n label=\"Enable text search for this collection\"\n onValueChange={(v) => setFieldValue(\"textSearchEnabled\", v)}\n value={values.textSearchEnabled ?? false}\n />\n <FieldHelperView>\n Allow text search for this collection. If you have not specified a text search\n delegate, this will use the built-in local text search. This is not recommended\n for large collections, as it may incur in performance and cost issues.\n </FieldHelperView>\n </div>\n </div>\n </ExpandablePanel>\n\n </div>\n\n </div>\n\n <div style={{ height: \"52px\" }}/>\n\n <Dialog\n open={iconDialogOpen}\n onOpenChange={setIconDialogOpen}\n maxWidth={\"xl\"}\n fullWidth\n >\n <div className={\"p-4 overflow-auto min-h-[200px]\"}>\n <SearchIconsView selectedIcon={values.icon}\n onIconSelected={(icon: string) => {\n setIconDialogOpen(false);\n setFieldValue(\"icon\", icon);\n }}/>\n </div>\n\n </Dialog>\n\n </Container>\n </div>\n );\n}\n","export function idToPropertiesPath(id: string): string {\n return \"properties.\" + id.replaceAll(\".\", \".properties.\");\n}\n\nexport function namespaceToPropertiesPath(namespace?: string): string {\n return namespace\n ? \"properties.\" + namespace.replaceAll(\".\", \".properties.\") + \".properties\"\n : \"properties\";\n}\n\nexport function namespaceToPropertiesOrderPath(namespace?: string): string {\n return namespace\n ? \"properties.\" + namespace.replaceAll(\".\", \".properties.\") + \".propertiesOrder\"\n : \"propertiesOrder\";\n}\n\nexport function getFullId(propertyKey: string, propertyNamespace?: string): string {\n return propertyNamespace\n ? `${propertyNamespace}.${propertyKey}`\n : propertyKey;\n}\n","import React, { useEffect } from \"react\";\n\nimport { FastField, Formik, getIn, useFormikContext } from \"formik\";\nimport { EnumValueConfig, EnumValues, FormikArrayContainer, } from \"@firecms/core\";\nimport {\n AutoAwesomeIcon,\n Button,\n CircularProgress,\n DebouncedTextField,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n ListIcon,\n Paper,\n SettingsIcon,\n Typography\n} from \"@firecms/ui\";\nimport { FieldHelperView } from \"./properties/FieldHelperView\";\nimport { extractEnumFromValues } from \"@firecms/schema_inference\";\n\ntype EnumFormProps = {\n enumValues: EnumValueConfig[];\n onValuesChanged?: (enumValues: EnumValueConfig[]) => void;\n onError?: (error: boolean) => void;\n updateIds: boolean;\n disabled: boolean;\n allowDataInference?: boolean;\n getData?: () => Promise<string[]>;\n};\nexport const EnumForm = React.memo(\n function EnumForm({\n enumValues,\n onValuesChanged,\n onError,\n updateIds,\n disabled,\n allowDataInference,\n getData\n }: EnumFormProps) {\n\n return (\n <Formik initialValues={{ enumValues }}\n // enableReinitialize={true}\n validateOnMount={true}\n onSubmit={(data: { enumValues: EnumValueConfig[] }, formikHelpers) => {\n }}\n >\n {\n ({\n values,\n errors\n }) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (onValuesChanged) {\n onValuesChanged(values.enumValues);\n }\n }, [values.enumValues]);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (onError)\n onError(Boolean(errors?.enumValues ?? false));\n }, [errors]);\n\n return <EnumFormFields enumValuesPath={\"enumValues\"}\n values={values}\n errors={errors}\n shouldUpdateId={updateIds}\n disabled={disabled}\n allowDataInference={allowDataInference}\n getData={getData}/>\n }\n }\n </Formik>\n\n );\n },\n function areEqual(prevProps: EnumFormProps, nextProps: EnumFormProps) {\n return prevProps.enumValues.length === nextProps.enumValues.length &&\n prevProps.onValuesChanged === nextProps.onValuesChanged &&\n prevProps.getData === nextProps.getData\n ;\n }\n);\n\ntype EnumFormFieldsProps = {\n values: { enumValues: EnumValueConfig[] };\n errors: any;\n enumValuesPath: string;\n shouldUpdateId: boolean;\n disabled: boolean;\n getData?: () => Promise<string[]>;\n allowDataInference?: boolean;\n};\n\n// const EnumFormFields = React.memo(\nfunction EnumFormFields({\n values,\n errors,\n disabled,\n enumValuesPath,\n shouldUpdateId,\n allowDataInference,\n getData,\n }: EnumFormFieldsProps) {\n\n const {\n setFieldValue\n } = useFormikContext();\n\n const [lastInternalIdAdded, setLastInternalIdAdded] = React.useState<number | undefined>();\n const [editDialogIndex, setEditDialogIndex] = React.useState<number | undefined>();\n const [inferring, setInferring] = React.useState(false);\n\n const inferredValuesRef = React.useRef(new Set());\n const inferredValues = inferredValuesRef.current;\n\n const buildEntry = (index: number, internalId: number) => {\n const justAdded = lastInternalIdAdded === internalId;\n return <EnumEntry index={index}\n disabled={disabled}\n enumValuesPath={enumValuesPath}\n autoFocus={justAdded}\n shouldUpdateId={shouldUpdateId || justAdded}\n onDialogOpen={() => setEditDialogIndex(index)}\n inferredEntry={inferredValues.has(values.enumValues[index]?.id as string)}\n key={`${internalId}`}/>;\n };\n\n const inferValues = async () => {\n if (!getData)\n return;\n setInferring(true);\n getData?.().then((data) => {\n if (!data)\n return;\n\n const flatData = data.flat();\n\n const fieldData = Array.from(new Set(flatData));\n\n const currentEnumValues = values.enumValues;\n const foundEnumValues = extractEnumFromValues(fieldData);\n\n // add only new enum values\n const newEnumValues = foundEnumValues.filter((enumValue) => {\n return !currentEnumValues?.some((v: any) => v.id === enumValue.id);\n });\n\n newEnumValues.forEach((enumValue) => {\n inferredValues.add(enumValue.id);\n });\n setFieldValue(enumValuesPath, [...newEnumValues, ...currentEnumValues]);\n }).catch(e => {\n console.error(e);\n })\n .finally(() => setInferring(false));\n }\n\n return (\n <div className={\"col-span-12\"}>\n <div className=\"ml-3.5 flex flex-row items-center\">\n <ListIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2 grow\">\n Values\n </Typography>\n {allowDataInference &&\n <Button loading={inferring}\n disabled={disabled || inferring}\n variant={\"text\"}\n size={\"small\"}\n onClick={inferValues}>\n {inferring ? <CircularProgress size={\"small\"}/> : <AutoAwesomeIcon/>}\n Infer values from data\n </Button>}\n </div>\n\n <Paper className=\"p-4 m-1\">\n\n <FormikArrayContainer\n value={values.enumValues}\n addLabel={\"Add enum value\"}\n name={enumValuesPath}\n buildEntry={buildEntry}\n disabled={disabled}\n onInternalIdAdded={setLastInternalIdAdded}\n small={true}\n setFieldValue={setFieldValue}\n includeAddButton={true}/>\n\n <EnumEntryDialog index={editDialogIndex}\n open={editDialogIndex !== undefined}\n enumValuesPath={enumValuesPath}\n onClose={() => setEditDialogIndex(undefined)}/>\n </Paper>\n </div>\n );\n}\n\ntype EnumEntryProps = {\n index: number,\n enumValuesPath: string,\n shouldUpdateId: boolean,\n autoFocus: boolean,\n onDialogOpen: () => void;\n disabled: boolean;\n inferredEntry?: boolean;\n};\n\nconst EnumEntry = React.memo(\n function EnumEntryInternal({\n index,\n shouldUpdateId: updateId,\n enumValuesPath,\n autoFocus,\n onDialogOpen,\n disabled,\n inferredEntry\n }: EnumEntryProps) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormikContext<EnumValues>();\n\n const shouldUpdateIdRef = React.useRef(!getIn(values, `${enumValuesPath}[${index}].id`));\n const shouldUpdateId = updateId || shouldUpdateIdRef.current;\n\n const idValue = getIn(values, `${enumValuesPath}[${index}].id`);\n const labelValue = getIn(values, `${enumValuesPath}[${index}].label`);\n\n const labelError = getIn(errors, `${enumValuesPath}[${index}].label`);\n\n const currentLabelRef = React.useRef(labelValue);\n\n React.useEffect(() => {\n if ((currentLabelRef.current === idValue || !idValue) && shouldUpdateId) {\n setFieldValue(`${enumValuesPath}[${index}].id`, labelValue);\n }\n currentLabelRef.current = labelValue;\n }, [labelValue]);\n\n return (\n <div className={\"flex w-full align-center justify-center\"}>\n <FastField name={`${enumValuesPath}[${index}].label`}\n as={DebouncedTextField}\n className={\"flex-grow\"}\n required\n disabled={disabled}\n size=\"small\"\n validate={validateLabel}\n autoFocus={autoFocus}\n autoComplete=\"off\"\n endAdornment={inferredEntry && <AutoAwesomeIcon size={\"small\"}/>}\n error={Boolean(labelError)}/>\n\n {!disabled &&\n <IconButton\n size=\"small\"\n aria-label=\"edit\"\n className={\"m-1\"}\n onClick={() => onDialogOpen()}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>}\n\n </div>);\n },\n function areEqual(prevProps: EnumEntryProps, nextProps: EnumEntryProps) {\n return prevProps.index === nextProps.index &&\n prevProps.enumValuesPath === nextProps.enumValuesPath &&\n prevProps.shouldUpdateId === nextProps.shouldUpdateId &&\n prevProps.inferredEntry === nextProps.inferredEntry &&\n prevProps.autoFocus === nextProps.autoFocus;\n }\n);\n\nfunction EnumEntryDialog({\n index,\n open,\n onClose,\n enumValuesPath\n }: {\n index?: number;\n open: boolean;\n enumValuesPath: string;\n onClose: () => void;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormikContext<EnumValues>();\n\n const idError = index !== undefined ? getIn(errors, `${enumValuesPath}[${index}].id`) : undefined;\n return <Dialog\n maxWidth=\"md\"\n aria-labelledby=\"enum-edit-dialog\"\n open={open}\n onOpenChange={(open) => !open ? onClose() : undefined}\n >\n\n <DialogContent>\n {index !== undefined &&\n <div><FastField name={`${enumValuesPath}[${index}]id`}\n as={DebouncedTextField}\n required\n validate={validateId}\n label={\"ID\"}\n size=\"small\"\n autoComplete=\"off\"\n error={Boolean(idError)}/>\n\n <FieldHelperView error={Boolean(idError)}>\n {idError ?? \"Value saved in the data source\"}\n </FieldHelperView>\n </div>}\n </DialogContent>\n\n <DialogActions>\n <Button\n autoFocus\n variant=\"outlined\"\n onClick={onClose}\n color=\"primary\">\n Ok\n </Button>\n </DialogActions>\n\n </Dialog>\n}\n\nfunction validateLabel(value: string) {\n let error;\n if (!value) {\n error = \"You must specify a label\";\n }\n return error;\n}\n\nfunction validateId(value: string) {\n let error;\n if (!value) {\n error = \"You must specify an ID\";\n }\n return error;\n}\n","import React from \"react\";\n\nimport { FastField, getIn, useFormikContext } from \"formik\";\nimport { SwitchControl } from \"@firecms/core\";\nimport { DebouncedTextField } from \"@firecms/ui\";\n\nexport function GeneralPropertyValidation({ disabled }: {\n required?: boolean;\n disabled:boolean;\n}) {\n\n const { values, handleChange } = useFormikContext();\n\n const validationRequired = \"validation.required\";\n const validationRequiredMessage = \"validation.requiredMessage\";\n const validationUnique = \"validation.unique\";\n const validationUniqueInArray = \"validation.uniqueInArray\";\n\n return (\n <>\n <div className={\"col-span-6\"}>\n <FastField type=\"checkbox\"\n disabled={disabled}\n name={validationRequired}\n label={\"Required\"}\n tooltip={\"You won't be able to save this entity if this value is not set\"}\n component={SwitchControl}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <FastField type=\"checkbox\"\n disabled={disabled}\n name={validationUnique}\n label={\"Unique\"}\n tooltip={\"There cannot be multiple entities with the same value\"}\n component={SwitchControl}/>\n </div>\n\n {getIn(values, validationRequired) && <div className={\"col-span-12\"}>\n <DebouncedTextField\n disabled={disabled}\n value={getIn(values, validationRequiredMessage)}\n label={\"Required message\"}\n name={validationRequiredMessage}\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n </>\n );\n}\n","import React from \"react\";\n\nimport { FastField, getIn, useFormikContext } from \"formik\";\nimport { isValidRegExp, serializeRegExp, SwitchControl } from \"@firecms/core\";\nimport { DebouncedTextField, } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\nimport { FieldHelperView } from \"../FieldHelperView\";\n\nexport function StringPropertyValidation({\n length,\n lowercase,\n matches,\n max,\n min,\n trim,\n uppercase,\n disabled,\n showErrors\n }: {\n length?: boolean;\n min?: boolean;\n max?: boolean;\n trim?: boolean;\n matches?: boolean;\n lowercase?: boolean;\n uppercase?: boolean;\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const {\n values,\n handleChange,\n errors\n } = useFormikContext();\n\n const validationLength = \"validation.length\";\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n const validationTrim = \"validation.trim\";\n const validationMatches = \"validation.matches\";\n const validationLowercase = \"validation.lowercase\";\n const validationUppercase = \"validation.uppercase\";\n\n const matchesError = getIn(errors, validationMatches);\n\n const matchesValue = getIn(values, validationMatches);\n const matchesStringValue = typeof matchesValue === \"string\" ? matchesValue : serializeRegExp(matchesValue);\n return (\n <div className={\"grid grid-cols-12 gap-2\"}>\n\n <GeneralPropertyValidation disabled={disabled}/>\n\n <div className={\"grid grid-cols-12 gap-2 col-span-12\"}>\n {lowercase && <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationLowercase}\n label={\"Lowercase\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>}\n {uppercase && <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationUppercase}\n label={\"Uppercase\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>}\n {trim && <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationTrim}\n label={\"Trim\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>}\n </div>\n\n <div className={\"grid grid-cols-12 gap-2 col-span-12\"}>\n {length && <div className={\"col-span-4\"}>\n <DebouncedTextField\n value={getIn(values, validationLength)}\n label={\"Exact length\"}\n name={validationLength}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n {min && <div className={\"col-span-4\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n label={\"Min length\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n {max && <div className={\"col-span-4\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n label={\"Max length\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>}\n\n </div>\n\n {matches && <div className={\"col-span-12\"}>\n <FastField name={validationMatches}\n as={DebouncedTextField}\n validate={(value: string) => value && !isValidRegExp(value)}\n label={\"Matches regex\"}\n size=\"small\"\n disabled={disabled}\n value={matchesStringValue}\n error={Boolean(matchesError)}/>\n <FieldHelperView error={Boolean(matchesError)}>\n {matchesError ? \"Not a valid regexp\" : \"e.g. /^\\\\d+$/ for digits only\"}\n </FieldHelperView>\n </div>}\n\n </div>\n );\n\n}\n","import React from \"react\";\n\nimport { getIn, useFormikContext } from \"formik\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\n\nexport function ArrayPropertyValidation({\n max = true,\n min = true,\n disabled\n }: {\n min?: boolean;\n max?: boolean;\n disabled: boolean;\n}) {\n\n const {\n values,\n handleChange\n } = useFormikContext();\n\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n\n return (\n <div className={\"grid grid-cols-12 gap-2\"}>\n\n <GeneralPropertyValidation disabled={disabled}/>\n\n {min && <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n disabled={disabled}\n label={\"Min length\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n {max && <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n disabled={disabled}\n label={\"Max length\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n onChange={handleChange}/>\n </div>}\n </div>\n );\n}\n","import { PropsWithChildren } from \"react\";\n\nimport { ExpandablePanel, RuleIcon, Typography } from \"@firecms/ui\";\n\nexport function ValidationPanel({\n children\n }: PropsWithChildren<{}>) {\n\n return (\n <ExpandablePanel\n initiallyExpanded={false}\n asField={true}\n className=\"p-4\"\n title={\n <div className=\"flex flex-row text-gray-500\">\n <RuleIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n Validation\n </Typography>\n </div>\n }>\n\n {children}\n\n </ExpandablePanel>\n )\n}\n","import React, { useMemo } from \"react\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { EnumValueConfig, resolveEnumValues, useSnackbarController } from \"@firecms/core\";\nimport { Select, SelectItem } from \"@firecms/ui\";\nimport { EnumForm } from \"../EnumForm\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { PropertyWithId } from \"../PropertyEditView\";\n\nexport function EnumPropertyField({\n multiselect,\n updateIds,\n disabled,\n showErrors,\n allowDataInference,\n getData\n }: {\n multiselect: boolean;\n updateIds: boolean;\n disabled: boolean;\n showErrors: boolean;\n allowDataInference?: boolean;\n getData?: () => Promise<object[]>;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n touched,\n setFieldError,\n setFieldValue\n } = useFormikContext<PropertyWithId>();\n\n const snackbarContext = useSnackbarController();\n\n const enumValuesPath = multiselect ? \"of.enumValues\" : \"enumValues\";\n\n const defaultValue = getIn(values, \"defaultValue\");\n\n const valuesEnumValues = getIn(values, enumValuesPath);\n const enumValues: EnumValueConfig[] = useMemo(() => {\n if (!valuesEnumValues || typeof valuesEnumValues === \"boolean\")\n return [] as EnumValueConfig[];\n return resolveEnumValues(valuesEnumValues) ?? [] as EnumValueConfig[];\n }, [valuesEnumValues]);\n\n const onValuesChanged = (value: EnumValueConfig[]) => {\n if (!values)\n return;\n setFieldValue(enumValuesPath, value);\n if (!multiselect) {\n const enumIds = value.filter(v => Boolean(v?.id)).map((v: any) => v.id);\n if (defaultValue && !enumIds.includes(defaultValue)) {\n setFieldValue(\"defaultValue\", undefined);\n snackbarContext.open({\n type: \"warning\",\n message: \"Default value was cleared\"\n })\n }\n }\n };\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <EnumForm enumValues={enumValues}\n updateIds={updateIds}\n disabled={disabled}\n allowDataInference={allowDataInference}\n onError={(hasError) => {\n setFieldError(enumValuesPath, hasError ? \"\" : undefined);\n }}\n getData={getData\n ? () => getData()\n .then(res => res.map(d => values.id && getIn(d, values.id)).filter(Boolean))\n : undefined}\n onValuesChanged={onValuesChanged}/>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n {!multiselect &&\n <StringPropertyValidation disabled={disabled}\n showErrors={showErrors}/>}\n {multiselect &&\n <ArrayPropertyValidation disabled={disabled}/>}\n </ValidationPanel>\n\n </div>\n\n {!multiselect && <div className={\"col-span-12\"}>\n\n <Select\n disabled={disabled}\n position={\"item-aligned\"}\n onValueChange={(value: string) => {\n setFieldValue(\"defaultValue\", value);\n }}\n label={\"Default value\"}\n value={defaultValue ?? \"\"}>\n {enumValues\n .filter((enumValue) => Boolean(enumValue?.id))\n .map((enumValue) => (\n <SelectItem key={enumValue.id}\n value={enumValue.id?.toString()}>\n {enumValue.label}\n </SelectItem>\n ))}\n </Select>\n\n </div>}\n </>\n );\n}\n","import React from \"react\";\nimport { SwitchControl, } from \"@firecms/core\";\nimport {\n Button,\n Checkbox,\n DebouncedTextField,\n ExpandablePanel,\n FileUploadIcon,\n MultiSelect,\n MultiSelectItem,\n Typography\n} from \"@firecms/ui\";\n\nimport { Field, getIn, useFormikContext } from \"formik\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\n\nconst fileTypes: Record<string, string> = {\n \"image/*\": \"Images\",\n \"video/*\": \"Videos\",\n \"audio/*\": \"Audio files\",\n \"application/*\": \"Files (pdf, zip, csv, excel...)\",\n \"text/*\": \"Text files\"\n}\n\nexport function StoragePropertyField({\n multiple,\n existing,\n disabled\n }: {\n multiple: boolean;\n existing: boolean;\n disabled: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormikContext();\n\n const baseStoragePath = multiple ? \"of.storage\" : \"storage\";\n const acceptedFiles = `${baseStoragePath}.acceptedFiles`;\n\n const metadata = `${baseStoragePath}.metadata`;\n const fileName = `${baseStoragePath}.fileName`;\n const storagePath = `${baseStoragePath}.storagePath`;\n const storeUrl = `${baseStoragePath}.storeUrl`;\n\n const fileNameValue = getIn(values, fileName) ?? \"{rand}_{file}\";\n const storagePathValue = getIn(values, storagePath) ?? \"/\";\n\n const storedValue = getIn(values, acceptedFiles);\n const fileTypesValue: string[] | undefined = Array.isArray(storedValue) ? storedValue : undefined;\n const allFileTypesSelected = !fileTypesValue || fileTypesValue.length === 0;\n\n const handleTypesChange = (value: string[]) => {\n if (!value) setFieldValue(acceptedFiles, undefined);\n else if (value.includes(\"all\")) setFieldValue(acceptedFiles, undefined);\n else if (value.length >= Object.keys(fileTypes).length) setFieldValue(acceptedFiles, undefined);\n else if (allFileTypesSelected)\n setFieldValue(acceptedFiles, Object.keys(fileTypes).filter((v) => !value.includes(v)));\n else setFieldValue(acceptedFiles, value);\n };\n\n const hasFilenameCallback = typeof fileNameValue === \"function\";\n const hasStoragePathCallback = typeof storagePathValue === \"function\";\n\n return (\n <>\n\n <div className={\"col-span-12\"}>\n\n <ExpandablePanel\n title={\n <div className=\"flex flex-row text-gray-500\">\n <FileUploadIcon/>\n <Typography variant={\"subtitle2\"}\n className=\"ml-2\">\n File upload config\n </Typography>\n </div>\n }>\n\n <div className={\"grid grid-cols-12 gap-2 p-4\"}>\n\n <div className={\"col-span-12\"}>\n\n <MultiSelect\n disabled={disabled}\n name={acceptedFiles}\n value={fileTypesValue ?? []}\n onMultiValueChange={handleTypesChange}\n label={allFileTypesSelected ? undefined : \"Allowed file types\"}\n renderValues={(selected) => {\n if (!selected || selected.length === 0) return \"All file types allowed\";\n return selected.map((v: string) => fileTypes[v])\n .filter((v: string) => Boolean(v))\n .join(\", \");\n }}>\n\n <MultiSelectItem key={\"all\"} value={\"all\"} className={\"flex items-center gap-2\"}>\n <Checkbox\n checked={!fileTypesValue}/>\n All\n </MultiSelectItem>\n\n {Object.entries(fileTypes).map(([value, label]) => (\n <MultiSelectItem key={value} value={value} className={\"flex items-center gap-2\"}>\n <Checkbox\n checked={allFileTypesSelected || fileTypesValue.indexOf(value) > -1}/>\n <div className={\"flex-grow\"}>\n {label}\n </div>\n <Button size={\"small\"}\n variant={\"outlined\"}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n return setFieldValue(acceptedFiles, [value]);\n }}>\n Only\n </Button>\n </MultiSelectItem>\n ))}\n\n </MultiSelect>\n </div>\n\n <div className={\"col-span-12\"}>\n <Field name={fileName}\n as={DebouncedTextField}\n label={\"File name\"}\n size={\"small\"}\n disabled={hasFilenameCallback || disabled}\n value={hasFilenameCallback ? \"-\" : fileNameValue}\n />\n </div>\n <div className={\"col-span-12\"}>\n <Field name={storagePath}\n as={DebouncedTextField}\n label={\"Storage path\"}\n disabled={hasStoragePathCallback || disabled}\n size={\"small\"}\n value={hasStoragePathCallback ? \"-\" : storagePathValue}\n />\n <Typography variant={\"caption\"} className={\"ml-3.5 mt-1 mb-2\"}>\n <p>You can use the following placeholders in\n the file name\n and storage path values:</p>\n <ul>\n <li>{\"{file} - Full name of the uploaded file\"}</li>\n <li>{\"{file.name} - Name of the uploaded file without extension\"}</li>\n <li>{\"{file.ext} - Extension of the uploaded file\"}</li>\n <li>{\"{entityId} - ID of the entity\"}</li>\n <li>{\"{propertyKey} - ID of this field\"}</li>\n <li>{\"{path} - Path of this entity\"}</li>\n <li>{\"{rand} - Random value used to avoid name collisions\"}</li>\n </ul>\n </Typography>\n <Field type=\"checkbox\"\n name={storeUrl}\n label={\"Save URL instead of storage path\"}\n disabled={existing || disabled}\n component={SwitchControl}/>\n <br/>\n <Typography variant={\"caption\"} className={\"ml-3.5 mt-1 mb-2\"}>\n Turn this setting on, if you prefer to save\n the download\n URL of the uploaded file instead of the\n storage path.\n You can only change this prop upon creation.\n </Typography>\n </div>\n </div>\n </ExpandablePanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n {!multiple && <div className={\"grid grid-cols-12 gap-2\"}>\n <GeneralPropertyValidation disabled={disabled}/>\n </div>}\n {multiple && <div className={\"col-span-12\"}>\n <ArrayPropertyValidation disabled={disabled}/>\n </div>}\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import { isPropertyBuilder, Properties, PropertiesOrBuilders, Property, PropertyOrBuilder } from \"@firecms/core\";\n\nexport function editableProperty(property: PropertyOrBuilder | PropertyOrBuilder): boolean {\n if (isPropertyBuilder(property))\n return false;\n if (isPropertyBuilder(property as PropertyOrBuilder))\n return false;\n else {\n const eProperty = property as Property;\n if (eProperty.dataType === \"array\" && typeof eProperty.of === \"function\")\n return false;\n else if (eProperty.dataType === \"array\" && Array.isArray(eProperty.of))\n return false;\n return Boolean(eProperty.editable);\n }\n}\n\nexport function removeNonEditableProperties(properties: PropertiesOrBuilders<any>): Properties {\n return Object.entries(properties)\n .filter(([_, property]) => editableProperty(property))\n .map(([key, propertyOrBuilder]) => {\n const property = propertyOrBuilder as Property;\n if (!editableProperty(property)) {\n return undefined;\n } else if (property.dataType === \"map\" && property.properties) {\n return {\n [key]: {\n ...property,\n properties: removeNonEditableProperties(property.properties as PropertiesOrBuilders)\n }\n };\n } else {\n return { [key]: property };\n }\n })\n .filter((e) => Boolean(e))\n .reduce((a, b) => ({ ...a, ...b }), {}) as Properties;\n}\n","import {\n ErrorBoundary,\n PropertyConfigBadge,\n getFieldConfig,\n isPropertyBuilder,\n Property,\n PropertyOrBuilder,\n useCustomizationController,\n} from \"@firecms/core\";\nimport {\n cardClickableMixin,\n cardMixin,\n cardSelectedMixin,\n cn,\n FunctionsIcon,\n Paper,\n RemoveCircleIcon,\n Typography,\n} from \"@firecms/ui\";\n\nimport { editableProperty } from \"../../utils/entities\";\n\nexport function PropertyFieldPreview({\n property,\n onClick,\n hasError,\n includeName,\n includeEditButton,\n selected\n }: {\n property: Property,\n hasError?: boolean,\n selected?: boolean,\n includeName?: boolean,\n includeEditButton?: boolean;\n onClick?: () => void\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n\n const propertyConfig = getFieldConfig(property, propertyConfigs);\n const disabled = !editableProperty(property);\n\n const borderColorClass = hasError\n ? \"border-red-500\"\n : (selected ? \"border-primary\" : \"border-transparent\");\n\n return <ErrorBoundary>\n <div\n onClick={onClick}\n className=\"flex flex-row w-full cursor-pointer\">\n <div className={\"m-4\"}>\n <PropertyConfigBadge propertyConfig={propertyConfig}/>\n </div>\n <Paper\n className={cn(\n \"pl-2 w-full flex flex-row gap-4 items-center\",\n cardMixin,\n onClick ? cardClickableMixin : \"\",\n selected ? cardSelectedMixin : \"\",\n \"flex-grow p-4 border transition-colors duration-200\",\n borderColorClass\n )}\n >\n\n <div className=\"w-full flex flex-col\">\n\n {includeName &&\n <ErrorBoundary>\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"flex-grow pr-2\">\n {property.name\n ? property.name\n : \"\\u00a0\"\n }\n </Typography>\n </ErrorBoundary>}\n\n <div className=\"flex flex-row items-center\">\n <ErrorBoundary>\n <Typography className=\"flex-grow pr-2\"\n variant={includeName ? \"body2\" : \"subtitle1\"}\n component=\"span\"\n color=\"secondary\">\n {propertyConfig?.name}\n </Typography>\n </ErrorBoundary>\n <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n {property.dataType}\n </Typography>\n </ErrorBoundary>\n\n </div>\n </div>\n\n {includeEditButton && <Typography variant={\"button\"}>\n EDIT\n </Typography>}\n\n </Paper>\n </div>\n </ErrorBoundary>\n}\n\nexport function NonEditablePropertyPreview({\n name,\n selected,\n onClick,\n property\n }: {\n name: string,\n selected: boolean,\n onClick?: () => void,\n property?: PropertyOrBuilder\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n\n const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, propertyConfigs) : undefined;\n\n return (\n <div\n onClick={onClick}\n className=\"flex flex-row w-full cursor-pointer\">\n <div className={\"relative m-4\"}>\n {propertyConfig && <PropertyConfigBadge propertyConfig={propertyConfig}/>}\n {!propertyConfig && <div\n className={\"h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500\"}>\n <FunctionsIcon color={\"inherit\"} size={\"medium\"}/>\n </div>}\n <RemoveCircleIcon color={\"disabled\"} size={\"small\"} className={\"absolute -right-2 -top-2\"}/>\n </div>\n <Paper\n className={cn(\n \"pl-2 w-full flex flex-row gap-4 items-center\",\n cardMixin,\n onClick ? cardClickableMixin : \"\",\n selected ? cardSelectedMixin : \"\",\n \"flex-grow p-4 border transition-colors duration-200\",\n selected ? \"border-primary\" : \"border-transparent\")}\n >\n\n <div className=\"w-full flex flex-col\">\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"flex-grow pr-2\">\n {property?.name\n ? property.name\n : name\n }\n </Typography>\n\n <div className=\"flex flex-row items-center\">\n {propertyConfig && <Typography className=\"flex-grow pr-2\"\n variant={\"body2\"}\n component=\"span\"\n color=\"secondary\">\n {propertyConfig?.name}\n </Typography>}\n\n {property && !isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n {property.dataType}\n </Typography>\n </ErrorBoundary>}\n\n {property && isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n This property is defined as a property builder in code\n </Typography>\n </ErrorBoundary>}\n\n {!property && <ErrorBoundary>\n <Typography variant=\"body2\"\n component=\"span\"\n color=\"disabled\">\n This field is defined as an additional field in code\n </Typography>\n </ErrorBoundary>}\n\n </div>\n\n {/*<div className=\"flex flex-row text-xs\">*/}\n {/* <Typography className=\"flex-grow pr-2\"*/}\n {/* variant=\"body2\"*/}\n {/* component=\"span\"*/}\n {/* color=\"secondary\">*/}\n {/* This field can only be edited in code*/}\n {/* </Typography>*/}\n {/*</div>*/}\n </div>\n\n </Paper>\n </div>)\n}\n","import {\n AdditionalFieldDelegate,\n CMSType,\n ErrorBoundary,\n isPropertyBuilder,\n PropertiesOrBuilders,\n PropertyOrBuilder,\n} from \"@firecms/core\";\nimport { AutoAwesomeIcon, defaultBorderMixin, DragHandleIcon, IconButton, RemoveIcon, Tooltip } from \"@firecms/ui\";\nimport { NonEditablePropertyPreview, PropertyFieldPreview } from \"./PropertyFieldPreview\";\nimport { DragDropContext, Draggable, DraggableProvided, Droppable } from \"@hello-pangea/dnd\";\nimport { getFullId, idToPropertiesPath } from \"./util\";\nimport { getIn } from \"formik\";\nimport { editableProperty } from \"../../utils/entities\";\nimport { useCallback } from \"react\";\n\nexport function PropertyTree<M extends {\n [Key: string]: CMSType\n}>({\n namespace,\n selectedPropertyKey,\n onPropertyClick,\n properties,\n propertiesOrder: propertiesOrderProp,\n additionalFields,\n errors,\n onPropertyMove,\n onPropertyRemove,\n className,\n inferredPropertyKeys,\n collectionEditable,\n }: {\n namespace?: string;\n selectedPropertyKey?: string;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n properties: PropertiesOrBuilders<M>;\n propertiesOrder?: string[];\n additionalFields?: AdditionalFieldDelegate<M>[];\n errors: Record<string, any>;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n className?: string;\n inferredPropertyKeys?: string[];\n collectionEditable: boolean;\n}) {\n\n const propertiesOrder = propertiesOrderProp ?? Object.keys(properties);\n\n const onDragEnd = useCallback((result: any) => {\n // dropped outside the list\n if (!result.destination) {\n return;\n }\n const startIndex = result.source.index;\n const endIndex = result.destination.index;\n\n const newPropertiesOrder = Array.from(propertiesOrder);\n const [removed] = newPropertiesOrder.splice(startIndex, 1);\n newPropertiesOrder.splice(endIndex, 0, removed);\n if (onPropertyMove)\n onPropertyMove(newPropertiesOrder, namespace);\n }, [namespace, onPropertyMove, propertiesOrder])\n\n return (\n <>\n\n <DragDropContext onDragEnd={onDragEnd}>\n <Droppable droppableId={`droppable_${namespace}`}>\n {(droppableProvided, droppableSnapshot) => (\n <div\n {...droppableProvided.droppableProps}\n ref={droppableProvided.innerRef}\n className={className}>\n {propertiesOrder && propertiesOrder\n // .filter((propertyKey) => Boolean(properties[propertyKey]))\n .map((propertyKey: string, index: number) => {\n const property = properties[propertyKey] as PropertyOrBuilder;\n const additionalField = additionalFields?.find(field => field.key === propertyKey);\n\n if (!property && !additionalField) {\n console.warn(`Property ${propertyKey} not found in properties or additionalFields`);\n return null;\n }\n return (\n <Draggable\n key={`array_field_${namespace}_${propertyKey}}`}\n draggableId={`array_field_${namespace}_${propertyKey}}`}\n index={index}>\n {(provided, snapshot) => {\n return (\n <ErrorBoundary>\n <PropertyTreeEntry\n propertyKey={propertyKey as string}\n propertyOrBuilder={property}\n additionalField={additionalField}\n provided={provided}\n errors={errors}\n namespace={namespace}\n inferredPropertyKeys={inferredPropertyKeys}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n onPropertyClick={snapshot.isDragging ? undefined : onPropertyClick}\n selectedPropertyKey={selectedPropertyKey}\n collectionEditable={collectionEditable}\n />\n </ErrorBoundary>\n );\n }}\n </Draggable>);\n }).filter(Boolean)}\n\n {droppableProvided.placeholder}\n\n </div>\n )}\n </Droppable>\n </DragDropContext>\n\n </>\n );\n}\n\nexport function PropertyTreeEntry({\n propertyKey,\n namespace,\n propertyOrBuilder,\n additionalField,\n provided,\n selectedPropertyKey,\n errors,\n onPropertyClick,\n onPropertyMove,\n onPropertyRemove,\n inferredPropertyKeys,\n collectionEditable,\n }: {\n propertyKey: string;\n namespace?: string;\n propertyOrBuilder: PropertyOrBuilder;\n additionalField?: AdditionalFieldDelegate<any>;\n selectedPropertyKey?: string;\n provided: DraggableProvided;\n errors: Record<string, any>;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n inferredPropertyKeys?: string[];\n collectionEditable: boolean;\n}) {\n\n const isPropertyInferred = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);\n\n const fullId = getFullId(propertyKey, namespace);\n\n let subtree;\n if (typeof propertyOrBuilder === \"object\") {\n const property = propertyOrBuilder;\n if (property.dataType === \"map\" && property.properties) {\n subtree = <PropertyTree\n selectedPropertyKey={selectedPropertyKey}\n namespace={fullId}\n properties={property.properties}\n propertiesOrder={property.propertiesOrder}\n errors={errors}\n onPropertyClick={onPropertyClick}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n collectionEditable={collectionEditable}\n />\n }\n }\n\n const hasError = fullId ? getIn(errors, idToPropertiesPath(fullId)) : false;\n const selected = selectedPropertyKey === fullId;\n const editable = propertyOrBuilder && ((collectionEditable && !isPropertyBuilder(propertyOrBuilder)) || editableProperty(propertyOrBuilder));\n\n return (\n <div\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n className=\"relative -ml-8\"\n >\n {subtree && <div\n className={\"absolute border-l \" + defaultBorderMixin}\n style={{\n left: \"32px\",\n top: \"64px\",\n bottom: \"16px\"\n }}/>}\n\n {!isPropertyBuilder(propertyOrBuilder) && !additionalField && editable\n ? <PropertyFieldPreview\n property={propertyOrBuilder}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n includeName={true}\n selected={selected}\n hasError={hasError}/>\n : <NonEditablePropertyPreview name={propertyKey}\n property={propertyOrBuilder}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n selected={selected}/>}\n\n <div className=\"absolute top-2 right-2 flex flex-row \">\n\n {isPropertyInferred && <Tooltip title={\"Inferred property\"}>\n <AutoAwesomeIcon size=\"small\" className={\"p-2\"}/>\n </Tooltip>}\n\n {onPropertyRemove && <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n color=\"inherit\"\n onClick={() => onPropertyRemove(propertyKey, namespace)}>\n <RemoveIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>}\n\n {onPropertyMove && <Tooltip title={\"Move\"}>\n <IconButton\n component={\"span\"}\n size=\"small\"\n >\n <DragHandleIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>}\n </div>\n\n\n {subtree && <div className={\"ml-16\"}>{subtree}</div>}\n </div>\n );\n\n}\n","import React, { useCallback, useState } from \"react\";\nimport { MapProperty, Property, PropertyConfig, } from \"@firecms/core\";\nimport { AddIcon, BooleanSwitchWithLabel, Button, Paper, Typography } from \"@firecms/ui\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { PropertyTree } from \"../PropertyTree\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from \"../util\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function MapPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {\n disabled: boolean;\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormikContext<MapProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState<boolean>(false);\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const propertiesOrder = values.propertiesOrder ?? Object.keys(values.properties ?? {});\n const onPropertyCreated = useCallback(({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n setFieldValue(\"properties\", {\n ...(values.properties ?? {}),\n [id]: property\n }, false);\n setFieldValue(\"propertiesOrder\", [...propertiesOrder, id], false);\n setPropertyDialogOpen(false);\n }, [values.properties, propertiesOrder]);\n\n const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n const propertiesPath = idToPropertiesPath(fullId);\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)));\n\n setFieldValue(propertiesPath, undefined, false);\n setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);\n\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }, [setFieldValue, values]);\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n\n const addChildButton = <Button\n color=\"primary\"\n variant={\"outlined\"}\n onClick={() => setPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}\n >\n Add property to {values.name ?? \"this group\"}\n </Button>;\n\n const empty = !propertiesOrder || propertiesOrder.length < 1;\n\n const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {\n setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);\n }, []);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <div className=\"flex justify-between items-end my-4\">\n <Typography variant={\"subtitle2\"}>Properties in this group</Typography>\n {addChildButton}\n </div>\n <Paper className=\"p-2 pl-8\">\n <PropertyTree\n properties={values.properties ?? {}}\n propertiesOrder={propertiesOrder}\n errors={{}}\n collectionEditable={collectionEditable}\n onPropertyClick={(propertyKey, namespace) => {\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n setPropertyDialogOpen(true);\n }}\n onPropertyMove={onPropertyMove}/>\n\n {empty &&\n <Typography variant={\"label\"}\n className=\"h-full flex items-center justify-center p-4\">\n Add the first property to this group\n </Typography>}\n </Paper>\n </div>\n\n <div className={\"col-span-12\"}>\n <BooleanSwitchWithLabel\n position={\"start\"}\n size={\"small\"}\n label=\"Spread children as columns\"\n onValueChange={(v) => setFieldValue(\"spreadChildren\", v)}\n value={values.spreadChildren ?? false}\n />\n <FieldHelperView>\n Set this flag to true if you want to display the children of this group as individual columns.\n </FieldHelperView>\n </div>\n\n <PropertyFormDialog\n inArray={false}\n forceShowErrors={false}\n open={propertyDialogOpen}\n allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n onCancel={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n onOkClicked={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n getData={getData}\n onDelete={deleteProperty}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n existingProperty={Boolean(selectedPropertyKey)}\n autoUpdateId={!selectedPropertyKey}\n autoOpenTypeSelect={!selectedPropertyKey}\n onPropertyChanged={onPropertyCreated}\n existingPropertyKeys={selectedPropertyKey ? undefined : propertiesOrder}\n propertyConfigs={propertyConfigs}\n />\n\n </>);\n}\n","import React, { useCallback, useState } from \"react\";\nimport { ArrayProperty, getFieldConfig, Property, PropertyConfig } from \"@firecms/core\";\nimport { Button, Paper, Typography } from \"@firecms/ui\";\nimport { Field, getIn, useFormikContext } from \"formik\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { PropertyFieldPreview } from \"../PropertyFieldPreview\";\nimport { ArrayPropertyValidation } from \"./validation/ArrayPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\n\nexport function RepeatPropertyField({\n showErrors,\n existing,\n disabled,\n getData,\n allowDataInference,\n propertyConfigs,\n collectionEditable\n }: {\n showErrors: boolean,\n existing: boolean,\n disabled: boolean,\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n handleChange,\n errors,\n setFieldValue,\n touched\n } = useFormikContext<ArrayProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState(false);\n const ofProperty = getIn(values, \"of\");\n const ofPropertyError = getIn(touched, \"of\") && getIn(errors, \"of\");\n\n const onPropertyChanged = useCallback(({ id, property, namespace }:\n { id?: string, property: Property, namespace?: string }) => {\n setFieldValue(\"of\", property);\n }, []);\n\n const widget = ofProperty && getFieldConfig(ofProperty, propertyConfigs);\n return (\n <>\n <div className={\"col-span-12\"}>\n <Typography variant={\"subtitle2\"}>\n Repeat component\n </Typography>\n <Field\n name={\"of\"}\n value={ofProperty}\n validate={(property: Property) => {\n return property?.dataType ? undefined : \"You need to specify a repeat field\";\n }}\n >\n {() => (\n <Paper className=\"p-2 mt-4\">\n\n {ofProperty && <PropertyFieldPreview\n property={ofProperty}\n onClick={disabled ? undefined : () => setPropertyDialogOpen(true)}\n includeName={false}\n includeEditButton={true}\n selected={false}\n hasError={false}/>}\n\n {!disabled && !ofProperty && <Button variant={\"text\"}\n size={\"large\"}\n color={ofPropertyError ? \"error\" : \"primary\"}\n onClick={() => setPropertyDialogOpen(true)}>\n Edit {`${widget ? widget.name : \"repeat component\"}`}\n </Button>}\n\n <PropertyFormDialog\n inArray={true}\n open={propertyDialogOpen}\n existingProperty={existing}\n getData={getData}\n autoUpdateId={!existing}\n autoOpenTypeSelect={!existing}\n onOkClicked={() => setPropertyDialogOpen(false)}\n allowDataInference={allowDataInference}\n property={ofProperty}\n includeIdAndName={false}\n onPropertyChanged={onPropertyChanged}\n forceShowErrors={showErrors}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n />\n </Paper>\n )}\n </Field>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <ArrayPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import { Field, getIn, useFormikContext } from \"formik\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { PropertyWithId } from \"../PropertyEditView\";\nimport React from \"react\";\nimport { FieldHelperView } from \"./FieldHelperView\";\nimport { toSnakeCase, unslugify } from \"@firecms/core\";\n\ntype CommonPropertyFieldsProps = {\n showErrors: boolean,\n disabledId: boolean,\n existingPropertyKeys?: string[];\n disabled: boolean;\n isNewProperty: boolean;\n autoUpdateId: boolean;\n};\n\nexport const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPropertyFieldsProps>(\n function CommonPropertyFields({\n showErrors,\n disabledId,\n existingPropertyKeys,\n disabled,\n autoUpdateId,\n isNewProperty\n }, ref) {\n\n const {\n errors,\n values,\n setFieldValue,\n setFieldTouched,\n touched\n } = useFormikContext<PropertyWithId>();\n\n const name = \"name\";\n const nameError = showErrors && getIn(errors, name);\n\n const id = \"id\";\n const idError = showErrors && getIn(errors, id);\n\n const description = \"description\";\n const descriptionError = showErrors && getIn(errors, description);\n\n return (\n <div className={\"flex flex-col gap-2 col-span-12\"}>\n\n <div>\n <Field\n inputRef={ref}\n as={DebouncedTextField}\n value={values[name]}\n onChange={(e: any) => {\n const newNameValue = e.target.value;\n setFieldValue(name, newNameValue);\n setFieldTouched(name, true, true);\n const idTouched = getIn(touched, id);\n if (!idTouched && autoUpdateId) {\n setFieldValue(id, newNameValue ? toSnakeCase(newNameValue) : \"\")\n }\n }}\n style={{ fontSize: 20 }}\n validate={validateName}\n placeholder={\"Field name\"}\n required\n disabled={disabled}\n error={Boolean(nameError)}/>\n\n <FieldHelperView error={Boolean(nameError)}>\n {nameError}\n </FieldHelperView>\n </div>\n\n <div>\n <Field\n as={DebouncedTextField}\n label={\"ID\"}\n value={values[id]}\n onChange={(e: any) => {\n const newIdValue = e.target.value;\n setFieldValue(id, newIdValue);\n setFieldTouched(id, true, true);\n const nameTouched = getIn(touched, name);\n if (!nameTouched && autoUpdateId) {\n setFieldValue(name, newIdValue ? unslugify(newIdValue) : \"\")\n }\n }}\n validate={() => validateId(values[id], existingPropertyKeys)}\n disabled={disabledId || disabled}\n required\n size=\"small\"\n error={Boolean(idError)}/>\n <FieldHelperView error={Boolean(idError)}>\n {idError}\n </FieldHelperView>\n </div>\n\n <div>\n <Field name={description}\n as={DebouncedTextField}\n label={\"Description\"}\n disabled={disabled}\n error={Boolean(descriptionError)}/>\n <FieldHelperView error={Boolean(descriptionError)}>\n {descriptionError}\n </FieldHelperView>\n </div>\n\n </div>\n );\n\n }\n);\n\nconst idRegEx = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\nfunction validateId(value?: string, existingPropertyKeys?: string[]) {\n\n let error;\n if (!value) {\n error = \"You must specify an id for the field\";\n }\n if (value && !value.match(idRegEx)) {\n error = \"The id can only contain letters, numbers and underscores (_), and not start with a number\";\n }\n if (value && existingPropertyKeys && existingPropertyKeys.includes(value)) {\n error = \"There is another field with this ID already\";\n }\n return error;\n}\n\nfunction validateName(value: string) {\n let error;\n if (!value) {\n error = \"You must specify a title for the field\";\n }\n return error;\n}\n","import React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormikContext } from \"formik\";\n\nimport { TextField } from \"@firecms/ui\";\n\nexport function StringPropertyField({\n widgetId,\n disabled,\n showErrors\n }: {\n widgetId: \"text_field\" | \"multiline\" | \"markdown\" | \"email\";\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue } = useFormikContext();\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n\n {widgetId === \"text_field\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n matches={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n {widgetId === \"multiline\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n {widgetId === \"markdown\" &&\n <StringPropertyValidation disabled={disabled}\n length={true}\n lowercase={true}\n max={true}\n min={true}\n trim={true}\n uppercase={true}\n showErrors={showErrors}/>}\n\n {widgetId === \"email\" &&\n <StringPropertyValidation disabled={disabled}\n max={true}\n min={true}\n trim={true}\n showErrors={showErrors}/>}\n\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import React from \"react\";\nimport { FastField, getIn, useFormikContext } from \"formik\";\n\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { SwitchControl } from \"@firecms/core\";\n\nexport function BooleanPropertyField({ disabled }: {\n disabled: boolean;\n}) {\n const { values } = useFormikContext();\n const defaultValue = getIn(values, \"defaultValue\");\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <FastField type=\"checkbox\"\n name={\"defaultValue\"}\n label={defaultValue === null || defaultValue === undefined ? \"Default value not set\" : (\"Default value is \" + defaultValue.toString())}\n disabled={disabled}\n allowIndeterminate={true}\n component={SwitchControl}/>\n\n </div>\n </>\n );\n}\n","import React, { useCallback, useState } from \"react\";\nimport { AddIcon, Button, Paper, Typography } from \"@firecms/ui\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { PropertyFormDialog } from \"../PropertyEditView\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"../util\";\nimport { PropertyTree } from \"../PropertyTree\";\nimport { ArrayProperty, Property, PropertyConfig } from \"@firecms/core\";\n\nexport function BlockPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {\n disabled: boolean;\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean;\n}) {\n\n const {\n values,\n setFieldValue\n } = useFormikContext<ArrayProperty>();\n\n const [propertyDialogOpen, setPropertyDialogOpen] = useState<boolean>(false);\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const onPropertyCreated = useCallback(({\n id,\n property\n }: { id?: string, property: Property }) => {\n if (!id)\n throw Error();\n setFieldValue(\"oneOf.properties\", {\n ...(values.oneOf?.properties ?? {}),\n [id]: property\n }, false);\n setFieldValue(\"oneOf.propertiesOrder\", [...(values.oneOf?.propertiesOrder ?? Object.keys(values.oneOf?.properties ?? {})), id], false);\n setPropertyDialogOpen(false);\n }, [values.oneOf?.properties, values.oneOf?.propertiesOrder]);\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.oneOf?.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n\n const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n setFieldValue(`oneOf.${idToPropertiesPath(fullId)}`, undefined, false);\n const propertiesOrderPath = `oneOf.${namespaceToPropertiesOrderPath(namespace)}`;\n const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath);\n setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);\n\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }, [setFieldValue, values]);\n\n const addChildButton = <Button\n autoFocus\n color=\"primary\"\n\n onClick={() => setPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}\n >\n Add property to {values.name ?? \"this block\"}\n </Button>;\n\n const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {\n setFieldValue(`oneOf.${namespaceToPropertiesOrderPath(namespace)}`, propertiesOrder, false);\n }, []);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <div className={\"flex justify-between items-end mt-8 mb-4\"}>\n <Typography variant={\"subtitle2\"}>Properties in this\n block</Typography>\n {addChildButton}\n </div>\n <Paper className=\"p-2 pl-8\">\n\n <PropertyTree\n properties={values.oneOf?.properties ?? {}}\n propertiesOrder={values.oneOf?.propertiesOrder}\n errors={{}}\n collectionEditable={collectionEditable}\n onPropertyClick={disabled\n ? undefined\n : (propertyKey, namespace) => {\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n setPropertyDialogOpen(true);\n }}\n onPropertyMove={disabled\n ? undefined\n : onPropertyMove}/>\n\n {!disabled && !values.oneOf?.propertiesOrder?.length &&\n <div className=\"h-full flex items-center justify-center p-4\">\n Add the first property to this block\n </div>}\n\n </Paper>\n </div>\n\n {!disabled && <PropertyFormDialog\n inArray={false}\n forceShowErrors={false}\n open={propertyDialogOpen}\n getData={getData}\n allowDataInference={allowDataInference}\n onCancel={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n onOkClicked={() => {\n setPropertyDialogOpen(false);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n }}\n collectionEditable={collectionEditable}\n onDelete={deleteProperty}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n existingProperty={Boolean(selectedPropertyKey)}\n autoUpdateId={!selectedPropertyKey}\n autoOpenTypeSelect={!selectedPropertyKey}\n onPropertyChanged={onPropertyCreated}\n existingPropertyKeys={selectedPropertyKey ? undefined : values.oneOf?.propertiesOrder}\n propertyConfigs={propertyConfigs}/>}\n\n </>);\n}\n","import React from \"react\";\n\nimport { FastField, getIn, useFormikContext } from \"formik\";\nimport { SwitchControl } from \"@firecms/core\";\nimport { DebouncedTextField } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./GeneralPropertyValidation\";\n\nexport function NumberPropertyValidation({ disabled }: {\n disabled: boolean;\n}) {\n\n const {\n values,\n handleChange\n } = useFormikContext();\n\n const validationMin = \"validation.min\";\n const validationMax = \"validation.max\";\n const validationLessThan = \"validation.lessThan\";\n const validationMoreThan = \"validation.moreThan\";\n const validationPositive = \"validation.positive\";\n const validationNegative = \"validation.negative\";\n const validationInteger = \"validation.integer\";\n\n return (\n\n <div className={\"grid grid-cols-12 gap-2\"}>\n <GeneralPropertyValidation disabled={disabled}/>\n\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMin)}\n label={\"Min value\"}\n name={validationMin}\n type=\"number\"\n size=\"small\"\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField value={getIn(values, validationMax)}\n label={\"Max value\"}\n name={validationMax}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField\n value={getIn(values, validationLessThan)}\n label={\"Less than\"}\n name={validationLessThan}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-6\"}>\n <DebouncedTextField\n value={getIn(values, validationMoreThan)}\n label={\"More than\"}\n name={validationMoreThan}\n type=\"number\"\n size=\"small\"\n\n disabled={disabled}\n onChange={handleChange}/>\n </div>\n\n <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationPositive}\n label={\"Positive value\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>\n <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationNegative}\n label={\"Negative value\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>\n <div className={\"col-span-4\"}>\n <FastField type=\"checkbox\"\n name={validationInteger}\n label={\"Integer value\"}\n disabled={disabled}\n component={SwitchControl}/>\n </div>\n </div>\n );\n}\n","import React from \"react\";\nimport { NumberPropertyValidation } from \"./validation/NumberPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { TextField } from \"@firecms/ui\";\nimport { getIn, useFormikContext } from \"formik\";\n\nexport function NumberPropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n const { values, setFieldValue } = useFormikContext();\n\n return (\n <>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <NumberPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n type={\"number\"}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : parseFloat(e.target.value));\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import React from \"react\";\nimport { Field, getIn, useFormikContext } from \"formik\";\nimport { IconForView, NumberProperty, StringProperty, useNavigationController } from \"@firecms/core\";\nimport { CircularProgress, Select, SelectGroup, SelectItem, Typography, } from \"@firecms/ui\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function ReferencePropertyField({\n existing,\n multiple,\n disabled,\n showErrors\n }: { existing: boolean, multiple: boolean, disabled: boolean, showErrors: boolean }) {\n\n const {\n values,\n handleChange,\n errors,\n } = useFormikContext<StringProperty | NumberProperty>();\n\n const navigation = useNavigationController();\n\n if (!navigation)\n return <div className={\"col-span-12\"}>\n <CircularProgress/>\n </div>;\n\n const pathPath = multiple ? \"of.path\" : \"path\";\n const pathValue: string | undefined = getIn(values, pathPath);\n const pathError: string | undefined = showErrors && getIn(errors, pathPath);\n\n return (\n <>\n <div className={\"col-span-12\"}>\n <Field required\n name={pathPath}\n pathPath={pathPath}\n type=\"select\"\n validate={validatePath}\n disabled={existing || disabled}\n value={pathValue}\n error={pathError}\n handleChange={handleChange}\n component={CollectionsSelect}/>\n\n </div>\n\n </>\n );\n}\n\nfunction validatePath(value?: string) {\n let error;\n if (!value) {\n error = \"You must specify a target collection for the field\";\n }\n return error;\n}\n\nexport function CollectionsSelect({\n disabled,\n pathPath,\n value,\n handleChange,\n error,\n ...props\n }: {\n disabled: boolean,\n pathPath: string,\n value?: string,\n handleChange: (event: any) => void,\n error?: string\n}) {\n\n const navigation = useNavigationController();\n\n if (!navigation)\n return <div className={\"col-span-12\"}>\n <CircularProgress/>\n </div>;\n\n const collections = navigation?.collections ?? [];\n\n const groups: string[] = Array.from(new Set(\n Object.values(collections).map(e => e.group).filter(Boolean) as string[]\n ).values());\n\n const ungroupedCollections = collections.filter((col) => !col.group);\n\n return (\n <>\n <Select\n error={Boolean(error)}\n disabled={disabled}\n value={value ?? \"\"}\n position={\"item-aligned\"}\n name={pathPath}\n onChange={handleChange}\n label={\"Target collection\"}\n renderValue={(selected) => {\n const selectedCollection = collections.find(collection => collection.id === selected || collection.path === selected);\n if (!selectedCollection) return null;\n return (\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={selectedCollection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {selectedCollection?.name.toUpperCase()}\n </Typography>\n </div>)\n }}\n {...props}>\n\n {groups.flatMap((group) => (\n <SelectGroup label={group || \"Views\"}\n key={`group_${group}`}>\n {\n collections.filter(collection => collection.group === group)\n .map((collection) => {\n return <SelectItem\n key={`${collection.id ?? collection.path}-${group}`}\n value={collection.id ?? collection.path}>\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={collection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {collection?.name.toUpperCase()}\n </Typography>\n </div>\n </SelectItem>;\n })\n\n }\n </SelectGroup>\n ))}\n\n {ungroupedCollections && <SelectGroup label={\"Views\"}>\n {ungroupedCollections\n .map((collection) => {\n return <SelectItem key={collection.id ?? collection.path}\n value={collection.id ?? collection.path}>\n <div className=\"flex flex-row\">\n <IconForView collectionOrView={collection}/>\n <Typography\n variant={\"subtitle2\"}\n className=\"font-medium ml-4\">\n {collection?.name.toUpperCase()}\n </Typography>\n </div>\n </SelectItem>;\n })\n\n }\n </SelectGroup>}\n\n </Select>\n\n <FieldHelperView>\n You can only edit the reference collection upon field\n creation.\n </FieldHelperView>\n </>\n );\n}\n","import React from \"react\";\nimport { getIn, useFormikContext } from \"formik\";\nimport { NumberProperty, StringProperty } from \"@firecms/core\";\nimport { Select, SelectItem } from \"@firecms/ui\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { FieldHelperView } from \"./FieldHelperView\";\n\nexport function DateTimePropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n const {\n values,\n errors,\n touched,\n setFieldValue\n } = useFormikContext<StringProperty | NumberProperty>();\n\n const modePath = \"mode\";\n const modeValue: string | undefined = getIn(values, modePath);\n const modeError: string | undefined = getIn(touched, modePath) && getIn(errors, modePath);\n\n const autoValuePath = \"autoValue\";\n const autoValueValue: string | undefined = getIn(values, autoValuePath);\n const autoValueError: string | undefined = getIn(touched, autoValuePath) && getIn(errors, autoValuePath);\n\n return (\n <>\n <div className={\"flex flex-col col-span-12\"}>\n <Select name={modePath}\n value={modeValue ?? \"date\"}\n error={Boolean(modeError)}\n onValueChange={(v) => setFieldValue(modePath, v)}\n label={\"Mode\"}\n renderValue={(v) => {\n switch (v) {\n case \"date_time\":\n return \"Date/Time\";\n case \"date\":\n return \"Date\";\n default:\n return \"\";\n }\n }}\n disabled={disabled}>\n <SelectItem value={\"date_time\"}> Date/Time </SelectItem>\n <SelectItem value={\"date\"}> Date </SelectItem>\n </Select>\n <FieldHelperView error={Boolean(modeError)}>\n {modeError}\n </FieldHelperView>\n\n <Select name={autoValuePath}\n disabled={disabled}\n value={autoValueValue ?? \"\"}\n onValueChange={(v) => setFieldValue(autoValuePath, v)}\n renderValue={(v) => {\n switch (v) {\n case \"on_create\":\n return \"On create\";\n case \"on_update\":\n return \"On any update\";\n default:\n return \"None\";\n }\n }}\n error={Boolean(autoValueError)}\n label={\"Automatic value\"}>\n <SelectItem value={\"\"}> None </SelectItem>\n <SelectItem value={\"on_create\"}> On create </SelectItem>\n <SelectItem value={\"on_update\"}> On any update </SelectItem>\n </Select>\n <FieldHelperView error={Boolean(autoValueError)}>\n {autoValueError ?? \"Update this field automatically when creating or updating the entity\"}\n </FieldHelperView>\n\n </div>\n\n <div className={\"col-span-12\"}>\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n </div>\n </>\n );\n}\n","import React from \"react\";\n\nimport { FastField, useFormikContext } from \"formik\";\nimport { SwitchControl } from \"@firecms/core\";\n\nexport function AdvancedPropertyValidation({ disabled }: {disabled: boolean}) {\n\n const { values, handleChange } = useFormikContext();\n\n const columnWidth = \"columnWidth\";\n const hideFromCollection = \"hideFromCollection\";\n const readOnly = \"readOnly\";\n\n return (\n\n <div className={\"grid grid-cols-12 gap-2\"} >\n <div className={\"col-span-12\"}>\n <FastField type=\"checkbox\"\n name={hideFromCollection}\n label={\"Hide from collection\"}\n disabled={disabled}\n tooltip={\"Hide this field from the collection view. It will still be visible in the form view\"}\n component={SwitchControl}/>\n </div>\n\n <div className={\"col-span-12\"}>\n <FastField type=\"checkbox\"\n name={readOnly}\n label={\"Read only\"}\n disabled={disabled}\n tooltip={\"Is this a read only field. Display only as a preview\"}\n component={SwitchControl}/>\n </div>\n </div>\n );\n}\n","import React from \"react\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { GeneralPropertyValidation } from \"./validation/GeneralPropertyValidation\";\n\nexport function KeyValuePropertyField({ disabled }: {\n disabled: boolean;\n}) {\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n <GeneralPropertyValidation disabled={disabled}/>\n </ValidationPanel>\n\n </div>\n </>\n );\n}\n","import {\n ArrayProperty,\n BooleanProperty,\n DateProperty,\n MapProperty,\n mergeDeep,\n NumberProperty,\n Property,\n PropertyConfig,\n StringProperty\n} from \"@firecms/core\";\n\nexport function updatePropertyFromWidget(propertyData: any,\n selectedWidgetId: string | undefined,\n propertyConfigs: Record<string, PropertyConfig>): Property {\n\n let updatedProperty;\n if (selectedWidgetId === \"text_field\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"text_field\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multiline\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"multiline\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n multiline: true,\n storage: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"markdown\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"markdown\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: true,\n email: undefined,\n url: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"url\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"url\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: true,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"email\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"email\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: true,\n url: undefined,\n enumValues: undefined\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: undefined,\n multiline: undefined,\n markdown: undefined,\n email: undefined,\n url: undefined,\n enumValues: propertyData.enumValues ?? []\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multi_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"string\",\n enumValues: propertyData.of?.enumValues ?? []\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"number_input\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"number\",\n propertyConfig: \"number_input\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n enumValues: undefined\n } satisfies NumberProperty\n );\n } else if (selectedWidgetId === \"number_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"number\",\n propertyConfig: \"number_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n enumValues: propertyData.enumValues ?? []\n } satisfies NumberProperty\n );\n } else if (selectedWidgetId === \"multi_number_select\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_number_select\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"number\",\n enumValues: propertyData.of?.enumValues ?? []\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"file_upload\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"string\",\n propertyConfig: \"file_upload\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n storage: {\n storagePath: \"/\"\n }\n } satisfies StringProperty\n );\n } else if (selectedWidgetId === \"multi_file_upload\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_file_upload\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"string\",\n storage: propertyData.of?.storage ?? {\n storagePath: \"/\"\n }\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"group\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"map\",\n propertyConfig: \"group\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n keyValue: false,\n properties: propertyData.properties ?? {}\n } satisfies MapProperty\n );\n } else if (selectedWidgetId === \"key_value\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"map\",\n propertyConfig: \"key_value\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n keyValue: true,\n properties: undefined\n } satisfies MapProperty\n );\n } else if (selectedWidgetId === \"reference\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"reference\",\n propertyConfig: \"reference\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies Property\n );\n } else if (selectedWidgetId === \"multi_references\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"multi_references\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n of: {\n dataType: \"reference\"\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"switch\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"boolean\",\n propertyConfig: \"switch\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies BooleanProperty\n );\n } else if (selectedWidgetId === \"date_time\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"date\",\n propertyConfig: \"date_time\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n mode: \"date_time\"\n } satisfies DateProperty\n );\n } else if (selectedWidgetId === \"repeat\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"repeat\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId === \"block\") {\n updatedProperty = mergeDeep(\n propertyData,\n {\n dataType: \"array\",\n propertyConfig: \"block\",\n editable: propertyData.editable !== undefined ? propertyData.editable : true,\n oneOf: {\n properties: {}\n }\n } satisfies ArrayProperty\n );\n } else if (selectedWidgetId && propertyConfigs[selectedWidgetId]) {\n updatedProperty = {\n ...propertyConfigs[selectedWidgetId].property,\n propertyConfig: selectedWidgetId\n };\n }\n\n return updatedProperty;\n}\n","import { PropertyConfigBadge, PropertyConfig } from \"@firecms/core\";\nimport { cn, SelectItem, Typography } from \"@firecms/ui\";\n\nexport interface PropertySelectItemProps {\n value: string;\n optionDisabled: boolean;\n propertyConfig: PropertyConfig;\n existing: boolean;\n}\n\nexport function PropertySelectItem({ value, optionDisabled, propertyConfig, existing }: PropertySelectItemProps) {\n return <SelectItem value={value}\n disabled={optionDisabled}\n className={\"flex flex-row items-center\"}>\n <div\n className={cn(\n \"flex flex-row items-center text-base min-h-[52px]\",\n optionDisabled ? \"w-full\" : \"\")}>\n <div className={\"mr-8\"}>\n <PropertyConfigBadge propertyConfig={propertyConfig}/>\n </div>\n <div>\n <div>{propertyConfig.name}</div>\n <Typography variant={\"caption\"}\n color={\"disabled\"}\n className={\"max-w-sm\"}>\n {existing && optionDisabled ? \"You can only switch to widgets that use the same data type\" : propertyConfig.description}\n </Typography>\n </div>\n </div>\n </SelectItem>\n}\n","import React from \"react\";\nimport { StringPropertyValidation } from \"./validation/StringPropertyValidation\";\nimport { ValidationPanel } from \"./validation/ValidationPanel\";\nimport { getIn, useFormikContext } from \"formik\";\n\nimport { Select, SelectItem, TextField } from \"@firecms/ui\";\n\nexport function UrlPropertyField({\n disabled,\n showErrors\n }: {\n disabled: boolean;\n showErrors: boolean;\n}) {\n\n const { values, setFieldValue } = useFormikContext();\n\n const urlValue = getIn(values, \"url\");\n\n return (\n <>\n <div className={\"col-span-12\"}>\n\n <Select\n disabled={disabled}\n position={\"item-aligned\"}\n onValueChange={(value: string) => {\n if (value === \"[NONE]\")\n setFieldValue(\"url\", true);\n else\n setFieldValue(\"url\", value);\n }}\n label={\"Preview type\"}\n renderValue={(value: string) => {\n switch (value) {\n case \"image\":\n return \"Image\";\n case \"video\":\n return \"Video\";\n case \"audio\":\n return \"Audio\";\n default:\n return \"Display URL\";\n }\n }}\n value={urlValue ?? \"[NONE]\"}>\n <SelectItem value={\"[NONE]\"}>\n Display URL\n </SelectItem>\n <SelectItem value={\"image\"}>\n Image\n </SelectItem>\n <SelectItem value={\"video\"}>\n Video\n </SelectItem>\n <SelectItem value={\"audio\"}>\n Audio\n </SelectItem>\n </Select>\n </div>\n\n <div className={\"col-span-12\"}>\n\n <ValidationPanel>\n\n <StringPropertyValidation disabled={disabled}\n max={true}\n min={true}\n trim={true}\n showErrors={showErrors}/>\n\n </ValidationPanel>\n\n </div>\n\n <div className={\"col-span-12\"}>\n\n <TextField name={\"defaultValue\"}\n disabled={disabled}\n onChange={(e: any) => {\n setFieldValue(\"defaultValue\", e.target.value === \"\" ? undefined : e.target.value);\n }}\n label={\"Default value\"}\n value={getIn(values, \"defaultValue\") ?? \"\"}/>\n\n </div>\n </>\n );\n}\n","import { DEFAULT_FIELD_CONFIGS, FieldConfigId, PropertyConfig } from \"@firecms/core\";\n\nexport const supportedFieldsIds: FieldConfigId[] = [\n \"text_field\",\n \"multiline\",\n \"markdown\",\n \"url\",\n \"email\",\n \"select\",\n \"multi_select\",\n \"number_input\",\n \"number_select\",\n \"multi_number_select\",\n \"file_upload\",\n \"multi_file_upload\",\n \"reference\",\n \"multi_references\",\n \"switch\",\n \"date_time\",\n \"group\",\n \"key_value\",\n \"repeat\",\n \"block\"\n];\n\nexport const supportedFields: Record<string, PropertyConfig> = Object.entries(DEFAULT_FIELD_CONFIGS)\n .filter(([id]) => supportedFieldsIds.includes(id as FieldConfigId))\n .map(([id, config]) => ({ [id]: config }))\n .reduce((a, b) => ({ ...a, ...b }), {});\n","import React, { useDeferredValue, useEffect, useRef, useState } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport { Formik, FormikErrors, FormikProps, getIn } from \"formik\";\nimport {\n DEFAULT_FIELD_CONFIGS,\n DeleteConfirmationDialog,\n PropertyConfigBadge,\n FieldConfigId,\n getFieldConfig,\n getFieldId,\n isPropertyBuilder,\n mergeDeep,\n Property,\n PropertyConfig,\n} from \"@firecms/core\";\nimport {\n Button,\n cn,\n DeleteIcon,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n InfoLabel,\n Select,\n Typography\n} from \"@firecms/ui\";\nimport { EnumPropertyField } from \"./properties/EnumPropertyField\";\nimport { StoragePropertyField } from \"./properties/StoragePropertyField\";\nimport { MapPropertyField } from \"./properties/MapPropertyField\";\nimport { RepeatPropertyField } from \"./properties/RepeatPropertyField\";\nimport { CommonPropertyFields } from \"./properties/CommonPropertyFields\";\nimport { StringPropertyField } from \"./properties/StringPropertyField\";\nimport { BooleanPropertyField } from \"./properties/BooleanPropertyField\";\nimport { BlockPropertyField } from \"./properties/BlockPropertyField\";\nimport { NumberPropertyField } from \"./properties/NumberPropertyField\";\nimport { ReferencePropertyField } from \"./properties/ReferencePropertyField\";\nimport { DateTimePropertyField } from \"./properties/DateTimePropertyField\";\nimport { AdvancedPropertyValidation } from \"./properties/advanced/AdvancedPropertyValidation\";\nimport { editableProperty } from \"../../utils/entities\";\nimport { KeyValuePropertyField } from \"./properties/KeyValuePropertyField\";\nimport { updatePropertyFromWidget } from \"./utils/update_property_for_widget\";\nimport { PropertySelectItem } from \"./PropertySelectItem\";\nimport { UrlPropertyField } from \"./properties/UrlPropertyField\";\nimport { supportedFields } from \"./utils/supported_fields\";\n\nexport type PropertyWithId = Property & {\n id?: string\n};\n\nexport type OnPropertyChangedParams = {\n id?: string,\n property: Property,\n namespace?: string,\n previousId?: string\n};\n\nexport type PropertyFormProps = {\n includeIdAndName?: boolean;\n existingProperty: boolean;\n autoUpdateId?: boolean;\n autoOpenTypeSelect: boolean;\n inArray: boolean;\n propertyKey?: string;\n propertyNamespace?: string;\n property?: Property;\n onPropertyChanged?: (params: OnPropertyChangedParams) => void;\n onPropertyChangedImmediate?: boolean;\n onDelete?: (id?: string, namespace?: string) => void;\n onError?: (id: string, namespace?: string, error?: FormikErrors<any>) => void;\n initialErrors?: FormikErrors<any>;\n forceShowErrors?: boolean;\n existingPropertyKeys?: string[];\n allowDataInference: boolean;\n getData?: () => Promise<object[]>;\n getHelpers?: (formikProps: FormikProps<PropertyWithId>) => void;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n};\n\nexport const PropertyForm = React.memo(\n function PropertyForm({\n includeIdAndName = true,\n autoOpenTypeSelect,\n existingProperty,\n autoUpdateId,\n inArray,\n propertyKey,\n propertyNamespace,\n property,\n onPropertyChanged,\n onPropertyChangedImmediate = true,\n onDelete,\n onError,\n initialErrors,\n forceShowErrors,\n existingPropertyKeys,\n allowDataInference,\n getHelpers,\n getData,\n propertyConfigs,\n collectionEditable\n }: PropertyFormProps) {\n\n const initialValue: PropertyWithId = {\n id: \"\",\n name: \"\"\n } as PropertyWithId;\n\n const disabled = (Boolean(property && !editableProperty(property)) && !collectionEditable);\n\n const lastSubmittedProperty = useRef<OnPropertyChangedParams | undefined>(property ? {\n id: propertyKey,\n previousId: propertyKey,\n property\n } : undefined);\n\n const doOnPropertyChanged = ({\n id,\n property\n }: OnPropertyChangedParams) => {\n const params = {\n id,\n previousId: lastSubmittedProperty.current?.id,\n property,\n namespace: propertyNamespace\n };\n lastSubmittedProperty.current = params;\n onPropertyChanged?.(params);\n };\n\n return <Formik\n key={`property_view_${propertyKey}`}\n initialErrors={initialErrors}\n initialValues={property\n ? { id: propertyKey, ...property } as PropertyWithId\n : initialValue}\n onSubmit={(newPropertyWithId: PropertyWithId, helpers) => {\n console.debug(\"onSubmit\", newPropertyWithId);\n const {\n id,\n ...property\n } = newPropertyWithId;\n doOnPropertyChanged({\n id,\n property: { ...property, editable: property.editable ?? true }\n });\n if (!existingProperty)\n helpers.resetForm({ values: initialValue });\n }}\n // validate={(values) => {\n // console.log(\"validate property\", values)\n // const errors: any = {};\n // if (!values?.dataType || !getFieldConfig(values)) {\n // errors.selectedWidget = \"Required\";\n // }\n // if (existingPropertyKeys && values?.id && existingPropertyKeys.includes(values?.id)) {\n // errors.id = \"\";\n // }\n // console.log(\"errors\", errors)\n // return errors;\n // }}\n >\n {(props) => {\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n getHelpers?.(props);\n }, [props]);\n\n return <PropertyEditView\n onPropertyChanged={onPropertyChangedImmediate\n ? doOnPropertyChanged\n : undefined}\n onDelete={onDelete}\n includeIdAndTitle={includeIdAndName}\n propertyNamespace={propertyNamespace}\n onError={onError}\n showErrors={forceShowErrors || props.submitCount > 0}\n existing={existingProperty}\n autoUpdateId={autoUpdateId}\n inArray={inArray}\n autoOpenTypeSelect={autoOpenTypeSelect}\n existingPropertyKeys={existingPropertyKeys}\n disabled={disabled}\n getData={getData}\n allowDataInference={allowDataInference}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n {...props}/>;\n\n }}\n\n </Formik>\n }, (a, b) =>\n a.getData === b.getData &&\n a.includeIdAndName === b.includeIdAndName &&\n a.autoOpenTypeSelect === b.autoOpenTypeSelect &&\n a.autoUpdateId === b.autoUpdateId &&\n a.existingProperty === b.existingProperty\n);\n\nexport function PropertyFormDialog({\n open,\n onCancel,\n onOkClicked,\n onPropertyChanged,\n getData,\n collectionEditable,\n ...formProps\n }: PropertyFormProps & {\n open?: boolean;\n onOkClicked?: () => void;\n onCancel?: () => void;\n}) {\n const helpersRef = useRef<FormikProps<PropertyWithId>>();\n const getHelpers = (helpers: FormikProps<PropertyWithId>) => {\n helpersRef.current = helpers;\n };\n\n return <Dialog\n open={open ?? false}\n maxWidth={\"xl\"}\n fullWidth={true}\n >\n\n <DialogContent>\n <PropertyForm {...formProps}\n onPropertyChanged={(params) => {\n onPropertyChanged?.(params);\n onOkClicked?.();\n }}\n collectionEditable={collectionEditable}\n onPropertyChangedImmediate={false}\n getHelpers={getHelpers}\n getData={getData}\n />\n </DialogContent>\n\n <DialogActions>\n\n {onCancel && <Button\n variant={\"text\"}\n onClick={() => {\n onCancel();\n helpersRef.current?.resetForm();\n }}>\n Cancel\n </Button>}\n\n <Button variant=\"outlined\"\n color=\"primary\"\n onClick={() => helpersRef.current?.submitForm()}>\n Ok\n </Button>\n </DialogActions>\n </Dialog>;\n\n}\n\nfunction PropertyEditView({\n values,\n errors,\n touched,\n setValues,\n setFieldValue,\n existing,\n autoUpdateId = false,\n autoOpenTypeSelect,\n includeIdAndTitle,\n onPropertyChanged,\n onDelete,\n propertyNamespace,\n onError,\n showErrors,\n disabled,\n inArray,\n existingPropertyKeys,\n getData,\n allowDataInference,\n propertyConfigs,\n collectionEditable\n }: {\n includeIdAndTitle?: boolean;\n existing: boolean;\n autoUpdateId?: boolean;\n autoOpenTypeSelect: boolean;\n propertyNamespace?: string;\n onPropertyChanged?: (params: OnPropertyChangedParams) => void;\n onDelete?: (id?: string, namespace?: string) => void;\n onError?: (id: string, namespace?: string, error?: FormikErrors<any>) => void;\n showErrors: boolean;\n inArray: boolean;\n disabled: boolean;\n existingPropertyKeys?: string[];\n getData?: () => Promise<object[]>;\n allowDataInference: boolean;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n} & FormikProps<PropertyWithId>) {\n\n const [selectOpen, setSelectOpen] = useState(autoOpenTypeSelect);\n const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);\n const [selectedFieldConfigId, setSelectedFieldConfigId] = useState<string | undefined>(values?.dataType ? getFieldId(values) : undefined);\n\n const allSupportedFields = Object.entries(supportedFields).concat(Object.entries(propertyConfigs));\n\n const displayedWidgets = inArray\n ? allSupportedFields.filter(([_, propertyConfig]) => !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.dataType !== \"array\")\n : allSupportedFields;\n\n const deferredValues = useDeferredValue(values);\n const nameFieldRef = useRef<HTMLInputElement>(null);\n\n const lastSubmittedProperty = useRef<object>(values);\n\n const selectedWidgetError = showErrors && getIn(errors, \"selectedWidget\");\n\n useEffect(() => {\n if (onPropertyChanged) {\n if ((!includeIdAndTitle || deferredValues.id)) {\n const {\n id,\n ...property\n } = deferredValues;\n if (!equal(deferredValues, lastSubmittedProperty.current)) {\n onPropertyChanged({\n id,\n property,\n namespace: propertyNamespace\n });\n lastSubmittedProperty.current = deferredValues;\n }\n }\n }\n }, [deferredValues, includeIdAndTitle, onPropertyChanged, propertyNamespace]);\n\n useEffect(() => {\n if (values?.id && onError && Object.keys(errors).length > 0) {\n onError(values?.id, propertyNamespace, errors);\n }\n }, [errors, onError, propertyNamespace, values?.id]);\n\n const onWidgetSelectChanged = (newSelectedWidgetId: FieldConfigId) => {\n setSelectedFieldConfigId(newSelectedWidgetId);\n setValues(updatePropertyFromWidget(values, newSelectedWidgetId, propertyConfigs));\n // Ugly hack to autofocus the name field\n setTimeout(() => {\n nameFieldRef.current?.focus();\n }, 0);\n };\n\n let childComponent;\n if (selectedFieldConfigId === \"text_field\" ||\n selectedFieldConfigId === \"multiline\" ||\n selectedFieldConfigId === \"markdown\" ||\n selectedFieldConfigId === \"email\") {\n childComponent =\n <StringPropertyField widgetId={selectedFieldConfigId}\n disabled={disabled}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"url\") {\n childComponent =\n <UrlPropertyField disabled={disabled}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"select\" ||\n selectedFieldConfigId === \"number_select\") {\n childComponent = <EnumPropertyField\n multiselect={false}\n allowDataInference={allowDataInference}\n updateIds={!existing}\n disabled={disabled}\n getData={getData}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"multi_select\" ||\n selectedFieldConfigId === \"multi_number_select\") {\n childComponent = <EnumPropertyField\n multiselect={true}\n updateIds={!existing}\n disabled={disabled}\n allowDataInference={allowDataInference}\n getData={getData}\n showErrors={showErrors}/>;\n } else if (selectedFieldConfigId === \"file_upload\") {\n childComponent =\n <StoragePropertyField existing={existing}\n multiple={false}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"multi_file_upload\") {\n childComponent =\n <StoragePropertyField existing={existing}\n multiple={true}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"switch\") {\n childComponent = <BooleanPropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"number_input\") {\n childComponent = <NumberPropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"group\") {\n childComponent =\n <MapPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"block\") {\n childComponent =\n <BlockPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"reference\") {\n childComponent =\n <ReferencePropertyField showErrors={showErrors}\n existing={existing}\n multiple={false}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"date_time\") {\n childComponent = <DateTimePropertyField disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"multi_references\") {\n childComponent =\n <ReferencePropertyField showErrors={showErrors}\n existing={existing}\n multiple={true}\n disabled={disabled}/>;\n } else if (selectedFieldConfigId === \"repeat\") {\n childComponent =\n <RepeatPropertyField showErrors={showErrors}\n existing={existing}\n getData={getData}\n allowDataInference={allowDataInference}\n disabled={disabled}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>;\n } else if (selectedFieldConfigId === \"key_value\") {\n childComponent =\n <KeyValuePropertyField disabled={disabled}/>;\n } else {\n childComponent = null;\n }\n\n return (\n <>\n {disabled && <InfoLabel mode={\"warn\"}>\n <Typography>This property can&apos;t be edited</Typography>\n <Typography variant={\"caption\"}>\n You may not have permission to\n edit it or it is defined in code with no <code>editable</code> flag\n </Typography>\n </InfoLabel>}\n\n <div className=\"flex mt-2 justify-between\">\n <div className={\"w-full flex flex-col gap-2\"}>\n <Select\n // className={\"w-full\"}\n error={Boolean(selectedWidgetError)}\n value={selectedFieldConfigId ?? \"\"}\n placeholder={\"Select a property widget\"}\n open={selectOpen}\n onOpenChange={setSelectOpen}\n position={\"item-aligned\"}\n disabled={disabled}\n renderValue={(value) => {\n if (!value) {\n return <em>Select a property\n widget</em>;\n }\n const key = value as FieldConfigId;\n const propertyConfig = DEFAULT_FIELD_CONFIGS[key] ?? propertyConfigs[key];\n const baseProperty = propertyConfig.property;\n const baseFieldConfig = baseProperty && !isPropertyBuilder(baseProperty) ? getFieldConfig(baseProperty, propertyConfigs) : undefined;\n const optionDisabled = isPropertyBuilder(baseProperty) || (existing && baseProperty.dataType !== values?.dataType);\n const computedFieldConfig = baseFieldConfig ? mergeDeep(baseFieldConfig, propertyConfig) : propertyConfig;\n return <div\n onClick={(e) => {\n if (optionDisabled) {\n e.stopPropagation();\n e.preventDefault();\n }\n }}\n className={cn(\n \"flex items-center\",\n optionDisabled ? \"w-full pointer-events-none opacity-50\" : \"\")}>\n <div className={\"mr-8\"}>\n <PropertyConfigBadge propertyConfig={computedFieldConfig}/>\n </div>\n <div className={\"flex flex-col items-start text-base text-left\"}>\n <div>{computedFieldConfig.name}</div>\n <Typography variant={\"caption\"}\n color={\"disabled\"}>\n {optionDisabled ? \"You can only switch to widgets that use the same data type\" : computedFieldConfig.description}\n </Typography>\n </div>\n </div>\n }}\n onValueChange={(value) => {\n onWidgetSelectChanged(value as FieldConfigId);\n }}>\n {displayedWidgets.map(([key, propertyConfig]) => {\n const baseProperty = propertyConfig.property;\n const optionDisabled = existing && !isPropertyBuilder(baseProperty) && baseProperty.dataType !== values?.dataType;\n return <PropertySelectItem\n key={key}\n value={key}\n optionDisabled={optionDisabled}\n propertyConfig={propertyConfig}\n existing={existing}/>;\n })}\n </Select>\n\n {selectedWidgetError &&\n <Typography variant=\"caption\"\n className={\"ml-3.5\"}\n color={\"error\"}>Required</Typography>}\n\n {/*<Typography variant=\"caption\" className={\"ml-3.5\"}>Define your own custom properties and*/}\n {/* components</Typography>*/}\n\n </div>\n\n {onDelete && values?.id &&\n <IconButton\n variant={\"ghost\"}\n className=\"m-4\"\n disabled={disabled}\n onClick={() => setDeleteDialogOpen(true)}>\n <DeleteIcon/>\n </IconButton>}\n </div>\n\n <div className={\"grid grid-cols-12 gap-y-12 mt-8 mb-8\"}>\n {includeIdAndTitle &&\n <CommonPropertyFields showErrors={showErrors}\n disabledId={existing}\n isNewProperty={!existing}\n existingPropertyKeys={existingPropertyKeys}\n disabled={disabled}\n autoUpdateId={autoUpdateId}\n ref={nameFieldRef}/>}\n\n {childComponent}\n\n <div className={\"col-span-12\"}>\n <AdvancedPropertyValidation disabled={disabled}/>\n </div>\n </div>\n\n {onDelete &&\n <DeleteConfirmationDialog open={deleteDialogOpen}\n onAccept={() => onDelete(values?.id, propertyNamespace)}\n onCancel={() => setDeleteDialogOpen(false)}\n title={<div>Delete this property?</div>}\n body={\n <div> This will <b>not delete any\n data</b>, only modify the\n collection.</div>\n }/>}\n\n </>\n );\n}\n","export function camelCase(str: string): string {\n return (str.slice(0, 1).toLowerCase() + str.slice(1))\n .replace(/([-_ ]){1,}/g, ' ')\n .split(/[-_ ]/)\n .reduce((cur, acc) => {\n return cur + acc[0].toUpperCase() + acc.substring(1);\n }, \"\");\n}\n","import { EntityCollection, useSnackbarController } from \"@firecms/core\";\nimport { Button, ContentCopyIcon, Dialog, DialogActions, DialogContent, Typography, } from \"@firecms/ui\";\nimport React from \"react\";\nimport JSON5 from \"json5\";\nimport { Highlight, themes } from \"prism-react-renderer\"\nimport { camelCase } from \"./utils/strings\";\n\nexport function GetCodeDialog({ collection, onOpenChange, open }: { onOpenChange: (open: boolean) => void, collection: any, open: any }) {\n\n const snackbarController = useSnackbarController();\n\n const code = \"import { EntityCollection } from \\\"firecms\\\";\\n\\nconst \" + camelCase(collection.name) + \"Collection:EntityCollection = \" + JSON5.stringify(collectionToCode(collection), null, \"\\t\");\n return <Dialog open={open}\n onOpenChange={onOpenChange}\n maxWidth={\"4xl\"}>\n <DialogContent>\n <Typography variant={\"h6\"} className={\"my-4\"}>\n Code for {collection.name}\n </Typography>\n <Typography variant={\"body2\"} className={\"my-4 mb-8\"}>\n If you want to customise the collection in code, you can add this collection code to your CMS\n app configuration.\n More info in the <a\n rel=\"noopener noreferrer\"\n href={\"https://firecms.co/docs/customization_quickstart\"}>docs</a>.\n </Typography>\n <Highlight\n theme={themes.vsDark}\n code={code}\n language=\"typescript\"\n >\n {({ className, style, tokens, getLineProps, getTokenProps }) => (\n <pre style={style} className={\"p-4 rounded text-sm\"}>\n {tokens.map((line, i) => (\n <div key={i} {...getLineProps({ line })}>\n {line.map((token, key) => (\n <span key={key} {...getTokenProps({ token })} />\n ))}\n </div>\n ))}\n </pre>\n )}\n </Highlight>\n\n </DialogContent>\n <DialogActions>\n <Button\n variant={\"text\"}\n size={\"small\"}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n snackbarController.open({\n type: \"success\",\n message: `Copied`\n })\n return navigator.clipboard.writeText(code);\n }}>\n <ContentCopyIcon size={\"small\"}/>\n Copy to clipboard\n </Button>\n <Button onClick={() => onOpenChange(false)}>Close</Button>\n </DialogActions>\n </Dialog>;\n}\n\nfunction collectionToCode(collection: EntityCollection): object {\n\n const propertyCleanup = (property: any) => {\n\n const updatedProperty = {\n ...property\n };\n\n delete updatedProperty.fromBuilder;\n delete updatedProperty.resolved;\n delete updatedProperty.propertiesOrder;\n delete updatedProperty.editable;\n\n if (updatedProperty.type === \"map\") {\n return {\n ...updatedProperty,\n properties: updatedProperty.properties.map(propertyCleanup)\n }\n }\n return updatedProperty;\n }\n\n return {\n id: collection.id,\n name: collection.name,\n singularName: collection.singularName,\n path: collection.path,\n description: collection.description,\n editable: true,\n collectionGroup: collection.collectionGroup,\n icon: collection.icon,\n group: collection.group,\n customId: collection.customId,\n initialFilter: collection.initialFilter,\n initialSort: collection.initialSort,\n properties: Object.entries(collection.properties)\n .map(([key, value]) => ({\n [key]: propertyCleanup(value)\n }))\n .reduce((a, b) => ({ ...a, ...b }), {}),\n subcollections: (collection.subcollections ?? []).map(collectionToCode)\n }\n\n}\n","import React, { useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { Field, FormikErrors, getIn, useFormikContext } from \"formik\";\nimport {\n EntityCollection,\n ErrorBoundary,\n isPropertyBuilder,\n makePropertiesEditable,\n Properties,\n Property,\n PropertyConfig,\n PropertyOrBuilder,\n useLargeLayout,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport {\n AddIcon,\n AutoAwesomeIcon,\n Button,\n CircularProgress,\n cn,\n CodeIcon,\n DebouncedTextField,\n defaultBorderMixin,\n IconButton,\n Paper,\n Tooltip,\n Typography,\n} from \"@firecms/ui\";\n\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"./util\";\nimport { OnPropertyChangedParams, PropertyForm, PropertyFormDialog } from \"./PropertyEditView\";\nimport { PropertyTree } from \"./PropertyTree\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\nimport { GetCodeDialog } from \"./GetCodeDialog\";\n\ntype CollectionEditorFormProps = {\n showErrors: boolean;\n isNewCollection: boolean;\n propertyErrorsRef?: React.MutableRefObject<any>;\n onPropertyError: (propertyKey: string, namespace: string | undefined, error?: FormikErrors<any>) => void;\n setDirty?: (dirty: boolean) => void;\n reservedGroups?: string[];\n extraIcon: React.ReactNode;\n getUser: (uid: string) => User | null;\n getData?: () => Promise<object[]>;\n doCollectionInference: (collection: PersistedCollection) => Promise<Partial<EntityCollection> | null> | undefined;\n propertyConfigs: Record<string, PropertyConfig>;\n collectionEditable: boolean;\n};\n\nexport function CollectionPropertiesEditorForm({\n showErrors,\n isNewCollection,\n propertyErrorsRef,\n onPropertyError,\n setDirty,\n reservedGroups,\n extraIcon,\n getUser,\n getData,\n doCollectionInference,\n propertyConfigs,\n collectionEditable\n }: CollectionEditorFormProps) {\n\n const {\n values,\n setFieldValue,\n setFieldError,\n setFieldTouched,\n errors,\n dirty\n } = useFormikContext<PersistedCollection>();\n\n const snackbarController = useSnackbarController();\n\n const largeLayout = useLargeLayout();\n const asDialog = !largeLayout\n\n // index of the selected property within the namespace\n const [selectedPropertyIndex, setSelectedPropertyIndex] = useState<number | undefined>();\n const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();\n const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();\n\n const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;\n const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(\".\", \".properties.\")) : undefined;\n const [codeDialogOpen, setCodeDialogOpen] = useState<boolean>(false);\n\n const [inferringProperties, setInferringProperties] = useState<boolean>(false);\n\n const [newPropertyDialogOpen, setNewPropertyDialogOpen] = useState<boolean>(false);\n const [inferredPropertyKeys, setInferredPropertyKeys] = useState<string[]>([]);\n\n const currentPropertiesOrderRef = React.useRef<{\n [key: string]: string[]\n }>(values.propertiesOrder ? { \"\": values.propertiesOrder } : {});\n\n useEffect(() => {\n if (setDirty)\n setDirty(dirty);\n }, [dirty]);\n\n const inferPropertiesFromData = doCollectionInference\n ? (): void => {\n if (!doCollectionInference)\n return;\n\n setInferringProperties(true);\n // @ts-ignore\n doCollectionInference(values)\n .then((newCollection) => {\n\n if (newCollection)\n makePropertiesEditable(newCollection.properties as Properties);\n\n if (!newCollection) {\n snackbarController.open({\n type: \"error\",\n message: \"Could not infer properties from data\"\n });\n return;\n }\n // find properties in the new collection, not present in the current one\n const newPropertyKeys = (newCollection.properties ? Object.keys(newCollection.properties) : [])\n .filter((propertyKey) => !values.properties[propertyKey]);\n if (newPropertyKeys.length === 0) {\n snackbarController.open({\n type: \"info\",\n message: \"No new properties found in existing data\"\n });\n return;\n }\n // add them to the current collection\n const updatedProperties = {\n ...newPropertyKeys.reduce((acc, propertyKey) => {\n acc[propertyKey] = (newCollection.properties ?? {})[propertyKey];\n return acc;\n }, {} as { [key: string]: PropertyOrBuilder }),\n ...values.properties\n };\n const updatedPropertiesOrder = [\n ...newPropertyKeys,\n ...(values.propertiesOrder ?? [])\n ];\n setFieldValue(\"properties\", updatedProperties, false);\n\n updatePropertiesOrder(updatedPropertiesOrder);\n\n setInferredPropertyKeys(newPropertyKeys);\n })\n .finally(() => {\n setInferringProperties(false);\n })\n }\n : undefined;\n\n const getCurrentPropertiesOrder = (namespace?: string) => {\n if (!namespace) return currentPropertiesOrderRef.current[\"\"];\n return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));\n }\n\n const updatePropertiesOrder = (newPropertiesOrder: string[], namespace?: string) => {\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n setFieldValue(propertiesOrderPath, newPropertiesOrder, false);\n currentPropertiesOrderRef.current[namespace ?? \"\"] = newPropertiesOrder;\n\n };\n\n const deleteProperty = (propertyKey?: string, namespace?: string) => {\n const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;\n if (!fullId)\n throw Error(\"collection editor miss config\");\n\n setFieldValue(idToPropertiesPath(fullId), undefined, false);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n const newPropertiesOrder = currentPropertiesOrder.filter((p) => p !== propertyKey);\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n setNewPropertyDialogOpen(false);\n\n setSelectedPropertyIndex(undefined);\n setSelectedPropertyKey(undefined);\n setSelectedPropertyNamespace(undefined);\n };\n\n const onPropertyMove = (propertiesOrder: string[], namespace?: string) => {\n setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);\n };\n\n const onPropertyCreated = ({\n id,\n property\n }: {\n id?: string,\n property: Property\n }) => {\n if (!id) {\n throw Error(\"Need to include an ID when creating a new property\")\n }\n setFieldValue(\"properties\", {\n ...(values.properties ?? {}),\n [id]: property\n }, false);\n const newPropertiesOrder = [...(values.propertiesOrder ?? Object.keys(values.properties)), id];\n\n updatePropertiesOrder(newPropertiesOrder);\n\n setNewPropertyDialogOpen(false);\n if (largeLayout) {\n setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n setSelectedPropertyKey(id);\n }\n setSelectedPropertyNamespace(undefined);\n };\n\n const onPropertyChanged = ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => {\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // If the id has changed we need to a little cleanup\n if (previousId && previousId !== id) {\n const previousFullId = getFullId(previousId, namespace);\n const previousPropertyPath = idToPropertiesPath(previousFullId);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n\n // replace previousId with id in propertiesOrder\n const newPropertiesOrder = currentPropertiesOrder\n .map((p) => p === previousId ? id : p)\n .filter((p) => p !== undefined) as string[];\n\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n if (id) {\n setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n setSelectedPropertyKey(id);\n }\n setFieldValue(previousPropertyPath, undefined, false);\n setFieldTouched(previousPropertyPath, false, false);\n }\n\n console.debug(\"onPropertyChanged\", {\n id,\n property,\n previousId,\n namespace,\n propertyPath\n })\n\n if (propertyPath) {\n setFieldValue(propertyPath, property, false);\n setFieldTouched(propertyPath, true, false);\n }\n\n };\n\n const onPropertyErrorInternal = useCallback((id: string, namespace?: string, error?: FormikErrors<any>) => {\n const propertyPath = id ? getFullId(id, namespace) : undefined;\n console.warn(\"onPropertyErrorInternal\", {\n id,\n namespace,\n error,\n propertyPath\n });\n if (propertyPath) {\n const hasError = error && Object.keys(error).length > 0;\n onPropertyError(id, namespace, hasError ? error : undefined);\n setFieldError(idToPropertiesPath(propertyPath), hasError ? \"Property error\" : undefined);\n }\n }, [])\n\n const closePropertyDialog = () => {\n setSelectedPropertyIndex(undefined);\n setSelectedPropertyKey(undefined);\n };\n\n const initialErrors = selectedPropertyKey && propertyErrorsRef?.current?.properties ? propertyErrorsRef.current.properties[selectedPropertyKey] : undefined;\n\n const emptyCollection = values?.propertiesOrder === undefined || values.propertiesOrder.length === 0;\n\n const usedPropertiesOrder = (values.propertiesOrder\n ? values.propertiesOrder\n : Object.keys(values.properties)) as string[];\n\n const owner = useMemo(() => getUser(values.ownerId), [getUser, values.ownerId]);\n const body = (\n <div className={\"grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900\"}>\n <div className={cn(\n \"p-4 md:p-8 pb-20 md:pb-20\",\n \"col-span-12 lg:col-span-5 h-full overflow-auto\",\n !asDialog && \"border-r \" + defaultBorderMixin\n )}>\n\n <div className=\"flex my-2\">\n\n <div className=\"flex-grow mb-4\">\n\n <Field\n name={\"name\"}\n as={DebouncedTextField}\n invisible={true}\n className=\"-ml-1\"\n inputClassName=\"text-2xl font-headers\"\n placeholder={\"Collection name\"}\n size={\"small\"}\n required\n error={Boolean(errors?.name)}/>\n\n {owner &&\n <Typography variant={\"body2\"}\n className={\"ml-2\"}\n color={\"secondary\"}>\n Created by {owner.displayName}\n </Typography>}\n </div>\n\n {extraIcon && <div className=\"ml-4\">\n {extraIcon}\n </div>}\n\n <div className=\"ml-1 mt-2 flex flex-row gap-2\">\n <Tooltip title={\"Get the code for this collection\"}>\n <IconButton\n variant={\"filled\"}\n disabled={inferringProperties}\n onClick={() => setCodeDialogOpen(true)}>\n <CodeIcon/>\n </IconButton>\n </Tooltip>\n {inferPropertiesFromData && <Tooltip title={\"Add new properties based on data\"}>\n <IconButton\n variant={\"filled\"}\n disabled={inferringProperties}\n onClick={inferPropertiesFromData}>\n {inferringProperties ? <CircularProgress size={\"small\"}/> : <AutoAwesomeIcon/>}\n </IconButton>\n </Tooltip>}\n <Tooltip title={\"Add new property\"}>\n <Button\n variant={\"outlined\"}\n onClick={() => setNewPropertyDialogOpen(true)}>\n <AddIcon/>\n </Button>\n </Tooltip>\n </div>\n </div>\n\n <ErrorBoundary>\n <PropertyTree\n className={\"pl-8\"}\n onPropertyClick={(propertyKey, namespace) => {\n setSelectedPropertyIndex(usedPropertiesOrder.indexOf(propertyKey));\n setSelectedPropertyKey(propertyKey);\n setSelectedPropertyNamespace(namespace);\n }}\n inferredPropertyKeys={inferredPropertyKeys}\n selectedPropertyKey={selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined}\n properties={values.properties}\n additionalFields={values.additionalFields}\n propertiesOrder={usedPropertiesOrder}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={isNewCollection ? deleteProperty : undefined}\n collectionEditable={collectionEditable}\n errors={showErrors ? errors : {}}/>\n </ErrorBoundary>\n\n <Button className={\"mt-8 w-full\"}\n color=\"primary\"\n variant={\"outlined\"}\n size={\"large\"}\n onClick={() => setNewPropertyDialogOpen(true)}\n startIcon={<AddIcon/>}>\n Add new property\n </Button>\n </div>\n\n {!asDialog &&\n <div className={\"col-span-12 lg:col-span-7 ml-2 p-4 md:p-8 h-full overflow-auto pb-20 md:pb-20\"}>\n <Paper\n className=\"sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center \">\n\n {selectedPropertyFullId &&\n selectedProperty &&\n !isPropertyBuilder(selectedProperty) &&\n <PropertyForm\n inArray={false}\n key={`edit_view_${selectedPropertyIndex}`}\n existingProperty={!isNewCollection}\n autoUpdateId={false}\n allowDataInference={!isNewCollection}\n autoOpenTypeSelect={false}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n onPropertyChanged={onPropertyChanged}\n onDelete={deleteProperty}\n onError={onPropertyErrorInternal}\n forceShowErrors={showErrors}\n initialErrors={initialErrors}\n getData={getData}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n />}\n\n {!selectedProperty &&\n <Typography variant={\"label\"} className=\"flex items-center justify-center h-full\">\n {emptyCollection\n ? \"Now you can add your first property\"\n : \"Select a property to edit it\"}\n </Typography>}\n\n {selectedProperty && isPropertyBuilder(selectedProperty) &&\n <Typography variant={\"label\"} className=\"flex items-center justify-center\">\n {\"This property is defined as a property builder in code\"}\n </Typography>}\n </Paper>\n </div>}\n\n {asDialog && <PropertyFormDialog\n inArray={false}\n open={selectedPropertyIndex !== undefined}\n key={`edit_view_${selectedPropertyIndex}`}\n autoUpdateId={!selectedProperty}\n allowDataInference={!isNewCollection}\n existingProperty={true}\n autoOpenTypeSelect={false}\n propertyKey={selectedPropertyKey}\n propertyNamespace={selectedPropertyNamespace}\n property={selectedProperty}\n onPropertyChanged={onPropertyChanged}\n onDelete={deleteProperty}\n onError={onPropertyErrorInternal}\n forceShowErrors={showErrors}\n initialErrors={initialErrors}\n getData={getData}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n onOkClicked={asDialog\n ? closePropertyDialog\n : undefined\n }/>}\n\n </div>);\n\n return (<>\n\n {body}\n\n {/* This is the dialog used for new properties*/}\n <PropertyFormDialog\n inArray={false}\n existingProperty={false}\n autoOpenTypeSelect={true}\n autoUpdateId={true}\n forceShowErrors={showErrors}\n open={newPropertyDialogOpen}\n onCancel={() => setNewPropertyDialogOpen(false)}\n onPropertyChanged={onPropertyCreated}\n getData={getData}\n allowDataInference={!isNewCollection}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n existingPropertyKeys={values.propertiesOrder as string[]}/>\n\n <GetCodeDialog\n collection={values}\n open={codeDialogOpen}\n onOpenChange={setCodeDialogOpen}/>\n\n </>\n );\n}\n","import React from \"react\";\nimport { Button, Dialog, DialogActions, DialogContent, Typography } from \"@firecms/ui\";\n\nexport interface UnsavedChangesDialogProps {\n open: boolean;\n body?: React.ReactNode;\n title?: string;\n handleOk: () => void;\n handleCancel: () => void;\n}\n\nexport function UnsavedChangesDialog({\n open,\n handleOk,\n handleCancel,\n body,\n title\n }: UnsavedChangesDialogProps) {\n\n return (\n <Dialog\n open={open}\n onOpenChange={(open) => open ? handleCancel() : handleOk()}\n aria-labelledby=\"alert-dialog-title\"\n aria-describedby=\"alert-dialog-description\"\n >\n <DialogContent>\n <Typography variant={\"h6\"}>\n {title ?? \"Unsaved changes\"}\n </Typography>\n\n {body && <Typography>\n {body}\n </Typography>}\n <Typography>\n Are you sure?\n </Typography>\n\n </DialogContent>\n\n <DialogActions>\n <Button variant=\"text\" onClick={handleCancel} autoFocus> Cancel </Button>\n <Button onClick={handleOk}> Ok </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import { useCustomizationController } from \"@firecms/core\";\nimport { Button, Dialog, DialogActions, DialogContent, Typography } from \"@firecms/ui\";\nimport React from \"react\";\n\nexport function EntityCustomViewsSelectDialog({ open, onClose }: { open: boolean, onClose: (selectedViewKey?: string) => void }) {\n const {\n entityViews,\n } = useCustomizationController();\n\n return <Dialog\n maxWidth={\"md\"}\n open={open}>\n <DialogContent className={\"flex flex-col gap-4\"}>\n <Typography variant={\"h6\"}>\n Select view\n </Typography>\n {entityViews?.map((view) => {\n return <Button\n key={view.key}\n onClick={() => onClose(view.key)}\n fullWidth\n variant={\"text\"}\n >\n {view.name} ({view.key})\n </Button>;\n })}\n {(entityViews ?? []).length === 0 &&\n <Typography variant={\"body2\"}>\n No custom views defined\n </Typography>\n }\n </DialogContent>\n <DialogActions>\n <Button variant={\"outlined\"} onClick={() => onClose()}>Cancel</Button>\n </DialogActions>\n </Dialog>\n}\n","import React from \"react\";\nimport {\n DeleteConfirmationDialog,\n EntityCollection,\n EntityCustomView,\n resolveEntityView,\n useCustomizationController,\n User\n} from \"@firecms/core\";\nimport {\n AddIcon,\n Button,\n Container,\n DeleteIcon,\n IconButton,\n InfoLabel,\n Paper,\n Table,\n TableBody,\n TableCell,\n TableRow,\n Tooltip,\n Typography,\n} from \"@firecms/ui\";\nimport { useFormikContext } from \"formik\";\nimport { CollectionEditorDialog } from \"./CollectionEditorDialog\";\nimport { CollectionsConfigController } from \"../../types/config_controller\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\nimport { CollectionInference } from \"../../types/collection_inference\";\nimport { EntityCustomViewsSelectDialog } from \"./EntityCustomViewsSelectDialog\";\n\nexport function SubcollectionsEditTab({\n collection,\n parentCollection,\n configController,\n collectionInference,\n getUser,\n parentCollectionIds\n }: {\n collection: PersistedCollection,\n parentCollection?: EntityCollection,\n configController: CollectionsConfigController;\n collectionInference?: CollectionInference;\n getUser: (uid: string) => User | null;\n parentCollectionIds?: string[];\n}) {\n\n const { entityViews: contextEntityViews } = useCustomizationController();\n\n const [subcollectionToDelete, setSubcollectionToDelete] = React.useState<string | undefined>();\n const [addEntityViewDialogOpen, setAddEntityViewDialogOpen] = React.useState<boolean>(false);\n const [viewToDelete, setViewToDelete] = React.useState<string | undefined>();\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n editedCollectionPath?: string,\n }>();\n\n const {\n values,\n setFieldValue,\n } = useFormikContext<EntityCollection>();\n\n const subcollections = collection.subcollections ?? [];\n const resolvedEntityViews = values.entityViews?.filter(e => typeof e === \"string\")\n .map(e => resolveEntityView(e, contextEntityViews))\n .filter(Boolean) as EntityCustomView[] ?? [];\n const hardCodedEntityViews = collection.entityViews?.filter(e => typeof e !== \"string\") as EntityCustomView[] ?? [];\n const totalEntityViews = resolvedEntityViews.length + hardCodedEntityViews.length;\n\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"2xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n <div className={\"flex flex-col gap-16\"}>\n\n <div className={\"flex-grow flex flex-col gap-4 items-start\"}>\n <Typography variant={\"h5\"}>\n Subcollections of {values.name}\n </Typography>\n\n {subcollections && subcollections.length > 0 &&\n <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n <Table>\n <TableBody>\n {subcollections.map((subcollection) => (\n <TableRow key={subcollection.path}\n onClick={() => setCurrentDialog({\n isNewCollection: false,\n editedCollectionPath: subcollection.path,\n })}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {subcollection.name}\n </Typography>\n </TableCell>\n <TableCell\n align=\"right\">\n <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n setSubcollectionToDelete(subcollection.path);\n }}\n color=\"inherit\">\n <DeleteIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Paper>}\n\n <Button\n onClick={() => {\n setCurrentDialog({\n isNewCollection: true\n });\n }}\n variant={\"outlined\"}\n startIcon={<AddIcon/>}>\n Add subcollection\n </Button>\n </div>\n\n <div className={\"flex-grow flex flex-col gap-4 items-start\"}>\n <Typography variant={\"h5\"}>\n Custom views\n </Typography>\n\n {totalEntityViews > 0 && <>\n <Paper className={\"flex flex-col gap-4 p-2 w-full\"}>\n <Table>\n <TableBody>\n {resolvedEntityViews.map((view) => (\n <TableRow key={view.key}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {view.name}\n </Typography>\n </TableCell>\n <TableCell\n align=\"right\">\n <Tooltip title={\"Remove\"}>\n <IconButton size=\"small\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n setViewToDelete(view.key);\n }}\n color=\"inherit\">\n <DeleteIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n </TableCell>\n </TableRow>\n ))}\n {hardCodedEntityViews.map((view) => (\n <TableRow key={view.key}>\n <TableCell\n align=\"left\">\n <Typography variant={\"subtitle2\"} className={\"flex-grow\"}>\n {view.name}\n </Typography>\n <Typography variant={\"caption\"} className={\"flex-grow\"}>\n This view is defined in code with\n key <code>{view.key}</code>\n </Typography>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Paper>\n\n </>}\n\n {totalEntityViews === 0 &&\n <InfoLabel>\n <b>COMING SOON</b> Define your own custom views by uploading it with the CLI\n </InfoLabel>\n }\n\n <Button\n onClick={() => {\n setAddEntityViewDialogOpen(true);\n }}\n variant={\"outlined\"}\n startIcon={<AddIcon/>}>\n Add custom entity view\n </Button>\n\n </div>\n\n </div>\n </Container>\n\n <div style={{ height: \"52px\" }}/>\n\n {subcollectionToDelete &&\n <DeleteConfirmationDialog open={Boolean(subcollectionToDelete)}\n onAccept={() => {\n configController.deleteCollection({\n path: subcollectionToDelete,\n parentCollectionIds: [...(parentCollectionIds ?? []), collection.path]\n });\n setSubcollectionToDelete(undefined);\n }}\n onCancel={() => setSubcollectionToDelete(undefined)}\n title={<>Delete this subcollection?</>}\n body={<> This will <b>not\n delete any data</b>, only\n the collection in the CMS</>}/>}\n {viewToDelete &&\n <DeleteConfirmationDialog open={Boolean(viewToDelete)}\n onAccept={() => {\n setFieldValue(\"entityViews\", values.entityViews?.filter(e => e !== viewToDelete));\n setViewToDelete(undefined);\n }}\n onCancel={() => setViewToDelete(undefined)}\n title={<>Remove this view?</>}\n body={<>This will <b>not\n delete any data</b>, only\n the view in the CMS</>}/>}\n\n <CollectionEditorDialog\n open={Boolean(currentDialog)}\n configController={configController}\n parentCollection={collection}\n collectionInference={collectionInference}\n parentCollectionIds={[...parentCollectionIds ?? [], values.id]}\n isNewCollection={false}\n {...currentDialog}\n getUser={getUser}\n handleClose={() => {\n setCurrentDialog(undefined);\n }}/>\n\n <EntityCustomViewsSelectDialog\n open={addEntityViewDialogOpen}\n onClose={(selectedViewKey) => {\n if (selectedViewKey) {\n setFieldValue(\"entityViews\", [...(values.entityViews ?? []), selectedViewKey]);\n }\n setAddEntityViewDialogOpen(false);\n }}/>\n </div>\n );\n}\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const productsCollectionTemplate: EntityCollection = {\n id: \"products\",\n path: \"products\",\n name: \"Products\",\n singularName: \"Product\",\n icon: \"shopping_cart\",\n description: \"List of the products currently sold in your shop\",\n properties: makePropertiesEditable({\n name: {\n dataType: \"string\",\n name: \"Name\",\n description: \"Name of this product\",\n validation: {\n required: true\n }\n },\n brand: {\n dataType: \"string\",\n name: \"Brand\",\n validation: {\n required: true\n }\n },\n description: {\n dataType: \"string\",\n name: \"Description\",\n description: \"Description of this product, supports markdown\",\n markdown: true\n },\n main_image: {\n dataType: \"string\",\n name: \"Image\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n },\n description: \"Upload field for images\"\n },\n available: {\n dataType: \"boolean\",\n name: \"Available\",\n columnWidth: 100,\n description: \"Is this product available in the website\"\n },\n price: {\n dataType: \"number\",\n name: \"Price\",\n validation: {\n requiredMessage: \"You must set a positive price\",\n min: 0\n }\n },\n images: {\n dataType: \"array\",\n name: \"Images\",\n hideFromCollection: true,\n of: {\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"]\n }\n }\n },\n related_products: {\n dataType: \"array\",\n name: \"Related products\",\n description: \"Products related to this one\",\n of: {\n dataType: \"reference\",\n path: \"products\"\n }\n },\n metadata: {\n name: \"Metadata\",\n description: \"This is an example of a map property\",\n dataType: \"map\",\n keyValue: true\n },\n added_on: {\n dataType: \"date\",\n name: \"Added on\",\n autoValue: \"on_create\"\n }\n })\n};\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const blogCollectionTemplate:EntityCollection = {\n id: \"blog\",\n path: \"blog\",\n name: \"Blog\",\n singularName: \"Blog entry\",\n icon: \"article\",\n description: \"A collection of blog entries\",\n defaultSize: \"l\",\n properties: makePropertiesEditable({\n name: {\n name: \"Name\",\n validation: { required: true },\n dataType: \"string\"\n },\n header_image: {\n name: \"Header image\",\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n metadata: {\n cacheControl: \"max-age=1000000\"\n }\n }\n },\n content: {\n name: \"Content\",\n description: \"Content blocks for the blog entry\",\n validation: { required: true },\n dataType: \"array\",\n oneOf: {\n typeField: \"type\",\n valueField: \"value\",\n properties: {\n text: {\n dataType: \"string\",\n name: \"Text\",\n markdown: true\n },\n quote: {\n dataType: \"string\",\n name: \"Quote\",\n multiline: true\n },\n images: {\n name: \"Images\",\n dataType: \"array\",\n of: {\n dataType: \"string\",\n storage: {\n storagePath: \"images\",\n acceptedFiles: [\"image/*\"],\n metadata: {\n cacheControl: \"max-age=1000000\"\n }\n }\n },\n description: \"This fields allows uploading multiple images at once and reordering\"\n },\n products: {\n name: \"Products\",\n dataType: \"array\",\n of: {\n dataType: \"reference\",\n path: \"products\",\n previewProperties: [\"name\", \"main_image\"]\n }\n }\n },\n propertiesOrder: [\"text\", \"quote\", \"images\", \"products\"]\n }\n },\n created_on: {\n name: \"Created on\",\n dataType: \"date\",\n autoValue: \"on_create\"\n },\n status: {\n name: \"Status\",\n validation: { required: true },\n dataType: \"string\",\n enumValues: {\n published: {\n id: \"published\",\n label: \"Published\",\n },\n draft: \"Draft\"\n },\n defaultValue: \"draft\"\n },\n publish_date: {\n name: \"Publish date\",\n dataType: \"date\",\n clearable: true\n },\n reviewed: {\n name: \"Reviewed\",\n dataType: \"boolean\"\n },\n tags: {\n name: \"Tags\",\n description: \"Example of generic array\",\n dataType: \"array\",\n of: {\n dataType: \"string\",\n previewAsTag: true\n }\n }\n }),\n initialFilter: {\n status: [\"==\", \"published\"]\n }\n};\n","import { EntityCollection, makePropertiesEditable } from \"@firecms/core\";\n\nexport const usersCollectionTemplate: EntityCollection = {\n id: \"users\",\n path: \"users\",\n name: \"Users\",\n singularName: \"User\",\n description: \"Registered users in the app/web\",\n icon: \"person\",\n properties: makePropertiesEditable({\n displayName: {\n name: \"Display name\",\n dataType: \"string\"\n },\n email: {\n name: \"Email\",\n dataType: \"string\",\n email: true\n },\n emailVerified: {\n name: \"Email verified\",\n dataType: \"boolean\"\n },\n phone: {\n name: \"Phone\",\n dataType: \"string\"\n },\n favourite_products: {\n name: \"Favourite products\",\n dataType: \"array\",\n of: {\n dataType: \"reference\",\n path: \"products\"\n }\n },\n photoURL: {\n name: \"Photo URL\",\n dataType: \"string\",\n url: \"image\"\n }\n }),\n};\n","import { EntityCollection } from \"@firecms/core\";\n\nexport const pagesCollectionTemplate: EntityCollection = {\n id: \"pages\",\n path: \"pages\",\n name: \"Pages\",\n singularName: \"Page\",\n icon: \"insert_drive_file\",\n description: \"List of website pages that can be edited here\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Page Title\",\n validation: { required: true }\n },\n slug: {\n dataType: \"string\",\n name: \"URL Slug\",\n validation: {\n required: true,\n unique: true,\n matches: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n matchesMessage: \"Must be lowercase, alphanumeric, and hyphenated\"\n }\n },\n hero_section: {\n dataType: \"map\",\n name: \"Hero Section\",\n properties: {\n headline: {\n dataType: \"string\",\n name: \"Headline\",\n validation: { required: true }\n },\n subhead: {\n dataType: \"string\",\n name: \"Subheadline\"\n },\n background_image: {\n dataType: \"string\",\n name: \"Background Image\",\n storage: {\n storagePath: \"page_hero/images\",\n acceptedFiles: [\"image/*\"],\n }\n },\n call_to_action: {\n dataType: \"string\",\n name: \"Call to Action\"\n },\n call_to_action_link: {\n dataType: \"string\",\n name: \"CTA Link\",\n url: true\n }\n }\n },\n content: {\n dataType: \"array\",\n name: \"Content\",\n oneOf: {\n properties: {\n section: {\n dataType: \"map\",\n name: \"Section\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Section Title\",\n validation: { required: true }\n },\n content: {\n dataType: \"string\",\n name: \"Section Content\",\n markdown: true\n },\n image: {\n dataType: \"string\",\n name: \"Section Image\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n },\n link: {\n dataType: \"string\",\n name: \"Section Link\",\n url: true\n }\n }\n },\n image: {\n dataType: \"string\",\n name: \"Image\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n },\n slider: {\n dataType: \"array\",\n name: \"Slider\",\n of: {\n dataType: \"map\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Title\",\n validation: { required: true }\n },\n image: {\n dataType: \"string\",\n storage: {\n storagePath: \"page_sections/images\",\n acceptedFiles: [\"image/*\"]\n }\n }\n }\n }\n },\n }\n }\n },\n sidebar: {\n dataType: \"map\",\n name: \"Sidebar\",\n properties: {\n title: {\n dataType: \"string\",\n name: \"Sidebar Title\",\n validation: { required: false }\n },\n content: {\n dataType: \"string\",\n name: \"Sidebar Content\",\n markdown: true\n }\n }\n },\n seo_metadata: {\n dataType: \"map\",\n name: \"SEO Metadata\",\n properties: {\n meta_title: {\n dataType: \"string\",\n name: \"Meta Title\"\n },\n meta_description: {\n dataType: \"string\",\n name: \"Meta Description\"\n },\n focus_keywords: {\n dataType: \"array\",\n name: \"Focus Keywords\",\n of: {\n dataType: \"string\"\n }\n }\n }\n },\n footer_override: {\n dataType: \"string\",\n name: \"Footer Override\",\n markdown: true\n },\n publish_date: {\n dataType: \"date\",\n name: \"Publish Date\",\n validation: { required: true }\n },\n last_updated: {\n dataType: \"date\",\n name: \"Last Updated\",\n autoValue: \"on_update\"\n },\n is_published: {\n dataType: \"boolean\",\n name: \"Is Published\",\n columnWidth: 100,\n description: \"Should this page be live on the site?\"\n },\n author_uid: {\n dataType: \"reference\",\n name: \"Author\",\n path: \"users\"\n }\n }\n};\n","import React, { useEffect, useState } from \"react\";\nimport { EntityCollection, unslugify, } from \"@firecms/core\";\nimport { Button, Card, Chip, CircularProgress, cn, Container, Icon, Tooltip, Typography, } from \"@firecms/ui\";\nimport { useFormikContext } from \"formik\";\n\nimport { productsCollectionTemplate } from \"./templates/products_template\";\nimport { blogCollectionTemplate } from \"./templates/blog_template\";\nimport { usersCollectionTemplate } from \"./templates/users_template\";\nimport { ImportFileUpload } from \"@firecms/data_import_export\";\nimport { pagesCollectionTemplate } from \"./templates/pages_template\";\n\nexport function CollectionEditorWelcomeView({\n path,\n pathSuggestions,\n parentCollection,\n onContinue,\n collections\n }: {\n path: string;\n pathSuggestions?: (path: string) => Promise<string[]>;\n parentCollection?: EntityCollection;\n onContinue: (importData?: object[]) => void;\n collections?: EntityCollection[];\n}) {\n\n const [loadingPathSuggestions, setLoadingPathSuggestions] = useState(false);\n const [filteredPathSuggestions, setFilteredPathSuggestions] = useState<string[] | undefined>();\n useEffect(() => {\n if (pathSuggestions && collections) {\n setLoadingPathSuggestions(true);\n pathSuggestions(path)\n .then(suggestions => {\n const filteredSuggestions = suggestions.filter(s => !collections.find(c => c.path.trim().toLowerCase() === s.trim().toLowerCase()));\n setFilteredPathSuggestions(filteredSuggestions);\n })\n .finally(() => setLoadingPathSuggestions(false));\n }\n }, [collections, path, pathSuggestions]);\n\n const {\n values,\n setFieldValue,\n setValues,\n handleChange,\n touched,\n errors,\n setFieldTouched,\n isSubmitting,\n submitCount\n } = useFormikContext<EntityCollection>();\n\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"4xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <div\n className=\"flex flex-row py-2 pt-3 items-center\">\n <Typography variant={\"h4\"} className={\"flex-grow\"}>\n New collection\n </Typography>\n </div>\n\n {parentCollection && <Chip colorScheme={\"tealDarker\"}>\n <Typography variant={\"caption\"}>\n This is a subcollection of <b>{parentCollection.name}</b>\n </Typography>\n </Chip>}\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Use one of the existing paths in your database:\n </Typography>\n <div className={\"flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7\"}>\n\n {loadingPathSuggestions && !filteredPathSuggestions && <CircularProgress size={\"small\"}/>}\n\n {filteredPathSuggestions?.map((suggestion, index) => (\n <Chip key={suggestion}\n colorScheme={\"cyanLighter\"}\n onClick={() => {\n setFieldValue(\"name\", unslugify(suggestion));\n setFieldValue(\"id\", suggestion);\n setFieldValue(\"path\", suggestion);\n setFieldValue(\"properties\", undefined);\n onContinue();\n }}\n size=\"small\">\n {suggestion}\n </Chip>\n ))}\n\n {!loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0 &&\n <Typography variant={\"caption\"}>\n No suggestions\n </Typography>\n }\n\n </div>\n\n </div>\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Select a template:\n </Typography>\n\n <div className={\"flex gap-4\"}>\n <TemplateButton title={\"Products\"}\n subtitle={\"A collection of products with images, prices and stock\"}\n icon={<Icon size={\"small\"} iconKey={productsCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(productsCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Users\"}\n subtitle={\"A collection of users with emails, names and roles\"}\n icon={<Icon size={\"small\"} iconKey={usersCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(usersCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Blog posts\"}\n subtitle={\"A collection of blog posts with images, authors and complex content\"}\n icon={<Icon size={\"small\"} iconKey={blogCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(blogCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Pages\"}\n subtitle={\"A collection of pages with images, authors and complex content\"}\n icon={<Icon size={\"small\"} iconKey={pagesCollectionTemplate.icon!}/>}\n onClick={() => {\n setValues(pagesCollectionTemplate);\n onContinue();\n }}/>\n </div>\n\n </div>\n\n {!parentCollection && <div>\n\n <Typography variant={\"caption\"}\n color={\"secondary\"}\n className={\"mb-2\"}>\n ● Create a collection from a file (csv, json, xls, xslx...)\n </Typography>\n\n <ImportFileUpload onDataAdded={(data) => onContinue(data)}/>\n\n </div>}\n\n <div>\n\n <Button variant={\"text\"} onClick={() => onContinue()} className={\"my-2\"}>\n Continue from scratch\n </Button>\n </div>\n\n {/*<div style={{ height: \"52px\" }}/>*/}\n\n </Container>\n </div>\n );\n}\n\nexport function TemplateButton({\n title,\n subtitle,\n icon,\n onClick\n }: {\n title: string,\n icon: React.ReactNode,\n subtitle: string,\n onClick?: () => void\n}) {\n\n return (\n <Tooltip title={subtitle}>\n <Card\n onClick={onClick}\n className={cn(\n \"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center\",\n \"text-gray-700 dark:text-gray-300\",\n \"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary\",\n \"border-gray-400 dark:border-gray-600 \"\n )}\n >\n {icon}\n <div className={\"flex flex-col items-start\"}>\n\n <Typography variant={\"subtitle1\"}>\n {title}\n </Typography>\n {/*<Typography>*/}\n {/* {subtitle}*/}\n {/*</Typography>*/}\n\n </div>\n </Card>\n </Tooltip>\n );\n\n}\n","import {\n DataNewPropertiesMapping,\n getInferenceType,\n ImportConfig,\n ImportNewPropertyFieldPreview\n} from \"@firecms/data_import_export\";\nimport { getIn, useFormikContext } from \"formik\";\n\nimport { PropertyConfigBadge, getFieldConfig, getFieldId, Properties, Property, PropertyConfig, } from \"@firecms/core\";\nimport { Container, Select, Tooltip, Typography } from \"@firecms/ui\";\nimport React, { useState } from \"react\";\nimport { OnPropertyChangedParams, PropertyFormDialog, PropertyWithId } from \"../PropertyEditView\";\nimport { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from \"../util\";\nimport { PersistedCollection } from \"../../../types/persisted_collection\";\nimport { updatePropertyFromWidget } from \"../utils/update_property_for_widget\";\nimport { PropertySelectItem } from \"../PropertySelectItem\";\nimport { supportedFields } from \"../utils/supported_fields\";\nimport { buildPropertyFromData } from \"@firecms/schema_inference\";\n\nexport function CollectionEditorImportMapping({\n importConfig,\n propertyConfigs,\n collectionEditable\n }:\n {\n importConfig: ImportConfig,\n propertyConfigs: Record<string, PropertyConfig>,\n collectionEditable: boolean\n }) {\n\n const {\n setFieldValue,\n setFieldTouched,\n values\n } = useFormikContext<PersistedCollection>();\n const [selectedProperty, setSelectedProperty] = useState<PropertyWithId | undefined>(undefined);\n\n const currentPropertiesOrderRef = React.useRef<{\n [key: string]: string[]\n }>(values.propertiesOrder ? { \"\": values.propertiesOrder } : {});\n\n const propertyKey = selectedProperty ? selectedProperty.id : undefined;\n const property = selectedProperty || undefined;\n\n const onPropertyChanged = ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => {\n\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // setSelectedProperty(property);\n const getCurrentPropertiesOrder = (namespace?: string) => {\n if (!namespace) return currentPropertiesOrderRef.current[\"\"];\n return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));\n }\n\n const updatePropertiesOrder = (newPropertiesOrder: string[], namespace?: string) => {\n const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);\n\n setFieldValue(propertiesOrderPath, newPropertiesOrder, false);\n currentPropertiesOrderRef.current[namespace ?? \"\"] = newPropertiesOrder;\n\n };\n\n // If the id has changed we need to a little cleanup\n if (previousId && previousId !== id) {\n const previousFullId = getFullId(previousId, namespace);\n const previousPropertyPath = idToPropertiesPath(previousFullId);\n\n const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);\n\n // replace previousId with id in propertiesOrder\n const newPropertiesOrder = currentPropertiesOrder\n .map((p) => p === previousId ? id : p)\n .filter((p) => p !== undefined) as string[];\n updatePropertiesOrder(newPropertiesOrder, namespace);\n\n // replace previousId with id in headersMapping\n const newHeadersMapping = { ...importConfig.headersMapping };\n Object.keys(newHeadersMapping).forEach((key) => {\n if (newHeadersMapping[key] === previousId) {\n newHeadersMapping[key] = id ?? \"\";\n }\n });\n importConfig.setHeadersMapping(newHeadersMapping);\n\n // if (id) {\n // setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));\n // setSelectedPropertyKey(id);\n // }\n setFieldValue(previousPropertyPath, undefined, false);\n setFieldTouched(previousPropertyPath, false, false);\n }\n\n if (propertyPath) {\n setFieldValue(propertyPath, property, false);\n setFieldTouched(propertyPath, true, false);\n }\n };\n const onPropertyTypeChanged = async ({\n id,\n importKey,\n property,\n namespace\n }: OnPropertyChangedParams & {\n importKey: string\n }) => {\n\n const fullId = id ? getFullId(id, namespace) : undefined;\n const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;\n\n // we try to infer the rest of the properties of a property, from the type and the data\n const propertyData = importConfig.importData.map((d) => getIn(d, importKey));\n const inferredNewProperty = {\n ...buildPropertyFromData(propertyData, property, getInferenceType),\n editable: true\n };\n\n if (propertyPath) {\n if (inferredNewProperty) {\n setFieldValue(propertyPath, inferredNewProperty, false);\n } else {\n setFieldValue(propertyPath, property, false);\n }\n setFieldTouched(propertyPath, true, false);\n }\n };\n\n return (\n\n <div className={\"overflow-auto my-auto bg-gray-50 dark:bg-gray-900\"}>\n <Container maxWidth={\"6xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <Typography variant=\"h6\" className={\"mt-4\"}>Data property mapping</Typography>\n\n <DataNewPropertiesMapping headersMapping={importConfig.headersMapping}\n idColumn={importConfig.idColumn}\n originProperties={importConfig.originProperties}\n destinationProperties={values.properties as Properties}\n onIdPropertyChanged={(value) => importConfig.setIdColumn(value)}\n buildPropertyView={({\n property,\n propertyKey,\n importKey\n }) => {\n return <ImportNewPropertyFieldPreview\n property={property}\n propertyKey={propertyKey}\n onPropertyNameChanged={(propertyKey: string, value: string) => setFieldValue(`properties.${propertyKey}.name`, value, false)}\n onEditClick={() => {\n if (!propertyKey || !property) return;\n setSelectedProperty({\n ...property,\n id: propertyKey,\n editable: true\n });\n }}\n propertyTypeView={<PropertySelect property={property}\n disabled={false}\n onPropertyChanged={(props) => onPropertyTypeChanged({\n ...props,\n importKey\n })}\n propertyKey={propertyKey}\n propertyConfigs={propertyConfigs}/>}\n />;\n }}/>\n </Container>\n\n <PropertyFormDialog\n open={selectedProperty !== undefined}\n propertyKey={propertyKey}\n property={property}\n inArray={false}\n autoUpdateId={false}\n onPropertyChanged={onPropertyChanged}\n allowDataInference={false}\n collectionEditable={collectionEditable}\n onOkClicked={() => {\n setSelectedProperty(undefined);\n }}\n onCancel={() => {\n setSelectedProperty(undefined);\n }}\n autoOpenTypeSelect={false}\n existingProperty={false}\n propertyConfigs={propertyConfigs}/>\n\n <div style={{ height: \"52px\" }}/>\n </div>\n );\n\n}\n\nfunction PropertySelect({\n property,\n onPropertyChanged,\n propertyKey,\n propertyConfigs,\n disabled\n }: {\n property: Property | null,\n propertyKey: string | null,\n onPropertyChanged: ({\n id,\n property,\n previousId,\n namespace\n }: OnPropertyChangedParams) => void,\n propertyConfigs: Record<string, PropertyConfig>,\n disabled?: boolean\n}) {\n\n const fieldId = property ? getFieldId(property) : null;\n const widget = property ? getFieldConfig(property, propertyConfigs) : null;\n\n const [selectOpen, setSelectOpen] = useState(false);\n\n return <Tooltip title={property && widget ? `${widget?.name} - ${property.dataType}` : undefined}\n open={selectOpen ? false : undefined}>\n <Select\n open={selectOpen}\n onOpenChange={setSelectOpen}\n invisible={true}\n className={\"w-full\"}\n disabled={disabled}\n error={!widget}\n value={fieldId ?? \"\"}\n placeholder={\"Select a property widget\"}\n position={\"item-aligned\"}\n renderValue={(value) => {\n if (!widget) return null;\n return <PropertyConfigBadge propertyConfig={widget}/>\n }}\n onValueChange={(newSelectedWidgetId) => {\n const newProperty = updatePropertyFromWidget(property, newSelectedWidgetId, propertyConfigs)\n if (!propertyKey) return;\n onPropertyChanged({\n id: propertyKey,\n property: newProperty,\n previousId: propertyKey,\n namespace: undefined\n });\n }}>\n {Object.entries(supportedFields).map(([key, widget]) => {\n return <PropertySelectItem\n key={key}\n value={key}\n optionDisabled={false}\n propertyConfig={widget}\n existing={false}/>;\n })\n }\n </Select>\n </Tooltip>;\n}\n","import { convertDataToEntity, getPropertiesMapping, ImportConfig } from \"@firecms/data_import_export\";\nimport { EntityCollectionTable, Properties, useSelectionController } from \"@firecms/core\";\nimport { useEffect } from \"react\";\nimport { Typography } from \"@firecms/ui\";\n\nexport function CollectionEditorImportDataPreview({ importConfig, properties, propertiesOrder }: {\n importConfig: ImportConfig,\n properties: Properties,\n propertiesOrder: string[]\n}) {\n\n useEffect(() => {\n const propertiesMapping = getPropertiesMapping(importConfig.originProperties, properties);\n const mappedData = importConfig.importData.map(d => convertDataToEntity(d, importConfig.idColumn, importConfig.headersMapping, properties, propertiesMapping, \"TEMP_PATH\"));\n importConfig.setEntities(mappedData);\n }, []);\n\n const selectionController = useSelectionController();\n\n return <EntityCollectionTable\n title={<div>\n <Typography variant={\"subtitle2\"}>Imported data preview</Typography>\n <Typography variant={\"caption\"}>Entities with the same id will be overwritten</Typography>\n </div>}\n tableController={{\n data: importConfig.entities,\n dataLoading: false,\n noMoreToLoad: false\n }}\n endAdornment={<div className={\"h-12\"}/>}\n filterable={false}\n sortable={false}\n selectionController={selectionController}\n displayedColumnIds={propertiesOrder.map(p => ({ key: p, disabled: false }))}\n properties={properties}/>\n\n}\n","import { Properties, slugify } from \"@firecms/core\";\nimport { ImportConfig } from \"@firecms/data_import_export\";\n\nexport function cleanPropertiesFromImport(properties: Properties, parentSlug = \"\"): {\n headersMapping: ImportConfig[\"headersMapping\"],\n properties: Properties,\n idColumn?: ImportConfig[\"idColumn\"],\n} {\n\n const result = Object.keys(properties).reduce((acc, key) => {\n const property = properties[key];\n const slug = slugify(key);\n const fullSlug = parentSlug ? `${parentSlug}.${slug}` : slug;\n\n if (property.dataType === \"map\" && property.properties) {\n const slugifiedResult = cleanPropertiesFromImport(property.properties as Properties, fullSlug);\n return {\n headersMapping: { ...acc.headersMapping, [key]: fullSlug },\n properties: {\n ...acc.properties,\n [slug]: {\n ...property,\n properties: slugifiedResult.properties,\n propertiesOrder: Object.keys(slugifiedResult.properties)\n }\n }\n }\n }\n\n const updatedProperties = {\n ...acc.properties,\n [slug]: property\n } as Properties;\n\n const headersMapping = { ...acc.headersMapping, [key]: fullSlug } as Record<string, string>;\n\n return {\n headersMapping,\n properties: updatedProperties,\n }\n }, { headersMapping: {}, properties: {} });\n\n const firstKey = Object.keys(result.headersMapping)?.[0];\n let idColumn: string | undefined;\n if (firstKey?.includes(\"id\") || firstKey?.includes(\"key\")) {\n idColumn = firstKey;\n }\n\n return {\n ...result,\n idColumn\n };\n}\n","import * as React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n CircularProgressCenter,\n CMSType,\n EntityCollection,\n ErrorView,\n isPropertyBuilder,\n MapProperty,\n mergeDeep,\n Properties,\n PropertiesOrBuilders,\n Property,\n PropertyConfig,\n PropertyOrBuilder,\n randomString,\n removeInitialAndTrailingSlashes,\n removeUndefined,\n TopNavigationResult,\n useAuthController,\n useCustomizationController,\n useNavigationController,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport {\n ArrowBackIcon,\n Button,\n cn,\n coolIconKeys,\n defaultBorderMixin,\n Dialog,\n DialogActions,\n DialogContent,\n DoneIcon,\n IconButton,\n LoadingButton,\n Tab,\n Tabs,\n} from \"@firecms/ui\";\nimport { Form, Formik, FormikHelpers } from \"formik\";\nimport { YupSchema } from \"./CollectionYupValidation\";\nimport { CollectionDetailsForm } from \"./CollectionDetailsForm\";\nimport { CollectionPropertiesEditorForm } from \"./CollectionPropertiesEditorForm\";\nimport { UnsavedChangesDialog } from \"./UnsavedChangesDialog\";\nimport { SubcollectionsEditTab } from \"./SubcollectionsEditTab\";\nimport { CollectionsConfigController } from \"../../types/config_controller\";\nimport { CollectionEditorWelcomeView } from \"./CollectionEditorWelcomeView\";\nimport { CollectionInference } from \"../../types/collection_inference\";\nimport { getInferenceType, ImportSaveInProgress, useImportConfig } from \"@firecms/data_import_export\";\nimport { buildEntityPropertiesFromData } from \"@firecms/schema_inference\";\nimport { CollectionEditorImportMapping } from \"./import/CollectionEditorImportMapping\";\nimport { CollectionEditorImportDataPreview } from \"./import/CollectionEditorImportDataPreview\";\nimport { cleanPropertiesFromImport } from \"./import/clean_import_data\";\nimport { PersistedCollection } from \"../../types/persisted_collection\";\n\nexport interface CollectionEditorDialogProps {\n open: boolean;\n isNewCollection: boolean;\n initialValues?: {\n group?: string,\n path?: string,\n name?: string,\n }\n editedCollectionPath?: string; // last segment of the path, like `locales`\n fullPath?: string; // full path of this particular collection, like `products/123/locales`\n parentCollectionIds?: string[]; // path ids of the parent collection, like [`products`]\n handleClose: (collection?: EntityCollection) => void;\n configController: CollectionsConfigController;\n reservedGroups?: string[];\n collectionInference?: CollectionInference;\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n pathSuggestions?: (path?: string) => Promise<string[]>;\n getUser: (uid: string) => User | null;\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n parentCollection?: PersistedCollection;\n}\n\nexport function CollectionEditorDialog(props: CollectionEditorDialogProps) {\n\n const open = props.open;\n\n const [formDirty, setFormDirty] = React.useState<boolean>(false);\n const [unsavedChangesDialogOpen, setUnsavedChangesDialogOpen] = React.useState<boolean>(false);\n\n const handleCancel = useCallback(() => {\n if (!formDirty) {\n props.handleClose(undefined);\n } else {\n setUnsavedChangesDialogOpen(true);\n }\n }, [formDirty, props.handleClose]);\n\n useEffect(() => {\n if (!open) {\n setFormDirty(false);\n setUnsavedChangesDialogOpen(false);\n }\n }, [open]);\n\n return (\n <Dialog\n open={open}\n fullWidth={true}\n fullHeight={true}\n scrollable={false}\n maxWidth={\"7xl\"}\n onOpenChange={(open) => !open ? handleCancel() : undefined}\n >\n {open && <CollectionEditorDialogInternal {...props}\n handleCancel={handleCancel}\n setFormDirty={setFormDirty}/>}\n\n <UnsavedChangesDialog\n open={unsavedChangesDialogOpen}\n handleOk={() => props.handleClose(undefined)}\n handleCancel={() => setUnsavedChangesDialogOpen(false)}\n body={\"There are unsaved changes in this collection\"}/>\n\n </Dialog>\n );\n}\n\ntype EditorView = \"welcome\"\n | \"details\"\n | \"import_data_mapping\"\n | \"import_data_preview\"\n | \"import_data_saving\"\n | \"properties\"\n | \"loading\"\n | \"extra_view\"\n | \"subcollections\";\n\nexport function CollectionEditorDialogInternal<M extends {\n [Key: string]: CMSType\n}>({\n isNewCollection,\n initialValues: initialValuesProp,\n configController,\n editedCollectionPath,\n parentCollectionIds,\n fullPath,\n collectionInference,\n handleClose,\n reservedGroups,\n extraView,\n handleCancel,\n setFormDirty,\n pathSuggestions,\n getUser,\n parentCollection,\n getData\n }: CollectionEditorDialogProps & {\n handleCancel: () => void,\n setFormDirty: (dirty: boolean) => void\n }\n) {\n\n const { propertyConfigs } = useCustomizationController();\n const navigation = useNavigationController();\n const {\n topLevelNavigation,\n collections\n } = navigation;\n\n const includeTemplates = !initialValuesProp?.path && (parentCollectionIds ?? []).length === 0;\n const collectionsInThisLevel = (parentCollection ? parentCollection.subcollections : collections) ?? [];\n const existingPaths = collectionsInThisLevel.map(col => col.path.trim().toLowerCase());\n const existingIds = collectionsInThisLevel.map(col => col.id?.trim().toLowerCase()).filter(Boolean) as string[];\n\n const importConfig = useImportConfig();\n\n if (!topLevelNavigation) {\n throw Error(\"Internal: Navigation not ready in collection editor\");\n }\n\n const {\n groups\n }: TopNavigationResult = topLevelNavigation;\n\n const snackbarController = useSnackbarController();\n const authController = useAuthController();\n\n // Use this ref to store which properties have errors\n const propertyErrorsRef = useRef({});\n\n const initialView = isNewCollection ? (includeTemplates ? \"welcome\" : \"details\") : \"properties\";\n const [currentView, setCurrentView] = useState<EditorView>(initialView); // this view can edit either the details view or the properties one\n\n const [error, setError] = React.useState<Error | undefined>();\n\n const [collection, setCollection] = React.useState<PersistedCollection<M> | undefined>();\n const [initialLoadingCompleted, setInitialLoadingCompleted] = React.useState(false);\n const [initialError, setInitialError] = React.useState<Error | undefined>();\n\n useEffect(() => {\n try {\n if (navigation.initialised) {\n if (editedCollectionPath) {\n setCollection(navigation.getCollectionFromPaths<PersistedCollection<M>>([...(parentCollectionIds ?? []), editedCollectionPath]));\n } else {\n setCollection(undefined);\n }\n setInitialLoadingCompleted(true);\n }\n } catch (e) {\n console.error(e);\n setInitialError(initialError);\n }\n }, [navigation.getCollectionFromPaths, editedCollectionPath, initialError, navigation.initialised]);\n\n const saveCollection = (updatedCollection: PersistedCollection<M>): Promise<boolean> => {\n const fullPath = updatedCollection.id || updatedCollection.path;\n return configController.saveCollection({\n id: fullPath,\n collectionData: updatedCollection,\n previousPath: editedCollectionPath,\n parentCollectionIds\n })\n .then(() => {\n setError(undefined);\n return true;\n })\n .catch((e) => {\n setError(e);\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n };\n\n const initialCollection = collection\n ? {\n ...collection,\n id: collection.id ?? collection.path ?? randomString(16)\n }\n : undefined;\n\n const initialValues: PersistedCollection<M> = initialCollection\n ? applyPropertyConfigs(initialCollection, propertyConfigs)\n : {\n id: initialValuesProp?.path ?? randomString(16),\n path: initialValuesProp?.path ?? \"\",\n name: initialValuesProp?.name ?? \"\",\n group: initialValuesProp?.group ?? \"\",\n properties: {} as PropertiesOrBuilders<M>,\n propertiesOrder: [],\n icon: coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)],\n ownerId: authController.user?.uid ?? \"\"\n };\n\n const setNextMode = useCallback(() => {\n if (currentView === \"details\") {\n if (importConfig.inUse) {\n setCurrentView(\"import_data_saving\");\n } else if (extraView) {\n setCurrentView(\"extra_view\");\n } else {\n setCurrentView(\"properties\");\n }\n } else if (currentView === \"welcome\") {\n setCurrentView(\"details\");\n } else if (currentView === \"import_data_mapping\") {\n setCurrentView(\"import_data_preview\");\n } else if (currentView === \"import_data_preview\") {\n setCurrentView(\"details\");\n } else if (currentView === \"extra_view\") {\n setCurrentView(\"properties\");\n } else {\n setCurrentView(\"details\");\n }\n\n }, [currentView, importConfig.inUse, extraView]);\n\n const doCollectionInference = useCallback((collection: PersistedCollection<any>) => {\n if (!collectionInference) return undefined;\n return collectionInference?.(collection.path, collection.collectionGroup ?? false, parentCollectionIds ?? []);\n }, [collectionInference, parentCollectionIds]);\n\n const inferCollectionFromData = useCallback(async (newCollection: PersistedCollection<M>) => {\n\n try {\n if (!doCollectionInference) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n\n setCurrentView(\"loading\");\n\n const inferredCollection = await doCollectionInference?.(newCollection);\n\n if (!inferredCollection) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n const values = {\n ...(newCollection ?? {})\n };\n\n if (Object.keys(inferredCollection.properties ?? {}).length > 0) {\n values.properties = inferredCollection.properties as PropertiesOrBuilders<M>;\n values.propertiesOrder = inferredCollection.propertiesOrder as Extract<keyof M, string>[];\n }\n\n if (!values.propertiesOrder) {\n values.propertiesOrder = Object.keys(values.properties) as Extract<keyof M, string>[];\n return values;\n }\n\n setCollection(values);\n console.log(\"Inferred collection\", {\n newCollection: newCollection ?? {},\n values\n });\n return values;\n } catch (e: any) {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error inferring collection: \" + (e.message ?? \"Details in the console\")\n });\n return newCollection;\n }\n }, [parentCollectionIds, doCollectionInference]);\n\n const onSubmit = (newCollectionState: PersistedCollection<M>, formikHelpers: FormikHelpers<PersistedCollection<M>>) => {\n try {\n\n console.log(\"Submitting collection\", newCollectionState)\n if (!isNewCollection) {\n saveCollection(newCollectionState).then(() => {\n formikHelpers.resetForm({ values: initialValues });\n // setNextMode();\n handleClose(newCollectionState);\n });\n return;\n }\n\n if (currentView === \"welcome\") {\n setNextMode();\n formikHelpers.resetForm({ values: newCollectionState });\n } else if (currentView === \"details\") {\n if (extraView || importConfig.inUse) {\n formikHelpers.resetForm({ values: newCollectionState });\n setNextMode();\n } else if (isNewCollection) {\n inferCollectionFromData(newCollectionState)\n .then((values) => {\n formikHelpers.resetForm({\n values: values ?? newCollectionState,\n touched: {\n path: true,\n name: true\n }\n });\n }).finally(() => {\n setNextMode();\n });\n } else {\n formikHelpers.resetForm({ values: newCollectionState });\n setNextMode();\n }\n } else if (currentView === \"extra_view\") {\n setNextMode();\n formikHelpers.resetForm({ values: newCollectionState });\n } else if (currentView === \"import_data_mapping\") {\n setNextMode();\n } else if (currentView === \"import_data_preview\") {\n setNextMode();\n } else if (currentView === \"properties\") {\n saveCollection(newCollectionState).then(() => {\n formikHelpers.resetForm({ values: initialValues });\n setNextMode();\n handleClose(newCollectionState);\n });\n } else {\n setNextMode();\n formikHelpers.resetForm({ values: newCollectionState });\n }\n } catch (e: any) {\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e.message ?? \"Details in the console\")\n });\n console.error(e);\n formikHelpers.resetForm({ values: newCollectionState });\n }\n };\n\n if (!isNewCollection && (!navigation.initialised || !initialLoadingCompleted)) {\n return <CircularProgressCenter/>;\n }\n\n return <DialogContent fullHeight={true}>\n <Formik\n initialValues={initialValues}\n validationSchema={(currentView === \"properties\" || currentView === \"subcollections\" || currentView === \"details\") && YupSchema}\n validate={(v) => {\n if (currentView === \"properties\") {\n // return the errors for the properties form\n return propertyErrorsRef.current;\n }\n const errors: Record<string, any> = {};\n if (currentView === \"details\") {\n const pathError = validatePath(v.path, isNewCollection, existingPaths, v.id);\n if (pathError) {\n errors.path = pathError;\n }\n const idError = validateId(v.id, isNewCollection, existingPaths, existingIds);\n if (idError) {\n errors.id = idError;\n }\n }\n return errors;\n }}\n onSubmit={onSubmit}\n >\n {(formikHelpers) => {\n const {\n values,\n errors,\n setFieldValue,\n isSubmitting,\n dirty,\n submitCount\n } = formikHelpers;\n\n const path = values.path ?? editedCollectionPath;\n const updatedFullPath = fullPath?.includes(\"/\") ? fullPath?.split(\"/\").slice(0, -1).join(\"/\") + \"/\" + path : path; // TODO: this path is wrong\n const pathError = validatePath(path, isNewCollection, existingPaths, values.id);\n\n const parentPaths = !pathError && parentCollectionIds ? navigation.convertIdsToPaths(parentCollectionIds) : undefined;\n const resolvedPath = !pathError ? navigation.resolveAliasesFrom(updatedFullPath) : undefined;\n const getDataWithPath = resolvedPath && getData ? () => getData(resolvedPath, parentPaths ?? []) : undefined;\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n setFormDirty(dirty);\n }, [dirty]);\n\n function onImportDataSet(data: object[]) {\n importConfig.setInUse(true);\n buildEntityPropertiesFromData(data, getInferenceType)\n .then((properties) => {\n const res = cleanPropertiesFromImport(properties);\n\n setFieldValue(\"properties\", res.properties);\n setFieldValue(\"propertiesOrder\", Object.keys(res.properties));\n\n importConfig.setIdColumn(res.idColumn);\n importConfig.setImportData(data);\n importConfig.setHeadersMapping(res.headersMapping);\n importConfig.setOriginProperties(res.properties);\n });\n }\n\n const validValues = Boolean(values.name) && Boolean(values.id);\n\n const onImportMappingComplete = () => {\n const updatedProperties = { ...values.properties };\n if (importConfig.idColumn)\n delete updatedProperties[importConfig.idColumn];\n setFieldValue(\"properties\", updatedProperties);\n // setFieldValue(\"propertiesOrder\", Object.values(importConfig.headersMapping));\n setNextMode();\n };\n\n const editable = collection?.editable === undefined || collection?.editable === true;\n const collectionEditable = editable || isNewCollection;\n return (\n <>\n {!isNewCollection && <Tabs value={currentView}\n className={cn(defaultBorderMixin, \"justify-end bg-gray-50 dark:bg-gray-950 border-b\")}\n onValueChange={(v) => setCurrentView(v as EditorView)}>\n <Tab value={\"details\"}>\n Details\n </Tab>\n <Tab value={\"properties\"}>\n Properties\n </Tab>\n <Tab value={\"subcollections\"}>\n Additional views\n </Tab>\n </Tabs>}\n\n <Form noValidate\n className={cn(\n isNewCollection ? \"h-full\" : \"h-[calc(100%-48px)]\",\n \"flex-grow flex flex-col relative\")}>\n\n {currentView === \"loading\" &&\n <CircularProgressCenter/>}\n\n {currentView === \"extra_view\" &&\n path &&\n extraView?.View &&\n <extraView.View path={path}/>}\n\n {currentView === \"welcome\" &&\n <CollectionEditorWelcomeView\n path={path}\n onContinue={(data) => {\n if (data) {\n onImportDataSet(data);\n setCurrentView(\"import_data_mapping\");\n } else {\n setCurrentView(\"details\");\n }\n }}\n collections={collections}\n parentCollection={parentCollection}\n pathSuggestions={pathSuggestions}/>}\n\n {currentView === \"import_data_mapping\" && importConfig &&\n <CollectionEditorImportMapping importConfig={importConfig}\n collectionEditable={collectionEditable}\n propertyConfigs={propertyConfigs}/>}\n\n {currentView === \"import_data_preview\" && importConfig &&\n <CollectionEditorImportDataPreview importConfig={importConfig}\n properties={values.properties as Properties}\n propertiesOrder={values.propertiesOrder as string[]}/>}\n\n {currentView === \"import_data_saving\" && importConfig &&\n <ImportSaveInProgress importConfig={importConfig}\n collection={values}\n onImportSuccess={(importedCollection) => {\n handleClose(importedCollection);\n snackbarController.open({\n type: \"info\",\n message: \"Data imported successfully\"\n });\n }}\n />}\n\n {currentView === \"details\" &&\n <CollectionDetailsForm\n existingPaths={existingPaths}\n existingIds={existingIds}\n groups={groups}\n parentCollectionIds={parentCollectionIds}\n parentCollection={parentCollection}\n isNewCollection={isNewCollection}/>}\n\n {currentView === \"subcollections\" && collection &&\n <SubcollectionsEditTab\n parentCollection={parentCollection}\n configController={configController}\n getUser={getUser}\n collectionInference={collectionInference}\n parentCollectionIds={parentCollectionIds}\n collection={collection}/>}\n\n {currentView === \"properties\" &&\n <CollectionPropertiesEditorForm\n showErrors={submitCount > 0}\n isNewCollection={isNewCollection}\n reservedGroups={reservedGroups}\n onPropertyError={(propertyKey, namespace, error) => {\n propertyErrorsRef.current = removeUndefined({\n ...propertyErrorsRef.current,\n [propertyKey]: error\n }, true);\n }}\n getUser={getUser}\n getData={getDataWithPath}\n doCollectionInference={doCollectionInference}\n propertyConfigs={propertyConfigs}\n collectionEditable={collectionEditable}\n extraIcon={extraView?.icon &&\n <IconButton\n color={\"primary\"}\n onClick={() => setCurrentView(\"extra_view\")}>\n {extraView.icon}\n </IconButton>}/>\n }\n\n {currentView !== \"welcome\" && <DialogActions\n position={\"absolute\"}>\n {error && <ErrorView error={error}/>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_mapping\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n importConfig.setInUse(false);\n return setCurrentView(\"welcome\");\n }}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_preview\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n saveCollection(values);\n setCurrentView(\"import_data_mapping\");\n }}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"details\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => setCurrentView(\"welcome\")}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n {isNewCollection && currentView === \"properties\" && <Button variant={\"text\"}\n type=\"button\"\n onClick={() => setCurrentView(\"details\")}>\n <ArrowBackIcon/>\n Back\n </Button>}\n\n <Button variant={\"text\"}\n onClick={() => {\n handleCancel();\n }}>\n Cancel\n </Button>\n\n {isNewCollection && currentView === \"import_data_mapping\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={onImportMappingComplete}\n >\n Next\n </Button>}\n\n {isNewCollection && currentView === \"import_data_preview\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={() => {\n setNextMode();\n }}\n >\n Next\n </Button>}\n\n {isNewCollection && (currentView === \"details\" || currentView === \"properties\") &&\n <LoadingButton\n variant={\"filled\"}\n color=\"primary\"\n type=\"submit\"\n loading={isSubmitting}\n disabled={isSubmitting || (currentView === \"details\" && !validValues)}\n startIcon={currentView === \"properties\"\n ? <DoneIcon/>\n : undefined}\n >\n {currentView === \"details\" && \"Next\"}\n {currentView === \"properties\" && \"Create collection\"}\n </LoadingButton>}\n\n {!isNewCollection && <LoadingButton\n variant=\"filled\"\n color=\"primary\"\n type=\"submit\"\n loading={isSubmitting}\n // disabled={isSubmitting || !dirty}\n >\n Update collection\n </LoadingButton>}\n\n </DialogActions>}\n </Form>\n </>\n );\n }}\n\n </Formik>\n </DialogContent>\n\n}\n\nfunction applyPropertyConfigs<M extends Record<string, any> = any>(collection: PersistedCollection<M>, propertyConfigs: Record<string, PropertyConfig<any>>): PersistedCollection<M> {\n const { properties, ...rest } = collection;\n const propertiesResult: PropertiesOrBuilders<any> = {};\n Object.keys(properties).forEach((key) => {\n propertiesResult[key] = applyPropertiesConfig(properties[key] as PropertyOrBuilder, propertyConfigs);\n });\n\n return { ...rest, properties: propertiesResult };\n}\n\nfunction applyPropertiesConfig(property: PropertyOrBuilder, propertyConfigs: Record<string, PropertyConfig<any>>) {\n let internalProperty = property;\n if (propertyConfigs && typeof internalProperty === \"object\" && internalProperty.propertyConfig) {\n const propertyConfig = propertyConfigs[internalProperty.propertyConfig];\n if (propertyConfig && isPropertyBuilder(propertyConfig.property)) {\n internalProperty = propertyConfig.property;\n } else {\n\n if (propertyConfig) {\n internalProperty = mergeDeep(propertyConfig.property, internalProperty);\n }\n\n if (!isPropertyBuilder(internalProperty) && internalProperty.dataType === \"map\" && internalProperty.properties) {\n const properties: Record<string, PropertyOrBuilder> = {};\n Object.keys(internalProperty.properties).forEach((key) => {\n properties[key] = applyPropertiesConfig(((internalProperty as MapProperty).properties as Properties)[key] as Property, propertyConfigs);\n });\n internalProperty = { ...internalProperty, properties };\n }\n\n }\n }\n return internalProperty;\n\n}\n\nconst validatePath = (value: string, isNewCollection: boolean, existingPaths: string[], idValue?: string) => {\n let error;\n if (!value) {\n error = \"You must specify a path in the database for this collection\";\n }\n // if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n // error = \"There is already a collection which uses this path as an id\";\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()) && !idValue)\n error = \"There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids\";\n\n const subpaths = removeInitialAndTrailingSlashes(value).split(\"/\");\n if (subpaths.length % 2 === 0) {\n error = `Collection paths must have an odd number of segments: ${value}`;\n }\n return error;\n};\n\nconst validateId = (value: string, isNewCollection: boolean, existingPaths: string[], existingIds: string[]) => {\n if (!value) return undefined;\n let error;\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection that uses this value as a path\";\n if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection which uses this id\";\n // if (error) {\n // setAdvancedPanelExpanded(true);\n // }\n return error;\n};\n","import React, { PropsWithChildren, useCallback, useEffect } from \"react\";\nimport equal from \"react-fast-compare\"\n\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport {\n Property,\n useCustomizationController,\n useNavigationController,\n User,\n useSnackbarController\n} from \"@firecms/core\";\nimport { CollectionEditorDialog } from \"./ui/collection_editor/CollectionEditorDialog\";\nimport { useNavigate } from \"react-router\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionEditorPermissionsBuilder } from \"./types/config_permissions\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { PropertyFormDialog } from \"./ui/collection_editor/PropertyEditView\";\nimport { PersistedCollection } from \"./types/persisted_collection\";\n\nexport const ConfigControllerContext = React.createContext<CollectionsConfigController>({} as any);\nexport const CollectionEditorContext = React.createContext<CollectionEditorController>({} as any);\n\nexport interface ConfigControllerProviderProps {\n /**\n * Controller for managing the collections' config.\n */\n collectionConfigController: CollectionsConfigController;\n\n /**\n * Callback used to infer the schema from the data.\n */\n collectionInference?: CollectionInference;\n\n /**\n * Use this builder to define the permissions for the configuration per user.\n */\n configPermissions?: CollectionEditorPermissionsBuilder;\n\n /**\n * Groups that cannot be used to create new collections.\n */\n reservedGroups?: string[];\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: (path?: string) => Promise<string[]>;\n\n getUser: (uid: string) => User | null\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n}\n\nexport const ConfigControllerProvider = React.memo(\n function ConfigControllerProvider({\n children,\n collectionConfigController,\n configPermissions,\n reservedGroups,\n collectionInference,\n extraView,\n pathSuggestions,\n getUser,\n getData,\n onAnalyticsEvent\n }: PropsWithChildren<ConfigControllerProviderProps>) {\n\n const navigation = useNavigationController();\n const navigate = useNavigate();\n const snackbarController = useSnackbarController();\n const { propertyConfigs } = useCustomizationController();\n\n const {\n collections\n } = navigation;\n const existingPaths = collections.map(col => col.path.trim().toLowerCase());\n\n const [rootPathSuggestions, setRootPathSuggestions] = React.useState<string[] | undefined>();\n useEffect(() => {\n if (pathSuggestions) {\n pathSuggestions().then((paths) => {\n setRootPathSuggestions(paths.filter(p => !existingPaths.includes(p.trim().toLowerCase())));\n });\n }\n }, [pathSuggestions]);\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n parentCollection?: PersistedCollection,\n editedCollectionPath?: string,\n fullPath?: string,\n parentCollectionIds: string[],\n initialValues?: {\n path?: string,\n group?: string,\n name?: string\n },\n redirect: boolean\n }>();\n\n const [currentPropertyDialog, setCurrentPropertyDialog] = React.useState<{\n propertyKey?: string,\n property?: Property,\n namespace?: string,\n parentCollection?: PersistedCollection,\n currentPropertiesOrder?: string[],\n editedCollectionPath: string,\n fullPath?: string,\n parentCollectionIds: string[],\n collectionEditable: boolean;\n }>();\n\n const defaultConfigPermissions: CollectionEditorPermissionsBuilder = useCallback(() => ({\n createCollections: true,\n editCollections: true,\n deleteCollections: true\n }), []);\n\n const editCollection = useCallback(({\n path,\n fullPath,\n parentCollectionIds,\n parentCollection\n }: {\n path?: string,\n fullPath?: string,\n parentCollectionIds: string[],\n parentCollection?: PersistedCollection\n }) => {\n console.debug(\"edit collection\", path, fullPath, parentCollectionIds, parentCollection);\n onAnalyticsEvent?.(\"edit_collection\", { path, fullPath });\n setCurrentDialog({\n editedCollectionPath: path,\n fullPath,\n parentCollectionIds,\n isNewCollection: false,\n parentCollection,\n redirect: false\n });\n }, []);\n\n const editProperty = useCallback(({\n propertyKey,\n property,\n editedCollectionPath,\n currentPropertiesOrder,\n parentCollectionIds,\n collection\n }: {\n propertyKey?: string,\n property?: Property,\n currentPropertiesOrder?: string[],\n editedCollectionPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection,\n }) => {\n console.debug(\"edit property\", propertyKey, property, editedCollectionPath, currentPropertiesOrder, parentCollectionIds, collection);\n onAnalyticsEvent?.(\"edit_property\", { propertyKey, editedCollectionPath });\n // namespace is all the path until the last dot\n const namespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(0, propertyKey.lastIndexOf(\".\"))\n : undefined;\n const propertyKeyWithoutNamespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(propertyKey.lastIndexOf(\".\") + 1)\n : propertyKey;\n setCurrentPropertyDialog({\n propertyKey: propertyKeyWithoutNamespace,\n property,\n namespace,\n currentPropertiesOrder,\n editedCollectionPath,\n parentCollectionIds,\n collectionEditable: collection?.editable ?? false\n });\n }, []);\n\n const createCollection = React.useCallback(({\n parentCollectionIds,\n parentCollection,\n initialValues,\n redirect\n }: {\n parentCollectionIds: string[],\n parentCollection?: PersistedCollection\n initialValues?: {\n group?: string,\n path?: string,\n name?: string\n },\n redirect: boolean\n }) => {\n console.debug(\"create collection\", parentCollectionIds, parentCollection, initialValues, redirect);\n onAnalyticsEvent?.(\"create_collection\", { parentCollectionIds, parentCollection, initialValues, redirect });\n setCurrentDialog({\n isNewCollection: true,\n parentCollectionIds,\n parentCollection,\n initialValues,\n redirect\n });\n }, []);\n\n const getPathSuggestions = !pathSuggestions\n ? undefined\n : (path?: string) => {\n if (!path && rootPathSuggestions)\n return Promise.resolve(rootPathSuggestions);\n else {\n return pathSuggestions?.(path);\n }\n }\n\n return (\n <ConfigControllerContext.Provider value={collectionConfigController}>\n <CollectionEditorContext.Provider\n value={{\n editCollection,\n createCollection,\n editProperty,\n configPermissions: configPermissions ?? defaultConfigPermissions,\n rootPathSuggestions\n }}>\n\n {children}\n\n <CollectionEditorDialog\n open={Boolean(currentDialog)}\n configController={collectionConfigController}\n isNewCollection={false}\n collectionInference={collectionInference}\n {...currentDialog}\n getData={getData}\n reservedGroups={reservedGroups}\n extraView={extraView}\n pathSuggestions={getPathSuggestions}\n getUser={getUser}\n handleClose={(collection) => {\n if (currentDialog?.redirect) {\n if (collection && currentDialog?.isNewCollection && !currentDialog.parentCollectionIds.length) {\n const url = navigation.buildUrlCollectionPath(collection.id ?? collection.path);\n navigate(url);\n }\n }\n setCurrentDialog(undefined);\n }}/>\n\n {/* Used for editing properties*/}\n <PropertyFormDialog\n open={Boolean(currentPropertyDialog)}\n includeIdAndName={true}\n existingProperty={Boolean(currentPropertyDialog?.propertyKey)}\n autoUpdateId={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}\n autoOpenTypeSelect={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}\n inArray={false}\n collectionEditable={currentPropertyDialog?.collectionEditable ?? false}\n getData={getData && currentPropertyDialog?.editedCollectionPath\n ? () => {\n console.debug(\"get data for property\", currentPropertyDialog?.editedCollectionPath);\n const resolvedPath = navigation.resolveAliasesFrom(currentPropertyDialog.editedCollectionPath!)\n return getData(resolvedPath, []);\n }\n : undefined}\n onPropertyChanged={({\n id,\n property\n }) => {\n if (!currentPropertyDialog) return;\n if (!id) return;\n const newProperty = !(currentPropertyDialog.propertyKey);\n return collectionConfigController.saveProperty({\n path: currentPropertyDialog?.editedCollectionPath,\n property,\n propertyKey: id,\n newPropertiesOrder: newProperty && currentPropertyDialog.currentPropertiesOrder ? [...currentPropertyDialog.currentPropertiesOrder, id] : undefined,\n namespace: currentPropertyDialog.namespace,\n parentCollectionIds: currentPropertyDialog.parentCollectionIds\n })\n .catch((e) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n }}\n onPropertyChangedImmediate={false}\n onDelete={() => {\n if (!currentPropertyDialog?.propertyKey) return;\n const newPropertiesOrder = currentPropertyDialog?.currentPropertiesOrder?.filter(p => p !== currentPropertyDialog?.propertyKey);\n return collectionConfigController.deleteProperty({\n path: currentPropertyDialog?.editedCollectionPath,\n propertyKey: currentPropertyDialog?.propertyKey,\n namespace: currentPropertyDialog?.namespace,\n newPropertiesOrder,\n parentCollectionIds: currentPropertyDialog?.parentCollectionIds\n })\n .then(() => {\n setCurrentPropertyDialog(undefined);\n }).catch((e) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error deleting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n }}\n onError={() => {\n }}\n onOkClicked={() => {\n setCurrentPropertyDialog(undefined);\n }}\n onCancel={() => {\n setCurrentPropertyDialog(undefined);\n }}\n initialErrors={{}}\n forceShowErrors={false}\n existingPropertyKeys={[]}\n allowDataInference={true}\n propertyConfigs={propertyConfigs}\n property={currentPropertyDialog?.property}\n propertyKey={currentPropertyDialog?.propertyKey}/>\n\n </CollectionEditorContext.Provider>\n\n </ConfigControllerContext.Provider>\n );\n }, equal);\n","import { useContext } from \"react\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionEditorContext } from \"./ConfigControllerProvider\";\n\n/**\n * Hook to access the collection editor controller.\n * The methods in this controller can be used to open the collection editor dialog.\n */\nexport const useCollectionEditorController = (): CollectionEditorController => useContext(CollectionEditorContext);\n","import { useContext } from \"react\";\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport { ConfigControllerContext } from \"./ConfigControllerProvider\";\n\n/**\n * Use this hook to access the configuration controller.\n * You can use it to get the list of collections, and to save/delete collections.\n */\nexport const useCollectionsConfigController = (): CollectionsConfigController => useContext(ConfigControllerContext);\n","import equal from \"react-fast-compare\"\n\nimport {\n CollectionActionsProps,\n mergeDeep,\n useAuthController,\n useNavigationController,\n useSnackbarController\n} from \"@firecms/core\";\nimport { Button, IconButton, SaveIcon, SettingsIcon, Tooltip, UndoIcon, } from \"@firecms/ui\";\n\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { useCollectionsConfigController } from \"../useCollectionsConfigController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function EditorCollectionAction({\n path: fullPath,\n parentCollectionIds,\n collection,\n tableController\n }: CollectionActionsProps) {\n\n const authController = useAuthController();\n const navigationController = useNavigationController();\n const collectionEditorController = useCollectionEditorController();\n const configController = useCollectionsConfigController();\n const snackbarController = useSnackbarController();\n\n const parentCollection = navigationController.getCollectionFromIds(parentCollectionIds);\n\n const canEditCollection = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n collection\n }).editCollections\n : true;\n\n let saveDefaultFilterButton = null;\n if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.initialFilter)) ||\n !equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {\n saveDefaultFilterButton = <>\n {collection.initialFilter || collection.initialSort && <Tooltip\n title={\"Reset to default filter and sort\"}>\n <Button\n color={\"primary\"}\n size={\"small\"}\n variant={\"text\"}\n onClick={() => {\n tableController.clearFilter?.();\n if (collection?.initialFilter)\n tableController.setFilterValues?.(collection?.initialFilter);\n if (collection?.initialSort)\n tableController.setSortBy?.(collection?.initialSort);\n }}>\n <UndoIcon/>\n </Button>\n </Tooltip>}\n\n <Tooltip\n title={tableController.sortBy || tableController.filterValues ? \"Save default filter and sort\" : \"Clear default filter and sort\"}>\n <Button\n color={\"primary\"}\n size={\"small\"}\n variant={\"outlined\"}\n onClick={() => configController\n ?.saveCollection({\n id: collection.path,\n parentCollectionIds,\n collectionData: mergeDeep(collection as PersistedCollection,\n {\n initialFilter: tableController.filterValues ?? null,\n initialSort: tableController.sortBy ?? null\n })\n }).then(() => {\n snackbarController.open({\n type: \"success\",\n message: \"Default config saved\"\n });\n })}>\n <SaveIcon/>\n </Button>\n </Tooltip>\n </>;\n }\n\n const editorButton = <Tooltip\n title={canEditCollection ? \"Edit collection\" : \"You don't have permissions to edit this collection\"}>\n <IconButton\n color={\"primary\"}\n disabled={!canEditCollection}\n onClick={canEditCollection\n ? () => collectionEditorController?.editCollection({ path: collection.path, fullPath, parentCollectionIds, parentCollection: parentCollection as PersistedCollection })\n : undefined}>\n <SettingsIcon/>\n </IconButton>\n </Tooltip>;\n\n return <>\n {canEditCollection && saveDefaultFilterButton}\n {editorButton}\n </>\n\n}\n\nfunction getObjectOrNull(o?: object): object | null {\n if (o && Object.keys(o).length === 0)\n return o\n return o ?? null;\n}\n","import {\n DeleteConfirmationDialog,\n PluginHomePageActionsProps,\n useAuthController,\n useSnackbarController\n} from \"@firecms/core\";\nimport { DeleteIcon, IconButton, Menu, MenuItem, MoreVertIcon, SettingsIcon, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { useCallback, useState } from \"react\";\nimport { useCollectionsConfigController } from \"../useCollectionsConfigController\";\n\nexport function HomePageEditorCollectionAction({\n path,\n collection\n }: PluginHomePageActionsProps) {\n\n const snackbarController = useSnackbarController();\n const authController = useAuthController();\n const configController = useCollectionsConfigController();\n const collectionEditorController = useCollectionEditorController();\n\n const permissions = collectionEditorController.configPermissions({\n user: authController.user,\n collection\n });\n\n const onEditCollectionClicked = useCallback(() => {\n collectionEditorController?.editCollection({ path, parentCollectionIds: [] });\n }, [collectionEditorController, path]);\n\n const [deleteRequested, setDeleteRequested] = useState(false);\n\n const deleteCollection = useCallback(() => {\n configController?.deleteCollection({ path }).then(() => {\n setDeleteRequested(false);\n snackbarController.open({\n message: \"Collection deleted\",\n type: \"success\"\n });\n });\n }, [path, configController]);\n\n return <>\n\n <div>\n {permissions.deleteCollections &&\n <Menu\n trigger={<IconButton>\n <MoreVertIcon size={\"small\"}/>\n </IconButton>}\n >\n <MenuItem onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n setDeleteRequested(true);\n }}>\n <DeleteIcon/>\n Delete\n </MenuItem>\n\n </Menu>\n\n }\n\n {permissions.editCollections &&\n <IconButton\n onClick={(event) => {\n onEditCollectionClicked();\n }}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>}\n </div>\n\n <DeleteConfirmationDialog\n open={deleteRequested}\n onAccept={deleteCollection}\n onCancel={() => setDeleteRequested(false)}\n title={<>Delete this collection?</>}\n body={<> This will <b>not\n delete any data</b>, only\n the collection in the CMS</>}/>\n </>;\n\n}\n","import { PluginHomePageAdditionalCardsProps, useAuthController } from \"@firecms/core\";\nimport { AddIcon, Card, cn, Typography } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\n\nexport function NewCollectionCard({\n group,\n context\n }: PluginHomePageAdditionalCardsProps) {\n\n if (!context.navigation.topLevelNavigation)\n throw Error(\"Navigation not ready in FireCMSHomePage\");\n\n const authController = useAuthController();\n\n const collectionEditorController = useCollectionEditorController();\n const canCreateCollections = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n }).createCollections\n : true;\n\n return (\n <Card className={cn(\"h-full p-4 min-h-[124px]\")}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n initialValues: group ? { group } : undefined,\n parentCollectionIds: [],\n redirect: true\n })\n : undefined}>\n\n <div\n className=\"flex flex-col items-start h-full w-full items-center justify-center h-full w-full flex-grow flex-col\">\n <AddIcon color=\"primary\" size={\"large\"}/>\n <Typography color=\"primary\"\n variant={\"caption\"}\n className={\"font-medium\"}>{\"Add new collection\".toUpperCase()}</Typography>\n\n {!canCreateCollections &&\n <Typography variant={\"caption\"}>You don&apos;t have permissions to create\n collections</Typography>\n }\n </div>\n\n </Card>\n );\n}\n","import { unslugify, useAuthController, useNavigationController } from \"@firecms/core\";\nimport { AddIcon, Chip, Collapse, Typography, } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport React from \"react\";\n\nexport function RootCollectionSuggestions() {\n\n const authController = useAuthController();\n const navigationController = useNavigationController();\n\n const collectionEditorController = useCollectionEditorController();\n const canCreateCollections = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user\n }).createCollections\n : true;\n\n const rootPathSuggestions = collectionEditorController.rootPathSuggestions ?? [];\n\n const showSuggestions = rootPathSuggestions.length > 3 || (navigationController.collections.length === 0 && rootPathSuggestions.length > 0);\n return <Collapse\n in={showSuggestions}>\n\n <div\n className={\"flex flex-col gap-1 p-2 my-4\"}>\n\n <Typography variant={\"body2\"} color={\"secondary\"}>\n Create a collection from your data:\n </Typography>\n\n <div\n className={\"flex flex-row gap-1 overflow-scroll no-scrollbar \"}>\n {rootPathSuggestions.map((path) => {\n return (\n <div key={path}>\n <Chip\n icon={<AddIcon size={\"small\"}/>}\n colorScheme={\"cyanLighter\"}\n onClick={collectionEditorController && canCreateCollections\n ? () => collectionEditorController.createCollection({\n initialValues: { path, name: unslugify(path) },\n parentCollectionIds: [],\n redirect: true\n })\n : undefined}\n size=\"small\">\n {path}\n </Chip>\n </div>\n );\n })}\n </div>\n </div>\n </Collapse>\n}\n","import { ResolvedProperty } from \"@firecms/core\";\nimport { IconButton, SettingsIcon, Tooltip } from \"@firecms/ui\";\nimport React from \"react\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function CollectionViewHeaderAction({\n propertyKey,\n onHover,\n property,\n fullPath,\n parentCollectionIds,\n collection\n }: {\n property: ResolvedProperty,\n propertyKey: string,\n onHover: boolean,\n fullPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection;\n}) {\n\n const collectionEditorController = useCollectionEditorController();\n\n return (\n <Tooltip title={\"Edit\"}>\n <IconButton\n className={onHover ? \"bg-white dark:bg-gray-950\" : \"hidden\"}\n onClick={() => {\n collectionEditorController.editProperty({\n propertyKey,\n property,\n editedCollectionPath: fullPath,\n parentCollectionIds,\n collection\n });\n }}\n size={\"small\"}>\n <SettingsIcon size={\"small\"}/>\n </IconButton>\n </Tooltip>\n )\n}\n","import { getDefaultPropertiesOrder, useAuthController } from \"@firecms/core\";\nimport { AddIcon, Tooltip } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { PersistedCollection } from \"../types/persisted_collection\";\n\nexport function PropertyAddColumnComponent({\n fullPath,\n parentCollectionIds,\n collection\n }: {\n fullPath: string,\n parentCollectionIds: string[],\n collection: PersistedCollection;\n}) {\n\n const authController = useAuthController();\n const collectionEditorController = useCollectionEditorController();\n const canEditCollection = collectionEditorController.configPermissions\n ? collectionEditorController.configPermissions({\n user: authController.user,\n collection\n }).editCollections\n : true;\n\n return (\n <Tooltip title={canEditCollection ? \"Add new property\" : \"You don't have permission to add new properties\"}>\n <div\n className={\"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-gray-100 bg-opacity-40 hover:bg-gray-100 dark:bg-gray-950 dark:bg-opacity-40 dark:hover:bg-gray-950\"}\n // className={onHover ? \"bg-white dark:bg-gray-950\" : undefined}\n onClick={() => {\n collectionEditorController.editProperty({\n editedCollectionPath: fullPath,\n parentCollectionIds,\n currentPropertiesOrder: getDefaultPropertiesOrder(collection),\n collection\n });\n }}>\n <AddIcon color={\"inherit\"}/>\n </div>\n </Tooltip>\n )\n}\n","import { AddIcon, Button } from \"@firecms/ui\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\n\nexport function NewCollectionButton() {\n const collectionEditorController = useCollectionEditorController();\n return <Button className={\"min-w-fit\"}\n variant={\"outlined\"}\n onClick={() => collectionEditorController.createCollection({\n parentCollectionIds: [],\n redirect: true\n })\n }>\n <AddIcon/>\n New collection\n </Button>\n}\n","import React from \"react\";\nimport {\n EntityCollection,\n FireCMSPlugin,\n joinCollectionLists,\n makePropertiesEditable,\n ModifyCollectionProps,\n Properties,\n User\n} from \"@firecms/core\";\nimport { ConfigControllerProvider } from \"./ConfigControllerProvider\";\nimport { CollectionEditorPermissionsBuilder } from \"./types/config_permissions\";\nimport { EditorCollectionAction } from \"./ui/EditorCollectionAction\";\nimport { HomePageEditorCollectionAction } from \"./ui/HomePageEditorCollectionAction\";\nimport { NewCollectionCard } from \"./ui/NewCollectionCard\";\nimport { PersistedCollection } from \"./types/persisted_collection\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport { RootCollectionSuggestions } from \"./ui/RootCollectionSuggestions\";\nimport { CollectionViewHeaderAction } from \"./ui/CollectionViewHeaderAction\";\nimport { PropertyAddColumnComponent } from \"./ui/PropertyAddColumnComponent\";\nimport { NewCollectionButton } from \"./ui/NewCollectionButton\";\n\nexport interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, UserType extends User = User> {\n\n /**\n * Firebase app where the configuration is saved.\n */\n collectionConfigController: CollectionsConfigController;\n\n modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | void;\n\n /**\n * Define what actions can be performed on the configuration.\n */\n configPermissions?: CollectionEditorPermissionsBuilder<UserType, EC>;\n\n /**\n * The words you define here will not be allowed to be used as group\n * names when creating collections.\n * e.g. [\"admin\"]\n */\n reservedGroups: string[];\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: (path: string) => Promise<string[]>;\n\n collectionInference?: CollectionInference;\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n getUser: (uid: string) => UserType | null;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n}\n\n/**\n * Use this hook to initialise the Collection Editor plugin.\n * This is likely the only hook you will need to use.\n * @param firebaseApp Firebase app where your project data lives.\n * @param configPermissions\n * @param reservedGroups\n * @param extraView\n * @param pathSuggestions\n * @param getUser\n * @param collectionInference\n */\nexport function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>\n({\n collectionConfigController,\n modifyCollection,\n configPermissions,\n reservedGroups,\n extraView,\n pathSuggestions,\n getUser,\n collectionInference,\n getData,\n onAnalyticsEvent\n }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection> {\n\n const injectCollections = (baseCollections: EntityCollection[]) => {\n\n const markAsEditable = (c: PersistedCollection) => {\n makePropertiesEditable(c.properties as Properties);\n c.subcollections?.forEach(markAsEditable);\n };\n const storedCollections = collectionConfigController.collections ?? [];\n storedCollections.forEach(markAsEditable);\n\n console.debug(\"Collections specified in code:\", baseCollections);\n console.debug(\"Collections stored in the backend\", storedCollections);\n const result = joinCollectionLists(baseCollections, storedCollections, [], modifyCollection);\n console.debug(\"Collections after joining:\", result);\n return result;\n };\n\n return {\n name: \"Collection Editor\",\n loading: collectionConfigController.loading,\n collections: {\n injectCollections,\n CollectionActions: EditorCollectionAction\n },\n provider: {\n Component: ConfigControllerProvider,\n props: {\n collectionConfigController,\n configPermissions,\n collectionInference,\n reservedGroups,\n extraView,\n pathSuggestions,\n getUser,\n getData,\n onAnalyticsEvent\n }\n },\n homePage: {\n additionalActions: <NewCollectionButton/>,\n additionalChildrenEnd: <RootCollectionSuggestions/>,\n CollectionActions: HomePageEditorCollectionAction,\n AdditionalCards: NewCollectionCard,\n },\n collectionView: {\n HeaderAction: CollectionViewHeaderAction,\n AddColumnComponent: PropertyAddColumnComponent\n }\n };\n}\n","import { ErrorView, unslugify, useNavigationController } from \"@firecms/core\";\nimport { useCollectionEditorController } from \"../useCollectionEditorController\";\nimport { Button } from \"@firecms/ui\";\n\nexport function MissingReferenceWidget({ path: pathProp }: {\n path: string\n}) {\n const navigation = useNavigationController();\n const path = getLastSegment(pathProp);\n const parentCollectionIds = navigation.getParentCollectionIds(pathProp);\n const collectionEditor = useCollectionEditorController();\n return <div className={\"p-1 flex flex-col items-center\"}>\n <ErrorView error={\"No collection for path: \" + path}/>\n <Button className={\"mx-2\"} variant={\"outlined\"} size={\"small\"}\n onClick={() => {\n collectionEditor.createCollection({\n initialValues: { path, name: unslugify(path) },\n parentCollectionIds,\n redirect: false\n });\n }}>\n Create\n </Button>\n </div>;\n}\n\nfunction getParentPathSegments(path: string): string[] {\n const segments = path.split(\"/\");\n return segments.filter((segment, index) => index % 2 === 0 && index !== segments.length - 1);\n}\n\nfunction getLastSegment(path: string): string {\n const segments = path.split(\"/\");\n return segments[segments.length - 1];\n}\n"],"names":["YupSchema","Yup","FieldHelperView","error","children","jsx","Typography","CollectionDetailsForm","isNewCollection","reservedGroups","existingPaths","existingIds","groups","parentCollection","groupRef","React","values","setFieldValue","handleChange","touched","errors","setFieldTouched","isSubmitting","submitCount","useFormikContext","iconDialogOpen","setIconDialogOpen","useState","advancedPanelExpanded","setAdvancedPanelExpanded","updateName","name","getIn","toSnakeCase","singular","useEffect","collectionIcon","IconForView","groupOptions","group","inputFocused","autoCompleteOpen","setAutoCompleteOpen","useAutoComplete","isSubcollection","customIdValue","Container","jsxs","Tooltip","IconButton","Chip","TextField","e","cn","Field","DebouncedTextField","event","Autocomplete","index","AutocompleteItem","ExpandablePanel","SettingsIcon","Select","value","SelectItem","v","BooleanSwitchWithLabel","Dialog","SearchIconsView","icon","idToPropertiesPath","id","namespaceToPropertiesPath","namespace","namespaceToPropertiesOrderPath","getFullId","propertyKey","propertyNamespace","EnumForm","enumValues","onValuesChanged","onError","updateIds","disabled","allowDataInference","getData","Formik","data","formikHelpers","EnumFormFields","prevProps","nextProps","enumValuesPath","shouldUpdateId","lastInternalIdAdded","setLastInternalIdAdded","editDialogIndex","setEditDialogIndex","inferring","setInferring","inferredValues","buildEntry","internalId","justAdded","EnumEntry","ListIcon","Button","flatData","fieldData","currentEnumValues","newEnumValues","extractEnumFromValues","enumValue","CircularProgress","AutoAwesomeIcon","Paper","FormikArrayContainer","EnumEntryDialog","updateId","autoFocus","onDialogOpen","inferredEntry","shouldUpdateIdRef","idValue","labelValue","labelError","currentLabelRef","FastField","validateLabel","open","onClose","idError","DialogContent","validateId","DialogActions","GeneralPropertyValidation","validationRequired","validationRequiredMessage","Fragment","SwitchControl","StringPropertyValidation","length","lowercase","matches","max","min","trim","uppercase","showErrors","validationLength","validationMin","validationMax","validationTrim","validationMatches","validationLowercase","validationUppercase","matchesError","matchesValue","matchesStringValue","serializeRegExp","isValidRegExp","ArrayPropertyValidation","ValidationPanel","RuleIcon","EnumPropertyField","multiselect","setFieldError","snackbarContext","useSnackbarController","defaultValue","valuesEnumValues","useMemo","resolveEnumValues","hasError","res","d","enumIds","fileTypes","StoragePropertyField","multiple","existing","baseStoragePath","acceptedFiles","fileName","storagePath","storeUrl","fileNameValue","storagePathValue","storedValue","fileTypesValue","allFileTypesSelected","handleTypesChange","hasFilenameCallback","hasStoragePathCallback","FileUploadIcon","MultiSelect","selected","MultiSelectItem","Checkbox","label","editableProperty","property","isPropertyBuilder","eProperty","removeNonEditableProperties","properties","_","key","propertyOrBuilder","a","b","PropertyFieldPreview","onClick","includeName","includeEditButton","propertyConfigs","useCustomizationController","propertyConfig","getFieldConfig","ErrorBoundary","PropertyConfigBadge","cardMixin","cardClickableMixin","cardSelectedMixin","NonEditablePropertyPreview","FunctionsIcon","RemoveCircleIcon","PropertyTree","selectedPropertyKey","onPropertyClick","propertiesOrderProp","additionalFields","onPropertyMove","onPropertyRemove","className","inferredPropertyKeys","collectionEditable","propertiesOrder","onDragEnd","useCallback","result","startIndex","endIndex","newPropertiesOrder","removed","DragDropContext","Droppable","droppableProvided","droppableSnapshot","additionalField","field","Draggable","provided","snapshot","PropertyTreeEntry","isPropertyInferred","fullId","subtree","editable","defaultBorderMixin","RemoveIcon","DragHandleIcon","MapPropertyField","propertyDialogOpen","setPropertyDialogOpen","setSelectedPropertyKey","selectedPropertyNamespace","setSelectedPropertyNamespace","onPropertyCreated","deleteProperty","propertiesPath","propertiesOrderPath","currentPropertiesOrder","p","selectedPropertyFullId","selectedProperty","addChildButton","AddIcon","empty","PropertyFormDialog","RepeatPropertyField","ofProperty","ofPropertyError","onPropertyChanged","widget","CommonPropertyFields","disabledId","existingPropertyKeys","autoUpdateId","isNewProperty","ref","nameError","description","descriptionError","newNameValue","validateName","newIdValue","unslugify","idRegEx","StringPropertyField","widgetId","BooleanPropertyField","BlockPropertyField","NumberPropertyValidation","validationLessThan","validationMoreThan","validationPositive","validationNegative","validationInteger","NumberPropertyField","ReferencePropertyField","useNavigationController","pathPath","pathValue","pathError","validatePath","CollectionsSelect","props","navigation","collections","ungroupedCollections","col","selectedCollection","collection","SelectGroup","DateTimePropertyField","modePath","modeValue","modeError","autoValuePath","autoValueValue","autoValueError","AdvancedPropertyValidation","KeyValuePropertyField","updatePropertyFromWidget","propertyData","selectedWidgetId","updatedProperty","mergeDeep","PropertySelectItem","optionDisabled","UrlPropertyField","urlValue","supportedFieldsIds","supportedFields","DEFAULT_FIELD_CONFIGS","config","PropertyForm","includeIdAndName","autoOpenTypeSelect","existingProperty","inArray","onPropertyChangedImmediate","onDelete","initialErrors","forceShowErrors","getHelpers","initialValue","lastSubmittedProperty","useRef","doOnPropertyChanged","params","newPropertyWithId","helpers","PropertyEditView","onCancel","onOkClicked","formProps","helpersRef","setValues","includeIdAndTitle","selectOpen","setSelectOpen","deleteDialogOpen","setDeleteDialogOpen","selectedFieldConfigId","setSelectedFieldConfigId","getFieldId","allSupportedFields","displayedWidgets","deferredValues","useDeferredValue","nameFieldRef","selectedWidgetError","equal","onWidgetSelectChanged","newSelectedWidgetId","childComponent","InfoLabel","baseProperty","baseFieldConfig","computedFieldConfig","DeleteIcon","DeleteConfirmationDialog","camelCase","str","cur","acc","GetCodeDialog","onOpenChange","snackbarController","code","JSON5","collectionToCode","Highlight","themes","style","tokens","getLineProps","getTokenProps","line","i","token","ContentCopyIcon","propertyCleanup","CollectionPropertiesEditorForm","propertyErrorsRef","onPropertyError","setDirty","extraIcon","getUser","doCollectionInference","dirty","largeLayout","useLargeLayout","asDialog","selectedPropertyIndex","setSelectedPropertyIndex","codeDialogOpen","setCodeDialogOpen","inferringProperties","setInferringProperties","newPropertyDialogOpen","setNewPropertyDialogOpen","setInferredPropertyKeys","currentPropertiesOrderRef","inferPropertiesFromData","newCollection","makePropertiesEditable","newPropertyKeys","updatedProperties","updatedPropertiesOrder","updatePropertiesOrder","getCurrentPropertiesOrder","previousId","propertyPath","previousFullId","previousPropertyPath","onPropertyErrorInternal","closePropertyDialog","emptyCollection","usedPropertiesOrder","owner","body","CodeIcon","UnsavedChangesDialog","handleOk","handleCancel","title","EntityCustomViewsSelectDialog","entityViews","view","SubcollectionsEditTab","configController","collectionInference","parentCollectionIds","contextEntityViews","subcollectionToDelete","setSubcollectionToDelete","addEntityViewDialogOpen","setAddEntityViewDialogOpen","viewToDelete","setViewToDelete","currentDialog","setCurrentDialog","subcollections","resolvedEntityViews","resolveEntityView","hardCodedEntityViews","totalEntityViews","Table","TableBody","subcollection","TableRow","TableCell","CollectionEditorDialog","selectedViewKey","productsCollectionTemplate","blogCollectionTemplate","usersCollectionTemplate","pagesCollectionTemplate","CollectionEditorWelcomeView","path","pathSuggestions","onContinue","loadingPathSuggestions","setLoadingPathSuggestions","filteredPathSuggestions","setFilteredPathSuggestions","suggestions","filteredSuggestions","c","s","suggestion","TemplateButton","Icon","ImportFileUpload","subtitle","Card","CollectionEditorImportMapping","importConfig","setSelectedProperty","newHeadersMapping","onPropertyTypeChanged","importKey","inferredNewProperty","buildPropertyFromData","getInferenceType","DataNewPropertiesMapping","ImportNewPropertyFieldPreview","PropertySelect","fieldId","newProperty","CollectionEditorImportDataPreview","propertiesMapping","getPropertiesMapping","mappedData","convertDataToEntity","selectionController","useSelectionController","EntityCollectionTable","cleanPropertiesFromImport","parentSlug","slug","slugify","fullSlug","slugifiedResult","firstKey","idColumn","formDirty","setFormDirty","unsavedChangesDialogOpen","setUnsavedChangesDialogOpen","CollectionEditorDialogInternal","initialValuesProp","editedCollectionPath","fullPath","handleClose","extraView","topLevelNavigation","includeTemplates","collectionsInThisLevel","useImportConfig","authController","useAuthController","initialView","currentView","setCurrentView","setError","setCollection","initialLoadingCompleted","setInitialLoadingCompleted","initialError","setInitialError","saveCollection","updatedCollection","initialCollection","randomString","initialValues","applyPropertyConfigs","coolIconKeys","setNextMode","inferCollectionFromData","inferredCollection","onSubmit","newCollectionState","CircularProgressCenter","updatedFullPath","parentPaths","resolvedPath","getDataWithPath","onImportDataSet","buildEntityPropertiesFromData","validValues","onImportMappingComplete","Tabs","Tab","Form","ImportSaveInProgress","importedCollection","removeUndefined","ErrorView","ArrowBackIcon","LoadingButton","DoneIcon","rest","propertiesResult","applyPropertiesConfig","internalProperty","removeInitialAndTrailingSlashes","ConfigControllerContext","CollectionEditorContext","ConfigControllerProvider","collectionConfigController","configPermissions","onAnalyticsEvent","navigate","useNavigate","rootPathSuggestions","setRootPathSuggestions","paths","currentPropertyDialog","setCurrentPropertyDialog","defaultConfigPermissions","editCollection","editProperty","propertyKeyWithoutNamespace","createCollection","redirect","getPathSuggestions","url","useCollectionEditorController","useContext","useCollectionsConfigController","EditorCollectionAction","tableController","navigationController","collectionEditorController","canEditCollection","saveDefaultFilterButton","getObjectOrNull","UndoIcon","SaveIcon","o","HomePageEditorCollectionAction","permissions","onEditCollectionClicked","deleteRequested","setDeleteRequested","deleteCollection","Menu","MoreVertIcon","MenuItem","NewCollectionCard","context","canCreateCollections","RootCollectionSuggestions","showSuggestions","Collapse","CollectionViewHeaderAction","onHover","PropertyAddColumnComponent","getDefaultPropertiesOrder","NewCollectionButton","useCollectionEditorPlugin","modifyCollection","injectCollections","baseCollections","markAsEditable","storedCollections","joinCollectionLists","MissingReferenceWidget","pathProp","getLastSegment","collectionEditor","segments"],"mappings":";;;;;;;;;;;;;;AAEO,MAAMA,KAAYC,GAAI,OAAO,EAAE,MAAM;AAAA,EACxC,IAAIA,GAAI,SAAS,SAAS,UAAU;AAAA,EACpC,MAAMA,GAAI,SAAS,SAAS,UAAU;AAAA,EACtC,MAAMA,GAAI,SAAS,SAAS,UAAU;AAC1C,CAAC;ACJM,SAASC,EAAgB;AAAA,EACI,OAAAC;AAAA,EACA,UAAAC;AACJ,GAAoD;AAChF,SAAKA,IAED,gBAAAC,EAACC,GAAW,EAAA,SAAS,WAAW,OAAOH,IAAQ,UAAU,aAAa,WAAW,iBAC5E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