@strapi/content-type-builder 5.0.0-rc.8 → 5.0.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/_chunks/{ListView-BlRO0hDC.js → ListView-CxvINB8V.js} +14 -13
- package/dist/_chunks/ListView-CxvINB8V.js.map +1 -0
- package/dist/_chunks/{ListView-B6MnxBt0.mjs → ListView-D1VH47yt.mjs} +14 -13
- package/dist/_chunks/ListView-D1VH47yt.mjs.map +1 -0
- package/dist/_chunks/{index-BLF1AIxt.js → index-BVbHj3Bu.js} +146 -195
- package/dist/_chunks/index-BVbHj3Bu.js.map +1 -0
- package/dist/_chunks/{index-DTrOFTtR.mjs → index-Bd7-GZsY.mjs} +160 -20
- package/dist/_chunks/index-Bd7-GZsY.mjs.map +1 -0
- package/dist/_chunks/{index-DgZgByqn.js → index-Be2fSfxp.js} +150 -9
- package/dist/_chunks/index-Be2fSfxp.js.map +1 -0
- package/dist/_chunks/{index-DuI_0sF6.mjs → index-S6EtktTB.mjs} +150 -199
- package/dist/_chunks/index-S6EtktTB.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-B6MnxBt0.mjs.map +0 -1
- package/dist/_chunks/ListView-BlRO0hDC.js.map +0 -1
- package/dist/_chunks/index-BLF1AIxt.js.map +0 -1
- package/dist/_chunks/index-DTrOFTtR.mjs.map +0 -1
- package/dist/_chunks/index-DgZgByqn.js.map +0 -1
- package/dist/_chunks/index-DuI_0sF6.mjs.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-Bd7-GZsY.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);
|
|
@@ -586,7 +454,7 @@ const AttributeOption = ({ type = "text" }) => {
|
|
|
586
454
|
const AttributeList = ({ attributes }) => /* @__PURE__ */ jsx(KeyboardNavigable, { tagName: "button", children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 8, children: attributes.map((attributeRow, index2) => {
|
|
587
455
|
return (
|
|
588
456
|
// eslint-disable-next-line react/no-array-index-key
|
|
589
|
-
/* @__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)
|
|
590
458
|
);
|
|
591
459
|
}) }) });
|
|
592
460
|
const CustomFieldOption = ({ customFieldUid, customField }) => {
|
|
@@ -643,7 +511,7 @@ const EmptyAttributes = () => {
|
|
|
643
511
|
/* @__PURE__ */ jsx(
|
|
644
512
|
LinkButton,
|
|
645
513
|
{
|
|
646
|
-
tag: Link
|
|
514
|
+
tag: Link,
|
|
647
515
|
to: `/marketplace?${qs.stringify({ categories: ["Custom fields"] })}`,
|
|
648
516
|
variant: "secondary",
|
|
649
517
|
startIcon: /* @__PURE__ */ jsx(Plus, {}),
|
|
@@ -667,9 +535,9 @@ const CustomFieldsList = () => {
|
|
|
667
535
|
(a, b) => a[1].name > b[1].name ? 1 : -1
|
|
668
536
|
);
|
|
669
537
|
return /* @__PURE__ */ jsx(KeyboardNavigable, { tagName: "button", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 3, children: [
|
|
670
|
-
/* @__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)) }),
|
|
671
539
|
/* @__PURE__ */ jsx(
|
|
672
|
-
Link,
|
|
540
|
+
Link$1,
|
|
673
541
|
{
|
|
674
542
|
href: "https://docs.strapi.io/developer-docs/latest/development/custom-fields.html",
|
|
675
543
|
isExternal: true,
|
|
@@ -739,6 +607,9 @@ const Wrapper$1 = styled(Flex)`
|
|
|
739
607
|
cursor: pointer;
|
|
740
608
|
user-select: none;
|
|
741
609
|
flex: 1;
|
|
610
|
+
border-radius: 4px;
|
|
611
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
612
|
+
|
|
742
613
|
${inputFocusStyle()}
|
|
743
614
|
}
|
|
744
615
|
|
|
@@ -750,7 +621,6 @@ const Wrapper$1 = styled(Flex)`
|
|
|
750
621
|
.option {
|
|
751
622
|
height: 100%;
|
|
752
623
|
border-radius: 4px;
|
|
753
|
-
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
754
624
|
will-change: transform, opacity;
|
|
755
625
|
background: ${({ theme }) => theme.colors.neutral0};
|
|
756
626
|
|
|
@@ -787,7 +657,6 @@ const Wrapper$1 = styled(Flex)`
|
|
|
787
657
|
.container input:checked ~ div {
|
|
788
658
|
background: ${({ theme }) => theme.colors.primary100};
|
|
789
659
|
color: ${({ theme }) => theme.colors.primary600};
|
|
790
|
-
border: 1px solid ${({ theme }) => theme.colors.primary200};
|
|
791
660
|
.checkmark {
|
|
792
661
|
border: solid 1px ${({ theme }) => theme.colors.primary600};
|
|
793
662
|
&::after {
|
|
@@ -953,10 +822,19 @@ const DraftAndPublishToggle = ({
|
|
|
953
822
|
/* @__PURE__ */ jsx(Checkbox, { checked: value, disabled, onCheckedChange: handleChange, children: label }),
|
|
954
823
|
/* @__PURE__ */ jsx(Field.Hint, {})
|
|
955
824
|
] }),
|
|
956
|
-
/* @__PURE__ */ jsx(Dialog.Root, { open: showWarning, onOpenChange: (isOpen) => setShowWarning(isOpen), children: /* @__PURE__ */ jsx(
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
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
|
+
) })
|
|
960
838
|
] });
|
|
961
839
|
};
|
|
962
840
|
const FormModalEndActions = ({
|
|
@@ -1403,7 +1281,7 @@ const FormModalHeader = ({
|
|
|
1403
1281
|
return /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsxs(Flex, { gap: 3, children: [
|
|
1404
1282
|
showBackLink && // This is a workaround and should use the LinkButton with a variant that currently doesn't exist
|
|
1405
1283
|
/* @__PURE__ */ jsx(
|
|
1406
|
-
Link,
|
|
1284
|
+
Link$1,
|
|
1407
1285
|
{
|
|
1408
1286
|
"aria-label": formatMessage({
|
|
1409
1287
|
id: getTrad("modalForm.header.back"),
|
|
@@ -1721,7 +1599,7 @@ const IconPicker = ({ intlLabel, name, onChange, value = "" }) => {
|
|
|
1721
1599
|
id: getTrad("IconPicker.search.button.label"),
|
|
1722
1600
|
defaultMessage: "Search icon button"
|
|
1723
1601
|
}),
|
|
1724
|
-
|
|
1602
|
+
variant: "ghost",
|
|
1725
1603
|
children: /* @__PURE__ */ jsx(Search, {})
|
|
1726
1604
|
}
|
|
1727
1605
|
),
|
|
@@ -1741,7 +1619,7 @@ const IconPicker = ({ intlLabel, name, onChange, value = "" }) => {
|
|
|
1741
1619
|
id: getTrad("IconPicker.remove.button"),
|
|
1742
1620
|
defaultMessage: "Remove the selected icon"
|
|
1743
1621
|
}),
|
|
1744
|
-
|
|
1622
|
+
variant: "ghost",
|
|
1745
1623
|
children: /* @__PURE__ */ jsx(Trash, {})
|
|
1746
1624
|
}
|
|
1747
1625
|
)
|
|
@@ -1822,6 +1700,49 @@ const PluralName = ({
|
|
|
1822
1700
|
/* @__PURE__ */ jsx(Field.Error, {})
|
|
1823
1701
|
] });
|
|
1824
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
|
+
};
|
|
1825
1746
|
const GenericInput = ({
|
|
1826
1747
|
autoComplete,
|
|
1827
1748
|
customInputs,
|
|
@@ -1973,6 +1894,7 @@ const GenericInput = ({
|
|
|
1973
1894
|
);
|
|
1974
1895
|
}
|
|
1975
1896
|
case "datetime": {
|
|
1897
|
+
const dateValue = parseDateValue(value);
|
|
1976
1898
|
return /* @__PURE__ */ jsx(
|
|
1977
1899
|
DateTimePicker,
|
|
1978
1900
|
{
|
|
@@ -1984,11 +1906,12 @@ const GenericInput = ({
|
|
|
1984
1906
|
},
|
|
1985
1907
|
onClear: () => onChange({ target: { name, value: null, type } }),
|
|
1986
1908
|
placeholder: formattedPlaceholder,
|
|
1987
|
-
value
|
|
1909
|
+
value: dateValue
|
|
1988
1910
|
}
|
|
1989
1911
|
);
|
|
1990
1912
|
}
|
|
1991
1913
|
case "date": {
|
|
1914
|
+
const dateValue = parseDateValue(value);
|
|
1992
1915
|
return /* @__PURE__ */ jsx(
|
|
1993
1916
|
DatePicker,
|
|
1994
1917
|
{
|
|
@@ -2005,7 +1928,7 @@ const GenericInput = ({
|
|
|
2005
1928
|
},
|
|
2006
1929
|
onClear: () => onChange({ target: { name, value: null, type } }),
|
|
2007
1930
|
placeholder: formattedPlaceholder,
|
|
2008
|
-
value
|
|
1931
|
+
value: dateValue
|
|
2009
1932
|
}
|
|
2010
1933
|
);
|
|
2011
1934
|
}
|
|
@@ -2117,23 +2040,15 @@ const GenericInput = ({
|
|
|
2117
2040
|
);
|
|
2118
2041
|
}
|
|
2119
2042
|
case "time": {
|
|
2120
|
-
|
|
2121
|
-
if (typeof value === "string" && value.split(":").length > 2) {
|
|
2122
|
-
const [hour, minute] = value.split(":");
|
|
2123
|
-
time = `${hour}:${minute}`;
|
|
2124
|
-
}
|
|
2043
|
+
const formattedValue = handleTimeChange({ value, onChange, name, type });
|
|
2125
2044
|
return /* @__PURE__ */ jsx(
|
|
2126
2045
|
TimePicker,
|
|
2127
2046
|
{
|
|
2128
2047
|
clearLabel: formatMessage({ id: "clearLabel", defaultMessage: "Clear" }),
|
|
2129
2048
|
disabled,
|
|
2130
|
-
onChange: (
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
onClear: () => {
|
|
2134
|
-
onChange({ target: { name, value: null, type } });
|
|
2135
|
-
},
|
|
2136
|
-
value: time
|
|
2049
|
+
onChange: (time) => handleTimeChangeEvent(onChange, name, type, time),
|
|
2050
|
+
onClear: () => handleTimeChangeEvent(onChange, name, type, void 0),
|
|
2051
|
+
value: formattedValue
|
|
2137
2052
|
}
|
|
2138
2053
|
);
|
|
2139
2054
|
}
|
|
@@ -2279,10 +2194,6 @@ const MenuTrigger = styled(Menu.Trigger)`
|
|
|
2279
2194
|
overflow: hidden;
|
|
2280
2195
|
text-overflow: ellipsis;
|
|
2281
2196
|
}
|
|
2282
|
-
svg {
|
|
2283
|
-
width: 0.6rem;
|
|
2284
|
-
height: 0.4rem;
|
|
2285
|
-
}
|
|
2286
2197
|
`;
|
|
2287
2198
|
const RelationFormBox = ({
|
|
2288
2199
|
disabled = false,
|
|
@@ -2832,18 +2743,36 @@ const TabForm = ({
|
|
|
2832
2743
|
null
|
|
2833
2744
|
);
|
|
2834
2745
|
if (input.type === "pushRight") {
|
|
2835
|
-
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
|
+
);
|
|
2836
2756
|
}
|
|
2837
|
-
return /* @__PURE__ */ jsx(
|
|
2838
|
-
|
|
2757
|
+
return /* @__PURE__ */ jsx(
|
|
2758
|
+
Grid.Item,
|
|
2839
2759
|
{
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
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
|
+
);
|
|
2847
2776
|
}) })
|
|
2848
2777
|
] }, sectionIndex);
|
|
2849
2778
|
}) });
|
|
@@ -5034,9 +4963,10 @@ const FormModal = () => {
|
|
|
5034
4963
|
kind,
|
|
5035
4964
|
step,
|
|
5036
4965
|
targetUid,
|
|
5037
|
-
showBackLink
|
|
4966
|
+
showBackLink,
|
|
4967
|
+
activeTab,
|
|
4968
|
+
setActiveTab
|
|
5038
4969
|
} = useFormModalNavigation();
|
|
5039
|
-
const [activeTab, setActiveTab] = React.useState("basic");
|
|
5040
4970
|
const getPlugin = useStrapiApp("FormModal", (state) => state.getPlugin);
|
|
5041
4971
|
const getCustomField = useStrapiApp("FormModal", (state) => state.customFields.get);
|
|
5042
4972
|
const customField = getCustomField(customFieldUid);
|
|
@@ -6097,7 +6027,7 @@ const DataManagerProvider = ({ children }) => {
|
|
|
6097
6027
|
} = useSelector(makeSelectDataManagerProvider());
|
|
6098
6028
|
const { toggleNotification } = useNotification();
|
|
6099
6029
|
const { lockAppWithAutoreload, unlockAppWithAutoreload } = useAutoReloadOverlayBlocker();
|
|
6100
|
-
const setCurrentStep = useGuidedTour("DataManagerProvider", (state) => state
|
|
6030
|
+
const { setCurrentStep, setStepState } = useGuidedTour("DataManagerProvider", (state) => state);
|
|
6101
6031
|
const getPlugin = useStrapiApp("DataManagerProvider", (state) => state.getPlugin);
|
|
6102
6032
|
const plugin = getPlugin(pluginId);
|
|
6103
6033
|
const autoReload = useAppInfo("DataManagerProvider", (state) => state.autoReload);
|
|
@@ -6426,10 +6356,10 @@ const DataManagerProvider = ({ children }) => {
|
|
|
6426
6356
|
} else {
|
|
6427
6357
|
await put(requestURL, body);
|
|
6428
6358
|
}
|
|
6429
|
-
await serverRestartWatcher(true);
|
|
6430
|
-
unlockAppWithAutoreload?.();
|
|
6431
6359
|
if (isCreating && (initialData.contentType?.schema.kind === "collectionType" || initialData.contentType?.schema.kind === "singleType")) {
|
|
6432
|
-
|
|
6360
|
+
setStepState("contentTypeBuilder.success", true);
|
|
6361
|
+
trackUsage("didCreateGuidedTourCollectionType");
|
|
6362
|
+
setCurrentStep(null);
|
|
6433
6363
|
}
|
|
6434
6364
|
if (isInContentTypeView) {
|
|
6435
6365
|
trackUsage("didSaveContentType");
|
|
@@ -6441,6 +6371,8 @@ const DataManagerProvider = ({ children }) => {
|
|
|
6441
6371
|
} else {
|
|
6442
6372
|
trackUsage("didSaveComponent");
|
|
6443
6373
|
}
|
|
6374
|
+
await serverRestartWatcher(true);
|
|
6375
|
+
unlockAppWithAutoreload?.();
|
|
6444
6376
|
await getDataRef.current();
|
|
6445
6377
|
dispatch({ type: UPDATE_INITIAL_STATE });
|
|
6446
6378
|
await updatePermissions();
|
|
@@ -6520,7 +6452,8 @@ const INITIAL_STATE_DATA = {
|
|
|
6520
6452
|
kind: null,
|
|
6521
6453
|
step: null,
|
|
6522
6454
|
targetUid: null,
|
|
6523
|
-
customFieldUid: null
|
|
6455
|
+
customFieldUid: null,
|
|
6456
|
+
activeTab: "basic"
|
|
6524
6457
|
};
|
|
6525
6458
|
const FormModalNavigationProvider = ({ children }) => {
|
|
6526
6459
|
const [state, setFormModalNavigationState] = React.useState(INITIAL_STATE_DATA);
|
|
@@ -6532,7 +6465,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6532
6465
|
actionType: "create",
|
|
6533
6466
|
modalType: "customField",
|
|
6534
6467
|
attributeType,
|
|
6535
|
-
customFieldUid
|
|
6468
|
+
customFieldUid,
|
|
6469
|
+
activeTab: "basic"
|
|
6536
6470
|
};
|
|
6537
6471
|
});
|
|
6538
6472
|
};
|
|
@@ -6547,7 +6481,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6547
6481
|
modalType: "attribute",
|
|
6548
6482
|
step,
|
|
6549
6483
|
attributeType,
|
|
6550
|
-
showBackLink: true
|
|
6484
|
+
showBackLink: true,
|
|
6485
|
+
activeTab: "basic"
|
|
6551
6486
|
};
|
|
6552
6487
|
});
|
|
6553
6488
|
};
|
|
@@ -6574,13 +6509,14 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6574
6509
|
targetUid,
|
|
6575
6510
|
modalType: "chooseAttribute",
|
|
6576
6511
|
isOpen: true,
|
|
6577
|
-
showBackLink: false
|
|
6512
|
+
showBackLink: false,
|
|
6513
|
+
activeTab: "basic"
|
|
6578
6514
|
};
|
|
6579
6515
|
});
|
|
6580
6516
|
};
|
|
6581
6517
|
const onOpenModalCreateSchema = (nextState) => {
|
|
6582
6518
|
setFormModalNavigationState((prevState) => {
|
|
6583
|
-
return { ...prevState, ...nextState, isOpen: true };
|
|
6519
|
+
return { ...prevState, ...nextState, isOpen: true, activeTab: "basic" };
|
|
6584
6520
|
});
|
|
6585
6521
|
};
|
|
6586
6522
|
const onOpenModalEditCategory = (categoryName) => {
|
|
@@ -6590,7 +6526,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6590
6526
|
categoryName,
|
|
6591
6527
|
actionType: "edit",
|
|
6592
6528
|
modalType: "editCategory",
|
|
6593
|
-
isOpen: true
|
|
6529
|
+
isOpen: true,
|
|
6530
|
+
activeTab: "basic"
|
|
6594
6531
|
};
|
|
6595
6532
|
});
|
|
6596
6533
|
};
|
|
@@ -6611,7 +6548,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6611
6548
|
targetUid,
|
|
6612
6549
|
attributeName,
|
|
6613
6550
|
attributeType,
|
|
6614
|
-
isOpen: true
|
|
6551
|
+
isOpen: true,
|
|
6552
|
+
activeTab: "basic"
|
|
6615
6553
|
};
|
|
6616
6554
|
});
|
|
6617
6555
|
};
|
|
@@ -6645,7 +6583,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6645
6583
|
forTarget,
|
|
6646
6584
|
targetUid,
|
|
6647
6585
|
kind,
|
|
6648
|
-
isOpen: true
|
|
6586
|
+
isOpen: true,
|
|
6587
|
+
activeTab: "basic"
|
|
6649
6588
|
};
|
|
6650
6589
|
});
|
|
6651
6590
|
};
|
|
@@ -6658,7 +6597,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6658
6597
|
...prev,
|
|
6659
6598
|
forTarget,
|
|
6660
6599
|
targetUid,
|
|
6661
|
-
modalType: "chooseAttribute"
|
|
6600
|
+
modalType: "chooseAttribute",
|
|
6601
|
+
activeTab: "basic"
|
|
6662
6602
|
};
|
|
6663
6603
|
});
|
|
6664
6604
|
};
|
|
@@ -6668,7 +6608,8 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6668
6608
|
...prev,
|
|
6669
6609
|
attributeType: "component",
|
|
6670
6610
|
modalType: "attribute",
|
|
6671
|
-
step: "2"
|
|
6611
|
+
step: "2",
|
|
6612
|
+
activeTab: "basic"
|
|
6672
6613
|
};
|
|
6673
6614
|
});
|
|
6674
6615
|
};
|
|
@@ -6681,7 +6622,16 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6681
6622
|
actionType: "create",
|
|
6682
6623
|
step: "1",
|
|
6683
6624
|
attributeType: null,
|
|
6684
|
-
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
|
|
6685
6635
|
};
|
|
6686
6636
|
});
|
|
6687
6637
|
};
|
|
@@ -6703,17 +6653,18 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6703
6653
|
onOpenModalEditField,
|
|
6704
6654
|
onOpenModalEditCustomField,
|
|
6705
6655
|
onOpenModalEditSchema,
|
|
6706
|
-
setFormModalNavigationState
|
|
6656
|
+
setFormModalNavigationState,
|
|
6657
|
+
setActiveTab
|
|
6707
6658
|
},
|
|
6708
6659
|
children
|
|
6709
6660
|
}
|
|
6710
6661
|
);
|
|
6711
6662
|
};
|
|
6712
|
-
const ListView$1 = lazy(() => import("./ListView-
|
|
6663
|
+
const ListView$1 = lazy(() => import("./ListView-D1VH47yt.mjs"));
|
|
6713
6664
|
const RecursivePath = () => {
|
|
6714
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, {}) }) }) });
|
|
6715
6666
|
};
|
|
6716
|
-
const ListView = lazy(() => import("./ListView-
|
|
6667
|
+
const ListView = lazy(() => import("./ListView-D1VH47yt.mjs"));
|
|
6717
6668
|
const App = () => {
|
|
6718
6669
|
const { formatMessage } = useIntl();
|
|
6719
6670
|
const title = formatMessage({
|
|
@@ -6747,4 +6698,4 @@ export {
|
|
|
6747
6698
|
index as i,
|
|
6748
6699
|
useDataManager as u
|
|
6749
6700
|
};
|
|
6750
|
-
//# sourceMappingURL=index-
|
|
6701
|
+
//# sourceMappingURL=index-S6EtktTB.mjs.map
|