@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,39 @@
|
|
|
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 } from 'lodash';
|
|
9
|
+
import { Field } from 'rc-field-form';
|
|
10
|
+
import React, { useState } from 'react';
|
|
11
|
+
export var FormItemInput = function FormItemInput(_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
className = _ref.className,
|
|
14
|
+
name = _ref.name,
|
|
15
|
+
rules = _ref.rules,
|
|
16
|
+
initialValue = _ref.initialValue,
|
|
17
|
+
valuePropName = _ref.valuePropName,
|
|
18
|
+
errorRender = _ref.errorRender,
|
|
19
|
+
hiddenError = _ref.hiddenError;
|
|
20
|
+
var _useState = useState(),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
meta = _useState2[0],
|
|
23
|
+
setMeta = _useState2[1];
|
|
24
|
+
var clsPrefix = 'triones-antm-form-item';
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: classNames(className)
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Field, {
|
|
28
|
+
name: name,
|
|
29
|
+
rules: rules,
|
|
30
|
+
valuePropName: valuePropName,
|
|
31
|
+
trigger: 'onChange',
|
|
32
|
+
onMetaChange: function onMetaChange(meta) {
|
|
33
|
+
setMeta(meta);
|
|
34
|
+
},
|
|
35
|
+
initialValue: initialValue
|
|
36
|
+
}, children)), !hiddenError && !isEmpty(meta === null || meta === void 0 ? void 0 : meta.errors) && /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: classNames("".concat(clsPrefix, "-error"))
|
|
38
|
+
}, (errorRender === null || errorRender === void 0 ? void 0 : errorRender(meta === null || meta === void 0 ? void 0 : meta.errors)) || (meta === null || meta === void 0 ? void 0 : meta.errors.join(','))));
|
|
39
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { CSSProperties, FC } from "react";
|
|
2
|
+
import { NamePath } from "rc-field-form/lib/interface";
|
|
3
|
+
import { FormItemLayout } from "../form";
|
|
4
|
+
type FormItemLabelProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
label?: React.ReactNode;
|
|
8
|
+
layout?: FormItemLayout;
|
|
9
|
+
name?: NamePath;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const FormItemLabel: FC<FormItemLabelProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { useFormContext } from "../hooks/useFormContext";
|
|
4
|
+
import { isFunction } from "lodash";
|
|
5
|
+
export var FormItemLabel = function FormItemLabel(_ref) {
|
|
6
|
+
var className = _ref.className,
|
|
7
|
+
style = _ref.style,
|
|
8
|
+
label = _ref.label,
|
|
9
|
+
layout = _ref.layout,
|
|
10
|
+
required = _ref.required;
|
|
11
|
+
var _useFormContext = useFormContext(),
|
|
12
|
+
requiredMark = _useFormContext.requiredMark,
|
|
13
|
+
colon = _useFormContext.colon;
|
|
14
|
+
var clsPrefix = "triones-antm-form-item-label";
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
className: classNames(className, {
|
|
17
|
+
required: "".concat(clsPrefix, "-required")
|
|
18
|
+
}),
|
|
19
|
+
style: style
|
|
20
|
+
}, /*#__PURE__*/React.createElement("label", null, required && /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "".concat(clsPrefix, "-required-mark")
|
|
22
|
+
}, isFunction(requiredMark) ? requiredMark(label, {
|
|
23
|
+
required: required
|
|
24
|
+
}) : '*'), label, layout == 'horizontal' && colon && ':'));
|
|
25
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { CSSProperties, FC, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { NamePath, Rule } from "rc-field-form/lib/interface";
|
|
3
|
+
import { FormItemLayout, FormLayoutAlign } from "../form";
|
|
4
|
+
export type FormItemProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
children?: ReactElement;
|
|
8
|
+
layout?: FormItemLayout;
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
labelAlign?: FormLayoutAlign;
|
|
11
|
+
labelWidth?: number;
|
|
12
|
+
name?: NamePath;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
hidden?: boolean;
|
|
15
|
+
noStyle?: boolean;
|
|
16
|
+
rules?: Rule[];
|
|
17
|
+
initialValue?: any;
|
|
18
|
+
valuePropName?: string;
|
|
19
|
+
errorRender?: (errors?: any[]) => React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export declare const FormItem: FC<FormItemProps>;
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
var _excluded = ["className", "style", "children", "layout", "label", "labelAlign", "labelWidth", "name", "required", "hidden", "noStyle", "rules", "initialValue", "valuePropName", "errorRender"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function _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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { FormItemLabel } from "./form-item-label";
|
|
11
|
+
import { FormItemInput } from "./form-item-input";
|
|
12
|
+
import classNames from "classnames";
|
|
13
|
+
import { useFormContext } from "../hooks/useFormContext";
|
|
14
|
+
import { Field } from "rc-field-form";
|
|
15
|
+
export var FormItem = function FormItem(_ref) {
|
|
16
|
+
var className = _ref.className,
|
|
17
|
+
style = _ref.style,
|
|
18
|
+
children = _ref.children,
|
|
19
|
+
layout = _ref.layout,
|
|
20
|
+
label = _ref.label,
|
|
21
|
+
labelAlign = _ref.labelAlign,
|
|
22
|
+
labelWidth = _ref.labelWidth,
|
|
23
|
+
name = _ref.name,
|
|
24
|
+
required = _ref.required,
|
|
25
|
+
_ref$hidden = _ref.hidden,
|
|
26
|
+
hidden = _ref$hidden === void 0 ? false : _ref$hidden,
|
|
27
|
+
_ref$noStyle = _ref.noStyle,
|
|
28
|
+
noStyle = _ref$noStyle === void 0 ? false : _ref$noStyle,
|
|
29
|
+
rules = _ref.rules,
|
|
30
|
+
initialValue = _ref.initialValue,
|
|
31
|
+
valuePropName = _ref.valuePropName,
|
|
32
|
+
errorRender = _ref.errorRender,
|
|
33
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
var _useFormContext = useFormContext(),
|
|
35
|
+
formLayout = _useFormContext.layout,
|
|
36
|
+
formLayoutAlign = _useFormContext.labelAlign,
|
|
37
|
+
formLabelWidth = _useFormContext.labelWidth,
|
|
38
|
+
hiddenError = _useFormContext.hiddenError;
|
|
39
|
+
var formItemLayout = layout ? layout : formLayout === 'inline' ? 'horizontal' : formLayout;
|
|
40
|
+
var formItemAlign = labelAlign ? labelAlign : formLayoutAlign || 'left';
|
|
41
|
+
var formItemLabelWidth = labelWidth ? labelWidth : formLabelWidth;
|
|
42
|
+
var clsPrefix = "triones-antm-form-item";
|
|
43
|
+
if (noStyle) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
45
|
+
name: name,
|
|
46
|
+
rules: rules,
|
|
47
|
+
trigger: 'onChange',
|
|
48
|
+
initialValue: initialValue
|
|
49
|
+
}, children);
|
|
50
|
+
}
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: classNames(clsPrefix, "".concat(clsPrefix, "-").concat(formItemLayout), className, _defineProperty({}, "".concat(clsPrefix, "-hidden"), hidden)),
|
|
53
|
+
style: style
|
|
54
|
+
}, label && /*#__PURE__*/React.createElement(FormItemLabel, {
|
|
55
|
+
className: classNames("".concat(clsPrefix, "-label"), "".concat(clsPrefix, "-label-").concat(formItemAlign)),
|
|
56
|
+
style: {
|
|
57
|
+
width: formItemLabelWidth
|
|
58
|
+
},
|
|
59
|
+
label: label,
|
|
60
|
+
required: required
|
|
61
|
+
}), /*#__PURE__*/React.createElement(FormItemInput, _extends({
|
|
62
|
+
className: "".concat(clsPrefix, "-input")
|
|
63
|
+
}, props, {
|
|
64
|
+
name: name,
|
|
65
|
+
rules: rules,
|
|
66
|
+
errorRender: errorRender,
|
|
67
|
+
initialValue: initialValue,
|
|
68
|
+
hiddenError: hiddenError
|
|
69
|
+
}), children));
|
|
70
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormLayout, FormLayoutAlign, RequiredMark } from "./form";
|
|
3
|
+
export interface FormContextProps {
|
|
4
|
+
colon?: boolean;
|
|
5
|
+
layout?: FormLayout;
|
|
6
|
+
labelAlign?: FormLayoutAlign;
|
|
7
|
+
labelWidth?: number;
|
|
8
|
+
requiredMark?: RequiredMark;
|
|
9
|
+
form?: any;
|
|
10
|
+
hiddenError?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const FormContext: React.Context<FormContextProps>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useWatch } from 'rc-field-form';
|
|
2
|
+
import type { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
|
|
3
|
+
import type { FormRef } from 'rc-field-form/lib/interface';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { FormInstance } from './interface';
|
|
6
|
+
import './style.scss';
|
|
7
|
+
export type RequiredMark = boolean | 'optional' | ((labelNode: React.ReactNode, info: {
|
|
8
|
+
required: boolean;
|
|
9
|
+
}) => React.ReactNode);
|
|
10
|
+
export type FormLayout = 'horizontal' | 'inline' | 'vertical';
|
|
11
|
+
export type FormItemLayout = 'horizontal' | 'vertical';
|
|
12
|
+
export type FormLayoutAlign = 'left' | 'right';
|
|
13
|
+
export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form' | 'component'> {
|
|
14
|
+
/**
|
|
15
|
+
* @description 配置 Form.Item 的 colon 的默认值。表示是否显示 label 后面的冒号 (只有在属性 layout 为 horizontal 时有效)
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
colon?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @description 布局
|
|
21
|
+
* @default horizontal
|
|
22
|
+
*/
|
|
23
|
+
layout?: FormLayout;
|
|
24
|
+
/**
|
|
25
|
+
* @description 经 Form.useForm() 创建的 form 控制实例,不提供时会自动创建
|
|
26
|
+
* @default
|
|
27
|
+
*/
|
|
28
|
+
form?: FormInstance<Values>;
|
|
29
|
+
/**
|
|
30
|
+
* @description 标签
|
|
31
|
+
* @default horizontal
|
|
32
|
+
*/
|
|
33
|
+
labelAlign?: FormLayoutAlign;
|
|
34
|
+
labelWidth?: number;
|
|
35
|
+
requiredMark?: RequiredMark;
|
|
36
|
+
/**
|
|
37
|
+
* @description 是否隐藏错误信息,主要用于自定义异常样式
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
hiddenError?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const InternalForm: React.ForwardRefRenderFunction<FormRef, FormProps>;
|
|
43
|
+
export { useWatch };
|
|
44
|
+
export default InternalForm;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var _excluded = ["children", "layout", "labelAlign", "labelWidth", "requiredMark", "hiddenError"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
import FieldForm, { useWatch } from 'rc-field-form';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { FormContext } from "./context";
|
|
8
|
+
import "./style.scss";
|
|
9
|
+
export var InternalForm = function InternalForm(_ref, ref) {
|
|
10
|
+
var children = _ref.children,
|
|
11
|
+
layout = _ref.layout,
|
|
12
|
+
labelAlign = _ref.labelAlign,
|
|
13
|
+
labelWidth = _ref.labelWidth,
|
|
14
|
+
requiredMark = _ref.requiredMark,
|
|
15
|
+
_ref$hiddenError = _ref.hiddenError,
|
|
16
|
+
hiddenError = _ref$hiddenError === void 0 ? false : _ref$hiddenError,
|
|
17
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
+
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
19
|
+
value: {
|
|
20
|
+
layout: layout || 'horizontal',
|
|
21
|
+
labelAlign: labelAlign || 'left',
|
|
22
|
+
labelWidth: labelWidth,
|
|
23
|
+
requiredMark: requiredMark || true,
|
|
24
|
+
hiddenError: hiddenError
|
|
25
|
+
}
|
|
26
|
+
}, /*#__PURE__*/React.createElement(FieldForm, _extends({}, props, {
|
|
27
|
+
component: false
|
|
28
|
+
}), children));
|
|
29
|
+
};
|
|
30
|
+
export { useWatch };
|
|
31
|
+
export default InternalForm;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 * as React from 'react';
|
|
14
|
+
import { useForm as useRcForm } from 'rc-field-form';
|
|
15
|
+
export default function useForm(form) {
|
|
16
|
+
var _useRcForm = useRcForm(),
|
|
17
|
+
_useRcForm2 = _slicedToArray(_useRcForm, 1),
|
|
18
|
+
rcForm = _useRcForm2[0];
|
|
19
|
+
var itemsRef = React.useRef({});
|
|
20
|
+
var wrapForm = React.useMemo(function () {
|
|
21
|
+
return form !== null && form !== void 0 ? form : _objectSpread({}, rcForm);
|
|
22
|
+
}, [form, rcForm]);
|
|
23
|
+
return [wrapForm];
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import InternalForm, { FormProps, useWatch } from "./form";
|
|
2
|
+
import FormItem, { FormItemProps } from "./FormItem";
|
|
3
|
+
import useForm from "./hooks/useForm";
|
|
4
|
+
type InternalFormType = typeof InternalForm;
|
|
5
|
+
type CompoundedComponent = InternalFormType & {
|
|
6
|
+
useForm: typeof useForm;
|
|
7
|
+
Item: typeof FormItem;
|
|
8
|
+
useWatch: typeof useWatch;
|
|
9
|
+
};
|
|
10
|
+
declare const Form: CompoundedComponent;
|
|
11
|
+
export type { FormProps, FormItemProps };
|
|
12
|
+
export default Form;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
$cls-prefix-form: 'triones-antm-form';
|
|
2
|
+
$cls-prefix-form-item: 'triones-antm-form-item';
|
|
3
|
+
|
|
4
|
+
.#{$cls-prefix-form}{
|
|
5
|
+
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.#{$cls-prefix-form-item}{
|
|
9
|
+
&-label{
|
|
10
|
+
font-size: 14Px;
|
|
11
|
+
//line-height: 1.5;
|
|
12
|
+
color: #6F6F6F;
|
|
13
|
+
&-left{}
|
|
14
|
+
&-right{
|
|
15
|
+
text-align: right;
|
|
16
|
+
}
|
|
17
|
+
&-required-mark{
|
|
18
|
+
display: inline-block;
|
|
19
|
+
color: red;
|
|
20
|
+
margin-right: 4Px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&-input{
|
|
24
|
+
.#{$cls-prefix-form-item}{
|
|
25
|
+
&-error{
|
|
26
|
+
font-size: 12Px;
|
|
27
|
+
color: red;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
&-horizontal{
|
|
32
|
+
display: flex;
|
|
33
|
+
.#{$cls-prefix-form-item}{
|
|
34
|
+
&-label{
|
|
35
|
+
padding: 4Px;
|
|
36
|
+
}
|
|
37
|
+
&-input{
|
|
38
|
+
flex: auto 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
&-hidden{
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FC, ReactNode } from 'react';
|
|
3
|
+
import { NativeProps } from '../utils/native-props';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
export type GridProps = {
|
|
6
|
+
columns: number;
|
|
7
|
+
gap?: number | string | [number | string, number | string];
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
} & NativeProps<'--gap' | '--gap-vertical' | '--gap-horizontal'>;
|
|
10
|
+
export declare const Grid: FC<GridProps>;
|
|
11
|
+
export type GridItemProps = {
|
|
12
|
+
span?: number;
|
|
13
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
} & NativeProps;
|
|
16
|
+
export declare const GridItem: FC<GridItemProps>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { toCSSLength, withNativeProps } from "../utils/native-props";
|
|
3
|
+
import "./style.scss";
|
|
4
|
+
import { mergeProps } from "../utils/with-default-props";
|
|
5
|
+
var classPrefix = "triones-antm-grid";
|
|
6
|
+
export var Grid = function Grid(props) {
|
|
7
|
+
var style = {
|
|
8
|
+
'--columns': props.columns.toString()
|
|
9
|
+
};
|
|
10
|
+
var gap = props.gap;
|
|
11
|
+
if (gap !== undefined) {
|
|
12
|
+
if (Array.isArray(gap)) {
|
|
13
|
+
style['--gap-horizontal'] = toCSSLength(gap[0]);
|
|
14
|
+
style['--gap-vertical'] = toCSSLength(gap[1]);
|
|
15
|
+
} else {
|
|
16
|
+
style['--gap'] = toCSSLength(gap);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return withNativeProps(props, /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: classPrefix,
|
|
21
|
+
style: style
|
|
22
|
+
}, props.children));
|
|
23
|
+
};
|
|
24
|
+
export var GridItem = function GridItem(p) {
|
|
25
|
+
var props = mergeProps({
|
|
26
|
+
span: 1
|
|
27
|
+
}, p);
|
|
28
|
+
return withNativeProps(props, /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "".concat(classPrefix, "-item"),
|
|
30
|
+
style: {
|
|
31
|
+
gridColumnEnd: "span ".concat(props.span)
|
|
32
|
+
},
|
|
33
|
+
onClick: props.onClick
|
|
34
|
+
}, props.children));
|
|
35
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
$class-prefix-grid: 'triones-antm-grid';
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
.#{$class-prefix-grid} {
|
|
4
|
+
--gap: 0;
|
|
5
|
+
--gap-horizontal: var(--gap);
|
|
6
|
+
--gap-vertical: var(--gap);
|
|
7
|
+
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-gap: 10PX;
|
|
10
|
+
column-gap: var(--gap-horizontal);
|
|
11
|
+
row-gap: var(--gap-vertical);
|
|
12
|
+
grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
|
|
13
|
+
align-items: stretch;
|
|
14
|
+
&-item {
|
|
15
|
+
grid-column-end: span var(--item-span);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { withNativeProps } from "../utils/native-props";
|
|
3
|
+
export var CheckIcon = /*#__PURE__*/memo(function (props) {
|
|
4
|
+
return withNativeProps(props, /*#__PURE__*/React.createElement("svg", {
|
|
5
|
+
viewBox: "0 0 40 40"
|
|
6
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
7
|
+
d: "M31.5541766,15 L28.0892433,15 L28.0892434,15 C27.971052,15 27.8576674,15.044522 27.7740471,15.1239792 L18.2724722,24.1625319 L13.2248725,19.3630279 L13.2248725,19.3630279 C13.1417074,19.2834412 13.0287551,19.2384807 12.9107898,19.2380079 L9.44474455,19.2380079 L9.44474454,19.2380079 C9.19869815,19.2384085 8.99957935,19.4284738 9,19.66253 C9,19.7747587 9.04719253,19.8823283 9.13066188,19.9616418 L17.0907466,27.5338228 C17.4170809,27.8442545 17.8447695,28 18.2713393,28 L18.2980697,28 C18.7168464,27.993643 19.133396,27.8378975 19.4530492,27.5338228 L31.8693384,15.7236361 L31.8693384,15.7236361 C32.0434167,15.5582251 32.0435739,15.2898919 31.8696892,15.1242941 C31.7860402,15.0446329 31.6725052,15 31.5541421,15 L31.5541766,15 Z",
|
|
8
|
+
fill: "currentColor"
|
|
9
|
+
})));
|
|
10
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* compact: true
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
import * as icons from "../../../../antd-mobile-icons-react";
|
|
6
|
+
import { map, omit } from "lodash";
|
|
7
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
8
|
+
export default (function () {
|
|
9
|
+
return /*#__PURE__*/React.createElement(DemoBlock, {
|
|
10
|
+
title: "\u56FE\u6807"
|
|
11
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
style: {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'space-between',
|
|
16
|
+
gap: 20,
|
|
17
|
+
flexWrap: 'wrap'
|
|
18
|
+
}
|
|
19
|
+
}, map(omit(icons, 'Icon'), function (icon, name) {
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
key: name,
|
|
22
|
+
style: {
|
|
23
|
+
width: '40%',
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
marginTop: 30
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(icon, {
|
|
30
|
+
key: name,
|
|
31
|
+
style: {
|
|
32
|
+
fontSize: 48
|
|
33
|
+
}
|
|
34
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
style: {
|
|
36
|
+
fontSize: 14,
|
|
37
|
+
marginTop: 5
|
|
38
|
+
}
|
|
39
|
+
}, name));
|
|
40
|
+
})));
|
|
41
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type BaseInputProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
type?: 'text' | 'password' | 'textarea';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
value?: any;
|
|
9
|
+
onChange?: (e: any) => void;
|
|
10
|
+
};
|
|
11
|
+
export interface BaseInputHandle {
|
|
12
|
+
clear?: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const BaseInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<BaseInputHandle>>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var _excluded = ["className", "style", "placeholder", "type", "value", "onChange"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
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; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
import classNames from 'classnames';
|
|
12
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
|
|
13
|
+
export var BaseInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
14
|
+
var className = _ref.className,
|
|
15
|
+
style = _ref.style,
|
|
16
|
+
placeholder = _ref.placeholder,
|
|
17
|
+
type = _ref.type,
|
|
18
|
+
value = _ref.value,
|
|
19
|
+
_onChange = _ref.onChange,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
var _useState = useState(0),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
keySequence = _useState2[0],
|
|
24
|
+
setKeySequence = _useState2[1];
|
|
25
|
+
var _useState3 = useState(value || ''),
|
|
26
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27
|
+
innerValue = _useState4[0],
|
|
28
|
+
setInnerValue = _useState4[1];
|
|
29
|
+
useImperativeHandle(ref, function () {
|
|
30
|
+
return {
|
|
31
|
+
clear: function clear() {
|
|
32
|
+
setInnerValue('');
|
|
33
|
+
_onChange === null || _onChange === void 0 || _onChange('');
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
var cls = 'triones-antm-input';
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
setKeySequence(keySequence + 1);
|
|
40
|
+
}, [type]);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
if (value === undefined) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (value === innerValue) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setInnerValue(value);
|
|
49
|
+
}, [value]);
|
|
50
|
+
return /*#__PURE__*/React.createElement("input", _extends({
|
|
51
|
+
key: keySequence
|
|
52
|
+
}, props, {
|
|
53
|
+
className: classNames(["".concat(cls), className]),
|
|
54
|
+
style: style,
|
|
55
|
+
placeholder: placeholder,
|
|
56
|
+
type: type,
|
|
57
|
+
value: innerValue,
|
|
58
|
+
onChange: function onChange(e) {
|
|
59
|
+
setInnerValue(e.target.value);
|
|
60
|
+
_onChange === null || _onChange === void 0 || _onChange(e);
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
});
|