@strapi/content-type-builder 5.0.0-rc.3 → 5.0.0-rc.30
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/_chunks/{ListView-CXba7ij5.mjs → ListView-CGLqkUBZ.mjs} +21 -16
- package/dist/_chunks/ListView-CGLqkUBZ.mjs.map +1 -0
- package/dist/_chunks/{ListView-BQb88LNw.js → ListView-LfXjdWfW.js} +21 -16
- package/dist/_chunks/ListView-LfXjdWfW.js.map +1 -0
- package/dist/_chunks/{index-C2yjWkJh.mjs → index-BXPQ175h.mjs} +177 -199
- package/dist/_chunks/index-BXPQ175h.mjs.map +1 -0
- package/dist/_chunks/{index-lmF90uIG.js → index-BolZAeLc.js} +150 -9
- package/dist/_chunks/index-BolZAeLc.js.map +1 -0
- package/dist/_chunks/{index-Bhjcor9k.js → index-BrsV2OKM.js} +173 -195
- package/dist/_chunks/index-BrsV2OKM.js.map +1 -0
- package/dist/_chunks/{index-1dZSgaqS.mjs → index-DFvzA6Sy.mjs} +160 -20
- package/dist/_chunks/index-DFvzA6Sy.mjs.map +1 -0
- package/dist/admin/index.js +5 -2
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +4 -2
- package/dist/admin/src/components/FormModal/attributes/form.d.ts +1 -1
- package/dist/admin/src/components/FormModal/utils/relations.d.ts +2 -2
- package/dist/admin/src/components/FormModalNavigationProvider/constants.d.ts +1 -0
- package/dist/admin/src/contexts/FormModalNavigationContext.d.ts +2 -0
- package/dist/admin/src/exports.d.ts +15 -0
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/utils/parseDateValue.d.ts +1 -0
- package/dist/admin/src/utils/timeFormat.d.ts +16 -0
- package/dist/server/index.js +91 -54
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +92 -55
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/validation/model-schema.d.ts.map +1 -1
- package/dist/server/src/services/builder.d.ts +4 -0
- package/dist/server/src/services/builder.d.ts.map +1 -1
- package/dist/server/src/services/constants.d.ts +0 -1
- package/dist/server/src/services/constants.d.ts.map +1 -1
- package/dist/server/src/services/schema-builder/content-type-builder.d.ts.map +1 -1
- package/package.json +9 -8
- package/dist/_chunks/ListView-BQb88LNw.js.map +0 -1
- package/dist/_chunks/ListView-CXba7ij5.mjs.map +0 -1
- package/dist/_chunks/index-1dZSgaqS.mjs.map +0 -1
- package/dist/_chunks/index-Bhjcor9k.js.map +0 -1
- package/dist/_chunks/index-C2yjWkJh.mjs.map +0 -1
- package/dist/_chunks/index-lmF90uIG.js.map +0 -1
- package/strapi-server.js +0 -3
|
@@ -3,14 +3,13 @@ import * as React from "react";
|
|
|
3
3
|
import { createContext, useContext, useState, Fragment, useRef, useEffect, memo, useMemo, lazy, Suspense } from "react";
|
|
4
4
|
import { useNotification, useTracking, useStrapiApp, ConfirmDialog, translatedErrors, useGuidedTour, useAppInfo, useAuth, useFetchClient, Page, Layouts } from "@strapi/admin/strapi-admin";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
|
-
import { NavLink, Link
|
|
7
|
-
import {
|
|
6
|
+
import { NavLink, Link, useNavigate, useLocation, useMatch, Navigate, Routes, Route } from "react-router-dom";
|
|
7
|
+
import { p as pluginId, n as nameToSlug, O as ON_CHANGE_RELATION_TARGET, a as ON_CHANGE_RELATION_TYPE, g as getRelationType, M as MAX_COMPONENT_DEPTH, c as createComponentUid, b as createUid, i as initialState, S as SET_DATA_TO_EDIT, d as SET_DYNAMIC_ZONE_DATA_SCHEMA, e as SET_CUSTOM_FIELD_DATA_SCHEMA, f as SET_ATTRIBUTE_DATA_SCHEMA, R as RESET_PROPS, h as SET_ERRORS, j as ON_CHANGE, k as RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ, l as RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO, m as RESET_PROPS_AND_SAVE_CURRENT_DATA, o as initialState$1, q as makeUnique, u as useAutoReloadOverlayBlocker, G as GET_DATA_SUCCEEDED, r as RELOAD_PLUGIN, s as retrieveComponentsFromSchema, t as SET_MODIFIED_DATA, A as ADD_CUSTOM_FIELD_ATTRIBUTE, E as EDIT_CUSTOM_FIELD_ATTRIBUTE, v as ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE, C as CHANGE_DYNAMIC_ZONE_COMPONENTS, D as DELETE_NOT_SAVED_TYPE, w as REMOVE_COMPONENT_FROM_DYNAMIC_ZONE, U as UPDATE_INITIAL_STATE, x as UPDATE_SCHEMA, y as EDIT_ATTRIBUTE, z as ADD_ATTRIBUTE, B as CREATE_SCHEMA, F as CREATE_COMPONENT_SCHEMA, H as REMOVE_FIELD_FROM_DISPLAYED_COMPONENT, I as REMOVE_FIELD, P as PERMISSIONS, J as AutoReloadOverlayBlockerProvider } from "./index-DFvzA6Sy.mjs";
|
|
8
|
+
import { useFilter, useCollator, SubNavLink, SubNav, SubNavHeader, SubNavSections, SubNavSection, SubNavLinkSection, Box, TextButton, Field, MultiSelectNested, Flex, Typography, KeyboardNavigable, Grid, LinkButton, Link as Link$1, Modal, Tabs, Divider, SingleSelect, SingleSelectOption, inputFocusStyle, Checkbox, TextInput, NumberInput, Dialog, Button, Breadcrumbs, Crumb, Searchbar, IconButton, Tooltip, VisuallyHidden, TimePicker, Textarea, DatePicker, DateTimePicker, Toggle, JSONInput, Menu, Combobox, ComboboxOption } from "@strapi/design-system";
|
|
8
9
|
import * as Icons from "@strapi/icons";
|
|
9
|
-
import {
|
|
10
|
-
import { createPortal } from "react-dom";
|
|
11
|
-
import { keyframes, styled } from "styled-components";
|
|
10
|
+
import { Plus, Sparkle, ArrowLeft, Search, Trash, Eye, EyeStriked, OneWay, OneToOne, OneToMany, ManyToOne, ManyToMany, ManyWays } from "@strapi/icons";
|
|
12
11
|
import upperFirst from "lodash/upperFirst";
|
|
13
|
-
import {
|
|
12
|
+
import { styled } from "styled-components";
|
|
14
13
|
import isEqual from "lodash/isEqual";
|
|
15
14
|
import get from "lodash/get";
|
|
16
15
|
import groupBy from "lodash/groupBy";
|
|
@@ -34,137 +33,6 @@ import { createSelector } from "@reduxjs/toolkit";
|
|
|
34
33
|
import camelCase from "lodash/camelCase";
|
|
35
34
|
import omit from "lodash/omit";
|
|
36
35
|
import sortBy from "lodash/sortBy";
|
|
37
|
-
const AutoReloadOverlayBlockerContext = React.createContext(
|
|
38
|
-
{}
|
|
39
|
-
);
|
|
40
|
-
const MAX_ELAPSED_TIME = 30 * 1e3;
|
|
41
|
-
const AutoReloadOverlayBlockerProvider = ({ children }) => {
|
|
42
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
43
|
-
const [config, setConfig] = React.useState({});
|
|
44
|
-
const [failed, setFailed] = React.useState(false);
|
|
45
|
-
const lockAppWithAutoreload = React.useCallback((config2 = {}) => {
|
|
46
|
-
setIsOpen(true);
|
|
47
|
-
setConfig(config2);
|
|
48
|
-
}, []);
|
|
49
|
-
const unlockAppWithAutoreload = React.useCallback(() => {
|
|
50
|
-
setIsOpen(false);
|
|
51
|
-
setConfig({});
|
|
52
|
-
}, []);
|
|
53
|
-
React.useEffect(() => {
|
|
54
|
-
if (isOpen) {
|
|
55
|
-
const timeout = setTimeout(() => {
|
|
56
|
-
setFailed(true);
|
|
57
|
-
}, MAX_ELAPSED_TIME);
|
|
58
|
-
return () => {
|
|
59
|
-
clearTimeout(timeout);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}, [isOpen]);
|
|
63
|
-
let displayedIcon = config?.icon || "reload";
|
|
64
|
-
let description = {
|
|
65
|
-
id: config?.description || "components.OverlayBlocker.description",
|
|
66
|
-
defaultMessage: "You're using a feature that needs the server to restart. The page will reload automatically."
|
|
67
|
-
};
|
|
68
|
-
let title = {
|
|
69
|
-
id: config?.title || "components.OverlayBlocker.title",
|
|
70
|
-
defaultMessage: "Waiting for restart"
|
|
71
|
-
};
|
|
72
|
-
if (failed) {
|
|
73
|
-
displayedIcon = "time";
|
|
74
|
-
description = {
|
|
75
|
-
id: "components.OverlayBlocker.description.serverError",
|
|
76
|
-
defaultMessage: "The server should have restarted, please check your logs in the terminal."
|
|
77
|
-
};
|
|
78
|
-
title = {
|
|
79
|
-
id: "components.OverlayBlocker.title.serverError",
|
|
80
|
-
defaultMessage: "The restart is taking longer than expected"
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
const autoReloadValue = React.useMemo(
|
|
84
|
-
() => ({
|
|
85
|
-
lockAppWithAutoreload,
|
|
86
|
-
unlockAppWithAutoreload
|
|
87
|
-
}),
|
|
88
|
-
[lockAppWithAutoreload, unlockAppWithAutoreload]
|
|
89
|
-
);
|
|
90
|
-
return /* @__PURE__ */ jsxs(AutoReloadOverlayBlockerContext.Provider, { value: autoReloadValue, children: [
|
|
91
|
-
/* @__PURE__ */ jsx(
|
|
92
|
-
Blocker,
|
|
93
|
-
{
|
|
94
|
-
displayedIcon,
|
|
95
|
-
isOpen,
|
|
96
|
-
description,
|
|
97
|
-
title
|
|
98
|
-
}
|
|
99
|
-
),
|
|
100
|
-
children
|
|
101
|
-
] });
|
|
102
|
-
};
|
|
103
|
-
const Blocker = ({ displayedIcon, description, title, isOpen }) => {
|
|
104
|
-
const { formatMessage } = useIntl();
|
|
105
|
-
return isOpen && globalThis?.document?.body ? createPortal(
|
|
106
|
-
/* @__PURE__ */ jsxs(Overlay, { id: "autoReloadOverlayBlocker", direction: "column", alignItems: "center", gap: 6, children: [
|
|
107
|
-
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "center", gap: 2, children: [
|
|
108
|
-
/* @__PURE__ */ jsx(Typography, { tag: "h1", variant: "alpha", children: formatMessage(title) }),
|
|
109
|
-
/* @__PURE__ */ jsx(Typography, { tag: "h2", textColor: "neutral600", fontSize: 4, fontWeight: "regular", children: formatMessage(description) })
|
|
110
|
-
] }),
|
|
111
|
-
displayedIcon === "reload" && /* @__PURE__ */ jsx(IconBox$1, { padding: 6, background: "primary100", borderColor: "primary200", children: /* @__PURE__ */ jsx(LoaderReload, { width: "3.6rem", height: "3.6rem" }) }),
|
|
112
|
-
displayedIcon === "time" && /* @__PURE__ */ jsx(IconBox$1, { padding: 6, background: "primary100", borderColor: "primary200", children: /* @__PURE__ */ jsx(Clock, { width: "4rem", height: "4rem" }) }),
|
|
113
|
-
/* @__PURE__ */ jsx(Box, { marginTop: 2, children: /* @__PURE__ */ jsx(Link, { href: "https://docs.strapi.io", isExternal: true, children: formatMessage({
|
|
114
|
-
id: "global.documentation",
|
|
115
|
-
defaultMessage: "Read the documentation"
|
|
116
|
-
}) }) })
|
|
117
|
-
] }),
|
|
118
|
-
// eslint-disable-next-line no-undef
|
|
119
|
-
globalThis.document.body
|
|
120
|
-
) : null;
|
|
121
|
-
};
|
|
122
|
-
const rotation = keyframes`
|
|
123
|
-
from {
|
|
124
|
-
transform: rotate(0deg);
|
|
125
|
-
}
|
|
126
|
-
to {
|
|
127
|
-
transform: rotate(359deg);
|
|
128
|
-
}
|
|
129
|
-
`;
|
|
130
|
-
const LoaderReload = styled(ArrowClockwise)`
|
|
131
|
-
animation: ${rotation} 1s infinite linear;
|
|
132
|
-
`;
|
|
133
|
-
const Overlay = styled(Flex)`
|
|
134
|
-
position: fixed;
|
|
135
|
-
top: 0;
|
|
136
|
-
right: 0;
|
|
137
|
-
bottom: 0;
|
|
138
|
-
left: 0;
|
|
139
|
-
/* TODO: set this up in the theme for consistence z-index values */
|
|
140
|
-
z-index: 1140;
|
|
141
|
-
padding-top: 16rem;
|
|
142
|
-
|
|
143
|
-
& > * {
|
|
144
|
-
position: relative;
|
|
145
|
-
z-index: 1;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
&:before {
|
|
149
|
-
content: '';
|
|
150
|
-
position: fixed;
|
|
151
|
-
top: 0;
|
|
152
|
-
right: 0;
|
|
153
|
-
bottom: 0;
|
|
154
|
-
left: 0;
|
|
155
|
-
background: ${({ theme }) => theme.colors.neutral0};
|
|
156
|
-
opacity: 0.9;
|
|
157
|
-
}
|
|
158
|
-
`;
|
|
159
|
-
const IconBox$1 = styled(Box)`
|
|
160
|
-
border-radius: 50%;
|
|
161
|
-
svg {
|
|
162
|
-
> path {
|
|
163
|
-
fill: ${({ theme }) => theme.colors.primary600} !important;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
`;
|
|
167
|
-
const useAutoReloadOverlayBlocker = () => React.useContext(AutoReloadOverlayBlockerContext);
|
|
168
36
|
const getTrad = (id) => `${pluginId}.${id}`;
|
|
169
37
|
const DataManagerContext = createContext();
|
|
170
38
|
const useDataManager = () => useContext(DataManagerContext);
|
|
@@ -338,6 +206,17 @@ const useContentTypeBuilderMenu = () => {
|
|
|
338
206
|
onSearchChange: setSearch
|
|
339
207
|
};
|
|
340
208
|
};
|
|
209
|
+
const SubNavLinkCustom = styled(SubNavLink)`
|
|
210
|
+
div {
|
|
211
|
+
width: inherit;
|
|
212
|
+
span:nth-child(2) {
|
|
213
|
+
white-space: nowrap;
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
text-overflow: ellipsis;
|
|
216
|
+
width: inherit;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
`;
|
|
341
220
|
const ContentTypeBuilderNav = () => {
|
|
342
221
|
const { menu, searchValue, onSearchChange } = useContentTypeBuilderMenu();
|
|
343
222
|
const { formatMessage } = useIntl();
|
|
@@ -386,7 +265,17 @@ const ContentTypeBuilderNav = () => {
|
|
|
386
265
|
subLink.name
|
|
387
266
|
)) }, link.name);
|
|
388
267
|
}
|
|
389
|
-
return /* @__PURE__ */ jsx(
|
|
268
|
+
return /* @__PURE__ */ jsx(
|
|
269
|
+
SubNavLinkCustom,
|
|
270
|
+
{
|
|
271
|
+
tag: NavLink,
|
|
272
|
+
to: link.to,
|
|
273
|
+
active: link.active,
|
|
274
|
+
width: "100%",
|
|
275
|
+
children: upperFirst(formatMessage({ id: link.name, defaultMessage: link.title }))
|
|
276
|
+
},
|
|
277
|
+
link.name
|
|
278
|
+
);
|
|
390
279
|
})
|
|
391
280
|
}
|
|
392
281
|
),
|
|
@@ -565,7 +454,7 @@ const AttributeOption = ({ type = "text" }) => {
|
|
|
565
454
|
const AttributeList = ({ attributes }) => /* @__PURE__ */ jsx(KeyboardNavigable, { tagName: "button", children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 8, children: attributes.map((attributeRow, index2) => {
|
|
566
455
|
return (
|
|
567
456
|
// eslint-disable-next-line react/no-array-index-key
|
|
568
|
-
/* @__PURE__ */ jsx(Grid.Root, { gap: 3, children: attributeRow.map((attribute) => /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(AttributeOption, { type: attribute }) }, attribute)) }, index2)
|
|
457
|
+
/* @__PURE__ */ jsx(Grid.Root, { gap: 3, children: attributeRow.map((attribute) => /* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(AttributeOption, { type: attribute }) }, attribute)) }, index2)
|
|
569
458
|
);
|
|
570
459
|
}) }) });
|
|
571
460
|
const CustomFieldOption = ({ customFieldUid, customField }) => {
|
|
@@ -622,7 +511,7 @@ const EmptyAttributes = () => {
|
|
|
622
511
|
/* @__PURE__ */ jsx(
|
|
623
512
|
LinkButton,
|
|
624
513
|
{
|
|
625
|
-
tag: Link
|
|
514
|
+
tag: Link,
|
|
626
515
|
to: `/marketplace?${qs.stringify({ categories: ["Custom fields"] })}`,
|
|
627
516
|
variant: "secondary",
|
|
628
517
|
startIcon: /* @__PURE__ */ jsx(Plus, {}),
|
|
@@ -646,9 +535,9 @@ const CustomFieldsList = () => {
|
|
|
646
535
|
(a, b) => a[1].name > b[1].name ? 1 : -1
|
|
647
536
|
);
|
|
648
537
|
return /* @__PURE__ */ jsx(KeyboardNavigable, { tagName: "button", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 3, children: [
|
|
649
|
-
/* @__PURE__ */ jsx(Grid.Root, { gap: 3, children: sortedCustomFields.map(([uid, customField]) => /* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(CustomFieldOption, { customFieldUid: uid, customField }, uid) }, uid)) }),
|
|
538
|
+
/* @__PURE__ */ jsx(Grid.Root, { gap: 3, children: sortedCustomFields.map(([uid, customField]) => /* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(CustomFieldOption, { customFieldUid: uid, customField }, uid) }, uid)) }),
|
|
650
539
|
/* @__PURE__ */ jsx(
|
|
651
|
-
Link,
|
|
540
|
+
Link$1,
|
|
652
541
|
{
|
|
653
542
|
href: "https://docs.strapi.io/developer-docs/latest/development/custom-fields.html",
|
|
654
543
|
isExternal: true,
|
|
@@ -718,6 +607,9 @@ const Wrapper$1 = styled(Flex)`
|
|
|
718
607
|
cursor: pointer;
|
|
719
608
|
user-select: none;
|
|
720
609
|
flex: 1;
|
|
610
|
+
border-radius: 4px;
|
|
611
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
612
|
+
|
|
721
613
|
${inputFocusStyle()}
|
|
722
614
|
}
|
|
723
615
|
|
|
@@ -729,7 +621,6 @@ const Wrapper$1 = styled(Flex)`
|
|
|
729
621
|
.option {
|
|
730
622
|
height: 100%;
|
|
731
623
|
border-radius: 4px;
|
|
732
|
-
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
733
624
|
will-change: transform, opacity;
|
|
734
625
|
background: ${({ theme }) => theme.colors.neutral0};
|
|
735
626
|
|
|
@@ -766,7 +657,6 @@ const Wrapper$1 = styled(Flex)`
|
|
|
766
657
|
.container input:checked ~ div {
|
|
767
658
|
background: ${({ theme }) => theme.colors.primary100};
|
|
768
659
|
color: ${({ theme }) => theme.colors.primary600};
|
|
769
|
-
border: 1px solid ${({ theme }) => theme.colors.primary200};
|
|
770
660
|
.checkmark {
|
|
771
661
|
border: solid 1px ${({ theme }) => theme.colors.primary600};
|
|
772
662
|
&::after {
|
|
@@ -932,10 +822,19 @@ const DraftAndPublishToggle = ({
|
|
|
932
822
|
/* @__PURE__ */ jsx(Checkbox, { checked: value, disabled, onCheckedChange: handleChange, children: label }),
|
|
933
823
|
/* @__PURE__ */ jsx(Field.Hint, {})
|
|
934
824
|
] }),
|
|
935
|
-
/* @__PURE__ */ jsx(Dialog.Root, { open: showWarning, onOpenChange: (isOpen) => setShowWarning(isOpen), children: /* @__PURE__ */ jsx(
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
825
|
+
/* @__PURE__ */ jsx(Dialog.Root, { open: showWarning, onOpenChange: (isOpen) => setShowWarning(isOpen), children: /* @__PURE__ */ jsx(
|
|
826
|
+
ConfirmDialog,
|
|
827
|
+
{
|
|
828
|
+
endAction: /* @__PURE__ */ jsx(Button, { onClick: handleConfirm, variant: "danger", width: "100%", justifyContent: "center", children: formatMessage({
|
|
829
|
+
id: getTrad("popUpWarning.draft-publish.button.confirm"),
|
|
830
|
+
defaultMessage: "Yes, disable"
|
|
831
|
+
}) }),
|
|
832
|
+
children: formatMessage({
|
|
833
|
+
id: getTrad("popUpWarning.draft-publish.message"),
|
|
834
|
+
defaultMessage: "If you disable the draft & publish, your drafts will be deleted."
|
|
835
|
+
})
|
|
836
|
+
}
|
|
837
|
+
) })
|
|
939
838
|
] });
|
|
940
839
|
};
|
|
941
840
|
const FormModalEndActions = ({
|
|
@@ -1382,7 +1281,7 @@ const FormModalHeader = ({
|
|
|
1382
1281
|
return /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsxs(Flex, { gap: 3, children: [
|
|
1383
1282
|
showBackLink && // This is a workaround and should use the LinkButton with a variant that currently doesn't exist
|
|
1384
1283
|
/* @__PURE__ */ jsx(
|
|
1385
|
-
Link,
|
|
1284
|
+
Link$1,
|
|
1386
1285
|
{
|
|
1387
1286
|
"aria-label": formatMessage({
|
|
1388
1287
|
id: getTrad("modalForm.header.back"),
|
|
@@ -1700,7 +1599,7 @@ const IconPicker = ({ intlLabel, name, onChange, value = "" }) => {
|
|
|
1700
1599
|
id: getTrad("IconPicker.search.button.label"),
|
|
1701
1600
|
defaultMessage: "Search icon button"
|
|
1702
1601
|
}),
|
|
1703
|
-
|
|
1602
|
+
variant: "ghost",
|
|
1704
1603
|
children: /* @__PURE__ */ jsx(Search, {})
|
|
1705
1604
|
}
|
|
1706
1605
|
),
|
|
@@ -1720,7 +1619,7 @@ const IconPicker = ({ intlLabel, name, onChange, value = "" }) => {
|
|
|
1720
1619
|
id: getTrad("IconPicker.remove.button"),
|
|
1721
1620
|
defaultMessage: "Remove the selected icon"
|
|
1722
1621
|
}),
|
|
1723
|
-
|
|
1622
|
+
variant: "ghost",
|
|
1724
1623
|
children: /* @__PURE__ */ jsx(Trash, {})
|
|
1725
1624
|
}
|
|
1726
1625
|
)
|
|
@@ -1801,6 +1700,49 @@ const PluralName = ({
|
|
|
1801
1700
|
/* @__PURE__ */ jsx(Field.Error, {})
|
|
1802
1701
|
] });
|
|
1803
1702
|
};
|
|
1703
|
+
const parseDateValue = (value) => {
|
|
1704
|
+
if (value instanceof Date && isValidDate(value)) {
|
|
1705
|
+
return value;
|
|
1706
|
+
}
|
|
1707
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
1708
|
+
const date = new Date(value);
|
|
1709
|
+
if (isValidDate(date)) {
|
|
1710
|
+
return date;
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
const isValidDate = (date) => !isNaN(date.getTime());
|
|
1715
|
+
const removeSeconds = (time) => {
|
|
1716
|
+
const [hours, minutes] = time.split(":");
|
|
1717
|
+
return `${hours}:${minutes}`;
|
|
1718
|
+
};
|
|
1719
|
+
const addSecondsAndMilliseconds = (time) => {
|
|
1720
|
+
return time.split(":").length === 2 ? `${time}:00.000` : time;
|
|
1721
|
+
};
|
|
1722
|
+
const formatTimeForInput = (value) => {
|
|
1723
|
+
if (!value)
|
|
1724
|
+
return;
|
|
1725
|
+
return value.split(":").length > 2 ? removeSeconds(value) : value;
|
|
1726
|
+
};
|
|
1727
|
+
const formatTimeForOutput = (value) => {
|
|
1728
|
+
if (!value)
|
|
1729
|
+
return void 0;
|
|
1730
|
+
return addSecondsAndMilliseconds(value);
|
|
1731
|
+
};
|
|
1732
|
+
const handleTimeChange = ({ value }) => {
|
|
1733
|
+
const formattedInputTime = formatTimeForInput(value);
|
|
1734
|
+
return formattedInputTime;
|
|
1735
|
+
};
|
|
1736
|
+
const handleTimeChangeEvent = (onChange, name, type, time) => {
|
|
1737
|
+
const formattedOutputTime = formatTimeForOutput(time);
|
|
1738
|
+
onChange({
|
|
1739
|
+
target: {
|
|
1740
|
+
name,
|
|
1741
|
+
value: formattedOutputTime,
|
|
1742
|
+
type
|
|
1743
|
+
}
|
|
1744
|
+
});
|
|
1745
|
+
};
|
|
1804
1746
|
const GenericInput = ({
|
|
1805
1747
|
autoComplete,
|
|
1806
1748
|
customInputs,
|
|
@@ -1952,6 +1894,7 @@ const GenericInput = ({
|
|
|
1952
1894
|
);
|
|
1953
1895
|
}
|
|
1954
1896
|
case "datetime": {
|
|
1897
|
+
const dateValue = parseDateValue(value);
|
|
1955
1898
|
return /* @__PURE__ */ jsx(
|
|
1956
1899
|
DateTimePicker,
|
|
1957
1900
|
{
|
|
@@ -1963,11 +1906,12 @@ const GenericInput = ({
|
|
|
1963
1906
|
},
|
|
1964
1907
|
onClear: () => onChange({ target: { name, value: null, type } }),
|
|
1965
1908
|
placeholder: formattedPlaceholder,
|
|
1966
|
-
value
|
|
1909
|
+
value: dateValue
|
|
1967
1910
|
}
|
|
1968
1911
|
);
|
|
1969
1912
|
}
|
|
1970
1913
|
case "date": {
|
|
1914
|
+
const dateValue = parseDateValue(value);
|
|
1971
1915
|
return /* @__PURE__ */ jsx(
|
|
1972
1916
|
DatePicker,
|
|
1973
1917
|
{
|
|
@@ -1984,7 +1928,7 @@ const GenericInput = ({
|
|
|
1984
1928
|
},
|
|
1985
1929
|
onClear: () => onChange({ target: { name, value: null, type } }),
|
|
1986
1930
|
placeholder: formattedPlaceholder,
|
|
1987
|
-
value
|
|
1931
|
+
value: dateValue
|
|
1988
1932
|
}
|
|
1989
1933
|
);
|
|
1990
1934
|
}
|
|
@@ -2096,23 +2040,15 @@ const GenericInput = ({
|
|
|
2096
2040
|
);
|
|
2097
2041
|
}
|
|
2098
2042
|
case "time": {
|
|
2099
|
-
|
|
2100
|
-
if (typeof value === "string" && value.split(":").length > 2) {
|
|
2101
|
-
const [hour, minute] = value.split(":");
|
|
2102
|
-
time = `${hour}:${minute}`;
|
|
2103
|
-
}
|
|
2043
|
+
const formattedValue = handleTimeChange({ value, onChange, name, type });
|
|
2104
2044
|
return /* @__PURE__ */ jsx(
|
|
2105
2045
|
TimePicker,
|
|
2106
2046
|
{
|
|
2107
2047
|
clearLabel: formatMessage({ id: "clearLabel", defaultMessage: "Clear" }),
|
|
2108
2048
|
disabled,
|
|
2109
|
-
onChange: (
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
onClear: () => {
|
|
2113
|
-
onChange({ target: { name, value: null, type } });
|
|
2114
|
-
},
|
|
2115
|
-
value: time
|
|
2049
|
+
onChange: (time) => handleTimeChangeEvent(onChange, name, type, time),
|
|
2050
|
+
onClear: () => handleTimeChangeEvent(onChange, name, type, void 0),
|
|
2051
|
+
value: formattedValue
|
|
2116
2052
|
}
|
|
2117
2053
|
);
|
|
2118
2054
|
}
|
|
@@ -2252,9 +2188,11 @@ const RelationTargetPicker = ({
|
|
|
2252
2188
|
] });
|
|
2253
2189
|
};
|
|
2254
2190
|
const MenuTrigger = styled(Menu.Trigger)`
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2191
|
+
max-width: 16.8rem;
|
|
2192
|
+
span {
|
|
2193
|
+
white-space: nowrap;
|
|
2194
|
+
overflow: hidden;
|
|
2195
|
+
text-overflow: ellipsis;
|
|
2258
2196
|
}
|
|
2259
2197
|
`;
|
|
2260
2198
|
const RelationFormBox = ({
|
|
@@ -2805,18 +2743,36 @@ const TabForm = ({
|
|
|
2805
2743
|
null
|
|
2806
2744
|
);
|
|
2807
2745
|
if (input.type === "pushRight") {
|
|
2808
|
-
return /* @__PURE__ */ jsx(
|
|
2746
|
+
return /* @__PURE__ */ jsx(
|
|
2747
|
+
Grid.Item,
|
|
2748
|
+
{
|
|
2749
|
+
col: input.size || 6,
|
|
2750
|
+
direction: "column",
|
|
2751
|
+
alignItems: "stretch",
|
|
2752
|
+
children: /* @__PURE__ */ jsx("div", {})
|
|
2753
|
+
},
|
|
2754
|
+
input.name || key
|
|
2755
|
+
);
|
|
2809
2756
|
}
|
|
2810
|
-
return /* @__PURE__ */ jsx(
|
|
2811
|
-
|
|
2757
|
+
return /* @__PURE__ */ jsx(
|
|
2758
|
+
Grid.Item,
|
|
2812
2759
|
{
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2760
|
+
col: input.size || 6,
|
|
2761
|
+
direction: "column",
|
|
2762
|
+
alignItems: "stretch",
|
|
2763
|
+
children: /* @__PURE__ */ jsx(
|
|
2764
|
+
MemoizedGenericInput,
|
|
2765
|
+
{
|
|
2766
|
+
...input,
|
|
2767
|
+
...genericInputProps,
|
|
2768
|
+
error: errorId,
|
|
2769
|
+
onChange,
|
|
2770
|
+
value
|
|
2771
|
+
}
|
|
2772
|
+
)
|
|
2773
|
+
},
|
|
2774
|
+
input.name || key
|
|
2775
|
+
);
|
|
2820
2776
|
}) })
|
|
2821
2777
|
] }, sectionIndex);
|
|
2822
2778
|
}) });
|
|
@@ -5007,9 +4963,10 @@ const FormModal = () => {
|
|
|
5007
4963
|
kind,
|
|
5008
4964
|
step,
|
|
5009
4965
|
targetUid,
|
|
5010
|
-
showBackLink
|
|
4966
|
+
showBackLink,
|
|
4967
|
+
activeTab,
|
|
4968
|
+
setActiveTab
|
|
5011
4969
|
} = useFormModalNavigation();
|
|
5012
|
-
const [activeTab, setActiveTab] = React.useState("basic");
|
|
5013
4970
|
const getPlugin = useStrapiApp("FormModal", (state) => state.getPlugin);
|
|
5014
4971
|
const getCustomField = useStrapiApp("FormModal", (state) => state.customFields.get);
|
|
5015
4972
|
const customField = getCustomField(customFieldUid);
|
|
@@ -6070,7 +6027,7 @@ const DataManagerProvider = ({ children }) => {
|
|
|
6070
6027
|
} = useSelector(makeSelectDataManagerProvider());
|
|
6071
6028
|
const { toggleNotification } = useNotification();
|
|
6072
6029
|
const { lockAppWithAutoreload, unlockAppWithAutoreload } = useAutoReloadOverlayBlocker();
|
|
6073
|
-
const setCurrentStep = useGuidedTour("DataManagerProvider", (state) => state
|
|
6030
|
+
const { setCurrentStep, setStepState } = useGuidedTour("DataManagerProvider", (state) => state);
|
|
6074
6031
|
const getPlugin = useStrapiApp("DataManagerProvider", (state) => state.getPlugin);
|
|
6075
6032
|
const plugin = getPlugin(pluginId);
|
|
6076
6033
|
const autoReload = useAppInfo("DataManagerProvider", (state) => state.autoReload);
|
|
@@ -6399,10 +6356,10 @@ const DataManagerProvider = ({ children }) => {
|
|
|
6399
6356
|
} else {
|
|
6400
6357
|
await put(requestURL, body);
|
|
6401
6358
|
}
|
|
6402
|
-
await serverRestartWatcher(true);
|
|
6403
|
-
unlockAppWithAutoreload?.();
|
|
6404
6359
|
if (isCreating && (initialData.contentType?.schema.kind === "collectionType" || initialData.contentType?.schema.kind === "singleType")) {
|
|
6405
|
-
|
|
6360
|
+
setStepState("contentTypeBuilder.success", true);
|
|
6361
|
+
trackUsage("didCreateGuidedTourCollectionType");
|
|
6362
|
+
setCurrentStep(null);
|
|
6406
6363
|
}
|
|
6407
6364
|
if (isInContentTypeView) {
|
|
6408
6365
|
trackUsage("didSaveContentType");
|
|
@@ -6414,6 +6371,8 @@ const DataManagerProvider = ({ children }) => {
|
|
|
6414
6371
|
} else {
|
|
6415
6372
|
trackUsage("didSaveComponent");
|
|
6416
6373
|
}
|
|
6374
|
+
await serverRestartWatcher(true);
|
|
6375
|
+
unlockAppWithAutoreload?.();
|
|
6417
6376
|
await getDataRef.current();
|
|
6418
6377
|
dispatch({ type: UPDATE_INITIAL_STATE });
|
|
6419
6378
|
await updatePermissions();
|
|
@@ -6493,7 +6452,8 @@ const INITIAL_STATE_DATA = {
|
|
|
6493
6452
|
kind: null,
|
|
6494
6453
|
step: null,
|
|
6495
6454
|
targetUid: null,
|
|
6496
|
-
customFieldUid: null
|
|
6455
|
+
customFieldUid: null,
|
|
6456
|
+
activeTab: "basic"
|
|
6497
6457
|
};
|
|
6498
6458
|
const FormModalNavigationProvider = ({ children }) => {
|
|
6499
6459
|
const [state, setFormModalNavigationState] = React.useState(INITIAL_STATE_DATA);
|
|
@@ -6505,7 +6465,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6505
6465
|
actionType: "create",
|
|
6506
6466
|
modalType: "customField",
|
|
6507
6467
|
attributeType,
|
|
6508
|
-
customFieldUid
|
|
6468
|
+
customFieldUid,
|
|
6469
|
+
activeTab: "basic"
|
|
6509
6470
|
};
|
|
6510
6471
|
});
|
|
6511
6472
|
};
|
|
@@ -6520,7 +6481,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6520
6481
|
modalType: "attribute",
|
|
6521
6482
|
step,
|
|
6522
6483
|
attributeType,
|
|
6523
|
-
showBackLink: true
|
|
6484
|
+
showBackLink: true,
|
|
6485
|
+
activeTab: "basic"
|
|
6524
6486
|
};
|
|
6525
6487
|
});
|
|
6526
6488
|
};
|
|
@@ -6547,13 +6509,14 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6547
6509
|
targetUid,
|
|
6548
6510
|
modalType: "chooseAttribute",
|
|
6549
6511
|
isOpen: true,
|
|
6550
|
-
showBackLink: false
|
|
6512
|
+
showBackLink: false,
|
|
6513
|
+
activeTab: "basic"
|
|
6551
6514
|
};
|
|
6552
6515
|
});
|
|
6553
6516
|
};
|
|
6554
6517
|
const onOpenModalCreateSchema = (nextState) => {
|
|
6555
6518
|
setFormModalNavigationState((prevState) => {
|
|
6556
|
-
return { ...prevState, ...nextState, isOpen: true };
|
|
6519
|
+
return { ...prevState, ...nextState, isOpen: true, activeTab: "basic" };
|
|
6557
6520
|
});
|
|
6558
6521
|
};
|
|
6559
6522
|
const onOpenModalEditCategory = (categoryName) => {
|
|
@@ -6563,7 +6526,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6563
6526
|
categoryName,
|
|
6564
6527
|
actionType: "edit",
|
|
6565
6528
|
modalType: "editCategory",
|
|
6566
|
-
isOpen: true
|
|
6529
|
+
isOpen: true,
|
|
6530
|
+
activeTab: "basic"
|
|
6567
6531
|
};
|
|
6568
6532
|
});
|
|
6569
6533
|
};
|
|
@@ -6584,7 +6548,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6584
6548
|
targetUid,
|
|
6585
6549
|
attributeName,
|
|
6586
6550
|
attributeType,
|
|
6587
|
-
isOpen: true
|
|
6551
|
+
isOpen: true,
|
|
6552
|
+
activeTab: "basic"
|
|
6588
6553
|
};
|
|
6589
6554
|
});
|
|
6590
6555
|
};
|
|
@@ -6618,7 +6583,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6618
6583
|
forTarget,
|
|
6619
6584
|
targetUid,
|
|
6620
6585
|
kind,
|
|
6621
|
-
isOpen: true
|
|
6586
|
+
isOpen: true,
|
|
6587
|
+
activeTab: "basic"
|
|
6622
6588
|
};
|
|
6623
6589
|
});
|
|
6624
6590
|
};
|
|
@@ -6631,7 +6597,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6631
6597
|
...prev,
|
|
6632
6598
|
forTarget,
|
|
6633
6599
|
targetUid,
|
|
6634
|
-
modalType: "chooseAttribute"
|
|
6600
|
+
modalType: "chooseAttribute",
|
|
6601
|
+
activeTab: "basic"
|
|
6635
6602
|
};
|
|
6636
6603
|
});
|
|
6637
6604
|
};
|
|
@@ -6641,7 +6608,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6641
6608
|
...prev,
|
|
6642
6609
|
attributeType: "component",
|
|
6643
6610
|
modalType: "attribute",
|
|
6644
|
-
step: "2"
|
|
6611
|
+
step: "2",
|
|
6612
|
+
activeTab: "basic"
|
|
6645
6613
|
};
|
|
6646
6614
|
});
|
|
6647
6615
|
};
|
|
@@ -6654,7 +6622,16 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6654
6622
|
actionType: "create",
|
|
6655
6623
|
step: "1",
|
|
6656
6624
|
attributeType: null,
|
|
6657
|
-
attributeName: null
|
|
6625
|
+
attributeName: null,
|
|
6626
|
+
activeTab: "basic"
|
|
6627
|
+
};
|
|
6628
|
+
});
|
|
6629
|
+
};
|
|
6630
|
+
const setActiveTab = (value) => {
|
|
6631
|
+
setFormModalNavigationState((prev) => {
|
|
6632
|
+
return {
|
|
6633
|
+
...prev,
|
|
6634
|
+
activeTab: value
|
|
6658
6635
|
};
|
|
6659
6636
|
});
|
|
6660
6637
|
};
|
|
@@ -6676,17 +6653,18 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6676
6653
|
onOpenModalEditField,
|
|
6677
6654
|
onOpenModalEditCustomField,
|
|
6678
6655
|
onOpenModalEditSchema,
|
|
6679
|
-
setFormModalNavigationState
|
|
6656
|
+
setFormModalNavigationState,
|
|
6657
|
+
setActiveTab
|
|
6680
6658
|
},
|
|
6681
6659
|
children
|
|
6682
6660
|
}
|
|
6683
6661
|
);
|
|
6684
6662
|
};
|
|
6685
|
-
const ListView$1 = lazy(() => import("./ListView-
|
|
6663
|
+
const ListView$1 = lazy(() => import("./ListView-CGLqkUBZ.mjs"));
|
|
6686
6664
|
const RecursivePath = () => {
|
|
6687
6665
|
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Page.Loading, {}), children: /* @__PURE__ */ jsx(Routes, { children: /* @__PURE__ */ jsx(Route, { path: `/:componentUid`, element: /* @__PURE__ */ jsx(ListView$1, {}) }) }) });
|
|
6688
6666
|
};
|
|
6689
|
-
const ListView = lazy(() => import("./ListView-
|
|
6667
|
+
const ListView = lazy(() => import("./ListView-CGLqkUBZ.mjs"));
|
|
6690
6668
|
const App = () => {
|
|
6691
6669
|
const { formatMessage } = useIntl();
|
|
6692
6670
|
const title = formatMessage({
|
|
@@ -6720,4 +6698,4 @@ export {
|
|
|
6720
6698
|
index as i,
|
|
6721
6699
|
useDataManager as u
|
|
6722
6700
|
};
|
|
6723
|
-
//# sourceMappingURL=index-
|
|
6701
|
+
//# sourceMappingURL=index-BXPQ175h.mjs.map
|