@antscorp/antsomi-ui 1.3.3-beta.34 → 1.3.3-beta.35
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/es/components/atoms/Alert/Alert.js +6 -13
- package/es/components/atoms/Button/index.js +1 -1
- package/es/components/atoms/Button/test.js +6 -6
- package/es/components/atoms/DividerPure/DividerPure.js +15 -4
- package/es/components/atoms/DividerPure/styled.js +6 -36
- package/es/components/atoms/Empty/Empty.js +1 -1
- package/es/components/atoms/FloatButton/index.js +1 -1
- package/es/components/atoms/Grid/Grid.js +2 -2
- package/es/components/atoms/Icon/index.js +15 -28
- package/es/components/atoms/Input/Input.js +32 -21
- package/es/components/atoms/Input/styled.js +12 -102
- package/es/components/atoms/InputDynamic/EditCaretPositioning.js +13 -13
- package/es/components/atoms/InputDynamic/InputDynamic.js +97 -83
- package/es/components/atoms/InputDynamic/PopupShortLink.js +21 -20
- package/es/components/atoms/InputDynamic/styled.js +13 -275
- package/es/components/atoms/InputDynamic/utils.js +114 -104
- package/es/components/atoms/InputNumber/InputNumber.js +14 -3
- package/es/components/atoms/MobileFrame/MobileFrame.js +14 -3
- package/es/components/atoms/MobileFrame/constants.js +1 -1
- package/es/components/atoms/MobileFrame/styled.js +8 -29
- package/es/components/atoms/Pagination/Pagination.js +1 -1
- package/es/components/atoms/Popover/Popover.js +1 -1
- package/es/components/atoms/Popover/styled.js +6 -1
- package/es/components/atoms/PreviewTabs/PreviewTabs.js +31 -20
- package/es/components/atoms/PreviewTabs/styled.js +10 -71
- package/es/components/atoms/Progress/Progress.js +1 -1
- package/es/components/atoms/Radio/index.js +8 -18
- package/es/components/atoms/Rate/Rate.js +1 -1
- package/es/components/atoms/RateV2/RateV2.js +30 -24
- package/es/components/atoms/RequiredLabel/index.js +14 -3
- package/es/components/atoms/RequiredLabel/styled.js +7 -5
- package/es/components/atoms/ScrollBox/index.js +25 -14
- package/es/components/atoms/Segmented/Segmented.js +1 -1
- package/es/components/atoms/Skeleton/Skeleton.js +1 -1
- package/es/components/atoms/Slider/index.js +18 -7
- package/es/components/atoms/Slider/styled.js +10 -38
- package/es/components/atoms/SliderV2/index.js +21 -10
- package/es/components/atoms/Space/Space.js +7 -6
- package/es/components/atoms/Spin/Spin.js +14 -3
- package/es/components/atoms/Spin/styled.js +6 -3
- package/es/components/atoms/Statistic/Statistic.js +1 -1
- package/es/components/atoms/Steps/Steps.js +1 -1
- package/es/components/atoms/Switch/Switch.js +1 -1
- package/es/components/atoms/Text/index.js +15 -4
- package/es/components/atoms/Text/styled.js +11 -40
- package/es/components/atoms/Timeline/Timeline.js +1 -1
- package/es/components/atoms/Watermark/Watermark.js +1 -1
- package/es/components/common/ConfigProvider/ConfigProvider.js +15 -4
- package/es/components/common/ConfigProvider/GlobalStyle.js +8 -569
- package/es/components/icons/AccountCircle.js +13 -2
- package/es/components/icons/AddShoppingCart.js +13 -2
- package/es/components/icons/ArrowGrowIcon.js +13 -2
- package/es/components/icons/AssignmentInd.js +13 -2
- package/es/components/icons/AudioRecordIcon.js +13 -2
- package/es/components/icons/BugIcon.js +13 -2
- package/es/components/icons/Call.js +13 -2
- package/es/components/icons/CameraIcon.js +13 -2
- package/es/components/icons/CaptureIcon.js +13 -2
- package/es/components/icons/Category.js +13 -2
- package/es/components/icons/ChatBubbleOutline.js +13 -2
- package/es/components/icons/CheckSlimIcon.js +13 -2
- package/es/components/icons/CircleNotifications.js +13 -2
- package/es/components/icons/CloseIcon.js +13 -2
- package/es/components/icons/CommentIcon.js +13 -2
- package/es/components/icons/ConfirmationNumber.js +13 -2
- package/es/components/icons/DesktopWindows.js +13 -2
- package/es/components/icons/EventIcon.js +13 -2
- package/es/components/icons/FactCheck.js +13 -2
- package/es/components/icons/FreeDrawIcon.js +13 -2
- package/es/components/icons/GPTIcon.js +2 -2
- package/es/components/icons/GPTIconV2.js +2 -2
- package/es/components/icons/GPTIconV3.js +13 -2
- package/es/components/icons/HighlightIcon.js +13 -2
- package/es/components/icons/HightlightAlt.js +13 -2
- package/es/components/icons/HowToReg.js +13 -2
- package/es/components/icons/IdeaIcon.js +13 -2
- package/es/components/icons/Interactive.js +13 -2
- package/es/components/icons/InvisibleIcon.js +13 -2
- package/es/components/icons/List.js +13 -2
- package/es/components/icons/LocalMallIcon.js +13 -2
- package/es/components/icons/MobileFriendly.js +13 -2
- package/es/components/icons/MuteIcon.js +13 -2
- package/es/components/icons/NotificationsActive.js +13 -2
- package/es/components/icons/OpenUrlIcon.js +13 -2
- package/es/components/icons/PauseIcon.js +13 -2
- package/es/components/icons/Payment.js +13 -2
- package/es/components/icons/PersonAddDisabled.js +13 -2
- package/es/components/icons/PhoneCallback.js +13 -2
- package/es/components/icons/PlaneIcon.js +13 -2
- package/es/components/icons/Preview.js +13 -2
- package/es/components/icons/Redeem.js +13 -2
- package/es/components/icons/RemoveRedEye.js +13 -2
- package/es/components/icons/RemoveShoppingCart.js +13 -2
- package/es/components/icons/RequestIcon.js +13 -2
- package/es/components/icons/Search.js +13 -2
- package/es/components/icons/ShoppingBag.js +13 -2
- package/es/components/icons/ShoppingCart.js +13 -2
- package/es/components/icons/StopRecordIcon.js +13 -2
- package/es/components/icons/Store.js +13 -2
- package/es/components/icons/UserIcon.js +13 -2
- package/es/components/icons/VerticalDotsIcon.js +13 -2
- package/es/components/icons/WarningIcon.js +13 -2
- package/es/components/icons/Web.js +13 -2
- package/es/components/icons/WebAsset.js +13 -2
- package/es/components/molecules/AlignSetting/index.js +20 -9
- package/es/components/molecules/AlignSetting/styled.js +6 -5
- package/es/components/molecules/AlignSetting/utils.js +2 -2
- package/es/components/molecules/CaptureScreen/CaptureScreen.js +269 -240
- package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.js +36 -25
- package/es/components/molecules/CaptureScreen/components/CommentBox/styled.js +15 -129
- package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.js +2 -2
- package/es/components/molecules/CaptureScreen/components/Cursor/styled.js +10 -73
- package/es/components/molecules/CaptureScreen/constants.js +7 -7
- package/es/components/molecules/CaptureScreen/hooks/useImageEditor.d.ts +1 -1
- package/es/components/molecules/CaptureScreen/hooks/useImageEditor.js +23 -23
- package/es/components/molecules/CaptureScreen/styled.js +28 -247
- package/es/components/molecules/CaptureScreen/themes/black.js +1 -1
- package/es/components/molecules/CaptureScreen/themes/white.js +1 -1
- package/es/components/molecules/CaptureScreen/utils.js +32 -29
- package/es/components/molecules/Card/Card.js +1 -1
- package/es/components/molecules/ChatBox/ChatBox.js +147 -81
- package/es/components/molecules/ChatBox/MessageItem.js +22 -20
- package/es/components/molecules/ChatBox/constants.js +2 -2
- package/es/components/molecules/ChatBox/styled.js +13 -275
- package/es/components/molecules/Collapse/Collapse.js +4 -3
- package/es/components/molecules/ColorPicker/ChromePicker/index.js +1 -1
- package/es/components/molecules/ColorPicker/ChromePicker/styled.js +6 -11
- package/es/components/molecules/ColorPicker/CustomPicker/index.js +33 -21
- package/es/components/molecules/ColorPicker/CustomPicker/styled.js +14 -95
- package/es/components/molecules/ColorPicker/SketchPicker/index.js +12 -1
- package/es/components/molecules/ColorPicker/SketchPicker/styled.js +6 -6
- package/es/components/molecules/ColorPicker/index.js +17 -17
- package/es/components/molecules/ColorPicker/styled.js +6 -8
- package/es/components/molecules/ColorSetting/index.js +35 -15
- package/es/components/molecules/ColorSetting/styled.js +9 -36
- package/es/components/molecules/DatePicker/DatePicker.js +1 -1
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +146 -112
- package/es/components/molecules/DatePicker/components/AdvancedPicker/constants.js +10 -10
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +12 -45
- package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.js +8 -3
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +28 -9
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/constants.js +1 -1
- package/es/components/molecules/Drawer/Drawer.js +1 -1
- package/es/components/molecules/EdgeSetting/index.js +69 -45
- package/es/components/molecules/EdgeSetting/styled.js +8 -13
- package/es/components/molecules/FontFamilySelect/constants.js +1 -1
- package/es/components/molecules/FontFamilySelect/index.js +33 -10
- package/es/components/molecules/FontSetting/constants.js +2 -2
- package/es/components/molecules/FontSetting/index.js +36 -22
- package/es/components/molecules/FontWeightSelect/constants.js +1 -1
- package/es/components/molecules/FontWeightSelect/index.js +32 -9
- package/es/components/molecules/GradientSetting/index.js +55 -35
- package/es/components/molecules/GradientSetting/styled.js +6 -58
- package/es/components/molecules/IconSelection/components/Icon/index.js +19 -8
- package/es/components/molecules/IconSelection/constants.js +37 -31
- package/es/components/molecules/IconSelection/index.js +56 -43
- package/es/components/molecules/IconSelection/styled.js +10 -74
- package/es/components/molecules/IconSelection/types.js +3 -1
- package/es/components/molecules/IconSelection/utils.js +3 -3
- package/es/components/molecules/InputNumber/index.js +23 -12
- package/es/components/molecules/InputNumberWithUnit/index.js +19 -5
- package/es/components/molecules/InputNumberWithUnit/styled.js +6 -15
- package/es/components/molecules/InputSearch/index.js +14 -3
- package/es/components/molecules/InputSearch/styled.js +6 -43
- package/es/components/molecules/Modal/Modal.js +23 -8
- package/es/components/molecules/Modal/styled.js +17 -69
- package/es/components/molecules/ModalV2/ModalV2.js +17 -6
- package/es/components/molecules/ModalV2/styled.js +6 -19
- package/es/components/molecules/Popconfirm/Popconfirm.js +1 -1
- package/es/components/molecules/PopupDraggable/PopupDraggable.js +25 -13
- package/es/components/molecules/PopupDraggable/styled.js +11 -47
- package/es/components/molecules/PreviewModal/PreviewModal.js +16 -5
- package/es/components/molecules/PreviewModal/styled.js +9 -30
- package/es/components/molecules/RadioGroup/index.js +14 -3
- package/es/components/molecules/RadioGroup/styled.js +7 -11
- package/es/components/molecules/ResizeGrid/ResizeGrid.js +338 -275
- package/es/components/molecules/ResizeGrid/components/Cell/Cell.js +37 -23
- package/es/components/molecules/ResizeGrid/components/Cell/styled.js +6 -78
- package/es/components/molecules/ResizeGrid/constant.js +37 -26
- package/es/components/molecules/ResizeGrid/styled.js +9 -54
- package/es/components/molecules/Result/Result.js +1 -1
- package/es/components/molecules/RichMenuBlock/RichMenuBlock.js +34 -23
- package/es/components/molecules/RichMenuBlock/RichMenuCell/index.js +11 -11
- package/es/components/molecules/RichMenuBlock/RichMenuCell/styled.js +18 -34
- package/es/components/molecules/RichMenuBlock/constants.js +1 -1
- package/es/components/molecules/RichMenuBlock/styled.js +16 -15
- package/es/components/molecules/RichMenuChatBar/RichMenuChatBar.js +17 -6
- package/es/components/molecules/RichMenuChatBar/TypingChat/index.js +3 -3
- package/es/components/molecules/RichMenuChatBar/TypingChat/styled.js +8 -43
- package/es/components/molecules/RichMenuChatBar/styled.js +10 -25
- package/es/components/molecules/RichMenuMobileView/RichMenuMobileView.js +22 -7
- package/es/components/molecules/RichMenuMobileView/styled.js +11 -18
- package/es/components/molecules/Select/Select.js +20 -9
- package/es/components/molecules/Select/Test.js +2 -2
- package/es/components/molecules/Select/styled.js +7 -34
- package/es/components/molecules/SettingWrapper/index.js +2 -2
- package/es/components/molecules/SettingWrapper/styled.js +9 -15
- package/es/components/molecules/SettingWrapperPopover/index.js +16 -4
- package/es/components/molecules/SliderWithInputNumber/index.js +19 -8
- package/es/components/molecules/SliderWithInputNumber/styled.js +6 -3
- package/es/components/molecules/TextDecorationSelect/constants.js +1 -1
- package/es/components/molecules/TextDecorationSelect/index.js +32 -9
- package/es/components/molecules/TextTransformSelect/constants.js +1 -1
- package/es/components/molecules/TextTransformSelect/index.js +32 -9
- package/es/components/molecules/TreeSelect/TreeSelect.js +1 -1
- package/es/components/molecules/UploadImage/MediaIcon.js +2 -2
- package/es/components/molecules/UploadImage/index.js +280 -182
- package/es/components/molecules/UploadImage/styled.js +16 -129
- package/es/components/organism/Help/Help.js +530 -422
- package/es/components/organism/Help/constants.js +12 -11
- package/es/components/organism/Help/styled.js +48 -257
- package/es/components/organism/Help/utils.js +11 -11
- package/es/components/organism/PositionSetting/config.js +2 -2
- package/es/components/organism/PositionSetting/index.js +27 -15
- package/es/components/organism/PositionSetting/styled.js +6 -1
- package/es/components/organism/Table/CrossTabTable/CrossTabTable.js +10 -10
- package/es/components/organism/Table/CrossTabTable/components/CustomCell/CustomCell.js +6 -6
- package/es/components/organism/Table/CrossTabTable/components/CustomCell/styled.js +6 -12
- package/es/components/organism/Table/CrossTabTable/constants.js +3 -3
- package/es/components/organism/Table/CrossTabTable/styled.js +6 -12
- package/es/components/organism/Table/CrossTabTable/utils.js +1 -1
- package/es/components/organism/Table/ExplorePivotTable/ExplorePivotTable.js +23 -12
- package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/CustomCell.js +8 -8
- package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/styled.js +8 -20
- package/es/components/organism/Table/ExplorePivotTable/constants.js +2 -2
- package/es/components/organism/Table/ExplorePivotTable/styled.js +7 -13
- package/es/components/organism/Table/ExplorePivotTable/utils.js +72 -52
- package/es/constants/gradientSetting.js +4 -4
- package/es/constants/keyCode.js +387 -387
- package/es/constants/richMenu.js +2 -2
- package/es/constants/storybook.js +2 -2
- package/es/constants/theme.js +6 -6
- package/es/hooks/index.js +1 -1
- package/es/hooks/useDebounce.js +5 -5
- package/es/hooks/useDeepCompareEffect.js +1 -1
- package/es/locales/i18n.js +2 -2
- package/es/locales/translations.js +23 -7
- package/es/models/SavedImage.js +68 -23
- package/es/models/Upload.js +64 -19
- package/es/models/model.js +5 -3
- package/es/services/MediaTemplateDesign/UploadFile/index.js +102 -46
- package/es/services/Ticket.js +89 -48
- package/es/services/constants.js +3 -3
- package/es/services/index.js +30 -19
- package/es/test.js +36 -25
- package/es/utils/color.js +22 -22
- package/es/utils/common.js +88 -75
- package/es/utils/handleError.js +49 -8
- package/es/utils/loadable.js +18 -6
- package/es/utils/web.js +26 -20
- package/package.json +3 -3
- package/dist/02028cc6be94478e1f13.svg +0 -1
- package/dist/0dfb9214dfd945cd7290.png +0 -1
- package/dist/19a777928d8a4fb24864.svg +0 -1
- package/dist/256cc472918edbfc13f3.ttf +0 -0
- package/dist/42deb30bedf71d95ec56.woff +0 -0
- package/dist/574b7bee0563a9fe9a29.png +0 -1
- package/dist/a772098db05052e4b517.eot +0 -0
- package/dist/bc6bf11c6f5e6743aa4c.png +0 -1
- package/dist/e32f09119052a55cce3c.png +0 -1
- package/dist/e3851b9384a984c6fdb5.png +0 -1
- package/dist/f422f99dc05cb0013092.png +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -69
- package/dist/main.css +0 -69
- package/dist/public/icons/2d496b55d85a9545d7311c073af442bb.png +0 -0
- package/dist/public/icons/2fbb4e0927d18e3f8e5c6511ab88d5b3.png +0 -0
- package/dist/public/icons/84d7dd910e6235dc6ce60657dd3bb062.svg +0 -87
- package/dist/public/icons/90553767e0a05b9585a54797cfd9ce51.png +0 -0
- package/dist/public/icons/97210ba7dc321670f4a144c1b40e88d8.png +0 -0
- package/dist/public/icons/d327b24e9c5d8f486f08d253aab58ce6.png +0 -0
- package/dist/public/icons/f1cf266d0a0a53ce07f2dbb859869b7a.png +0 -0
- package/dist/public/icons/fe347d51ab67ec846138b9a565b3071b.svg +0 -361
- package/dist/public/icons/iphone-top-bar.png +0 -0
- package/dist/public/icons/iphone.png +0 -0
- package/dist/public/icons/placeholder-image.png +0 -0
- package/dist/public/icons/stars_slider.png +0 -0
- package/dist/public/icons/transparent.svg +0 -1
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
13
|
var t = {};
|
|
3
14
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -17,51 +28,51 @@ import { Flex, Icon } from '..';
|
|
|
17
28
|
// Styled
|
|
18
29
|
import { NavigationButton, StyledRichMenuTabs } from './styled';
|
|
19
30
|
import { tryCatchWrapper } from '@antscorp/antsomi-ui/es/utils';
|
|
20
|
-
|
|
31
|
+
var defaultProps = {
|
|
21
32
|
total: 20,
|
|
22
33
|
current: 1,
|
|
23
34
|
};
|
|
24
|
-
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
var PATH = 'antsomi-ui/src/components/atoms/PreviewTabs/PreviewTabs.tsx';
|
|
36
|
+
export var PreviewTabs = function (props) {
|
|
37
|
+
var _a = props.total, total = _a === void 0 ? 20 : _a, _b = props.current, current = _b === void 0 ? 1 : _b, onChange = props.onChange, restProps = __rest(props, ["total", "current", "onChange"]);
|
|
38
|
+
var tabsRef = React.useRef(null);
|
|
28
39
|
// State
|
|
29
|
-
|
|
40
|
+
var _c = useState({
|
|
30
41
|
disablePrev: true,
|
|
31
42
|
disableNext: true,
|
|
32
|
-
});
|
|
43
|
+
}), state = _c[0], setState = _c[1];
|
|
33
44
|
// Variables
|
|
34
|
-
|
|
45
|
+
var disableNext = state.disableNext, disablePrev = state.disablePrev;
|
|
35
46
|
// Handlers
|
|
36
|
-
|
|
47
|
+
var checkScroll = function () {
|
|
37
48
|
if (tabsRef.current) {
|
|
38
|
-
|
|
39
|
-
setState(prevState
|
|
40
|
-
setState(prevState
|
|
49
|
+
var _a = tabsRef.current, scrollLeft_1 = _a.scrollLeft, clientWidth_1 = _a.clientWidth, scrollWidth_1 = _a.scrollWidth;
|
|
50
|
+
setState(function (prevState) { return (__assign(__assign({}, prevState), { disableNext: scrollLeft_1 + clientWidth_1 === scrollWidth_1 })); });
|
|
51
|
+
setState(function (prevState) { return (__assign(__assign({}, prevState), { disablePrev: scrollLeft_1 === 0 })); });
|
|
41
52
|
}
|
|
42
53
|
};
|
|
43
54
|
// Check disable next navigation base length of tabs
|
|
44
|
-
useEffect(()
|
|
55
|
+
useEffect(function () {
|
|
45
56
|
checkScroll();
|
|
46
57
|
}, []);
|
|
47
58
|
// Handlers
|
|
48
|
-
|
|
59
|
+
var onClickNavigation = tryCatchWrapper(function (isPrev) {
|
|
49
60
|
if (tabsRef.current) {
|
|
50
|
-
|
|
61
|
+
var scrollLeft = tabsRef.current.scrollLeft;
|
|
51
62
|
tabsRef.current.scrollTo({ left: scrollLeft + (isPrev ? -40 : 40), behavior: 'smooth' });
|
|
52
63
|
checkScroll();
|
|
53
64
|
}
|
|
54
65
|
}, PATH);
|
|
55
|
-
return (React.createElement(StyledRichMenuTabs,
|
|
66
|
+
return (React.createElement(StyledRichMenuTabs, __assign({}, restProps),
|
|
56
67
|
React.createElement(NavigationButton, { className: cn('navigation--previous', {
|
|
57
68
|
'navigation--disabled': disablePrev,
|
|
58
|
-
}), onClick: ()
|
|
69
|
+
}), onClick: function () { return onClickNavigation(true); } },
|
|
59
70
|
React.createElement(Icon, { type: "icon-ants-angle-left" })),
|
|
60
|
-
React.createElement(Flex, { ref: tabsRef, className: "tabs antsomi-scrollbar-hidden", align: "center", onScroll: ()
|
|
61
|
-
React.createElement(Flex, { align: "center", justify: "center", className: "tabs__label" }, index + 1))))),
|
|
71
|
+
React.createElement(Flex, { ref: tabsRef, className: "tabs antsomi-scrollbar-hidden", align: "center", onScroll: function () { return checkScroll(); } }, Array.from({ length: total }).map(function (_, index) { return (React.createElement(Flex, { key: "".concat(index + 1), align: "center", justify: "center", className: "tabs__item ".concat(current === index + 1 ? 'tabs__item--active' : ''), onClick: function () { return onChange && onChange(index + 1); } },
|
|
72
|
+
React.createElement(Flex, { align: "center", justify: "center", className: "tabs__label" }, index + 1))); })),
|
|
62
73
|
React.createElement(NavigationButton, { className: cn('navigation--next', {
|
|
63
74
|
'navigation--disabled': disableNext,
|
|
64
|
-
}), onClick: ()
|
|
75
|
+
}), onClick: function () { return onClickNavigation(false); } },
|
|
65
76
|
React.createElement(Icon, { type: "icon-ants-angle-right" }))));
|
|
66
77
|
};
|
|
67
78
|
PreviewTabs.defaultProps = defaultProps;
|
|
@@ -1,79 +1,18 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
1
5
|
// Components
|
|
2
6
|
import { Flex } from '../Flex';
|
|
3
7
|
// Styled
|
|
4
8
|
import styled from 'styled-components';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
height: 40px;
|
|
11
|
-
width: ${({ width }) => width || 467}px;
|
|
12
|
-
|
|
13
|
-
.tabs {
|
|
14
|
-
flex: 1;
|
|
15
|
-
width: 100%;
|
|
16
|
-
overflow: auto;
|
|
17
|
-
|
|
18
|
-
&__item {
|
|
19
|
-
flex-shrink: 0;
|
|
20
|
-
height: 40px;
|
|
21
|
-
width: 40px;
|
|
22
|
-
border-right: 1px solid #d4d4d4;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
transition: all 200ms;
|
|
25
|
-
|
|
26
|
-
&--active {
|
|
27
|
-
background-color: #fff;
|
|
28
|
-
|
|
29
|
-
.tabs__label {
|
|
30
|
-
background-color: var(--primary-color);
|
|
31
|
-
color: #fff;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&__label {
|
|
37
|
-
height: 24px;
|
|
38
|
-
width: 24px;
|
|
39
|
-
font-weight: 700;
|
|
40
|
-
font-size: 14px;
|
|
41
|
-
color: var(--primary-color);
|
|
42
|
-
border-radius: 100%;
|
|
43
|
-
border: 1px solid #b8cfe6;
|
|
44
|
-
background-color: #fff;
|
|
45
|
-
transition: all 200ms;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
export const NavigationButton = styled(Flex) `
|
|
50
|
-
width: 40px;
|
|
51
|
-
height: 40px;
|
|
52
|
-
background-color: #fff;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
|
|
55
|
-
i {
|
|
56
|
-
font-size: 12px;
|
|
57
|
-
color: #595959;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&.navigation--previous {
|
|
61
|
-
border-right: 1px solid #d4d4d4;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&.navigation--next {
|
|
65
|
-
border-left: 1px solid #d4d4d4;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&.navigation--disabled {
|
|
69
|
-
cursor: not-allowed;
|
|
70
|
-
|
|
71
|
-
i {
|
|
72
|
-
color: #59595980;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
`;
|
|
9
|
+
export var StyledRichMenuTabs = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n background: #f0f0f0;\n box-shadow: 0px 3px 3px 0px rgba(0, 46, 89, 0.1);\n height: 40px;\n width: ", "px;\n\n .tabs {\n flex: 1;\n width: 100%;\n overflow: auto;\n\n &__item {\n flex-shrink: 0;\n height: 40px;\n width: 40px;\n border-right: 1px solid #d4d4d4;\n cursor: pointer;\n transition: all 200ms;\n\n &--active {\n background-color: #fff;\n\n .tabs__label {\n background-color: var(--primary-color);\n color: #fff;\n }\n }\n }\n\n &__label {\n height: 24px;\n width: 24px;\n font-weight: 700;\n font-size: 14px;\n color: var(--primary-color);\n border-radius: 100%;\n border: 1px solid #b8cfe6;\n background-color: #fff;\n transition: all 200ms;\n }\n }\n"], ["\n display: flex;\n align-items: center;\n background: #f0f0f0;\n box-shadow: 0px 3px 3px 0px rgba(0, 46, 89, 0.1);\n height: 40px;\n width: ", "px;\n\n .tabs {\n flex: 1;\n width: 100%;\n overflow: auto;\n\n &__item {\n flex-shrink: 0;\n height: 40px;\n width: 40px;\n border-right: 1px solid #d4d4d4;\n cursor: pointer;\n transition: all 200ms;\n\n &--active {\n background-color: #fff;\n\n .tabs__label {\n background-color: var(--primary-color);\n color: #fff;\n }\n }\n }\n\n &__label {\n height: 24px;\n width: 24px;\n font-weight: 700;\n font-size: 14px;\n color: var(--primary-color);\n border-radius: 100%;\n border: 1px solid #b8cfe6;\n background-color: #fff;\n transition: all 200ms;\n }\n }\n"])), function (_a) {
|
|
10
|
+
var width = _a.width;
|
|
11
|
+
return width || 467;
|
|
12
|
+
});
|
|
13
|
+
export var NavigationButton = styled(Flex)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 40px;\n height: 40px;\n background-color: #fff;\n cursor: pointer;\n\n i {\n font-size: 12px;\n color: #595959;\n }\n\n &.navigation--previous {\n border-right: 1px solid #d4d4d4;\n }\n\n &.navigation--next {\n border-left: 1px solid #d4d4d4;\n }\n\n &.navigation--disabled {\n cursor: not-allowed;\n\n i {\n color: #59595980;\n }\n }\n"], ["\n width: 40px;\n height: 40px;\n background-color: #fff;\n cursor: pointer;\n\n i {\n font-size: 12px;\n color: #595959;\n }\n\n &.navigation--previous {\n border-right: 1px solid #d4d4d4;\n }\n\n &.navigation--next {\n border-left: 1px solid #d4d4d4;\n }\n\n &.navigation--disabled {\n cursor: not-allowed;\n\n i {\n color: #59595980;\n }\n }\n"])));
|
|
76
14
|
NavigationButton.defaultProps = {
|
|
77
15
|
align: 'center',
|
|
78
16
|
justify: 'center',
|
|
79
17
|
};
|
|
18
|
+
var templateObject_1, templateObject_2;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Progress as AntdProgress } from 'antd';
|
|
2
|
-
export
|
|
2
|
+
export var Progress = AntdProgress;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
1
5
|
var _a, _b, _c, _d;
|
|
2
6
|
// Libraries
|
|
3
7
|
import styled from 'styled-components';
|
|
@@ -5,21 +9,7 @@ import styled from 'styled-components';
|
|
|
5
9
|
import { Radio as AntdRadio } from 'antd';
|
|
6
10
|
// Constants
|
|
7
11
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.antsomi-radio {
|
|
14
|
-
.antsomi-radio-inner {
|
|
15
|
-
border-width: 2px;
|
|
16
|
-
border-color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.colorPrimary};
|
|
17
|
-
|
|
18
|
-
&::after {
|
|
19
|
-
background-color: ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.colorPrimary};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
export const RadioButton = styled(AntdRadio.Button) ``;
|
|
25
|
-
export const RadioGroupSub = styled(AntdRadio.Group) ``;
|
|
12
|
+
export var Radio = styled(AntdRadio)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: 'Roboto';\n color: ", ";\n font-size: ", "px;\n\n .antsomi-radio {\n .antsomi-radio-inner {\n border-width: 2px;\n border-color: ", ";\n\n &::after {\n background-color: ", ";\n }\n }\n }\n"], ["\n font-family: 'Roboto';\n color: ", ";\n font-size: ", "px;\n\n .antsomi-radio {\n .antsomi-radio-inner {\n border-width: 2px;\n border-color: ", ";\n\n &::after {\n background-color: ", ";\n }\n }\n }\n"])), (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorTextBase, (_b = THEME.token) === null || _b === void 0 ? void 0 : _b.fontSize, (_c = THEME.token) === null || _c === void 0 ? void 0 : _c.colorPrimary, (_d = THEME.token) === null || _d === void 0 ? void 0 : _d.colorPrimary);
|
|
13
|
+
export var RadioButton = styled(AntdRadio.Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
|
|
14
|
+
export var RadioGroupSub = styled(AntdRadio.Group)(templateObject_3 || (templateObject_3 = __makeTemplateObject([""], [""])));
|
|
15
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Rate as AntdRate } from 'antd';
|
|
2
|
-
export
|
|
2
|
+
export var Rate = AntdRate;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import StarImage from '@antscorp/antsomi-ui/es/assets/images/stars_slider.png';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
var STAR_WIDTH = 30;
|
|
4
|
+
var parseNumDecimals = function (input, decimals) {
|
|
5
|
+
return +Number.parseFloat(input === null || input === void 0 ? void 0 : input.toString()).toFixed(decimals);
|
|
6
|
+
};
|
|
7
|
+
var roundHalf = function (num) {
|
|
8
|
+
var multiplier = 1 / 0.5;
|
|
7
9
|
return Math.round(num * multiplier) / multiplier;
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
@@ -13,51 +15,55 @@ const roundHalf = (num) => {
|
|
|
13
15
|
* @default type 'full'
|
|
14
16
|
* @returns
|
|
15
17
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
var getWidth = function (width, type) {
|
|
19
|
+
if (type === void 0) { type = 'full'; }
|
|
20
|
+
var numberOfStar = width / STAR_WIDTH;
|
|
18
21
|
return type === 'full'
|
|
19
22
|
? Math.ceil(numberOfStar) * STAR_WIDTH
|
|
20
23
|
: type === 'half'
|
|
21
24
|
? roundHalf(numberOfStar) * STAR_WIDTH
|
|
22
25
|
: width;
|
|
23
26
|
};
|
|
24
|
-
export
|
|
25
|
-
|
|
27
|
+
export var RateV2 = function (_a) {
|
|
28
|
+
var _b = _a.count, count = _b === void 0 ? 5 : _b, className = _a.className, _c = _a.defaultValue, defaultValue = _c === void 0 ? 0 : _c, value = _a.value, _d = _a.type, type = _d === void 0 ? 'full' : _d, onChange = _a.onChange;
|
|
29
|
+
var fullWidth = count * STAR_WIDTH;
|
|
26
30
|
// The width is calculated when move mouse => change the UI, not change the real value
|
|
27
|
-
|
|
31
|
+
var _e = useState(function () {
|
|
32
|
+
return defaultValue ? getWidth(defaultValue * STAR_WIDTH, type) : 0;
|
|
33
|
+
}), fillWidth = _e[0], setFillWidth = _e[1];
|
|
28
34
|
// The real current value that will be return to parent component by onChange function
|
|
29
35
|
// currWidth = value * STAR_WIDTH
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
var _f = useState(0), currWidth = _f[0], setCurrWidth = _f[1];
|
|
37
|
+
var handleMouseMove = function (e) {
|
|
38
|
+
var rect = e.currentTarget.getBoundingClientRect();
|
|
39
|
+
var x = e.clientX - rect.left;
|
|
40
|
+
var hoverWidth = Math.round(x);
|
|
35
41
|
setFillWidth(getWidth(hoverWidth, type));
|
|
36
42
|
};
|
|
37
|
-
|
|
43
|
+
var handleClick = function () {
|
|
38
44
|
// If have no value => auto set current value; if have value => must control value with onChange props
|
|
39
45
|
if (!value)
|
|
40
46
|
setCurrWidth(fillWidth);
|
|
41
47
|
if (onChange)
|
|
42
48
|
onChange(parseNumDecimals(fillWidth / STAR_WIDTH, 2));
|
|
43
49
|
};
|
|
44
|
-
useEffect(()
|
|
50
|
+
useEffect(function () {
|
|
45
51
|
if (typeof value === 'number') {
|
|
46
|
-
|
|
52
|
+
var width = getWidth(value * STAR_WIDTH, type);
|
|
47
53
|
setCurrWidth(width);
|
|
48
54
|
setFillWidth(width);
|
|
49
55
|
}
|
|
50
56
|
}, [value]);
|
|
51
|
-
return (React.createElement("div", { className:
|
|
57
|
+
return (React.createElement("div", { className: "antsomi-rate-continuous".concat(className ? " ".concat(className) : ''), style: {
|
|
52
58
|
position: 'relative',
|
|
53
|
-
width:
|
|
59
|
+
width: "".concat(fullWidth, "px"),
|
|
54
60
|
backgroundPosition: '-27px',
|
|
55
61
|
height: '28px',
|
|
56
|
-
}, onMouseMove: handleMouseMove, onMouseLeave: ()
|
|
62
|
+
}, onMouseMove: handleMouseMove, onMouseLeave: function () { return setFillWidth(currWidth || 0); }, onClick: handleClick },
|
|
57
63
|
React.createElement("div", { className: "custom-rate custom-rate--fill", style: {
|
|
58
64
|
position: 'absolute',
|
|
59
|
-
background:
|
|
60
|
-
width:
|
|
65
|
+
background: "url(".concat(StarImage, ") 0px 0px"),
|
|
66
|
+
width: "".concat(fillWidth, "px"),
|
|
61
67
|
height: '26px',
|
|
62
68
|
zIndex: 1,
|
|
63
69
|
} }),
|
|
@@ -66,8 +72,8 @@ export const RateV2 = ({ count = 5, className, defaultValue = 0, value, type = '
|
|
|
66
72
|
top: '0px',
|
|
67
73
|
left: '0px',
|
|
68
74
|
backgroundImage: 'none',
|
|
69
|
-
background:
|
|
70
|
-
width:
|
|
75
|
+
background: "transparent url(".concat(StarImage, ") 0px -26px"),
|
|
76
|
+
width: "".concat(fullWidth, "px"),
|
|
71
77
|
height: '26px',
|
|
72
78
|
} })));
|
|
73
79
|
};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
13
|
var t = {};
|
|
3
14
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -15,10 +26,10 @@ import React, { memo } from 'react';
|
|
|
15
26
|
import { Text } from '../Text';
|
|
16
27
|
// Styled
|
|
17
28
|
import { StyledRequired } from './styled';
|
|
18
|
-
export
|
|
29
|
+
export var RequiredLabel = memo(function (props) {
|
|
19
30
|
// Props
|
|
20
|
-
|
|
21
|
-
return (React.createElement(Text,
|
|
31
|
+
var children = props.children, _a = props.isReverseMask, isReverseMask = _a === void 0 ? false : _a, restProps = __rest(props, ["children", "isReverseMask"]);
|
|
32
|
+
return (React.createElement(Text, __assign({}, restProps),
|
|
22
33
|
!isReverseMask && React.createElement(StyledRequired, null, "*"),
|
|
23
34
|
children,
|
|
24
35
|
isReverseMask && React.createElement(StyledRequired, null, "*")));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
1
5
|
var _a;
|
|
2
6
|
// Libraries
|
|
3
7
|
import styled from 'styled-components';
|
|
4
8
|
// Constants
|
|
5
9
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
margin-right: 4px;
|
|
10
|
-
`;
|
|
10
|
+
export var RequiredLabelWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
11
|
+
export var StyledRequired = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n margin-right: 4px;\n"], ["\n color: ", ";\n margin-right: 4px;\n"])), (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.red6);
|
|
12
|
+
var templateObject_1, templateObject_2;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
1
16
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
17
|
var t = {};
|
|
3
18
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -15,11 +30,11 @@ import React, { useState, useEffect, useRef } from 'react';
|
|
|
15
30
|
import styled from 'styled-components';
|
|
16
31
|
// Constants
|
|
17
32
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
useEffect(()
|
|
33
|
+
export var ScrollBox = function (props) {
|
|
34
|
+
var children = props.children, height = props.height, maxHeight = props.maxHeight, isPadding = props.isPadding, loadMore = props.loadMore, style = props.style, restOf = __rest(props, ["children", "height", "maxHeight", "isPadding", "loadMore", "style"]);
|
|
35
|
+
var wrapperRef = useRef(null);
|
|
36
|
+
var _a = useState(false), isScroll = _a[0], setIsScroll = _a[1];
|
|
37
|
+
useEffect(function () {
|
|
23
38
|
if (wrapperRef.current && wrapperRef.current.scrollHeight > wrapperRef.current.clientHeight) {
|
|
24
39
|
!isScroll && setIsScroll(true);
|
|
25
40
|
}
|
|
@@ -28,8 +43,8 @@ export const ScrollBox = props => {
|
|
|
28
43
|
}
|
|
29
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
45
|
}, [wrapperRef.current]);
|
|
31
|
-
|
|
32
|
-
|
|
46
|
+
var handleScroll = function (e) {
|
|
47
|
+
var bottom = e.target.scrollTop + e.target.clientHeight >= e.target.scrollHeight;
|
|
33
48
|
if (bottom) {
|
|
34
49
|
if (typeof loadMore === 'function') {
|
|
35
50
|
loadMore();
|
|
@@ -38,14 +53,10 @@ export const ScrollBox = props => {
|
|
|
38
53
|
};
|
|
39
54
|
return (
|
|
40
55
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
41
|
-
React.createElement(Wrapper,
|
|
56
|
+
React.createElement(Wrapper, __assign({ ref: wrapperRef }, __assign(__assign({}, restOf), { style: __assign(__assign(__assign(__assign({}, style), (height && { height: height })), (maxHeight && { maxHeight: maxHeight })), { paddingRight: isScroll && isPadding ? 8 : 0 }) }), { onScroll: handleScroll }), children));
|
|
42
57
|
};
|
|
43
|
-
|
|
44
|
-
height: 100%;
|
|
45
|
-
width: 100%;
|
|
46
|
-
background-color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw0};
|
|
47
|
-
overflow: auto;
|
|
48
|
-
`;
|
|
58
|
+
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100%;\n width: 100%;\n background-color: ", ";\n overflow: auto;\n"], ["\n height: 100%;\n width: 100%;\n background-color: ", ";\n overflow: auto;\n"])), (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw0);
|
|
49
59
|
ScrollBox.defaultProps = {
|
|
50
60
|
isPadding: false,
|
|
51
61
|
};
|
|
62
|
+
var templateObject_1;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Segmented as AntdSegmented } from 'antd';
|
|
2
|
-
export
|
|
2
|
+
export var Segmented = AntdSegmented;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Skeleton as AntdSkeleton } from 'antd';
|
|
2
|
-
export
|
|
2
|
+
export var Skeleton = AntdSkeleton;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
// Libraries
|
|
2
13
|
import React, { memo, useMemo } from 'react';
|
|
3
14
|
// Antd Components
|
|
@@ -5,19 +16,19 @@ import { Slider as AntdSlider } from 'antd';
|
|
|
5
16
|
// Styled
|
|
6
17
|
import { SliderWrapper } from './styled';
|
|
7
18
|
import { omit } from 'lodash';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
export var Slider = memo(function (props) {
|
|
20
|
+
var range = props.range, value = props.value, _a = props.min, min = _a === void 0 ? 0 : _a, _b = props.max, max = _b === void 0 ? 0 : _b, className = props.className, tooltipVisible = props.tooltipVisible;
|
|
21
|
+
var isNegative = useMemo(function () { return !!(!range && min < 0); }, [range, min]);
|
|
22
|
+
var calculateWidth = useMemo(function () { return ((value || 0) * 100) / (Math.abs(max) + Math.abs(min) || 1); }, [min, max, value]);
|
|
23
|
+
var restProps = tooltipVisible === 'default' ? omit(props, ['tooltipVisible']) : props;
|
|
13
24
|
if (isNegative) {
|
|
14
25
|
return (React.createElement(SliderWrapper, { isNegative: true, width: calculateWidth, className: className },
|
|
15
|
-
React.createElement(AntdSlider,
|
|
26
|
+
React.createElement(AntdSlider, __assign({}, omit(restProps, ['marks', 'className']), { marks: {
|
|
16
27
|
0: ' ',
|
|
17
28
|
} }))));
|
|
18
29
|
}
|
|
19
30
|
return (React.createElement(SliderWrapper, { className: className },
|
|
20
|
-
React.createElement(AntdSlider,
|
|
31
|
+
React.createElement(AntdSlider, __assign({}, restProps))));
|
|
21
32
|
});
|
|
22
33
|
Slider.defaultProps = {
|
|
23
34
|
tooltipVisible: false,
|
|
@@ -1,44 +1,16 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
1
5
|
// Libraries
|
|
2
6
|
import styled, { css } from 'styled-components';
|
|
3
7
|
// Constants
|
|
4
8
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
5
|
-
export
|
|
6
|
-
width: 100%;
|
|
7
|
-
|
|
8
|
-
.antsomi-slider {
|
|
9
|
-
${p => {
|
|
9
|
+
export var SliderWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 100%;\n\n .antsomi-slider {\n ", "\n }\n"], ["\n width: 100%;\n\n .antsomi-slider {\n ", "\n }\n"])), function (p) {
|
|
10
10
|
var _a, _b;
|
|
11
|
-
|
|
11
|
+
var width = p.width || 0;
|
|
12
12
|
return p.isNegative
|
|
13
|
-
? css
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.antsomi-slider-track {
|
|
19
|
-
${width < 0
|
|
20
|
-
? css `
|
|
21
|
-
left: auto !important;
|
|
22
|
-
right: 50% !important;
|
|
23
|
-
`
|
|
24
|
-
: css `
|
|
25
|
-
left: 50% !important;
|
|
26
|
-
right: auto !important;
|
|
27
|
-
`}
|
|
28
|
-
|
|
29
|
-
width: ${Math.abs(width)}% !important;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.antsomi-slider-dot {
|
|
33
|
-
top: -4px;
|
|
34
|
-
width: 0.25rem;
|
|
35
|
-
height: 0.875rem;
|
|
36
|
-
border-radius: 0.125rem;
|
|
37
|
-
background-color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.accent1};
|
|
38
|
-
border-color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.accent1};
|
|
39
|
-
}
|
|
40
|
-
`
|
|
41
|
-
: '';
|
|
42
|
-
}}
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
13
|
+
? css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n .antsomi-slider-handle-1 {\n display: none;\n }\n\n .antsomi-slider-track {\n ", "\n\n width: ", "% !important;\n }\n\n .antsomi-slider-dot {\n top: -4px;\n width: 0.25rem;\n height: 0.875rem;\n border-radius: 0.125rem;\n background-color: ", ";\n border-color: ", ";\n }\n "], ["\n .antsomi-slider-handle-1 {\n display: none;\n }\n\n .antsomi-slider-track {\n ", "\n\n width: ", "% !important;\n }\n\n .antsomi-slider-dot {\n top: -4px;\n width: 0.25rem;\n height: 0.875rem;\n border-radius: 0.125rem;\n background-color: ", ";\n border-color: ", ";\n }\n "])), width < 0
|
|
14
|
+
? css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n left: auto !important;\n right: 50% !important;\n "], ["\n left: auto !important;\n right: 50% !important;\n "]))) : css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n left: 50% !important;\n right: auto !important;\n "], ["\n left: 50% !important;\n right: auto !important;\n "]))), Math.abs(width), (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.accent1, (_b = THEME.token) === null || _b === void 0 ? void 0 : _b.accent1) : '';
|
|
15
|
+
});
|
|
16
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
// Libraries
|
|
2
13
|
import React, { useState } from 'react';
|
|
3
14
|
// Antd Components
|
|
4
15
|
import { Slider as AntdSlider } from 'antd';
|
|
5
16
|
// React.FC<SliderProps>
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
17
|
+
export var SliderV2 = function (props) {
|
|
18
|
+
var min = props.min, max = props.max, onChange = props.onChange, styles = props.styles, range = props.range, value = props.value, defaultValue = props.defaultValue, marks = props.marks, defaultSliderTrack = props.defaultSliderTrack;
|
|
19
|
+
var _a = useState(defaultValue || min || 0), valueInternal = _a[0], setValueInternal = _a[1];
|
|
9
20
|
if (min && max && min < 0 && max > 0 && !range && !defaultSliderTrack) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return (React.createElement(AntdSlider,
|
|
21
|
+
var sliderWidth = max - min;
|
|
22
|
+
var calcValue = value || valueInternal;
|
|
23
|
+
var leftTrackPosition = "".concat((Math.abs(calcValue > 0 ? min : min - calcValue) / sliderWidth) * 100, "%");
|
|
24
|
+
var sliderTrackWidth = "".concat((Math.abs(calcValue) / sliderWidth) * 100, "%");
|
|
25
|
+
return (React.createElement(AntdSlider, __assign({ value: value || valueInternal, onChange: function (value) {
|
|
15
26
|
setValueInternal(value);
|
|
16
27
|
if (onChange)
|
|
17
28
|
onChange(value);
|
|
18
|
-
}, styles:
|
|
29
|
+
}, styles: __assign({ track: __assign({ left: leftTrackPosition, width: sliderTrackWidth }, styles === null || styles === void 0 ? void 0 : styles.track) }, styles), marks: marks || { 0: ' ' } }, props)));
|
|
19
30
|
}
|
|
20
|
-
return React.createElement(AntdSlider,
|
|
31
|
+
return React.createElement(AntdSlider, __assign({}, props));
|
|
21
32
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
1
5
|
import styled from 'styled-components';
|
|
2
6
|
// Components
|
|
3
7
|
import { Space as AntdSpace } from 'antd';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
`;
|
|
9
|
-
export const Space = OriginSpace;
|
|
8
|
+
export var OriginSpace = styled(AntdSpace)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.antsomi-space-vertical {\n width: 100%;\n }\n"], ["\n &.antsomi-space-vertical {\n width: 100%;\n }\n"])));
|
|
9
|
+
export var Space = OriginSpace;
|
|
10
|
+
var templateObject_1;
|