diginet-core-ui 1.3.78 → 1.3.79
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/components/accordion/details.js +2 -6
- package/components/accordion/group.js +2 -9
- package/components/accordion/index.js +2 -15
- package/components/accordion/summary.js +4 -27
- package/components/alert/index.js +98 -137
- package/components/alert/notify.js +97 -166
- package/components/avatar/index.js +4 -63
- package/components/badge/index.js +7 -34
- package/components/button/icon.js +120 -186
- package/components/button/index.js +136 -205
- package/components/button/more.js +0 -12
- package/components/button/ripple-effect.js +46 -44
- package/components/card/body.js +2 -7
- package/components/card/extra.js +2 -7
- package/components/card/footer.js +2 -7
- package/components/card/header.js +2 -7
- package/components/card/index.js +2 -22
- package/components/chart/Pie/Circle.js +0 -1
- package/components/chart/Pie/Sector.js +0 -17
- package/components/chart/Pie/Sectors.js +0 -10
- package/components/chart/Pie/index.js +4 -36
- package/components/chart/Pie-v2/Circle.js +0 -1
- package/components/chart/Pie-v2/Sector.js +0 -13
- package/components/chart/Pie-v2/Sectors.js +0 -20
- package/components/chart/Pie-v2/index.js +11 -38
- package/components/chart/bar/Axis.js +0 -12
- package/components/chart/bar/Bar.js +13 -35
- package/components/chart/bar/Grid.js +0 -18
- package/components/chart/bar/Labels.js +0 -18
- package/components/chart/bar/Points.js +0 -17
- package/components/chart/bar/index.js +6 -26
- package/components/chart/bar-v2/Axis.js +0 -12
- package/components/chart/bar-v2/Bar.js +15 -36
- package/components/chart/bar-v2/Grid.js +0 -18
- package/components/chart/bar-v2/Labels.js +0 -18
- package/components/chart/bar-v2/Points.js +0 -17
- package/components/chart/bar-v2/index.js +6 -26
- package/components/chart/line/Axis.js +4 -16
- package/components/chart/line/Grid.js +2 -19
- package/components/chart/line/Labels.js +0 -18
- package/components/chart/line/Path.js +23 -33
- package/components/chart/line/Point.js +6 -40
- package/components/chart/line/Title.js +0 -3
- package/components/chart/line/index.js +12 -35
- package/components/chart/line-v2/Axis.js +0 -13
- package/components/chart/line-v2/Grid.js +0 -18
- package/components/chart/line-v2/Labels.js +0 -18
- package/components/chart/line-v2/Path.js +23 -33
- package/components/chart/line-v2/Point.js +6 -35
- package/components/chart/line-v2/Title.js +0 -3
- package/components/chart/line-v2/index.js +12 -30
- package/components/check-text/index.js +0 -8
- package/components/check-text/interview-confirmation.js +0 -7
- package/components/check-text/interview-status.js +0 -7
- package/components/chip/attach.js +4 -17
- package/components/chip/index.js +6 -33
- package/components/collapse/index.js +0 -13
- package/components/divider/index.js +0 -8
- package/components/form-control/attachment/index.js +24 -202
- package/components/form-control/calendar/function.js +40 -94
- package/components/form-control/calendar/index.js +5 -30
- package/components/form-control/calendar/range.js +11 -28
- package/components/form-control/checkbox/index.js +4 -37
- package/components/form-control/control/index.js +3 -13
- package/components/form-control/date-picker/index-old.js +18 -0
- package/components/form-control/date-picker/index.js +23 -99
- package/components/form-control/date-range-picker/index.js +86 -221
- package/components/form-control/dropdown/index.js +72 -289
- package/components/form-control/dropdown-box/index.js +6 -35
- package/components/form-control/form/index.js +0 -2
- package/components/form-control/form-group/index.js +1 -6
- package/components/form-control/helper-text/index.js +2 -9
- package/components/form-control/input-base/index.js +218 -399
- package/components/form-control/label/index.js +2 -12
- package/components/form-control/money-input/index.js +43 -132
- package/components/form-control/number-input/index.js +15 -113
- package/components/form-control/number-input/index2.js +78 -119
- package/components/form-control/phone-input/index.js +16 -78
- package/components/form-control/radio/index.js +4 -23
- package/components/form-control/text-input/index.js +33 -256
- package/components/form-control/time-picker/index.js +14 -71
- package/components/form-control/time-picker/swiper.js +21 -73
- package/components/form-control/toggle/index.js +4 -19
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +0 -14
- package/components/form-view/input.js +2 -13
- package/components/form-view/label.js +0 -2
- package/components/grid/Col.js +2 -15
- package/components/grid/Container.js +2 -21
- package/components/grid/Row.js +2 -21
- package/components/grid/index.js +2 -43
- package/components/image/index.js +2 -22
- package/components/index.js +62 -31
- package/components/list/list-item-action.js +0 -9
- package/components/list/list-item-icon.js +0 -9
- package/components/list/list-item-text.js +0 -5
- package/components/list/list-item.js +0 -11
- package/components/list/list.js +0 -13
- package/components/list/sub-header.js +0 -4
- package/components/modal/body.js +2 -6
- package/components/modal/footer.js +2 -11
- package/components/modal/header.js +2 -12
- package/components/modal/index.js +2 -10
- package/components/modal/modal.js +11 -52
- package/components/others/extra/index.js +3 -10
- package/components/others/import/index.js +0 -7
- package/components/others/option-wrapper/index.js +4 -7
- package/components/others/scrollbar/index.js +0 -3
- package/components/paging/page-info.js +39 -101
- package/components/paging/page-selector.js +7 -35
- package/components/paging/page-selector2.js +35 -74
- package/components/paper/index.js +0 -11
- package/components/popover/body.js +2 -6
- package/components/popover/footer.js +2 -11
- package/components/popover/header.js +2 -7
- package/components/popover/index.js +39 -123
- package/components/popup/danger_popup.js +0 -19
- package/components/popup/index.js +2 -48
- package/components/popup/proposals_popup.js +10 -49
- package/components/popup/v2/index.js +0 -31
- package/components/progress/circular.js +19 -81
- package/components/progress/linear.js +4 -20
- package/components/rating/index.js +0 -24
- package/components/slider/slider-container.js +3 -40
- package/components/slider/slider-item.js +10 -25
- package/components/status/index.js +2 -16
- package/components/tab/tab-container.js +2 -16
- package/components/tab/tab-header.js +4 -24
- package/components/tab/tab-panel.js +4 -16
- package/components/tab/tab.js +4 -28
- package/components/tooltip/index.js +12 -97
- package/components/tooltip/portal.js +0 -2
- package/components/transfer/index.js +22 -67
- package/components/tree-view/index.js +62 -202
- package/components/typography/index.js +3 -31
- package/global/index.js +0 -8
- package/icons/basic.js +0 -48
- package/icons/effect.js +17 -29
- package/icons/general/clock/clock.js +0 -2
- package/icons/general/color-handler/background.js +0 -2
- package/icons/general/color-handler/text.js +0 -2
- package/icons/general/emoji/emoji.js +0 -2
- package/icons/general/font-properties/bold.js +0 -2
- package/icons/general/font-properties/font-family.js +0 -2
- package/icons/general/font-properties/font-size.js +0 -2
- package/icons/general/font-properties/italic.js +0 -2
- package/icons/general/font-properties/underline.js +0 -2
- package/icons/general/hyperlink/hyperlink.js +0 -2
- package/icons/general/indent/decrease.js +0 -2
- package/icons/general/indent/increase.js +0 -2
- package/icons/general/list/bullets.js +0 -2
- package/icons/general/list/numbering.js +0 -2
- package/icons/general/picture/picture.js +0 -2
- package/icons/general/steps/redo.js +0 -2
- package/icons/general/steps/undo.js +0 -2
- package/icons/general/text-align/center.js +0 -2
- package/icons/general/text-align/justify.js +0 -2
- package/icons/general/text-align/left.js +0 -2
- package/icons/general/text-align/right.js +0 -2
- package/icons/menu/dhr.js +2 -1
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +0 -10
- package/package.json +1 -1
- package/readme.md +11 -1
- package/styles/animation.js +15 -58
- package/styles/color-helper.js +24 -54
- package/styles/colors.js +17 -9
- package/styles/general.js +6 -2
- package/styles/typography.js +4 -4
- package/styles/utils.js +2 -2
- package/theme/createBreakpoints.js +7 -18
- package/theme/make-styles.js +2 -5
- package/theme/set-theme.js +3 -6
- package/theme/settings.js +3 -2
- package/theme/theme-provider.js +0 -1
- package/utils/array/array.js +14 -23
- package/utils/classNames.js +0 -5
- package/utils/console.js +0 -6
- package/utils/date.js +13 -82
- package/utils/error/error.js +1 -9
- package/utils/error/errors.js +1 -48
- package/utils/getFileType.js +0 -9
- package/utils/handleBreakpoints.js +0 -5
- package/utils/intersectionObserver.js +0 -5
- package/utils/iterator.js +0 -9
- package/utils/map-parent.js +3 -10
- package/utils/object/extend.js +0 -10
- package/utils/object/object.js +12 -11
- package/utils/parseHTML.js +0 -1
- package/utils/promisify.js +0 -5
- package/utils/randomString.js +0 -7
- package/utils/remove-unicode.js +0 -1
- package/utils/render-portal.js +1 -9
- package/utils/renderHTML.js +4 -6
- package/utils/renderIcon.js +4 -14
- package/utils/sb-template.js +6 -5
- package/utils/string/capitalize.js +0 -1
- package/utils/string/capitalizeSentenceCase.js +0 -2
- package/utils/string/string.js +0 -13
- package/utils/type.js +0 -21
- package/utils/updatePosition.js +4 -5
- package/utils/useDelayUnmount.js +0 -4
- package/utils/useElementSize.js +9 -3
- package/utils/useEventListener.js +12 -6
- package/utils/useInput.js +0 -6
- package/utils/useMediaQuery.js +8 -10
- package/utils/useOnClickOutside.js +0 -2
- package/utils/usePortal.js +3 -10
- package/utils/validate.js +6 -20
package/icons/menu/dhr.js
CHANGED
|
@@ -1501,8 +1501,9 @@ export const MHRP77N0010 = /*#__PURE__*/memo(() => {
|
|
|
1501
1501
|
d: "M29.24 19a10 10 0 1010 10 10 10 0 00-10-10zm6.23 6.77l-5.94 8.05a1.944 1.944 0 01-1.45.78 1.893 1.893 0 01-1.52-.63l-3.46-3.84a1.487 1.487 0 112.21-1.99l2.45 2.72a.2.2 0 00.14.06.21.21 0 00.14-.07l5.04-6.83a1.486 1.486 0 012.08-.31 1.46 1.46 0 01.31 2.06z",
|
|
1502
1502
|
fill: "#1ca261"
|
|
1503
1503
|
}))));
|
|
1504
|
-
});
|
|
1504
|
+
});
|
|
1505
1505
|
|
|
1506
|
+
// Icon HRM Web6
|
|
1506
1507
|
export const MHRM39N0014 = /*#__PURE__*/memo(() => {
|
|
1507
1508
|
return /*#__PURE__*/React.createElement("svg", {
|
|
1508
1509
|
width: 29.707,
|
package/icons/menu/index.js
CHANGED
package/icons/menu/v2/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
|
-
|
|
3
2
|
/* eslint-disable no-empty */
|
|
4
|
-
|
|
5
3
|
/** @jsxRuntime classic */
|
|
6
|
-
|
|
7
4
|
/** @jsx jsx */
|
|
8
5
|
import { memo, forwardRef, useRef, useMemo } from 'react';
|
|
9
6
|
import PropTypes from 'prop-types';
|
|
@@ -17,17 +14,13 @@ const IconMenu = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
17
14
|
if (!ref) {
|
|
18
15
|
ref = useRef(null);
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
const getResourceImage = fileName => {
|
|
22
18
|
let icon = require('../../../assets/images/menu/dhr/Default.svg');
|
|
23
|
-
|
|
24
19
|
try {
|
|
25
20
|
icon = require('../../../assets/images/menu/' + `${type}/` + fileName);
|
|
26
21
|
} catch (e) {}
|
|
27
|
-
|
|
28
22
|
return icon;
|
|
29
23
|
};
|
|
30
|
-
|
|
31
24
|
return useMemo(() => jsx("img", {
|
|
32
25
|
src: getResourceImage(name + '.svg'),
|
|
33
26
|
width: width,
|
|
@@ -44,13 +37,10 @@ IconMenu.defaultProps = {
|
|
|
44
37
|
IconMenu.propTypes = {
|
|
45
38
|
/** Menu type (DHR || ERP || BEM). */
|
|
46
39
|
type: PropTypes.oneOf(['dhr', 'erp', 'bem']),
|
|
47
|
-
|
|
48
40
|
/** Name of icon. */
|
|
49
41
|
name: PropTypes.string,
|
|
50
|
-
|
|
51
42
|
/** Width of icon. */
|
|
52
43
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
53
|
-
|
|
54
44
|
/** Height of icon. */
|
|
55
45
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
56
46
|
};
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,8 +38,18 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.79
|
|
42
|
+
- \[Changed\]: Button – Add prop labelProps; Allow use CUI colors
|
|
43
|
+
- \[Changed\]: InputBase – Add startIcon, endIcon to multiline textarea; Add viewType none; Optimize code
|
|
44
|
+
- \[Changed\]: Notify – Replace prop color with type; Change duration from seconds to milliseconds; Refactoring code
|
|
45
|
+
- \[Changed\]: ButtonIcon – Add tabIndex; Optimize code
|
|
46
|
+
- \[Changed\]: DateRangePicker – Hide clear button when disabled or readonly
|
|
47
|
+
- \[Changed\]: TextInput – Add prop nonStyle; Add viewType none
|
|
48
|
+
- \[Changed\]: Ripple – useImperativeHandle method start
|
|
49
|
+
- \[Fixed\]: Popover – Fix wrong position when use method show
|
|
50
|
+
|
|
41
51
|
## 1.3.78
|
|
42
|
-
- \[Changed\]:
|
|
52
|
+
- \[Changed\]: Dropdown – Update UI mode multi and optimize render multi selected
|
|
43
53
|
|
|
44
54
|
## 1.3.77
|
|
45
55
|
- \[Changed\]: DateRangePicker – Add method show to ref
|
package/styles/animation.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
/* eslint-disable no-prototype-builtins */
|
|
2
2
|
import { keyframes } from '@emotion/core';
|
|
3
3
|
import { promisify } from '../utils';
|
|
4
|
-
|
|
5
4
|
const loadStyles = css => {
|
|
6
|
-
let head = document.head || document.getElementsByTagName('head')[0];
|
|
5
|
+
let head = document.head || document.getElementsByTagName('head')[0];
|
|
7
6
|
|
|
7
|
+
// no <head> node? create one...
|
|
8
8
|
if (!head) {
|
|
9
9
|
head = document.createElement('head');
|
|
10
10
|
const body = document.body || document.getElementsByTagName('body')[0];
|
|
11
|
-
|
|
12
11
|
if (body) {
|
|
13
12
|
body.parentNode.insertBefore(head, body);
|
|
14
13
|
} else {
|
|
15
14
|
document.documentElement.appendChild(head);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
const style = document.createElement('style');
|
|
20
|
-
|
|
21
18
|
if (style.styleSheet) {
|
|
22
19
|
// IE
|
|
23
20
|
style.styleSheet.cssText = css;
|
|
@@ -25,61 +22,48 @@ const loadStyles = css => {
|
|
|
25
22
|
// the world
|
|
26
23
|
style.appendChild(document.createTextNode(css));
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
head.appendChild(style);
|
|
30
26
|
return style;
|
|
31
27
|
};
|
|
32
|
-
|
|
33
28
|
const pfx = ['webkit', 'moz', 'MS', 'o', ''];
|
|
34
|
-
|
|
35
29
|
const addStyleEvent = (el, type, callback = () => {}) => {
|
|
36
30
|
for (let p in pfx) {
|
|
37
31
|
if (!pfx[p]) {
|
|
38
32
|
type = type.toLowerCase();
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
el.addEventListener(pfx[p] + type, callback, false);
|
|
42
35
|
}
|
|
43
36
|
};
|
|
44
|
-
|
|
45
37
|
const removeStyleEvent = (el, type, callback = () => {}) => {
|
|
46
38
|
for (let p in pfx) {
|
|
47
39
|
if (!pfx[p]) {
|
|
48
40
|
type = type.toLowerCase();
|
|
49
41
|
}
|
|
50
|
-
|
|
51
42
|
el.removeEventListener(pfx[p] + type, callback, false);
|
|
52
43
|
}
|
|
53
44
|
};
|
|
54
|
-
|
|
55
45
|
const getTransformProperty = () => {
|
|
56
46
|
const styles = ['webkitTransform', 'MozTransform', 'msTransform', 'OTransform', 'transform'];
|
|
57
47
|
const el = document.createElement('p');
|
|
58
48
|
let style;
|
|
59
|
-
|
|
60
49
|
for (let i in styles) {
|
|
61
50
|
style = styles[i];
|
|
62
|
-
|
|
63
51
|
if (el.style[style] !== null) {
|
|
64
52
|
return style;
|
|
65
53
|
}
|
|
66
54
|
}
|
|
67
55
|
};
|
|
68
|
-
|
|
69
56
|
const getAnimationProperty = () => {
|
|
70
57
|
const styles = ['webkitAnimation', 'MozAnimation', 'msAnimation', 'OAnimation', 'animation'];
|
|
71
58
|
const el = document.createElement('div');
|
|
72
59
|
let style;
|
|
73
|
-
|
|
74
60
|
for (let i in styles) {
|
|
75
61
|
style = styles[i];
|
|
76
|
-
|
|
77
62
|
if (el.style[style] !== null) {
|
|
78
63
|
return style;
|
|
79
64
|
}
|
|
80
65
|
}
|
|
81
66
|
};
|
|
82
|
-
|
|
83
67
|
const registeredAnimations = {};
|
|
84
68
|
const mainDefaults = {
|
|
85
69
|
duration: 1000,
|
|
@@ -94,51 +78,43 @@ const mainDefaults = {
|
|
|
94
78
|
export const hasAnimation = name => {
|
|
95
79
|
return registeredAnimations.hasOwnProperty(name);
|
|
96
80
|
};
|
|
97
|
-
|
|
98
81
|
const clearTransformProp = el => {
|
|
99
82
|
el.style.transform = '';
|
|
100
83
|
el.style[getTransformProperty()] = '';
|
|
101
84
|
};
|
|
102
|
-
|
|
103
85
|
const clearAnimationProp = el => {
|
|
104
86
|
el.style[getAnimationProperty()] = '';
|
|
105
87
|
el.style.animation = '';
|
|
106
88
|
};
|
|
107
|
-
|
|
108
89
|
const setAnimationProp = (els, val, opts) => {
|
|
109
|
-
const clearTransforms = opts && opts.clearTransforms === true;
|
|
110
|
-
|
|
90
|
+
const clearTransforms = opts && opts.clearTransforms === true;
|
|
91
|
+
// we got a collection, potentially
|
|
111
92
|
for (let i in els) {
|
|
112
93
|
// we do both because... chrome does both
|
|
113
94
|
if (clearTransforms) {
|
|
114
95
|
clearTransformProp(els[i]);
|
|
115
96
|
}
|
|
116
|
-
|
|
117
97
|
if (els[i].style) {
|
|
118
98
|
els[i].style[getAnimationProperty()] = val;
|
|
119
99
|
}
|
|
120
100
|
}
|
|
121
101
|
};
|
|
122
|
-
|
|
123
102
|
const addUnit = (item, unit) => {
|
|
124
103
|
if (typeof item === 'string') {
|
|
125
104
|
return item;
|
|
126
105
|
}
|
|
127
|
-
|
|
128
106
|
return item + unit;
|
|
129
107
|
};
|
|
130
|
-
|
|
131
108
|
const getValueForProperty = (val, prop) => {
|
|
132
109
|
if (val.hasOwnProperty(prop)) {
|
|
133
110
|
return val[prop];
|
|
134
111
|
}
|
|
135
|
-
|
|
136
112
|
return 0;
|
|
137
113
|
};
|
|
138
|
-
|
|
139
114
|
const createCssTranslateString = val => {
|
|
140
|
-
var res = [];
|
|
115
|
+
var res = [];
|
|
141
116
|
|
|
117
|
+
// array of values is assumed to be [x,y,(z)]
|
|
142
118
|
if (Array.isArray(val)) {
|
|
143
119
|
if (val.length === 2) {
|
|
144
120
|
res = res.concat(val, 0);
|
|
@@ -150,13 +126,11 @@ const createCssTranslateString = val => {
|
|
|
150
126
|
res.push(getValueForProperty(val, 'y'));
|
|
151
127
|
res.push(getValueForProperty(val, 'z'));
|
|
152
128
|
}
|
|
153
|
-
|
|
154
129
|
res = res.map(function (val) {
|
|
155
130
|
return addUnit(val, 'px');
|
|
156
131
|
});
|
|
157
132
|
return 'translate3d(' + res.join(',') + ')';
|
|
158
133
|
};
|
|
159
|
-
|
|
160
134
|
const lookups = {
|
|
161
135
|
scale: val => {
|
|
162
136
|
return 'scale(' + val + ')';
|
|
@@ -171,23 +145,22 @@ const lookups = {
|
|
|
171
145
|
return val;
|
|
172
146
|
}
|
|
173
147
|
};
|
|
174
|
-
|
|
175
148
|
const prefix = () => {
|
|
176
149
|
if (typeof document !== 'undefined') {
|
|
177
150
|
const el = document.documentElement || document.createElement('div');
|
|
178
151
|
return el.style.animation !== null ? '' : '-webkit-';
|
|
179
152
|
}
|
|
180
153
|
};
|
|
181
|
-
|
|
182
154
|
const getStyles = obj => {
|
|
183
155
|
// array of values is assumed to be [x,y,(z)]
|
|
156
|
+
|
|
184
157
|
if (Array.isArray(obj)) {
|
|
185
158
|
return prefix() + 'transform:' + createCssTranslateString(obj);
|
|
186
159
|
}
|
|
187
|
-
|
|
188
160
|
let transformBuff = [],
|
|
189
|
-
|
|
161
|
+
otherStyles = [];
|
|
190
162
|
|
|
163
|
+
// object assumes
|
|
191
164
|
if (typeof obj === 'object') {
|
|
192
165
|
for (let key in obj) {
|
|
193
166
|
if (lookups[key]) {
|
|
@@ -197,34 +170,29 @@ const getStyles = obj => {
|
|
|
197
170
|
}
|
|
198
171
|
}
|
|
199
172
|
}
|
|
200
|
-
|
|
201
173
|
otherStyles.push(prefix() + 'transform:' + transformBuff.join(''));
|
|
202
174
|
return otherStyles.join(';');
|
|
203
175
|
};
|
|
204
|
-
|
|
205
176
|
const getLine = (percentage, styles) => {
|
|
206
177
|
if (typeof percentage === 'number') {
|
|
207
178
|
percentage += '%';
|
|
208
179
|
} else if (typeof percentage === 'string' && percentage.indexOf('%') === -1) {
|
|
209
180
|
percentage += '%';
|
|
210
181
|
}
|
|
211
|
-
|
|
212
182
|
return percentage + '{' + getStyles(styles) + '}';
|
|
213
183
|
};
|
|
214
|
-
|
|
215
184
|
const createKeyframeAnimation = (name, positions) => {
|
|
216
|
-
let buf = '@' + prefix() + 'keyframes ' + name + '{';
|
|
185
|
+
let buf = '@' + prefix() + 'keyframes ' + name + '{';
|
|
217
186
|
|
|
187
|
+
// we got an array of arrays
|
|
218
188
|
if (Array.isArray(positions)) {
|
|
219
189
|
buf += positions.map(function (pos, index) {
|
|
220
190
|
let percentage;
|
|
221
|
-
|
|
222
191
|
if (index) {
|
|
223
192
|
percentage = index / (positions.length - 1) * 100;
|
|
224
193
|
} else {
|
|
225
194
|
percentage = 0;
|
|
226
195
|
}
|
|
227
|
-
|
|
228
196
|
return getLine(percentage, pos);
|
|
229
197
|
}).join('');
|
|
230
198
|
} else {
|
|
@@ -232,58 +200,47 @@ const createKeyframeAnimation = (name, positions) => {
|
|
|
232
200
|
buf += getLine(key, positions[key]);
|
|
233
201
|
}
|
|
234
202
|
}
|
|
235
|
-
|
|
236
203
|
buf += '}';
|
|
237
204
|
return buf;
|
|
238
205
|
};
|
|
239
|
-
|
|
240
206
|
const setAnimationAsTransform = (els, opts) => {
|
|
241
|
-
const clearAnimations = opts && opts.clearAnimations === true;
|
|
242
|
-
|
|
207
|
+
const clearAnimations = opts && opts.clearAnimations === true;
|
|
208
|
+
// we got a collection, potentially
|
|
243
209
|
for (let i in els) {
|
|
244
210
|
els[i].style[getTransformProperty()] = getComputedStyle(els[i])[getTransformProperty()];
|
|
245
211
|
if (clearAnimations) clearAnimationProp(els[i]);
|
|
246
212
|
}
|
|
247
213
|
};
|
|
248
|
-
|
|
249
214
|
export const runAnimation = promisify((els, opts, cb = () => {}) => {
|
|
250
215
|
if (typeof opts === 'string') {
|
|
251
216
|
opts = {
|
|
252
217
|
name: opts
|
|
253
218
|
};
|
|
254
219
|
}
|
|
255
|
-
|
|
256
220
|
if (!els.length) {
|
|
257
221
|
els = [els];
|
|
258
222
|
}
|
|
259
|
-
|
|
260
223
|
if (!opts.name) {
|
|
261
224
|
return cb(Error('must supply animation name'));
|
|
262
225
|
}
|
|
263
|
-
|
|
264
226
|
const found = registeredAnimations[opts.name];
|
|
265
|
-
|
|
266
227
|
if (!found) {
|
|
267
228
|
return cb(Error(`no animation named ${opts.name} exists`));
|
|
268
229
|
}
|
|
269
|
-
|
|
270
|
-
|
|
230
|
+
opts = {
|
|
231
|
+
...opts,
|
|
271
232
|
...found.presets,
|
|
272
233
|
...mainDefaults
|
|
273
234
|
};
|
|
274
|
-
|
|
275
235
|
const animationEnd = () => {
|
|
276
236
|
removeStyleEvent(els[0], 'AnimationEnd', animationEnd);
|
|
277
|
-
|
|
278
237
|
if (opts.resetWhenDone) {
|
|
279
238
|
setAnimationAsTransform(els, {
|
|
280
239
|
clearAnimations: true
|
|
281
240
|
});
|
|
282
241
|
}
|
|
283
|
-
|
|
284
242
|
return cb(null, els);
|
|
285
243
|
};
|
|
286
|
-
|
|
287
244
|
addStyleEvent(els[0], 'AnimationEnd', animationEnd);
|
|
288
245
|
const styles = [opts.name, addUnit(opts.duration, 'ms'), opts.easing, opts.iterations, addUnit(opts.delay, 'ms'), opts.direction, opts.fillMode];
|
|
289
246
|
setAnimationProp(els, styles.join(' '), {
|