diff --git a/src/utils/functions/index.ts b/src/utils/functions/index.ts index eaa20d8..69fcf3c 100644 --- a/src/utils/functions/index.ts +++ b/src/utils/functions/index.ts @@ -3,6 +3,8 @@ export * from './arrayOrDefault' export * from './datetime' export type { RawDate, TimezoneId, timeInS } from './datetime' +export * from './chart' + export * from './min_max_filter' export type { KeyType } from './min_max_filter' @@ -21,5 +23,7 @@ export type { StorageNames, DataDashboardNNB } from './storage' export * from './string' +export * from './svg' + export * from './table_settings' export type { TableColumnSettings, TableSettings, TableSettingsStore } from './table_settings' diff --git a/src/utils/functions/svg.ts b/src/utils/functions/svg.ts new file mode 100644 index 0000000..7ec6902 --- /dev/null +++ b/src/utils/functions/svg.ts @@ -0,0 +1,18 @@ + +export const svgToDataURL = (svg: SVGSVGElement) => { + const serializer = new XMLSerializer() + let source = serializer.serializeToString(svg) + + if(!source.match(/^]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/)) + source = source.replace(/^]+"http\:\/\/www\.w3\.org\/1999\/xlink"/)) + source = source.replace(/^\r\n' + + encodeURIComponent(source) + + return source +}