bmdl-sdk 1.5.9 → 2.0.1
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/.prettierrc +37 -0
- package/bin/dev.js +10 -8
- package/bin/init.js +2 -1
- package/bmdl-sdk-2.0.1.tgz +0 -0
- package/global.d.ts +9 -0
- package/next.config.ts +35 -0
- package/package.json +35 -8
- package/postcss.config.mjs +5 -0
- package/public/favicon.ico +0 -0
- package/public/images/bg/404.bg.dark.png +0 -0
- package/public/images/bg/404.bg.png +0 -0
- package/public/images/bg/maintenance.bg.dark.png +0 -0
- package/public/images/bg/maintenance.bg.png +0 -0
- package/public/images/bg/not-authorized.bg.dark.png +0 -0
- package/public/images/bg/not-authorized.bg.png +0 -0
- package/public/images/bg/redirect.bg.dark.png +0 -0
- package/public/images/bg/redirect.bg.png +0 -0
- package/public/images/cover/email-verify.cover.dark.png +0 -0
- package/public/images/cover/email-verify.cover.png +0 -0
- package/public/images/cover/login.cover.dark.png +0 -0
- package/public/images/cover/login.cover.png +0 -0
- package/public/images/cover/password-forgot.cover.dark.png +0 -0
- package/public/images/cover/password-forgot.cover.png +0 -0
- package/public/images/cover/password-reset.cover.dark.png +0 -0
- package/public/images/cover/password-reset.cover.png +0 -0
- package/public/images/cover/register.cover.dark.png +0 -0
- package/public/images/cover/register.cover.png +0 -0
- package/public/images/cover/two-factor-verify.cover.dark.png +0 -0
- package/public/images/cover/two-factor-verify.cover.png +0 -0
- package/public/images/lang/en.png +0 -0
- package/public/images/lang/ru.png +0 -0
- package/public/locales/en/datasets.json +92 -0
- package/public/locales/en/errors.json +402 -0
- package/public/locales/en/general.json +139 -0
- package/public/locales/ru/datasets.json +92 -0
- package/public/locales/ru/errors.json +406 -0
- package/public/locales/ru/general.json +139 -0
- package/src/app/datasets/page.tsx +25 -0
- package/src/app/layout.tsx +45 -0
- package/src/app/not-found.tsx +34 -0
- package/src/app/page.tsx +24 -0
- package/src/components/atoms/Actions/Actions.styles.ts +31 -0
- package/src/components/atoms/Actions/Actions.tsx +45 -0
- package/src/components/atoms/Actions/index.ts +1 -0
- package/src/components/atoms/Avatar/Avatar.styles.ts +95 -0
- package/src/components/atoms/Avatar/Avatar.tsx +46 -0
- package/src/components/atoms/Avatar/index.ts +1 -0
- package/src/components/atoms/Badge/Badge.styles.ts +93 -0
- package/src/components/atoms/Badge/Badge.tsx +31 -0
- package/src/components/atoms/Badge/index.ts +1 -0
- package/src/components/atoms/Button/Button.styles.ts +189 -0
- package/src/components/atoms/Button/Button.tsx +29 -0
- package/src/components/atoms/Button/index.ts +1 -0
- package/src/components/atoms/Calendar/Calendar.styles.ts +227 -0
- package/src/components/atoms/Calendar/Calendar.tsx +96 -0
- package/src/components/atoms/Calendar/index.ts +1 -0
- package/src/components/atoms/Checkbox/Checkbox.styles.ts +37 -0
- package/src/components/atoms/Checkbox/Checkbox.tsx +26 -0
- package/src/components/atoms/Checkbox/index.ts +1 -0
- package/src/components/atoms/Date/Date.styles.ts +6 -0
- package/src/components/atoms/Date/Date.tsx +27 -0
- package/src/components/atoms/Date/index.ts +1 -0
- package/src/components/atoms/DatePicker/DatePicker.styles.ts +53 -0
- package/src/components/atoms/DatePicker/DatePicker.tsx +114 -0
- package/src/components/atoms/DatePicker/DatePicker.utils.tsx +49 -0
- package/src/components/atoms/DatePicker/index.ts +1 -0
- package/src/components/atoms/Dialog/Dialog.styles.ts +71 -0
- package/src/components/atoms/Dialog/Dialog.tsx +55 -0
- package/src/components/atoms/Dialog/index.ts +1 -0
- package/src/components/atoms/Dropdown/Divider/Divider.styles.ts +8 -0
- package/src/components/atoms/Dropdown/Divider/Divider.tsx +14 -0
- package/src/components/atoms/Dropdown/Divider/index.ts +1 -0
- package/src/components/atoms/Dropdown/Dropdown.styles.ts +31 -0
- package/src/components/atoms/Dropdown/Dropdown.tsx +48 -0
- package/src/components/atoms/Dropdown/Item/Item.styles.ts +12 -0
- package/src/components/atoms/Dropdown/Item/Item.tsx +18 -0
- package/src/components/atoms/Dropdown/Item/index.ts +1 -0
- package/src/components/atoms/Dropdown/index.ts +1 -0
- package/src/components/atoms/Form/Form.styles.ts +23 -0
- package/src/components/atoms/Form/Form.tsx +21 -0
- package/src/components/atoms/Form/Item/Item.styles.ts +23 -0
- package/src/components/atoms/Form/Item/Item.tsx +11 -0
- package/src/components/atoms/Form/Item/index.ts +1 -0
- package/src/components/atoms/Form/Label/Label.tsx +11 -0
- package/src/components/atoms/Form/Label/index.ts +1 -0
- package/src/components/atoms/Form/Message/Message.tsx +29 -0
- package/src/components/atoms/Form/Message/index.ts +1 -0
- package/src/components/atoms/Form/index.ts +1 -0
- package/src/components/atoms/Input/Email/Email.tsx +11 -0
- package/src/components/atoms/Input/Email/index.ts +1 -0
- package/src/components/atoms/Input/Input.styles.ts +77 -0
- package/src/components/atoms/Input/Input.tsx +29 -0
- package/src/components/atoms/Input/Number/Number.tsx +12 -0
- package/src/components/atoms/Input/Number/index.ts +1 -0
- package/src/components/atoms/Input/OTP/OTP.styles.ts +30 -0
- package/src/components/atoms/Input/OTP/OTP.tsx +23 -0
- package/src/components/atoms/Input/OTP/index.ts +1 -0
- package/src/components/atoms/Input/Password/Password.tsx +11 -0
- package/src/components/atoms/Input/Password/index.ts +1 -0
- package/src/components/atoms/Input/Search/Search.tsx +12 -0
- package/src/components/atoms/Input/Search/index.ts +1 -0
- package/src/components/atoms/Input/index.ts +1 -0
- package/src/components/atoms/Label/Label.styles.ts +29 -0
- package/src/components/atoms/Label/Label.tsx +18 -0
- package/src/components/atoms/Label/index.ts +1 -0
- package/src/components/atoms/Logo/Logo.styles.ts +16 -0
- package/src/components/atoms/Logo/Logo.tsx +20 -0
- package/src/components/atoms/Logo/index.ts +1 -0
- package/src/components/atoms/Pagination/Pagination.styles.ts +77 -0
- package/src/components/atoms/Pagination/Pagination.tsx +131 -0
- package/src/components/atoms/Pagination/index.ts +1 -0
- package/src/components/atoms/Popover/Popover.styles.ts +28 -0
- package/src/components/atoms/Popover/Popover.tsx +46 -0
- package/src/components/atoms/Popover/index.ts +1 -0
- package/src/components/atoms/Radio/Item/Item.styles.ts +35 -0
- package/src/components/atoms/Radio/Item/Item.tsx +18 -0
- package/src/components/atoms/Radio/Item/index.ts +1 -0
- package/src/components/atoms/Radio/Radio.styles.ts +25 -0
- package/src/components/atoms/Radio/Radio.tsx +21 -0
- package/src/components/atoms/Radio/index.ts +1 -0
- package/src/components/atoms/RangeNumber/RangeNumber.tsx +33 -0
- package/src/components/atoms/RangeNumber/index.ts +1 -0
- package/src/components/atoms/Select/Item/Item.styles.ts +22 -0
- package/src/components/atoms/Select/Item/Item.tsx +17 -0
- package/src/components/atoms/Select/Item/index.ts +1 -0
- package/src/components/atoms/Select/Select.styles.ts +149 -0
- package/src/components/atoms/Select/Select.tsx +68 -0
- package/src/components/atoms/Select/index.ts +1 -0
- package/src/components/atoms/Separator/Separator.styles.ts +13 -0
- package/src/components/atoms/Separator/Separator.tsx +20 -0
- package/src/components/atoms/Separator/index.ts +1 -0
- package/src/components/atoms/Sheet/Sheet.styles.ts +100 -0
- package/src/components/atoms/Sheet/Sheet.tsx +53 -0
- package/src/components/atoms/Sheet/index.ts +1 -0
- package/src/components/atoms/Skeleton/Skeleton.styles.ts +30 -0
- package/src/components/atoms/Skeleton/Skeleton.tsx +11 -0
- package/src/components/atoms/Skeleton/index.ts +1 -0
- package/src/components/atoms/Spin/Spin.styles.ts +17 -0
- package/src/components/atoms/Spin/Spin.tsx +19 -0
- package/src/components/atoms/Spin/index.ts +1 -0
- package/src/components/atoms/Switch/Switch.styles.ts +34 -0
- package/src/components/atoms/Switch/Switch.tsx +20 -0
- package/src/components/atoms/Switch/index.ts +1 -0
- package/src/components/atoms/Table/FilterContent/FilterContent.styles.ts +33 -0
- package/src/components/atoms/Table/FilterContent/FilterContent.tsx +300 -0
- package/src/components/atoms/Table/FilterContent/index.ts +1 -0
- package/src/components/atoms/Table/FilterIcon/FilterIcon.tsx +16 -0
- package/src/components/atoms/Table/FilterIcon/index.ts +1 -0
- package/src/components/atoms/Table/SortIcon/SortIcon.tsx +32 -0
- package/src/components/atoms/Table/SortIcon/index.ts +1 -0
- package/src/components/atoms/Table/Table.styles.ts +178 -0
- package/src/components/atoms/Table/Table.tsx +484 -0
- package/src/components/atoms/Table/Table.utils.tsx +19 -0
- package/src/components/atoms/Table/index.ts +1 -0
- package/src/components/atoms/Tabs/Tabs.tsx +15 -0
- package/src/components/atoms/Tabs/index.ts +1 -0
- package/src/components/atoms/Textarea/Textarea.styles.ts +64 -0
- package/src/components/atoms/Textarea/Textarea.tsx +15 -0
- package/src/components/atoms/Textarea/index.ts +1 -0
- package/src/components/atoms/Toast/Toast.styles.ts +35 -0
- package/src/components/atoms/Toast/Toast.tsx +85 -0
- package/src/components/atoms/Toast/Toast.utils.tsx +43 -0
- package/src/components/atoms/Toast/index.ts +1 -0
- package/src/components/atoms/Tooltip/Tooltip.styles.ts +33 -0
- package/src/components/atoms/Tooltip/Tooltip.tsx +32 -0
- package/src/components/atoms/Tooltip/index.ts +1 -0
- package/src/components/atoms/Typography/Display/Display.styles.ts +26 -0
- package/src/components/atoms/Typography/Display/Display.tsx +11 -0
- package/src/components/atoms/Typography/Display/index.ts +1 -0
- package/src/components/atoms/Typography/Link/Link.styles.ts +32 -0
- package/src/components/atoms/Typography/Link/Link.tsx +25 -0
- package/src/components/atoms/Typography/Link/index.ts +1 -0
- package/src/components/atoms/Typography/Paragraph/Paragraph.styles.ts +32 -0
- package/src/components/atoms/Typography/Paragraph/Paragraph.tsx +11 -0
- package/src/components/atoms/Typography/Paragraph/index.ts +1 -0
- package/src/components/atoms/Typography/Text/Text.styles.ts +39 -0
- package/src/components/atoms/Typography/Text/Text.tsx +25 -0
- package/src/components/atoms/Typography/Text/index.ts +1 -0
- package/src/components/atoms/Typography/Title/Title.styles.ts +28 -0
- package/src/components/atoms/Typography/Title/Title.tsx +15 -0
- package/src/components/atoms/Typography/Title/index.ts +1 -0
- package/src/components/atoms/Typography/Typography.tsx +21 -0
- package/src/components/atoms/Typography/index.ts +1 -0
- package/src/components/atoms/icons/AvanpostIcon.tsx +31 -0
- package/src/components/atoms/icons/CheckIcon.tsx +22 -0
- package/src/components/atoms/icons/EmptyIcon.tsx +56 -0
- package/src/components/atoms/icons/LogoIcon.tsx +141 -0
- package/src/components/atoms/icons/NumberTypeIcon.tsx +25 -0
- package/src/components/atoms/icons/SidebarCloseIcon.tsx +75 -0
- package/src/components/atoms/icons/index.ts +6 -0
- package/src/components/atoms/index.ts +31 -0
- package/src/components/molecules/DataTable/CreationModal/CreationModal.tsx +31 -0
- package/src/components/molecules/DataTable/CreationModal/index.ts +1 -0
- package/src/components/molecules/DataTable/DataTable.styles.ts +23 -0
- package/src/components/molecules/DataTable/DataTable.tsx +167 -0
- package/src/components/molecules/DataTable/Name/Name.tsx +20 -0
- package/src/components/molecules/DataTable/Name/index.ts +1 -0
- package/src/components/molecules/DataTable/Skeleton/Skeleton.tsx +27 -0
- package/src/components/molecules/DataTable/Skeleton/index.ts +6 -0
- package/src/components/molecules/DataTable/index.ts +8 -0
- package/src/components/molecules/Header/Button/Button.styles.ts +24 -0
- package/src/components/molecules/Header/Button/Button.tsx +20 -0
- package/src/components/molecules/Header/Button/index.ts +1 -0
- package/src/components/molecules/Header/Header.styles.ts +16 -0
- package/src/components/molecules/Header/Header.tsx +20 -0
- package/src/components/molecules/Header/Navigate/Navigate.tsx +40 -0
- package/src/components/molecules/Header/Navigate/index.ts +1 -0
- package/src/components/molecules/Header/SelectLang/SelectLang.tsx +47 -0
- package/src/components/molecules/Header/SelectLang/index.ts +2 -0
- package/src/components/molecules/Header/SelectTheme/SelectTheme.tsx +43 -0
- package/src/components/molecules/Header/SelectTheme/index.ts +1 -0
- package/src/components/molecules/Header/index.ts +2 -0
- package/src/components/molecules/ProjectIcon/ProjectIcon.styles.ts +23 -0
- package/src/components/molecules/ProjectIcon/ProjectIcon.tsx +37 -0
- package/src/components/molecules/ProjectIcon/index.ts +1 -0
- package/src/components/molecules/Sidebar/Item/Item.styles.ts +52 -0
- package/src/components/molecules/Sidebar/Item/Item.tsx +30 -0
- package/src/components/molecules/Sidebar/Item/index.ts +1 -0
- package/src/components/molecules/Sidebar/Sidebar.styles.ts +97 -0
- package/src/components/molecules/Sidebar/Sidebar.tsx +122 -0
- package/src/components/molecules/Sidebar/Sidebar.utils.tsx +36 -0
- package/src/components/molecules/Sidebar/Trigger/Trigger.tsx +23 -0
- package/src/components/molecules/Sidebar/Trigger/index.ts +1 -0
- package/src/components/molecules/Sidebar/index.ts +1 -0
- package/src/components/molecules/Widget/Content/Content.tsx +80 -0
- package/src/components/molecules/Widget/Content/index.ts +1 -0
- package/src/components/molecules/Widget/Toolbox/Toolbox.tsx +0 -0
- package/src/components/molecules/Widget/Toolbox/index.ts +0 -0
- package/src/components/molecules/Widget/Widget.tsx +26 -0
- package/src/components/molecules/Widget/Widget.utils.tsx +31 -0
- package/src/components/molecules/Widget/index.ts +2 -0
- package/src/components/molecules/index.ts +6 -0
- package/src/components/organisms/ComponentWidget/ComponentWidget.tsx +9 -0
- package/src/components/organisms/ComponentWidget/index.ts +2 -0
- package/src/components/organisms/DatasetsTable/Creation/Creation.tsx +105 -0
- package/src/components/organisms/DatasetsTable/Creation/Navigate/Navigate.tsx +59 -0
- package/src/components/organisms/DatasetsTable/Creation/Navigate/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Step/Step.styles.ts +12 -0
- package/src/components/organisms/DatasetsTable/Creation/Step/Step.tsx +43 -0
- package/src/components/organisms/DatasetsTable/Creation/Step/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step1/Step1.styles.ts +41 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step1/Step1.tsx +67 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step1/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/SelectSource/SelectSource.tsx +252 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/SelectSource/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/Step2.tsx +11 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/UploadFile/UploadFile.tsx +112 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/UploadFile/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step3/Step3.tsx +145 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step3/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step4/Step4.tsx +120 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step4/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/index.ts +4 -0
- package/src/components/organisms/DatasetsTable/Creation/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/DatasetsTable.tsx +81 -0
- package/src/components/organisms/DatasetsTable/DatasetsTable.utils.tsx +125 -0
- package/src/components/organisms/DatasetsTable/Source/Source.styles.ts +7 -0
- package/src/components/organisms/DatasetsTable/Source/Source.tsx +39 -0
- package/src/components/organisms/DatasetsTable/Source/Source.utils.tsx +45 -0
- package/src/components/organisms/DatasetsTable/Source/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Status/Status.styles.ts +25 -0
- package/src/components/organisms/DatasetsTable/Status/Status.tsx +29 -0
- package/src/components/organisms/DatasetsTable/Status/Status.utils.tsx +29 -0
- package/src/components/organisms/DatasetsTable/Status/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Type/Type.styles.ts +7 -0
- package/src/components/organisms/DatasetsTable/Type/Type.tsx +32 -0
- package/src/components/organisms/DatasetsTable/Type/Type.utils.tsx +14 -0
- package/src/components/organisms/DatasetsTable/Type/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/index.ts +1 -0
- package/src/components/organisms/index.ts +3 -0
- package/src/components/templates/DefaultLayout/DefaultLayout.styles.ts +26 -0
- package/src/components/templates/DefaultLayout/DefaultLayout.tsx +41 -0
- package/src/components/templates/DefaultLayout/index.ts +1 -0
- package/src/components/templates/PageLayout/PageLayout.styles.ts +25 -0
- package/src/components/templates/PageLayout/PageLayout.tsx +28 -0
- package/src/components/templates/PageLayout/index.ts +1 -0
- package/src/components/templates/index.ts +3 -0
- package/src/config/i18n.config.ts +46 -0
- package/src/constants/index.ts +10 -0
- package/src/contexts/CreateComponentContext/CreateComponentContext.tsx +17 -0
- package/src/contexts/CreateComponentContext/index.ts +4 -0
- package/src/contexts/CreateDatasetContext/CreateDatasetContext.tsx +25 -0
- package/src/contexts/CreateDatasetContext/index.ts +4 -0
- package/src/contexts/ProjectContext/ProjectContext.tsx +32 -0
- package/src/contexts/ProjectContext/index.ts +1 -0
- package/src/contexts/SidebarContext/SidebarContext.tsx +10 -0
- package/src/contexts/SidebarContext/index.ts +1 -0
- package/src/contexts/index.ts +10 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useCreateComponent.ts +15 -0
- package/src/hooks/useCreateDataset.ts +15 -0
- package/src/hooks/useDebounce.ts +17 -0
- package/src/hooks/useDebounced.ts +31 -0
- package/src/hooks/useIsMobile.ts +27 -0
- package/src/hooks/useSidebar.ts +15 -0
- package/src/hooks/useStickyHeader.ts +35 -0
- package/src/hooks/useWindowSize.ts +27 -0
- package/src/providers/CreateComponentProvider/CreateComponentProvider.tsx +53 -0
- package/src/providers/CreateComponentProvider/index.ts +1 -0
- package/src/providers/CreateDatasetProvider/CreateDatasetProvider.tsx +73 -0
- package/src/providers/CreateDatasetProvider/index.ts +1 -0
- package/src/providers/LangProvider/LangProvider.tsx +15 -0
- package/src/providers/LangProvider/index.ts +1 -0
- package/src/providers/ProjectProvider/ProjectProvider.tsx +110 -0
- package/src/providers/ProjectProvider/index.ts +1 -0
- package/src/providers/SidebarProvider/SidebarProvider.tsx +51 -0
- package/src/providers/SidebarProvider/index.ts +1 -0
- package/src/providers/ThemeProvider/ThemeProvider.tsx +20 -0
- package/src/providers/ThemeProvider/index.ts +1 -0
- package/src/providers/index.ts +6 -0
- package/src/store/index.ts +2 -0
- package/src/store/sidebar/sidebar.store.ts +17 -0
- package/src/store/sidebar/sidebar.type.ts +4 -0
- package/src/styles/globals.css +202 -0
- package/src/types/component.type.ts +13 -0
- package/src/types/dataset.type.ts +25 -0
- package/src/types/file.type.ts +13 -0
- package/src/types/general.type.ts +86 -0
- package/src/types/index.ts +9 -0
- package/src/types/layer.type.ts +7 -0
- package/src/types/project.type.ts +15 -0
- package/src/types/user.type.ts +6 -0
- package/src/types/widget.type.ts +12 -0
- package/src/utils/bm.util.ts +150 -0
- package/src/utils/bytes.util.ts +110 -0
- package/src/utils/date.util.ts +49 -0
- package/src/utils/dynamicMessage.util.ts +9 -0
- package/src/utils/getInitials.util.ts +10 -0
- package/src/utils/hideEmail.util.ts +14 -0
- package/src/utils/index.ts +12 -0
- package/src/utils/pagination.util.ts +144 -0
- package/src/utils/twJoin.util.ts +49 -0
- package/src/utils/twMerge.util.ts +6 -0
- package/src/utils/upload.util.ts +26 -0
- package/src/utils/url.util.ts +29 -0
- package/tsconfig.json +40 -6
- package/bmdl-sdk-1.5.9.tgz +0 -0
- package/index.html +0 -12
- package/src/App.tsx +0 -187
- package/src/main.tsx +0 -15
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TranslateFn } from '@/types'
|
|
2
|
+
|
|
3
|
+
export function getAcceptedTypesText(
|
|
4
|
+
acceptedTypes = '*',
|
|
5
|
+
t: TranslateFn
|
|
6
|
+
): string {
|
|
7
|
+
if (acceptedTypes === '*') return t('types.all')
|
|
8
|
+
|
|
9
|
+
const types = acceptedTypes.split(',').map(type => {
|
|
10
|
+
if (type.startsWith('.')) return type
|
|
11
|
+
if (type.endsWith('/*')) return type.replace('/*', ` ${t('files')}`)
|
|
12
|
+
return type
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
return types.join(', ').replace(/\./g, '')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
////////////
|
|
19
|
+
|
|
20
|
+
export function formatFileSize(bytes: number, t: TranslateFn): string {
|
|
21
|
+
if (bytes === 0) return `0 ${t('bytes')}`
|
|
22
|
+
const k = 1024
|
|
23
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB']
|
|
24
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
|
25
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime'
|
|
2
|
+
|
|
3
|
+
export function getParam(key: string) {
|
|
4
|
+
const url = new URL(window.location.href)
|
|
5
|
+
return url.searchParams.get(key)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function getParams() {
|
|
9
|
+
const url = new URL(window.location.href)
|
|
10
|
+
const params: Record<string, any> = {
|
|
11
|
+
length: url.searchParams.size
|
|
12
|
+
}
|
|
13
|
+
url.searchParams.forEach((value, key) => {
|
|
14
|
+
params[key] = value
|
|
15
|
+
})
|
|
16
|
+
return params
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function addParam(router: AppRouterInstance, key: string, value: any) {
|
|
20
|
+
const url = new URL(window.location.href)
|
|
21
|
+
url.searchParams.set(key, value)
|
|
22
|
+
router.push(url.toString())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function removeParam(router: AppRouterInstance, key: string) {
|
|
26
|
+
const url = new URL(window.location.href)
|
|
27
|
+
url.searchParams.delete(key)
|
|
28
|
+
router.push(url.toString())
|
|
29
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2021",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"module": "esnext",
|
|
15
|
+
"moduleResolution": "bundler",
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"isolatedModules": true,
|
|
18
|
+
"jsx": "react-jsx",
|
|
19
|
+
"incremental": true,
|
|
20
|
+
"plugins": [
|
|
21
|
+
{
|
|
22
|
+
"name": "next"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"paths": {
|
|
26
|
+
"@/*": [
|
|
27
|
+
"./src/*"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"include": [
|
|
32
|
+
"next-env.d.ts",
|
|
33
|
+
"**/*.ts",
|
|
34
|
+
"**/*.tsx",
|
|
35
|
+
".next/types/**/*.ts",
|
|
36
|
+
".next/dev/types/**/*.ts"
|
|
37
|
+
],
|
|
38
|
+
"exclude": [
|
|
39
|
+
"node_modules"
|
|
40
|
+
]
|
|
7
41
|
}
|
package/bmdl-sdk-1.5.9.tgz
DELETED
|
Binary file
|
package/index.html
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>BMDL SDK</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<div id="root"></div>
|
|
10
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
-
</body>
|
|
12
|
-
</html>
|
package/src/App.tsx
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { ComponentProps } from '..'
|
|
3
|
-
|
|
4
|
-
// Интерфейс для динамического импорта виджета
|
|
5
|
-
interface WidgetModule {
|
|
6
|
-
default: React.ComponentType<ComponentProps>
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const App: React.FC = () => {
|
|
10
|
-
const [WidgetComponent, setWidgetComponent] =
|
|
11
|
-
useState<React.ComponentType<ComponentProps> | null>(null)
|
|
12
|
-
const [dataOptions, setDataOptions] = useState<any>(null)
|
|
13
|
-
const [viewOptions, setViewOptions] = useState<any>(null)
|
|
14
|
-
const [loading, setLoading] = useState(true)
|
|
15
|
-
const [error, setError] = useState<string | null>(null)
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
// Загружаем компонент виджета из проекта
|
|
19
|
-
const loadWidget = async () => {
|
|
20
|
-
try {
|
|
21
|
-
// Динамически импортируем компонент из проекта разработчика
|
|
22
|
-
const widgetModule = (await import('@project/app/App.tsx')) as WidgetModule
|
|
23
|
-
const dataOptionsModule = await import('@project/dataOptions.ts')
|
|
24
|
-
const viewOptionsModule = await import('@project/viewOptions.ts')
|
|
25
|
-
|
|
26
|
-
setWidgetComponent(() => widgetModule.default)
|
|
27
|
-
setDataOptions(dataOptionsModule.createDataOptions())
|
|
28
|
-
setViewOptions(viewOptionsModule.createViewOptions())
|
|
29
|
-
setLoading(false)
|
|
30
|
-
} catch (err) {
|
|
31
|
-
console.error('Failed to load widget:', err)
|
|
32
|
-
setError('Failed to load widget component. Please check your files.')
|
|
33
|
-
setLoading(false)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
loadWidget()
|
|
38
|
-
}, [])
|
|
39
|
-
|
|
40
|
-
if (loading) {
|
|
41
|
-
return (
|
|
42
|
-
<div
|
|
43
|
-
style={{
|
|
44
|
-
display: 'flex',
|
|
45
|
-
justifyContent: 'center',
|
|
46
|
-
alignItems: 'center',
|
|
47
|
-
height: '100vh',
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
<h2>Loading widget...</h2>
|
|
51
|
-
</div>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (error) {
|
|
56
|
-
return (
|
|
57
|
-
<div
|
|
58
|
-
style={{
|
|
59
|
-
display: 'flex',
|
|
60
|
-
justifyContent: 'center',
|
|
61
|
-
alignItems: 'center',
|
|
62
|
-
height: '100vh',
|
|
63
|
-
flexDirection: 'column',
|
|
64
|
-
}}
|
|
65
|
-
>
|
|
66
|
-
<h2 style={{ color: 'red' }}>Error</h2>
|
|
67
|
-
<p>{error}</p>
|
|
68
|
-
<p style={{ fontSize: '14px', color: '#666' }}>
|
|
69
|
-
Make sure you have src/App/App.tsx, src/config.ts, src/dataOptions.ts,
|
|
70
|
-
src/viewOptions.ts
|
|
71
|
-
</p>
|
|
72
|
-
</div>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (!WidgetComponent) {
|
|
77
|
-
return null
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<div
|
|
82
|
-
style={{
|
|
83
|
-
display: 'flex',
|
|
84
|
-
height: '100vh',
|
|
85
|
-
fontFamily: 'Arial, sans-serif',
|
|
86
|
-
}}
|
|
87
|
-
>
|
|
88
|
-
{/* Левая половина - информация SDK */}
|
|
89
|
-
<div
|
|
90
|
-
style={{
|
|
91
|
-
flex: 1,
|
|
92
|
-
padding: '20px',
|
|
93
|
-
backgroundColor: '#f0f4f8',
|
|
94
|
-
borderRight: '2px solid #ddd',
|
|
95
|
-
overflow: 'auto',
|
|
96
|
-
}}
|
|
97
|
-
>
|
|
98
|
-
<h2 style={{ marginTop: 0 }}>🔧 BMDL SDK Preview</h2>
|
|
99
|
-
<div
|
|
100
|
-
style={{
|
|
101
|
-
backgroundColor: 'white',
|
|
102
|
-
padding: '15px',
|
|
103
|
-
borderRadius: '8px',
|
|
104
|
-
marginBottom: '15px',
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<h4>📊 Widget Info</h4>
|
|
108
|
-
<div id='widget-info'>
|
|
109
|
-
{/* Информация будет добавлена из config.ts */}
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
<div
|
|
113
|
-
style={{
|
|
114
|
-
backgroundColor: 'white',
|
|
115
|
-
padding: '15px',
|
|
116
|
-
borderRadius: '8px',
|
|
117
|
-
}}
|
|
118
|
-
>
|
|
119
|
-
<h4>📦 Data Options</h4>
|
|
120
|
-
<pre
|
|
121
|
-
style={{
|
|
122
|
-
background: '#f5f5f5',
|
|
123
|
-
padding: '10px',
|
|
124
|
-
borderRadius: '4px',
|
|
125
|
-
fontSize: '12px',
|
|
126
|
-
}}
|
|
127
|
-
>
|
|
128
|
-
{JSON.stringify(dataOptions, null, 2)}
|
|
129
|
-
</pre>
|
|
130
|
-
</div>
|
|
131
|
-
<div
|
|
132
|
-
style={{
|
|
133
|
-
backgroundColor: 'white',
|
|
134
|
-
padding: '15px',
|
|
135
|
-
borderRadius: '8px',
|
|
136
|
-
marginTop: '15px',
|
|
137
|
-
}}
|
|
138
|
-
>
|
|
139
|
-
<h4>⚙️ View Options</h4>
|
|
140
|
-
<pre
|
|
141
|
-
style={{
|
|
142
|
-
background: '#f5f5f5',
|
|
143
|
-
padding: '10px',
|
|
144
|
-
borderRadius: '4px',
|
|
145
|
-
fontSize: '12px',
|
|
146
|
-
}}
|
|
147
|
-
>
|
|
148
|
-
{JSON.stringify(viewOptions, null, 2)}
|
|
149
|
-
</pre>
|
|
150
|
-
</div>
|
|
151
|
-
<div style={{ marginTop: '20px', fontSize: '12px', color: '#666' }}>
|
|
152
|
-
<p>
|
|
153
|
-
💡 Edit src/App/App.tsx, src/dataOptions.ts, or src/viewOptions.ts
|
|
154
|
-
to see changes
|
|
155
|
-
</p>
|
|
156
|
-
</div>
|
|
157
|
-
</div>
|
|
158
|
-
|
|
159
|
-
{/* Правая половина - виджет разработчика */}
|
|
160
|
-
<div
|
|
161
|
-
style={{
|
|
162
|
-
flex: 1,
|
|
163
|
-
padding: '20px',
|
|
164
|
-
backgroundColor: '#ffffff',
|
|
165
|
-
overflow: 'auto',
|
|
166
|
-
}}
|
|
167
|
-
>
|
|
168
|
-
<h3 style={{ marginTop: 0 }}>📱 Your Widget</h3>
|
|
169
|
-
<div
|
|
170
|
-
style={{
|
|
171
|
-
border: '2px dashed #ccc',
|
|
172
|
-
borderRadius: '8px',
|
|
173
|
-
padding: '20px',
|
|
174
|
-
minHeight: '400px',
|
|
175
|
-
}}
|
|
176
|
-
>
|
|
177
|
-
<WidgetComponent
|
|
178
|
-
dataOptions={dataOptions}
|
|
179
|
-
viewOptions={viewOptions}
|
|
180
|
-
/>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
)
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export default App
|
package/src/main.tsx
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import ReactDOM from 'react-dom/client'
|
|
3
|
-
import App from './App'
|
|
4
|
-
|
|
5
|
-
console.log('🚀 BMDL SDK Starting...')
|
|
6
|
-
|
|
7
|
-
const rootElement = document.getElementById('root')
|
|
8
|
-
if (rootElement) {
|
|
9
|
-
const root = ReactDOM.createRoot(rootElement)
|
|
10
|
-
root.render(
|
|
11
|
-
<React.StrictMode>
|
|
12
|
-
<App />
|
|
13
|
-
</React.StrictMode>,
|
|
14
|
-
)
|
|
15
|
-
}
|