habarico 7.3.0-beta.5 → 7.3.0-beta.7
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/lib/index.cjs +224 -169
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +38 -16
- package/lib/index.esm.js +224 -170
- package/lib/index.esm.js.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -15600,6 +15600,18 @@ const TabsLocationProvider = ({ children, syncWithLocation }) => {
|
|
|
15600
15600
|
const getExt = (filename) => {
|
|
15601
15601
|
return filename.split(".").pop()?.toLowerCase() ?? "";
|
|
15602
15602
|
};
|
|
15603
|
+
const IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
15604
|
+
"png",
|
|
15605
|
+
"jpg",
|
|
15606
|
+
"jpeg",
|
|
15607
|
+
"gif",
|
|
15608
|
+
"webp",
|
|
15609
|
+
"avif",
|
|
15610
|
+
"svg",
|
|
15611
|
+
"bmp",
|
|
15612
|
+
"ico"
|
|
15613
|
+
]);
|
|
15614
|
+
const isImageFilename = (filename) => IMAGE_EXTENSIONS.has(getExt(filename));
|
|
15603
15615
|
const isFileAccepted = (file, accept) => {
|
|
15604
15616
|
const types = accept.map((t) => t.trim().toLowerCase());
|
|
15605
15617
|
const ext = "." + getExt(file.name);
|
|
@@ -16119,12 +16131,12 @@ const csMessages = {
|
|
|
16119
16131
|
new_conversation: "Nov\xE1 konverzace",
|
|
16120
16132
|
error_message: "Omlouv\xE1m se, do\u0161lo k chyb\u011B p\u0159i komunikaci s AI. Zkuste to pros\xEDm znovu."
|
|
16121
16133
|
},
|
|
16122
|
-
|
|
16123
|
-
dialog_title: "Nahr\xE1t
|
|
16134
|
+
upload_files: {
|
|
16135
|
+
dialog_title: "Nahr\xE1t soubory",
|
|
16124
16136
|
select_files: "Vybrat soubory",
|
|
16125
|
-
remove_all_tooltip: "Odstranit v\u0161echny
|
|
16137
|
+
remove_all_tooltip: "Odstranit v\u0161echny soubory",
|
|
16126
16138
|
remove_all: "Smazat v\u0161e",
|
|
16127
|
-
upload_success: "
|
|
16139
|
+
upload_success: "Soubory byly \xFAsp\u011B\u0161n\u011B nahr\xE1ny.",
|
|
16128
16140
|
upload_error: "P\u0159i nahr\xE1v\xE1n\xED do\u0161lo k chyb\u011B.",
|
|
16129
16141
|
uploading: "Nahr\xE1v\xE1m\u2026",
|
|
16130
16142
|
processing: "Zpracov\xE1v\xE1 se\u2026",
|
|
@@ -16670,12 +16682,12 @@ const deMessages = {
|
|
|
16670
16682
|
new_conversation: "Neues Gespr\xE4ch",
|
|
16671
16683
|
error_message: "Entschuldigung, beim Kommunizieren mit der KI ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut."
|
|
16672
16684
|
},
|
|
16673
|
-
|
|
16674
|
-
dialog_title: "
|
|
16685
|
+
upload_files: {
|
|
16686
|
+
dialog_title: "Dateien hochladen",
|
|
16675
16687
|
select_files: "Dateien ausw\xE4hlen",
|
|
16676
|
-
remove_all_tooltip: "Alle
|
|
16688
|
+
remove_all_tooltip: "Alle Dateien entfernen",
|
|
16677
16689
|
remove_all: "Alle l\xF6schen",
|
|
16678
|
-
upload_success: "
|
|
16690
|
+
upload_success: "Dateien wurden erfolgreich hochgeladen.",
|
|
16679
16691
|
upload_error: "Beim Hochladen ist ein Fehler aufgetreten.",
|
|
16680
16692
|
uploading: "Hochladen\u2026",
|
|
16681
16693
|
processing: "Wird verarbeitet\u2026",
|
|
@@ -17223,12 +17235,12 @@ const enMessages = {
|
|
|
17223
17235
|
new_conversation: "New conversation",
|
|
17224
17236
|
error_message: "Sorry, an error occurred while communicating with AI. Please try again."
|
|
17225
17237
|
},
|
|
17226
|
-
|
|
17227
|
-
dialog_title: "Upload
|
|
17238
|
+
upload_files: {
|
|
17239
|
+
dialog_title: "Upload files",
|
|
17228
17240
|
select_files: "Select files",
|
|
17229
|
-
remove_all_tooltip: "Remove all
|
|
17241
|
+
remove_all_tooltip: "Remove all files",
|
|
17230
17242
|
remove_all: "Remove all",
|
|
17231
|
-
upload_success: "
|
|
17243
|
+
upload_success: "Files uploaded successfully.",
|
|
17232
17244
|
upload_error: "An error occurred during upload.",
|
|
17233
17245
|
uploading: "Uploading\u2026",
|
|
17234
17246
|
processing: "Processing\u2026",
|
|
@@ -17777,13 +17789,13 @@ const esMessages = {
|
|
|
17777
17789
|
new_conversation: "Nueva conversaci\xF3n",
|
|
17778
17790
|
error_message: "Lo sentimos, se produjo un error al comunicarse con la IA. Por favor, int\xE9ntelo de nuevo."
|
|
17779
17791
|
},
|
|
17780
|
-
|
|
17781
|
-
dialog_title: "Subir
|
|
17792
|
+
upload_files: {
|
|
17793
|
+
dialog_title: "Subir archivos",
|
|
17782
17794
|
select_files: "Seleccionar archivos",
|
|
17783
|
-
remove_all_tooltip: "Eliminar
|
|
17795
|
+
remove_all_tooltip: "Eliminar todos los archivos",
|
|
17784
17796
|
remove_all: "Eliminar todo",
|
|
17785
|
-
upload_success: "
|
|
17786
|
-
upload_error: "Se produjo un error al subir
|
|
17797
|
+
upload_success: "Los archivos se subieron correctamente.",
|
|
17798
|
+
upload_error: "Se produjo un error al subir los archivos.",
|
|
17787
17799
|
uploading: "Subiendo\u2026",
|
|
17788
17800
|
processing: "Procesando\u2026",
|
|
17789
17801
|
upload_count: "Subir (%{count})",
|
|
@@ -18361,12 +18373,12 @@ const frMessages = {
|
|
|
18361
18373
|
new_conversation: "Nouvelle conversation",
|
|
18362
18374
|
error_message: "D\xE9sol\xE9, une erreur s'est produite lors de la communication avec l'IA. Veuillez r\xE9essayer."
|
|
18363
18375
|
},
|
|
18364
|
-
|
|
18365
|
-
dialog_title: "T\xE9l\xE9charger des
|
|
18376
|
+
upload_files: {
|
|
18377
|
+
dialog_title: "T\xE9l\xE9charger des fichiers",
|
|
18366
18378
|
select_files: "S\xE9lectionner des fichiers",
|
|
18367
|
-
remove_all_tooltip: "Supprimer
|
|
18379
|
+
remove_all_tooltip: "Supprimer tous les fichiers",
|
|
18368
18380
|
remove_all: "Tout supprimer",
|
|
18369
|
-
upload_success: "
|
|
18381
|
+
upload_success: "Fichiers t\xE9l\xE9charg\xE9s avec succ\xE8s.",
|
|
18370
18382
|
upload_error: "Une erreur s'est produite lors du t\xE9l\xE9chargement.",
|
|
18371
18383
|
uploading: "T\xE9l\xE9chargement\u2026",
|
|
18372
18384
|
processing: "Traitement\u2026",
|
|
@@ -18929,12 +18941,12 @@ const itMessages = {
|
|
|
18929
18941
|
new_conversation: "Nuova conversazione",
|
|
18930
18942
|
error_message: "Spiacenti, si \xE8 verificato un errore durante la comunicazione con l'IA. Riprova."
|
|
18931
18943
|
},
|
|
18932
|
-
|
|
18933
|
-
dialog_title: "Carica
|
|
18944
|
+
upload_files: {
|
|
18945
|
+
dialog_title: "Carica file",
|
|
18934
18946
|
select_files: "Seleziona file",
|
|
18935
|
-
remove_all_tooltip: "Rimuovi
|
|
18947
|
+
remove_all_tooltip: "Rimuovi tutti i file",
|
|
18936
18948
|
remove_all: "Rimuovi tutto",
|
|
18937
|
-
upload_success: "
|
|
18949
|
+
upload_success: "I file sono stati caricati con successo.",
|
|
18938
18950
|
upload_error: "Si \xE8 verificato un errore durante il caricamento.",
|
|
18939
18951
|
uploading: "Caricamento\u2026",
|
|
18940
18952
|
processing: "Elaborazione\u2026",
|
|
@@ -19527,12 +19539,12 @@ const jaMessages = {
|
|
|
19527
19539
|
new_conversation: "\u65B0\u3057\u3044\u4F1A\u8A71",
|
|
19528
19540
|
error_message: "\u7533\u3057\u8A33\u3042\u308A\u307E\u305B\u3093\u304C\u3001AI\u3068\u306E\u901A\u4FE1\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002"
|
|
19529
19541
|
},
|
|
19530
|
-
|
|
19531
|
-
dialog_title: "\
|
|
19542
|
+
upload_files: {
|
|
19543
|
+
dialog_title: "\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",
|
|
19532
19544
|
select_files: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E",
|
|
19533
|
-
remove_all_tooltip: "\u3059\u3079\u3066\u306E\
|
|
19545
|
+
remove_all_tooltip: "\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u524A\u9664",
|
|
19534
19546
|
remove_all: "\u3059\u3079\u3066\u524A\u9664",
|
|
19535
|
-
upload_success: "\
|
|
19547
|
+
upload_success: "\u30D5\u30A1\u30A4\u30EB\u304C\u6B63\u5E38\u306B\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3055\u308C\u307E\u3057\u305F\u3002",
|
|
19536
19548
|
upload_error: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002",
|
|
19537
19549
|
uploading: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u2026",
|
|
19538
19550
|
processing: "\u51E6\u7406\u4E2D\u2026",
|
|
@@ -20156,12 +20168,12 @@ const nlMessages = {
|
|
|
20156
20168
|
new_conversation: "Nieuw gesprek",
|
|
20157
20169
|
error_message: "Sorry, er is een fout opgetreden tijdens de communicatie met AI. Probeer het opnieuw."
|
|
20158
20170
|
},
|
|
20159
|
-
|
|
20160
|
-
dialog_title: "
|
|
20171
|
+
upload_files: {
|
|
20172
|
+
dialog_title: "Bestanden uploaden",
|
|
20161
20173
|
select_files: "Bestanden selecteren",
|
|
20162
|
-
remove_all_tooltip: "Alle
|
|
20174
|
+
remove_all_tooltip: "Alle bestanden verwijderen",
|
|
20163
20175
|
remove_all: "Alles verwijderen",
|
|
20164
|
-
upload_success: "
|
|
20176
|
+
upload_success: "Bestanden zijn succesvol ge\xFCpload.",
|
|
20165
20177
|
upload_error: "Er is een fout opgetreden tijdens het uploaden.",
|
|
20166
20178
|
uploading: "Uploaden\u2026",
|
|
20167
20179
|
processing: "Verwerken\u2026",
|
|
@@ -20735,12 +20747,12 @@ const plMessages = {
|
|
|
20735
20747
|
new_conversation: "Nowa rozmowa",
|
|
20736
20748
|
error_message: "Przepraszamy, wyst\u0105pi\u0142 b\u0142\u0105d podczas komunikacji z AI. Spr\xF3buj ponownie."
|
|
20737
20749
|
},
|
|
20738
|
-
|
|
20739
|
-
dialog_title: "Prze\u015Blij
|
|
20750
|
+
upload_files: {
|
|
20751
|
+
dialog_title: "Prze\u015Blij pliki",
|
|
20740
20752
|
select_files: "Wybierz pliki",
|
|
20741
|
-
remove_all_tooltip: "Usu\u0144 wszystkie
|
|
20753
|
+
remove_all_tooltip: "Usu\u0144 wszystkie pliki",
|
|
20742
20754
|
remove_all: "Usu\u0144 wszystko",
|
|
20743
|
-
upload_success: "
|
|
20755
|
+
upload_success: "Pliki zosta\u0142y przes\u0142ane pomy\u015Blnie.",
|
|
20744
20756
|
upload_error: "Wyst\u0105pi\u0142 b\u0142\u0105d podczas przesy\u0142ania.",
|
|
20745
20757
|
uploading: "Przesy\u0142anie\u2026",
|
|
20746
20758
|
processing: "Przetwarzanie\u2026",
|
|
@@ -21285,13 +21297,13 @@ const ptMessages = {
|
|
|
21285
21297
|
new_conversation: "Nova conversa",
|
|
21286
21298
|
error_message: "Desculpe, ocorreu um erro ao comunicar com a IA. Por favor, tente novamente."
|
|
21287
21299
|
},
|
|
21288
|
-
|
|
21289
|
-
dialog_title: "Enviar
|
|
21300
|
+
upload_files: {
|
|
21301
|
+
dialog_title: "Enviar arquivos",
|
|
21290
21302
|
select_files: "Selecionar arquivos",
|
|
21291
|
-
remove_all_tooltip: "Remover
|
|
21303
|
+
remove_all_tooltip: "Remover todos os arquivos",
|
|
21292
21304
|
remove_all: "Remover tudo",
|
|
21293
|
-
upload_success: "
|
|
21294
|
-
upload_error: "Ocorreu um erro ao enviar
|
|
21305
|
+
upload_success: "Arquivos enviados com sucesso.",
|
|
21306
|
+
upload_error: "Ocorreu um erro ao enviar os arquivos.",
|
|
21295
21307
|
uploading: "Enviando\u2026",
|
|
21296
21308
|
processing: "Processando\u2026",
|
|
21297
21309
|
upload_count: "Enviar (%{count})",
|
|
@@ -21780,13 +21792,13 @@ const roMessages = {
|
|
|
21780
21792
|
new_conversation: "Conversa\u021Bie nou\u0103",
|
|
21781
21793
|
error_message: "Ne pare r\u0103u, a ap\u0103rut o eroare \xEEn timpul comunic\u0103rii cu AI. V\u0103 rug\u0103m s\u0103 \xEEncerca\u021Bi din nou."
|
|
21782
21794
|
},
|
|
21783
|
-
|
|
21784
|
-
dialog_title: "\xCEncarc\u0103
|
|
21795
|
+
upload_files: {
|
|
21796
|
+
dialog_title: "\xCEncarc\u0103 fi\u0219iere",
|
|
21785
21797
|
select_files: "Selecteaz\u0103 fi\u0219iere",
|
|
21786
|
-
remove_all_tooltip: "Elimin\u0103 toate
|
|
21798
|
+
remove_all_tooltip: "Elimin\u0103 toate fi\u0219ierele",
|
|
21787
21799
|
remove_all: "Elimin\u0103 tot",
|
|
21788
|
-
upload_success: "
|
|
21789
|
-
upload_error: "A ap\u0103rut o eroare la \xEEnc\u0103rcarea
|
|
21800
|
+
upload_success: "Fi\u0219ierele au fost \xEEnc\u0103rcate cu succes.",
|
|
21801
|
+
upload_error: "A ap\u0103rut o eroare la \xEEnc\u0103rcarea fi\u0219ierelor.",
|
|
21790
21802
|
uploading: "Se \xEEncarc\u0103\u2026",
|
|
21791
21803
|
processing: "Se proceseaz\u0103\u2026",
|
|
21792
21804
|
upload_count: "\xCEncarc\u0103 (%{count})",
|
|
@@ -22329,12 +22341,12 @@ const skMessages = {
|
|
|
22329
22341
|
new_conversation: "Nov\xE1 konverz\xE1cia",
|
|
22330
22342
|
error_message: "Ospravedl\u0148ujem sa, pri komunik\xE1cii s AI do\u0161lo k chybe. Sk\xFAste to pros\xEDm znovu."
|
|
22331
22343
|
},
|
|
22332
|
-
|
|
22333
|
-
dialog_title: "Nahra\u0165
|
|
22344
|
+
upload_files: {
|
|
22345
|
+
dialog_title: "Nahra\u0165 s\xFAbory",
|
|
22334
22346
|
select_files: "Vybra\u0165 s\xFAbory",
|
|
22335
|
-
remove_all_tooltip: "Odstr\xE1ni\u0165 v\u0161etky
|
|
22347
|
+
remove_all_tooltip: "Odstr\xE1ni\u0165 v\u0161etky s\xFAbory",
|
|
22336
22348
|
remove_all: "Zmaza\u0165 v\u0161etko",
|
|
22337
|
-
upload_success: "
|
|
22349
|
+
upload_success: "S\xFAbory boli \xFAspe\u0161ne nahran\xE9.",
|
|
22338
22350
|
upload_error: "Pri nahr\xE1van\xED do\u0161lo k chybe.",
|
|
22339
22351
|
uploading: "Nahr\xE1vam\u2026",
|
|
22340
22352
|
processing: "Spracov\xE1va sa\u2026",
|
|
@@ -22952,12 +22964,12 @@ const ukMessages = {
|
|
|
22952
22964
|
new_conversation: "\u041D\u043E\u0432\u0430 \u0440\u043E\u0437\u043C\u043E\u0432\u0430",
|
|
22953
22965
|
error_message: "\u0412\u0438\u0431\u0430\u0447\u0442\u0435, \u043F\u0456\u0434 \u0447\u0430\u0441 \u0441\u043F\u0456\u043B\u043A\u0443\u0432\u0430\u043D\u043D\u044F \u0437 AI \u0441\u0442\u0430\u043B\u0430\u0441\u044F \u043F\u043E\u043C\u0438\u043B\u043A\u0430. \u0411\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430, \u0441\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0449\u0435 \u0440\u0430\u0437."
|
|
22954
22966
|
},
|
|
22955
|
-
|
|
22956
|
-
dialog_title: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438 \u0444\
|
|
22967
|
+
upload_files: {
|
|
22968
|
+
dialog_title: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438 \u0444\u0430\u0439\u043B\u0438",
|
|
22957
22969
|
select_files: "\u0412\u0438\u0431\u0440\u0430\u0442\u0438 \u0444\u0430\u0439\u043B\u0438",
|
|
22958
|
-
remove_all_tooltip: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0432\u0441\u0456 \u0444\
|
|
22970
|
+
remove_all_tooltip: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0432\u0441\u0456 \u0444\u0430\u0439\u043B\u0438",
|
|
22959
22971
|
remove_all: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0432\u0441\u0435",
|
|
22960
|
-
upload_success: "\u0424\
|
|
22972
|
+
upload_success: "\u0424\u0430\u0439\u043B\u0438 \u0443\u0441\u043F\u0456\u0448\u043D\u043E \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u0456.",
|
|
22961
22973
|
upload_error: "\u041F\u0456\u0434 \u0447\u0430\u0441 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u0441\u0442\u0430\u043B\u0430\u0441\u044F \u043F\u043E\u043C\u0438\u043B\u043A\u0430.",
|
|
22962
22974
|
uploading: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F\u2026",
|
|
22963
22975
|
processing: "\u041E\u0431\u0440\u043E\u0431\u043A\u0430\u2026",
|
|
@@ -28657,6 +28669,7 @@ var IconType = /* @__PURE__ */ ((IconType2) => {
|
|
|
28657
28669
|
IconType2["Task"] = "Task";
|
|
28658
28670
|
IconType2["Tune"] = "Tune";
|
|
28659
28671
|
IconType2["UnfoldMore"] = "UnfoldMore";
|
|
28672
|
+
IconType2["UploadFile"] = "UploadFile";
|
|
28660
28673
|
IconType2["ViewList"] = "ViewList";
|
|
28661
28674
|
IconType2["ViewWeek"] = "ViewWeek";
|
|
28662
28675
|
IconType2["Visibility"] = "Visibility";
|
|
@@ -46011,13 +46024,38 @@ const usePanelContext = () => {
|
|
|
46011
46024
|
return context;
|
|
46012
46025
|
};
|
|
46013
46026
|
|
|
46027
|
+
const RESIZE_HANDLE_SX = {
|
|
46028
|
+
corner: {
|
|
46029
|
+
right: 5,
|
|
46030
|
+
bottom: 5,
|
|
46031
|
+
width: 12,
|
|
46032
|
+
height: 12,
|
|
46033
|
+
borderRight: "2px solid",
|
|
46034
|
+
borderBottom: "2px solid",
|
|
46035
|
+
borderColor: "text.disabled",
|
|
46036
|
+
borderBottomRightRadius: "6px",
|
|
46037
|
+
cursor: "nwse-resize"
|
|
46038
|
+
},
|
|
46039
|
+
bottom: {
|
|
46040
|
+
left: "50%",
|
|
46041
|
+
bottom: 5,
|
|
46042
|
+
width: 24,
|
|
46043
|
+
height: 4,
|
|
46044
|
+
ml: "-12px",
|
|
46045
|
+
borderRadius: 2,
|
|
46046
|
+
bgcolor: "text.disabled",
|
|
46047
|
+
cursor: "ns-resize"
|
|
46048
|
+
}
|
|
46049
|
+
};
|
|
46050
|
+
const ResizeHandle = ({ at }) => /* @__PURE__ */ jsxRuntime.jsx(material.Box, { "aria-hidden": true, sx: { position: "absolute", ...RESIZE_HANDLE_SX[at] } });
|
|
46014
46051
|
const Panel = ({
|
|
46015
46052
|
variant,
|
|
46016
46053
|
collapsible = false,
|
|
46017
46054
|
defaultCollapsed = false,
|
|
46018
46055
|
collapsed: collapsedProp,
|
|
46019
46056
|
onCollapsedChange,
|
|
46020
|
-
|
|
46057
|
+
resizable = false,
|
|
46058
|
+
resizeHandle = "corner",
|
|
46021
46059
|
fullHeight = false,
|
|
46022
46060
|
emphasized = false,
|
|
46023
46061
|
children,
|
|
@@ -46068,24 +46106,7 @@ const Panel = ({
|
|
|
46068
46106
|
},
|
|
46069
46107
|
children: [
|
|
46070
46108
|
/* @__PURE__ */ jsxRuntime.jsx(InsidePanelContextProvider, { value: true, children }),
|
|
46071
|
-
|
|
46072
|
-
material.Box,
|
|
46073
|
-
{
|
|
46074
|
-
"aria-hidden": true,
|
|
46075
|
-
sx: {
|
|
46076
|
-
position: "absolute",
|
|
46077
|
-
right: 5,
|
|
46078
|
-
bottom: 5,
|
|
46079
|
-
width: 12,
|
|
46080
|
-
height: 12,
|
|
46081
|
-
borderRight: "2px solid",
|
|
46082
|
-
borderBottom: "2px solid",
|
|
46083
|
-
borderColor: "text.disabled",
|
|
46084
|
-
borderBottomRightRadius: "6px",
|
|
46085
|
-
cursor: "nwse-resize"
|
|
46086
|
-
}
|
|
46087
|
-
}
|
|
46088
|
-
)
|
|
46109
|
+
resizable && /* @__PURE__ */ jsxRuntime.jsx(ResizeHandle, { at: resizeHandle })
|
|
46089
46110
|
]
|
|
46090
46111
|
}
|
|
46091
46112
|
)
|
|
@@ -48214,13 +48235,6 @@ function useContainerWidth(options = {}) {
|
|
|
48214
48235
|
measureWidth
|
|
48215
48236
|
};
|
|
48216
48237
|
}
|
|
48217
|
-
var DEFAULT_BREAKPOINTS$1 = {
|
|
48218
|
-
lg: 1200,
|
|
48219
|
-
md: 996,
|
|
48220
|
-
sm: 768,
|
|
48221
|
-
xs: 480,
|
|
48222
|
-
xxs: 0
|
|
48223
|
-
};
|
|
48224
48238
|
|
|
48225
48239
|
var cjs = {exports: {}};
|
|
48226
48240
|
|
|
@@ -51709,6 +51723,11 @@ function ResponsiveGridLayout(props) {
|
|
|
51709
51723
|
var css_248z = ".react-grid-layout {\n position: relative;\n transition: height 200ms ease;\n}\n.react-grid-item {\n transition: all 200ms ease;\n transition-property: left, top, width, height;\n}\n.react-grid-item img {\n pointer-events: none;\n user-select: none;\n}\n.react-grid-item.cssTransforms {\n transition-property: transform, width, height;\n}\n.react-grid-item.resizing {\n transition: none;\n z-index: 1;\n will-change: width, height;\n}\n\n.react-grid-item.react-draggable-dragging {\n transition: none;\n z-index: 3;\n will-change: transform;\n}\n\n.react-grid-item.dropping {\n visibility: hidden;\n}\n\n.react-grid-item.react-grid-placeholder {\n background: red;\n opacity: 0.2;\n transition-duration: 100ms;\n z-index: 2;\n user-select: none;\n}\n\n.react-grid-item.react-grid-placeholder.placeholder-resizing {\n transition: none;\n}\n\n.react-grid-item > .react-resizable-handle {\n position: absolute;\n width: 20px;\n height: 20px;\n opacity: 0;\n}\n\n.react-grid-item:hover > .react-resizable-handle {\n opacity: 1;\n}\n\n.react-grid-item > .react-resizable-handle::after {\n content: \"\";\n position: absolute;\n right: 3px;\n bottom: 3px;\n width: 5px;\n height: 5px;\n border-right: 2px solid rgba(0, 0, 0, 0.4);\n border-bottom: 2px solid rgba(0, 0, 0, 0.4);\n}\n\n.react-resizable-hide > .react-resizable-handle {\n display: none;\n}\n\n.react-grid-item > .react-resizable-handle.react-resizable-handle-sw {\n bottom: 0;\n left: 0;\n cursor: sw-resize;\n transform: rotate(90deg);\n}\n.react-grid-item > .react-resizable-handle.react-resizable-handle-se {\n bottom: 0;\n right: 0;\n cursor: se-resize;\n}\n.react-grid-item > .react-resizable-handle.react-resizable-handle-nw {\n top: 0;\n left: 0;\n cursor: nw-resize;\n transform: rotate(180deg);\n}\n.react-grid-item > .react-resizable-handle.react-resizable-handle-ne {\n top: 0;\n right: 0;\n cursor: ne-resize;\n transform: rotate(270deg);\n}\n.react-grid-item > .react-resizable-handle.react-resizable-handle-w,\n.react-grid-item > .react-resizable-handle.react-resizable-handle-e {\n top: 50%;\n margin-top: -10px;\n cursor: ew-resize;\n}\n.react-grid-item > .react-resizable-handle.react-resizable-handle-w {\n left: 0;\n transform: rotate(135deg);\n}\n.react-grid-item > .react-resizable-handle.react-resizable-handle-e {\n right: 0;\n transform: rotate(315deg);\n}\n.react-grid-item > .react-resizable-handle.react-resizable-handle-n,\n.react-grid-item > .react-resizable-handle.react-resizable-handle-s {\n left: 50%;\n margin-left: -10px;\n cursor: ns-resize;\n}\n.react-grid-item > .react-resizable-handle.react-resizable-handle-n {\n top: 0;\n transform: rotate(225deg);\n}\n.react-grid-item > .react-resizable-handle.react-resizable-handle-s {\n bottom: 0;\n transform: rotate(45deg);\n}\n";
|
|
51710
51724
|
styleInject(css_248z);
|
|
51711
51725
|
|
|
51726
|
+
const GRID_COLS = 12;
|
|
51727
|
+
const NARROW_BREAKPOINT = 996;
|
|
51728
|
+
const GRID_BREAKPOINTS = { lg: NARROW_BREAKPOINT, sm: 0 };
|
|
51729
|
+
const isNarrowWidth = (width) => getBreakpointFromWidth(GRID_BREAKPOINTS, width) === "sm";
|
|
51730
|
+
const SPACER_ID = "__spacer";
|
|
51712
51731
|
const toLayout = (p) => ({
|
|
51713
51732
|
i: p.id,
|
|
51714
51733
|
x: p.layout.x,
|
|
@@ -51718,29 +51737,43 @@ const toLayout = (p) => ({
|
|
|
51718
51737
|
minW: p.layout.minW,
|
|
51719
51738
|
minH: p.layout.minH
|
|
51720
51739
|
});
|
|
51721
|
-
const
|
|
51740
|
+
const stackedHeight = (p) => p.layout.stackedH ?? p.layout.h;
|
|
51741
|
+
const stackedBottom = (panels) => panels.reduce((sum, p) => sum + stackedHeight(p), 0);
|
|
51742
|
+
const toStackedLayout = (panels, isEditing) => {
|
|
51722
51743
|
let y = 0;
|
|
51723
|
-
return panels.map((p) => {
|
|
51724
|
-
const
|
|
51725
|
-
y
|
|
51726
|
-
|
|
51744
|
+
return [...panels].sort((a, b) => a.layout.y - b.layout.y || a.layout.x - b.layout.x).map((p) => {
|
|
51745
|
+
const h = stackedHeight(p);
|
|
51746
|
+
const item = { i: p.id, x: 0, y, w: 1, h, minH: p.layout.minH };
|
|
51747
|
+
y += h;
|
|
51748
|
+
if (!isEditing) return item;
|
|
51749
|
+
return { ...item, minW: 1, maxW: 1, resizeHandles: ["s"], isDraggable: false };
|
|
51727
51750
|
});
|
|
51728
51751
|
};
|
|
51729
51752
|
const buildLayouts = (isEditing, panels, spacerItem) => {
|
|
51730
|
-
|
|
51731
|
-
|
|
51732
|
-
|
|
51753
|
+
const lg = panels.map(toLayout);
|
|
51754
|
+
return {
|
|
51755
|
+
lg: isEditing && spacerItem ? [...lg, spacerItem] : lg,
|
|
51756
|
+
sm: toStackedLayout(panels, isEditing)
|
|
51757
|
+
};
|
|
51733
51758
|
};
|
|
51759
|
+
const mapLayoutBack = (panels, items, isNarrow) => panels.map((p) => {
|
|
51760
|
+
const item = items.find((l) => l.i === p.id && l.i !== SPACER_ID);
|
|
51761
|
+
if (!item) return { id: p.id, layout: p.layout };
|
|
51762
|
+
if (isNarrow) {
|
|
51763
|
+
if (item.h === stackedHeight(p)) return { id: p.id, layout: p.layout };
|
|
51764
|
+
return { id: p.id, layout: { ...p.layout, stackedH: item.h } };
|
|
51765
|
+
}
|
|
51766
|
+
return { id: p.id, layout: { ...p.layout, x: item.x, y: item.y, w: item.w, h: item.h } };
|
|
51767
|
+
});
|
|
51734
51768
|
|
|
51735
|
-
const
|
|
51736
|
-
const COLS_VIEW = { lg: GRID_COLS, md: GRID_COLS, sm: 1, xs: 1, xxs: 1 };
|
|
51737
|
-
const COLS_EDIT = { lg: GRID_COLS, md: GRID_COLS, sm: GRID_COLS, xs: GRID_COLS, xxs: GRID_COLS };
|
|
51769
|
+
const COLS = { lg: GRID_COLS, sm: 1 };
|
|
51738
51770
|
const ROW_HEIGHT = 100;
|
|
51739
51771
|
const GRID_MARGIN = 10;
|
|
51740
|
-
const SPACER_ID = "__spacer";
|
|
51741
51772
|
const ADD_GHOST_W = 3;
|
|
51742
51773
|
const ADD_GHOST_FALLBACK_H = 2;
|
|
51743
51774
|
const DOT_EXTRA_ROWS = 5;
|
|
51775
|
+
const STACKED_RESIZE_HIT_W = 96;
|
|
51776
|
+
const STACKED_RESIZE_HIT_H = 44;
|
|
51744
51777
|
const noCompactorPreventCollision = { ...noCompactor, preventCollision: true };
|
|
51745
51778
|
const rectsOverlap = (a, b) => a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y;
|
|
51746
51779
|
const computeAddGhostLayout = (panels, w) => {
|
|
@@ -51755,11 +51788,14 @@ const computeAddGhostLayout = (panels, w) => {
|
|
|
51755
51788
|
}
|
|
51756
51789
|
return { x: 0, y: bottom, w, h: ADD_GHOST_FALLBACK_H };
|
|
51757
51790
|
};
|
|
51758
|
-
const
|
|
51759
|
-
|
|
51760
|
-
|
|
51761
|
-
|
|
51762
|
-
|
|
51791
|
+
const addGhostLayoutFor = (panels, isNarrow) => isNarrow ? { x: 0, y: stackedBottom(panels), w: 1, h: ADD_GHOST_FALLBACK_H } : computeAddGhostLayout(panels, Math.min(ADD_GHOST_W, GRID_COLS));
|
|
51792
|
+
const gridBottom = (panels, isNarrow, addGhost) => {
|
|
51793
|
+
const rowBottoms = [
|
|
51794
|
+
...isNarrow ? [stackedBottom(panels)] : panels.map((p) => p.layout.y + p.layout.h),
|
|
51795
|
+
...addGhost ? [addGhost.y + addGhost.h] : []
|
|
51796
|
+
];
|
|
51797
|
+
return panels.length > 0 || addGhost ? Math.max(...rowBottoms) : 4;
|
|
51798
|
+
};
|
|
51763
51799
|
const DotGrid = ({
|
|
51764
51800
|
cols,
|
|
51765
51801
|
rows,
|
|
@@ -51790,19 +51826,19 @@ const DashboardGrid = ({
|
|
|
51790
51826
|
}) => {
|
|
51791
51827
|
const isEditing = mode === "edit";
|
|
51792
51828
|
const { width, containerRef } = useContainerWidth();
|
|
51829
|
+
const isNarrow = isNarrowWidth(width);
|
|
51830
|
+
const isNarrowEdit = isEditing && isNarrow;
|
|
51831
|
+
const isWideEdit = isEditing && !isNarrow;
|
|
51832
|
+
const cols = isNarrow ? COLS.sm : COLS.lg;
|
|
51793
51833
|
const theme = material.useTheme();
|
|
51794
51834
|
const [isInteracting, setIsInteracting] = React.useState(false);
|
|
51795
51835
|
const showAddGhost = isEditing && Boolean(addPanel) && panels.length > 0 && !isInteracting;
|
|
51796
|
-
const addGhostLayout = showAddGhost ?
|
|
51836
|
+
const addGhostLayout = showAddGhost ? addGhostLayoutFor(panels, isNarrow) : null;
|
|
51797
51837
|
const gridWidth = width;
|
|
51798
|
-
const colWidth = (gridWidth - GRID_MARGIN * (
|
|
51838
|
+
const colWidth = (gridWidth - GRID_MARGIN * (cols + 1)) / cols;
|
|
51799
51839
|
const cellW = colWidth + GRID_MARGIN;
|
|
51800
51840
|
const cellH = ROW_HEIGHT + GRID_MARGIN;
|
|
51801
|
-
const
|
|
51802
|
-
...panels.map((p) => p.layout.y + p.layout.h),
|
|
51803
|
-
...addGhostLayout ? [addGhostLayout.y + addGhostLayout.h] : []
|
|
51804
|
-
];
|
|
51805
|
-
const maxGridRow = rowBottoms.length > 0 ? Math.max(...rowBottoms) : 4;
|
|
51841
|
+
const maxGridRow = gridBottom(panels, isNarrow, addGhostLayout);
|
|
51806
51842
|
const [screenDotRows, setScreenDotRows] = React.useState(null);
|
|
51807
51843
|
React.useEffect(() => {
|
|
51808
51844
|
if (!isEditing || !containerRef.current) {
|
|
@@ -51823,10 +51859,11 @@ const DashboardGrid = ({
|
|
|
51823
51859
|
h: 1,
|
|
51824
51860
|
static: true
|
|
51825
51861
|
};
|
|
51826
|
-
const
|
|
51862
|
+
const showSpacer = isWideEdit;
|
|
51863
|
+
const layouts = buildLayouts(isEditing, panels, showSpacer ? spacerItem : void 0);
|
|
51827
51864
|
const handleLayoutChange = (currentLayout, _all) => {
|
|
51828
51865
|
if (!isEditing || !currentLayout || !onLayoutChange) return;
|
|
51829
|
-
onLayoutChange(mapLayoutBack(panels, currentLayout));
|
|
51866
|
+
onLayoutChange(mapLayoutBack(panels, currentLayout, isNarrow));
|
|
51830
51867
|
};
|
|
51831
51868
|
const emptyContent = isEditing && addPanel ? /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { minHeight: ROW_HEIGHT * 2 + GRID_MARGIN }, children: addPanel }) : /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { py: 8, textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { color: "text.secondary", children: emptyMessage }) });
|
|
51832
51869
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -51850,13 +51887,24 @@ const DashboardGrid = ({
|
|
|
51850
51887
|
// resize affordance. Keep the handle element itself (the transparent hit area) so resize
|
|
51851
51888
|
// still works; only our Panel corner is drawn.
|
|
51852
51889
|
"& .react-grid-item > .react-resizable-handle::after": { display: "none" },
|
|
51890
|
+
// RGL's bottom-edge handle is a 20px square turned 45° — too small a target on a phone,
|
|
51891
|
+
// where the stack is resized. Widen it into an upright touch target centred on the edge
|
|
51892
|
+
// and let it take the touch instead of the page scroll.
|
|
51893
|
+
"& .react-grid-item > .react-resizable-handle.react-resizable-handle-s": {
|
|
51894
|
+
width: STACKED_RESIZE_HIT_W,
|
|
51895
|
+
height: STACKED_RESIZE_HIT_H,
|
|
51896
|
+
bottom: -GRID_MARGIN,
|
|
51897
|
+
ml: `${-STACKED_RESIZE_HIT_W / 2}px`,
|
|
51898
|
+
transform: "none",
|
|
51899
|
+
touchAction: "none"
|
|
51900
|
+
},
|
|
51853
51901
|
...sx
|
|
51854
51902
|
},
|
|
51855
51903
|
children: panels.length === 0 ? emptyContent : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
51856
51904
|
isEditing && /* @__PURE__ */ jsxRuntime.jsx(
|
|
51857
51905
|
DotGrid,
|
|
51858
51906
|
{
|
|
51859
|
-
cols
|
|
51907
|
+
cols,
|
|
51860
51908
|
rows: dotRows,
|
|
51861
51909
|
cellW,
|
|
51862
51910
|
cellH,
|
|
@@ -51871,10 +51919,11 @@ const DashboardGrid = ({
|
|
|
51871
51919
|
className: "layout",
|
|
51872
51920
|
width: gridWidth,
|
|
51873
51921
|
layouts,
|
|
51874
|
-
|
|
51922
|
+
breakpoints: GRID_BREAKPOINTS,
|
|
51923
|
+
cols: COLS,
|
|
51875
51924
|
rowHeight: ROW_HEIGHT,
|
|
51876
51925
|
margin: [GRID_MARGIN, GRID_MARGIN],
|
|
51877
|
-
compactor: noCompactorPreventCollision,
|
|
51926
|
+
compactor: isNarrowEdit ? verticalCompactor : noCompactorPreventCollision,
|
|
51878
51927
|
onLayoutChange: handleLayoutChange,
|
|
51879
51928
|
dragConfig: { enabled: isEditing, handle: `.${PANEL_DRAG_HANDLE_CLASS}` },
|
|
51880
51929
|
resizeConfig: { enabled: isEditing },
|
|
@@ -51883,35 +51932,43 @@ const DashboardGrid = ({
|
|
|
51883
51932
|
onResizeStart: () => setIsInteracting(true),
|
|
51884
51933
|
onResizeStop: () => setIsInteracting(false),
|
|
51885
51934
|
children: [
|
|
51886
|
-
|
|
51935
|
+
showSpacer && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "none" } }, SPACER_ID),
|
|
51887
51936
|
panels.map((p) => (
|
|
51888
51937
|
// raise the hovered item so an inner chart tooltip isn't painted over by neighbours
|
|
51889
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { height: "100%", "&:hover": { zIndex: 5 } }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
51890
|
-
|
|
51891
|
-
|
|
51892
|
-
|
|
51893
|
-
|
|
51894
|
-
|
|
51895
|
-
|
|
51896
|
-
|
|
51897
|
-
|
|
51898
|
-
|
|
51899
|
-
|
|
51900
|
-
|
|
51901
|
-
|
|
51902
|
-
|
|
51903
|
-
|
|
51904
|
-
|
|
51905
|
-
|
|
51906
|
-
|
|
51907
|
-
|
|
51908
|
-
|
|
51909
|
-
|
|
51910
|
-
|
|
51938
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { height: "100%", "&:hover": { zIndex: 5 } }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
51939
|
+
Panel,
|
|
51940
|
+
{
|
|
51941
|
+
resizable: isEditing,
|
|
51942
|
+
resizeHandle: isNarrow ? "bottom" : "corner",
|
|
51943
|
+
sx: { height: "100%" },
|
|
51944
|
+
children: [
|
|
51945
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
51946
|
+
PanelHeader,
|
|
51947
|
+
{
|
|
51948
|
+
label: p.label,
|
|
51949
|
+
icon: p.icon,
|
|
51950
|
+
iconColor: p.iconColor,
|
|
51951
|
+
iconBadge: p.iconBadge,
|
|
51952
|
+
help: p.help,
|
|
51953
|
+
actions: p.actions,
|
|
51954
|
+
dragHandle: isWideEdit
|
|
51955
|
+
}
|
|
51956
|
+
),
|
|
51957
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
51958
|
+
PanelContent,
|
|
51959
|
+
{
|
|
51960
|
+
paddingSize: p.contentPaddingSize,
|
|
51961
|
+
sx: { flexGrow: 1, minHeight: 0, overflow: "auto" },
|
|
51962
|
+
children: p.content
|
|
51963
|
+
}
|
|
51964
|
+
)
|
|
51965
|
+
]
|
|
51966
|
+
}
|
|
51967
|
+
) }, p.id)
|
|
51911
51968
|
))
|
|
51912
51969
|
]
|
|
51913
51970
|
},
|
|
51914
|
-
|
|
51971
|
+
isNarrowEdit ? "edit-narrow" : mode
|
|
51915
51972
|
),
|
|
51916
51973
|
addGhostLayout && /* @__PURE__ */ jsxRuntime.jsx(
|
|
51917
51974
|
material.Box,
|
|
@@ -53636,7 +53693,7 @@ const FileRow = ({
|
|
|
53636
53693
|
const hasSize = fileSize != null;
|
|
53637
53694
|
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: rowSx(!!error, padding, singleFile, noBorder, !!disabled), children: [
|
|
53638
53695
|
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [
|
|
53639
|
-
previewUrl ? /* @__PURE__ */ jsxRuntime.jsx(FileImagePreview, { src: previewUrl, alt: filename }) : /* @__PURE__ */ jsxRuntime.jsx(FileTypePreview, { filename }),
|
|
53696
|
+
previewUrl && isImageFilename(filename) ? /* @__PURE__ */ jsxRuntime.jsx(FileImagePreview, { src: previewUrl, alt: filename }) : /* @__PURE__ */ jsxRuntime.jsx(FileTypePreview, { filename }),
|
|
53640
53697
|
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
53641
53698
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
53642
53699
|
material.Typography,
|
|
@@ -64801,15 +64858,15 @@ const TriStateBooleanInput = ({ sx, ...props }) => {
|
|
|
64801
64858
|
const useUploadAreaLabels = () => {
|
|
64802
64859
|
const translate = reactAdmin.useTranslate();
|
|
64803
64860
|
return {
|
|
64804
|
-
clickToUpload: translate("ra.
|
|
64805
|
-
orDragAndDrop: translate("ra.
|
|
64806
|
-
removeAll: translate("ra.
|
|
64807
|
-
filesRemainingHint: (count) => translate("ra.
|
|
64861
|
+
clickToUpload: translate("ra.upload_files.click_to_upload"),
|
|
64862
|
+
orDragAndDrop: translate("ra.upload_files.or_drag_and_drop"),
|
|
64863
|
+
removeAll: translate("ra.upload_files.remove_all"),
|
|
64864
|
+
filesRemainingHint: (count) => translate("ra.upload_files.files_remaining_hint", { count }),
|
|
64808
64865
|
maxFileSizeHint: (size) => `max. ${size}`,
|
|
64809
|
-
uploading: translate("ra.
|
|
64810
|
-
processing: translate("ra.
|
|
64811
|
-
uploadComplete: translate("ra.
|
|
64812
|
-
tryAgain: translate("ra.
|
|
64866
|
+
uploading: translate("ra.upload_files.uploading"),
|
|
64867
|
+
processing: translate("ra.upload_files.processing"),
|
|
64868
|
+
uploadComplete: translate("ra.upload_files.upload_complete"),
|
|
64869
|
+
tryAgain: translate("ra.upload_files.try_again")
|
|
64813
64870
|
};
|
|
64814
64871
|
};
|
|
64815
64872
|
|
|
@@ -64886,10 +64943,10 @@ const useUploadQueue = ({
|
|
|
64886
64943
|
};
|
|
64887
64944
|
const getUploadErrorMsg = (e) => {
|
|
64888
64945
|
if (e instanceof Error) return e.message;
|
|
64889
|
-
return translate("ra.
|
|
64946
|
+
return translate("ra.upload_files.upload_error");
|
|
64890
64947
|
};
|
|
64891
|
-
const validateFileType = (file) => accept && !isFileAccepted(file, accept) ? translate("ra.
|
|
64892
|
-
const validateFileSize = (file) => maxFileSize != null && file.size > maxFileSize ? translate("ra.
|
|
64948
|
+
const validateFileType = (file) => accept && !isFileAccepted(file, accept) ? translate("ra.upload_files.file_type_not_allowed") : null;
|
|
64949
|
+
const validateFileSize = (file) => maxFileSize != null && file.size > maxFileSize ? translate("ra.upload_files.file_too_large") : null;
|
|
64893
64950
|
const prepareAndUpload = async (id, picked) => {
|
|
64894
64951
|
const pickedError = validateFileType(picked);
|
|
64895
64952
|
if (pickedError) {
|
|
@@ -64903,7 +64960,7 @@ const useUploadQueue = ({
|
|
|
64903
64960
|
} catch {
|
|
64904
64961
|
updateEntry(id, {
|
|
64905
64962
|
processing: false,
|
|
64906
|
-
error: translate("ra.
|
|
64963
|
+
error: translate("ra.upload_files.image_processing_failed")
|
|
64907
64964
|
});
|
|
64908
64965
|
return;
|
|
64909
64966
|
}
|
|
@@ -64971,7 +65028,7 @@ const UploadInput = ({
|
|
|
64971
65028
|
const isMulti = maxFiles !== 1;
|
|
64972
65029
|
const defaultLabels = useUploadAreaLabels();
|
|
64973
65030
|
const failedCountRef = React.useRef(0);
|
|
64974
|
-
const validateUploads = () => failedCountRef.current > 0 ? "ra.
|
|
65031
|
+
const validateUploads = () => failedCountRef.current > 0 ? "ra.upload_files.unresolved_errors" : void 0;
|
|
64975
65032
|
const {
|
|
64976
65033
|
field: { onChange, value },
|
|
64977
65034
|
fieldState: { error, invalid }
|
|
@@ -74539,10 +74596,7 @@ const defaultBoxProvider = ({ schema, excludeFields, props }) => {
|
|
|
74539
74596
|
|
|
74540
74597
|
const DEFAULT_IMAGE_ACCEPT = [".png", ".jpg", ".jpeg", ".bmp", ".gif"];
|
|
74541
74598
|
|
|
74542
|
-
const
|
|
74543
|
-
uploadImages,
|
|
74544
|
-
...props
|
|
74545
|
-
}) => {
|
|
74599
|
+
const SchemaUploadFilesButton = ({ uploadFiles, ...props }) => {
|
|
74546
74600
|
const {
|
|
74547
74601
|
reference,
|
|
74548
74602
|
target,
|
|
@@ -74553,14 +74607,14 @@ const SchemaUploadImagesButton = ({
|
|
|
74553
74607
|
maxFiles,
|
|
74554
74608
|
upload: uploadParam,
|
|
74555
74609
|
data,
|
|
74556
|
-
|
|
74557
|
-
} =
|
|
74610
|
+
fileField
|
|
74611
|
+
} = uploadFiles ?? {};
|
|
74558
74612
|
const { getMethodSchema } = useGetLocalResourceSchema({ resource: reference });
|
|
74559
|
-
const
|
|
74560
|
-
(f) => f.name ===
|
|
74613
|
+
const fileFieldOptions = fileField ? (getMethodSchema("post")?.fields ?? getMethodSchema("get")?.fields)?.find(
|
|
74614
|
+
(f) => f.name === fileField
|
|
74561
74615
|
)?.options : void 0;
|
|
74562
|
-
const upload = uploadParam ??
|
|
74563
|
-
const accept = acceptParam ??
|
|
74616
|
+
const upload = uploadParam ?? fileFieldOptions?.upload;
|
|
74617
|
+
const accept = acceptParam ?? fileFieldOptions?.accept ?? DEFAULT_IMAGE_ACCEPT;
|
|
74564
74618
|
const translate = reactAdmin.useTranslate();
|
|
74565
74619
|
const { Dialog, openDialog, closeDialog } = useDialog();
|
|
74566
74620
|
const uploadResource = useResourceContext(reference);
|
|
@@ -74588,14 +74642,14 @@ const SchemaUploadImagesButton = ({
|
|
|
74588
74642
|
fileModifier
|
|
74589
74643
|
});
|
|
74590
74644
|
const handleConfirm = async () => {
|
|
74591
|
-
if (!
|
|
74645
|
+
if (!fileField) return;
|
|
74592
74646
|
setSaving(true);
|
|
74593
74647
|
let anyFailed = false;
|
|
74594
74648
|
const readyEntries = entries.filter((e) => e.uploadResult && !e.error && !e.done);
|
|
74595
74649
|
for (const entry of readyEntries) {
|
|
74596
74650
|
try {
|
|
74597
74651
|
await dataProvider.create(uploadResource, {
|
|
74598
|
-
data: { ...data, ...uploadTargetValues, [
|
|
74652
|
+
data: { ...data, ...uploadTargetValues, [fileField]: entry.uploadResult }
|
|
74599
74653
|
});
|
|
74600
74654
|
updateEntry(entry.id, { done: true });
|
|
74601
74655
|
} catch (e) {
|
|
@@ -74605,14 +74659,14 @@ const SchemaUploadImagesButton = ({
|
|
|
74605
74659
|
}
|
|
74606
74660
|
setSaving(false);
|
|
74607
74661
|
if (!anyFailed) {
|
|
74608
|
-
notify(translate("ra.
|
|
74662
|
+
notify(translate("ra.upload_files.upload_success"), { type: "success" });
|
|
74609
74663
|
refresh();
|
|
74610
74664
|
removeAll();
|
|
74611
74665
|
closeDialog();
|
|
74612
74666
|
}
|
|
74613
74667
|
};
|
|
74614
74668
|
const handleRetryEntry = async (id) => {
|
|
74615
|
-
if (!
|
|
74669
|
+
if (!fileField) return;
|
|
74616
74670
|
const entry = entries.find((e) => e.id === id);
|
|
74617
74671
|
if (!entry || entry.progress !== null) return;
|
|
74618
74672
|
if (entry.uploadResult) {
|
|
@@ -74620,10 +74674,10 @@ const SchemaUploadImagesButton = ({
|
|
|
74620
74674
|
setSaving(true);
|
|
74621
74675
|
try {
|
|
74622
74676
|
await dataProvider.create(uploadResource, {
|
|
74623
|
-
data: { ...data, ...uploadTargetValues, [
|
|
74677
|
+
data: { ...data, ...uploadTargetValues, [fileField]: entry.uploadResult }
|
|
74624
74678
|
});
|
|
74625
74679
|
updateEntry(id, { done: true });
|
|
74626
|
-
notify(translate("ra.
|
|
74680
|
+
notify(translate("ra.upload_files.upload_success"), { type: "success" });
|
|
74627
74681
|
refresh();
|
|
74628
74682
|
} catch (e) {
|
|
74629
74683
|
updateEntry(id, { error: getUploadErrorMsg(e) });
|
|
@@ -74644,12 +74698,12 @@ const SchemaUploadImagesButton = ({
|
|
|
74644
74698
|
variant: "text",
|
|
74645
74699
|
size: "medium",
|
|
74646
74700
|
...props,
|
|
74647
|
-
icon: props.icon ?? /* @__PURE__ */ jsxRuntime.jsx(Icon$1, { icon: IconType.
|
|
74701
|
+
icon: props.icon ?? /* @__PURE__ */ jsxRuntime.jsx(Icon$1, { icon: IconType.UploadFile }),
|
|
74648
74702
|
onClick: openDialog
|
|
74649
74703
|
}
|
|
74650
74704
|
),
|
|
74651
74705
|
/* @__PURE__ */ jsxRuntime.jsxs(Dialog, { maxWidth: "sm", fullWidth: true, disableClose: isDisabled, children: [
|
|
74652
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { children: translate("ra.
|
|
74706
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { children: translate("ra.upload_files.dialog_title") }),
|
|
74653
74707
|
/* @__PURE__ */ jsxRuntime.jsx(material.DialogContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74654
74708
|
UploadArea,
|
|
74655
74709
|
{
|
|
@@ -74685,7 +74739,7 @@ const SchemaUploadImagesButton = ({
|
|
|
74685
74739
|
onClick: handleConfirm,
|
|
74686
74740
|
disabled: readyCount === 0 || isDisabled,
|
|
74687
74741
|
startIcon: saving ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 16 }) : void 0,
|
|
74688
|
-
children: saving ? translate("ra.
|
|
74742
|
+
children: saving ? translate("ra.upload_files.uploading") : translate("ra.upload_files.upload_count", { count: readyCount })
|
|
74689
74743
|
}
|
|
74690
74744
|
)
|
|
74691
74745
|
] })
|
|
@@ -74742,8 +74796,8 @@ const defaultButtonProvider = ({
|
|
|
74742
74796
|
return;
|
|
74743
74797
|
case "save":
|
|
74744
74798
|
return /* @__PURE__ */ jsxRuntime.jsx(SaveButton, { data: schema.save?.data, ...props });
|
|
74745
|
-
case "upload-
|
|
74746
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74799
|
+
case "upload-files":
|
|
74800
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SchemaUploadFilesButton, { uploadFiles: schema.uploadFiles, ...props });
|
|
74747
74801
|
case "export":
|
|
74748
74802
|
return /* @__PURE__ */ jsxRuntime.jsx(ExportButton, { format: schema.export?.format, fields: schema.export?.fields, ...props });
|
|
74749
74803
|
}
|
|
@@ -106121,6 +106175,7 @@ exports.hideScrollY = hideScrollY;
|
|
|
106121
106175
|
exports.isBoxSchema = isBoxSchema;
|
|
106122
106176
|
exports.isFieldDescriptor = isFieldDescriptor;
|
|
106123
106177
|
exports.isFileAccepted = isFileAccepted;
|
|
106178
|
+
exports.isImageFilename = isImageFilename;
|
|
106124
106179
|
exports.isRoutedViewMode = isRoutedViewMode;
|
|
106125
106180
|
exports.isSafeUrl = isSafeUrl;
|
|
106126
106181
|
exports.isSelfHighlightingField = isSelfHighlightingField;
|