@pisell/materials 1.0.363 → 1.0.365
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/7b1c7af5ce9e37e4b40ea53fea6ccfd9.jpeg +0 -0
- package/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +4 -4
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/assets/7b1c7af5ce9e37e4b40ea53fea6ccfd9.jpeg +0 -0
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +29 -27
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +23 -21
- package/dist/umd/materials.min.css +1 -0
- package/dist/umd/materials.min.js +1 -0
- package/dist/umd/static/DotsSix.57d66266.svg +1 -0
- package/dist/umd/static/arrow-left.e542294f.svg +1 -0
- package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
- package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
- package/dist/umd/static/help-circle.31c9be40.svg +1 -0
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
- package/es/components/button/index.d.ts +4 -3
- package/es/components/button/index.js +14 -3
- package/es/components/iconfont/index.d.ts +2 -1
- package/es/components/iconfont/index.js +1 -1
- package/es/components/page/index.css +0 -0
- package/es/components/page/index.d.ts +2 -2
- package/es/components/page/index.js +208 -185
- package/es/components/pisell-config-provider/context.d.ts +16 -0
- package/es/components/pisell-config-provider/context.js +32 -0
- package/es/components/pisell-config-provider/hooks/usePisellConfig.d.ts +2 -0
- package/es/components/pisell-config-provider/hooks/usePisellConfig.js +7 -0
- package/es/components/pisell-config-provider/index.d.ts +9 -0
- package/es/components/pisell-config-provider/index.js +32 -0
- package/es/components/pisellCard/bg.jpeg +0 -0
- package/es/components/pisellCard/index.d.ts +47 -0
- package/es/components/pisellCard/index.js +84 -0
- package/es/components/pisellCard/index.less +89 -0
- package/es/components/pisellCardList/index.d.ts +23 -0
- package/es/components/pisellCardList/index.js +104 -0
- package/es/components/pisellCardList/index.less +75 -0
- package/es/components/pisellCheckboxGroup/index.d.ts +26 -0
- package/es/components/pisellCheckboxGroup/index.js +144 -0
- package/es/components/pisellCheckboxGroup/index.less +36 -0
- package/es/components/pisellCheckboxGroup/mock.d.ts +4 -0
- package/es/components/pisellCheckboxGroup/mock.js +16 -0
- package/es/components/pisellContainer/components/Portal/index.d.ts +10 -0
- package/es/components/pisellContainer/components/Portal/index.js +7 -0
- package/es/components/pisellContainer/containers.d.ts +1 -0
- package/es/components/pisellContainer/containers.js +8 -0
- package/es/components/pisellContainer/index.d.ts +22 -0
- package/es/components/pisellContainer/index.js +17 -0
- package/es/components/pisellCountdown/index.d.ts +24 -0
- package/es/components/pisellCountdown/index.js +44 -0
- package/es/components/pisellCountdown/utils.d.ts +1 -0
- package/es/components/pisellCountdown/utils.js +35 -0
- package/es/components/pisellDatePicker/datePickerCpt.d.ts +12 -0
- package/es/components/pisellDatePicker/datePickerCpt.js +131 -0
- package/es/components/pisellDatePicker/detePickerCpt.less +3 -0
- package/es/components/pisellDatePicker/index.d.ts +3 -0
- package/es/components/pisellDatePicker/index.js +17 -0
- package/es/components/pisellEmpty/index.d.ts +16 -0
- package/es/components/pisellEmpty/index.js +38 -0
- package/es/components/pisellEmpty/index.less +34 -0
- package/es/components/pisellInput/components/BankCard/cardPng/AMEX.png +0 -0
- package/es/components/pisellInput/components/BankCard/cardPng/Discover.png +0 -0
- package/es/components/pisellInput/components/BankCard/cardPng/JCB.png +0 -0
- package/es/components/pisellInput/components/BankCard/cardPng/MasterCard.png +0 -0
- package/es/components/pisellInput/components/BankCard/cardPng/UnionPay.png +0 -0
- package/es/components/pisellInput/components/BankCard/cardPng/VISA.png +0 -0
- package/es/components/pisellInput/components/BankCard/index.d.ts +11 -0
- package/es/components/pisellInput/components/BankCard/index.js +82 -0
- package/es/components/pisellInput/components/BankCard/index.less +4 -0
- package/es/components/pisellInput/components/BankCard/utils.d.ts +11 -0
- package/es/components/pisellInput/components/BankCard/utils.js +65 -0
- package/es/components/pisellInput/components/Copy/index.d.ts +11 -0
- package/es/components/pisellInput/components/Copy/index.js +53 -0
- package/es/components/pisellInput/components/SecurityCode/card.png +0 -0
- package/es/components/pisellInput/components/SecurityCode/index.d.ts +12 -0
- package/es/components/pisellInput/components/SecurityCode/index.js +46 -0
- package/es/components/pisellInput/components/SecurityCode/index.less +4 -0
- package/es/components/pisellInput/index.d.ts +13 -0
- package/es/components/pisellInput/index.js +15 -0
- package/es/components/pisellLoading/index.d.ts +15 -0
- package/es/components/pisellLoading/index.js +48 -0
- package/es/components/pisellLoading/index.less +35 -0
- package/es/components/pisellMessage/index.d.ts +4 -0
- package/es/components/pisellMessage/index.js +5 -0
- package/es/components/pisellModal/components/Information/index.d.ts +21 -0
- package/es/components/pisellModal/components/Information/index.js +23 -0
- package/es/components/pisellModal/components/Information/index.less +15 -0
- package/es/components/pisellModal/components/IpadModal/index.d.ts +6 -0
- package/es/components/pisellModal/components/IpadModal/index.js +6 -0
- package/es/components/pisellModal/components/MobileModal/index.d.ts +9 -0
- package/es/components/pisellModal/components/MobileModal/index.js +26 -0
- package/es/components/pisellModal/components/MobileModal/index.less +59 -0
- package/es/components/pisellModal/components/PcModal/index.d.ts +30 -0
- package/es/components/pisellModal/components/PcModal/index.js +129 -0
- package/es/components/pisellModal/components/PcModal/index.less +38 -0
- package/es/components/pisellModal/components/functions/index.d.ts +12 -0
- package/es/components/pisellModal/components/functions/index.js +44 -0
- package/es/components/pisellModal/components/functions/index.less +25 -0
- package/es/components/pisellModal/components/index.d.ts +10 -0
- package/es/components/pisellModal/components/index.js +9 -0
- package/es/components/pisellModal/constants.d.ts +6 -0
- package/es/components/pisellModal/constants.js +6 -0
- package/es/components/pisellModal/index.d.ts +43 -0
- package/es/components/pisellModal/index.js +30 -0
- package/es/components/pisellRow/index.d.ts +14 -0
- package/es/components/pisellRow/index.js +54 -0
- package/es/components/pisellRow/index.less +13 -0
- package/es/components/pisellText/components/Amount/index.d.ts +18 -0
- package/es/components/pisellText/components/Amount/index.js +25 -0
- package/es/components/pisellText/index.d.ts +8 -0
- package/es/components/pisellText/index.js +7 -0
- package/es/components/pisellToast/index.d.ts +16 -0
- package/es/components/pisellToast/index.js +32 -0
- package/es/components/pisellToast/index.less +26 -0
- package/es/components/pisellTooltip/index.d.ts +10 -0
- package/es/components/pisellTooltip/index.js +18 -0
- package/es/components/pisellTooltip/index.less +5 -0
- package/es/hooks/useCssVariables.d.ts +8 -0
- package/es/hooks/useCssVariables.js +21 -0
- package/es/index.d.ts +18 -0
- package/es/index.js +19 -1
- package/es/locales/en-US.d.ts +3 -0
- package/es/locales/en-US.js +5 -1
- package/es/locales/zh-CN.d.ts +3 -0
- package/es/locales/zh-CN.js +5 -1
- package/es/locales/zh-TW.d.ts +3 -0
- package/es/locales/zh-TW.js +5 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +15 -1
- package/lib/components/button/index.d.ts +4 -3
- package/lib/components/button/index.js +13 -9
- package/lib/components/iconfont/index.d.ts +2 -1
- package/lib/components/iconfont/index.js +1 -1
- package/lib/components/page/index.css +0 -0
- package/lib/components/page/index.d.ts +2 -2
- package/lib/components/page/index.js +172 -159
- package/lib/components/pisell-config-provider/context.d.ts +16 -0
- package/lib/components/pisell-config-provider/context.js +49 -0
- package/lib/components/pisell-config-provider/hooks/usePisellConfig.d.ts +2 -0
- package/lib/components/pisell-config-provider/hooks/usePisellConfig.js +31 -0
- package/lib/components/pisell-config-provider/index.d.ts +9 -0
- package/lib/components/pisell-config-provider/index.js +61 -0
- package/lib/components/pisellCard/bg.jpeg +0 -0
- package/lib/components/pisellCard/index.d.ts +47 -0
- package/lib/components/pisellCard/index.js +97 -0
- package/lib/components/pisellCard/index.less +89 -0
- package/lib/components/pisellCardList/index.d.ts +23 -0
- package/lib/components/pisellCardList/index.js +146 -0
- package/lib/components/pisellCardList/index.less +75 -0
- package/lib/components/pisellCheckboxGroup/index.d.ts +26 -0
- package/lib/components/pisellCheckboxGroup/index.js +151 -0
- package/lib/components/pisellCheckboxGroup/index.less +36 -0
- package/lib/components/pisellCheckboxGroup/mock.d.ts +4 -0
- package/lib/components/pisellCheckboxGroup/mock.js +35 -0
- package/lib/components/pisellContainer/components/Portal/index.d.ts +10 -0
- package/lib/components/pisellContainer/components/Portal/index.js +40 -0
- package/lib/components/pisellContainer/containers.d.ts +1 -0
- package/lib/components/pisellContainer/containers.js +46 -0
- package/lib/components/pisellContainer/index.d.ts +22 -0
- package/lib/components/pisellContainer/index.js +49 -0
- package/lib/components/pisellCountdown/index.d.ts +24 -0
- package/lib/components/pisellCountdown/index.js +63 -0
- package/lib/components/pisellCountdown/utils.d.ts +1 -0
- package/lib/components/pisellCountdown/utils.js +60 -0
- package/lib/components/pisellDatePicker/datePickerCpt.d.ts +12 -0
- package/lib/components/pisellDatePicker/datePickerCpt.js +157 -0
- package/lib/components/pisellDatePicker/detePickerCpt.less +3 -0
- package/lib/components/pisellDatePicker/index.d.ts +3 -0
- package/lib/components/pisellDatePicker/index.js +48 -0
- package/lib/components/pisellEmpty/index.d.ts +16 -0
- package/lib/components/pisellEmpty/index.js +61 -0
- package/lib/components/pisellEmpty/index.less +34 -0
- package/lib/components/pisellInput/components/BankCard/cardPng/AMEX.png +0 -0
- package/lib/components/pisellInput/components/BankCard/cardPng/Discover.png +0 -0
- package/lib/components/pisellInput/components/BankCard/cardPng/JCB.png +0 -0
- package/lib/components/pisellInput/components/BankCard/cardPng/MasterCard.png +0 -0
- package/lib/components/pisellInput/components/BankCard/cardPng/UnionPay.png +0 -0
- package/lib/components/pisellInput/components/BankCard/cardPng/VISA.png +0 -0
- package/lib/components/pisellInput/components/BankCard/index.d.ts +11 -0
- package/lib/components/pisellInput/components/BankCard/index.js +98 -0
- package/lib/components/pisellInput/components/BankCard/index.less +4 -0
- package/lib/components/pisellInput/components/BankCard/utils.d.ts +11 -0
- package/lib/components/pisellInput/components/BankCard/utils.js +103 -0
- package/lib/components/pisellInput/components/Copy/index.d.ts +11 -0
- package/lib/components/pisellInput/components/Copy/index.js +61 -0
- package/lib/components/pisellInput/components/SecurityCode/card.png +0 -0
- package/lib/components/pisellInput/components/SecurityCode/index.d.ts +12 -0
- package/lib/components/pisellInput/components/SecurityCode/index.js +74 -0
- package/lib/components/pisellInput/components/SecurityCode/index.less +4 -0
- package/lib/components/pisellInput/index.d.ts +13 -0
- package/lib/components/pisellInput/index.js +46 -0
- package/lib/components/pisellLoading/index.d.ts +15 -0
- package/lib/components/pisellLoading/index.js +72 -0
- package/lib/components/pisellLoading/index.less +35 -0
- package/lib/components/pisellMessage/index.d.ts +4 -0
- package/lib/components/pisellMessage/index.js +34 -0
- package/lib/components/pisellModal/components/Information/index.d.ts +21 -0
- package/lib/components/pisellModal/components/Information/index.js +53 -0
- package/lib/components/pisellModal/components/Information/index.less +15 -0
- package/lib/components/pisellModal/components/IpadModal/index.d.ts +6 -0
- package/lib/components/pisellModal/components/IpadModal/index.js +40 -0
- package/lib/components/pisellModal/components/MobileModal/index.d.ts +9 -0
- package/lib/components/pisellModal/components/MobileModal/index.js +66 -0
- package/lib/components/pisellModal/components/MobileModal/index.less +59 -0
- package/lib/components/pisellModal/components/PcModal/index.d.ts +30 -0
- package/lib/components/pisellModal/components/PcModal/index.js +143 -0
- package/lib/components/pisellModal/components/PcModal/index.less +38 -0
- package/lib/components/pisellModal/components/functions/index.d.ts +12 -0
- package/lib/components/pisellModal/components/functions/index.js +90 -0
- package/lib/components/pisellModal/components/functions/index.less +25 -0
- package/lib/components/pisellModal/components/index.d.ts +10 -0
- package/lib/components/pisellModal/components/index.js +52 -0
- package/lib/components/pisellModal/constants.d.ts +6 -0
- package/lib/components/pisellModal/constants.js +33 -0
- package/lib/components/pisellModal/index.d.ts +43 -0
- package/lib/components/pisellModal/index.js +63 -0
- package/lib/components/pisellRow/index.d.ts +14 -0
- package/lib/components/pisellRow/index.js +85 -0
- package/lib/components/pisellRow/index.less +13 -0
- package/lib/components/pisellText/components/Amount/index.d.ts +18 -0
- package/lib/components/pisellText/components/Amount/index.js +64 -0
- package/lib/components/pisellText/index.d.ts +8 -0
- package/lib/components/pisellText/index.js +41 -0
- package/lib/components/pisellToast/index.d.ts +16 -0
- package/lib/components/pisellToast/index.js +59 -0
- package/lib/components/pisellToast/index.less +26 -0
- package/lib/components/pisellTooltip/index.d.ts +10 -0
- package/lib/components/pisellTooltip/index.js +56 -0
- package/lib/components/pisellTooltip/index.less +5 -0
- package/lib/hooks/useCssVariables.d.ts +8 -0
- package/lib/hooks/useCssVariables.js +36 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +54 -0
- package/lib/locales/en-US.d.ts +3 -0
- package/lib/locales/en-US.js +5 -1
- package/lib/locales/zh-CN.d.ts +3 -0
- package/lib/locales/zh-CN.js +5 -1
- package/lib/locales/zh-TW.d.ts +3 -0
- package/lib/locales/zh-TW.js +5 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +16 -0
- package/lowcode/_utils/transform-meta.ts +31 -10
- package/lowcode/button/__screenshots__/pisell-modal-information.png +0 -0
- package/lowcode/button/meta.ts +30 -0
- package/lowcode/button/snippets.ts +28 -0
- package/lowcode/information-modal/meta.ts +44 -1
- package/lowcode/modal/meta.ts +1 -1
- package/lowcode/pisell-card/meta.ts +189 -0
- package/lowcode/pisell-card/snippets.ts +20 -0
- package/lowcode/pisell-card-list/meta.ts +145 -0
- package/lowcode/pisell-card-list/snippets.ts +9 -0
- package/lowcode/pisell-checkbox-group/meta.ts +112 -0
- package/lowcode/pisell-checkbox-group/snippets.ts +13 -0
- package/lowcode/pisell-container/meta.ts +71 -0
- package/lowcode/pisell-container/snippets.ts +14 -0
- package/lowcode/pisell-countdown/meta.ts +71 -0
- package/lowcode/pisell-countdown/snippets.ts +12 -0
- package/lowcode/pisell-date-picker/meta.ts +76 -0
- package/lowcode/pisell-date-picker/snippets.ts +9 -0
- package/lowcode/pisell-empty/__screenshots__/empty-1.png +0 -0
- package/lowcode/pisell-empty/meta.ts +85 -0
- package/lowcode/pisell-empty/snippets.ts +10 -0
- package/lowcode/pisell-input/__screenshots__/input-1.png +0 -0
- package/lowcode/pisell-input/meta.ts +193 -0
- package/lowcode/pisell-input/snippets.ts +11 -0
- package/lowcode/pisell-input.bank-card-input/__screenshots__/pisell-input.bank-card-input.png +0 -0
- package/lowcode/pisell-input.bank-card-input/meta.ts +62 -0
- package/lowcode/pisell-input.bank-card-input/snippets.ts +11 -0
- package/lowcode/pisell-input.copy/meta.ts +73 -0
- package/lowcode/pisell-input.copy/snippets.ts +10 -0
- package/lowcode/pisell-input.security-code/__screenshots__/pisell-input.security-code.png +0 -0
- package/lowcode/pisell-input.security-code/meta.ts +92 -0
- package/lowcode/pisell-input.security-code/snippets.ts +11 -0
- package/lowcode/pisell-loading/meta.ts +98 -0
- package/lowcode/pisell-loading/snippets.ts +11 -0
- package/lowcode/pisell-modal/__screenshots__/modal-1.png +0 -0
- package/lowcode/pisell-modal/__screenshots__/modal-2.png +0 -0
- package/lowcode/pisell-modal/meta.ts +200 -0
- package/lowcode/pisell-modal/snippets.ts +38 -0
- package/lowcode/pisell-modal.information/__screenshots__/pisell-modal.information.png +0 -0
- package/lowcode/pisell-modal.information/meta.ts +109 -0
- package/lowcode/pisell-modal.information/snippets.ts +17 -0
- package/lowcode/pisell-row/meta.ts +127 -0
- package/lowcode/pisell-row/snippets.ts +24 -0
- package/lowcode/pisell-text/meta.ts +8117 -0
- package/lowcode/pisell-text.amount/meta.ts +61 -0
- package/lowcode/pisell-text.amount/snippets.ts +15 -0
- package/lowcode/pisell-tooltip/__screenshots__/tooltip-1.jpg +0 -0
- package/lowcode/pisell-tooltip/meta.ts +306 -0
- package/lowcode/pisell-tooltip/snippets.ts +12 -0
- package/package.json +3 -3
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface PisellCardProps {
|
|
4
|
+
id: number;
|
|
5
|
+
/** 商品名称 */
|
|
6
|
+
name: string;
|
|
7
|
+
/** 二维码 */
|
|
8
|
+
qrCode: string;
|
|
9
|
+
/** 共享店铺名称 */
|
|
10
|
+
storeName: string;
|
|
11
|
+
/** 余额 */
|
|
12
|
+
balance: number;
|
|
13
|
+
/** 识别码编号 */
|
|
14
|
+
code: string;
|
|
15
|
+
/** 有效期 */
|
|
16
|
+
validDate: string;
|
|
17
|
+
/** 使用金额 */
|
|
18
|
+
redeem: number;
|
|
19
|
+
/** 是否禁用 */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** 禁用原因 */
|
|
22
|
+
disabledReason?: string;
|
|
23
|
+
/** 封面图 */
|
|
24
|
+
cover?: string;
|
|
25
|
+
/** 是否选中 */
|
|
26
|
+
active?: boolean;
|
|
27
|
+
/** 是否展示商品名称 */
|
|
28
|
+
showName?: boolean;
|
|
29
|
+
/** 是否展示共享店铺名称 */
|
|
30
|
+
showStoreName?: boolean;
|
|
31
|
+
/** 是否展示使用金额 */
|
|
32
|
+
showRedeem?: boolean;
|
|
33
|
+
/** 是否展示余额 */
|
|
34
|
+
showBalance?: boolean;
|
|
35
|
+
/** 是否展示识别码编号 */
|
|
36
|
+
showCode?: boolean;
|
|
37
|
+
/** 是否展示有效期 */
|
|
38
|
+
showValidDate?: boolean;
|
|
39
|
+
/** 是否展示右上角详情按钮 */
|
|
40
|
+
showDetail?: boolean;
|
|
41
|
+
/** 是否展示qrCode */
|
|
42
|
+
showQrCode?: boolean;
|
|
43
|
+
/** 是否展示封面 */
|
|
44
|
+
showCover?: boolean;
|
|
45
|
+
}
|
|
46
|
+
declare const PisellCard: (props: PisellCardProps) => React.JSX.Element;
|
|
47
|
+
export default PisellCard;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import QRCode from "../qrcode";
|
|
4
|
+
import Iconfont from "../iconfont";
|
|
5
|
+
import Amount from "../pisellText/components/Amount";
|
|
6
|
+
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import bg from "./bg.jpeg";
|
|
9
|
+
import "./index.less";
|
|
10
|
+
var PisellCard = function PisellCard(props) {
|
|
11
|
+
var id = props.id,
|
|
12
|
+
code = props.code,
|
|
13
|
+
qrCode = props.qrCode,
|
|
14
|
+
balance = props.balance,
|
|
15
|
+
disabledReason = props.disabledReason,
|
|
16
|
+
name = props.name,
|
|
17
|
+
storeName = props.storeName,
|
|
18
|
+
redeem = props.redeem,
|
|
19
|
+
validDate = props.validDate,
|
|
20
|
+
disabled = props.disabled,
|
|
21
|
+
active = props.active,
|
|
22
|
+
cover = props.cover,
|
|
23
|
+
_props$showCover = props.showCover,
|
|
24
|
+
showCover = _props$showCover === void 0 ? true : _props$showCover,
|
|
25
|
+
_props$showDetail = props.showDetail,
|
|
26
|
+
showDetail = _props$showDetail === void 0 ? true : _props$showDetail,
|
|
27
|
+
_props$showBalance = props.showBalance,
|
|
28
|
+
showBalance = _props$showBalance === void 0 ? true : _props$showBalance,
|
|
29
|
+
_props$showRedeem = props.showRedeem,
|
|
30
|
+
showRedeem = _props$showRedeem === void 0 ? true : _props$showRedeem,
|
|
31
|
+
_props$showName = props.showName,
|
|
32
|
+
showName = _props$showName === void 0 ? true : _props$showName,
|
|
33
|
+
_props$showCode = props.showCode,
|
|
34
|
+
showCode = _props$showCode === void 0 ? true : _props$showCode,
|
|
35
|
+
_props$showStoreName = props.showStoreName,
|
|
36
|
+
showStoreName = _props$showStoreName === void 0 ? true : _props$showStoreName,
|
|
37
|
+
_props$showValidDate = props.showValidDate,
|
|
38
|
+
showValidDate = _props$showValidDate === void 0 ? true : _props$showValidDate,
|
|
39
|
+
_props$showQrCode = props.showQrCode,
|
|
40
|
+
showQrCode = _props$showQrCode === void 0 ? true : _props$showQrCode;
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: classNames('pisell-card', {
|
|
43
|
+
'pisell-card-disabled': disabled
|
|
44
|
+
}),
|
|
45
|
+
style: showCover ? {
|
|
46
|
+
backgroundImage: "url('".concat(cover || bg, "')")
|
|
47
|
+
} : {}
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "pisell-card-name-wrap"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("span", null, showName && name), showDetail && /*#__PURE__*/React.createElement("span", null, "Detail")), /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "pisell-card-store-name"
|
|
52
|
+
}, showStoreName && storeName), /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "pisell-card-amount-wrap"
|
|
54
|
+
}, showRedeem && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "pisell-card-amount-item"
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: "pisell-card-amount-item-label"
|
|
58
|
+
}, "Redeem"), /*#__PURE__*/React.createElement(Amount, {
|
|
59
|
+
className: "pisell-card-amount-item-value",
|
|
60
|
+
useThousandsSeparator: true,
|
|
61
|
+
value: redeem
|
|
62
|
+
})), showBalance && /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: "pisell-card-amount-item"
|
|
64
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: "pisell-card-amount-item-label"
|
|
66
|
+
}, "Balance", disabled ? ': ' : ''), /*#__PURE__*/React.createElement(Amount, {
|
|
67
|
+
className: "pisell-card-amount-item-value",
|
|
68
|
+
useThousandsSeparator: true,
|
|
69
|
+
value: balance
|
|
70
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "pisell-card-code-wrap"
|
|
72
|
+
}, /*#__PURE__*/React.createElement("div", null, showCode && /*#__PURE__*/React.createElement("div", null, code), showValidDate && /*#__PURE__*/React.createElement("div", null, "Valid to ", validDate)), showQrCode && /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "pisell-card-qr-code"
|
|
74
|
+
}, /*#__PURE__*/React.createElement(QRCode, {
|
|
75
|
+
value: qrCode,
|
|
76
|
+
size: 60
|
|
77
|
+
}))), (disabled || disabledReason) && /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: "pisell-card-warn-message"
|
|
79
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
80
|
+
className: "pisell-card-icon",
|
|
81
|
+
type: "pisell2-alert-circle"
|
|
82
|
+
}), /*#__PURE__*/React.createElement("span", null, disabledReason)));
|
|
83
|
+
};
|
|
84
|
+
export default PisellCard;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
.pisell-card {
|
|
2
|
+
padding: 16px;
|
|
3
|
+
color: var(--Gray-900, #101828);
|
|
4
|
+
font-size: 14px;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
border-radius: 12px;
|
|
9
|
+
background-size: cover;
|
|
10
|
+
height: 190px;
|
|
11
|
+
.pisell-card-name-wrap {
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
line-height: 20px;
|
|
16
|
+
}
|
|
17
|
+
.pisell-card-store-name {
|
|
18
|
+
height: 20px;
|
|
19
|
+
font-size: 12px;
|
|
20
|
+
font-weight: 400;
|
|
21
|
+
line-height: 18px; /* 150% */
|
|
22
|
+
margin-bottom: 22px;
|
|
23
|
+
}
|
|
24
|
+
.pisell-card-amount-wrap {
|
|
25
|
+
display: flex;
|
|
26
|
+
margin-bottom: 4px;
|
|
27
|
+
.pisell-card-amount-item {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
margin-right: 16px;
|
|
31
|
+
.pisell-card-amount-item-label {
|
|
32
|
+
color: var(--Gray-500, #667085);
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
line-height: 20px;
|
|
35
|
+
height: 20px;
|
|
36
|
+
}
|
|
37
|
+
.pisell-card-amount-item-value {
|
|
38
|
+
font-size: 20px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
line-height: 30px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.pisell-card-code-wrap {
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
position: relative;
|
|
48
|
+
.pisell-card-qr-code {
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: -16px;
|
|
51
|
+
right: -6px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
.pisell-lowcode-qrcode {
|
|
55
|
+
padding: 6px;
|
|
56
|
+
}
|
|
57
|
+
.pisell-card-warn-message {
|
|
58
|
+
position: absolute;
|
|
59
|
+
bottom: 0;
|
|
60
|
+
width: 100%;
|
|
61
|
+
left: 0;
|
|
62
|
+
background: var(--Warning-200, #FEDF89);
|
|
63
|
+
display: flex;
|
|
64
|
+
padding: 10px 16px;
|
|
65
|
+
color: var(--Gray-900, #101828);
|
|
66
|
+
font-weight: 600;
|
|
67
|
+
line-height: 20px;
|
|
68
|
+
.pisell-card-icon {
|
|
69
|
+
font-size: 20px;
|
|
70
|
+
color: #DC6803;
|
|
71
|
+
margin-right: 6px;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.pisell-card-disabled {
|
|
76
|
+
color: var(--Gray-500, #667085);
|
|
77
|
+
padding-bottom: 36px;
|
|
78
|
+
.pisell-card-amount-wrap {
|
|
79
|
+
.pisell-card-amount-item {
|
|
80
|
+
flex-direction: row;
|
|
81
|
+
align-items: center;
|
|
82
|
+
.pisell-card-amount-item-value {
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
font-weight: 400;
|
|
85
|
+
line-height: 20px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PisellCheckboxGroupProps } from '../pisellCheckboxGroup';
|
|
3
|
+
import { PisellContextType } from '../pisell-config-provider/context';
|
|
4
|
+
import { PisellCardProps } from "../pisellCard";
|
|
5
|
+
export interface PisellCardListProps extends Omit<PisellCheckboxGroupProps, 'options'> {
|
|
6
|
+
platform?: PisellContextType['platform'];
|
|
7
|
+
endMessage?: React.ReactNode;
|
|
8
|
+
loader?: React.ReactNode;
|
|
9
|
+
hasMore: boolean;
|
|
10
|
+
loadMoreData?: () => Promise<void>;
|
|
11
|
+
data: PisellCardProps[];
|
|
12
|
+
showName?: boolean;
|
|
13
|
+
showStoreName?: boolean;
|
|
14
|
+
showRedeem?: boolean;
|
|
15
|
+
showBalance?: boolean;
|
|
16
|
+
showCode?: boolean;
|
|
17
|
+
showValidDate?: boolean;
|
|
18
|
+
showDetail?: boolean;
|
|
19
|
+
showQrCode?: boolean;
|
|
20
|
+
showCover?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare const PisellCardList: (props: PisellCardListProps) => React.JSX.Element;
|
|
23
|
+
export default PisellCardList;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
4
|
+
import { Skeleton } from 'antd';
|
|
5
|
+
import PisellCheckboxGroup from "../pisellCheckboxGroup";
|
|
6
|
+
import PisellCard from "../pisellCard";
|
|
7
|
+
var mockList = [{
|
|
8
|
+
id: 1,
|
|
9
|
+
name: '张三',
|
|
10
|
+
qrCode: 'https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLRpBpr.png',
|
|
11
|
+
storeName: '张三的店铺',
|
|
12
|
+
balance: 100,
|
|
13
|
+
code: 'Walletpass code',
|
|
14
|
+
validDate: '2022-01-01',
|
|
15
|
+
redeem: 1000,
|
|
16
|
+
disabled: false,
|
|
17
|
+
disabledReason: '',
|
|
18
|
+
cover: ''
|
|
19
|
+
}, {
|
|
20
|
+
id: 2,
|
|
21
|
+
name: '张三',
|
|
22
|
+
qrCode: 'https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLRpBpr.png',
|
|
23
|
+
storeName: '张三的店铺',
|
|
24
|
+
balance: 100,
|
|
25
|
+
code: 'Walletpass code',
|
|
26
|
+
validDate: '2022-01-01',
|
|
27
|
+
redeem: 1000,
|
|
28
|
+
disabled: true,
|
|
29
|
+
disabledReason: 'Used maximum amount',
|
|
30
|
+
cover: ''
|
|
31
|
+
}, {
|
|
32
|
+
id: 3,
|
|
33
|
+
name: '张三',
|
|
34
|
+
qrCode: 'https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLRpBpr.png',
|
|
35
|
+
storeName: '张三的店铺',
|
|
36
|
+
balance: 100,
|
|
37
|
+
code: 'Walletpass code',
|
|
38
|
+
validDate: '2022-01-01',
|
|
39
|
+
redeem: 1000,
|
|
40
|
+
disabled: false,
|
|
41
|
+
disabledReason: '',
|
|
42
|
+
cover: ''
|
|
43
|
+
}];
|
|
44
|
+
var PisellCardList = function PisellCardList(props) {
|
|
45
|
+
var _props$data = props.data,
|
|
46
|
+
data = _props$data === void 0 ? mockList : _props$data,
|
|
47
|
+
_props$loadMoreData = props.loadMoreData,
|
|
48
|
+
loadMoreData = _props$loadMoreData === void 0 ? function () {} : _props$loadMoreData,
|
|
49
|
+
endMessage = props.endMessage,
|
|
50
|
+
loader = props.loader,
|
|
51
|
+
hasMore = props.hasMore,
|
|
52
|
+
onChange = props.onChange,
|
|
53
|
+
value = props.value,
|
|
54
|
+
mode = props.mode,
|
|
55
|
+
showName = props.showName,
|
|
56
|
+
showCode = props.showCode,
|
|
57
|
+
showCover = props.showCover,
|
|
58
|
+
showDetail = props.showDetail,
|
|
59
|
+
showBalance = props.showBalance,
|
|
60
|
+
showRedeem = props.showRedeem,
|
|
61
|
+
showQrCode = props.showQrCode,
|
|
62
|
+
showStoreName = props.showStoreName,
|
|
63
|
+
showValidDate = props.showValidDate;
|
|
64
|
+
return /*#__PURE__*/React.createElement(InfiniteScroll, {
|
|
65
|
+
dataLength: data.length,
|
|
66
|
+
next: loadMoreData,
|
|
67
|
+
hasMore: hasMore,
|
|
68
|
+
loader: loader || /*#__PURE__*/React.createElement(Skeleton, {
|
|
69
|
+
paragraph: {
|
|
70
|
+
rows: 3
|
|
71
|
+
},
|
|
72
|
+
active: true
|
|
73
|
+
}),
|
|
74
|
+
endMessage: endMessage,
|
|
75
|
+
scrollableTarget: "scrollableDiv"
|
|
76
|
+
}, /*#__PURE__*/React.createElement(PisellCheckboxGroup
|
|
77
|
+
// platform="h5"
|
|
78
|
+
, {
|
|
79
|
+
options: data,
|
|
80
|
+
value: value,
|
|
81
|
+
mode: mode,
|
|
82
|
+
rowKey: "id",
|
|
83
|
+
className: "payment-list",
|
|
84
|
+
gap: 12,
|
|
85
|
+
onChange: onChange,
|
|
86
|
+
iconPosition: "hide",
|
|
87
|
+
optionClassName: 'payment-item',
|
|
88
|
+
renderOption: function renderOption(item, active) {
|
|
89
|
+
return /*#__PURE__*/React.createElement(PisellCard, _extends({}, item, {
|
|
90
|
+
active: active,
|
|
91
|
+
showName: showName,
|
|
92
|
+
showBalance: showBalance,
|
|
93
|
+
showCode: showCode,
|
|
94
|
+
showCover: showCover,
|
|
95
|
+
showDetail: showDetail,
|
|
96
|
+
showQrCode: showQrCode,
|
|
97
|
+
showRedeem: showRedeem,
|
|
98
|
+
showStoreName: showStoreName,
|
|
99
|
+
showValidDate: showValidDate
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
104
|
+
export default PisellCardList;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.pisell-card {
|
|
2
|
+
padding: 16px;
|
|
3
|
+
color: var(--Gray-900, #101828);
|
|
4
|
+
font-size: 14px;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
border-radius: 12px;
|
|
9
|
+
.pisell-card-name-wrap {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
line-height: 20px;
|
|
14
|
+
}
|
|
15
|
+
.pisell-card-store-name {
|
|
16
|
+
height: 20px;
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
line-height: 18px; /* 150% */
|
|
20
|
+
}
|
|
21
|
+
.pisell-card-amount-wrap {
|
|
22
|
+
display: flex;
|
|
23
|
+
margin-bottom: 4px;
|
|
24
|
+
.pisell-card-amount-item {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
margin-right: 16px;
|
|
28
|
+
.pisell-card-amount-item-label {
|
|
29
|
+
color: var(--Gray-500, #667085);
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
height: 20px;
|
|
33
|
+
}
|
|
34
|
+
.pisell-card-amount-item-value {
|
|
35
|
+
font-size: 20px;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
line-height: 30px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
.pisell-card-code-wrap {
|
|
42
|
+
display: flex;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
position: relative;
|
|
45
|
+
.pisell-card-qr-code {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: -16px;
|
|
48
|
+
right: 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.pisell-lowcode-qrcode {
|
|
52
|
+
padding: 6px;
|
|
53
|
+
}
|
|
54
|
+
.pisell-card-warn-message {
|
|
55
|
+
position: absolute;
|
|
56
|
+
bottom: 0;
|
|
57
|
+
width: 100%;
|
|
58
|
+
left: 0;
|
|
59
|
+
background: var(--Warning-200, #FEDF89);
|
|
60
|
+
display: flex;
|
|
61
|
+
padding: 6px 16px;
|
|
62
|
+
color: var(--Warning-900, #7A2E0E);
|
|
63
|
+
font-weight: 400;
|
|
64
|
+
line-height: 20px;
|
|
65
|
+
.pisell-card-icon {
|
|
66
|
+
font-size: 20px;
|
|
67
|
+
color: #7A2E0E;
|
|
68
|
+
margin-right: 2px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
.pisell-card-disabled {
|
|
73
|
+
color: var(--Gray-500, #667085);
|
|
74
|
+
padding-bottom: 36px;
|
|
75
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PisellContextType } from '../pisell-config-provider/context';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export interface PisellCheckboxGroupOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
declare type PisellCheckboxGroupValue = string | string[] | any;
|
|
11
|
+
export interface PisellCheckboxGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
platform?: PisellContextType['platform'];
|
|
13
|
+
gap?: number;
|
|
14
|
+
padding?: number;
|
|
15
|
+
options: PisellCheckboxGroupOption[];
|
|
16
|
+
onChange?: (value: PisellCheckboxGroupValue) => void;
|
|
17
|
+
value?: PisellCheckboxGroupValue;
|
|
18
|
+
renderOption?: (option: PisellCheckboxGroupOption, active: boolean) => React.ReactNode;
|
|
19
|
+
rowKey?: string;
|
|
20
|
+
mode?: 'multiple' | 'single';
|
|
21
|
+
iconPosition?: 'left' | 'right' | 'hide';
|
|
22
|
+
optionClassName?: string;
|
|
23
|
+
optionActiveClassName?: string;
|
|
24
|
+
}
|
|
25
|
+
declare const PisellCheckboxGroup: (props: PisellCheckboxGroupProps) => React.JSX.Element;
|
|
26
|
+
export default PisellCheckboxGroup;
|
|
@@ -0,0 +1,144 @@
|
|
|
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
|
+
var _excluded = ["platform", "gap", "style", "options", "onChange", "value", "renderOption", "padding", "rowKey", "mode", "iconPosition", "optionClassName", "optionActiveClassName"];
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
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); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
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."); }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
import React, { useEffect, useMemo } from 'react';
|
|
18
|
+
import usePisellConfig from "../pisell-config-provider/hooks/usePisellConfig";
|
|
19
|
+
import classNames from 'classnames';
|
|
20
|
+
import { Checkbox, Radio } from 'antd';
|
|
21
|
+
import { isNumber } from '@pisell/utils';
|
|
22
|
+
import { changeArray } from '@pisell/utils';
|
|
23
|
+
import "./index.less";
|
|
24
|
+
import { useState } from 'react';
|
|
25
|
+
import PisellRow from "../pisellRow";
|
|
26
|
+
import { mockList } from "./mock";
|
|
27
|
+
var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
|
|
28
|
+
var config = usePisellConfig();
|
|
29
|
+
var platform = props.platform,
|
|
30
|
+
_props$gap = props.gap,
|
|
31
|
+
gap = _props$gap === void 0 ? 10 : _props$gap,
|
|
32
|
+
style = props.style,
|
|
33
|
+
_props$options = props.options,
|
|
34
|
+
options = _props$options === void 0 ? mockList : _props$options,
|
|
35
|
+
onChange = props.onChange,
|
|
36
|
+
value = props.value,
|
|
37
|
+
_props$renderOption = props.renderOption,
|
|
38
|
+
renderOption = _props$renderOption === void 0 ? function (option, active) {
|
|
39
|
+
return option.label;
|
|
40
|
+
} : _props$renderOption,
|
|
41
|
+
_props$padding = props.padding,
|
|
42
|
+
padding = _props$padding === void 0 ? 0 : _props$padding,
|
|
43
|
+
_props$rowKey = props.rowKey,
|
|
44
|
+
rowKey = _props$rowKey === void 0 ? 'value' : _props$rowKey,
|
|
45
|
+
_props$mode = props.mode,
|
|
46
|
+
mode = _props$mode === void 0 ? 'multiple' : _props$mode,
|
|
47
|
+
_props$iconPosition = props.iconPosition,
|
|
48
|
+
iconPosition = _props$iconPosition === void 0 ? 'left' : _props$iconPosition,
|
|
49
|
+
optionClassName = props.optionClassName,
|
|
50
|
+
optionActiveClassName = props.optionActiveClassName,
|
|
51
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
52
|
+
var _useState = useState([]),
|
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
+
_value = _useState2[0],
|
|
55
|
+
set_value = _useState2[1];
|
|
56
|
+
|
|
57
|
+
// 当value 发生变化时, 将外部value 处理成内部value
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
initValue();
|
|
60
|
+
}, [value]);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @title: 转换value到内部
|
|
64
|
+
* @description:
|
|
65
|
+
* @return {*}
|
|
66
|
+
* @Author: zhiwei.Wang
|
|
67
|
+
* @Date: 2024-01-30 16:45
|
|
68
|
+
*/
|
|
69
|
+
var initValue = function initValue() {
|
|
70
|
+
var _val = value;
|
|
71
|
+
if (!value) {
|
|
72
|
+
_val = [];
|
|
73
|
+
} else {
|
|
74
|
+
if (!Array.isArray(value)) {
|
|
75
|
+
_val = [value];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
set_value(_val);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// 样式
|
|
82
|
+
var _style = useMemo(function () {
|
|
83
|
+
var gapVal = isNumber(gap) ? gap + 'px' : gap;
|
|
84
|
+
var paddingVal = isNumber(padding) ? padding + 'px' : padding;
|
|
85
|
+
var obj = _objectSpread({
|
|
86
|
+
gap: gapVal,
|
|
87
|
+
padding: paddingVal
|
|
88
|
+
}, style);
|
|
89
|
+
return obj;
|
|
90
|
+
}, [style, gap, padding]);
|
|
91
|
+
useEffect(function () {
|
|
92
|
+
document.body.id = 'body';
|
|
93
|
+
}, []);
|
|
94
|
+
var _onChange = function _onChange(val) {
|
|
95
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(mode === 'single' ? val[0] : val);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @title: 选择
|
|
100
|
+
* @description:
|
|
101
|
+
* @param {any} item
|
|
102
|
+
* @return {*}
|
|
103
|
+
* @Author: zhiwei.Wang
|
|
104
|
+
* @Date: 2024-01-30 16:46
|
|
105
|
+
*/
|
|
106
|
+
var handleSelectItem = function handleSelectItem(item) {
|
|
107
|
+
var newVal = [item];
|
|
108
|
+
if (mode === 'multiple') {
|
|
109
|
+
newVal = changeArray(_value, item, 'this');
|
|
110
|
+
}
|
|
111
|
+
_onChange(newVal);
|
|
112
|
+
set_value(newVal);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// 根据mode 切换不同的组件
|
|
116
|
+
var CheckBoxItem = mode === 'multiple' ? Checkbox : Radio;
|
|
117
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
118
|
+
className: classNames('pisell-checkbox-group', rest.className),
|
|
119
|
+
style: _style
|
|
120
|
+
}), options.map(function (option) {
|
|
121
|
+
var active = _value.includes(option[rowKey]);
|
|
122
|
+
return /*#__PURE__*/React.createElement(PisellRow, {
|
|
123
|
+
className: classNames('pisell-checkbox-group-item', optionClassName, _defineProperty({
|
|
124
|
+
'pisell-checkbox-group-item-active': active
|
|
125
|
+
}, optionActiveClassName, active)),
|
|
126
|
+
key: option[rowKey],
|
|
127
|
+
gap: 10,
|
|
128
|
+
onClick: function onClick() {
|
|
129
|
+
handleSelectItem(option[rowKey]);
|
|
130
|
+
},
|
|
131
|
+
leftContent: iconPosition === 'left' && /*#__PURE__*/React.createElement(CheckBoxItem, {
|
|
132
|
+
checked: active,
|
|
133
|
+
className: "pisell-checkbox-group-item-checkbox"
|
|
134
|
+
}),
|
|
135
|
+
rightContent: iconPosition === 'right' && /*#__PURE__*/React.createElement(CheckBoxItem, {
|
|
136
|
+
checked: active,
|
|
137
|
+
className: "pisell-checkbox-group-item-checkbox"
|
|
138
|
+
}),
|
|
139
|
+
centerContent: renderOption === null || renderOption === void 0 ? void 0 : renderOption(option, active),
|
|
140
|
+
centerContentFill: true
|
|
141
|
+
});
|
|
142
|
+
}));
|
|
143
|
+
};
|
|
144
|
+
export default PisellCheckboxGroup;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.pisell-checkbox-group {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
|
|
6
|
+
.pisell-checkbox-group-item {
|
|
7
|
+
width: 100%;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
border-radius: 12px;
|
|
10
|
+
position: relative;
|
|
11
|
+
|
|
12
|
+
&::before {
|
|
13
|
+
content: '';
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
border-radius: 12px;
|
|
20
|
+
border: 1px solid var(--Gray-200, #EAECF0);
|
|
21
|
+
z-index: 2;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.pisell-checkbox-group-item-active {
|
|
25
|
+
&::before {
|
|
26
|
+
border-width: 2px;
|
|
27
|
+
border-color: var(--theme-color);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.pisell-checkbox-group-item-checkbox {
|
|
35
|
+
margin: 0;
|
|
36
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PisellContextType } from "../../../pisell-config-provider/context";
|
|
3
|
+
export interface PortalProps {
|
|
4
|
+
/** 平台 */
|
|
5
|
+
platform?: PisellContextType['platform'];
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
container: HTMLElement | null;
|
|
8
|
+
}
|
|
9
|
+
declare const Portal: React.FC<PortalProps>;
|
|
10
|
+
export default Portal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const containers: Record<string, any>;
|