@rebasepro/admin 0.13.1-canary.gf57a27e → 0.14.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.
- package/dist/{CollectionEditorDialog-BnfOcqM_.js → CollectionEditorDialog-CSheud_E.js} +19 -9
- package/dist/CollectionEditorDialog-CSheud_E.js.map +1 -0
- package/dist/{PropertyEditView-vLXglzIy.js → PropertyEditView-CWZlC1gq.js} +5 -5
- package/dist/PropertyEditView-CWZlC1gq.js.map +1 -0
- package/dist/{RouterCollectionsStudioView-DF3aiOuv.js → RouterCollectionsStudioView-CwTpdzWF.js} +4 -4
- package/dist/{RouterCollectionsStudioView-DF3aiOuv.js.map → RouterCollectionsStudioView-CwTpdzWF.js.map} +1 -1
- package/dist/collection_editor_ui.js +4 -4
- package/dist/components/ClearFilterSortButton.d.ts +7 -1
- package/dist/components/CollectionViewBinding/SortButton.d.ts +7 -1
- package/dist/components/RelationSelector.d.ts +13 -0
- package/dist/data_export/export/export.d.ts +7 -0
- package/dist/data_export/export/fetch_export_data.d.ts +48 -0
- package/dist/data_export/export/index.d.ts +1 -0
- package/dist/data_import/utils/csv.d.ts +30 -0
- package/dist/data_import/utils/index.d.ts +2 -0
- package/dist/data_import/utils/save_entities.d.ts +38 -0
- package/dist/data_import/utils/transforms.d.ts +9 -0
- package/dist/editor.js +3 -0
- package/dist/editor.js.map +1 -1
- package/dist/{export-C26xQN-g.js → export-L53WektO.js} +175 -39
- package/dist/export-L53WektO.js.map +1 -0
- package/dist/{history-DSS-Ebwh.js → history-D5SKygpJ.js} +2 -2
- package/dist/{history-DSS-Ebwh.js.map → history-D5SKygpJ.js.map} +1 -1
- package/dist/{import-Dhx96B6x.js → import-C_4edkoD.js} +5 -4
- package/dist/import-C_4edkoD.js.map +1 -0
- package/dist/index.js +93 -74
- package/dist/index.js.map +1 -1
- package/dist/preview/components/date_fns_locales.d.ts +9 -0
- package/dist/{util-Bt6VadeZ.js → util-C-D5yD2n.js} +567 -113
- package/dist/util-C-D5yD2n.js.map +1 -0
- package/package.json +10 -9
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +8 -3
- package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +5 -2
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +1 -0
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +9 -8
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +5 -2
- package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +5 -2
- package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +1 -0
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +92 -84
- package/src/collection_editor/useLocalCollectionsConfigController.tsx +10 -3
- package/src/components/ClearFilterSortButton.tsx +16 -7
- package/src/components/CollectionTableBinding/table_bindings.tsx +7 -1
- package/src/components/CollectionViewBinding/CollectionBoardViewBinding.tsx +13 -7
- package/src/components/CollectionViewBinding/CollectionViewBinding.tsx +1 -0
- package/src/components/CollectionViewBinding/CollectionViewStartActions.tsx +9 -0
- package/src/components/CollectionViewBinding/SortButton.tsx +16 -4
- package/src/components/CollectionViewBinding/ViewModeToggle.tsx +10 -5
- package/src/components/CollectionViewBinding/useBoardDataController.tsx +11 -3
- package/src/components/DefaultDrawer.tsx +7 -0
- package/src/components/DrawerNavigationItem.tsx +12 -0
- package/src/components/RelationSelector.tsx +52 -5
- package/src/components/SearchIconsView.tsx +14 -33
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +1 -0
- package/src/components/UserSelector.tsx +47 -5
- package/src/data_export/export/ExportCollectionAction.tsx +101 -48
- package/src/data_export/export/export.ts +63 -16
- package/src/data_export/export/fetch_export_data.ts +90 -0
- package/src/data_export/export/index.ts +1 -0
- package/src/data_import/components/DataNewPropertiesMapping.tsx +20 -3
- package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +1 -0
- package/src/data_import/components/ImportSaveInProgress.tsx +35 -36
- package/src/data_import/import/ImportCollectionAction.tsx +13 -2
- package/src/data_import/utils/csv.ts +153 -0
- package/src/data_import/utils/data.ts +7 -1
- package/src/data_import/utils/file_to_json.ts +77 -6
- package/src/data_import/utils/index.ts +2 -0
- package/src/data_import/utils/save_entities.ts +138 -0
- package/src/data_import/utils/transforms.ts +23 -0
- package/src/editor/components/image-bubble.tsx +2 -0
- package/src/editor/selectors/link-selector.tsx +1 -0
- package/src/form/field_bindings/BinaryFieldBinding.tsx +1 -0
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +4 -0
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +3 -0
- package/src/form/field_bindings/TextFieldBinding.tsx +18 -0
- package/src/form/field_bindings/VectorFieldBinding.tsx +1 -0
- package/src/preview/components/DatePreview.tsx +15 -2
- package/src/preview/components/ReferencePreview.tsx +5 -8
- package/src/preview/components/RelationPreview.tsx +8 -7
- package/src/preview/components/date_fns_locales.ts +125 -0
- package/dist/CollectionEditorDialog-BnfOcqM_.js.map +0 -1
- package/dist/PropertyEditView-vLXglzIy.js.map +0 -1
- package/dist/export-C26xQN-g.js.map +0 -1
- package/dist/import-Dhx96B6x.js.map +0 -1
- package/dist/util-Bt6VadeZ.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Ct as convertDataToEntity, Dt as useImportConfig, Et as getInferenceType, Hn as useCollectionRegistryController, Ot as ImportSaveInProgress, Rt as PropertyConfigBadge, St as DataNewPropertiesMapping, br as getPropertiesWithPropertiesOrder, in as CollectionTableBinding, jt as ImportFileUpload, nn as useSelectionController, w as getFieldConfig, xr as getPropertyInPath$1 } from "./util-C-D5yD2n.js";
|
|
3
3
|
import React, { useCallback, useEffect } from "react";
|
|
4
4
|
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, Select, SelectItem, Tooltip, Typography, UploadIcon, cls, defaultBorderMixin, iconSize } from "@rebasepro/ui";
|
|
5
5
|
import { useAuthController, useCustomizationController, useSnackbarController } from "@rebasepro/app";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { slugify } from "@rebasepro/utils";
|
|
7
|
+
import { isPrototypePollutingKey, slugify } from "@rebasepro/utils";
|
|
8
8
|
import { buildEntityPropertiesFromData } from "@rebasepro/inference";
|
|
9
9
|
//#region src/data_import/import/ImportCollectionAction.tsx
|
|
10
10
|
function ImportCollectionAction({ collection, path, onAnalyticsEvent }) {
|
|
@@ -275,7 +275,7 @@ function ImportDataPreview({ importConfig, properties, propertiesOrder }) {
|
|
|
275
275
|
children: "Imported data preview"
|
|
276
276
|
}), /* @__PURE__ */ jsx(Typography, {
|
|
277
277
|
variant: "caption",
|
|
278
|
-
children: "Entities with the same id will be overwritten"
|
|
278
|
+
children: importConfig.idColumn ? "Entities with the same id will be overwritten" : "All rows will be imported as new entities"
|
|
279
279
|
})] }),
|
|
280
280
|
tableController: {
|
|
281
281
|
data: importConfig.entities,
|
|
@@ -295,6 +295,7 @@ function buildHeadersMappingFromData(objArr, properties) {
|
|
|
295
295
|
const headersMapping = {};
|
|
296
296
|
objArr.filter(Boolean).forEach((obj) => {
|
|
297
297
|
Object.keys(obj).forEach((key) => {
|
|
298
|
+
if (isPrototypePollutingKey(key)) return;
|
|
298
299
|
const child = obj[key];
|
|
299
300
|
if (child != null && typeof child === "object" && !Array.isArray(child)) {
|
|
300
301
|
const childProperty = properties?.[key];
|
|
@@ -325,4 +326,4 @@ var import_exports = /* @__PURE__ */ __exportAll({
|
|
|
325
326
|
//#endregion
|
|
326
327
|
export { PropertySelectEntry as i, ImportCollectionAction as n, ImportDataPreview as r, import_exports as t };
|
|
327
328
|
|
|
328
|
-
//# sourceMappingURL=import-
|
|
329
|
+
//# sourceMappingURL=import-C_4edkoD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-C_4edkoD.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/admin-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;\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ACjB,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"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as getEntityViewWidth, $n as
|
|
2
|
-
import { i as PropertySelectEntry, n as ImportCollectionAction, r as ImportDataPreview } from "./import-
|
|
3
|
-
import { a as
|
|
1
|
+
import { $ as getEntityViewWidth, $n as SkeletonPropertyComponent, $t as resolveCollectionPathIds, A as SelectFieldBinding, An as ArrayOfStringsPreview, At as saveImportedEntities, B as useSelectionDialog, Bn as useSidePanel, Bt as FieldCaption, C as getDefaultFieldId, Cn as UserPreview, Cr as isReferenceProperty, Ct as convertDataToEntity, D as TextFieldBinding, Dn as KeyValuePreview, Dt as useImportConfig, E as VectorFieldBinding, En as DatePreview, Et as getInferenceType, F as MapFieldBinding, Fn as ArrayOfReferencesPreview, Ft as parseCsvToObjects, G as useTopLevelNavigation, Gn as getEntityPreviewKeys, Gt as mergeEntityActions, H as SideDialogs, Hn as useCollectionRegistryController, Ht as BreadcrumbsProvider, I as KeyValueFieldBinding, In as InlineEntityListPreview, It as unflattenObject, J as useBuildCollectionRegistryController, Jn as ArrayPropertyPreview, Jt as getCollectionPathsCombinations, K as useResolvedViews, Kn as getEntityTitlePropertyKey, Kt as addInitialSlash, L as DateTimeFieldBinding, Ln as ReferencePreview, Lt as ArrayContainer, M as ReferenceFieldBinding, Mn as ArrayEnumPreview, Mt as convertFileToJson, N as MultiSelectFieldBinding, Nn as ArrayOfStorageComponentsPreview, Nt as detectCsvDelimiter, O as SwitchFieldBinding, On as MapPropertyPreview, Ot as ImportSaveInProgress, P as MarkdownEditorFieldBinding, Pn as RelationPreview, Pt as parseCsvRows, Q as buildSidePanelsFromUrl, Qn as StorageThumbnailInternal, Qt as removeTrailingSlash, R as BlockFieldBinding, Rn as EntityPreviewBinding, Rt as PropertyConfigBadge, S as getDefaultFieldConfig, Sn as PropertyPreview, Sr as getResolvedPropertyInPath, St as DataNewPropertiesMapping, T as getFieldId, Tn as BooleanPreview, Tt as processValueMapping, U as useBuildUrlController, Un as getUserLabel, Ut as resolveEntityAction, V as SelectionTableBinding, Vn as CollectionRegistryContext, Vt as useBreadcrumbsController, W as useBuildNavigationStateController, Wn as useResolvedUser, Wt as resolveEntityView, X as resolveNavigationFrom, Xn as EnumValuesChip, Xt as removeInitialAndTrailingSlashes, Y as useHistory, Yn as StringPropertyPreview, Yt as getLastSegment, Z as useResolvedNavigationFrom, Zn as StorageThumbnail, Zt as removeInitialSlash, _ as useCollectionsConfigController, _n as ReadOnlyFieldBinding, _r as getDefaultPropertiesOrder, _t as CollectionViewActions, a as namespaceToPropertiesPath, an as SelectableTable, ar as ImagePreview, at as removeEmptyContainers, b as PropertyFieldBinding, bn as FieldHelperText, br as getPropertiesWithPropertiesOrder, bt as useCollectionEditorDialogsState, c as buildCollectionGenerationCallback, cn as UrlContext, cr as FormSections, ct as copyEntityAction, d as fromSerializableCollectionConfigs, dn as useNavigationStateController, dr as FieldBlock, dt as resetPasswordAction, en as resolveOpenEntityMode, er as renderSkeletonCaptionText, et as useBuildSidePanel, f as fromSerializableProperties, fn as useSideDialogsController, fr as LABEL_ICON_SIZE, ft as CreationResultDialog, g as toSerializableProperty, gn as useClearRestoreValue, gr as getBracketNotation, gt as EntityCardBinding, h as toSerializableProperties, hn as ArrayCustomShapedFieldBinding, hr as PropertyIdCopyTooltip, ht as CollectionCardViewBinding, i as namespaceToPropertiesOrderPath, in as CollectionTableBinding, ir as UrlComponentPreview, it as getInitialEntityValues, j as RepeatFieldBinding, jn as ArrayPropertyEnumPreview, jt as ImportFileUpload, k as StorageUploadFieldBinding, kn as ArrayOneOfPreview, kt as IMPORT_BATCH_SIZE, l as validateCollectionJson, ln as useUrlController, lr as FormRail, lt as deleteEntityAction, m as toSerializableCollectionConfig, mn as SelectableTableContext, mr as spanClass, mt as EntityViewBinding, n as getFullIdPath, nn as useSelectionController, nr as renderSkeletonImageThumbnail, nt as extractTouchedValues, o as CollectionGenerationApiError, on as CollectionRowActions, or as sanitizeUrl, ot as zodToFormErrors, p as fromSerializableProperty, pn as SideDialogsControllerContext, pr as isSelfLabellingProperty, pt as DetailViewBinding, q as useResolvedCollections, qn as getEntityTitlePropertyKeyForEntity, qt as getCollectionBySlugWithin, r as idToPropertiesPath, rn as VirtualTableInput, rr as renderSkeletonText, rt as getChanges, s as DEFAULT_COLLECTION_GENERATION_ENDPOINT, sn as useAdminContext, sr as EmptyValue, st as CollectionViewBinding, t as getFullId, tn as resolveViewMode, tr as renderSkeletonIcon, tt as EditViewBinding, u as fromSerializableCollectionConfig, un as NavigationStateContext, ur as RecordMeta, ut as editEntityAction, v as EntityFormBinding, vn as LabelWithIconAndTooltip, vr as getIconForProperty, vt as useCollectionEditorController, w as getFieldConfig, wn as NumberPropertyPreview, wr as isRelationProperty, wt as flattenEntry, x as DEFAULT_FIELD_CONFIGS, xn as ArrayOfMapsPreview, xr as getPropertyInPath, xt as ImportNewPropertyFieldPreview, y as EntityForm, yn as LabelWithIcon, yr as getIconForWidget, yt as ConfigControllerProvider, z as ArrayOfReferencesFieldBinding, zn as SidePanelControllerContext, zt as SearchIconsView } from "./util-C-D5yD2n.js";
|
|
2
|
+
import { i as PropertySelectEntry, n as ImportCollectionAction, r as ImportDataPreview } from "./import-C_4edkoD.js";
|
|
3
|
+
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-L53WektO.js";
|
|
4
4
|
import React, { Suspense, lazy, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { deepEqual } from "fast-equals";
|
|
6
6
|
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 } from "@rebasepro/ui";
|
|
@@ -786,6 +786,7 @@ function DrawerNavigationItem({ name, icon, drawerOpen, url, onClick, indented =
|
|
|
786
786
|
if (drawerOpen && wantsTooltip) setWantsTooltip(false);
|
|
787
787
|
const listItem = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(NavLink, {
|
|
788
788
|
onClick,
|
|
789
|
+
"aria-label": name,
|
|
789
790
|
style: {
|
|
790
791
|
width: "100%",
|
|
791
792
|
transition: drawerOpen ? "width 150ms ease-in" : void 0
|
|
@@ -985,11 +986,14 @@ function AdminNavigationContent() {
|
|
|
985
986
|
] });
|
|
986
987
|
}
|
|
987
988
|
function DrawerLogo({ logo, title, logoDestination = "/", drawerOpen, drawerHovered }) {
|
|
989
|
+
const showFullContent = drawerOpen || drawerHovered;
|
|
990
|
+
const { t } = useTranslation();
|
|
988
991
|
return /* @__PURE__ */ jsxs("div", {
|
|
989
992
|
className: "flex flex-row items-center shrink-0 pt-4 pb-0 px-2",
|
|
990
993
|
children: [/* @__PURE__ */ jsx(Link, {
|
|
991
994
|
className: "shrink-0 flex items-center justify-center w-[56px] h-[40px]",
|
|
992
995
|
to: logoDestination,
|
|
996
|
+
"aria-label": t("home") || "Home",
|
|
993
997
|
children: logo ? /* @__PURE__ */ jsx("img", {
|
|
994
998
|
src: logo,
|
|
995
999
|
alt: "Logo",
|
|
@@ -999,7 +1003,7 @@ function DrawerLogo({ logo, title, logoDestination = "/", drawerOpen, drawerHove
|
|
|
999
1003
|
height: "28px"
|
|
1000
1004
|
})
|
|
1001
1005
|
}), /* @__PURE__ */ jsx("div", {
|
|
1002
|
-
className: cls("flex flex-row items-center overflow-hidden transition-all duration-200 ease-in-out",
|
|
1006
|
+
className: cls("flex flex-row items-center overflow-hidden transition-all duration-200 ease-in-out", showFullContent ? "opacity-100 w-full ml-1" : "opacity-0 w-0 ml-0"),
|
|
1003
1007
|
children: title && /* @__PURE__ */ jsx(Link, {
|
|
1004
1008
|
className: "visited:text-inherit dark:visited:text-inherit block truncate",
|
|
1005
1009
|
to: logoDestination,
|
|
@@ -1621,7 +1625,8 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
|
|
|
1621
1625
|
});
|
|
1622
1626
|
if (newPropertiesOrder) await request("/collection/save", {
|
|
1623
1627
|
collectionId: path,
|
|
1624
|
-
collectionData: { propertiesOrder: newPropertiesOrder }
|
|
1628
|
+
collectionData: { propertiesOrder: newPropertiesOrder },
|
|
1629
|
+
partial: true
|
|
1625
1630
|
});
|
|
1626
1631
|
},
|
|
1627
1632
|
deleteProperty: async ({ path, propertyKey, newPropertiesOrder }) => {
|
|
@@ -1631,14 +1636,16 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
|
|
|
1631
1636
|
});
|
|
1632
1637
|
if (newPropertiesOrder) await request("/collection/save", {
|
|
1633
1638
|
collectionId: path,
|
|
1634
|
-
collectionData: { propertiesOrder: newPropertiesOrder }
|
|
1639
|
+
collectionData: { propertiesOrder: newPropertiesOrder },
|
|
1640
|
+
partial: true
|
|
1635
1641
|
});
|
|
1636
1642
|
},
|
|
1637
1643
|
updatePropertiesOrder: async ({ collection, fullPath, newPropertiesOrder }) => {
|
|
1638
1644
|
const collectionId = collection.id || fullPath.split("/").pop();
|
|
1639
1645
|
await request("/collection/save", {
|
|
1640
1646
|
collectionId,
|
|
1641
|
-
collectionData: { propertiesOrder: newPropertiesOrder }
|
|
1647
|
+
collectionData: { propertiesOrder: newPropertiesOrder },
|
|
1648
|
+
partial: true
|
|
1642
1649
|
});
|
|
1643
1650
|
},
|
|
1644
1651
|
updateKanbanColumnsOrder: async () => {},
|
|
@@ -1656,7 +1663,7 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
|
|
|
1656
1663
|
//#region src/components/RebaseNavigation.tsx
|
|
1657
1664
|
var EMPTY_PLUGINS = [];
|
|
1658
1665
|
var EMPTY_COLLECTIONS = [];
|
|
1659
|
-
var CollectionsStudioView = lazy(() => import("./RouterCollectionsStudioView-
|
|
1666
|
+
var CollectionsStudioView = lazy(() => import("./RouterCollectionsStudioView-CwTpdzWF.js").then((n) => n.n).then((m) => ({ default: m.RouterCollectionsStudioView })));
|
|
1660
1667
|
/**
|
|
1661
1668
|
* Navigation layer — builds and provides all admin navigation controllers:
|
|
1662
1669
|
* collection registry, URL controller, navigation state, side entity,
|
|
@@ -2885,8 +2892,8 @@ function ContentHomePage({ additionalActions, additionalChildrenStart, additiona
|
|
|
2885
2892
|
}
|
|
2886
2893
|
//#endregion
|
|
2887
2894
|
//#region src/components/CollectionEditorDialogs.tsx
|
|
2888
|
-
var CollectionEditorDialog = lazy(() => import("./CollectionEditorDialog-
|
|
2889
|
-
var PropertyFormDialog = lazy(() => import("./PropertyEditView-
|
|
2895
|
+
var CollectionEditorDialog = lazy(() => import("./CollectionEditorDialog-CSheud_E.js").then((n) => n.r).then((m) => ({ default: m.CollectionEditorDialog })));
|
|
2896
|
+
var PropertyFormDialog = lazy(() => import("./PropertyEditView-CWZlC1gq.js").then((n) => n.t).then((m) => ({ default: m.PropertyFormDialog })));
|
|
2890
2897
|
/**
|
|
2891
2898
|
* Renders the CollectionEditorDialog and PropertyFormDialog inside
|
|
2892
2899
|
* the RebaseShell tree where admin-internal contexts
|
|
@@ -3306,6 +3313,23 @@ function useJsonCollectionsConfigController({ store, readOnly = false, autoLoad
|
|
|
3306
3313
|
const [navigationEntries, setNavigationEntries] = useState([]);
|
|
3307
3314
|
const storeRef = useRef(store);
|
|
3308
3315
|
storeRef.current = store;
|
|
3316
|
+
/**
|
|
3317
|
+
* The current collections, readable outside a state updater.
|
|
3318
|
+
*
|
|
3319
|
+
* Three mutators used to compute their new value inside
|
|
3320
|
+
* `setCollections(prev => …)` and persist from in there, which cost them
|
|
3321
|
+
* both halves of a save: the promise they returned resolved before the
|
|
3322
|
+
* store had answered, so a failed write reached the caller as a success,
|
|
3323
|
+
* and a `setState` updater must be pure — under `StrictMode` React invokes
|
|
3324
|
+
* it twice, so every one of those saves wrote to the store twice in
|
|
3325
|
+
* development. Reading `prev` from a ref lets them do what
|
|
3326
|
+
* `updatePropertiesOrder` already did: compute, set, then await.
|
|
3327
|
+
*/
|
|
3328
|
+
const collectionsRef = useRef([]);
|
|
3329
|
+
const applyCollections = useCallback((next) => {
|
|
3330
|
+
collectionsRef.current = next;
|
|
3331
|
+
setCollections(next);
|
|
3332
|
+
}, []);
|
|
3309
3333
|
useEffect(() => {
|
|
3310
3334
|
if (!autoLoad) return;
|
|
3311
3335
|
let cancelled = false;
|
|
@@ -3313,7 +3337,7 @@ function useJsonCollectionsConfigController({ store, readOnly = false, autoLoad
|
|
|
3313
3337
|
try {
|
|
3314
3338
|
const [serialized, navEntries] = await Promise.all([storeRef.current.load(), storeRef.current.loadNavigationEntries?.() ?? Promise.resolve([])]);
|
|
3315
3339
|
if (cancelled) return;
|
|
3316
|
-
|
|
3340
|
+
applyCollections(fromSerializableCollectionConfigs(serialized));
|
|
3317
3341
|
setNavigationEntries(navEntries);
|
|
3318
3342
|
} catch (e) {
|
|
3319
3343
|
console.error("useJsonCollectionsConfigController: failed to load collections", e);
|
|
@@ -3324,7 +3348,7 @@ function useJsonCollectionsConfigController({ store, readOnly = false, autoLoad
|
|
|
3324
3348
|
return () => {
|
|
3325
3349
|
cancelled = true;
|
|
3326
3350
|
};
|
|
3327
|
-
}, [autoLoad]);
|
|
3351
|
+
}, [autoLoad, applyCollections]);
|
|
3328
3352
|
/**
|
|
3329
3353
|
* Update local state and persist a collection to the store.
|
|
3330
3354
|
*/
|
|
@@ -3343,80 +3367,75 @@ function useJsonCollectionsConfigController({ store, readOnly = false, autoLoad
|
|
|
3343
3367
|
const saveCollection = useCallback(async ({ id, collectionData }) => {
|
|
3344
3368
|
const collection = collectionData;
|
|
3345
3369
|
await persistCollection(collection);
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
const next = [...prev];
|
|
3350
|
-
next[idx] = collection;
|
|
3351
|
-
return next;
|
|
3352
|
-
}
|
|
3353
|
-
return [...prev, collection];
|
|
3354
|
-
});
|
|
3355
|
-
}, [persistCollection]);
|
|
3356
|
-
const updateCollection = useCallback(async ({ id, collectionData, previousId }) => {
|
|
3357
|
-
setCollections((prev) => {
|
|
3358
|
-
const lookupId = previousId ?? id;
|
|
3359
|
-
const idx = prev.findIndex((c) => c.slug === lookupId);
|
|
3360
|
-
if (idx < 0) return prev;
|
|
3361
|
-
const merged = {
|
|
3362
|
-
...prev[idx],
|
|
3363
|
-
...collectionData
|
|
3364
|
-
};
|
|
3370
|
+
const prev = collectionsRef.current;
|
|
3371
|
+
const idx = prev.findIndex((c) => c.slug === id);
|
|
3372
|
+
if (idx >= 0) {
|
|
3365
3373
|
const next = [...prev];
|
|
3366
|
-
next[idx] =
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3374
|
+
next[idx] = collection;
|
|
3375
|
+
applyCollections(next);
|
|
3376
|
+
} else applyCollections([...prev, collection]);
|
|
3377
|
+
}, [persistCollection, applyCollections]);
|
|
3378
|
+
const updateCollection = useCallback(async ({ id, collectionData, previousId }) => {
|
|
3379
|
+
const prev = collectionsRef.current;
|
|
3380
|
+
const lookupId = previousId ?? id;
|
|
3381
|
+
const idx = prev.findIndex((c) => c.slug === lookupId);
|
|
3382
|
+
if (idx < 0) return;
|
|
3383
|
+
const merged = {
|
|
3384
|
+
...prev[idx],
|
|
3385
|
+
...collectionData
|
|
3386
|
+
};
|
|
3387
|
+
const next = [...prev];
|
|
3388
|
+
next[idx] = merged;
|
|
3389
|
+
applyCollections(next);
|
|
3390
|
+
await persistCollection(merged);
|
|
3391
|
+
if (previousId && previousId !== id) await storeRef.current.delete(previousId);
|
|
3392
|
+
}, [persistCollection, applyCollections]);
|
|
3372
3393
|
const deleteCollection = useCallback(async ({ id }) => {
|
|
3373
3394
|
await storeRef.current.delete(id);
|
|
3374
|
-
|
|
3375
|
-
}, []);
|
|
3395
|
+
applyCollections(collectionsRef.current.filter((c) => c.slug !== id));
|
|
3396
|
+
}, [applyCollections]);
|
|
3376
3397
|
const saveProperty = useCallback(async ({ path, propertyKey, property, newPropertiesOrder }) => {
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
}, [persistCollection]);
|
|
3398
|
+
const prev = collectionsRef.current;
|
|
3399
|
+
const idx = prev.findIndex((c) => c.slug === path);
|
|
3400
|
+
if (idx < 0) return;
|
|
3401
|
+
const collection = { ...prev[idx] };
|
|
3402
|
+
collection.properties = {
|
|
3403
|
+
...collection.properties,
|
|
3404
|
+
[propertyKey]: property
|
|
3405
|
+
};
|
|
3406
|
+
if (newPropertiesOrder) collection.propertiesOrder = newPropertiesOrder;
|
|
3407
|
+
const next = [...prev];
|
|
3408
|
+
next[idx] = collection;
|
|
3409
|
+
applyCollections(next);
|
|
3410
|
+
await persistCollection(next[idx]);
|
|
3411
|
+
}, [persistCollection, applyCollections]);
|
|
3392
3412
|
const deleteProperty = useCallback(async ({ path, propertyKey, newPropertiesOrder }) => {
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
}, [persistCollection]);
|
|
3413
|
+
const prev = collectionsRef.current;
|
|
3414
|
+
const idx = prev.findIndex((c) => c.slug === path);
|
|
3415
|
+
if (idx < 0) return;
|
|
3416
|
+
const collection = { ...prev[idx] };
|
|
3417
|
+
const { [propertyKey]: _removed, ...remaining } = collection.properties;
|
|
3418
|
+
collection.properties = remaining;
|
|
3419
|
+
if (newPropertiesOrder) collection.propertiesOrder = newPropertiesOrder;
|
|
3420
|
+
const next = [...prev];
|
|
3421
|
+
next[idx] = collection;
|
|
3422
|
+
applyCollections(next);
|
|
3423
|
+
await persistCollection(next[idx]);
|
|
3424
|
+
}, [persistCollection, applyCollections]);
|
|
3406
3425
|
const updatePropertiesOrder = useCallback(async ({ collection, newPropertiesOrder }) => {
|
|
3407
3426
|
const updated = {
|
|
3408
3427
|
...collection,
|
|
3409
3428
|
propertiesOrder: newPropertiesOrder
|
|
3410
3429
|
};
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3430
|
+
const prev = collectionsRef.current;
|
|
3431
|
+
const idx = prev.findIndex((c) => c.slug === collection.slug);
|
|
3432
|
+
if (idx >= 0) {
|
|
3414
3433
|
const next = [...prev];
|
|
3415
3434
|
next[idx] = updated;
|
|
3416
|
-
|
|
3417
|
-
}
|
|
3435
|
+
applyCollections(next);
|
|
3436
|
+
}
|
|
3418
3437
|
await persistCollection(updated);
|
|
3419
|
-
}, [persistCollection]);
|
|
3438
|
+
}, [persistCollection, applyCollections]);
|
|
3420
3439
|
const updateKanbanColumnsOrder = useCallback(async ({ collection, kanbanColumnProperty, newColumnsOrder }) => {}, []);
|
|
3421
3440
|
const saveNavigationEntriesHandler = useCallback(async (entries) => {
|
|
3422
3441
|
setNavigationEntries(entries);
|
|
@@ -3484,6 +3503,6 @@ function MissingReferenceWidget({ path: pathProp }) {
|
|
|
3484
3503
|
});
|
|
3485
3504
|
}
|
|
3486
3505
|
//#endregion
|
|
3487
|
-
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, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityPreviewBinding, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FieldBlock, FieldCaption, FieldHelperText, FormRail, FormSections, ImagePreview, ImportCollectionAction, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LabelWithIconAndTooltip, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MissingReferenceWidget, MultiSelectFieldBinding, NavigationStateContext, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyIdCopyTooltip, PropertyPreview, PropertySelectEntry, ReadOnlyFieldBinding, RebaseAdmin, RebaseAuthGate, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordMeta, ReferenceFieldBinding, ReferencePreview, ReferenceWidget, RelationPreview, RepeatFieldBinding, Scaffold, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringPropertyPreview, SwitchFieldBinding, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, copyEntityAction, createStaticDataController, deleteEntityAction, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, extractTouchedValues, 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, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, processValueMapping, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveEntityAction, resolveEntityView, resolveNavigationFrom, sanitizeUrl, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unflattenObject, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionRegistryController, useCollectionsConfigController, useHistory, useImportConfig, useJsonCollectionsConfigController, useLocalCollectionsConfigController, useNavigationStateController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSelectionController, useSelectionDialog, useSideDialogsController, useSidePanel, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
|
|
3506
|
+
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, MAX_EXPORT_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MissingReferenceWidget, MultiSelectFieldBinding, NavigationStateContext, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyIdCopyTooltip, PropertyPreview, PropertySelectEntry, ReadOnlyFieldBinding, RebaseAdmin, RebaseAuthGate, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordMeta, ReferenceFieldBinding, ReferencePreview, ReferenceWidget, RelationPreview, RepeatFieldBinding, Scaffold, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringPropertyPreview, SwitchFieldBinding, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, copyEntityAction, 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, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, parseCsvRows, parseCsvToObjects, processValueMapping, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveEntityAction, resolveEntityView, resolveNavigationFrom, sanitizeUrl, saveImportedEntities, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unflattenObject, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionRegistryController, useCollectionsConfigController, useHistory, useImportConfig, useJsonCollectionsConfigController, useLocalCollectionsConfigController, useNavigationStateController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSelectionController, useSelectionDialog, useSideDialogsController, useSidePanel, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
|
|
3488
3507
|
|
|
3489
3508
|
//# sourceMappingURL=index.js.map
|