@pisell/materials 1.0.922 → 1.0.924
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 +1 -1
- package/build/lowcode/preview.js +164 -148
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +48 -19
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +55 -26
- package/es/components/auto-complete-number/index.d.ts +0 -1
- package/es/components/badge/index.d.ts +0 -1
- package/es/components/batch-editor/fields/index.d.ts +0 -1
- package/es/components/calendar/index.d.ts +0 -1
- package/es/components/checkbox/index.d.ts +0 -1
- package/es/components/classicLayout/index.d.ts +0 -1
- package/es/components/colorPicker/index.d.ts +0 -1
- package/es/components/config-provider/index.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/ColorPicker/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/IconSelect/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Translation/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +199 -19
- package/es/components/dataSourceComponents/fields/Upload/CameraPopover.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Upload/CameraPopover.js +66 -0
- package/es/components/dataSourceComponents/fields/Upload/index.less +35 -3
- package/es/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/index.d.ts +7 -7
- package/es/components/date-picker/index.d.ts +0 -1
- package/es/components/dropdown/index.d.ts +0 -1
- package/es/components/filter/components/items/index.d.ts +0 -1
- package/es/components/filter/components/items/text/Editor/index.d.ts +0 -1
- package/es/components/filter/components/items/text/Preview/index.d.ts +0 -1
- package/es/components/filter/components/items/text/index.d.ts +0 -1
- package/es/components/iconfont/index.d.ts +8 -0
- package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +0 -1
- package/es/components/pisellCamera/index.d.ts +4 -0
- package/es/components/pisellCamera/index.js +219 -0
- package/es/components/pisellCamera/index.less +120 -0
- package/es/components/pisellCard/index.d.ts +0 -1
- package/es/components/pisellDatePicker/index.d.ts +0 -1
- package/es/components/pisellLoading/index.d.ts +0 -1
- package/es/components/pisellModal/components/IpadModal/index.d.ts +0 -1
- package/es/components/pisellModal/components/MobileModal/index.d.ts +0 -1
- package/es/components/pisellModal/components/index.d.ts +0 -1
- package/es/components/pisellToast/index.d.ts +1 -0
- package/es/components/pisellToast/index.js +1 -0
- package/es/components/pisellToast/squareToast/index.d.ts +25 -0
- package/es/components/pisellToast/squareToast/index.js +110 -0
- package/es/components/pisellToast/squareToast/index.less +71 -0
- package/es/components/pisellToast/squareToast/useToast.d.ts +39 -0
- package/es/components/pisellToast/squareToast/useToast.js +145 -0
- package/es/components/pisellUpload/index.d.ts +0 -1
- package/es/components/productCard/components/Divider/index.d.ts +0 -1
- package/es/components/productCard/components/MultiDay/index.d.ts +0 -1
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +0 -1
- package/es/components/productCard/components/Packages/components/options/index.d.ts +0 -1
- package/es/components/productCard/components/Time/components/Like/index.d.ts +0 -1
- package/es/components/radio/index.d.ts +0 -1
- package/es/components/segmented/index.d.ts +0 -1
- package/es/components/select-time/RightPanel/index.d.ts +0 -1
- package/es/components/skeleton/index.d.ts +0 -1
- package/es/components/slider/index.d.ts +0 -1
- package/es/components/sort/components/InlineMenu/index.d.ts +0 -1
- package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/es/components/table/Summary/index.d.ts +0 -1
- package/es/components/table/Table/SelectField/index.d.ts +0 -1
- package/es/components/table/Table/fields/date/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/date/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/date/index.d.ts +0 -1
- package/es/components/table/Table/fields/image/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/image/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/image/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/image/index.d.ts +0 -1
- package/es/components/table/Table/fields/index.d.ts +0 -1
- package/es/components/table/Table/fields/link/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/link/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/link/index.d.ts +0 -1
- package/es/components/table/Table/fields/number/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/number/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/number/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/number/index.d.ts +0 -1
- package/es/components/table/Table/fields/numberRange/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/numberRange/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/numberRange/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/numberRange/index.d.ts +0 -1
- package/es/components/table/Table/fields/oldRangePicker/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/oldRangePicker/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/oldRangePicker/index.d.ts +0 -1
- package/es/components/table/Table/fields/pSwitch/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/pSwitch/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/pSwitch/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/pSwitch/index.d.ts +0 -1
- package/es/components/table/Table/fields/rangePicker/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/rangePicker/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/rangePicker/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/rangePicker/index.d.ts +0 -1
- package/es/components/table/Table/fields/search/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/search/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/search/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/search/index.d.ts +0 -1
- package/es/components/table/Table/fields/select/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/select/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/select/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/fields/select/index.d.ts +0 -1
- package/es/components/table/Table/fields/text/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/text/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/text/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/text/index.d.ts +0 -1
- package/es/components/table/Table/fields/treeSelect/Config/index.d.ts +0 -1
- package/es/components/table/Table/fields/treeSelect/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/treeSelect/Sort/index.d.ts +0 -1
- package/es/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/fields/treeSelect/index.d.ts +0 -1
- package/es/components/table/Table/tableConfig/summary/index.d.ts +0 -1
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/components/table/TableFilter/SortIcon.d.ts +0 -1
- package/es/components/time-picker/index.d.ts +0 -1
- package/es/components/upload/index.d.ts +0 -1
- package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +0 -1
- package/es/components/virtual-keyboard/Time/utils.d.ts +0 -1
- package/es/components/walletCard/Guest/index.d.ts +0 -1
- package/es/components/walletCard/Guide/index.d.ts +0 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/locales/en-US.d.ts +10 -0
- package/es/locales/en-US.js +13 -1
- package/es/locales/zh-CN.d.ts +10 -0
- package/es/locales/zh-CN.js +13 -1
- package/es/locales/zh-TW.d.ts +10 -0
- package/es/locales/zh-TW.js +13 -1
- package/es/utils/index.d.ts +1 -1
- package/lib/components/auto-complete-number/index.d.ts +0 -1
- package/lib/components/badge/index.d.ts +0 -1
- package/lib/components/batch-editor/fields/index.d.ts +0 -1
- package/lib/components/calendar/index.d.ts +0 -1
- package/lib/components/checkbox/index.d.ts +0 -1
- package/lib/components/classicLayout/index.d.ts +0 -1
- package/lib/components/colorPicker/index.d.ts +0 -1
- package/lib/components/config-provider/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/ColorPicker/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/IconSelect/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Translation/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +168 -5
- package/lib/components/dataSourceComponents/fields/Upload/CameraPopover.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Upload/CameraPopover.js +95 -0
- package/lib/components/dataSourceComponents/fields/Upload/index.less +35 -3
- package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/index.d.ts +7 -7
- package/lib/components/date-picker/index.d.ts +0 -1
- package/lib/components/dropdown/index.d.ts +0 -1
- package/lib/components/filter/components/items/index.d.ts +0 -1
- package/lib/components/filter/components/items/text/Editor/index.d.ts +0 -1
- package/lib/components/filter/components/items/text/Preview/index.d.ts +0 -1
- package/lib/components/filter/components/items/text/index.d.ts +0 -1
- package/lib/components/iconfont/index.d.ts +8 -0
- package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +0 -1
- package/lib/components/pisellCamera/index.d.ts +4 -0
- package/lib/components/pisellCamera/index.js +219 -0
- package/lib/components/pisellCamera/index.less +120 -0
- package/lib/components/pisellCard/index.d.ts +0 -1
- package/lib/components/pisellDatePicker/index.d.ts +0 -1
- package/lib/components/pisellLoading/index.d.ts +0 -1
- package/lib/components/pisellModal/components/IpadModal/index.d.ts +0 -1
- package/lib/components/pisellModal/components/MobileModal/index.d.ts +0 -1
- package/lib/components/pisellModal/components/index.d.ts +0 -1
- package/lib/components/pisellToast/index.d.ts +1 -0
- package/lib/components/pisellToast/index.js +7 -1
- package/lib/components/pisellToast/squareToast/index.d.ts +25 -0
- package/lib/components/pisellToast/squareToast/index.js +121 -0
- package/lib/components/pisellToast/squareToast/index.less +71 -0
- package/lib/components/pisellToast/squareToast/useToast.d.ts +39 -0
- package/lib/components/pisellToast/squareToast/useToast.js +148 -0
- package/lib/components/pisellUpload/index.d.ts +0 -1
- package/lib/components/productCard/components/Divider/index.d.ts +0 -1
- package/lib/components/productCard/components/MultiDay/index.d.ts +0 -1
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +0 -1
- package/lib/components/productCard/components/Packages/components/options/index.d.ts +0 -1
- package/lib/components/productCard/components/Time/components/Like/index.d.ts +0 -1
- package/lib/components/radio/index.d.ts +0 -1
- package/lib/components/segmented/index.d.ts +0 -1
- package/lib/components/select-time/RightPanel/index.d.ts +0 -1
- package/lib/components/skeleton/index.d.ts +0 -1
- package/lib/components/slider/index.d.ts +0 -1
- package/lib/components/sort/components/InlineMenu/index.d.ts +0 -1
- package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/lib/components/table/Summary/index.d.ts +0 -1
- package/lib/components/table/Table/SelectField/index.d.ts +0 -1
- package/lib/components/table/Table/fields/date/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/date/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/date/index.d.ts +0 -1
- package/lib/components/table/Table/fields/image/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/image/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/image/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/image/index.d.ts +0 -1
- package/lib/components/table/Table/fields/index.d.ts +0 -1
- package/lib/components/table/Table/fields/link/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/link/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/link/index.d.ts +0 -1
- package/lib/components/table/Table/fields/number/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/number/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/number/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/number/index.d.ts +0 -1
- package/lib/components/table/Table/fields/numberRange/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/numberRange/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/numberRange/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/numberRange/index.d.ts +0 -1
- package/lib/components/table/Table/fields/oldRangePicker/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/oldRangePicker/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/oldRangePicker/index.d.ts +0 -1
- package/lib/components/table/Table/fields/pSwitch/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/pSwitch/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/pSwitch/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/pSwitch/index.d.ts +0 -1
- package/lib/components/table/Table/fields/rangePicker/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/rangePicker/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/rangePicker/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/rangePicker/index.d.ts +0 -1
- package/lib/components/table/Table/fields/search/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/search/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/search/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/search/index.d.ts +0 -1
- package/lib/components/table/Table/fields/select/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/select/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/select/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/fields/select/index.d.ts +0 -1
- package/lib/components/table/Table/fields/text/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/text/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/text/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/text/index.d.ts +0 -1
- package/lib/components/table/Table/fields/treeSelect/Config/index.d.ts +0 -1
- package/lib/components/table/Table/fields/treeSelect/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/treeSelect/Sort/index.d.ts +0 -1
- package/lib/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/fields/treeSelect/index.d.ts +0 -1
- package/lib/components/table/Table/tableConfig/summary/index.d.ts +0 -1
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/components/table/TableFilter/SortIcon.d.ts +0 -1
- package/lib/components/time-picker/index.d.ts +0 -1
- package/lib/components/upload/index.d.ts +0 -1
- package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +0 -1
- package/lib/components/virtual-keyboard/Time/utils.d.ts +0 -1
- package/lib/components/walletCard/Guest/index.d.ts +0 -1
- package/lib/components/walletCard/Guide/index.d.ts +0 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -0
- package/lib/locales/en-US.d.ts +10 -0
- package/lib/locales/en-US.js +13 -1
- package/lib/locales/zh-CN.d.ts +10 -0
- package/lib/locales/zh-CN.js +13 -1
- package/lib/locales/zh-TW.d.ts +10 -0
- package/lib/locales/zh-TW.js +13 -1
- package/lib/utils/index.d.ts +1 -1
- package/lowcode/form-item-upload/meta.ts +20 -5
- package/package.json +2 -1
|
@@ -59,11 +59,7 @@ declare const formFieldMap: {
|
|
|
59
59
|
FormItemTranslation: import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
60
60
|
FormItemIconSelect: import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
61
61
|
};
|
|
62
|
-
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<import("./
|
|
63
|
-
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
64
|
-
} & {
|
|
65
|
-
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
66
|
-
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
|
|
62
|
+
declare const getFieldComponent: (fieldComponent: string) => (import("react").FC<import("./Input/type").InputProps> & {
|
|
67
63
|
JSON: import("react").FC<any>;
|
|
68
64
|
Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
69
65
|
TextArea: import("react").FC<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
@@ -83,7 +79,11 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
83
79
|
name?: string | undefined;
|
|
84
80
|
fieldKey?: string | undefined;
|
|
85
81
|
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
86
|
-
}) | (import("react").FC<{}> & {
|
|
82
|
+
}) | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<{}> & {
|
|
83
|
+
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
84
|
+
} & {
|
|
85
|
+
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
86
|
+
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<{}> & {
|
|
87
87
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
88
88
|
} & {
|
|
89
89
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -97,5 +97,5 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
97
97
|
dataSource?: any;
|
|
98
98
|
}) => JSX.Element) | import("react").FC<any> | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
|
|
99
99
|
onChange: (value: string) => void;
|
|
100
|
-
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./
|
|
100
|
+
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
101
101
|
export { getFieldComponent, formFieldMap };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IconComponentProps } from '@ant-design/icons/es/components/Icon';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface IconFontProps extends IconComponentProps {
|
|
4
|
+
type: string;
|
|
5
|
+
onClick?: React.MouseEventHandler<HTMLSpanElement>;
|
|
6
|
+
}
|
|
7
|
+
declare const IconFont: React.FC<IconFontProps>;
|
|
8
|
+
export default IconFont;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
8
|
+
import { Camera } from 'react-camera-pro';
|
|
9
|
+
import { getText } from "../../locales";
|
|
10
|
+
import PisellModal from "../../components/pisellModal";
|
|
11
|
+
import "./index.less";
|
|
12
|
+
var PisellCamera = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
13
|
+
var cameraRef = useRef(null);
|
|
14
|
+
var _useState = useState(false),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
open = _useState2[0],
|
|
17
|
+
setOpen = _useState2[1];
|
|
18
|
+
var _useState3 = useState(''),
|
|
19
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
|
+
photo = _useState4[0],
|
|
21
|
+
setPhoto = _useState4[1];
|
|
22
|
+
var _useState5 = useState(null),
|
|
23
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
24
|
+
cameraAvailable = _useState6[0],
|
|
25
|
+
setCameraAvailable = _useState6[1]; // null: 检测中, true: 可用, false: 不可用
|
|
26
|
+
var uploadFileRef = useRef(null);
|
|
27
|
+
|
|
28
|
+
// Base64转File对象
|
|
29
|
+
var base64ToFile = function base64ToFile(base64String, filename) {
|
|
30
|
+
var _arr$0$match;
|
|
31
|
+
var arr = base64String.split(',');
|
|
32
|
+
var mime = ((_arr$0$match = arr[0].match(/:(.*?);/)) === null || _arr$0$match === void 0 ? void 0 : _arr$0$match[1]) || '';
|
|
33
|
+
var bstr = atob(arr[1]);
|
|
34
|
+
var n = bstr.length;
|
|
35
|
+
var u8arr = new Uint8Array(n);
|
|
36
|
+
while (n--) {
|
|
37
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
38
|
+
}
|
|
39
|
+
return new File([u8arr], filename, {
|
|
40
|
+
type: mime
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// 拍照并添加到fileList
|
|
45
|
+
var takePhoto = function takePhoto() {
|
|
46
|
+
if (!cameraRef.current || !cameraRef.current.takePhoto) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
var _cameraRef$current, _cameraRef$current$ta;
|
|
51
|
+
var _photo = (_cameraRef$current = cameraRef.current) === null || _cameraRef$current === void 0 || (_cameraRef$current$ta = _cameraRef$current.takePhoto) === null || _cameraRef$current$ta === void 0 ? void 0 : _cameraRef$current$ta.call(_cameraRef$current);
|
|
52
|
+
var timestamp = Date.now();
|
|
53
|
+
var filename = "photo-".concat(timestamp, ".jpg");
|
|
54
|
+
setPhoto(_photo);
|
|
55
|
+
|
|
56
|
+
// 转换为File对象
|
|
57
|
+
var file = base64ToFile(_photo, filename);
|
|
58
|
+
|
|
59
|
+
// 创建符合Antd Upload格式的文件对象
|
|
60
|
+
var uploadFile = {
|
|
61
|
+
uid: timestamp.toString(),
|
|
62
|
+
name: filename,
|
|
63
|
+
status: 'uploading',
|
|
64
|
+
url: _photo,
|
|
65
|
+
// 用于预览
|
|
66
|
+
originFileObj: file,
|
|
67
|
+
// 原始文件对象,用于上传
|
|
68
|
+
thumbUrl: _photo,
|
|
69
|
+
lastModified: Date.now(),
|
|
70
|
+
lastModifiedDate: new Date(),
|
|
71
|
+
type: 'image/jpeg',
|
|
72
|
+
size: file.size
|
|
73
|
+
};
|
|
74
|
+
console.log('takePhoto_uploadFile', uploadFile);
|
|
75
|
+
uploadFileRef.current = uploadFile;
|
|
76
|
+
return uploadFile;
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error('takePhoto_error', error);
|
|
79
|
+
uploadFileRef.current = null;
|
|
80
|
+
setPhoto('');
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var onOpen = function onOpen() {
|
|
85
|
+
setCameraAvailable(null);
|
|
86
|
+
setPhoto('');
|
|
87
|
+
uploadFileRef.current = null;
|
|
88
|
+
setOpen(true);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// 关闭相机弹窗,重置状态
|
|
92
|
+
var onClose = function onClose() {
|
|
93
|
+
cameraRef.current = null;
|
|
94
|
+
uploadFileRef.current = null;
|
|
95
|
+
setOpen(false);
|
|
96
|
+
setPhoto('');
|
|
97
|
+
setCameraAvailable(null);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// 重拍照片
|
|
101
|
+
var onRetakePhoto = function onRetakePhoto() {
|
|
102
|
+
setPhoto('');
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// 使用照片
|
|
106
|
+
var onUsePhoto = function onUsePhoto() {
|
|
107
|
+
var _props$onChange;
|
|
108
|
+
props === null || props === void 0 || (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, uploadFileRef.current);
|
|
109
|
+
onClose();
|
|
110
|
+
};
|
|
111
|
+
useImperativeHandle(ref, function () {
|
|
112
|
+
return {
|
|
113
|
+
open: onOpen,
|
|
114
|
+
takePhoto: takePhoto,
|
|
115
|
+
isCameraAvailable: function isCameraAvailable() {
|
|
116
|
+
return cameraAvailable;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
console.log('cameraAvailable', cameraAvailable);
|
|
121
|
+
return /*#__PURE__*/React.createElement(PisellModal, {
|
|
122
|
+
open: open,
|
|
123
|
+
onCancel: function onCancel(e) {
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
onClose();
|
|
127
|
+
},
|
|
128
|
+
header: false,
|
|
129
|
+
footer: null,
|
|
130
|
+
destroyOnClose: true,
|
|
131
|
+
bodyStyle: {
|
|
132
|
+
padding: 0
|
|
133
|
+
},
|
|
134
|
+
width: '90vw',
|
|
135
|
+
className: "pisell-camera-modal"
|
|
136
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
className: "pisell-camera-container",
|
|
138
|
+
onClick: function onClick(e) {
|
|
139
|
+
e.stopPropagation();
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
}
|
|
142
|
+
}, cameraAvailable === null ?
|
|
143
|
+
/*#__PURE__*/
|
|
144
|
+
// 检测中
|
|
145
|
+
React.createElement("div", {
|
|
146
|
+
className: "pisell-camera-loading"
|
|
147
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
className: "pisell-camera-loading-text"
|
|
149
|
+
}, getText('pisell-camera-checking'))) : cameraAvailable === false ?
|
|
150
|
+
/*#__PURE__*/
|
|
151
|
+
// 无摄像头
|
|
152
|
+
React.createElement("div", {
|
|
153
|
+
className: "pisell-camera-no-camera"
|
|
154
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
className: "pisell-camera-no-camera-icon"
|
|
156
|
+
}, "\uD83D\uDCF7"), /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: "pisell-camera-no-camera-text"
|
|
158
|
+
}, getText('pisell-camera-no-camera-accessible')), /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: "pisell-camera-no-camera-desc"
|
|
160
|
+
}, getText('pisell-camera-no-camera-desc'))) : null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Camera, {
|
|
161
|
+
ref: cameraRef,
|
|
162
|
+
errorMessages: {
|
|
163
|
+
// noCameraAccessible: getText('pisell-camera-no-camera-accessible'),
|
|
164
|
+
// permissionDenied: getText('pisell-camera-permission-denied'),
|
|
165
|
+
// switchCamera: getText('pisell-camera-switch-camera'),
|
|
166
|
+
// canvas: getText('pisell-camera-canvas'),
|
|
167
|
+
},
|
|
168
|
+
numberOfCamerasCallback: function numberOfCamerasCallback(numberOfCameras) {
|
|
169
|
+
console.log('numberOfCameras', numberOfCameras);
|
|
170
|
+
if (!cameraRef.current) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (numberOfCameras <= 0) {
|
|
174
|
+
setTimeout(function () {
|
|
175
|
+
setCameraAvailable(function (pre) {
|
|
176
|
+
if (pre === true) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
return false;
|
|
180
|
+
});
|
|
181
|
+
}, 5000);
|
|
182
|
+
} else {
|
|
183
|
+
setCameraAvailable(true);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}), cameraAvailable === true && /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
className: "pisell-camera-action"
|
|
188
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
189
|
+
className: "pisell-camera-action-item",
|
|
190
|
+
onClick: function onClick(e) {
|
|
191
|
+
e.stopPropagation();
|
|
192
|
+
e.preventDefault();
|
|
193
|
+
takePhoto();
|
|
194
|
+
}
|
|
195
|
+
})), photo && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
196
|
+
className: "pisell-camera-photo-container"
|
|
197
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
198
|
+
src: photo,
|
|
199
|
+
alt: "photo",
|
|
200
|
+
className: "pisell-camera-photo"
|
|
201
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
202
|
+
className: "pisell-camera-photo-img-action"
|
|
203
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
204
|
+
className: "pisell-camera-photo-img-action-item",
|
|
205
|
+
onClick: function onClick(e) {
|
|
206
|
+
e.stopPropagation();
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
onRetakePhoto();
|
|
209
|
+
}
|
|
210
|
+
}, getText('pisell-upload-camera-retake')), /*#__PURE__*/React.createElement("div", {
|
|
211
|
+
className: "pisell-camera-photo-img-action-item",
|
|
212
|
+
onClick: function onClick(e) {
|
|
213
|
+
e.stopPropagation();
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
onUsePhoto();
|
|
216
|
+
}
|
|
217
|
+
}, getText('pisell-upload-camera-use')))))));
|
|
218
|
+
});
|
|
219
|
+
export default PisellCamera;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
.pisell-camera-modal {
|
|
2
|
+
.pisell-camera-container {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 90vh;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
|
|
10
|
+
.pisell-camera-action {
|
|
11
|
+
position: absolute;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
right: 0;
|
|
15
|
+
height: 100px;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
|
|
20
|
+
.pisell-camera-action-item {
|
|
21
|
+
width: 60px;
|
|
22
|
+
height: 60px;
|
|
23
|
+
background-color: #fff;
|
|
24
|
+
border-radius: 60px;
|
|
25
|
+
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.pisell-camera-photo-container {
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0;
|
|
33
|
+
left: 0;
|
|
34
|
+
right: 0;
|
|
35
|
+
bottom: 0;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
|
|
39
|
+
.pisell-camera-photo {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
object-fit: cover;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
.pisell-camera-photo-img-action {
|
|
46
|
+
position: absolute;
|
|
47
|
+
bottom: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
height: 100px;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
56
|
+
|
|
57
|
+
.pisell-camera-photo-img-action-item {
|
|
58
|
+
padding: 20px 60px;
|
|
59
|
+
font-size: 20px;
|
|
60
|
+
color: #fff;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.pisell-camera-loading {
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 0;
|
|
68
|
+
left: 0;
|
|
69
|
+
right: 0;
|
|
70
|
+
bottom: 0;
|
|
71
|
+
background-color: transparent;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
|
|
76
|
+
.pisell-camera-loading-text {
|
|
77
|
+
font-size: 18px;
|
|
78
|
+
color: #666;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.pisell-camera-no-camera {
|
|
83
|
+
position: absolute;
|
|
84
|
+
top: 0;
|
|
85
|
+
left: 0;
|
|
86
|
+
right: 0;
|
|
87
|
+
bottom: 0;
|
|
88
|
+
background-color: #ffffff;
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 100%;
|
|
95
|
+
background-color: #f5f5f5;
|
|
96
|
+
padding: 40px;
|
|
97
|
+
text-align: center;
|
|
98
|
+
|
|
99
|
+
.pisell-camera-no-camera-icon {
|
|
100
|
+
font-size: 64px;
|
|
101
|
+
margin-bottom: 20px;
|
|
102
|
+
opacity: 0.6;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.pisell-camera-no-camera-text {
|
|
106
|
+
font-size: 20px;
|
|
107
|
+
color: #333;
|
|
108
|
+
margin-bottom: 12px;
|
|
109
|
+
font-weight: 500;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.pisell-camera-no-camera-desc {
|
|
113
|
+
font-size: 14px;
|
|
114
|
+
color: #666;
|
|
115
|
+
line-height: 1.5;
|
|
116
|
+
max-width: 300px;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export declare type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading';
|
|
4
|
+
export interface ToastProps {
|
|
5
|
+
/** Toast 类型 */
|
|
6
|
+
type?: ToastType;
|
|
7
|
+
/** 显示的内容,支持文本或 React 节点 */
|
|
8
|
+
message: React.ReactNode;
|
|
9
|
+
/** 是否显示 */
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
/** 自动关闭时间,单位毫秒,0 表示不自动关闭 */
|
|
12
|
+
duration?: number;
|
|
13
|
+
/** 关闭回调 */
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
/** 自定义图标 */
|
|
16
|
+
icon?: React.ReactNode;
|
|
17
|
+
/** 自定义样式类名 */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** 自定义样式 */
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
/** 是否显示遮罩 */
|
|
22
|
+
mask?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const Toast: React.FC<ToastProps>;
|
|
25
|
+
export default Toast;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
14
|
+
import Modal from "../../modal";
|
|
15
|
+
import Icon from "../../icon";
|
|
16
|
+
import classNames from 'classnames';
|
|
17
|
+
import "./index.less";
|
|
18
|
+
var icons = {
|
|
19
|
+
info: '',
|
|
20
|
+
success: 'iconchenggong-1-01',
|
|
21
|
+
error: 'icon-warning',
|
|
22
|
+
warning: 'icon-warning',
|
|
23
|
+
loading: 'icon-loading',
|
|
24
|
+
fail: 'icon-warning'
|
|
25
|
+
};
|
|
26
|
+
var Toast = function Toast(_ref) {
|
|
27
|
+
var _ref$type = _ref.type,
|
|
28
|
+
type = _ref$type === void 0 ? 'info' : _ref$type,
|
|
29
|
+
message = _ref.message,
|
|
30
|
+
_ref$visible = _ref.visible,
|
|
31
|
+
visible = _ref$visible === void 0 ? false : _ref$visible,
|
|
32
|
+
_ref$duration = _ref.duration,
|
|
33
|
+
duration = _ref$duration === void 0 ? 2000 : _ref$duration,
|
|
34
|
+
onClose = _ref.onClose,
|
|
35
|
+
icon = _ref.icon,
|
|
36
|
+
className = _ref.className,
|
|
37
|
+
_ref$mask = _ref.mask,
|
|
38
|
+
mask = _ref$mask === void 0 ? false : _ref$mask,
|
|
39
|
+
style = _ref.style;
|
|
40
|
+
var _useState = useState(visible),
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
internalVisible = _useState2[0],
|
|
43
|
+
setInternalVisible = _useState2[1];
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
setInternalVisible(visible);
|
|
46
|
+
}, [visible]);
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
if (internalVisible && duration > 0) {
|
|
49
|
+
var timer = setTimeout(function () {
|
|
50
|
+
handleClose();
|
|
51
|
+
}, duration);
|
|
52
|
+
return function () {
|
|
53
|
+
return clearTimeout(timer);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}, [internalVisible, duration]);
|
|
57
|
+
var handleClose = function handleClose() {
|
|
58
|
+
setInternalVisible(false);
|
|
59
|
+
onClose === null || onClose === void 0 || onClose();
|
|
60
|
+
};
|
|
61
|
+
var showIcon = useMemo(function () {
|
|
62
|
+
return icon !== undefined || icons[type];
|
|
63
|
+
}, [type, icon]);
|
|
64
|
+
var renderIcon = function renderIcon() {
|
|
65
|
+
if (icon !== undefined) {
|
|
66
|
+
return icon;
|
|
67
|
+
}
|
|
68
|
+
var iconType = icons[type];
|
|
69
|
+
if (iconType) {
|
|
70
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
71
|
+
type: iconType,
|
|
72
|
+
className: "pisell-square-toast-icon pisell-square-toast-icon-".concat(type)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
};
|
|
77
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
78
|
+
open: visible,
|
|
79
|
+
footer: null,
|
|
80
|
+
closable: false,
|
|
81
|
+
centered: true,
|
|
82
|
+
maskTransitionName: "",
|
|
83
|
+
transitionName: "",
|
|
84
|
+
getContainer: function getContainer() {
|
|
85
|
+
return document.body;
|
|
86
|
+
},
|
|
87
|
+
wrapClassName: "pisell-square-toast-wrap",
|
|
88
|
+
className: classNames('pisell-square-toast-modal', className),
|
|
89
|
+
width: "auto",
|
|
90
|
+
style: _objectSpread({
|
|
91
|
+
textAlign: 'center'
|
|
92
|
+
}, style),
|
|
93
|
+
bodyStyle: {
|
|
94
|
+
padding: 0
|
|
95
|
+
},
|
|
96
|
+
mask: mask,
|
|
97
|
+
modalRender: function modalRender() {
|
|
98
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: "pisell-square-toast ".concat(type ? "pisell-square-toast-".concat(type) : '')
|
|
100
|
+
}, showIcon && /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "pisell-square-toast-icon-wrapper"
|
|
102
|
+
}, renderIcon()), /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: "pisell-square-toast-content"
|
|
104
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
className: "pisell-square-toast-message"
|
|
106
|
+
}, message)));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
export default Toast;
|