@chayns-components/core 5.0.0-beta.964 → 5.0.0-beta.966
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/cjs/index.js +6 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/fileDialog.js +20 -2
- package/lib/cjs/utils/fileDialog.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/fileDialog.js +18 -1
- package/lib/esm/utils/fileDialog.js.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/utils/fileDialog.d.ts +1 -0
- package/package.json +2 -2
package/lib/cjs/index.js
CHANGED
|
@@ -345,6 +345,12 @@ Object.defineProperty(exports, "Truncation", {
|
|
|
345
345
|
return _Truncation.default;
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
|
+
Object.defineProperty(exports, "filterFilesByMimeType", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function () {
|
|
351
|
+
return _fileDialog.filterFilesByMimeType;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
348
354
|
Object.defineProperty(exports, "getFileAsArrayBuffer", {
|
|
349
355
|
enumerable: true,
|
|
350
356
|
get: function () {
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingBar","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_useElementSize","_comboBox","_contentCard","_contextMenu","_filterButtons","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n ColorSchemeContextProps,\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type ComboBoxTextStyles,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as ContextMenu,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,G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CAAA,KAAAK,OAAA,EAAAL,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingBar","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_useElementSize","_comboBox","_contentCard","_contextMenu","_filterButtons","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n ColorSchemeContextProps,\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type ComboBoxTextStyles,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as ContextMenu,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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c,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAAA,SAAAtE,uBAAA8D,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAI,UAAA,GAAAJ,CAAA,KAAAK,OAAA,EAAAL,CAAA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectFiles = exports.getFileAsArrayBuffer = void 0;
|
|
6
|
+
exports.selectFiles = exports.getFileAsArrayBuffer = exports.filterFilesByMimeType = void 0;
|
|
7
7
|
var _chaynsApi = require("chayns-api");
|
|
8
8
|
const selectFiles = ({
|
|
9
9
|
type,
|
|
@@ -43,7 +43,7 @@ const selectFiles = ({
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
const fileArray = Object.values(files);
|
|
46
|
-
|
|
46
|
+
let filteredFileArray = fileArray.filter(file => {
|
|
47
47
|
const sizeInMB = file.size / 1024 / 1024;
|
|
48
48
|
if (maxFileSizeInMB && maxFileSizeInMB < sizeInMB) {
|
|
49
49
|
return false;
|
|
@@ -59,6 +59,9 @@ const selectFiles = ({
|
|
|
59
59
|
text: 'Einige Deiner ausgewählten Dateien sind zu groß.'
|
|
60
60
|
}).open();
|
|
61
61
|
}
|
|
62
|
+
if (typeof type === 'string') {
|
|
63
|
+
filteredFileArray = filterFilesByMimeType(filteredFileArray, type);
|
|
64
|
+
}
|
|
62
65
|
resolve(filteredFileArray);
|
|
63
66
|
};
|
|
64
67
|
const onCancel = () => {
|
|
@@ -75,6 +78,21 @@ const selectFiles = ({
|
|
|
75
78
|
input.click();
|
|
76
79
|
});
|
|
77
80
|
exports.selectFiles = selectFiles;
|
|
81
|
+
const filterFilesByMimeType = (files, mimeTypes) => {
|
|
82
|
+
const allowedTypes = mimeTypes.split(',').map(type => type.trim());
|
|
83
|
+
const isAllowedType = fileType => allowedTypes.some(allowedType => {
|
|
84
|
+
if (allowedType.endsWith('/*')) {
|
|
85
|
+
const convertedAllowedType = allowedType.split('/*')[0];
|
|
86
|
+
if (!convertedAllowedType) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return fileType.startsWith(convertedAllowedType);
|
|
90
|
+
}
|
|
91
|
+
return fileType === allowedType;
|
|
92
|
+
});
|
|
93
|
+
return Array.from(files).filter(file => isAllowedType(file.type));
|
|
94
|
+
};
|
|
95
|
+
exports.filterFilesByMimeType = filterFilesByMimeType;
|
|
78
96
|
const getFileAsArrayBuffer = file => new Promise((resolve, reject) => {
|
|
79
97
|
const reader = new FileReader();
|
|
80
98
|
reader.onload = e => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDialog.js","names":["_chaynsApi","require","selectFiles","type","multiple","maxFileSizeInMB","Promise","resolve","reject","input","document","createElement","style","visibility","width","height","display","accept","body","appendChild","abortController","AbortController","signal","onChange","event","removeChild","abort","target","files","fileArray","Object","values","filteredFileArray","filter","file","sizeInMB","size","includes","length","createDialog","DialogType","ALERT","text","open","onCancel","Error","addEventListener","click","exports","getFileAsArrayBuffer","reader","FileReader","onload","e","_e$target","result","onerror","readAsArrayBuffer"],"sources":["../../../src/utils/fileDialog.ts"],"sourcesContent":["import { createDialog, DialogType } from 'chayns-api';\n\ninterface SelectFilesOptions {\n type?: string;\n multiple: boolean;\n maxFileSizeInMB?: number;\n}\n\nexport const selectFiles = ({\n
|
|
1
|
+
{"version":3,"file":"fileDialog.js","names":["_chaynsApi","require","selectFiles","type","multiple","maxFileSizeInMB","Promise","resolve","reject","input","document","createElement","style","visibility","width","height","display","accept","body","appendChild","abortController","AbortController","signal","onChange","event","removeChild","abort","target","files","fileArray","Object","values","filteredFileArray","filter","file","sizeInMB","size","includes","length","createDialog","DialogType","ALERT","text","open","filterFilesByMimeType","onCancel","Error","addEventListener","click","exports","mimeTypes","allowedTypes","split","map","trim","isAllowedType","fileType","some","allowedType","endsWith","convertedAllowedType","startsWith","Array","from","getFileAsArrayBuffer","reader","FileReader","onload","e","_e$target","result","onerror","readAsArrayBuffer"],"sources":["../../../src/utils/fileDialog.ts"],"sourcesContent":["import { createDialog, DialogType } from 'chayns-api';\n\ninterface SelectFilesOptions {\n type?: string;\n multiple: boolean;\n maxFileSizeInMB?: number;\n}\n\nexport const selectFiles = ({\n type,\n multiple,\n maxFileSizeInMB,\n}: SelectFilesOptions): Promise<File[]> =>\n new Promise((resolve, reject) => {\n const input = document.createElement('input');\n\n input.type = 'file';\n input.style.visibility = 'none';\n input.style.width = '0';\n input.style.height = '0';\n input.style.display = 'none';\n\n if (type !== '*/*' && type) {\n input.accept = type;\n }\n\n if (multiple) {\n input.multiple = true;\n }\n\n document.body.appendChild(input);\n\n const abortController = new AbortController();\n const { signal } = abortController;\n\n const onChange = (event: Event) => {\n document.body.removeChild(input);\n abortController.abort();\n\n if (!event.target) {\n resolve([]);\n return;\n }\n\n const target = event.target as HTMLInputElement;\n const { files } = target;\n\n if (!files) {\n resolve([]);\n return;\n }\n\n const fileArray = Object.values(files);\n\n let filteredFileArray = fileArray.filter((file) => {\n const sizeInMB = file.size / 1024 / 1024;\n\n if (maxFileSizeInMB && maxFileSizeInMB < sizeInMB) {\n return false;\n }\n\n if (file.type.includes('video/') && sizeInMB > 500) {\n return false;\n }\n\n return !(file.type.includes('image/') && sizeInMB > 64);\n });\n\n if (fileArray.length !== filteredFileArray.length) {\n void createDialog({\n type: DialogType.ALERT,\n text: 'Einige Deiner ausgewählten Dateien sind zu groß.',\n }).open();\n }\n\n if (typeof type === 'string') {\n filteredFileArray = filterFilesByMimeType(filteredFileArray, type);\n }\n\n resolve(filteredFileArray);\n };\n\n const onCancel = () => {\n document.body.removeChild(input);\n abortController.abort();\n reject(new Error('File selection was cancelled.'));\n };\n\n input.addEventListener('change', onChange, { signal });\n input.addEventListener('focusout', onCancel, { signal });\n\n input.click();\n });\n\nexport const filterFilesByMimeType = (files: FileList | File[], mimeTypes: string): File[] => {\n const allowedTypes = mimeTypes.split(',').map((type) => type.trim());\n\n const isAllowedType = (fileType: string) =>\n allowedTypes.some((allowedType) => {\n if (allowedType.endsWith('/*')) {\n const convertedAllowedType = allowedType.split('/*')[0];\n\n if (!convertedAllowedType) {\n return false;\n }\n\n return fileType.startsWith(convertedAllowedType);\n }\n\n return fileType === allowedType;\n });\n\n return Array.from(files).filter((file) => isAllowedType(file.type));\n};\n\nexport const getFileAsArrayBuffer = (file: File): Promise<string | ArrayBuffer> =>\n new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = (e) => {\n if (e.target?.result) {\n resolve(e.target.result);\n } else {\n reject(Error('Could not get array buffer.'));\n }\n };\n\n reader.onerror = reject;\n\n reader.readAsArrayBuffer(file);\n });\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAQO,MAAMC,WAAW,GAAGA,CAAC;EACxBC,IAAI;EACJC,QAAQ;EACRC;AACgB,CAAC,KACjB,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;EAC7B,MAAMC,KAAK,GAAGC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;EAE7CF,KAAK,CAACN,IAAI,GAAG,MAAM;EACnBM,KAAK,CAACG,KAAK,CAACC,UAAU,GAAG,MAAM;EAC/BJ,KAAK,CAACG,KAAK,CAACE,KAAK,GAAG,GAAG;EACvBL,KAAK,CAACG,KAAK,CAACG,MAAM,GAA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,CAAC,IAAI,CAAC,EAAE;MAC5B,MAAMC,oBAAoB,GAAGF,WAAW,CAACN,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;MAEvD,IAAI,CAACQ,oBAAoB,EAAE;QACvB,OAAO,KAAK;MAChB;MAEA,OAAOJ,QAAQ,CAACK,UAAU,CAACD,oBAAoB,CAAC;IACpD;IAEA,OAAOJ,QAAQ,KAAKE,WAAW;EACnC,CAAC,CAAC;EAEN,OAAOI,KAAK,CAACC,IAAI,CAACnC,KAAK,CAAC,CAACK,MAAM,CAAEC,IAAI,IAAKqB,aAAa,CAACrB,IAAI,CAAC/B,IAAI,CAAC,CAAC;AACvE,CAAC;AAAC8C,OAAA,CAAAL,qBAAA,GAAAA,qBAAA;AAEK,MAAMoB,oBAAoB,GAAI9B,IAAU,IAC3C,IAAI5B,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;EAC7B,MAAMyD,MAAM,GAAG,IAAIC,UAAU,CAAC,CAAC;EAE/BD,MAAM,CAACE,MAAM,GAAIC,CAAC,IAAK;IAAA,IAAAC,SAAA;IACnB,KAAAA,SAAA,GAAID,CAAC,CAACzC,MAAM,cAAA0C,SAAA,eAARA,SAAA,CAAUC,MAAM,EAAE;MAClB/D,OAAO,CAAC6D,CAAC,CAACzC,MAAM,CAAC2C,MAAM,CAAC;IAC5B,CAAC,MAAM;MACH9D,MAAM,CAACsC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAChD;EACJ,CAAC;EAEDmB,MAAM,CAACM,OAAO,GAAG/D,MAAM;EAEvByD,MAAM,CAACO,iBAAiB,CAACtC,IAAI,CAAC;AAClC,CAAC,CAAC;AAACe,OAAA,CAAAe,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
package/lib/esm/index.js
CHANGED
|
@@ -54,7 +54,7 @@ export { ContextMenuAlignment } from './types/contextMenu';
|
|
|
54
54
|
export { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';
|
|
55
55
|
export { ClampPosition } from './types/truncation';
|
|
56
56
|
export { getIsTouch } from './utils/environment';
|
|
57
|
-
export { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';
|
|
57
|
+
export { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';
|
|
58
58
|
export { isTobitEmployee } from './utils/isTobitEmployee';
|
|
59
59
|
export { getUsableHeight } from './utils/pageProvider';
|
|
60
60
|
export { uploadFile } from './utils/uploadFile';
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","Accordion","AccordionContent","AccordionGroup","AccordionIntro","AccordionItem","AmountControl","AreaContext","AreaProvider","Badge","Button","Checkbox","ColorSchemeProvider","useColorScheme","ComboBox","ContentCard","ContextMenu","ExpandableContent","FileInput","FilterButton","FilterButtons","GridImage","Icon","Input","List","ListItemContent","ListItem","MentionFinder","NumberInput","PageProvider","Popup","PopupContent","ProgressBar","RadioButtonGroup","RadioButton","ScrollView","SearchBox","SearchInput","SelectButton","SetupWizardItem","SetupWizard","SharingBar","Signature","SliderButton","Slider","SmallWaitCursor","SmallWaitCursorSize","SmallWaitCursorSpeed","TagInput","TextArea","Tooltip","Truncation","MentionFinderPopupAlignment","useElementSize","ComboBoxDirection","ContentCardType","ContextMenuAlignment","FilterButtonItemShape","FilterButtonSize","ClampPosition","getIsTouch","getFileAsArrayBuffer","selectFiles","isTobitEmployee","getUsableHeight","uploadFile"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n ColorSchemeContextProps,\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type ComboBoxTextStyles,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as ContextMenu,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\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,SAASC,2BAA2B,QAAQ,2BAA2B;AACvE,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,iBAAiB,QAAQ,kBAAkB;AACpD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,oBAAoB,QAAQ,qBAAqB;AAG1D,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,uBAAuB;AAW/E,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,oBAAoB,EAAEC,WAAW,QAAQ,oBAAoB;
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","Accordion","AccordionContent","AccordionGroup","AccordionIntro","AccordionItem","AmountControl","AreaContext","AreaProvider","Badge","Button","Checkbox","ColorSchemeProvider","useColorScheme","ComboBox","ContentCard","ContextMenu","ExpandableContent","FileInput","FilterButton","FilterButtons","GridImage","Icon","Input","List","ListItemContent","ListItem","MentionFinder","NumberInput","PageProvider","Popup","PopupContent","ProgressBar","RadioButtonGroup","RadioButton","ScrollView","SearchBox","SearchInput","SelectButton","SetupWizardItem","SetupWizard","SharingBar","Signature","SliderButton","Slider","SmallWaitCursor","SmallWaitCursorSize","SmallWaitCursorSpeed","TagInput","TextArea","Tooltip","Truncation","MentionFinderPopupAlignment","useElementSize","ComboBoxDirection","ContentCardType","ContextMenuAlignment","FilterButtonItemShape","FilterButtonSize","ClampPosition","getIsTouch","filterFilesByMimeType","getFileAsArrayBuffer","selectFiles","isTobitEmployee","getUsableHeight","uploadFile"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n ColorSchemeContextProps,\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type ComboBoxTextStyles,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as ContextMenu,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\n"],"mappings":"AAAA;AACA,SAASA,OAAO,IAAIC,SAAS,QAAQ,kCAAkC;AACvE,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,2DAA2D;AACvG,SAASF,OAAO,IAAIG,cAAc,QAAQ,uDAAuD;AACjG,SAASH,OAAO,IAAII,cAAc,QAAQ,uDAAuD;AACjG,SAASJ,OAAO,IAAIK,aAAa,QAAQ,qDAAqD;AAC9F,SAASL,OAAO,IAAIM,aAAa,QAAQ,2CAA2C;AACpF,SACIC,WAAW,EACXP,OAAO,IAAIQ,YAAY,QACpB,gDAAgD;AACvD,SAASR,OAAO,IAAIS,KAAK,QAAQ,0BAA0B;AAC3D,SAAST,OAAO,IAAIU,MAAM,QAAQ,4BAA4B;AAC9D,SAASV,OAAO,IAAIW,QAAQ,QAAQ,gCAAgC;AACpE,SACIX,OAAO,IAAIY,mBAAmB,EAC9BC,cAAc,QACX,wDAAwD;AAM/D,SACIb,OAAO,IAAIc,QAAQ,QAIhB,gCAAgC;AACvC,SAASd,OAAO,IAAIe,WAAW,QAAQ,uCAAuC;AAC9E,SACIf,OAAO,IAAIgB,WAAW,QAInB,uCAAuC;AAC9C,SAAShB,OAAO,IAAIiB,iBAAiB,QAAQ,mDAAmD;AAChG,SAASjB,OAAO,IAAIkB,SAAS,QAA2B,mCAAmC;AAC3F,SAASlB,OAAO,IAAImB,YAAY,QAAQ,wDAAwD;AAChG,SAASnB,OAAO,IAAIoB,aAAa,QAAQ,2CAA2C;AACpF,SAASpB,OAAO,IAAIqB,SAAS,QAAQ,mCAAmC;AACxE,SAASrB,OAAO,IAAIsB,IAAI,QAAQ,wBAAwB;AACxD,SAAStB,OAAO,IAAIuB,KAAK,QAAQ,0BAA0B;AAC3D,SAASvB,OAAO,IAAIwB,IAAI,QAAQ,wBAAwB;AACxD,SAASxB,OAAO,IAAIyB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OAAO,IAAImD,UAAU,QAAQ,oCAAoC;AAC1E,SAASC,2BAA2B,QAAQ,2BAA2B;AACvE,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,iBAAiB,QAAQ,kBAAkB;AACpD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,oBAAoB,QAAQ,qBAAqB;AAG1D,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,uBAAuB;AAW/E,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,qBAAqB,EAAEC,oBAAoB,EAAEC,WAAW,QAAQ,oBAAoB;AAC7F,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,UAAU,QAAQ,oBAAoB","ignoreList":[]}
|
|
@@ -39,7 +39,7 @@ export const selectFiles = _ref => {
|
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
const fileArray = Object.values(files);
|
|
42
|
-
|
|
42
|
+
let filteredFileArray = fileArray.filter(file => {
|
|
43
43
|
const sizeInMB = file.size / 1024 / 1024;
|
|
44
44
|
if (maxFileSizeInMB && maxFileSizeInMB < sizeInMB) {
|
|
45
45
|
return false;
|
|
@@ -55,6 +55,9 @@ export const selectFiles = _ref => {
|
|
|
55
55
|
text: 'Einige Deiner ausgewählten Dateien sind zu groß.'
|
|
56
56
|
}).open();
|
|
57
57
|
}
|
|
58
|
+
if (typeof type === 'string') {
|
|
59
|
+
filteredFileArray = filterFilesByMimeType(filteredFileArray, type);
|
|
60
|
+
}
|
|
58
61
|
resolve(filteredFileArray);
|
|
59
62
|
};
|
|
60
63
|
const onCancel = () => {
|
|
@@ -71,6 +74,20 @@ export const selectFiles = _ref => {
|
|
|
71
74
|
input.click();
|
|
72
75
|
});
|
|
73
76
|
};
|
|
77
|
+
export const filterFilesByMimeType = (files, mimeTypes) => {
|
|
78
|
+
const allowedTypes = mimeTypes.split(',').map(type => type.trim());
|
|
79
|
+
const isAllowedType = fileType => allowedTypes.some(allowedType => {
|
|
80
|
+
if (allowedType.endsWith('/*')) {
|
|
81
|
+
const convertedAllowedType = allowedType.split('/*')[0];
|
|
82
|
+
if (!convertedAllowedType) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return fileType.startsWith(convertedAllowedType);
|
|
86
|
+
}
|
|
87
|
+
return fileType === allowedType;
|
|
88
|
+
});
|
|
89
|
+
return Array.from(files).filter(file => isAllowedType(file.type));
|
|
90
|
+
};
|
|
74
91
|
export const getFileAsArrayBuffer = file => new Promise((resolve, reject) => {
|
|
75
92
|
const reader = new FileReader();
|
|
76
93
|
reader.onload = e => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDialog.js","names":["createDialog","DialogType","selectFiles","_ref","type","multiple","maxFileSizeInMB","Promise","resolve","reject","input","document","createElement","style","visibility","width","height","display","accept","body","appendChild","abortController","AbortController","signal","onChange","event","removeChild","abort","target","files","fileArray","Object","values","filteredFileArray","filter","file","sizeInMB","size","includes","length","ALERT","text","open","onCancel","Error","addEventListener","click","getFileAsArrayBuffer","reader","FileReader","onload","e","result","onerror","readAsArrayBuffer"],"sources":["../../../src/utils/fileDialog.ts"],"sourcesContent":["import { createDialog, DialogType } from 'chayns-api';\n\ninterface SelectFilesOptions {\n type?: string;\n multiple: boolean;\n maxFileSizeInMB?: number;\n}\n\nexport const selectFiles = ({\n
|
|
1
|
+
{"version":3,"file":"fileDialog.js","names":["createDialog","DialogType","selectFiles","_ref","type","multiple","maxFileSizeInMB","Promise","resolve","reject","input","document","createElement","style","visibility","width","height","display","accept","body","appendChild","abortController","AbortController","signal","onChange","event","removeChild","abort","target","files","fileArray","Object","values","filteredFileArray","filter","file","sizeInMB","size","includes","length","ALERT","text","open","filterFilesByMimeType","onCancel","Error","addEventListener","click","mimeTypes","allowedTypes","split","map","trim","isAllowedType","fileType","some","allowedType","endsWith","convertedAllowedType","startsWith","Array","from","getFileAsArrayBuffer","reader","FileReader","onload","e","result","onerror","readAsArrayBuffer"],"sources":["../../../src/utils/fileDialog.ts"],"sourcesContent":["import { createDialog, DialogType } from 'chayns-api';\n\ninterface SelectFilesOptions {\n type?: string;\n multiple: boolean;\n maxFileSizeInMB?: number;\n}\n\nexport const selectFiles = ({\n type,\n multiple,\n maxFileSizeInMB,\n}: SelectFilesOptions): Promise<File[]> =>\n new Promise((resolve, reject) => {\n const input = document.createElement('input');\n\n input.type = 'file';\n input.style.visibility = 'none';\n input.style.width = '0';\n input.style.height = '0';\n input.style.display = 'none';\n\n if (type !== '*/*' && type) {\n input.accept = type;\n }\n\n if (multiple) {\n input.multiple = true;\n }\n\n document.body.appendChild(input);\n\n const abortController = new AbortController();\n const { signal } = abortController;\n\n const onChange = (event: Event) => {\n document.body.removeChild(input);\n abortController.abort();\n\n if (!event.target) {\n resolve([]);\n return;\n }\n\n const target = event.target as HTMLInputElement;\n const { files } = target;\n\n if (!files) {\n resolve([]);\n return;\n }\n\n const fileArray = Object.values(files);\n\n let filteredFileArray = fileArray.filter((file) => {\n const sizeInMB = file.size / 1024 / 1024;\n\n if (maxFileSizeInMB && maxFileSizeInMB < sizeInMB) {\n return false;\n }\n\n if (file.type.includes('video/') && sizeInMB > 500) {\n return false;\n }\n\n return !(file.type.includes('image/') && sizeInMB > 64);\n });\n\n if (fileArray.length !== filteredFileArray.length) {\n void createDialog({\n type: DialogType.ALERT,\n text: 'Einige Deiner ausgewählten Dateien sind zu groß.',\n }).open();\n }\n\n if (typeof type === 'string') {\n filteredFileArray = filterFilesByMimeType(filteredFileArray, type);\n }\n\n resolve(filteredFileArray);\n };\n\n const onCancel = () => {\n document.body.removeChild(input);\n abortController.abort();\n reject(new Error('File selection was cancelled.'));\n };\n\n input.addEventListener('change', onChange, { signal });\n input.addEventListener('focusout', onCancel, { signal });\n\n input.click();\n });\n\nexport const filterFilesByMimeType = (files: FileList | File[], mimeTypes: string): File[] => {\n const allowedTypes = mimeTypes.split(',').map((type) => type.trim());\n\n const isAllowedType = (fileType: string) =>\n allowedTypes.some((allowedType) => {\n if (allowedType.endsWith('/*')) {\n const convertedAllowedType = allowedType.split('/*')[0];\n\n if (!convertedAllowedType) {\n return false;\n }\n\n return fileType.startsWith(convertedAllowedType);\n }\n\n return fileType === allowedType;\n });\n\n return Array.from(files).filter((file) => isAllowedType(file.type));\n};\n\nexport const getFileAsArrayBuffer = (file: File): Promise<string | ArrayBuffer> =>\n new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = (e) => {\n if (e.target?.result) {\n resolve(e.target.result);\n } else {\n reject(Error('Could not get array buffer.'));\n }\n };\n\n reader.onerror = reject;\n\n reader.readAsArrayBuffer(file);\n });\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,UAAU,QAAQ,YAAY;AAQrD,OAAO,MAAMC,WAAW,GAAGC,IAAA;EAAA,IAAC;IACxBC,IAAI;IACJC,QAAQ;IACRC;EACgB,CAAC,GAAAH,IAAA;EAAA,OACjB,IAAII,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC7B,MAAMC,KAAK,GAAGC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;IAE7CF,KAAK,CAACN,IAAI,GAAG,MAAM;IACnBM,KAAK,CAACG,KAAK,CAACC,UAAU,GAAG,MAAM;IAC/BJ,KAAK,CAACG,KAAK,CAACE,KAAK,GAAG,GAAG;IACvBL,KAAK,CAACG,KAAK,CAACG,MAAM,GAAG,GAAG;IACxBN,KAAK,CAACG,KAAK,CAACI,OAAO,GAAG,MAAM;IAE5B,IAAIb,IAAI,KAAK,KAAK,IAAIA,IAAI,EAAE;MACxBM,KAAK,CAACQ,MAAM,GAAGd,IAAI;IACvB;IAEA,IAAIC,QAAQ,EAAE;MACVK,KAAK,CAACL,QAAQ,GAAG,IAAI;IACzB;IAEAM,QAAQ,CAACQ,IAAI,CAACC,WAAW,CAACV,KAAK,CAAC;IAEhC,MAAMW,eAAe,GAAG,IAAIC,eAAe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AAKkB,aAAa,CAAClB,IAAI,CAAC/B,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,OAAO,MAAM0D,oBAAoB,GAAI3B,IAAU,IAC3C,IAAI5B,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;EAC7B,MAAMsD,MAAM,GAAG,IAAIC,UAAU,CAAC,CAAC;EAE/BD,MAAM,CAACE,MAAM,GAAIC,CAAC,IAAK;IACnB,IAAIA,CAAC,CAACtC,MAAM,EAAEuC,MAAM,EAAE;MAClB3D,OAAO,CAAC0D,CAAC,CAACtC,MAAM,CAACuC,MAAM,CAAC;IAC5B,CAAC,MAAM;MACH1D,MAAM,CAACoC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAChD;EACJ,CAAC;EAEDkB,MAAM,CAACK,OAAO,GAAG3D,MAAM;EAEvBsD,MAAM,CAACM,iBAAiB,CAAClC,IAAI,CAAC;AAClC,CAAC,CAAC","ignoreList":[]}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export type { SelectButtonItem } from './types/selectButton';
|
|
|
66
66
|
export type { SliderButtonItem } from './types/slider-button';
|
|
67
67
|
export { ClampPosition } from './types/truncation';
|
|
68
68
|
export { getIsTouch } from './utils/environment';
|
|
69
|
-
export { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';
|
|
69
|
+
export { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';
|
|
70
70
|
export { isTobitEmployee } from './utils/isTobitEmployee';
|
|
71
71
|
export { getUsableHeight } from './utils/pageProvider';
|
|
72
72
|
export { uploadFile } from './utils/uploadFile';
|
|
@@ -4,5 +4,6 @@ interface SelectFilesOptions {
|
|
|
4
4
|
maxFileSizeInMB?: number;
|
|
5
5
|
}
|
|
6
6
|
export declare const selectFiles: ({ type, multiple, maxFileSizeInMB, }: SelectFilesOptions) => Promise<File[]>;
|
|
7
|
+
export declare const filterFilesByMimeType: (files: FileList | File[], mimeTypes: string) => File[];
|
|
7
8
|
export declare const getFileAsArrayBuffer: (file: File) => Promise<string | ArrayBuffer>;
|
|
8
9
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.966",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "2b32ad8a854ad4a8a0848837eca352936d26b924"
|
|
91
91
|
}
|