@zohodesk/components 1.0.0-alpha-271 → 1.0.0-alpha-272
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/README.md +4 -0
- package/es/Accordion/Accordion.js +7 -3
- package/es/Accordion/AccordionItem.js +4 -2
- package/es/Animation/Animation.js +3 -3
- package/es/AppContainer/AppContainer.js +13 -5
- package/es/Avatar/Avatar.js +23 -11
- package/es/AvatarTeam/AvatarTeam.js +3 -3
- package/es/Button/Button.js +4 -3
- package/es/Buttongroup/Buttongroup.js +3 -3
- package/es/Card/Card.js +21 -10
- package/es/CheckBox/CheckBox.js +5 -3
- package/es/DateTime/CalendarView.js +32 -20
- package/es/DateTime/DateTime.js +75 -10
- package/es/DateTime/DateTimePopupFooter.js +4 -2
- package/es/DateTime/DateTimePopupHeader.js +8 -2
- package/es/DateTime/DateWidget.js +98 -35
- package/es/DateTime/DaysRow.js +4 -2
- package/es/DateTime/Time.js +10 -2
- package/es/DateTime/YearView.js +28 -4
- package/es/DateTime/__tests__/CalendarView.spec.js +1 -0
- package/es/DateTime/__tests__/DateTime.spec.js +1 -0
- package/es/DateTime/__tests__/DateWidget.spec.js +2 -3
- package/es/DateTime/common.js +3 -0
- package/es/DateTime/constants.js +1 -0
- package/es/DateTime/dateFormatUtils/dateFormat.js +63 -30
- package/es/DateTime/dateFormatUtils/dateFormats.js +0 -1
- package/es/DateTime/dateFormatUtils/dayChange.js +13 -4
- package/es/DateTime/dateFormatUtils/index.js +32 -2
- package/es/DateTime/dateFormatUtils/monthChange.js +8 -0
- package/es/DateTime/dateFormatUtils/timeChange.js +22 -6
- package/es/DateTime/dateFormatUtils/yearChange.js +11 -2
- package/es/DateTime/objectUtils.js +14 -20
- package/es/DateTime/props/defaultProps.js +2 -1
- package/es/DateTime/typeChecker.js +3 -0
- package/es/DateTime/validator.js +58 -6
- package/es/DropBox/DropBox.js +6 -2
- package/es/DropBox/DropBoxElement/DropBoxElement.js +7 -0
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -3
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +3 -0
- package/es/DropBox/props/defaultProps.js +1 -2
- package/es/DropBox/props/propTypes.js +1 -2
- package/es/DropDown/DropDown.js +8 -4
- package/es/DropDown/DropDownHeading.js +4 -5
- package/es/DropDown/DropDownItem.js +6 -0
- package/es/DropDown/DropDownSearch.js +4 -0
- package/es/DropDown/DropDownSeparator.js +1 -0
- package/es/DropDown/__tests__/DropDown.spec.js +1 -2
- package/es/Heading/Heading.js +2 -3
- package/es/Label/Label.js +2 -3
- package/es/Layout/Box.js +13 -0
- package/es/Layout/Container.js +12 -1
- package/es/Layout/index.js +1 -2
- package/es/ListItem/ListContainer.js +8 -3
- package/es/ListItem/ListItem.js +9 -3
- package/es/ListItem/ListItemWithAvatar.js +9 -3
- package/es/ListItem/ListItemWithCheckBox.js +7 -2
- package/es/ListItem/ListItemWithIcon.js +8 -3
- package/es/ListItem/ListItemWithRadio.js +7 -3
- package/es/Modal/Modal.js +28 -11
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +89 -13
- package/es/MultiSelect/AdvancedMultiSelect.js +32 -9
- package/es/MultiSelect/EmptyState.js +2 -0
- package/es/MultiSelect/MultiSelect.js +99 -32
- package/es/MultiSelect/MultiSelectHeader.js +3 -0
- package/es/MultiSelect/MultiSelectWithAvatar.js +12 -6
- package/es/MultiSelect/SelectedOptions.js +6 -3
- package/es/MultiSelect/Suggestions.js +7 -3
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +4 -6
- package/es/MultiSelect/props/propTypes.js +2 -0
- package/es/PopOver/PopOver.js +18 -2
- package/es/PopOver/__tests__/PopOver.spec.js +2 -1
- package/es/Popup/Popup.js +77 -24
- package/es/Popup/__tests__/Popup.spec.js +17 -5
- package/es/Popup/viewPort.js +16 -4
- package/es/Provider/IdProvider.js +10 -5
- package/es/Provider/LibraryContext.js +6 -4
- package/es/Provider/NumberGenerator/NumberGenerator.js +21 -7
- package/es/Provider/ZindexProvider.js +9 -2
- package/es/Radio/Radio.js +4 -2
- package/es/Responsive/CustomResponsive.js +30 -18
- package/es/Responsive/RefWrapper.js +6 -7
- package/es/Responsive/ResizeComponent.js +35 -25
- package/es/Responsive/ResizeObserver.js +26 -6
- package/es/Responsive/Responsive.js +34 -20
- package/es/Responsive/index.js +1 -3
- package/es/Responsive/sizeObservers.js +28 -7
- package/es/Responsive/utils/index.js +7 -5
- package/es/Responsive/utils/shallowCompare.js +7 -2
- package/es/Responsive/windowResizeObserver.js +7 -0
- package/es/ResponsiveDropBox/ResponsiveDropBox.js +4 -0
- package/es/Ribbon/Ribbon.js +3 -2
- package/es/RippleEffect/RippleEffect.js +1 -3
- package/es/Select/GroupSelect.js +58 -14
- package/es/Select/Select.js +79 -33
- package/es/Select/SelectWithAvatar.js +17 -4
- package/es/Select/SelectWithIcon.js +46 -5
- package/es/Select/__tests__/Select.spec.js +6 -8
- package/es/Select/props/propTypes.js +1 -0
- package/es/Stencils/Stencils.js +3 -3
- package/es/Switch/Switch.js +5 -3
- package/es/Tab/Tab.js +4 -4
- package/es/Tab/TabContent.js +1 -0
- package/es/Tab/TabContentWrapper.js +2 -0
- package/es/Tab/TabWrapper.js +5 -2
- package/es/Tab/Tabs.js +54 -7
- package/es/Tab/__tests__/Tab.spec.js +1 -3
- package/es/Tab/__tests__/TabWrapper.spec.js +1 -0
- package/es/Tag/Tag.js +6 -3
- package/es/TextBox/TextBox.js +15 -3
- package/es/TextBox/__tests__/TextBox.spec.js +1 -4
- package/es/TextBoxIcon/TextBoxIcon.js +9 -2
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +2 -7
- package/es/Textarea/Textarea.js +12 -3
- package/es/Textarea/__tests__/Textarea.spec.js +2 -2
- package/es/Tooltip/Tooltip.js +58 -14
- package/es/Tooltip/__tests__/Tooltip.spec.js +5 -0
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -2
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +7 -5
- package/es/deprecated/PortalLayer/PortalLayer.js +25 -20
- package/es/semantic/Button/Button.js +3 -2
- package/es/utils/Common.js +54 -9
- package/es/utils/ContextOptimizer.js +4 -5
- package/es/utils/__tests__/debounce.spec.js +2 -2
- package/es/utils/constructFullName.js +2 -0
- package/es/utils/css/compileClassNames.js +5 -0
- package/es/utils/css/mergeStyle.js +7 -6
- package/es/utils/css/utils.js +1 -0
- package/es/utils/datetime/GMTZones.js +48 -0
- package/es/utils/datetime/common.js +31 -7
- package/es/utils/debounce.js +5 -1
- package/es/utils/dropDownUtils.js +68 -11
- package/es/utils/getInitial.js +4 -0
- package/es/utils/shallowEqual.js +6 -0
- package/lib/Accordion/Accordion.js +42 -18
- package/lib/Accordion/AccordionItem.js +40 -18
- package/lib/Accordion/__tests__/Accordion.spec.js +3 -0
- package/lib/Accordion/index.js +3 -0
- package/lib/Accordion/props/propTypes.js +3 -0
- package/lib/Animation/Animation.js +38 -18
- package/lib/Animation/__tests__/Animation.spec.js +11 -7
- package/lib/Animation/props/propTypes.js +3 -0
- package/lib/AppContainer/AppContainer.js +56 -21
- package/lib/AppContainer/props/propTypes.js +3 -0
- package/lib/Avatar/Avatar.js +78 -38
- package/lib/Avatar/__tests__/Avatar.spec.js +44 -0
- package/lib/Avatar/props/propTypes.js +3 -0
- package/lib/AvatarTeam/AvatarTeam.js +52 -30
- package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +13 -0
- package/lib/AvatarTeam/props/propTypes.js +3 -0
- package/lib/Button/Button.js +31 -20
- package/lib/Button/css/cssJSLogic.js +18 -17
- package/lib/Button/index.js +3 -0
- package/lib/Button/props/defaultProps.js +2 -0
- package/lib/Button/props/propTypes.js +3 -0
- package/lib/Buttongroup/Buttongroup.js +32 -12
- package/lib/Buttongroup/__test__/Buttongroup.spec.js +10 -0
- package/lib/Buttongroup/props/propTypes.js +3 -0
- package/lib/Card/Card.js +102 -46
- package/lib/Card/__tests__/Card.spec.js +10 -1
- package/lib/Card/index.js +4 -0
- package/lib/Card/props/propTypes.js +3 -0
- package/lib/CheckBox/CheckBox.js +71 -47
- package/lib/CheckBox/__tests__/CheckBox.spec.js +3 -0
- package/lib/CheckBox/props/propTypes.js +3 -0
- package/lib/DateTime/CalendarView.js +82 -42
- package/lib/DateTime/DateTime.js +246 -158
- package/lib/DateTime/DateTimePopupFooter.js +31 -8
- package/lib/DateTime/DateTimePopupHeader.js +48 -17
- package/lib/DateTime/DateWidget.js +352 -250
- package/lib/DateTime/DaysRow.js +27 -5
- package/lib/DateTime/Time.js +73 -32
- package/lib/DateTime/YearView.js +77 -28
- package/lib/DateTime/__tests__/CalendarView.spec.js +13 -5
- package/lib/DateTime/__tests__/DateTime.spec.js +51 -37
- package/lib/DateTime/__tests__/DateWidget.spec.js +10 -8
- package/lib/DateTime/common.js +6 -0
- package/lib/DateTime/constants.js +1 -0
- package/lib/DateTime/dateFormatUtils/dateFormat.js +184 -122
- package/lib/DateTime/dateFormatUtils/dateFormats.js +0 -1
- package/lib/DateTime/dateFormatUtils/dayChange.js +14 -7
- package/lib/DateTime/dateFormatUtils/index.js +74 -16
- package/lib/DateTime/dateFormatUtils/monthChange.js +19 -9
- package/lib/DateTime/dateFormatUtils/timeChange.js +54 -22
- package/lib/DateTime/dateFormatUtils/yearChange.js +22 -11
- package/lib/DateTime/index.js +2 -0
- package/lib/DateTime/objectUtils.js +24 -20
- package/lib/DateTime/props/defaultProps.js +2 -1
- package/lib/DateTime/props/propTypes.js +11 -1
- package/lib/DateTime/typeChecker.js +4 -0
- package/lib/DateTime/validator.js +73 -10
- package/lib/DropBox/DropBox.js +34 -10
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +59 -38
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +42 -34
- package/lib/DropBox/DropBoxElement/props/propTypes.js +3 -0
- package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +14 -9
- package/lib/DropBox/__tests__/DropBox.spec.js +6 -2
- package/lib/DropBox/css/cssJSLogic.js +3 -1
- package/lib/DropBox/props/defaultProps.js +8 -4
- package/lib/DropBox/props/propTypes.js +10 -4
- package/lib/DropDown/DropDown.js +52 -8
- package/lib/DropDown/DropDownHeading.js +39 -20
- package/lib/DropDown/DropDownItem.js +42 -20
- package/lib/DropDown/DropDownSearch.js +40 -17
- package/lib/DropDown/DropDownSeparator.js +24 -4
- package/lib/DropDown/__tests__/DropDown.spec.js +15 -9
- package/lib/DropDown/__tests__/DropDownItem.spec.js +9 -4
- package/lib/DropDown/__tests__/DropDownSearch.spec.js +3 -0
- package/lib/DropDown/index.js +9 -0
- package/lib/DropDown/props/propTypes.js +6 -4
- package/lib/Heading/Heading.js +37 -15
- package/lib/Heading/props/propTypes.js +3 -0
- package/lib/Label/Label.js +39 -19
- package/lib/Label/__tests__/Label.spec.js +14 -1
- package/lib/Label/props/propTypes.js +3 -0
- package/lib/Layout/Box.js +31 -11
- package/lib/Layout/Container.js +29 -10
- package/lib/Layout/__tests__/Box.spec.js +65 -49
- package/lib/Layout/__tests__/Container.spec.js +67 -50
- package/lib/Layout/index.js +3 -0
- package/lib/Layout/props/propTypes.js +3 -0
- package/lib/Layout/utils.js +10 -0
- package/lib/ListItem/ListContainer.js +48 -27
- package/lib/ListItem/ListItem.js +69 -45
- package/lib/ListItem/ListItemWithAvatar.js +75 -48
- package/lib/ListItem/ListItemWithCheckBox.js +64 -39
- package/lib/ListItem/ListItemWithIcon.js +68 -44
- package/lib/ListItem/ListItemWithRadio.js +65 -41
- package/lib/ListItem/index.js +7 -0
- package/lib/ListItem/props/propTypes.js +6 -4
- package/lib/Modal/Modal.js +45 -10
- package/lib/Modal/props/propTypes.js +3 -0
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +294 -166
- package/lib/MultiSelect/AdvancedMultiSelect.js +202 -125
- package/lib/MultiSelect/EmptyState.js +45 -24
- package/lib/MultiSelect/MultiSelect.js +323 -206
- package/lib/MultiSelect/MultiSelectHeader.js +30 -8
- package/lib/MultiSelect/MultiSelectWithAvatar.js +105 -63
- package/lib/MultiSelect/SelectedOptions.js +43 -17
- package/lib/MultiSelect/Suggestions.js +64 -32
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +86 -75
- package/lib/MultiSelect/index.js +5 -0
- package/lib/MultiSelect/props/defaultProps.js +2 -0
- package/lib/MultiSelect/props/propTypes.js +5 -0
- package/lib/PopOver/PopOver.js +95 -49
- package/lib/PopOver/__tests__/PopOver.spec.js +4 -1
- package/lib/PopOver/index.js +4 -0
- package/lib/PopOver/props/propTypes.js +3 -0
- package/lib/Popup/Popup.js +158 -81
- package/lib/Popup/__tests__/Popup.spec.js +43 -8
- package/lib/Popup/viewPort.js +28 -14
- package/lib/Provider/AvatarSize.js +4 -0
- package/lib/Provider/Config.js +2 -0
- package/lib/Provider/CssProvider.js +4 -0
- package/lib/Provider/IdProvider.js +17 -6
- package/lib/Provider/LibraryContext.js +35 -15
- package/lib/Provider/LibraryContextInit.js +4 -0
- package/lib/Provider/NumberGenerator/NumberGenerator.js +44 -15
- package/lib/Provider/ZindexProvider.js +15 -3
- package/lib/Provider/index.js +5 -0
- package/lib/Radio/Radio.js +61 -38
- package/lib/Radio/__tests__/Radiospec.js +9 -5
- package/lib/Radio/props/propTypes.js +3 -0
- package/lib/Responsive/CustomResponsive.js +73 -29
- package/lib/Responsive/RefWrapper.js +17 -11
- package/lib/Responsive/ResizeComponent.js +62 -36
- package/lib/Responsive/ResizeObserver.js +24 -10
- package/lib/Responsive/Responsive.js +80 -30
- package/lib/Responsive/index.js +4 -0
- package/lib/Responsive/props/propTypes.js +3 -0
- package/lib/Responsive/sizeObservers.js +53 -17
- package/lib/Responsive/utils/index.js +11 -3
- package/lib/Responsive/utils/shallowCompare.js +11 -2
- package/lib/Responsive/windowResizeObserver.js +8 -0
- package/lib/ResponsiveDropBox/ResponsiveDropBox.js +45 -17
- package/lib/ResponsiveDropBox/props/propTypes.js +3 -0
- package/lib/Ribbon/Ribbon.js +33 -13
- package/lib/Ribbon/__tests__/Ribbon.spec.js +22 -0
- package/lib/Ribbon/props/propTypes.js +3 -0
- package/lib/RippleEffect/RippleEffect.js +18 -10
- package/lib/RippleEffect/props/propTypes.js +3 -0
- package/lib/Select/GroupSelect.js +229 -130
- package/lib/Select/Select.js +290 -209
- package/lib/Select/SelectWithAvatar.js +102 -56
- package/lib/Select/SelectWithIcon.js +132 -76
- package/lib/Select/__tests__/Select.spec.js +133 -91
- package/lib/Select/index.js +5 -0
- package/lib/Select/props/defaultProps.js +5 -4
- package/lib/Select/props/propTypes.js +4 -0
- package/lib/Stencils/Stencils.js +29 -10
- package/lib/Stencils/__tests__/Stencils.spec.js +12 -0
- package/lib/Stencils/props/propTypes.js +3 -0
- package/lib/Switch/Switch.js +57 -34
- package/lib/Switch/props/propTypes.js +3 -0
- package/lib/Tab/Tab.js +40 -27
- package/lib/Tab/TabContent.js +12 -5
- package/lib/Tab/TabContentWrapper.js +13 -6
- package/lib/Tab/TabWrapper.js +37 -19
- package/lib/Tab/Tabs.js +171 -91
- package/lib/Tab/__tests__/Tab.spec.js +67 -58
- package/lib/Tab/__tests__/TabContent.spec.js +10 -6
- package/lib/Tab/__tests__/TabContentWrapper.spec.js +28 -20
- package/lib/Tab/__tests__/TabWrapper.spec.js +12 -0
- package/lib/Tab/__tests__/Tabs.spec.js +53 -39
- package/lib/Tab/index.js +6 -0
- package/lib/Tab/props/propTypes.js +3 -0
- package/lib/Tag/Tag.js +72 -43
- package/lib/Tag/__tests__/Tag.spec.js +14 -8
- package/lib/Tag/props/propTypes.js +3 -0
- package/lib/TextBox/TextBox.js +85 -59
- package/lib/TextBox/__tests__/TextBox.spec.js +14 -4
- package/lib/TextBox/props/propTypes.js +6 -4
- package/lib/TextBoxIcon/TextBoxIcon.js +79 -52
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +14 -5
- package/lib/TextBoxIcon/props/propTypes.js +3 -0
- package/lib/Textarea/Textarea.js +54 -29
- package/lib/Textarea/__tests__/Textarea.spec.js +14 -2
- package/lib/Textarea/props/propTypes.js +3 -0
- package/lib/Tooltip/Tooltip.js +94 -31
- package/lib/Tooltip/__tests__/Tooltip.spec.js +24 -3
- package/lib/Tooltip/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +40 -16
- package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +53 -25
- package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/index.js +3 -0
- package/lib/css.js +40 -0
- package/lib/deprecated/PortalLayer/PortalLayer.js +46 -23
- package/lib/deprecated/PortalLayer/props/propTypes.js +3 -0
- package/lib/index.js +57 -0
- package/lib/semantic/Button/Button.js +42 -22
- package/lib/semantic/Button/props/propTypes.js +3 -0
- package/lib/semantic/index.js +2 -0
- package/lib/utils/Common.js +110 -18
- package/lib/utils/ContextOptimizer.js +16 -10
- package/lib/utils/__tests__/constructFullName.spec.js +1 -0
- package/lib/utils/__tests__/debounce.spec.js +3 -2
- package/lib/utils/__tests__/getInitial.spec.js +1 -0
- package/lib/utils/constructFullName.js +13 -4
- package/lib/utils/css/compileClassNames.js +6 -0
- package/lib/utils/css/mergeStyle.js +10 -7
- package/lib/utils/css/utils.js +8 -0
- package/lib/utils/datetime/GMTZones.js +55 -0
- package/lib/utils/datetime/common.js +52 -7
- package/lib/utils/debounce.js +6 -1
- package/lib/utils/dropDownUtils.js +175 -59
- package/lib/utils/dummyFunction.js +2 -0
- package/lib/utils/getHTMLFontSize.js +1 -0
- package/lib/utils/getInitial.js +6 -0
- package/lib/utils/index.js +4 -0
- package/lib/utils/scrollTo.js +2 -0
- package/lib/utils/shallowEqual.js +8 -0
- package/package.json +1 -1
|
@@ -4,19 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.constructFullNameByPattern = constructFullNameByPattern;
|
|
7
|
+
|
|
7
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
|
|
8
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
|
+
|
|
9
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
|
|
11
|
-
function
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
17
|
+
|
|
12
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
|
|
13
20
|
function constructFullName(firstName, lastName) {
|
|
14
21
|
return "".concat(firstName ? "".concat(firstName).concat(lastName ? ' ' : '') : '').concat(lastName ? lastName : '');
|
|
15
22
|
}
|
|
23
|
+
|
|
16
24
|
function constructFullNameByPattern(firstName, lastName, namePattern) {
|
|
17
25
|
var _namePattern = _slicedToArray(namePattern, 2),
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
name0 = _namePattern[0],
|
|
27
|
+
name1 = _namePattern[1];
|
|
28
|
+
|
|
20
29
|
if (name0 === 'FIRST_NAME' && name1 === 'LAST_NAME') {
|
|
21
30
|
return constructFullName(firstName, lastName);
|
|
22
31
|
} else if (name0 === 'LAST_NAME' && name1 === 'FIRST_NAME') {
|
|
@@ -4,10 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = compileClassNames;
|
|
7
|
+
|
|
7
8
|
var _utils = require("./utils");
|
|
9
|
+
|
|
8
10
|
var collectClassNames = function collectClassNames(processedClassNameList) {
|
|
9
11
|
for (var index = 0; index < (arguments.length <= 1 ? 0 : arguments.length - 1); index++) {
|
|
10
12
|
var classInfo = index + 1 < 1 || arguments.length <= index + 1 ? undefined : arguments[index + 1];
|
|
13
|
+
|
|
11
14
|
if (!classInfo) {
|
|
12
15
|
continue;
|
|
13
16
|
} else if ((0, _utils.isDataTypeOf)(classInfo, _utils.dataTypes.object)) {
|
|
@@ -19,11 +22,14 @@ var collectClassNames = function collectClassNames(processedClassNameList) {
|
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
};
|
|
25
|
+
|
|
22
26
|
function compileClassNames() {
|
|
23
27
|
var resultClassNameList = [];
|
|
28
|
+
|
|
24
29
|
for (var _len = arguments.length, classinfoList = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
30
|
classinfoList[_key] = arguments[_key];
|
|
26
31
|
}
|
|
32
|
+
|
|
27
33
|
collectClassNames.apply(void 0, [resultClassNameList].concat(classinfoList));
|
|
28
34
|
return resultClassNameList.filter(function (a) {
|
|
29
35
|
return a !== '';
|
|
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = mergeStyle;
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
|
|
9
10
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
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; }
|
|
11
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
-
var REPLACER_SYMBOL = '$';
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
|
|
14
|
+
var REPLACER_SYMBOL = '$'; // $ startWith is used for replace the existing style.
|
|
16
15
|
// all other will be append
|
|
17
16
|
|
|
18
17
|
function mergeStyle(defaultStyle) {
|
|
@@ -21,15 +20,16 @@ function mergeStyle(defaultStyle) {
|
|
|
21
20
|
// if(!Object.keys(defaultStyle).includes('base')) {
|
|
22
21
|
// throw new Error(`STYLE CUSTOMIZATION RULE - Your style sheet should have "base" class name for customization`);
|
|
23
22
|
// }
|
|
24
|
-
|
|
25
23
|
return Object.keys(customStyle).reduce(function (res, next) {
|
|
26
24
|
if (next.startsWith(REPLACER_SYMBOL)) {
|
|
27
25
|
var styleValue = customStyle[next];
|
|
28
26
|
var styleName = next.replace(REPLACER_SYMBOL, '');
|
|
27
|
+
|
|
29
28
|
if (!defaultStyle[styleName] && !additionalStyle.includes(styleName)) {
|
|
30
29
|
// return res;
|
|
31
30
|
throw new Error("UNKNOWN CLASSNAME DETECTED - Given customStyle's key \"".concat(styleName, "\" is not available in that component style"));
|
|
32
31
|
}
|
|
32
|
+
|
|
33
33
|
if (additionalStyle.includes(styleName)) {
|
|
34
34
|
res[styleName] = styleValue;
|
|
35
35
|
} else {
|
|
@@ -38,6 +38,7 @@ function mergeStyle(defaultStyle) {
|
|
|
38
38
|
var styleKey = res[keyName];
|
|
39
39
|
var styleClasses = styleKey.split(' ');
|
|
40
40
|
var ind = styleClasses.indexOf(val);
|
|
41
|
+
|
|
41
42
|
if (ind !== -1) {
|
|
42
43
|
styleClasses[ind] = styleValue;
|
|
43
44
|
res[keyName] = styleClasses.join(' ');
|
|
@@ -50,6 +51,7 @@ function mergeStyle(defaultStyle) {
|
|
|
50
51
|
var styleKey = res[keyName];
|
|
51
52
|
var styleClasses = styleKey.split(' ');
|
|
52
53
|
var ind = styleClasses.indexOf(_val);
|
|
54
|
+
|
|
53
55
|
if (ind !== -1) {
|
|
54
56
|
styleClasses[ind] = styleClasses[ind] + ' ' + customStyle[next];
|
|
55
57
|
res[keyName] = styleClasses.join(' ');
|
|
@@ -61,6 +63,7 @@ function mergeStyle(defaultStyle) {
|
|
|
61
63
|
// res[next] = customStyle[next];
|
|
62
64
|
throw new Error("UNKNOWN CLASSNAME DETECTED - Given customStyle's key \"".concat(next, "\" is not available in that component style"));
|
|
63
65
|
}
|
|
66
|
+
|
|
64
67
|
return res;
|
|
65
68
|
}, _objectSpread({}, defaultStyle));
|
|
66
69
|
}
|
package/lib/utils/css/utils.js
CHANGED
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isDataTypeOf = exports.getDataType = exports.dataTypes = void 0;
|
|
7
|
+
|
|
7
8
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
|
+
|
|
8
10
|
var dataTypes = {
|
|
9
11
|
number: 'number',
|
|
10
12
|
array: 'array',
|
|
@@ -17,17 +19,23 @@ var dataTypes = {
|
|
|
17
19
|
"boolean": 'boolean'
|
|
18
20
|
};
|
|
19
21
|
exports.dataTypes = dataTypes;
|
|
22
|
+
|
|
20
23
|
var getDataType = function getDataType(data) {
|
|
21
24
|
var typeofData = _typeof(data);
|
|
25
|
+
|
|
22
26
|
var isArrayDataType = Array.isArray(data);
|
|
27
|
+
|
|
23
28
|
if (isArrayDataType) {
|
|
24
29
|
return dataTypes.array;
|
|
25
30
|
} else {
|
|
26
31
|
return dataTypes[typeofData];
|
|
27
32
|
}
|
|
28
33
|
};
|
|
34
|
+
|
|
29
35
|
exports.getDataType = getDataType;
|
|
36
|
+
|
|
30
37
|
var isDataTypeOf = function isDataTypeOf(data, type) {
|
|
31
38
|
return getDataType(data) === type;
|
|
32
39
|
};
|
|
40
|
+
|
|
33
41
|
exports.isDataTypeOf = isDataTypeOf;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.offsetMap = void 0;
|
|
7
|
+
var offsetMap = {
|
|
8
|
+
0: 'GMT+00:00 Africa/Abidjan',
|
|
9
|
+
44: 'GMT+00:00 Africa/Monrovia',
|
|
10
|
+
60: 'GMT+01:00 Africa/Bangui',
|
|
11
|
+
120: 'GMT+02:00 Africa/Blantyre',
|
|
12
|
+
180: 'GMT+03:00 Africa/Addis_Ababa',
|
|
13
|
+
210: 'GMT+04:30 Asia/Tehran',
|
|
14
|
+
240: 'GMT+03:00 Asia/Bahrain',
|
|
15
|
+
270: 'GMT+04:30 Asia/Kabul',
|
|
16
|
+
300: 'GMT+05:00 Asia/Aqtau',
|
|
17
|
+
'-330': 'GMT+05:30 Asia/Kolkata',
|
|
18
|
+
360: 'GMT+06:00 Asia/Dacca',
|
|
19
|
+
390: 'GMT+06:30 Indian/Cocos',
|
|
20
|
+
420: 'GMT+07:00 Asia/Bangkok',
|
|
21
|
+
450: 'GMT+08:00 Asia/Singapore',
|
|
22
|
+
480: 'GMT+08:00 Asia/Hong_Kong',
|
|
23
|
+
510: 'GMT+08:00 Asia/Harbin',
|
|
24
|
+
525: 'GMT+08:45 Australia/Eucla',
|
|
25
|
+
540: 'GMT+09:00 Asia/Chita',
|
|
26
|
+
570: 'GMT+09:30 Australia/Adelaide',
|
|
27
|
+
600: 'GMT+10:00 Antarctica/DumontDUrville',
|
|
28
|
+
660: 'GMT+11:00 Asia/Magadan',
|
|
29
|
+
690: 'GMT+11:00 Pacific/Norfolk',
|
|
30
|
+
720: 'GMT+12:00 Asia/Kamchatka',
|
|
31
|
+
765: 'GMT+12:45 Pacific/Chatham',
|
|
32
|
+
780: 'GMT+12:00 Asia/Anadyr',
|
|
33
|
+
840: 'GMT+14:00 Etc/GMT-14',
|
|
34
|
+
'-60': 'GMT-01:00 Etc/GMT+1',
|
|
35
|
+
'-660': 'GMT-11:00 US/Samoa',
|
|
36
|
+
'-600': 'GMT-04:00 America/Anguilla',
|
|
37
|
+
'-240': 'GMT-04:00 America/Antigua',
|
|
38
|
+
'-180': 'GMT-03:00 America/Araguaina',
|
|
39
|
+
'-300': 'GMT-05:00 America/Atikokan',
|
|
40
|
+
'-480': 'GMT-05:00 America/Bahia_Banderas',
|
|
41
|
+
'-360': 'GMT-06:00 America/Belize',
|
|
42
|
+
'-420': 'GMT-06:00 America/Boise',
|
|
43
|
+
'-540': 'GMT-07:00 America/Dawson',
|
|
44
|
+
'-135': 'GMT-04:00 America/Guyana',
|
|
45
|
+
'-120': 'GMT-02:00 Etc/GMT+2',
|
|
46
|
+
'-150': 'GMT-03:00 America/Paramaribo',
|
|
47
|
+
'-210': 'GMT-04:00 America/Santo_Domingo',
|
|
48
|
+
'-720': 'GMT+12:00 Pacific/Kwajalein',
|
|
49
|
+
'-560': 'GMT+14:00 Pacific/Kiritimati',
|
|
50
|
+
'-510': 'GMT-09:30 Pacific/Marquesas',
|
|
51
|
+
'-630': 'GMT-11:00 Pacific/Niue',
|
|
52
|
+
'-450': 'GMT-08:00 Pacific/Pitcairn',
|
|
53
|
+
'-570': 'GMT-10:00 Pacific/Rarotonga'
|
|
54
|
+
};
|
|
55
|
+
exports.offsetMap = offsetMap;
|
|
@@ -8,6 +8,7 @@ exports.getDiffObj = getDiffObj;
|
|
|
8
8
|
exports.getI18NInfo = getI18NInfo;
|
|
9
9
|
exports.getI18NValue = getI18NValue;
|
|
10
10
|
exports.getMonthEnd = getMonthEnd;
|
|
11
|
+
exports.getTimeOffset = getTimeOffset;
|
|
11
12
|
exports.getValues = getValues;
|
|
12
13
|
exports.isToday = isToday;
|
|
13
14
|
exports.isTomorrow = isTomorrow;
|
|
@@ -17,12 +18,17 @@ exports.isYesterday = isYesterday;
|
|
|
17
18
|
exports.pad = pad;
|
|
18
19
|
exports.replaceI18NValuesWithRegex = replaceI18NValuesWithRegex;
|
|
19
20
|
exports.unescapeUnicode = unescapeUnicode;
|
|
21
|
+
|
|
22
|
+
var _GMTZones = require("./GMTZones.js");
|
|
23
|
+
|
|
20
24
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
25
|
+
|
|
21
26
|
var dateFormat = {
|
|
22
27
|
dayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
23
28
|
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
24
29
|
timeNames: ['a', 'p', 'am', 'pm', 'A', 'P', 'AM', 'PM']
|
|
25
30
|
};
|
|
31
|
+
|
|
26
32
|
function pad(n) {
|
|
27
33
|
var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
28
34
|
var z = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -30,8 +36,19 @@ function pad(n) {
|
|
|
30
36
|
n = "".concat(n);
|
|
31
37
|
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
|
|
32
38
|
}
|
|
39
|
+
|
|
40
|
+
function getTimeOffset() {
|
|
41
|
+
var GMT = new Date();
|
|
42
|
+
var matchingOffset = Object.keys(_GMTZones.offsetMap).find(function (offset) {
|
|
43
|
+
return GMT.getTimezoneOffset() === Number(offset);
|
|
44
|
+
});
|
|
45
|
+
return matchingOffset ? _GMTZones.offsetMap[matchingOffset].toString().split(' ') : ['', ''];
|
|
46
|
+
}
|
|
47
|
+
|
|
33
48
|
function formatDate(dateMill, mask) {
|
|
34
49
|
var date = new Date(dateMill);
|
|
50
|
+
var O = getTimeOffset()[0];
|
|
51
|
+
var Z = getTimeOffset()[1];
|
|
35
52
|
var d = date.getDate();
|
|
36
53
|
var D = date.getDay();
|
|
37
54
|
var m = date.getMonth();
|
|
@@ -42,6 +59,7 @@ function formatDate(dateMill, mask) {
|
|
|
42
59
|
var L = date.getMilliseconds();
|
|
43
60
|
var flags = {
|
|
44
61
|
d: d,
|
|
62
|
+
O: O,
|
|
45
63
|
dd: pad(d, 2),
|
|
46
64
|
ddd: dateFormat.dayNames[D],
|
|
47
65
|
dddd: dateFormat.dayNames[D + 7],
|
|
@@ -69,17 +87,23 @@ function formatDate(dateMill, mask) {
|
|
|
69
87
|
L: pad(Math.round(L / 10)),
|
|
70
88
|
t: H < 12 ? dateFormat.timeNames[0] : dateFormat.timeNames[1],
|
|
71
89
|
A: H < 12 ? dateFormat.timeNames[6] : dateFormat.timeNames[7],
|
|
72
|
-
|
|
90
|
+
a: H < 12 ? dateFormat.timeNames[6] : dateFormat.timeNames[7],
|
|
91
|
+
T: H < 12 ? dateFormat.timeNames[4] : dateFormat.timeNames[5],
|
|
92
|
+
Z: Z,
|
|
93
|
+
VV: Z,
|
|
94
|
+
SSS: pad(L, 3)
|
|
73
95
|
};
|
|
74
|
-
var token = /D{1,4}|d{1,4}|M{1,4}|YYYY|yyyy|YY|yy?|([
|
|
96
|
+
var token = /D{1,4}|d{1,4}|M{1,4}|YYYY|yyyy|YY|O|Z|VV|SSS|yy?|([HhmsAa])\1?|[LloSZWN]|\[[^\]]*\]|'[^']*'/g;
|
|
75
97
|
var dat = mask.replace(token, function (match) {
|
|
76
98
|
if (match in flags) {
|
|
77
99
|
return flags[match];
|
|
78
100
|
}
|
|
101
|
+
|
|
79
102
|
return match.slice(1, match.length - 1);
|
|
80
103
|
});
|
|
81
104
|
return dat;
|
|
82
105
|
}
|
|
106
|
+
|
|
83
107
|
function replaceI18NValuesWithRegex(i18nStr, values) {
|
|
84
108
|
if (typeof values !== 'undefined') {
|
|
85
109
|
if (Array.isArray(values)) {
|
|
@@ -90,13 +114,16 @@ function replaceI18NValuesWithRegex(i18nStr, values) {
|
|
|
90
114
|
i18nStr = i18nStr.replace(new RegExp('\\{0\\}', 'g'), values);
|
|
91
115
|
}
|
|
92
116
|
}
|
|
117
|
+
|
|
93
118
|
return i18nStr;
|
|
94
119
|
}
|
|
120
|
+
|
|
95
121
|
function unescapeUnicode(str) {
|
|
96
122
|
return str.replace(/\\u([a-fA-F0-9]{4})/g, function (g, m1) {
|
|
97
123
|
return String.fromCharCode(parseInt(m1, 16));
|
|
98
124
|
});
|
|
99
125
|
}
|
|
126
|
+
|
|
100
127
|
function getValues() {
|
|
101
128
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
102
129
|
var diff = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -104,31 +131,36 @@ function getValues() {
|
|
|
104
131
|
return diff[param];
|
|
105
132
|
});
|
|
106
133
|
}
|
|
134
|
+
|
|
107
135
|
function getI18NValue(i18n) {
|
|
108
136
|
if (typeof i18n === 'undefined') {
|
|
109
137
|
return function (key) {
|
|
110
138
|
return key;
|
|
111
139
|
};
|
|
112
140
|
}
|
|
141
|
+
|
|
113
142
|
return function (key, values) {
|
|
114
143
|
var i18nStr = i18n[key];
|
|
144
|
+
|
|
115
145
|
if (i18nStr === undefined) {
|
|
116
146
|
return key;
|
|
117
147
|
}
|
|
148
|
+
|
|
118
149
|
i18nStr = replaceI18NValuesWithRegex(i18nStr, values);
|
|
119
150
|
return unescapeUnicode(i18nStr);
|
|
120
151
|
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// function getValues(params = [], diff) {
|
|
152
|
+
} // function getValues(params = [], diff) {
|
|
124
153
|
// return params.map(param => {
|
|
125
154
|
// return diff[param];
|
|
126
155
|
// });
|
|
127
156
|
// }
|
|
157
|
+
|
|
158
|
+
|
|
128
159
|
function getI18NInfo(toDateObj, props, diffObj) {
|
|
129
160
|
var key = null,
|
|
130
|
-
|
|
131
|
-
|
|
161
|
+
values,
|
|
162
|
+
text = null;
|
|
163
|
+
|
|
132
164
|
if (typeof props === 'function') {
|
|
133
165
|
var value = props(diffObj1);
|
|
134
166
|
key = value.key;
|
|
@@ -139,40 +171,50 @@ function getI18NInfo(toDateObj, props, diffObj) {
|
|
|
139
171
|
} else if (typeof props === 'string') {
|
|
140
172
|
text = toDateObj.format(props);
|
|
141
173
|
}
|
|
174
|
+
|
|
142
175
|
return {
|
|
143
176
|
key: key,
|
|
144
177
|
values: values,
|
|
145
178
|
text: text
|
|
146
179
|
};
|
|
147
180
|
}
|
|
181
|
+
|
|
148
182
|
function isToday(fromDate, toDate) {
|
|
149
183
|
var TODAY = toDate.clone().startOf('day');
|
|
150
184
|
return fromDate.isSame(TODAY, 'd');
|
|
151
185
|
}
|
|
186
|
+
|
|
152
187
|
function isYesterday(fromDate, toDate) {
|
|
153
188
|
var YESTERDAY = toDate.clone().subtract(1, 'days').startOf('day');
|
|
154
189
|
return fromDate.isSame(YESTERDAY, 'd');
|
|
155
190
|
}
|
|
191
|
+
|
|
156
192
|
function isTomorrow(fromDate, toDate) {
|
|
157
193
|
return isYesterday(toDate, fromDate);
|
|
158
194
|
}
|
|
195
|
+
|
|
159
196
|
function isWithinAWeek(fromDate, toDate) {
|
|
160
197
|
var A_WEEK_OLD = toDate.clone().subtract(7, 'days').startOf('day');
|
|
161
198
|
return fromDate.isAfter(A_WEEK_OLD);
|
|
162
199
|
}
|
|
200
|
+
|
|
163
201
|
function isTwoWeeksOrMore(fromDate, toDate) {
|
|
164
202
|
return !isWithinAWeek(fromDate, toDate);
|
|
165
203
|
}
|
|
204
|
+
|
|
166
205
|
var oneYearInMillis = 31536000000;
|
|
167
206
|
var oneDayInMillis = 86400000;
|
|
168
207
|
var oneHourInMillis = 3600000;
|
|
169
208
|
var oneMinuteInMillis = 60000;
|
|
209
|
+
|
|
170
210
|
function convertAsNonExponential(number) {
|
|
171
211
|
if (number.toString().toLowerCase().indexOf('e') !== -1) {
|
|
172
212
|
return number.toFixed(20);
|
|
173
213
|
}
|
|
214
|
+
|
|
174
215
|
return number;
|
|
175
216
|
}
|
|
217
|
+
|
|
176
218
|
function getDiffObj(diff) {
|
|
177
219
|
diff = Math.abs(diff);
|
|
178
220
|
var diffYears = diff / oneYearInMillis;
|
|
@@ -196,11 +238,14 @@ function getDiffObj(diff) {
|
|
|
196
238
|
s: diffSeconds
|
|
197
239
|
};
|
|
198
240
|
}
|
|
241
|
+
|
|
199
242
|
function getMonthEnd(month, year) {
|
|
200
243
|
var monthend = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
201
244
|
var isLeapYear = year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
|
245
|
+
|
|
202
246
|
if (month === 1 && isLeapYear) {
|
|
203
247
|
return 29;
|
|
204
248
|
}
|
|
249
|
+
|
|
205
250
|
return monthend[month];
|
|
206
251
|
}
|
package/lib/utils/debounce.js
CHANGED
|
@@ -4,20 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.debounce = debounce;
|
|
7
|
+
|
|
7
8
|
function debounce(func, wait, immediate) {
|
|
8
9
|
var timeout;
|
|
9
10
|
return function () {
|
|
10
11
|
var context = this,
|
|
11
|
-
|
|
12
|
+
args = arguments;
|
|
13
|
+
|
|
12
14
|
var later = function later() {
|
|
13
15
|
timeout = null;
|
|
16
|
+
|
|
14
17
|
if (!immediate) {
|
|
15
18
|
func.apply(context, args);
|
|
16
19
|
}
|
|
17
20
|
};
|
|
21
|
+
|
|
18
22
|
var callNow = immediate && !timeout;
|
|
19
23
|
clearTimeout(timeout);
|
|
20
24
|
timeout = setTimeout(later, wait);
|
|
25
|
+
|
|
21
26
|
if (callNow) {
|
|
22
27
|
func.apply(context, args);
|
|
23
28
|
}
|