@geekron/strapi 0.3.1 → 0.3.2
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/admin/index.js
CHANGED
|
@@ -19307,7 +19307,7 @@ var init_ApiErrorAlert = __esm(() => {
|
|
|
19307
19307
|
});
|
|
19308
19308
|
|
|
19309
19309
|
// admin/src/components/DashboardStats.tsx
|
|
19310
|
-
var import_design_system10, import_admin7,
|
|
19310
|
+
var import_design_system10, import_admin7, import_react12, jsx_dev_runtime28, DashboardStats = ({
|
|
19311
19311
|
showLoading = true,
|
|
19312
19312
|
data: externalData,
|
|
19313
19313
|
onError,
|
|
@@ -19315,15 +19315,15 @@ var import_design_system10, import_admin7, import_react11, jsx_dev_runtime28, Da
|
|
|
19315
19315
|
}) => {
|
|
19316
19316
|
const fetchClient = import_admin7.useFetchClient();
|
|
19317
19317
|
const { toggleNotification } = import_admin7.useNotification();
|
|
19318
|
-
const [isLoading, setIsLoading] =
|
|
19319
|
-
const [error, setError] =
|
|
19320
|
-
const [stats, setStats] =
|
|
19318
|
+
const [isLoading, setIsLoading] = import_react12.useState(!externalData);
|
|
19319
|
+
const [error, setError] = import_react12.useState(null);
|
|
19320
|
+
const [stats, setStats] = import_react12.useState(externalData || {
|
|
19321
19321
|
totalVisitor: 0,
|
|
19322
19322
|
todayVisitor: 0,
|
|
19323
19323
|
totalInquiry: 0,
|
|
19324
19324
|
unreadInquiry: 0
|
|
19325
19325
|
});
|
|
19326
|
-
|
|
19326
|
+
import_react12.useEffect(() => {
|
|
19327
19327
|
if (externalData) {
|
|
19328
19328
|
setStats(externalData);
|
|
19329
19329
|
setIsLoading(false);
|
|
@@ -19352,7 +19352,7 @@ var import_design_system10, import_admin7, import_react11, jsx_dev_runtime28, Da
|
|
|
19352
19352
|
};
|
|
19353
19353
|
fetchStats();
|
|
19354
19354
|
}, [externalData, fetchClient, toggleNotification, onError, onLoaded]);
|
|
19355
|
-
|
|
19355
|
+
import_react12.useEffect(() => {
|
|
19356
19356
|
if (externalData) {
|
|
19357
19357
|
setStats(externalData);
|
|
19358
19358
|
}
|
|
@@ -19481,7 +19481,7 @@ var init_DashboardStats = __esm(() => {
|
|
|
19481
19481
|
init_ApiErrorAlert();
|
|
19482
19482
|
import_design_system10 = require("@strapi/design-system");
|
|
19483
19483
|
import_admin7 = require("@strapi/strapi/admin");
|
|
19484
|
-
|
|
19484
|
+
import_react12 = require("react");
|
|
19485
19485
|
jsx_dev_runtime28 = require("react/jsx-dev-runtime");
|
|
19486
19486
|
DashboardStats_default = DashboardStats;
|
|
19487
19487
|
});
|
|
@@ -19538,19 +19538,19 @@ var init_Dashboard = __esm(() => {
|
|
|
19538
19538
|
});
|
|
19539
19539
|
|
|
19540
19540
|
// admin/src/pages/Inquiry.tsx
|
|
19541
|
-
var import_design_system13, import_icons14, import_symbols, import_admin10,
|
|
19541
|
+
var import_design_system13, import_icons14, import_symbols, import_admin10, import_react14, import_react_router_dom, jsx_dev_runtime31, Inquiry = () => {
|
|
19542
19542
|
const navigate = import_react_router_dom.useNavigate();
|
|
19543
19543
|
const fetchClient = import_admin10.useFetchClient();
|
|
19544
19544
|
const { toggleNotification } = import_admin10.useNotification();
|
|
19545
|
-
const [isLoading, setIsLoading] =
|
|
19546
|
-
const [error, setError] =
|
|
19547
|
-
const [data, setData] =
|
|
19548
|
-
const [pagination, setPagination] =
|
|
19545
|
+
const [isLoading, setIsLoading] = import_react14.useState(true);
|
|
19546
|
+
const [error, setError] = import_react14.useState(null);
|
|
19547
|
+
const [data, setData] = import_react14.useState([]);
|
|
19548
|
+
const [pagination, setPagination] = import_react14.useState({
|
|
19549
19549
|
page: 1,
|
|
19550
19550
|
pageSize: 10,
|
|
19551
19551
|
total: 0
|
|
19552
19552
|
});
|
|
19553
|
-
const fetchInquiries =
|
|
19553
|
+
const fetchInquiries = import_react14.useCallback(async (page = 1, pageSize = 10) => {
|
|
19554
19554
|
setIsLoading(true);
|
|
19555
19555
|
setError(null);
|
|
19556
19556
|
try {
|
|
@@ -19581,10 +19581,10 @@ var import_design_system13, import_icons14, import_symbols, import_admin10, impo
|
|
|
19581
19581
|
setIsLoading(false);
|
|
19582
19582
|
}
|
|
19583
19583
|
}, [fetchClient.get, toggleNotification]);
|
|
19584
|
-
|
|
19584
|
+
import_react14.useEffect(() => {
|
|
19585
19585
|
fetchInquiries(pagination.page, pagination.pageSize);
|
|
19586
19586
|
}, [fetchInquiries, pagination.page, pagination.pageSize]);
|
|
19587
|
-
|
|
19587
|
+
import_react14.useEffect(() => {
|
|
19588
19588
|
const handleVisibilityChange = () => {
|
|
19589
19589
|
if (document.visibilityState === "visible") {
|
|
19590
19590
|
fetchInquiries(pagination.page, pagination.pageSize);
|
|
@@ -19754,22 +19754,22 @@ var init_Inquiry = __esm(() => {
|
|
|
19754
19754
|
import_icons14 = require("@strapi/icons");
|
|
19755
19755
|
import_symbols = require("@strapi/icons/symbols");
|
|
19756
19756
|
import_admin10 = require("@strapi/strapi/admin");
|
|
19757
|
-
|
|
19757
|
+
import_react14 = require("react");
|
|
19758
19758
|
import_react_router_dom = require("react-router-dom");
|
|
19759
19759
|
jsx_dev_runtime31 = require("react/jsx-dev-runtime");
|
|
19760
19760
|
Inquiry_default = Inquiry;
|
|
19761
19761
|
});
|
|
19762
19762
|
|
|
19763
19763
|
// admin/src/pages/InquiryDetail.tsx
|
|
19764
|
-
var import_design_system14, import_admin11,
|
|
19764
|
+
var import_design_system14, import_admin11, import_react15, import_react_router_dom2, import_styled_components15, jsx_dev_runtime32, DetailTable, InquiryDetail = () => {
|
|
19765
19765
|
const { id } = import_react_router_dom2.useParams();
|
|
19766
19766
|
const navigate = import_react_router_dom2.useNavigate();
|
|
19767
19767
|
const fetchClient = import_admin11.useFetchClient();
|
|
19768
19768
|
const { toggleNotification } = import_admin11.useNotification();
|
|
19769
|
-
const [isLoading, setIsLoading] =
|
|
19770
|
-
const [isMarking, setIsMarking] =
|
|
19771
|
-
const [data, setData] =
|
|
19772
|
-
|
|
19769
|
+
const [isLoading, setIsLoading] = import_react15.useState(true);
|
|
19770
|
+
const [isMarking, setIsMarking] = import_react15.useState(false);
|
|
19771
|
+
const [data, setData] = import_react15.useState(null);
|
|
19772
|
+
import_react15.useEffect(() => {
|
|
19773
19773
|
const fetchDetail = async () => {
|
|
19774
19774
|
if (!id) {
|
|
19775
19775
|
toggleNotification({
|
|
@@ -20051,7 +20051,7 @@ var import_design_system14, import_admin11, import_react14, import_react_router_
|
|
|
20051
20051
|
var init_InquiryDetail = __esm(() => {
|
|
20052
20052
|
import_design_system14 = require("@strapi/design-system");
|
|
20053
20053
|
import_admin11 = require("@strapi/strapi/admin");
|
|
20054
|
-
|
|
20054
|
+
import_react15 = require("react");
|
|
20055
20055
|
import_react_router_dom2 = require("react-router-dom");
|
|
20056
20056
|
import_styled_components15 = __toESM(require("styled-components"));
|
|
20057
20057
|
jsx_dev_runtime32 = require("react/jsx-dev-runtime");
|
|
@@ -20098,19 +20098,19 @@ var init_InquiryDetail = __esm(() => {
|
|
|
20098
20098
|
});
|
|
20099
20099
|
|
|
20100
20100
|
// admin/src/pages/Visitor.tsx
|
|
20101
|
-
var import_design_system15, import_symbols2, import_admin12,
|
|
20101
|
+
var import_design_system15, import_symbols2, import_admin12, import_react16, jsx_dev_runtime33, Visitor = () => {
|
|
20102
20102
|
const fetchClient = import_admin12.useFetchClient();
|
|
20103
20103
|
const { toggleNotification } = import_admin12.useNotification();
|
|
20104
|
-
const [isLoading, setIsLoading] =
|
|
20105
|
-
const [error, setError] =
|
|
20106
|
-
const [activeTab, setActiveTab] =
|
|
20107
|
-
const [data, setData] =
|
|
20108
|
-
const [pagination, setPagination] =
|
|
20104
|
+
const [isLoading, setIsLoading] = import_react16.useState(true);
|
|
20105
|
+
const [error, setError] = import_react16.useState(null);
|
|
20106
|
+
const [activeTab, setActiveTab] = import_react16.useState("dailyStats");
|
|
20107
|
+
const [data, setData] = import_react16.useState([]);
|
|
20108
|
+
const [pagination, setPagination] = import_react16.useState({
|
|
20109
20109
|
page: 1,
|
|
20110
20110
|
pageSize: 10,
|
|
20111
20111
|
total: 0
|
|
20112
20112
|
});
|
|
20113
|
-
const fetchVisitorData =
|
|
20113
|
+
const fetchVisitorData = import_react16.useCallback(async (tab, page = 1, pageSize = 10) => {
|
|
20114
20114
|
setIsLoading(true);
|
|
20115
20115
|
setError(null);
|
|
20116
20116
|
try {
|
|
@@ -20157,7 +20157,7 @@ var import_design_system15, import_symbols2, import_admin12, import_react15, jsx
|
|
|
20157
20157
|
setIsLoading(false);
|
|
20158
20158
|
}
|
|
20159
20159
|
}, [fetchClient.get, toggleNotification]);
|
|
20160
|
-
|
|
20160
|
+
import_react16.useEffect(() => {
|
|
20161
20161
|
fetchVisitorData(activeTab, 1, pagination.pageSize);
|
|
20162
20162
|
}, [activeTab, pagination.pageSize, fetchVisitorData]);
|
|
20163
20163
|
const handleTabChange = (tabKey) => {
|
|
@@ -20449,7 +20449,7 @@ var init_Visitor = __esm(() => {
|
|
|
20449
20449
|
import_design_system15 = require("@strapi/design-system");
|
|
20450
20450
|
import_symbols2 = require("@strapi/icons/symbols");
|
|
20451
20451
|
import_admin12 = require("@strapi/strapi/admin");
|
|
20452
|
-
|
|
20452
|
+
import_react16 = require("react");
|
|
20453
20453
|
jsx_dev_runtime33 = require("react/jsx-dev-runtime");
|
|
20454
20454
|
Visitor_default = Visitor;
|
|
20455
20455
|
});
|
|
@@ -20459,7 +20459,7 @@ var exports_App = {};
|
|
|
20459
20459
|
__export(exports_App, {
|
|
20460
20460
|
default: () => App_default
|
|
20461
20461
|
});
|
|
20462
|
-
var import_strapi_admin, import_design_system16,
|
|
20462
|
+
var import_strapi_admin, import_design_system16, import_react17, import_react_router_dom3, import_styled_components16, jsx_dev_runtime34, LayoutContainer, Sidebar, MainContent, StyledNavLink, SidebarNav = () => {
|
|
20463
20463
|
return /* @__PURE__ */ jsx_dev_runtime34.jsxDEV(Sidebar, {
|
|
20464
20464
|
children: [
|
|
20465
20465
|
/* @__PURE__ */ jsx_dev_runtime34.jsxDEV(import_design_system16.Box, {
|
|
@@ -20502,9 +20502,9 @@ var import_strapi_admin, import_design_system16, import_react16, import_react_ro
|
|
|
20502
20502
|
}, undefined, true, undefined, this);
|
|
20503
20503
|
}, App = () => {
|
|
20504
20504
|
const client = import_strapi_admin.useFetchClient();
|
|
20505
|
-
const [isConnected, setIsConnected] =
|
|
20506
|
-
const [checking, setChecking] =
|
|
20507
|
-
|
|
20505
|
+
const [isConnected, setIsConnected] = import_react17.default.useState(null);
|
|
20506
|
+
const [checking, setChecking] = import_react17.default.useState(true);
|
|
20507
|
+
import_react17.default.useEffect(() => {
|
|
20508
20508
|
client.get("/website/check").then((response) => {
|
|
20509
20509
|
if (response?.data?.message) {
|
|
20510
20510
|
setIsConnected(true);
|
|
@@ -20591,7 +20591,7 @@ var init_App = __esm(() => {
|
|
|
20591
20591
|
init_Visitor();
|
|
20592
20592
|
import_strapi_admin = require("@strapi/admin/strapi-admin");
|
|
20593
20593
|
import_design_system16 = require("@strapi/design-system");
|
|
20594
|
-
|
|
20594
|
+
import_react17 = __toESM(require("react"));
|
|
20595
20595
|
import_react_router_dom3 = require("react-router-dom");
|
|
20596
20596
|
import_styled_components16 = __toESM(require("styled-components"));
|
|
20597
20597
|
jsx_dev_runtime34 = require("react/jsx-dev-runtime");
|
|
@@ -45540,6 +45540,7 @@ var registerColorPicker = (app) => {
|
|
|
45540
45540
|
// admin/src/fields/DataNested.tsx
|
|
45541
45541
|
var import_design_system5 = require("@strapi/design-system");
|
|
45542
45542
|
var import_admin3 = require("@strapi/strapi/admin");
|
|
45543
|
+
var import_react9 = require("react");
|
|
45543
45544
|
|
|
45544
45545
|
// admin/src/fields/DataNested/SortableTree.tsx
|
|
45545
45546
|
var import_core2 = __toESM(require_dist3(), 1);
|
|
@@ -47125,15 +47126,17 @@ var adjustTranslate = ({ transform }) => {
|
|
|
47125
47126
|
// admin/src/fields/DataNested/hooks/useTreeItems.ts
|
|
47126
47127
|
var import_react7 = require("react");
|
|
47127
47128
|
function useTreeItems(defaultItems, maxDepth) {
|
|
47128
|
-
const [items, setItems] = import_react7.useState(
|
|
47129
|
+
const [items, setItems] = import_react7.useState(defaultItems);
|
|
47130
|
+
const hasUserEditedRef = import_react7.useRef(false);
|
|
47129
47131
|
const prevDefaultItemsRef = import_react7.useRef(JSON.stringify(defaultItems));
|
|
47130
47132
|
import_react7.useEffect(() => {
|
|
47131
47133
|
const currentDefaultItemsStr = JSON.stringify(defaultItems);
|
|
47132
|
-
if (currentDefaultItemsStr !== prevDefaultItemsRef.current) {
|
|
47134
|
+
if (currentDefaultItemsStr !== prevDefaultItemsRef.current || defaultItems.length > 0 && items.length === 0) {
|
|
47133
47135
|
prevDefaultItemsRef.current = currentDefaultItemsStr;
|
|
47134
47136
|
setItems(defaultItems);
|
|
47137
|
+
hasUserEditedRef.current = false;
|
|
47135
47138
|
}
|
|
47136
|
-
}, [defaultItems]);
|
|
47139
|
+
}, [defaultItems, items.length]);
|
|
47137
47140
|
const [modalState, setModalState] = import_react7.useState({
|
|
47138
47141
|
isOpen: false,
|
|
47139
47142
|
mode: null,
|
|
@@ -47492,15 +47495,20 @@ function SortableTree({
|
|
|
47492
47495
|
};
|
|
47493
47496
|
}, [flattenedItems, offsetLeft]);
|
|
47494
47497
|
const isInitialMount = import_react8.useRef(true);
|
|
47498
|
+
const prevItemsRef = import_react8.useRef(JSON.stringify(items));
|
|
47495
47499
|
import_react8.useEffect(() => {
|
|
47496
47500
|
if (isInitialMount.current) {
|
|
47497
47501
|
isInitialMount.current = false;
|
|
47502
|
+
prevItemsRef.current = JSON.stringify(items);
|
|
47498
47503
|
return;
|
|
47499
47504
|
}
|
|
47500
|
-
|
|
47505
|
+
const currentItemsStr = JSON.stringify(items);
|
|
47506
|
+
const defaultItemsStr = JSON.stringify(defaultItems);
|
|
47507
|
+
if (onChange && currentItemsStr !== prevItemsRef.current && currentItemsStr !== defaultItemsStr) {
|
|
47501
47508
|
onChange(items);
|
|
47502
47509
|
}
|
|
47503
|
-
|
|
47510
|
+
prevItemsRef.current = currentItemsStr;
|
|
47511
|
+
}, [items, onChange, defaultItems]);
|
|
47504
47512
|
const announcements = useAnnouncements(items, indicator, indentationWidth);
|
|
47505
47513
|
const handleDragEnd = ({ active, over }) => {
|
|
47506
47514
|
handleDragCancel();
|
|
@@ -47597,6 +47605,7 @@ var DataNested = ({
|
|
|
47597
47605
|
const handleChange = (value) => {
|
|
47598
47606
|
field.onChange(name, value);
|
|
47599
47607
|
};
|
|
47608
|
+
const treeKey = import_react9.useMemo(() => JSON.stringify(field.value || []), [field.value]);
|
|
47600
47609
|
return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_design_system5.Field.Root, {
|
|
47601
47610
|
name,
|
|
47602
47611
|
id: name,
|
|
@@ -47614,7 +47623,7 @@ var DataNested = ({
|
|
|
47614
47623
|
defaultItems: field.value || [],
|
|
47615
47624
|
maxDepth: attribute.options?.depth,
|
|
47616
47625
|
onChange: handleChange
|
|
47617
|
-
},
|
|
47626
|
+
}, treeKey, false, undefined, this),
|
|
47618
47627
|
/* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_design_system5.Field.Hint, {}, undefined, false, undefined, this),
|
|
47619
47628
|
/* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_design_system5.Field.Error, {}, undefined, false, undefined, this)
|
|
47620
47629
|
]
|
|
@@ -47738,7 +47747,7 @@ var registerDataSelect = (app) => {
|
|
|
47738
47747
|
};
|
|
47739
47748
|
|
|
47740
47749
|
// node_modules/@iconify/react/dist/iconify.js
|
|
47741
|
-
var
|
|
47750
|
+
var import_react10 = require("react");
|
|
47742
47751
|
"use client";
|
|
47743
47752
|
function getIconsTree(data, names) {
|
|
47744
47753
|
const icons = data.icons;
|
|
@@ -49082,7 +49091,7 @@ var render = (icon, props, name) => {
|
|
|
49082
49091
|
componentProps.dangerouslySetInnerHTML = {
|
|
49083
49092
|
__html: cleanUpInnerHTML(replaceIDs(item.body, id ? () => id + "ID" + localCounter++ : "iconifyReact"))
|
|
49084
49093
|
};
|
|
49085
|
-
return
|
|
49094
|
+
return import_react10.createElement("svg", componentProps);
|
|
49086
49095
|
}
|
|
49087
49096
|
const { body, width, height } = icon;
|
|
49088
49097
|
const useMask = mode === "mask" || (mode === "bg" ? false : body.indexOf("currentColor") !== -1);
|
|
@@ -49100,7 +49109,7 @@ var render = (icon, props, name) => {
|
|
|
49100
49109
|
...useMask ? monotoneProps : coloredProps,
|
|
49101
49110
|
...customStyle
|
|
49102
49111
|
};
|
|
49103
|
-
return
|
|
49112
|
+
return import_react10.createElement("span", componentProps);
|
|
49104
49113
|
};
|
|
49105
49114
|
allowSimpleNames(true);
|
|
49106
49115
|
setAPIModule("", fetchAPIModule);
|
|
@@ -49142,8 +49151,8 @@ if (typeof document !== "undefined" && typeof window !== "undefined") {
|
|
|
49142
49151
|
}
|
|
49143
49152
|
}
|
|
49144
49153
|
function IconComponent(props) {
|
|
49145
|
-
const [mounted, setMounted] =
|
|
49146
|
-
const [abort, setAbort] =
|
|
49154
|
+
const [mounted, setMounted] = import_react10.useState(!!props.ssr);
|
|
49155
|
+
const [abort, setAbort] = import_react10.useState({});
|
|
49147
49156
|
function getInitialState(mounted2) {
|
|
49148
49157
|
if (mounted2) {
|
|
49149
49158
|
const name2 = props.icon;
|
|
@@ -49165,7 +49174,7 @@ function IconComponent(props) {
|
|
|
49165
49174
|
name: ""
|
|
49166
49175
|
};
|
|
49167
49176
|
}
|
|
49168
|
-
const [state, setState] =
|
|
49177
|
+
const [state, setState] = import_react10.useState(getInitialState(!!props.ssr));
|
|
49169
49178
|
function cleanup() {
|
|
49170
49179
|
const callback = abort.callback;
|
|
49171
49180
|
if (callback) {
|
|
@@ -49205,29 +49214,29 @@ function IconComponent(props) {
|
|
|
49205
49214
|
}
|
|
49206
49215
|
}
|
|
49207
49216
|
}
|
|
49208
|
-
|
|
49217
|
+
import_react10.useEffect(() => {
|
|
49209
49218
|
setMounted(true);
|
|
49210
49219
|
return cleanup;
|
|
49211
49220
|
}, []);
|
|
49212
|
-
|
|
49221
|
+
import_react10.useEffect(() => {
|
|
49213
49222
|
if (mounted) {
|
|
49214
49223
|
updateState();
|
|
49215
49224
|
}
|
|
49216
49225
|
}, [props.icon, mounted]);
|
|
49217
49226
|
const { name, data } = state;
|
|
49218
49227
|
if (!data) {
|
|
49219
|
-
return props.children ? props.children : props.fallback ? props.fallback :
|
|
49228
|
+
return props.children ? props.children : props.fallback ? props.fallback : import_react10.createElement("span", {});
|
|
49220
49229
|
}
|
|
49221
49230
|
return render({
|
|
49222
49231
|
...defaultIconProps,
|
|
49223
49232
|
...data
|
|
49224
49233
|
}, props, name);
|
|
49225
49234
|
}
|
|
49226
|
-
var Icon =
|
|
49235
|
+
var Icon = import_react10.forwardRef((props, ref) => IconComponent({
|
|
49227
49236
|
...props,
|
|
49228
49237
|
_ref: ref
|
|
49229
49238
|
}));
|
|
49230
|
-
var InlineIcon =
|
|
49239
|
+
var InlineIcon = import_react10.forwardRef((props, ref) => IconComponent({
|
|
49231
49240
|
inline: true,
|
|
49232
49241
|
...props,
|
|
49233
49242
|
_ref: ref
|
|
@@ -50004,10 +50013,10 @@ var import_icons12 = require("@strapi/icons");
|
|
|
50004
50013
|
init_DashboardStats();
|
|
50005
50014
|
var import_design_system11 = require("@strapi/design-system");
|
|
50006
50015
|
var import_admin8 = require("@strapi/strapi/admin");
|
|
50007
|
-
var
|
|
50016
|
+
var import_react13 = __toESM(require("react"));
|
|
50008
50017
|
var jsx_dev_runtime29 = require("react/jsx-dev-runtime");
|
|
50009
50018
|
var WelcomeWidget = () => {
|
|
50010
|
-
const [refresh, setRefresh] =
|
|
50019
|
+
const [refresh, setRefresh] = import_react13.default.useState(false);
|
|
50011
50020
|
const fetchClient = import_admin8.useFetchClient();
|
|
50012
50021
|
const { toggleNotification } = import_admin8.useNotification();
|
|
50013
50022
|
const handleRefresh = async () => {
|
package/dist/admin/index.mjs
CHANGED
|
@@ -45580,6 +45580,7 @@ var registerColorPicker = (app) => {
|
|
|
45580
45580
|
// admin/src/fields/DataNested.tsx
|
|
45581
45581
|
import { Field as Field2 } from "@strapi/design-system";
|
|
45582
45582
|
import { useField as useField2 } from "@strapi/strapi/admin";
|
|
45583
|
+
import { useMemo as useMemo4 } from "react";
|
|
45583
45584
|
|
|
45584
45585
|
// admin/src/fields/DataNested/SortableTree.tsx
|
|
45585
45586
|
var import_core2 = __toESM(require_dist3(), 1);
|
|
@@ -47169,15 +47170,17 @@ var adjustTranslate = ({ transform }) => {
|
|
|
47169
47170
|
// admin/src/fields/DataNested/hooks/useTreeItems.ts
|
|
47170
47171
|
import { useEffect as useEffect2, useRef as useRef2, useState as useState6 } from "react";
|
|
47171
47172
|
function useTreeItems(defaultItems, maxDepth) {
|
|
47172
|
-
const [items, setItems] = useState6(
|
|
47173
|
+
const [items, setItems] = useState6(defaultItems);
|
|
47174
|
+
const hasUserEditedRef = useRef2(false);
|
|
47173
47175
|
const prevDefaultItemsRef = useRef2(JSON.stringify(defaultItems));
|
|
47174
47176
|
useEffect2(() => {
|
|
47175
47177
|
const currentDefaultItemsStr = JSON.stringify(defaultItems);
|
|
47176
|
-
if (currentDefaultItemsStr !== prevDefaultItemsRef.current) {
|
|
47178
|
+
if (currentDefaultItemsStr !== prevDefaultItemsRef.current || defaultItems.length > 0 && items.length === 0) {
|
|
47177
47179
|
prevDefaultItemsRef.current = currentDefaultItemsStr;
|
|
47178
47180
|
setItems(defaultItems);
|
|
47181
|
+
hasUserEditedRef.current = false;
|
|
47179
47182
|
}
|
|
47180
|
-
}, [defaultItems]);
|
|
47183
|
+
}, [defaultItems, items.length]);
|
|
47181
47184
|
const [modalState, setModalState] = useState6({
|
|
47182
47185
|
isOpen: false,
|
|
47183
47186
|
mode: null,
|
|
@@ -47536,15 +47539,20 @@ function SortableTree({
|
|
|
47536
47539
|
};
|
|
47537
47540
|
}, [flattenedItems, offsetLeft]);
|
|
47538
47541
|
const isInitialMount = useRef3(true);
|
|
47542
|
+
const prevItemsRef = useRef3(JSON.stringify(items));
|
|
47539
47543
|
useEffect3(() => {
|
|
47540
47544
|
if (isInitialMount.current) {
|
|
47541
47545
|
isInitialMount.current = false;
|
|
47546
|
+
prevItemsRef.current = JSON.stringify(items);
|
|
47542
47547
|
return;
|
|
47543
47548
|
}
|
|
47544
|
-
|
|
47549
|
+
const currentItemsStr = JSON.stringify(items);
|
|
47550
|
+
const defaultItemsStr = JSON.stringify(defaultItems);
|
|
47551
|
+
if (onChange && currentItemsStr !== prevItemsRef.current && currentItemsStr !== defaultItemsStr) {
|
|
47545
47552
|
onChange(items);
|
|
47546
47553
|
}
|
|
47547
|
-
|
|
47554
|
+
prevItemsRef.current = currentItemsStr;
|
|
47555
|
+
}, [items, onChange, defaultItems]);
|
|
47548
47556
|
const announcements = useAnnouncements(items, indicator, indentationWidth);
|
|
47549
47557
|
const handleDragEnd = ({ active, over }) => {
|
|
47550
47558
|
handleDragCancel();
|
|
@@ -47641,6 +47649,7 @@ var DataNested = ({
|
|
|
47641
47649
|
const handleChange = (value) => {
|
|
47642
47650
|
field.onChange(name, value);
|
|
47643
47651
|
};
|
|
47652
|
+
const treeKey = useMemo4(() => JSON.stringify(field.value || []), [field.value]);
|
|
47644
47653
|
return /* @__PURE__ */ jsxDEV23(Field2.Root, {
|
|
47645
47654
|
name,
|
|
47646
47655
|
id: name,
|
|
@@ -47658,7 +47667,7 @@ var DataNested = ({
|
|
|
47658
47667
|
defaultItems: field.value || [],
|
|
47659
47668
|
maxDepth: attribute.options?.depth,
|
|
47660
47669
|
onChange: handleChange
|
|
47661
|
-
},
|
|
47670
|
+
}, treeKey, false, undefined, this),
|
|
47662
47671
|
/* @__PURE__ */ jsxDEV23(Field2.Hint, {}, undefined, false, undefined, this),
|
|
47663
47672
|
/* @__PURE__ */ jsxDEV23(Field2.Error, {}, undefined, false, undefined, this)
|
|
47664
47673
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableTree.d.ts","sourceRoot":"","sources":["../../../../../admin/src/fields/DataNested/SortableTree.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAgC,SAAS,EAAE,MAAM,SAAS,CAAA;AAStE,UAAU,KAAK;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;CACrC;AAED,wBAAgB,YAAY,CAAC,EAC5B,WAAW,EACX,YAA4B,EAC5B,SAAiB,EACjB,gBAA4C,EAC5C,SAAS,EACT,QAAQ,EACR,QAAQ,GACR,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"SortableTree.d.ts","sourceRoot":"","sources":["../../../../../admin/src/fields/DataNested/SortableTree.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAgC,SAAS,EAAE,MAAM,SAAS,CAAA;AAStE,UAAU,KAAK;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;CACrC;AAED,wBAAgB,YAAY,CAAC,EAC5B,WAAW,EACX,YAA4B,EAC5B,SAAiB,EACjB,gBAA4C,EAC5C,SAAS,EACT,QAAQ,EACR,QAAQ,GACR,EAAE,KAAK,2CAgOP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTreeItems.d.ts","sourceRoot":"","sources":["../../../../../../admin/src/fields/DataNested/hooks/useTreeItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAGrD,OAAO,KAAK,EAAY,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AASjE,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACjC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;CACjC;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"useTreeItems.d.ts","sourceRoot":"","sources":["../../../../../../admin/src/fields/DataNested/hooks/useTreeItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAGrD,OAAO,KAAK,EAAY,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AASjE,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACjC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;CACjC;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM;;;;uBA+B5C,gBAAgB;yBAId,gBAAgB;;2BAed,gBAAgB;yBASlB,gBAAgB;qBAkBpB,gBAAgB;;8BAkBP,YAAY;0BAyBlB,YAAY;EAsBvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataNested.d.ts","sourceRoot":"","sources":["../../../../admin/src/fields/DataNested.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"DataNested.d.ts","sourceRoot":"","sources":["../../../../admin/src/fields/DataNested.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,sBAAsB,CAAA;AA8DjE,eAAO,MAAM,kBAAkB,GAAI,KAAK,SAAS,SA+ChD,CAAA"}
|