@ozguraltan/strapi-content-input 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/{ContentInputField-D-oLSSaU.mjs → ContentInputField-CKTOutN-.mjs} +357 -43
- package/dist/admin/{ContentInputField-BKP5B-ap.js → ContentInputField-CLuL3TFr.js} +357 -43
- package/dist/admin/{index-DjfM5X8R.mjs → index-BIwC3VPC.mjs} +1 -1
- package/dist/admin/{index-CEOkAoB9.js → index-DV4pLrQl.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/widgets/StrapiMediaPicker.d.ts +2 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useState, useMemo, useRef, createContext, useContext, useEffect } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import cloneDeep from "lodash/cloneDeep";
|
|
5
|
-
import { M as MaterialIcon } from "./index-
|
|
5
|
+
import { M as MaterialIcon } from "./index-BIwC3VPC.mjs";
|
|
6
6
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
7
7
|
const ROW_PRESETS = [
|
|
8
8
|
{
|
|
@@ -845,7 +845,8 @@ const translations = {
|
|
|
845
845
|
gridGallery: "Grid Gallery",
|
|
846
846
|
galleryDisplayType: "Gallery Display Type",
|
|
847
847
|
galleryImages: "Gallery Images",
|
|
848
|
-
addGalleryImage: "+ Add Image",
|
|
848
|
+
addGalleryImage: "+ Add Image(s)",
|
|
849
|
+
clearAllImages: "Clear All",
|
|
849
850
|
noGalleryImages: "No images added to this gallery yet.",
|
|
850
851
|
popupOnOnClick: "Open in Lightbox Popup on Click",
|
|
851
852
|
imageProcess: "Image Processing",
|
|
@@ -974,17 +975,37 @@ const translations = {
|
|
|
974
975
|
// Media Picker
|
|
975
976
|
selectImage: "Select Image",
|
|
976
977
|
selectMedia: "Select Media",
|
|
978
|
+
selectMultipleMedia: "Select Images",
|
|
977
979
|
removeImage: "Remove Image",
|
|
978
980
|
mediaUrlPlaceholder: "Image URL or choose from Media Library...",
|
|
979
981
|
mediaLibraryTitle: "Strapi Media Library",
|
|
980
982
|
filesCount: "files",
|
|
981
983
|
refresh: "Refresh",
|
|
982
984
|
uploading: "Uploading...",
|
|
983
|
-
uploadNewFile: "Upload New File",
|
|
985
|
+
uploadNewFile: "Upload New File(s)",
|
|
984
986
|
searchFilesPlaceholder: "Search by file name or extension...",
|
|
985
987
|
loadingMediaFiles: "Loading media files...",
|
|
986
988
|
noMediaFilesFound: "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
|
|
987
|
-
selectedBadge: "SELECTED"
|
|
989
|
+
selectedBadge: "SELECTED",
|
|
990
|
+
multiSelectHint: "Click multiple images to select them in order",
|
|
991
|
+
selectedCountLabel: "selected",
|
|
992
|
+
selectAllVisible: "Select All",
|
|
993
|
+
clearSelection: "Clear Selection",
|
|
994
|
+
addSelectedMedia: "Add Selected",
|
|
995
|
+
"media.selectImage": "Select Image",
|
|
996
|
+
"media.selectMedia": "Select Media",
|
|
997
|
+
"media.selectMultipleMedia": "Select Images",
|
|
998
|
+
"media.removeImage": "Remove Image",
|
|
999
|
+
"media.urlPlaceholder": "Image URL or choose from Media Library...",
|
|
1000
|
+
"media.libraryTitle": "Strapi Media Library",
|
|
1001
|
+
"media.filesCount": "files",
|
|
1002
|
+
"media.refresh": "Refresh",
|
|
1003
|
+
"media.uploading": "Uploading...",
|
|
1004
|
+
"media.uploadNew": "Upload New File(s)",
|
|
1005
|
+
"media.searchPlaceholder": "Search by file name or extension...",
|
|
1006
|
+
"media.loadingFiles": "Loading media files...",
|
|
1007
|
+
"media.noMatchingFiles": "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
|
|
1008
|
+
"media.selectedBadge": "SELECTED"
|
|
988
1009
|
},
|
|
989
1010
|
tr: {
|
|
990
1011
|
// Core entities & actions
|
|
@@ -1158,7 +1179,8 @@ const translations = {
|
|
|
1158
1179
|
gridGallery: "Grid (Izgara Galeri)",
|
|
1159
1180
|
galleryDisplayType: "Galeri Gösterim Tipi",
|
|
1160
1181
|
galleryImages: "Galeri Görselleri",
|
|
1161
|
-
addGalleryImage: "+ Görsel Ekle",
|
|
1182
|
+
addGalleryImage: "+ Görsel(ler) Ekle",
|
|
1183
|
+
clearAllImages: "Tümünü Temizle",
|
|
1162
1184
|
noGalleryImages: "Henüz galeriye görsel eklenmedi.",
|
|
1163
1185
|
popupOnOnClick: "Tıklandığında Pop-up (Lightbox) Olarak Büyüt",
|
|
1164
1186
|
imageProcess: "Görsel İşleme (Image Process)",
|
|
@@ -1287,17 +1309,37 @@ const translations = {
|
|
|
1287
1309
|
// Media Picker
|
|
1288
1310
|
selectImage: "Görsel Seç",
|
|
1289
1311
|
selectMedia: "Medya Seç",
|
|
1312
|
+
selectMultipleMedia: "Çoklu Görsel Seç",
|
|
1290
1313
|
removeImage: "Görseli Kaldır",
|
|
1291
1314
|
mediaUrlPlaceholder: "Görsel URL veya Medya Kütüphanesi...",
|
|
1292
1315
|
mediaLibraryTitle: "Strapi Medya Kütüphanesi",
|
|
1293
1316
|
filesCount: "dosya",
|
|
1294
1317
|
refresh: "Yenile",
|
|
1295
1318
|
uploading: "Yükleniyor...",
|
|
1296
|
-
uploadNewFile: "Yeni Dosya Yükle",
|
|
1319
|
+
uploadNewFile: "Yeni Dosya(lar) Yükle",
|
|
1297
1320
|
searchFilesPlaceholder: "Dosya adı veya uzantı ara...",
|
|
1298
1321
|
loadingMediaFiles: "Medya dosyaları yükleniyor...",
|
|
1299
1322
|
noMediaFilesFound: "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
|
|
1300
|
-
selectedBadge: "SEÇİLİ"
|
|
1323
|
+
selectedBadge: "SEÇİLİ",
|
|
1324
|
+
multiSelectHint: "Birden fazla görseli sırayla seçmek için üzerine tıklayın",
|
|
1325
|
+
selectedCountLabel: "seçildi",
|
|
1326
|
+
selectAllVisible: "Tümünü Seç",
|
|
1327
|
+
clearSelection: "Seçimi Temizle",
|
|
1328
|
+
addSelectedMedia: "Seçilenleri Ekle",
|
|
1329
|
+
"media.selectImage": "Görsel Seç",
|
|
1330
|
+
"media.selectMedia": "Medya Seç",
|
|
1331
|
+
"media.selectMultipleMedia": "Çoklu Görsel Seç",
|
|
1332
|
+
"media.removeImage": "Görseli Kaldır",
|
|
1333
|
+
"media.urlPlaceholder": "Görsel URL veya Medya Kütüphanesi...",
|
|
1334
|
+
"media.libraryTitle": "Strapi Medya Kütüphanesi",
|
|
1335
|
+
"media.filesCount": "dosya",
|
|
1336
|
+
"media.refresh": "Yenile",
|
|
1337
|
+
"media.uploading": "Yükleniyor...",
|
|
1338
|
+
"media.uploadNew": "Yeni Dosya(lar) Yükle",
|
|
1339
|
+
"media.searchPlaceholder": "Dosya adı veya uzantı ara...",
|
|
1340
|
+
"media.loadingFiles": "Medya dosyaları yükleniyor...",
|
|
1341
|
+
"media.noMatchingFiles": "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
|
|
1342
|
+
"media.selectedBadge": "SEÇİLİ"
|
|
1301
1343
|
}
|
|
1302
1344
|
};
|
|
1303
1345
|
function createTranslator(locale = "en") {
|
|
@@ -11426,6 +11468,9 @@ const UnitInput = ({
|
|
|
11426
11468
|
)
|
|
11427
11469
|
] });
|
|
11428
11470
|
};
|
|
11471
|
+
function getFileKey(file) {
|
|
11472
|
+
return String(file?.id ?? file?.documentId ?? file?.url ?? file?.name ?? "");
|
|
11473
|
+
}
|
|
11429
11474
|
function mapStrapiFileToAsset(file) {
|
|
11430
11475
|
const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${f.url} ${f.width}w`).join(", ") : "";
|
|
11431
11476
|
return {
|
|
@@ -11443,12 +11488,15 @@ function mapStrapiFileToAsset(file) {
|
|
|
11443
11488
|
const StrapiMediaPicker = ({
|
|
11444
11489
|
value,
|
|
11445
11490
|
onChange,
|
|
11446
|
-
label
|
|
11491
|
+
label,
|
|
11492
|
+
multiple = false,
|
|
11493
|
+
onSelectMultiple
|
|
11447
11494
|
}) => {
|
|
11448
11495
|
const { t } = useEditorTranslator();
|
|
11449
11496
|
const { get, post } = useFetchClient();
|
|
11450
11497
|
const [modalOpen, setModalOpen] = useState(false);
|
|
11451
11498
|
const [files, setFiles] = useState([]);
|
|
11499
|
+
const [selectedFiles, setSelectedFiles] = useState([]);
|
|
11452
11500
|
const [loading, setLoading] = useState(false);
|
|
11453
11501
|
const [uploading, setUploading] = useState(false);
|
|
11454
11502
|
const [search, setSearch] = useState("");
|
|
@@ -11486,24 +11534,57 @@ const StrapiMediaPicker = ({
|
|
|
11486
11534
|
const handleOpenModal = (e) => {
|
|
11487
11535
|
e.preventDefault();
|
|
11488
11536
|
e.stopPropagation();
|
|
11537
|
+
setSelectedFiles([]);
|
|
11489
11538
|
setModalOpen(true);
|
|
11490
11539
|
loadLibrary().finally(() => setLoading(false));
|
|
11491
11540
|
};
|
|
11541
|
+
const toggleFileSelection = (file) => {
|
|
11542
|
+
const key = getFileKey(file);
|
|
11543
|
+
setSelectedFiles((prev) => {
|
|
11544
|
+
const exists = prev.some((f) => getFileKey(f) === key);
|
|
11545
|
+
if (exists) {
|
|
11546
|
+
return prev.filter((f) => getFileKey(f) !== key);
|
|
11547
|
+
}
|
|
11548
|
+
return [...prev, file];
|
|
11549
|
+
});
|
|
11550
|
+
};
|
|
11551
|
+
const handleConfirmMultiple = () => {
|
|
11552
|
+
if (selectedFiles.length === 0) return;
|
|
11553
|
+
const assets = selectedFiles.map(mapStrapiFileToAsset);
|
|
11554
|
+
if (onSelectMultiple) {
|
|
11555
|
+
onSelectMultiple(assets);
|
|
11556
|
+
} else {
|
|
11557
|
+
assets.forEach((asset) => onChange(asset));
|
|
11558
|
+
}
|
|
11559
|
+
setSelectedFiles([]);
|
|
11560
|
+
setModalOpen(false);
|
|
11561
|
+
};
|
|
11492
11562
|
const handleFileUpload = async (e) => {
|
|
11493
|
-
const
|
|
11494
|
-
if (!
|
|
11563
|
+
const inputFiles = e.target.files;
|
|
11564
|
+
if (!inputFiles || inputFiles.length === 0) return;
|
|
11495
11565
|
setUploading(true);
|
|
11496
11566
|
try {
|
|
11497
11567
|
const formData = new FormData();
|
|
11498
|
-
for (let i = 0; i <
|
|
11499
|
-
formData.append("files",
|
|
11568
|
+
for (let i = 0; i < inputFiles.length; i++) {
|
|
11569
|
+
formData.append("files", inputFiles[i]);
|
|
11500
11570
|
}
|
|
11501
11571
|
const res = await post("/upload", formData);
|
|
11502
11572
|
const uploadedList = Array.isArray(res?.data) ? res.data : Array.isArray(res?.data?.data) ? res.data.data : [];
|
|
11503
11573
|
await loadLibrary();
|
|
11504
11574
|
if (uploadedList.length > 0) {
|
|
11505
|
-
|
|
11506
|
-
|
|
11575
|
+
if (multiple) {
|
|
11576
|
+
const assets = uploadedList.map(mapStrapiFileToAsset);
|
|
11577
|
+
if (onSelectMultiple) {
|
|
11578
|
+
onSelectMultiple(assets);
|
|
11579
|
+
} else {
|
|
11580
|
+
assets.forEach((a) => onChange(a));
|
|
11581
|
+
}
|
|
11582
|
+
setSelectedFiles([]);
|
|
11583
|
+
setModalOpen(false);
|
|
11584
|
+
} else {
|
|
11585
|
+
onChange(mapStrapiFileToAsset(uploadedList[0]));
|
|
11586
|
+
setModalOpen(false);
|
|
11587
|
+
}
|
|
11507
11588
|
}
|
|
11508
11589
|
} catch {
|
|
11509
11590
|
} finally {
|
|
@@ -11515,7 +11596,25 @@ const StrapiMediaPicker = ({
|
|
|
11515
11596
|
const handleUrlApply = () => {
|
|
11516
11597
|
const trimmed = urlInput.trim();
|
|
11517
11598
|
if (!trimmed) {
|
|
11518
|
-
if (value) onChange(null);
|
|
11599
|
+
if (!multiple && value) onChange(null);
|
|
11600
|
+
return;
|
|
11601
|
+
}
|
|
11602
|
+
if (multiple) {
|
|
11603
|
+
const parts = trimmed.split(/[\n,]+/).map((s) => s.trim()).filter(Boolean);
|
|
11604
|
+
if (parts.length === 0) return;
|
|
11605
|
+
const assets = parts.map((u) => ({
|
|
11606
|
+
target_url: u,
|
|
11607
|
+
url: u,
|
|
11608
|
+
filename: u.split("/").pop() || "external-image",
|
|
11609
|
+
mime_type: "image/jpeg",
|
|
11610
|
+
caption: ""
|
|
11611
|
+
}));
|
|
11612
|
+
if (onSelectMultiple) {
|
|
11613
|
+
onSelectMultiple(assets);
|
|
11614
|
+
} else {
|
|
11615
|
+
assets.forEach((a) => onChange(a));
|
|
11616
|
+
}
|
|
11617
|
+
setUrlInput("");
|
|
11519
11618
|
return;
|
|
11520
11619
|
}
|
|
11521
11620
|
if (trimmed === (value?.target_url || value?.url || "")) return;
|
|
@@ -11659,8 +11758,8 @@ const StrapiMediaPicker = ({
|
|
|
11659
11758
|
whiteSpace: "nowrap"
|
|
11660
11759
|
},
|
|
11661
11760
|
children: [
|
|
11662
|
-
/* @__PURE__ */ jsx(MaterialIcon, { name: "image", size: 15, color: "#fff" }),
|
|
11663
|
-
t("media.selectMedia", "Select Media")
|
|
11761
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: multiple ? "collections" : "image", size: 15, color: "#fff" }),
|
|
11762
|
+
multiple ? t("media.selectMultipleMedia", "Select Images") : t("media.selectMedia", "Select Media")
|
|
11664
11763
|
]
|
|
11665
11764
|
}
|
|
11666
11765
|
)
|
|
@@ -11804,22 +11903,82 @@ const StrapiMediaPicker = ({
|
|
|
11804
11903
|
]
|
|
11805
11904
|
}
|
|
11806
11905
|
),
|
|
11807
|
-
/* @__PURE__ */
|
|
11808
|
-
"
|
|
11906
|
+
/* @__PURE__ */ jsxs(
|
|
11907
|
+
"div",
|
|
11809
11908
|
{
|
|
11810
|
-
type: "text",
|
|
11811
|
-
value: search,
|
|
11812
|
-
onChange: (e) => setSearch(e.target.value),
|
|
11813
|
-
placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
|
|
11814
11909
|
style: {
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
11820
|
-
}
|
|
11910
|
+
padding: "10px 18px",
|
|
11911
|
+
borderBottom: "1px solid #f1f5f9",
|
|
11912
|
+
display: "flex",
|
|
11913
|
+
alignItems: "center",
|
|
11914
|
+
gap: 8
|
|
11915
|
+
},
|
|
11916
|
+
children: [
|
|
11917
|
+
/* @__PURE__ */ jsx(
|
|
11918
|
+
"input",
|
|
11919
|
+
{
|
|
11920
|
+
type: "text",
|
|
11921
|
+
value: search,
|
|
11922
|
+
onChange: (e) => setSearch(e.target.value),
|
|
11923
|
+
placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
|
|
11924
|
+
style: {
|
|
11925
|
+
flex: 1,
|
|
11926
|
+
padding: "7px 10px",
|
|
11927
|
+
fontSize: 12,
|
|
11928
|
+
border: "1px solid #cbd5e1",
|
|
11929
|
+
borderRadius: 5
|
|
11930
|
+
}
|
|
11931
|
+
}
|
|
11932
|
+
),
|
|
11933
|
+
multiple && filteredFiles.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11934
|
+
/* @__PURE__ */ jsx(
|
|
11935
|
+
"button",
|
|
11936
|
+
{
|
|
11937
|
+
type: "button",
|
|
11938
|
+
onClick: () => {
|
|
11939
|
+
const existingKeys = new Set(selectedFiles.map(getFileKey));
|
|
11940
|
+
const additions = filteredFiles.filter(
|
|
11941
|
+
(f) => !existingKeys.has(getFileKey(f))
|
|
11942
|
+
);
|
|
11943
|
+
setSelectedFiles([...selectedFiles, ...additions]);
|
|
11944
|
+
},
|
|
11945
|
+
style: {
|
|
11946
|
+
padding: "6px 10px",
|
|
11947
|
+
fontSize: 11,
|
|
11948
|
+
fontWeight: 600,
|
|
11949
|
+
border: "1px solid #cbd5e1",
|
|
11950
|
+
borderRadius: 5,
|
|
11951
|
+
background: "#ffffff",
|
|
11952
|
+
color: "#334155",
|
|
11953
|
+
cursor: "pointer",
|
|
11954
|
+
whiteSpace: "nowrap"
|
|
11955
|
+
},
|
|
11956
|
+
children: t("selectAllVisible", "Select All")
|
|
11957
|
+
}
|
|
11958
|
+
),
|
|
11959
|
+
selectedFiles.length > 0 && /* @__PURE__ */ jsx(
|
|
11960
|
+
"button",
|
|
11961
|
+
{
|
|
11962
|
+
type: "button",
|
|
11963
|
+
onClick: () => setSelectedFiles([]),
|
|
11964
|
+
style: {
|
|
11965
|
+
padding: "6px 10px",
|
|
11966
|
+
fontSize: 11,
|
|
11967
|
+
fontWeight: 600,
|
|
11968
|
+
border: "1px solid #fecaca",
|
|
11969
|
+
borderRadius: 5,
|
|
11970
|
+
background: "#fef2f2",
|
|
11971
|
+
color: "#dc2626",
|
|
11972
|
+
cursor: "pointer",
|
|
11973
|
+
whiteSpace: "nowrap"
|
|
11974
|
+
},
|
|
11975
|
+
children: t("clearSelection", "Clear Selection")
|
|
11976
|
+
}
|
|
11977
|
+
)
|
|
11978
|
+
] })
|
|
11979
|
+
]
|
|
11821
11980
|
}
|
|
11822
|
-
)
|
|
11981
|
+
),
|
|
11823
11982
|
/* @__PURE__ */ jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsx(
|
|
11824
11983
|
"div",
|
|
11825
11984
|
{
|
|
@@ -11844,14 +12003,36 @@ const StrapiMediaPicker = ({
|
|
|
11844
12003
|
gap: 12
|
|
11845
12004
|
},
|
|
11846
12005
|
children: filteredFiles.map((file) => {
|
|
11847
|
-
const
|
|
12006
|
+
const fileKey = getFileKey(file);
|
|
12007
|
+
const multiIndex = multiple ? selectedFiles.findIndex((f) => getFileKey(f) === fileKey) : -1;
|
|
12008
|
+
const isMultiSelected = multiIndex !== -1;
|
|
12009
|
+
const isCurrent = multiple ? isMultiSelected : Boolean(
|
|
12010
|
+
previewUrl && (file.url === previewUrl || file.name === value?.filename)
|
|
12011
|
+
);
|
|
11848
12012
|
const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
|
|
11849
12013
|
return /* @__PURE__ */ jsxs(
|
|
11850
12014
|
"div",
|
|
11851
12015
|
{
|
|
11852
12016
|
onClick: () => {
|
|
11853
|
-
|
|
11854
|
-
|
|
12017
|
+
if (multiple) {
|
|
12018
|
+
toggleFileSelection(file);
|
|
12019
|
+
} else {
|
|
12020
|
+
onChange(mapStrapiFileToAsset(file));
|
|
12021
|
+
setModalOpen(false);
|
|
12022
|
+
}
|
|
12023
|
+
},
|
|
12024
|
+
onDoubleClick: () => {
|
|
12025
|
+
if (multiple) {
|
|
12026
|
+
const asset = mapStrapiFileToAsset(file);
|
|
12027
|
+
const listToCommit = selectedFiles.length > 0 ? selectedFiles.map(mapStrapiFileToAsset) : [asset];
|
|
12028
|
+
if (onSelectMultiple) {
|
|
12029
|
+
onSelectMultiple(listToCommit);
|
|
12030
|
+
} else {
|
|
12031
|
+
listToCommit.forEach((a) => onChange(a));
|
|
12032
|
+
}
|
|
12033
|
+
setSelectedFiles([]);
|
|
12034
|
+
setModalOpen(false);
|
|
12035
|
+
}
|
|
11855
12036
|
},
|
|
11856
12037
|
style: {
|
|
11857
12038
|
border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
|
|
@@ -11859,7 +12040,8 @@ const StrapiMediaPicker = ({
|
|
|
11859
12040
|
overflow: "hidden",
|
|
11860
12041
|
cursor: "pointer",
|
|
11861
12042
|
background: isCurrent ? "#eff6ff" : "#fff",
|
|
11862
|
-
boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)"
|
|
12043
|
+
boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)",
|
|
12044
|
+
userSelect: "none"
|
|
11863
12045
|
},
|
|
11864
12046
|
children: [
|
|
11865
12047
|
/* @__PURE__ */ jsxs(
|
|
@@ -11882,7 +12064,30 @@ const StrapiMediaPicker = ({
|
|
|
11882
12064
|
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
11883
12065
|
}
|
|
11884
12066
|
) : /* @__PURE__ */ jsx(MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
|
|
11885
|
-
|
|
12067
|
+
multiple ? /* @__PURE__ */ jsx(
|
|
12068
|
+
"span",
|
|
12069
|
+
{
|
|
12070
|
+
style: {
|
|
12071
|
+
position: "absolute",
|
|
12072
|
+
top: 6,
|
|
12073
|
+
left: 6,
|
|
12074
|
+
minWidth: 22,
|
|
12075
|
+
height: 22,
|
|
12076
|
+
padding: isMultiSelected ? "0 6px" : 0,
|
|
12077
|
+
borderRadius: 11,
|
|
12078
|
+
background: isMultiSelected ? "#2669a0" : "rgba(255, 255, 255, 0.88)",
|
|
12079
|
+
border: isMultiSelected ? "1.5px solid #ffffff" : "1.5px solid #94a3b8",
|
|
12080
|
+
color: "#ffffff",
|
|
12081
|
+
fontSize: 10,
|
|
12082
|
+
fontWeight: 700,
|
|
12083
|
+
display: "inline-flex",
|
|
12084
|
+
alignItems: "center",
|
|
12085
|
+
justifyContent: "center",
|
|
12086
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
12087
|
+
},
|
|
12088
|
+
children: isMultiSelected ? `✓ ${multiIndex + 1}` : ""
|
|
12089
|
+
}
|
|
12090
|
+
) : isCurrent && /* @__PURE__ */ jsx(
|
|
11886
12091
|
"span",
|
|
11887
12092
|
{
|
|
11888
12093
|
style: {
|
|
@@ -11944,11 +12149,84 @@ const StrapiMediaPicker = ({
|
|
|
11944
12149
|
] })
|
|
11945
12150
|
]
|
|
11946
12151
|
},
|
|
11947
|
-
|
|
12152
|
+
fileKey
|
|
11948
12153
|
);
|
|
11949
12154
|
})
|
|
11950
12155
|
}
|
|
11951
|
-
) })
|
|
12156
|
+
) }),
|
|
12157
|
+
multiple && /* @__PURE__ */ jsxs(
|
|
12158
|
+
"div",
|
|
12159
|
+
{
|
|
12160
|
+
style: {
|
|
12161
|
+
display: "flex",
|
|
12162
|
+
alignItems: "center",
|
|
12163
|
+
justifyContent: "space-between",
|
|
12164
|
+
padding: "12px 18px",
|
|
12165
|
+
borderTop: "1px solid #e2e8f0",
|
|
12166
|
+
background: "#f8fafc",
|
|
12167
|
+
gap: 12
|
|
12168
|
+
},
|
|
12169
|
+
children: [
|
|
12170
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#475569", fontWeight: 500 }, children: selectedFiles.length > 0 ? /* @__PURE__ */ jsxs("span", { style: { color: "#0f172a", fontWeight: 700 }, children: [
|
|
12171
|
+
selectedFiles.length,
|
|
12172
|
+
" ",
|
|
12173
|
+
t("selectedCountLabel", "selected")
|
|
12174
|
+
] }) : /* @__PURE__ */ jsx("span", { children: t("multiSelectHint", "Click multiple images to select them in order") }) }),
|
|
12175
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
12176
|
+
/* @__PURE__ */ jsx(
|
|
12177
|
+
"button",
|
|
12178
|
+
{
|
|
12179
|
+
type: "button",
|
|
12180
|
+
onClick: () => {
|
|
12181
|
+
setSelectedFiles([]);
|
|
12182
|
+
setModalOpen(false);
|
|
12183
|
+
},
|
|
12184
|
+
style: {
|
|
12185
|
+
padding: "7px 14px",
|
|
12186
|
+
fontSize: 12,
|
|
12187
|
+
fontWeight: 600,
|
|
12188
|
+
border: "1px solid #cbd5e1",
|
|
12189
|
+
borderRadius: 5,
|
|
12190
|
+
background: "#ffffff",
|
|
12191
|
+
color: "#475569",
|
|
12192
|
+
cursor: "pointer"
|
|
12193
|
+
},
|
|
12194
|
+
children: t("cancel", "Cancel")
|
|
12195
|
+
}
|
|
12196
|
+
),
|
|
12197
|
+
/* @__PURE__ */ jsxs(
|
|
12198
|
+
"button",
|
|
12199
|
+
{
|
|
12200
|
+
type: "button",
|
|
12201
|
+
disabled: selectedFiles.length === 0,
|
|
12202
|
+
onClick: handleConfirmMultiple,
|
|
12203
|
+
style: {
|
|
12204
|
+
display: "inline-flex",
|
|
12205
|
+
alignItems: "center",
|
|
12206
|
+
gap: 6,
|
|
12207
|
+
padding: "7px 16px",
|
|
12208
|
+
fontSize: 12,
|
|
12209
|
+
fontWeight: 700,
|
|
12210
|
+
border: "none",
|
|
12211
|
+
borderRadius: 5,
|
|
12212
|
+
background: selectedFiles.length > 0 ? "#2669a0" : "#94a3b8",
|
|
12213
|
+
color: "#ffffff",
|
|
12214
|
+
cursor: selectedFiles.length > 0 ? "pointer" : "not-allowed"
|
|
12215
|
+
},
|
|
12216
|
+
children: [
|
|
12217
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "check", size: 16, color: "#ffffff" }),
|
|
12218
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
12219
|
+
t("addSelectedMedia", "Add Selected"),
|
|
12220
|
+
" ",
|
|
12221
|
+
selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""
|
|
12222
|
+
] })
|
|
12223
|
+
]
|
|
12224
|
+
}
|
|
12225
|
+
)
|
|
12226
|
+
] })
|
|
12227
|
+
]
|
|
12228
|
+
}
|
|
12229
|
+
)
|
|
11952
12230
|
]
|
|
11953
12231
|
}
|
|
11954
12232
|
)
|
|
@@ -13045,18 +13323,54 @@ const WidgetEditor = ({ widget, onChange }) => {
|
|
|
13045
13323
|
{
|
|
13046
13324
|
label: t("addGalleryImage"),
|
|
13047
13325
|
value: null,
|
|
13326
|
+
multiple: true,
|
|
13048
13327
|
onChange: (asset) => {
|
|
13049
13328
|
if (asset) updateData([...images, asset]);
|
|
13329
|
+
},
|
|
13330
|
+
onSelectMultiple: (newAssets) => {
|
|
13331
|
+
if (newAssets && newAssets.length > 0) {
|
|
13332
|
+
updateData([...images, ...newAssets]);
|
|
13333
|
+
}
|
|
13050
13334
|
}
|
|
13051
13335
|
}
|
|
13052
13336
|
) }),
|
|
13053
13337
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
13054
|
-
/* @__PURE__ */ jsxs(
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
|
|
13338
|
+
/* @__PURE__ */ jsxs(
|
|
13339
|
+
"div",
|
|
13340
|
+
{
|
|
13341
|
+
style: {
|
|
13342
|
+
display: "flex",
|
|
13343
|
+
alignItems: "center",
|
|
13344
|
+
justifyContent: "space-between",
|
|
13345
|
+
marginBottom: 4
|
|
13346
|
+
},
|
|
13347
|
+
children: [
|
|
13348
|
+
/* @__PURE__ */ jsxs("label", { style: { ...labelStyle, marginBottom: 0 }, children: [
|
|
13349
|
+
t("galleryImages"),
|
|
13350
|
+
" (",
|
|
13351
|
+
images.length,
|
|
13352
|
+
")"
|
|
13353
|
+
] }),
|
|
13354
|
+
images.length > 1 && /* @__PURE__ */ jsx(
|
|
13355
|
+
"button",
|
|
13356
|
+
{
|
|
13357
|
+
type: "button",
|
|
13358
|
+
onClick: () => updateData([]),
|
|
13359
|
+
style: {
|
|
13360
|
+
border: "none",
|
|
13361
|
+
background: "transparent",
|
|
13362
|
+
color: "#dc2626",
|
|
13363
|
+
fontSize: 11,
|
|
13364
|
+
fontWeight: 600,
|
|
13365
|
+
cursor: "pointer",
|
|
13366
|
+
padding: "2px 4px"
|
|
13367
|
+
},
|
|
13368
|
+
children: t("clearAllImages")
|
|
13369
|
+
}
|
|
13370
|
+
)
|
|
13371
|
+
]
|
|
13372
|
+
}
|
|
13373
|
+
),
|
|
13060
13374
|
images.length === 0 ? /* @__PURE__ */ jsx(
|
|
13061
13375
|
"div",
|
|
13062
13376
|
{
|
|
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const reactDom = require("react-dom");
|
|
6
6
|
const cloneDeep = require("lodash/cloneDeep");
|
|
7
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-DV4pLrQl.js");
|
|
8
8
|
const admin = require("@strapi/strapi/admin");
|
|
9
9
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
10
|
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
@@ -850,7 +850,8 @@ const translations = {
|
|
|
850
850
|
gridGallery: "Grid Gallery",
|
|
851
851
|
galleryDisplayType: "Gallery Display Type",
|
|
852
852
|
galleryImages: "Gallery Images",
|
|
853
|
-
addGalleryImage: "+ Add Image",
|
|
853
|
+
addGalleryImage: "+ Add Image(s)",
|
|
854
|
+
clearAllImages: "Clear All",
|
|
854
855
|
noGalleryImages: "No images added to this gallery yet.",
|
|
855
856
|
popupOnOnClick: "Open in Lightbox Popup on Click",
|
|
856
857
|
imageProcess: "Image Processing",
|
|
@@ -979,17 +980,37 @@ const translations = {
|
|
|
979
980
|
// Media Picker
|
|
980
981
|
selectImage: "Select Image",
|
|
981
982
|
selectMedia: "Select Media",
|
|
983
|
+
selectMultipleMedia: "Select Images",
|
|
982
984
|
removeImage: "Remove Image",
|
|
983
985
|
mediaUrlPlaceholder: "Image URL or choose from Media Library...",
|
|
984
986
|
mediaLibraryTitle: "Strapi Media Library",
|
|
985
987
|
filesCount: "files",
|
|
986
988
|
refresh: "Refresh",
|
|
987
989
|
uploading: "Uploading...",
|
|
988
|
-
uploadNewFile: "Upload New File",
|
|
990
|
+
uploadNewFile: "Upload New File(s)",
|
|
989
991
|
searchFilesPlaceholder: "Search by file name or extension...",
|
|
990
992
|
loadingMediaFiles: "Loading media files...",
|
|
991
993
|
noMediaFilesFound: "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
|
|
992
|
-
selectedBadge: "SELECTED"
|
|
994
|
+
selectedBadge: "SELECTED",
|
|
995
|
+
multiSelectHint: "Click multiple images to select them in order",
|
|
996
|
+
selectedCountLabel: "selected",
|
|
997
|
+
selectAllVisible: "Select All",
|
|
998
|
+
clearSelection: "Clear Selection",
|
|
999
|
+
addSelectedMedia: "Add Selected",
|
|
1000
|
+
"media.selectImage": "Select Image",
|
|
1001
|
+
"media.selectMedia": "Select Media",
|
|
1002
|
+
"media.selectMultipleMedia": "Select Images",
|
|
1003
|
+
"media.removeImage": "Remove Image",
|
|
1004
|
+
"media.urlPlaceholder": "Image URL or choose from Media Library...",
|
|
1005
|
+
"media.libraryTitle": "Strapi Media Library",
|
|
1006
|
+
"media.filesCount": "files",
|
|
1007
|
+
"media.refresh": "Refresh",
|
|
1008
|
+
"media.uploading": "Uploading...",
|
|
1009
|
+
"media.uploadNew": "Upload New File(s)",
|
|
1010
|
+
"media.searchPlaceholder": "Search by file name or extension...",
|
|
1011
|
+
"media.loadingFiles": "Loading media files...",
|
|
1012
|
+
"media.noMatchingFiles": "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
|
|
1013
|
+
"media.selectedBadge": "SELECTED"
|
|
993
1014
|
},
|
|
994
1015
|
tr: {
|
|
995
1016
|
// Core entities & actions
|
|
@@ -1163,7 +1184,8 @@ const translations = {
|
|
|
1163
1184
|
gridGallery: "Grid (Izgara Galeri)",
|
|
1164
1185
|
galleryDisplayType: "Galeri Gösterim Tipi",
|
|
1165
1186
|
galleryImages: "Galeri Görselleri",
|
|
1166
|
-
addGalleryImage: "+ Görsel Ekle",
|
|
1187
|
+
addGalleryImage: "+ Görsel(ler) Ekle",
|
|
1188
|
+
clearAllImages: "Tümünü Temizle",
|
|
1167
1189
|
noGalleryImages: "Henüz galeriye görsel eklenmedi.",
|
|
1168
1190
|
popupOnOnClick: "Tıklandığında Pop-up (Lightbox) Olarak Büyüt",
|
|
1169
1191
|
imageProcess: "Görsel İşleme (Image Process)",
|
|
@@ -1292,17 +1314,37 @@ const translations = {
|
|
|
1292
1314
|
// Media Picker
|
|
1293
1315
|
selectImage: "Görsel Seç",
|
|
1294
1316
|
selectMedia: "Medya Seç",
|
|
1317
|
+
selectMultipleMedia: "Çoklu Görsel Seç",
|
|
1295
1318
|
removeImage: "Görseli Kaldır",
|
|
1296
1319
|
mediaUrlPlaceholder: "Görsel URL veya Medya Kütüphanesi...",
|
|
1297
1320
|
mediaLibraryTitle: "Strapi Medya Kütüphanesi",
|
|
1298
1321
|
filesCount: "dosya",
|
|
1299
1322
|
refresh: "Yenile",
|
|
1300
1323
|
uploading: "Yükleniyor...",
|
|
1301
|
-
uploadNewFile: "Yeni Dosya Yükle",
|
|
1324
|
+
uploadNewFile: "Yeni Dosya(lar) Yükle",
|
|
1302
1325
|
searchFilesPlaceholder: "Dosya adı veya uzantı ara...",
|
|
1303
1326
|
loadingMediaFiles: "Medya dosyaları yükleniyor...",
|
|
1304
1327
|
noMediaFilesFound: "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
|
|
1305
|
-
selectedBadge: "SEÇİLİ"
|
|
1328
|
+
selectedBadge: "SEÇİLİ",
|
|
1329
|
+
multiSelectHint: "Birden fazla görseli sırayla seçmek için üzerine tıklayın",
|
|
1330
|
+
selectedCountLabel: "seçildi",
|
|
1331
|
+
selectAllVisible: "Tümünü Seç",
|
|
1332
|
+
clearSelection: "Seçimi Temizle",
|
|
1333
|
+
addSelectedMedia: "Seçilenleri Ekle",
|
|
1334
|
+
"media.selectImage": "Görsel Seç",
|
|
1335
|
+
"media.selectMedia": "Medya Seç",
|
|
1336
|
+
"media.selectMultipleMedia": "Çoklu Görsel Seç",
|
|
1337
|
+
"media.removeImage": "Görseli Kaldır",
|
|
1338
|
+
"media.urlPlaceholder": "Görsel URL veya Medya Kütüphanesi...",
|
|
1339
|
+
"media.libraryTitle": "Strapi Medya Kütüphanesi",
|
|
1340
|
+
"media.filesCount": "dosya",
|
|
1341
|
+
"media.refresh": "Yenile",
|
|
1342
|
+
"media.uploading": "Yükleniyor...",
|
|
1343
|
+
"media.uploadNew": "Yeni Dosya(lar) Yükle",
|
|
1344
|
+
"media.searchPlaceholder": "Dosya adı veya uzantı ara...",
|
|
1345
|
+
"media.loadingFiles": "Medya dosyaları yükleniyor...",
|
|
1346
|
+
"media.noMatchingFiles": "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
|
|
1347
|
+
"media.selectedBadge": "SEÇİLİ"
|
|
1306
1348
|
}
|
|
1307
1349
|
};
|
|
1308
1350
|
function createTranslator(locale = "en") {
|
|
@@ -11431,6 +11473,9 @@ const UnitInput = ({
|
|
|
11431
11473
|
)
|
|
11432
11474
|
] });
|
|
11433
11475
|
};
|
|
11476
|
+
function getFileKey(file) {
|
|
11477
|
+
return String(file?.id ?? file?.documentId ?? file?.url ?? file?.name ?? "");
|
|
11478
|
+
}
|
|
11434
11479
|
function mapStrapiFileToAsset(file) {
|
|
11435
11480
|
const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${f.url} ${f.width}w`).join(", ") : "";
|
|
11436
11481
|
return {
|
|
@@ -11448,12 +11493,15 @@ function mapStrapiFileToAsset(file) {
|
|
|
11448
11493
|
const StrapiMediaPicker = ({
|
|
11449
11494
|
value,
|
|
11450
11495
|
onChange,
|
|
11451
|
-
label
|
|
11496
|
+
label,
|
|
11497
|
+
multiple = false,
|
|
11498
|
+
onSelectMultiple
|
|
11452
11499
|
}) => {
|
|
11453
11500
|
const { t } = useEditorTranslator();
|
|
11454
11501
|
const { get, post } = admin.useFetchClient();
|
|
11455
11502
|
const [modalOpen, setModalOpen] = React.useState(false);
|
|
11456
11503
|
const [files, setFiles] = React.useState([]);
|
|
11504
|
+
const [selectedFiles, setSelectedFiles] = React.useState([]);
|
|
11457
11505
|
const [loading, setLoading] = React.useState(false);
|
|
11458
11506
|
const [uploading, setUploading] = React.useState(false);
|
|
11459
11507
|
const [search, setSearch] = React.useState("");
|
|
@@ -11491,24 +11539,57 @@ const StrapiMediaPicker = ({
|
|
|
11491
11539
|
const handleOpenModal = (e) => {
|
|
11492
11540
|
e.preventDefault();
|
|
11493
11541
|
e.stopPropagation();
|
|
11542
|
+
setSelectedFiles([]);
|
|
11494
11543
|
setModalOpen(true);
|
|
11495
11544
|
loadLibrary().finally(() => setLoading(false));
|
|
11496
11545
|
};
|
|
11546
|
+
const toggleFileSelection = (file) => {
|
|
11547
|
+
const key = getFileKey(file);
|
|
11548
|
+
setSelectedFiles((prev) => {
|
|
11549
|
+
const exists = prev.some((f) => getFileKey(f) === key);
|
|
11550
|
+
if (exists) {
|
|
11551
|
+
return prev.filter((f) => getFileKey(f) !== key);
|
|
11552
|
+
}
|
|
11553
|
+
return [...prev, file];
|
|
11554
|
+
});
|
|
11555
|
+
};
|
|
11556
|
+
const handleConfirmMultiple = () => {
|
|
11557
|
+
if (selectedFiles.length === 0) return;
|
|
11558
|
+
const assets = selectedFiles.map(mapStrapiFileToAsset);
|
|
11559
|
+
if (onSelectMultiple) {
|
|
11560
|
+
onSelectMultiple(assets);
|
|
11561
|
+
} else {
|
|
11562
|
+
assets.forEach((asset) => onChange(asset));
|
|
11563
|
+
}
|
|
11564
|
+
setSelectedFiles([]);
|
|
11565
|
+
setModalOpen(false);
|
|
11566
|
+
};
|
|
11497
11567
|
const handleFileUpload = async (e) => {
|
|
11498
|
-
const
|
|
11499
|
-
if (!
|
|
11568
|
+
const inputFiles = e.target.files;
|
|
11569
|
+
if (!inputFiles || inputFiles.length === 0) return;
|
|
11500
11570
|
setUploading(true);
|
|
11501
11571
|
try {
|
|
11502
11572
|
const formData = new FormData();
|
|
11503
|
-
for (let i = 0; i <
|
|
11504
|
-
formData.append("files",
|
|
11573
|
+
for (let i = 0; i < inputFiles.length; i++) {
|
|
11574
|
+
formData.append("files", inputFiles[i]);
|
|
11505
11575
|
}
|
|
11506
11576
|
const res = await post("/upload", formData);
|
|
11507
11577
|
const uploadedList = Array.isArray(res?.data) ? res.data : Array.isArray(res?.data?.data) ? res.data.data : [];
|
|
11508
11578
|
await loadLibrary();
|
|
11509
11579
|
if (uploadedList.length > 0) {
|
|
11510
|
-
|
|
11511
|
-
|
|
11580
|
+
if (multiple) {
|
|
11581
|
+
const assets = uploadedList.map(mapStrapiFileToAsset);
|
|
11582
|
+
if (onSelectMultiple) {
|
|
11583
|
+
onSelectMultiple(assets);
|
|
11584
|
+
} else {
|
|
11585
|
+
assets.forEach((a) => onChange(a));
|
|
11586
|
+
}
|
|
11587
|
+
setSelectedFiles([]);
|
|
11588
|
+
setModalOpen(false);
|
|
11589
|
+
} else {
|
|
11590
|
+
onChange(mapStrapiFileToAsset(uploadedList[0]));
|
|
11591
|
+
setModalOpen(false);
|
|
11592
|
+
}
|
|
11512
11593
|
}
|
|
11513
11594
|
} catch {
|
|
11514
11595
|
} finally {
|
|
@@ -11520,7 +11601,25 @@ const StrapiMediaPicker = ({
|
|
|
11520
11601
|
const handleUrlApply = () => {
|
|
11521
11602
|
const trimmed = urlInput.trim();
|
|
11522
11603
|
if (!trimmed) {
|
|
11523
|
-
if (value) onChange(null);
|
|
11604
|
+
if (!multiple && value) onChange(null);
|
|
11605
|
+
return;
|
|
11606
|
+
}
|
|
11607
|
+
if (multiple) {
|
|
11608
|
+
const parts = trimmed.split(/[\n,]+/).map((s) => s.trim()).filter(Boolean);
|
|
11609
|
+
if (parts.length === 0) return;
|
|
11610
|
+
const assets = parts.map((u) => ({
|
|
11611
|
+
target_url: u,
|
|
11612
|
+
url: u,
|
|
11613
|
+
filename: u.split("/").pop() || "external-image",
|
|
11614
|
+
mime_type: "image/jpeg",
|
|
11615
|
+
caption: ""
|
|
11616
|
+
}));
|
|
11617
|
+
if (onSelectMultiple) {
|
|
11618
|
+
onSelectMultiple(assets);
|
|
11619
|
+
} else {
|
|
11620
|
+
assets.forEach((a) => onChange(a));
|
|
11621
|
+
}
|
|
11622
|
+
setUrlInput("");
|
|
11524
11623
|
return;
|
|
11525
11624
|
}
|
|
11526
11625
|
if (trimmed === (value?.target_url || value?.url || "")) return;
|
|
@@ -11664,8 +11763,8 @@ const StrapiMediaPicker = ({
|
|
|
11664
11763
|
whiteSpace: "nowrap"
|
|
11665
11764
|
},
|
|
11666
11765
|
children: [
|
|
11667
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "image", size: 15, color: "#fff" }),
|
|
11668
|
-
t("media.selectMedia", "Select Media")
|
|
11766
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: multiple ? "collections" : "image", size: 15, color: "#fff" }),
|
|
11767
|
+
multiple ? t("media.selectMultipleMedia", "Select Images") : t("media.selectMedia", "Select Media")
|
|
11669
11768
|
]
|
|
11670
11769
|
}
|
|
11671
11770
|
)
|
|
@@ -11809,22 +11908,82 @@ const StrapiMediaPicker = ({
|
|
|
11809
11908
|
]
|
|
11810
11909
|
}
|
|
11811
11910
|
),
|
|
11812
|
-
/* @__PURE__ */ jsxRuntime.
|
|
11813
|
-
"
|
|
11911
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11912
|
+
"div",
|
|
11814
11913
|
{
|
|
11815
|
-
type: "text",
|
|
11816
|
-
value: search,
|
|
11817
|
-
onChange: (e) => setSearch(e.target.value),
|
|
11818
|
-
placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
|
|
11819
11914
|
style: {
|
|
11820
|
-
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
}
|
|
11915
|
+
padding: "10px 18px",
|
|
11916
|
+
borderBottom: "1px solid #f1f5f9",
|
|
11917
|
+
display: "flex",
|
|
11918
|
+
alignItems: "center",
|
|
11919
|
+
gap: 8
|
|
11920
|
+
},
|
|
11921
|
+
children: [
|
|
11922
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11923
|
+
"input",
|
|
11924
|
+
{
|
|
11925
|
+
type: "text",
|
|
11926
|
+
value: search,
|
|
11927
|
+
onChange: (e) => setSearch(e.target.value),
|
|
11928
|
+
placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
|
|
11929
|
+
style: {
|
|
11930
|
+
flex: 1,
|
|
11931
|
+
padding: "7px 10px",
|
|
11932
|
+
fontSize: 12,
|
|
11933
|
+
border: "1px solid #cbd5e1",
|
|
11934
|
+
borderRadius: 5
|
|
11935
|
+
}
|
|
11936
|
+
}
|
|
11937
|
+
),
|
|
11938
|
+
multiple && filteredFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11939
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11940
|
+
"button",
|
|
11941
|
+
{
|
|
11942
|
+
type: "button",
|
|
11943
|
+
onClick: () => {
|
|
11944
|
+
const existingKeys = new Set(selectedFiles.map(getFileKey));
|
|
11945
|
+
const additions = filteredFiles.filter(
|
|
11946
|
+
(f) => !existingKeys.has(getFileKey(f))
|
|
11947
|
+
);
|
|
11948
|
+
setSelectedFiles([...selectedFiles, ...additions]);
|
|
11949
|
+
},
|
|
11950
|
+
style: {
|
|
11951
|
+
padding: "6px 10px",
|
|
11952
|
+
fontSize: 11,
|
|
11953
|
+
fontWeight: 600,
|
|
11954
|
+
border: "1px solid #cbd5e1",
|
|
11955
|
+
borderRadius: 5,
|
|
11956
|
+
background: "#ffffff",
|
|
11957
|
+
color: "#334155",
|
|
11958
|
+
cursor: "pointer",
|
|
11959
|
+
whiteSpace: "nowrap"
|
|
11960
|
+
},
|
|
11961
|
+
children: t("selectAllVisible", "Select All")
|
|
11962
|
+
}
|
|
11963
|
+
),
|
|
11964
|
+
selectedFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11965
|
+
"button",
|
|
11966
|
+
{
|
|
11967
|
+
type: "button",
|
|
11968
|
+
onClick: () => setSelectedFiles([]),
|
|
11969
|
+
style: {
|
|
11970
|
+
padding: "6px 10px",
|
|
11971
|
+
fontSize: 11,
|
|
11972
|
+
fontWeight: 600,
|
|
11973
|
+
border: "1px solid #fecaca",
|
|
11974
|
+
borderRadius: 5,
|
|
11975
|
+
background: "#fef2f2",
|
|
11976
|
+
color: "#dc2626",
|
|
11977
|
+
cursor: "pointer",
|
|
11978
|
+
whiteSpace: "nowrap"
|
|
11979
|
+
},
|
|
11980
|
+
children: t("clearSelection", "Clear Selection")
|
|
11981
|
+
}
|
|
11982
|
+
)
|
|
11983
|
+
] })
|
|
11984
|
+
]
|
|
11826
11985
|
}
|
|
11827
|
-
)
|
|
11986
|
+
),
|
|
11828
11987
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11829
11988
|
"div",
|
|
11830
11989
|
{
|
|
@@ -11849,14 +12008,36 @@ const StrapiMediaPicker = ({
|
|
|
11849
12008
|
gap: 12
|
|
11850
12009
|
},
|
|
11851
12010
|
children: filteredFiles.map((file) => {
|
|
11852
|
-
const
|
|
12011
|
+
const fileKey = getFileKey(file);
|
|
12012
|
+
const multiIndex = multiple ? selectedFiles.findIndex((f) => getFileKey(f) === fileKey) : -1;
|
|
12013
|
+
const isMultiSelected = multiIndex !== -1;
|
|
12014
|
+
const isCurrent = multiple ? isMultiSelected : Boolean(
|
|
12015
|
+
previewUrl && (file.url === previewUrl || file.name === value?.filename)
|
|
12016
|
+
);
|
|
11853
12017
|
const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
|
|
11854
12018
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11855
12019
|
"div",
|
|
11856
12020
|
{
|
|
11857
12021
|
onClick: () => {
|
|
11858
|
-
|
|
11859
|
-
|
|
12022
|
+
if (multiple) {
|
|
12023
|
+
toggleFileSelection(file);
|
|
12024
|
+
} else {
|
|
12025
|
+
onChange(mapStrapiFileToAsset(file));
|
|
12026
|
+
setModalOpen(false);
|
|
12027
|
+
}
|
|
12028
|
+
},
|
|
12029
|
+
onDoubleClick: () => {
|
|
12030
|
+
if (multiple) {
|
|
12031
|
+
const asset = mapStrapiFileToAsset(file);
|
|
12032
|
+
const listToCommit = selectedFiles.length > 0 ? selectedFiles.map(mapStrapiFileToAsset) : [asset];
|
|
12033
|
+
if (onSelectMultiple) {
|
|
12034
|
+
onSelectMultiple(listToCommit);
|
|
12035
|
+
} else {
|
|
12036
|
+
listToCommit.forEach((a) => onChange(a));
|
|
12037
|
+
}
|
|
12038
|
+
setSelectedFiles([]);
|
|
12039
|
+
setModalOpen(false);
|
|
12040
|
+
}
|
|
11860
12041
|
},
|
|
11861
12042
|
style: {
|
|
11862
12043
|
border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
|
|
@@ -11864,7 +12045,8 @@ const StrapiMediaPicker = ({
|
|
|
11864
12045
|
overflow: "hidden",
|
|
11865
12046
|
cursor: "pointer",
|
|
11866
12047
|
background: isCurrent ? "#eff6ff" : "#fff",
|
|
11867
|
-
boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)"
|
|
12048
|
+
boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)",
|
|
12049
|
+
userSelect: "none"
|
|
11868
12050
|
},
|
|
11869
12051
|
children: [
|
|
11870
12052
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -11887,7 +12069,30 @@ const StrapiMediaPicker = ({
|
|
|
11887
12069
|
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
11888
12070
|
}
|
|
11889
12071
|
) : /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
|
|
11890
|
-
|
|
12072
|
+
multiple ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12073
|
+
"span",
|
|
12074
|
+
{
|
|
12075
|
+
style: {
|
|
12076
|
+
position: "absolute",
|
|
12077
|
+
top: 6,
|
|
12078
|
+
left: 6,
|
|
12079
|
+
minWidth: 22,
|
|
12080
|
+
height: 22,
|
|
12081
|
+
padding: isMultiSelected ? "0 6px" : 0,
|
|
12082
|
+
borderRadius: 11,
|
|
12083
|
+
background: isMultiSelected ? "#2669a0" : "rgba(255, 255, 255, 0.88)",
|
|
12084
|
+
border: isMultiSelected ? "1.5px solid #ffffff" : "1.5px solid #94a3b8",
|
|
12085
|
+
color: "#ffffff",
|
|
12086
|
+
fontSize: 10,
|
|
12087
|
+
fontWeight: 700,
|
|
12088
|
+
display: "inline-flex",
|
|
12089
|
+
alignItems: "center",
|
|
12090
|
+
justifyContent: "center",
|
|
12091
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
12092
|
+
},
|
|
12093
|
+
children: isMultiSelected ? `✓ ${multiIndex + 1}` : ""
|
|
12094
|
+
}
|
|
12095
|
+
) : isCurrent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11891
12096
|
"span",
|
|
11892
12097
|
{
|
|
11893
12098
|
style: {
|
|
@@ -11949,11 +12154,84 @@ const StrapiMediaPicker = ({
|
|
|
11949
12154
|
] })
|
|
11950
12155
|
]
|
|
11951
12156
|
},
|
|
11952
|
-
|
|
12157
|
+
fileKey
|
|
11953
12158
|
);
|
|
11954
12159
|
})
|
|
11955
12160
|
}
|
|
11956
|
-
) })
|
|
12161
|
+
) }),
|
|
12162
|
+
multiple && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12163
|
+
"div",
|
|
12164
|
+
{
|
|
12165
|
+
style: {
|
|
12166
|
+
display: "flex",
|
|
12167
|
+
alignItems: "center",
|
|
12168
|
+
justifyContent: "space-between",
|
|
12169
|
+
padding: "12px 18px",
|
|
12170
|
+
borderTop: "1px solid #e2e8f0",
|
|
12171
|
+
background: "#f8fafc",
|
|
12172
|
+
gap: 12
|
|
12173
|
+
},
|
|
12174
|
+
children: [
|
|
12175
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#475569", fontWeight: 500 }, children: selectedFiles.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#0f172a", fontWeight: 700 }, children: [
|
|
12176
|
+
selectedFiles.length,
|
|
12177
|
+
" ",
|
|
12178
|
+
t("selectedCountLabel", "selected")
|
|
12179
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("multiSelectHint", "Click multiple images to select them in order") }) }),
|
|
12180
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
12181
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12182
|
+
"button",
|
|
12183
|
+
{
|
|
12184
|
+
type: "button",
|
|
12185
|
+
onClick: () => {
|
|
12186
|
+
setSelectedFiles([]);
|
|
12187
|
+
setModalOpen(false);
|
|
12188
|
+
},
|
|
12189
|
+
style: {
|
|
12190
|
+
padding: "7px 14px",
|
|
12191
|
+
fontSize: 12,
|
|
12192
|
+
fontWeight: 600,
|
|
12193
|
+
border: "1px solid #cbd5e1",
|
|
12194
|
+
borderRadius: 5,
|
|
12195
|
+
background: "#ffffff",
|
|
12196
|
+
color: "#475569",
|
|
12197
|
+
cursor: "pointer"
|
|
12198
|
+
},
|
|
12199
|
+
children: t("cancel", "Cancel")
|
|
12200
|
+
}
|
|
12201
|
+
),
|
|
12202
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12203
|
+
"button",
|
|
12204
|
+
{
|
|
12205
|
+
type: "button",
|
|
12206
|
+
disabled: selectedFiles.length === 0,
|
|
12207
|
+
onClick: handleConfirmMultiple,
|
|
12208
|
+
style: {
|
|
12209
|
+
display: "inline-flex",
|
|
12210
|
+
alignItems: "center",
|
|
12211
|
+
gap: 6,
|
|
12212
|
+
padding: "7px 16px",
|
|
12213
|
+
fontSize: 12,
|
|
12214
|
+
fontWeight: 700,
|
|
12215
|
+
border: "none",
|
|
12216
|
+
borderRadius: 5,
|
|
12217
|
+
background: selectedFiles.length > 0 ? "#2669a0" : "#94a3b8",
|
|
12218
|
+
color: "#ffffff",
|
|
12219
|
+
cursor: selectedFiles.length > 0 ? "pointer" : "not-allowed"
|
|
12220
|
+
},
|
|
12221
|
+
children: [
|
|
12222
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "check", size: 16, color: "#ffffff" }),
|
|
12223
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
12224
|
+
t("addSelectedMedia", "Add Selected"),
|
|
12225
|
+
" ",
|
|
12226
|
+
selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""
|
|
12227
|
+
] })
|
|
12228
|
+
]
|
|
12229
|
+
}
|
|
12230
|
+
)
|
|
12231
|
+
] })
|
|
12232
|
+
]
|
|
12233
|
+
}
|
|
12234
|
+
)
|
|
11957
12235
|
]
|
|
11958
12236
|
}
|
|
11959
12237
|
)
|
|
@@ -13050,18 +13328,54 @@ const WidgetEditor = ({ widget, onChange }) => {
|
|
|
13050
13328
|
{
|
|
13051
13329
|
label: t("addGalleryImage"),
|
|
13052
13330
|
value: null,
|
|
13331
|
+
multiple: true,
|
|
13053
13332
|
onChange: (asset) => {
|
|
13054
13333
|
if (asset) updateData([...images, asset]);
|
|
13334
|
+
},
|
|
13335
|
+
onSelectMultiple: (newAssets) => {
|
|
13336
|
+
if (newAssets && newAssets.length > 0) {
|
|
13337
|
+
updateData([...images, ...newAssets]);
|
|
13338
|
+
}
|
|
13055
13339
|
}
|
|
13056
13340
|
}
|
|
13057
13341
|
) }),
|
|
13058
13342
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
13059
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
13060
|
-
|
|
13061
|
-
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
|
|
13343
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
13344
|
+
"div",
|
|
13345
|
+
{
|
|
13346
|
+
style: {
|
|
13347
|
+
display: "flex",
|
|
13348
|
+
alignItems: "center",
|
|
13349
|
+
justifyContent: "space-between",
|
|
13350
|
+
marginBottom: 4
|
|
13351
|
+
},
|
|
13352
|
+
children: [
|
|
13353
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: { ...labelStyle, marginBottom: 0 }, children: [
|
|
13354
|
+
t("galleryImages"),
|
|
13355
|
+
" (",
|
|
13356
|
+
images.length,
|
|
13357
|
+
")"
|
|
13358
|
+
] }),
|
|
13359
|
+
images.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13360
|
+
"button",
|
|
13361
|
+
{
|
|
13362
|
+
type: "button",
|
|
13363
|
+
onClick: () => updateData([]),
|
|
13364
|
+
style: {
|
|
13365
|
+
border: "none",
|
|
13366
|
+
background: "transparent",
|
|
13367
|
+
color: "#dc2626",
|
|
13368
|
+
fontSize: 11,
|
|
13369
|
+
fontWeight: 600,
|
|
13370
|
+
cursor: "pointer",
|
|
13371
|
+
padding: "2px 4px"
|
|
13372
|
+
},
|
|
13373
|
+
children: t("clearAllImages")
|
|
13374
|
+
}
|
|
13375
|
+
)
|
|
13376
|
+
]
|
|
13377
|
+
}
|
|
13378
|
+
),
|
|
13065
13379
|
images.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
13066
13380
|
"div",
|
|
13067
13381
|
{
|
|
@@ -121,7 +121,7 @@ const index = {
|
|
|
121
121
|
},
|
|
122
122
|
icon: PluginIcon,
|
|
123
123
|
components: {
|
|
124
|
-
Input: async () => import("./ContentInputField-
|
|
124
|
+
Input: async () => import("./ContentInputField-CKTOutN-.mjs").then((mod) => ({
|
|
125
125
|
default: mod.ContentInputField
|
|
126
126
|
}))
|
|
127
127
|
},
|
|
@@ -124,7 +124,7 @@ const index = {
|
|
|
124
124
|
},
|
|
125
125
|
icon: PluginIcon,
|
|
126
126
|
components: {
|
|
127
|
-
Input: async () => Promise.resolve().then(() => require("./ContentInputField-
|
|
127
|
+
Input: async () => Promise.resolve().then(() => require("./ContentInputField-CLuL3TFr.js")).then((mod) => ({
|
|
128
128
|
default: mod.ContentInputField
|
|
129
129
|
}))
|
|
130
130
|
},
|
package/dist/admin/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-DV4pLrQl.js");
|
|
4
4
|
require("react");
|
|
5
5
|
exports.default = index.index;
|
package/dist/admin/index.mjs
CHANGED
|
@@ -4,6 +4,8 @@ export interface StrapiMediaPickerProps {
|
|
|
4
4
|
value?: CIMediaAsset | null;
|
|
5
5
|
onChange: (asset: CIMediaAsset | null) => void;
|
|
6
6
|
label?: string;
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
onSelectMultiple?: (assets: CIMediaAsset[]) => void;
|
|
7
9
|
}
|
|
8
10
|
export declare function mapStrapiFileToAsset(file: any): CIMediaAsset;
|
|
9
11
|
export declare const StrapiMediaPicker: React.FC<StrapiMediaPickerProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozguraltan/strapi-content-input",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Locomotive CMS ContentInput visual page/content builder ported to Strapi v5 as a native JSONB Custom Field plugin.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ozgur Altan <ozguraltan05@gmail.com>",
|