@rebasepro/cms 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/{CollectionEditorDialog-DPLimWfL.js → CollectionEditorDialog-CUtfS_49.js} +3 -3
  2. package/dist/{CollectionEditorDialog-DPLimWfL.js.map → CollectionEditorDialog-CUtfS_49.js.map} +1 -1
  3. package/dist/{PropertyEditView-D85vuYZu.js → PropertyEditView-BpEbC0Q2.js} +2 -2
  4. package/dist/{PropertyEditView-D85vuYZu.js.map → PropertyEditView-BpEbC0Q2.js.map} +1 -1
  5. package/dist/{RouterCollectionsStudioView-C1BseTGZ.js → RouterCollectionsStudioView-EK8Knq5I.js} +4 -4
  6. package/dist/{RouterCollectionsStudioView-C1BseTGZ.js.map → RouterCollectionsStudioView-EK8Knq5I.js.map} +1 -1
  7. package/dist/collection_editor_ui.js +4 -4
  8. package/dist/components/EntityIdentityBar.d.ts +11 -0
  9. package/dist/components/PropertyKeyHint.d.ts +25 -0
  10. package/dist/components/index.d.ts +1 -1
  11. package/dist/{export-CrKQwyBM.js → export-LvIpE7sE.js} +3 -3
  12. package/dist/export-LvIpE7sE.js.map +1 -0
  13. package/dist/form/components/LabelWithIcon.d.ts +7 -0
  14. package/dist/form/components/index.d.ts +0 -1
  15. package/dist/{history-DH4h_T1U.js → history-DG6Ln7CV.js} +2 -2
  16. package/dist/{history-DH4h_T1U.js.map → history-DG6Ln7CV.js.map} +1 -1
  17. package/dist/{import-Ct2FFEEj.js → import-Cxnmpyjl.js} +2 -2
  18. package/dist/{import-Ct2FFEEj.js.map → import-Cxnmpyjl.js.map} +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +14 -8
  21. package/dist/index.js.map +1 -1
  22. package/dist/{util-jUWinb7D.js → util-CyIcgnv2.js} +544 -460
  23. package/dist/util-CyIcgnv2.js.map +1 -0
  24. package/package.json +9 -9
  25. package/dist/components/PropertyIdCopyTooltip.d.ts +0 -8
  26. package/dist/export-CrKQwyBM.js.map +0 -1
  27. package/dist/form/components/LabelWithIconAndTooltip.d.ts +0 -15
  28. package/dist/util-jUWinb7D.js.map +0 -1
