grommet 2.29.0 → 2.30.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/Anchor/Anchor.js +9 -3
- package/components/Anchor/StyledAnchor.js +6 -3
- package/components/Button/Button.js +10 -14
- package/components/Button/StyledButtonKind.js +21 -9
- package/components/Calendar/Calendar.js +80 -71
- package/components/Data/Data.js +48 -26
- package/components/Data/DataForm.js +203 -48
- package/components/Data/filter.js +17 -6
- package/components/Data/index.d.ts +12 -7
- package/components/Data/index.js +6 -2
- package/components/Data/propTypes.js +3 -2
- package/components/Data/stories/Cards.js +1 -1
- package/components/Data/stories/Complex.js +84 -0
- package/components/Data/stories/Controlled.js +1 -1
- package/components/Data/stories/DataTable.js +11 -4
- package/components/Data/stories/Infinite.js +53 -57
- package/components/Data/stories/Inline.js +7 -2
- package/components/Data/stories/List.js +1 -1
- package/components/Data/stories/Simple.js +1 -1
- package/components/Data/stories/SpaceX.js +114 -140
- package/components/Data/stories/StarWars.js +127 -0
- package/components/Data/stories/Views.js +56 -0
- package/components/DataFilter/DataFilter.js +33 -42
- package/components/DataFilter/stories/Simple.js +7 -4
- package/components/DataFilters/DataFilters.js +117 -40
- package/components/DataFilters/index.d.ts +1 -0
- package/components/DataFilters/propTypes.js +2 -1
- package/components/DataFilters/stories/Drop.js +7 -4
- package/components/DataFilters/stories/Inline.js +24 -6
- package/components/DataFilters/stories/Layer.js +46 -0
- package/components/DataFilters/stories/Simple.js +7 -4
- package/components/DataSearch/DataSearch.js +70 -13
- package/components/DataSearch/index.d.ts +10 -1
- package/components/DataSearch/propTypes.js +6 -1
- package/components/DataSearch/stories/Drop.js +42 -0
- package/components/DataSearch/stories/Responsive.js +42 -0
- package/components/DataSearch/stories/Simple.js +5 -2
- package/components/DataSort/DataSort.js +67 -18
- package/components/DataSort/index.d.ts +4 -8
- package/components/DataSort/propTypes.js +9 -2
- package/components/DataSort/stories/Drop.js +41 -0
- package/components/DataSort/stories/Simple.js +9 -5
- package/components/DataSummary/DataSummary.js +4 -4
- package/components/DataSummary/index.d.ts +1 -1
- package/components/DataSummary/propTypes.js +2 -2
- package/components/DataSummary/stories/Simple.js +7 -4
- package/components/DataTable/Cell.js +1 -1
- package/components/DataTable/DataTable.js +23 -9
- package/components/DataTable/GroupedBody.js +1 -0
- package/components/DataTable/Resizer.js +1 -3
- package/components/DataTable/StyledDataTable.js +2 -2
- package/components/DataTable/index.d.ts +23 -6
- package/components/DataTable/stories/SpaceX.js +72 -76
- package/components/DataTable/stories/SpaceXUngrouped.js +33 -35
- package/components/DataTableColumns/DataTableColumns.js +226 -0
- package/components/DataTableColumns/README.md +2 -0
- package/components/DataTableColumns/index.d.ts +10 -0
- package/components/DataTableColumns/index.js +6 -0
- package/components/DataTableColumns/propTypes.js +18 -0
- package/components/DataTableColumns/stories/Simple.js +51 -0
- package/components/DataView/DataView.js +73 -0
- package/components/DataView/README.md +2 -0
- package/components/DataView/index.d.ts +15 -0
- package/components/DataView/index.js +6 -0
- package/components/DataView/propTypes.js +10 -0
- package/components/DataView/stories/Simple.js +51 -0
- package/components/DateInput/utils.js +1 -3
- package/components/Distribution/Distribution.js +1 -1
- package/components/Drop/DropContainer.js +56 -100
- package/components/Drop/stories/Overflow.js +1 -0
- package/components/DropButton/DropButton.js +1 -1
- package/components/Form/stories/Controlled.js +11 -2
- package/components/Form/stories/ControlledInput.js +13 -2
- package/components/Form/stories/ControlledInputLazy.js +13 -2
- package/components/Form/stories/ControlledLazy.js +13 -2
- package/components/Form/stories/FieldWithChildren.js +13 -2
- package/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/components/Form/stories/Uncontrolled.js +15 -2
- package/components/Form/stories/ValidateOnBlur.js +18 -0
- package/components/Form/stories/ValidateOnChange.js +6 -0
- package/components/Form/stories/ValidateOnMount.js +4 -0
- package/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/components/FormField/FormField.js +15 -4
- package/components/Layer/LayerContainer.js +2 -3
- package/components/Layer/PortalContext.js +1 -1
- package/components/Layer/StyledLayer.js +3 -1
- package/components/Layer/stories/Form.js +54 -28
- package/components/List/List.js +1 -8
- package/components/Pagination/Pagination.js +27 -8
- package/components/Paragraph/Paragraph.js +18 -6
- package/components/Select/utils.js +1 -1
- package/components/Skeleton/stories/GridContainer.js +1 -3
- package/components/Tabs/Tabs.js +2 -1
- package/components/Text/Text.js +9 -1
- package/components/Text/TextContext.js +8 -0
- package/components/TextInput/StyledTextInput.js +3 -1
- package/components/TextInput/TextInput.js +4 -2
- package/components/TextInput/index.d.ts +3 -1
- package/components/TextInput/propTypes.js +3 -1
- package/components/Toolbar/stories/Simple.js +1 -1
- package/components/Video/Video.js +4 -8
- package/components/WorldMap/WorldMap.js +18 -17
- package/components/index.d.ts +2 -0
- package/components/index.js +18 -6
- package/es6/components/Anchor/Anchor.js +9 -3
- package/es6/components/Anchor/StyledAnchor.js +6 -3
- package/es6/components/Button/Button.js +10 -14
- package/es6/components/Button/StyledButtonKind.js +21 -9
- package/es6/components/Calendar/Calendar.js +80 -71
- package/es6/components/Data/Data.js +48 -26
- package/es6/components/Data/DataForm.js +199 -51
- package/es6/components/Data/filter.js +17 -6
- package/es6/components/Data/index.d.ts +12 -7
- package/es6/components/Data/index.js +1 -1
- package/es6/components/Data/propTypes.js +3 -2
- package/es6/components/Data/stories/Cards.js +1 -1
- package/es6/components/Data/stories/Complex.js +78 -0
- package/es6/components/Data/stories/Controlled.js +1 -1
- package/es6/components/Data/stories/DataTable.js +12 -5
- package/es6/components/Data/stories/Infinite.js +53 -57
- package/es6/components/Data/stories/Inline.js +7 -2
- package/es6/components/Data/stories/List.js +1 -1
- package/es6/components/Data/stories/Simple.js +1 -1
- package/es6/components/Data/stories/SpaceX.js +114 -140
- package/es6/components/Data/stories/StarWars.js +121 -0
- package/es6/components/Data/stories/Views.js +50 -0
- package/es6/components/DataFilter/DataFilter.js +33 -42
- package/es6/components/DataFilter/stories/Simple.js +8 -5
- package/es6/components/DataFilters/DataFilters.js +118 -41
- package/es6/components/DataFilters/index.d.ts +1 -0
- package/es6/components/DataFilters/propTypes.js +2 -1
- package/es6/components/DataFilters/stories/Drop.js +8 -5
- package/es6/components/DataFilters/stories/Inline.js +25 -7
- package/es6/components/DataFilters/stories/Layer.js +40 -0
- package/es6/components/DataFilters/stories/Simple.js +8 -5
- package/es6/components/DataSearch/DataSearch.js +71 -14
- package/es6/components/DataSearch/index.d.ts +10 -1
- package/es6/components/DataSearch/propTypes.js +5 -1
- package/es6/components/DataSearch/stories/Drop.js +36 -0
- package/es6/components/DataSearch/stories/Responsive.js +36 -0
- package/es6/components/DataSearch/stories/Simple.js +6 -3
- package/es6/components/DataSort/DataSort.js +67 -18
- package/es6/components/DataSort/index.d.ts +4 -8
- package/es6/components/DataSort/propTypes.js +8 -2
- package/es6/components/DataSort/stories/Drop.js +35 -0
- package/es6/components/DataSort/stories/Simple.js +10 -6
- package/es6/components/DataSummary/DataSummary.js +4 -4
- package/es6/components/DataSummary/index.d.ts +1 -1
- package/es6/components/DataSummary/propTypes.js +2 -2
- package/es6/components/DataSummary/stories/Simple.js +8 -5
- package/es6/components/DataTable/Cell.js +2 -2
- package/es6/components/DataTable/DataTable.js +23 -9
- package/es6/components/DataTable/GroupedBody.js +1 -0
- package/es6/components/DataTable/Resizer.js +1 -3
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DataTable/index.d.ts +23 -6
- package/es6/components/DataTable/stories/SpaceX.js +72 -76
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +33 -35
- package/es6/components/DataTableColumns/DataTableColumns.js +219 -0
- package/es6/components/DataTableColumns/README.md +2 -0
- package/es6/components/DataTableColumns/index.d.ts +10 -0
- package/es6/components/DataTableColumns/index.js +1 -0
- package/es6/components/DataTableColumns/propTypes.js +12 -0
- package/es6/components/DataTableColumns/stories/Simple.js +46 -0
- package/es6/components/DataView/DataView.js +66 -0
- package/es6/components/DataView/README.md +2 -0
- package/es6/components/DataView/index.d.ts +15 -0
- package/es6/components/DataView/index.js +1 -0
- package/es6/components/DataView/propTypes.js +5 -0
- package/es6/components/DataView/stories/Simple.js +45 -0
- package/es6/components/DateInput/utils.js +1 -3
- package/es6/components/Distribution/Distribution.js +1 -1
- package/es6/components/Drop/DropContainer.js +58 -102
- package/es6/components/Drop/stories/Overflow.js +1 -0
- package/es6/components/DropButton/DropButton.js +1 -1
- package/es6/components/Form/stories/Controlled.js +11 -2
- package/es6/components/Form/stories/ControlledInput.js +13 -2
- package/es6/components/Form/stories/ControlledInputLazy.js +13 -2
- package/es6/components/Form/stories/ControlledLazy.js +13 -2
- package/es6/components/Form/stories/FieldWithChildren.js +13 -2
- package/es6/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/es6/components/Form/stories/Uncontrolled.js +15 -2
- package/es6/components/Form/stories/ValidateOnBlur.js +19 -1
- package/es6/components/Form/stories/ValidateOnChange.js +6 -0
- package/es6/components/Form/stories/ValidateOnMount.js +4 -0
- package/es6/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/es6/components/FormField/FormField.js +15 -4
- package/es6/components/Layer/LayerContainer.js +2 -3
- package/es6/components/Layer/PortalContext.js +1 -1
- package/es6/components/Layer/StyledLayer.js +3 -1
- package/es6/components/Layer/stories/Form.js +56 -29
- package/es6/components/List/List.js +1 -8
- package/es6/components/Pagination/Pagination.js +27 -8
- package/es6/components/Paragraph/Paragraph.js +19 -7
- package/es6/components/Select/utils.js +1 -1
- package/es6/components/Skeleton/stories/GridContainer.js +1 -3
- package/es6/components/Tabs/Tabs.js +2 -1
- package/es6/components/Text/Text.js +10 -2
- package/es6/components/Text/TextContext.js +2 -0
- package/es6/components/TextInput/StyledTextInput.js +4 -2
- package/es6/components/TextInput/TextInput.js +4 -2
- package/es6/components/TextInput/index.d.ts +3 -1
- package/es6/components/TextInput/propTypes.js +3 -1
- package/es6/components/Toolbar/stories/Simple.js +1 -1
- package/es6/components/Video/Video.js +4 -8
- package/es6/components/WorldMap/WorldMap.js +18 -17
- package/es6/components/index.d.ts +2 -0
- package/es6/components/index.js +3 -1
- package/es6/languages/default.json +14 -4
- package/es6/themes/base.d.ts +31 -0
- package/es6/themes/base.js +31 -1
- package/es6/utils/DOM.js +17 -0
- package/es6/utils/PortalContext.js +1 -1
- package/es6/utils/background.js +9 -1
- package/es6/utils/colors.js +2 -2
- package/es6/utils/general-prop-types.js +1 -1
- package/es6/utils/index.d.ts +7 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +14 -4
- package/package.json +42 -40
- package/themes/base.d.ts +31 -0
- package/themes/base.js +31 -1
- package/utils/DOM.js +20 -2
- package/utils/PortalContext.js +1 -1
- package/utils/background.js +8 -0
- package/utils/colors.js +3 -1
- package/utils/general-prop-types.js +1 -1
- package/utils/index.d.ts +7 -1
|
@@ -10,7 +10,8 @@ var _Box = require("../Box");
|
|
|
10
10
|
var _StyledAnchor = require("./StyledAnchor");
|
|
11
11
|
var _propTypes = require("./propTypes");
|
|
12
12
|
var _AnalyticsContext = require("../../contexts/AnalyticsContext");
|
|
13
|
-
var
|
|
13
|
+
var _TextContext = require("../Text/TextContext");
|
|
14
|
+
var _excluded = ["a11yTitle", "aria-label", "children", "color", "disabled", "gap", "href", "icon", "label", "onBlur", "onClick", "onFocus", "reverse", "size"];
|
|
14
15
|
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); }
|
|
15
16
|
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; }
|
|
16
17
|
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); }
|
|
@@ -29,11 +30,14 @@ var Anchor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
29
30
|
onClickProp = _ref.onClick,
|
|
30
31
|
_onFocus = _ref.onFocus,
|
|
31
32
|
reverse = _ref.reverse,
|
|
33
|
+
sizeProp = _ref.size,
|
|
32
34
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
33
35
|
var theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _defaultProps.defaultProps.theme;
|
|
34
36
|
var _useState = (0, _react.useState)(),
|
|
35
37
|
focus = _useState[0],
|
|
36
38
|
setFocus = _useState[1];
|
|
39
|
+
var _useContext = (0, _react.useContext)(_TextContext.TextContext),
|
|
40
|
+
size = _useContext.size;
|
|
37
41
|
var sendAnalytics = (0, _AnalyticsContext.useAnalytics)();
|
|
38
42
|
var onClick = (0, _react.useCallback)(function (event) {
|
|
39
43
|
sendAnalytics({
|
|
@@ -52,8 +56,9 @@ var Anchor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
52
56
|
}, [children, icon, label]);
|
|
53
57
|
var coloredIcon = icon;
|
|
54
58
|
if (icon && !icon.props.color) {
|
|
59
|
+
var _theme$anchor, _theme$anchor$size, _theme$anchor$size2;
|
|
55
60
|
coloredIcon = /*#__PURE__*/(0, _react.cloneElement)(icon, {
|
|
56
|
-
color: (0, _utils.normalizeColor)(color || theme.anchor.color, theme)
|
|
61
|
+
color: (0, _utils.normalizeColor)(color || ((_theme$anchor = theme.anchor) == null ? void 0 : (_theme$anchor$size = _theme$anchor.size) == null ? void 0 : (_theme$anchor$size2 = _theme$anchor$size[sizeProp || size]) == null ? void 0 : _theme$anchor$size2.color) || theme.anchor.color, theme)
|
|
57
62
|
});
|
|
58
63
|
}
|
|
59
64
|
var first = reverse ? label : coloredIcon;
|
|
@@ -76,7 +81,8 @@ var Anchor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
76
81
|
onBlur: function onBlur(event) {
|
|
77
82
|
setFocus(false);
|
|
78
83
|
if (_onBlur) _onBlur(event);
|
|
79
|
-
}
|
|
84
|
+
},
|
|
85
|
+
size: sizeProp || size
|
|
80
86
|
}), first && second ? /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
81
87
|
as: "span",
|
|
82
88
|
direction: "row",
|
|
@@ -28,11 +28,14 @@ var StyledAnchor = _styledComponents["default"].a.withConfig({
|
|
|
28
28
|
})(["box-sizing:border-box;", " color:", ";", " text-decoration:", ";cursor:pointer;", " ", " ", " ", " ", " ", ""], function (props) {
|
|
29
29
|
return sizeStyle(props);
|
|
30
30
|
}, function (props) {
|
|
31
|
-
|
|
31
|
+
var _props$theme$anchor, _props$theme$anchor$s, _props$theme$anchor$s2;
|
|
32
|
+
return (0, _utils.normalizeColor)(props.colorProp || ((_props$theme$anchor = props.theme.anchor) == null ? void 0 : (_props$theme$anchor$s = _props$theme$anchor.size) == null ? void 0 : (_props$theme$anchor$s2 = _props$theme$anchor$s[props.size]) == null ? void 0 : _props$theme$anchor$s2.color) || props.theme.anchor.color, props.theme);
|
|
32
33
|
}, function (props) {
|
|
33
|
-
|
|
34
|
+
var _props$theme$anchor2, _props$theme$anchor2$, _props$theme$anchor2$2, _props$theme$anchor3, _props$theme$anchor3$, _props$theme$anchor3$2;
|
|
35
|
+
return props.weight ? "font-weight: " + props.weight + ";" : (((_props$theme$anchor2 = props.theme.anchor) == null ? void 0 : (_props$theme$anchor2$ = _props$theme$anchor2.size) == null ? void 0 : (_props$theme$anchor2$2 = _props$theme$anchor2$[props.size]) == null ? void 0 : _props$theme$anchor2$2.fontWeight) || props.theme.anchor.fontWeight) && "font-weight: " + (((_props$theme$anchor3 = props.theme.anchor) == null ? void 0 : (_props$theme$anchor3$ = _props$theme$anchor3.size) == null ? void 0 : (_props$theme$anchor3$2 = _props$theme$anchor3$[props.size]) == null ? void 0 : _props$theme$anchor3$2.fontWeight) || props.theme.anchor.fontWeight) + ";";
|
|
34
36
|
}, function (props) {
|
|
35
|
-
|
|
37
|
+
var _props$theme$anchor4, _props$theme$anchor4$, _props$theme$anchor4$2;
|
|
38
|
+
return props.hasIcon ? 'none' : ((_props$theme$anchor4 = props.theme.anchor) == null ? void 0 : (_props$theme$anchor4$ = _props$theme$anchor4.size) == null ? void 0 : (_props$theme$anchor4$2 = _props$theme$anchor4$[props.size]) == null ? void 0 : _props$theme$anchor4$2.textDecoration) || props.theme.anchor.textDecoration;
|
|
36
39
|
}, _utils.genericStyles, function (props) {
|
|
37
40
|
return !props.disabled && props.theme.anchor.hover && (0, _styledComponents.css)(["&:hover{", " ", " ", "}"], props.theme.anchor.hover.textDecoration && "text-decoration: " + props.theme.anchor.hover.textDecoration + ";", props.theme.anchor.hover.fontWeight && "font-weight: " + props.theme.anchor.hover.fontWeight + ";", props.theme.anchor.hover.extend);
|
|
38
41
|
}, function (props) {
|
|
@@ -59,9 +59,7 @@ var getIconColor = function getIconColor(paths, theme, colorProp, kind) {
|
|
|
59
59
|
// for example: 'active.primary'
|
|
60
60
|
if (paths[index]) {
|
|
61
61
|
var parts = paths[index].split('.');
|
|
62
|
-
while (obj && parts.length)
|
|
63
|
-
obj = obj[parts.shift()];
|
|
64
|
-
}
|
|
62
|
+
while (obj && parts.length) obj = obj[parts.shift()];
|
|
65
63
|
}
|
|
66
64
|
if (obj) {
|
|
67
65
|
var _obj, _obj$icon, _obj$icon$props;
|
|
@@ -78,9 +76,7 @@ var getIconColor = function getIconColor(paths, theme, colorProp, kind) {
|
|
|
78
76
|
else if (paths[index + 1]) {
|
|
79
77
|
var _obj2, _obj2$icon, _obj2$icon$props;
|
|
80
78
|
var _parts = paths[index + 1].split('.');
|
|
81
|
-
while (baseObj && _parts.length)
|
|
82
|
-
obj = baseObj[_parts.shift()];
|
|
83
|
-
}
|
|
79
|
+
while (baseObj && _parts.length) obj = baseObj[_parts.shift()];
|
|
84
80
|
if ((_obj2 = obj) != null && (_obj2$icon = _obj2.icon) != null && (_obj2$icon$props = _obj2$icon.props) != null && _obj2$icon$props.color) color = obj.icon.props.color;
|
|
85
81
|
}
|
|
86
82
|
// use passed in color for text if the theme doesn't have
|
|
@@ -111,9 +107,7 @@ var getKindIcon = function getKindIcon(paths, theme, kind) {
|
|
|
111
107
|
// for example: 'active.primary'
|
|
112
108
|
if (paths[index]) {
|
|
113
109
|
var parts = paths[index].split('.');
|
|
114
|
-
while (obj && parts.length)
|
|
115
|
-
obj = obj[parts.shift()];
|
|
116
|
-
}
|
|
110
|
+
while (obj && parts.length) obj = obj[parts.shift()];
|
|
117
111
|
}
|
|
118
112
|
if ((_obj3 = obj) != null && _obj3.icon) result = obj.icon;
|
|
119
113
|
index -= 1;
|
|
@@ -130,9 +124,7 @@ var getPropertyColor = function getPropertyColor(property, paths, theme, kind, p
|
|
|
130
124
|
// index 0 is default state
|
|
131
125
|
if (paths[0]) {
|
|
132
126
|
var parts = paths[0].split('.');
|
|
133
|
-
while (obj && parts.length)
|
|
134
|
-
obj = obj[parts.shift()];
|
|
135
|
-
}
|
|
127
|
+
while (obj && parts.length) obj = obj[parts.shift()];
|
|
136
128
|
}
|
|
137
129
|
if (obj) {
|
|
138
130
|
result = obj[property] || obj[property] && obj[property].color;
|
|
@@ -173,7 +165,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
173
165
|
reverseProp = _ref.reverse,
|
|
174
166
|
secondary = _ref.secondary,
|
|
175
167
|
selected = _ref.selected,
|
|
176
|
-
|
|
168
|
+
sizeProp = _ref.size,
|
|
177
169
|
tip = _ref.tip,
|
|
178
170
|
_ref$type = _ref.type,
|
|
179
171
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
@@ -221,6 +213,9 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
221
213
|
return undefined; // pre-default, no kind
|
|
222
214
|
}, [kindArg, kindObj, primary, secondary, theme]);
|
|
223
215
|
|
|
216
|
+
// for backwards compatibility, no-kind button theme did not
|
|
217
|
+
// default to size "medium" on buttons with no size prop
|
|
218
|
+
var size = sizeProp || kind && 'medium' || undefined;
|
|
224
219
|
// When we have a kind and are not plain, themePaths stores the relative
|
|
225
220
|
// paths within the theme for the current kind and state of the button.
|
|
226
221
|
// These paths are used with getIconColor() above and kindStyle() within
|
|
@@ -310,8 +305,9 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
310
305
|
var second = reverse ? buttonIcon : label;
|
|
311
306
|
var contents;
|
|
312
307
|
if (first && second) {
|
|
308
|
+
var _theme$button, _theme$button$kind2;
|
|
313
309
|
contents = /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
314
|
-
direction:
|
|
310
|
+
direction: ((_theme$button = theme.button) == null ? void 0 : (_theme$button$kind2 = _theme$button[kind]) == null ? void 0 : _theme$button$kind2.direction) || 'row',
|
|
315
311
|
align: "center",
|
|
316
312
|
justify: justify || (align === 'center' ? 'center' : 'between'),
|
|
317
313
|
gap: gap || theme.button.gap,
|
|
@@ -21,12 +21,20 @@ var fontStyle = function fontStyle(props) {
|
|
|
21
21
|
var data = props.theme.text[size];
|
|
22
22
|
return (0, _styledComponents.css)(["font-size:", ";line-height:", ";"], data.size, data.height);
|
|
23
23
|
};
|
|
24
|
-
var padFromTheme = function padFromTheme(size, theme, themeObj, kind) {
|
|
25
|
-
var _themeObj$size, _themeObj$size$size, _themeObj$size$size$
|
|
24
|
+
var padFromTheme = function padFromTheme(size, theme, themeObj, kind, iconOnly) {
|
|
25
|
+
var _themeObj$size, _themeObj$size$size, _themeObj$size$size$i, _themeObj$size3, _themeObj$size3$size, _themeObj$size3$size$;
|
|
26
26
|
if (size === void 0) {
|
|
27
27
|
size = 'medium';
|
|
28
28
|
}
|
|
29
|
-
if (size && themeObj != null && (_themeObj$size = themeObj.size) != null && (_themeObj$size$size = _themeObj$size[size]) != null && (_themeObj$size$size$
|
|
29
|
+
if (size && iconOnly && themeObj != null && (_themeObj$size = themeObj.size) != null && (_themeObj$size$size = _themeObj$size[size]) != null && (_themeObj$size$size$i = _themeObj$size$size.iconOnly) != null && _themeObj$size$size$i.pad) {
|
|
30
|
+
var _themeObj$size2, _themeObj$size2$size, _themeObj$size2$size$;
|
|
31
|
+
var pad = themeObj == null ? void 0 : (_themeObj$size2 = themeObj.size) == null ? void 0 : (_themeObj$size2$size = _themeObj$size2[size]) == null ? void 0 : (_themeObj$size2$size$ = _themeObj$size2$size.iconOnly) == null ? void 0 : _themeObj$size2$size$.pad;
|
|
32
|
+
return {
|
|
33
|
+
vertical: typeof pad === 'string' ? pad : pad.vertical,
|
|
34
|
+
horizontal: typeof pad === 'string' ? pad : pad.horizontal
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (size && themeObj != null && (_themeObj$size3 = themeObj.size) != null && (_themeObj$size3$size = _themeObj$size3[size]) != null && (_themeObj$size3$size$ = _themeObj$size3$size[kind]) != null && _themeObj$size3$size$.pad) {
|
|
30
38
|
return themeObj.size[size][kind].pad;
|
|
31
39
|
}
|
|
32
40
|
if (size && themeObj.size && themeObj.size[size] && themeObj.size[size].pad) {
|
|
@@ -44,13 +52,16 @@ var padFromTheme = function padFromTheme(size, theme, themeObj, kind) {
|
|
|
44
52
|
return undefined;
|
|
45
53
|
};
|
|
46
54
|
var padStyle = function padStyle(_ref) {
|
|
47
|
-
var
|
|
55
|
+
var hasIcon = _ref.hasIcon,
|
|
56
|
+
hasLabel = _ref.hasLabel,
|
|
57
|
+
size = _ref.sizeProp,
|
|
48
58
|
theme = _ref.theme,
|
|
49
59
|
kind = _ref.kind;
|
|
50
60
|
// caller has specified a themeObj to use for styling
|
|
51
61
|
// relevant for cases like pagination which looks to theme.pagination.button
|
|
52
62
|
var themeObj = typeof kind === 'object' ? kind : theme.button;
|
|
53
|
-
var
|
|
63
|
+
var iconOnly = hasIcon && !hasLabel;
|
|
64
|
+
var pad = padFromTheme(size, theme, themeObj, kind, iconOnly);
|
|
54
65
|
return pad ? (0, _styledComponents.css)(["padding:", " ", ";"], pad.vertical, pad.horizontal) : '';
|
|
55
66
|
};
|
|
56
67
|
var basicStyle = function basicStyle(props) {
|
|
@@ -61,9 +72,7 @@ var getPath = function getPath(theme, path) {
|
|
|
61
72
|
if (path) {
|
|
62
73
|
obj = theme;
|
|
63
74
|
var parts = path.split('.');
|
|
64
|
-
while (obj && parts.length)
|
|
65
|
-
obj = obj[parts.shift()];
|
|
66
|
-
}
|
|
75
|
+
while (obj && parts.length) obj = obj[parts.shift()];
|
|
67
76
|
}
|
|
68
77
|
return obj;
|
|
69
78
|
};
|
|
@@ -75,6 +84,8 @@ var adjustPadStyle = function adjustPadStyle(pad, width) {
|
|
|
75
84
|
// build up CSS from basic to specific based on the supplied sub-object paths
|
|
76
85
|
var kindStyle = function kindStyle(_ref2) {
|
|
77
86
|
var colorValue = _ref2.colorValue,
|
|
87
|
+
hasIcon = _ref2.hasIcon,
|
|
88
|
+
hasLabel = _ref2.hasLabel,
|
|
78
89
|
kind = _ref2.kind,
|
|
79
90
|
size = _ref2.sizeProp,
|
|
80
91
|
themePaths = _ref2.themePaths,
|
|
@@ -84,7 +95,8 @@ var kindStyle = function kindStyle(_ref2) {
|
|
|
84
95
|
// caller has specified a themeObj to use for styling
|
|
85
96
|
// relevant for cases like pagination which looks to theme.pagination.button
|
|
86
97
|
var themeObj = typeof kind === 'object' ? kind : theme.button;
|
|
87
|
-
var
|
|
98
|
+
var iconOnly = hasIcon && !hasLabel;
|
|
99
|
+
var pad = padFromTheme(size, theme, themeObj, kind, iconOnly);
|
|
88
100
|
themePaths.base.forEach(function (themePath) {
|
|
89
101
|
var obj = getPath(themeObj, themePath);
|
|
90
102
|
if (obj) {
|
|
@@ -9,8 +9,10 @@ var _MessageContext = require("../../contexts/MessageContext");
|
|
|
9
9
|
var _defaultProps = require("../../default-props");
|
|
10
10
|
var _Box = require("../Box");
|
|
11
11
|
var _Button = require("../Button");
|
|
12
|
+
var _Header = require("../Header");
|
|
12
13
|
var _Heading = require("../Heading");
|
|
13
14
|
var _Keyboard = require("../Keyboard");
|
|
15
|
+
var _Text = require("../Text");
|
|
14
16
|
var _propTypes = require("./propTypes");
|
|
15
17
|
var _StyledCalendar = require("./StyledCalendar");
|
|
16
18
|
var _utils = require("./utils");
|
|
@@ -502,26 +504,32 @@ var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
502
504
|
setActive(selectedDate);
|
|
503
505
|
};
|
|
504
506
|
var renderCalendarHeader = function renderCalendarHeader() {
|
|
507
|
+
var _theme$calendar$size;
|
|
505
508
|
var PreviousIcon = size === 'small' ? theme.calendar.icons.small.previous : theme.calendar.icons.previous;
|
|
506
509
|
var NextIcon = size === 'small' ? theme.calendar.icons.small.next : theme.calendar.icons.next;
|
|
510
|
+
var monthAndYear = reference.toLocaleDateString(locale, {
|
|
511
|
+
month: 'long',
|
|
512
|
+
year: 'numeric'
|
|
513
|
+
});
|
|
507
514
|
return /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
508
515
|
direction: "row",
|
|
509
516
|
justify: "between",
|
|
510
517
|
align: "center"
|
|
511
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
518
|
+
}, /*#__PURE__*/_react["default"].createElement(_Header.Header, {
|
|
512
519
|
flex: true,
|
|
513
520
|
pad: {
|
|
514
521
|
horizontal: headingPadMap[size] || 'small'
|
|
515
522
|
}
|
|
516
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
523
|
+
}, (_theme$calendar$size = theme.calendar[size]) != null && _theme$calendar$size.title ? /*#__PURE__*/_react["default"].createElement(_Text.Text, theme.calendar[size].title, monthAndYear) :
|
|
524
|
+
/*#__PURE__*/
|
|
525
|
+
// theme.calendar.heading.level should be removed in v3 of grommet
|
|
526
|
+
// theme.calendar[size].title should be used instead
|
|
527
|
+
_react["default"].createElement(_Heading.Heading, {
|
|
517
528
|
level: size === 'small' ? theme.calendar.heading && theme.calendar.heading.level || 4 : (theme.calendar.heading && theme.calendar.heading.level || 4) - 1,
|
|
518
529
|
size: size,
|
|
519
530
|
margin: "none",
|
|
520
531
|
overflowWrap: "normal"
|
|
521
|
-
},
|
|
522
|
-
month: 'long',
|
|
523
|
-
year: 'numeric'
|
|
524
|
-
}))), /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
532
|
+
}, monthAndYear)), /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
525
533
|
flex: false,
|
|
526
534
|
direction: "row",
|
|
527
535
|
align: "center"
|
|
@@ -590,7 +598,7 @@ var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
590
598
|
var days;
|
|
591
599
|
var firstDayInMonth;
|
|
592
600
|
var blankWeek = false;
|
|
593
|
-
|
|
601
|
+
var _loop = function _loop() {
|
|
594
602
|
if (day.getDay() === firstDayOfWeek) {
|
|
595
603
|
if (days) {
|
|
596
604
|
weeks.push( /*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledWeek, {
|
|
@@ -634,73 +642,74 @@ var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
634
642
|
fillContainer: fill
|
|
635
643
|
})));
|
|
636
644
|
} else {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
return _onClick(dateObject);
|
|
661
|
-
},
|
|
662
|
-
onMouseOver: function onMouseOver() {
|
|
663
|
-
return setActive(dateObject);
|
|
664
|
-
},
|
|
665
|
-
onMouseOut: function onMouseOut() {
|
|
666
|
-
return setActive(undefined);
|
|
667
|
-
}
|
|
645
|
+
var dateObject = day;
|
|
646
|
+
// this.dayRefs[dateObject] = React.createRef();
|
|
647
|
+
var selected = false;
|
|
648
|
+
var inRange = false;
|
|
649
|
+
var selectedState = (0, _utils.withinDates)(day, range ? normalizeRange(value, activeDate) : value);
|
|
650
|
+
if (selectedState === 2) {
|
|
651
|
+
selected = true;
|
|
652
|
+
} else if (selectedState === 1) {
|
|
653
|
+
inRange = true;
|
|
654
|
+
}
|
|
655
|
+
var dayDisabled = (0, _utils.withinDates)(day, normalizeInput(disabled)) || bounds && !(0, _utils.betweenDates)(day, normalizeInput(bounds));
|
|
656
|
+
if (!firstDayInMonth && !dayDisabled && day.getMonth() === reference.getMonth()) {
|
|
657
|
+
firstDayInMonth = dateObject;
|
|
658
|
+
}
|
|
659
|
+
if (!children) {
|
|
660
|
+
days.push( /*#__PURE__*/_react["default"].createElement(CalendarDay, {
|
|
661
|
+
key: day.getTime(),
|
|
662
|
+
buttonProps: {
|
|
663
|
+
a11yTitle: day.toDateString(),
|
|
664
|
+
active: active && active.getTime() === day.getTime(),
|
|
665
|
+
disabled: dayDisabled && !!dayDisabled,
|
|
666
|
+
onClick: function onClick() {
|
|
667
|
+
return _onClick(dateObject);
|
|
668
668
|
},
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
669
|
+
onMouseOver: function onMouseOver() {
|
|
670
|
+
return setActive(dateObject);
|
|
671
|
+
},
|
|
672
|
+
onMouseOut: function onMouseOut() {
|
|
673
|
+
return setActive(undefined);
|
|
674
|
+
}
|
|
675
|
+
},
|
|
676
|
+
isInRange: inRange,
|
|
677
|
+
isSelected: selected,
|
|
678
|
+
otherMonth: day.getMonth() !== reference.getMonth(),
|
|
679
|
+
size: size,
|
|
680
|
+
fill: fill
|
|
681
|
+
}, day.getDate()));
|
|
682
|
+
} else {
|
|
683
|
+
days.push( /*#__PURE__*/_react["default"].createElement(CalendarCustomDay, {
|
|
684
|
+
key: day.getTime(),
|
|
685
|
+
buttonProps: onSelect ? {
|
|
686
|
+
a11yTitle: day.toDateString(),
|
|
687
|
+
active: active && active.getTime() === day.getTime(),
|
|
688
|
+
disabled: dayDisabled && !!dayDisabled,
|
|
689
|
+
onClick: function onClick() {
|
|
690
|
+
return _onClick(dateObject);
|
|
691
|
+
},
|
|
692
|
+
onMouseOver: function onMouseOver() {
|
|
693
|
+
return setActive(dateObject);
|
|
694
|
+
},
|
|
695
|
+
onMouseOut: function onMouseOut() {
|
|
696
|
+
return setActive(undefined);
|
|
697
|
+
}
|
|
698
|
+
} : null,
|
|
699
|
+
size: size,
|
|
700
|
+
fill: fill
|
|
701
|
+
}, children({
|
|
702
|
+
date: day,
|
|
703
|
+
day: day.getDate(),
|
|
704
|
+
isInRange: inRange,
|
|
705
|
+
isSelected: selected
|
|
706
|
+
})));
|
|
707
|
+
}
|
|
702
708
|
}
|
|
703
709
|
day = (0, _utils.addDays)(day, 1);
|
|
710
|
+
};
|
|
711
|
+
while (day.getTime() < displayBounds[1].getTime()) {
|
|
712
|
+
_loop();
|
|
704
713
|
}
|
|
705
714
|
weeks.push( /*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledWeek
|
|
706
715
|
// if a week contains only blank days, for screen reader accessibility
|
package/components/Data/Data.js
CHANGED
|
@@ -7,22 +7,30 @@ var _Box = require("../Box");
|
|
|
7
7
|
var _DataFilters = require("../DataFilters");
|
|
8
8
|
var _DataSearch = require("../DataSearch");
|
|
9
9
|
var _DataSummary = require("../DataSummary");
|
|
10
|
+
var _DataView = require("../DataView");
|
|
10
11
|
var _Toolbar = require("../Toolbar");
|
|
11
12
|
var _DataContext = require("../../contexts/DataContext");
|
|
12
13
|
var _propTypes = require("./propTypes");
|
|
13
14
|
var _filter = require("./filter");
|
|
14
|
-
var _excluded = ["children", "data", "id", "messages", "onView", "properties", "toolbar", "total", "updateOn", "view"];
|
|
15
|
+
var _excluded = ["children", "data", "defaultView", "filteredTotal", "id", "messages", "onView", "properties", "toolbar", "total", "updateOn", "view", "views"];
|
|
15
16
|
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); }
|
|
16
17
|
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; }
|
|
17
18
|
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); }
|
|
18
19
|
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; }
|
|
19
|
-
var
|
|
20
|
-
search: ''
|
|
21
|
-
|
|
20
|
+
var defaultDefaultView = {
|
|
21
|
+
search: ''
|
|
22
|
+
};
|
|
23
|
+
var normalizeView = function normalizeView(viewProp, views) {
|
|
24
|
+
return typeof viewProp === 'string' && (views == null ? void 0 : views.find(function (v) {
|
|
25
|
+
return v.name === viewProp;
|
|
26
|
+
})) || typeof viewProp === 'object' && viewProp;
|
|
22
27
|
};
|
|
23
28
|
var Data = function Data(_ref) {
|
|
24
29
|
var children = _ref.children,
|
|
25
30
|
dataProp = _ref.data,
|
|
31
|
+
_ref$defaultView = _ref.defaultView,
|
|
32
|
+
defaultView = _ref$defaultView === void 0 ? defaultDefaultView : _ref$defaultView,
|
|
33
|
+
filteredTotal = _ref.filteredTotal,
|
|
26
34
|
_ref$id = _ref.id,
|
|
27
35
|
id = _ref$id === void 0 ? 'data' : _ref$id,
|
|
28
36
|
messages = _ref.messages,
|
|
@@ -33,48 +41,62 @@ var Data = function Data(_ref) {
|
|
|
33
41
|
_ref$updateOn = _ref.updateOn,
|
|
34
42
|
updateOn = _ref$updateOn === void 0 ? 'submit' : _ref$updateOn,
|
|
35
43
|
viewProp = _ref.view,
|
|
44
|
+
views = _ref.views,
|
|
36
45
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
37
|
-
var _useState = (0, _react.useState)(viewProp),
|
|
46
|
+
var _useState = (0, _react.useState)(normalizeView(viewProp || defaultView, views)),
|
|
38
47
|
view = _useState[0],
|
|
39
48
|
setView = _useState[1];
|
|
40
49
|
(0, _react.useEffect)(function () {
|
|
41
|
-
return setView(viewProp);
|
|
42
|
-
}, [viewProp]);
|
|
43
|
-
var
|
|
44
|
-
|
|
50
|
+
return setView(normalizeView(viewProp || defaultView, views));
|
|
51
|
+
}, [defaultView, viewProp, views]);
|
|
52
|
+
var _useState2 = (0, _react.useState)([]),
|
|
53
|
+
toolbarKeys = _useState2[0],
|
|
54
|
+
setToolbarKeys = _useState2[1];
|
|
55
|
+
var result = (0, _react.useMemo)(function () {
|
|
56
|
+
var _ref2;
|
|
57
|
+
if (onView)
|
|
58
|
+
// caller is filtering
|
|
59
|
+
return {
|
|
60
|
+
data: dataProp,
|
|
61
|
+
total: total,
|
|
62
|
+
filteredTotal: (_ref2 = filteredTotal != null ? filteredTotal : dataProp == null ? void 0 : dataProp.length) != null ? _ref2 : 0
|
|
63
|
+
};
|
|
45
64
|
return (0, _filter.filter)(dataProp, view, properties);
|
|
46
|
-
}, [dataProp, onView, properties, view]);
|
|
65
|
+
}, [dataProp, filteredTotal, onView, properties, total, view]);
|
|
47
66
|
|
|
48
67
|
// what we use for DataContext value
|
|
49
68
|
var contextValue = (0, _react.useMemo)(function () {
|
|
50
|
-
var
|
|
69
|
+
var value = _extends({
|
|
51
70
|
id: id,
|
|
52
71
|
messages: messages,
|
|
53
72
|
properties: properties,
|
|
54
73
|
updateOn: updateOn,
|
|
55
|
-
view: view
|
|
74
|
+
view: view,
|
|
75
|
+
views: views
|
|
76
|
+
}, result);
|
|
77
|
+
value.clearFilters = function () {
|
|
78
|
+
var nextView = defaultView;
|
|
79
|
+
setView(nextView);
|
|
80
|
+
if (onView) onView(nextView);
|
|
56
81
|
};
|
|
57
|
-
|
|
58
|
-
result.clearFilters = function () {
|
|
59
|
-
var nextView = defaultView;
|
|
60
|
-
setView(nextView);
|
|
61
|
-
if (onView) onView(nextView);
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
result.onView = function (nextView) {
|
|
82
|
+
value.onView = function (nextView) {
|
|
65
83
|
setView(nextView);
|
|
66
84
|
if (onView) onView(nextView);
|
|
67
85
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
86
|
+
value.addToolbarKey = function (key) {
|
|
87
|
+
setToolbarKeys(function (prevKeys) {
|
|
88
|
+
if (prevKeys.includes(key)) return prevKeys;
|
|
89
|
+
return [].concat(prevKeys, [key]);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
value.toolbarKeys = toolbarKeys;
|
|
93
|
+
return value;
|
|
94
|
+
}, [defaultView, id, messages, onView, properties, result, toolbarKeys, updateOn, view, views]);
|
|
73
95
|
var toolbarContent;
|
|
74
96
|
if (toolbar) {
|
|
75
97
|
toolbarContent = [/*#__PURE__*/_react["default"].createElement(_Toolbar.Toolbar, {
|
|
76
98
|
key: "toolbar"
|
|
77
|
-
}, (toolbar === true || toolbar === 'search') && /*#__PURE__*/_react["default"].createElement(_DataSearch.DataSearch, null), (toolbar === true || toolbar === 'filters') && /*#__PURE__*/_react["default"].createElement(_DataFilters.DataFilters, {
|
|
99
|
+
}, (toolbar === true || toolbar === 'search') && /*#__PURE__*/_react["default"].createElement(_DataSearch.DataSearch, null), (toolbar === true || toolbar === 'view') && /*#__PURE__*/_react["default"].createElement(_DataView.DataView, null), (toolbar === true || toolbar === 'filters') && /*#__PURE__*/_react["default"].createElement(_DataFilters.DataFilters, {
|
|
78
100
|
drop: true
|
|
79
101
|
})), /*#__PURE__*/_react["default"].createElement(_DataSummary.DataSummary, {
|
|
80
102
|
key: "summary"
|