@trionesdev/antd-mobile-react 0.0.2-beta.2 → 0.0.2-beta.20
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 -21
- package/dist/ActionSheet/ActionSheet.d.ts +25 -0
- package/dist/ActionSheet/ActionSheet.js +77 -0
- package/dist/ActionSheet/index.d.ts +1 -1
- package/dist/ActionSheet/index.js +1 -1
- package/dist/ActionSheet/style.scss +52 -0
- package/dist/Avatar/demo/base.js +2 -2
- package/dist/Avatar/demo/style.scss +6 -6
- package/dist/Badge/demo/base.js +2 -2
- package/dist/Badge/demo/base.scss +6 -6
- package/dist/Button/button.d.ts +2 -1
- package/dist/Button/button.js +1 -1
- package/dist/Button/demo/base.js +2 -2
- package/dist/Button/style.scss +234 -232
- package/dist/Calendar/calendar-grid.d.ts +10 -9
- package/dist/Calendar/calendar-grid.js +41 -64
- package/dist/Calendar/calendar-header.d.ts +3 -2
- package/dist/Calendar/calendar-header.js +6 -6
- package/dist/Calendar/calendar-range.d.ts +4 -3
- package/dist/Calendar/calendar-range.js +12 -11
- package/dist/Calendar/calendar.d.ts +5 -4
- package/dist/Calendar/calendar.js +23 -14
- package/dist/Calendar/style.scss +85 -85
- package/dist/Calendar/touchable-calendar-grid.d.ts +6 -5
- package/dist/Calendar/touchable-calendar-grid.js +67 -59
- package/dist/CalendarDatetimePicker/CalendarDatetimePicker.d.ts +3 -2
- package/dist/CalendarDatetimePicker/CalendarDatetimePicker.js +14 -28
- package/dist/CalendarDatetimePicker/DateTimeSwitch.d.ts +3 -2
- package/dist/CalendarDatetimePicker/DateTimeSwitch.js +4 -3
- package/dist/CalendarDatetimePicker/demo/base.js +1 -1
- package/dist/CalendarDatetimePicker/style.scss +54 -54
- package/dist/CalendarDatetimePicker/types.d.ts +1 -1
- package/dist/CalendarDatetimePicker/types.js +1 -1
- package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.d.ts +11 -0
- package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.js +61 -0
- package/dist/{Mask → CalendarDatetimePickerCell}/demo/base.js +9 -15
- package/dist/CalendarDatetimePickerCell/index.d.ts +3 -0
- package/dist/CalendarDatetimePickerCell/index.js +2 -0
- package/dist/CalendarDatetimePickerCell/style.scss +10 -0
- package/dist/CalendarDatetimePickerCell/types.d.ts +1 -0
- package/dist/CalendarDatetimePickerCell/types.js +1 -0
- package/dist/CalendarPicker/calendar-picker.js +2 -2
- package/dist/CalendarPicker/calendar-range-picker.d.ts +4 -4
- package/dist/CalendarPicker/calendar-range-picker.js +11 -9
- package/dist/CalendarPicker/demo/base.js +6 -6
- package/dist/CalendarPicker/index.d.ts +2 -2
- package/dist/CalendarPicker/index.js +3 -3
- package/dist/CalendarPicker/style.scss +31 -31
- package/dist/CalendarPicker/types.d.ts +8 -7
- package/dist/CalendarPickerCell/CalendarPickerCell.d.ts +11 -0
- package/dist/CalendarPickerCell/CalendarPickerCell.js +54 -0
- package/dist/CalendarPickerCell/CalendarRangePickerCell.d.ts +11 -0
- package/dist/CalendarPickerCell/CalendarRangePickerCell.js +56 -0
- package/dist/CalendarPickerCell/demo/base.d.ts +3 -0
- package/dist/CalendarPickerCell/demo/base.js +31 -0
- package/dist/CalendarPickerCell/index.d.ts +8 -0
- package/dist/CalendarPickerCell/index.js +5 -0
- package/dist/Card/demo/base.js +2 -2
- package/dist/Card/demo/base.scss +18 -18
- package/dist/CascaderPicker/cascader-picker.d.ts +27 -0
- package/dist/CascaderPicker/cascader-picker.js +90 -0
- package/dist/CascaderPicker/demo/base.js +1 -4
- package/dist/CascaderPicker/index.d.ts +1 -1
- package/dist/CascaderPicker/index.js +1 -1
- package/dist/CascaderPicker/style.scss +45 -0
- package/dist/CascaderPickerCell/CascaderPickerCell.d.ts +21 -0
- package/dist/CascaderPickerCell/CascaderPickerCell.js +70 -0
- package/dist/CascaderPickerCell/demo/base.js +71 -0
- package/dist/CascaderPickerCell/index.d.ts +3 -0
- package/dist/CascaderPickerCell/index.js +2 -0
- package/dist/CascaderPickerCell/style.scss +24 -0
- package/dist/Cell/demo/base.js +41 -2
- package/dist/Checkbox/demo/base.js +11 -6
- package/dist/Checkbox/demo/disabled.js +2 -1
- package/dist/ConfigProvider/demo/base.js +2 -2
- package/dist/DemoBlock/index.d.ts +6 -0
- package/dist/DemoBlock/index.js +9 -2
- package/dist/DemoBlock/index.scss +20 -20
- package/dist/DemoDescription/index.scss +3 -3
- package/dist/Divider/demo/base.js +2 -2
- package/dist/Ellipsis/demo/base.js +2 -2
- package/dist/Empty/demo/base.js +2 -2
- package/dist/ErrorBlock/demo/base.js +2 -2
- package/dist/FetchPicker/FetchPicker.d.ts +113 -0
- package/dist/FetchPicker/FetchPicker.js +319 -0
- package/dist/FetchPicker/index.d.ts +4 -0
- package/dist/FetchPicker/index.js +3 -0
- package/dist/FetchPicker/styles.scss +118 -0
- package/dist/FloatButton/FloatButton.d.ts +21 -0
- package/dist/FloatButton/FloatButton.js +66 -0
- package/dist/FloatButton/FloatButtonGroup.d.ts +21 -0
- package/dist/FloatButton/FloatButtonGroup.js +120 -0
- package/dist/FloatButton/context.d.ts +13 -0
- package/dist/FloatButton/context.js +2 -0
- package/dist/FloatButton/demo/base.d.ts +3 -0
- package/dist/FloatButton/demo/base.js +10 -0
- package/dist/FloatButton/demo/group.d.ts +3 -0
- package/dist/FloatButton/demo/group.js +20 -0
- package/dist/FloatButton/demo/square.d.ts +3 -0
- package/dist/FloatButton/demo/square.js +12 -0
- package/dist/FloatButton/index.d.ts +10 -0
- package/dist/FloatButton/index.js +5 -0
- package/dist/FloatButton/style.scss +123 -0
- package/dist/Footer/demo/base.js +2 -2
- package/dist/Form/FormItem/form-item-content.d.ts +17 -0
- package/dist/Form/FormItem/form-item-content.js +39 -0
- package/dist/Form/FormItem/form-item-label.d.ts +13 -0
- package/dist/Form/FormItem/form-item-label.js +29 -0
- package/dist/Form/FormItem/form-item.d.ts +51 -0
- package/dist/Form/FormItem/form-item.js +74 -0
- package/dist/Form/FormItem/index.d.ts +5 -0
- package/dist/Form/FormItem/index.js +3 -0
- package/dist/Form/demo/input.js +7 -3
- package/dist/Form/demo/vertical.d.ts +3 -0
- package/dist/Form/demo/vertical.js +45 -0
- package/dist/Form/index.d.ts +9 -2
- package/dist/Form/index.js +5 -1
- package/dist/Form/style.scss +106 -0
- package/dist/FormCell/index.d.ts +3 -0
- package/dist/FormCell/index.js +2 -0
- package/dist/Grid/demo/base.js +2 -2
- package/dist/Grid/demo/base.scss +7 -7
- package/dist/Icon/demo/base.js +2 -2
- package/dist/Image/demo/base.js +2 -2
- package/dist/Image/demo/base.scss +4 -4
- package/dist/Image/style.scss +30 -30
- package/dist/ImagesPreview/ImagesPreview.js +2 -2
- package/dist/ImagesPreview/style.scss +34 -34
- package/dist/ImagesWall/CameraModal.js +2 -2
- package/dist/ImagesWall/style.scss +70 -70
- package/dist/Input/base-input.d.ts +13 -0
- package/dist/Input/base-input.js +41 -0
- package/dist/Input/demo/base.js +115 -13
- package/dist/Input/index.d.ts +14 -2
- package/dist/Input/index.js +11 -1
- package/dist/Input/index.scss +240 -0
- package/dist/Input/input-affix-wrapper.d.ts +13 -0
- package/dist/Input/input-affix-wrapper.js +37 -0
- package/dist/Input/input-opt.d.ts +16 -0
- package/dist/Input/input-opt.js +87 -0
- package/dist/Input/input-password.d.ts +7 -0
- package/dist/Input/input-password.js +48 -0
- package/dist/Input/input.d.ts +20 -0
- package/dist/Input/input.js +66 -0
- package/dist/Input/textarea.d.ts +15 -0
- package/dist/Input/textarea.js +51 -0
- package/dist/Input/types.d.ts +3 -0
- package/dist/Input/types.js +2 -0
- package/dist/Loading/DotLoading.d.ts +1 -0
- package/dist/Loading/DotLoading.js +1 -0
- package/dist/Loading/SpinLoading.d.ts +1 -0
- package/dist/Loading/SpinLoading.js +1 -0
- package/dist/Loading/demo/base.d.ts +3 -0
- package/dist/{SpinLoading → Loading}/demo/base.js +8 -2
- package/dist/Loading/demo/dot-loading.d.ts +3 -0
- package/dist/Loading/demo/dot-loading.js +25 -0
- package/dist/Loading/index.d.ts +5 -0
- package/dist/Loading/index.js +3 -0
- package/dist/NavBar/demo/base.scss +5 -5
- package/dist/NoticeBar/demo/base.js +2 -2
- package/dist/Overlay/Overlay.d.ts +16 -0
- package/dist/Overlay/Overlay.js +117 -0
- package/dist/Overlay/demo/base.d.ts +3 -0
- package/dist/Overlay/demo/base.js +27 -0
- package/dist/Overlay/index.d.ts +4 -0
- package/dist/Overlay/index.js +3 -0
- package/dist/Overlay/style.scss +20 -0
- package/dist/PageIndicator/demo/base.js +2 -2
- package/dist/Picker/index.d.ts +1 -1
- package/dist/Picker/index.js +1 -1
- package/dist/Picker/picker.d.ts +20 -0
- package/dist/Picker/picker.js +94 -0
- package/dist/Picker/style.scss +44 -0
- package/dist/PickerView/index.d.ts +2 -1
- package/dist/PickerView/index.js +1 -1
- 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/demo/base.js +109 -27
- package/dist/Popup/index.d.ts +2 -1
- package/dist/Popup/index.js +2 -1
- package/dist/Popup/popup.d.ts +31 -0
- package/dist/Popup/popup.js +87 -0
- package/dist/Popup/style.scss +129 -0
- package/dist/Progress/index.d.ts +1 -1
- package/dist/Progress/index.js +1 -1
- package/dist/Radio/demo/base.js +2 -2
- package/dist/Radio/demo/base.scss +4 -4
- package/dist/Result/demo/base.js +2 -2
- package/dist/SafeArea/demo/base.scss +18 -18
- package/dist/ScrollView/index.d.ts +2 -1
- package/dist/ScrollView/index.js +1 -1
- 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/Segmented/demo/base.d.ts +3 -0
- package/dist/Segmented/demo/base.js +33 -0
- package/dist/Segmented/index.d.ts +3 -0
- package/dist/Segmented/index.js +2 -0
- package/dist/SideBar/index.d.ts +1 -1
- package/dist/SideBar/side-bar.js +6 -6
- package/dist/SideBar/style.scss +85 -85
- package/dist/Skeleton/demo/base.d.ts +3 -0
- package/dist/Skeleton/demo/base.js +8 -0
- package/dist/Skeleton/index.d.ts +3 -0
- package/dist/Skeleton/index.js +2 -0
- package/dist/Space/demo/base.js +2 -2
- package/dist/Stepper/demo/base.d.ts +3 -0
- package/dist/Stepper/demo/base.js +23 -0
- package/dist/Stepper/index.d.ts +3 -0
- package/dist/Stepper/index.js +2 -0
- package/dist/Swiper/style.scss +54 -54
- package/dist/Switch/demo/base.js +2 -2
- package/dist/TabBar/demo/base.js +2 -2
- package/dist/Tag/demo/base.js +2 -2
- package/dist/Tag/demo/style.scss +8 -8
- package/dist/Toast/style.scss +63 -63
- package/dist/Toast/toast-modal.js +4 -4
- package/dist/VerificationCodeInput/demo/base.js +2 -2
- package/dist/VerificationCodeInput/index.d.ts +2 -2
- package/dist/VerificationCodeInput/index.js +1 -1
- 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/demo/demo1.js +2 -2
- package/dist/WaterMark/demo/demo1.scss +6 -6
- package/dist/WaterMark/demo/demo2.js +2 -2
- package/dist/index.d.ts +33 -19
- package/dist/index.js +9 -2
- package/dist/style/variable.scss +1 -1
- package/dist/types.d.ts +0 -8
- package/dist/types.js +0 -1
- package/dist/utils/dayjs.d.ts +4 -0
- package/dist/utils/dayjs.js +42 -0
- package/dist/utils/type.js +36 -36
- package/dist/utils/use-isomorphic-update-layout-effect.d.ts +1 -1
- package/dist/utils/with-default-props.js +4 -4
- package/package.json +11 -16
- package/readme.md +43 -43
- package/dist/Mask/index.d.ts +0 -3
- package/dist/Mask/index.js +0 -2
- package/dist/Progress/Progress.d.ts +0 -37
- package/dist/Progress/Progress.js +0 -52
- package/dist/Progress/ProgressCircle.d.ts +0 -17
- package/dist/Progress/ProgressCircle.js +0 -148
- package/dist/Progress/ProgressLine.d.ts +0 -15
- package/dist/Progress/ProgressLine.js +0 -87
- package/dist/Progress/style.scss +0 -33
- package/dist/Progress/types.d.ts +0 -4
- package/dist/Progress/types.js +0 -2
- package/dist/SpinLoading/index.d.ts +0 -3
- package/dist/SpinLoading/index.js +0 -2
- /package/dist/{Mask → CalendarDatetimePickerCell}/demo/base.d.ts +0 -0
- /package/dist/{SpinLoading → CascaderPickerCell}/demo/base.d.ts +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
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 classNames from 'classnames';
|
|
14
|
+
import { CloseOutline } from "@trionesdev/antd-mobile-icons-react";
|
|
15
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
+
import { FloatButton } from "./FloatButton";
|
|
17
|
+
import { FloatButtonGroupContext } from "./context";
|
|
18
|
+
import "./style.scss";
|
|
19
|
+
var groupCls = 'triones-antm-float-button-group';
|
|
20
|
+
export var FloatButtonGroup = function FloatButtonGroup(_ref) {
|
|
21
|
+
var _ref$shape = _ref.shape,
|
|
22
|
+
shape = _ref$shape === void 0 ? 'circle' : _ref$shape,
|
|
23
|
+
_ref$type = _ref.type,
|
|
24
|
+
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
25
|
+
icon = _ref.icon,
|
|
26
|
+
trigger = _ref.trigger,
|
|
27
|
+
openProp = _ref.open,
|
|
28
|
+
onOpenChange = _ref.onOpenChange,
|
|
29
|
+
closeIcon = _ref.closeIcon,
|
|
30
|
+
_ref$placement = _ref.placement,
|
|
31
|
+
placement = _ref$placement === void 0 ? 'top' : _ref$placement,
|
|
32
|
+
onClick = _ref.onClick,
|
|
33
|
+
className = _ref.className,
|
|
34
|
+
style = _ref.style,
|
|
35
|
+
children = _ref.children,
|
|
36
|
+
_ref$right = _ref.right,
|
|
37
|
+
right = _ref$right === void 0 ? 24 : _ref$right,
|
|
38
|
+
_ref$bottom = _ref.bottom,
|
|
39
|
+
bottom = _ref$bottom === void 0 ? 24 : _ref$bottom,
|
|
40
|
+
_ref$zIndex = _ref.zIndex,
|
|
41
|
+
zIndex = _ref$zIndex === void 0 ? 100 : _ref$zIndex;
|
|
42
|
+
var rootRef = useRef(null);
|
|
43
|
+
var isMenu = trigger === 'click' || trigger === 'hover';
|
|
44
|
+
var _useState = useState(false),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
uncontrolledOpen = _useState2[0],
|
|
47
|
+
setUncontrolledOpen = _useState2[1];
|
|
48
|
+
var mergedOpen = openProp !== null && openProp !== void 0 ? openProp : uncontrolledOpen;
|
|
49
|
+
var setOpen = useCallback(function (next) {
|
|
50
|
+
if (openProp === undefined) {
|
|
51
|
+
setUncontrolledOpen(next);
|
|
52
|
+
}
|
|
53
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(next);
|
|
54
|
+
}, [openProp, onOpenChange]);
|
|
55
|
+
var triggerOpen = useCallback(function (next) {
|
|
56
|
+
if (mergedOpen !== next) {
|
|
57
|
+
setOpen(next);
|
|
58
|
+
}
|
|
59
|
+
}, [mergedOpen, setOpen]);
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (!isMenu || trigger !== 'click') return;
|
|
62
|
+
var onDoc = function onDoc(e) {
|
|
63
|
+
var _rootRef$current;
|
|
64
|
+
if ((_rootRef$current = rootRef.current) !== null && _rootRef$current !== void 0 && _rootRef$current.contains(e.target)) return;
|
|
65
|
+
triggerOpen(false);
|
|
66
|
+
};
|
|
67
|
+
document.addEventListener('click', onDoc, true);
|
|
68
|
+
return function () {
|
|
69
|
+
return document.removeEventListener('click', onDoc, true);
|
|
70
|
+
};
|
|
71
|
+
}, [isMenu, trigger, triggerOpen]);
|
|
72
|
+
var onMouseEnter = function onMouseEnter() {
|
|
73
|
+
if (trigger === 'hover') triggerOpen(true);
|
|
74
|
+
};
|
|
75
|
+
var onMouseLeave = function onMouseLeave() {
|
|
76
|
+
if (trigger === 'hover') triggerOpen(false);
|
|
77
|
+
};
|
|
78
|
+
var onTriggerClick = function onTriggerClick(e) {
|
|
79
|
+
if (trigger === 'click') {
|
|
80
|
+
triggerOpen(!mergedOpen);
|
|
81
|
+
}
|
|
82
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
83
|
+
};
|
|
84
|
+
var mergedCloseIcon = closeIcon !== null && closeIcon !== void 0 ? closeIcon : /*#__PURE__*/React.createElement(CloseOutline, null);
|
|
85
|
+
var listVisible = !isMenu || mergedOpen;
|
|
86
|
+
var listNode = /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: classNames("".concat(groupCls, "-list"), _defineProperty({}, "".concat(groupCls, "-list--hidden"), !listVisible)),
|
|
88
|
+
"aria-hidden": !listVisible
|
|
89
|
+
}, children);
|
|
90
|
+
var triggerNode = /*#__PURE__*/React.createElement(FloatButton, {
|
|
91
|
+
type: type,
|
|
92
|
+
shape: shape,
|
|
93
|
+
icon: mergedOpen ? mergedCloseIcon : icon,
|
|
94
|
+
onClick: onTriggerClick
|
|
95
|
+
});
|
|
96
|
+
var ctxValue = useMemo(function () {
|
|
97
|
+
return {
|
|
98
|
+
inGroup: true,
|
|
99
|
+
shape: shape,
|
|
100
|
+
individual: shape === 'circle',
|
|
101
|
+
right: right,
|
|
102
|
+
bottom: bottom,
|
|
103
|
+
zIndex: zIndex
|
|
104
|
+
};
|
|
105
|
+
}, [shape, right, bottom, zIndex]);
|
|
106
|
+
var rootClass = classNames(groupCls, "".concat(groupCls, "--placement-").concat(placement), _defineProperty({}, "".concat(groupCls, "--menu"), isMenu), className);
|
|
107
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
ref: rootRef,
|
|
109
|
+
className: rootClass,
|
|
110
|
+
style: _objectSpread({
|
|
111
|
+
zIndex: zIndex,
|
|
112
|
+
right: "".concat(right, "Px"),
|
|
113
|
+
bottom: "calc(".concat(bottom, "Px + env(safe-area-inset-bottom, 0px))")
|
|
114
|
+
}, style),
|
|
115
|
+
onMouseEnter: onMouseEnter,
|
|
116
|
+
onMouseLeave: onMouseLeave
|
|
117
|
+
}, /*#__PURE__*/React.createElement(FloatButtonGroupContext.Provider, {
|
|
118
|
+
value: ctxValue
|
|
119
|
+
}, isMenu ? /*#__PURE__*/React.createElement(React.Fragment, null, placement === 'bottom' ? /*#__PURE__*/React.createElement(React.Fragment, null, triggerNode, listNode) : placement === 'right' ? /*#__PURE__*/React.createElement(React.Fragment, null, triggerNode, listNode) : /*#__PURE__*/React.createElement(React.Fragment, null, listNode, triggerNode)) : children));
|
|
120
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type FloatButtonGroupContextValue = {
|
|
3
|
+
/** 是否在 FloatButton.Group 内(组内子按钮不使用 fixed 定位) */
|
|
4
|
+
inGroup: boolean;
|
|
5
|
+
/** 组级 shape,覆盖子项 */
|
|
6
|
+
shape?: 'circle' | 'square';
|
|
7
|
+
/** 与 antd 一致:circle 组为 true */
|
|
8
|
+
individual?: boolean;
|
|
9
|
+
right?: number;
|
|
10
|
+
bottom?: number;
|
|
11
|
+
zIndex?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const FloatButtonGroupContext: React.Context<FloatButtonGroupContextValue | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
3
|
+
import FloatButton from "../index";
|
|
4
|
+
export default (function () {
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
6
|
+
title: "\u57FA\u7840\u7528\u6CD5"
|
|
7
|
+
}, /*#__PURE__*/React.createElement(FloatButton, {
|
|
8
|
+
type: "primary"
|
|
9
|
+
})));
|
|
10
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
3
|
+
import FloatButton from "../index";
|
|
4
|
+
export default (function () {
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
6
|
+
title: "\u6309\u94AE\u7EC4\uFF08\u83DC\u5355\uFF09"
|
|
7
|
+
}, /*#__PURE__*/React.createElement(FloatButton.Group, {
|
|
8
|
+
trigger: "click",
|
|
9
|
+
type: "primary",
|
|
10
|
+
placement: "top"
|
|
11
|
+
}, /*#__PURE__*/React.createElement(FloatButton, {
|
|
12
|
+
icon: /*#__PURE__*/React.createElement("span", {
|
|
13
|
+
"aria-label": "search"
|
|
14
|
+
}, "\uD83D\uDD0D")
|
|
15
|
+
}), /*#__PURE__*/React.createElement(FloatButton, {
|
|
16
|
+
icon: /*#__PURE__*/React.createElement("span", {
|
|
17
|
+
"aria-label": "edit"
|
|
18
|
+
}, "\u270E")
|
|
19
|
+
}))));
|
|
20
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
3
|
+
import FloatButton from "../index";
|
|
4
|
+
export default (function () {
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
6
|
+
title: "\u65B9\u5F62\u4E0E\u63CF\u8FF0"
|
|
7
|
+
}, /*#__PURE__*/React.createElement(FloatButton, {
|
|
8
|
+
type: "primary",
|
|
9
|
+
shape: "square",
|
|
10
|
+
content: "\u5E2E\u52A9"
|
|
11
|
+
})));
|
|
12
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FloatButton as InternalFloatButton, FloatButtonProps } from "./FloatButton";
|
|
2
|
+
import { FloatButtonGroup } from "./FloatButtonGroup";
|
|
3
|
+
type InternalFloatButtonType = typeof InternalFloatButton;
|
|
4
|
+
type CompoundedComponent = InternalFloatButtonType & {
|
|
5
|
+
Group: typeof FloatButtonGroup;
|
|
6
|
+
};
|
|
7
|
+
declare const FloatButton: CompoundedComponent;
|
|
8
|
+
export type { FloatButtonProps };
|
|
9
|
+
export type { FloatButtonGroupProps } from "./FloatButtonGroup";
|
|
10
|
+
export default FloatButton;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
|
+
|
|
3
|
+
$floatButtonCls: "triones-antm-float-button";
|
|
4
|
+
$floatButtonGroupCls: "triones-antm-float-button-group";
|
|
5
|
+
|
|
6
|
+
$floatButtonSize: 48Px;
|
|
7
|
+
$floatButtonShadow: 0 6Px 16Px 0 rgba(0, 0, 0, 0.08),
|
|
8
|
+
0 3Px 6Px -4Px rgba(0, 0, 0, 0.12), 0 9Px 28Px 8Px rgba(0, 0, 0, 0.05);
|
|
9
|
+
|
|
10
|
+
.#{$floatButtonCls} {
|
|
11
|
+
position: fixed;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
|
|
16
|
+
&--embedded {
|
|
17
|
+
position: relative;
|
|
18
|
+
right: auto;
|
|
19
|
+
bottom: auto;
|
|
20
|
+
z-index: auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-body {
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
margin: 0;
|
|
26
|
+
padding: 0;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
gap: 8Px;
|
|
31
|
+
min-width: $floatButtonSize;
|
|
32
|
+
min-height: $floatButtonSize;
|
|
33
|
+
border: none;
|
|
34
|
+
border-radius: 50%;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
font-size: 20Px;
|
|
37
|
+
line-height: 1;
|
|
38
|
+
color: rgba(0, 0, 0, 0.88);
|
|
39
|
+
background: #fff;
|
|
40
|
+
box-shadow: $floatButtonShadow;
|
|
41
|
+
transition: color 0.2s, background 0.2s, box-shadow 0.2s;
|
|
42
|
+
-webkit-tap-highlight-color: transparent;
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
|
|
45
|
+
&:active {
|
|
46
|
+
filter: brightness(0.95);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&--shape-square &-body {
|
|
51
|
+
border-radius: variable.$trionesBorderRadius;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&--has-content &-body {
|
|
55
|
+
min-height: $floatButtonSize;
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&--type-primary &-body {
|
|
63
|
+
color: #fff;
|
|
64
|
+
background: variable.$trionesColorPrimary;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&-icon {
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&-content {
|
|
74
|
+
font-size: variable.$trionesFontSizeSm;
|
|
75
|
+
font-weight: 500;
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.#{$floatButtonGroupCls} {
|
|
81
|
+
position: fixed;
|
|
82
|
+
z-index: 100;
|
|
83
|
+
bottom: calc(24Px + env(safe-area-inset-bottom, 0px));
|
|
84
|
+
display: flex;
|
|
85
|
+
gap: 12Px;
|
|
86
|
+
align-items: flex-end;
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
|
|
89
|
+
&--placement {
|
|
90
|
+
&-top {
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
}
|
|
93
|
+
&-bottom {
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
}
|
|
96
|
+
&-left {
|
|
97
|
+
flex-direction: row;
|
|
98
|
+
}
|
|
99
|
+
&-right {
|
|
100
|
+
flex-direction: row;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&--menu {
|
|
105
|
+
align-items: center;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&-list {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
gap: 12Px;
|
|
112
|
+
align-items: flex-end;
|
|
113
|
+
|
|
114
|
+
&--hidden {
|
|
115
|
+
display: none;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&--placement-left &-list,
|
|
120
|
+
&--placement-right &-list {
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
}
|
|
123
|
+
}
|
package/dist/Footer/demo/base.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Rule } from 'rc-field-form/lib/interface';
|
|
2
|
+
import React, { FC } from 'react';
|
|
3
|
+
import { FormHorizontalAlign } from "@trionesdev/antd-mobile-base-react";
|
|
4
|
+
type FormItemInputProps = {
|
|
5
|
+
children?: React.ReactElement;
|
|
6
|
+
className?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
rules?: Rule[];
|
|
9
|
+
initialValue?: any;
|
|
10
|
+
contentAlign?: FormHorizontalAlign;
|
|
11
|
+
valuePropName?: string;
|
|
12
|
+
errors?: React.ReactNode[];
|
|
13
|
+
errorRender?: (errors?: any[]) => React.ReactNode;
|
|
14
|
+
hiddenError?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const FormItemContent: FC<FormItemInputProps>;
|
|
17
|
+
export {};
|
|
@@ -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-es';
|
|
9
|
+
import { Field } from 'rc-field-form';
|
|
10
|
+
import React, { useState } from 'react';
|
|
11
|
+
export var FormItemContent = function FormItemContent(_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(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 { FormItemLayout } from '@trionesdev/antd-mobile-base-react';
|
|
2
|
+
import { NamePath } from 'rc-field-form/lib/interface';
|
|
3
|
+
import React, { CSSProperties, FC } from 'react';
|
|
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,29 @@
|
|
|
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 { useFormContext } from '@trionesdev/antd-mobile-base-react';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { isFunction } from 'lodash-es';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
export var FormItemLabel = function FormItemLabel(_ref) {
|
|
10
|
+
var className = _ref.className,
|
|
11
|
+
style = _ref.style,
|
|
12
|
+
label = _ref.label,
|
|
13
|
+
layout = _ref.layout,
|
|
14
|
+
required = _ref.required;
|
|
15
|
+
var _useFormContext = useFormContext(),
|
|
16
|
+
requiredMark = _useFormContext.requiredMark,
|
|
17
|
+
colon = _useFormContext.colon;
|
|
18
|
+
var clsPrefix = "triones-antm-form-item-label";
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: classNames(className, _defineProperty({}, "".concat(clsPrefix, "-required"), required)),
|
|
21
|
+
style: style
|
|
22
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: classNames("".concat(clsPrefix, "-wrapper"))
|
|
24
|
+
}, required && /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: "".concat(clsPrefix, "-required-mark")
|
|
26
|
+
}, isFunction(requiredMark) ? requiredMark(label, {
|
|
27
|
+
required: required
|
|
28
|
+
}) : '*'), label, layout === 'horizontal' && colon && ':'));
|
|
29
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FormHorizontalAlign, FormItemLayout } from '@trionesdev/antd-mobile-base-react';
|
|
2
|
+
import { NamePath, Rule } from 'rc-field-form/lib/interface';
|
|
3
|
+
import React, { CSSProperties, FC, ReactElement, ReactNode } from 'react';
|
|
4
|
+
export type FormItemProps = {
|
|
5
|
+
/**
|
|
6
|
+
* @description 类
|
|
7
|
+
* @default
|
|
8
|
+
*/
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
children?: ReactElement;
|
|
12
|
+
/**
|
|
13
|
+
* @description 布局
|
|
14
|
+
* @default
|
|
15
|
+
*/
|
|
16
|
+
layout?: FormItemLayout;
|
|
17
|
+
/**
|
|
18
|
+
* @description 标签
|
|
19
|
+
* @default
|
|
20
|
+
*/
|
|
21
|
+
label?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* @description 标签对齐方式
|
|
24
|
+
* @default left
|
|
25
|
+
*/
|
|
26
|
+
labelAlign?: FormHorizontalAlign;
|
|
27
|
+
/**
|
|
28
|
+
* @description 标签宽度
|
|
29
|
+
* @default
|
|
30
|
+
*/
|
|
31
|
+
labelWidth?: number;
|
|
32
|
+
/**
|
|
33
|
+
* @description 输入框对齐方式
|
|
34
|
+
* @default
|
|
35
|
+
*/
|
|
36
|
+
contentAlign?: FormHorizontalAlign;
|
|
37
|
+
/**
|
|
38
|
+
* @description 字段名
|
|
39
|
+
* @default
|
|
40
|
+
*/
|
|
41
|
+
name?: NamePath;
|
|
42
|
+
required?: boolean;
|
|
43
|
+
hidden?: boolean;
|
|
44
|
+
noStyle?: boolean;
|
|
45
|
+
rules?: Rule[];
|
|
46
|
+
initialValue?: any;
|
|
47
|
+
valuePropName?: string;
|
|
48
|
+
errorRender?: (errors?: any[]) => React.ReactNode;
|
|
49
|
+
extra?: ReactNode;
|
|
50
|
+
};
|
|
51
|
+
export declare const FormItem: FC<FormItemProps>;
|
|
@@ -0,0 +1,74 @@
|
|
|
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", "contentAlign", "name", "required", "hidden", "noStyle", "rules", "initialValue", "valuePropName", "errorRender", "extra"];
|
|
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 { useFormContext } from '@trionesdev/antd-mobile-base-react';
|
|
10
|
+
import classNames from 'classnames';
|
|
11
|
+
import { Field } from 'rc-field-form';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { FormItemContent } from "./form-item-content";
|
|
14
|
+
import { FormItemLabel } from "./form-item-label";
|
|
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
|
+
contentAlign = _ref.contentAlign,
|
|
24
|
+
name = _ref.name,
|
|
25
|
+
required = _ref.required,
|
|
26
|
+
_ref$hidden = _ref.hidden,
|
|
27
|
+
hidden = _ref$hidden === void 0 ? false : _ref$hidden,
|
|
28
|
+
_ref$noStyle = _ref.noStyle,
|
|
29
|
+
noStyle = _ref$noStyle === void 0 ? false : _ref$noStyle,
|
|
30
|
+
rules = _ref.rules,
|
|
31
|
+
initialValue = _ref.initialValue,
|
|
32
|
+
valuePropName = _ref.valuePropName,
|
|
33
|
+
errorRender = _ref.errorRender,
|
|
34
|
+
extra = _ref.extra,
|
|
35
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
+
// const { layout: formLayout, labelAlign: formLayoutAlign, labelWidth: formLabelWidth, hiddenError, extra: formExtra } = useFormContext()
|
|
37
|
+
var ctx = useFormContext();
|
|
38
|
+
var formItemLayout = layout ? layout : ctx.layout === 'inline' ? 'horizontal' : ctx.layout;
|
|
39
|
+
var formItemAlign = labelAlign ? labelAlign : ctx.labelAlign || 'left';
|
|
40
|
+
var formItemLabelWidth = labelWidth ? labelWidth : ctx.labelWidth;
|
|
41
|
+
var formItemExtra = extra !== undefined ? extra : ctx.extra;
|
|
42
|
+
var formItemWrapperAlign = contentAlign ? contentAlign : ctx.contentAlign;
|
|
43
|
+
var clsPrefix = 'triones-antm-form-item';
|
|
44
|
+
if (noStyle) {
|
|
45
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
46
|
+
name: name,
|
|
47
|
+
rules: rules,
|
|
48
|
+
valuePropName: valuePropName,
|
|
49
|
+
trigger: 'onChange',
|
|
50
|
+
initialValue: initialValue
|
|
51
|
+
}, children);
|
|
52
|
+
}
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: classNames(clsPrefix, "".concat(clsPrefix, "-").concat(formItemLayout), className, _defineProperty({}, "".concat(clsPrefix, "-hidden"), hidden)),
|
|
55
|
+
style: style
|
|
56
|
+
}, label && /*#__PURE__*/React.createElement(FormItemLabel, {
|
|
57
|
+
className: classNames("".concat(clsPrefix, "-label"), "".concat(clsPrefix, "-label-").concat(formItemAlign)),
|
|
58
|
+
style: {
|
|
59
|
+
width: formItemLabelWidth
|
|
60
|
+
},
|
|
61
|
+
layout: formItemLayout,
|
|
62
|
+
label: label,
|
|
63
|
+
required: required
|
|
64
|
+
}), /*#__PURE__*/React.createElement(FormItemContent, _extends({
|
|
65
|
+
className: classNames("".concat(clsPrefix, "-content"), _defineProperty({}, "".concat(clsPrefix, "-content-").concat(formItemWrapperAlign), formItemWrapperAlign))
|
|
66
|
+
}, props, {
|
|
67
|
+
name: name,
|
|
68
|
+
rules: rules,
|
|
69
|
+
errorRender: errorRender,
|
|
70
|
+
initialValue: initialValue,
|
|
71
|
+
valuePropName: valuePropName,
|
|
72
|
+
hiddenError: ctx.hiddenError
|
|
73
|
+
}), children), formItemExtra);
|
|
74
|
+
};
|
package/dist/Form/demo/input.js
CHANGED
|
@@ -7,7 +7,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { DemoBlock } from "../../DemoBlock";
|
|
9
9
|
import Form from "../index";
|
|
10
|
-
import { Input } from "../../index";
|
|
10
|
+
import { Input, Stepper } from "../../index";
|
|
11
11
|
import Button from "../../Button";
|
|
12
12
|
export default (function () {
|
|
13
13
|
var _Form$useForm = Form.useForm(),
|
|
@@ -16,16 +16,20 @@ export default (function () {
|
|
|
16
16
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
17
17
|
title: "\u6C34\u5E73\u8868\u5355"
|
|
18
18
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
19
|
-
form: form
|
|
19
|
+
form: form,
|
|
20
|
+
labelWidth: 100
|
|
20
21
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
21
22
|
label: "\u7528\u6237\u540D",
|
|
22
23
|
name: "username"
|
|
23
24
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
24
25
|
placeholder: "\u8BF7\u8F93\u5165\u7528\u6237\u540D"
|
|
25
26
|
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
27
|
+
label: "\u5E74\u9F84",
|
|
28
|
+
name: "age"
|
|
29
|
+
}, /*#__PURE__*/React.createElement(Stepper, null)), /*#__PURE__*/React.createElement(Form.Item, {
|
|
26
30
|
label: "\u8BF4\u660E",
|
|
27
31
|
name: "description"
|
|
28
|
-
}, /*#__PURE__*/React.createElement(Input.
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Input.Textarea, {
|
|
29
33
|
placeholder: "\u8BF7\u8F93\u5165\u8BF4\u660E"
|
|
30
34
|
}))), /*#__PURE__*/React.createElement(Button, {
|
|
31
35
|
type: "primary",
|