@pisell/materials 1.0.446 → 1.0.447
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +7 -7
- package/es/components/browserSelect/chevron-down.png +0 -0
- package/es/components/browserSelect/index.d.ts +15 -0
- package/es/components/browserSelect/index.js +36 -0
- package/es/components/browserSelect/index.less +18 -0
- package/es/components/button/index.js +2 -0
- package/es/components/buttonGroupEdit/index.d.ts +8 -0
- package/es/components/buttonGroupEdit/index.js +411 -0
- package/es/components/buttonGroupPreview/index.d.ts +20 -0
- package/es/components/buttonGroupPreview/index.js +81 -0
- package/es/components/cardPro/index.d.ts +4 -0
- package/es/components/cardPro/index.js +66 -0
- package/es/components/cardPro/index.less +58 -0
- package/es/components/collapse/index.d.ts +6 -0
- package/es/components/collapse/index.js +66 -0
- package/es/components/collapse/index.less +1 -0
- package/es/components/date-picker/constants.d.ts +39 -0
- package/es/components/date-picker/constants.js +76 -0
- package/es/components/date-picker/datePickerCpt.d.ts +8 -0
- package/es/components/date-picker/datePickerCpt.js +370 -0
- package/es/components/date-picker/hooks/useMediaQuery.d.ts +2 -0
- package/es/components/date-picker/hooks/useMediaQuery.js +28 -0
- package/es/components/date-picker/index.js +2 -2
- package/es/components/date-picker/index.less +1880 -0
- package/es/components/drag-sort-tree/index.d.ts +0 -1
- package/es/components/drag-sort-tree/index.js +2 -1
- package/es/components/iconfont/index.js +1 -1
- package/es/components/picker-view/index.d.ts +2 -0
- package/es/components/picker-view/index.js +2 -0
- package/es/components/pisellAnchor/index.d.ts +15 -0
- package/es/components/pisellAnchor/index.js +114 -0
- package/es/components/pisellAnchor/index.less +98 -0
- package/es/components/pisellInformationEntry/Input/index.js +9 -3
- package/es/components/pisellInformationEntry/constants.d.ts +10 -0
- package/es/components/pisellInformationEntry/constants.js +10 -0
- package/es/components/pisellInformationEntry/hooks/useTerminalPeripherals.d.ts +8 -0
- package/es/components/pisellInformationEntry/hooks/useTerminalPeripherals.js +54 -0
- package/es/components/pisellInformationEntry/index.js +21 -4
- package/es/components/pisellInformationEntry/index.less +1 -1
- package/es/components/pisellLoading/index.d.ts +2 -0
- package/es/components/pisellLoading/index.js +3 -1
- package/es/components/pisellQrcode/index.d.ts +4 -0
- package/es/components/pisellQrcode/index.js +75 -0
- package/es/components/pisellQrcode/index.less +41 -0
- package/es/components/pisellStatistic/index.d.ts +10 -0
- package/es/components/pisellStatistic/index.js +26 -0
- package/es/components/pisellStatistic/index.less +14 -0
- package/es/components/pisellTags/index.d.ts +13 -0
- package/es/components/pisellTags/index.js +83 -0
- package/es/components/pisellTags/index.less +17 -0
- package/es/components/pisellTags/utils.d.ts +1 -0
- package/es/components/pisellTags/utils.js +89 -0
- package/es/components/pisellUpload/index.d.ts +11 -0
- package/es/components/pisellUpload/index.js +34 -0
- package/es/components/pisellUpload/index.less +15 -0
- package/es/components/pisellUploadCrop/index.d.ts +3 -0
- package/es/components/pisellUploadCrop/index.js +73 -0
- package/es/components/pisellUploadCrop/index.less +15 -0
- package/es/components/pisellWalletCard/img/drak.png +0 -0
- package/es/components/pisellWalletCard/img/light.png +0 -0
- package/es/components/pisellWalletCard/index.d.ts +4 -0
- package/es/components/pisellWalletCard/index.js +122 -0
- package/es/components/pisellWalletCard/index.less +96 -0
- package/es/components/pisellWalletPassCard/index.d.ts +2 -0
- package/es/components/pisellWalletPassCard/index.js +16 -4
- package/es/components/pisellWalletPassCard/index.less +3 -0
- package/es/components/productCard/components/Actions/index.d.ts +4 -0
- package/es/components/productCard/components/Actions/index.js +20 -0
- package/es/components/productCard/components/Actions/index.less +14 -0
- package/es/components/productCard/components/AmountFooter/index.d.ts +4 -0
- package/es/components/productCard/components/AmountFooter/index.js +32 -0
- package/es/components/productCard/components/AmountFooter/index.less +30 -0
- package/es/components/productCard/components/Divider/index.d.ts +4 -0
- package/es/components/productCard/components/Divider/index.js +11 -0
- package/es/components/productCard/components/Divider/index.less +13 -0
- package/es/components/productCard/components/Header/index.d.ts +4 -0
- package/es/components/productCard/components/Header/index.js +69 -0
- package/es/components/productCard/components/Header/index.less +59 -0
- package/es/components/productCard/components/Holder/index.d.ts +4 -0
- package/es/components/productCard/components/Holder/index.js +11 -0
- package/es/components/productCard/components/Holder/index.less +11 -0
- package/es/components/productCard/components/Note/index.d.ts +4 -0
- package/es/components/productCard/components/Note/index.js +17 -0
- package/es/components/productCard/components/Note/index.less +20 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/index.d.ts +10 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/index.js +96 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/index.less +53 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +2 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.js +31 -0
- package/es/components/productCard/components/Packages/components/options/index.d.ts +4 -0
- package/es/components/productCard/components/Packages/components/options/index.js +23 -0
- package/es/components/productCard/components/Packages/components/options/index.less +28 -0
- package/es/components/productCard/components/Packages/index.d.ts +4 -0
- package/es/components/productCard/components/Packages/index.js +22 -0
- package/es/components/productCard/components/Packages/index.less +17 -0
- package/es/components/productCard/components/Packages/utils.d.ts +20 -0
- package/es/components/productCard/components/Packages/utils.js +40 -0
- package/es/components/productCard/components/Sales/index.d.ts +4 -0
- package/es/components/productCard/components/Sales/index.js +22 -0
- package/es/components/productCard/components/Sales/index.less +18 -0
- package/es/components/productCard/components/Time/components/Like/index.d.ts +9 -0
- package/es/components/productCard/components/Time/components/Like/index.js +26 -0
- package/es/components/productCard/components/Time/components/Like/index.less +6 -0
- package/es/components/productCard/components/Time/components/Like/like-heart.png +0 -0
- package/es/components/productCard/components/Time/components/Like/like-hide-heart.png +0 -0
- package/es/components/productCard/components/Time/index.d.ts +4 -0
- package/es/components/productCard/components/Time/index.js +30 -0
- package/es/components/productCard/components/Time/index.less +25 -0
- package/es/components/productCard/index.d.ts +5 -0
- package/es/components/productCard/index.js +80 -0
- package/es/components/productCard/index.less +48 -0
- package/es/components/productCard/types.d.ts +10 -0
- package/es/components/productCard/types.js +1 -0
- package/es/components/productCard/utils.d.ts +162 -0
- package/es/components/productCard/utils.js +683 -0
- package/es/components/record-view/index.d.ts +3 -3
- package/es/components/record-view/index.js +23 -16
- package/es/components/section-footers/index.d.ts +8 -0
- package/es/components/section-footers/index.js +16 -0
- package/es/components/select-time/RightPanel/index.d.ts +2 -2
- package/es/components/select-time/RightPanel/index.js +7 -7
- package/es/components/table/Actions/component/ExportImport/index.js +3 -3
- package/es/components/table/BasicTable/index.js +7 -1
- package/es/components/table/Gallery/components/GalleryItem/components/Title/index.less +1 -1
- package/es/components/table/Gallery/components/GalleryItem/index.js +10 -3
- package/es/components/table/Gallery/components/GalleryItem/index.less +1 -0
- package/es/components/table/Gallery/index.js +14 -4
- package/es/components/table/Table/index.js +2 -1
- package/es/components/table/Table/utils.d.ts +15 -3
- package/es/components/table/Table/utils.js +6 -2
- package/es/components/table/hooks/useTableSetting.js +26 -5
- package/es/components/table/hooks/useTransDataSource.d.ts +1 -0
- package/es/components/table/hooks/useTransDataSource.js +6 -4
- package/es/components/table/types.d.ts +2 -0
- package/es/components/tabs/index.d.ts +1 -0
- package/es/components/tabs/index.js +33 -11
- package/es/components/virtual-keyboard/Keyboard/index.d.ts +1 -0
- package/es/components/virtual-keyboard/Keyboard/index.js +10 -2
- package/es/index.d.ts +18 -4
- package/es/index.js +20 -3
- package/es/locales/en-US.d.ts +14 -0
- package/es/locales/en-US.js +16 -1
- package/es/locales/zh-CN.d.ts +14 -0
- package/es/locales/zh-CN.js +16 -1
- package/es/locales/zh-TW.d.ts +14 -0
- package/es/locales/zh-TW.js +16 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +4 -1
- package/lib/components/browserSelect/chevron-down.png +0 -0
- package/lib/components/browserSelect/index.d.ts +15 -0
- package/lib/components/browserSelect/index.js +59 -0
- package/lib/components/browserSelect/index.less +18 -0
- package/lib/components/button/index.js +2 -0
- package/lib/components/buttonGroupEdit/index.d.ts +8 -0
- package/lib/components/buttonGroupEdit/index.js +234 -0
- package/lib/components/buttonGroupPreview/index.d.ts +20 -0
- package/lib/components/buttonGroupPreview/index.js +65 -0
- package/lib/components/cardPro/index.d.ts +4 -0
- package/lib/components/cardPro/index.js +60 -0
- package/lib/components/cardPro/index.less +58 -0
- package/lib/components/collapse/index.d.ts +6 -0
- package/lib/components/collapse/index.js +88 -0
- package/lib/components/collapse/index.less +1 -0
- package/lib/components/date-picker/constants.d.ts +39 -0
- package/lib/components/date-picker/constants.js +78 -0
- package/lib/components/date-picker/datePickerCpt.d.ts +8 -0
- package/lib/components/date-picker/datePickerCpt.js +403 -0
- package/lib/components/date-picker/hooks/useMediaQuery.d.ts +2 -0
- package/lib/components/date-picker/hooks/useMediaQuery.js +43 -0
- package/lib/components/date-picker/index.js +2 -2
- package/lib/components/date-picker/index.less +1880 -0
- package/lib/components/drag-sort-tree/index.d.ts +0 -1
- package/lib/components/drag-sort-tree/index.js +0 -1
- package/lib/components/iconfont/index.js +1 -1
- package/lib/components/picker-view/index.d.ts +2 -0
- package/lib/components/picker-view/index.js +36 -0
- package/lib/components/pisellAnchor/index.d.ts +15 -0
- package/lib/components/pisellAnchor/index.js +107 -0
- package/lib/components/pisellAnchor/index.less +98 -0
- package/lib/components/pisellInformationEntry/Input/index.js +9 -1
- package/lib/components/pisellInformationEntry/constants.d.ts +10 -0
- package/lib/components/pisellInformationEntry/constants.js +12 -0
- package/lib/components/pisellInformationEntry/hooks/useTerminalPeripherals.d.ts +8 -0
- package/lib/components/pisellInformationEntry/hooks/useTerminalPeripherals.js +83 -0
- package/lib/components/pisellInformationEntry/index.js +18 -2
- package/lib/components/pisellInformationEntry/index.less +1 -1
- package/lib/components/pisellLoading/index.d.ts +2 -0
- package/lib/components/pisellLoading/index.js +2 -1
- package/lib/components/pisellQrcode/index.d.ts +4 -0
- package/lib/components/pisellQrcode/index.js +79 -0
- package/lib/components/pisellQrcode/index.less +41 -0
- package/lib/components/pisellStatistic/index.d.ts +10 -0
- package/lib/components/pisellStatistic/index.js +51 -0
- package/lib/components/pisellStatistic/index.less +14 -0
- package/lib/components/pisellTags/index.d.ts +13 -0
- package/lib/components/pisellTags/index.js +113 -0
- package/lib/components/pisellTags/index.less +17 -0
- package/lib/components/pisellTags/utils.d.ts +1 -0
- package/lib/components/pisellTags/utils.js +86 -0
- package/lib/components/pisellUpload/index.d.ts +11 -0
- package/lib/components/pisellUpload/index.js +53 -0
- package/lib/components/pisellUpload/index.less +15 -0
- package/lib/components/pisellUploadCrop/index.d.ts +3 -0
- package/lib/components/pisellUploadCrop/index.js +75 -0
- package/lib/components/pisellUploadCrop/index.less +15 -0
- package/lib/components/pisellWalletCard/img/drak.png +0 -0
- package/lib/components/pisellWalletCard/img/light.png +0 -0
- package/lib/components/pisellWalletCard/index.d.ts +4 -0
- package/lib/components/pisellWalletCard/index.js +184 -0
- package/lib/components/pisellWalletCard/index.less +96 -0
- package/lib/components/pisellWalletPassCard/index.d.ts +2 -0
- package/lib/components/pisellWalletPassCard/index.js +8 -4
- package/lib/components/pisellWalletPassCard/index.less +3 -0
- package/lib/components/productCard/components/Actions/index.d.ts +4 -0
- package/lib/components/productCard/components/Actions/index.js +54 -0
- package/lib/components/productCard/components/Actions/index.less +14 -0
- package/lib/components/productCard/components/AmountFooter/index.d.ts +4 -0
- package/lib/components/productCard/components/AmountFooter/index.js +61 -0
- package/lib/components/productCard/components/AmountFooter/index.less +30 -0
- package/lib/components/productCard/components/Divider/index.d.ts +4 -0
- package/lib/components/productCard/components/Divider/index.js +50 -0
- package/lib/components/productCard/components/Divider/index.less +13 -0
- package/lib/components/productCard/components/Header/index.d.ts +4 -0
- package/lib/components/productCard/components/Header/index.js +81 -0
- package/lib/components/productCard/components/Header/index.less +59 -0
- package/lib/components/productCard/components/Holder/index.d.ts +4 -0
- package/lib/components/productCard/components/Holder/index.js +42 -0
- package/lib/components/productCard/components/Holder/index.less +11 -0
- package/lib/components/productCard/components/Note/index.d.ts +4 -0
- package/lib/components/productCard/components/Note/index.js +43 -0
- package/lib/components/productCard/components/Note/index.less +20 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.d.ts +10 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.js +93 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.less +53 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +2 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.js +48 -0
- package/lib/components/productCard/components/Packages/components/options/index.d.ts +4 -0
- package/lib/components/productCard/components/Packages/components/options/index.js +73 -0
- package/lib/components/productCard/components/Packages/components/options/index.less +28 -0
- package/lib/components/productCard/components/Packages/index.d.ts +4 -0
- package/lib/components/productCard/components/Packages/index.js +51 -0
- package/lib/components/productCard/components/Packages/index.less +17 -0
- package/lib/components/productCard/components/Packages/utils.d.ts +20 -0
- package/lib/components/productCard/components/Packages/utils.js +44 -0
- package/lib/components/productCard/components/Sales/index.d.ts +4 -0
- package/lib/components/productCard/components/Sales/index.js +51 -0
- package/lib/components/productCard/components/Sales/index.less +18 -0
- package/lib/components/productCard/components/Time/components/Like/index.d.ts +9 -0
- package/lib/components/productCard/components/Time/components/Like/index.js +64 -0
- package/lib/components/productCard/components/Time/components/Like/index.less +6 -0
- package/lib/components/productCard/components/Time/components/Like/like-heart.png +0 -0
- package/lib/components/productCard/components/Time/components/Like/like-hide-heart.png +0 -0
- package/lib/components/productCard/components/Time/index.d.ts +4 -0
- package/lib/components/productCard/components/Time/index.js +57 -0
- package/lib/components/productCard/components/Time/index.less +25 -0
- package/lib/components/productCard/index.d.ts +5 -0
- package/lib/components/productCard/index.js +101 -0
- package/lib/components/productCard/index.less +48 -0
- package/lib/components/productCard/types.d.ts +10 -0
- package/lib/components/productCard/types.js +17 -0
- package/lib/components/productCard/utils.d.ts +162 -0
- package/lib/components/productCard/utils.js +598 -0
- package/lib/components/record-view/index.d.ts +3 -3
- package/lib/components/record-view/index.js +19 -3
- package/lib/components/section-footers/index.d.ts +8 -0
- package/lib/components/section-footers/index.js +39 -0
- package/lib/components/select-time/RightPanel/index.d.ts +2 -2
- package/lib/components/table/Actions/component/ExportImport/index.js +3 -4
- package/lib/components/table/BasicTable/index.js +5 -1
- package/lib/components/table/Gallery/components/GalleryItem/components/Title/index.less +1 -1
- package/lib/components/table/Gallery/components/GalleryItem/index.js +18 -4
- package/lib/components/table/Gallery/components/GalleryItem/index.less +1 -0
- package/lib/components/table/Gallery/index.js +14 -3
- package/lib/components/table/Table/index.js +2 -1
- package/lib/components/table/Table/utils.d.ts +15 -3
- package/lib/components/table/Table/utils.js +7 -1
- package/lib/components/table/hooks/useTableSetting.js +23 -9
- package/lib/components/table/hooks/useTransDataSource.d.ts +1 -0
- package/lib/components/table/hooks/useTransDataSource.js +5 -4
- package/lib/components/table/types.d.ts +2 -0
- package/lib/components/tabs/index.d.ts +1 -0
- package/lib/components/tabs/index.js +36 -6
- package/lib/components/virtual-keyboard/Keyboard/index.d.ts +1 -0
- package/lib/components/virtual-keyboard/Keyboard/index.js +15 -2
- package/lib/index.d.ts +18 -4
- package/lib/index.js +76 -34
- package/lib/locales/en-US.d.ts +14 -0
- package/lib/locales/en-US.js +16 -1
- package/lib/locales/zh-CN.d.ts +14 -0
- package/lib/locales/zh-CN.js +16 -1
- package/lib/locales/zh-TW.d.ts +14 -0
- package/lib/locales/zh-TW.js +16 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +7 -2
- package/lowcode/badge/meta.ts +8 -8
- package/lowcode/collapse/meta.ts +85 -1
- package/lowcode/pisell-anchor/meta.ts +127 -0
- package/lowcode/pisell-anchor/snippets.ts +20 -0
- package/lowcode/pisell-qrcode/__screenshots__/upload-1.png +0 -0
- package/lowcode/pisell-qrcode/meta.ts +46 -0
- package/lowcode/pisell-qrcode/snippets.ts +12 -0
- package/lowcode/pisell-statistic/meta.ts +83 -0
- package/lowcode/pisell-statistic/snippets.ts +13 -0
- package/lowcode/pisell-tooltip/meta.ts +1 -1
- package/lowcode/pisell-upload/__screenshots__/upload-1.png +0 -0
- package/lowcode/pisell-upload/meta.ts +508 -0
- package/lowcode/pisell-upload/snippets.ts +20 -0
- package/lowcode/pisell-upload-crop/meta.ts +77 -0
- package/lowcode/pisell-upload-crop/snippe.ts +12 -0
- package/lowcode/pisell-wallet-card/meta.ts +141 -0
- package/lowcode/pisell-wallet-card/snippets.ts +26 -0
- package/lowcode/product-card/meta.ts +92 -0
- package/lowcode/product-card/snippets.ts +15 -0
- package/lowcode/record-view/meta.ts +12 -0
- package/lowcode/section-footers/meta.ts +47 -3
- package/lowcode/section-footers/snippe.ts +14 -1
- package/lowcode/statistic/meta.ts +1 -1
- package/lowcode/tabs/meta.ts +51 -51
- package/lowcode/tabs/snippets.ts +36 -36
- package/lowcode/tag/meta.ts +6 -0
- package/lowcode/timeline/meta.ts +12 -3
- package/lowcode/timeline/snippets.ts +2 -0
- package/lowcode/timeline.item/meta.ts +1 -1
- package/package.json +31 -26
- package/dist/umd/materials.min.css +0 -1
- package/dist/umd/materials.min.js +0 -1
- package/dist/umd/static/DotsSix.57d66266.svg +0 -1
- package/dist/umd/static/arrow-left.e542294f.svg +0 -1
- package/dist/umd/static/arrow-right.763f03e0.svg +0 -1
- package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
- package/dist/umd/static/help-circle.31c9be40.svg +0 -1
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +0 -1
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface BrowserSelectProps extends React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> {
|
|
4
|
+
options: any[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @title: 系统级别的下拉框
|
|
8
|
+
* @description:
|
|
9
|
+
* @param {BrowserSelectProps} props
|
|
10
|
+
* @return {*}
|
|
11
|
+
* @Author: zhiwei.Wang
|
|
12
|
+
* @Date: 2024-01-30 16:43
|
|
13
|
+
*/
|
|
14
|
+
declare const BrowserSelect: (props: BrowserSelectProps) => React.JSX.Element;
|
|
15
|
+
export default BrowserSelect;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var _excluded = ["options"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
import React, { useMemo } from "react";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
import "./index.less";
|
|
8
|
+
/**
|
|
9
|
+
* @title: 系统级别的下拉框
|
|
10
|
+
* @description:
|
|
11
|
+
* @param {BrowserSelectProps} props
|
|
12
|
+
* @return {*}
|
|
13
|
+
* @Author: zhiwei.Wang
|
|
14
|
+
* @Date: 2024-01-30 16:43
|
|
15
|
+
*/
|
|
16
|
+
var BrowserSelect = function BrowserSelect(props) {
|
|
17
|
+
var options = props.options,
|
|
18
|
+
resetProps = _objectWithoutProperties(props, _excluded);
|
|
19
|
+
var _options = useMemo(function () {
|
|
20
|
+
return (props.options || []).map(function (d) {
|
|
21
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
22
|
+
value: d.value,
|
|
23
|
+
key: d.value
|
|
24
|
+
}, d.label);
|
|
25
|
+
});
|
|
26
|
+
}, [props.options]);
|
|
27
|
+
return /*#__PURE__*/React.createElement("select", _extends({}, resetProps, {
|
|
28
|
+
className: classNames("date-picker-pisell-browser-select", resetProps.className),
|
|
29
|
+
onChange: function onChange(e) {
|
|
30
|
+
var _resetProps$onChange;
|
|
31
|
+
e.persist();
|
|
32
|
+
(_resetProps$onChange = resetProps.onChange) === null || _resetProps$onChange === void 0 ? void 0 : _resetProps$onChange.call(resetProps, e);
|
|
33
|
+
}
|
|
34
|
+
}), _options);
|
|
35
|
+
};
|
|
36
|
+
export default BrowserSelect;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.date-picker-pisell-browser-select {
|
|
2
|
+
padding: 9px 16px;
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
background-color: #fff;
|
|
5
|
+
background-image: url('./chevron-down.png');
|
|
6
|
+
color: var(--Gray-true-900, #141414);
|
|
7
|
+
font-size: 16px;
|
|
8
|
+
font-style: normal;
|
|
9
|
+
font-weight: 600;
|
|
10
|
+
border: 1px solid var(--Gray-300, #D0D5DD);
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
appearance: none;
|
|
13
|
+
-webkit-appearance: none;
|
|
14
|
+
-moz-appearance: none;
|
|
15
|
+
background-position: right 10px center;
|
|
16
|
+
background-size: 12px;
|
|
17
|
+
background-repeat: no-repeat;
|
|
18
|
+
}
|
|
@@ -3,11 +3,13 @@ import React, { forwardRef, useMemo } from 'react';
|
|
|
3
3
|
import { Button as OriginalButton } from 'antd';
|
|
4
4
|
var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
5
5
|
var _props$href;
|
|
6
|
+
console.log('%c [ props ]-15', 'font-size:13px; background:#e991b5; color:#ffd5f9;', props);
|
|
6
7
|
var innerProps = {};
|
|
7
8
|
if (!((_props$href = props.href) !== null && _props$href !== void 0 && _props$href.trim()) || props.__designMode === 'design') {
|
|
8
9
|
// 解决低代码编辑器中按钮设置 href 属性造成按钮点击重定向问题
|
|
9
10
|
innerProps.href = undefined;
|
|
10
11
|
}
|
|
12
|
+
debugger;
|
|
11
13
|
var _children = useMemo(function () {
|
|
12
14
|
if (props.rightIcon) {
|
|
13
15
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonGroupListItemProps } from './../buttonGroupPreview';
|
|
3
|
+
interface ButtonGroupEditProps {
|
|
4
|
+
buttonList: ButtonGroupListItemProps[];
|
|
5
|
+
buttonGroupList: ButtonGroupListItemProps[][];
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ButtonGroupEditProps & React.RefAttributes<any>>>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
18
|
+
import React, { useState, useEffect, memo, forwardRef } from 'react';
|
|
19
|
+
import { Button, Card, Dropdown, Flex, Form, Input, Modal, Radio } from 'antd';
|
|
20
|
+
import { MoreOutlined, SwapOutlined } from '@ant-design/icons';
|
|
21
|
+
import { DndContext, closestCenter, useSensor, useSensors, PointerSensor } from '@dnd-kit/core';
|
|
22
|
+
import { useSortable, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
23
|
+
import { uuid } from "../../utils/index";
|
|
24
|
+
var commonStyle = {
|
|
25
|
+
cursor: 'move',
|
|
26
|
+
transition: 'transform 0.3s ease'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// 按钮组件
|
|
30
|
+
var DraggableButton = function DraggableButton(_ref) {
|
|
31
|
+
var buttonItem = _ref.buttonItem,
|
|
32
|
+
buttonList = _ref.buttonList,
|
|
33
|
+
onEdit = _ref.onEdit;
|
|
34
|
+
var id = buttonItem.id,
|
|
35
|
+
_buttonItem$isMore = buttonItem.isMore,
|
|
36
|
+
isMore = _buttonItem$isMore === void 0 ? false : _buttonItem$isMore,
|
|
37
|
+
_buttonItem$children = buttonItem.children,
|
|
38
|
+
children = _buttonItem$children === void 0 ? '' : _buttonItem$children,
|
|
39
|
+
_buttonItem$buttonPro = buttonItem.buttonProps,
|
|
40
|
+
buttonProps = _buttonItem$buttonPro === void 0 ? {} : _buttonItem$buttonPro;
|
|
41
|
+
var _useSortable = useSortable({
|
|
42
|
+
id: id
|
|
43
|
+
}),
|
|
44
|
+
listeners = _useSortable.listeners,
|
|
45
|
+
setNodeRef = _useSortable.setNodeRef,
|
|
46
|
+
transform = _useSortable.transform,
|
|
47
|
+
transition = _useSortable.transition,
|
|
48
|
+
isDragging = _useSortable.isDragging;
|
|
49
|
+
var style = transform ? _objectSpread(_objectSpread({}, commonStyle), {}, {
|
|
50
|
+
transform: "translate3d(".concat(transform.x, "px, ").concat(transform.y, "px, 0)"),
|
|
51
|
+
transition: isDragging ? 'unset' : transition
|
|
52
|
+
}) : commonStyle;
|
|
53
|
+
|
|
54
|
+
// 防止拖拽时阻止点击事件
|
|
55
|
+
var handleClick = function handleClick(e) {
|
|
56
|
+
if (isDragging) {
|
|
57
|
+
// 防止拖拽时触发点击事件
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 触发编辑按钮
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var menu = {
|
|
67
|
+
items: buttonList.filter(function (item) {
|
|
68
|
+
return !item.isMore;
|
|
69
|
+
}).map(function (item) {
|
|
70
|
+
return {
|
|
71
|
+
key: item.id,
|
|
72
|
+
label: item.children
|
|
73
|
+
};
|
|
74
|
+
}),
|
|
75
|
+
onClick: function onClick(e) {
|
|
76
|
+
var item = buttonList.find(function (item) {
|
|
77
|
+
return item.id === e.key;
|
|
78
|
+
});
|
|
79
|
+
onEdit(item);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
83
|
+
ref: setNodeRef
|
|
84
|
+
}, listeners, {
|
|
85
|
+
style: style
|
|
86
|
+
}), isMore ? /*#__PURE__*/React.createElement(Dropdown, {
|
|
87
|
+
menu: menu
|
|
88
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
89
|
+
onClick: handleClick
|
|
90
|
+
}, /*#__PURE__*/React.createElement(MoreOutlined, null))) : /*#__PURE__*/React.createElement(Button, _extends({
|
|
91
|
+
style: style
|
|
92
|
+
}, buttonProps, {
|
|
93
|
+
onClick: function onClick() {
|
|
94
|
+
return onEdit(buttonItem);
|
|
95
|
+
}
|
|
96
|
+
}), children));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// 主组件
|
|
100
|
+
var ButtonGroupEdit = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
101
|
+
var _useState = useState(props.buttonList),
|
|
102
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
103
|
+
buttonList = _useState2[0],
|
|
104
|
+
setButtonList = _useState2[1]; // 左侧按钮列表
|
|
105
|
+
var _useState3 = useState(props.buttonGroupList),
|
|
106
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
107
|
+
buttonGroupList = _useState4[0],
|
|
108
|
+
setButtonGroupList = _useState4[1]; // 右侧二维按钮组
|
|
109
|
+
|
|
110
|
+
var sensors = useSensors(useSensor(PointerSensor, {
|
|
111
|
+
activationConstraint: {
|
|
112
|
+
distance: 5
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
var _useState5 = useState(false),
|
|
116
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
117
|
+
isModalVisible = _useState6[0],
|
|
118
|
+
setIsModalVisible = _useState6[1]; // Modal 控制显示状态
|
|
119
|
+
var _useState7 = useState(null),
|
|
120
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
121
|
+
currentButton = _useState8[0],
|
|
122
|
+
setCurrentButton = _useState8[1]; // 当前要编辑按钮
|
|
123
|
+
|
|
124
|
+
var _Form$useForm = Form.useForm(),
|
|
125
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
126
|
+
form = _Form$useForm2[0];
|
|
127
|
+
useEffect(function () {
|
|
128
|
+
setButtonList(props.buttonList);
|
|
129
|
+
if (props.buttonList.length > 0) {
|
|
130
|
+
// 如果按钮列表还有按钮 就在最后增加一个更多的按钮选项
|
|
131
|
+
setButtonList([].concat(_toConsumableArray(buttonList), [{
|
|
132
|
+
id: uuid(),
|
|
133
|
+
isMore: true
|
|
134
|
+
}]));
|
|
135
|
+
} else {
|
|
136
|
+
setButtonGroupList(props.buttonGroupList);
|
|
137
|
+
}
|
|
138
|
+
}, [props.buttonList, props.buttonGroupList]);
|
|
139
|
+
|
|
140
|
+
// 增加一行按钮组
|
|
141
|
+
var addRow = function addRow() {
|
|
142
|
+
var newButton = {
|
|
143
|
+
id: uuid(),
|
|
144
|
+
children: "\u6309\u94AE".concat(uuid()),
|
|
145
|
+
// 默认按钮文本
|
|
146
|
+
buttonProps: {
|
|
147
|
+
type: 'default'
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
setButtonGroupList(function (prev) {
|
|
151
|
+
return [].concat(_toConsumableArray(prev), [[newButton]]);
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
useEffect(function () {
|
|
155
|
+
if (currentButton) {
|
|
156
|
+
var _currentButton$button;
|
|
157
|
+
form.setFieldsValue({
|
|
158
|
+
children: currentButton.children,
|
|
159
|
+
type: (_currentButton$button = currentButton.buttonProps) === null || _currentButton$button === void 0 ? void 0 : _currentButton$button.type
|
|
160
|
+
}); // 动态设置按钮名称
|
|
161
|
+
}
|
|
162
|
+
}, [currentButton, form]); // 每次 currentButton 改变时,更新表单值
|
|
163
|
+
|
|
164
|
+
// 打开编辑Modal
|
|
165
|
+
var handleEditButton = function handleEditButton(button) {
|
|
166
|
+
setCurrentButton(button); // 设置当前编辑按钮
|
|
167
|
+
setIsModalVisible(true); // 显示 Modal
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// 关闭 Modal
|
|
171
|
+
var handleCancel = function handleCancel() {
|
|
172
|
+
setIsModalVisible(false);
|
|
173
|
+
setCurrentButton(null); // 清空当前编辑的按钮
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// 保存按钮修改
|
|
177
|
+
var handleSave = function handleSave(values) {
|
|
178
|
+
console.log('%c [ values ]-153', 'font-size:13px; background:#968084; color:#dac4c8;', values);
|
|
179
|
+
if (!currentButton) return;
|
|
180
|
+
var updatedButton = _objectSpread(_objectSpread({}, currentButton), {}, {
|
|
181
|
+
children: values.children,
|
|
182
|
+
buttonProps: values
|
|
183
|
+
});
|
|
184
|
+
// 更新 buttonList
|
|
185
|
+
setButtonList(function (prevList) {
|
|
186
|
+
return prevList.map(function (item) {
|
|
187
|
+
return item.id === currentButton.id ? _objectSpread(_objectSpread({}, item), updatedButton) : item;
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// 更新 buttonGroupList
|
|
192
|
+
setButtonGroupList(function (prevGroupList) {
|
|
193
|
+
return prevGroupList.map(function (row) {
|
|
194
|
+
return row.map(function (item) {
|
|
195
|
+
return item.id === currentButton.id ? _objectSpread(_objectSpread({}, item), updatedButton) : item;
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
handleCancel(); // 关闭 Modal
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// 拖拽结束的处理函数
|
|
203
|
+
var onDragEnd = function onDragEnd(event) {
|
|
204
|
+
var _active$data, _over$data;
|
|
205
|
+
var active = event.active,
|
|
206
|
+
over = event.over;
|
|
207
|
+
if (!over) return;
|
|
208
|
+
var activeId = active.id;
|
|
209
|
+
var overId = over.id;
|
|
210
|
+
var activeContainerId = '';
|
|
211
|
+
var overContainerId = '';
|
|
212
|
+
if (active !== null && active !== void 0 && (_active$data = active.data) !== null && _active$data !== void 0 && _active$data.current) {
|
|
213
|
+
activeContainerId = active.data.current.sortable.containerId;
|
|
214
|
+
}
|
|
215
|
+
if (over !== null && over !== void 0 && (_over$data = over.data) !== null && _over$data !== void 0 && _over$data.current) {
|
|
216
|
+
overContainerId = over.data.current.sortable.containerId;
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
// 从 buttonList 拖拽到 buttonGroupList
|
|
220
|
+
if (activeContainerId === 'list1' && overContainerId === 'list2') {
|
|
221
|
+
var activeIndex = buttonList.findIndex(function (item) {
|
|
222
|
+
return item.id === activeId;
|
|
223
|
+
});
|
|
224
|
+
if (activeIndex === -1) return;
|
|
225
|
+
var movedItem = _objectSpread({}, buttonList[activeIndex]);
|
|
226
|
+
// 找到目标位置
|
|
227
|
+
var overRowIndex = buttonGroupList.findIndex(function (row) {
|
|
228
|
+
return row.some(function (item) {
|
|
229
|
+
return item.id === overId;
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
if (overRowIndex === -1) return;
|
|
233
|
+
var updatedGroupList = _toConsumableArray(buttonGroupList);
|
|
234
|
+
updatedGroupList[overRowIndex].push(movedItem); // 将按钮添加到目标行
|
|
235
|
+
// 更新状态
|
|
236
|
+
var updatedButtonList = buttonList.filter(function (item) {
|
|
237
|
+
return item.id !== activeId;
|
|
238
|
+
}); // 删除拖拽的元素
|
|
239
|
+
setButtonGroupList(updatedGroupList);
|
|
240
|
+
setButtonList(updatedButtonList);
|
|
241
|
+
}
|
|
242
|
+
// 从 buttonGroupList 拖拽到 buttonList
|
|
243
|
+
if (activeContainerId === 'list2' && overContainerId === 'list1') {
|
|
244
|
+
var _buttonGroupList$_ove;
|
|
245
|
+
var _overRowIndex = buttonGroupList.findIndex(function (row) {
|
|
246
|
+
return row.some(function (item) {
|
|
247
|
+
return item.id === overId;
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
if (_overRowIndex === -1) return;
|
|
251
|
+
var overColIndex = (_buttonGroupList$_ove = buttonGroupList[_overRowIndex]) === null || _buttonGroupList$_ove === void 0 ? void 0 : _buttonGroupList$_ove.findIndex(function (item) {
|
|
252
|
+
return item.id === overId;
|
|
253
|
+
});
|
|
254
|
+
if (overColIndex === -1) return;
|
|
255
|
+
var _buttonGroupList$_ove2 = buttonGroupList[_overRowIndex].splice(overColIndex, 1),
|
|
256
|
+
_buttonGroupList$_ove3 = _slicedToArray(_buttonGroupList$_ove2, 1),
|
|
257
|
+
_movedItem = _buttonGroupList$_ove3[0];
|
|
258
|
+
setButtonGroupList(_toConsumableArray(buttonGroupList));
|
|
259
|
+
setButtonList(function (prev) {
|
|
260
|
+
return [].concat(_toConsumableArray(prev), [_movedItem]);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// 同一个列表内的拖拽排序:在 buttonList 内拖拽排序
|
|
265
|
+
if (activeContainerId === 'list1' && overContainerId === 'list1') {
|
|
266
|
+
var _activeIndex = buttonList.findIndex(function (item) {
|
|
267
|
+
return item.id === activeId;
|
|
268
|
+
});
|
|
269
|
+
var overIndex = buttonList.findIndex(function (item) {
|
|
270
|
+
return item.id === overId;
|
|
271
|
+
});
|
|
272
|
+
if (_activeIndex === -1 || overIndex === -1) return;
|
|
273
|
+
var updatedList = _toConsumableArray(buttonList);
|
|
274
|
+
var _updatedList$splice = updatedList.splice(_activeIndex, 1),
|
|
275
|
+
_updatedList$splice2 = _slicedToArray(_updatedList$splice, 1),
|
|
276
|
+
_movedItem2 = _updatedList$splice2[0];
|
|
277
|
+
updatedList.splice(overIndex, 0, _movedItem2);
|
|
278
|
+
setButtonList(updatedList);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// 同一个列表内的拖拽排序:在 buttonGroupList 内拖拽排序
|
|
282
|
+
if (activeContainerId === 'list2' && overContainerId === 'list2') {
|
|
283
|
+
var _buttonGroupList$acti, _buttonGroupList$_ove4;
|
|
284
|
+
var activeRowIndex = buttonGroupList.findIndex(function (row) {
|
|
285
|
+
return row.some(function (item) {
|
|
286
|
+
return item.id === activeId;
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
var activeColIndex = (_buttonGroupList$acti = buttonGroupList[activeRowIndex]) === null || _buttonGroupList$acti === void 0 ? void 0 : _buttonGroupList$acti.findIndex(function (item) {
|
|
290
|
+
return item.id === activeId;
|
|
291
|
+
});
|
|
292
|
+
var _overRowIndex2 = buttonGroupList.findIndex(function (row) {
|
|
293
|
+
return row.some(function (item) {
|
|
294
|
+
return item.id === overId;
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
var _overColIndex = (_buttonGroupList$_ove4 = buttonGroupList[_overRowIndex2]) === null || _buttonGroupList$_ove4 === void 0 ? void 0 : _buttonGroupList$_ove4.findIndex(function (item) {
|
|
298
|
+
return item.id === overId;
|
|
299
|
+
});
|
|
300
|
+
if (activeRowIndex === -1 || _overRowIndex2 === -1 || activeColIndex === -1 || _overColIndex === -1) return;
|
|
301
|
+
var _updatedGroupList = _toConsumableArray(buttonGroupList);
|
|
302
|
+
var _updatedGroupList$act = _updatedGroupList[activeRowIndex].splice(activeColIndex, 1),
|
|
303
|
+
_updatedGroupList$act2 = _slicedToArray(_updatedGroupList$act, 1),
|
|
304
|
+
_movedItem3 = _updatedGroupList$act2[0];
|
|
305
|
+
_updatedGroupList[_overRowIndex2].splice(_overColIndex, 0, _movedItem3);
|
|
306
|
+
setButtonGroupList(_updatedGroupList);
|
|
307
|
+
}
|
|
308
|
+
} catch (error) {
|
|
309
|
+
console.error('拖拽结束时出错:', error);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
console.log('%c [ currentButton ]-235', 'font-size:13px; background:#07d83a; color:#4bff7e;', currentButton);
|
|
313
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
314
|
+
wrap: true,
|
|
315
|
+
justify: "space-between",
|
|
316
|
+
align: "center",
|
|
317
|
+
gap: "middle"
|
|
318
|
+
}, /*#__PURE__*/React.createElement(DndContext, {
|
|
319
|
+
onDragEnd: onDragEnd,
|
|
320
|
+
sensors: sensors,
|
|
321
|
+
collisionDetection: closestCenter
|
|
322
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
323
|
+
title: "\u6309\u94AE\u5217\u8868"
|
|
324
|
+
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
325
|
+
id: "list1",
|
|
326
|
+
items: buttonList.map(function (item) {
|
|
327
|
+
return item.id;
|
|
328
|
+
}),
|
|
329
|
+
strategy: verticalListSortingStrategy
|
|
330
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
331
|
+
gap: "middle",
|
|
332
|
+
vertical: true
|
|
333
|
+
}, buttonList.map(function (item) {
|
|
334
|
+
return /*#__PURE__*/React.createElement(DraggableButton, {
|
|
335
|
+
key: item.id,
|
|
336
|
+
buttonItem: item,
|
|
337
|
+
buttonList: buttonList,
|
|
338
|
+
onEdit: handleEditButton
|
|
339
|
+
});
|
|
340
|
+
})))), /*#__PURE__*/React.createElement(Button, {
|
|
341
|
+
type: "primary",
|
|
342
|
+
icon: /*#__PURE__*/React.createElement(SwapOutlined, null)
|
|
343
|
+
}), /*#__PURE__*/React.createElement(Card, {
|
|
344
|
+
title: "\u8C03\u6574\u5217\u8868",
|
|
345
|
+
style: {
|
|
346
|
+
flex: 1
|
|
347
|
+
}
|
|
348
|
+
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
349
|
+
id: "list2",
|
|
350
|
+
items: buttonGroupList.flat().map(function (item) {
|
|
351
|
+
return item.id;
|
|
352
|
+
}),
|
|
353
|
+
strategy: verticalListSortingStrategy
|
|
354
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
355
|
+
gap: "middle",
|
|
356
|
+
vertical: true
|
|
357
|
+
}, buttonGroupList.map(function (subItem, rowIndex) {
|
|
358
|
+
return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Flex, {
|
|
359
|
+
key: rowIndex,
|
|
360
|
+
gap: "middle"
|
|
361
|
+
}, subItem.map(function (item) {
|
|
362
|
+
return /*#__PURE__*/React.createElement(DraggableButton, {
|
|
363
|
+
key: item.id,
|
|
364
|
+
buttonItem: item,
|
|
365
|
+
buttonList: buttonList,
|
|
366
|
+
onEdit: handleEditButton
|
|
367
|
+
});
|
|
368
|
+
})));
|
|
369
|
+
}))))), /*#__PURE__*/React.createElement(Button, {
|
|
370
|
+
type: "primary",
|
|
371
|
+
onClick: addRow
|
|
372
|
+
}, "\u65B0\u589E\u4E00\u884C"), /*#__PURE__*/React.createElement(Modal, {
|
|
373
|
+
title: "\u7F16\u8F91\u6309\u94AE\u5C5E\u6027",
|
|
374
|
+
open: isModalVisible,
|
|
375
|
+
onCancel: handleCancel,
|
|
376
|
+
footer: null
|
|
377
|
+
}, currentButton && /*#__PURE__*/React.createElement(Form, {
|
|
378
|
+
form: form,
|
|
379
|
+
onFinish: handleSave
|
|
380
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
381
|
+
name: "children",
|
|
382
|
+
label: "\u6309\u94AE\u540D\u79F0",
|
|
383
|
+
rules: [{
|
|
384
|
+
required: true,
|
|
385
|
+
message: '请输入按钮名称'
|
|
386
|
+
}]
|
|
387
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
388
|
+
placeholder: "\u8BF7\u8F93\u5165\u6309\u94AE\u540D\u79F0"
|
|
389
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
390
|
+
name: "type",
|
|
391
|
+
label: "\u6309\u94AE\u7C7B\u578B",
|
|
392
|
+
rules: [{
|
|
393
|
+
required: true,
|
|
394
|
+
message: '请选择按钮类型'
|
|
395
|
+
}]
|
|
396
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio.Button, {
|
|
397
|
+
value: "primary"
|
|
398
|
+
}, "primary"), /*#__PURE__*/React.createElement(Radio.Button, {
|
|
399
|
+
value: "dashed"
|
|
400
|
+
}, "dashed"), /*#__PURE__*/React.createElement(Radio.Button, {
|
|
401
|
+
value: "link"
|
|
402
|
+
}, "link"), /*#__PURE__*/React.createElement(Radio.Button, {
|
|
403
|
+
value: "text"
|
|
404
|
+
}, "text"), /*#__PURE__*/React.createElement(Radio.Button, {
|
|
405
|
+
value: "default"
|
|
406
|
+
}, "default"))), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
|
|
407
|
+
type: "primary",
|
|
408
|
+
htmlType: "submit"
|
|
409
|
+
}, "\u4FDD\u5B58")))));
|
|
410
|
+
});
|
|
411
|
+
export default /*#__PURE__*/memo(ButtonGroupEdit);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MenuProps, ButtonProps } from 'antd';
|
|
3
|
+
export interface ButtonGroupListItemProps {
|
|
4
|
+
id: string;
|
|
5
|
+
children?: string;
|
|
6
|
+
isMore?: boolean;
|
|
7
|
+
menuData?: MenuProps['items'];
|
|
8
|
+
buttonProps?: ButtonProps;
|
|
9
|
+
updateButtonProps?: ButtonProps;
|
|
10
|
+
}
|
|
11
|
+
interface ButtonConfigProps {
|
|
12
|
+
[id: string]: ButtonGroupListItemProps;
|
|
13
|
+
}
|
|
14
|
+
export declare type ButtonGroupListProps = ButtonGroupListItemProps[][];
|
|
15
|
+
interface ButtonGroupPreviewProps {
|
|
16
|
+
buttonConfig?: ButtonConfigProps;
|
|
17
|
+
buttonGroupList: ButtonGroupListProps;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ButtonGroupPreviewProps & React.RefAttributes<any>>>;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
import React, { forwardRef, memo, useMemo } from 'react';
|
|
9
|
+
import { Button, Space, Dropdown, Flex } from 'antd';
|
|
10
|
+
import { MoreOutlined } from '@ant-design/icons';
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param param0 { buttonConfig, buttonGroupList }
|
|
14
|
+
* @returns 整合按钮配置 返回最新的组件数据
|
|
15
|
+
*/
|
|
16
|
+
var updateSourceData = function updateSourceData(_ref) {
|
|
17
|
+
var buttonConfig = _ref.buttonConfig,
|
|
18
|
+
buttonGroupList = _ref.buttonGroupList;
|
|
19
|
+
console.log('%c [ 0 ]-43', 'font-size:13px; background:#26c778; color:#6affbc;', Object.keys(buttonConfig).length !== 0);
|
|
20
|
+
if (Object.keys(buttonConfig).length !== 0) {
|
|
21
|
+
return buttonGroupList.map(function (subArray) {
|
|
22
|
+
return subArray.map(function (item) {
|
|
23
|
+
if (buttonConfig.hasOwnProperty(item.id)) {
|
|
24
|
+
return buttonConfig[item.id]; // 如果存在,则替换为新的对象
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return item; // 保持其他对象不变
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log('%c [ buttonGroupList ]-54', 'font-size:13px; background:#721db9; color:#b661fd;', buttonGroupList);
|
|
33
|
+
return buttonGroupList;
|
|
34
|
+
};
|
|
35
|
+
var ButtonGroupPreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
36
|
+
var _props$buttonConfig = props.buttonConfig,
|
|
37
|
+
buttonConfig = _props$buttonConfig === void 0 ? {} : _props$buttonConfig,
|
|
38
|
+
_props$buttonGroupLis = props.buttonGroupList,
|
|
39
|
+
buttonGroupList = _props$buttonGroupLis === void 0 ? [] : _props$buttonGroupLis;
|
|
40
|
+
console.log('%c [ props ]-57', 'font-size:13px; background:#305767; color:#749bab;', props);
|
|
41
|
+
var sourceDatas = useMemo(function () {
|
|
42
|
+
return updateSourceData({
|
|
43
|
+
buttonConfig: buttonConfig,
|
|
44
|
+
buttonGroupList: buttonGroupList
|
|
45
|
+
});
|
|
46
|
+
}, [buttonGroupList, buttonConfig]);
|
|
47
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
48
|
+
wrap: true,
|
|
49
|
+
vertical: true,
|
|
50
|
+
style: {
|
|
51
|
+
marginBottom: 10
|
|
52
|
+
}
|
|
53
|
+
}, sourceDatas.map(function (item, index) {
|
|
54
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
55
|
+
key: index
|
|
56
|
+
}, item.map(function (items, index) {
|
|
57
|
+
var _items$isMore = items.isMore,
|
|
58
|
+
isMore = _items$isMore === void 0 ? false : _items$isMore,
|
|
59
|
+
_items$id = items.id,
|
|
60
|
+
id = _items$id === void 0 ? '' : _items$id,
|
|
61
|
+
_items$menuData = items.menuData,
|
|
62
|
+
menuData = _items$menuData === void 0 ? [] : _items$menuData,
|
|
63
|
+
_items$children = items.children,
|
|
64
|
+
children = _items$children === void 0 ? '默认按钮名称' : _items$children,
|
|
65
|
+
buttonProps = items.buttonProps,
|
|
66
|
+
_items$updateButtonPr = items.updateButtonProps,
|
|
67
|
+
updateButtonProps = _items$updateButtonPr === void 0 ? {} : _items$updateButtonPr;
|
|
68
|
+
var btnProps = _objectSpread(_objectSpread({}, buttonProps), updateButtonProps);
|
|
69
|
+
return isMore ? /*#__PURE__*/React.createElement(Dropdown, {
|
|
70
|
+
menu: {
|
|
71
|
+
items: menuData
|
|
72
|
+
}
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Button, null, /*#__PURE__*/React.createElement(MoreOutlined, null))) : /*#__PURE__*/React.createElement(Button, _extends({
|
|
74
|
+
key: id
|
|
75
|
+
}, btnProps, {
|
|
76
|
+
children: updateButtonProps.children || children
|
|
77
|
+
}));
|
|
78
|
+
}));
|
|
79
|
+
}));
|
|
80
|
+
});
|
|
81
|
+
export default /*#__PURE__*/memo(ButtonGroupPreview);
|