strapi-plugin-magic-mark 3.4.0 → 4.0.1
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/CHANGELOG.md +373 -0
- package/README.md +393 -618
- package/dist/admin/App-BIc-2qv8.mjs +580 -0
- package/dist/admin/App-DxALpMK_.js +580 -0
- package/dist/admin/PinnedBookmarksWidget-BWiAKlnA.mjs +55 -0
- package/dist/admin/PinnedBookmarksWidget-VM6buexr.js +55 -0
- package/dist/admin/de-BF0nCjGF.mjs +183 -0
- package/dist/admin/de-Cn90CcnC.js +183 -0
- package/dist/admin/en-D-EGHodf.mjs +183 -0
- package/dist/admin/en-GDfO_EfL.js +183 -0
- package/dist/admin/es-6o-_RABX.js +183 -0
- package/dist/admin/es-C33BufuB.mjs +183 -0
- package/dist/admin/fr-BOZS5mJT.js +183 -0
- package/dist/admin/fr-DJHTjkmb.mjs +183 -0
- package/dist/admin/index-BJ8l6K7P.mjs +1861 -0
- package/dist/admin/index-C9FMo0F_.js +1862 -0
- package/dist/admin/index.js +4 -2
- package/dist/admin/index.mjs +2 -1
- package/dist/admin/pt-D13SxuK2.js +183 -0
- package/dist/admin/pt-yoB1jrsq.mjs +183 -0
- package/dist/server/index.js +1129 -1542
- package/dist/server/index.mjs +1126 -1539
- package/package.json +90 -54
- package/strapi-admin.js +5 -0
- package/strapi-server.js +2 -1
- package/COPYRIGHT_NOTICE.txt +0 -20
- package/dist/_chunks/App-DNyxeldt.js +0 -1451
- package/dist/_chunks/App-D_Vllkur.mjs +0 -1449
- package/dist/_chunks/UpgradePage-DuyIskve.mjs +0 -351
- package/dist/_chunks/UpgradePage-SzlmS6po.js +0 -353
- package/dist/_chunks/de-Cs9dd3Mr.js +0 -138
- package/dist/_chunks/de-DOVki5VS.mjs +0 -138
- package/dist/_chunks/en-CE3r46Y2.js +0 -138
- package/dist/_chunks/en-Cf5-O03L.mjs +0 -138
- package/dist/_chunks/es-Ba6JcPIm.mjs +0 -138
- package/dist/_chunks/es-D4AOyJYJ.js +0 -138
- package/dist/_chunks/fr-CWSfoA8i.js +0 -138
- package/dist/_chunks/fr-CrMBXR3c.mjs +0 -138
- package/dist/_chunks/index-CBwb0AEf.js +0 -3618
- package/dist/_chunks/index-JirQF8zE.mjs +0 -328
- package/dist/_chunks/index-QkINaIgJ.mjs +0 -3614
- package/dist/_chunks/index-uUErgmi9.js +0 -330
- package/dist/_chunks/pt-BXxZ1Zym.mjs +0 -138
- package/dist/_chunks/pt-DW_6r_mP.js +0 -138
- package/pics/advancedFilters.png +0 -0
- package/pics/dashboard.png +0 -0
- package/pics/quickaccesinContentmanager.png +0 -0
- package/pics/saveAsMagicMark.png +0 -0
|
@@ -1,3618 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const React = require("react");
|
|
3
|
-
const admin = require("@strapi/strapi/admin");
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const icons = require("@strapi/icons");
|
|
6
|
-
const outline = require("@heroicons/react/24/outline");
|
|
7
|
-
const reactIntl = require("react-intl");
|
|
8
|
-
const reactRouterDom = require("react-router-dom");
|
|
9
|
-
const styled = require("styled-components");
|
|
10
|
-
const designSystem = require("@strapi/design-system");
|
|
11
|
-
const ReactDOM = require("react-dom");
|
|
12
|
-
const qs = require("qs");
|
|
13
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
|
-
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
15
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
16
|
-
const ReactDOM__default = /* @__PURE__ */ _interopDefault(ReactDOM);
|
|
17
|
-
const qs__default = /* @__PURE__ */ _interopDefault(qs);
|
|
18
|
-
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
19
|
-
const v = glob[path];
|
|
20
|
-
if (v) {
|
|
21
|
-
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
22
|
-
}
|
|
23
|
-
return new Promise((_, reject) => {
|
|
24
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
25
|
-
reject.bind(
|
|
26
|
-
null,
|
|
27
|
-
new Error(
|
|
28
|
-
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
29
|
-
)
|
|
30
|
-
)
|
|
31
|
-
);
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
const strapi = {
|
|
35
|
-
name: "magic-mark"
|
|
36
|
-
};
|
|
37
|
-
const pluginPkg = {
|
|
38
|
-
strapi
|
|
39
|
-
};
|
|
40
|
-
const pluginId = "magic-mark";
|
|
41
|
-
const Initializer = ({ setPlugin }) => {
|
|
42
|
-
const ref = React.useRef(setPlugin);
|
|
43
|
-
const { get } = admin.useFetchClient();
|
|
44
|
-
React.useEffect(() => {
|
|
45
|
-
ref.current(pluginId);
|
|
46
|
-
}, []);
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
const HEARTBEAT_INTERVAL = 4 * 60 * 1e3;
|
|
49
|
-
const heartbeat = async () => {
|
|
50
|
-
try {
|
|
51
|
-
await get(`/${pluginId}/license/status`);
|
|
52
|
-
} catch (error) {
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const initialTimeout = setTimeout(heartbeat, 60 * 1e3);
|
|
56
|
-
const interval = setInterval(heartbeat, HEARTBEAT_INTERVAL);
|
|
57
|
-
return () => {
|
|
58
|
-
clearTimeout(initialTimeout);
|
|
59
|
-
clearInterval(interval);
|
|
60
|
-
};
|
|
61
|
-
}, [get]);
|
|
62
|
-
return null;
|
|
63
|
-
};
|
|
64
|
-
const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Book, {});
|
|
65
|
-
const parseQueryString = (queryString) => {
|
|
66
|
-
const result = {
|
|
67
|
-
filters: [],
|
|
68
|
-
sort: [],
|
|
69
|
-
populate: []
|
|
70
|
-
};
|
|
71
|
-
if (!queryString) return result;
|
|
72
|
-
const params = new URLSearchParams(queryString);
|
|
73
|
-
params.forEach((value, key) => {
|
|
74
|
-
console.log("[QueryParser] Parsing:", key, "=", value);
|
|
75
|
-
if (key.startsWith("filters[")) {
|
|
76
|
-
const filter = parseFilterKey(key, value);
|
|
77
|
-
if (filter) {
|
|
78
|
-
result.filters.push(filter);
|
|
79
|
-
}
|
|
80
|
-
} else if (key === "sort") {
|
|
81
|
-
result.sort = value.split(",").map((s) => s.trim());
|
|
82
|
-
} else if (key.startsWith("populate")) {
|
|
83
|
-
const populateField = extractPopulateField(key);
|
|
84
|
-
if (populateField && !result.populate.includes(populateField)) {
|
|
85
|
-
result.populate.push(populateField);
|
|
86
|
-
}
|
|
87
|
-
} else if (key === "page") {
|
|
88
|
-
result.page = parseInt(value);
|
|
89
|
-
} else if (key === "pageSize") {
|
|
90
|
-
result.pageSize = parseInt(value);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return result;
|
|
94
|
-
};
|
|
95
|
-
const parseFilterKey = (key, value) => {
|
|
96
|
-
try {
|
|
97
|
-
let logic;
|
|
98
|
-
if (key.includes("[$and]")) {
|
|
99
|
-
logic = "AND";
|
|
100
|
-
} else if (key.includes("[$or]")) {
|
|
101
|
-
logic = "OR";
|
|
102
|
-
}
|
|
103
|
-
const fieldMatch = key.match(/\[([^\]$]+)\](?=\[\$)/);
|
|
104
|
-
const field = fieldMatch ? fieldMatch[1] : null;
|
|
105
|
-
const operatorMatch = key.match(/\[\$(\w+)\]/);
|
|
106
|
-
const operator = operatorMatch ? operatorMatch[1] : "eq";
|
|
107
|
-
if (!field) {
|
|
108
|
-
console.warn("[QueryParser] Could not extract field from:", key);
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
field: formatFieldName(field),
|
|
113
|
-
operator: formatOperator(operator),
|
|
114
|
-
value,
|
|
115
|
-
logic
|
|
116
|
-
};
|
|
117
|
-
} catch (error) {
|
|
118
|
-
console.error("[QueryParser] Error parsing filter:", key, error);
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
const extractPopulateField = (key) => {
|
|
123
|
-
const match = key.match(/populate\[([^\]]+)\]/);
|
|
124
|
-
return match ? match[1] : null;
|
|
125
|
-
};
|
|
126
|
-
const formatFieldName = (field) => {
|
|
127
|
-
const formatted = field.replace(/([A-Z])/g, " $1");
|
|
128
|
-
return formatted.charAt(0).toUpperCase() + formatted.slice(1);
|
|
129
|
-
};
|
|
130
|
-
const formatOperator = (operator) => {
|
|
131
|
-
const operatorMap = {
|
|
132
|
-
"eq": "=",
|
|
133
|
-
"ne": "≠",
|
|
134
|
-
"lt": "<",
|
|
135
|
-
"lte": "≤",
|
|
136
|
-
"gt": ">",
|
|
137
|
-
"gte": "≥",
|
|
138
|
-
"in": "in",
|
|
139
|
-
"notIn": "not in",
|
|
140
|
-
"contains": "contains",
|
|
141
|
-
"notContains": "not contains",
|
|
142
|
-
"containsi": "contains (case insensitive)",
|
|
143
|
-
"notContainsi": "not contains (case insensitive)",
|
|
144
|
-
"startsWith": "starts with",
|
|
145
|
-
"endsWith": "ends with",
|
|
146
|
-
"null": "is null",
|
|
147
|
-
"notNull": "is not null"
|
|
148
|
-
};
|
|
149
|
-
return operatorMap[operator] || operator;
|
|
150
|
-
};
|
|
151
|
-
const FilterChip = styled__default.default.div`
|
|
152
|
-
display: inline-flex;
|
|
153
|
-
align-items: center;
|
|
154
|
-
padding: 4px 12px;
|
|
155
|
-
border-radius: 4px;
|
|
156
|
-
background: ${(props) => props.logic === "OR" ? props.theme.colors.warning100 : props.theme.colors.primary100};
|
|
157
|
-
border: 1px solid ${(props) => props.logic === "OR" ? props.theme.colors.warning500 : props.theme.colors.primary500};
|
|
158
|
-
font-size: 12px;
|
|
159
|
-
margin: 4px;
|
|
160
|
-
gap: 4px;
|
|
161
|
-
color: ${(props) => props.theme.colors.neutral800};
|
|
162
|
-
`;
|
|
163
|
-
const LogicBadge$1 = styled__default.default.span`
|
|
164
|
-
font-weight: bold;
|
|
165
|
-
color: ${(props) => props.logic === "OR" ? props.theme.colors.warning700 : props.theme.colors.primary700};
|
|
166
|
-
font-size: 10px;
|
|
167
|
-
text-transform: uppercase;
|
|
168
|
-
`;
|
|
169
|
-
const PopulateChip = styled__default.default.div`
|
|
170
|
-
display: inline-flex;
|
|
171
|
-
align-items: center;
|
|
172
|
-
padding: 4px 12px;
|
|
173
|
-
border-radius: 4px;
|
|
174
|
-
background: ${(props) => props.theme.colors.success100};
|
|
175
|
-
border: 1px solid ${(props) => props.theme.colors.success500};
|
|
176
|
-
font-size: 12px;
|
|
177
|
-
margin: 4px;
|
|
178
|
-
color: ${(props) => props.theme.colors.neutral800};
|
|
179
|
-
`;
|
|
180
|
-
const SortChip = styled__default.default.div`
|
|
181
|
-
display: inline-flex;
|
|
182
|
-
align-items: center;
|
|
183
|
-
padding: 4px 12px;
|
|
184
|
-
border-radius: 4px;
|
|
185
|
-
background: ${(props) => props.theme.colors.warning100};
|
|
186
|
-
border: 1px solid ${(props) => props.theme.colors.warning500};
|
|
187
|
-
font-size: 12px;
|
|
188
|
-
margin: 4px;
|
|
189
|
-
color: ${(props) => props.theme.colors.neutral800};
|
|
190
|
-
`;
|
|
191
|
-
const FilterPreview = ({ query }) => {
|
|
192
|
-
const parsed = parseQueryString(query);
|
|
193
|
-
if (!query || parsed.filters.length === 0 && parsed.sort.length === 0 && parsed.populate.length === 0) {
|
|
194
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, background: "neutral100", borderRadius: "4px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "No filters applied" }) });
|
|
195
|
-
}
|
|
196
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 3, background: "neutral100", borderRadius: "4px", children: [
|
|
197
|
-
parsed.filters.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 2, children: [
|
|
198
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", style: { marginBottom: "8px", display: "block" }, children: "Filters:" }),
|
|
199
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { wrap: "wrap", gap: 1, children: parsed.filters.map((filter, idx) => /* @__PURE__ */ jsxRuntime.jsxs(FilterChip, { logic: filter.logic, children: [
|
|
200
|
-
filter.logic && /* @__PURE__ */ jsxRuntime.jsx(LogicBadge$1, { logic: filter.logic, children: filter.logic }),
|
|
201
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
202
|
-
filter.field,
|
|
203
|
-
" ",
|
|
204
|
-
filter.operator,
|
|
205
|
-
" ",
|
|
206
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: filter.value })
|
|
207
|
-
] })
|
|
208
|
-
] }, idx)) })
|
|
209
|
-
] }),
|
|
210
|
-
parsed.sort.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 2, children: [
|
|
211
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", style: { marginBottom: "8px", display: "block" }, children: "Sorting:" }),
|
|
212
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { wrap: "wrap", gap: 1, children: parsed.sort.map((sort, idx) => /* @__PURE__ */ jsxRuntime.jsxs(SortChip, { children: [
|
|
213
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Filter, { width: "12px", height: "12px", style: { marginRight: "4px" } }),
|
|
214
|
-
" ",
|
|
215
|
-
sort
|
|
216
|
-
] }, idx)) })
|
|
217
|
-
] }),
|
|
218
|
-
parsed.populate.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
219
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", style: { marginBottom: "8px", display: "block" }, children: "Relations:" }),
|
|
220
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { wrap: "wrap", gap: 1, children: parsed.populate.map((field, idx) => /* @__PURE__ */ jsxRuntime.jsxs(PopulateChip, { children: [
|
|
221
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Link, { width: "12px", height: "12px", style: { marginRight: "4px" } }),
|
|
222
|
-
" ",
|
|
223
|
-
field
|
|
224
|
-
] }, idx)) })
|
|
225
|
-
] })
|
|
226
|
-
] });
|
|
227
|
-
};
|
|
228
|
-
const theme = {
|
|
229
|
-
colors: {
|
|
230
|
-
primary: { 500: "#4945FF", 600: "#3B38E0", 100: "#EEF0FF", 200: "#D9D8FF" },
|
|
231
|
-
secondary: { 100: "#F0F0FF" },
|
|
232
|
-
danger: { 500: "#D02B20", 100: "#FCECEA" },
|
|
233
|
-
neutral: { 200: "#DCDCE4", 400: "#A5A5BA", 600: "#666687" }
|
|
234
|
-
},
|
|
235
|
-
shadows: {
|
|
236
|
-
md: "0 4px 6px -1px rgba(0, 0, 0, 0.1)",
|
|
237
|
-
xl: "0 20px 25px -5px rgba(0, 0, 0, 0.15)"
|
|
238
|
-
},
|
|
239
|
-
gradients: {
|
|
240
|
-
header: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)"
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
const BOOKMARK_ICONS = [
|
|
244
|
-
{ id: "bookmark", icon: outline.BookmarkIcon, label: "Bookmark" },
|
|
245
|
-
{ id: "book", icon: outline.BookOpenIcon, label: "Book" },
|
|
246
|
-
{ id: "star", icon: outline.StarIcon, label: "Star" },
|
|
247
|
-
{ id: "heart", icon: outline.HeartIcon, label: "Heart" },
|
|
248
|
-
{ id: "bolt", icon: outline.BoltIcon, label: "Lightning" },
|
|
249
|
-
{ id: "rocket", icon: outline.RocketLaunchIcon, label: "Rocket" },
|
|
250
|
-
{ id: "pencil", icon: outline.PencilIcon, label: "Pencil" },
|
|
251
|
-
{ id: "link", icon: outline.LinkIcon, label: "Link" },
|
|
252
|
-
{ id: "sparkles", icon: outline.SparklesIcon, label: "Sparkles" },
|
|
253
|
-
{ id: "briefcase", icon: outline.BriefcaseIcon, label: "Briefcase" },
|
|
254
|
-
{ id: "photo", icon: outline.PhotoIcon, label: "Photo" },
|
|
255
|
-
{ id: "document", icon: outline.DocumentIcon, label: "Document" },
|
|
256
|
-
{ id: "bell", icon: outline.BellIcon, label: "Bell" },
|
|
257
|
-
{ id: "check", icon: outline.CheckCircleIcon, label: "Check" },
|
|
258
|
-
{ id: "gift", icon: outline.GiftIcon, label: "Gift" },
|
|
259
|
-
{ id: "user", icon: outline.UserIcon, label: "User" },
|
|
260
|
-
{ id: "users", icon: outline.UserGroupIcon, label: "Users" },
|
|
261
|
-
{ id: "mail", icon: outline.EnvelopeIcon, label: "Mail" },
|
|
262
|
-
{ id: "calendar", icon: outline.CalendarIcon, label: "Calendar" },
|
|
263
|
-
{ id: "clock", icon: outline.ClockIcon, label: "Clock" },
|
|
264
|
-
{ id: "folder", icon: outline.FolderIcon, label: "Folder" },
|
|
265
|
-
{ id: "search", icon: outline.MagnifyingGlassIcon, label: "Search" },
|
|
266
|
-
{ id: "filter", icon: outline.FunnelIcon, label: "Filter" },
|
|
267
|
-
{ id: "globe", icon: outline.GlobeAltIcon, label: "Globe" },
|
|
268
|
-
{ id: "tag", icon: outline.TagIcon, label: "Tag" },
|
|
269
|
-
{ id: "flag", icon: outline.FlagIcon, label: "Flag" },
|
|
270
|
-
{ id: "fire", icon: outline.FireIcon, label: "Fire" },
|
|
271
|
-
{ id: "cube", icon: outline.CubeIcon, label: "Cube" },
|
|
272
|
-
{ id: "home", icon: outline.HomeIcon, label: "Home" },
|
|
273
|
-
{ id: "cog", icon: outline.CogIcon, label: "Settings" },
|
|
274
|
-
{ id: "wrench", icon: outline.WrenchIcon, label: "Wrench" },
|
|
275
|
-
{ id: "terminal", icon: outline.CommandLineIcon, label: "Terminal" },
|
|
276
|
-
{ id: "chart", icon: outline.ChartBarIcon, label: "Chart" }
|
|
277
|
-
];
|
|
278
|
-
const getIconById = (iconId) => {
|
|
279
|
-
const found = BOOKMARK_ICONS.find((i) => i.id === iconId);
|
|
280
|
-
return found ? found.icon : outline.BookmarkIcon;
|
|
281
|
-
};
|
|
282
|
-
const fadeIn$1 = styled.keyframes`
|
|
283
|
-
from { opacity: 0; transform: scale(0.95); }
|
|
284
|
-
to { opacity: 1; transform: scale(1); }
|
|
285
|
-
`;
|
|
286
|
-
styled.keyframes`
|
|
287
|
-
from { opacity: 0; max-height: 0; }
|
|
288
|
-
to { opacity: 1; max-height: 500px; }
|
|
289
|
-
`;
|
|
290
|
-
const Overlay = styled__default.default.div`
|
|
291
|
-
position: fixed;
|
|
292
|
-
top: 0;
|
|
293
|
-
left: 0;
|
|
294
|
-
right: 0;
|
|
295
|
-
bottom: 0;
|
|
296
|
-
background: rgba(0, 0, 0, 0.6);
|
|
297
|
-
backdrop-filter: blur(4px);
|
|
298
|
-
display: flex;
|
|
299
|
-
align-items: center;
|
|
300
|
-
justify-content: center;
|
|
301
|
-
z-index: 999;
|
|
302
|
-
`;
|
|
303
|
-
const ModalContainer = styled__default.default.div`
|
|
304
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
305
|
-
border-radius: 16px;
|
|
306
|
-
max-height: 90vh;
|
|
307
|
-
overflow: hidden;
|
|
308
|
-
max-width: 580px;
|
|
309
|
-
width: 95%;
|
|
310
|
-
box-shadow: ${theme.shadows.xl};
|
|
311
|
-
animation: ${fadeIn$1} 0.2s ease-out;
|
|
312
|
-
display: flex;
|
|
313
|
-
flex-direction: column;
|
|
314
|
-
`;
|
|
315
|
-
const ModalHeader = styled__default.default.div`
|
|
316
|
-
background: ${theme.gradients.header};
|
|
317
|
-
padding: 24px 28px;
|
|
318
|
-
display: flex;
|
|
319
|
-
justify-content: space-between;
|
|
320
|
-
align-items: center;
|
|
321
|
-
`;
|
|
322
|
-
const HeaderTitle = styled__default.default.h2`
|
|
323
|
-
color: white;
|
|
324
|
-
font-size: 1.25rem;
|
|
325
|
-
font-weight: 600;
|
|
326
|
-
margin: 0;
|
|
327
|
-
display: flex;
|
|
328
|
-
align-items: center;
|
|
329
|
-
gap: 10px;
|
|
330
|
-
|
|
331
|
-
svg {
|
|
332
|
-
width: 24px;
|
|
333
|
-
height: 24px;
|
|
334
|
-
}
|
|
335
|
-
`;
|
|
336
|
-
const CloseButton = styled__default.default.button`
|
|
337
|
-
background: rgba(255, 255, 255, 0.2);
|
|
338
|
-
border: none;
|
|
339
|
-
border-radius: 8px;
|
|
340
|
-
padding: 8px;
|
|
341
|
-
cursor: pointer;
|
|
342
|
-
display: flex;
|
|
343
|
-
align-items: center;
|
|
344
|
-
justify-content: center;
|
|
345
|
-
transition: all 0.15s ease;
|
|
346
|
-
|
|
347
|
-
svg {
|
|
348
|
-
width: 20px;
|
|
349
|
-
height: 20px;
|
|
350
|
-
color: white;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
&:hover {
|
|
354
|
-
background: rgba(255, 255, 255, 0.3);
|
|
355
|
-
transform: scale(1.05);
|
|
356
|
-
}
|
|
357
|
-
`;
|
|
358
|
-
const ModalBody = styled__default.default.div`
|
|
359
|
-
padding: 24px 28px;
|
|
360
|
-
overflow-y: auto;
|
|
361
|
-
flex: 1;
|
|
362
|
-
`;
|
|
363
|
-
const ModalFooter$1 = styled__default.default.div`
|
|
364
|
-
padding: 16px 28px;
|
|
365
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
366
|
-
border-top: 1px solid rgba(128, 128, 128, 0.25);
|
|
367
|
-
display: flex;
|
|
368
|
-
justify-content: flex-end;
|
|
369
|
-
gap: 12px;
|
|
370
|
-
`;
|
|
371
|
-
const Section = styled__default.default.div`
|
|
372
|
-
margin-bottom: 20px;
|
|
373
|
-
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
374
|
-
border-radius: 12px;
|
|
375
|
-
overflow: hidden;
|
|
376
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
377
|
-
transition: all 0.2s ease;
|
|
378
|
-
|
|
379
|
-
&:hover {
|
|
380
|
-
border-color: ${theme.colors.primary[200]};
|
|
381
|
-
}
|
|
382
|
-
`;
|
|
383
|
-
const SectionHeader = styled__default.default.button`
|
|
384
|
-
width: 100%;
|
|
385
|
-
padding: 14px 16px;
|
|
386
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
387
|
-
border: none;
|
|
388
|
-
cursor: pointer;
|
|
389
|
-
display: flex;
|
|
390
|
-
align-items: center;
|
|
391
|
-
justify-content: space-between;
|
|
392
|
-
transition: all 0.15s ease;
|
|
393
|
-
|
|
394
|
-
&:hover {
|
|
395
|
-
background: ${(p) => p.theme.colors.neutral200};
|
|
396
|
-
}
|
|
397
|
-
`;
|
|
398
|
-
const SectionTitle = styled__default.default.div`
|
|
399
|
-
display: flex;
|
|
400
|
-
align-items: center;
|
|
401
|
-
gap: 10px;
|
|
402
|
-
font-weight: 600;
|
|
403
|
-
font-size: 0.875rem;
|
|
404
|
-
color: ${(p) => p.theme.colors.neutral800};
|
|
405
|
-
|
|
406
|
-
svg {
|
|
407
|
-
width: 18px;
|
|
408
|
-
height: 18px;
|
|
409
|
-
color: ${theme.colors.primary[500]};
|
|
410
|
-
}
|
|
411
|
-
`;
|
|
412
|
-
const SectionContent = styled__default.default.div`
|
|
413
|
-
padding: ${(props) => props.$collapsed ? "0" : "16px"};
|
|
414
|
-
max-height: ${(props) => props.$collapsed ? "0" : "500px"};
|
|
415
|
-
opacity: ${(props) => props.$collapsed ? "0" : "1"};
|
|
416
|
-
overflow: hidden;
|
|
417
|
-
transition: all 0.25s ease;
|
|
418
|
-
`;
|
|
419
|
-
const ChevronIcon = styled__default.default.div`
|
|
420
|
-
transform: rotate(${(props) => props.$collapsed ? "0" : "180deg"});
|
|
421
|
-
transition: transform 0.2s ease;
|
|
422
|
-
|
|
423
|
-
svg {
|
|
424
|
-
width: 18px;
|
|
425
|
-
height: 18px;
|
|
426
|
-
color: ${(p) => p.theme.colors.neutral600};
|
|
427
|
-
}
|
|
428
|
-
`;
|
|
429
|
-
const IconPicker = styled__default.default.div`
|
|
430
|
-
display: grid;
|
|
431
|
-
grid-template-columns: repeat(8, 1fr);
|
|
432
|
-
gap: 8px;
|
|
433
|
-
padding: 12px;
|
|
434
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
435
|
-
border-radius: 8px;
|
|
436
|
-
max-height: 180px;
|
|
437
|
-
overflow-y: auto;
|
|
438
|
-
|
|
439
|
-
&::-webkit-scrollbar {
|
|
440
|
-
width: 6px;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
&::-webkit-scrollbar-track {
|
|
444
|
-
background: transparent;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
&::-webkit-scrollbar-thumb {
|
|
448
|
-
background: ${theme.colors.neutral[400]};
|
|
449
|
-
border-radius: 3px;
|
|
450
|
-
}
|
|
451
|
-
`;
|
|
452
|
-
const IconButton = styled__default.default.button`
|
|
453
|
-
display: flex;
|
|
454
|
-
align-items: center;
|
|
455
|
-
justify-content: center;
|
|
456
|
-
padding: 10px;
|
|
457
|
-
border: 2px solid ${(props) => props.$isSelected ? theme.colors.primary[500] : "transparent"};
|
|
458
|
-
background: ${(props) => props.$isSelected ? theme.colors.primary[100] : props.theme.colors.neutral0};
|
|
459
|
-
border-radius: 8px;
|
|
460
|
-
cursor: pointer;
|
|
461
|
-
transition: all 0.15s ease;
|
|
462
|
-
|
|
463
|
-
svg {
|
|
464
|
-
width: 20px;
|
|
465
|
-
height: 20px;
|
|
466
|
-
color: ${(props) => props.$isSelected ? theme.colors.primary[500] : props.theme.colors.neutral600};
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
&:hover {
|
|
470
|
-
border-color: ${theme.colors.primary[500]};
|
|
471
|
-
background: ${theme.colors.primary[100]};
|
|
472
|
-
transform: scale(1.08);
|
|
473
|
-
|
|
474
|
-
svg {
|
|
475
|
-
color: ${theme.colors.primary[500]};
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
`;
|
|
479
|
-
const SelectedIconDisplay = styled__default.default.div`
|
|
480
|
-
display: flex;
|
|
481
|
-
align-items: center;
|
|
482
|
-
gap: 16px;
|
|
483
|
-
padding: 12px 16px;
|
|
484
|
-
background: linear-gradient(135deg, ${theme.colors.primary[100]} 0%, ${theme.colors.secondary[100]} 100%);
|
|
485
|
-
border-radius: 10px;
|
|
486
|
-
margin-bottom: 12px;
|
|
487
|
-
`;
|
|
488
|
-
const SelectedIconCircle = styled__default.default.div`
|
|
489
|
-
width: 52px;
|
|
490
|
-
height: 52px;
|
|
491
|
-
border-radius: 12px;
|
|
492
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
493
|
-
border: 2px solid ${theme.colors.primary[500]};
|
|
494
|
-
display: flex;
|
|
495
|
-
align-items: center;
|
|
496
|
-
justify-content: center;
|
|
497
|
-
box-shadow: ${theme.shadows.md};
|
|
498
|
-
|
|
499
|
-
svg {
|
|
500
|
-
width: 26px;
|
|
501
|
-
height: 26px;
|
|
502
|
-
color: ${theme.colors.primary[500]};
|
|
503
|
-
}
|
|
504
|
-
`;
|
|
505
|
-
const PublicToggleContainer = styled__default.default.div`
|
|
506
|
-
display: flex;
|
|
507
|
-
align-items: center;
|
|
508
|
-
justify-content: space-between;
|
|
509
|
-
padding: 14px 16px;
|
|
510
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
511
|
-
border-radius: 10px;
|
|
512
|
-
margin-bottom: 16px;
|
|
513
|
-
`;
|
|
514
|
-
const PublicToggleInfo = styled__default.default.div`
|
|
515
|
-
display: flex;
|
|
516
|
-
align-items: center;
|
|
517
|
-
gap: 12px;
|
|
518
|
-
|
|
519
|
-
svg {
|
|
520
|
-
width: 20px;
|
|
521
|
-
height: 20px;
|
|
522
|
-
color: ${theme.colors.primary[500]};
|
|
523
|
-
}
|
|
524
|
-
`;
|
|
525
|
-
const SwitchContainer = styled__default.default.label`
|
|
526
|
-
position: relative;
|
|
527
|
-
display: inline-flex;
|
|
528
|
-
align-items: center;
|
|
529
|
-
cursor: pointer;
|
|
530
|
-
`;
|
|
531
|
-
const SwitchInput = styled__default.default.input`
|
|
532
|
-
opacity: 0;
|
|
533
|
-
width: 0;
|
|
534
|
-
height: 0;
|
|
535
|
-
position: absolute;
|
|
536
|
-
`;
|
|
537
|
-
const SwitchSlider = styled__default.default.span`
|
|
538
|
-
position: relative;
|
|
539
|
-
width: 44px;
|
|
540
|
-
height: 24px;
|
|
541
|
-
background: ${(props) => props.$checked ? theme.colors.primary[500] : theme.colors.neutral[300]};
|
|
542
|
-
border-radius: 24px;
|
|
543
|
-
transition: all 0.2s ease;
|
|
544
|
-
|
|
545
|
-
&::before {
|
|
546
|
-
content: '';
|
|
547
|
-
position: absolute;
|
|
548
|
-
width: 18px;
|
|
549
|
-
height: 18px;
|
|
550
|
-
left: ${(props) => props.$checked ? "23px" : "3px"};
|
|
551
|
-
top: 3px;
|
|
552
|
-
background: white;
|
|
553
|
-
border-radius: 50%;
|
|
554
|
-
transition: all 0.2s ease;
|
|
555
|
-
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
&:hover {
|
|
559
|
-
background: ${(props) => props.$checked ? theme.colors.primary[600] : theme.colors.neutral[400]};
|
|
560
|
-
}
|
|
561
|
-
`;
|
|
562
|
-
const SelectionList = styled__default.default.div`
|
|
563
|
-
max-height: 140px;
|
|
564
|
-
overflow-y: auto;
|
|
565
|
-
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
566
|
-
border-radius: 8px;
|
|
567
|
-
background: ${(props) => props.$disabled ? props.theme.colors.neutral100 : props.theme.colors.neutral0};
|
|
568
|
-
opacity: ${(props) => props.$disabled ? 0.6 : 1};
|
|
569
|
-
pointer-events: ${(props) => props.$disabled ? "none" : "auto"};
|
|
570
|
-
|
|
571
|
-
&::-webkit-scrollbar {
|
|
572
|
-
width: 6px;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
&::-webkit-scrollbar-track {
|
|
576
|
-
background: transparent;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
&::-webkit-scrollbar-thumb {
|
|
580
|
-
background: ${theme.colors.neutral[400]};
|
|
581
|
-
border-radius: 3px;
|
|
582
|
-
}
|
|
583
|
-
`;
|
|
584
|
-
const SelectionItem = styled__default.default.label`
|
|
585
|
-
display: flex;
|
|
586
|
-
align-items: center;
|
|
587
|
-
gap: 12px;
|
|
588
|
-
padding: 10px 14px;
|
|
589
|
-
cursor: pointer;
|
|
590
|
-
border-bottom: 1px solid rgba(128, 128, 128, 0.25);
|
|
591
|
-
background: ${(props) => props.$selected ? theme.colors.primary[100] : "transparent"};
|
|
592
|
-
transition: all 0.15s ease;
|
|
593
|
-
|
|
594
|
-
&:last-child {
|
|
595
|
-
border-bottom: none;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
&:hover {
|
|
599
|
-
background: ${(props) => props.$selected ? theme.colors.primary[100] : props.theme.colors.neutral100};
|
|
600
|
-
}
|
|
601
|
-
`;
|
|
602
|
-
const CustomCheckbox = styled__default.default.div`
|
|
603
|
-
width: 20px;
|
|
604
|
-
height: 20px;
|
|
605
|
-
border-radius: 4px;
|
|
606
|
-
border: 2px solid ${(props) => props.$checked ? theme.colors.primary[500] : props.theme.colors.neutral400};
|
|
607
|
-
background: ${(props) => props.$checked ? theme.colors.primary[500] : "transparent"};
|
|
608
|
-
display: flex;
|
|
609
|
-
align-items: center;
|
|
610
|
-
justify-content: center;
|
|
611
|
-
transition: all 0.15s ease;
|
|
612
|
-
flex-shrink: 0;
|
|
613
|
-
|
|
614
|
-
svg {
|
|
615
|
-
width: 14px;
|
|
616
|
-
height: 14px;
|
|
617
|
-
color: white;
|
|
618
|
-
opacity: ${(props) => props.$checked ? 1 : 0};
|
|
619
|
-
}
|
|
620
|
-
`;
|
|
621
|
-
const ItemLabel = styled__default.default.span`
|
|
622
|
-
font-size: 0.875rem;
|
|
623
|
-
color: ${(props) => props.$selected ? theme.colors.primary[600] : props.theme.colors.neutral800};
|
|
624
|
-
font-weight: ${(props) => props.$selected ? 600 : 400};
|
|
625
|
-
`;
|
|
626
|
-
const ItemBadge = styled__default.default.span`
|
|
627
|
-
font-size: 0.7rem;
|
|
628
|
-
padding: 2px 6px;
|
|
629
|
-
border-radius: 4px;
|
|
630
|
-
background: ${(props) => props.$type === "custom" ? "#F3E8FF" : theme.colors.neutral[200]};
|
|
631
|
-
color: ${(props) => props.$type === "custom" ? "#8B5CF6" : theme.colors.neutral[600]};
|
|
632
|
-
font-weight: 500;
|
|
633
|
-
`;
|
|
634
|
-
const FormField = styled__default.default.div`
|
|
635
|
-
margin-bottom: 16px;
|
|
636
|
-
|
|
637
|
-
&:last-child {
|
|
638
|
-
margin-bottom: 0;
|
|
639
|
-
}
|
|
640
|
-
`;
|
|
641
|
-
const Label = styled__default.default.label`
|
|
642
|
-
display: block;
|
|
643
|
-
font-size: 0.875rem;
|
|
644
|
-
font-weight: 600;
|
|
645
|
-
color: ${(p) => p.theme.colors.neutral800};
|
|
646
|
-
margin-bottom: 8px;
|
|
647
|
-
`;
|
|
648
|
-
const HintText = styled__default.default.p`
|
|
649
|
-
font-size: 0.75rem;
|
|
650
|
-
color: ${(p) => p.theme.colors.neutral600};
|
|
651
|
-
margin-top: 6px;
|
|
652
|
-
display: flex;
|
|
653
|
-
align-items: center;
|
|
654
|
-
gap: 6px;
|
|
655
|
-
|
|
656
|
-
svg {
|
|
657
|
-
width: 14px;
|
|
658
|
-
height: 14px;
|
|
659
|
-
flex-shrink: 0;
|
|
660
|
-
}
|
|
661
|
-
`;
|
|
662
|
-
const PathDisplay = styled__default.default.div`
|
|
663
|
-
padding: 12px 14px;
|
|
664
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
665
|
-
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
666
|
-
border-radius: 8px;
|
|
667
|
-
font-family: 'Monaco', 'Menlo', monospace;
|
|
668
|
-
font-size: 0.8rem;
|
|
669
|
-
color: ${(p) => p.theme.colors.neutral600};
|
|
670
|
-
word-break: break-all;
|
|
671
|
-
`;
|
|
672
|
-
const ErrorBox = styled__default.default.div`
|
|
673
|
-
padding: 12px 16px;
|
|
674
|
-
background: ${theme.colors.danger[100]};
|
|
675
|
-
border: 1px solid ${theme.colors.danger[500]};
|
|
676
|
-
border-radius: 8px;
|
|
677
|
-
margin-bottom: 16px;
|
|
678
|
-
|
|
679
|
-
p {
|
|
680
|
-
color: ${theme.colors.danger[500]};
|
|
681
|
-
font-size: 0.875rem;
|
|
682
|
-
margin: 0;
|
|
683
|
-
}
|
|
684
|
-
`;
|
|
685
|
-
const SectionLabel = styled__default.default.div`
|
|
686
|
-
font-size: 0.75rem;
|
|
687
|
-
font-weight: 600;
|
|
688
|
-
color: ${(p) => p.theme.colors.neutral600};
|
|
689
|
-
text-transform: uppercase;
|
|
690
|
-
letter-spacing: 0.5px;
|
|
691
|
-
margin-bottom: 8px;
|
|
692
|
-
margin-top: 12px;
|
|
693
|
-
|
|
694
|
-
&:first-child {
|
|
695
|
-
margin-top: 0;
|
|
696
|
-
}
|
|
697
|
-
`;
|
|
698
|
-
const StyledTextInput = styled__default.default(designSystem.TextInput)`
|
|
699
|
-
input {
|
|
700
|
-
border-radius: 8px;
|
|
701
|
-
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
702
|
-
|
|
703
|
-
&:focus {
|
|
704
|
-
border-color: ${theme.colors.primary[500]};
|
|
705
|
-
box-shadow: 0 0 0 3px ${theme.colors.primary[100]};
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
`;
|
|
709
|
-
const StyledTextarea = styled__default.default(designSystem.Textarea)`
|
|
710
|
-
textarea {
|
|
711
|
-
border-radius: 8px;
|
|
712
|
-
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
713
|
-
min-height: 80px;
|
|
714
|
-
|
|
715
|
-
&:focus {
|
|
716
|
-
border-color: ${theme.colors.primary[500]};
|
|
717
|
-
box-shadow: 0 0 0 3px ${theme.colors.primary[100]};
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
`;
|
|
721
|
-
const CreateEditModal = ({
|
|
722
|
-
bookmark,
|
|
723
|
-
onClose,
|
|
724
|
-
onSuccess,
|
|
725
|
-
pluginId: pluginId2,
|
|
726
|
-
currentPath,
|
|
727
|
-
currentQuery
|
|
728
|
-
}) => {
|
|
729
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
730
|
-
const { post, put, get } = admin.useFetchClient();
|
|
731
|
-
const [name2, setName] = React.useState("");
|
|
732
|
-
const [path, setPath] = React.useState(currentPath || "");
|
|
733
|
-
const [query, setQuery] = React.useState(currentQuery || "");
|
|
734
|
-
const [icon, setIcon] = React.useState("bookmark");
|
|
735
|
-
const [description, setDescription] = React.useState("");
|
|
736
|
-
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
737
|
-
const [error, setError] = React.useState("");
|
|
738
|
-
const [isPublic, setIsPublic] = React.useState(false);
|
|
739
|
-
const [sharedWithRoles, setSharedWithRoles] = React.useState([]);
|
|
740
|
-
const [sharedWithUsers, setSharedWithUsers] = React.useState([]);
|
|
741
|
-
const [availableRoles, setAvailableRoles] = React.useState([]);
|
|
742
|
-
const [availableUsers, setAvailableUsers] = React.useState([]);
|
|
743
|
-
const [loadingRoles, setLoadingRoles] = React.useState(false);
|
|
744
|
-
const [loadingUsers, setLoadingUsers] = React.useState(false);
|
|
745
|
-
const [iconSectionOpen, setIconSectionOpen] = React.useState(true);
|
|
746
|
-
const [sharingSectionOpen, setSharingSectionOpen] = React.useState(false);
|
|
747
|
-
const [filtersSectionOpen, setFiltersSectionOpen] = React.useState(false);
|
|
748
|
-
React.useEffect(() => {
|
|
749
|
-
if (bookmark) {
|
|
750
|
-
setName(bookmark.name);
|
|
751
|
-
setPath(bookmark.path);
|
|
752
|
-
setQuery(bookmark.query || "");
|
|
753
|
-
setIcon(bookmark.icon || bookmark.emoji || "bookmark");
|
|
754
|
-
setDescription(bookmark.description || "");
|
|
755
|
-
setIsPublic(bookmark.isPublic || false);
|
|
756
|
-
setSharedWithRoles(bookmark.sharedWithRoles || []);
|
|
757
|
-
setSharedWithUsers(bookmark.sharedWithUsers || []);
|
|
758
|
-
}
|
|
759
|
-
fetchRoles();
|
|
760
|
-
fetchUsers();
|
|
761
|
-
}, [bookmark]);
|
|
762
|
-
const fetchRoles = async () => {
|
|
763
|
-
setLoadingRoles(true);
|
|
764
|
-
try {
|
|
765
|
-
const response = await get(`/${pluginId2}/roles`);
|
|
766
|
-
const roles = response.data?.data?.data || response.data?.data || response.data || [];
|
|
767
|
-
setAvailableRoles(roles);
|
|
768
|
-
} catch (error2) {
|
|
769
|
-
console.error("[Magic-Mark] Error fetching roles:", error2);
|
|
770
|
-
} finally {
|
|
771
|
-
setLoadingRoles(false);
|
|
772
|
-
}
|
|
773
|
-
};
|
|
774
|
-
const fetchUsers = async () => {
|
|
775
|
-
setLoadingUsers(true);
|
|
776
|
-
try {
|
|
777
|
-
const meResponse = await get("/admin/users/me");
|
|
778
|
-
const currentUser = meResponse.data?.data || meResponse.data || meResponse;
|
|
779
|
-
const currentUserId = currentUser?.id;
|
|
780
|
-
const currentUserEmail = currentUser?.email;
|
|
781
|
-
const response = await get("/admin/users?pageSize=100&page=1&sort=firstname");
|
|
782
|
-
const allUsers = response.data?.data?.results || response.data?.results || [];
|
|
783
|
-
const users = Array.isArray(allUsers) ? allUsers.filter((u) => {
|
|
784
|
-
const matchById = u.id === currentUserId || u.id === Number(currentUserId) || String(u.id) === String(currentUserId);
|
|
785
|
-
const matchByEmail = u.email?.toLowerCase() === currentUserEmail?.toLowerCase();
|
|
786
|
-
return !(matchById || matchByEmail);
|
|
787
|
-
}) : [];
|
|
788
|
-
setAvailableUsers(users);
|
|
789
|
-
} catch (error2) {
|
|
790
|
-
console.error("[Magic-Mark] Error fetching users:", error2);
|
|
791
|
-
try {
|
|
792
|
-
const response = await get(`/${pluginId2}/users`);
|
|
793
|
-
const users = response.data?.data?.data || response.data?.data || response.data || [];
|
|
794
|
-
setAvailableUsers(users);
|
|
795
|
-
} catch (fallbackError) {
|
|
796
|
-
setAvailableUsers([]);
|
|
797
|
-
}
|
|
798
|
-
} finally {
|
|
799
|
-
setLoadingUsers(false);
|
|
800
|
-
}
|
|
801
|
-
};
|
|
802
|
-
const validateForm = () => {
|
|
803
|
-
setError("");
|
|
804
|
-
if (!name2.trim()) {
|
|
805
|
-
setError(formatMessage({ id: `${pluginId2}.error.nameRequired`, defaultMessage: "Name is required" }));
|
|
806
|
-
return false;
|
|
807
|
-
}
|
|
808
|
-
if (!path.trim()) {
|
|
809
|
-
setError(formatMessage({ id: `${pluginId2}.error.pathRequired`, defaultMessage: "Path is required" }));
|
|
810
|
-
return false;
|
|
811
|
-
}
|
|
812
|
-
return true;
|
|
813
|
-
};
|
|
814
|
-
const handleSubmit = async () => {
|
|
815
|
-
if (!validateForm()) return;
|
|
816
|
-
setIsSubmitting(true);
|
|
817
|
-
try {
|
|
818
|
-
const bookmarkId = bookmark?.documentId || bookmark?.id;
|
|
819
|
-
const endpoint = bookmark ? `/${pluginId2}/bookmarks/${bookmarkId}` : `/${pluginId2}/bookmarks`;
|
|
820
|
-
const body = {
|
|
821
|
-
name: name2,
|
|
822
|
-
path,
|
|
823
|
-
query,
|
|
824
|
-
icon,
|
|
825
|
-
emoji: icon,
|
|
826
|
-
description,
|
|
827
|
-
isPublic,
|
|
828
|
-
sharedWithRoles,
|
|
829
|
-
sharedWithUsers
|
|
830
|
-
};
|
|
831
|
-
if (bookmark) {
|
|
832
|
-
await put(endpoint, body);
|
|
833
|
-
} else {
|
|
834
|
-
await post(endpoint, body);
|
|
835
|
-
}
|
|
836
|
-
onSuccess();
|
|
837
|
-
} catch (error2) {
|
|
838
|
-
console.error("[Magic-Mark] Error saving bookmark:", error2);
|
|
839
|
-
setError(formatMessage({ id: `${pluginId2}.error.save`, defaultMessage: "Failed to save bookmark" }));
|
|
840
|
-
} finally {
|
|
841
|
-
setIsSubmitting(false);
|
|
842
|
-
}
|
|
843
|
-
};
|
|
844
|
-
const toggleRole = (roleId) => {
|
|
845
|
-
setSharedWithRoles(
|
|
846
|
-
(prev) => prev.includes(roleId) ? prev.filter((id) => id !== roleId) : [...prev, roleId]
|
|
847
|
-
);
|
|
848
|
-
};
|
|
849
|
-
const toggleUser = (userId) => {
|
|
850
|
-
setSharedWithUsers(
|
|
851
|
-
(prev) => prev.includes(userId) ? prev.filter((id) => id !== userId) : [...prev, userId]
|
|
852
|
-
);
|
|
853
|
-
};
|
|
854
|
-
const isEditing = !!bookmark;
|
|
855
|
-
const SelectedIcon = getIconById(icon);
|
|
856
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Overlay, { onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(ModalContainer, { onClick: (e) => e.stopPropagation(), children: [
|
|
857
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ModalHeader, { children: [
|
|
858
|
-
/* @__PURE__ */ jsxRuntime.jsxs(HeaderTitle, { children: [
|
|
859
|
-
/* @__PURE__ */ jsxRuntime.jsx(outline.BookmarkIcon, {}),
|
|
860
|
-
isEditing ? formatMessage({ id: `${pluginId2}.modal.edit`, defaultMessage: "Edit Bookmark" }) : formatMessage({ id: `${pluginId2}.modal.create`, defaultMessage: "Save as Bookmark" })
|
|
861
|
-
] }),
|
|
862
|
-
/* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}) })
|
|
863
|
-
] }),
|
|
864
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ModalBody, { children: [
|
|
865
|
-
error && /* @__PURE__ */ jsxRuntime.jsx(ErrorBox, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: error }) }),
|
|
866
|
-
/* @__PURE__ */ jsxRuntime.jsxs(FormField, { children: [
|
|
867
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { children: [
|
|
868
|
-
formatMessage({ id: `${pluginId2}.form.name`, defaultMessage: "Bookmark Name" }),
|
|
869
|
-
" *"
|
|
870
|
-
] }),
|
|
871
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
872
|
-
StyledTextInput,
|
|
873
|
-
{
|
|
874
|
-
type: "text",
|
|
875
|
-
placeholder: formatMessage({ id: `${pluginId2}.form.namePlaceholder`, defaultMessage: "e.g., Published Articles" }),
|
|
876
|
-
value: name2,
|
|
877
|
-
onChange: (e) => setName(e.target.value)
|
|
878
|
-
}
|
|
879
|
-
)
|
|
880
|
-
] }),
|
|
881
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
|
|
882
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SectionHeader, { onClick: () => setIconSectionOpen(!iconSectionOpen), children: [
|
|
883
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SectionTitle, { children: [
|
|
884
|
-
/* @__PURE__ */ jsxRuntime.jsx(outline.SwatchIcon, {}),
|
|
885
|
-
formatMessage({ id: `${pluginId2}.form.icon`, defaultMessage: "Choose Icon" })
|
|
886
|
-
] }),
|
|
887
|
-
/* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { $collapsed: !iconSectionOpen, children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronDownIcon, {}) })
|
|
888
|
-
] }),
|
|
889
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SectionContent, { $collapsed: !iconSectionOpen, children: [
|
|
890
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SelectedIconDisplay, { children: [
|
|
891
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectedIconCircle, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIcon, {}) }),
|
|
892
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
|
|
893
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "semiBold", style: { color: "var(--colors-neutral800, #32324D)", display: "block" }, children: BOOKMARK_ICONS.find((i) => i.id === icon)?.label || "Bookmark" }),
|
|
894
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { fontSize: "0.75rem", display: "block" }, children: "Click below to change" })
|
|
895
|
-
] })
|
|
896
|
-
] }),
|
|
897
|
-
/* @__PURE__ */ jsxRuntime.jsx(IconPicker, { children: BOOKMARK_ICONS.map((item) => {
|
|
898
|
-
const IconComp = item.icon;
|
|
899
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
900
|
-
IconButton,
|
|
901
|
-
{
|
|
902
|
-
$isSelected: icon === item.id,
|
|
903
|
-
onClick: () => setIcon(item.id),
|
|
904
|
-
type: "button",
|
|
905
|
-
title: item.label,
|
|
906
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(IconComp, {})
|
|
907
|
-
},
|
|
908
|
-
item.id
|
|
909
|
-
);
|
|
910
|
-
}) })
|
|
911
|
-
] })
|
|
912
|
-
] }),
|
|
913
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
|
|
914
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SectionHeader, { onClick: () => setSharingSectionOpen(!sharingSectionOpen), children: [
|
|
915
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SectionTitle, { children: [
|
|
916
|
-
/* @__PURE__ */ jsxRuntime.jsx(outline.ShareIcon, {}),
|
|
917
|
-
formatMessage({ id: `${pluginId2}.form.sharing`, defaultMessage: "Sharing Options" }),
|
|
918
|
-
(isPublic || sharedWithRoles.length > 0 || sharedWithUsers.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(ItemBadge, { children: isPublic ? "Public" : `${sharedWithRoles.length + sharedWithUsers.length} shared` })
|
|
919
|
-
] }),
|
|
920
|
-
/* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { $collapsed: !sharingSectionOpen, children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronDownIcon, {}) })
|
|
921
|
-
] }),
|
|
922
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SectionContent, { $collapsed: !sharingSectionOpen, children: [
|
|
923
|
-
/* @__PURE__ */ jsxRuntime.jsxs(PublicToggleContainer, { children: [
|
|
924
|
-
/* @__PURE__ */ jsxRuntime.jsxs(PublicToggleInfo, { children: [
|
|
925
|
-
/* @__PURE__ */ jsxRuntime.jsx(outline.GlobeAltIcon, {}),
|
|
926
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
|
|
927
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "semiBold", style: { color: "var(--colors-neutral800, #32324D)", display: "block" }, children: "Public Bookmark" }),
|
|
928
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", style: { fontSize: "0.75rem", color: "var(--colors-neutral600, #666687)", display: "block" }, children: "All admin users can see this" })
|
|
929
|
-
] })
|
|
930
|
-
] }),
|
|
931
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SwitchContainer, { children: [
|
|
932
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
933
|
-
SwitchInput,
|
|
934
|
-
{
|
|
935
|
-
type: "checkbox",
|
|
936
|
-
checked: isPublic,
|
|
937
|
-
onChange: () => setIsPublic(!isPublic)
|
|
938
|
-
}
|
|
939
|
-
),
|
|
940
|
-
/* @__PURE__ */ jsxRuntime.jsx(SwitchSlider, { $checked: isPublic })
|
|
941
|
-
] })
|
|
942
|
-
] }),
|
|
943
|
-
/* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { children: "Share with Roles" }),
|
|
944
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectionList, { $disabled: isPublic, children: loadingRoles ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "16px", textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Loading..." }) }) : availableRoles.length > 0 ? availableRoles.map((role) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
945
|
-
SelectionItem,
|
|
946
|
-
{
|
|
947
|
-
$selected: sharedWithRoles.includes(role.id),
|
|
948
|
-
onClick: () => !isPublic && toggleRole(role.id),
|
|
949
|
-
children: [
|
|
950
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomCheckbox, { $checked: sharedWithRoles.includes(role.id), children: /* @__PURE__ */ jsxRuntime.jsx(outline.CheckCircleIcon, {}) }),
|
|
951
|
-
/* @__PURE__ */ jsxRuntime.jsx(ItemLabel, { $selected: sharedWithRoles.includes(role.id), children: role.name || role.code }),
|
|
952
|
-
role.isCustom && /* @__PURE__ */ jsxRuntime.jsx(ItemBadge, { $type: "custom", children: "Custom" }),
|
|
953
|
-
role.userCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(ItemBadge, { $type: "count", children: [
|
|
954
|
-
role.userCount,
|
|
955
|
-
" users"
|
|
956
|
-
] })
|
|
957
|
-
]
|
|
958
|
-
},
|
|
959
|
-
role.id
|
|
960
|
-
)) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "16px", textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "No roles available" }) }) }),
|
|
961
|
-
/* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { children: "Share with Users" }),
|
|
962
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectionList, { $disabled: isPublic, children: loadingUsers ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "16px", textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Loading..." }) }) : availableUsers.length > 0 ? availableUsers.map((user) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
963
|
-
SelectionItem,
|
|
964
|
-
{
|
|
965
|
-
$selected: sharedWithUsers.includes(user.id),
|
|
966
|
-
onClick: () => !isPublic && toggleUser(user.id),
|
|
967
|
-
children: [
|
|
968
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomCheckbox, { $checked: sharedWithUsers.includes(user.id), children: /* @__PURE__ */ jsxRuntime.jsx(outline.CheckCircleIcon, {}) }),
|
|
969
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ItemLabel, { $selected: sharedWithUsers.includes(user.id), children: [
|
|
970
|
-
user.firstname || "",
|
|
971
|
-
" ",
|
|
972
|
-
user.lastname || ""
|
|
973
|
-
] }),
|
|
974
|
-
/* @__PURE__ */ jsxRuntime.jsx(ItemBadge, { children: user.email })
|
|
975
|
-
]
|
|
976
|
-
},
|
|
977
|
-
user.id
|
|
978
|
-
)) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "16px", textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "No other users" }) }) })
|
|
979
|
-
] })
|
|
980
|
-
] }),
|
|
981
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
|
|
982
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SectionHeader, { onClick: () => setFiltersSectionOpen(!filtersSectionOpen), children: [
|
|
983
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SectionTitle, { children: [
|
|
984
|
-
/* @__PURE__ */ jsxRuntime.jsx(outline.FunnelIcon, {}),
|
|
985
|
-
formatMessage({ id: `${pluginId2}.form.filterPreview`, defaultMessage: "Captured Filters" })
|
|
986
|
-
] }),
|
|
987
|
-
/* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { $collapsed: !filtersSectionOpen, children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronDownIcon, {}) })
|
|
988
|
-
] }),
|
|
989
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SectionContent, { $collapsed: !filtersSectionOpen, children: [
|
|
990
|
-
/* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { children: "Content Manager Path" }),
|
|
991
|
-
/* @__PURE__ */ jsxRuntime.jsx(PathDisplay, { children: path || "No path captured" }),
|
|
992
|
-
/* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { children: "Active Filters" }),
|
|
993
|
-
/* @__PURE__ */ jsxRuntime.jsx(FilterPreview, { query }),
|
|
994
|
-
/* @__PURE__ */ jsxRuntime.jsxs(HintText, { children: [
|
|
995
|
-
/* @__PURE__ */ jsxRuntime.jsx(outline.LightBulbIcon, {}),
|
|
996
|
-
"These filters will be restored when you click this bookmark"
|
|
997
|
-
] })
|
|
998
|
-
] })
|
|
999
|
-
] }),
|
|
1000
|
-
/* @__PURE__ */ jsxRuntime.jsxs(FormField, { children: [
|
|
1001
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { children: [
|
|
1002
|
-
formatMessage({ id: `${pluginId2}.form.description`, defaultMessage: "Description" }),
|
|
1003
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 400, color: "var(--colors-neutral600, #666687)" }, children: " (Optional)" })
|
|
1004
|
-
] }),
|
|
1005
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1006
|
-
StyledTextarea,
|
|
1007
|
-
{
|
|
1008
|
-
placeholder: formatMessage({ id: `${pluginId2}.form.descriptionPlaceholder`, defaultMessage: "Add a description..." }),
|
|
1009
|
-
value: description,
|
|
1010
|
-
onChange: (e) => setDescription(e.target.value)
|
|
1011
|
-
}
|
|
1012
|
-
)
|
|
1013
|
-
] })
|
|
1014
|
-
] }),
|
|
1015
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ModalFooter$1, { children: [
|
|
1016
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({ id: `${pluginId2}.button.cancel`, defaultMessage: "Cancel" }) }),
|
|
1017
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleSubmit, loading: isSubmitting, children: isEditing ? formatMessage({ id: `${pluginId2}.button.update`, defaultMessage: "Update" }) : formatMessage({ id: `${pluginId2}.button.save`, defaultMessage: "Save Bookmark" }) })
|
|
1018
|
-
] })
|
|
1019
|
-
] }) });
|
|
1020
|
-
};
|
|
1021
|
-
const fadeIn = styled.keyframes`
|
|
1022
|
-
from { opacity: 0; transform: translateY(-8px); }
|
|
1023
|
-
to { opacity: 1; transform: translateY(0); }
|
|
1024
|
-
`;
|
|
1025
|
-
const PopoverContainer = styled__default.default.div`
|
|
1026
|
-
position: absolute;
|
|
1027
|
-
top: calc(100% + 8px);
|
|
1028
|
-
right: 0;
|
|
1029
|
-
min-width: 280px;
|
|
1030
|
-
max-width: 360px;
|
|
1031
|
-
max-height: 400px;
|
|
1032
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
1033
|
-
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
1034
|
-
border-radius: 8px;
|
|
1035
|
-
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
|
|
1036
|
-
z-index: 1000;
|
|
1037
|
-
animation: ${fadeIn} 0.2s ease-out;
|
|
1038
|
-
overflow: hidden;
|
|
1039
|
-
`;
|
|
1040
|
-
const PopoverHeader = styled__default.default.div`
|
|
1041
|
-
padding: 12px 16px;
|
|
1042
|
-
background: linear-gradient(135deg, #4945FF 0%, #7B79FF 100%);
|
|
1043
|
-
border-bottom: 1px solid rgba(128, 128, 128, 0.25);
|
|
1044
|
-
display: flex;
|
|
1045
|
-
align-items: center;
|
|
1046
|
-
gap: 8px;
|
|
1047
|
-
|
|
1048
|
-
svg {
|
|
1049
|
-
width: 16px;
|
|
1050
|
-
height: 16px;
|
|
1051
|
-
color: white;
|
|
1052
|
-
}
|
|
1053
|
-
`;
|
|
1054
|
-
const PopoverTitle = styled__default.default.span`
|
|
1055
|
-
font-size: 13px;
|
|
1056
|
-
font-weight: 600;
|
|
1057
|
-
color: white;
|
|
1058
|
-
`;
|
|
1059
|
-
const PopoverCount = styled__default.default.span`
|
|
1060
|
-
font-size: 11px;
|
|
1061
|
-
color: rgba(255, 255, 255, 0.8);
|
|
1062
|
-
margin-left: auto;
|
|
1063
|
-
`;
|
|
1064
|
-
const BookmarksList = styled__default.default.div`
|
|
1065
|
-
max-height: 300px;
|
|
1066
|
-
overflow-y: auto;
|
|
1067
|
-
padding: 8px;
|
|
1068
|
-
|
|
1069
|
-
&::-webkit-scrollbar {
|
|
1070
|
-
width: 6px;
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
&::-webkit-scrollbar-track {
|
|
1074
|
-
background: rgba(128, 128, 128, 0.12);
|
|
1075
|
-
border-radius: 3px;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
&::-webkit-scrollbar-thumb {
|
|
1079
|
-
background: #c0c0cf;
|
|
1080
|
-
border-radius: 3px;
|
|
1081
|
-
}
|
|
1082
|
-
`;
|
|
1083
|
-
const BookmarkItem = styled__default.default.button`
|
|
1084
|
-
width: 100%;
|
|
1085
|
-
display: flex;
|
|
1086
|
-
align-items: center;
|
|
1087
|
-
gap: 10px;
|
|
1088
|
-
padding: 10px 12px;
|
|
1089
|
-
border: none;
|
|
1090
|
-
border-radius: 6px;
|
|
1091
|
-
background: ${(props) => props.$isPinned ? "#fffbeb" : "transparent"};
|
|
1092
|
-
cursor: pointer;
|
|
1093
|
-
transition: all 0.15s ease;
|
|
1094
|
-
text-align: left;
|
|
1095
|
-
|
|
1096
|
-
&:hover {
|
|
1097
|
-
background: ${(props) => props.$isPinned ? "#fef3c7" : "#f6f6f9"};
|
|
1098
|
-
|
|
1099
|
-
.arrow-icon {
|
|
1100
|
-
opacity: 1;
|
|
1101
|
-
transform: translateX(0);
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
&:active {
|
|
1106
|
-
transform: scale(0.98);
|
|
1107
|
-
}
|
|
1108
|
-
`;
|
|
1109
|
-
const BookmarkIconWrapper = styled__default.default.div`
|
|
1110
|
-
display: flex;
|
|
1111
|
-
align-items: center;
|
|
1112
|
-
justify-content: center;
|
|
1113
|
-
width: 32px;
|
|
1114
|
-
height: 32px;
|
|
1115
|
-
background: linear-gradient(135deg, #EEF0FF 0%, #E0E7FF 100%);
|
|
1116
|
-
border-radius: 6px;
|
|
1117
|
-
flex-shrink: 0;
|
|
1118
|
-
|
|
1119
|
-
svg {
|
|
1120
|
-
width: 16px;
|
|
1121
|
-
height: 16px;
|
|
1122
|
-
color: #4945FF;
|
|
1123
|
-
}
|
|
1124
|
-
`;
|
|
1125
|
-
const BookmarkContent = styled__default.default.div`
|
|
1126
|
-
flex: 1;
|
|
1127
|
-
min-width: 0;
|
|
1128
|
-
`;
|
|
1129
|
-
const BookmarkName = styled__default.default.div`
|
|
1130
|
-
font-size: 13px;
|
|
1131
|
-
font-weight: 500;
|
|
1132
|
-
color: ${(p) => p.theme.colors.neutral800};
|
|
1133
|
-
white-space: nowrap;
|
|
1134
|
-
overflow: hidden;
|
|
1135
|
-
text-overflow: ellipsis;
|
|
1136
|
-
`;
|
|
1137
|
-
const BookmarkDescription = styled__default.default.div`
|
|
1138
|
-
font-size: 11px;
|
|
1139
|
-
color: ${(p) => p.theme.colors.neutral500};
|
|
1140
|
-
white-space: nowrap;
|
|
1141
|
-
overflow: hidden;
|
|
1142
|
-
text-overflow: ellipsis;
|
|
1143
|
-
margin-top: 2px;
|
|
1144
|
-
`;
|
|
1145
|
-
const ArrowIcon = styled__default.default.div`
|
|
1146
|
-
opacity: 0;
|
|
1147
|
-
transform: translateX(-4px);
|
|
1148
|
-
transition: all 0.15s ease;
|
|
1149
|
-
color: #4945FF;
|
|
1150
|
-
|
|
1151
|
-
svg {
|
|
1152
|
-
width: 14px;
|
|
1153
|
-
height: 14px;
|
|
1154
|
-
}
|
|
1155
|
-
`;
|
|
1156
|
-
const PinIcon = styled__default.default.div`
|
|
1157
|
-
color: #f59e0b;
|
|
1158
|
-
flex-shrink: 0;
|
|
1159
|
-
|
|
1160
|
-
svg {
|
|
1161
|
-
width: 12px;
|
|
1162
|
-
height: 12px;
|
|
1163
|
-
}
|
|
1164
|
-
`;
|
|
1165
|
-
const EmptyState = styled__default.default.div`
|
|
1166
|
-
padding: 24px 16px;
|
|
1167
|
-
text-align: center;
|
|
1168
|
-
`;
|
|
1169
|
-
const EmptyIcon = styled__default.default.div`
|
|
1170
|
-
width: 48px;
|
|
1171
|
-
height: 48px;
|
|
1172
|
-
margin: 0 auto 12px;
|
|
1173
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
1174
|
-
border-radius: 50%;
|
|
1175
|
-
display: flex;
|
|
1176
|
-
align-items: center;
|
|
1177
|
-
justify-content: center;
|
|
1178
|
-
|
|
1179
|
-
svg {
|
|
1180
|
-
width: 24px;
|
|
1181
|
-
height: 24px;
|
|
1182
|
-
color: ${(p) => p.theme.colors.neutral500};
|
|
1183
|
-
}
|
|
1184
|
-
`;
|
|
1185
|
-
const PopoverFooter = styled__default.default.div`
|
|
1186
|
-
padding: 10px 16px;
|
|
1187
|
-
border-top: 1px solid rgba(128, 128, 128, 0.2);
|
|
1188
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
1189
|
-
`;
|
|
1190
|
-
const ViewAllLink = styled__default.default.button`
|
|
1191
|
-
width: 100%;
|
|
1192
|
-
display: flex;
|
|
1193
|
-
align-items: center;
|
|
1194
|
-
justify-content: center;
|
|
1195
|
-
gap: 6px;
|
|
1196
|
-
padding: 8px;
|
|
1197
|
-
border: none;
|
|
1198
|
-
border-radius: 4px;
|
|
1199
|
-
background: transparent;
|
|
1200
|
-
color: #4945FF;
|
|
1201
|
-
font-size: 13px;
|
|
1202
|
-
font-weight: 500;
|
|
1203
|
-
cursor: pointer;
|
|
1204
|
-
transition: all 0.15s ease;
|
|
1205
|
-
|
|
1206
|
-
&:hover {
|
|
1207
|
-
background: rgba(73, 69, 255, 0.08);
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
svg {
|
|
1211
|
-
width: 14px;
|
|
1212
|
-
height: 14px;
|
|
1213
|
-
}
|
|
1214
|
-
`;
|
|
1215
|
-
const ViewsListPopover = ({
|
|
1216
|
-
views,
|
|
1217
|
-
onViewClick,
|
|
1218
|
-
isLoading = false
|
|
1219
|
-
}) => {
|
|
1220
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
1221
|
-
const navigate = reactRouterDom.useNavigate();
|
|
1222
|
-
const sortedViews = [...views].sort((a, b) => {
|
|
1223
|
-
if (a.isPinned && !b.isPinned) return -1;
|
|
1224
|
-
if (!a.isPinned && b.isPinned) return 1;
|
|
1225
|
-
return a.name.localeCompare(b.name);
|
|
1226
|
-
});
|
|
1227
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(PopoverContainer, { children: [
|
|
1228
|
-
/* @__PURE__ */ jsxRuntime.jsxs(PopoverHeader, { children: [
|
|
1229
|
-
/* @__PURE__ */ jsxRuntime.jsx(outline.BookmarkIcon, {}),
|
|
1230
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTitle, { children: "Your Bookmarks" }),
|
|
1231
|
-
/* @__PURE__ */ jsxRuntime.jsxs(PopoverCount, { children: [
|
|
1232
|
-
views.length,
|
|
1233
|
-
" saved"
|
|
1234
|
-
] })
|
|
1235
|
-
] }),
|
|
1236
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: "Loading..." }) }) : views && views.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1237
|
-
/* @__PURE__ */ jsxRuntime.jsx(BookmarksList, { children: sortedViews.map((view) => {
|
|
1238
|
-
const IconComponent = getIconById(view.icon || view.emoji || "bookmark");
|
|
1239
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1240
|
-
BookmarkItem,
|
|
1241
|
-
{
|
|
1242
|
-
$isPinned: view.isPinned,
|
|
1243
|
-
onClick: () => onViewClick(view),
|
|
1244
|
-
children: [
|
|
1245
|
-
/* @__PURE__ */ jsxRuntime.jsx(BookmarkIconWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }),
|
|
1246
|
-
/* @__PURE__ */ jsxRuntime.jsxs(BookmarkContent, { children: [
|
|
1247
|
-
/* @__PURE__ */ jsxRuntime.jsx(BookmarkName, { children: view.name }),
|
|
1248
|
-
view.description && /* @__PURE__ */ jsxRuntime.jsx(BookmarkDescription, { children: view.description })
|
|
1249
|
-
] }),
|
|
1250
|
-
view.isPinned && /* @__PURE__ */ jsxRuntime.jsx(PinIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.Pin, {}) }),
|
|
1251
|
-
/* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { className: "arrow-icon", children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowRight, {}) })
|
|
1252
|
-
]
|
|
1253
|
-
},
|
|
1254
|
-
view.id
|
|
1255
|
-
);
|
|
1256
|
-
}) }),
|
|
1257
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverFooter, { children: /* @__PURE__ */ jsxRuntime.jsxs(ViewAllLink, { onClick: () => navigate(`/plugins/${pluginId}`), children: [
|
|
1258
|
-
/* @__PURE__ */ jsxRuntime.jsx(outline.BookmarkIcon, {}),
|
|
1259
|
-
"Manage all bookmarks"
|
|
1260
|
-
] }) })
|
|
1261
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(EmptyState, { children: [
|
|
1262
|
-
/* @__PURE__ */ jsxRuntime.jsx(EmptyIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(outline.BookmarkIcon, {}) }),
|
|
1263
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage({
|
|
1264
|
-
id: `${pluginId}.ViewsWidget.ViewsPopover.emptyList`,
|
|
1265
|
-
defaultMessage: "No bookmarks yet. Save your first view!"
|
|
1266
|
-
}) })
|
|
1267
|
-
] })
|
|
1268
|
-
] });
|
|
1269
|
-
};
|
|
1270
|
-
const WidgetContainer = styled__default.default.div`
|
|
1271
|
-
display: flex;
|
|
1272
|
-
align-items: center;
|
|
1273
|
-
gap: 8px;
|
|
1274
|
-
margin-right: 8px;
|
|
1275
|
-
`;
|
|
1276
|
-
const ActionButton = styled__default.default.button`
|
|
1277
|
-
display: inline-flex;
|
|
1278
|
-
align-items: center;
|
|
1279
|
-
justify-content: center;
|
|
1280
|
-
gap: 6px;
|
|
1281
|
-
height: 36px;
|
|
1282
|
-
padding: 0 14px;
|
|
1283
|
-
font-size: 13px;
|
|
1284
|
-
font-weight: 500;
|
|
1285
|
-
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
1286
|
-
border-radius: 4px;
|
|
1287
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
1288
|
-
color: ${(p) => p.theme.colors.neutral800};
|
|
1289
|
-
cursor: pointer;
|
|
1290
|
-
transition: all 0.15s ease;
|
|
1291
|
-
white-space: nowrap;
|
|
1292
|
-
|
|
1293
|
-
&:hover {
|
|
1294
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
1295
|
-
border-color: rgba(128, 128, 128, 0.3);
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
&:active {
|
|
1299
|
-
transform: scale(0.98);
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
svg {
|
|
1303
|
-
width: 16px;
|
|
1304
|
-
height: 16px;
|
|
1305
|
-
flex-shrink: 0;
|
|
1306
|
-
}
|
|
1307
|
-
`;
|
|
1308
|
-
const MagicMarkButton = styled__default.default.button`
|
|
1309
|
-
display: inline-flex;
|
|
1310
|
-
align-items: center;
|
|
1311
|
-
justify-content: center;
|
|
1312
|
-
width: 32px;
|
|
1313
|
-
height: 32px;
|
|
1314
|
-
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
1315
|
-
border-radius: 4px;
|
|
1316
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
1317
|
-
color: ${(p) => p.theme.colors.neutral800};
|
|
1318
|
-
cursor: pointer;
|
|
1319
|
-
transition: all 0.15s ease;
|
|
1320
|
-
position: relative;
|
|
1321
|
-
|
|
1322
|
-
&:hover {
|
|
1323
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
1324
|
-
border-color: rgba(128, 128, 128, 0.3);
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
&:active {
|
|
1328
|
-
transform: scale(0.98);
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
svg {
|
|
1332
|
-
width: 18px;
|
|
1333
|
-
height: 18px;
|
|
1334
|
-
flex-shrink: 0;
|
|
1335
|
-
color: ${(p) => p.theme.colors.neutral600};
|
|
1336
|
-
}
|
|
1337
|
-
`;
|
|
1338
|
-
const MagicMarkWrapper = styled__default.default.div`
|
|
1339
|
-
position: relative;
|
|
1340
|
-
`;
|
|
1341
|
-
const Badge = styled__default.default.span`
|
|
1342
|
-
position: absolute;
|
|
1343
|
-
top: -6px;
|
|
1344
|
-
right: -6px;
|
|
1345
|
-
display: inline-flex;
|
|
1346
|
-
align-items: center;
|
|
1347
|
-
justify-content: center;
|
|
1348
|
-
min-width: 18px;
|
|
1349
|
-
height: 18px;
|
|
1350
|
-
padding: 0 5px;
|
|
1351
|
-
font-size: 10px;
|
|
1352
|
-
font-weight: 700;
|
|
1353
|
-
background: #4945FF;
|
|
1354
|
-
color: #ffffff;
|
|
1355
|
-
border-radius: 9px;
|
|
1356
|
-
border: 2px solid #ffffff;
|
|
1357
|
-
box-shadow: 0 1px 3px rgba(0,0,0,0.15);
|
|
1358
|
-
`;
|
|
1359
|
-
const ViewsWidget = () => {
|
|
1360
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
1361
|
-
const navigate = reactRouterDom.useNavigate();
|
|
1362
|
-
const { get } = admin.useFetchClient();
|
|
1363
|
-
const viewsButtonRef = React.useRef(null);
|
|
1364
|
-
const [showCreateModal, setShowCreateModal] = React__default.default.useState(false);
|
|
1365
|
-
const [viewsPopoverVisible, setViewsPopoverVisible] = React__default.default.useState(false);
|
|
1366
|
-
const [bookmarks, setBookmarks] = React__default.default.useState([]);
|
|
1367
|
-
const [isLoadingViews, setIsLoadingViews] = React__default.default.useState(false);
|
|
1368
|
-
const [currentPath, setCurrentPath] = React__default.default.useState("");
|
|
1369
|
-
const [currentQuery, setCurrentQuery] = React__default.default.useState("");
|
|
1370
|
-
const getBookmarks = async () => {
|
|
1371
|
-
setIsLoadingViews(true);
|
|
1372
|
-
const url = `/magic-mark/bookmarks`;
|
|
1373
|
-
try {
|
|
1374
|
-
const { data } = await get(url);
|
|
1375
|
-
setBookmarks(data.data || []);
|
|
1376
|
-
} catch (error) {
|
|
1377
|
-
console.error("[Magic-Mark] Error fetching bookmarks:", error);
|
|
1378
|
-
setBookmarks([]);
|
|
1379
|
-
} finally {
|
|
1380
|
-
setIsLoadingViews(false);
|
|
1381
|
-
}
|
|
1382
|
-
};
|
|
1383
|
-
const handleOpenModal = () => {
|
|
1384
|
-
let path = window.location.pathname;
|
|
1385
|
-
if (path.startsWith("/admin/")) {
|
|
1386
|
-
path = path.substring(6);
|
|
1387
|
-
}
|
|
1388
|
-
const query = window.location.search.substring(1);
|
|
1389
|
-
setCurrentPath(path);
|
|
1390
|
-
setCurrentQuery(query);
|
|
1391
|
-
setShowCreateModal(true);
|
|
1392
|
-
};
|
|
1393
|
-
React__default.default.useEffect(() => {
|
|
1394
|
-
getBookmarks();
|
|
1395
|
-
}, [showCreateModal]);
|
|
1396
|
-
const handleBookmarkClick = (bookmark) => {
|
|
1397
|
-
if (bookmark.path && bookmark.query) {
|
|
1398
|
-
navigate(`${bookmark.path}?${bookmark.query}`);
|
|
1399
|
-
} else if (bookmark.path) {
|
|
1400
|
-
navigate(bookmark.path);
|
|
1401
|
-
}
|
|
1402
|
-
setViewsPopoverVisible(false);
|
|
1403
|
-
};
|
|
1404
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(WidgetContainer, { children: [
|
|
1405
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1406
|
-
ActionButton,
|
|
1407
|
-
{
|
|
1408
|
-
onClick: handleOpenModal,
|
|
1409
|
-
title: formatMessage({
|
|
1410
|
-
id: `${pluginId}.ViewsWidget.actions.create`,
|
|
1411
|
-
defaultMessage: "Save current view as bookmark"
|
|
1412
|
-
}),
|
|
1413
|
-
children: [
|
|
1414
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
1415
|
-
"Save"
|
|
1416
|
-
]
|
|
1417
|
-
}
|
|
1418
|
-
),
|
|
1419
|
-
/* @__PURE__ */ jsxRuntime.jsxs(MagicMarkWrapper, { children: [
|
|
1420
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1421
|
-
MagicMarkButton,
|
|
1422
|
-
{
|
|
1423
|
-
ref: viewsButtonRef,
|
|
1424
|
-
onClick: () => setViewsPopoverVisible((s) => !s),
|
|
1425
|
-
title: "MagicMark Bookmarks",
|
|
1426
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(outline.BookmarkIcon, {})
|
|
1427
|
-
}
|
|
1428
|
-
),
|
|
1429
|
-
bookmarks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: bookmarks.length }),
|
|
1430
|
-
viewsPopoverVisible && viewsButtonRef.current && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1431
|
-
ViewsListPopover,
|
|
1432
|
-
{
|
|
1433
|
-
views: bookmarks,
|
|
1434
|
-
onViewClick: handleBookmarkClick,
|
|
1435
|
-
isLoading: isLoadingViews,
|
|
1436
|
-
buttonElement: viewsButtonRef.current
|
|
1437
|
-
}
|
|
1438
|
-
)
|
|
1439
|
-
] }),
|
|
1440
|
-
showCreateModal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1441
|
-
CreateEditModal,
|
|
1442
|
-
{
|
|
1443
|
-
bookmark: null,
|
|
1444
|
-
pluginId,
|
|
1445
|
-
onClose: () => setShowCreateModal(false),
|
|
1446
|
-
onSuccess: () => {
|
|
1447
|
-
setShowCreateModal(false);
|
|
1448
|
-
getBookmarks();
|
|
1449
|
-
},
|
|
1450
|
-
currentPath,
|
|
1451
|
-
currentQuery
|
|
1452
|
-
}
|
|
1453
|
-
)
|
|
1454
|
-
] });
|
|
1455
|
-
};
|
|
1456
|
-
const SelectContainer = styled__default.default.div`
|
|
1457
|
-
position: relative;
|
|
1458
|
-
width: 100%;
|
|
1459
|
-
`;
|
|
1460
|
-
const SelectButton = styled__default.default.button`
|
|
1461
|
-
width: 100%;
|
|
1462
|
-
height: 32px;
|
|
1463
|
-
padding: 0 36px 0 12px;
|
|
1464
|
-
border: 1px solid ${(props) => props.$isOpen ? "#4945ff" : "rgba(128, 128, 128, 0.25)"};
|
|
1465
|
-
border-radius: 4px;
|
|
1466
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
1467
|
-
font-size: 14px;
|
|
1468
|
-
text-align: left;
|
|
1469
|
-
cursor: pointer;
|
|
1470
|
-
display: flex;
|
|
1471
|
-
align-items: center;
|
|
1472
|
-
justify-content: space-between;
|
|
1473
|
-
transition: all 0.2s ease;
|
|
1474
|
-
|
|
1475
|
-
&:hover {
|
|
1476
|
-
border-color: #4945ff;
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
&:focus {
|
|
1480
|
-
outline: none;
|
|
1481
|
-
border-color: #4945ff;
|
|
1482
|
-
box-shadow: 0 0 0 2px rgba(73, 69, 255, 0.1);
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
@media (max-width: 768px) {
|
|
1486
|
-
height: 32px;
|
|
1487
|
-
padding: 0 32px 0 10px;
|
|
1488
|
-
font-size: 13px;
|
|
1489
|
-
}
|
|
1490
|
-
`;
|
|
1491
|
-
const SelectText = styled__default.default.span`
|
|
1492
|
-
color: ${(props) => props.$isPlaceholder ? props.theme.colors.neutral500 : props.theme.colors.neutral800};
|
|
1493
|
-
overflow: hidden;
|
|
1494
|
-
text-overflow: ellipsis;
|
|
1495
|
-
white-space: nowrap;
|
|
1496
|
-
`;
|
|
1497
|
-
const IconWrapper = styled__default.default.span`
|
|
1498
|
-
position: absolute;
|
|
1499
|
-
right: 12px;
|
|
1500
|
-
top: 50%;
|
|
1501
|
-
transform: translateY(-50%) ${(props) => props.$isOpen ? "rotate(180deg)" : "rotate(0deg)"};
|
|
1502
|
-
transition: transform 0.2s ease;
|
|
1503
|
-
display: flex;
|
|
1504
|
-
align-items: center;
|
|
1505
|
-
pointer-events: none;
|
|
1506
|
-
color: ${(p) => p.theme.colors.neutral500};
|
|
1507
|
-
`;
|
|
1508
|
-
const DropdownList = styled__default.default.div`
|
|
1509
|
-
position: fixed;
|
|
1510
|
-
top: ${(props) => props.top}px;
|
|
1511
|
-
left: ${(props) => props.left}px;
|
|
1512
|
-
width: ${(props) => props.width}px;
|
|
1513
|
-
max-height: 400px;
|
|
1514
|
-
overflow-y: auto;
|
|
1515
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
1516
|
-
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
1517
|
-
border-radius: 4px;
|
|
1518
|
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
1519
|
-
z-index: 10000;
|
|
1520
|
-
display: ${(props) => props.$isOpen ? "block" : "none"};
|
|
1521
|
-
|
|
1522
|
-
@media (max-width: 768px) {
|
|
1523
|
-
max-height: 320px;
|
|
1524
|
-
}
|
|
1525
|
-
`;
|
|
1526
|
-
const DropdownItem = styled__default.default.button`
|
|
1527
|
-
width: 100%;
|
|
1528
|
-
padding: 10px 12px;
|
|
1529
|
-
border: none;
|
|
1530
|
-
background: ${(props) => props.$isSelected ? "rgba(73, 69, 255, 0.06)" : props.theme.colors.neutral0};
|
|
1531
|
-
text-align: left;
|
|
1532
|
-
cursor: pointer;
|
|
1533
|
-
font-size: 14px;
|
|
1534
|
-
color: ${(props) => props.$isSelected ? "#4945ff" : props.theme.colors.neutral800};
|
|
1535
|
-
transition: background 0.15s ease;
|
|
1536
|
-
|
|
1537
|
-
&:hover {
|
|
1538
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
&:focus {
|
|
1542
|
-
outline: none;
|
|
1543
|
-
background: rgba(73, 69, 255, 0.06);
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
@media (max-width: 768px) {
|
|
1547
|
-
padding: 12px;
|
|
1548
|
-
font-size: 13px;
|
|
1549
|
-
}
|
|
1550
|
-
`;
|
|
1551
|
-
const SearchInput = styled__default.default.input`
|
|
1552
|
-
width: 100%;
|
|
1553
|
-
padding: 10px 12px;
|
|
1554
|
-
border: none;
|
|
1555
|
-
border-bottom: 1px solid rgba(128, 128, 128, 0.25);
|
|
1556
|
-
font-size: 14px;
|
|
1557
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
1558
|
-
color: ${(p) => p.theme.colors.neutral800};
|
|
1559
|
-
|
|
1560
|
-
&:focus {
|
|
1561
|
-
outline: none;
|
|
1562
|
-
border-bottom-color: #4945ff;
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
@media (max-width: 768px) {
|
|
1566
|
-
padding: 12px;
|
|
1567
|
-
font-size: 13px;
|
|
1568
|
-
}
|
|
1569
|
-
`;
|
|
1570
|
-
const CustomSelect = ({
|
|
1571
|
-
value,
|
|
1572
|
-
onChange,
|
|
1573
|
-
options,
|
|
1574
|
-
placeholder = "Select...",
|
|
1575
|
-
searchable = true
|
|
1576
|
-
}) => {
|
|
1577
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
1578
|
-
const [searchTerm, setSearchTerm] = React.useState("");
|
|
1579
|
-
const [dropdownPos, setDropdownPos] = React.useState({ top: 0, left: 0, width: 0 });
|
|
1580
|
-
const containerRef = React.useRef(null);
|
|
1581
|
-
const buttonRef = React.useRef(null);
|
|
1582
|
-
const searchInputRef = React.useRef(null);
|
|
1583
|
-
const updatePosition = () => {
|
|
1584
|
-
if (buttonRef.current) {
|
|
1585
|
-
const rect = buttonRef.current.getBoundingClientRect();
|
|
1586
|
-
setDropdownPos({
|
|
1587
|
-
top: rect.bottom + 4,
|
|
1588
|
-
left: rect.left,
|
|
1589
|
-
width: rect.width
|
|
1590
|
-
});
|
|
1591
|
-
}
|
|
1592
|
-
};
|
|
1593
|
-
React.useEffect(() => {
|
|
1594
|
-
if (isOpen) {
|
|
1595
|
-
updatePosition();
|
|
1596
|
-
window.addEventListener("scroll", updatePosition, true);
|
|
1597
|
-
window.addEventListener("resize", updatePosition);
|
|
1598
|
-
return () => {
|
|
1599
|
-
window.removeEventListener("scroll", updatePosition, true);
|
|
1600
|
-
window.removeEventListener("resize", updatePosition);
|
|
1601
|
-
};
|
|
1602
|
-
}
|
|
1603
|
-
}, [isOpen]);
|
|
1604
|
-
React.useEffect(() => {
|
|
1605
|
-
const handleClickOutside = (event) => {
|
|
1606
|
-
const target = event.target;
|
|
1607
|
-
if (containerRef.current && !containerRef.current.contains(target) && !target.closest("[data-dropdown-portal]")) {
|
|
1608
|
-
setIsOpen(false);
|
|
1609
|
-
setSearchTerm("");
|
|
1610
|
-
}
|
|
1611
|
-
};
|
|
1612
|
-
if (isOpen) {
|
|
1613
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
1614
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1615
|
-
}
|
|
1616
|
-
}, [isOpen]);
|
|
1617
|
-
React.useEffect(() => {
|
|
1618
|
-
if (isOpen && searchable && searchInputRef.current) {
|
|
1619
|
-
searchInputRef.current.focus();
|
|
1620
|
-
}
|
|
1621
|
-
}, [isOpen, searchable]);
|
|
1622
|
-
const filteredOptions = searchable && searchTerm ? options.filter(
|
|
1623
|
-
(opt) => opt.label.toLowerCase().includes(searchTerm.toLowerCase())
|
|
1624
|
-
) : options;
|
|
1625
|
-
const selectedOption = options.find((opt) => opt.value === value);
|
|
1626
|
-
const handleSelect = (optionValue) => {
|
|
1627
|
-
console.log("[CustomSelect] Selected:", optionValue);
|
|
1628
|
-
onChange(optionValue);
|
|
1629
|
-
setIsOpen(false);
|
|
1630
|
-
setSearchTerm("");
|
|
1631
|
-
};
|
|
1632
|
-
const dropdownContent = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1633
|
-
DropdownList,
|
|
1634
|
-
{
|
|
1635
|
-
$isOpen: isOpen,
|
|
1636
|
-
top: dropdownPos.top,
|
|
1637
|
-
left: dropdownPos.left,
|
|
1638
|
-
width: dropdownPos.width,
|
|
1639
|
-
"data-dropdown-portal": "true",
|
|
1640
|
-
children: [
|
|
1641
|
-
searchable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1642
|
-
SearchInput,
|
|
1643
|
-
{
|
|
1644
|
-
ref: searchInputRef,
|
|
1645
|
-
type: "text",
|
|
1646
|
-
placeholder: "Search...",
|
|
1647
|
-
value: searchTerm,
|
|
1648
|
-
onChange: (e) => setSearchTerm(e.target.value),
|
|
1649
|
-
onClick: (e) => e.stopPropagation()
|
|
1650
|
-
}
|
|
1651
|
-
),
|
|
1652
|
-
filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "No options found" }) }) : filteredOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1653
|
-
DropdownItem,
|
|
1654
|
-
{
|
|
1655
|
-
type: "button",
|
|
1656
|
-
$isSelected: option.value === value,
|
|
1657
|
-
onClick: () => handleSelect(option.value),
|
|
1658
|
-
children: option.label
|
|
1659
|
-
},
|
|
1660
|
-
option.value
|
|
1661
|
-
))
|
|
1662
|
-
]
|
|
1663
|
-
}
|
|
1664
|
-
);
|
|
1665
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(SelectContainer, { ref: containerRef, children: [
|
|
1666
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1667
|
-
SelectButton,
|
|
1668
|
-
{
|
|
1669
|
-
ref: buttonRef,
|
|
1670
|
-
type: "button",
|
|
1671
|
-
onClick: () => setIsOpen(!isOpen),
|
|
1672
|
-
$isOpen: isOpen,
|
|
1673
|
-
children: [
|
|
1674
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectText, { $isPlaceholder: !value, children: selectedOption?.label || placeholder }),
|
|
1675
|
-
/* @__PURE__ */ jsxRuntime.jsx(IconWrapper, { $isOpen: isOpen, children: "▼" })
|
|
1676
|
-
]
|
|
1677
|
-
}
|
|
1678
|
-
),
|
|
1679
|
-
isOpen && ReactDOM__default.default.createPortal(dropdownContent, document.body)
|
|
1680
|
-
] });
|
|
1681
|
-
};
|
|
1682
|
-
const useRelationSchema = () => {
|
|
1683
|
-
const { get } = admin.useFetchClient();
|
|
1684
|
-
const [loading, setLoading] = React.useState({});
|
|
1685
|
-
const [errors, setErrors] = React.useState({});
|
|
1686
|
-
const cacheRef = React.useRef({});
|
|
1687
|
-
const CACHE_TTL = 5 * 60 * 1e3;
|
|
1688
|
-
const fetchSchema = React.useCallback(async (uid) => {
|
|
1689
|
-
const cached = cacheRef.current[uid];
|
|
1690
|
-
if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
|
|
1691
|
-
console.log("[RelationSchema] Using cached schema for:", uid);
|
|
1692
|
-
return cached.attributes;
|
|
1693
|
-
}
|
|
1694
|
-
setLoading((prev) => ({ ...prev, [uid]: true }));
|
|
1695
|
-
setErrors((prev) => ({ ...prev, [uid]: "" }));
|
|
1696
|
-
try {
|
|
1697
|
-
console.log("[RelationSchema] Fetching schema for:", uid);
|
|
1698
|
-
const response = await get(`/content-type-builder/content-types/${uid}`);
|
|
1699
|
-
const schemaInfo = response.data?.data?.schema || response.data?.schema || {};
|
|
1700
|
-
const attributes = schemaInfo.attributes || {};
|
|
1701
|
-
cacheRef.current[uid] = {
|
|
1702
|
-
attributes,
|
|
1703
|
-
timestamp: Date.now()
|
|
1704
|
-
};
|
|
1705
|
-
console.log("[RelationSchema] Fetched attributes for", uid, ":", Object.keys(attributes));
|
|
1706
|
-
setLoading((prev) => ({ ...prev, [uid]: false }));
|
|
1707
|
-
return attributes;
|
|
1708
|
-
} catch (error) {
|
|
1709
|
-
console.error("[RelationSchema] Error fetching schema for", uid, ":", error);
|
|
1710
|
-
const errorMessage = error.message || "Failed to fetch schema";
|
|
1711
|
-
setErrors((prev) => ({ ...prev, [uid]: errorMessage }));
|
|
1712
|
-
setLoading((prev) => ({ ...prev, [uid]: false }));
|
|
1713
|
-
return null;
|
|
1714
|
-
}
|
|
1715
|
-
}, [get]);
|
|
1716
|
-
const getFilterableFields = React.useCallback(async (uid) => {
|
|
1717
|
-
const attributes = await fetchSchema(uid);
|
|
1718
|
-
if (!attributes) return [];
|
|
1719
|
-
const fields = [];
|
|
1720
|
-
const skipFields = ["createdBy", "updatedBy", "localizations", "locale"];
|
|
1721
|
-
Object.entries(attributes).forEach(([name2, attr]) => {
|
|
1722
|
-
if (skipFields.includes(name2)) return;
|
|
1723
|
-
if (["media", "component", "dynamiczone"].includes(attr.type)) return;
|
|
1724
|
-
const isRelation = attr.type === "relation";
|
|
1725
|
-
fields.push({
|
|
1726
|
-
name: name2,
|
|
1727
|
-
type: attr.type,
|
|
1728
|
-
isRelation,
|
|
1729
|
-
target: isRelation ? attr.target : void 0
|
|
1730
|
-
});
|
|
1731
|
-
});
|
|
1732
|
-
const defaultFields = [
|
|
1733
|
-
{ name: "id", type: "integer", isRelation: false },
|
|
1734
|
-
{ name: "documentId", type: "string", isRelation: false },
|
|
1735
|
-
{ name: "createdAt", type: "datetime", isRelation: false },
|
|
1736
|
-
{ name: "updatedAt", type: "datetime", isRelation: false }
|
|
1737
|
-
];
|
|
1738
|
-
const existingNames = new Set(fields.map((f) => f.name));
|
|
1739
|
-
defaultFields.forEach((df) => {
|
|
1740
|
-
if (!existingNames.has(df.name)) {
|
|
1741
|
-
fields.unshift(df);
|
|
1742
|
-
}
|
|
1743
|
-
});
|
|
1744
|
-
return fields;
|
|
1745
|
-
}, [fetchSchema]);
|
|
1746
|
-
const getRelationFields = React.useCallback(async (relationTarget) => {
|
|
1747
|
-
return getFilterableFields(relationTarget);
|
|
1748
|
-
}, [getFilterableFields]);
|
|
1749
|
-
const clearCache = React.useCallback(() => {
|
|
1750
|
-
cacheRef.current = {};
|
|
1751
|
-
console.log("[RelationSchema] Cache cleared");
|
|
1752
|
-
}, []);
|
|
1753
|
-
const getCachedSchema = React.useCallback((uid) => {
|
|
1754
|
-
const cached = cacheRef.current[uid];
|
|
1755
|
-
if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
|
|
1756
|
-
return cached.attributes;
|
|
1757
|
-
}
|
|
1758
|
-
return null;
|
|
1759
|
-
}, []);
|
|
1760
|
-
return {
|
|
1761
|
-
fetchSchema,
|
|
1762
|
-
getFilterableFields,
|
|
1763
|
-
getRelationFields,
|
|
1764
|
-
clearCache,
|
|
1765
|
-
getCachedSchema,
|
|
1766
|
-
loading,
|
|
1767
|
-
errors
|
|
1768
|
-
};
|
|
1769
|
-
};
|
|
1770
|
-
const BASE_FILTERS = [
|
|
1771
|
-
{ value: "eq", label: "is" },
|
|
1772
|
-
{ value: "ne", label: "is not" },
|
|
1773
|
-
{ value: "null", label: "is null" },
|
|
1774
|
-
{ value: "notNull", label: "is not null" }
|
|
1775
|
-
];
|
|
1776
|
-
const NUMERIC_FILTERS = [
|
|
1777
|
-
{ value: "gt", label: "is greater than" },
|
|
1778
|
-
{ value: "gte", label: "is greater than or equal to" },
|
|
1779
|
-
{ value: "lt", label: "is less than" },
|
|
1780
|
-
{ value: "lte", label: "is less than or equal to" }
|
|
1781
|
-
];
|
|
1782
|
-
const CONTAINS_FILTERS = [
|
|
1783
|
-
{ value: "contains", label: "contains" },
|
|
1784
|
-
{ value: "containsi", label: "contains (case insensitive)" },
|
|
1785
|
-
{ value: "notContains", label: "not contains" },
|
|
1786
|
-
{ value: "notContainsi", label: "not contains (case insensitive)" }
|
|
1787
|
-
];
|
|
1788
|
-
const STRING_PARSE_FILTERS = [
|
|
1789
|
-
{ value: "startsWith", label: "starts with" },
|
|
1790
|
-
{ value: "startsWithi", label: "starts with (case insensitive)" },
|
|
1791
|
-
{ value: "endsWith", label: "ends with" },
|
|
1792
|
-
{ value: "endsWithi", label: "ends with (case insensitive)" }
|
|
1793
|
-
];
|
|
1794
|
-
const IS_SENSITIVE_FILTERS = [
|
|
1795
|
-
{ value: "eqi", label: "is (case insensitive)" },
|
|
1796
|
-
{ value: "nei", label: "is not (case insensitive)" }
|
|
1797
|
-
];
|
|
1798
|
-
const ARRAY_FILTERS = [
|
|
1799
|
-
{ value: "in", label: "is in" },
|
|
1800
|
-
{ value: "notIn", label: "is not in" }
|
|
1801
|
-
];
|
|
1802
|
-
const RANGE_FILTERS = [
|
|
1803
|
-
{ value: "between", label: "is between" }
|
|
1804
|
-
];
|
|
1805
|
-
function getOperatorsForType(fieldType) {
|
|
1806
|
-
const t = (fieldType || "string").toLowerCase();
|
|
1807
|
-
if (["string", "text", "email", "uid", "richtext"].includes(t)) {
|
|
1808
|
-
return [
|
|
1809
|
-
...BASE_FILTERS,
|
|
1810
|
-
...IS_SENSITIVE_FILTERS,
|
|
1811
|
-
...CONTAINS_FILTERS,
|
|
1812
|
-
...STRING_PARSE_FILTERS,
|
|
1813
|
-
...ARRAY_FILTERS
|
|
1814
|
-
];
|
|
1815
|
-
}
|
|
1816
|
-
if (["integer", "float", "decimal", "biginteger"].includes(t)) {
|
|
1817
|
-
return [
|
|
1818
|
-
...BASE_FILTERS,
|
|
1819
|
-
...NUMERIC_FILTERS,
|
|
1820
|
-
...ARRAY_FILTERS,
|
|
1821
|
-
...RANGE_FILTERS
|
|
1822
|
-
];
|
|
1823
|
-
}
|
|
1824
|
-
if (["datetime"].includes(t)) {
|
|
1825
|
-
return [
|
|
1826
|
-
...BASE_FILTERS,
|
|
1827
|
-
...NUMERIC_FILTERS,
|
|
1828
|
-
...RANGE_FILTERS
|
|
1829
|
-
];
|
|
1830
|
-
}
|
|
1831
|
-
if (["date", "time"].includes(t)) {
|
|
1832
|
-
return [
|
|
1833
|
-
...BASE_FILTERS,
|
|
1834
|
-
...NUMERIC_FILTERS,
|
|
1835
|
-
...CONTAINS_FILTERS,
|
|
1836
|
-
...RANGE_FILTERS
|
|
1837
|
-
];
|
|
1838
|
-
}
|
|
1839
|
-
if (["boolean"].includes(t)) {
|
|
1840
|
-
return BASE_FILTERS;
|
|
1841
|
-
}
|
|
1842
|
-
if (["enumeration"].includes(t)) {
|
|
1843
|
-
return [...BASE_FILTERS, ...ARRAY_FILTERS];
|
|
1844
|
-
}
|
|
1845
|
-
return [...BASE_FILTERS, ...IS_SENSITIVE_FILTERS];
|
|
1846
|
-
}
|
|
1847
|
-
const buildFilterFromPath = (fieldPath, operator, value, valueTo, negate) => {
|
|
1848
|
-
const parts = fieldPath.split(".").filter(Boolean);
|
|
1849
|
-
if (parts.length === 0) return {};
|
|
1850
|
-
const opKey = operator.startsWith("$") ? operator : `$${operator}`;
|
|
1851
|
-
let filterValue;
|
|
1852
|
-
if (["null", "notNull"].includes(operator)) {
|
|
1853
|
-
filterValue = true;
|
|
1854
|
-
} else if (["in", "notIn"].includes(operator)) {
|
|
1855
|
-
filterValue = value.split(",").map((v) => v.trim()).filter(Boolean);
|
|
1856
|
-
} else if (operator === "between" && valueTo) {
|
|
1857
|
-
filterValue = [value, valueTo];
|
|
1858
|
-
} else {
|
|
1859
|
-
filterValue = value;
|
|
1860
|
-
}
|
|
1861
|
-
let result;
|
|
1862
|
-
if (parts.length === 1) {
|
|
1863
|
-
result = { [parts[0]]: { [opKey]: filterValue } };
|
|
1864
|
-
} else {
|
|
1865
|
-
const [first, ...rest] = parts;
|
|
1866
|
-
result = {
|
|
1867
|
-
[first]: buildFilterFromPath(rest.join("."), operator, value, valueTo, false)
|
|
1868
|
-
};
|
|
1869
|
-
}
|
|
1870
|
-
if (negate) {
|
|
1871
|
-
return { $not: result };
|
|
1872
|
-
}
|
|
1873
|
-
return result;
|
|
1874
|
-
};
|
|
1875
|
-
const extractRelationFromField = (field) => {
|
|
1876
|
-
if (!field || !field.includes(".")) return null;
|
|
1877
|
-
return field.split(".")[0];
|
|
1878
|
-
};
|
|
1879
|
-
const rowsToFilterStructure = (rows, connectors) => {
|
|
1880
|
-
const validRows = rows.filter((r) => {
|
|
1881
|
-
if (!r.field) return false;
|
|
1882
|
-
const needsValue = !["null", "notNull"].includes(r.operator);
|
|
1883
|
-
return !needsValue || r.value && r.value.trim() !== "";
|
|
1884
|
-
});
|
|
1885
|
-
if (validRows.length === 0) return void 0;
|
|
1886
|
-
if (validRows.length === 1) {
|
|
1887
|
-
return buildFilterFromPath(validRows[0].field, validRows[0].operator, validRows[0].value, validRows[0].valueTo, validRows[0].negate);
|
|
1888
|
-
}
|
|
1889
|
-
const groups = [];
|
|
1890
|
-
let currentAndGroup = [];
|
|
1891
|
-
validRows.forEach((row, i) => {
|
|
1892
|
-
const filter = buildFilterFromPath(row.field, row.operator, row.value, row.valueTo, row.negate);
|
|
1893
|
-
currentAndGroup.push(filter);
|
|
1894
|
-
const nextConnector = connectors[i];
|
|
1895
|
-
if (nextConnector?.logic === "OR" || !nextConnector) {
|
|
1896
|
-
if (currentAndGroup.length === 1) {
|
|
1897
|
-
groups.push(currentAndGroup[0]);
|
|
1898
|
-
} else {
|
|
1899
|
-
groups.push({ $and: currentAndGroup });
|
|
1900
|
-
}
|
|
1901
|
-
currentAndGroup = [];
|
|
1902
|
-
}
|
|
1903
|
-
});
|
|
1904
|
-
if (currentAndGroup.length > 0) {
|
|
1905
|
-
if (currentAndGroup.length === 1) {
|
|
1906
|
-
groups.push(currentAndGroup[0]);
|
|
1907
|
-
} else {
|
|
1908
|
-
groups.push({ $and: currentAndGroup });
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
if (groups.length === 1) return groups[0];
|
|
1912
|
-
return { $or: groups };
|
|
1913
|
-
};
|
|
1914
|
-
const generateFromRows = (rows, connectors) => {
|
|
1915
|
-
const queryObject = {};
|
|
1916
|
-
const filterStructure = rowsToFilterStructure(rows, connectors);
|
|
1917
|
-
if (filterStructure) {
|
|
1918
|
-
queryObject.filters = filterStructure;
|
|
1919
|
-
}
|
|
1920
|
-
const relations = /* @__PURE__ */ new Set();
|
|
1921
|
-
rows.forEach((r) => {
|
|
1922
|
-
const rel = extractRelationFromField(r.field);
|
|
1923
|
-
if (rel) relations.add(rel);
|
|
1924
|
-
});
|
|
1925
|
-
if (relations.size > 0) {
|
|
1926
|
-
const populate = {};
|
|
1927
|
-
relations.forEach((rel) => {
|
|
1928
|
-
populate[rel] = true;
|
|
1929
|
-
});
|
|
1930
|
-
queryObject.populate = populate;
|
|
1931
|
-
}
|
|
1932
|
-
return qs__default.default.stringify(queryObject, { encodeValuesOnly: true });
|
|
1933
|
-
};
|
|
1934
|
-
const buildFilterFromGroup = (group) => {
|
|
1935
|
-
const validItems = group.items.filter((item) => {
|
|
1936
|
-
if ("isGroup" in item && item.isGroup) return true;
|
|
1937
|
-
const row = item;
|
|
1938
|
-
if (!row.field) return false;
|
|
1939
|
-
if (["null", "notNull"].includes(row.operator)) return true;
|
|
1940
|
-
if (row.operator === "between") return row.value?.trim() && row.valueTo?.trim();
|
|
1941
|
-
return row.value?.trim();
|
|
1942
|
-
});
|
|
1943
|
-
if (validItems.length === 0) return void 0;
|
|
1944
|
-
const conditions = validItems.map((item) => {
|
|
1945
|
-
if ("isGroup" in item && item.isGroup) {
|
|
1946
|
-
return buildFilterFromGroup(item);
|
|
1947
|
-
}
|
|
1948
|
-
const row = item;
|
|
1949
|
-
return buildFilterFromPath(row.field, row.operator, row.value, row.valueTo, row.negate);
|
|
1950
|
-
}).filter(Boolean);
|
|
1951
|
-
if (conditions.length === 0) return void 0;
|
|
1952
|
-
if (conditions.length === 1) return conditions[0];
|
|
1953
|
-
const logicKey = group.logic === "AND" ? "$and" : "$or";
|
|
1954
|
-
return { [logicKey]: conditions };
|
|
1955
|
-
};
|
|
1956
|
-
const extractRelationsFromGroup = (group) => {
|
|
1957
|
-
const relations = /* @__PURE__ */ new Set();
|
|
1958
|
-
group.items.forEach((item) => {
|
|
1959
|
-
if ("isGroup" in item && item.isGroup) {
|
|
1960
|
-
const nested = extractRelationsFromGroup(item);
|
|
1961
|
-
nested.forEach((r) => relations.add(r));
|
|
1962
|
-
} else {
|
|
1963
|
-
const row = item;
|
|
1964
|
-
const rel = extractRelationFromField(row.field);
|
|
1965
|
-
if (rel) relations.add(rel);
|
|
1966
|
-
}
|
|
1967
|
-
});
|
|
1968
|
-
return relations;
|
|
1969
|
-
};
|
|
1970
|
-
const generateFromGroup = (group) => {
|
|
1971
|
-
const queryObject = {};
|
|
1972
|
-
const filterStructure = buildFilterFromGroup(group);
|
|
1973
|
-
if (filterStructure) {
|
|
1974
|
-
queryObject.filters = filterStructure;
|
|
1975
|
-
}
|
|
1976
|
-
const relations = extractRelationsFromGroup(group);
|
|
1977
|
-
if (relations.size > 0) {
|
|
1978
|
-
const populate = {};
|
|
1979
|
-
relations.forEach((rel) => {
|
|
1980
|
-
populate[rel] = true;
|
|
1981
|
-
});
|
|
1982
|
-
queryObject.populate = populate;
|
|
1983
|
-
}
|
|
1984
|
-
return qs__default.default.stringify(queryObject, { encodeValuesOnly: true });
|
|
1985
|
-
};
|
|
1986
|
-
const extractFieldPathAndOperator = (parts) => {
|
|
1987
|
-
let operatorIndex = -1;
|
|
1988
|
-
for (let i = parts.length - 1; i >= 0; i--) {
|
|
1989
|
-
if (parts[i].startsWith("$")) {
|
|
1990
|
-
operatorIndex = i;
|
|
1991
|
-
break;
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
1994
|
-
if (operatorIndex === -1) return null;
|
|
1995
|
-
const operator = parts[operatorIndex].substring(1);
|
|
1996
|
-
const fieldPath = parts.slice(0, operatorIndex);
|
|
1997
|
-
if (fieldPath.length === 0) return null;
|
|
1998
|
-
return { fieldPath, operator };
|
|
1999
|
-
};
|
|
2000
|
-
const parseQueryToStructure = (queryString) => {
|
|
2001
|
-
const params = new URLSearchParams(queryString);
|
|
2002
|
-
const filterTree = {};
|
|
2003
|
-
params.forEach((value, key) => {
|
|
2004
|
-
if (key.startsWith("filters[")) {
|
|
2005
|
-
const parts = key.match(/\[([^\]]+)\]/g)?.map((p) => p.slice(1, -1)) || [];
|
|
2006
|
-
console.log("[QueryParser] Parsing key:", key, "parts:", parts);
|
|
2007
|
-
if (parts.length < 2) return;
|
|
2008
|
-
if (parts[0].startsWith("$")) {
|
|
2009
|
-
const logic = parts[0].substring(1);
|
|
2010
|
-
const index2 = parseInt(parts[1]);
|
|
2011
|
-
if (isNaN(index2)) return;
|
|
2012
|
-
if (parts[2].startsWith("$")) {
|
|
2013
|
-
const nestedLogic = parts[2].substring(1);
|
|
2014
|
-
const nestedIndex = parseInt(parts[3]);
|
|
2015
|
-
if (isNaN(nestedIndex)) return;
|
|
2016
|
-
const remainingParts = parts.slice(4);
|
|
2017
|
-
const extracted = extractFieldPathAndOperator(remainingParts);
|
|
2018
|
-
if (!extracted) return;
|
|
2019
|
-
if (!filterTree[logic]) filterTree[logic] = {};
|
|
2020
|
-
if (!filterTree[logic][index2]) filterTree[logic][index2] = { nested: nestedLogic, items: {} };
|
|
2021
|
-
filterTree[logic][index2].items[nestedIndex] = {
|
|
2022
|
-
fieldPath: extracted.fieldPath,
|
|
2023
|
-
field: extracted.fieldPath[extracted.fieldPath.length - 1],
|
|
2024
|
-
// Last element for backward compat
|
|
2025
|
-
operator: extracted.operator,
|
|
2026
|
-
value
|
|
2027
|
-
};
|
|
2028
|
-
} else {
|
|
2029
|
-
const remainingParts = parts.slice(2);
|
|
2030
|
-
const extracted = extractFieldPathAndOperator(remainingParts);
|
|
2031
|
-
if (!extracted) return;
|
|
2032
|
-
if (!filterTree[logic]) filterTree[logic] = {};
|
|
2033
|
-
filterTree[logic][index2] = {
|
|
2034
|
-
fieldPath: extracted.fieldPath,
|
|
2035
|
-
field: extracted.fieldPath[extracted.fieldPath.length - 1],
|
|
2036
|
-
// Last element for backward compat
|
|
2037
|
-
operator: extracted.operator,
|
|
2038
|
-
value
|
|
2039
|
-
};
|
|
2040
|
-
}
|
|
2041
|
-
} else {
|
|
2042
|
-
console.log("[QueryParser] Parsing simple filter without logic operator");
|
|
2043
|
-
const extracted = extractFieldPathAndOperator(parts);
|
|
2044
|
-
if (!extracted) return;
|
|
2045
|
-
if (!filterTree["and"]) filterTree["and"] = {};
|
|
2046
|
-
filterTree["and"][0] = {
|
|
2047
|
-
fieldPath: extracted.fieldPath,
|
|
2048
|
-
field: extracted.fieldPath[extracted.fieldPath.length - 1],
|
|
2049
|
-
operator: extracted.operator,
|
|
2050
|
-
value
|
|
2051
|
-
};
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
});
|
|
2055
|
-
console.log("[QueryParser] Filter tree:", filterTree);
|
|
2056
|
-
const rootLogic = Object.keys(filterTree)[0] || "and";
|
|
2057
|
-
const rootGroup = {
|
|
2058
|
-
id: "root",
|
|
2059
|
-
logic: rootLogic.toUpperCase(),
|
|
2060
|
-
conditions: []
|
|
2061
|
-
};
|
|
2062
|
-
let conditionId = 1;
|
|
2063
|
-
const rootItems = filterTree[rootLogic] || {};
|
|
2064
|
-
Object.keys(rootItems).sort((a, b) => parseInt(a) - parseInt(b)).forEach((index2) => {
|
|
2065
|
-
const item = rootItems[index2];
|
|
2066
|
-
if (item.nested) {
|
|
2067
|
-
const subGroup = {
|
|
2068
|
-
id: `group_${conditionId++}`,
|
|
2069
|
-
logic: item.nested.toUpperCase(),
|
|
2070
|
-
conditions: [],
|
|
2071
|
-
isGroup: true
|
|
2072
|
-
};
|
|
2073
|
-
Object.keys(item.items).sort((a, b) => parseInt(a) - parseInt(b)).forEach((subIndex) => {
|
|
2074
|
-
const subItem = item.items[subIndex];
|
|
2075
|
-
subGroup.conditions.push({
|
|
2076
|
-
id: `condition_${conditionId++}`,
|
|
2077
|
-
field: subItem.field,
|
|
2078
|
-
fieldPath: subItem.fieldPath,
|
|
2079
|
-
operator: subItem.operator,
|
|
2080
|
-
value: decodeURIComponent(subItem.value)
|
|
2081
|
-
});
|
|
2082
|
-
});
|
|
2083
|
-
rootGroup.conditions.push(subGroup);
|
|
2084
|
-
} else {
|
|
2085
|
-
rootGroup.conditions.push({
|
|
2086
|
-
id: `condition_${conditionId++}`,
|
|
2087
|
-
field: item.field,
|
|
2088
|
-
fieldPath: item.fieldPath,
|
|
2089
|
-
operator: item.operator,
|
|
2090
|
-
value: decodeURIComponent(item.value)
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
});
|
|
2094
|
-
if (rootGroup.conditions.length === 0) {
|
|
2095
|
-
rootGroup.conditions.push({
|
|
2096
|
-
id: "condition_1",
|
|
2097
|
-
field: "",
|
|
2098
|
-
fieldPath: [],
|
|
2099
|
-
operator: "eq",
|
|
2100
|
-
value: ""
|
|
2101
|
-
});
|
|
2102
|
-
}
|
|
2103
|
-
console.log("[QueryParser] Built structure:", rootGroup);
|
|
2104
|
-
return rootGroup;
|
|
2105
|
-
};
|
|
2106
|
-
const flattenGroup = (group) => {
|
|
2107
|
-
const result = [];
|
|
2108
|
-
const logic = group.logic;
|
|
2109
|
-
group.conditions.forEach((item, i) => {
|
|
2110
|
-
const connectorBefore = i === 0 ? null : logic;
|
|
2111
|
-
if ("isGroup" in item && item.isGroup) {
|
|
2112
|
-
const sub = flattenGroup(item);
|
|
2113
|
-
sub.forEach((s, j) => {
|
|
2114
|
-
result.push({
|
|
2115
|
-
condition: s.condition,
|
|
2116
|
-
connectorBefore: j === 0 ? connectorBefore : s.connectorBefore
|
|
2117
|
-
});
|
|
2118
|
-
});
|
|
2119
|
-
} else {
|
|
2120
|
-
result.push({ condition: item, connectorBefore });
|
|
2121
|
-
}
|
|
2122
|
-
});
|
|
2123
|
-
return result;
|
|
2124
|
-
};
|
|
2125
|
-
const parseQueryToRows = (queryString) => {
|
|
2126
|
-
const structure = parseQueryToStructure(queryString);
|
|
2127
|
-
const flattened = flattenGroup(structure);
|
|
2128
|
-
const rows = [];
|
|
2129
|
-
const connectors = [];
|
|
2130
|
-
flattened.forEach((item, i) => {
|
|
2131
|
-
const cond = item.condition;
|
|
2132
|
-
const field = cond.fieldPath && cond.fieldPath.length > 0 ? cond.fieldPath.join(".") : cond.field || "";
|
|
2133
|
-
const needsValue = !["null", "notNull"].includes(cond.operator);
|
|
2134
|
-
if (!field && needsValue) return;
|
|
2135
|
-
rows.push({
|
|
2136
|
-
id: cond.id || `row_${i + 1}`,
|
|
2137
|
-
field,
|
|
2138
|
-
operator: cond.operator,
|
|
2139
|
-
value: cond.value || ""
|
|
2140
|
-
});
|
|
2141
|
-
if (item.connectorBefore && i > 0) {
|
|
2142
|
-
connectors.push({ logic: item.connectorBefore });
|
|
2143
|
-
}
|
|
2144
|
-
});
|
|
2145
|
-
for (let i = connectors.length; i < Math.max(0, rows.length - 1); i++) {
|
|
2146
|
-
connectors.push({ logic: "AND" });
|
|
2147
|
-
}
|
|
2148
|
-
return { rows, connectors };
|
|
2149
|
-
};
|
|
2150
|
-
const ModalOverlay = styled__default.default.div`
|
|
2151
|
-
position: fixed;
|
|
2152
|
-
top: 0;
|
|
2153
|
-
left: 0;
|
|
2154
|
-
right: 0;
|
|
2155
|
-
bottom: 0;
|
|
2156
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
2157
|
-
display: flex;
|
|
2158
|
-
align-items: center;
|
|
2159
|
-
justify-content: center;
|
|
2160
|
-
z-index: 400;
|
|
2161
|
-
padding: 20px;
|
|
2162
|
-
@media (max-width: 768px) {
|
|
2163
|
-
padding: 10px;
|
|
2164
|
-
}
|
|
2165
|
-
`;
|
|
2166
|
-
const ModalContent = styled__default.default(designSystem.Box)`
|
|
2167
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
2168
|
-
border-radius: 8px;
|
|
2169
|
-
max-height: 90vh;
|
|
2170
|
-
max-width: 720px;
|
|
2171
|
-
width: 100%;
|
|
2172
|
-
min-height: 400px;
|
|
2173
|
-
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
|
|
2174
|
-
display: flex;
|
|
2175
|
-
flex-direction: column;
|
|
2176
|
-
overflow: hidden;
|
|
2177
|
-
@media (max-width: 768px) {
|
|
2178
|
-
max-width: 100%;
|
|
2179
|
-
max-height: 92vh;
|
|
2180
|
-
}
|
|
2181
|
-
`;
|
|
2182
|
-
const ModalScrollArea = styled__default.default.div`
|
|
2183
|
-
flex: 1;
|
|
2184
|
-
overflow-y: auto;
|
|
2185
|
-
overflow-x: hidden;
|
|
2186
|
-
`;
|
|
2187
|
-
const RowWrapper = styled__default.default.div`
|
|
2188
|
-
display: flex;
|
|
2189
|
-
flex-direction: column;
|
|
2190
|
-
gap: 8px;
|
|
2191
|
-
margin-bottom: 8px;
|
|
2192
|
-
`;
|
|
2193
|
-
const FilterRowCard = styled__default.default.div`
|
|
2194
|
-
display: flex;
|
|
2195
|
-
flex-direction: column;
|
|
2196
|
-
gap: 10px;
|
|
2197
|
-
padding: 12px;
|
|
2198
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
2199
|
-
border-radius: 6px;
|
|
2200
|
-
border: 1px solid ${(p) => p.theme.colors.neutral200};
|
|
2201
|
-
`;
|
|
2202
|
-
const FilterRowTop = styled__default.default.div`
|
|
2203
|
-
display: flex;
|
|
2204
|
-
align-items: center;
|
|
2205
|
-
gap: 8px;
|
|
2206
|
-
flex-wrap: wrap;
|
|
2207
|
-
`;
|
|
2208
|
-
const NegateCheckbox = styled__default.default.label`
|
|
2209
|
-
display: flex;
|
|
2210
|
-
align-items: center;
|
|
2211
|
-
gap: 6px;
|
|
2212
|
-
font-size: 12px;
|
|
2213
|
-
color: ${(p) => p.theme.colors.neutral700};
|
|
2214
|
-
cursor: pointer;
|
|
2215
|
-
user-select: none;
|
|
2216
|
-
input {
|
|
2217
|
-
cursor: pointer;
|
|
2218
|
-
}
|
|
2219
|
-
`;
|
|
2220
|
-
const FilterRowValue = styled__default.default.div`
|
|
2221
|
-
width: 100%;
|
|
2222
|
-
padding-top: 14px;
|
|
2223
|
-
padding-bottom: 4px;
|
|
2224
|
-
border-top: 1px solid ${(p) => p.theme.colors.neutral200};
|
|
2225
|
-
`;
|
|
2226
|
-
const ValueLabel = styled__default.default.span`
|
|
2227
|
-
display: block;
|
|
2228
|
-
font-size: 12px;
|
|
2229
|
-
font-weight: 500;
|
|
2230
|
-
color: ${(p) => p.theme.colors.neutral600};
|
|
2231
|
-
margin-bottom: 8px;
|
|
2232
|
-
`;
|
|
2233
|
-
styled__default.default.span`
|
|
2234
|
-
font-size: 10px;
|
|
2235
|
-
font-weight: 500;
|
|
2236
|
-
padding: 2px 6px;
|
|
2237
|
-
border-radius: 4px;
|
|
2238
|
-
background: ${(p) => p.theme.colors.neutral200};
|
|
2239
|
-
color: ${(p) => p.theme.colors.neutral700};
|
|
2240
|
-
text-transform: uppercase;
|
|
2241
|
-
`;
|
|
2242
|
-
const MultiValueWrapper = styled__default.default.div`
|
|
2243
|
-
display: flex;
|
|
2244
|
-
flex-wrap: wrap;
|
|
2245
|
-
gap: 6px;
|
|
2246
|
-
min-height: 32px;
|
|
2247
|
-
padding: 6px 8px;
|
|
2248
|
-
border: 1px solid ${(p) => p.theme.colors.neutral200};
|
|
2249
|
-
border-radius: 4px;
|
|
2250
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
2251
|
-
&:focus-within {
|
|
2252
|
-
border-color: #4945ff;
|
|
2253
|
-
box-shadow: 0 0 0 2px rgba(73, 69, 255, 0.1);
|
|
2254
|
-
}
|
|
2255
|
-
`;
|
|
2256
|
-
const MultiValueInput = styled__default.default.input`
|
|
2257
|
-
flex: 1;
|
|
2258
|
-
min-width: 80px;
|
|
2259
|
-
border: none;
|
|
2260
|
-
background: transparent;
|
|
2261
|
-
font-size: 14px;
|
|
2262
|
-
color: ${(p) => p.theme.colors.neutral800};
|
|
2263
|
-
&:focus {
|
|
2264
|
-
outline: none;
|
|
2265
|
-
}
|
|
2266
|
-
&::placeholder {
|
|
2267
|
-
color: ${(p) => p.theme.colors.neutral500};
|
|
2268
|
-
}
|
|
2269
|
-
`;
|
|
2270
|
-
const BetweenWrapper = styled__default.default.div`
|
|
2271
|
-
display: flex;
|
|
2272
|
-
align-items: center;
|
|
2273
|
-
gap: 8px;
|
|
2274
|
-
width: 100%;
|
|
2275
|
-
`;
|
|
2276
|
-
const BetweenSeparator = styled__default.default.span`
|
|
2277
|
-
font-size: 13px;
|
|
2278
|
-
font-weight: 500;
|
|
2279
|
-
color: ${(p) => p.theme.colors.neutral600};
|
|
2280
|
-
`;
|
|
2281
|
-
function SmartValueInput({
|
|
2282
|
-
fieldType,
|
|
2283
|
-
operator,
|
|
2284
|
-
value,
|
|
2285
|
-
valueTo,
|
|
2286
|
-
onChange,
|
|
2287
|
-
onValueToChange,
|
|
2288
|
-
placeholder = "Value"
|
|
2289
|
-
}) {
|
|
2290
|
-
const t = (fieldType || "string").toLowerCase();
|
|
2291
|
-
const [inputValue, setInputValue] = React__default.default.useState("");
|
|
2292
|
-
if (["in", "notIn"].includes(operator)) {
|
|
2293
|
-
const values = value ? value.split(",").map((v) => v.trim()).filter(Boolean) : [];
|
|
2294
|
-
const handleAddValue = (e) => {
|
|
2295
|
-
if (e.key === "Enter" || e.key === ",") {
|
|
2296
|
-
e.preventDefault();
|
|
2297
|
-
const newVal = inputValue.trim();
|
|
2298
|
-
if (newVal && !values.includes(newVal)) {
|
|
2299
|
-
const updated = [...values, newVal].join(",");
|
|
2300
|
-
onChange(updated);
|
|
2301
|
-
setInputValue("");
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
};
|
|
2305
|
-
const handleRemoveValue = (val) => {
|
|
2306
|
-
const updated = values.filter((v) => v !== val).join(",");
|
|
2307
|
-
onChange(updated);
|
|
2308
|
-
};
|
|
2309
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs(MultiValueWrapper, { children: [
|
|
2310
|
-
values.map((val) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2311
|
-
designSystem.Tag,
|
|
2312
|
-
{
|
|
2313
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
|
|
2314
|
-
onClick: () => handleRemoveValue(val),
|
|
2315
|
-
children: val
|
|
2316
|
-
},
|
|
2317
|
-
val
|
|
2318
|
-
)),
|
|
2319
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2320
|
-
MultiValueInput,
|
|
2321
|
-
{
|
|
2322
|
-
value: inputValue,
|
|
2323
|
-
onChange: (e) => setInputValue(e.target.value),
|
|
2324
|
-
onKeyDown: handleAddValue,
|
|
2325
|
-
placeholder: values.length === 0 ? "Type and press Enter" : ""
|
|
2326
|
-
}
|
|
2327
|
-
)
|
|
2328
|
-
] }) });
|
|
2329
|
-
}
|
|
2330
|
-
if (operator === "between") {
|
|
2331
|
-
if (["date"].includes(t)) {
|
|
2332
|
-
const dateVal1 = value ? (() => {
|
|
2333
|
-
try {
|
|
2334
|
-
const d = new Date(value);
|
|
2335
|
-
return isNaN(d.getTime()) ? void 0 : d;
|
|
2336
|
-
} catch {
|
|
2337
|
-
return void 0;
|
|
2338
|
-
}
|
|
2339
|
-
})() : void 0;
|
|
2340
|
-
const dateVal2 = valueTo ? (() => {
|
|
2341
|
-
try {
|
|
2342
|
-
const d = new Date(valueTo);
|
|
2343
|
-
return isNaN(d.getTime()) ? void 0 : d;
|
|
2344
|
-
} catch {
|
|
2345
|
-
return void 0;
|
|
2346
|
-
}
|
|
2347
|
-
})() : void 0;
|
|
2348
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(BetweenWrapper, { children: [
|
|
2349
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.DatePicker, { value: dateVal1, onChange: (d) => onChange(d ? d.toISOString().slice(0, 10) : ""), clearLabel: "Clear", size: "S" }) }),
|
|
2350
|
-
/* @__PURE__ */ jsxRuntime.jsx(BetweenSeparator, { children: "and" }),
|
|
2351
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.DatePicker, { value: dateVal2, onChange: (d) => onValueToChange?.(d ? d.toISOString().slice(0, 10) : ""), clearLabel: "Clear", size: "S" }) })
|
|
2352
|
-
] });
|
|
2353
|
-
}
|
|
2354
|
-
if (["integer", "float", "decimal", "biginteger"].includes(t)) {
|
|
2355
|
-
const num1 = value === "" ? void 0 : (() => {
|
|
2356
|
-
const n = parseFloat(value);
|
|
2357
|
-
return isNaN(n) ? void 0 : n;
|
|
2358
|
-
})();
|
|
2359
|
-
const num2 = valueTo === "" || !valueTo ? void 0 : (() => {
|
|
2360
|
-
const n = parseFloat(valueTo);
|
|
2361
|
-
return isNaN(n) ? void 0 : n;
|
|
2362
|
-
})();
|
|
2363
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(BetweenWrapper, { children: [
|
|
2364
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.NumberInput, { value: num1, onValueChange: (v) => onChange(v !== void 0 ? String(v) : ""), size: "S" }) }),
|
|
2365
|
-
/* @__PURE__ */ jsxRuntime.jsx(BetweenSeparator, { children: "and" }),
|
|
2366
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.NumberInput, { value: num2, onValueChange: (v) => onValueToChange?.(v !== void 0 ? String(v) : ""), size: "S" }) })
|
|
2367
|
-
] });
|
|
2368
|
-
}
|
|
2369
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(BetweenWrapper, { children: [
|
|
2370
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.TextInput, { value, onChange: (e) => onChange(e.target.value), placeholder: "From", size: "S" }) }),
|
|
2371
|
-
/* @__PURE__ */ jsxRuntime.jsx(BetweenSeparator, { children: "and" }),
|
|
2372
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.TextInput, { value: valueTo || "", onChange: (e) => onValueToChange?.(e.target.value), placeholder: "To", size: "S" }) })
|
|
2373
|
-
] });
|
|
2374
|
-
}
|
|
2375
|
-
if (["date"].includes(t)) {
|
|
2376
|
-
const dateVal = value ? (() => {
|
|
2377
|
-
try {
|
|
2378
|
-
const d = new Date(value);
|
|
2379
|
-
return isNaN(d.getTime()) ? void 0 : d;
|
|
2380
|
-
} catch {
|
|
2381
|
-
return void 0;
|
|
2382
|
-
}
|
|
2383
|
-
})() : void 0;
|
|
2384
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%", minWidth: 140 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2385
|
-
designSystem.DatePicker,
|
|
2386
|
-
{
|
|
2387
|
-
value: dateVal,
|
|
2388
|
-
onChange: (d) => onChange(d ? d.toISOString().slice(0, 10) : ""),
|
|
2389
|
-
clearLabel: "Clear",
|
|
2390
|
-
size: "S"
|
|
2391
|
-
}
|
|
2392
|
-
) });
|
|
2393
|
-
}
|
|
2394
|
-
if (["datetime"].includes(t)) {
|
|
2395
|
-
const dateVal = value ? (() => {
|
|
2396
|
-
try {
|
|
2397
|
-
const d = new Date(value);
|
|
2398
|
-
return isNaN(d.getTime()) ? void 0 : d;
|
|
2399
|
-
} catch {
|
|
2400
|
-
return void 0;
|
|
2401
|
-
}
|
|
2402
|
-
})() : void 0;
|
|
2403
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%", minWidth: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2404
|
-
designSystem.DateTimePicker,
|
|
2405
|
-
{
|
|
2406
|
-
value: dateVal ?? void 0,
|
|
2407
|
-
onChange: (d) => onChange(d ? d.toISOString() : ""),
|
|
2408
|
-
clearLabel: "Clear",
|
|
2409
|
-
size: "S"
|
|
2410
|
-
}
|
|
2411
|
-
) });
|
|
2412
|
-
}
|
|
2413
|
-
if (["time"].includes(t)) {
|
|
2414
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%", minWidth: 120 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2415
|
-
designSystem.TimePicker,
|
|
2416
|
-
{
|
|
2417
|
-
value: value || void 0,
|
|
2418
|
-
onChange: (v) => onChange(v ?? ""),
|
|
2419
|
-
size: "S"
|
|
2420
|
-
}
|
|
2421
|
-
) });
|
|
2422
|
-
}
|
|
2423
|
-
if (["integer", "float", "decimal", "biginteger"].includes(t)) {
|
|
2424
|
-
const numVal = value === "" ? void 0 : (() => {
|
|
2425
|
-
const n = parseFloat(value);
|
|
2426
|
-
return isNaN(n) ? void 0 : n;
|
|
2427
|
-
})();
|
|
2428
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%", minWidth: 120 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2429
|
-
designSystem.NumberInput,
|
|
2430
|
-
{
|
|
2431
|
-
value: numVal,
|
|
2432
|
-
onValueChange: (v) => onChange(v !== void 0 ? String(v) : ""),
|
|
2433
|
-
size: "S"
|
|
2434
|
-
}
|
|
2435
|
-
) });
|
|
2436
|
-
}
|
|
2437
|
-
if (["boolean"].includes(t)) {
|
|
2438
|
-
const selVal = value === "true" ? "true" : value === "false" ? "false" : "";
|
|
2439
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%", minWidth: 120 }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2440
|
-
designSystem.SingleSelect,
|
|
2441
|
-
{
|
|
2442
|
-
value: selVal || void 0,
|
|
2443
|
-
onChange: (v) => onChange(v != null ? String(v) : ""),
|
|
2444
|
-
placeholder,
|
|
2445
|
-
size: "S",
|
|
2446
|
-
children: [
|
|
2447
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "true", children: "true" }),
|
|
2448
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "false", children: "false" })
|
|
2449
|
-
]
|
|
2450
|
-
}
|
|
2451
|
-
) });
|
|
2452
|
-
}
|
|
2453
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "100%", minWidth: 120 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2454
|
-
designSystem.TextInput,
|
|
2455
|
-
{
|
|
2456
|
-
value,
|
|
2457
|
-
onChange: (e) => onChange(e.target.value),
|
|
2458
|
-
placeholder,
|
|
2459
|
-
size: "S"
|
|
2460
|
-
}
|
|
2461
|
-
) });
|
|
2462
|
-
}
|
|
2463
|
-
const ConnectorPill = styled__default.default.div`
|
|
2464
|
-
display: flex;
|
|
2465
|
-
align-items: center;
|
|
2466
|
-
justify-content: center;
|
|
2467
|
-
padding: 6px 0;
|
|
2468
|
-
`;
|
|
2469
|
-
const ConnectorButton = styled__default.default.button`
|
|
2470
|
-
padding: 6px 14px;
|
|
2471
|
-
font-size: 12px;
|
|
2472
|
-
font-weight: 500;
|
|
2473
|
-
border: 1px solid ${(p) => p.$active ? "#4945ff" : p.theme.colors.neutral300};
|
|
2474
|
-
border-radius: 999px;
|
|
2475
|
-
background: ${(p) => p.$active ? "#EEF0FF" : "transparent"};
|
|
2476
|
-
color: ${(p) => p.$active ? "#4945ff" : p.theme.colors.neutral700};
|
|
2477
|
-
cursor: pointer;
|
|
2478
|
-
transition: all 0.15s ease;
|
|
2479
|
-
&:hover {
|
|
2480
|
-
border-color: #4945ff;
|
|
2481
|
-
}
|
|
2482
|
-
`;
|
|
2483
|
-
const ActiveBadge = styled__default.default.span`
|
|
2484
|
-
font-size: 12px;
|
|
2485
|
-
font-weight: 500;
|
|
2486
|
-
padding: 2px 8px;
|
|
2487
|
-
border-radius: 999px;
|
|
2488
|
-
background: rgba(73, 69, 255, 0.12);
|
|
2489
|
-
color: #4945ff;
|
|
2490
|
-
margin-left: 8px;
|
|
2491
|
-
`;
|
|
2492
|
-
const DeleteButton = styled__default.default.button`
|
|
2493
|
-
display: flex;
|
|
2494
|
-
align-items: center;
|
|
2495
|
-
justify-content: center;
|
|
2496
|
-
width: 32px;
|
|
2497
|
-
height: 32px;
|
|
2498
|
-
border: none;
|
|
2499
|
-
background: rgba(239, 68, 68, 0.06);
|
|
2500
|
-
color: #dc2626;
|
|
2501
|
-
border-radius: 4px;
|
|
2502
|
-
cursor: pointer;
|
|
2503
|
-
flex-shrink: 0;
|
|
2504
|
-
&:hover {
|
|
2505
|
-
background: rgba(239, 68, 68, 0.12);
|
|
2506
|
-
}
|
|
2507
|
-
svg {
|
|
2508
|
-
width: 14px;
|
|
2509
|
-
height: 14px;
|
|
2510
|
-
}
|
|
2511
|
-
`;
|
|
2512
|
-
const AddButton = styled__default.default.button`
|
|
2513
|
-
display: flex;
|
|
2514
|
-
align-items: center;
|
|
2515
|
-
gap: 6px;
|
|
2516
|
-
padding: 8px 14px;
|
|
2517
|
-
font-size: 13px;
|
|
2518
|
-
font-weight: 500;
|
|
2519
|
-
border: 1px dashed rgba(128, 128, 128, 0.25);
|
|
2520
|
-
border-radius: 4px;
|
|
2521
|
-
background: ${(p) => p.theme.colors.neutral100};
|
|
2522
|
-
color: #4945ff;
|
|
2523
|
-
cursor: pointer;
|
|
2524
|
-
transition: all 0.15s ease;
|
|
2525
|
-
&:hover {
|
|
2526
|
-
border-color: #4945ff;
|
|
2527
|
-
background: rgba(73, 69, 255, 0.06);
|
|
2528
|
-
}
|
|
2529
|
-
`;
|
|
2530
|
-
const InfoText = styled__default.default.div`
|
|
2531
|
-
font-size: 12px;
|
|
2532
|
-
color: ${(p) => p.theme.colors.neutral600};
|
|
2533
|
-
margin-top: 8px;
|
|
2534
|
-
font-style: italic;
|
|
2535
|
-
`;
|
|
2536
|
-
const ModalFooter = styled__default.default.div`
|
|
2537
|
-
flex-shrink: 0;
|
|
2538
|
-
padding-top: 16px;
|
|
2539
|
-
border-top: 1px solid ${(p) => p.theme.colors.neutral200};
|
|
2540
|
-
margin-top: 8px;
|
|
2541
|
-
`;
|
|
2542
|
-
const GroupContainer = styled__default.default.div`
|
|
2543
|
-
border: 2px solid ${(p) => p.$logic === "AND" ? "#0EA5E9" : "#F97316"};
|
|
2544
|
-
border-radius: 8px;
|
|
2545
|
-
padding: 16px;
|
|
2546
|
-
margin: ${(p) => p.$level > 0 ? "12px 0 12px 20px" : "0"};
|
|
2547
|
-
background: ${(p) => p.$logic === "AND" ? "rgba(14, 165, 233, 0.03)" : "rgba(249, 115, 22, 0.03)"};
|
|
2548
|
-
position: relative;
|
|
2549
|
-
${(p) => p.$level > 0 && `border-style: dashed;`}
|
|
2550
|
-
`;
|
|
2551
|
-
const GroupHeader = styled__default.default.div`
|
|
2552
|
-
display: flex;
|
|
2553
|
-
align-items: center;
|
|
2554
|
-
justify-content: space-between;
|
|
2555
|
-
margin-bottom: 12px;
|
|
2556
|
-
padding-bottom: 10px;
|
|
2557
|
-
border-bottom: 1px solid ${(p) => p.theme.colors.neutral200};
|
|
2558
|
-
`;
|
|
2559
|
-
const LogicBadge = styled__default.default.div`
|
|
2560
|
-
display: inline-flex;
|
|
2561
|
-
align-items: center;
|
|
2562
|
-
gap: 8px;
|
|
2563
|
-
font-size: 12px;
|
|
2564
|
-
font-weight: 600;
|
|
2565
|
-
color: ${(p) => p.$logic === "AND" ? "#0284C7" : "#EA580C"};
|
|
2566
|
-
`;
|
|
2567
|
-
const LogicToggleButton = styled__default.default.button`
|
|
2568
|
-
padding: 4px 12px;
|
|
2569
|
-
border-radius: 999px;
|
|
2570
|
-
border: 1px solid ${(p) => p.$logic === "AND" ? "#0EA5E9" : "#F97316"};
|
|
2571
|
-
background: ${(p) => p.$active ? p.$logic === "AND" ? "#0EA5E9" : "#F97316" : "transparent"};
|
|
2572
|
-
color: ${(p) => p.$active ? "white" : p.$logic === "AND" ? "#0284C7" : "#EA580C"};
|
|
2573
|
-
font-size: 11px;
|
|
2574
|
-
font-weight: 600;
|
|
2575
|
-
cursor: pointer;
|
|
2576
|
-
transition: all 0.15s ease;
|
|
2577
|
-
&:hover {
|
|
2578
|
-
transform: scale(1.05);
|
|
2579
|
-
}
|
|
2580
|
-
`;
|
|
2581
|
-
const GroupActions = styled__default.default.div`
|
|
2582
|
-
display: flex;
|
|
2583
|
-
gap: 6px;
|
|
2584
|
-
align-items: center;
|
|
2585
|
-
`;
|
|
2586
|
-
const SmallButton = styled__default.default.button`
|
|
2587
|
-
padding: 4px 10px;
|
|
2588
|
-
font-size: 11px;
|
|
2589
|
-
font-weight: 500;
|
|
2590
|
-
border: 1px solid ${(p) => p.theme.colors.neutral300};
|
|
2591
|
-
border-radius: 4px;
|
|
2592
|
-
background: ${(p) => p.theme.colors.neutral0};
|
|
2593
|
-
color: ${(p) => p.theme.colors.neutral700};
|
|
2594
|
-
cursor: pointer;
|
|
2595
|
-
&:hover {
|
|
2596
|
-
border-color: #4945ff;
|
|
2597
|
-
background: rgba(73, 69, 255, 0.06);
|
|
2598
|
-
}
|
|
2599
|
-
&:disabled {
|
|
2600
|
-
opacity: 0.5;
|
|
2601
|
-
cursor: not-allowed;
|
|
2602
|
-
}
|
|
2603
|
-
`;
|
|
2604
|
-
const RemoveGroupButton = styled__default.default(SmallButton)`
|
|
2605
|
-
color: #dc2626;
|
|
2606
|
-
border-color: rgba(239, 68, 68, 0.3);
|
|
2607
|
-
&:hover {
|
|
2608
|
-
border-color: #dc2626;
|
|
2609
|
-
background: rgba(239, 68, 68, 0.06);
|
|
2610
|
-
}
|
|
2611
|
-
`;
|
|
2612
|
-
const StrapiStyleFilterModal = ({
|
|
2613
|
-
onClose,
|
|
2614
|
-
onApply,
|
|
2615
|
-
availableFields,
|
|
2616
|
-
availableRelations = [],
|
|
2617
|
-
currentQuery = "",
|
|
2618
|
-
enableNestedGroups = false
|
|
2619
|
-
}) => {
|
|
2620
|
-
const { getRelationFields } = useRelationSchema();
|
|
2621
|
-
const [fieldOptions, setFieldOptions] = React.useState([]);
|
|
2622
|
-
const [rows, setRows] = React.useState([]);
|
|
2623
|
-
const [connectors, setConnectors] = React.useState([]);
|
|
2624
|
-
const [rootGroup, setRootGroup] = React.useState(null);
|
|
2625
|
-
const buildFieldOptions = React.useCallback(async () => {
|
|
2626
|
-
const direct = availableFields.map((f) => ({
|
|
2627
|
-
value: f.name,
|
|
2628
|
-
label: f.name,
|
|
2629
|
-
group: "Fields",
|
|
2630
|
-
type: f.type
|
|
2631
|
-
}));
|
|
2632
|
-
const relationOptions = [];
|
|
2633
|
-
for (const rel of availableRelations) {
|
|
2634
|
-
if (!rel.target) continue;
|
|
2635
|
-
try {
|
|
2636
|
-
const nestedFields = await getRelationFields(rel.target);
|
|
2637
|
-
if (nestedFields) {
|
|
2638
|
-
nestedFields.filter((f) => !f.isRelation).forEach((f) => {
|
|
2639
|
-
relationOptions.push({
|
|
2640
|
-
value: `${rel.name}.${f.name}`,
|
|
2641
|
-
label: `${rel.name} > ${f.name}`,
|
|
2642
|
-
group: "Relations",
|
|
2643
|
-
type: f.type
|
|
2644
|
-
});
|
|
2645
|
-
});
|
|
2646
|
-
}
|
|
2647
|
-
} catch (e) {
|
|
2648
|
-
console.warn("[StrapiStyleFilter] Failed to load relation fields:", rel.name, e);
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2651
|
-
setFieldOptions([...direct, ...relationOptions]);
|
|
2652
|
-
}, [availableFields, availableRelations, getRelationFields]);
|
|
2653
|
-
React.useEffect(() => {
|
|
2654
|
-
buildFieldOptions();
|
|
2655
|
-
}, [buildFieldOptions]);
|
|
2656
|
-
React.useEffect(() => {
|
|
2657
|
-
if (enableNestedGroups) {
|
|
2658
|
-
setRootGroup({
|
|
2659
|
-
id: "root",
|
|
2660
|
-
logic: "AND",
|
|
2661
|
-
items: [{
|
|
2662
|
-
id: `row_${Date.now()}`,
|
|
2663
|
-
field: "",
|
|
2664
|
-
operator: "eq",
|
|
2665
|
-
value: ""
|
|
2666
|
-
}],
|
|
2667
|
-
isGroup: true
|
|
2668
|
-
});
|
|
2669
|
-
} else {
|
|
2670
|
-
if (currentQuery) {
|
|
2671
|
-
const { rows: parsedRows, connectors: parsedConnectors } = parseQueryToRows(currentQuery);
|
|
2672
|
-
if (parsedRows.length > 0) {
|
|
2673
|
-
setRows(parsedRows);
|
|
2674
|
-
setConnectors(parsedConnectors);
|
|
2675
|
-
return;
|
|
2676
|
-
}
|
|
2677
|
-
}
|
|
2678
|
-
setRows([{
|
|
2679
|
-
id: `row_${Date.now()}`,
|
|
2680
|
-
field: "",
|
|
2681
|
-
operator: "eq",
|
|
2682
|
-
value: ""
|
|
2683
|
-
}]);
|
|
2684
|
-
setConnectors([]);
|
|
2685
|
-
}
|
|
2686
|
-
}, [currentQuery, enableNestedGroups]);
|
|
2687
|
-
React.useEffect(() => {
|
|
2688
|
-
if (fieldOptions.length === 0) return;
|
|
2689
|
-
if (!enableNestedGroups) {
|
|
2690
|
-
setRows((prev) => prev.map((r) => {
|
|
2691
|
-
if (!r.field || r.fieldType) return r;
|
|
2692
|
-
const opt = fieldOptions.find((f) => f.value === r.field);
|
|
2693
|
-
return opt?.type ? { ...r, fieldType: opt.type } : r;
|
|
2694
|
-
}));
|
|
2695
|
-
} else if (rootGroup) {
|
|
2696
|
-
const enrichGroup = (group) => ({
|
|
2697
|
-
...group,
|
|
2698
|
-
items: group.items.map((item) => {
|
|
2699
|
-
if ("isGroup" in item && item.isGroup) {
|
|
2700
|
-
return enrichGroup(item);
|
|
2701
|
-
}
|
|
2702
|
-
const row = item;
|
|
2703
|
-
if (!row.field || row.fieldType) return row;
|
|
2704
|
-
const opt = fieldOptions.find((f) => f.value === row.field);
|
|
2705
|
-
return opt?.type ? { ...row, fieldType: opt.type } : row;
|
|
2706
|
-
})
|
|
2707
|
-
});
|
|
2708
|
-
setRootGroup((prev) => prev ? enrichGroup(prev) : prev);
|
|
2709
|
-
}
|
|
2710
|
-
}, [fieldOptions, enableNestedGroups]);
|
|
2711
|
-
const relationsInUse = enableNestedGroups && rootGroup ? (() => {
|
|
2712
|
-
const relations = /* @__PURE__ */ new Set();
|
|
2713
|
-
const extract = (group) => {
|
|
2714
|
-
group.items.forEach((item) => {
|
|
2715
|
-
if ("isGroup" in item && item.isGroup) {
|
|
2716
|
-
extract(item);
|
|
2717
|
-
} else {
|
|
2718
|
-
const row = item;
|
|
2719
|
-
if (row.field?.includes(".")) {
|
|
2720
|
-
relations.add(row.field.split(".")[0]);
|
|
2721
|
-
}
|
|
2722
|
-
}
|
|
2723
|
-
});
|
|
2724
|
-
};
|
|
2725
|
-
extract(rootGroup);
|
|
2726
|
-
return relations;
|
|
2727
|
-
})() : new Set(
|
|
2728
|
-
rows.map((r) => r.field.includes(".") ? r.field.split(".")[0] : null).filter(Boolean)
|
|
2729
|
-
);
|
|
2730
|
-
const updateRow = (index2, updates) => {
|
|
2731
|
-
setRows((prev) => prev.map((r, i) => {
|
|
2732
|
-
if (i !== index2) return r;
|
|
2733
|
-
const merged = { ...r, ...updates };
|
|
2734
|
-
if ("field" in updates && updates.field !== void 0) {
|
|
2735
|
-
const opt = fieldOptions.find((f) => f.value === updates.field);
|
|
2736
|
-
merged.fieldType = opt?.type;
|
|
2737
|
-
const ops = getOperatorsForType(opt?.type || "string");
|
|
2738
|
-
const firstOp = ops[0]?.value ?? "eq";
|
|
2739
|
-
if (!ops.some((o) => o.value === merged.operator)) {
|
|
2740
|
-
merged.operator = firstOp;
|
|
2741
|
-
}
|
|
2742
|
-
}
|
|
2743
|
-
return merged;
|
|
2744
|
-
}));
|
|
2745
|
-
};
|
|
2746
|
-
const updateConnector = (index2, logic) => {
|
|
2747
|
-
setConnectors((prev) => {
|
|
2748
|
-
const next = [...prev];
|
|
2749
|
-
next[index2] = { logic };
|
|
2750
|
-
return next;
|
|
2751
|
-
});
|
|
2752
|
-
};
|
|
2753
|
-
const addRow = () => {
|
|
2754
|
-
const newRow = {
|
|
2755
|
-
id: `row_${Date.now()}`,
|
|
2756
|
-
field: "",
|
|
2757
|
-
operator: "eq",
|
|
2758
|
-
value: ""
|
|
2759
|
-
};
|
|
2760
|
-
setRows((prev) => [...prev, newRow]);
|
|
2761
|
-
setConnectors((prev) => [...prev, { logic: "AND" }]);
|
|
2762
|
-
};
|
|
2763
|
-
const removeRow = (index2) => {
|
|
2764
|
-
setRows((prev) => prev.filter((_, i) => i !== index2));
|
|
2765
|
-
setConnectors((prev) => {
|
|
2766
|
-
const connectorIndex = index2 > 0 ? index2 - 1 : 0;
|
|
2767
|
-
return prev.filter((_, i) => i !== connectorIndex);
|
|
2768
|
-
});
|
|
2769
|
-
};
|
|
2770
|
-
const updateGroupLogic = (groupId, logic) => {
|
|
2771
|
-
if (!rootGroup) return;
|
|
2772
|
-
const update = (group) => {
|
|
2773
|
-
if (group.id === groupId) {
|
|
2774
|
-
return { ...group, logic };
|
|
2775
|
-
}
|
|
2776
|
-
return {
|
|
2777
|
-
...group,
|
|
2778
|
-
items: group.items.map(
|
|
2779
|
-
(item) => "isGroup" in item && item.isGroup ? update(item) : item
|
|
2780
|
-
)
|
|
2781
|
-
};
|
|
2782
|
-
};
|
|
2783
|
-
setRootGroup(update(rootGroup));
|
|
2784
|
-
};
|
|
2785
|
-
const updateRowInGroup = (groupId, rowId, updates) => {
|
|
2786
|
-
if (!rootGroup) return;
|
|
2787
|
-
const update = (group) => {
|
|
2788
|
-
if (group.id === groupId) {
|
|
2789
|
-
return {
|
|
2790
|
-
...group,
|
|
2791
|
-
items: group.items.map((item) => {
|
|
2792
|
-
if (!("isGroup" in item) || !item.isGroup) {
|
|
2793
|
-
const row = item;
|
|
2794
|
-
if (row.id === rowId) {
|
|
2795
|
-
const merged = { ...row, ...updates };
|
|
2796
|
-
if ("field" in updates && updates.field !== void 0) {
|
|
2797
|
-
const opt = fieldOptions.find((f) => f.value === updates.field);
|
|
2798
|
-
merged.fieldType = opt?.type;
|
|
2799
|
-
const ops = getOperatorsForType(opt?.type || "string");
|
|
2800
|
-
const firstOp = ops[0]?.value ?? "eq";
|
|
2801
|
-
if (!ops.some((o) => o.value === merged.operator)) {
|
|
2802
|
-
merged.operator = firstOp;
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
return merged;
|
|
2806
|
-
}
|
|
2807
|
-
}
|
|
2808
|
-
return item;
|
|
2809
|
-
})
|
|
2810
|
-
};
|
|
2811
|
-
}
|
|
2812
|
-
return {
|
|
2813
|
-
...group,
|
|
2814
|
-
items: group.items.map(
|
|
2815
|
-
(item) => "isGroup" in item && item.isGroup ? update(item) : item
|
|
2816
|
-
)
|
|
2817
|
-
};
|
|
2818
|
-
};
|
|
2819
|
-
setRootGroup(update(rootGroup));
|
|
2820
|
-
};
|
|
2821
|
-
const addRowToGroup = (groupId) => {
|
|
2822
|
-
if (!rootGroup) return;
|
|
2823
|
-
const newRow = {
|
|
2824
|
-
id: `row_${Date.now()}`,
|
|
2825
|
-
field: "",
|
|
2826
|
-
operator: "eq",
|
|
2827
|
-
value: ""
|
|
2828
|
-
};
|
|
2829
|
-
const update = (group) => {
|
|
2830
|
-
if (group.id === groupId) {
|
|
2831
|
-
return { ...group, items: [...group.items, newRow] };
|
|
2832
|
-
}
|
|
2833
|
-
return {
|
|
2834
|
-
...group,
|
|
2835
|
-
items: group.items.map(
|
|
2836
|
-
(item) => "isGroup" in item && item.isGroup ? update(item) : item
|
|
2837
|
-
)
|
|
2838
|
-
};
|
|
2839
|
-
};
|
|
2840
|
-
setRootGroup(update(rootGroup));
|
|
2841
|
-
};
|
|
2842
|
-
const removeRowFromGroup = (groupId, rowId) => {
|
|
2843
|
-
if (!rootGroup) return;
|
|
2844
|
-
const update = (group) => {
|
|
2845
|
-
if (group.id === groupId) {
|
|
2846
|
-
return {
|
|
2847
|
-
...group,
|
|
2848
|
-
items: group.items.filter((item) => {
|
|
2849
|
-
if ("isGroup" in item && item.isGroup) return true;
|
|
2850
|
-
return item.id !== rowId;
|
|
2851
|
-
})
|
|
2852
|
-
};
|
|
2853
|
-
}
|
|
2854
|
-
return {
|
|
2855
|
-
...group,
|
|
2856
|
-
items: group.items.map(
|
|
2857
|
-
(item) => "isGroup" in item && item.isGroup ? update(item) : item
|
|
2858
|
-
)
|
|
2859
|
-
};
|
|
2860
|
-
};
|
|
2861
|
-
setRootGroup(update(rootGroup));
|
|
2862
|
-
};
|
|
2863
|
-
const addNestedGroup = (parentGroupId) => {
|
|
2864
|
-
if (!rootGroup) return;
|
|
2865
|
-
const newGroup = {
|
|
2866
|
-
id: `group_${Date.now()}`,
|
|
2867
|
-
logic: "AND",
|
|
2868
|
-
items: [{
|
|
2869
|
-
id: `row_${Date.now()}`,
|
|
2870
|
-
field: "",
|
|
2871
|
-
operator: "eq",
|
|
2872
|
-
value: ""
|
|
2873
|
-
}],
|
|
2874
|
-
isGroup: true
|
|
2875
|
-
};
|
|
2876
|
-
const update = (group) => {
|
|
2877
|
-
if (group.id === parentGroupId) {
|
|
2878
|
-
return { ...group, items: [...group.items, newGroup] };
|
|
2879
|
-
}
|
|
2880
|
-
return {
|
|
2881
|
-
...group,
|
|
2882
|
-
items: group.items.map(
|
|
2883
|
-
(item) => "isGroup" in item && item.isGroup ? update(item) : item
|
|
2884
|
-
)
|
|
2885
|
-
};
|
|
2886
|
-
};
|
|
2887
|
-
setRootGroup(update(rootGroup));
|
|
2888
|
-
};
|
|
2889
|
-
const removeGroup = (groupId) => {
|
|
2890
|
-
if (!rootGroup || groupId === "root") return;
|
|
2891
|
-
const update = (group) => ({
|
|
2892
|
-
...group,
|
|
2893
|
-
items: group.items.filter((item) => {
|
|
2894
|
-
if ("isGroup" in item && item.isGroup) {
|
|
2895
|
-
return item.id !== groupId;
|
|
2896
|
-
}
|
|
2897
|
-
return true;
|
|
2898
|
-
}).map(
|
|
2899
|
-
(item) => "isGroup" in item && item.isGroup ? update(item) : item
|
|
2900
|
-
)
|
|
2901
|
-
});
|
|
2902
|
-
setRootGroup(update(rootGroup));
|
|
2903
|
-
};
|
|
2904
|
-
const handleApply = () => {
|
|
2905
|
-
if (enableNestedGroups && rootGroup) {
|
|
2906
|
-
const queryString2 = generateFromGroup(rootGroup);
|
|
2907
|
-
onApply(queryString2);
|
|
2908
|
-
onClose();
|
|
2909
|
-
return;
|
|
2910
|
-
}
|
|
2911
|
-
const validRows = rows.filter((r) => {
|
|
2912
|
-
if (!r.field) return false;
|
|
2913
|
-
if (["null", "notNull"].includes(r.operator)) return true;
|
|
2914
|
-
if (r.operator === "between") return r.value.trim() && r.valueTo?.trim();
|
|
2915
|
-
return r.value.trim();
|
|
2916
|
-
});
|
|
2917
|
-
if (validRows.length === 0) {
|
|
2918
|
-
onApply("");
|
|
2919
|
-
onClose();
|
|
2920
|
-
return;
|
|
2921
|
-
}
|
|
2922
|
-
const queryString = generateFromRows(validRows, connectors.slice(0, validRows.length - 1));
|
|
2923
|
-
onApply(queryString);
|
|
2924
|
-
onClose();
|
|
2925
|
-
};
|
|
2926
|
-
const handleClearAll = () => {
|
|
2927
|
-
if (enableNestedGroups) {
|
|
2928
|
-
setRootGroup({
|
|
2929
|
-
id: "root",
|
|
2930
|
-
logic: "AND",
|
|
2931
|
-
items: [{
|
|
2932
|
-
id: `row_${Date.now()}`,
|
|
2933
|
-
field: "",
|
|
2934
|
-
operator: "eq",
|
|
2935
|
-
value: ""
|
|
2936
|
-
}],
|
|
2937
|
-
isGroup: true
|
|
2938
|
-
});
|
|
2939
|
-
} else {
|
|
2940
|
-
setRows([{
|
|
2941
|
-
id: `row_${Date.now()}`,
|
|
2942
|
-
field: "",
|
|
2943
|
-
operator: "eq",
|
|
2944
|
-
value: ""
|
|
2945
|
-
}]);
|
|
2946
|
-
setConnectors([]);
|
|
2947
|
-
}
|
|
2948
|
-
};
|
|
2949
|
-
const countActiveFilters = (group) => {
|
|
2950
|
-
let count = 0;
|
|
2951
|
-
group.items.forEach((item) => {
|
|
2952
|
-
if ("isGroup" in item && item.isGroup) {
|
|
2953
|
-
count += countActiveFilters(item);
|
|
2954
|
-
} else {
|
|
2955
|
-
const row = item;
|
|
2956
|
-
if (row.field && (["null", "notNull"].includes(row.operator) || row.value && row.value.trim())) {
|
|
2957
|
-
count++;
|
|
2958
|
-
}
|
|
2959
|
-
}
|
|
2960
|
-
});
|
|
2961
|
-
return count;
|
|
2962
|
-
};
|
|
2963
|
-
const activeCount = enableNestedGroups && rootGroup ? countActiveFilters(rootGroup) : rows.filter((r) => r.field && (["null", "notNull"].includes(r.operator) || r.value && r.value.trim())).length;
|
|
2964
|
-
const renderGroup = (group, level = 0) => {
|
|
2965
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(GroupContainer, { $logic: group.logic, $level: level, children: [
|
|
2966
|
-
/* @__PURE__ */ jsxRuntime.jsxs(GroupHeader, { children: [
|
|
2967
|
-
/* @__PURE__ */ jsxRuntime.jsxs(LogicBadge, { $logic: group.logic, children: [
|
|
2968
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2969
|
-
LogicToggleButton,
|
|
2970
|
-
{
|
|
2971
|
-
$active: group.logic === "AND",
|
|
2972
|
-
$logic: "AND",
|
|
2973
|
-
onClick: () => updateGroupLogic(group.id, "AND"),
|
|
2974
|
-
type: "button",
|
|
2975
|
-
children: "AND"
|
|
2976
|
-
}
|
|
2977
|
-
),
|
|
2978
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2979
|
-
LogicToggleButton,
|
|
2980
|
-
{
|
|
2981
|
-
$active: group.logic === "OR",
|
|
2982
|
-
$logic: "OR",
|
|
2983
|
-
onClick: () => updateGroupLogic(group.id, "OR"),
|
|
2984
|
-
type: "button",
|
|
2985
|
-
children: "OR"
|
|
2986
|
-
}
|
|
2987
|
-
)
|
|
2988
|
-
] }),
|
|
2989
|
-
/* @__PURE__ */ jsxRuntime.jsxs(GroupActions, { children: [
|
|
2990
|
-
/* @__PURE__ */ jsxRuntime.jsx(SmallButton, { onClick: () => addRowToGroup(group.id), type: "button", children: "+ Row" }),
|
|
2991
|
-
/* @__PURE__ */ jsxRuntime.jsx(SmallButton, { onClick: () => addNestedGroup(group.id), type: "button", children: "+ Group" }),
|
|
2992
|
-
group.id !== "root" && /* @__PURE__ */ jsxRuntime.jsx(RemoveGroupButton, { onClick: () => removeGroup(group.id), type: "button", children: "Remove" })
|
|
2993
|
-
] })
|
|
2994
|
-
] }),
|
|
2995
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: group.items.map((item) => {
|
|
2996
|
-
if ("isGroup" in item && item.isGroup) {
|
|
2997
|
-
return renderGroup(item, level + 1);
|
|
2998
|
-
}
|
|
2999
|
-
const row = item;
|
|
3000
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(FilterRowCard, { children: [
|
|
3001
|
-
/* @__PURE__ */ jsxRuntime.jsxs(FilterRowTop, { children: [
|
|
3002
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: "1 1 200px", minWidth: "140px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3003
|
-
CustomSelect,
|
|
3004
|
-
{
|
|
3005
|
-
value: row.field,
|
|
3006
|
-
onChange: (v) => updateRowInGroup(group.id, row.id, { field: v }),
|
|
3007
|
-
options: [
|
|
3008
|
-
{ value: "", label: "Select field..." },
|
|
3009
|
-
...fieldOptions
|
|
3010
|
-
],
|
|
3011
|
-
placeholder: "Select field",
|
|
3012
|
-
searchable: true
|
|
3013
|
-
}
|
|
3014
|
-
) }),
|
|
3015
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: "1 1 140px", minWidth: "120px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3016
|
-
CustomSelect,
|
|
3017
|
-
{
|
|
3018
|
-
value: row.operator,
|
|
3019
|
-
onChange: (v) => updateRowInGroup(group.id, row.id, { operator: v }),
|
|
3020
|
-
options: getOperatorsForType(row.fieldType).map((o) => ({ value: o.value, label: o.label })),
|
|
3021
|
-
placeholder: "Operator",
|
|
3022
|
-
searchable: false
|
|
3023
|
-
}
|
|
3024
|
-
) }),
|
|
3025
|
-
/* @__PURE__ */ jsxRuntime.jsxs(NegateCheckbox, { title: "Negate this condition (NOT)", children: [
|
|
3026
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3027
|
-
"input",
|
|
3028
|
-
{
|
|
3029
|
-
type: "checkbox",
|
|
3030
|
-
checked: row.negate || false,
|
|
3031
|
-
onChange: (e) => updateRowInGroup(group.id, row.id, { negate: e.target.checked })
|
|
3032
|
-
}
|
|
3033
|
-
),
|
|
3034
|
-
"NOT"
|
|
3035
|
-
] }),
|
|
3036
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3037
|
-
DeleteButton,
|
|
3038
|
-
{
|
|
3039
|
-
type: "button",
|
|
3040
|
-
onClick: () => removeRowFromGroup(group.id, row.id),
|
|
3041
|
-
title: "Remove filter",
|
|
3042
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {})
|
|
3043
|
-
}
|
|
3044
|
-
)
|
|
3045
|
-
] }),
|
|
3046
|
-
!["null", "notNull"].includes(row.operator) && /* @__PURE__ */ jsxRuntime.jsxs(FilterRowValue, { children: [
|
|
3047
|
-
/* @__PURE__ */ jsxRuntime.jsx(ValueLabel, { children: ["in", "notIn"].includes(row.operator) ? "Enter values (press Enter after each)" : ["between"].includes(row.operator) ? "Enter range" : "Enter value" }),
|
|
3048
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3049
|
-
SmartValueInput,
|
|
3050
|
-
{
|
|
3051
|
-
fieldType: row.fieldType,
|
|
3052
|
-
operator: row.operator,
|
|
3053
|
-
value: row.value,
|
|
3054
|
-
valueTo: row.valueTo,
|
|
3055
|
-
onChange: (v) => updateRowInGroup(group.id, row.id, { value: v }),
|
|
3056
|
-
onValueToChange: (v) => updateRowInGroup(group.id, row.id, { valueTo: v }),
|
|
3057
|
-
placeholder: "Value"
|
|
3058
|
-
}
|
|
3059
|
-
)
|
|
3060
|
-
] })
|
|
3061
|
-
] }, row.id);
|
|
3062
|
-
}) })
|
|
3063
|
-
] }, group.id);
|
|
3064
|
-
};
|
|
3065
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ModalOverlay, { onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(ModalContent, { padding: 6, onClick: (e) => e.stopPropagation(), children: [
|
|
3066
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, style: { flexShrink: 0 }, children: [
|
|
3067
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", children: [
|
|
3068
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h2", variant: "beta", children: "Advanced Filter" }),
|
|
3069
|
-
activeCount > 0 && /* @__PURE__ */ jsxRuntime.jsx(ActiveBadge, { children: activeCount })
|
|
3070
|
-
] }),
|
|
3071
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "ghost", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}) })
|
|
3072
|
-
] }),
|
|
3073
|
-
/* @__PURE__ */ jsxRuntime.jsx(ModalScrollArea, { children: enableNestedGroups && rootGroup ? (
|
|
3074
|
-
// Nested Groups Mode
|
|
3075
|
-
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3076
|
-
renderGroup(rootGroup, 0),
|
|
3077
|
-
relationsInUse.size > 0 && /* @__PURE__ */ jsxRuntime.jsxs(InfoText, { children: [
|
|
3078
|
-
Array.from(relationsInUse).join(", "),
|
|
3079
|
-
" will be loaded automatically"
|
|
3080
|
-
] })
|
|
3081
|
-
] })
|
|
3082
|
-
) : (
|
|
3083
|
-
// Flat Mode
|
|
3084
|
-
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3085
|
-
/* @__PURE__ */ jsxRuntime.jsx(RowWrapper, { children: rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs(React__default.default.Fragment, { children: [
|
|
3086
|
-
i > 0 && /* @__PURE__ */ jsxRuntime.jsxs(ConnectorPill, { children: [
|
|
3087
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3088
|
-
ConnectorButton,
|
|
3089
|
-
{
|
|
3090
|
-
type: "button",
|
|
3091
|
-
$active: connectors[i - 1]?.logic === "AND",
|
|
3092
|
-
onClick: () => updateConnector(i - 1, "AND"),
|
|
3093
|
-
children: "and"
|
|
3094
|
-
}
|
|
3095
|
-
),
|
|
3096
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { margin: "0 8px", color: "var(--colors-neutral500, #8e8ea9)" }, children: "|" }),
|
|
3097
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3098
|
-
ConnectorButton,
|
|
3099
|
-
{
|
|
3100
|
-
type: "button",
|
|
3101
|
-
$active: connectors[i - 1]?.logic === "OR",
|
|
3102
|
-
onClick: () => updateConnector(i - 1, "OR"),
|
|
3103
|
-
children: "or"
|
|
3104
|
-
}
|
|
3105
|
-
)
|
|
3106
|
-
] }),
|
|
3107
|
-
/* @__PURE__ */ jsxRuntime.jsxs(FilterRowCard, { children: [
|
|
3108
|
-
/* @__PURE__ */ jsxRuntime.jsxs(FilterRowTop, { children: [
|
|
3109
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: "1 1 200px", minWidth: "140px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3110
|
-
CustomSelect,
|
|
3111
|
-
{
|
|
3112
|
-
value: row.field,
|
|
3113
|
-
onChange: (v) => updateRow(i, { field: v }),
|
|
3114
|
-
options: [
|
|
3115
|
-
{ value: "", label: "Select field..." },
|
|
3116
|
-
...fieldOptions
|
|
3117
|
-
],
|
|
3118
|
-
placeholder: "Select field",
|
|
3119
|
-
searchable: true
|
|
3120
|
-
}
|
|
3121
|
-
) }),
|
|
3122
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: "1 1 140px", minWidth: "120px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3123
|
-
CustomSelect,
|
|
3124
|
-
{
|
|
3125
|
-
value: row.operator,
|
|
3126
|
-
onChange: (v) => updateRow(i, { operator: v }),
|
|
3127
|
-
options: getOperatorsForType(row.fieldType).map((o) => ({ value: o.value, label: o.label })),
|
|
3128
|
-
placeholder: "Operator",
|
|
3129
|
-
searchable: false
|
|
3130
|
-
}
|
|
3131
|
-
) }),
|
|
3132
|
-
/* @__PURE__ */ jsxRuntime.jsxs(NegateCheckbox, { title: "Negate this condition (NOT)", children: [
|
|
3133
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3134
|
-
"input",
|
|
3135
|
-
{
|
|
3136
|
-
type: "checkbox",
|
|
3137
|
-
checked: row.negate || false,
|
|
3138
|
-
onChange: (e) => updateRow(i, { negate: e.target.checked })
|
|
3139
|
-
}
|
|
3140
|
-
),
|
|
3141
|
-
"NOT"
|
|
3142
|
-
] }),
|
|
3143
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3144
|
-
DeleteButton,
|
|
3145
|
-
{
|
|
3146
|
-
type: "button",
|
|
3147
|
-
onClick: () => removeRow(i),
|
|
3148
|
-
title: "Remove filter",
|
|
3149
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {})
|
|
3150
|
-
}
|
|
3151
|
-
)
|
|
3152
|
-
] }),
|
|
3153
|
-
!["null", "notNull"].includes(row.operator) && /* @__PURE__ */ jsxRuntime.jsxs(FilterRowValue, { children: [
|
|
3154
|
-
/* @__PURE__ */ jsxRuntime.jsx(ValueLabel, { children: ["in", "notIn"].includes(row.operator) ? "Enter values (press Enter after each)" : ["between"].includes(row.operator) ? "Enter range" : "Enter value" }),
|
|
3155
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3156
|
-
SmartValueInput,
|
|
3157
|
-
{
|
|
3158
|
-
fieldType: row.fieldType,
|
|
3159
|
-
operator: row.operator,
|
|
3160
|
-
value: row.value,
|
|
3161
|
-
valueTo: row.valueTo,
|
|
3162
|
-
onChange: (v) => updateRow(i, { value: v }),
|
|
3163
|
-
onValueToChange: (v) => updateRow(i, { valueTo: v }),
|
|
3164
|
-
placeholder: "Value"
|
|
3165
|
-
}
|
|
3166
|
-
)
|
|
3167
|
-
] })
|
|
3168
|
-
] })
|
|
3169
|
-
] }, row.id)) }),
|
|
3170
|
-
relationsInUse.size > 0 && /* @__PURE__ */ jsxRuntime.jsxs(InfoText, { children: [
|
|
3171
|
-
Array.from(relationsInUse).join(", "),
|
|
3172
|
-
" will be loaded automatically"
|
|
3173
|
-
] })
|
|
3174
|
-
] })
|
|
3175
|
-
) }),
|
|
3176
|
-
/* @__PURE__ */ jsxRuntime.jsx(ModalFooter, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", gap: 2, children: [
|
|
3177
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClearAll, variant: "tertiary", children: "Clear All" }),
|
|
3178
|
-
!enableNestedGroups && /* @__PURE__ */ jsxRuntime.jsx(AddButton, { type: "button", onClick: addRow, children: "+ Add Filter" }),
|
|
3179
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleApply, variant: "default", children: "Apply" })
|
|
3180
|
-
] }) })
|
|
3181
|
-
] }) });
|
|
3182
|
-
};
|
|
3183
|
-
const FEATURES = {
|
|
3184
|
-
// Free tier features
|
|
3185
|
-
basicBookmarks: { tier: "free", limit: 10 },
|
|
3186
|
-
basicFilters: { tier: "free" },
|
|
3187
|
-
// Premium tier features
|
|
3188
|
-
extendedBookmarks: { tier: "premium", limit: 50 },
|
|
3189
|
-
queryHistory: { tier: "premium" },
|
|
3190
|
-
exportBookmarks: { tier: "premium" },
|
|
3191
|
-
sharedBookmarks: { tier: "premium" },
|
|
3192
|
-
// Advanced tier features
|
|
3193
|
-
unlimitedBookmarks: { tier: "advanced", limit: -1 },
|
|
3194
|
-
advancedFilters: { tier: "advanced" },
|
|
3195
|
-
subGroups: { tier: "advanced" },
|
|
3196
|
-
bulkOperations: { tier: "advanced" },
|
|
3197
|
-
analytics: { tier: "advanced" },
|
|
3198
|
-
customIntegrations: { tier: "advanced" }
|
|
3199
|
-
};
|
|
3200
|
-
const useLicenseInfo = () => {
|
|
3201
|
-
const { get } = admin.useFetchClient();
|
|
3202
|
-
const [limits, setLimits] = React.useState(null);
|
|
3203
|
-
const [isLoading, setIsLoading] = React.useState(true);
|
|
3204
|
-
React.useEffect(() => {
|
|
3205
|
-
const fetchLimits = async () => {
|
|
3206
|
-
try {
|
|
3207
|
-
console.log("[useLicenseInfo] Fetching license limits...");
|
|
3208
|
-
const response = await get("/magic-mark/license/limits");
|
|
3209
|
-
console.log("[useLicenseInfo] Raw API response:", response);
|
|
3210
|
-
console.log("[useLicenseInfo] Response data:", response.data);
|
|
3211
|
-
if (response.data?.success) {
|
|
3212
|
-
console.log("[useLicenseInfo] Setting limits:", response.data.data);
|
|
3213
|
-
setLimits(response.data.data);
|
|
3214
|
-
} else {
|
|
3215
|
-
console.warn("[useLicenseInfo] API returned success=false or missing data");
|
|
3216
|
-
}
|
|
3217
|
-
} catch (error) {
|
|
3218
|
-
console.error("[useLicenseInfo] Error fetching license limits:", error);
|
|
3219
|
-
} finally {
|
|
3220
|
-
setIsLoading(false);
|
|
3221
|
-
}
|
|
3222
|
-
};
|
|
3223
|
-
fetchLimits();
|
|
3224
|
-
}, []);
|
|
3225
|
-
const tier = limits?.tier || "free";
|
|
3226
|
-
const isPremium = tier === "premium" || tier === "advanced";
|
|
3227
|
-
const isAdvanced = tier === "advanced";
|
|
3228
|
-
console.log("[useLicenseInfo] Computed values:", { tier, isPremium, isAdvanced, limits });
|
|
3229
|
-
return {
|
|
3230
|
-
isLoading,
|
|
3231
|
-
limits,
|
|
3232
|
-
tier,
|
|
3233
|
-
isFree: tier === "free",
|
|
3234
|
-
isPremium,
|
|
3235
|
-
isAdvanced,
|
|
3236
|
-
canUseFeature: (feature) => {
|
|
3237
|
-
const featureConfig = FEATURES[feature];
|
|
3238
|
-
const tierOrder = { free: 0, premium: 1, advanced: 2 };
|
|
3239
|
-
return tierOrder[tier] >= tierOrder[featureConfig.tier];
|
|
3240
|
-
}
|
|
3241
|
-
};
|
|
3242
|
-
};
|
|
3243
|
-
const FilterButtonGroup = styled__default.default.div`
|
|
3244
|
-
display: flex;
|
|
3245
|
-
align-items: center;
|
|
3246
|
-
gap: 6px;
|
|
3247
|
-
`;
|
|
3248
|
-
const FilterButton = styled__default.default.button`
|
|
3249
|
-
display: inline-flex;
|
|
3250
|
-
align-items: center;
|
|
3251
|
-
justify-content: center;
|
|
3252
|
-
gap: 6px;
|
|
3253
|
-
height: 36px;
|
|
3254
|
-
padding: 0 14px;
|
|
3255
|
-
font-size: 13px;
|
|
3256
|
-
font-weight: 500;
|
|
3257
|
-
border: 1px solid ${(props) => props.$isActive ? "#4945FF" : "rgba(128, 128, 128, 0.25)"};
|
|
3258
|
-
border-radius: 4px;
|
|
3259
|
-
background: ${(props) => props.$isActive ? "rgba(73, 69, 255, 0.08)" : props.theme.colors.neutral0};
|
|
3260
|
-
color: ${(props) => props.$isActive ? "#4945FF" : props.theme.colors.neutral800};
|
|
3261
|
-
cursor: pointer;
|
|
3262
|
-
transition: all 0.15s ease;
|
|
3263
|
-
white-space: nowrap;
|
|
3264
|
-
|
|
3265
|
-
&:hover {
|
|
3266
|
-
background: ${(props) => props.$isActive ? "rgba(73, 69, 255, 0.12)" : props.theme.colors.neutral100};
|
|
3267
|
-
border-color: ${(props) => props.$isActive ? "#4945FF" : "rgba(128, 128, 128, 0.3)"};
|
|
3268
|
-
}
|
|
3269
|
-
|
|
3270
|
-
&:active {
|
|
3271
|
-
transform: scale(0.98);
|
|
3272
|
-
}
|
|
3273
|
-
|
|
3274
|
-
svg {
|
|
3275
|
-
width: 16px;
|
|
3276
|
-
height: 16px;
|
|
3277
|
-
flex-shrink: 0;
|
|
3278
|
-
}
|
|
3279
|
-
`;
|
|
3280
|
-
const ClearButton = styled__default.default.button`
|
|
3281
|
-
display: inline-flex;
|
|
3282
|
-
align-items: center;
|
|
3283
|
-
justify-content: center;
|
|
3284
|
-
width: 36px;
|
|
3285
|
-
height: 36px;
|
|
3286
|
-
padding: 0;
|
|
3287
|
-
border: 1px solid rgba(239, 68, 68, 0.3);
|
|
3288
|
-
border-radius: 4px;
|
|
3289
|
-
background: rgba(239, 68, 68, 0.06);
|
|
3290
|
-
color: #dc2626;
|
|
3291
|
-
cursor: pointer;
|
|
3292
|
-
transition: all 0.15s ease;
|
|
3293
|
-
|
|
3294
|
-
&:hover {
|
|
3295
|
-
background: rgba(239, 68, 68, 0.12);
|
|
3296
|
-
border-color: rgba(239, 68, 68, 0.4);
|
|
3297
|
-
}
|
|
3298
|
-
|
|
3299
|
-
&:active {
|
|
3300
|
-
transform: scale(0.98);
|
|
3301
|
-
}
|
|
3302
|
-
|
|
3303
|
-
svg {
|
|
3304
|
-
width: 16px;
|
|
3305
|
-
height: 16px;
|
|
3306
|
-
}
|
|
3307
|
-
`;
|
|
3308
|
-
const ActiveDot = styled__default.default.span`
|
|
3309
|
-
width: 6px;
|
|
3310
|
-
height: 6px;
|
|
3311
|
-
background: #22c55e;
|
|
3312
|
-
border-radius: 50%;
|
|
3313
|
-
margin-left: 2px;
|
|
3314
|
-
`;
|
|
3315
|
-
const AdvancedFilterButton = () => {
|
|
3316
|
-
const [showModal, setShowModal] = React.useState(false);
|
|
3317
|
-
const navigate = reactRouterDom.useNavigate();
|
|
3318
|
-
const location = reactRouterDom.useLocation();
|
|
3319
|
-
const { get } = admin.useFetchClient();
|
|
3320
|
-
const { isPremium, isAdvanced } = useLicenseInfo();
|
|
3321
|
-
const [availableFields, setAvailableFields] = React.useState([]);
|
|
3322
|
-
const [availableRelations, setAvailableRelations] = React.useState([]);
|
|
3323
|
-
const [hasActiveFilters, setHasActiveFilters] = React.useState(false);
|
|
3324
|
-
React.useEffect(() => {
|
|
3325
|
-
const params = new URLSearchParams(location.search);
|
|
3326
|
-
let hasFilters = false;
|
|
3327
|
-
params.forEach((value, key) => {
|
|
3328
|
-
if (key.startsWith("filters[")) {
|
|
3329
|
-
hasFilters = true;
|
|
3330
|
-
}
|
|
3331
|
-
});
|
|
3332
|
-
setHasActiveFilters(hasFilters);
|
|
3333
|
-
}, [location.search]);
|
|
3334
|
-
const extractContentTypeUid = () => {
|
|
3335
|
-
const match = location.pathname.match(/collection-types\/([^/?]+)/);
|
|
3336
|
-
return match ? match[1] : null;
|
|
3337
|
-
};
|
|
3338
|
-
React.useEffect(() => {
|
|
3339
|
-
const fetchSchema = async () => {
|
|
3340
|
-
const uid = extractContentTypeUid();
|
|
3341
|
-
if (!uid) {
|
|
3342
|
-
console.log("[AdvancedFilter] No content type UID found in URL");
|
|
3343
|
-
return;
|
|
3344
|
-
}
|
|
3345
|
-
try {
|
|
3346
|
-
console.log("[AdvancedFilter] Fetching schema for:", uid);
|
|
3347
|
-
let realAttributes = {};
|
|
3348
|
-
try {
|
|
3349
|
-
const schemaResponse = await get(`/content-type-builder/content-types/${uid}`);
|
|
3350
|
-
const schemaInfo = schemaResponse.data?.data?.schema || schemaResponse.data?.schema || {};
|
|
3351
|
-
realAttributes = schemaInfo.attributes || {};
|
|
3352
|
-
console.log("[AdvancedFilter] Real schema attributes:", realAttributes);
|
|
3353
|
-
} catch (e) {
|
|
3354
|
-
console.log("[AdvancedFilter] Content-type-builder endpoint failed:", e);
|
|
3355
|
-
}
|
|
3356
|
-
let metadatas = {};
|
|
3357
|
-
try {
|
|
3358
|
-
const configResponse = await get(`/content-manager/content-types/${uid}/configuration`);
|
|
3359
|
-
const contentTypeData = configResponse.data?.data?.contentType || configResponse.data?.contentType || {};
|
|
3360
|
-
metadatas = contentTypeData.metadatas || {};
|
|
3361
|
-
console.log("[AdvancedFilter] Configuration metadatas:", metadatas);
|
|
3362
|
-
} catch (e) {
|
|
3363
|
-
console.log("[AdvancedFilter] Configuration endpoint failed:", e);
|
|
3364
|
-
}
|
|
3365
|
-
const fields = [];
|
|
3366
|
-
const relations = [];
|
|
3367
|
-
const fieldNames = /* @__PURE__ */ new Set();
|
|
3368
|
-
Object.keys(realAttributes).forEach((key) => {
|
|
3369
|
-
const attr = realAttributes[key];
|
|
3370
|
-
const attrType = attr.type;
|
|
3371
|
-
if (["createdBy", "updatedBy", "localizations", "locale"].includes(key)) {
|
|
3372
|
-
return;
|
|
3373
|
-
}
|
|
3374
|
-
if (attrType === "relation") {
|
|
3375
|
-
relations.push({ name: key, target: attr.target });
|
|
3376
|
-
console.log("[AdvancedFilter] Found relation:", key, "-> target:", attr.target);
|
|
3377
|
-
} else if (attrType === "component" || attrType === "dynamiczone") {
|
|
3378
|
-
console.log("[AdvancedFilter] Skipping component/dynamiczone:", key);
|
|
3379
|
-
} else if (attrType === "media") {
|
|
3380
|
-
console.log("[AdvancedFilter] Skipping media:", key);
|
|
3381
|
-
} else if (!fieldNames.has(key)) {
|
|
3382
|
-
fieldNames.add(key);
|
|
3383
|
-
fields.push({
|
|
3384
|
-
name: key,
|
|
3385
|
-
type: attrType || "string"
|
|
3386
|
-
});
|
|
3387
|
-
}
|
|
3388
|
-
});
|
|
3389
|
-
["id", "documentId", "createdAt", "updatedAt"].forEach((defaultField) => {
|
|
3390
|
-
if (!fieldNames.has(defaultField)) {
|
|
3391
|
-
let type = "string";
|
|
3392
|
-
if (defaultField === "id") type = "integer";
|
|
3393
|
-
if (defaultField === "createdAt" || defaultField === "updatedAt") type = "datetime";
|
|
3394
|
-
fields.unshift({ name: defaultField, type });
|
|
3395
|
-
}
|
|
3396
|
-
});
|
|
3397
|
-
setAvailableFields(fields);
|
|
3398
|
-
setAvailableRelations(relations);
|
|
3399
|
-
console.log("[AdvancedFilter] Final fields:", fields);
|
|
3400
|
-
console.log("[AdvancedFilter] Final relations:", relations);
|
|
3401
|
-
} catch (error) {
|
|
3402
|
-
console.error("[AdvancedFilter] Error fetching schema:", error);
|
|
3403
|
-
setAvailableFields([
|
|
3404
|
-
{ name: "id", type: "integer" },
|
|
3405
|
-
{ name: "documentId", type: "string" },
|
|
3406
|
-
{ name: "createdAt", type: "datetime" },
|
|
3407
|
-
{ name: "updatedAt", type: "datetime" }
|
|
3408
|
-
]);
|
|
3409
|
-
}
|
|
3410
|
-
};
|
|
3411
|
-
fetchSchema();
|
|
3412
|
-
}, [location.pathname]);
|
|
3413
|
-
const handleApplyFilters = (queryString) => {
|
|
3414
|
-
console.log("[AdvancedFilter] Applying filters:", queryString);
|
|
3415
|
-
const currentPath = location.pathname;
|
|
3416
|
-
const currentParams = new URLSearchParams(location.search);
|
|
3417
|
-
const newParams = new URLSearchParams(queryString);
|
|
3418
|
-
const cleanParams = new URLSearchParams();
|
|
3419
|
-
currentParams.forEach((value, key) => {
|
|
3420
|
-
if (!key.startsWith("filters[") && !key.startsWith("populate[")) {
|
|
3421
|
-
cleanParams.set(key, value);
|
|
3422
|
-
}
|
|
3423
|
-
});
|
|
3424
|
-
newParams.forEach((value, key) => {
|
|
3425
|
-
cleanParams.set(key, value);
|
|
3426
|
-
});
|
|
3427
|
-
cleanParams.set("page", "1");
|
|
3428
|
-
const finalUrl = `${currentPath}?${cleanParams.toString()}`;
|
|
3429
|
-
console.log("[AdvancedFilter] Final URL:", finalUrl);
|
|
3430
|
-
navigate(finalUrl);
|
|
3431
|
-
setTimeout(() => {
|
|
3432
|
-
window.location.reload();
|
|
3433
|
-
}, 100);
|
|
3434
|
-
};
|
|
3435
|
-
const handleClearFilters = () => {
|
|
3436
|
-
const currentPath = location.pathname;
|
|
3437
|
-
const currentParams = new URLSearchParams(location.search);
|
|
3438
|
-
const cleanParams = new URLSearchParams();
|
|
3439
|
-
currentParams.forEach((value, key) => {
|
|
3440
|
-
if (!key.startsWith("filters[") && !key.startsWith("populate[")) {
|
|
3441
|
-
cleanParams.set(key, value);
|
|
3442
|
-
}
|
|
3443
|
-
});
|
|
3444
|
-
const finalUrl = `${currentPath}${cleanParams.toString() ? "?" + cleanParams.toString() : ""}`;
|
|
3445
|
-
navigate(finalUrl);
|
|
3446
|
-
setTimeout(() => {
|
|
3447
|
-
window.location.reload();
|
|
3448
|
-
}, 100);
|
|
3449
|
-
};
|
|
3450
|
-
const getCurrentFilters = () => {
|
|
3451
|
-
const params = new URLSearchParams(location.search);
|
|
3452
|
-
const currentQuery = params.toString();
|
|
3453
|
-
console.log("[AdvancedFilter] Current query from URL:", currentQuery);
|
|
3454
|
-
return currentQuery;
|
|
3455
|
-
};
|
|
3456
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(FilterButtonGroup, { children: [
|
|
3457
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3458
|
-
FilterButton,
|
|
3459
|
-
{
|
|
3460
|
-
$isActive: hasActiveFilters,
|
|
3461
|
-
onClick: () => setShowModal(true),
|
|
3462
|
-
title: "Open advanced filter builder",
|
|
3463
|
-
children: [
|
|
3464
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Filter, {}),
|
|
3465
|
-
"Advanced Filter",
|
|
3466
|
-
hasActiveFilters && /* @__PURE__ */ jsxRuntime.jsx(ActiveDot, {})
|
|
3467
|
-
]
|
|
3468
|
-
}
|
|
3469
|
-
),
|
|
3470
|
-
hasActiveFilters && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3471
|
-
ClearButton,
|
|
3472
|
-
{
|
|
3473
|
-
onClick: handleClearFilters,
|
|
3474
|
-
title: "Clear all filters",
|
|
3475
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {})
|
|
3476
|
-
}
|
|
3477
|
-
),
|
|
3478
|
-
showModal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3479
|
-
StrapiStyleFilterModal,
|
|
3480
|
-
{
|
|
3481
|
-
onClose: () => setShowModal(false),
|
|
3482
|
-
onApply: handleApplyFilters,
|
|
3483
|
-
availableFields,
|
|
3484
|
-
availableRelations,
|
|
3485
|
-
currentQuery: getCurrentFilters(),
|
|
3486
|
-
enableNestedGroups: isPremium || isAdvanced
|
|
3487
|
-
}
|
|
3488
|
-
)
|
|
3489
|
-
] });
|
|
3490
|
-
};
|
|
3491
|
-
const name = pluginPkg.strapi.name;
|
|
3492
|
-
const prefixPluginTranslations = (data, pluginId2) => {
|
|
3493
|
-
const prefixed = {};
|
|
3494
|
-
Object.keys(data).forEach((key) => {
|
|
3495
|
-
prefixed[`${pluginId2}.${key}`] = data[key];
|
|
3496
|
-
});
|
|
3497
|
-
return prefixed;
|
|
3498
|
-
};
|
|
3499
|
-
const index = {
|
|
3500
|
-
register(app) {
|
|
3501
|
-
console.log(`[${pluginId}] Registering plugin...`);
|
|
3502
|
-
app.addMenuLink({
|
|
3503
|
-
to: `plugins/${pluginId}`,
|
|
3504
|
-
icon: PluginIcon,
|
|
3505
|
-
intlLabel: {
|
|
3506
|
-
id: `${pluginId}.Admin.MainMenu.PluginName`,
|
|
3507
|
-
defaultMessage: name
|
|
3508
|
-
},
|
|
3509
|
-
Component: () => Promise.resolve().then(() => require("./App-DNyxeldt.js")),
|
|
3510
|
-
permissions: []
|
|
3511
|
-
});
|
|
3512
|
-
app.createSettingSection(
|
|
3513
|
-
{
|
|
3514
|
-
id: pluginId,
|
|
3515
|
-
intlLabel: {
|
|
3516
|
-
id: `${pluginId}.settings.title`,
|
|
3517
|
-
defaultMessage: "MagicMark"
|
|
3518
|
-
}
|
|
3519
|
-
},
|
|
3520
|
-
[
|
|
3521
|
-
{
|
|
3522
|
-
intlLabel: {
|
|
3523
|
-
id: `${pluginId}.settings.upgrade`,
|
|
3524
|
-
defaultMessage: "Upgrade"
|
|
3525
|
-
},
|
|
3526
|
-
id: "magic-mark-upgrade",
|
|
3527
|
-
to: `${pluginId}/upgrade`,
|
|
3528
|
-
Component: () => Promise.resolve().then(() => require(
|
|
3529
|
-
/* webpackChunkName: "magic-mark-upgrade" */
|
|
3530
|
-
"./UpgradePage-SzlmS6po.js"
|
|
3531
|
-
)),
|
|
3532
|
-
permissions: []
|
|
3533
|
-
},
|
|
3534
|
-
{
|
|
3535
|
-
intlLabel: {
|
|
3536
|
-
id: `${pluginId}.settings.license`,
|
|
3537
|
-
defaultMessage: "License"
|
|
3538
|
-
},
|
|
3539
|
-
id: "magic-mark-license",
|
|
3540
|
-
to: `${pluginId}/license`,
|
|
3541
|
-
Component: () => Promise.resolve().then(() => require(
|
|
3542
|
-
/* webpackChunkName: "magic-mark-license" */
|
|
3543
|
-
"./index-uUErgmi9.js"
|
|
3544
|
-
)),
|
|
3545
|
-
permissions: []
|
|
3546
|
-
}
|
|
3547
|
-
]
|
|
3548
|
-
);
|
|
3549
|
-
app.registerPlugin({
|
|
3550
|
-
id: pluginId,
|
|
3551
|
-
initializer: Initializer,
|
|
3552
|
-
isReady: true,
|
|
3553
|
-
name
|
|
3554
|
-
});
|
|
3555
|
-
},
|
|
3556
|
-
async bootstrap(app) {
|
|
3557
|
-
console.log(`[${pluginId}] Bootstrapping plugin...`);
|
|
3558
|
-
try {
|
|
3559
|
-
const contentManagerPlugin = app.getPlugin("content-manager");
|
|
3560
|
-
if (contentManagerPlugin) {
|
|
3561
|
-
console.log(`[${pluginId}] Injecting content manager components...`);
|
|
3562
|
-
contentManagerPlugin.injectComponent("listView", "actions", {
|
|
3563
|
-
name: "magic-mark-advanced-filter",
|
|
3564
|
-
Component: AdvancedFilterButton
|
|
3565
|
-
});
|
|
3566
|
-
contentManagerPlugin.injectComponent("listView", "actions", {
|
|
3567
|
-
name: "magic-mark-views-widget",
|
|
3568
|
-
Component: ViewsWidget
|
|
3569
|
-
});
|
|
3570
|
-
console.log(`[${pluginId}] Successfully injected content manager components`);
|
|
3571
|
-
}
|
|
3572
|
-
} catch (error) {
|
|
3573
|
-
console.error(`[${pluginId}] Error injecting content manager components:`, error);
|
|
3574
|
-
}
|
|
3575
|
-
const env = typeof process === "undefined" ? {} : process.env;
|
|
3576
|
-
if (env.STRAPI_ADMIN_FAVORITE_VIEWS_INJECT_TO) {
|
|
3577
|
-
for (const entry of env.STRAPI_ADMIN_FAVORITE_VIEWS_INJECT_TO.split(",")) {
|
|
3578
|
-
const parts = entry.split("::");
|
|
3579
|
-
if (parts.length < 2) continue;
|
|
3580
|
-
const [, pluginAndPath] = parts;
|
|
3581
|
-
const [pluginName, container, block] = pluginAndPath.split(".");
|
|
3582
|
-
const plugin = app.getPlugin(pluginName);
|
|
3583
|
-
if (!plugin) continue;
|
|
3584
|
-
try {
|
|
3585
|
-
plugin.injectComponent(container, block, {
|
|
3586
|
-
name: "favorite-views-widget",
|
|
3587
|
-
Component: ViewsWidget
|
|
3588
|
-
});
|
|
3589
|
-
} catch (error) {
|
|
3590
|
-
console.error(`[${pluginId}] Error injecting component to ${pluginName}:`, error);
|
|
3591
|
-
}
|
|
3592
|
-
}
|
|
3593
|
-
}
|
|
3594
|
-
},
|
|
3595
|
-
async registerTrads({ locales }) {
|
|
3596
|
-
const importedTrads = await Promise.all(
|
|
3597
|
-
locales.map((locale) => {
|
|
3598
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-Cs9dd3Mr.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-CE3r46Y2.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-D4AOyJYJ.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-CWSfoA8i.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-DW_6r_mP.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
|
3599
|
-
return {
|
|
3600
|
-
data: prefixPluginTranslations(data, pluginId),
|
|
3601
|
-
locale
|
|
3602
|
-
};
|
|
3603
|
-
}).catch(() => {
|
|
3604
|
-
return {
|
|
3605
|
-
data: {},
|
|
3606
|
-
locale
|
|
3607
|
-
};
|
|
3608
|
-
});
|
|
3609
|
-
})
|
|
3610
|
-
);
|
|
3611
|
-
return Promise.resolve(importedTrads);
|
|
3612
|
-
}
|
|
3613
|
-
};
|
|
3614
|
-
exports.CreateEditModal = CreateEditModal;
|
|
3615
|
-
exports.getIconById = getIconById;
|
|
3616
|
-
exports.index = index;
|
|
3617
|
-
exports.pluginId = pluginId;
|
|
3618
|
-
exports.useLicenseInfo = useLicenseInfo;
|