@firecms/core 3.0.0-canary.165 → 3.0.0-canary.167
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/components/common/default_entity_actions.d.ts +0 -2
- package/dist/components/common/useColumnsIds.d.ts +1 -0
- package/dist/index.es.js +39 -39
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +38 -38
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collections.d.ts +1 -1
- package/dist/types/dialogs_controller.d.ts +6 -2
- package/dist/types/entity_actions.d.ts +15 -0
- package/dist/util/entity_actions.d.ts +2 -0
- package/dist/util/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +5 -4
- package/src/components/common/default_entity_actions.tsx +3 -28
- package/src/components/common/useColumnsIds.tsx +1 -1
- package/src/contexts/DialogsProvider.tsx +1 -0
- package/src/core/EntityEditView.tsx +6 -2
- package/src/preview/PropertyPreview.tsx +2 -2
- package/src/types/collections.ts +1 -1
- package/src/types/dialogs_controller.tsx +6 -2
- package/src/types/entity_actions.tsx +18 -0
- package/src/util/entity_actions.ts +28 -0
- package/src/util/index.ts +1 -0
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { EntityAction } from "../../types";
|
|
2
2
|
export declare const editEntityAction: EntityAction;
|
|
3
3
|
export declare const copyEntityAction: EntityAction;
|
|
4
|
-
export declare const archiveEntityAction: EntityAction;
|
|
5
|
-
export declare const openWebsiteAction: EntityAction;
|
|
6
4
|
export declare const deleteEntityAction: EntityAction;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EntityCollection, ResolvedEntityCollection, ResolvedProperty } from "../../types";
|
|
2
2
|
import { PropertyColumnConfig } from "../EntityCollectionTable/EntityCollectionTableProps";
|
|
3
|
+
export declare const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
|
|
3
4
|
export declare function useColumnIds<M extends Record<string, any>>(collection: ResolvedEntityCollection<M>, includeSubcollections: boolean): PropertyColumnConfig[];
|
|
4
5
|
export declare function getColumnKeysForProperty(property: ResolvedProperty, key: string, disabled?: boolean): PropertyColumnConfig[];
|
|
5
6
|
export declare function getFormFieldKeys(collection: EntityCollection): string[];
|
package/dist/index.es.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import React__default, { forwardRef, useState, useRef, useEffect, useContext, useCallback, useMemo, createRef, createContext, useLayoutEffect, createElement } from "react";
|
|
5
|
-
import { getColorSchemeForSeed, CHIP_COLORS, Tooltip, IconButton, InfoIcon, Typography, ContentCopyIcon, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, ErrorIcon, cls, defaultBorderMixin, OpenInNewIcon, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, Skeleton, paperMixin, EditIcon, KeyboardTabIcon, DoNotDisturbOnIcon, Menu, MoreVertIcon, MenuItem, Checkbox, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, CenteredView, AssignmentIcon, Label, CloseIcon, TextField, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogTitle, DialogContent, DialogActions, FileCopyIcon,
|
|
5
|
+
import { getColorSchemeForSeed, CHIP_COLORS, Tooltip, IconButton, InfoIcon, Typography, ContentCopyIcon, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, ErrorIcon, cls, defaultBorderMixin, OpenInNewIcon, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, Skeleton, paperMixin, EditIcon, KeyboardTabIcon, DoNotDisturbOnIcon, Menu, MoreVertIcon, MenuItem, Checkbox, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, CenteredView, AssignmentIcon, Label, CloseIcon, TextField, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogTitle, DialogContent, DialogActions, FileCopyIcon, DeleteIcon, AddIcon, ExpandablePanel, Markdown, ArrowForwardIcon, Card, cardMixin, cardClickableMixin, StarIcon, Chip, Collapse, Container, NotesIcon, Tab, Tabs, Alert, FilterListOffIcon, SearchIcon, LoadingButton, Avatar, DarkModeIcon, LightModeIcon, LogoutIcon, HandleIcon, RemoveIcon, KeyboardArrowUpIcon, KeyboardArrowDownIcon, debounce, DescriptionIcon, fieldBackgroundMixin, fieldBackgroundHoverMixin, fieldBackgroundDisabledMixin, ArrowDropDownIcon, ShortTextIcon, SubjectIcon, FormatQuoteIcon, HttpIcon, MailIcon, FlagIcon, ListIcon, ListAltIcon, NumbersIcon, FormatListNumberedIcon, UploadFileIcon, DriveFolderUploadIcon, LinkIcon, AddLinkIcon, ScheduleIcon, BallotIcon, RepeatIcon, ViewStreamIcon, Sheet, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
|
|
6
6
|
import { SnackbarProvider as SnackbarProvider$1, useSnackbar } from "notistack";
|
|
7
7
|
import hash from "object-hash";
|
|
8
8
|
import { useFormex, setIn, getIn, useCreateFormex, Formex, Field } from "@firecms/formex";
|
|
@@ -874,6 +874,28 @@ function isValidRegExp(input) {
|
|
|
874
874
|
const simpleRegexp = input.match(/((?![*+?])(?:[^\r\n[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*])+)/);
|
|
875
875
|
return !!simpleRegexp;
|
|
876
876
|
}
|
|
877
|
+
const reservedKeys = ["edit", "copy", "delete"];
|
|
878
|
+
function mergeEntityActions(currentActions, newActions) {
|
|
879
|
+
const updatedActions = [];
|
|
880
|
+
currentActions.forEach((action) => {
|
|
881
|
+
const newAction = newActions.find((a) => a.key === action.key);
|
|
882
|
+
if (newAction) {
|
|
883
|
+
const mergedAction = {
|
|
884
|
+
...action,
|
|
885
|
+
...newAction
|
|
886
|
+
};
|
|
887
|
+
updatedActions.push(mergedAction);
|
|
888
|
+
} else {
|
|
889
|
+
updatedActions.push(action);
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
newActions.forEach((action) => {
|
|
893
|
+
if (!currentActions.find((a) => a.key === action.key) && (!action.key || !reservedKeys.includes(action.key))) {
|
|
894
|
+
updatedActions.push(action);
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
return updatedActions;
|
|
898
|
+
}
|
|
877
899
|
function useDebouncedCallback(value, callback, immediate, t0) {
|
|
878
900
|
const $ = c(9);
|
|
879
901
|
const timeoutMs = t0 === void 0 ? 300 : t0;
|
|
@@ -3645,7 +3667,7 @@ const DialogsProvider = (t0) => {
|
|
|
3645
3667
|
if ($[7] !== close || $[8] !== dialogEntries) {
|
|
3646
3668
|
let t72;
|
|
3647
3669
|
if ($[10] !== close) {
|
|
3648
|
-
t72 = (entry, i) => /* @__PURE__ */ jsx(entry.Component, { open: true, closeDialog: close }, `dialog_${i}`);
|
|
3670
|
+
t72 = (entry, i) => /* @__PURE__ */ jsx(entry.Component, { open: true, closeDialog: close, ...entry.props }, `dialog_${i}`);
|
|
3649
3671
|
$[10] = close;
|
|
3650
3672
|
$[11] = t72;
|
|
3651
3673
|
} else {
|
|
@@ -7107,7 +7129,7 @@ function getTablePropertyColumnWidth(property) {
|
|
|
7107
7129
|
function getSubcollectionColumnId(collection) {
|
|
7108
7130
|
return `subcollection:${collection.id ?? collection.path}`;
|
|
7109
7131
|
}
|
|
7110
|
-
const COLLECTION_GROUP_PARENT_ID
|
|
7132
|
+
const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
|
|
7111
7133
|
function useColumnIds(collection, includeSubcollections) {
|
|
7112
7134
|
const $ = c(5);
|
|
7113
7135
|
let t0;
|
|
@@ -7118,7 +7140,7 @@ function useColumnIds(collection, includeSubcollections) {
|
|
|
7118
7140
|
propertyColumnConfigs = hideAndExpandKeys(collection, collection.propertiesOrder);
|
|
7119
7141
|
if (collection.collectionGroup) {
|
|
7120
7142
|
propertyColumnConfigs.push({
|
|
7121
|
-
key: COLLECTION_GROUP_PARENT_ID
|
|
7143
|
+
key: COLLECTION_GROUP_PARENT_ID,
|
|
7122
7144
|
disabled: true
|
|
7123
7145
|
});
|
|
7124
7146
|
}
|
|
@@ -7173,7 +7195,7 @@ function hideAndExpandKeys(collection, keys) {
|
|
|
7173
7195
|
}];
|
|
7174
7196
|
}
|
|
7175
7197
|
}
|
|
7176
|
-
if (collection.collectionGroup && key === COLLECTION_GROUP_PARENT_ID
|
|
7198
|
+
if (collection.collectionGroup && key === COLLECTION_GROUP_PARENT_ID) {
|
|
7177
7199
|
return [{
|
|
7178
7200
|
key,
|
|
7179
7201
|
disabled: true
|
|
@@ -7192,7 +7214,7 @@ function getDefaultColumnKeys(collection, includeSubCollections) {
|
|
|
7192
7214
|
columnIds.push(...subCollectionIds.filter((subColId) => !columnIds.includes(subColId)));
|
|
7193
7215
|
}
|
|
7194
7216
|
if (collection.collectionGroup) {
|
|
7195
|
-
columnIds.push(COLLECTION_GROUP_PARENT_ID
|
|
7217
|
+
columnIds.push(COLLECTION_GROUP_PARENT_ID);
|
|
7196
7218
|
}
|
|
7197
7219
|
return hideAndExpandKeys(collection, columnIds);
|
|
7198
7220
|
}
|
|
@@ -9470,6 +9492,7 @@ function getRecentIds(collectionId) {
|
|
|
9470
9492
|
}
|
|
9471
9493
|
const editEntityAction = {
|
|
9472
9494
|
icon: /* @__PURE__ */ jsx(EditIcon, {}),
|
|
9495
|
+
key: "edit",
|
|
9473
9496
|
name: "Edit",
|
|
9474
9497
|
collapsed: false,
|
|
9475
9498
|
onClick({
|
|
@@ -9502,6 +9525,7 @@ const editEntityAction = {
|
|
|
9502
9525
|
const copyEntityAction = {
|
|
9503
9526
|
icon: /* @__PURE__ */ jsx(FileCopyIcon, {}),
|
|
9504
9527
|
name: "Copy",
|
|
9528
|
+
key: "copy",
|
|
9505
9529
|
onClick({
|
|
9506
9530
|
entity,
|
|
9507
9531
|
collection,
|
|
@@ -9525,34 +9549,10 @@ const copyEntityAction = {
|
|
|
9525
9549
|
return Promise.resolve(void 0);
|
|
9526
9550
|
}
|
|
9527
9551
|
};
|
|
9528
|
-
const archiveEntityAction = {
|
|
9529
|
-
icon: /* @__PURE__ */ jsx(ArchiveIcon, {}),
|
|
9530
|
-
name: "Archive",
|
|
9531
|
-
onClick({
|
|
9532
|
-
entity,
|
|
9533
|
-
collection,
|
|
9534
|
-
context: {
|
|
9535
|
-
dataSource
|
|
9536
|
-
}
|
|
9537
|
-
}) {
|
|
9538
|
-
return Promise.resolve(void 0);
|
|
9539
|
-
}
|
|
9540
|
-
};
|
|
9541
|
-
const openWebsiteAction = {
|
|
9542
|
-
icon: /* @__PURE__ */ jsx(OpenInNewIcon, {}),
|
|
9543
|
-
name: "See in website",
|
|
9544
|
-
onClick({
|
|
9545
|
-
entity,
|
|
9546
|
-
collection,
|
|
9547
|
-
context
|
|
9548
|
-
}) {
|
|
9549
|
-
window.open(`https://example.com/${entity.id}`, "_blank");
|
|
9550
|
-
return Promise.resolve(void 0);
|
|
9551
|
-
}
|
|
9552
|
-
};
|
|
9553
9552
|
const deleteEntityAction = {
|
|
9554
9553
|
icon: /* @__PURE__ */ jsx(DeleteIcon, {}),
|
|
9555
9554
|
name: "Delete",
|
|
9555
|
+
key: "delete",
|
|
9556
9556
|
onClick({
|
|
9557
9557
|
entity,
|
|
9558
9558
|
fullPath,
|
|
@@ -11519,7 +11519,7 @@ function EntityEditViewInner({
|
|
|
11519
11519
|
const actions = [];
|
|
11520
11520
|
if (createEnabled) actions.push(copyEntityAction);
|
|
11521
11521
|
if (deleteEnabled) actions.push(deleteEntityAction);
|
|
11522
|
-
if (customEntityActions) actions
|
|
11522
|
+
if (customEntityActions) return mergeEntityActions(actions, customEntityActions);
|
|
11523
11523
|
return actions;
|
|
11524
11524
|
}, [authController, inputCollection, path]);
|
|
11525
11525
|
const modified = formex.dirty;
|
|
@@ -11597,7 +11597,8 @@ function EntityEditViewInner({
|
|
|
11597
11597
|
fullPath: resolvedCollection.path,
|
|
11598
11598
|
collection: resolvedCollection,
|
|
11599
11599
|
context,
|
|
11600
|
-
sideEntityController
|
|
11600
|
+
sideEntityController,
|
|
11601
|
+
formContext
|
|
11601
11602
|
});
|
|
11602
11603
|
}, children: action.icon }, action.name)) }),
|
|
11603
11604
|
formex.isSubmitting && /* @__PURE__ */ jsx(CircularProgress, { size: "small" }),
|
|
@@ -12127,7 +12128,6 @@ function EntityCollectionViewStartActions(t0) {
|
|
|
12127
12128
|
}
|
|
12128
12129
|
return t5;
|
|
12129
12130
|
}
|
|
12130
|
-
const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
|
|
12131
12131
|
const EntityCollectionView = React__default.memo(function EntityCollectionView2({
|
|
12132
12132
|
fullPath: fullPathProp,
|
|
12133
12133
|
parentCollectionIds,
|
|
@@ -12377,7 +12377,7 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
|
|
|
12377
12377
|
const actions = [editEntityAction];
|
|
12378
12378
|
if (createEnabled) actions.push(copyEntityAction);
|
|
12379
12379
|
if (deleteEnabled) actions.push(deleteEntityAction);
|
|
12380
|
-
if (customEntityActions) actions
|
|
12380
|
+
if (customEntityActions) return mergeEntityActions(actions, customEntityActions);
|
|
12381
12381
|
return actions;
|
|
12382
12382
|
};
|
|
12383
12383
|
const getIdColumnWidth = () => {
|
|
@@ -16017,7 +16017,7 @@ const PropertyPreview = React__default.memo(function PropertyPreview2(props) {
|
|
|
16017
16017
|
propertyOrBuilder: inputProperty,
|
|
16018
16018
|
propertyConfigs: customizationController.propertyConfigs
|
|
16019
16019
|
});
|
|
16020
|
-
if (
|
|
16020
|
+
if (property === null) {
|
|
16021
16021
|
let t02;
|
|
16022
16022
|
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
16023
16023
|
t02 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
@@ -16038,7 +16038,7 @@ const PropertyPreview = React__default.memo(function PropertyPreview2(props) {
|
|
|
16038
16038
|
customProps: property.customProps
|
|
16039
16039
|
});
|
|
16040
16040
|
} else {
|
|
16041
|
-
if (value === null) {
|
|
16041
|
+
if (value === void 0 || value === null) {
|
|
16042
16042
|
let t02;
|
|
16043
16043
|
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
16044
16044
|
t02 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
@@ -22535,6 +22535,7 @@ export {
|
|
|
22535
22535
|
AuthControllerContext,
|
|
22536
22536
|
BlockFieldBinding,
|
|
22537
22537
|
BooleanPreview,
|
|
22538
|
+
COLLECTION_GROUP_PARENT_ID,
|
|
22538
22539
|
COLLECTION_PATH_SEPARATOR,
|
|
22539
22540
|
CircularProgressCenter,
|
|
22540
22541
|
ConfirmationDialog,
|
|
@@ -22613,7 +22614,6 @@ export {
|
|
|
22613
22614
|
VirtualTable,
|
|
22614
22615
|
addInitialSlash,
|
|
22615
22616
|
applyPermissionsFunctionIfEmpty,
|
|
22616
|
-
archiveEntityAction,
|
|
22617
22617
|
buildAdditionalFieldDelegate,
|
|
22618
22618
|
buildCollection,
|
|
22619
22619
|
buildEntityCallbacks,
|
|
@@ -22687,7 +22687,7 @@ export {
|
|
|
22687
22687
|
makePropertiesNonEditable,
|
|
22688
22688
|
mergeCollection,
|
|
22689
22689
|
mergeDeep,
|
|
22690
|
-
|
|
22690
|
+
mergeEntityActions,
|
|
22691
22691
|
pick,
|
|
22692
22692
|
plural,
|
|
22693
22693
|
printChanged,
|