@trionesdev/antd-mobile-base-react 0.0.2-beta.0
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/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/ActionSheet/ActionSheet.d.ts +25 -0
- package/dist/ActionSheet/ActionSheet.js +77 -0
- package/dist/ActionSheet/index.d.ts +3 -0
- package/dist/ActionSheet/index.js +2 -0
- package/dist/ActionSheet/style.scss +51 -0
- package/dist/Alert/alert.d.ts +32 -0
- package/dist/Alert/alert.js +49 -0
- package/dist/Alert/index.d.ts +3 -0
- package/dist/Alert/index.js +2 -0
- package/dist/Alert/style.scss +69 -0
- package/dist/Avatar/avatar.d.ts +14 -0
- package/dist/Avatar/avatar.js +40 -0
- package/dist/Avatar/index.d.ts +3 -0
- package/dist/Avatar/index.js +2 -0
- package/dist/Avatar/style.scss +16 -0
- package/dist/Badge/badge.d.ts +14 -0
- package/dist/Badge/badge.js +82 -0
- package/dist/Badge/index.d.ts +3 -0
- package/dist/Badge/index.js +2 -0
- package/dist/Badge/style.scss +100 -0
- package/dist/Card/card.d.ts +21 -0
- package/dist/Card/card.js +48 -0
- package/dist/Card/index.d.ts +4 -0
- package/dist/Card/index.js +3 -0
- package/dist/Card/native-props.d.ts +8 -0
- package/dist/Card/native-props.js +27 -0
- package/dist/Card/style.scss +35 -0
- package/dist/CascaderPicker/cascader-picker.d.ts +27 -0
- package/dist/CascaderPicker/cascader-picker.js +88 -0
- package/dist/CascaderPicker/index.d.ts +3 -0
- package/dist/CascaderPicker/index.js +2 -0
- package/dist/CascaderPicker/style.scss +42 -0
- package/dist/CascaderView/cascader-column-item.d.ts +8 -0
- package/dist/CascaderView/cascader-column-item.js +19 -0
- package/dist/CascaderView/cascader-column.d.ts +9 -0
- package/dist/CascaderView/cascader-column.js +26 -0
- package/dist/CascaderView/cascader-view.d.ts +18 -0
- package/dist/CascaderView/cascader-view.js +243 -0
- package/dist/CascaderView/index.d.ts +3 -0
- package/dist/CascaderView/index.js +2 -0
- package/dist/CascaderView/style.scss +22 -0
- package/dist/CascaderView/types.d.ts +11 -0
- package/dist/CascaderView/types.js +1 -0
- package/dist/Cell/CellGroup.d.ts +3 -0
- package/dist/Cell/CellGroup.js +41 -0
- package/dist/Cell/cell.d.ts +4 -0
- package/dist/Cell/cell.js +31 -0
- package/dist/Cell/index.d.ts +9 -0
- package/dist/Cell/index.js +5 -0
- package/dist/Cell/styles.scss +52 -0
- package/dist/Cell/types.d.ts +41 -0
- package/dist/Cell/types.js +1 -0
- package/dist/Checkbox/checkbox-button.d.ts +3 -0
- package/dist/Checkbox/checkbox-button.js +42 -0
- package/dist/Checkbox/checkbox-group.d.ts +3 -0
- package/dist/Checkbox/checkbox-group.js +32 -0
- package/dist/Checkbox/checkbox.d.ts +4 -0
- package/dist/Checkbox/checkbox.js +47 -0
- package/dist/Checkbox/group-context.d.ts +3 -0
- package/dist/Checkbox/group-context.js +2 -0
- package/dist/Checkbox/index.d.ts +11 -0
- package/dist/Checkbox/index.js +7 -0
- package/dist/Checkbox/index.scss +151 -0
- package/dist/Checkbox/types.d.ts +20 -0
- package/dist/Checkbox/types.js +1 -0
- package/dist/ConfigProvider/config-provider.d.ts +57 -0
- package/dist/ConfigProvider/config-provider.js +41 -0
- package/dist/ConfigProvider/index.d.ts +9 -0
- package/dist/ConfigProvider/index.js +6 -0
- package/dist/DemoBlock/index.d.ts +10 -0
- package/dist/DemoBlock/index.js +15 -0
- package/dist/DemoBlock/index.scss +20 -0
- package/dist/DemoDescription/index.d.ts +6 -0
- package/dist/DemoDescription/index.js +7 -0
- package/dist/DemoDescription/index.scss +3 -0
- package/dist/Descriptions/DescriptionItem.d.ts +5 -0
- package/dist/Descriptions/DescriptionItem.js +67 -0
- package/dist/Descriptions/Descriptions.d.ts +4 -0
- package/dist/Descriptions/Descriptions.js +229 -0
- package/dist/Descriptions/index.d.ts +9 -0
- package/dist/Descriptions/index.js +5 -0
- package/dist/Descriptions/style.scss +65 -0
- package/dist/Descriptions/types.d.ts +90 -0
- package/dist/Descriptions/types.js +1 -0
- package/dist/Divider/divider.d.ts +17 -0
- package/dist/Divider/divider.js +36 -0
- package/dist/Divider/index.d.ts +3 -0
- package/dist/Divider/index.js +2 -0
- package/dist/Divider/style.scss +62 -0
- package/dist/Ellipsis/ellipsis.d.ts +16 -0
- package/dist/Ellipsis/ellipsis.js +77 -0
- package/dist/Ellipsis/index.d.ts +3 -0
- package/dist/Ellipsis/index.js +2 -0
- package/dist/Ellipsis/style.scss +13 -0
- package/dist/Ellipsis/useMeasure.d.ts +2 -0
- package/dist/Ellipsis/useMeasure.js +123 -0
- package/dist/Empty/empty-icon.d.ts +3 -0
- package/dist/Empty/empty-icon.js +12 -0
- package/dist/Empty/empty.d.ts +12 -0
- package/dist/Empty/empty.js +48 -0
- package/dist/Empty/images/empty.png +0 -0
- package/dist/Empty/index.d.ts +3 -0
- package/dist/Empty/index.js +2 -0
- package/dist/Empty/style.scss +29 -0
- package/dist/ErrorBlock/create-error-block.d.ts +13 -0
- package/dist/ErrorBlock/create-error-block.js +44 -0
- package/dist/ErrorBlock/demo/base.d.ts +3 -0
- package/dist/ErrorBlock/demo/base.js +23 -0
- package/dist/ErrorBlock/error-block.d.ts +2 -0
- package/dist/ErrorBlock/error-block.js +9 -0
- package/dist/ErrorBlock/images/busy.d.ts +2 -0
- package/dist/ErrorBlock/images/busy.js +90 -0
- package/dist/ErrorBlock/images/busy.png +0 -0
- package/dist/ErrorBlock/images/default.d.ts +2 -0
- package/dist/ErrorBlock/images/default.js +166 -0
- package/dist/ErrorBlock/images/default.png +0 -0
- package/dist/ErrorBlock/images/disconnected.d.ts +2 -0
- package/dist/ErrorBlock/images/disconnected.js +123 -0
- package/dist/ErrorBlock/images/disconnected.png +0 -0
- package/dist/ErrorBlock/images/empty.d.ts +2 -0
- package/dist/ErrorBlock/images/empty.js +119 -0
- package/dist/ErrorBlock/images/empty.png +0 -0
- package/dist/ErrorBlock/images/index.d.ts +4 -0
- package/dist/ErrorBlock/images/index.js +4 -0
- package/dist/ErrorBlock/index.d.ts +7 -0
- package/dist/ErrorBlock/index.js +3 -0
- package/dist/ErrorBlock/style.scss +62 -0
- package/dist/Footer/footer.d.ts +20 -0
- package/dist/Footer/footer.js +66 -0
- package/dist/Footer/index.d.ts +3 -0
- package/dist/Footer/index.js +2 -0
- package/dist/Footer/style.scss +55 -0
- package/dist/Form/FormItem/form-item-input.d.ts +15 -0
- package/dist/Form/FormItem/form-item-input.js +39 -0
- package/dist/Form/FormItem/form-item-label.d.ts +13 -0
- package/dist/Form/FormItem/form-item-label.js +25 -0
- package/dist/Form/FormItem/form-item.d.ts +21 -0
- package/dist/Form/FormItem/form-item.js +70 -0
- package/dist/Form/FormItem/index.d.ts +5 -0
- package/dist/Form/FormItem/index.js +3 -0
- package/dist/Form/context.d.ts +12 -0
- package/dist/Form/context.js +6 -0
- package/dist/Form/form.d.ts +44 -0
- package/dist/Form/form.js +31 -0
- package/dist/Form/hooks/useForm.d.ts +2 -0
- package/dist/Form/hooks/useForm.js +24 -0
- package/dist/Form/hooks/useFormContext.d.ts +2 -0
- package/dist/Form/hooks/useFormContext.js +6 -0
- package/dist/Form/index.d.ts +12 -0
- package/dist/Form/index.js +8 -0
- package/dist/Form/interface.d.ts +3 -0
- package/dist/Form/interface.js +1 -0
- package/dist/Form/style.scss +45 -0
- package/dist/Grid/grid.d.ts +16 -0
- package/dist/Grid/grid.js +35 -0
- package/dist/Grid/index.d.ts +7 -0
- package/dist/Grid/index.js +4 -0
- package/dist/Grid/style.scss +17 -0
- package/dist/Icon/check-icon.d.ts +3 -0
- package/dist/Icon/check-icon.js +10 -0
- package/dist/Icon/demo/base.d.ts +6 -0
- package/dist/Icon/demo/base.js +41 -0
- package/dist/Input/base-input.d.ts +14 -0
- package/dist/Input/base-input.js +63 -0
- package/dist/Input/index.d.ts +12 -0
- package/dist/Input/index.js +9 -0
- package/dist/Input/index.scss +173 -0
- package/dist/Input/input-affix-wrapper.d.ts +8 -0
- package/dist/Input/input-affix-wrapper.js +50 -0
- package/dist/Input/input-opt.d.ts +16 -0
- package/dist/Input/input-opt.js +93 -0
- package/dist/Input/input-password.d.ts +7 -0
- package/dist/Input/input-password.js +47 -0
- package/dist/Input/input.d.ts +15 -0
- package/dist/Input/input.js +47 -0
- package/dist/Input/textarea.d.ts +13 -0
- package/dist/Input/textarea.js +45 -0
- package/dist/Input/types.d.ts +1 -0
- package/dist/Input/types.js +1 -0
- package/dist/InputNumber/index.d.ts +3 -0
- package/dist/InputNumber/index.js +2 -0
- package/dist/InputNumber/input-number.d.ts +13 -0
- package/dist/InputNumber/input-number.js +69 -0
- package/dist/InputNumber/style.scss +43 -0
- package/dist/Mask/index.d.ts +3 -0
- package/dist/Mask/index.js +2 -0
- package/dist/Mask/mask-modal.d.ts +45 -0
- package/dist/Mask/mask-modal.js +32 -0
- package/dist/Mask/mask.d.ts +5 -0
- package/dist/Mask/mask.js +19 -0
- package/dist/Mask/style.scss +20 -0
- package/dist/NavBar/index.d.ts +3 -0
- package/dist/NavBar/index.js +2 -0
- package/dist/NavBar/nav-bar.d.ts +31 -0
- package/dist/NavBar/nav-bar.js +36 -0
- package/dist/NavBar/style.scss +61 -0
- package/dist/NoticeBar/index.d.ts +3 -0
- package/dist/NoticeBar/index.js +2 -0
- package/dist/NoticeBar/notice-bar.d.ts +64 -0
- package/dist/NoticeBar/notice-bar.js +119 -0
- package/dist/NoticeBar/style.scss +130 -0
- package/dist/PageIndicator/index.d.ts +3 -0
- package/dist/PageIndicator/index.js +2 -0
- package/dist/PageIndicator/page-indicator.d.ts +10 -0
- package/dist/PageIndicator/page-indicator.js +27 -0
- package/dist/PageIndicator/style.scss +59 -0
- package/dist/Picker/index.d.ts +3 -0
- package/dist/Picker/index.js +2 -0
- package/dist/Picker/picker.d.ts +19 -0
- package/dist/Picker/picker.js +97 -0
- package/dist/Picker/style.scss +41 -0
- package/dist/PickerView/index.d.ts +4 -0
- package/dist/PickerView/index.js +2 -0
- package/dist/PickerView/picker-view-column-item.d.ts +7 -0
- package/dist/PickerView/picker-view-column-item.js +11 -0
- package/dist/PickerView/picker-view-column.d.ts +10 -0
- package/dist/PickerView/picker-view-column.js +117 -0
- package/dist/PickerView/picker-view.d.ts +12 -0
- package/dist/PickerView/picker-view.js +60 -0
- package/dist/PickerView/style.scss +72 -0
- package/dist/PickerView/types.d.ts +4 -0
- package/dist/PickerView/types.js +1 -0
- package/dist/Popup/index.d.ts +3 -0
- package/dist/Popup/index.js +2 -0
- package/dist/Popup/popup-modal.d.ts +52 -0
- package/dist/Popup/popup-modal.js +74 -0
- package/dist/Popup/popup.d.ts +4 -0
- package/dist/Popup/popup.js +56 -0
- package/dist/Popup/style.scss +53 -0
- package/dist/Radio/GroupContext.d.ts +10 -0
- package/dist/Radio/GroupContext.js +2 -0
- package/dist/Radio/RadioButton.d.ts +3 -0
- package/dist/Radio/RadioButton.js +60 -0
- package/dist/Radio/RadioGroup.d.ts +3 -0
- package/dist/Radio/RadioGroup.js +60 -0
- package/dist/Radio/index.d.ts +11 -0
- package/dist/Radio/index.js +14 -0
- package/dist/Radio/radio.d.ts +4 -0
- package/dist/Radio/radio.js +78 -0
- package/dist/Radio/style.scss +138 -0
- package/dist/Radio/types.d.ts +58 -0
- package/dist/Radio/types.js +1 -0
- package/dist/Rate/index.d.ts +3 -0
- package/dist/Rate/index.js +2 -0
- package/dist/Rate/rate.d.ts +50 -0
- package/dist/Rate/rate.js +100 -0
- package/dist/Rate/style.scss +37 -0
- package/dist/Result/demo/base.d.ts +3 -0
- package/dist/Result/demo/base.js +57 -0
- package/dist/Result/index.d.ts +3 -0
- package/dist/Result/index.js +2 -0
- package/dist/Result/result.d.ts +10 -0
- package/dist/Result/result.js +28 -0
- package/dist/Result/style.scss +73 -0
- package/dist/Result/use-result-icon.d.ts +2 -0
- package/dist/Result/use-result-icon.js +53 -0
- package/dist/SafeArea/index.d.ts +4 -0
- package/dist/SafeArea/index.js +3 -0
- package/dist/SafeArea/safe-area.d.ts +14 -0
- package/dist/SafeArea/safe-area.js +23 -0
- package/dist/SafeArea/style.scss +18 -0
- package/dist/Scaffold/index.d.ts +3 -0
- package/dist/Scaffold/index.js +2 -0
- package/dist/Scaffold/scaffold.d.ts +11 -0
- package/dist/Scaffold/scaffold.js +19 -0
- package/dist/Scaffold/style.scss +16 -0
- package/dist/ScrollView/index.d.ts +4 -0
- package/dist/ScrollView/index.js +2 -0
- package/dist/ScrollView/scroll-view.d.ts +4 -0
- package/dist/ScrollView/scroll-view.js +55 -0
- package/dist/ScrollView/style.scss +19 -0
- package/dist/ScrollView/types.d.ts +26 -0
- package/dist/ScrollView/types.js +1 -0
- package/dist/SideBar/SideBarContext.d.ts +18 -0
- package/dist/SideBar/SideBarContext.js +2 -0
- package/dist/SideBar/index.d.ts +3 -0
- package/dist/SideBar/index.js +2 -0
- package/dist/SideBar/side-bar.d.ts +25 -0
- package/dist/SideBar/side-bar.js +351 -0
- package/dist/SideBar/style.scss +85 -0
- package/dist/SideBar/types.d.ts +7 -0
- package/dist/SideBar/types.js +1 -0
- package/dist/Space/index.d.ts +3 -0
- package/dist/Space/index.js +2 -0
- package/dist/Space/space.d.ts +38 -0
- package/dist/Space/space.js +61 -0
- package/dist/Space/style.scss +77 -0
- package/dist/SpinLoading/demo/base.d.ts +3 -0
- package/dist/SpinLoading/demo/base.js +21 -0
- package/dist/SpinLoading/index.d.ts +3 -0
- package/dist/SpinLoading/index.js +2 -0
- package/dist/SpinLoading/spin-loading.d.ts +10 -0
- package/dist/SpinLoading/spin-loading.js +59 -0
- package/dist/SpinLoading/spin-loading.scss +40 -0
- package/dist/Steps/HorizontalSteps.d.ts +3 -0
- package/dist/Steps/HorizontalSteps.js +85 -0
- package/dist/Steps/Point.d.ts +6 -0
- package/dist/Steps/Point.js +13 -0
- package/dist/Steps/Steps.d.ts +4 -0
- package/dist/Steps/Steps.js +26 -0
- package/dist/Steps/VerticalSteps.d.ts +3 -0
- package/dist/Steps/VerticalSteps.js +92 -0
- package/dist/Steps/context.d.ts +8 -0
- package/dist/Steps/context.js +5 -0
- package/dist/Steps/index.d.ts +4 -0
- package/dist/Steps/index.js +2 -0
- package/dist/Steps/style.scss +146 -0
- package/dist/Steps/types.d.ts +23 -0
- package/dist/Steps/types.js +4 -0
- package/dist/Switch/index.d.ts +3 -0
- package/dist/Switch/index.js +2 -0
- package/dist/Switch/style.scss +128 -0
- package/dist/Switch/switch.d.ts +21 -0
- package/dist/Switch/switch.js +96 -0
- package/dist/TabBar/TabBarContext.d.ts +10 -0
- package/dist/TabBar/TabBarContext.js +2 -0
- package/dist/TabBar/demo/base.d.ts +6 -0
- package/dist/TabBar/demo/base.js +26 -0
- package/dist/TabBar/index.d.ts +7 -0
- package/dist/TabBar/index.js +3 -0
- package/dist/TabBar/index.scss +36 -0
- package/dist/TabBar/tab-bar.d.ts +61 -0
- package/dist/TabBar/tab-bar.js +86 -0
- package/dist/Tabs/context.d.ts +11 -0
- package/dist/Tabs/context.js +4 -0
- package/dist/Tabs/demo/base.d.ts +3 -0
- package/dist/Tabs/demo/base.js +59 -0
- package/dist/Tabs/index.d.ts +9 -0
- package/dist/Tabs/index.js +5 -0
- package/dist/Tabs/style.scss +108 -0
- package/dist/Tabs/tab-nav.d.ts +9 -0
- package/dist/Tabs/tab-nav.js +25 -0
- package/dist/Tabs/tab-pane.d.ts +7 -0
- package/dist/Tabs/tab-pane.js +17 -0
- package/dist/Tabs/tab.d.ts +7 -0
- package/dist/Tabs/tab.js +6 -0
- package/dist/Tabs/tabs.d.ts +25 -0
- package/dist/Tabs/tabs.js +156 -0
- package/dist/Tag/demo/base.d.ts +7 -0
- package/dist/Tag/demo/base.js +67 -0
- package/dist/Tag/demo/style.scss +8 -0
- package/dist/Tag/index.d.ts +3 -0
- package/dist/Tag/index.js +2 -0
- package/dist/Tag/style.scss +86 -0
- package/dist/Tag/tag.d.ts +30 -0
- package/dist/Tag/tag.js +44 -0
- package/dist/Toast/index.d.ts +5 -0
- package/dist/Toast/index.js +3 -0
- package/dist/Toast/style.scss +63 -0
- package/dist/Toast/toast-modal.d.ts +18 -0
- package/dist/Toast/toast-modal.js +112 -0
- package/dist/Toast/toast.d.ts +7 -0
- package/dist/Toast/toast.js +78 -0
- package/dist/VerificationCodeInput/demo/base.d.ts +3 -0
- package/dist/VerificationCodeInput/demo/base.js +11 -0
- package/dist/VerificationCodeInput/index.d.ts +3 -0
- package/dist/VerificationCodeInput/index.js +2 -0
- package/dist/VerificationCodeInput/style.scss +20 -0
- package/dist/VerificationCodeInput/verification-code-input.d.ts +24 -0
- package/dist/VerificationCodeInput/verification-code-input.js +99 -0
- package/dist/WaterMark/index.d.ts +3 -0
- package/dist/WaterMark/index.js +2 -0
- package/dist/WaterMark/style.scss +17 -0
- package/dist/WaterMark/water-mark.d.ts +22 -0
- package/dist/WaterMark/water-mark.js +108 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +46 -0
- package/dist/locales/base.d.ts +139 -0
- package/dist/locales/base.js +139 -0
- package/dist/locales/en-US.d.ts +139 -0
- package/dist/locales/en-US.js +4 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +140 -0
- package/dist/style/index.d.ts +1 -0
- package/dist/style/index.js +5 -0
- package/dist/style/style.scss +52 -0
- package/dist/style/theme-dark.scss +24 -0
- package/dist/style/theme-default.scss +54 -0
- package/dist/style/variable.scss +168 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.js +1 -0
- package/dist/utils/datetime-utils.d.ts +3 -0
- package/dist/utils/datetime-utils.js +18 -0
- package/dist/utils/dev-log.d.ts +3 -0
- package/dist/utils/dev-log.js +36 -0
- package/dist/utils/is-dev.d.ts +1 -0
- package/dist/utils/is-dev.js +1 -0
- package/dist/utils/merge-locale.d.ts +1 -0
- package/dist/utils/merge-locale.js +16 -0
- package/dist/utils/native-props.d.ts +10 -0
- package/dist/utils/native-props.js +39 -0
- package/dist/utils/random-utils.d.ts +3 -0
- package/dist/utils/random-utils.js +13 -0
- package/dist/utils/to-css-length.d.ts +1 -0
- package/dist/utils/to-css-length.js +3 -0
- package/dist/utils/type.d.ts +65 -0
- package/dist/utils/type.js +48 -0
- package/dist/utils/with-default-props.d.ts +9 -0
- package/dist/utils/with-default-props.js +33 -0
- package/dist/utils/with-stop-propagation.d.ts +4 -0
- package/dist/utils/with-stop-propagation.js +38 -0
- package/package.json +55 -0
|
@@ -0,0 +1,27 @@
|
|
|
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 _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; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
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); }
|
|
5
|
+
import React, { memo } from 'react';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { withNativeProps } from "../utils/native-props";
|
|
8
|
+
import { mergeProps } from "../utils/with-default-props";
|
|
9
|
+
import "./style.scss";
|
|
10
|
+
var classPrefix = "triones-antm-page-indicator";
|
|
11
|
+
var defaultProps = {
|
|
12
|
+
color: 'primary',
|
|
13
|
+
direction: 'horizontal'
|
|
14
|
+
};
|
|
15
|
+
export var PageIndicator = /*#__PURE__*/memo(function (p) {
|
|
16
|
+
var props = mergeProps(defaultProps, p);
|
|
17
|
+
var dots = [];
|
|
18
|
+
for (var i = 0; i < props.total; i++) {
|
|
19
|
+
dots.push( /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
key: i,
|
|
21
|
+
className: classNames("".concat(classPrefix, "-dot"), _defineProperty({}, "".concat(classPrefix, "-dot-active"), props.current === i))
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
return withNativeProps(props, /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: classNames(classPrefix, "".concat(classPrefix, "-").concat(props.direction), "".concat(classPrefix, "-color-").concat(props.color))
|
|
26
|
+
}, dots));
|
|
27
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* prettier-ignore */
|
|
2
|
+
.triones-antm-page-indicator {
|
|
3
|
+
display: flex;
|
|
4
|
+
width: auto;
|
|
5
|
+
|
|
6
|
+
--dot-color: #ccc;
|
|
7
|
+
--active-dot-color: #1677ff;
|
|
8
|
+
--dot-size: 3PX;
|
|
9
|
+
--active-dot-size: 13PX;
|
|
10
|
+
--dot-border-radius: 1PX;
|
|
11
|
+
--active-dot-border-radius: var(--dot-border-radius);
|
|
12
|
+
--dot-spacing: 3PX;
|
|
13
|
+
|
|
14
|
+
&-dot {
|
|
15
|
+
display: block;
|
|
16
|
+
width: var(--dot-size);
|
|
17
|
+
height: var(--dot-size);
|
|
18
|
+
border-radius: var(--dot-border-radius);
|
|
19
|
+
background: var(--dot-color);
|
|
20
|
+
|
|
21
|
+
&:last-child {
|
|
22
|
+
margin-right: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-active {
|
|
26
|
+
border-radius: var(--active-dot-border-radius);
|
|
27
|
+
background: var(--active-dot-color);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-color-white {
|
|
32
|
+
--dot-color: rgba(255, 255, 255, 50%);
|
|
33
|
+
--active-dot-color: #fff;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&-horizontal {
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
|
|
39
|
+
.triones-antm-page-indicator-dot {
|
|
40
|
+
margin-right: var(--dot-spacing);
|
|
41
|
+
|
|
42
|
+
&-active {
|
|
43
|
+
width: var(--active-dot-size);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&-vertical {
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
|
|
51
|
+
.triones-antm-page-indicator-dot {
|
|
52
|
+
margin-bottom: var(--dot-spacing);
|
|
53
|
+
|
|
54
|
+
&-active {
|
|
55
|
+
height: var(--active-dot-size);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { PickerColumnOption } from '../PickerView';
|
|
3
|
+
import './style.scss';
|
|
4
|
+
export type PickerProps = {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
afterOpenChange?: (open: boolean) => void;
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
columns?: PickerColumnOption[][];
|
|
9
|
+
/**
|
|
10
|
+
* @description 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 string 变为 { value: string, label: ReactNode } 的格式
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
labelInValue?: boolean;
|
|
14
|
+
value?: any[];
|
|
15
|
+
onOk: (value: any[]) => void;
|
|
16
|
+
onCancel?: () => void;
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const Picker: FC<PickerProps>;
|
|
@@ -0,0 +1,97 @@
|
|
|
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 classNames from 'classnames';
|
|
8
|
+
import { size } from 'lodash';
|
|
9
|
+
import React, { useEffect, useState } from 'react';
|
|
10
|
+
import ConfigProvider from "../ConfigProvider";
|
|
11
|
+
import PickerView from "../PickerView";
|
|
12
|
+
import Popup from "../Popup";
|
|
13
|
+
import "./style.scss";
|
|
14
|
+
var pickerCls = 'triones-antm-picker';
|
|
15
|
+
export var Picker = /*#__PURE__*/React.memo(function (_ref) {
|
|
16
|
+
var open = _ref.open,
|
|
17
|
+
afterOpenChange = _ref.afterOpenChange,
|
|
18
|
+
title = _ref.title,
|
|
19
|
+
columns = _ref.columns,
|
|
20
|
+
_ref$labelInValue = _ref.labelInValue,
|
|
21
|
+
labelInValue = _ref$labelInValue === void 0 ? false : _ref$labelInValue,
|
|
22
|
+
value = _ref.value,
|
|
23
|
+
onOk = _ref.onOk,
|
|
24
|
+
onCancel = _ref.onCancel,
|
|
25
|
+
onClose = _ref.onClose;
|
|
26
|
+
var _ConfigProvider$useCo = ConfigProvider.useConfig(),
|
|
27
|
+
locale = _ConfigProvider$useCo.locale;
|
|
28
|
+
var _useState = useState(value || Array.from({
|
|
29
|
+
length: size(columns)
|
|
30
|
+
}).map(function () {
|
|
31
|
+
return null;
|
|
32
|
+
})),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
internalValue = _useState2[0],
|
|
35
|
+
setInternalValue = _useState2[1];
|
|
36
|
+
var _React$useState = React.useState(open || false),
|
|
37
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
38
|
+
innerOpen = _React$useState2[0],
|
|
39
|
+
setInnerOpen = _React$useState2[1];
|
|
40
|
+
var handleClose = function handleClose() {
|
|
41
|
+
setInnerOpen(false);
|
|
42
|
+
onClose === null || onClose === void 0 || onClose();
|
|
43
|
+
};
|
|
44
|
+
var handleOk = function handleOk() {
|
|
45
|
+
onOk === null || onOk === void 0 || onOk(internalValue);
|
|
46
|
+
handleClose();
|
|
47
|
+
};
|
|
48
|
+
var handelCancel = function handelCancel() {
|
|
49
|
+
onCancel === null || onCancel === void 0 || onCancel();
|
|
50
|
+
handleClose();
|
|
51
|
+
};
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(innerOpen);
|
|
54
|
+
}, [innerOpen]);
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
if (open === undefined) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (open === innerOpen) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
setInnerOpen(open);
|
|
63
|
+
}, [open]);
|
|
64
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
65
|
+
open: innerOpen,
|
|
66
|
+
onClose: function onClose() {
|
|
67
|
+
setInnerOpen(false);
|
|
68
|
+
},
|
|
69
|
+
styles: {
|
|
70
|
+
body: {
|
|
71
|
+
borderTopLeftRadius: 6,
|
|
72
|
+
borderTopRightRadius: 6
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: classNames(pickerCls)
|
|
77
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: classNames("".concat(pickerCls, "-header"))
|
|
79
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
80
|
+
className: classNames("".concat(pickerCls, "-header-button")),
|
|
81
|
+
onClick: handelCancel
|
|
82
|
+
}, locale.common.cancel), title && /*#__PURE__*/React.createElement("div", {
|
|
83
|
+
className: classNames("".concat(pickerCls, "-header-title"))
|
|
84
|
+
}, title), /*#__PURE__*/React.createElement("a", {
|
|
85
|
+
className: classNames("".concat(pickerCls, "-header-button"), "".concat(pickerCls, "-header-button-ok")),
|
|
86
|
+
onClick: handleOk
|
|
87
|
+
}, locale.common.confirm)), /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: classNames("".concat(pickerCls, "-body"))
|
|
89
|
+
}, /*#__PURE__*/React.createElement(PickerView, {
|
|
90
|
+
columns: columns,
|
|
91
|
+
labelInValue: labelInValue,
|
|
92
|
+
value: internalValue,
|
|
93
|
+
onChange: function onChange(v) {
|
|
94
|
+
setInternalValue(v);
|
|
95
|
+
}
|
|
96
|
+
}))));
|
|
97
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@import "../style/variable";
|
|
2
|
+
$pickerCls: 'triones-antm-picker';
|
|
3
|
+
|
|
4
|
+
.#{$pickerCls} {
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 300Px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
|
|
12
|
+
&-header {
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
align-items: center;
|
|
16
|
+
border-bottom: 1Px solid #eee;
|
|
17
|
+
padding: 4Px;
|
|
18
|
+
|
|
19
|
+
&-button {
|
|
20
|
+
padding: 8Px;
|
|
21
|
+
font-size: 12Px;
|
|
22
|
+
&-ok{
|
|
23
|
+
color: $trionesColorPrimary;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&-title {
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-body {
|
|
32
|
+
flex: 1 1;
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
pointer-events: unset;
|
|
36
|
+
}
|
|
37
|
+
&-view{
|
|
38
|
+
--height: 100%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import React from "react";
|
|
3
|
+
var pickerViewCls = "triones-antm-picker-view";
|
|
4
|
+
export var PickerViewColumnItem = function PickerViewColumnItem(_ref) {
|
|
5
|
+
var option = _ref.option;
|
|
6
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
className: classNames("".concat(pickerViewCls, "-column-item"))
|
|
8
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: "".concat(pickerViewCls, "-column-item-label")
|
|
10
|
+
}, option.label));
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { PickerColumnOption } from "./types";
|
|
3
|
+
type PickerViewColumnProps = {
|
|
4
|
+
options?: PickerColumnOption[];
|
|
5
|
+
labelInValue?: boolean;
|
|
6
|
+
value?: any;
|
|
7
|
+
onChange?: (value: any, index?: number) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const PickerViewColumn: FC<PickerViewColumnProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
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, { useEffect, useState } from "react";
|
|
8
|
+
import classNames from "classnames";
|
|
9
|
+
import { PickerViewColumnItem } from "./picker-view-column-item";
|
|
10
|
+
import { findIndex, isEmpty, size } from "lodash";
|
|
11
|
+
var pickerViewCls = "triones-antm-picker-view";
|
|
12
|
+
export var PickerViewColumn = /*#__PURE__*/React.memo(function (_ref) {
|
|
13
|
+
var options = _ref.options,
|
|
14
|
+
labelInValue = _ref.labelInValue,
|
|
15
|
+
value = _ref.value,
|
|
16
|
+
onChange = _ref.onChange;
|
|
17
|
+
var _useState = useState(value || null),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
internalValue = _useState2[0],
|
|
20
|
+
setInternalValue = _useState2[1];
|
|
21
|
+
var itemHeight = 34;
|
|
22
|
+
var max = 0;
|
|
23
|
+
var min = 0 - itemHeight * (size(options) - 1);
|
|
24
|
+
var _useState3 = useState(false),
|
|
25
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
26
|
+
touching = _useState4[0],
|
|
27
|
+
setTouching = _useState4[1];
|
|
28
|
+
var _React$useState = React.useState(),
|
|
29
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
30
|
+
touchPoint = _React$useState2[0],
|
|
31
|
+
setTouchPoint = _React$useState2[1];
|
|
32
|
+
var _useState5 = useState(0),
|
|
33
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
34
|
+
translateY = _useState6[0],
|
|
35
|
+
setTranslateY = _useState6[1];
|
|
36
|
+
var handleSelectOption = function handleSelectOption(selectValue) {
|
|
37
|
+
var valueIndex = findIndex(options, function (option) {
|
|
38
|
+
if (labelInValue) {
|
|
39
|
+
return option.value === selectValue.value;
|
|
40
|
+
}
|
|
41
|
+
return option.value === selectValue;
|
|
42
|
+
});
|
|
43
|
+
setTranslateY(0 - valueIndex * itemHeight);
|
|
44
|
+
};
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
if (value === undefined) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (value === internalValue) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
setInternalValue(value);
|
|
53
|
+
handleSelectOption(value);
|
|
54
|
+
}, [value]);
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
if (!value) {
|
|
57
|
+
var selectValue = labelInValue ? options === null || options === void 0 ? void 0 : options[0] : options === null || options === void 0 ? void 0 : options[0].value;
|
|
58
|
+
setInternalValue(selectValue || null);
|
|
59
|
+
onChange === null || onChange === void 0 || onChange(selectValue || null);
|
|
60
|
+
handleSelectOption(selectValue);
|
|
61
|
+
} else {
|
|
62
|
+
handleSelectOption(value);
|
|
63
|
+
}
|
|
64
|
+
}, [options]);
|
|
65
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: classNames("".concat(pickerViewCls, "-column"))
|
|
67
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: classNames("".concat(pickerViewCls, "-column-wheel")),
|
|
69
|
+
style: {
|
|
70
|
+
transform: "translate3d(0, ".concat(translateY, "px, 0)")
|
|
71
|
+
},
|
|
72
|
+
onTouchStart: function onTouchStart(event) {
|
|
73
|
+
setTouching(true);
|
|
74
|
+
var startPoint = {
|
|
75
|
+
clientX: event.touches[0].clientX,
|
|
76
|
+
clientY: event.touches[0].clientY
|
|
77
|
+
};
|
|
78
|
+
setTouchPoint(startPoint);
|
|
79
|
+
},
|
|
80
|
+
onTouchMove: function onTouchMove(event) {
|
|
81
|
+
if (touching) {
|
|
82
|
+
var movePoint = {
|
|
83
|
+
clientX: event.touches[0].clientX,
|
|
84
|
+
clientY: event.touches[0].clientY
|
|
85
|
+
};
|
|
86
|
+
if (translateY > max || translateY < min) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
setTranslateY(translateY + (movePoint.clientY - touchPoint.clientY));
|
|
90
|
+
setTouchPoint(movePoint);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
onTouchEnd: function onTouchEnd(event) {
|
|
94
|
+
setTouching(false);
|
|
95
|
+
var selectIndex = 0;
|
|
96
|
+
if (translateY > 0) {
|
|
97
|
+
setTranslateY(0);
|
|
98
|
+
selectIndex = 0;
|
|
99
|
+
} else if (translateY < 0 - itemHeight * (size(options) - 1)) {
|
|
100
|
+
setTranslateY(0 - itemHeight * (size(options) - 1));
|
|
101
|
+
selectIndex = size(options) - 1;
|
|
102
|
+
} else {
|
|
103
|
+
var num = Math.abs(Math.round(translateY / itemHeight));
|
|
104
|
+
setTranslateY(0 - num * itemHeight);
|
|
105
|
+
selectIndex = num;
|
|
106
|
+
}
|
|
107
|
+
var selectValue = labelInValue ? options === null || options === void 0 ? void 0 : options[selectIndex] : options === null || options === void 0 ? void 0 : options[selectIndex].value;
|
|
108
|
+
setInternalValue(selectValue);
|
|
109
|
+
onChange === null || onChange === void 0 || onChange(selectValue);
|
|
110
|
+
}
|
|
111
|
+
}, !isEmpty(options) && (options === null || options === void 0 ? void 0 : options.map(function (option, index) {
|
|
112
|
+
return /*#__PURE__*/React.createElement(PickerViewColumnItem, {
|
|
113
|
+
option: option,
|
|
114
|
+
key: "view-column-".concat(index)
|
|
115
|
+
});
|
|
116
|
+
}))));
|
|
117
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { FC } from "react";
|
|
2
|
+
import { PickerColumnOption } from "./types";
|
|
3
|
+
import "./style.scss";
|
|
4
|
+
export type PickerViewProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
columns?: PickerColumnOption[][];
|
|
8
|
+
labelInValue?: boolean;
|
|
9
|
+
value?: any[];
|
|
10
|
+
onChange?: (value: any[]) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const PickerView: FC<PickerViewProps>;
|
|
@@ -0,0 +1,60 @@
|
|
|
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 classNames from "classnames";
|
|
8
|
+
import { isEmpty, size } from "lodash";
|
|
9
|
+
import { PickerViewColumn } from "./picker-view-column";
|
|
10
|
+
import React, { useEffect, useState } from "react";
|
|
11
|
+
import "./style.scss";
|
|
12
|
+
var pickerViewCls = "triones-antm-picker-view";
|
|
13
|
+
export var PickerView = /*#__PURE__*/React.memo(function (_ref) {
|
|
14
|
+
var className = _ref.className,
|
|
15
|
+
style = _ref.style,
|
|
16
|
+
columns = _ref.columns,
|
|
17
|
+
labelInValue = _ref.labelInValue,
|
|
18
|
+
value = _ref.value,
|
|
19
|
+
_onChange = _ref.onChange;
|
|
20
|
+
var _useState = useState(value || Array.from({
|
|
21
|
+
length: size(columns)
|
|
22
|
+
}).map(function () {
|
|
23
|
+
return null;
|
|
24
|
+
})),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
internalValue = _useState2[0],
|
|
27
|
+
setInternalValue = _useState2[1];
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
if (value === undefined) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (value === internalValue) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
setInternalValue(value);
|
|
36
|
+
}, [value]);
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: classNames("".concat(pickerViewCls), className),
|
|
39
|
+
style: style
|
|
40
|
+
}, !isEmpty(columns) && (columns === null || columns === void 0 ? void 0 : columns.map(function (column, index) {
|
|
41
|
+
return /*#__PURE__*/React.createElement(PickerViewColumn, {
|
|
42
|
+
key: "column-".concat(index),
|
|
43
|
+
labelInValue: labelInValue,
|
|
44
|
+
options: column,
|
|
45
|
+
value: value === null || value === void 0 ? void 0 : value[index],
|
|
46
|
+
onChange: function onChange(v) {
|
|
47
|
+
internalValue[index] = v;
|
|
48
|
+
_onChange === null || _onChange === void 0 || _onChange(internalValue);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: classNames("".concat(pickerViewCls, "-mask"))
|
|
53
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: classNames("".concat(pickerViewCls, "-mask-top"))
|
|
55
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: classNames("".concat(pickerViewCls, "-mask-middle"))
|
|
57
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: classNames("".concat(pickerViewCls, "-mask-bottom"))
|
|
59
|
+
})));
|
|
60
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
$pickerViewCls: 'triones-antm-picker-view';
|
|
2
|
+
.#{$pickerViewCls} {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: var(--height,240Px);
|
|
5
|
+
display: flex;
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
--item-height: 34Px;
|
|
9
|
+
--item-font-size: 16Px;
|
|
10
|
+
|
|
11
|
+
&-column {
|
|
12
|
+
height: 100%;
|
|
13
|
+
flex: 1 1;
|
|
14
|
+
user-select: none;
|
|
15
|
+
touch-action: none;
|
|
16
|
+
position: relative;
|
|
17
|
+
z-index: 0;
|
|
18
|
+
&-wheel{
|
|
19
|
+
width: 100%;
|
|
20
|
+
cursor: grab;
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: calc(50% - var(--item-height)/2);
|
|
23
|
+
left: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&-item {
|
|
27
|
+
font-size: var(--item-font-size);
|
|
28
|
+
padding: 0 6px;
|
|
29
|
+
height: var(--item-height);
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
align-items: center;
|
|
33
|
+
&-label{
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-mask {
|
|
42
|
+
position: absolute;
|
|
43
|
+
z-index: 10000;
|
|
44
|
+
left: 0;
|
|
45
|
+
top: 0;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
|
|
52
|
+
&-top {
|
|
53
|
+
background-color: white;
|
|
54
|
+
flex: auto;
|
|
55
|
+
mask: linear-gradient(0deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .8) 50%, #000);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&-middle {
|
|
59
|
+
height: var(--item-height);
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
flex: none;
|
|
62
|
+
border-top: 1px solid #eee;
|
|
63
|
+
border-bottom: 1px solid #eee;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&-bottom {
|
|
67
|
+
background-color: white;
|
|
68
|
+
flex: auto;
|
|
69
|
+
mask: linear-gradient(180deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .8) 50%, #000);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { CSSProperties, FC, PropsWithChildren } from 'react';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
export type Position = 'top' | 'bottom' | 'left' | 'right';
|
|
4
|
+
export type PopupModalProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
/**
|
|
7
|
+
* @description 样式
|
|
8
|
+
* @default horizontal
|
|
9
|
+
*/
|
|
10
|
+
styles?: {
|
|
11
|
+
body?: CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @description Modal 完全关闭后的回调
|
|
15
|
+
* @default
|
|
16
|
+
*/
|
|
17
|
+
afterClose?: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* @description 是否打开
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
open?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @description 打开位置
|
|
25
|
+
* @default bottom
|
|
26
|
+
*/
|
|
27
|
+
position?: Position;
|
|
28
|
+
/**
|
|
29
|
+
* @description 是否可以关闭(显示关闭按钮)
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
closable?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @description 是否蒙层关闭
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
maskClosable?: boolean;
|
|
38
|
+
onMaskClick?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* @description 关闭时销毁 Modal 里的子元素
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
destroyOnClose?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* @description 设置 Modal 的 z-index
|
|
46
|
+
* @default 1000
|
|
47
|
+
*/
|
|
48
|
+
zIndex?: number;
|
|
49
|
+
onClose?: () => void;
|
|
50
|
+
onDestroy?: () => void;
|
|
51
|
+
};
|
|
52
|
+
export declare const PopupModal: FC<PropsWithChildren<PopupModalProps>>;
|