@astral/ui 4.55.0 → 4.55.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/CardGridInfinite/CardGridInfinite.js +19 -6
- package/components/CardGridInfinite/useLogic/useLogic.d.ts +1 -0
- package/components/CardGridInfinite/useLogic/useLogic.js +1 -0
- package/components/ConfigProvider/ConfigProvider.d.ts +1 -1
- package/components/ConfigProvider/ConfigProvider.js +10 -4
- package/components/fileUploading/FileUploaderFile/Actions/useLogic/useLogic.js +4 -3
- package/components/fileUploading/PreviewFileUploader/PreviewFileUploader.d.ts +8 -1
- package/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.js +6 -5
- package/components/fileUploading/hooks/useFileUploader/hooks/index.d.ts +1 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/index.js +1 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/index.d.ts +1 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/index.js +1 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/usePrepareAccept.d.ts +2 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/usePrepareAccept.js +14 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/getAcceptMeta.d.ts +5 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/getAcceptMeta.js +23 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/index.d.ts +1 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/index.js +1 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/index.d.ts +2 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/index.js +2 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/index.d.ts +1 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/index.js +1 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/validateAcceptMeta.d.ts +2 -0
- package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/validateAcceptMeta.js +10 -0
- package/components/fileUploading/hooks/useFileUploader/useFileUploader.js +3 -1
- package/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.d.ts +34 -120
- package/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.js +10 -137
- package/components/fileUploading/restrictions/restrictFileType/constants.d.ts +4 -0
- package/components/fileUploading/restrictions/restrictFileType/constants.js +4 -0
- package/components/fileUploading/restrictions/restrictFileType/restrictFileType.d.ts +2 -2
- package/components/fileUploading/restrictions/restrictFileType/restrictFileType.js +31 -55
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/getFileMeta.d.ts +5 -0
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/getFileMeta.js +21 -0
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/index.d.ts +1 -0
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/index.js +1 -0
- package/components/fileUploading/restrictions/restrictFileType/utils/index.d.ts +1 -2
- package/components/fileUploading/restrictions/restrictFileType/utils/index.js +1 -2
- package/components/fileUploading/services/MimeTypeRegistry/MimeTypeRegistry.d.ts +9 -0
- package/components/fileUploading/services/MimeTypeRegistry/MimeTypeRegistry.js +27 -0
- package/components/fileUploading/services/MimeTypeRegistry/constants.d.ts +1 -0
- package/components/fileUploading/services/MimeTypeRegistry/constants.js +343 -0
- package/components/fileUploading/services/MimeTypeRegistry/index.d.ts +1 -0
- package/components/fileUploading/services/MimeTypeRegistry/index.js +1 -0
- package/components/fileUploading/types.d.ts +10 -0
- package/components/fileUploading/utils/index.d.ts +1 -1
- package/components/fileUploading/utils/index.js +1 -1
- package/components/services/ErrorService/ErrorService.d.ts +17 -0
- package/components/services/ErrorService/ErrorService.js +33 -0
- package/components/services/ErrorService/index.d.ts +1 -0
- package/components/services/ErrorService/index.js +1 -0
- package/node/components/CardGridInfinite/CardGridInfinite.js +18 -5
- package/node/components/CardGridInfinite/useLogic/useLogic.d.ts +1 -0
- package/node/components/CardGridInfinite/useLogic/useLogic.js +1 -0
- package/node/components/ConfigProvider/ConfigProvider.d.ts +1 -1
- package/node/components/ConfigProvider/ConfigProvider.js +9 -3
- package/node/components/fileUploading/FileUploaderFile/Actions/useLogic/useLogic.js +4 -3
- package/node/components/fileUploading/PreviewFileUploader/PreviewFileUploader.d.ts +8 -1
- package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.js +6 -5
- package/node/components/fileUploading/hooks/useFileUploader/hooks/index.d.ts +1 -0
- package/node/components/fileUploading/{restrictions/restrictFileType/utils/getFileTypeFromName → hooks/useFileUploader/hooks}/index.js +1 -1
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/index.d.ts +1 -0
- package/node/components/fileUploading/{restrictions/restrictFileType/utils/getFileTypeFromFile → hooks/useFileUploader/hooks/usePrepareAccept}/index.js +1 -1
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/usePrepareAccept.d.ts +2 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/usePrepareAccept.js +18 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/getAcceptMeta.d.ts +5 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/getAcceptMeta.js +27 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/index.d.ts +1 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/index.js +17 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/index.d.ts +2 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/index.js +18 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/index.d.ts +1 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/index.js +17 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/validateAcceptMeta.d.ts +2 -0
- package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/validateAcceptMeta.js +14 -0
- package/node/components/fileUploading/hooks/useFileUploader/useFileUploader.js +3 -1
- package/node/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.d.ts +34 -120
- package/node/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.js +9 -136
- package/node/components/fileUploading/restrictions/restrictFileType/constants.d.ts +4 -0
- package/node/components/fileUploading/restrictions/restrictFileType/constants.js +5 -1
- package/node/components/fileUploading/restrictions/restrictFileType/restrictFileType.d.ts +2 -2
- package/node/components/fileUploading/restrictions/restrictFileType/restrictFileType.js +29 -53
- package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/getFileMeta.d.ts +5 -0
- package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/getFileMeta.js +25 -0
- package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/index.d.ts +1 -0
- package/node/components/fileUploading/restrictions/restrictFileType/utils/{prepareType → getFileMeta}/index.js +1 -1
- package/node/components/fileUploading/restrictions/restrictFileType/utils/index.d.ts +1 -2
- package/node/components/fileUploading/restrictions/restrictFileType/utils/index.js +1 -2
- package/node/components/fileUploading/services/MimeTypeRegistry/MimeTypeRegistry.d.ts +9 -0
- package/node/components/fileUploading/services/MimeTypeRegistry/MimeTypeRegistry.js +31 -0
- package/node/components/fileUploading/services/MimeTypeRegistry/constants.d.ts +1 -0
- package/node/components/fileUploading/services/MimeTypeRegistry/constants.js +347 -0
- package/node/components/fileUploading/services/MimeTypeRegistry/index.d.ts +1 -0
- package/node/components/fileUploading/services/MimeTypeRegistry/index.js +17 -0
- package/node/components/fileUploading/types.d.ts +10 -0
- package/node/components/fileUploading/utils/index.d.ts +1 -1
- package/node/components/fileUploading/utils/index.js +16 -3
- package/node/components/services/ErrorService/ErrorService.d.ts +17 -0
- package/node/components/services/ErrorService/ErrorService.js +37 -0
- package/node/components/services/ErrorService/index.d.ts +1 -0
- package/node/components/services/ErrorService/index.js +17 -0
- package/package.json +1 -1
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/getFileTypeFromFile.d.ts +0 -4
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/getFileTypeFromFile.js +0 -10
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/index.d.ts +0 -1
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/index.js +0 -1
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.d.ts +0 -4
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.js +0 -13
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/index.d.ts +0 -1
- package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/index.js +0 -1
- package/components/fileUploading/restrictions/restrictFileType/utils/prepareType/index.d.ts +0 -1
- package/components/fileUploading/restrictions/restrictFileType/utils/prepareType/index.js +0 -1
- package/components/fileUploading/restrictions/restrictFileType/utils/prepareType/prepareType.d.ts +0 -5
- package/components/fileUploading/restrictions/restrictFileType/utils/prepareType/prepareType.js +0 -5
- package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/getFileTypeFromFile.d.ts +0 -4
- package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/getFileTypeFromFile.js +0 -14
- package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/index.d.ts +0 -1
- package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.d.ts +0 -4
- package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.js +0 -17
- package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/index.d.ts +0 -1
- package/node/components/fileUploading/restrictions/restrictFileType/utils/prepareType/index.d.ts +0 -1
- package/node/components/fileUploading/restrictions/restrictFileType/utils/prepareType/prepareType.d.ts +0 -5
- package/node/components/fileUploading/restrictions/restrictFileType/utils/prepareType/prepareType.js +0 -9
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/* cSpell:disable */
|
|
2
|
+
export const getMimeTypesMap = () => ({
|
|
3
|
+
'application/andrew-inset': ['ez'],
|
|
4
|
+
'application/applixware': ['aw'],
|
|
5
|
+
'application/atom+xml': ['atom'],
|
|
6
|
+
'application/atomcat+xml': ['atomcat'],
|
|
7
|
+
'application/atomdeleted+xml': ['atomdeleted'],
|
|
8
|
+
'application/atomsvc+xml': ['atomsvc'],
|
|
9
|
+
'application/atsc-dwd+xml': ['dwd'],
|
|
10
|
+
'application/atsc-held+xml': ['held'],
|
|
11
|
+
'application/atsc-rsat+xml': ['rsat'],
|
|
12
|
+
'application/bdoc': ['bdoc'],
|
|
13
|
+
'application/calendar+xml': ['xcs'],
|
|
14
|
+
'application/ccxml+xml': ['ccxml'],
|
|
15
|
+
'application/cdfx+xml': ['cdfx'],
|
|
16
|
+
'application/cdmi-capability': ['cdmia'],
|
|
17
|
+
'application/cdmi-container': ['cdmic'],
|
|
18
|
+
'application/cdmi-domain': ['cdmid'],
|
|
19
|
+
'application/cdmi-object': ['cdmio'],
|
|
20
|
+
'application/cdmi-queue': ['cdmiq'],
|
|
21
|
+
'application/cu-seeme': ['cu'],
|
|
22
|
+
'application/dash+xml': ['mpd'],
|
|
23
|
+
'application/davmount+xml': ['davmount'],
|
|
24
|
+
'application/docbook+xml': ['dbk'],
|
|
25
|
+
'application/dssc+der': ['dssc'],
|
|
26
|
+
'application/dssc+xml': ['xdssc'],
|
|
27
|
+
'application/ecmascript': ['ecma', 'es'],
|
|
28
|
+
'application/emma+xml': ['emma'],
|
|
29
|
+
'application/emotionml+xml': ['emotionml'],
|
|
30
|
+
'application/epub+zip': ['epub'],
|
|
31
|
+
'application/exi': ['exi'],
|
|
32
|
+
'application/fdt+xml': ['fdt'],
|
|
33
|
+
'application/font-tdpfr': ['pfr'],
|
|
34
|
+
'application/geo+json': ['geojson'],
|
|
35
|
+
'application/gml+xml': ['gml'],
|
|
36
|
+
'application/gpx+xml': ['gpx'],
|
|
37
|
+
'application/gxf': ['gxf'],
|
|
38
|
+
'application/gzip': ['gz'],
|
|
39
|
+
'application/hjson': ['hjson'],
|
|
40
|
+
'application/hyperstudio': ['stk'],
|
|
41
|
+
'application/inkml+xml': ['ink', 'inkml'],
|
|
42
|
+
'application/ipfix': ['ipfix'],
|
|
43
|
+
'application/its+xml': ['its'],
|
|
44
|
+
'application/java-archive': ['jar', 'war', 'ear'],
|
|
45
|
+
'application/java-serialized-object': ['ser'],
|
|
46
|
+
'application/java-vm': ['class'],
|
|
47
|
+
'application/javascript': ['js', 'mjs'],
|
|
48
|
+
'application/json': ['json', 'map'],
|
|
49
|
+
'application/json5': ['json5'],
|
|
50
|
+
'application/jsonml+json': ['jsonml'],
|
|
51
|
+
'application/ld+json': ['jsonld'],
|
|
52
|
+
'application/lgr+xml': ['lgr'],
|
|
53
|
+
'application/lost+xml': ['lostxml'],
|
|
54
|
+
'application/mac-binhex40': ['hqx'],
|
|
55
|
+
'application/mac-compactpro': ['cpt'],
|
|
56
|
+
'application/mads+xml': ['mads'],
|
|
57
|
+
'application/manifest+json': ['webmanifest'],
|
|
58
|
+
'application/marc': ['mrc'],
|
|
59
|
+
'application/marcxml+xml': ['mrcx'],
|
|
60
|
+
'application/mathematica': ['ma', 'nb', 'mb'],
|
|
61
|
+
'application/mathml+xml': ['mathml'],
|
|
62
|
+
'application/mbox': ['mbox'],
|
|
63
|
+
'application/mediaservercontrol+xml': ['mscml'],
|
|
64
|
+
'application/metalink+xml': ['metalink'],
|
|
65
|
+
'application/metalink4+xml': ['meta4'],
|
|
66
|
+
'application/mets+xml': ['mets'],
|
|
67
|
+
'application/mmt-aei+xml': ['maei'],
|
|
68
|
+
'application/mmt-usd+xml': ['musd'],
|
|
69
|
+
'application/mods+xml': ['mods'],
|
|
70
|
+
'application/mp21': ['m21', 'mp21'],
|
|
71
|
+
'application/mp4': ['mp4s', 'm4p'],
|
|
72
|
+
'application/mrb-consumer+xml': ['*xdf'],
|
|
73
|
+
'application/mrb-publish+xml': ['*xdf'],
|
|
74
|
+
'application/msword': ['doc', 'dot'],
|
|
75
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [
|
|
76
|
+
'docx',
|
|
77
|
+
],
|
|
78
|
+
'application/mxf': ['mxf'],
|
|
79
|
+
'application/n-quads': ['nq'],
|
|
80
|
+
'application/n-triples': ['nt'],
|
|
81
|
+
'application/node': ['cjs'],
|
|
82
|
+
'application/octet-stream': [
|
|
83
|
+
'bin',
|
|
84
|
+
'dms',
|
|
85
|
+
'lrf',
|
|
86
|
+
'mar',
|
|
87
|
+
'so',
|
|
88
|
+
'dist',
|
|
89
|
+
'distz',
|
|
90
|
+
'pkg',
|
|
91
|
+
'bpk',
|
|
92
|
+
'dump',
|
|
93
|
+
'elc',
|
|
94
|
+
'deploy',
|
|
95
|
+
'exe',
|
|
96
|
+
'dll',
|
|
97
|
+
'deb',
|
|
98
|
+
'dmg',
|
|
99
|
+
'iso',
|
|
100
|
+
'img',
|
|
101
|
+
'msi',
|
|
102
|
+
'msp',
|
|
103
|
+
'msm',
|
|
104
|
+
'buffer',
|
|
105
|
+
],
|
|
106
|
+
'application/oda': ['oda'],
|
|
107
|
+
'application/oebps-package+xml': ['opf'],
|
|
108
|
+
'application/ogg': ['ogx'],
|
|
109
|
+
'application/omdoc+xml': ['omdoc'],
|
|
110
|
+
'application/onenote': ['onetoc', 'onetoc2', 'onetmp', 'onepkg'],
|
|
111
|
+
'application/oxps': ['oxps'],
|
|
112
|
+
'application/p2p-overlay+xml': ['relo'],
|
|
113
|
+
'application/patch-ops-error+xml': ['*xer'],
|
|
114
|
+
'application/pdf': ['pdf'],
|
|
115
|
+
'application/pgp-encrypted': ['pgp'],
|
|
116
|
+
'application/pgp-signature': ['asc', 'sig'],
|
|
117
|
+
'application/pics-rules': ['prf'],
|
|
118
|
+
'application/pkcs10': ['p10'],
|
|
119
|
+
'application/pkcs7-mime': ['p7m', 'p7c'],
|
|
120
|
+
'application/pkcs7-signature': ['p7s'],
|
|
121
|
+
'application/pkcs8': ['p8'],
|
|
122
|
+
'application/pkix-attr-cert': ['ac'],
|
|
123
|
+
'application/pkix-cert': ['cer'],
|
|
124
|
+
'application/pkix-crl': ['crl'],
|
|
125
|
+
'application/pkix-pkipath': ['pkipath'],
|
|
126
|
+
'application/pkixcmp': ['pki'],
|
|
127
|
+
'application/pls+xml': ['pls'],
|
|
128
|
+
'application/postscript': ['ai', 'eps', 'ps'],
|
|
129
|
+
'application/provenance+xml': ['provx'],
|
|
130
|
+
'application/pskc+xml': ['pskcxml'],
|
|
131
|
+
'application/raml+yaml': ['raml'],
|
|
132
|
+
'application/rdf+xml': ['rdf', 'owl'],
|
|
133
|
+
'application/reginfo+xml': ['rif'],
|
|
134
|
+
'application/relax-ng-compact-syntax': ['rnc'],
|
|
135
|
+
'application/resource-lists+xml': ['rl'],
|
|
136
|
+
'application/resource-lists-diff+xml': ['rld'],
|
|
137
|
+
'application/rls-services+xml': ['rs'],
|
|
138
|
+
'application/route-apd+xml': ['rapd'],
|
|
139
|
+
'application/route-s-tsid+xml': ['sls'],
|
|
140
|
+
'application/route-usd+xml': ['rusd'],
|
|
141
|
+
'application/rpki-ghostbusters': ['gbr'],
|
|
142
|
+
'application/rpki-manifest': ['mft'],
|
|
143
|
+
'application/rpki-roa': ['roa'],
|
|
144
|
+
'application/rsd+xml': ['rsd'],
|
|
145
|
+
'application/rss+xml': ['rss'],
|
|
146
|
+
'application/rtf': ['rtf'],
|
|
147
|
+
'application/sbml+xml': ['sbml'],
|
|
148
|
+
'application/scvp-cv-request': ['scq'],
|
|
149
|
+
'application/scvp-cv-response': ['scs'],
|
|
150
|
+
'application/scvp-vp-request': ['spq'],
|
|
151
|
+
'application/scvp-vp-response': ['spp'],
|
|
152
|
+
'application/sdp': ['sdp'],
|
|
153
|
+
'application/senml+xml': ['senmlx'],
|
|
154
|
+
'application/sensml+xml': ['sensmlx'],
|
|
155
|
+
'application/set-payment-initiation': ['setpay'],
|
|
156
|
+
'application/set-registration-initiation': ['setreg'],
|
|
157
|
+
'application/shf+xml': ['shf'],
|
|
158
|
+
'application/sieve': ['siv', 'sieve'],
|
|
159
|
+
'application/smil+xml': ['smi', 'smil'],
|
|
160
|
+
'application/sparql-query': ['rq'],
|
|
161
|
+
'application/sparql-results+xml': ['srx'],
|
|
162
|
+
'application/srgs': ['gram'],
|
|
163
|
+
'application/srgs+xml': ['grxml'],
|
|
164
|
+
'application/sru+xml': ['sru'],
|
|
165
|
+
'application/ssdl+xml': ['ssdl'],
|
|
166
|
+
'application/ssml+xml': ['ssml'],
|
|
167
|
+
'application/swid+xml': ['swidtag'],
|
|
168
|
+
'application/tei+xml': ['tei', 'teicorpus'],
|
|
169
|
+
'application/thraud+xml': ['tfi'],
|
|
170
|
+
'application/timestamped-data': ['tsd'],
|
|
171
|
+
'application/toml': ['toml'],
|
|
172
|
+
'application/ttml+xml': ['ttml'],
|
|
173
|
+
'application/ubjson': ['ubj'],
|
|
174
|
+
'application/urc-ressheet+xml': ['rsheet'],
|
|
175
|
+
'application/urc-targetdesc+xml': ['td'],
|
|
176
|
+
'application/voicexml+xml': ['vxml'],
|
|
177
|
+
'application/wasm': ['wasm'],
|
|
178
|
+
'application/widget': ['wgt'],
|
|
179
|
+
'application/winhlp': ['hlp'],
|
|
180
|
+
'application/wsdl+xml': ['wsdl'],
|
|
181
|
+
'application/wspolicy+xml': ['wspolicy'],
|
|
182
|
+
'application/xaml+xml': ['xaml'],
|
|
183
|
+
'application/xcap-att+xml': ['xav'],
|
|
184
|
+
'application/xcap-caps+xml': ['xca'],
|
|
185
|
+
'application/xcap-diff+xml': ['xdf'],
|
|
186
|
+
'application/xcap-el+xml': ['xel'],
|
|
187
|
+
'application/xcap-error+xml': ['xer'],
|
|
188
|
+
'application/xcap-ns+xml': ['xns'],
|
|
189
|
+
'application/xenc+xml': ['xenc'],
|
|
190
|
+
'application/xhtml+xml': ['xhtml', 'xht'],
|
|
191
|
+
'application/xliff+xml': ['xlf'],
|
|
192
|
+
'application/xml': ['xml', 'xsl', 'xsd', 'rng'],
|
|
193
|
+
'application/xml-dtd': ['dtd'],
|
|
194
|
+
'application/vnd.oasis.opendocument.text': ['odt'],
|
|
195
|
+
'application/vnd.oasis.opendocument.spreadsheet': ['ods'],
|
|
196
|
+
'application/vnd.oasis.opendocument.graphics': ['odg'],
|
|
197
|
+
'application/vnd.oasis.opendocument.presentation': ['odp'],
|
|
198
|
+
'application/xop+xml': ['xop'],
|
|
199
|
+
'application/xproc+xml': ['xpl'],
|
|
200
|
+
'application/xslt+xml': ['*xsl', 'xslt'],
|
|
201
|
+
'application/xspf+xml': ['xspf'],
|
|
202
|
+
'application/xv+xml': ['mxml', 'xhvml', 'xvml', 'xvm'],
|
|
203
|
+
'application/yang': ['yang'],
|
|
204
|
+
'application/yin+xml': ['yin'],
|
|
205
|
+
'application/zip': ['zip'],
|
|
206
|
+
'application/zip-compressed': ['zip'],
|
|
207
|
+
'application/x-zip-compressed': ['zip'],
|
|
208
|
+
'application/x-rar-compressed': ['rar'],
|
|
209
|
+
'application/vnd.rar': ['rar'],
|
|
210
|
+
'application/x-compressed': ['rar'],
|
|
211
|
+
'audio/3gpp': ['*3gpp'],
|
|
212
|
+
'audio/adpcm': ['adp'],
|
|
213
|
+
'audio/amr': ['amr'],
|
|
214
|
+
'audio/basic': ['au', 'snd'],
|
|
215
|
+
'audio/midi': ['mid', 'midi', 'kar', 'rmi'],
|
|
216
|
+
'audio/mobile-xmf': ['mxmf'],
|
|
217
|
+
'audio/mp3': ['*mp3'],
|
|
218
|
+
'audio/mp4': ['m4a', 'mp4a'],
|
|
219
|
+
'audio/mpeg': ['mpga', 'mp2', 'mp2a', 'mp3', 'm2a', 'm3a'],
|
|
220
|
+
'audio/ogg': ['oga', 'ogg', 'spx', 'opus'],
|
|
221
|
+
'audio/s3m': ['s3m'],
|
|
222
|
+
'audio/silk': ['sil'],
|
|
223
|
+
'audio/wav': ['wav'],
|
|
224
|
+
'audio/wave': ['*wav'],
|
|
225
|
+
'audio/webm': ['weba'],
|
|
226
|
+
'audio/xm': ['xm'],
|
|
227
|
+
'font/collection': ['ttc'],
|
|
228
|
+
'font/otf': ['otf'],
|
|
229
|
+
'font/ttf': ['ttf'],
|
|
230
|
+
'font/woff': ['woff'],
|
|
231
|
+
'font/woff2': ['woff2'],
|
|
232
|
+
'image/aces': ['exr'],
|
|
233
|
+
'image/apng': ['apng'],
|
|
234
|
+
'image/avif': ['avif'],
|
|
235
|
+
'image/bmp': ['bmp'],
|
|
236
|
+
'image/cgm': ['cgm'],
|
|
237
|
+
'image/dicom-rle': ['drle'],
|
|
238
|
+
'image/emf': ['emf'],
|
|
239
|
+
'image/fits': ['fits'],
|
|
240
|
+
'image/g3fax': ['g3'],
|
|
241
|
+
'image/gif': ['gif'],
|
|
242
|
+
'image/heic': ['heic'],
|
|
243
|
+
'image/heic-sequence': ['heics'],
|
|
244
|
+
'image/heif': ['heif'],
|
|
245
|
+
'image/heif-sequence': ['heifs'],
|
|
246
|
+
'image/hej2k': ['hej2'],
|
|
247
|
+
'image/hsj2': ['hsj2'],
|
|
248
|
+
'image/ief': ['ief'],
|
|
249
|
+
'image/jls': ['jls'],
|
|
250
|
+
'image/jp2': ['jp2', 'jpg2'],
|
|
251
|
+
'image/jpeg': ['jpeg', 'jpg', 'jpe'],
|
|
252
|
+
'image/jph': ['jph'],
|
|
253
|
+
'image/jphc': ['jhc'],
|
|
254
|
+
'image/jpm': ['jpm'],
|
|
255
|
+
'image/jpx': ['jpx', 'jpf'],
|
|
256
|
+
'image/jxr': ['jxr'],
|
|
257
|
+
'image/jxra': ['jxra'],
|
|
258
|
+
'image/jxrs': ['jxrs'],
|
|
259
|
+
'image/jxs': ['jxs'],
|
|
260
|
+
'image/jxsc': ['jxsc'],
|
|
261
|
+
'image/jxsi': ['jxsi'],
|
|
262
|
+
'image/jxss': ['jxss'],
|
|
263
|
+
'image/ktx': ['ktx'],
|
|
264
|
+
'image/ktx2': ['ktx2'],
|
|
265
|
+
'image/png': ['png'],
|
|
266
|
+
'image/sgi': ['sgi'],
|
|
267
|
+
'image/svg+xml': ['svg', 'svgz'],
|
|
268
|
+
'image/t38': ['t38'],
|
|
269
|
+
'image/tiff': ['tif', 'tiff'],
|
|
270
|
+
'image/tiff-fx': ['tfx'],
|
|
271
|
+
'image/webp': ['webp'],
|
|
272
|
+
'image/wmf': ['wmf'],
|
|
273
|
+
'message/disposition-notification': ['disposition-notification'],
|
|
274
|
+
'message/global': ['u8msg'],
|
|
275
|
+
'message/global-delivery-status': ['u8dsn'],
|
|
276
|
+
'message/global-disposition-notification': ['u8mdn'],
|
|
277
|
+
'message/global-headers': ['u8hdr'],
|
|
278
|
+
'message/rfc822': ['eml', 'mime'],
|
|
279
|
+
'model/3mf': ['3mf'],
|
|
280
|
+
'model/gltf+json': ['gltf'],
|
|
281
|
+
'model/gltf-binary': ['glb'],
|
|
282
|
+
'model/iges': ['igs', 'iges'],
|
|
283
|
+
'model/mesh': ['msh', 'mesh', 'silo'],
|
|
284
|
+
'model/mtl': ['mtl'],
|
|
285
|
+
'model/obj': ['obj'],
|
|
286
|
+
'model/stl': ['stl'],
|
|
287
|
+
'model/vrml': ['wrl', 'vrml'],
|
|
288
|
+
'model/x3d+binary': ['*x3db', 'x3dbz'],
|
|
289
|
+
'model/x3d+fastinfoset': ['x3db'],
|
|
290
|
+
'model/x3d+vrml': ['*x3dv', 'x3dvz'],
|
|
291
|
+
'model/x3d+xml': ['x3d', 'x3dz'],
|
|
292
|
+
'model/x3d-vrml': ['x3dv'],
|
|
293
|
+
'text/cache-manifest': ['appcache', 'manifest'],
|
|
294
|
+
'text/calendar': ['ics', 'ifb'],
|
|
295
|
+
'text/coffeescript': ['coffee', 'litcoffee'],
|
|
296
|
+
'text/css': ['css'],
|
|
297
|
+
'text/csv': ['csv'],
|
|
298
|
+
'application/csv': ['csv'],
|
|
299
|
+
'text/html': ['html', 'htm', 'shtml'],
|
|
300
|
+
'text/jade': ['jade'],
|
|
301
|
+
'text/jsx': ['jsx'],
|
|
302
|
+
'text/less': ['less'],
|
|
303
|
+
'text/markdown': ['markdown', 'md'],
|
|
304
|
+
'text/mathml': ['mml'],
|
|
305
|
+
'text/mdx': ['mdx'],
|
|
306
|
+
'text/n3': ['n3'],
|
|
307
|
+
'text/plain': ['txt', 'text', 'conf', 'def', 'list', 'log', 'in', 'ini'],
|
|
308
|
+
'text/richtext': ['rtx'],
|
|
309
|
+
'text/rtf': ['*rtf'],
|
|
310
|
+
'text/sgml': ['sgml', 'sgm'],
|
|
311
|
+
'text/shex': ['shex'],
|
|
312
|
+
'text/slim': ['slim', 'slm'],
|
|
313
|
+
'text/spdx': ['spdx'],
|
|
314
|
+
'text/stylus': ['stylus', 'styl'],
|
|
315
|
+
'text/tab-separated-values': ['tsv'],
|
|
316
|
+
'text/troff': ['t', 'tr', 'roff', 'man', 'me', 'ms'],
|
|
317
|
+
'text/turtle': ['ttl'],
|
|
318
|
+
'text/uri-list': ['uri', 'uris', 'urls'],
|
|
319
|
+
'text/vcard': ['vcard'],
|
|
320
|
+
'text/vtt': ['vtt'],
|
|
321
|
+
'text/xml': ['*xml'],
|
|
322
|
+
'text/yaml': ['yaml', 'yml'],
|
|
323
|
+
'video/3gpp': ['3gp', '3gpp'],
|
|
324
|
+
'video/3gpp2': ['3g2'],
|
|
325
|
+
'video/h261': ['h261'],
|
|
326
|
+
'video/h263': ['h263'],
|
|
327
|
+
'video/h264': ['h264'],
|
|
328
|
+
'video/iso.segment': ['m4s'],
|
|
329
|
+
'video/jpeg': ['jpgv'],
|
|
330
|
+
'video/jpm': ['*jpm', 'jpgm'],
|
|
331
|
+
'video/mj2': ['mj2', 'mjp2'],
|
|
332
|
+
'video/mp2t': ['ts'],
|
|
333
|
+
'video/mp4': ['mp4', 'mp4v', 'mpg4'],
|
|
334
|
+
'video/mpeg': ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'],
|
|
335
|
+
'video/ogg': ['ogv'],
|
|
336
|
+
'video/quicktime': ['qt', 'mov'],
|
|
337
|
+
'video/webm': ['webm'],
|
|
338
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['xlsx'],
|
|
339
|
+
'application/vnd.ms-excel': ['xls', 'csv'],
|
|
340
|
+
'application/x-x509-ca-cert': ['cer'],
|
|
341
|
+
'application/x-pkcs7-certificates': ['p7b'],
|
|
342
|
+
'application/sig': ['sig'],
|
|
343
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MimeTypeRegistry';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MimeTypeRegistry';
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import type { ReactNode, RefObject } from 'react';
|
|
2
|
+
export type FileMimeType = string;
|
|
2
3
|
export type RestrictionFnResult = {
|
|
3
4
|
code: string;
|
|
4
5
|
message: string;
|
|
5
6
|
};
|
|
6
7
|
export type RestrictionFn = (value: File) => RestrictionFnResult | undefined;
|
|
7
8
|
export type FileId = string;
|
|
9
|
+
/**
|
|
10
|
+
* Расширенная информация о переданном accept
|
|
11
|
+
*/
|
|
12
|
+
export type AcceptMeta = {
|
|
13
|
+
extensions: string[];
|
|
14
|
+
mimeTypes: string[];
|
|
15
|
+
generalMimeTypes: string[];
|
|
16
|
+
isOnlyExtensions: boolean;
|
|
17
|
+
};
|
|
8
18
|
export type FileStatus = {
|
|
9
19
|
/**
|
|
10
20
|
* Если true, будет отображен progress-бар загрузки файла
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { getFileTypeFromName } from '../restrictions/restrictFileType/utils/getFileTypeFromName';
|
|
2
1
|
export { compareFile } from './compareFile';
|
|
3
2
|
export { declensionFile } from './declensionFile';
|
|
4
3
|
export { generateAttrLinkNewTab } from './generateAttrLinkNewTab';
|
|
5
4
|
export { rulePipe } from './rulePipe';
|
|
6
5
|
export { toArray } from './toArray';
|
|
6
|
+
export * from '../hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { getFileTypeFromName } from '../restrictions/restrictFileType/utils/getFileTypeFromName';
|
|
2
1
|
export { compareFile } from './compareFile';
|
|
3
2
|
export { declensionFile } from './declensionFile';
|
|
4
3
|
export { generateAttrLinkNewTab } from './generateAttrLinkNewTab';
|
|
5
4
|
export { rulePipe } from './rulePipe';
|
|
6
5
|
export { toArray } from './toArray';
|
|
6
|
+
export * from '../hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Занимается логированием ошибок и отправкой их в sentry
|
|
3
|
+
*/
|
|
4
|
+
export declare class ErrorService {
|
|
5
|
+
private readonly logger;
|
|
6
|
+
private static instance;
|
|
7
|
+
private _captureException?;
|
|
8
|
+
private constructor();
|
|
9
|
+
init(captureException: (error: Error) => void): void;
|
|
10
|
+
captureException: (error: Error) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Логирует ошибку в консоль и отправляет в sentry
|
|
13
|
+
* */
|
|
14
|
+
logError: (componentName: string, message: string) => void;
|
|
15
|
+
static getInstance(): ErrorService;
|
|
16
|
+
private createError;
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Занимается логированием ошибок и отправкой их в sentry
|
|
3
|
+
*/
|
|
4
|
+
export class ErrorService {
|
|
5
|
+
constructor(logger) {
|
|
6
|
+
this.logger = logger;
|
|
7
|
+
this.captureException = (error) => {
|
|
8
|
+
if (this._captureException) {
|
|
9
|
+
this._captureException(error);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Логирует ошибку в консоль и отправляет в sentry
|
|
14
|
+
* */
|
|
15
|
+
this.logError = (componentName, message) => {
|
|
16
|
+
const error = this.createError(componentName, message);
|
|
17
|
+
this.logger.error(error);
|
|
18
|
+
this.captureException(error);
|
|
19
|
+
};
|
|
20
|
+
this.createError = (componentName, message) => {
|
|
21
|
+
return new Error(`ASTRAL_UI:${componentName}: ${message}`);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
init(captureException) {
|
|
25
|
+
this._captureException = captureException;
|
|
26
|
+
}
|
|
27
|
+
static getInstance() {
|
|
28
|
+
if (!ErrorService.instance) {
|
|
29
|
+
ErrorService.instance = new ErrorService(console);
|
|
30
|
+
}
|
|
31
|
+
return ErrorService.instance;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ErrorService';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ErrorService';
|
|
@@ -15,11 +15,24 @@ const SkeletonGrid_1 = require("./SkeletonGrid");
|
|
|
15
15
|
const styles_1 = require("./styles");
|
|
16
16
|
const useLogic_1 = require("./useLogic");
|
|
17
17
|
const CardGridInfinite = (props) => {
|
|
18
|
-
const { contentStateProps, desktopCardWidth, virtuosoProps, scrollParent, skeleton, footerProps, onTopButtonProps, list, noDataImgSrc, defineCard, classnames, } = (0, useLogic_1.useLogic)(props);
|
|
18
|
+
const { contentStateProps, desktopCardWidth, virtuosoProps, scrollParent, skeleton, footerProps, onTopButtonProps, list, noDataImgSrc, defineCard, classnames, isMobile, } = (0, useLogic_1.useLogic)(props);
|
|
19
19
|
const VirtuosoList = (0, react_1.useMemo)(() => (0, react_1.forwardRef)((listProps, ref) => ((0, jsx_runtime_1.jsx)(List_1.List, { ...listProps, ref: ref, desktopCardWidth: desktopCardWidth }))), [desktopCardWidth]);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const renderVirtuoso = () => {
|
|
21
|
+
if (!scrollParent) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
// VirtuosoGrid не поддерживает работу со списком без grid сетки (на мобиле обычный список) когда высота item разная
|
|
25
|
+
if (isMobile) {
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(react_virtuoso_1.Virtuoso, { ...virtuosoProps, data: list, customScrollParent: scrollParent, components: {
|
|
27
|
+
List: VirtuosoList,
|
|
28
|
+
Footer: () => (0, jsx_runtime_1.jsx)(Footer_1.Footer, { ...footerProps }),
|
|
29
|
+
}, itemContent: (_, item) => (0, jsx_runtime_1.jsx)(Card_1.Card, { item: item, ...defineCard(item) }) }));
|
|
30
|
+
}
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(react_virtuoso_1.VirtuosoGrid, { ...virtuosoProps, data: list, customScrollParent: scrollParent, listClassName: constants_1.cardGridClassnames.list, components: {
|
|
32
|
+
List: VirtuosoList,
|
|
33
|
+
Footer: () => (0, jsx_runtime_1.jsx)(Footer_1.Footer, { ...footerProps }),
|
|
34
|
+
}, itemContent: (_, item) => (0, jsx_runtime_1.jsx)(Card_1.Card, { item: item, ...defineCard(item) }) }));
|
|
35
|
+
};
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.ContentStateWrapper, { className: classnames, children: (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { ...contentStateProps, loadingContent: (0, jsx_runtime_1.jsx)(SkeletonGrid_1.SkeletonGrid, { skeleton: skeleton, desktopCardWidth: desktopCardWidth }), children: list?.length ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderVirtuoso(), (0, jsx_runtime_1.jsx)(OnTopButton_1.OnTopButton, { ...onTopButtonProps })] })) : ((0, jsx_runtime_1.jsx)(NoDataPlaceholder_1.NoDataPlaceholder, { noDataImgSrc: noDataImgSrc })) }) }));
|
|
24
37
|
};
|
|
25
38
|
exports.CardGridInfinite = CardGridInfinite;
|
|
@@ -31,6 +31,7 @@ export declare const useLogic: <TDataItem extends Record<string, unknown>>({ lis
|
|
|
31
31
|
handleScrollToTop: () => void;
|
|
32
32
|
scrollRef: import("react").RefObject<HTMLElement | null>;
|
|
33
33
|
};
|
|
34
|
+
isMobile: boolean;
|
|
34
35
|
scrollParent: HTMLElement | null;
|
|
35
36
|
skeleton: import("../types").SkeletonConfig;
|
|
36
37
|
list: TDataItem[] | undefined;
|
|
@@ -139,5 +139,5 @@ export type ConfigProviderProps = Partial<ConfigContextProps> & {
|
|
|
139
139
|
nextFeatureFlags?: NextFeatureFlagsContextProps;
|
|
140
140
|
};
|
|
141
141
|
export declare const ConfigContext: import("react").Context<ConfigContextProps>;
|
|
142
|
-
export declare const ConfigProvider: ({ children, language, datePickerLanguageMap, captureException, emptySymbol, imagesMap, techSup, hidePersonalData, hidePersonalDataClassname, hidePersonalInputDataClassname, components: propsComponents, nextFeatureFlags, }: Partial<ConfigProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
142
|
+
export declare const ConfigProvider: ({ children, language, datePickerLanguageMap, captureException: captureExceptionProp, emptySymbol, imagesMap, techSup, hidePersonalData, hidePersonalDataClassname, hidePersonalInputDataClassname, components: propsComponents, nextFeatureFlags, }: Partial<ConfigProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
143
143
|
export {};
|
|
@@ -4,6 +4,7 @@ exports.ConfigProvider = exports.ConfigContext = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const constants_1 = require("../DatePicker/constants");
|
|
7
|
+
const ErrorService_1 = require("../services/ErrorService");
|
|
7
8
|
const NextFeatureFlagsContext_1 = require("./NextFeatureFlagsContext");
|
|
8
9
|
const imagesMapDefault = {
|
|
9
10
|
noDataImgSrc: '',
|
|
@@ -29,7 +30,13 @@ exports.ConfigContext = (0, react_1.createContext)({
|
|
|
29
30
|
hidePersonalInputDataClassname: defaultHidePersonalInputDataClassname,
|
|
30
31
|
hidePersonalData: true,
|
|
31
32
|
});
|
|
32
|
-
const ConfigProvider = ({ children, language = 'ru', datePickerLanguageMap = constants_1.russianMap, captureException, emptySymbol = '—', imagesMap = imagesMapDefault, techSup = techSupDefault, hidePersonalData = true, hidePersonalDataClassname = defaultHidePersonalDataClassname, hidePersonalInputDataClassname = defaultHidePersonalInputDataClassname, components: propsComponents, nextFeatureFlags = {}, }) => {
|
|
33
|
+
const ConfigProvider = ({ children, language = 'ru', datePickerLanguageMap = constants_1.russianMap, captureException: captureExceptionProp, emptySymbol = '—', imagesMap = imagesMapDefault, techSup = techSupDefault, hidePersonalData = true, hidePersonalDataClassname = defaultHidePersonalDataClassname, hidePersonalInputDataClassname = defaultHidePersonalInputDataClassname, components: propsComponents, nextFeatureFlags = {}, }) => {
|
|
34
|
+
const captureException =
|
|
35
|
+
// biome-ignore lint/suspicious/noConsole: Ошибка для интеграторов
|
|
36
|
+
captureExceptionProp || ((error) => console.error(error));
|
|
37
|
+
(0, react_1.useMemo)(() => {
|
|
38
|
+
ErrorService_1.ErrorService.getInstance().init(captureException);
|
|
39
|
+
}, [captureException]);
|
|
33
40
|
(0, react_1.useEffect)(() => {
|
|
34
41
|
if (!captureException) {
|
|
35
42
|
// biome-ignore lint/suspicious/noConsole: Ошибка для интеграторов
|
|
@@ -58,8 +65,7 @@ const ConfigProvider = ({ children, language = 'ru', datePickerLanguageMap = con
|
|
|
58
65
|
return ((0, jsx_runtime_1.jsx)(exports.ConfigContext.Provider, { value: {
|
|
59
66
|
language,
|
|
60
67
|
datePickerLanguageMap,
|
|
61
|
-
|
|
62
|
-
captureException: captureException || ((error) => console.error(error)),
|
|
68
|
+
captureException,
|
|
63
69
|
emptySymbol,
|
|
64
70
|
imagesMap,
|
|
65
71
|
techSup,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
|
-
const getFileExtension_1 = require("@astral/utils/file/getFileExtension");
|
|
5
4
|
const react_1 = require("react");
|
|
6
5
|
const ConfigProvider_1 = require("../../../../ConfigProvider");
|
|
7
6
|
const constants_1 = require("../../../constants");
|
|
8
7
|
const useGenerateLocalFileURL_1 = require("../../../hooks/useGenerateLocalFileURL");
|
|
8
|
+
const MimeTypeRegistry_1 = require("../../../services/MimeTypeRegistry");
|
|
9
9
|
const generateAttrLinkNewTab_1 = require("../../../utils/generateAttrLinkNewTab");
|
|
10
10
|
const useLogic = ({ fileId, file, fileUrl, isUploadError, generateDownloadLink, onDelete, onRetry, onView, setErrorStatusFile, selfFiles, isLoading, isError, isDeletingFile, fileName, }) => {
|
|
11
11
|
const { captureException } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
|
|
@@ -45,8 +45,9 @@ const useLogic = ({ fileId, file, fileUrl, isUploadError, generateDownloadLink,
|
|
|
45
45
|
if (onView) {
|
|
46
46
|
return { isShowViewButton: true, onClick: handleView };
|
|
47
47
|
}
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const extensions = file &&
|
|
49
|
+
MimeTypeRegistry_1.MimeTypeRegistry.getInstance().getExtensionsByMimeType(file?.type);
|
|
50
|
+
if (checkIsAcceptedExtension(extensions)) {
|
|
50
51
|
return {
|
|
51
52
|
isShowViewButton: true,
|
|
52
53
|
...(0, generateAttrLinkNewTab_1.generateAttrLinkNewTab)(downloadLink),
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type UsePreviewFileUploaderParams } from '../hooks/usePreviewFileUploader';
|
|
3
3
|
export type PreviewFileUploaderProps = UsePreviewFileUploaderParams;
|
|
4
|
-
export declare const PreviewFileUploader: import("react").ForwardRefExoticComponent<
|
|
4
|
+
export declare const PreviewFileUploader: import("react").ForwardRefExoticComponent<Pick<import("../types").FileUploaderProps, "className" | "label" | "name" | "placeholder" | "isDisabled" | "isError" | "inputRef" | "helperText" | "maxFileSize" | "onUploadFile" | "getErrorMessage" | "restrictions" | "notify" | "onDeleteFile" | "onView" | "generateDownloadLink"> & {
|
|
5
|
+
value: import("../types").UploadFile | null | undefined;
|
|
6
|
+
accept?: string[] | undefined;
|
|
7
|
+
placeholderImgSrc?: string | undefined;
|
|
8
|
+
isHidePersonalData?: boolean | undefined;
|
|
9
|
+
PdfViewer?: import("react").LazyExoticComponent<(props: import("../../PdfViewer").PdfViewerProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>> | ((props: import("../../PdfViewer").PdfViewerProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>) | undefined;
|
|
10
|
+
onChange: (value: import("../types").UploadFile | null) => void;
|
|
11
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
|
-
const getFileExtension_1 = require("@astral/utils/file/getFileExtension");
|
|
5
4
|
const react_1 = require("react");
|
|
6
5
|
const ConfigProvider_1 = require("../../../../ConfigProvider");
|
|
7
6
|
const constants_1 = require("../../../constants");
|
|
8
7
|
const useGenerateLocalFileURL_1 = require("../../../hooks/useGenerateLocalFileURL");
|
|
8
|
+
const MimeTypeRegistry_1 = require("../../../services/MimeTypeRegistry");
|
|
9
9
|
const generateAttrLinkNewTab_1 = require("../../../utils/generateAttrLinkNewTab");
|
|
10
10
|
const useLogic = ({ fileId, file, fileUrl, generateDownloadLink, onDelete, onView, fileType, }) => {
|
|
11
11
|
const { captureException } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
|
|
12
12
|
const { generateUrl } = (0, useGenerateLocalFileURL_1.useGenerateLocalFileURL)();
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const isPdfFile = MimeTypeRegistry_1.MimeTypeRegistry.getInstance()
|
|
14
|
+
.getExtensionsByMimeType((file?.type || fileType))
|
|
15
|
+
?.includes('pdf') || false;
|
|
15
16
|
const isImageFile = fileType.includes('image/');
|
|
16
17
|
const isOtherFile = !isImageFile && !isPdfFile;
|
|
17
18
|
const getDownloadLink = () => {
|
|
@@ -42,8 +43,8 @@ const useLogic = ({ fileId, file, fileUrl, generateDownloadLink, onDelete, onVie
|
|
|
42
43
|
if (onView) {
|
|
43
44
|
return { onClick: handleView };
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
-
if (checkIsAcceptedExtension(
|
|
46
|
+
const extensions = MimeTypeRegistry_1.MimeTypeRegistry.getInstance().getExtensionsByMimeType((file?.type || fileType));
|
|
47
|
+
if (checkIsAcceptedExtension(extensions)) {
|
|
47
48
|
return (0, generateAttrLinkNewTab_1.generateAttrLinkNewTab)(downloadLink);
|
|
48
49
|
}
|
|
49
50
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './usePrepareAccept';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./usePrepareAccept"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './usePrepareAccept';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./usePrepareAccept"), exports);
|