grommet 2.31.0 → 2.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Accordion/Accordion.js +4 -2
- package/components/Accordion/index.d.ts +1 -0
- package/components/Accordion/propTypes.js +1 -0
- package/components/AccordionPanel/AccordionPanel.js +2 -1
- package/components/Box/Box.js +14 -4
- package/components/Box/stories/Border.js +15 -1
- package/components/Button/BusyAnimation.js +51 -0
- package/components/Button/Button.js +64 -4
- package/components/Button/StyledButton.js +4 -2
- package/components/Button/StyledButtonKind.js +8 -4
- package/components/Button/index.d.ts +7 -0
- package/components/Button/propTypes.js +6 -0
- package/components/Button/stories/Busy.js +45 -0
- package/components/Calendar/stories/Dual.js +4 -6
- package/components/Data/DataForm.js +6 -2
- package/components/Data/filter.js +9 -1
- package/components/Data/stories/Complex.js +63 -6
- package/components/Data/stories/Inline.js +19 -2
- package/components/DataFilter/DataFilter.js +11 -1
- package/components/DataFilters/DataFilters.js +13 -10
- package/components/DataTable/Body.js +16 -13
- package/components/DataTable/DataTable.js +4 -1
- package/components/DataTable/GroupedBody.js +1 -0
- package/components/DataTable/Header.js +1 -0
- package/components/DataTable/buildState.js +12 -10
- package/components/DataTable/stories/Controlled.js +2 -1
- package/components/DataTable/stories/ControlledGrouped.js +2 -1
- package/components/DataTable/stories/CustomThemed/Custom.js +0 -1
- package/components/DataTable/stories/CustomThemed/Fill.js +2 -1
- package/components/DataTable/stories/GroupedOnSelect.js +2 -1
- package/components/DataTable/stories/NoPrimary.js +0 -1
- package/components/DataTable/stories/OnUpdate.js +2 -1
- package/components/DataTable/stories/Served.js +2 -1
- package/components/DataTable/stories/Tunable.js +2 -1
- package/components/DataTable/stories/rowDetails.js +2 -1
- package/components/DataTableColumns/DataTableColumns.js +5 -0
- package/components/DataTableColumns/stories/Simple.js +4 -3
- package/components/DataTableGroupBy/DataTableGroupBy.js +67 -0
- package/components/DataTableGroupBy/README.md +2 -0
- package/components/DataTableGroupBy/index.d.ts +20 -0
- package/components/DataTableGroupBy/index.js +6 -0
- package/components/DataTableGroupBy/propTypes.js +17 -0
- package/components/DataTableGroupBy/stories/Simple.js +50 -0
- package/components/DateInput/DateInput.js +1 -1
- package/components/Drop/DropContainer.js +2 -2
- package/components/DropButton/DropButton.js +2 -2
- package/components/FileInput/FileInput.js +82 -53
- package/components/Form/Form.js +95 -44
- package/components/Form/stories/TriggerValidationUsingFormField.js +109 -0
- package/components/FormField/FormField.js +4 -2
- package/components/FormField/index.d.ts +1 -0
- package/components/FormField/propTypes.js +2 -1
- package/components/Grid/stories/CustomThemed/Responsive.js +0 -1
- package/components/InfiniteScroll/InfiniteScroll.js +1 -0
- package/components/Layer/Layer.js +1 -1
- package/components/Layer/LayerContainer.js +2 -2
- package/components/List/index.d.ts +2 -2
- package/components/NameValueList/NameValueList.js +1 -1
- package/components/SelectMultiple/SelectMultiple.js +13 -10
- package/components/SelectMultiple/SelectMultipleValue.js +1 -1
- package/components/Tip/stories/HeaderActions.js +0 -1
- package/components/index.d.ts +1 -0
- package/components/index.js +6 -0
- package/es6/components/Accordion/Accordion.js +4 -2
- package/es6/components/Accordion/index.d.ts +1 -0
- package/es6/components/Accordion/propTypes.js +1 -0
- package/es6/components/AccordionPanel/AccordionPanel.js +2 -1
- package/es6/components/Box/Box.js +14 -4
- package/es6/components/Box/stories/Border.js +15 -1
- package/es6/components/Button/BusyAnimation.js +41 -0
- package/es6/components/Button/Button.js +64 -5
- package/es6/components/Button/StyledButton.js +4 -2
- package/es6/components/Button/StyledButtonKind.js +8 -4
- package/es6/components/Button/index.d.ts +7 -0
- package/es6/components/Button/propTypes.js +6 -0
- package/es6/components/Button/stories/Busy.js +37 -0
- package/es6/components/Calendar/stories/Dual.js +4 -6
- package/es6/components/Data/DataForm.js +4 -1
- package/es6/components/Data/filter.js +9 -1
- package/es6/components/Data/stories/Complex.js +64 -7
- package/es6/components/Data/stories/Inline.js +20 -3
- package/es6/components/DataFilter/DataFilter.js +11 -1
- package/es6/components/DataFilters/DataFilters.js +13 -10
- package/es6/components/DataTable/Body.js +15 -13
- package/es6/components/DataTable/DataTable.js +4 -1
- package/es6/components/DataTable/GroupedBody.js +1 -0
- package/es6/components/DataTable/buildState.js +12 -10
- package/es6/components/DataTableColumns/DataTableColumns.js +5 -0
- package/es6/components/DataTableColumns/stories/Simple.js +5 -4
- package/es6/components/DataTableGroupBy/DataTableGroupBy.js +60 -0
- package/es6/components/DataTableGroupBy/README.md +2 -0
- package/es6/components/DataTableGroupBy/index.d.ts +20 -0
- package/es6/components/DataTableGroupBy/index.js +1 -0
- package/es6/components/DataTableGroupBy/propTypes.js +11 -0
- package/es6/components/DataTableGroupBy/stories/Simple.js +45 -0
- package/es6/components/DateInput/DateInput.js +1 -1
- package/es6/components/Drop/DropContainer.js +2 -2
- package/es6/components/DropButton/DropButton.js +2 -2
- package/es6/components/FileInput/FileInput.js +83 -53
- package/es6/components/Form/Form.js +95 -44
- package/es6/components/Form/stories/TriggerValidationUsingFormField.js +102 -0
- package/es6/components/FormField/FormField.js +4 -2
- package/es6/components/FormField/index.d.ts +1 -0
- package/es6/components/FormField/propTypes.js +2 -1
- package/es6/components/InfiniteScroll/InfiniteScroll.js +1 -0
- package/es6/components/Layer/Layer.js +1 -1
- package/es6/components/Layer/LayerContainer.js +2 -2
- package/es6/components/List/index.d.ts +2 -2
- package/es6/components/NameValueList/NameValueList.js +1 -1
- package/es6/components/SelectMultiple/SelectMultiple.js +13 -10
- package/es6/components/SelectMultiple/SelectMultipleValue.js +1 -1
- package/es6/components/index.d.ts +1 -0
- package/es6/components/index.js +1 -0
- package/es6/index.d.ts +1 -0
- package/es6/languages/default.json +15 -2
- package/es6/themes/base.js +1 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +1 -0
- package/languages/default.json +15 -2
- package/package.json +37 -36
- package/themes/base.js +1 -1
|
@@ -6,7 +6,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
6
6
|
var _propTypes = require("./propTypes");
|
|
7
7
|
var _Box = require("../Box");
|
|
8
8
|
var _AccordionContext = require("./AccordionContext");
|
|
9
|
-
var _excluded = ["activeIndex", "animate", "children", "multiple", "onActive"];
|
|
9
|
+
var _excluded = ["activeIndex", "animate", "children", "level", "multiple", "onActive"];
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
12
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -19,6 +19,7 @@ var Accordion = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
19
19
|
_ref$animate = _ref.animate,
|
|
20
20
|
animate = _ref$animate === void 0 ? true : _ref$animate,
|
|
21
21
|
children = _ref.children,
|
|
22
|
+
level = _ref.level,
|
|
22
23
|
multiple = _ref.multiple,
|
|
23
24
|
onActive = _ref.onActive,
|
|
24
25
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -55,11 +56,12 @@ var Accordion = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
55
56
|
return {
|
|
56
57
|
active: activeIndexes.indexOf(index) > -1,
|
|
57
58
|
animate: animate,
|
|
59
|
+
level: level,
|
|
58
60
|
onPanelChange: function onPanelChange() {
|
|
59
61
|
return _onPanelChange(index);
|
|
60
62
|
}
|
|
61
63
|
};
|
|
62
|
-
}, [activeIndexes, animate, multiple, onActive]);
|
|
64
|
+
}, [activeIndexes, animate, level, multiple, onActive]);
|
|
63
65
|
return /*#__PURE__*/_react["default"].createElement(_Box.Box, _extends({
|
|
64
66
|
ref: ref
|
|
65
67
|
}, rest), _react.Children.toArray(children).filter(function (child) {
|
|
@@ -12,6 +12,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
12
12
|
activeIndex: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].arrayOf(_propTypes["default"].number)]),
|
|
13
13
|
animate: _propTypes["default"].bool,
|
|
14
14
|
children: _propTypes["default"].node,
|
|
15
|
+
level: _propTypes["default"].number,
|
|
15
16
|
onActive: _propTypes["default"].func,
|
|
16
17
|
multiple: _propTypes["default"].bool,
|
|
17
18
|
messages: _propTypes["default"].shape({
|
|
@@ -31,6 +31,7 @@ var AccordionPanel = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
31
31
|
var _useContext = (0, _react.useContext)(_AccordionContext.AccordionContext),
|
|
32
32
|
active = _useContext.active,
|
|
33
33
|
animate = _useContext.animate,
|
|
34
|
+
level = _useContext.level,
|
|
34
35
|
onPanelChange = _useContext.onPanelChange;
|
|
35
36
|
var _useState = (0, _react.useState)(undefined),
|
|
36
37
|
hover = _useState[0],
|
|
@@ -110,7 +111,7 @@ var AccordionPanel = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
110
111
|
horizontal: 'xsmall'
|
|
111
112
|
}
|
|
112
113
|
}, /*#__PURE__*/_react["default"].createElement(_Heading.Heading, {
|
|
113
|
-
level: theme.accordion.heading && theme.accordion.heading.level || 4,
|
|
114
|
+
level: level || theme.accordion.heading && theme.accordion.heading.level || 4,
|
|
114
115
|
margin: theme.accordion.heading && theme.accordion.heading.margin || undefined,
|
|
115
116
|
color: hover
|
|
116
117
|
}, label)) : label, AccordionIcon && /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
package/components/Box/Box.js
CHANGED
|
@@ -91,13 +91,21 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
91
91
|
if (focusable) return 0;
|
|
92
92
|
return undefined;
|
|
93
93
|
}, [focusable, tabIndex]);
|
|
94
|
-
if ((border === 'between' || border && border.side === 'between') &&
|
|
94
|
+
if ((border === 'between' || border && border.side === 'between' || Array.isArray(border) && border.find(function (b) {
|
|
95
|
+
return b.side === 'between';
|
|
96
|
+
})) && !gap) {
|
|
95
97
|
console.warn('Box must have a gap to use border between');
|
|
96
98
|
}
|
|
97
99
|
var contents = children;
|
|
98
100
|
if (gap && gap !== 'none' && (!(boxOptions != null && boxOptions.cssGap || cssGap) ||
|
|
99
101
|
// need this approach to show border between
|
|
100
|
-
border === 'between' || (border == null ? void 0 : border.side) === 'between')) {
|
|
102
|
+
border === 'between' || (border == null ? void 0 : border.side) === 'between' || Array.isArray(border) && border.find(function (b) {
|
|
103
|
+
return b.side === 'between';
|
|
104
|
+
}))) {
|
|
105
|
+
// if border is an array, we need to extract the border between object
|
|
106
|
+
var styledBoxGapBorder = Array.isArray(border) ? border.find(function (b) {
|
|
107
|
+
return b.side === 'between';
|
|
108
|
+
}) : border;
|
|
101
109
|
var boxAs = !as && tag ? tag : as;
|
|
102
110
|
contents = [];
|
|
103
111
|
var firstIndex;
|
|
@@ -114,7 +122,7 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
114
122
|
gap: gap,
|
|
115
123
|
directionProp: direction,
|
|
116
124
|
responsive: responsive,
|
|
117
|
-
border:
|
|
125
|
+
border: styledBoxGapBorder
|
|
118
126
|
}));
|
|
119
127
|
}
|
|
120
128
|
}
|
|
@@ -183,7 +191,9 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
183
191
|
elevationProp: elevation,
|
|
184
192
|
fillProp: fill,
|
|
185
193
|
focus: focus,
|
|
186
|
-
gap: ((boxOptions == null ? void 0 : boxOptions.cssGap) || cssGap) && gap && gap !== 'none' && border !== 'between' && (border == null ? void 0 : border.side) !== 'between' &&
|
|
194
|
+
gap: ((boxOptions == null ? void 0 : boxOptions.cssGap) || cssGap) && gap && gap !== 'none' && border !== 'between' && (border == null ? void 0 : border.side) !== 'between' && (!Array.isArray(border) || !border.find(function (b) {
|
|
195
|
+
return b.side === 'between';
|
|
196
|
+
})) && gap,
|
|
187
197
|
kindProp: kind,
|
|
188
198
|
overflowProp: overflow,
|
|
189
199
|
wrapProp: wrap,
|
|
@@ -98,7 +98,21 @@ var BorderBox = function BorderBox() {
|
|
|
98
98
|
size: 'large'
|
|
99
99
|
}
|
|
100
100
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "between"), /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, direction));
|
|
101
|
-
}))
|
|
101
|
+
})), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
102
|
+
direction: "row",
|
|
103
|
+
gap: "small",
|
|
104
|
+
border: [{
|
|
105
|
+
side: 'between'
|
|
106
|
+
}, {
|
|
107
|
+
side: 'top'
|
|
108
|
+
}, {
|
|
109
|
+
side: 'right'
|
|
110
|
+
}, {
|
|
111
|
+
side: 'bottom'
|
|
112
|
+
}, {
|
|
113
|
+
side: 'left'
|
|
114
|
+
}]
|
|
115
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "Multiple Border"), /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "With Between")))
|
|
102
116
|
// </Grommet>
|
|
103
117
|
);
|
|
104
118
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.StyledBusyContents = exports.GrowCheckmark = exports.EllipsisAnimation = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
7
|
+
var _Checkmark = require("grommet-icons/icons/Checkmark");
|
|
8
|
+
var _Box = require("../Box");
|
|
9
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
var bounceDelay = (0, _styledComponents.keyframes)(["0%,80%,100%{transform:scale(0.4);}40%{transform:scale(0.8);}"]);
|
|
13
|
+
var bounceDelayRule = (0, _styledComponents.css)(["animation:", " 1.4s infinite ease-in-out both;"], bounceDelay);
|
|
14
|
+
var Dot = (0, _styledComponents["default"])(_Box.Box).withConfig({
|
|
15
|
+
displayName: "BusyAnimation__Dot",
|
|
16
|
+
componentId: "sc-feuivs-0"
|
|
17
|
+
})(["background-color:currentColor;width:8px;height:8px;border-radius:100%;display:inline-block;", " ", ""], bounceDelayRule, function (props) {
|
|
18
|
+
return props.delay && "animation-delay: " + props.delay + ";";
|
|
19
|
+
});
|
|
20
|
+
var EllipsisAnimation = function EllipsisAnimation() {
|
|
21
|
+
return /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
22
|
+
style: {
|
|
23
|
+
position: 'absolute'
|
|
24
|
+
},
|
|
25
|
+
fill: true,
|
|
26
|
+
alignContent: "center",
|
|
27
|
+
justify: "center"
|
|
28
|
+
}, /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
29
|
+
alignSelf: "center",
|
|
30
|
+
direction: "row",
|
|
31
|
+
gap: "small"
|
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement(Dot, {
|
|
33
|
+
delay: "-0.32s"
|
|
34
|
+
}), /*#__PURE__*/_react["default"].createElement(Dot, {
|
|
35
|
+
delay: "-0.16s"
|
|
36
|
+
}), /*#__PURE__*/_react["default"].createElement(Dot, null)));
|
|
37
|
+
};
|
|
38
|
+
exports.EllipsisAnimation = EllipsisAnimation;
|
|
39
|
+
var grow = (0, _styledComponents.keyframes)(["0%{opacity:0;transform:scale(.3);}20%{opacity:1;transform:scale(1.15);}30%{transform:scale(.9);}45%{transform:scale(1.05);}55%{transform:scale(1);}100%{transform:scale(1);}"]);
|
|
40
|
+
var GrowCheckmark = (0, _styledComponents["default"])(_Checkmark.Checkmark).withConfig({
|
|
41
|
+
displayName: "BusyAnimation__GrowCheckmark",
|
|
42
|
+
componentId: "sc-feuivs-1"
|
|
43
|
+
})(["position:absolute;align-self:center;animation:", " 0.9s ease-in-out;"], grow);
|
|
44
|
+
exports.GrowCheckmark = GrowCheckmark;
|
|
45
|
+
var StyledBusyContents = _styledComponents["default"].div.withConfig({
|
|
46
|
+
displayName: "BusyAnimation__StyledBusyContents",
|
|
47
|
+
componentId: "sc-feuivs-2"
|
|
48
|
+
})(["opacity:", ";}"], function (props) {
|
|
49
|
+
return props.animating ? 0 : 1;
|
|
50
|
+
});
|
|
51
|
+
exports.StyledBusyContents = StyledBusyContents;
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.Button = void 0;
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _styledComponents = require("styled-components");
|
|
6
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
7
7
|
var _utils = require("../../utils");
|
|
8
8
|
var _defaultProps = require("../../default-props");
|
|
9
9
|
var _propTypes = require("./propTypes");
|
|
10
|
+
var _AnnounceContext = require("../../contexts/AnnounceContext");
|
|
11
|
+
var _MessageContext = require("../../contexts/MessageContext");
|
|
10
12
|
var _Box = require("../Box");
|
|
11
13
|
var _Tip = require("../Tip");
|
|
12
14
|
var _Badge = require("./Badge");
|
|
@@ -14,11 +16,17 @@ var _StyledButton = require("./StyledButton");
|
|
|
14
16
|
var _StyledButtonKind = require("./StyledButtonKind");
|
|
15
17
|
var _AnalyticsContext = require("../../contexts/AnalyticsContext");
|
|
16
18
|
var _Skeleton = require("../Skeleton");
|
|
17
|
-
var
|
|
19
|
+
var _BusyAnimation = require("./BusyAnimation");
|
|
20
|
+
var _excluded = ["active", "align", "aria-label", "badge", "busy", "color", "children", "disabled", "icon", "focusIndicator", "gap", "fill", "href", "justify", "kind", "label", "messages", "onBlur", "onClick", "onFocus", "onMouseOut", "onMouseOver", "pad", "plain", "primary", "reverse", "secondary", "selected", "size", "success", "tip", "type", "a11yTitle", "as"];
|
|
18
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
23
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
|
+
var RelativeBox = (0, _styledComponents["default"])(_Box.Box).withConfig({
|
|
26
|
+
displayName: "Button__RelativeBox",
|
|
27
|
+
componentId: "sc-zuqsuw-0"
|
|
28
|
+
})(["position:relative;"]);
|
|
29
|
+
|
|
22
30
|
// We have two Styled* components to separate
|
|
23
31
|
// the newer default|primary|secondary approach,
|
|
24
32
|
// which we use the term "kind" to refer to,
|
|
@@ -143,6 +151,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
143
151
|
align = _ref$align === void 0 ? 'center' : _ref$align,
|
|
144
152
|
ariaLabel = _ref['aria-label'],
|
|
145
153
|
badgeProp = _ref.badge,
|
|
154
|
+
busy = _ref.busy,
|
|
146
155
|
color = _ref.color,
|
|
147
156
|
children = _ref.children,
|
|
148
157
|
disabled = _ref.disabled,
|
|
@@ -155,6 +164,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
155
164
|
justify = _ref.justify,
|
|
156
165
|
kindArg = _ref.kind,
|
|
157
166
|
label = _ref.label,
|
|
167
|
+
messages = _ref.messages,
|
|
158
168
|
_onBlur = _ref.onBlur,
|
|
159
169
|
onClickProp = _ref.onClick,
|
|
160
170
|
_onFocus = _ref.onFocus,
|
|
@@ -167,6 +177,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
167
177
|
secondary = _ref.secondary,
|
|
168
178
|
selected = _ref.selected,
|
|
169
179
|
sizeProp = _ref.size,
|
|
180
|
+
success = _ref.success,
|
|
170
181
|
tip = _ref.tip,
|
|
171
182
|
_ref$type = _ref.type,
|
|
172
183
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
@@ -181,6 +192,21 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
181
192
|
var _useState2 = (0, _react.useState)(false),
|
|
182
193
|
hover = _useState2[0],
|
|
183
194
|
setHover = _useState2[1];
|
|
195
|
+
var announce = (0, _react.useContext)(_AnnounceContext.AnnounceContext);
|
|
196
|
+
var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
197
|
+
format = _useContext.format;
|
|
198
|
+
if (busy && success) {
|
|
199
|
+
console.warn('Button cannot have both busy and success set to true.');
|
|
200
|
+
}
|
|
201
|
+
(0, _react.useEffect)(function () {
|
|
202
|
+
if (busy) announce(format({
|
|
203
|
+
id: 'button.busy',
|
|
204
|
+
messages: messages
|
|
205
|
+
}));else if (success) announce(format({
|
|
206
|
+
id: 'button.success',
|
|
207
|
+
messages: messages
|
|
208
|
+
}));
|
|
209
|
+
}, [announce, busy, format, messages, success]);
|
|
184
210
|
if ((icon || label) && children) {
|
|
185
211
|
console.warn('Button should not have children if icon or label is provided');
|
|
186
212
|
}
|
|
@@ -337,6 +363,36 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
337
363
|
content: badgeProp
|
|
338
364
|
}, contents);
|
|
339
365
|
}
|
|
366
|
+
if (busy || success) {
|
|
367
|
+
// match what the label will use
|
|
368
|
+
var animationColor;
|
|
369
|
+
if (kind) {
|
|
370
|
+
if (!plain) {
|
|
371
|
+
animationColor = hover && getIconColor(themePaths.hover, theme) || getIconColor(themePaths.base, theme, color, kind);
|
|
372
|
+
}
|
|
373
|
+
} else if (primary) {
|
|
374
|
+
animationColor = theme.global.colors.text[isDarkBackground() ? 'dark' : 'light'];
|
|
375
|
+
}
|
|
376
|
+
contents =
|
|
377
|
+
/*#__PURE__*/
|
|
378
|
+
// position relative is necessary to have the animation
|
|
379
|
+
// display over the button content
|
|
380
|
+
_react["default"].createElement(RelativeBox, {
|
|
381
|
+
flex: false
|
|
382
|
+
}, busy && /*#__PURE__*/_react["default"].createElement(_BusyAnimation.EllipsisAnimation, null), success && /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
383
|
+
style: {
|
|
384
|
+
position: 'absolute'
|
|
385
|
+
},
|
|
386
|
+
fill: true,
|
|
387
|
+
alignContent: "center",
|
|
388
|
+
justify: "center"
|
|
389
|
+
}, /*#__PURE__*/_react["default"].createElement(_BusyAnimation.GrowCheckmark, {
|
|
390
|
+
color: animationColor,
|
|
391
|
+
"aria-hidden": true
|
|
392
|
+
})), /*#__PURE__*/_react["default"].createElement(_BusyAnimation.StyledBusyContents, {
|
|
393
|
+
animating: busy || success
|
|
394
|
+
}, contents));
|
|
395
|
+
}
|
|
340
396
|
var styledButtonResult;
|
|
341
397
|
if (kind) {
|
|
342
398
|
styledButtonResult = /*#__PURE__*/_react["default"].createElement(_StyledButtonKind.StyledButtonKind, _extends({}, rest, {
|
|
@@ -345,6 +401,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
345
401
|
active: active,
|
|
346
402
|
align: align,
|
|
347
403
|
"aria-label": ariaLabel || a11yTitle,
|
|
404
|
+
busy: busy,
|
|
348
405
|
badge: badgeProp,
|
|
349
406
|
colorValue: color,
|
|
350
407
|
disabled: disabled,
|
|
@@ -358,7 +415,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
358
415
|
href: href,
|
|
359
416
|
kind: kind,
|
|
360
417
|
themePaths: themePaths,
|
|
361
|
-
onClick: onClick,
|
|
418
|
+
onClick: !busy && !success ? onClick : undefined,
|
|
362
419
|
onFocus: function onFocus(event) {
|
|
363
420
|
setFocus(true);
|
|
364
421
|
if (_onFocus) _onFocus(event);
|
|
@@ -373,6 +430,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
373
430
|
plain: plain || _react.Children.count(children) > 0,
|
|
374
431
|
primary: primary,
|
|
375
432
|
sizeProp: size,
|
|
433
|
+
success: success,
|
|
376
434
|
type: !href ? type : undefined
|
|
377
435
|
}), contents);
|
|
378
436
|
} else {
|
|
@@ -380,6 +438,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
380
438
|
as: domTag,
|
|
381
439
|
ref: ref,
|
|
382
440
|
"aria-label": ariaLabel || a11yTitle,
|
|
441
|
+
busy: busy,
|
|
383
442
|
colorValue: color,
|
|
384
443
|
active: active,
|
|
385
444
|
selected: selected,
|
|
@@ -393,7 +452,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
393
452
|
href: href,
|
|
394
453
|
kind: kind,
|
|
395
454
|
themePaths: themePaths,
|
|
396
|
-
onClick: onClick,
|
|
455
|
+
onClick: !busy && !success ? onClick : undefined,
|
|
397
456
|
onFocus: function onFocus(event) {
|
|
398
457
|
setFocus(true);
|
|
399
458
|
if (_onFocus) _onFocus(event);
|
|
@@ -408,6 +467,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
408
467
|
plain: typeof plain !== 'undefined' ? plain : _react.Children.count(children) > 0 || icon && !label,
|
|
409
468
|
primary: primary,
|
|
410
469
|
sizeProp: size,
|
|
470
|
+
success: success,
|
|
411
471
|
type: !href ? type : undefined
|
|
412
472
|
}), contents);
|
|
413
473
|
}
|
|
@@ -77,14 +77,14 @@ var disabledButtonStyle = function disabledButtonStyle(props) {
|
|
|
77
77
|
var StyledButton = _styledComponents["default"].button.withConfig({
|
|
78
78
|
displayName: "StyledButton",
|
|
79
79
|
componentId: "sc-323bzc-0"
|
|
80
|
-
})(["display:inline-block;box-sizing:border-box;cursor:pointer;font:inherit;text-decoration:none;margin:0;background:transparent;overflow:visible;text-transform:none;", " ", " ", " ", " ", " ", " ", " &:focus{", "}&:focus:not(:focus-visible){", "}", " ", " ", " ", " ", " ", ""], _utils.genericStyles, function (props) {
|
|
80
|
+
})(["display:inline-block;box-sizing:border-box;cursor:pointer;font:inherit;text-decoration:none;margin:0;background:transparent;overflow:visible;text-transform:none;", " ", " ", " ", " ", " ", " ", " &:focus{", "}&:focus:not(:focus-visible){", "}", " ", " ", " ", " ", " ", " ", ""], _utils.genericStyles, function (props) {
|
|
81
81
|
return props.plain && plainStyle(props);
|
|
82
82
|
}, function (props) {
|
|
83
83
|
return !props.plain && basicStyle(props);
|
|
84
84
|
}, function (props) {
|
|
85
85
|
return props.primary && primaryStyle(props);
|
|
86
86
|
}, function (props) {
|
|
87
|
-
return !props.disabled && !props.selected && !props.focus && hoverStyle;
|
|
87
|
+
return !props.disabled && !props.selected && !props.focus && !props.busy && !props.success && hoverStyle;
|
|
88
88
|
}, function (props) {
|
|
89
89
|
return !props.disabled && props.active && activeButtonStyle(props);
|
|
90
90
|
}, function (props) {
|
|
@@ -103,6 +103,8 @@ var StyledButton = _styledComponents["default"].button.withConfig({
|
|
|
103
103
|
return !props.plain && props.pad && (0, _utils.edgeStyle)('padding', props.pad, false, undefined, props.theme);
|
|
104
104
|
}, function (props) {
|
|
105
105
|
return props.theme.button && props.theme.button.extend;
|
|
106
|
+
}, function (props) {
|
|
107
|
+
return (props.busy || props.success) && "\n cursor: default;\n ";
|
|
106
108
|
});
|
|
107
109
|
exports.StyledButton = StyledButton;
|
|
108
110
|
StyledButton.defaultProps = {};
|
|
@@ -83,11 +83,13 @@ var adjustPadStyle = function adjustPadStyle(pad, width) {
|
|
|
83
83
|
|
|
84
84
|
// build up CSS from basic to specific based on the supplied sub-object paths
|
|
85
85
|
var kindStyle = function kindStyle(_ref2) {
|
|
86
|
-
var
|
|
86
|
+
var busy = _ref2.busy,
|
|
87
|
+
colorValue = _ref2.colorValue,
|
|
87
88
|
hasIcon = _ref2.hasIcon,
|
|
88
89
|
hasLabel = _ref2.hasLabel,
|
|
89
90
|
kind = _ref2.kind,
|
|
90
91
|
size = _ref2.sizeProp,
|
|
92
|
+
success = _ref2.success,
|
|
91
93
|
themePaths = _ref2.themePaths,
|
|
92
94
|
theme = _ref2.theme;
|
|
93
95
|
var styles = [];
|
|
@@ -134,7 +136,7 @@ var kindStyle = function kindStyle(_ref2) {
|
|
|
134
136
|
// padding in the hover or hover.kind itself for backward compatibility
|
|
135
137
|
adjPadStyles = adjustPadStyle(pad, obj.border.width);
|
|
136
138
|
}
|
|
137
|
-
if (partStyles.length > 0) {
|
|
139
|
+
if (partStyles.length > 0 && !busy && !success) {
|
|
138
140
|
styles.push((0, _styledComponents.css)(["&:hover{", " ", "}"], partStyles, adjPadStyles));
|
|
139
141
|
}
|
|
140
142
|
}
|
|
@@ -177,7 +179,7 @@ var StyledButtonKind = _styledComponents["default"].button.withConfig({
|
|
|
177
179
|
}).withConfig({
|
|
178
180
|
displayName: "StyledButtonKind",
|
|
179
181
|
componentId: "sc-1vhfpnt-0"
|
|
180
|
-
})(["display:inline-block;box-sizing:border-box;cursor:pointer;font:inherit;text-decoration:none;margin:0;background:transparent;overflow:visible;text-transform:none;", " ", " ", " ", " ", " ", " ", " ", " ", " &:focus{", "}&:focus:not(:focus-visible){", "}", " ", " ", ""], _utils.genericStyles, function (props) {
|
|
182
|
+
})(["display:inline-block;box-sizing:border-box;cursor:pointer;font:inherit;text-decoration:none;margin:0;background:transparent;overflow:visible;text-transform:none;", " ", " ", " ", " ", " ", " ", " ", " ", " &:focus{", "}&:focus:not(:focus-visible){", "}", " ", " ", " ", ""], _utils.genericStyles, function (props) {
|
|
181
183
|
return props.plain && plainStyle(props);
|
|
182
184
|
}, function (props) {
|
|
183
185
|
return !props.disabled && props.active && _utils.activeStyle;
|
|
@@ -190,7 +192,7 @@ var StyledButtonKind = _styledComponents["default"].button.withConfig({
|
|
|
190
192
|
}, function (props) {
|
|
191
193
|
return !props.plain && props.align && "\n text-align: " + props.align + ";\n ";
|
|
192
194
|
}, function (props) {
|
|
193
|
-
return !props.disabled && props.hoverIndicator && hoverIndicatorStyle(props);
|
|
195
|
+
return !props.disabled && props.hoverIndicator && !props.busy && !props.success && hoverIndicatorStyle(props);
|
|
194
196
|
}, function (props) {
|
|
195
197
|
return props.disabled && (0, _utils.disabledStyle)(props.theme.button.disabled.opacity);
|
|
196
198
|
}, function (props) {
|
|
@@ -201,6 +203,8 @@ var StyledButtonKind = _styledComponents["default"].button.withConfig({
|
|
|
201
203
|
return props.fillContainer && fillStyle(props.fillContainer);
|
|
202
204
|
}, function (props) {
|
|
203
205
|
return props.theme.button && props.theme.button.extend;
|
|
206
|
+
}, function (props) {
|
|
207
|
+
return (props.busy || props.success) && "\n cursor: default;\n ";
|
|
204
208
|
});
|
|
205
209
|
exports.StyledButtonKind = StyledButtonKind;
|
|
206
210
|
StyledButtonKind.defaultProps = {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { string } from 'prop-types';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import {
|
|
3
4
|
A11yTitleType,
|
|
@@ -39,6 +40,7 @@ export interface ButtonProps {
|
|
|
39
40
|
hover: boolean;
|
|
40
41
|
focus: boolean;
|
|
41
42
|
}) => React.ReactNode);
|
|
43
|
+
busy?: boolean;
|
|
42
44
|
gridArea?: GridAreaType;
|
|
43
45
|
margin?: MarginType;
|
|
44
46
|
active?: boolean;
|
|
@@ -61,12 +63,17 @@ export interface ButtonProps {
|
|
|
61
63
|
icon?: JSX.Element;
|
|
62
64
|
kind?: string;
|
|
63
65
|
label?: React.ReactNode;
|
|
66
|
+
messages?: {
|
|
67
|
+
busy?: string;
|
|
68
|
+
success?: string;
|
|
69
|
+
};
|
|
64
70
|
pad?: PadType;
|
|
65
71
|
plain?: boolean;
|
|
66
72
|
primary?: boolean;
|
|
67
73
|
reverse?: boolean;
|
|
68
74
|
secondary?: boolean;
|
|
69
75
|
size?: 'small' | 'medium' | 'large' | string;
|
|
76
|
+
success?: boolean;
|
|
70
77
|
tip?: TipProps | string;
|
|
71
78
|
type?: 'button' | 'reset' | 'submit';
|
|
72
79
|
as?: PolymorphicType;
|
|
@@ -17,6 +17,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
17
17
|
max: _propTypes["default"].number,
|
|
18
18
|
value: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].number])
|
|
19
19
|
})]),
|
|
20
|
+
busy: _propTypes["default"].bool,
|
|
20
21
|
color: _generalPropTypes.colorPropType,
|
|
21
22
|
disabled: _propTypes["default"].bool,
|
|
22
23
|
fill: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['horizontal', 'vertical']), _propTypes["default"].bool]),
|
|
@@ -27,6 +28,10 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
27
28
|
icon: _propTypes["default"].element,
|
|
28
29
|
justify: _propTypes["default"].oneOf(['around', 'between', 'center', 'end', 'evenly', 'start', 'stretch']),
|
|
29
30
|
label: _propTypes["default"].node,
|
|
31
|
+
messages: _propTypes["default"].shape({
|
|
32
|
+
busy: _propTypes["default"].string,
|
|
33
|
+
success: _propTypes["default"].string
|
|
34
|
+
}),
|
|
30
35
|
onClick: _propTypes["default"].func,
|
|
31
36
|
pad: _generalPropTypes.padPropType,
|
|
32
37
|
plain: _propTypes["default"].bool,
|
|
@@ -34,6 +39,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
34
39
|
reverse: _propTypes["default"].bool,
|
|
35
40
|
secondary: _propTypes["default"].bool,
|
|
36
41
|
size: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['small', 'medium', 'large']), _propTypes["default"].string]),
|
|
42
|
+
success: _propTypes["default"].bool,
|
|
37
43
|
target: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['_self', '_blank', '_parent', '_top']), _propTypes["default"].string]),
|
|
38
44
|
tip: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
39
45
|
content: _propTypes["default"].oneOfType([_propTypes["default"].node, _propTypes["default"].string]),
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Busy = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
8
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
9
|
+
var Busy = function Busy() {
|
|
10
|
+
var _useState = (0, _react.useState)(),
|
|
11
|
+
busy = _useState[0],
|
|
12
|
+
setBusy = _useState[1];
|
|
13
|
+
var _useState2 = (0, _react.useState)(),
|
|
14
|
+
success = _useState2[0],
|
|
15
|
+
setSuccess = _useState2[1];
|
|
16
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
17
|
+
align: "center",
|
|
18
|
+
pad: "medium"
|
|
19
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Button, {
|
|
20
|
+
primary: true,
|
|
21
|
+
busy: busy,
|
|
22
|
+
success: success,
|
|
23
|
+
label: "Button Busy",
|
|
24
|
+
onClick: function onClick() {
|
|
25
|
+
setBusy(true);
|
|
26
|
+
setTimeout(function () {
|
|
27
|
+
setBusy(false);
|
|
28
|
+
setSuccess(true);
|
|
29
|
+
}, 2000);
|
|
30
|
+
setTimeout(function () {
|
|
31
|
+
setSuccess(false);
|
|
32
|
+
}, 4000);
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
exports.Busy = Busy;
|
|
37
|
+
Busy.parameters = {
|
|
38
|
+
chromatic: {
|
|
39
|
+
disable: true
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var _default = {
|
|
43
|
+
title: 'Controls/Button/Busy'
|
|
44
|
+
};
|
|
45
|
+
exports["default"] = _default;
|
|
@@ -49,11 +49,9 @@ var Dual = function Dual() {
|
|
|
49
49
|
onReference: function onReference(reference) {
|
|
50
50
|
var refDate = new Date(reference);
|
|
51
51
|
var nextDate = new Date(refDate);
|
|
52
|
-
console.log(refDate);
|
|
53
|
-
console.log(nextDate);
|
|
54
52
|
nextDate.setMonth(refDate.getMonth() + 1, 1);
|
|
55
|
-
setReference1(refDate.
|
|
56
|
-
setReference2(nextDate.
|
|
53
|
+
setReference1(refDate.toISOString());
|
|
54
|
+
setReference2(nextDate.toISOString());
|
|
57
55
|
},
|
|
58
56
|
header: function header(_ref) {
|
|
59
57
|
var currentDate = _ref.date,
|
|
@@ -88,8 +86,8 @@ var Dual = function Dual() {
|
|
|
88
86
|
var refDate = new Date(reference);
|
|
89
87
|
var priorDate = new Date(refDate);
|
|
90
88
|
priorDate.setMonth(refDate.getMonth() - 1, 1);
|
|
91
|
-
setReference1(priorDate.
|
|
92
|
-
setReference2(refDate.
|
|
89
|
+
setReference1(priorDate.toISOString());
|
|
90
|
+
setReference2(refDate.toISOString());
|
|
93
91
|
},
|
|
94
92
|
header: function header(_ref2) {
|
|
95
93
|
var currentDate = _ref2.date,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.formViewNameKey = exports.formStepKey = exports.formSortKey = exports.formSearchKey = exports.formRangeKey = exports.formPageKey = exports.formColumnsKey = exports.DataForm = void 0;
|
|
4
|
+
exports.formViewNameKey = exports.formStepKey = exports.formSortKey = exports.formSearchKey = exports.formRangeKey = exports.formPageKey = exports.formGroupByKey = exports.formColumnsKey = exports.DataForm = void 0;
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
6
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
7
|
var _Box = require("../Box");
|
|
@@ -49,6 +49,8 @@ var formPageKey = '_page';
|
|
|
49
49
|
exports.formPageKey = formPageKey;
|
|
50
50
|
var formColumnsKey = '_columns';
|
|
51
51
|
exports.formColumnsKey = formColumnsKey;
|
|
52
|
+
var formGroupByKey = '_groupBy';
|
|
53
|
+
exports.formGroupByKey = formGroupByKey;
|
|
52
54
|
var formViewNameKey = '_view';
|
|
53
55
|
exports.formViewNameKey = formViewNameKey;
|
|
54
56
|
var viewFormKeyMap = {
|
|
@@ -57,6 +59,7 @@ var viewFormKeyMap = {
|
|
|
57
59
|
step: formStepKey,
|
|
58
60
|
page: formPageKey,
|
|
59
61
|
columns: formColumnsKey,
|
|
62
|
+
groupBy: formGroupByKey,
|
|
60
63
|
view: formViewNameKey
|
|
61
64
|
};
|
|
62
65
|
|
|
@@ -119,6 +122,7 @@ var viewToFormValue = function viewToFormValue(view) {
|
|
|
119
122
|
if (view != null && view.sort) result[formSortKey] = view.sort;
|
|
120
123
|
if (view != null && view.name) result[formViewNameKey] = view.name;
|
|
121
124
|
if (view != null && view.columns) result[formColumnsKey] = view.columns;
|
|
125
|
+
if (view != null && view.groupBy) result[formGroupByKey] = view.groupBy;
|
|
122
126
|
return unflatten(result);
|
|
123
127
|
};
|
|
124
128
|
|
|
@@ -267,7 +271,7 @@ var DataForm = function DataForm(_ref) {
|
|
|
267
271
|
return setFormValue(viewToFormValue(view));
|
|
268
272
|
}, [view]);
|
|
269
273
|
var content = children;
|
|
270
|
-
if (footer !== false || pad) {
|
|
274
|
+
if (footer !== false && updateOn === 'submit' || pad) {
|
|
271
275
|
content = /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
272
276
|
fill: "vertical"
|
|
273
277
|
}, /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
@@ -51,7 +51,15 @@ var filter = function filter(data, view, properties) {
|
|
|
51
51
|
if (typeof (filterValue == null ? void 0 : filterValue.min) === 'number' || typeof (filterValue == null ? void 0 : filterValue.max) === 'number') return typeof value !== 'number' || value <= filterValue.min || value >= filterValue.max;
|
|
52
52
|
|
|
53
53
|
// options case
|
|
54
|
-
if (Array.isArray(filterValue))
|
|
54
|
+
if (Array.isArray(filterValue)) {
|
|
55
|
+
if (Array.isArray(value)) {
|
|
56
|
+
return !filterValue.some(function (f) {
|
|
57
|
+
return typeof f === 'object' ? value.includes(f == null ? void 0 : f.value) // from {label: ___, value: ___}
|
|
58
|
+
: value.includes(f);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return !filterValue.includes(value);
|
|
62
|
+
}
|
|
55
63
|
|
|
56
64
|
// presence case
|
|
57
65
|
if (typeof filterValue === 'boolean') return filterValue === !value;
|