@firecms/collection_editor 3.0.0-canary.120 → 3.0.0-canary.122
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/index.es.js
CHANGED
|
@@ -3,7 +3,7 @@ import { FieldCaption, SearchIconsView, toSnakeCase, singular, IconForView, Arra
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import React__default, { useContext, useState, useEffect, useMemo, useRef, useDeferredValue, useCallback } from "react";
|
|
5
5
|
import equal from "react-fast-compare";
|
|
6
|
-
import { useAutoComplete, Container, Typography, Tooltip, IconButton, Chip, TextField, cls, DebouncedTextField, Autocomplete, AutocompleteItem, ExpandablePanel, SettingsIcon, ClearIcon, Select, SelectItem, BooleanSwitchWithLabel, Dialog, AutoAwesomeIcon, Badge, ListIcon, Button, CircularProgress, Paper, DialogContent, DialogActions, RuleIcon, FileUploadIcon, MultiSelect, MultiSelectItem,
|
|
6
|
+
import { useAutoComplete, Container, Typography, Tooltip, IconButton, Chip, TextField, cls, DebouncedTextField, Autocomplete, AutocompleteItem, ExpandablePanel, SettingsIcon, ClearIcon, Select, SelectItem, BooleanSwitchWithLabel, Dialog, AutoAwesomeIcon, Badge, ListIcon, Button, CircularProgress, Paper, DialogContent, DialogActions, RuleIcon, FileUploadIcon, MultiSelect, MultiSelectItem, cardMixin, cardClickableMixin, cardSelectedMixin, FunctionsIcon, RemoveCircleIcon, defaultBorderMixin, RemoveIcon, DragHandleIcon, AddIcon, SelectGroup, InfoLabel, DeleteIcon, ContentCopyIcon, CodeIcon, Table, TableBody, TableRow, TableCell, Alert, Icon, Card, coolIconKeys, Tabs, Tab, ArrowBackIcon, LoadingButton, DoneIcon, Menu, MoreVertIcon, MenuItem, SaveIcon, UndoIcon } from "@firecms/ui";
|
|
7
7
|
import * as Yup from "yup";
|
|
8
8
|
import { useFormex, Field, getIn, useCreateFormex, Formex } from "@firecms/formex";
|
|
9
9
|
import { extractEnumFromValues, buildPropertyFromData, buildEntityPropertiesFromData } from "@firecms/schema_inference";
|
|
@@ -1122,10 +1122,6 @@ function StoragePropertyField({
|
|
|
1122
1122
|
const allFileTypesSelected = !fileTypesValue || fileTypesValue.length === 0;
|
|
1123
1123
|
const handleTypesChange = (value) => {
|
|
1124
1124
|
if (!value) setFieldValue(acceptedFiles, void 0);
|
|
1125
|
-
else if (value.includes("all")) setFieldValue(acceptedFiles, void 0);
|
|
1126
|
-
else if (value.length >= Object.keys(fileTypes).length) setFieldValue(acceptedFiles, void 0);
|
|
1127
|
-
else if (allFileTypesSelected)
|
|
1128
|
-
setFieldValue(acceptedFiles, Object.keys(fileTypes).filter((v) => !value.includes(v)));
|
|
1129
1125
|
else setFieldValue(acceptedFiles, value);
|
|
1130
1126
|
};
|
|
1131
1127
|
const hasFilenameCallback = typeof fileNameValue === "function";
|
|
@@ -1146,51 +1142,36 @@ function StoragePropertyField({
|
|
|
1146
1142
|
)
|
|
1147
1143
|
] }),
|
|
1148
1144
|
children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-2 p-4", children: [
|
|
1149
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */
|
|
1145
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(
|
|
1150
1146
|
MultiSelect,
|
|
1151
1147
|
{
|
|
1148
|
+
className: "w-full",
|
|
1149
|
+
placeholder: "All file types allowed",
|
|
1152
1150
|
disabled,
|
|
1153
1151
|
name: acceptedFiles,
|
|
1154
1152
|
value: fileTypesValue ?? [],
|
|
1155
|
-
|
|
1153
|
+
onValueChange: handleTypesChange,
|
|
1156
1154
|
label: allFileTypesSelected ? void 0 : "Allowed file types",
|
|
1157
1155
|
renderValues: (selected) => {
|
|
1158
1156
|
if (!selected || selected.length === 0) return "All file types allowed";
|
|
1159
1157
|
return selected.map((v) => fileTypes[v]).filter((v) => Boolean(v)).join(", ");
|
|
1160
1158
|
},
|
|
1161
|
-
children: [
|
|
1162
|
-
/* @__PURE__ */
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
),
|
|
1178
|
-
/* @__PURE__ */ jsx("div", { className: "flex-grow", children: label }),
|
|
1179
|
-
/* @__PURE__ */ jsx(
|
|
1180
|
-
Button,
|
|
1181
|
-
{
|
|
1182
|
-
size: "small",
|
|
1183
|
-
variant: "outlined",
|
|
1184
|
-
onClick: (e) => {
|
|
1185
|
-
e.preventDefault();
|
|
1186
|
-
e.stopPropagation();
|
|
1187
|
-
return setFieldValue(acceptedFiles, [value]);
|
|
1188
|
-
},
|
|
1189
|
-
children: "Only"
|
|
1190
|
-
}
|
|
1191
|
-
)
|
|
1192
|
-
] }, value))
|
|
1193
|
-
]
|
|
1159
|
+
children: Object.entries(fileTypes).map(([value, label]) => /* @__PURE__ */ jsxs(MultiSelectItem, { value, className: "flex items-center gap-2", children: [
|
|
1160
|
+
/* @__PURE__ */ jsx("div", { className: "flex-grow", children: label }),
|
|
1161
|
+
/* @__PURE__ */ jsx(
|
|
1162
|
+
Button,
|
|
1163
|
+
{
|
|
1164
|
+
size: "small",
|
|
1165
|
+
variant: "text",
|
|
1166
|
+
onClick: (e) => {
|
|
1167
|
+
e.preventDefault();
|
|
1168
|
+
e.stopPropagation();
|
|
1169
|
+
return setFieldValue(acceptedFiles, [value]);
|
|
1170
|
+
},
|
|
1171
|
+
children: "Only"
|
|
1172
|
+
}
|
|
1173
|
+
)
|
|
1174
|
+
] }, value))
|
|
1194
1175
|
}
|
|
1195
1176
|
) }),
|
|
1196
1177
|
/* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(
|