@rebasepro/cms 0.21.0 → 0.21.1

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":"import-BciQBH5t.js","names":[],"sources":["../src/data_import/import/ImportCollectionAction.tsx","../src/data_import/import/index.ts"],"sourcesContent":["import React, { useCallback, useEffect } from \"react\";\nimport {\n useAuthController,\n useCustomizationController,\n useSnackbarController\n} from \"@rebasepro/app\";\nimport { getPropertiesWithPropertiesOrder, getPropertyInPath } from \"../../util\";\nimport { Properties, Property, User } from \"@rebasepro/types\";\nimport { CollectionActionsProps, AdminCollection } from \"@rebasepro/cms-types\";\nimport { getFieldConfig } from \"../../components/field_configs\";\nimport { PropertyConfigBadge } from \"../../components/PropertyConfigBadge\";\nimport { useSelectionController } from \"../../components/CollectionViewBinding/useSelectionController\";\nimport { CollectionTableBinding } from \"../../components/CollectionTableBinding/CollectionTableBinding\";\nimport { useCollectionRegistryController } from \"../../hooks\";\nimport {\n Button,\n cls,\n defaultBorderMixin,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n IconButton,\n iconSize,\n Select,\n SelectItem,\n Tooltip,\n Typography,\n UploadIcon\n} from \"@rebasepro/ui\";\nimport { buildEntityPropertiesFromData } from \"@rebasepro/inference\";\nimport { useImportConfig } from \"../hooks\";\nimport { convertDataToEntity, getInferenceType } from \"../utils\";\nimport { DataNewPropertiesMapping } from \"../components/DataNewPropertiesMapping\";\nimport { ImportFileUpload } from \"../components/ImportFileUpload\";\nimport { ImportSaveInProgress } from \"../components/ImportSaveInProgress\";\nimport { ImportConfig } from \"../types\";\nimport { isPrototypePollutingKey, slugify } from \"@rebasepro/utils\";\n\ntype ImportState = \"initial\" | \"mapping\" | \"preview\" | \"import_data_saving\";\n\nexport function ImportCollectionAction<M extends Record<string, unknown>, USER extends User>({\n collection,\n path,\n onAnalyticsEvent\n}: CollectionActionsProps<M, USER> & {\n onAnalyticsEvent?: (event: string, params?: any) => void;\n}\n) {\n\n const snackbarController = useSnackbarController();\n\n const [open, setOpen] = React.useState(false);\n\n const [step, setStep] = React.useState<ImportState>(\"initial\");\n\n const importConfig = useImportConfig();\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n onAnalyticsEvent?.(\"import_open\");\n setStep(\"initial\");\n }, [onAnalyticsEvent]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const onMappingComplete = useCallback(() => {\n onAnalyticsEvent?.(\"import_mapping_complete\");\n setStep(\"preview\");\n }, [onAnalyticsEvent]);\n\n const onPreviewComplete = useCallback(() => {\n onAnalyticsEvent?.(\"import_data_save\");\n setStep(\"import_data_saving\");\n }, [onAnalyticsEvent]);\n\n const onDataAdded = async (data: object[]) => {\n importConfig.setImportData(data);\n\n if (data.length > 0) {\n const originProperties = await buildEntityPropertiesFromData(data, getInferenceType);\n importConfig.setOriginProperties(originProperties as Properties);\n\n const headersMapping = buildHeadersMappingFromData(data, collection?.properties);\n importConfig.setHeadersMapping(headersMapping);\n const firstKey = Object.keys(headersMapping)?.[0];\n if (firstKey?.includes(\"id\") || firstKey?.includes(\"key\")) {\n importConfig.setIdColumn(firstKey);\n }\n }\n setTimeout(() => {\n onAnalyticsEvent?.(\"import_data_added\");\n setStep(\"mapping\");\n }, 100);\n };\n\n const properties = getPropertiesWithPropertiesOrder(collection.properties, collection.propertiesOrder as Extract<keyof M, string>[]);\n\n const propertiesAndLevel = Object.entries(properties)\n .flatMap(([key, property]) => getPropertiesAndLevel(key, property, 0));\n const propertiesOrder = (collection.propertiesOrder ?? Object.keys(collection.properties)) as Extract<keyof M, string>[];\n\n return <>\n\n <Tooltip title={\"Import\"}\n asChild={true}>\n <IconButton\n size={\"small\"}\n color={\"primary\"} onClick={handleClickOpen}>\n <UploadIcon size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n\n <Dialog open={open}\n fullWidth={step !== \"initial\"}\n fullHeight={step !== \"initial\"}\n maxWidth={step === \"initial\" ? \"lg\" : \"7xl\"}>\n\n <DialogTitle variant={\"h6\"} hidden={step === \"preview\"}>Import data</DialogTitle>\n\n <DialogContent className={\"h-full flex flex-col gap-4 my-4\"} fullHeight={step === \"preview\"}>\n\n {step === \"initial\" && <>\n <Typography variant={\"body2\"}>Upload a CSV, Excel or JSON file and map it to your existing\n schema</Typography>\n <ImportFileUpload onDataAdded={onDataAdded}/>\n </>}\n\n {step === \"mapping\" && <>\n <DataNewPropertiesMapping importConfig={importConfig}\n destinationProperties={properties}\n buildPropertyView={({\n isIdColumn,\n property,\n propertyKey,\n importKey\n }) => {\n return <PropertyTreeSelect\n selectedPropertyKey={propertyKey ?? \"\"}\n properties={properties}\n propertiesAndLevel={propertiesAndLevel}\n isIdColumn={isIdColumn}\n onIdSelected={() => {\n importConfig.setIdColumn(importKey);\n }}\n onPropertySelected={(newPropertyKey) => {\n\n onAnalyticsEvent?.(\"import_mapping_field_updated\");\n const newHeadersMapping: Record<string, string | null> = Object.entries(importConfig.headersMapping)\n .map(([currentImportKey, currentPropertyKey]) => {\n if (currentPropertyKey === newPropertyKey) {\n return { [currentImportKey]: null };\n }\n if (currentImportKey === importKey) {\n return { [currentImportKey]: newPropertyKey };\n }\n return { [currentImportKey]: currentPropertyKey };\n })\n .reduce((acc, curr) => ({ ...acc,\n...curr }), {});\n importConfig.setHeadersMapping(newHeadersMapping as Record<string, string>);\n\n if (newPropertyKey === importConfig.idColumn) {\n importConfig.setIdColumn(undefined);\n }\n\n }}\n />;\n }}/>\n </>}\n\n {step === \"preview\" && <ImportDataPreview importConfig={importConfig}\n properties={properties}\n propertiesOrder={propertiesOrder}/>}\n\n {step === \"import_data_saving\" && importConfig &&\n <ImportSaveInProgress importConfig={importConfig}\n collection={collection as AdminCollection}\n path={path}\n onImportSuccess={(importedCollection) => {\n handleClose();\n snackbarController.open({\n type: \"info\",\n message: \"Data imported successfully\"\n });\n }}\n />}\n\n </DialogContent>\n <DialogActions>\n\n {step === \"mapping\" && <Button\n onClick={() => setStep(\"initial\")}\n variant={\"text\"}>\n Back\n </Button>}\n\n {step === \"preview\" && <Button\n onClick={() => setStep(\"mapping\")}\n variant={\"text\"}>\n Back\n </Button>}\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n Cancel\n </Button>\n\n {step === \"mapping\" && <Button variant=\"filled\"\n color={\"primary\"}\n onClick={onMappingComplete}>\n Next\n </Button>}\n\n {step === \"preview\" && <Button variant=\"filled\"\n color={\"primary\"}\n onClick={onPreviewComplete}>\n Save data\n </Button>}\n\n </DialogActions>\n </Dialog>\n\n </>;\n}\n\nconst internalIDValue = \"__internal_id__\";\n\nfunction PropertyTreeSelect({\n selectedPropertyKey,\n properties,\n onPropertySelected,\n onIdSelected,\n propertiesAndLevel,\n isIdColumn\n}: {\n selectedPropertyKey: string | null;\n properties: Record<string, Property>;\n onPropertySelected: (propertyKey: string | null) => void;\n onIdSelected: () => void;\n propertiesAndLevel: PropertyAndLevel[];\n isIdColumn?: boolean;\n}) {\n\n const selectedProperty = selectedPropertyKey ? getPropertyInPath(properties, selectedPropertyKey) : null;\n\n const renderValue = useCallback((selectedPropertyKey: string) => {\n\n if (selectedPropertyKey === internalIDValue) {\n return <Typography variant={\"body2\"} className={\"p-4\"}>Use this column as ID</Typography>;\n }\n\n if (!selectedPropertyKey || !selectedProperty) {\n return <Typography variant={\"body2\"} color=\"disabled\" className={\"p-4\"}>Do not import this\n property</Typography>;\n }\n\n return <PropertySelectEntry propertyKey={selectedPropertyKey}\n property={selectedProperty as Property}/>;\n }, [selectedProperty]);\n\n const onSelectValueChange = (value: string) => {\n if (value === internalIDValue) {\n onIdSelected();\n onPropertySelected(null);\n } else if (value === \"__do_not_import\") {\n onPropertySelected(null);\n } else {\n onPropertySelected(value);\n }\n };\n\n return <Select value={isIdColumn ? internalIDValue : (selectedPropertyKey ?? undefined)}\n fullWidth={true}\n onValueChange={onSelectValueChange}\n renderValue={renderValue}>\n\n <SelectItem value={\"__do_not_import\"}>\n <Typography variant={\"body2\"} color={\"disabled\"} className={\"p-4\"}>Do not import this property</Typography>\n </SelectItem>\n\n <SelectItem value={internalIDValue}>\n <Typography variant={\"body2\"} className={\"p-4\"}>Use this column as ID</Typography>\n </SelectItem>\n\n {propertiesAndLevel.map(({\n property,\n level,\n propertyKey\n }) => {\n return <SelectItem value={propertyKey}\n key={propertyKey}\n disabled={property.type === \"map\"}>\n <PropertySelectEntry propertyKey={propertyKey}\n property={property}\n level={level}/>\n </SelectItem>;\n })}\n\n </Select>;\n}\n\ntype PropertyAndLevel = {\n property: Property,\n level: number,\n propertyKey: string\n};\n\nfunction getPropertiesAndLevel(key: string, property: Property, level: number): PropertyAndLevel[] {\n const properties: PropertyAndLevel[] = [];\n properties.push({\n property,\n level,\n propertyKey: key\n });\n if (property.type === \"map\" && property.properties) {\n Object.entries(property.properties).forEach(([childKey, value]) => {\n properties.push(...getPropertiesAndLevel(`${key}.${childKey}`, value as Property, level + 1));\n });\n }\n return properties;\n}\n\nexport function PropertySelectEntry({\n propertyKey,\n property,\n level = 0\n}: {\n propertyKey: string;\n property: Property;\n level?: number;\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n const widget = getFieldConfig(property, propertyConfigs);\n\n return <div\n className=\"flex flex-row w-full text-start items-center h-full\">\n\n {new Array(level).fill(0).map((_, index) =>\n <div className={cls(defaultBorderMixin, \"ml-8 border-l h-12\")} key={index}/>)}\n\n <div className={\"m-4\"}>\n <Tooltip title={widget?.name}>\n <PropertyConfigBadge propertyConfig={widget}/>\n </Tooltip>\n </div>\n\n <div className={\"flex flex-col grow p-2 pl-2\"}>\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"grow pr-2\">\n {property.name\n ? property.name\n : \"\\u00a0\"\n }\n </Typography>\n\n <Typography className=\" pr-2\"\n variant={\"body2\"}\n component=\"span\"\n color=\"secondary\">\n {propertyKey}\n </Typography>\n </div>\n\n </div>;\n\n}\n\nexport function ImportDataPreview<M extends Record<string, unknown>>({\n importConfig,\n properties,\n propertiesOrder\n}: {\n importConfig: ImportConfig,\n properties: Properties,\n propertiesOrder: Extract<keyof M, string>[],\n}) {\n const authController = useAuthController();\n const collectionRegistry = useCollectionRegistryController();\n useEffect(() => {\n const mappedData = importConfig.importData.map(d => convertDataToEntity(\n authController,\n collectionRegistry,\n d,\n importConfig.idColumn,\n importConfig.headersMapping,\n properties,\n \"TEMP_PATH\",\n importConfig.defaultValues\n ));\n importConfig.setEntities(mappedData);\n }, []);\n\n const selectionController = useSelectionController();\n\n return <CollectionTableBinding\n title={<div>\n <Typography variant={\"subtitle2\"}>Imported data preview</Typography>\n {/* Conditional because it is only true when a column was chosen as\n the id: without one, every row is created and nothing can be\n overwritten. With one, the import asks for an upsert — which it\n did not, back when this sentence was unconditional and false. */}\n <Typography variant={\"caption\"}>\n {importConfig.idColumn\n ? \"Entities with the same id will be overwritten\"\n : \"All rows will be imported as new entities\"}\n </Typography>\n </div>}\n tableController={{\n data: importConfig.entities,\n dataLoading: false,\n noMoreToLoad: false\n }}\n enablePopupIcon={false}\n endAdornment={<div className={\"h-12\"}/>}\n filterable={false}\n sortable={false}\n openEntityMode={\"full_screen\"}\n selectionController={selectionController}\n properties={properties}/>\n\n}\n\nfunction buildHeadersMappingFromData(objArr: object[], properties?: Properties) {\n const headersMapping: Record<string, string> = {};\n objArr.filter(Boolean).forEach((obj) => {\n Object.keys(obj).forEach((key) => {\n // The keys are the uploaded file's header row; `headersMapping[key] = …`\n // is the same setter the import pipeline refuses elsewhere.\n if (isPrototypePollutingKey(key)) return;\n const child = (obj as Record<string, unknown>)[key];\n if (child != null && typeof child === \"object\" && !Array.isArray(child)) {\n const childProperty = properties?.[key];\n const childProperties = childProperty && \"properties\" in childProperty ? childProperty.properties : undefined;\n const childHeadersMapping = buildHeadersMappingFromData([child as object], childProperties);\n Object.entries(childHeadersMapping).forEach(([subKey, mapping]) => {\n headersMapping[`${key}.${subKey}`] = `${key}.${mapping}`;\n });\n }\n\n if (!properties) {\n headersMapping[key] = key;\n } else if (key in properties) {\n headersMapping[key] = key;\n } else {\n const slug = slugify(key);\n if (slug in properties) {\n headersMapping[key] = slug;\n } else {\n headersMapping[key] = key;\n }\n }\n\n });\n });\n return headersMapping;\n}\n","export * from \"./ImportCollectionAction\";\n"],"mappings":";;;;;;;;;AAyCA,SAAgB,uBAA6E,EACzF,YACA,MACA,oBAIF;CAEE,MAAM,qBAAqB,sBAAsB;CAEjD,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAE5C,MAAM,CAAC,MAAM,WAAW,MAAM,SAAsB,SAAS;CAE7D,MAAM,eAAe,gBAAgB;CAErC,MAAM,kBAAkB,kBAAkB;EACtC,QAAQ,IAAI;EACZ,mBAAmB,aAAa;EAChC,QAAQ,SAAS;CACrB,GAAG,CAAC,gBAAgB,CAAC;CAErB,MAAM,cAAc,kBAAkB;EAClC,QAAQ,KAAK;CACjB,GAAG,CAAC,OAAO,CAAC;CAEZ,MAAM,oBAAoB,kBAAkB;EACxC,mBAAmB,yBAAyB;EAC5C,QAAQ,SAAS;CACrB,GAAG,CAAC,gBAAgB,CAAC;CAErB,MAAM,oBAAoB,kBAAkB;EACxC,mBAAmB,kBAAkB;EACrC,QAAQ,oBAAoB;CAChC,GAAG,CAAC,gBAAgB,CAAC;CAErB,MAAM,cAAc,OAAO,SAAmB;EAC1C,aAAa,cAAc,IAAI;EAE/B,IAAI,KAAK,SAAS,GAAG;GACjB,MAAM,mBAAmB,MAAM,8BAA8B,MAAM,gBAAgB;GACnF,aAAa,oBAAoB,gBAA8B;GAE/D,MAAM,iBAAiB,4BAA4B,MAAM,YAAY,UAAU;GAC/E,aAAa,kBAAkB,cAAc;GAC7C,MAAM,WAAW,OAAO,KAAK,cAAc,CAAC,GAAG;GAC/C,IAAI,UAAU,SAAS,IAAI,KAAK,UAAU,SAAS,KAAK,GACpD,aAAa,YAAY,QAAQ;EAEzC;EACA,iBAAiB;GACb,mBAAmB,mBAAmB;GACtC,QAAQ,SAAS;EACrB,GAAG,GAAG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CAAA,CACX,EAAA,CAAA;EACL,iBAAiB;GACb,MAAM,aAAa;GACnB,aAAa;GACb,cAAc;EAClB;EACA,iBAAiB;EACjB,cAAc,oBAAC,OAAD,EAAK,WAAW,OAAQ,CAAA;EACtC,YAAY;EACZ,UAAU;EACV,gBAAgB;EACK;EACT;CAAY,CAAA;AAEhC;AAEA,SAAS,4BAA4B,QAAkB,YAAyB;CAC5E,MAAM,iBAAyC,CAAC;CAChD,OAAO,OAAO,OAAO,CAAC,CAAC,SAAS,QAAQ;EACpC,OAAO,KAAK,GAAG,CAAC,CAAC,SAAS,QAAQ;GAG9B,IAAI,wBAAwB,GAAG,GAAG;GAClC,MAAM,QAAS,IAAgC;GAC/C,IAAI,SAAS,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAAG;IACrE,MAAM,gBAAgB,aAAa;IACnC,MAAM,kBAAkB,iBAAiB,gBAAgB,gBAAgB,cAAc,aAAa,KAAA;IACpG,MAAM,sBAAsB,4BAA4B,CAAC,KAAe,GAAG,eAAe;IAC1F,OAAO,QAAQ,mBAAmB,CAAC,CAAC,SAAS,CAAC,QAAQ,aAAa;KAC/D,eAAe,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI,GAAG;IACnD,CAAC;GACL;GAEA,IAAI,CAAC,YACD,eAAe,OAAO;QACnB,IAAI,OAAO,YACd,eAAe,OAAO;QACnB;IACH,MAAM,OAAO,QAAQ,GAAG;IACxB,IAAI,QAAQ,YACR,eAAe,OAAO;SAEtB,eAAe,OAAO;GAE9B;EAEJ,CAAC;CACL,CAAC;CACD,OAAO;AACX"}
1
+ {"version":3,"file":"import-Ct2FFEEj.js","names":[],"sources":["../src/data_import/import/ImportCollectionAction.tsx","../src/data_import/import/index.ts"],"sourcesContent":["import React, { useCallback, useEffect } from \"react\";\nimport {\n useAuthController,\n useCustomizationController,\n useSnackbarController\n} from \"@rebasepro/app\";\nimport { getPropertiesWithPropertiesOrder, getPropertyInPath } from \"../../util\";\nimport { Properties, Property, User } from \"@rebasepro/types\";\nimport { CollectionActionsProps, AdminCollection } from \"@rebasepro/cms-types\";\nimport { getFieldConfig } from \"../../components/field_configs\";\nimport { PropertyConfigBadge } from \"../../components/PropertyConfigBadge\";\nimport { useSelectionController } from \"../../components/CollectionViewBinding/useSelectionController\";\nimport { CollectionTableBinding } from \"../../components/CollectionTableBinding/CollectionTableBinding\";\nimport { useCollectionRegistryController } from \"../../hooks\";\nimport {\n Button,\n cls,\n defaultBorderMixin,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n IconButton,\n iconSize,\n Select,\n SelectItem,\n Tooltip,\n Typography,\n UploadIcon\n} from \"@rebasepro/ui\";\nimport { buildEntityPropertiesFromData } from \"@rebasepro/inference\";\nimport { useImportConfig } from \"../hooks\";\nimport { convertDataToEntity, getInferenceType } from \"../utils\";\nimport { DataNewPropertiesMapping } from \"../components/DataNewPropertiesMapping\";\nimport { ImportFileUpload } from \"../components/ImportFileUpload\";\nimport { ImportSaveInProgress } from \"../components/ImportSaveInProgress\";\nimport { ImportConfig } from \"../types\";\nimport { isPrototypePollutingKey, slugify } from \"@rebasepro/utils\";\n\ntype ImportState = \"initial\" | \"mapping\" | \"preview\" | \"import_data_saving\";\n\nexport function ImportCollectionAction<M extends Record<string, unknown>, USER extends User>({\n collection,\n path,\n onAnalyticsEvent\n}: CollectionActionsProps<M, USER> & {\n onAnalyticsEvent?: (event: string, params?: any) => void;\n}\n) {\n\n const snackbarController = useSnackbarController();\n\n const [open, setOpen] = React.useState(false);\n\n const [step, setStep] = React.useState<ImportState>(\"initial\");\n\n const importConfig = useImportConfig();\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n onAnalyticsEvent?.(\"import_open\");\n setStep(\"initial\");\n }, [onAnalyticsEvent]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const onMappingComplete = useCallback(() => {\n onAnalyticsEvent?.(\"import_mapping_complete\");\n setStep(\"preview\");\n }, [onAnalyticsEvent]);\n\n const onPreviewComplete = useCallback(() => {\n onAnalyticsEvent?.(\"import_data_save\");\n setStep(\"import_data_saving\");\n }, [onAnalyticsEvent]);\n\n const onDataAdded = async (data: object[]) => {\n importConfig.setImportData(data);\n\n if (data.length > 0) {\n const originProperties = await buildEntityPropertiesFromData(data, getInferenceType);\n importConfig.setOriginProperties(originProperties as Properties);\n\n const headersMapping = buildHeadersMappingFromData(data, collection?.properties);\n importConfig.setHeadersMapping(headersMapping);\n const firstKey = Object.keys(headersMapping)?.[0];\n if (firstKey?.includes(\"id\") || firstKey?.includes(\"key\")) {\n importConfig.setIdColumn(firstKey);\n }\n }\n setTimeout(() => {\n onAnalyticsEvent?.(\"import_data_added\");\n setStep(\"mapping\");\n }, 100);\n };\n\n const properties = getPropertiesWithPropertiesOrder(collection.properties, collection.propertiesOrder as Extract<keyof M, string>[]);\n\n const propertiesAndLevel = Object.entries(properties)\n .flatMap(([key, property]) => getPropertiesAndLevel(key, property, 0));\n const propertiesOrder = (collection.propertiesOrder ?? Object.keys(collection.properties)) as Extract<keyof M, string>[];\n\n return <>\n\n <Tooltip title={\"Import\"}\n asChild={true}>\n <IconButton\n size={\"small\"}\n color={\"primary\"} onClick={handleClickOpen}>\n <UploadIcon size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n\n <Dialog open={open}\n fullWidth={step !== \"initial\"}\n fullHeight={step !== \"initial\"}\n maxWidth={step === \"initial\" ? \"lg\" : \"7xl\"}>\n\n <DialogTitle variant={\"h6\"} hidden={step === \"preview\"}>Import data</DialogTitle>\n\n <DialogContent className={\"h-full flex flex-col gap-4 my-4\"} fullHeight={step === \"preview\"}>\n\n {step === \"initial\" && <>\n <Typography variant={\"body2\"}>Upload a CSV, Excel or JSON file and map it to your existing\n schema</Typography>\n <ImportFileUpload onDataAdded={onDataAdded}/>\n </>}\n\n {step === \"mapping\" && <>\n <DataNewPropertiesMapping importConfig={importConfig}\n destinationProperties={properties}\n buildPropertyView={({\n isIdColumn,\n property,\n propertyKey,\n importKey\n }) => {\n return <PropertyTreeSelect\n selectedPropertyKey={propertyKey ?? \"\"}\n properties={properties}\n propertiesAndLevel={propertiesAndLevel}\n isIdColumn={isIdColumn}\n onIdSelected={() => {\n importConfig.setIdColumn(importKey);\n }}\n onPropertySelected={(newPropertyKey) => {\n\n onAnalyticsEvent?.(\"import_mapping_field_updated\");\n const newHeadersMapping: Record<string, string | null> = Object.entries(importConfig.headersMapping)\n .map(([currentImportKey, currentPropertyKey]) => {\n if (currentPropertyKey === newPropertyKey) {\n return { [currentImportKey]: null };\n }\n if (currentImportKey === importKey) {\n return { [currentImportKey]: newPropertyKey };\n }\n return { [currentImportKey]: currentPropertyKey };\n })\n .reduce((acc, curr) => ({ ...acc,\n...curr }), {});\n importConfig.setHeadersMapping(newHeadersMapping as Record<string, string>);\n\n if (newPropertyKey === importConfig.idColumn) {\n importConfig.setIdColumn(undefined);\n }\n\n }}\n />;\n }}/>\n </>}\n\n {step === \"preview\" && <ImportDataPreview importConfig={importConfig}\n properties={properties}\n propertiesOrder={propertiesOrder}/>}\n\n {step === \"import_data_saving\" && importConfig &&\n <ImportSaveInProgress importConfig={importConfig}\n collection={collection as AdminCollection}\n path={path}\n onImportSuccess={(importedCollection) => {\n handleClose();\n snackbarController.open({\n type: \"info\",\n message: \"Data imported successfully\"\n });\n }}\n />}\n\n </DialogContent>\n <DialogActions>\n\n {step === \"mapping\" && <Button\n onClick={() => setStep(\"initial\")}\n variant={\"text\"}>\n Back\n </Button>}\n\n {step === \"preview\" && <Button\n onClick={() => setStep(\"mapping\")}\n variant={\"text\"}>\n Back\n </Button>}\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n Cancel\n </Button>\n\n {step === \"mapping\" && <Button variant=\"filled\"\n color={\"primary\"}\n onClick={onMappingComplete}>\n Next\n </Button>}\n\n {step === \"preview\" && <Button variant=\"filled\"\n color={\"primary\"}\n onClick={onPreviewComplete}>\n Save data\n </Button>}\n\n </DialogActions>\n </Dialog>\n\n </>;\n}\n\nconst internalIDValue = \"__internal_id__\";\n\nfunction PropertyTreeSelect({\n selectedPropertyKey,\n properties,\n onPropertySelected,\n onIdSelected,\n propertiesAndLevel,\n isIdColumn\n}: {\n selectedPropertyKey: string | null;\n properties: Record<string, Property>;\n onPropertySelected: (propertyKey: string | null) => void;\n onIdSelected: () => void;\n propertiesAndLevel: PropertyAndLevel[];\n isIdColumn?: boolean;\n}) {\n\n const selectedProperty = selectedPropertyKey ? getPropertyInPath(properties, selectedPropertyKey) : null;\n\n const renderValue = useCallback((selectedPropertyKey: string) => {\n\n if (selectedPropertyKey === internalIDValue) {\n return <Typography variant={\"body2\"} className={\"p-4\"}>Use this column as ID</Typography>;\n }\n\n if (!selectedPropertyKey || !selectedProperty) {\n return <Typography variant={\"body2\"} color=\"disabled\" className={\"p-4\"}>Do not import this\n property</Typography>;\n }\n\n return <PropertySelectEntry propertyKey={selectedPropertyKey}\n property={selectedProperty as Property}/>;\n }, [selectedProperty]);\n\n const onSelectValueChange = (value: string) => {\n if (value === internalIDValue) {\n onIdSelected();\n onPropertySelected(null);\n } else if (value === \"__do_not_import\") {\n onPropertySelected(null);\n } else {\n onPropertySelected(value);\n }\n };\n\n return <Select value={isIdColumn ? internalIDValue : (selectedPropertyKey ?? undefined)}\n fullWidth={true}\n onValueChange={onSelectValueChange}\n renderValue={renderValue}>\n\n <SelectItem value={\"__do_not_import\"}>\n <Typography variant={\"body2\"} color={\"disabled\"} className={\"p-4\"}>Do not import this property</Typography>\n </SelectItem>\n\n <SelectItem value={internalIDValue}>\n <Typography variant={\"body2\"} className={\"p-4\"}>Use this column as ID</Typography>\n </SelectItem>\n\n {propertiesAndLevel.map(({\n property,\n level,\n propertyKey\n }) => {\n return <SelectItem value={propertyKey}\n key={propertyKey}\n disabled={property.type === \"map\"}>\n <PropertySelectEntry propertyKey={propertyKey}\n property={property}\n level={level}/>\n </SelectItem>;\n })}\n\n </Select>;\n}\n\ntype PropertyAndLevel = {\n property: Property,\n level: number,\n propertyKey: string\n};\n\nfunction getPropertiesAndLevel(key: string, property: Property, level: number): PropertyAndLevel[] {\n const properties: PropertyAndLevel[] = [];\n properties.push({\n property,\n level,\n propertyKey: key\n });\n if (property.type === \"map\" && property.properties) {\n Object.entries(property.properties).forEach(([childKey, value]) => {\n properties.push(...getPropertiesAndLevel(`${key}.${childKey}`, value as Property, level + 1));\n });\n }\n return properties;\n}\n\nexport function PropertySelectEntry({\n propertyKey,\n property,\n level = 0\n}: {\n propertyKey: string;\n property: Property;\n level?: number;\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n const widget = getFieldConfig(property, propertyConfigs);\n\n return <div\n className=\"flex flex-row w-full text-start items-center h-full\">\n\n {new Array(level).fill(0).map((_, index) =>\n <div className={cls(defaultBorderMixin, \"ml-8 border-l h-12\")} key={index}/>)}\n\n <div className={\"m-4\"}>\n <Tooltip title={widget?.name}>\n <PropertyConfigBadge propertyConfig={widget}/>\n </Tooltip>\n </div>\n\n <div className={\"flex flex-col grow p-2 pl-2\"}>\n <Typography variant=\"body1\"\n component=\"span\"\n className=\"grow pr-2\">\n {property.name\n ? property.name\n : \"\\u00a0\"\n }\n </Typography>\n\n <Typography className=\" pr-2\"\n variant={\"body2\"}\n component=\"span\"\n color=\"secondary\">\n {propertyKey}\n </Typography>\n </div>\n\n </div>;\n\n}\n\nexport function ImportDataPreview<M extends Record<string, unknown>>({\n importConfig,\n properties,\n propertiesOrder\n}: {\n importConfig: ImportConfig,\n properties: Properties,\n propertiesOrder: Extract<keyof M, string>[],\n}) {\n const authController = useAuthController();\n const collectionRegistry = useCollectionRegistryController();\n useEffect(() => {\n const mappedData = importConfig.importData.map(d => convertDataToEntity(\n authController,\n collectionRegistry,\n d,\n importConfig.idColumn,\n importConfig.headersMapping,\n properties,\n \"TEMP_PATH\",\n importConfig.defaultValues\n ));\n importConfig.setEntities(mappedData);\n }, []);\n\n const selectionController = useSelectionController();\n\n return <CollectionTableBinding\n title={<div>\n <Typography variant={\"subtitle2\"}>Imported data preview</Typography>\n {/* Conditional because it is only true when a column was chosen as\n the id: without one, every row is created and nothing can be\n overwritten. With one, the import asks for an upsert — which it\n did not, back when this sentence was unconditional and false. */}\n <Typography variant={\"caption\"}>\n {importConfig.idColumn\n ? \"Entities with the same id will be overwritten\"\n : \"All rows will be imported as new entities\"}\n </Typography>\n </div>}\n tableController={{\n data: importConfig.entities,\n dataLoading: false,\n noMoreToLoad: false\n }}\n enablePopupIcon={false}\n endAdornment={<div className={\"h-12\"}/>}\n filterable={false}\n sortable={false}\n openEntityMode={\"full_screen\"}\n selectionController={selectionController}\n properties={properties}/>\n\n}\n\nfunction buildHeadersMappingFromData(objArr: object[], properties?: Properties) {\n const headersMapping: Record<string, string> = {};\n objArr.filter(Boolean).forEach((obj) => {\n Object.keys(obj).forEach((key) => {\n // The keys are the uploaded file's header row; `headersMapping[key] = …`\n // is the same setter the import pipeline refuses elsewhere.\n if (isPrototypePollutingKey(key)) return;\n const child = (obj as Record<string, unknown>)[key];\n if (child != null && typeof child === \"object\" && !Array.isArray(child)) {\n const childProperty = properties?.[key];\n const childProperties = childProperty && \"properties\" in childProperty ? childProperty.properties : undefined;\n const childHeadersMapping = buildHeadersMappingFromData([child as object], childProperties);\n Object.entries(childHeadersMapping).forEach(([subKey, mapping]) => {\n headersMapping[`${key}.${subKey}`] = `${key}.${mapping}`;\n });\n }\n\n if (!properties) {\n headersMapping[key] = key;\n } else if (key in properties) {\n headersMapping[key] = key;\n } else {\n const slug = slugify(key);\n if (slug in properties) {\n headersMapping[key] = slug;\n } else {\n headersMapping[key] = key;\n }\n }\n\n });\n });\n return headersMapping;\n}\n","export * from \"./ImportCollectionAction\";\n"],"mappings":";;;;;;;;;AAyCA,SAAgB,uBAA6E,EACzF,YACA,MACA,oBAIF;CAEE,MAAM,qBAAqB,sBAAsB;CAEjD,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAE5C,MAAM,CAAC,MAAM,WAAW,MAAM,SAAsB,SAAS;CAE7D,M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AAC,SAAS,QAAQ;GAG9B,IAAI,wBAAwB,GAAG,GAAG;GAClC,MAAM,QAAS,IAAgC;GAC/C,IAAI,SAAS,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAAG;IACrE,MAAM,gBAAgB,aAAa;IACnC,MAAM,kBAAkB,iBAAiB,gBAAgB,gBAAgB,cAAc,aAAa,KAAA;IACpG,MAAM,sBAAsB,4BAA4B,CAAC,KAAe,GAAG,eAAe;IAC1F,OAAO,QAAQ,mBAAmB,CAAC,CAAC,SAAS,CAAC,QAAQ,aAAa;KAC/D,eAAe,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI,GAAG;IACnD,CAAC;GACL;GAEA,IAAI,CAAC,YACD,eAAe,OAAO;QACnB,IAAI,OAAO,YACd,eAAe,OAAO;QACnB;IACH,MAAM,OAAO,QAAQ,GAAG;IACxB,IAAI,QAAQ,YACR,eAAe,OAAO;SAEtB,eAAe,OAAO;GAE9B;EAEJ,CAAC;CACL,CAAC;CACD,OAAO;AACX"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { $n as useSidePanel, $t as getCollectionBySlugWithin, A as getFieldId, An as ReadOnlyFieldBinding, Ar as getIconForProperty, At as convertDataToEntity, B as MapFieldBinding, Bn as KeyValuePreview, Bt as detectCsvDelimiter, C as EntityFormBinding, Cn as NavigationStateContext, Cr as FieldBlock, Ct as EntityCardBinding, D as getDefaultFieldConfig, Dn as SelectableTableContext, Dr as PropertyIdCopyTooltip, Dt as useCollectionEditorDialogsState, E as DEFAULT_FIELD_CONFIGS, En as SideDialogsControllerContext, Er as spanClass, Et as ConfigControllerProvider, F as SelectFieldBinding, Fn as PropertyPreview, Fr as isReferenceProperty, Ft as ImportSaveInProgress, G as useSelectionDialog, Gn as ArrayEnumPreview, Gt as SearchIconsView, H as DateTimeFieldBinding, Hn as ArrayOneOfPreview, Ht as parseCsvToObjects, I as RepeatFieldBinding, In as UserPreview, Ir as isRelationProperty, It as IMPORT_BATCH_SIZE, J as useBuildUrlController, Jn as ArrayOfReferencesPreview, Jt as BreadcrumbsProvider, K as SelectionTableBinding, Kn as ArrayOfStorageComponentsPreview, Kt as FieldCaption, L as ReferenceFieldBinding, Ln as NumberPropertyPreview, Lt as saveImportedEntities, M as TextFieldBinding, Mn as LabelWithIcon, Mr as getPropertiesWithPropertiesOrder, Mt as processValueMapping, N as SwitchFieldBinding, Nn as FieldHelperText, Nr as getPropertyInPath, Nt as getInferenceType, O as getDefaultFieldId, On as ArrayCustomShapedFieldBinding, Or as getBracketNotation, Ot as ImportNewPropertyFieldPreview, P as StorageUploadFieldBinding, Pn as ArrayOfMapsPreview, Pr as getResolvedPropertyInPath, Pt as useImportConfig, Q as useResolvedCollections, Qn as SidePanelControllerContext, Qt as addInitialSlash, R as MultiSelectFieldBinding, Rn as BooleanPreview, Rt as ImportFileUpload, S as isSchemaChangeCancelled, Sn as useUrlController, Sr as RecordMeta, St as CollectionCardViewBinding, T as PropertyFieldBinding, Tn as useSideDialogsController, Tr as isSelfLabellingProperty, Tt as useCollectionEditorController, U as BlockFieldBinding, Un as ArrayOfStringsPreview, Ut as ArrayContainer, V as KeyValueFieldBinding, Vn as MapPropertyPreview, Vt as parseCsvRows, W as ArrayOfReferencesFieldBinding, Wn as ArrayPropertyEnumPreview, Wt as PropertyConfigBadge, X as useTopLevelNavigation, Xn as ReferencePreview, Xt as resolveEntityView, Y as useBuildNavigationStateController, Yn as InlineEntityListPreview, Yt as resolveEntityAction, Z as useResolvedViews, Zn as EntityPreviewBinding, Zt as mergeEntityActions, _ as useCollectionsConfigController, _n as CollectionTableBinding, _r as UrlComponentPreview, _t as editEntityAction, a as namespaceToPropertiesPath, an as resolveCollectionPathIds, ar as getEntityTitlePropertyKey, at as getEntityViewWidth, b as asUnavailable, bn as useAdminContext, br as FormSections, bt as DetailViewBinding, c as buildCollectionGenerationCallback, cn as SelectionMenu, cr as StringPropertyPreview, d as fromSerializableCollectionConfigs, dn as resolveSelection, dr as StorageThumbnailInternal, dt as getInitialEntityValues, en as getCollectionPathsCombinations, er as CollectionRegistryContext, et as useBuildCollectionRegistryController, f as fromSerializableProperties, fn as selectionQueryToFindParams, fr as SkeletonPropertyComponent, ft as removeEmptyContainers, g as toSerializableProperty, gn as VirtualTableInput, gr as renderSkeletonText, gt as deleteEntityAction, h as toSerializableProperties, hn as useSelectionController, hr as renderSkeletonImageThumbnail, ht as copyEntityAction, i as namespaceToPropertiesOrderPath, in as removeTrailingSlash, ir as getEntityPreviewKeys, it as buildSidePanelsFromUrl, j as VectorFieldBinding, jn as LabelWithIconAndTooltip, jr as getIconForWidget, jt as flattenEntry, k as getFieldConfig, kn as useClearRestoreValue, kr as getDefaultPropertiesOrder, kt as DataNewPropertiesMapping, l as validateCollectionJson, ln as MAX_SELECTION_ROWS, lr as EnumValuesChip, lt as extractTouchedValues, m as toSerializableCollectionConfig, mr as renderSkeletonIcon, mt as CollectionViewBinding, n as getFullIdPath, nn as removeInitialAndTrailingSlashes, nr as getUserLabel, nt as resolveNavigationFrom, o as CollectionGenerationApiError, on as resolveOpenEntityMode, or as getEntityTitlePropertyKeyForEntity, ot as useBuildSidePanel, p as fromSerializableProperty, pn as serializeSelectionQuery, pr as renderSkeletonCaptionText, pt as zodToFormErrors, q as SideDialogs, qn as RelationPreview, qt as useBreadcrumbsController, r as idToPropertiesPath, rn as removeInitialSlash, rr as useResolvedUser, rt as useResolvedNavigationFrom, s as DEFAULT_COLLECTION_GENERATION_ENDPOINT, sn as resolveViewMode, sr as ArrayPropertyPreview, st as EditViewBinding, t as getFullId, tn as getLastSegment, tr as useCollectionRegistryController, tt as useHistory, u as fromSerializableCollectionConfig, un as SELECTION_PAGE_SIZE, ur as StorageThumbnail, ut as getChanges, v as LiveSchemaError, vn as SelectableTable, vr as ImagePreview, vt as resetPasswordAction, w as EntityForm, wn as useNavigationStateController, wr as LABEL_ICON_SIZE, wt as CollectionViewActions, x as createLiveSchemaClient, xn as UrlContext, xr as FormRail, xt as EntityViewBinding, y as SchemaChangeCancelled, yn as CollectionRowActions, yr as EmptyValue, yt as CreationResultDialog, z as MarkdownEditorFieldBinding, zn as DatePreview, zt as convertFileToJson } from "./util-h6jhiiBE.js";
1
+ import { $n as useSidePanel, $t as getCollectionBySlugWithin, A as getFieldId, An as ReadOnlyFieldBinding, Ar as getIconForProperty, At as convertDataToEntity, B as MapFieldBinding, Bn as KeyValuePreview, Bt as detectCsvDelimiter, C as EntityFormBinding, Cn as NavigationStateContext, Cr as FieldBlock, Ct as EntityCardBinding, D as getDefaultFieldConfig, Dn as SelectableTableContext, Dr as PropertyIdCopyTooltip, Dt as useCollectionEditorDialogsState, E as DEFAULT_FIELD_CONFIGS, En as SideDialogsControllerContext, Er as spanClass, Et as ConfigControllerProvider, F as SelectFieldBinding, Fn as PropertyPreview, Fr as isReferenceProperty, Ft as ImportSaveInProgress, G as useSelectionDialog, Gn as ArrayEnumPreview, Gt as SearchIconsView, H as DateTimeFieldBinding, Hn as ArrayOneOfPreview, Ht as parseCsvToObjects, I as RepeatFieldBinding, In as UserPreview, Ir as isRelationProperty, It as IMPORT_BATCH_SIZE, J as useBuildUrlController, Jn as ArrayOfReferencesPreview, Jt as BreadcrumbsProvider, K as SelectionTableBinding, Kn as ArrayOfStorageComponentsPreview, Kt as FieldCaption, L as ReferenceFieldBinding, Ln as NumberPropertyPreview, Lt as saveImportedEntities, M as TextFieldBinding, Mn as LabelWithIcon, Mr as getPropertiesWithPropertiesOrder, Mt as processValueMapping, N as SwitchFieldBinding, Nn as FieldHelperText, Nr as getPropertyInPath, Nt as getInferenceType, O as getDefaultFieldId, On as ArrayCustomShapedFieldBinding, Or as getBracketNotation, Ot as ImportNewPropertyFieldPreview, P as StorageUploadFieldBinding, Pn as ArrayOfMapsPreview, Pr as getResolvedPropertyInPath, Pt as useImportConfig, Q as useResolvedCollections, Qn as SidePanelControllerContext, Qt as addInitialSlash, R as MultiSelectFieldBinding, Rn as BooleanPreview, Rt as ImportFileUpload, S as isSchemaChangeCancelled, Sn as useUrlController, Sr as RecordMeta, St as CollectionCardViewBinding, T as PropertyFieldBinding, Tn as useSideDialogsController, Tr as isSelfLabellingProperty, Tt as useCollectionEditorController, U as BlockFieldBinding, Un as ArrayOfStringsPreview, Ut as ArrayContainer, V as KeyValueFieldBinding, Vn as MapPropertyPreview, Vt as parseCsvRows, W as ArrayOfReferencesFieldBinding, Wn as ArrayPropertyEnumPreview, Wt as PropertyConfigBadge, X as useTopLevelNavigation, Xn as ReferencePreview, Xt as resolveEntityView, Y as useBuildNavigationStateController, Yn as InlineEntityListPreview, Yt as resolveEntityAction, Z as useResolvedViews, Zn as EntityPreviewBinding, Zt as mergeEntityActions, _ as useCollectionsConfigController, _n as CollectionTableBinding, _r as UrlComponentPreview, _t as editEntityAction, a as namespaceToPropertiesPath, an as resolveCollectionPathIds, ar as getEntityTitlePropertyKey, at as getEntityViewWidth, b as asUnavailable, bn as useAdminContext, br as FormSections, bt as DetailViewBinding, c as buildCollectionGenerationCallback, cn as SelectionMenu, cr as StringPropertyPreview, d as fromSerializableCollectionConfigs, dn as resolveSelection, dr as StorageThumbnailInternal, dt as getInitialEntityValues, en as getCollectionPathsCombinations, er as CollectionRegistryContext, et as useBuildCollectionRegistryController, f as fromSerializableProperties, fn as selectionQueryToFindParams, fr as SkeletonPropertyComponent, ft as removeEmptyContainers, g as toSerializableProperty, gn as VirtualTableInput, gr as renderSkeletonText, gt as deleteEntityAction, h as toSerializableProperties, hn as useSelectionController, hr as renderSkeletonImageThumbnail, ht as copyEntityAction, i as namespaceToPropertiesOrderPath, in as removeTrailingSlash, ir as getEntityPreviewKeys, it as buildSidePanelsFromUrl, j as VectorFieldBinding, jn as LabelWithIconAndTooltip, jr as getIconForWidget, jt as flattenEntry, k as getFieldConfig, kn as useClearRestoreValue, kr as getDefaultPropertiesOrder, kt as DataNewPropertiesMapping, l as validateCollectionJson, ln as MAX_SELECTION_ROWS, lr as EnumValuesChip, lt as extractTouchedValues, m as toSerializableCollectionConfig, mr as renderSkeletonIcon, mt as CollectionViewBinding, n as getFullIdPath, nn as removeInitialAndTrailingSlashes, nr as getUserLabel, nt as resolveNavigationFrom, o as CollectionGenerationApiError, on as resolveOpenEntityMode, or as getEntityTitlePropertyKeyForEntity, ot as useBuildSidePanel, p as fromSerializableProperty, pn as serializeSelectionQuery, pr as renderSkeletonCaptionText, pt as zodToFormErrors, q as SideDialogs, qn as RelationPreview, qt as useBreadcrumbsController, r as idToPropertiesPath, rn as removeInitialSlash, rr as useResolvedUser, rt as useResolvedNavigationFrom, s as DEFAULT_COLLECTION_GENERATION_ENDPOINT, sn as resolveViewMode, sr as ArrayPropertyPreview, st as EditViewBinding, t as getFullId, tn as getLastSegment, tr as useCollectionRegistryController, tt as useHistory, u as fromSerializableCollectionConfig, un as SELECTION_PAGE_SIZE, ur as StorageThumbnail, ut as getChanges, v as LiveSchemaError, vn as SelectableTable, vr as ImagePreview, vt as resetPasswordAction, w as EntityForm, wn as useNavigationStateController, wr as LABEL_ICON_SIZE, wt as CollectionViewActions, x as createLiveSchemaClient, xn as UrlContext, xr as FormRail, xt as EntityViewBinding, y as SchemaChangeCancelled, yn as CollectionRowActions, yr as EmptyValue, yt as CreationResultDialog, z as MarkdownEditorFieldBinding, zn as DatePreview, zt as convertFileToJson } from "./util-jUWinb7D.js";
2
2
  import { r as sanitizeUrl } from "./util-DB31IoJE.js";
3
- import { i as PropertySelectEntry, n as ImportCollectionAction, r as ImportDataPreview } from "./import-BciQBH5t.js";
4
- import { a as MAX_EXPORT_ROWS, c as downloadDataAsCsv, d as escapeCsvFormula, f as getEntityCSVExportableData, i as EXPORT_PAGE_SIZE, l as downloadEntitiesExport, n as ExportCollectionAction, o as fetchAllEntitiesForExport, p as getEntityJsonExportableData, r as BasicExportAction, s as downloadBlob, u as entryToCSVRow } from "./export-DtSmLT6u.js";
3
+ import { i as PropertySelectEntry, n as ImportCollectionAction, r as ImportDataPreview } from "./import-Ct2FFEEj.js";
4
+ import { a as MAX_EXPORT_ROWS, c as downloadDataAsCsv, d as escapeCsvFormula, f as getEntityCSVExportableData, i as EXPORT_PAGE_SIZE, l as downloadEntitiesExport, n as ExportCollectionAction, o as fetchAllEntitiesForExport, p as getEntityJsonExportableData, r as BasicExportAction, s as downloadBlob, u as entryToCSVRow } from "./export-CrKQwyBM.js";
5
5
  import React, { Suspense, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
6
6
  import { deepEqual } from "fast-equals";
7
7
  import { Avatar, Button, Card, CenteredView, ChevronDownIcon, ChevronsLeftIcon, ChevronsRightIcon, Chip, CircularProgressCenter, Collapse, Container, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, ExpandablePanel, IconButton, LogOutIcon, Markdown, Menu, MenuIcon, MenuItem, MoonIcon, PencilIcon, SearchBar, SettingsIcon, Sheet, Skeleton, StarIcon, SunIcon, SunMoonIcon, TextField, Tooltip, Typography, cls, defaultBorderMixin, iconSize, lazyChunk } from "@rebasepro/ui";
@@ -1897,7 +1897,7 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
1897
1897
  //#region src/components/RebaseNavigation.tsx
1898
1898
  var EMPTY_PLUGINS = [];
1899
1899
  var EMPTY_COLLECTIONS = [];
1900
- var CollectionsStudioView = lazyChunk(() => import("./RouterCollectionsStudioView-DuDFEYuL.js").then((n) => n.n).then((m) => ({ default: m.RouterCollectionsStudioView })));
1900
+ var CollectionsStudioView = lazyChunk(() => import("./RouterCollectionsStudioView-C1BseTGZ.js").then((n) => n.n).then((m) => ({ default: m.RouterCollectionsStudioView })));
1901
1901
  /**
1902
1902
  * Navigation layer — builds and provides all admin navigation controllers:
1903
1903
  * collection registry, URL controller, navigation state, side entity,
@@ -3175,8 +3175,8 @@ function ContentHomePage({ additionalActions, additionalChildrenStart, additiona
3175
3175
  }
3176
3176
  //#endregion
3177
3177
  //#region src/components/CollectionEditorDialogs.tsx
3178
- var CollectionEditorDialog = lazyChunk(() => import("./CollectionEditorDialog-C-A_NCKB.js").then((n) => n.r).then((m) => ({ default: m.CollectionEditorDialog })));
3179
- var PropertyFormDialog = lazyChunk(() => import("./PropertyEditView-Dv7496fx.js").then((n) => n.t).then((m) => ({ default: m.PropertyFormDialog })));
3178
+ var CollectionEditorDialog = lazyChunk(() => import("./CollectionEditorDialog-DPLimWfL.js").then((n) => n.r).then((m) => ({ default: m.CollectionEditorDialog })));
3179
+ var PropertyFormDialog = lazyChunk(() => import("./PropertyEditView-D85vuYZu.js").then((n) => n.t).then((m) => ({ default: m.PropertyFormDialog })));
3180
3180
  /**
3181
3181
  * Renders the CollectionEditorDialog and PropertyFormDialog inside
3182
3182
  * the RebaseShell tree where admin-internal contexts
@@ -3519,7 +3519,7 @@ function LabelWithIconAndTooltip({ propertyKey, className, ...props }) {
3519
3519
  * and tables to the specified properties.
3520
3520
  * @group Form fields
3521
3521
  */
3522
- function ReadOnlyFieldBinding({ propertyKey, value, error, showError, minimalistView, property, includeDescription, hideLabel, context }) {
3522
+ function ReadOnlyFieldBinding({ propertyKey, value, error, showError, minimalistView, property, includeDescription, hideLabel, context, size = "large" }) {
3523
3523
  const skipCardWrapper = property.type === "relation" || property.type === "reference";
3524
3524
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3525
3525
  !minimalistView && !hideLabel && /* @__PURE__ */ jsx(LabelWithIconAndTooltip, {
@@ -3530,7 +3530,11 @@ function ReadOnlyFieldBinding({ propertyKey, value, error, showError, minimalist
3530
3530
  className: "h-8 text-text-secondary dark:text-text-secondary-dark ml-3"
3531
3531
  }),
3532
3532
  /* @__PURE__ */ jsx("div", {
3533
- className: cls("w-full overflow-x-scroll no-scrollbar flex items-center", skipCardWrapper ? "" : "rounded-lg border border-hairline-strong px-3 min-h-12 opacity-80"),
3533
+ className: cls("w-full overflow-x-scroll no-scrollbar flex items-center", skipCardWrapper ? "" : cls("rounded-lg border border-hairline-strong px-3 text-sm opacity-80", {
3534
+ "min-h-[34px]": size === "small",
3535
+ "min-h-[42px]": size === "medium",
3536
+ "min-h-[50px]": size === "large"
3537
+ })),
3534
3538
  children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyPreview, {
3535
3539
  propertyKey,
3536
3540
  value,
@@ -9891,8 +9895,8 @@ function EditorCollectionAction({ path, parentCollectionSlugs, parentEntityIds,
9891
9895
  }
9892
9896
  //#endregion
9893
9897
  //#region src/components/CollectionViewBinding/CollectionViewActions.tsx
9894
- var ImportCollectionAction = lazyChunk(() => import("./import-BciQBH5t.js").then((n) => n.t).then((m) => ({ default: m.ImportCollectionAction })));
9895
- var ExportCollectionAction = lazyChunk(() => import("./export-DtSmLT6u.js").then((n) => n.t).then((m) => ({ default: m.ExportCollectionAction })));
9898
+ var ImportCollectionAction = lazyChunk(() => import("./import-Ct2FFEEj.js").then((n) => n.t).then((m) => ({ default: m.ImportCollectionAction })));
9899
+ var ExportCollectionAction = lazyChunk(() => import("./export-CrKQwyBM.js").then((n) => n.t).then((m) => ({ default: m.ExportCollectionAction })));
9896
9900
  function CollectionViewActions({ collection, relativePath, parentCollectionSlugs, parentEntityIds, onNewClick, onAddExistingClick, onMultipleDeleteClick, selectionEnabled, path, selectionController, tableController, collectionEntitiesCount, compact, children, openNewDocument }) {
9897
9901
  const context = useAdminContext();
9898
9902
  const { canCreate, canDelete } = usePermissions();
@@ -12228,7 +12232,7 @@ function SplitListShowButton({ onClick }) {
12228
12232
  }
12229
12233
  //#endregion
12230
12234
  //#region src/components/EntityInspector.tsx
12231
- var EntityHistoryView = lazyChunk(() => import("./history-C6kUDQ3f.js").then((m) => ({ default: m.EntityHistoryView })));
12235
+ var EntityHistoryView = lazyChunk(() => import("./history-DH4h_T1U.js").then((m) => ({ default: m.EntityHistoryView })));
12232
12236
  /**
12233
12237
  * The JSON tab pulls `prism-react-renderer` — 85 kB, and it was EAGER.
12234
12238
  *
@@ -20612,7 +20616,7 @@ function BlockEntry({ name, index, value, typeField, valueField, properties, aut
20612
20616
  * and tables to the specified properties.
20613
20617
  * @group Form fields
20614
20618
  */
20615
- function DateTimeFieldBinding({ propertyKey, value, setValue, autoFocus, error, showError, disabled, touched, property, includeDescription, hideLabel }) {
20619
+ function DateTimeFieldBinding({ propertyKey, value, setValue, autoFocus, error, showError, disabled, touched, property, includeDescription, hideLabel, size = "large" }) {
20616
20620
  const { locale } = useCustomizationController();
20617
20621
  const internalValue = value || null;
20618
20622
  useClearRestoreValue({
@@ -20623,6 +20627,7 @@ function DateTimeFieldBinding({ propertyKey, value, setValue, autoFocus, error,
20623
20627
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PropertyIdCopyTooltip, {
20624
20628
  propertyKey,
20625
20629
  children: /* @__PURE__ */ jsx(DateTimeField, {
20630
+ size,
20626
20631
  value: internalValue,
20627
20632
  onChange: (dateValue) => setValue(dateValue),
20628
20633
  mode: property.mode,
@@ -21337,7 +21342,7 @@ function MarkdownEditorFieldBinding({ property, propertyKey, value, setValue, in
21337
21342
  * and tables to the specified properties.
21338
21343
  * @group Form fields
21339
21344
  */
21340
- function MultiSelectFieldBinding({ propertyKey, value, setValue, error, showError, disabled, property, includeDescription, hideLabel, size = "small", autoFocus }) {
21345
+ function MultiSelectFieldBinding({ propertyKey, value, setValue, error, showError, disabled, property, includeDescription, hideLabel, size = "large", autoFocus }) {
21341
21346
  const of = property.of;
21342
21347
  if (!of) throw Error("Using wrong component ArrayEnumSelect");
21343
21348
  if (Array.isArray(of)) throw Error("Using array properties instead of single one in `of` in ArrayProperty");
@@ -21595,7 +21600,7 @@ function RepeatFieldBinding({ propertyKey, value, error, showError, isSubmitting
21595
21600
  * and tables to the specified properties.
21596
21601
  * @group Form fields
21597
21602
  */
21598
- function SelectFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, touched, property, includeDescription, hideLabel, size = "small" }) {
21603
+ function SelectFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, touched, property, includeDescription, hideLabel, size = "large" }) {
21599
21604
  const enumValues = resolveEnumValues(property.enum ?? []);
21600
21605
  useClearRestoreValue({
21601
21606
  property,
@@ -21957,7 +21962,7 @@ function StorageUpload({ property, name, value, setInternalValue, onChange, mult
21957
21962
  * and tables to the specified properties.
21958
21963
  * @group Form fields
21959
21964
  */
21960
- var SwitchFieldBinding = function SwitchFieldBinding({ propertyKey, value, setValue, error, showError, autoFocus, disabled, size = "small", property, includeDescription, hideLabel }) {
21965
+ var SwitchFieldBinding = function SwitchFieldBinding({ propertyKey, value, setValue, error, showError, autoFocus, disabled, size = "large", property, includeDescription, hideLabel }) {
21961
21966
  useClearRestoreValue({
21962
21967
  property,
21963
21968
  value,
@@ -21995,7 +22000,7 @@ var SwitchFieldBinding = function SwitchFieldBinding({ propertyKey, value, setVa
21995
22000
  * and tables to the specified properties.
21996
22001
  * @group Form fields
21997
22002
  */
21998
- function TextFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, hideLabel, size = "small" }) {
22003
+ function TextFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, hideLabel, size = "large" }) {
21999
22004
  let multiline;
22000
22005
  let url;
22001
22006
  if (property.type === "string") {
@@ -22105,7 +22110,7 @@ function TextFieldBinding({ propertyKey, value, setValue, error, showError, disa
22105
22110
  * Vector object structure expected by Rebase driver.
22106
22111
  * @group Form fields
22107
22112
  */
22108
- function VectorFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, hideLabel, size = "small" }) {
22113
+ function VectorFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, hideLabel, size = "large" }) {
22109
22114
  const isVectorObject = (val) => {
22110
22115
  return typeof val === "object" && val !== null && "value" in val;
22111
22116
  };
@@ -22279,7 +22284,7 @@ var inRange = (n, [min, max]) => n >= min && n <= max;
22279
22284
  *
22280
22285
  * @group Form fields
22281
22286
  */
22282
- function GeopointFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, hideLabel, size = "small" }) {
22287
+ function GeopointFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, hideLabel, size = "large" }) {
22283
22288
  const coordinates = readCoordinates(value);
22284
22289
  const [latText, setLatText] = useState(() => coordinates ? String(coordinates.latitude) : "");
22285
22290
  const [lngText, setLngText] = useState(() => coordinates ? String(coordinates.longitude) : "");
@@ -22417,7 +22422,7 @@ function humanSize(bytes) {
22417
22422
  *
22418
22423
  * @group Form fields
22419
22424
  */
22420
- function BinaryFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, hideLabel, size = "small" }) {
22425
+ function BinaryFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, hideLabel, size = "large" }) {
22421
22426
  const [text, setText] = useState(typeof value === "string" ? value : "");
22422
22427
  const [isEditing, setIsEditing] = useState(false);
22423
22428
  useEffect(() => {
@@ -22751,7 +22756,7 @@ function SingleRelationFieldBinding({ propertyKey, value, size, error, showError
22751
22756
  * and tables to the specified properties.
22752
22757
  * @group Form fields
22753
22758
  */
22754
- function UserSelectFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, touched, property, includeDescription, hideLabel, size = "small" }) {
22759
+ function UserSelectFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, touched, property, includeDescription, hideLabel, size = "large" }) {
22755
22760
  const selectorSize = size;
22756
22761
  return /* @__PURE__ */ jsxs(Fragment, { children: [
22757
22762
  !hideLabel && /* @__PURE__ */ jsx(PropertyIdCopyTooltip, {
@@ -24172,7 +24177,7 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
24172
24177
  context: formContext,
24173
24178
  partOfArray: false,
24174
24179
  minimalistView: false,
24175
- size: "small",
24180
+ size: "large",
24176
24181
  autoFocus: autoFocusKey === field.key
24177
24182
  };
24178
24183
  return /* @__PURE__ */ jsx("div", {
@@ -25571,4 +25576,4 @@ function getFullIdPath(propertyKey, propertyNamespace) {
25571
25576
  //#endregion
25572
25577
  export { NAVIGATION_DEFAULT_GROUP_NAME as $, useSidePanel as $n, getCollectionBySlugWithin as $t, getFieldId as A, ReadOnlyFieldBinding as An, getIconForProperty as Ar, convertDataToEntity as At, MapFieldBinding as B, KeyValuePreview as Bn, detectCsvDelimiter as Bt, EntityFormBinding as C, NavigationStateContext as Cn, FieldBlock as Cr, EntityCardBinding as Ct, getDefaultFieldConfig as D, SelectableTableContext as Dn, PropertyIdCopyTooltip as Dr, useCollectionEditorDialogsState as Dt, DEFAULT_FIELD_CONFIGS as E, SideDialogsControllerContext as En, spanClass as Er, ConfigControllerProvider as Et, SelectFieldBinding as F, PropertyPreview as Fn, isReferenceProperty as Fr, ImportSaveInProgress as Ft, useSelectionDialog as G, ArrayEnumPreview as Gn, SearchIconsView as Gt, DateTimeFieldBinding as H, ArrayOneOfPreview as Hn, parseCsvToObjects as Ht, RepeatFieldBinding as I, UserPreview as In, isRelationProperty as Ir, IMPORT_BATCH_SIZE as It, useBuildUrlController as J, ArrayOfReferencesPreview as Jn, BreadcrumbsProvider as Jt, SelectionTableBinding as K, ArrayOfStorageComponentsPreview as Kn, FieldCaption as Kt, ReferenceFieldBinding as L, NumberPropertyPreview as Ln, saveImportedEntities as Lt, TextFieldBinding as M, LabelWithIcon as Mn, getPropertiesWithPropertiesOrder as Mr, processValueMapping as Mt, SwitchFieldBinding as N, FieldHelperText as Nn, getPropertyInPath$1 as Nr, getInferenceType as Nt, getDefaultFieldId as O, ArrayCustomShapedFieldBinding as On, getBracketNotation as Or, ImportNewPropertyFieldPreview as Ot, StorageUploadFieldBinding as P, ArrayOfMapsPreview as Pn, getResolvedPropertyInPath as Pr, useImportConfig as Pt, useResolvedCollections as Q, SidePanelControllerContext as Qn, addInitialSlash as Qt, MultiSelectFieldBinding as R, BooleanPreview as Rn, ImportFileUpload as Rt, isSchemaChangeCancelled as S, useUrlController as Sn, RecordMeta as Sr, CollectionCardViewBinding as St, PropertyFieldBinding as T, useSideDialogsController as Tn, isSelfLabellingProperty as Tr, useCollectionEditorController as Tt, BlockFieldBinding as U, ArrayOfStringsPreview as Un, ArrayContainer as Ut, KeyValueFieldBinding as V, MapPropertyPreview as Vn, parseCsvRows as Vt, ArrayOfReferencesFieldBinding as W, ArrayPropertyEnumPreview as Wn, PropertyConfigBadge as Wt, useTopLevelNavigation as X, ReferencePreview as Xn, resolveEntityView as Xt, useBuildNavigationStateController as Y, InlineEntityListPreview as Yn, resolveEntityAction as Yt, useResolvedViews as Z, EntityPreviewBinding as Zn, mergeEntityActions as Zt, useCollectionsConfigController as _, CollectionTableBinding as _n, UrlComponentPreview as _r, editEntityAction as _t, namespaceToPropertiesPath as a, resolveCollectionPathIds$1 as an, getEntityTitlePropertyKey as ar, getEntityViewWidth as at, asUnavailable as b, useAdminContext as bn, FormSections as br, DetailViewBinding as bt, buildCollectionGenerationCallback as c, SelectionMenu as cn, StringPropertyPreview as cr, useSafeSnackbarController as ct, fromSerializableCollectionConfigs as d, resolveSelection as dn, StorageThumbnailInternal as dr, getInitialEntityValues as dt, getCollectionPathsCombinations as en, CollectionRegistryContext as er, useBuildCollectionRegistryController as et, fromSerializableProperties as f, selectionQueryToFindParams as fn, SkeletonPropertyComponent as fr, removeEmptyContainers as ft, toSerializableProperty as g, VirtualTableInput$1 as gn, renderSkeletonText as gr, deleteEntityAction as gt, toSerializableProperties as h, useSelectionController as hn, renderSkeletonImageThumbnail as hr, copyEntityAction as ht, namespaceToPropertiesOrderPath as i, removeTrailingSlash$1 as in, getEntityPreviewKeys as ir, buildSidePanelsFromUrl as it, VectorFieldBinding as j, LabelWithIconAndTooltip as jn, getIconForWidget as jr, flattenEntry as jt, getFieldConfig as k, useClearRestoreValue as kn, getDefaultPropertiesOrder as kr, DataNewPropertiesMapping as kt, validateCollectionJson as l, MAX_SELECTION_ROWS as ln, EnumValuesChip as lr, extractTouchedValues as lt, toSerializableCollectionConfig as m, walkEntityPages as mn, renderSkeletonIcon as mr, CollectionViewBinding as mt, getFullIdPath as n, removeInitialAndTrailingSlashes$1 as nn, getUserLabel as nr, resolveNavigationFrom as nt, CollectionGenerationApiError as o, resolveOpenEntityMode as on, getEntityTitlePropertyKeyForEntity as or, useBuildSidePanel as ot, fromSerializableProperty as p, serializeSelectionQuery as pn, renderSkeletonCaptionText as pr, zodToFormErrors as pt, SideDialogs as q, RelationPreview as qn, useBreadcrumbsController as qt, idToPropertiesPath as r, removeInitialSlash as rn, useResolvedUser as rr, useResolvedNavigationFrom as rt, DEFAULT_COLLECTION_GENERATION_ENDPOINT as s, resolveViewMode as sn, ArrayPropertyPreview as sr, EditViewBinding as st, getFullId as t, getLastSegment$1 as tn, useCollectionRegistryController as tr, useHistory as tt, fromSerializableCollectionConfig as u, SELECTION_PAGE_SIZE as un, StorageThumbnail as ur, getChanges as ut, LiveSchemaError as v, SelectableTable as vn, ImagePreview as vr, resetPasswordAction as vt, EntityForm as w, useNavigationStateController as wn, LABEL_ICON_SIZE as wr, CollectionViewActions as wt, createLiveSchemaClient as x, UrlContext as xn, FormRail as xr, EntityViewBinding as xt, SchemaChangeCancelled as y, CollectionRowActions as yn, EmptyValue as yr, CreationResultDialog as yt, MarkdownEditorFieldBinding as z, DatePreview as zn, convertFileToJson as zt };
25573
25578
 
25574
- //# sourceMappingURL=util-h6jhiiBE.js.map
25579
+ //# sourceMappingURL=util-jUWinb7D.js.map