@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,229 @@
|
|
|
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
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(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; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
import classNames from 'classnames';
|
|
16
|
+
import React, { useEffect, useState } from 'react';
|
|
17
|
+
import { DescriptionItem, DescriptionItemContent, DescriptionItemLabel } from "./DescriptionItem";
|
|
18
|
+
import "./style.scss";
|
|
19
|
+
import { cls } from "./types";
|
|
20
|
+
export var Descriptions = function Descriptions(_ref) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
styles = _ref.styles,
|
|
23
|
+
_ref$colon = _ref.colon,
|
|
24
|
+
colon = _ref$colon === void 0 ? true : _ref$colon,
|
|
25
|
+
_ref$columns = _ref.columns,
|
|
26
|
+
columns = _ref$columns === void 0 ? 1 : _ref$columns,
|
|
27
|
+
_ref$layout = _ref.layout,
|
|
28
|
+
layout = _ref$layout === void 0 ? 'horizontal' : _ref$layout,
|
|
29
|
+
labelWidth = _ref.labelWidth,
|
|
30
|
+
_ref$bordered = _ref.bordered,
|
|
31
|
+
bordered = _ref$bordered === void 0 ? false : _ref$bordered,
|
|
32
|
+
_ref$items = _ref.items,
|
|
33
|
+
items = _ref$items === void 0 ? [] : _ref$items;
|
|
34
|
+
var _useState = useState(),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
gridTemplateColumns = _useState2[0],
|
|
37
|
+
setGridTemplateColumns = _useState2[1];
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
if (layout === 'horizontal') {
|
|
40
|
+
var templateColumns = [];
|
|
41
|
+
if (bordered) {
|
|
42
|
+
for (var i = 0; i < columns; i++) {
|
|
43
|
+
templateColumns.push("".concat(labelWidth ? labelWidth + 'px' : 'minmax(0, 1fr)', " minmax(0, 1fr)"));
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
for (var _i = 0; _i < columns; _i++) {
|
|
47
|
+
templateColumns.push("minmax(0, 1fr)");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
setGridTemplateColumns("".concat(templateColumns.join(' ')));
|
|
51
|
+
}
|
|
52
|
+
}, [layout, labelWidth, columns]);
|
|
53
|
+
var handleBuildCells = function handleBuildCells(items) {
|
|
54
|
+
var _items$filter;
|
|
55
|
+
var itemMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
56
|
+
var elements = [[]];
|
|
57
|
+
items === null || items === void 0 || (_items$filter = items.filter(function (item) {
|
|
58
|
+
return item.hidden !== true;
|
|
59
|
+
})) === null || _items$filter === void 0 || _items$filter.forEach(function (item, index) {
|
|
60
|
+
var _item$span, _item$span2;
|
|
61
|
+
var span = ((_item$span = item.span) !== null && _item$span !== void 0 ? _item$span : 1) > columns ? columns : (_item$span2 = item.span) !== null && _item$span2 !== void 0 ? _item$span2 : 1;
|
|
62
|
+
var rowElements = elements[elements.length - 1];
|
|
63
|
+
var countSpan = rowElements.map(function (item) {
|
|
64
|
+
return item.span;
|
|
65
|
+
}).reduce(function (acc, cur) {
|
|
66
|
+
return acc + cur;
|
|
67
|
+
}, 0);
|
|
68
|
+
if (countSpan === columns) {
|
|
69
|
+
if (itemMode) {
|
|
70
|
+
elements.push([{
|
|
71
|
+
span: span,
|
|
72
|
+
children: /*#__PURE__*/React.createElement(DescriptionItem, {
|
|
73
|
+
style: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
74
|
+
styles: {
|
|
75
|
+
label: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
76
|
+
content: styles === null || styles === void 0 ? void 0 : styles.content
|
|
77
|
+
},
|
|
78
|
+
labelWidth: labelWidth,
|
|
79
|
+
label: item.label,
|
|
80
|
+
colon: colon
|
|
81
|
+
}, item.children)
|
|
82
|
+
}]);
|
|
83
|
+
} else {
|
|
84
|
+
elements.push([{
|
|
85
|
+
span: span,
|
|
86
|
+
label: /*#__PURE__*/React.createElement(DescriptionItemLabel, {
|
|
87
|
+
style: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
88
|
+
labelWidth: labelWidth,
|
|
89
|
+
label: item.label,
|
|
90
|
+
colon: colon
|
|
91
|
+
}),
|
|
92
|
+
children: /*#__PURE__*/React.createElement(DescriptionItemContent, {
|
|
93
|
+
style: styles === null || styles === void 0 ? void 0 : styles.content
|
|
94
|
+
}, item.children)
|
|
95
|
+
}]);
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
if (countSpan + span > columns) {
|
|
99
|
+
rowElements[rowElements.length - 1].span = rowElements[rowElements.length - 1].span + (columns - countSpan);
|
|
100
|
+
if (itemMode) {
|
|
101
|
+
elements.push([{
|
|
102
|
+
span: span,
|
|
103
|
+
children: /*#__PURE__*/React.createElement(DescriptionItem, {
|
|
104
|
+
style: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
105
|
+
styles: {
|
|
106
|
+
label: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
107
|
+
content: styles === null || styles === void 0 ? void 0 : styles.content
|
|
108
|
+
},
|
|
109
|
+
labelWidth: labelWidth,
|
|
110
|
+
label: item.label,
|
|
111
|
+
colon: colon
|
|
112
|
+
}, item.children)
|
|
113
|
+
}]);
|
|
114
|
+
} else {
|
|
115
|
+
elements.push([{
|
|
116
|
+
span: span,
|
|
117
|
+
label: /*#__PURE__*/React.createElement(DescriptionItemLabel, {
|
|
118
|
+
style: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
119
|
+
labelWidth: labelWidth,
|
|
120
|
+
label: item.label,
|
|
121
|
+
colon: colon
|
|
122
|
+
}),
|
|
123
|
+
children: /*#__PURE__*/React.createElement(DescriptionItemContent, {
|
|
124
|
+
style: styles === null || styles === void 0 ? void 0 : styles.content
|
|
125
|
+
}, item.children)
|
|
126
|
+
}]);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
if (itemMode) {
|
|
130
|
+
elements.push([{
|
|
131
|
+
span: span,
|
|
132
|
+
children: /*#__PURE__*/React.createElement(DescriptionItem, {
|
|
133
|
+
style: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
134
|
+
styles: {
|
|
135
|
+
label: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
136
|
+
content: styles === null || styles === void 0 ? void 0 : styles.content
|
|
137
|
+
},
|
|
138
|
+
labelWidth: labelWidth,
|
|
139
|
+
label: item.label,
|
|
140
|
+
colon: colon
|
|
141
|
+
}, item.children)
|
|
142
|
+
}]);
|
|
143
|
+
} else {
|
|
144
|
+
rowElements.push({
|
|
145
|
+
span: span,
|
|
146
|
+
label: /*#__PURE__*/React.createElement(DescriptionItemLabel, {
|
|
147
|
+
style: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
148
|
+
labelWidth: labelWidth,
|
|
149
|
+
label: item.label,
|
|
150
|
+
colon: colon
|
|
151
|
+
}),
|
|
152
|
+
children: /*#__PURE__*/React.createElement(DescriptionItemContent, {
|
|
153
|
+
style: styles === null || styles === void 0 ? void 0 : styles.content
|
|
154
|
+
}, item.children)
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (index === items.length - 1) {
|
|
160
|
+
var _rowElements = elements[elements.length - 1];
|
|
161
|
+
var _countSpan = _rowElements.map(function (item) {
|
|
162
|
+
return item.span;
|
|
163
|
+
}).reduce(function (acc, cur) {
|
|
164
|
+
return acc + cur;
|
|
165
|
+
}, 0);
|
|
166
|
+
_rowElements[_rowElements.length - 1].span = _rowElements[_rowElements.length - 1].span + (columns - _countSpan);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
return elements;
|
|
170
|
+
};
|
|
171
|
+
var handleItemsRender = function handleItemsRender() {
|
|
172
|
+
if (children && Array.isArray(children)) {}
|
|
173
|
+
if (layout === 'horizontal') {
|
|
174
|
+
var elements = [[]];
|
|
175
|
+
if (bordered) {
|
|
176
|
+
elements = handleBuildCells(items, false);
|
|
177
|
+
return elements.map(function (rowElements) {
|
|
178
|
+
return rowElements.map(function (cellElement) {
|
|
179
|
+
return [/*#__PURE__*/React.cloneElement(cellElement.label, {
|
|
180
|
+
key: cellElement.label.key
|
|
181
|
+
}), /*#__PURE__*/React.cloneElement(cellElement.children, {
|
|
182
|
+
key: cellElement.children.key,
|
|
183
|
+
span: cellElement.span * 2 - 1
|
|
184
|
+
})];
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
} else {
|
|
188
|
+
elements = handleBuildCells(items, true);
|
|
189
|
+
return elements.map(function (rowElements) {
|
|
190
|
+
return rowElements.map(function (cellElement) {
|
|
191
|
+
return /*#__PURE__*/React.cloneElement(cellElement.children, {
|
|
192
|
+
key: cellElement.children.key,
|
|
193
|
+
span: cellElement.span
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
} else if (layout === 'vertical') {
|
|
199
|
+
var _elements = [[]];
|
|
200
|
+
if (bordered) {} else {
|
|
201
|
+
_elements = handleBuildCells(items, false);
|
|
202
|
+
return _elements.map(function (rowElements) {
|
|
203
|
+
var labels = rowElements.map(function (item) {
|
|
204
|
+
return /*#__PURE__*/React.cloneElement(item.label, {
|
|
205
|
+
key: item.children.key,
|
|
206
|
+
span: item.span
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
var contents = rowElements.map(function (item) {
|
|
210
|
+
return /*#__PURE__*/React.cloneElement(item.children, {
|
|
211
|
+
key: item.children.key,
|
|
212
|
+
span: item.span
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
return [].concat(_toConsumableArray(labels), _toConsumableArray(contents));
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
222
|
+
className: classNames(cls, _defineProperty({}, "".concat(cls, "-bordered"), bordered))
|
|
223
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
224
|
+
className: classNames("".concat(cls, "-view")),
|
|
225
|
+
style: {
|
|
226
|
+
gridTemplateColumns: gridTemplateColumns
|
|
227
|
+
}
|
|
228
|
+
}, handleItemsRender()));
|
|
229
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Descriptions as InternalDescriptions } from "./Descriptions";
|
|
2
|
+
import { DescriptionItem } from './DescriptionItem';
|
|
3
|
+
import { DescriptionsProps } from "./types";
|
|
4
|
+
type CompoundedComponent = typeof InternalDescriptions & {
|
|
5
|
+
Item: typeof DescriptionItem;
|
|
6
|
+
};
|
|
7
|
+
declare const Descriptions: CompoundedComponent;
|
|
8
|
+
export type { DescriptionsProps };
|
|
9
|
+
export default Descriptions;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
@import "../style/variable";
|
|
2
|
+
|
|
3
|
+
$descriptionsCls: 'triones-antm-descriptions';
|
|
4
|
+
.#{$descriptionsCls} {
|
|
5
|
+
&-header {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&-view {
|
|
9
|
+
display: grid;
|
|
10
|
+
|
|
11
|
+
.#{$descriptionsCls} {
|
|
12
|
+
&-row {
|
|
13
|
+
display: flex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-item {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
padding: 4Px 4Px;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
&-label {
|
|
22
|
+
color: $trionesColorTextSecondary;
|
|
23
|
+
word-wrap: break-word; /* 允许长单词或URL换行 */
|
|
24
|
+
overflow-wrap: break-word; /* 更标准的属性名 */
|
|
25
|
+
white-space: normal; /* 默认换行行为 */
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-content {
|
|
30
|
+
word-wrap: break-word; /* 允许长单词或URL换行 */
|
|
31
|
+
overflow-wrap: break-word; /* 更标准的属性名 */
|
|
32
|
+
white-space: normal; /* 默认换行行为 */
|
|
33
|
+
flex: 1 auto;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-bordered {
|
|
41
|
+
border: 1Px solid $trionesBorderColor;
|
|
42
|
+
border-radius: $trionesBorderRadius;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
|
|
45
|
+
.#{$descriptionsCls} {
|
|
46
|
+
&-view{
|
|
47
|
+
background-color: rgba(5,5,5,0.06);
|
|
48
|
+
grid-gap: 1Px;
|
|
49
|
+
}
|
|
50
|
+
&-item {
|
|
51
|
+
&-label {
|
|
52
|
+
display: flex;
|
|
53
|
+
background-color: rgb(250, 250, 250);
|
|
54
|
+
align-items: center;
|
|
55
|
+
padding: 4Px 4Px;
|
|
56
|
+
}
|
|
57
|
+
&-content {
|
|
58
|
+
background-color: white;
|
|
59
|
+
padding: 4Px 4Px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
export declare const cls = "triones-antm-descriptions";
|
|
3
|
+
export type DescriptionsProps = {
|
|
4
|
+
/**
|
|
5
|
+
* @description 是否显示行标题冒号
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
colon?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* @description 列数
|
|
11
|
+
* @default 1
|
|
12
|
+
*/
|
|
13
|
+
columns?: number;
|
|
14
|
+
/**
|
|
15
|
+
* @description 布局方式
|
|
16
|
+
* @default horizontal
|
|
17
|
+
*/
|
|
18
|
+
layout?: 'horizontal' | 'vertical';
|
|
19
|
+
/**
|
|
20
|
+
* @description 尺寸
|
|
21
|
+
* @default middle
|
|
22
|
+
*/
|
|
23
|
+
size?: 'small' | 'middle' | 'large';
|
|
24
|
+
/**
|
|
25
|
+
* @description 是否显示边框
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
bordered?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @description label的宽度
|
|
31
|
+
* @default
|
|
32
|
+
*/
|
|
33
|
+
labelWidth?: number;
|
|
34
|
+
/**
|
|
35
|
+
* @description 描述项
|
|
36
|
+
* @default []
|
|
37
|
+
*/
|
|
38
|
+
items: DescriptionItemProps[];
|
|
39
|
+
/**
|
|
40
|
+
* @description 自定义样式
|
|
41
|
+
*/
|
|
42
|
+
styles?: {
|
|
43
|
+
item?: React.CSSProperties;
|
|
44
|
+
label?: React.CSSProperties;
|
|
45
|
+
content?: React.CSSProperties;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type DescriptionItemProps = PropsWithChildren<{
|
|
49
|
+
/**
|
|
50
|
+
* @description 标签
|
|
51
|
+
*/
|
|
52
|
+
label?: React.ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* @description label的宽度
|
|
55
|
+
*/
|
|
56
|
+
labelWidth?: number;
|
|
57
|
+
/**
|
|
58
|
+
* @description label的样式
|
|
59
|
+
*/
|
|
60
|
+
styles?: {
|
|
61
|
+
label?: React.CSSProperties;
|
|
62
|
+
content?: React.CSSProperties;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* @description 内容的样式
|
|
66
|
+
*/
|
|
67
|
+
style?: React.CSSProperties;
|
|
68
|
+
/**
|
|
69
|
+
* @description 跨度
|
|
70
|
+
* @default 1
|
|
71
|
+
*/
|
|
72
|
+
span?: number;
|
|
73
|
+
/**
|
|
74
|
+
* @description 是否显示冒号
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
colon?: boolean;
|
|
78
|
+
hidden?: boolean;
|
|
79
|
+
}>;
|
|
80
|
+
export type DescriptionItemLabelProps = PropsWithChildren<{
|
|
81
|
+
label?: React.ReactNode;
|
|
82
|
+
labelWidth?: number;
|
|
83
|
+
style?: React.CSSProperties;
|
|
84
|
+
span?: number;
|
|
85
|
+
colon?: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
export type DescriptionItemContentProps = PropsWithChildren<{
|
|
88
|
+
style?: React.CSSProperties;
|
|
89
|
+
span?: number;
|
|
90
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var cls = "triones-antm-descriptions";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import './style.scss';
|
|
4
|
+
interface BasicComponent {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
id?: string;
|
|
9
|
+
}
|
|
10
|
+
export type DividerContentPosition = 'left' | 'center' | 'right';
|
|
11
|
+
export type DividerDirection = 'horizontal' | 'vertical';
|
|
12
|
+
export interface DividerProps extends BasicComponent {
|
|
13
|
+
contentPosition: DividerContentPosition;
|
|
14
|
+
direction?: DividerDirection;
|
|
15
|
+
}
|
|
16
|
+
export declare const Divider: FC<Partial<DividerProps> & React.HTMLAttributes<HTMLDivElement>>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var _excluded = ["children", "contentPosition", "style", "className", "direction"];
|
|
2
|
+
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); }
|
|
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 _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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
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); }
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import "./style.scss";
|
|
14
|
+
var ComponentDefaults = {
|
|
15
|
+
className: '',
|
|
16
|
+
style: {}
|
|
17
|
+
};
|
|
18
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
19
|
+
contentPosition: 'center',
|
|
20
|
+
direction: 'horizontal'
|
|
21
|
+
});
|
|
22
|
+
var classPrefix = "triones-antm-divider";
|
|
23
|
+
export var Divider = function Divider(props) {
|
|
24
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
25
|
+
children = _defaultProps$props.children,
|
|
26
|
+
contentPosition = _defaultProps$props.contentPosition,
|
|
27
|
+
style = _defaultProps$props.style,
|
|
28
|
+
className = _defaultProps$props.className,
|
|
29
|
+
direction = _defaultProps$props.direction,
|
|
30
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
31
|
+
var classes = direction === 'horizontal' ? classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(classPrefix), true), "".concat(classPrefix, "-center"), children), "".concat(classPrefix, "-left"), contentPosition === 'left'), "".concat(classPrefix, "-right"), contentPosition === 'right'), "".concat(classPrefix, "-hairline"), true)) : classNames(_defineProperty(_defineProperty({}, "".concat(classPrefix), true), "".concat(classPrefix, "-vertical"), direction === 'vertical'));
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
33
|
+
className: "".concat(classes, " ").concat(className || ''),
|
|
34
|
+
style: style
|
|
35
|
+
}, rest), children);
|
|
36
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@import "../style/variable";
|
|
2
|
+
|
|
3
|
+
$dividerCls: 'triones-antm-divider';
|
|
4
|
+
/* prettier-ignore */
|
|
5
|
+
.#{$dividerCls} {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
font-size: 14PX;
|
|
9
|
+
color: $trionesBorderColor;
|
|
10
|
+
border: 0 solid $trionesBorderColor ;
|
|
11
|
+
width: 100%;
|
|
12
|
+
|
|
13
|
+
&::before,
|
|
14
|
+
&::after {
|
|
15
|
+
content: '';
|
|
16
|
+
border-style: inherit;
|
|
17
|
+
border-color: inherit;
|
|
18
|
+
border-width: 2PX 0 0;
|
|
19
|
+
height: 2PX;
|
|
20
|
+
flex: 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-center,
|
|
24
|
+
&-left,
|
|
25
|
+
&-right {
|
|
26
|
+
&::before {
|
|
27
|
+
margin-right: 8PX;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&::after {
|
|
31
|
+
margin-left: 8PX;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-left {
|
|
36
|
+
&::before {
|
|
37
|
+
max-width: 10%;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-right {
|
|
42
|
+
&::after {
|
|
43
|
+
max-width: 10%;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&-hairline {
|
|
48
|
+
&::before,
|
|
49
|
+
&::after {
|
|
50
|
+
transform: scaleY(0.5);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&-vertical {
|
|
55
|
+
display: inline-block;
|
|
56
|
+
width: auto;
|
|
57
|
+
height: 12PX;
|
|
58
|
+
border-left: 1PX solid #eeeeee;
|
|
59
|
+
margin: 0 8PX;
|
|
60
|
+
vertical-align: middle;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './style.scss';
|
|
4
|
+
import { PropagationEvent } from "../utils/with-stop-propagation";
|
|
5
|
+
import { NativeProps } from "../utils/native-props";
|
|
6
|
+
export type EllipsisProps = {
|
|
7
|
+
content: string;
|
|
8
|
+
direction?: 'start' | 'end' | 'middle';
|
|
9
|
+
rows?: number;
|
|
10
|
+
expandText?: ReactNode;
|
|
11
|
+
collapseText?: ReactNode;
|
|
12
|
+
stopPropagationForActionButtons?: PropagationEvent[];
|
|
13
|
+
onContentClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
14
|
+
defaultExpanded?: boolean;
|
|
15
|
+
} & NativeProps;
|
|
16
|
+
export declare const Ellipsis: FC<EllipsisProps>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import useMeasure from "./useMeasure";
|
|
9
|
+
import "./style.scss";
|
|
10
|
+
import { withStopPropagation } from "../utils/with-stop-propagation";
|
|
11
|
+
import { mergeProps } from "../utils/with-default-props";
|
|
12
|
+
import { withNativeProps } from "../utils/native-props";
|
|
13
|
+
var classPrefix = "triones-antm-ellipsis";
|
|
14
|
+
var defaultProps = {
|
|
15
|
+
direction: 'end',
|
|
16
|
+
rows: 1,
|
|
17
|
+
expandText: '',
|
|
18
|
+
content: '',
|
|
19
|
+
collapseText: '',
|
|
20
|
+
stopPropagationForActionButtons: [],
|
|
21
|
+
onContentClick: function onContentClick() {},
|
|
22
|
+
defaultExpanded: false
|
|
23
|
+
};
|
|
24
|
+
export var Ellipsis = function Ellipsis(p) {
|
|
25
|
+
var props = mergeProps(defaultProps, p);
|
|
26
|
+
var content = props.content,
|
|
27
|
+
_props$direction = props.direction,
|
|
28
|
+
direction = _props$direction === void 0 ? 'end' : _props$direction,
|
|
29
|
+
_props$rows = props.rows,
|
|
30
|
+
rows = _props$rows === void 0 ? 1 : _props$rows,
|
|
31
|
+
expandText = props.expandText,
|
|
32
|
+
collapseText = props.collapseText,
|
|
33
|
+
_props$stopPropagatio = props.stopPropagationForActionButtons,
|
|
34
|
+
stopPropagationForActionButtons = _props$stopPropagatio === void 0 ? [] : _props$stopPropagatio,
|
|
35
|
+
_props$onContentClick = props.onContentClick,
|
|
36
|
+
onContentClick = _props$onContentClick === void 0 ? function () {} : _props$onContentClick,
|
|
37
|
+
_props$defaultExpande = props.defaultExpanded,
|
|
38
|
+
defaultExpanded = _props$defaultExpande === void 0 ? false : _props$defaultExpande;
|
|
39
|
+
|
|
40
|
+
// ============================ Refs ============================
|
|
41
|
+
var rootRef = React.useRef(null);
|
|
42
|
+
|
|
43
|
+
// ========================== Expanded ==========================
|
|
44
|
+
var _React$useState = React.useState(defaultExpanded),
|
|
45
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
46
|
+
expanded = _React$useState2[0],
|
|
47
|
+
setExpanded = _React$useState2[1];
|
|
48
|
+
var expandNode = expandText ? withStopPropagation(stopPropagationForActionButtons, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "triones-antm-ellipsis-icon",
|
|
50
|
+
onClick: function onClick() {
|
|
51
|
+
setExpanded(true);
|
|
52
|
+
}
|
|
53
|
+
}, expandText)) : null;
|
|
54
|
+
var collapseNode = collapseText ? withStopPropagation(stopPropagationForActionButtons, /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "triones-antm-ellipsis-icon",
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
setExpanded(false);
|
|
58
|
+
}
|
|
59
|
+
}, collapseText)) : null;
|
|
60
|
+
|
|
61
|
+
// ========================== Ellipsis ==========================
|
|
62
|
+
var _useMeasure = useMeasure(rootRef, content, rows, direction, expanded, expandNode, collapseNode),
|
|
63
|
+
_useMeasure2 = _slicedToArray(_useMeasure, 2),
|
|
64
|
+
measureNodes = _useMeasure2[0],
|
|
65
|
+
forceResize = _useMeasure2[1];
|
|
66
|
+
|
|
67
|
+
// =========================== Render ===========================
|
|
68
|
+
return withNativeProps(props, /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
ref: rootRef,
|
|
70
|
+
className: classPrefix,
|
|
71
|
+
onClick: function onClick(e) {
|
|
72
|
+
if (e.target === e.currentTarget) {
|
|
73
|
+
onContentClick(e);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, measureNodes));
|
|
77
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
$class-prefix-ellipsis: 'triones-antm-ellipsis';
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
.#{$class-prefix-ellipsis} {
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
line-height: 1.5;
|
|
6
|
+
word-break: break-word;
|
|
7
|
+
|
|
8
|
+
&-icon {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
color: #1677ff;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default function useMeasure(containerRef: React.RefObject<HTMLDivElement>, content: string, rows: number, direction: 'start' | 'end' | 'middle', expanded: boolean, expandNode: React.ReactElement | null, collapseNode: React.ReactElement | null): readonly [React.JSX.Element, () => void];
|