slice-machine-ui 1.22.3-beta.1 → 1.22.3-beta.3
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/components/DeleteVariationModal/index.tsx +12 -11
- package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +2 -5
- package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +9 -5
- package/components/Forms/RenameVariationModal/RenameVariationModal.tsx +12 -11
- package/components/ItemHeader/index.tsx +1 -0
- package/components/ListItem/index.tsx +5 -2
- package/components/ScreenshotChangesModal/VariationDropZone.tsx +31 -9
- package/components/ScreenshotChangesModal/index.tsx +3 -0
- package/components/ScreenshotChangesModal/useCustomScreenshot.tsx +5 -5
- package/components/Simulator/index.tsx +9 -3
- package/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +2 -2
- package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +2 -2
- package/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +12 -20
- package/lib/builders/CustomTypeBuilder/TabModal/update.tsx +3 -1
- package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +119 -52
- package/lib/builders/CustomTypeBuilder/index.tsx +39 -42
- package/lib/builders/SliceBuilder/FieldZones/index.tsx +81 -56
- package/lib/builders/SliceBuilder/Sidebar/AddVariationModal.tsx +24 -16
- package/lib/builders/SliceBuilder/Sidebar/index.tsx +44 -46
- package/lib/builders/SliceBuilder/SimulatorButton/index.tsx +4 -28
- package/lib/builders/SliceBuilder/index.tsx +10 -96
- package/lib/builders/common/Zone/Card/components/Hints/CodeBlock.tsx +5 -1
- package/lib/builders/common/Zone/Card/components/NewField.tsx +16 -15
- package/lib/builders/common/Zone/Card/index.jsx +2 -0
- package/lib/builders/common/Zone/index.jsx +3 -1
- package/lib/models/common/ComponentUI.ts +0 -14
- package/lib/models/common/CustomType/sliceZone.ts +0 -29
- package/lib/models/common/CustomType/tab.ts +10 -142
- package/lib/models/common/widgets/Group/ListItem/index.jsx +61 -23
- package/out/404.html +1 -1
- package/out/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js +1 -0
- package/out/_next/static/chunks/183-4feb6bb3eddbc768.js +1 -0
- package/out/_next/static/chunks/18539003-7b2711e6c51d6fac.js +97 -0
- package/out/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js +1 -0
- package/out/_next/static/chunks/25-8fedd33ad9b6de5b.js +1 -0
- package/out/_next/static/chunks/318-541db69860d31138.js +1 -0
- package/out/_next/static/chunks/{505-3f1cf09a086dcba8.js → 376-0ed5822f8afcaa7c.js} +3 -3
- package/out/_next/static/chunks/4c744e84-e3161d754618373f.js +1 -0
- package/out/_next/static/chunks/50-cfc2514205b86001.js +1 -0
- package/out/_next/static/chunks/543-f8766685f7f451e2.js +1 -0
- package/out/_next/static/chunks/59b4e022-7a3b5554b806349f.js +1 -0
- package/out/_next/static/chunks/696-b12edad30a3617e5.js +31 -0
- package/out/_next/static/chunks/727-15cf3f2fea9a37e5.js +1 -0
- package/out/_next/static/chunks/731-501990ebe6a71b32.js +1 -0
- package/out/_next/static/chunks/787-727e3aef5d2a10a8.js +1 -0
- package/out/_next/static/chunks/904-ccd8ca3368ce29fc.js +1 -0
- package/out/_next/static/chunks/{918-38d08f1e885b222d.js → 918-5bb55fb464e34768.js} +1 -1
- package/out/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js +1 -0
- package/out/_next/static/chunks/pages/_app-20876abeebe0fda7.js +430 -0
- package/out/_next/static/chunks/pages/changelog-68d115a14f1423d7.js +1 -0
- package/out/_next/static/chunks/pages/changes-6f62ae7b6243a1c7.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-3a37eb3373bb8823.js → [customTypeId]-3f862ad6111a1fc0.js} +1 -1
- package/out/_next/static/chunks/pages/{custom-types-2f5664d9492b13fb.js → custom-types-94b8f8dbf7727412.js} +1 -1
- package/out/_next/static/chunks/pages/{index-d8e3a2c0d712904f.js → index-64cfb8b0948ba8ef.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-733f3890c0466a05.js → [pageTypeId]-d1ffca11c42f2603.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-897ca93c114a1435.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-e89e2e6f772a3454.js +1 -0
- package/out/_next/static/chunks/pages/slices-9628f8aa54968d6a.js +1 -0
- package/out/_next/static/css/{1bbf650dfd37ce69.css → 1aa04669758c24f4.css} +1 -1
- package/out/_next/static/j_voPTrYzsuLCERqtl3Hn/_buildManifest.js +1 -0
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +6 -6
- package/pages/slices/[lib]/[sliceName]/[variation]/index.tsx +25 -11
- package/pages/slices/[lib]/[sliceName]/[variation]/simulator.tsx +12 -9
- package/src/apiClient.ts +7 -6
- package/src/components/CodeBlock/CodeBlock.tsx +1 -0
- package/src/components/Window/Window.tsx +7 -1
- package/src/domain/__tests__/customType.test.ts +785 -0
- package/src/domain/customType.ts +519 -6
- package/src/domain/slice.ts +166 -1
- package/src/features/autoSave/AutoSaveStatusIndicator.tsx +43 -0
- package/src/features/autoSave/useAutoSave.tsx +177 -0
- package/src/features/customTypes/EditDropdown.tsx +3 -0
- package/src/features/customTypes/actions/convertCustomToPageType.ts +2 -4
- package/src/features/customTypes/customTypesBuilder/CustomTypeProvider.tsx +90 -0
- package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +46 -79
- package/src/features/customTypes/customTypesMessages.ts +4 -0
- package/src/features/slices/actions/addSlicesToSliceZone.ts +2 -7
- package/src/features/slices/actions/uploadSliceScreenshot.ts +45 -0
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +5 -5
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +4 -10
- package/src/features/slices/sliceBuilder/SliceBuilderProvider.tsx +110 -0
- package/src/features/slices/sliceBuilder/actions/deleteVariation.ts +8 -24
- package/src/features/slices/sliceBuilder/actions/renameVariation.ts +8 -24
- package/src/features/slices/sliceCards/SharedSliceCard.tsx +1 -0
- package/src/hooks/useCurrentSlice.tsx +4 -16
- package/src/hooks/useScreenshotChangesModal.ts +1 -0
- package/src/hooks/useServerState.ts +1 -58
- package/src/modules/availableCustomTypes/index.ts +8 -3
- package/src/modules/simulator/index.ts +0 -2
- package/src/modules/slices/index.ts +32 -25
- package/src/modules/slices/selector.ts +30 -0
- package/src/modules/useSliceMachineActions.ts +20 -270
- package/src/redux/reducer.ts +0 -4
- package/src/redux/saga.ts +0 -6
- package/src/redux/type.ts +0 -4
- package/test/src/modules/availableCustomTypes/index.test.ts +8 -10
- package/test/src/modules/simulator.test.ts +0 -2
- package/lib/models/common/CustomType/group.ts +0 -80
- package/lib/models/common/Variation.ts +0 -100
- package/out/_next/static/ZrWICkLApT4ZATA_akn-2/_buildManifest.js +0 -1
- package/out/_next/static/chunks/18539003-4460ccbfe3109578.js +0 -97
- package/out/_next/static/chunks/482-34cee2a2071c235f.js +0 -1
- package/out/_next/static/chunks/550-c80fd46fb64d1eef.js +0 -1
- package/out/_next/static/chunks/80-7b8a97d0122ff74a.js +0 -1
- package/out/_next/static/chunks/840-163f8a1040e6820d.js +0 -1
- package/out/_next/static/chunks/904-519dbf0f7e8c6243.js +0 -1
- package/out/_next/static/chunks/958-8aca174b80cb0c35.js +0 -1
- package/out/_next/static/chunks/pages/_app-132564608e9a9502.js +0 -458
- package/out/_next/static/chunks/pages/changelog-4d0f2f1222e403fe.js +0 -1
- package/out/_next/static/chunks/pages/changes-52c9d917808d1461.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-7b17cb59d0db03b5.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ef11594ce026b650.js +0 -1
- package/out/_next/static/chunks/pages/slices-884a936a9a062a65.js +0 -1
- package/src/domain/__tests__/CustomTypeModel.test.ts +0 -247
- package/src/layouts/WithSlice.tsx +0 -26
- package/src/modules/screenshots/actions.ts +0 -21
- package/src/modules/screenshots/sagas.ts +0 -70
- package/src/modules/selectedCustomType/actions.ts +0 -147
- package/src/modules/selectedCustomType/index.ts +0 -11
- package/src/modules/selectedCustomType/reducer.ts +0 -287
- package/src/modules/selectedCustomType/sagas.ts +0 -72
- package/src/modules/selectedCustomType/selectors.ts +0 -33
- package/src/modules/selectedCustomType/stateHelpers.ts +0 -42
- package/src/modules/selectedCustomType/types.ts +0 -9
- package/src/modules/selectedSlice/actions.ts +0 -106
- package/src/modules/selectedSlice/reducer.ts +0 -175
- package/src/modules/selectedSlice/sagas.ts +0 -72
- package/src/modules/selectedSlice/selectors.ts +0 -55
- package/src/modules/selectedSlice/types.ts +0 -3
- package/src/modules/toaster/utils.tsx +0 -23
- package/test/lib/models/common/CustomType/sliceZone.test.ts +0 -49
- package/test/pages/custom-types.test.tsx +0 -625
- package/test/src/modules/selectedCustomType/__fixtures__/model.json +0 -119
- package/test/src/modules/selectedCustomType/reducer.test.ts +0 -322
- package/test/src/modules/selectedCustomType/sagas.test.ts +0 -89
- package/test/src/modules/selectedCustomType/selectors.test.ts +0 -54
- package/test/src/modules/selectedSlice/__fixtures__/mocks.json +0 -171
- package/test/src/modules/selectedSlice/__fixtures__/model.json +0 -35
- package/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts +0 -72
- package/test/src/modules/selectedSlice/__testutils__/getSelectedSliceDummyData.ts +0 -30
- package/test/src/modules/selectedSlice/reducer.test.ts +0 -170
- package/test/src/modules/selectedSlice/sagas.test.ts +0 -82
- package/test/src/modules/toaster/utils.test.ts +0 -50
- /package/out/_next/static/{ZrWICkLApT4ZATA_akn-2 → j_voPTrYzsuLCERqtl3Hn}/_ssgManifest.js +0 -0
|
@@ -11,8 +11,6 @@ import { Groups, GroupSM } from "../Group";
|
|
|
11
11
|
|
|
12
12
|
import { SlicesSM, SliceZone } from "../Slices";
|
|
13
13
|
|
|
14
|
-
import { SliceZone as SliceZoneOperations } from "./sliceZone";
|
|
15
|
-
|
|
16
14
|
export const TabFields = t.array(
|
|
17
15
|
t.type({
|
|
18
16
|
key: t.string,
|
|
@@ -88,145 +86,15 @@ export const Tabs = {
|
|
|
88
86
|
},
|
|
89
87
|
};
|
|
90
88
|
|
|
91
|
-
export
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
export const Tab = {
|
|
100
|
-
init(id: string): TabSM {
|
|
101
|
-
return { key: id, value: [] };
|
|
102
|
-
},
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
104
|
-
updateSliceZone(tab: TabSM): Function {
|
|
105
|
-
return (mutate: (v: SlicesSM) => TabSM) => {
|
|
106
|
-
return {
|
|
107
|
-
...tab,
|
|
108
|
-
sliceZone: tab.sliceZone && mutate(tab.sliceZone),
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
|
-
updateGroup(tab: TabSM, groupId: string) {
|
|
113
|
-
return (mutate: (v: GroupSM) => GroupSM): TabSM => {
|
|
114
|
-
return {
|
|
115
|
-
...tab,
|
|
116
|
-
value: tab.value.map((field) => {
|
|
117
|
-
if (field.key === groupId && field.value.type === "Group") {
|
|
118
|
-
return {
|
|
119
|
-
key: groupId,
|
|
120
|
-
value: mutate(field.value),
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
return field;
|
|
124
|
-
}),
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
},
|
|
128
|
-
addWidget(tab: TabSM, id: string, widget: TabField): TabSM {
|
|
129
|
-
const elem = { key: id, value: widget };
|
|
130
|
-
|
|
131
|
-
return {
|
|
132
|
-
...tab,
|
|
133
|
-
value: [...tab.value, elem],
|
|
134
|
-
};
|
|
135
|
-
},
|
|
136
|
-
replaceWidget(
|
|
137
|
-
tab: TabSM,
|
|
138
|
-
previousKey: string,
|
|
139
|
-
newKey: string,
|
|
140
|
-
value: TabField,
|
|
141
|
-
): TabSM {
|
|
142
|
-
return {
|
|
143
|
-
...tab,
|
|
144
|
-
value: tab.value.map((t) => {
|
|
145
|
-
if (t.key === previousKey) {
|
|
146
|
-
return {
|
|
147
|
-
key: newKey,
|
|
148
|
-
value,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
return t;
|
|
152
|
-
}),
|
|
153
|
-
};
|
|
154
|
-
},
|
|
155
|
-
reorderWidget(tab: TabSM, start: number, end: number): TabSM {
|
|
156
|
-
const reorderedWidget: { key: string; value: TabField } | undefined =
|
|
157
|
-
tab.value[start];
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
159
|
-
if (!reorderedWidget)
|
|
160
|
-
throw new Error(`Unable to reorder the widget at index ${start}.`);
|
|
161
|
-
|
|
162
|
-
const reorderedArea = tab.value.reduce<
|
|
163
|
-
Array<{ key: string; value: TabField }>
|
|
164
|
-
>((acc, widget, index: number) => {
|
|
165
|
-
const elems = [widget, reorderedWidget];
|
|
166
|
-
switch (index) {
|
|
167
|
-
case start:
|
|
168
|
-
return acc;
|
|
169
|
-
case end:
|
|
170
|
-
return [...acc, ...(end > start ? elems : elems.reverse())];
|
|
171
|
-
default:
|
|
172
|
-
return [...acc, widget];
|
|
173
|
-
}
|
|
174
|
-
}, []);
|
|
175
|
-
return {
|
|
176
|
-
...tab,
|
|
177
|
-
value: reorderedArea,
|
|
178
|
-
};
|
|
179
|
-
},
|
|
180
|
-
removeWidget(tab: TabSM, id: string): TabSM {
|
|
181
|
-
const newTab = {
|
|
182
|
-
...tab,
|
|
183
|
-
value: tab.value.filter((e) => e.key !== id),
|
|
184
|
-
};
|
|
185
|
-
return newTab;
|
|
186
|
-
},
|
|
187
|
-
createSliceZone(tab: TabSM, key: string): TabSM {
|
|
188
|
-
return {
|
|
189
|
-
...tab,
|
|
190
|
-
sliceZone: SliceZoneOperations.createEmpty(key),
|
|
191
|
-
};
|
|
192
|
-
},
|
|
193
|
-
deleteSliceZone(tab: TabSM): TabSM {
|
|
194
|
-
const { sliceZone: _, ...restTab } = tab;
|
|
195
|
-
|
|
196
|
-
return restTab;
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
organiseFields(tabSM: TabSM) {
|
|
200
|
-
const { fields, groups } = tabSM.value.reduce<OrganisedFields>(
|
|
201
|
-
(acc: OrganisedFields, current: { key: string; value: TabField }) => {
|
|
202
|
-
switch (current.value.type) {
|
|
203
|
-
case "UID":
|
|
204
|
-
return acc;
|
|
205
|
-
case "Group":
|
|
206
|
-
return {
|
|
207
|
-
...acc,
|
|
208
|
-
groups: [
|
|
209
|
-
...acc.groups,
|
|
210
|
-
{ key: current.key, value: current.value },
|
|
211
|
-
],
|
|
212
|
-
};
|
|
213
|
-
return acc;
|
|
214
|
-
default:
|
|
215
|
-
return {
|
|
216
|
-
...acc,
|
|
217
|
-
fields: [
|
|
218
|
-
...acc.fields,
|
|
219
|
-
current as { key: string; value: TabField },
|
|
220
|
-
],
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
{ fields: [], groups: [] },
|
|
225
|
-
);
|
|
226
|
-
return {
|
|
227
|
-
fields,
|
|
228
|
-
groups,
|
|
229
|
-
sliceZone: tabSM.sliceZone,
|
|
230
|
-
};
|
|
89
|
+
export const TabFieldsModel = {
|
|
90
|
+
fromSM(field: TabField): NestableWidget | UID | Group {
|
|
91
|
+
switch (field.type) {
|
|
92
|
+
case "Group":
|
|
93
|
+
return Groups.fromSM(field);
|
|
94
|
+
default:
|
|
95
|
+
return field;
|
|
96
|
+
}
|
|
231
97
|
},
|
|
232
98
|
};
|
|
99
|
+
|
|
100
|
+
export type TabField = NestableWidget | UID | GroupSM;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fragment, useState } from "react";
|
|
2
|
+
import { flushSync } from "react-dom";
|
|
2
3
|
|
|
3
4
|
import { DragDropContext, Droppable } from "react-beautiful-dnd";
|
|
4
5
|
|
|
@@ -21,7 +22,14 @@ import sliceBuilderArray from "@lib/models/common/widgets/sliceBuilderArray";
|
|
|
21
22
|
import Hint from "@lib/builders/common/Zone/Card/components/Hints";
|
|
22
23
|
|
|
23
24
|
import ListItem from "@components/ListItem";
|
|
24
|
-
import
|
|
25
|
+
import { useCustomTypeState } from "@src/features/customTypes/customTypesBuilder/CustomTypeProvider";
|
|
26
|
+
import { TabFieldsModel } from "@lib/models/common/CustomType";
|
|
27
|
+
import {
|
|
28
|
+
addGroupField,
|
|
29
|
+
deleteGroupField,
|
|
30
|
+
reorderGroupField,
|
|
31
|
+
updateGroupField,
|
|
32
|
+
} from "@src/domain/customType";
|
|
25
33
|
|
|
26
34
|
/* eslint-disable */
|
|
27
35
|
const CustomListItem = ({
|
|
@@ -40,12 +48,7 @@ const CustomListItem = ({
|
|
|
40
48
|
const [selectMode, setSelectMode] = useState(false);
|
|
41
49
|
const [newFieldData, setNewFieldData] = useState(null);
|
|
42
50
|
const [editModalData, setEditModalData] = useState({ isOpen: false });
|
|
43
|
-
const {
|
|
44
|
-
addFieldIntoGroup,
|
|
45
|
-
deleteFieldIntoGroup,
|
|
46
|
-
replaceFieldIntoGroup,
|
|
47
|
-
reorderFieldIntoGroup,
|
|
48
|
-
} = useSliceMachineActions();
|
|
51
|
+
const { customType, setCustomType } = useCustomTypeState();
|
|
49
52
|
|
|
50
53
|
const onSelectFieldType = (widgetTypeName) => {
|
|
51
54
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -68,8 +71,16 @@ const CustomListItem = ({
|
|
|
68
71
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
|
69
72
|
const newWidget = widget.create(label);
|
|
70
73
|
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
const newField = TabFieldsModel.fromSM(newWidget);
|
|
75
|
+
const newCustomType = addGroupField({
|
|
76
|
+
customType,
|
|
77
|
+
sectionId: tabId,
|
|
78
|
+
groupFieldId: groupItem.key,
|
|
79
|
+
newField,
|
|
80
|
+
newFieldId: id,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
setCustomType(newCustomType);
|
|
73
84
|
};
|
|
74
85
|
|
|
75
86
|
const onSaveField = ({ apiId: previousKey, newKey, value }) => {
|
|
@@ -77,8 +88,18 @@ const CustomListItem = ({
|
|
|
77
88
|
if (ensureWidgetTypeExistence(Widgets, value.type)) {
|
|
78
89
|
return;
|
|
79
90
|
}
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
|
|
92
|
+
const newField = TabFieldsModel.fromSM(value);
|
|
93
|
+
const newCustomType = updateGroupField({
|
|
94
|
+
customType,
|
|
95
|
+
sectionId: tabId,
|
|
96
|
+
groupFieldId: groupItem.key,
|
|
97
|
+
previousFieldId: previousKey,
|
|
98
|
+
newFieldId: newKey,
|
|
99
|
+
newField,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
setCustomType(newCustomType);
|
|
82
103
|
};
|
|
83
104
|
|
|
84
105
|
const onDragEnd = (result) => {
|
|
@@ -87,21 +108,37 @@ const CustomListItem = ({
|
|
|
87
108
|
return;
|
|
88
109
|
}
|
|
89
110
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
111
|
+
const { source, destination } = result;
|
|
112
|
+
if (!destination) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const { index: sourceIndex } = source;
|
|
117
|
+
const { index: destinationIndex } = destination;
|
|
118
|
+
|
|
119
|
+
const newCustomType = reorderGroupField({
|
|
120
|
+
customType,
|
|
121
|
+
sectionId: tabId,
|
|
122
|
+
groupFieldId: groupItem.key,
|
|
123
|
+
sourceIndex,
|
|
124
|
+
destinationIndex,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// When removing redux and replacing it by a simple useState, react-beautiful-dnd (that is deprecated library) was making the fields flickering on reorder.
|
|
128
|
+
// The problem seems to come from the react non-synchronous way to handle our state update that didn't work well with the library.
|
|
129
|
+
// It's a hack and since it's used on an old pure JavaScript code with a deprecated library it will be removed when updating the UI of the fields.
|
|
130
|
+
flushSync(() => setCustomType(newCustomType));
|
|
100
131
|
};
|
|
101
132
|
|
|
102
133
|
const onDeleteItem = (key) => {
|
|
103
|
-
|
|
104
|
-
|
|
134
|
+
const newCustomType = deleteGroupField({
|
|
135
|
+
customType,
|
|
136
|
+
sectionId: tabId,
|
|
137
|
+
groupFieldId: groupItem.key,
|
|
138
|
+
fieldId: key,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
setCustomType(newCustomType);
|
|
105
142
|
};
|
|
106
143
|
|
|
107
144
|
const enterEditMode = (field) => {
|
|
@@ -172,6 +209,7 @@ const CustomListItem = ({
|
|
|
172
209
|
`data.${groupItem.key}.${key}`,
|
|
173
210
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions
|
|
174
211
|
draggableId: `group-${groupItem.key}-${item.key}-${index}`,
|
|
212
|
+
dataCy: `list-item-group-${groupItem.key}-${item.key}`,
|
|
175
213
|
};
|
|
176
214
|
|
|
177
215
|
const HintElement = (
|
package/out/404.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/1aa04669758c24f4.css" as="style"/><link rel="stylesheet" href="/_next/static/css/1aa04669758c24f4.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-20876abeebe0fda7.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/j_voPTrYzsuLCERqtl3Hn/_buildManifest.js" defer=""></script><script src="/_next/static/j_voPTrYzsuLCERqtl3Hn/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"j_voPTrYzsuLCERqtl3Hn","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[461],{77245:function(c,t,h){h.d(t,{LhG:function(){return u}});var n=h(68281);function u(c){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z"}}]})(c)}}}]);
|