@elastic/eui 113.3.0 → 114.0.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/es/components/button/split_button/split_button.js +13 -0
- package/es/components/button/split_button/split_button_actions.js +15 -0
- package/es/components/collapsible_nav/collapsible_nav.js +5 -0
- package/es/components/color_picker/color_picker.js +31 -8
- package/es/components/datagrid/utils/scrolling.js +39 -10
- package/es/components/flyout/_flyout_overlay.js +34 -4
- package/es/components/flyout/flyout.component.js +13 -9
- package/es/components/flyout/flyout.js +9 -1
- package/es/components/flyout/flyout.styles.js +2 -2
- package/es/components/flyout/flyout_menu.js +2 -1
- package/es/components/flyout/flyout_resizable.js +5 -0
- package/es/components/flyout/manager/actions.js +5 -2
- package/es/components/flyout/manager/flyout_child.js +1 -0
- package/es/components/flyout/manager/flyout_managed.js +5 -3
- package/es/components/flyout/manager/reducer.js +116 -57
- package/es/components/flyout/manager/store.js +13 -6
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/es/components/overlay_mask/overlay_mask.js +10 -3
- package/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/es/services/hooks/index.js +8 -8
- package/es/services/hooks/useIsPointerDown.js +6 -15
- package/es/services/index.js +1 -1
- package/eui.d.ts +83 -51
- package/i18ntokens.json +661 -643
- package/lib/components/button/split_button/split_button.js +13 -0
- package/lib/components/button/split_button/split_button_actions.js +15 -0
- package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
- package/lib/components/color_picker/color_picker.js +30 -7
- package/lib/components/datagrid/utils/scrolling.js +37 -8
- package/lib/components/flyout/_flyout_overlay.js +33 -3
- package/lib/components/flyout/flyout.component.js +13 -9
- package/lib/components/flyout/flyout.js +9 -1
- package/lib/components/flyout/flyout.styles.js +2 -2
- package/lib/components/flyout/flyout_menu.js +2 -1
- package/lib/components/flyout/flyout_resizable.js +5 -0
- package/lib/components/flyout/manager/actions.js +5 -2
- package/lib/components/flyout/manager/flyout_child.js +1 -0
- package/lib/components/flyout/manager/flyout_managed.js +5 -3
- package/lib/components/flyout/manager/reducer.js +116 -57
- package/lib/components/flyout/manager/store.js +13 -6
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/lib/components/overlay_mask/overlay_mask.js +10 -3
- package/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/lib/services/hooks/index.js +60 -91
- package/lib/services/hooks/useIsPointerDown.js +7 -14
- package/lib/services/index.js +70 -11
- package/optimize/es/components/color_picker/color_picker.js +31 -8
- package/optimize/es/components/datagrid/utils/scrolling.js +39 -10
- package/optimize/es/components/flyout/_flyout_overlay.js +34 -4
- package/optimize/es/components/flyout/flyout.component.js +13 -9
- package/optimize/es/components/flyout/flyout.js +4 -1
- package/optimize/es/components/flyout/flyout.styles.js +2 -2
- package/optimize/es/components/flyout/flyout_menu.js +2 -1
- package/optimize/es/components/flyout/manager/actions.js +5 -2
- package/optimize/es/components/flyout/manager/flyout_managed.js +4 -3
- package/optimize/es/components/flyout/manager/reducer.js +116 -57
- package/optimize/es/components/flyout/manager/store.js +13 -6
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/optimize/es/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/es/services/hooks/index.js +8 -8
- package/optimize/es/services/hooks/useIsPointerDown.js +6 -10
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/color_picker/color_picker.js +30 -7
- package/optimize/lib/components/datagrid/utils/scrolling.js +37 -8
- package/optimize/lib/components/flyout/_flyout_overlay.js +33 -3
- package/optimize/lib/components/flyout/flyout.component.js +13 -9
- package/optimize/lib/components/flyout/flyout.js +4 -1
- package/optimize/lib/components/flyout/flyout.styles.js +2 -2
- package/optimize/lib/components/flyout/flyout_menu.js +2 -1
- package/optimize/lib/components/flyout/manager/actions.js +5 -2
- package/optimize/lib/components/flyout/manager/flyout_managed.js +4 -3
- package/optimize/lib/components/flyout/manager/reducer.js +116 -57
- package/optimize/lib/components/flyout/manager/store.js +13 -6
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/lib/services/hooks/index.js +60 -91
- package/optimize/lib/services/hooks/useIsPointerDown.js +5 -10
- package/optimize/lib/services/index.js +70 -11
- package/package.json +4 -4
- package/test-env/components/button/split_button/split_button.js +13 -0
- package/test-env/components/button/split_button/split_button_actions.js +15 -0
- package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
- package/test-env/components/color_picker/color_picker.js +30 -7
- package/test-env/components/datagrid/utils/scrolling.js +37 -8
- package/test-env/components/flyout/_flyout_overlay.js +33 -3
- package/test-env/components/flyout/flyout.component.js +13 -9
- package/test-env/components/flyout/flyout.styles.js +2 -2
- package/test-env/components/flyout/flyout_menu.js +2 -1
- package/test-env/components/flyout/flyout_resizable.js +5 -0
- package/test-env/components/flyout/manager/actions.js +5 -2
- package/test-env/components/flyout/manager/flyout_child.js +1 -0
- package/test-env/components/flyout/manager/flyout_managed.js +5 -3
- package/test-env/components/flyout/manager/reducer.js +116 -57
- package/test-env/components/flyout/manager/store.js +13 -6
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/test-env/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/test-env/components/overlay_mask/overlay_mask.js +10 -3
- package/test-env/components/tree_view/tree_view_item.styles.js +1 -1
- package/test-env/services/hooks/index.js +60 -91
- package/test-env/services/hooks/useIsPointerDown.js +5 -10
- package/test-env/services/index.js +70 -11
|
@@ -33,7 +33,7 @@ var _use_flyout_z_index = require("./use_flyout_z_index");
|
|
|
33
33
|
var _flyout_parent_context = require("./flyout_parent_context");
|
|
34
34
|
var _use_flyout_menu = require("./use_flyout_menu");
|
|
35
35
|
var _react2 = require("@emotion/react");
|
|
36
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "flyoutMenuProps", "flyoutMenuDisplayMode", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "hasChildBackground", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby", "aria-labelledby", "id", "resizable", "minWidth", "onResize", "onAnimationEnd", "container"];
|
|
36
|
+
var _excluded = ["className", "children", "as", "hideCloseButton", "flyoutMenuProps", "flyoutMenuDisplayMode", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "hasChildBackground", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "hasAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby", "aria-labelledby", "id", "resizable", "minWidth", "onResize", "onAnimationEnd", "container"];
|
|
37
37
|
/*
|
|
38
38
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
39
39
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -96,23 +96,25 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
96
96
|
outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
|
|
97
97
|
_usePropsWithComponen12 = _usePropsWithComponen.pushMinBreakpoint,
|
|
98
98
|
pushMinBreakpoint = _usePropsWithComponen12 === void 0 ? _const2.DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen12,
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
_pushAnimation = _usePropsWithComponen.pushAnimation,
|
|
100
|
+
_hasAnimation = _usePropsWithComponen.hasAnimation,
|
|
101
101
|
_focusTrapProps = _usePropsWithComponen.focusTrapProps,
|
|
102
|
-
|
|
103
|
-
includeFixedHeadersInFocusTrap =
|
|
102
|
+
_usePropsWithComponen13 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
|
|
103
|
+
includeFixedHeadersInFocusTrap = _usePropsWithComponen13 === void 0 ? true : _usePropsWithComponen13,
|
|
104
104
|
includeSelectorInFocusTrap = _usePropsWithComponen.includeSelectorInFocusTrap,
|
|
105
105
|
_ariaDescribedBy = _usePropsWithComponen['aria-describedby'],
|
|
106
106
|
_ariaLabelledBy = _usePropsWithComponen['aria-labelledby'],
|
|
107
107
|
id = _usePropsWithComponen.id,
|
|
108
|
-
|
|
109
|
-
resizable =
|
|
108
|
+
_usePropsWithComponen14 = _usePropsWithComponen.resizable,
|
|
109
|
+
resizable = _usePropsWithComponen14 === void 0 ? false : _usePropsWithComponen14,
|
|
110
110
|
minWidth = _usePropsWithComponen.minWidth,
|
|
111
111
|
onResize = _usePropsWithComponen.onResize,
|
|
112
112
|
onAnimationEnd = _usePropsWithComponen.onAnimationEnd,
|
|
113
113
|
containerProp = _usePropsWithComponen.container,
|
|
114
114
|
rest = (0, _objectWithoutProperties2.default)(_usePropsWithComponen, _excluded);
|
|
115
115
|
var container = resolveContainer(containerProp);
|
|
116
|
+
var hasAnimationDefault = type === 'overlay';
|
|
117
|
+
var hasAnimation = _hasAnimation !== null && _hasAnimation !== void 0 ? _hasAnimation : hasAnimationDefault;
|
|
116
118
|
var _useEuiThemeCSSVariab = (0, _services.useEuiThemeCSSVariables)(),
|
|
117
119
|
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
118
120
|
var Element = as || defaultElement;
|
|
@@ -533,7 +535,7 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
533
535
|
return _objectSpread(_objectSpread(_objectSpread({}, style), composedStyles), containerPositionStyles);
|
|
534
536
|
}, [style, size, layoutMode, siblingFlyoutId, siblingFlyoutWidth, maxWidth, flyoutZIndex, containerRect, side, isChildFlyout]);
|
|
535
537
|
var styles = (0, _services.useEuiMemoizedStyles)(_flyout.euiFlyoutStyles);
|
|
536
|
-
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], (0, _const2.isEuiFlyoutSizeNamed)(size) && styles[size], maxWidth === false && styles.noMaxWidth, isPushed ? styles.push.push : styles.overlay.overlay, isPushed ? styles.push[side] : styles.overlay[side],
|
|
538
|
+
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], (0, _const2.isEuiFlyoutSizeNamed)(size) && styles[size], maxWidth === false && styles.noMaxWidth, isPushed ? styles.push.push : styles.overlay.overlay, isPushed ? styles.push[side] : styles.overlay[side], !hasAnimation && styles.noAnimation, styles[side]];
|
|
537
539
|
var classes = (0, _classnames.default)('euiFlyout', isChildFlyout && hasChildBackground && 'euiFlyout--hasChildBackground', className);
|
|
538
540
|
var flyoutToggle = (0, _react.useRef)(document.activeElement);
|
|
539
541
|
var _useState5 = (0, _react.useState)([]),
|
|
@@ -669,8 +671,10 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
669
671
|
isPushed: isPushed,
|
|
670
672
|
maskZIndex: maskZIndex,
|
|
671
673
|
headerZindexLocation: effectiveHeaderZindexLocation,
|
|
674
|
+
containerRect: containerRect,
|
|
672
675
|
maskProps: _objectSpread(_objectSpread({}, maskProps), {}, {
|
|
673
|
-
maskRef: maskCombinedRefs
|
|
676
|
+
maskRef: maskCombinedRefs,
|
|
677
|
+
hasAnimation: hasAnimation
|
|
674
678
|
})
|
|
675
679
|
}, (0, _react2.jsx)(_services.EuiWindowEvent, {
|
|
676
680
|
event: "keydown",
|
|
@@ -74,9 +74,9 @@ var euiFlyoutStyles = exports.euiFlyoutStyles = function euiFlyoutStyles(euiThem
|
|
|
74
74
|
push: {
|
|
75
75
|
push: /*#__PURE__*/(0, _react.css)("clip-path:none;z-index:", Number(euiTheme.levels.flyout) - 1, ";;label:push;"),
|
|
76
76
|
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-left', euiTheme.border.thick), ";;label:right;"),
|
|
77
|
-
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-right', euiTheme.border.thick), ";;label:left;")
|
|
78
|
-
noAnimation: _ref
|
|
77
|
+
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-right', euiTheme.border.thick), ";;label:left;")
|
|
79
78
|
},
|
|
79
|
+
noAnimation: _ref,
|
|
80
80
|
// Padding
|
|
81
81
|
paddingSizes: {
|
|
82
82
|
none: /*#__PURE__*/(0, _react.css)(composeFlyoutPadding(euiThemeContext, 'none'), ";;label:none;"),
|
|
@@ -23,7 +23,7 @@ var _flyout_menu = require("./flyout_menu.styles");
|
|
|
23
23
|
var _flyout_menu_context = require("./flyout_menu_context");
|
|
24
24
|
var _i18n = require("../i18n");
|
|
25
25
|
var _react2 = require("@emotion/react");
|
|
26
|
-
var _excluded = ["className", "title", "titleId", "hideTitle", "hideCloseButton", "historyItems", "showBackButton", "backButtonProps", "customActions"];
|
|
26
|
+
var _excluded = ["className", "title", "titleId", "hideTitle", "hideCloseButton", "historyItems", "showBackButton", "backButtonProps", "customActions", "iconType"];
|
|
27
27
|
/*
|
|
28
28
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
29
29
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -114,6 +114,7 @@ var EuiFlyoutMenu = exports.EuiFlyoutMenu = function EuiFlyoutMenu(_ref2) {
|
|
|
114
114
|
showBackButton = _ref2.showBackButton,
|
|
115
115
|
backButtonProps = _ref2.backButtonProps,
|
|
116
116
|
customActions = _ref2.customActions,
|
|
117
|
+
_iconType = _ref2.iconType,
|
|
117
118
|
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
118
119
|
var _useContext = (0, _react.useContext)(_flyout_menu_context.EuiFlyoutMenuContext),
|
|
119
120
|
onClose = _useContext.onClose;
|
|
@@ -46,6 +46,11 @@ EuiFlyoutResizable.propTypes = {
|
|
|
46
46
|
* @default undefined (auto-inherit when nested, otherwise 'never')
|
|
47
47
|
*/
|
|
48
48
|
session: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
|
|
49
|
+
/**
|
|
50
|
+
* Optional Symbol to scope flyout history. Only flyouts that receive the same Symbol reference share Back button and history; omit to get a unique group per session.
|
|
51
|
+
* @default undefined (each session gets a unique key and does not share history)
|
|
52
|
+
*/
|
|
53
|
+
historyKey: _propTypes.default.any,
|
|
49
54
|
/**
|
|
50
55
|
* Callback fired when the flyout becomes active/visible, which may happen programmatically from history navigation.
|
|
51
56
|
*/
|
|
@@ -75,19 +75,22 @@ var ACTION_CLOSE_UNMANAGED_FLYOUT = exports.ACTION_CLOSE_UNMANAGED_FLYOUT = "".c
|
|
|
75
75
|
* - `title` is used for the flyout menu.
|
|
76
76
|
* - `level` determines whether the flyout is `main` or `child`.
|
|
77
77
|
* - Optional `size` is the named EUI size (e.g. `s`, `m`, `l`).
|
|
78
|
+
* - Optional `historyKey` (Symbol) scopes history; only flyouts with the same reference share Back/history. Omit for a unique group per session.
|
|
78
79
|
* - Optional `iconType` is shown next to the session title in the history menu.
|
|
79
80
|
*/
|
|
80
81
|
var addFlyout = exports.addFlyout = function addFlyout(flyoutId, title) {
|
|
81
82
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _const.LEVEL_MAIN;
|
|
82
83
|
var size = arguments.length > 3 ? arguments[3] : undefined;
|
|
83
|
-
var
|
|
84
|
-
var
|
|
84
|
+
var historyKey = arguments.length > 4 ? arguments[4] : undefined;
|
|
85
|
+
var iconType = arguments.length > 5 ? arguments[5] : undefined;
|
|
86
|
+
var minWidth = arguments.length > 6 ? arguments[6] : undefined;
|
|
85
87
|
return {
|
|
86
88
|
type: ACTION_ADD,
|
|
87
89
|
flyoutId: flyoutId,
|
|
88
90
|
title: title,
|
|
89
91
|
level: level,
|
|
90
92
|
size: size,
|
|
93
|
+
historyKey: historyKey,
|
|
91
94
|
iconType: iconType,
|
|
92
95
|
minWidth: minWidth
|
|
93
96
|
};
|
|
@@ -93,6 +93,7 @@ var EuiFlyoutChild = exports.EuiFlyoutChild = /*#__PURE__*/(0, _react.forwardRef
|
|
|
93
93
|
}));
|
|
94
94
|
});
|
|
95
95
|
EuiFlyoutChild.propTypes = {
|
|
96
|
+
historyKey: _propTypes.default.any,
|
|
96
97
|
flyoutMenuProps: _propTypes.default.shape({
|
|
97
98
|
className: _propTypes.default.string,
|
|
98
99
|
"aria-label": _propTypes.default.string,
|
|
@@ -27,7 +27,7 @@ var _selectors = require("./selectors");
|
|
|
27
27
|
var _store = require("./store");
|
|
28
28
|
var _validation = require("./validation");
|
|
29
29
|
var _react2 = require("@emotion/react");
|
|
30
|
-
var _excluded = ["id", "onClose", "onActive", "level", "size", "minWidth", "css", "flyoutMenuProps"];
|
|
30
|
+
var _excluded = ["id", "onClose", "onActive", "level", "size", "minWidth", "historyKey", "css", "flyoutMenuProps"];
|
|
31
31
|
/*
|
|
32
32
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
33
33
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -67,6 +67,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
67
67
|
level = _ref.level,
|
|
68
68
|
sizeProp = _ref.size,
|
|
69
69
|
minWidth = _ref.minWidth,
|
|
70
|
+
historyKey = _ref.historyKey,
|
|
70
71
|
customCss = _ref.css,
|
|
71
72
|
_flyoutMenuProps = _ref.flyoutMenuProps,
|
|
72
73
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -165,7 +166,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
165
166
|
// Register with flyout manager context when open, remove when closed
|
|
166
167
|
// Using useLayoutEffect to run synchronously before DOM updates
|
|
167
168
|
(0, _react.useLayoutEffect)(function () {
|
|
168
|
-
addFlyout(flyoutId, title, level, size, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
|
|
169
|
+
addFlyout(flyoutId, title, level, size, level === _const.LEVEL_MAIN ? historyKey : undefined, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
|
|
169
170
|
return function () {
|
|
170
171
|
var currentStoreState = (0, _store.getFlyoutManagerStore)().getState();
|
|
171
172
|
var stillInStore = currentStoreState.flyouts.some(function (f) {
|
|
@@ -181,7 +182,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
181
182
|
}
|
|
182
183
|
wasRegisteredRef.current = false;
|
|
183
184
|
};
|
|
184
|
-
}, [flyoutId, title, level, size, minWidth, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
|
|
185
|
+
}, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
|
|
185
186
|
|
|
186
187
|
// Detect when flyout has been removed from manager state (e.g., via Back button)
|
|
187
188
|
// and trigger onClose callback to notify the parent component
|
|
@@ -283,6 +284,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
283
284
|
});
|
|
284
285
|
EuiManagedFlyout.propTypes = {
|
|
285
286
|
level: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired]).isRequired,
|
|
287
|
+
historyKey: _propTypes.default.any,
|
|
286
288
|
flyoutMenuProps: _propTypes.default.any,
|
|
287
289
|
onActive: _propTypes.default.func
|
|
288
290
|
};
|
|
@@ -32,6 +32,28 @@ var initialState = exports.initialState = {
|
|
|
32
32
|
currentZIndex: 0,
|
|
33
33
|
unmanagedFlyouts: []
|
|
34
34
|
};
|
|
35
|
+
var addSessionFlyoutsToRemove = function addSessionFlyoutsToRemove(session, flyoutsToRemove) {
|
|
36
|
+
var _session$childHistory;
|
|
37
|
+
flyoutsToRemove.add(session.mainFlyoutId);
|
|
38
|
+
if (session.childFlyoutId) {
|
|
39
|
+
flyoutsToRemove.add(session.childFlyoutId);
|
|
40
|
+
}
|
|
41
|
+
((_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : []).forEach(function (e) {
|
|
42
|
+
return flyoutsToRemove.add(e.flyoutId);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var moveHistoryGroupToTop = function moveHistoryGroupToTop(sessions, historyKey) {
|
|
46
|
+
var groupSessions = [];
|
|
47
|
+
var otherSessions = [];
|
|
48
|
+
sessions.forEach(function (session) {
|
|
49
|
+
if (session.historyKey === historyKey) {
|
|
50
|
+
groupSessions.push(session);
|
|
51
|
+
} else {
|
|
52
|
+
otherSessions.push(session);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return [].concat(otherSessions, groupSessions);
|
|
56
|
+
};
|
|
35
57
|
|
|
36
58
|
/**
|
|
37
59
|
* Reducer handling all flyout manager actions and state transitions.
|
|
@@ -80,6 +102,7 @@ function flyoutManagerReducer() {
|
|
|
80
102
|
title = action.title,
|
|
81
103
|
level = action.level,
|
|
82
104
|
size = action.size,
|
|
105
|
+
historyKey = action.historyKey,
|
|
83
106
|
iconType = action.iconType,
|
|
84
107
|
minWidth = action.minWidth;
|
|
85
108
|
var isDuplicate = state.flyouts.some(function (f) {
|
|
@@ -106,7 +129,8 @@ function flyoutManagerReducer() {
|
|
|
106
129
|
iconType: iconType,
|
|
107
130
|
childFlyoutId: null,
|
|
108
131
|
childHistory: [],
|
|
109
|
-
zIndex: state.currentZIndex
|
|
132
|
+
zIndex: state.currentZIndex,
|
|
133
|
+
historyKey: historyKey !== null && historyKey !== void 0 ? historyKey : Symbol()
|
|
110
134
|
};
|
|
111
135
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
112
136
|
sessions: [].concat((0, _toConsumableArray2.default)(state.sessions), [newSession]),
|
|
@@ -233,8 +257,8 @@ function flyoutManagerReducer() {
|
|
|
233
257
|
});
|
|
234
258
|
}
|
|
235
259
|
var owningSessionIndex = state.sessions.findIndex(function (session) {
|
|
236
|
-
var _session$
|
|
237
|
-
return session.childFlyoutId === action.flyoutId || ((_session$
|
|
260
|
+
var _session$childHistory2;
|
|
261
|
+
return session.childFlyoutId === action.flyoutId || ((_session$childHistory2 = session.childHistory) !== null && _session$childHistory2 !== void 0 ? _session$childHistory2 : []).some(function (entry) {
|
|
238
262
|
return entry.flyoutId === action.flyoutId;
|
|
239
263
|
});
|
|
240
264
|
});
|
|
@@ -266,21 +290,37 @@ function flyoutManagerReducer() {
|
|
|
266
290
|
});
|
|
267
291
|
}
|
|
268
292
|
|
|
269
|
-
// Unregister all flyouts.
|
|
293
|
+
// Unregister all flyouts (within the current history group only).
|
|
270
294
|
case _actions.ACTION_CLOSE_ALL:
|
|
271
295
|
{
|
|
272
296
|
if (state.sessions.length === 0) {
|
|
273
297
|
return state;
|
|
274
298
|
}
|
|
299
|
+
var _currentSessionIndex = state.sessions.length - 1;
|
|
300
|
+
var _currentSession = state.sessions[_currentSessionIndex];
|
|
301
|
+
var currentKey = _currentSession.historyKey;
|
|
275
302
|
|
|
276
|
-
//
|
|
303
|
+
// Remove all sessions that have the current historyKey (entire group)
|
|
304
|
+
var _newSessions = state.sessions.filter(function (s) {
|
|
305
|
+
return s.historyKey !== currentKey;
|
|
306
|
+
});
|
|
307
|
+
var _flyoutsToRemove = new Set();
|
|
308
|
+
state.sessions.forEach(function (session) {
|
|
309
|
+
if (session.historyKey === currentKey) {
|
|
310
|
+
addSessionFlyoutsToRemove(session, _flyoutsToRemove);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
var _newFlyouts3 = state.flyouts.filter(function (f) {
|
|
314
|
+
return !_flyoutsToRemove.has(f.flyoutId);
|
|
315
|
+
});
|
|
277
316
|
var _newCurrentZIndex2 = state.currentZIndex;
|
|
278
|
-
if (state.unmanagedFlyouts.length === 0) {
|
|
317
|
+
if (_newSessions.length === 0 && state.unmanagedFlyouts.length === 0) {
|
|
279
318
|
_newCurrentZIndex2 = 0;
|
|
280
319
|
}
|
|
281
|
-
return _objectSpread(_objectSpread({},
|
|
282
|
-
|
|
283
|
-
|
|
320
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
321
|
+
sessions: _newSessions,
|
|
322
|
+
flyouts: _newFlyouts3,
|
|
323
|
+
currentZIndex: _newCurrentZIndex2
|
|
284
324
|
});
|
|
285
325
|
}
|
|
286
326
|
|
|
@@ -292,8 +332,8 @@ function flyoutManagerReducer() {
|
|
|
292
332
|
return state;
|
|
293
333
|
}
|
|
294
334
|
var _updatedSessions2 = (0, _toConsumableArray2.default)(state.sessions);
|
|
295
|
-
var
|
|
296
|
-
_updatedSessions2[
|
|
335
|
+
var _currentSessionIndex2 = _updatedSessions2.length - 1;
|
|
336
|
+
_updatedSessions2[_currentSessionIndex2] = _objectSpread(_objectSpread({}, _updatedSessions2[_currentSessionIndex2]), {}, {
|
|
297
337
|
childFlyoutId: action.flyoutId
|
|
298
338
|
});
|
|
299
339
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -339,51 +379,50 @@ function flyoutManagerReducer() {
|
|
|
339
379
|
});
|
|
340
380
|
}
|
|
341
381
|
|
|
342
|
-
// Go back: pop child history when any, else pop current session
|
|
382
|
+
// Go back: pop child history when any, else pop current session (only within same historyKey).
|
|
343
383
|
case _actions.ACTION_GO_BACK:
|
|
344
384
|
{
|
|
345
|
-
var
|
|
385
|
+
var _currentSession2$chil;
|
|
346
386
|
if (state.sessions.length === 0) {
|
|
347
387
|
return state;
|
|
348
388
|
}
|
|
349
|
-
var
|
|
350
|
-
var
|
|
351
|
-
var _childHistory = (
|
|
389
|
+
var _currentSessionIndex3 = state.sessions.length - 1;
|
|
390
|
+
var _currentSession2 = state.sessions[_currentSessionIndex3];
|
|
391
|
+
var _childHistory = (_currentSession2$chil = _currentSession2.childHistory) !== null && _currentSession2$chil !== void 0 ? _currentSession2$chil : [];
|
|
352
392
|
if (_childHistory.length > 0) {
|
|
353
393
|
// Pop one child: set current child to the last entry in history, remove the current child flyout
|
|
354
394
|
var popped = _childHistory[_childHistory.length - 1];
|
|
355
395
|
var newChildHistory = _childHistory.slice(0, -1);
|
|
356
396
|
var _updatedSessions3 = (0, _toConsumableArray2.default)(state.sessions);
|
|
357
|
-
_updatedSessions3[
|
|
397
|
+
_updatedSessions3[_currentSessionIndex3] = _objectSpread(_objectSpread({}, _currentSession2), {}, {
|
|
358
398
|
childHistory: newChildHistory,
|
|
359
399
|
childFlyoutId: popped.flyoutId,
|
|
360
400
|
childTitle: popped.title,
|
|
361
401
|
childIconType: popped.iconType
|
|
362
402
|
});
|
|
363
|
-
var
|
|
364
|
-
return f.flyoutId !==
|
|
403
|
+
var _newFlyouts4 = state.flyouts.filter(function (f) {
|
|
404
|
+
return f.flyoutId !== _currentSession2.childFlyoutId;
|
|
365
405
|
});
|
|
366
406
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
367
407
|
sessions: _updatedSessions3,
|
|
368
|
-
flyouts:
|
|
408
|
+
flyouts: _newFlyouts4
|
|
369
409
|
});
|
|
370
410
|
}
|
|
371
411
|
|
|
372
412
|
// No child history: pop current session (main + all its children)
|
|
373
|
-
var
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return _flyoutsToRemove.add(e.flyoutId);
|
|
413
|
+
var _flyoutsToRemove2 = new Set();
|
|
414
|
+
addSessionFlyoutsToRemove(_currentSession2, _flyoutsToRemove2);
|
|
415
|
+
var sessionsWithoutCurrent = state.sessions.slice(0, _currentSessionIndex3);
|
|
416
|
+
var hasRemainingInCurrentGroup = sessionsWithoutCurrent.some(function (s) {
|
|
417
|
+
return s.historyKey === _currentSession2.historyKey;
|
|
379
418
|
});
|
|
380
|
-
var
|
|
381
|
-
|
|
419
|
+
var _newSessions2 = hasRemainingInCurrentGroup ? moveHistoryGroupToTop(sessionsWithoutCurrent, _currentSession2.historyKey) : sessionsWithoutCurrent;
|
|
420
|
+
var _newFlyouts5 = state.flyouts.filter(function (f) {
|
|
421
|
+
return !_flyoutsToRemove2.has(f.flyoutId);
|
|
382
422
|
});
|
|
383
|
-
var _newSessions = state.sessions.slice(0, _currentSessionIndex2);
|
|
384
423
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
385
|
-
sessions:
|
|
386
|
-
flyouts:
|
|
424
|
+
sessions: _newSessions2,
|
|
425
|
+
flyouts: _newFlyouts5
|
|
387
426
|
});
|
|
388
427
|
}
|
|
389
428
|
|
|
@@ -392,11 +431,11 @@ function flyoutManagerReducer() {
|
|
|
392
431
|
{
|
|
393
432
|
var _flyoutId3 = action.flyoutId,
|
|
394
433
|
_level = action.level;
|
|
395
|
-
var
|
|
434
|
+
var _currentSessionIndex4 = state.sessions.length - 1;
|
|
396
435
|
if (_level === _const.LEVEL_CHILD && state.sessions.length > 0) {
|
|
397
|
-
var
|
|
398
|
-
var
|
|
399
|
-
var _childHistory2 = (
|
|
436
|
+
var _currentSession3$chil;
|
|
437
|
+
var _currentSession3 = state.sessions[_currentSessionIndex4];
|
|
438
|
+
var _childHistory2 = (_currentSession3$chil = _currentSession3.childHistory) !== null && _currentSession3$chil !== void 0 ? _currentSession3$chil : [];
|
|
400
439
|
var targetIndex = _childHistory2.findIndex(function (entry) {
|
|
401
440
|
return entry.flyoutId === _flyoutId3;
|
|
402
441
|
});
|
|
@@ -405,18 +444,18 @@ function flyoutManagerReducer() {
|
|
|
405
444
|
}
|
|
406
445
|
var targetEntry = _childHistory2[targetIndex];
|
|
407
446
|
var _newChildHistory = _childHistory2.slice(0, targetIndex);
|
|
408
|
-
var
|
|
409
|
-
if (
|
|
410
|
-
|
|
447
|
+
var _flyoutsToRemove3 = new Set();
|
|
448
|
+
if (_currentSession3.childFlyoutId) {
|
|
449
|
+
_flyoutsToRemove3.add(_currentSession3.childFlyoutId);
|
|
411
450
|
}
|
|
412
451
|
_childHistory2.slice(targetIndex + 1).forEach(function (e) {
|
|
413
|
-
|
|
452
|
+
_flyoutsToRemove3.add(e.flyoutId);
|
|
414
453
|
});
|
|
415
|
-
var
|
|
416
|
-
return !
|
|
454
|
+
var _newFlyouts6 = state.flyouts.filter(function (f) {
|
|
455
|
+
return !_flyoutsToRemove3.has(f.flyoutId);
|
|
417
456
|
});
|
|
418
457
|
var _updatedSessions4 = (0, _toConsumableArray2.default)(state.sessions);
|
|
419
|
-
_updatedSessions4[
|
|
458
|
+
_updatedSessions4[_currentSessionIndex4] = _objectSpread(_objectSpread({}, _currentSession3), {}, {
|
|
420
459
|
childHistory: _newChildHistory,
|
|
421
460
|
childFlyoutId: targetEntry.flyoutId,
|
|
422
461
|
childTitle: targetEntry.title,
|
|
@@ -424,7 +463,7 @@ function flyoutManagerReducer() {
|
|
|
424
463
|
});
|
|
425
464
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
426
465
|
sessions: _updatedSessions4,
|
|
427
|
-
flyouts:
|
|
466
|
+
flyouts: _newFlyouts6
|
|
428
467
|
});
|
|
429
468
|
}
|
|
430
469
|
|
|
@@ -435,25 +474,45 @@ function flyoutManagerReducer() {
|
|
|
435
474
|
if (targetSessionIndex === -1) {
|
|
436
475
|
return state; // Target flyout not found
|
|
437
476
|
}
|
|
477
|
+
var _currentSession4 = state.sessions[_currentSessionIndex4];
|
|
478
|
+
var targetSession = state.sessions[targetSessionIndex];
|
|
479
|
+
|
|
480
|
+
// Group-local navigation: keep other history groups, remove only newer sessions in target's group,
|
|
481
|
+
// then bring that group to the top.
|
|
482
|
+
if (targetSession.historyKey === _currentSession4.historyKey) {
|
|
483
|
+
var _flyoutsToRemove4 = new Set();
|
|
484
|
+
var sessionsAfterTargetInGroup = state.sessions.filter(function (session, index) {
|
|
485
|
+
return index > targetSessionIndex && session.historyKey === targetSession.historyKey;
|
|
486
|
+
});
|
|
487
|
+
sessionsAfterTargetInGroup.forEach(function (session) {
|
|
488
|
+
addSessionFlyoutsToRemove(session, _flyoutsToRemove4);
|
|
489
|
+
});
|
|
490
|
+
var sessionsWithoutRemoved = state.sessions.filter(function (session) {
|
|
491
|
+
return !sessionsAfterTargetInGroup.some(function (removed) {
|
|
492
|
+
return removed.mainFlyoutId === session.mainFlyoutId;
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
var reorderedSessions = moveHistoryGroupToTop(sessionsWithoutRemoved, targetSession.historyKey);
|
|
496
|
+
var _newFlyouts7 = state.flyouts.filter(function (f) {
|
|
497
|
+
return !_flyoutsToRemove4.has(f.flyoutId);
|
|
498
|
+
});
|
|
499
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
500
|
+
sessions: reorderedSessions,
|
|
501
|
+
flyouts: _newFlyouts7
|
|
502
|
+
});
|
|
503
|
+
}
|
|
438
504
|
var sessionsToClose = state.sessions.slice(targetSessionIndex + 1);
|
|
439
|
-
var
|
|
505
|
+
var _flyoutsToRemove5 = new Set();
|
|
440
506
|
sessionsToClose.forEach(function (session) {
|
|
441
|
-
|
|
442
|
-
_flyoutsToRemove3.add(session.mainFlyoutId);
|
|
443
|
-
if (session.childFlyoutId) {
|
|
444
|
-
_flyoutsToRemove3.add(session.childFlyoutId);
|
|
445
|
-
}
|
|
446
|
-
((_session$childHistory2 = session.childHistory) !== null && _session$childHistory2 !== void 0 ? _session$childHistory2 : []).forEach(function (e) {
|
|
447
|
-
return _flyoutsToRemove3.add(e.flyoutId);
|
|
448
|
-
});
|
|
507
|
+
addSessionFlyoutsToRemove(session, _flyoutsToRemove5);
|
|
449
508
|
});
|
|
450
|
-
var
|
|
451
|
-
return !
|
|
509
|
+
var _newFlyouts8 = state.flyouts.filter(function (f) {
|
|
510
|
+
return !_flyoutsToRemove5.has(f.flyoutId);
|
|
452
511
|
});
|
|
453
|
-
var
|
|
512
|
+
var _newSessions3 = state.sessions.slice(0, targetSessionIndex + 1);
|
|
454
513
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
455
|
-
sessions:
|
|
456
|
-
flyouts:
|
|
514
|
+
sessions: _newSessions3,
|
|
515
|
+
flyouts: _newFlyouts8
|
|
457
516
|
});
|
|
458
517
|
}
|
|
459
518
|
|
|
@@ -54,8 +54,15 @@ function createStore() {
|
|
|
54
54
|
var _currentSession$child;
|
|
55
55
|
var currentSessionIndex = currentState.sessions.length - 1;
|
|
56
56
|
var currentSession = currentSessionIndex >= 0 ? currentState.sessions[currentSessionIndex] : null;
|
|
57
|
+
if (!currentSession) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
57
60
|
var previousSessions = currentState.sessions.slice(0, currentSessionIndex);
|
|
58
|
-
|
|
61
|
+
// Only include sessions in the same history group (same historyKey reference)
|
|
62
|
+
var previousSessionsInGroup = previousSessions.filter(function (session) {
|
|
63
|
+
return session.historyKey === currentSession.historyKey;
|
|
64
|
+
});
|
|
65
|
+
var childHistory = (_currentSession$child = currentSession.childHistory) !== null && _currentSession$child !== void 0 ? _currentSession$child : [];
|
|
59
66
|
var childItems = (0, _toConsumableArray2.default)(childHistory).reverse().map(function (entry) {
|
|
60
67
|
return {
|
|
61
68
|
title: entry.title,
|
|
@@ -66,11 +73,11 @@ function createStore() {
|
|
|
66
73
|
};
|
|
67
74
|
});
|
|
68
75
|
|
|
69
|
-
// Previous sessions: list each session's current child then its child history
|
|
76
|
+
// Previous sessions (same group): list each session's current child then its child history
|
|
70
77
|
var previousSessionItems = [];
|
|
71
78
|
var _loop = function _loop() {
|
|
72
79
|
var _session$childHistory;
|
|
73
|
-
var session =
|
|
80
|
+
var session = previousSessionsInGroup[i];
|
|
74
81
|
var mainTitle = session.title;
|
|
75
82
|
var mainFlyoutId = session.mainFlyoutId;
|
|
76
83
|
var history = (_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : [];
|
|
@@ -108,7 +115,7 @@ function createStore() {
|
|
|
108
115
|
});
|
|
109
116
|
}
|
|
110
117
|
};
|
|
111
|
-
for (var i =
|
|
118
|
+
for (var i = previousSessionsInGroup.length - 1; i >= 0; i--) {
|
|
112
119
|
_loop();
|
|
113
120
|
}
|
|
114
121
|
return [].concat((0, _toConsumableArray2.default)(childItems), previousSessionItems);
|
|
@@ -147,8 +154,8 @@ function createStore() {
|
|
|
147
154
|
subscribe: subscribe,
|
|
148
155
|
subscribeToEvents: subscribeToEvents,
|
|
149
156
|
dispatch: dispatch,
|
|
150
|
-
addFlyout: function addFlyout(flyoutId, title, level, size, iconType, minWidth) {
|
|
151
|
-
return dispatch((0, _actions.addFlyout)(flyoutId, title, level, size, iconType, minWidth));
|
|
157
|
+
addFlyout: function addFlyout(flyoutId, title, level, size, historyKey, iconType, minWidth) {
|
|
158
|
+
return dispatch((0, _actions.addFlyout)(flyoutId, title, level, size, historyKey, iconType, minWidth));
|
|
152
159
|
},
|
|
153
160
|
closeFlyout: function closeFlyout(flyoutId) {
|
|
154
161
|
return dispatch((0, _actions.closeFlyout)(flyoutId));
|
package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js
CHANGED
|
@@ -12,6 +12,7 @@ var _remarkParseNoTrim = _interopRequireDefault(require("remark-parse-no-trim"))
|
|
|
12
12
|
var _remarkEmoji = _interopRequireDefault(require("remark-emoji"));
|
|
13
13
|
var _remarkBreaks = _interopRequireDefault(require("remark-breaks"));
|
|
14
14
|
var _remark_prismjs = _interopRequireDefault(require("../remark/remark_prismjs"));
|
|
15
|
+
var _remark_intraword_underscore = _interopRequireDefault(require("../remark/remark_intraword_underscore"));
|
|
15
16
|
var MarkdownTooltip = _interopRequireWildcard(require("../markdown_tooltip"));
|
|
16
17
|
var MarkdownCheckbox = _interopRequireWildcard(require("../markdown_checkbox"));
|
|
17
18
|
var _markdown_link_validator = require("../markdown_link_validator");
|
|
@@ -42,7 +43,7 @@ var getDefaultEuiMarkdownParsingPlugins = exports.getDefaultEuiMarkdownParsingPl
|
|
|
42
43
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
43
44
|
var exclude = _ref.exclude,
|
|
44
45
|
parsingConfig = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
45
|
-
var parsingPlugins = [[_remarkParseNoTrim.default, {}], [_remark_prismjs.default, {}]];
|
|
46
|
+
var parsingPlugins = [[_remarkParseNoTrim.default, {}], [_remark_prismjs.default, {}], [_remark_intraword_underscore.default, {}]];
|
|
46
47
|
Object.entries(DEFAULT_PARSING_PLUGINS).forEach(function (_ref2) {
|
|
47
48
|
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
48
49
|
pluginName = _ref3[0],
|