@@ -1 +1 @@
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,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,S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aAAa,WACR,kDACA;EACE,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-Cxnmpyjl.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,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O,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"}
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export type { RichTextEditorProps, RichTextEditorTextSize, JSONContent, EditorAI
3
3
  export * from "./form/index.js";
4
4
  export * from "./preview/index.js";
5
5
  export * from "./routes/index.js";
6
- export { EntityViewBinding, SelectionTableBinding, SelectableTable, SelectableTableContext, CollectionViewBinding, CollectionViewActions, CollectionCardViewBinding, EntityCardBinding, useSelectionController, PropertyConfigBadge, PropertyIdCopyTooltip, CollectionTableBinding, CollectionRowActions, VirtualTableInput, ArrayContainer, type ArrayEntryParams, ReferenceWidget, SearchIconsView, FieldCaption, EntityPreviewBinding, getFieldConfig, getFieldId, getDefaultFieldConfig, getDefaultFieldId, DEFAULT_FIELD_CONFIGS, editEntityAction, copyEntityAction, deleteEntityAction, resetPasswordAction, SidePanelProvider, Scaffold, AppBar, Drawer, DefaultDrawer, DrawerFooterActions, DrawerNavigationItem, DrawerNavigationGroup, AdminModeSyncer, RebaseCMS, RebaseShell, RebaseAuthGate, RebaseNavigation, RebaseLayout, RebaseRouteDefs, SideDialogs, useApp, CollectionPanel } from "./components/index.js";
6
+ export { EntityViewBinding, SelectionTableBinding, SelectableTable, SelectableTableContext, CollectionViewBinding, CollectionViewActions, CollectionCardViewBinding, EntityCardBinding, useSelectionController, PropertyConfigBadge, PropertyKeyHint, CollectionTableBinding, CollectionRowActions, VirtualTableInput, ArrayContainer, type ArrayEntryParams, ReferenceWidget, SearchIconsView, FieldCaption, EntityPreviewBinding, getFieldConfig, getFieldId, getDefaultFieldConfig, getDefaultFieldId, DEFAULT_FIELD_CONFIGS, editEntityAction, copyEntityAction, deleteEntityAction, resetPasswordAction, SidePanelProvider, Scaffold, AppBar, Drawer, DefaultDrawer, DrawerFooterActions, DrawerNavigationItem, DrawerNavigationGroup, AdminModeSyncer, RebaseCMS, RebaseShell, RebaseAuthGate, RebaseNavigation, RebaseLayout, RebaseRouteDefs, SideDialogs, useApp, CollectionPanel } from "./components/index.js";
7
7
  export type { EntityViewBindingProps, SelectionProps, SelectableTableProps, CollectionPanelProps, DrawerNavigationGroupProps, DrawerNavigationItemProps } from "./components/index.js";
8
8
  export * from "./hooks/index.js";
9
9
  export { addInitialSlash, removeInitialSlash, removeTrailingSlash, removeInitialAndTrailingSlashes, getLastSegment, getCollectionBySlugWithin, getCollectionPathsCombinations, resolveCollectionPathIds, mergeEntityActions, resolveEntityAction, resolveEntityView, isReferenceProperty, isRelationProperty, getIconForWidget, getIconForProperty, getPropertyInPath, getResolvedPropertyInPath, getBracketNotation, getPropertiesWithPropertiesOrder, getDefaultPropertiesOrder, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity } from "./util/index.js";
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-jUWinb7D.js";
1
+ import { $n as CollectionRegistryContext, $t as getCollectionBySlugWithin, A as getFieldId, An as ReadOnlyFieldBinding, Ar as getIconForWidget, At as convertDataToEntity, B as MapFieldBinding, Bn as MapPropertyPreview, Bt as detectCsvDelimiter, C as EntityFormBinding, Cn as NavigationStateContext, Cr as LABEL_ICON_SIZE, Ct as EntityCardBinding, D as getDefaultFieldConfig, Dn as SelectableTableContext, Dr as getBracketNotation, Dt as useCollectionEditorDialogsState, E as DEFAULT_FIELD_CONFIGS, En as SideDialogsControllerContext, Er as PropertyKeyHint, Et as ConfigControllerProvider, F as SelectFieldBinding, Fn as UserPreview, Fr as isRelationProperty, Ft as ImportSaveInProgress, G as useSelectionDialog, Gn as ArrayOfStorageComponentsPreview, Gt as SearchIconsView, H as DateTimeFieldBinding, Hn as ArrayOfStringsPreview, Ht as parseCsvToObjects, I as RepeatFieldBinding, In as NumberPropertyPreview, It as IMPORT_BATCH_SIZE, J as useBuildUrlController, Jn as InlineEntityListPreview, Jt as BreadcrumbsProvider, K as SelectionTableBinding, Kn as RelationPreview, Kt as FieldCaption, L as ReferenceFieldBinding, Ln as BooleanPreview, Lt as saveImportedEntities, M as TextFieldBinding, Mn as FieldHelperText, Mr as getPropertyInPath, Mt as processValueMapping, N as SwitchFieldBinding, Nn as ArrayOfMapsPreview, Nr as getResolvedPropertyInPath, Nt as getInferenceType, O as getDefaultFieldId, On as ArrayCustomShapedFieldBinding, Or as getDefaultPropertiesOrder, Ot as ImportNewPropertyFieldPreview, P as StorageUploadFieldBinding, Pn as PropertyPreview, Pr as isReferenceProperty, Pt as useImportConfig, Q as useResolvedCollections, Qn as useSidePanel, Qt as addInitialSlash, R as MultiSelectFieldBinding, Rn as DatePreview, Rt as ImportFileUpload, S as isSchemaChangeCancelled, Sn as useUrlController, Sr as FieldBlock, St as CollectionCardViewBinding, T as PropertyFieldBinding, Tn as useSideDialogsController, Tr as spanClass, Tt as useCollectionEditorController, U as BlockFieldBinding, Un as ArrayPropertyEnumPreview, Ut as ArrayContainer, V as KeyValueFieldBinding, Vn as ArrayOneOfPreview, Vt as parseCsvRows, W as ArrayOfReferencesFieldBinding, Wn as ArrayEnumPreview, Wt as PropertyConfigBadge, X as useTopLevelNavigation, Xn as EntityPreviewBinding, Xt as resolveEntityView, Y as useBuildNavigationStateController, Yn as ReferencePreview, Yt as resolveEntityAction, Z as useResolvedViews, Zn as SidePanelControllerContext, Zt as mergeEntityActions, _ as useCollectionsConfigController, _n as CollectionTableBinding, _r as ImagePreview, _t as editEntityAction, a as namespaceToPropertiesPath, an as resolveCollectionPathIds, ar as getEntityTitlePropertyKeyForEntity, at as getEntityViewWidth, b as asUnavailable, bn as useAdminContext, br as FormRail, bt as DetailViewBinding, c as buildCollectionGenerationCallback, cn as SelectionMenu, cr as EnumValuesChip, d as fromSerializableCollectionConfigs, dn as resolveSelection, dr as SkeletonPropertyComponent, dt as getInitialEntityValues, en as getCollectionPathsCombinations, er as useCollectionRegistryController, et as useBuildCollectionRegistryController, f as fromSerializableProperties, fn as selectionQueryToFindParams, fr as renderSkeletonCaptionText, ft as removeEmptyContainers, g as toSerializableProperty, gn as VirtualTableInput, gr as UrlComponentPreview, gt as deleteEntityAction, h as toSerializableProperties, hn as useSelectionController, hr as renderSkeletonText, ht as copyEntityAction, i as namespaceToPropertiesOrderPath, in as removeTrailingSlash, ir as getEntityTitlePropertyKey, it as buildSidePanelsFromUrl, j as VectorFieldBinding, jn as LabelWithIcon, jr as getPropertiesWithPropertiesOrder, jt as flattenEntry, k as getFieldConfig, kn as useClearRestoreValue, kr as getIconForProperty, kt as DataNewPropertiesMapping, l as validateCollectionJson, ln as MAX_SELECTION_ROWS, lr as StorageThumbnail, lt as extractTouchedValues, m as toSerializableCollectionConfig, mr as renderSkeletonImageThumbnail, mt as CollectionViewBinding, n as getFullIdPath, nn as removeInitialAndTrailingSlashes, nr as useResolvedUser, nt as resolveNavigationFrom, o as CollectionGenerationApiError, on as resolveOpenEntityMode, or as ArrayPropertyPreview, ot as useBuildSidePanel, p as fromSerializableProperty, pn as serializeSelectionQuery, pr as renderSkeletonIcon, pt as zodToFormErrors, q as SideDialogs, qn as ArrayOfReferencesPreview, qt as useBreadcrumbsController, r as idToPropertiesPath, rn as removeInitialSlash, rr as getEntityPreviewKeys, rt as useResolvedNavigationFrom, s as DEFAULT_COLLECTION_GENERATION_ENDPOINT, sn as resolveViewMode, sr as StringPropertyPreview, st as EditViewBinding, t as getFullId, tn as getLastSegment, tr as getUserLabel, tt as useHistory, u as fromSerializableCollectionConfig, un as SELECTION_PAGE_SIZE, ur as StorageThumbnailInternal, ut as getChanges, v as LiveSchemaError, vn as SelectableTable, vr as EmptyValue, vt as resetPasswordAction, w as EntityForm, wn as useNavigationStateController, wr as isSelfLabellingProperty, wt as CollectionViewActions, x as createLiveSchemaClient, xn as UrlContext, xr as RecordMeta, xt as EntityViewBinding, y as SchemaChangeCancelled, yn as CollectionRowActions, yr as FormSections, yt as CreationResultDialog, z as MarkdownEditorFieldBinding, zn as KeyValuePreview, zt as convertFileToJson } from "./util-CyIcgnv2.js";
2
2
  import { r as sanitizeUrl } from "./util-DB31IoJE.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";
3
+ import { i as PropertySelectEntry, n as ImportCollectionAction, r as ImportDataPreview } from "./import-Cxnmpyjl.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-LvIpE7sE.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";
@@ -613,6 +613,10 @@ var DefaultAppBar = function DefaultAppBar({ title, endAdornment, startAdornment
613
613
  const largeLayout = useLargeLayout();
614
614
  const user = userProp ?? authController.user;
615
615
  const { t } = useTranslation();
616
+ const rebaseContext = useRebaseContext();
617
+ const slotProps = React.useMemo(() => ({ context: rebaseContext }), [rebaseContext]);
618
+ const globalSearch = useSlot("global.search", slotProps);
619
+ const shellToolbar = useSlot("shell.toolbar", slotProps);
616
620
  let avatarComponent;
617
621
  if (user) {
618
622
  const initial = user?.displayName ? user.displayName[0].toUpperCase() : user?.email ? user.email[0].toUpperCase() : "A";
@@ -684,8 +688,10 @@ var DefaultAppBar = function DefaultAppBar({ title, endAdornment, startAdornment
684
688
  })
685
689
  }),
686
690
  startAdornment,
691
+ globalSearch,
687
692
  /* @__PURE__ */ jsx("div", { className: "grow" }),
688
693
  endAdornment && /* @__PURE__ */ jsx(ErrorBoundary, { children: endAdornment }),
694
+ shellToolbar,
689
695
  includeLanguageToggle && /* @__PURE__ */ jsx(LanguageToggle, {}),
690
696
  includeModeToggle && /* @__PURE__ */ jsxs(Menu, {
691
697
  trigger: /* @__PURE__ */ jsx(IconButton, {
@@ -1897,7 +1903,7 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
1897
1903
  //#region src/components/RebaseNavigation.tsx
1898
1904
  var EMPTY_PLUGINS = [];
1899
1905
  var EMPTY_COLLECTIONS = [];
1900
- var CollectionsStudioView = lazyChunk(() => import("./RouterCollectionsStudioView-C1BseTGZ.js").then((n) => n.n).then((m) => ({ default: m.RouterCollectionsStudioView })));
1906
+ var CollectionsStudioView = lazyChunk(() => import("./RouterCollectionsStudioView-EK8Knq5I.js").then((n) => n.n).then((m) => ({ default: m.RouterCollectionsStudioView })));
1901
1907
  /**
1902
1908
  * Navigation layer — builds and provides all admin navigation controllers:
1903
1909
  * collection registry, URL controller, navigation state, side entity,
@@ -2147,7 +2153,7 @@ function NavigationChip({ entry }) {
2147
2153
  onClick: () => navigate(entry.url),
2148
2154
  icon: /* @__PURE__ */ jsx(StarIcon, {
2149
2155
  onClick: onIconClick,
2150
- size: "small",
2156
+ size: iconSize.small,
2151
2157
  className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500"
2152
2158
  }),
2153
2159
  children: entry.name
@@ -3175,8 +3181,8 @@ function ContentHomePage({ additionalActions, additionalChildrenStart, additiona
3175
3181
  }
3176
3182
  //#endregion
3177
3183
  //#region src/components/CollectionEditorDialogs.tsx
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 })));
3184
+ var CollectionEditorDialog = lazyChunk(() => import("./CollectionEditorDialog-CUtfS_49.js").then((n) => n.r).then((m) => ({ default: m.CollectionEditorDialog })));
3185
+ var PropertyFormDialog = lazyChunk(() => import("./PropertyEditView-BpEbC0Q2.js").then((n) => n.t).then((m) => ({ default: m.PropertyFormDialog })));
3180
3186
  /**
3181
3187
  * Renders the CollectionEditorDialog and PropertyFormDialog inside
3182
3188
  * the RebaseShell tree where admin-internal contexts
@@ -3782,6 +3788,6 @@ function MissingReferenceWidget({ path: pathProp }) {
3782
3788
  });
3783
3789
  }
3784
3790
  //#endregion
3785
- export { AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanPreview, CollectionCardViewBinding, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionTableBinding, CollectionViewActions, CollectionViewBinding, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DefaultDrawer, Drawer, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityPreviewBinding, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FieldBlock, FieldCaption, FieldHelperText, FormRail, FormSections, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LabelWithIconAndTooltip, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MissingReferenceWidget, MultiSelectFieldBinding, NavigationStateContext, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyIdCopyTooltip, PropertyPreview, PropertySelectEntry, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordMeta, ReferenceFieldBinding, ReferencePreview, ReferenceWidget, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringPropertyPreview, SwitchFieldBinding, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, copyEntityAction, createLiveSchemaClient, createStaticDataController, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, flattenEntry, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, getUserLabel, idToPropertiesPath, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, parseCsvRows, parseCsvToObjects, processValueMapping, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveEntityAction, resolveEntityView, resolveNavigationFrom, resolveSelection, sanitizeUrl, saveImportedEntities, selectionQueryToFindParams, serializeSelectionQuery, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionRegistryController, useCollectionsConfigController, useHistory, useImportConfig, useJsonCollectionsConfigController, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSelectionController, useSelectionDialog, useSideDialogsController, useSidePanel, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
3791
+ export { AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanPreview, CollectionCardViewBinding, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionTableBinding, CollectionViewActions, CollectionViewBinding, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DefaultDrawer, Drawer, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityPreviewBinding, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FieldBlock, FieldCaption, FieldHelperText, FormRail, FormSections, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MissingReferenceWidget, MultiSelectFieldBinding, NavigationStateContext, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordMeta, ReferenceFieldBinding, ReferencePreview, ReferenceWidget, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringPropertyPreview, SwitchFieldBinding, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, copyEntityAction, createLiveSchemaClient, createStaticDataController, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, flattenEntry, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, getUserLabel, idToPropertiesPath, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, parseCsvRows, parseCsvToObjects, processValueMapping, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveEntityAction, resolveEntityView, resolveNavigationFrom, resolveSelection, sanitizeUrl, saveImportedEntities, selectionQueryToFindParams, serializeSelectionQuery, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionRegistryController, useCollectionsConfigController, useHistory, useImportConfig, useJsonCollectionsConfigController, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSelectionController, useSelectionDialog, useSideDialogsController, useSidePanel, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
3786
3792
 
3787
3793
  //# sourceMappingURL=index.js.map