@atlaskit/editor-plugin-type-ahead 10.2.2 → 10.3.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/CHANGELOG.md +20 -0
- package/dist/cjs/pm-plugins/commands/update-list-items.js +3 -1
- package/dist/cjs/pm-plugins/main.js +1 -0
- package/dist/cjs/pm-plugins/reducer.js +7 -1
- package/dist/cjs/typeAheadPlugin.js +3 -1
- package/dist/cjs/ui/ContentComponent.js +10 -7
- package/dist/cjs/ui/TypeAheadList.js +126 -52
- package/dist/cjs/ui/TypeAheadMenu.js +3 -0
- package/dist/cjs/ui/TypeAheadPopup.js +3 -0
- package/dist/cjs/ui/WrapperTypeAhead.js +3 -1
- package/dist/cjs/ui/hooks/build-sectioned-result.js +131 -0
- package/dist/cjs/ui/hooks/use-load-items.js +12 -4
- package/dist/es2019/pm-plugins/commands/update-list-items.js +3 -2
- package/dist/es2019/pm-plugins/main.js +1 -0
- package/dist/es2019/pm-plugins/reducer.js +6 -1
- package/dist/es2019/typeAheadPlugin.js +3 -1
- package/dist/es2019/ui/ContentComponent.js +10 -7
- package/dist/es2019/ui/TypeAheadList.js +85 -23
- package/dist/es2019/ui/TypeAheadMenu.js +2 -0
- package/dist/es2019/ui/TypeAheadPopup.js +2 -0
- package/dist/es2019/ui/WrapperTypeAhead.js +3 -1
- package/dist/es2019/ui/hooks/build-sectioned-result.js +83 -0
- package/dist/es2019/ui/hooks/use-load-items.js +13 -4
- package/dist/esm/pm-plugins/commands/update-list-items.js +3 -1
- package/dist/esm/pm-plugins/main.js +1 -0
- package/dist/esm/pm-plugins/reducer.js +7 -1
- package/dist/esm/typeAheadPlugin.js +3 -1
- package/dist/esm/ui/ContentComponent.js +10 -7
- package/dist/esm/ui/TypeAheadList.js +126 -52
- package/dist/esm/ui/TypeAheadMenu.js +3 -0
- package/dist/esm/ui/TypeAheadPopup.js +3 -0
- package/dist/esm/ui/WrapperTypeAhead.js +3 -1
- package/dist/esm/ui/hooks/build-sectioned-result.js +124 -0
- package/dist/esm/ui/hooks/use-load-items.js +12 -4
- package/dist/types/pm-plugins/commands/update-list-items.d.ts +2 -1
- package/dist/types/types/index.d.ts +8 -0
- package/dist/types/ui/TypeAheadList.d.ts +3 -1
- package/dist/types/ui/TypeAheadPopup.d.ts +3 -2
- package/dist/types/ui/hooks/build-sectioned-result.d.ts +11 -0
- package/dist/types/ui/hooks/use-load-items.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/commands/update-list-items.d.ts +2 -1
- package/dist/types-ts4.5/types/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/TypeAheadList.d.ts +3 -1
- package/dist/types-ts4.5/ui/TypeAheadPopup.d.ts +3 -2
- package/dist/types-ts4.5/ui/hooks/build-sectioned-result.d.ts +11 -0
- package/dist/types-ts4.5/ui/hooks/use-load-items.d.ts +2 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 10.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`beab4fffee103`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/beab4fffee103) -
|
|
8
|
+
EDITOR-7318: Add type-ahead sections support with getSections handler API.
|
|
9
|
+
|
|
10
|
+
Adds `TypeAheadSection` and `TypeAheadSectionUpdate` types and an optional `getSections()` method
|
|
11
|
+
to `TypeAheadHandler` in `editor-common`. Implements section grouping in
|
|
12
|
+
`editor-plugin-type-ahead` via `buildSectionedResult`. Adds People/Agents section split to
|
|
13
|
+
`editor-plugin-mentions`.
|
|
14
|
+
|
|
15
|
+
Removes the `updateSection` action and associated `sectionOverrides`/`sectionsRefreshKey`
|
|
16
|
+
pm-plugin state — section definitions are now derived directly from `getSections()` at load time
|
|
17
|
+
rather than being mutated at runtime.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 10.2.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -7,12 +7,14 @@ exports.updateListItem = void 0;
|
|
|
7
7
|
var _actions = require("../actions");
|
|
8
8
|
var _key = require("../key");
|
|
9
9
|
var updateListItem = exports.updateListItem = function updateListItem(items) {
|
|
10
|
+
var sections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
10
11
|
return function (state, dispatch) {
|
|
11
12
|
var tr = state.tr;
|
|
12
13
|
tr.setMeta(_key.pluginKey, {
|
|
13
14
|
action: _actions.ACTIONS.UPDATE_LIST_ITEMS,
|
|
14
15
|
params: {
|
|
15
|
-
items: items
|
|
16
|
+
items: items,
|
|
17
|
+
sections: sections
|
|
16
18
|
}
|
|
17
19
|
});
|
|
18
20
|
if (dispatch) {
|
|
@@ -76,6 +76,7 @@ var createReducer = exports.createReducer = function createReducer(_ref) {
|
|
|
76
76
|
inputMethod: inputMethod,
|
|
77
77
|
selectedIndex: typeof selectedIndex === 'number' ? selectedIndex : -1,
|
|
78
78
|
items: [],
|
|
79
|
+
sections: [],
|
|
79
80
|
query: reopenQuery || '',
|
|
80
81
|
removePrefixTriggerOnCancel: removePrefixTriggerOnCancel
|
|
81
82
|
});
|
|
@@ -94,6 +95,7 @@ var createReducer = exports.createReducer = function createReducer(_ref) {
|
|
|
94
95
|
stats: null,
|
|
95
96
|
triggerHandler: undefined,
|
|
96
97
|
items: [],
|
|
98
|
+
sections: [],
|
|
97
99
|
removePrefixTriggerOnCancel: undefined
|
|
98
100
|
});
|
|
99
101
|
};
|
|
@@ -144,13 +146,17 @@ var createReducer = exports.createReducer = function createReducer(_ref) {
|
|
|
144
146
|
return _objectSpread(_objectSpread({}, currentPluginState), {}, {
|
|
145
147
|
errorInfo: errorInfo,
|
|
146
148
|
items: [],
|
|
149
|
+
sections: [],
|
|
147
150
|
selectedIndex: -1
|
|
148
151
|
});
|
|
149
152
|
} else if (shouldUpdateListItems) {
|
|
150
|
-
var items = params.items
|
|
153
|
+
var items = params.items,
|
|
154
|
+
_params$sections = params.sections,
|
|
155
|
+
sections = _params$sections === void 0 ? [] : _params$sections;
|
|
151
156
|
var selectedIndex = currentPluginState.selectedIndex;
|
|
152
157
|
return _objectSpread(_objectSpread({}, currentPluginState), {}, {
|
|
153
158
|
items: items,
|
|
159
|
+
sections: sections,
|
|
154
160
|
selectedIndex: Math.max(selectedIndex >= items.length ? items.length - 1 : selectedIndex, -1)
|
|
155
161
|
});
|
|
156
162
|
} else if (shouldUpdateSelectedIndex) {
|
|
@@ -214,7 +214,7 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
|
|
|
214
214
|
}];
|
|
215
215
|
},
|
|
216
216
|
getSharedState: function getSharedState(editorState) {
|
|
217
|
-
var _state$decorationSet, _state$decorationElem, _state$items, _state$errorInfo, _state$selectedIndex;
|
|
217
|
+
var _state$decorationSet, _state$decorationElem, _state$items, _state$sections, _state$errorInfo, _state$selectedIndex;
|
|
218
218
|
if (!editorState) {
|
|
219
219
|
return {
|
|
220
220
|
query: '',
|
|
@@ -225,6 +225,7 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
|
|
|
225
225
|
decorationElement: null,
|
|
226
226
|
triggerHandler: undefined,
|
|
227
227
|
items: [],
|
|
228
|
+
sections: [],
|
|
228
229
|
errorInfo: null,
|
|
229
230
|
selectedIndex: 0
|
|
230
231
|
};
|
|
@@ -240,6 +241,7 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
|
|
|
240
241
|
decorationElement: (_state$decorationElem = state === null || state === void 0 ? void 0 : state.decorationElement) !== null && _state$decorationElem !== void 0 ? _state$decorationElem : null,
|
|
241
242
|
triggerHandler: state === null || state === void 0 ? void 0 : state.triggerHandler,
|
|
242
243
|
items: (_state$items = state === null || state === void 0 ? void 0 : state.items) !== null && _state$items !== void 0 ? _state$items : [],
|
|
244
|
+
sections: (_state$sections = state === null || state === void 0 ? void 0 : state.sections) !== null && _state$sections !== void 0 ? _state$sections : [],
|
|
243
245
|
errorInfo: (_state$errorInfo = state === null || state === void 0 ? void 0 : state.errorInfo) !== null && _state$errorInfo !== void 0 ? _state$errorInfo : null,
|
|
244
246
|
selectedIndex: (_state$selectedIndex = state === null || state === void 0 ? void 0 : state.selectedIndex) !== null && _state$selectedIndex !== void 0 ? _state$selectedIndex : 0
|
|
245
247
|
};
|
|
@@ -13,25 +13,27 @@ function ContentComponent(_ref) {
|
|
|
13
13
|
editorView = _ref.editorView,
|
|
14
14
|
popupMountRef = _ref.popupMountRef;
|
|
15
15
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['typeAhead'], function (states) {
|
|
16
|
-
var _states$typeAheadStat, _states$typeAheadStat2, _states$typeAheadStat3, _states$typeAheadStat4, _states$typeAheadStat5, _states$typeAheadStat6, _states$typeAheadStat7;
|
|
16
|
+
var _states$typeAheadStat, _states$typeAheadStat2, _states$typeAheadStat3, _states$typeAheadStat4, _states$typeAheadStat5, _states$typeAheadStat6, _states$typeAheadStat7, _states$typeAheadStat8;
|
|
17
17
|
return {
|
|
18
18
|
triggerHandler: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.triggerHandler,
|
|
19
19
|
items: (_states$typeAheadStat2 = states.typeAheadState) === null || _states$typeAheadStat2 === void 0 ? void 0 : _states$typeAheadStat2.items,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
sections: (_states$typeAheadStat3 = states.typeAheadState) === null || _states$typeAheadStat3 === void 0 ? void 0 : _states$typeAheadStat3.sections,
|
|
21
|
+
errorInfo: (_states$typeAheadStat4 = states.typeAheadState) === null || _states$typeAheadStat4 === void 0 ? void 0 : _states$typeAheadStat4.errorInfo,
|
|
22
|
+
decorationElement: (_states$typeAheadStat5 = states.typeAheadState) === null || _states$typeAheadStat5 === void 0 ? void 0 : _states$typeAheadStat5.decorationElement,
|
|
23
|
+
decorationSet: (_states$typeAheadStat6 = states.typeAheadState) === null || _states$typeAheadStat6 === void 0 ? void 0 : _states$typeAheadStat6.decorationSet,
|
|
24
|
+
query: (_states$typeAheadStat7 = states.typeAheadState) === null || _states$typeAheadStat7 === void 0 ? void 0 : _states$typeAheadStat7.query,
|
|
25
|
+
selectedIndex: (_states$typeAheadStat8 = states.typeAheadState) === null || _states$typeAheadStat8 === void 0 ? void 0 : _states$typeAheadStat8.selectedIndex
|
|
25
26
|
};
|
|
26
27
|
}),
|
|
27
28
|
triggerHandler = _useSharedPluginState.triggerHandler,
|
|
28
29
|
items = _useSharedPluginState.items,
|
|
30
|
+
sections = _useSharedPluginState.sections,
|
|
29
31
|
errorInfo = _useSharedPluginState.errorInfo,
|
|
30
32
|
decorationElement = _useSharedPluginState.decorationElement,
|
|
31
33
|
decorationSet = _useSharedPluginState.decorationSet,
|
|
32
34
|
query = _useSharedPluginState.query,
|
|
33
35
|
selectedIndex = _useSharedPluginState.selectedIndex;
|
|
34
|
-
if (items === undefined || decorationSet === undefined || errorInfo === undefined || decorationElement === undefined || query === undefined || selectedIndex === undefined) {
|
|
36
|
+
if (items === undefined || sections === undefined || decorationSet === undefined || errorInfo === undefined || decorationElement === undefined || query === undefined || selectedIndex === undefined) {
|
|
35
37
|
return null;
|
|
36
38
|
}
|
|
37
39
|
return /*#__PURE__*/_react.default.createElement(_TypeAheadMenu.TypeAheadMenu, {
|
|
@@ -42,6 +44,7 @@ function ContentComponent(_ref) {
|
|
|
42
44
|
typeAheadState: {
|
|
43
45
|
triggerHandler: triggerHandler,
|
|
44
46
|
items: items,
|
|
47
|
+
sections: sections,
|
|
45
48
|
errorInfo: errorInfo,
|
|
46
49
|
decorationElement: decorationElement,
|
|
47
50
|
decorationSet: decorationSet,
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.TypeAheadList = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _react2 = require("@emotion/react");
|
|
12
13
|
var _reactIntl = require("react-intl");
|
|
@@ -19,6 +20,7 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
19
20
|
var _menu = require("@atlaskit/menu");
|
|
20
21
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
21
22
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
22
24
|
var _closeTypeAhead = require("../pm-plugins/commands/close-type-ahead");
|
|
23
25
|
var _updateSelectedIndex = require("../pm-plugins/commands/update-selected-index");
|
|
24
26
|
var _constants = require("../pm-plugins/constants");
|
|
@@ -42,8 +44,43 @@ var list = (0, _react2.css)({
|
|
|
42
44
|
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-150, 12px)")
|
|
43
45
|
}
|
|
44
46
|
});
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
+
var buildTypeAheadRows = function buildTypeAheadRows(_ref) {
|
|
48
|
+
var itemsLength = _ref.itemsLength,
|
|
49
|
+
sections = _ref.sections;
|
|
50
|
+
if (sections.length === 0) {
|
|
51
|
+
return Array.from({
|
|
52
|
+
length: itemsLength
|
|
53
|
+
}, function (_, itemIndex) {
|
|
54
|
+
return {
|
|
55
|
+
type: 'item',
|
|
56
|
+
itemIndex: itemIndex
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
var sortedSections = (0, _toConsumableArray2.default)(sections).sort(function (left, right) {
|
|
61
|
+
return left.startIndex - right.startIndex;
|
|
62
|
+
});
|
|
63
|
+
var sectionsByStartIndex = new Map(sortedSections.map(function (section) {
|
|
64
|
+
return [section.startIndex, section];
|
|
65
|
+
}));
|
|
66
|
+
var rows = [];
|
|
67
|
+
for (var itemIndex = 0; itemIndex < itemsLength; itemIndex++) {
|
|
68
|
+
var section = sectionsByStartIndex.get(itemIndex);
|
|
69
|
+
if (section) {
|
|
70
|
+
rows.push({
|
|
71
|
+
type: 'section',
|
|
72
|
+
section: section
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
rows.push({
|
|
76
|
+
type: 'item',
|
|
77
|
+
itemIndex: itemIndex
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return rows;
|
|
81
|
+
};
|
|
82
|
+
var TypeaheadAssistiveTextPureComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
83
|
+
var numberOfResults = _ref2.numberOfResults;
|
|
47
84
|
var intl = (0, _reactIntl.useIntl)();
|
|
48
85
|
return (0, _react2.jsx)(_ui.AssistiveText, {
|
|
49
86
|
assistiveText: intl.formatMessage(_typeAhead.typeAheadListMessages.searchResultsLabel, {
|
|
@@ -55,21 +92,22 @@ var TypeaheadAssistiveTextPureComponent = /*#__PURE__*/_react.default.memo(funct
|
|
|
55
92
|
id: _constants.TYPE_AHEAD_DECORATION_ELEMENT_ID + '__popup'
|
|
56
93
|
});
|
|
57
94
|
});
|
|
58
|
-
var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (
|
|
59
|
-
var _triggerHandler$getMo, _decorationElement$qu2;
|
|
60
|
-
var items =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
95
|
+
var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref3) {
|
|
96
|
+
var _itemRowIndexByItemIn, _triggerHandler$getMo, _decorationElement$qu2;
|
|
97
|
+
var items = _ref3.items,
|
|
98
|
+
sections = _ref3.sections,
|
|
99
|
+
emptyItem = _ref3.emptyItem,
|
|
100
|
+
selectedIndex = _ref3.selectedIndex,
|
|
101
|
+
editorView = _ref3.editorView,
|
|
102
|
+
onItemClick = _ref3.onItemClick,
|
|
103
|
+
intl = _ref3.intl,
|
|
104
|
+
fitHeight = _ref3.fitHeight,
|
|
105
|
+
decorationElement = _ref3.decorationElement,
|
|
106
|
+
triggerHandler = _ref3.triggerHandler,
|
|
107
|
+
moreElementsInQuickInsertViewEnabled = _ref3.moreElementsInQuickInsertViewEnabled,
|
|
108
|
+
api = _ref3.api,
|
|
109
|
+
showMoreOptionsButton = _ref3.showMoreOptionsButton,
|
|
110
|
+
onMoreOptionsClicked = _ref3.onMoreOptionsClicked;
|
|
73
111
|
var listRef = (0, _react.useRef)();
|
|
74
112
|
var listContainerRef = (0, _react.useRef)(null);
|
|
75
113
|
var lastInputMethodRef = (0, _react.useRef)('keyboard');
|
|
@@ -96,6 +134,27 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
96
134
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
97
135
|
cache = _useState4[0],
|
|
98
136
|
setCache = _useState4[1];
|
|
137
|
+
var listRows = (0, _react.useMemo)(function () {
|
|
138
|
+
return buildTypeAheadRows({
|
|
139
|
+
itemsLength: itemsLength,
|
|
140
|
+
sections: sections || []
|
|
141
|
+
});
|
|
142
|
+
}, [itemsLength, sections]);
|
|
143
|
+
var itemRowIndexByItemIndex = (0, _react.useMemo)(function () {
|
|
144
|
+
var rowIndexByItemIndex = new Map();
|
|
145
|
+
listRows.forEach(function (row, rowIndex) {
|
|
146
|
+
if (row.type === 'item') {
|
|
147
|
+
rowIndexByItemIndex.set(row.itemIndex, rowIndex);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
return rowIndexByItemIndex;
|
|
151
|
+
}, [listRows]);
|
|
152
|
+
var populatedSectionCount = (0, _react.useMemo)(function () {
|
|
153
|
+
return listRows.filter(function (row) {
|
|
154
|
+
return row.type === 'section';
|
|
155
|
+
}).length;
|
|
156
|
+
}, [listRows]);
|
|
157
|
+
var selectedItemRowIndex = selectedIndex >= 0 ? (_itemRowIndexByItemIn = itemRowIndexByItemIndex.get(selectedIndex)) !== null && _itemRowIndexByItemIn !== void 0 ? _itemRowIndexByItemIn : -1 : -1;
|
|
99
158
|
var onItemsRendered = (0, _react.useCallback)(function (props) {
|
|
100
159
|
lastVisibleIndexes.current = props;
|
|
101
160
|
}, []);
|
|
@@ -132,8 +191,8 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
132
191
|
var lastVisibleStopIndex = lastVisibleIndexes.current.stopIndex;
|
|
133
192
|
var onScroll = (0, _react.useCallback)(
|
|
134
193
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
|
-
function (
|
|
136
|
-
var scrollUpdateWasRequested =
|
|
194
|
+
function (_ref4) {
|
|
195
|
+
var scrollUpdateWasRequested = _ref4.scrollUpdateWasRequested;
|
|
137
196
|
if (!scrollUpdateWasRequested) {
|
|
138
197
|
return;
|
|
139
198
|
}
|
|
@@ -151,28 +210,32 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
151
210
|
requestAnimationFrame(function () {
|
|
152
211
|
requestAnimationFrame(function () {
|
|
153
212
|
var isViewMoreSelected = showMoreOptionsButton && selectedIndex === itemsLength;
|
|
154
|
-
var isSelectedItemVisible =
|
|
213
|
+
var isSelectedItemVisible = selectedItemRowIndex >= lastVisibleStartIndex && selectedItemRowIndex <= lastVisibleStopIndex ||
|
|
155
214
|
// view more is always visible, hence no scrolling
|
|
156
215
|
isViewMoreSelected;
|
|
157
216
|
|
|
158
217
|
//Should scroll to the list item only when the selectedIndex >= 0 and item is not visible
|
|
159
218
|
if (!isSelectedItemVisible && selectedIndex !== -1) {
|
|
160
|
-
listRef.current.scrollToRow(
|
|
219
|
+
listRef.current.scrollToRow(selectedItemRowIndex);
|
|
161
220
|
} else if (selectedIndex === -1) {
|
|
162
221
|
listRef.current.scrollToRow(0);
|
|
163
222
|
}
|
|
164
223
|
});
|
|
165
224
|
});
|
|
166
|
-
}, [selectedIndex, lastVisibleStartIndex, lastVisibleStopIndex, itemsLength, showMoreOptionsButton]);
|
|
167
|
-
var _onMouseMove = function onMouseMove(event,
|
|
225
|
+
}, [selectedIndex, lastVisibleStartIndex, lastVisibleStopIndex, itemsLength, showMoreOptionsButton, selectedItemRowIndex]);
|
|
226
|
+
var _onMouseMove = function onMouseMove(event, row) {
|
|
227
|
+
if (row.type !== 'item') {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
var itemIndex = row.itemIndex;
|
|
168
231
|
event.preventDefault();
|
|
169
232
|
event.stopPropagation();
|
|
170
|
-
if (selectedIndex ===
|
|
233
|
+
if (selectedIndex === itemIndex) {
|
|
171
234
|
return;
|
|
172
235
|
}
|
|
173
236
|
mouseMovedRef.current = true;
|
|
174
237
|
lastInputMethodRef.current = 'mouse';
|
|
175
|
-
(0, _updateSelectedIndex.updateSelectedIndex)(
|
|
238
|
+
(0, _updateSelectedIndex.updateSelectedIndex)(itemIndex, api)(editorView.state, editorView.dispatch);
|
|
176
239
|
};
|
|
177
240
|
(0, _react.useLayoutEffect)(function () {
|
|
178
241
|
if (mouseMovedRef.current) {
|
|
@@ -186,17 +249,17 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
186
249
|
return;
|
|
187
250
|
}
|
|
188
251
|
var isViewMoreSelected = showMoreOptionsButton && selectedIndex === itemsLength;
|
|
189
|
-
var isSelectedItemVisible =
|
|
252
|
+
var isSelectedItemVisible = selectedItemRowIndex >= lastVisibleStartIndex && selectedItemRowIndex <= lastVisibleStopIndex ||
|
|
190
253
|
// view more is always visible, hence no scrolling
|
|
191
254
|
isViewMoreSelected;
|
|
192
255
|
|
|
193
256
|
//Should scroll to the list item only when the selectedIndex >= 0 and item is not visible
|
|
194
257
|
if (!isSelectedItemVisible && selectedIndex !== -1) {
|
|
195
|
-
listRef.current.scrollToRow(
|
|
258
|
+
listRef.current.scrollToRow(selectedItemRowIndex);
|
|
196
259
|
} else if (selectedIndex === -1) {
|
|
197
260
|
listRef.current.scrollToRow(0);
|
|
198
261
|
}
|
|
199
|
-
}, [selectedIndex, lastVisibleStartIndex, lastVisibleStopIndex, itemsLength, showMoreOptionsButton]);
|
|
262
|
+
}, [selectedIndex, lastVisibleStartIndex, lastVisibleStopIndex, itemsLength, showMoreOptionsButton, selectedItemRowIndex]);
|
|
200
263
|
(0, _react.useLayoutEffect)(function () {
|
|
201
264
|
setCache(new _CellMeasurer.CellMeasurerCache({
|
|
202
265
|
fixedWidth: true,
|
|
@@ -212,10 +275,10 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
212
275
|
listContainerRef.current.firstChild.scrollTo(0, 0);
|
|
213
276
|
}
|
|
214
277
|
});
|
|
215
|
-
}, [items]);
|
|
278
|
+
}, [items, sections]);
|
|
216
279
|
(0, _react.useLayoutEffect)(function () {
|
|
217
280
|
// Exclude view more item from the count
|
|
218
|
-
var itemsToRender = showMoreOptionsButton ? items.slice(0, -1) : items;
|
|
281
|
+
var itemsToRender = (0, _experiments.editorExperiment)('platform_editor_agent_mentions', true) ? listRows : showMoreOptionsButton ? items.slice(0, -1) : items;
|
|
219
282
|
var height = Math.min(
|
|
220
283
|
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- Ignored via go/ees017 (to be fixed)
|
|
221
284
|
itemsToRender.reduce(function (prevValue, currentValue, index) {
|
|
@@ -224,7 +287,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
224
287
|
});
|
|
225
288
|
}, 0), fitHeight);
|
|
226
289
|
setHeight(height);
|
|
227
|
-
}, [items, cache, fitHeight, showMoreOptionsButton]);
|
|
290
|
+
}, [listRows, items, cache, fitHeight, showMoreOptionsButton]);
|
|
228
291
|
(0, _react.useLayoutEffect)(function () {
|
|
229
292
|
if (!listContainerRef.current) {
|
|
230
293
|
return;
|
|
@@ -287,8 +350,8 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
287
350
|
if (onMoreOptionsClicked) {
|
|
288
351
|
onMoreOptionsClicked();
|
|
289
352
|
}
|
|
290
|
-
api === null || api === void 0 || api.core.actions.execute(function (
|
|
291
|
-
var tr =
|
|
353
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref5) {
|
|
354
|
+
var tr = _ref5.tr;
|
|
292
355
|
(0, _closeTypeAhead.closeTypeAhead)(tr);
|
|
293
356
|
config === null || config === void 0 || config.onClick({
|
|
294
357
|
tr: tr
|
|
@@ -296,22 +359,25 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
296
359
|
return tr;
|
|
297
360
|
});
|
|
298
361
|
};
|
|
299
|
-
var renderRow = function renderRow(
|
|
300
|
-
var index =
|
|
301
|
-
key =
|
|
302
|
-
style =
|
|
303
|
-
parent =
|
|
304
|
-
isScrolling =
|
|
305
|
-
isVisible =
|
|
306
|
-
var
|
|
362
|
+
var renderRow = function renderRow(_ref6) {
|
|
363
|
+
var index = _ref6.index,
|
|
364
|
+
key = _ref6.key,
|
|
365
|
+
style = _ref6.style,
|
|
366
|
+
parent = _ref6.parent,
|
|
367
|
+
isScrolling = _ref6.isScrolling,
|
|
368
|
+
isVisible = _ref6.isVisible;
|
|
369
|
+
var currentRow = listRows[index];
|
|
370
|
+
if (!currentRow) {
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
307
373
|
return (0, _react2.jsx)(_CellMeasurer.CellMeasurer, {
|
|
308
374
|
key: key,
|
|
309
375
|
cache: cache,
|
|
310
376
|
parent: parent,
|
|
311
377
|
columnIndex: 0,
|
|
312
378
|
rowIndex: index
|
|
313
|
-
}, function (
|
|
314
|
-
var measure =
|
|
379
|
+
}, function (_ref7) {
|
|
380
|
+
var measure = _ref7.measure;
|
|
315
381
|
return (0, _react2.jsx)(_ListRow.ListRow, {
|
|
316
382
|
measure: measure,
|
|
317
383
|
index: index
|
|
@@ -323,21 +389,29 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
323
389
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
324
390
|
,
|
|
325
391
|
onMouseMove: function onMouseMove(e) {
|
|
326
|
-
return _onMouseMove(e,
|
|
392
|
+
return _onMouseMove(e, currentRow);
|
|
327
393
|
}
|
|
328
|
-
}, (0, _react2.jsx)(
|
|
329
|
-
|
|
330
|
-
|
|
394
|
+
}, currentRow.type === 'section' ? populatedSectionCount === 1 ? null : (0, _react2.jsx)(_compiled.Box, {
|
|
395
|
+
paddingInline: "space.150",
|
|
396
|
+
paddingBlock: "space.050"
|
|
397
|
+
}, (0, _react2.jsx)(_compiled.Text, {
|
|
398
|
+
as: "span",
|
|
399
|
+
size: "small",
|
|
400
|
+
color: "color.text.subtle",
|
|
401
|
+
weight: "medium"
|
|
402
|
+
}, currentRow.section.title)) : (0, _react2.jsx)(_TypeAheadListItem.TypeAheadListItem, {
|
|
403
|
+
key: items[currentRow.itemIndex].title,
|
|
404
|
+
item: items[currentRow.itemIndex],
|
|
331
405
|
firstOnlineSupportedIndex: firstOnlineSupportedRow,
|
|
332
406
|
itemsLength: itemsLength,
|
|
333
|
-
itemIndex:
|
|
407
|
+
itemIndex: currentRow.itemIndex,
|
|
334
408
|
selectedIndex: selectedIndex
|
|
335
409
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
336
410
|
,
|
|
337
|
-
onItemClick: function onItemClick(mode,
|
|
338
|
-
actions.onItemClick(mode,
|
|
411
|
+
onItemClick: function onItemClick(mode, itemIndex) {
|
|
412
|
+
actions.onItemClick(mode, itemIndex, _analytics.INPUT_METHOD.MOUSE);
|
|
339
413
|
},
|
|
340
|
-
ariaLabel: (0, _utils.getTypeAheadListAriaLabels)(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl,
|
|
414
|
+
ariaLabel: (0, _utils.getTypeAheadListAriaLabels)(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, items[currentRow.itemIndex]).listItemAriaLabel,
|
|
341
415
|
moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled,
|
|
342
416
|
api: api,
|
|
343
417
|
lastInputMethodRef: lastInputMethodRef
|
|
@@ -371,7 +445,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
371
445
|
ref: listRef
|
|
372
446
|
// Skip rendering the view more button in the list
|
|
373
447
|
,
|
|
374
|
-
rowCount:
|
|
448
|
+
rowCount: listRows.length,
|
|
375
449
|
rowHeight: cache.rowHeight,
|
|
376
450
|
onRowsRendered: onItemsRendered,
|
|
377
451
|
width: LIST_WIDTH,
|
|
@@ -23,6 +23,8 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
|
|
|
23
23
|
var isOpen = typeAheadState.decorationSet.find().length > 0;
|
|
24
24
|
var triggerHandler = typeAheadState.triggerHandler,
|
|
25
25
|
items = typeAheadState.items,
|
|
26
|
+
_typeAheadState$secti = typeAheadState.sections,
|
|
27
|
+
sections = _typeAheadState$secti === void 0 ? [] : _typeAheadState$secti,
|
|
26
28
|
errorInfo = typeAheadState.errorInfo,
|
|
27
29
|
decorationElement = typeAheadState.decorationElement,
|
|
28
30
|
decorationSet = typeAheadState.decorationSet,
|
|
@@ -103,6 +105,7 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
|
|
|
103
105
|
anchorElement: decorationElement,
|
|
104
106
|
triggerHandler: triggerHandler,
|
|
105
107
|
items: items,
|
|
108
|
+
sections: sections,
|
|
106
109
|
emptyItem: emptyItem,
|
|
107
110
|
errorInfo: errorInfo,
|
|
108
111
|
selectedIndex: selectedIndex,
|
|
@@ -70,6 +70,8 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
70
70
|
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
71
71
|
popupsScrollableElement = props.popupsScrollableElement,
|
|
72
72
|
items = props.items,
|
|
73
|
+
_props$sections = props.sections,
|
|
74
|
+
sections = _props$sections === void 0 ? [] : _props$sections,
|
|
73
75
|
emptyItem = props.emptyItem,
|
|
74
76
|
errorInfo = props.errorInfo,
|
|
75
77
|
selectedIndex = props.selectedIndex,
|
|
@@ -345,6 +347,7 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
345
347
|
triggerHandler: triggerHandler
|
|
346
348
|
}), (0, _react2.jsx)(_TypeAheadList.TypeAheadList, {
|
|
347
349
|
items: items,
|
|
350
|
+
sections: sections,
|
|
348
351
|
emptyItem: emptyItem,
|
|
349
352
|
selectedIndex: selectedIndex
|
|
350
353
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.WrapperTypeAhead = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _reactIntl = require("react-intl");
|
|
11
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
13
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
13
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -40,6 +41,7 @@ var WrapperTypeAhead = exports.WrapperTypeAhead = /*#__PURE__*/_react.default.me
|
|
|
40
41
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
41
42
|
showMoreOptionsButton = !!(triggerHandler !== null && triggerHandler !== void 0 && triggerHandler.getMoreOptionsButtonConfig);
|
|
42
43
|
}
|
|
44
|
+
var intl = (0, _reactIntl.useIntl)();
|
|
43
45
|
var _useState = (0, _react.useState)(false),
|
|
44
46
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
45
47
|
closed = _useState2[0],
|
|
@@ -50,7 +52,7 @@ var WrapperTypeAhead = exports.WrapperTypeAhead = /*#__PURE__*/_react.default.me
|
|
|
50
52
|
setQuery = _useState4[1];
|
|
51
53
|
var queryRef = (0, _react.useRef)(query);
|
|
52
54
|
var editorViewRef = (0, _react.useRef)(editorView);
|
|
53
|
-
var items = (0, _useLoadItems.useLoadItems)(triggerHandler, editorView, query, showMoreOptionsButton, api);
|
|
55
|
+
var items = (0, _useLoadItems.useLoadItems)(triggerHandler, editorView, query, showMoreOptionsButton, api, intl);
|
|
54
56
|
(0, _react.useEffect)(function () {
|
|
55
57
|
if (!closed && (0, _platformFeatureFlags.fg)('platform_editor_ease_of_use_metrics')) {
|
|
56
58
|
var _api$metrics;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.buildSectionedResult = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
10
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
var buildSectionedResult = exports.buildSectionedResult = function buildSectionedResult(_ref) {
|
|
14
|
+
var _triggerHandler$getSe;
|
|
15
|
+
var items = _ref.items,
|
|
16
|
+
triggerHandler = _ref.triggerHandler,
|
|
17
|
+
intl = _ref.intl;
|
|
18
|
+
if (!(0, _experiments.editorExperiment)('platform_editor_agent_mentions', true) || !intl) {
|
|
19
|
+
return {
|
|
20
|
+
items: items,
|
|
21
|
+
sections: []
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
var sectionDefinitions = (_triggerHandler$getSe = triggerHandler.getSections) === null || _triggerHandler$getSe === void 0 ? void 0 : _triggerHandler$getSe.call(triggerHandler, {
|
|
25
|
+
intl: intl
|
|
26
|
+
});
|
|
27
|
+
if (!sectionDefinitions || sectionDefinitions.length === 0) {
|
|
28
|
+
return {
|
|
29
|
+
items: items,
|
|
30
|
+
sections: []
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Track which item indexes have been claimed by a section, or excluded (matched a section but
|
|
35
|
+
// cut by that section's limit). Items excluded by limit should not appear anywhere in the output.
|
|
36
|
+
var assignedToSection = new Set();
|
|
37
|
+
var excludedByLimit = new Set();
|
|
38
|
+
var groupedBySection = new Map();
|
|
39
|
+
var _iterator = _createForOfIteratorHelper(sectionDefinitions),
|
|
40
|
+
_step;
|
|
41
|
+
try {
|
|
42
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
43
|
+
var section = _step.value;
|
|
44
|
+
var matchingIndexes = [];
|
|
45
|
+
for (var _i = 0; _i < items.length; _i++) {
|
|
46
|
+
if (assignedToSection.has(_i) || excludedByLimit.has(_i)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (section.filter(items[_i])) {
|
|
50
|
+
matchingIndexes.push(_i);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
var acceptedIndexes = section.limit !== undefined ? matchingIndexes.slice(0, section.limit) : matchingIndexes;
|
|
54
|
+
var rejectedByLimit = matchingIndexes.slice(acceptedIndexes.length);
|
|
55
|
+
var _iterator3 = _createForOfIteratorHelper(acceptedIndexes),
|
|
56
|
+
_step3;
|
|
57
|
+
try {
|
|
58
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
59
|
+
var _i2 = _step3.value;
|
|
60
|
+
assignedToSection.add(_i2);
|
|
61
|
+
}
|
|
62
|
+
} catch (err) {
|
|
63
|
+
_iterator3.e(err);
|
|
64
|
+
} finally {
|
|
65
|
+
_iterator3.f();
|
|
66
|
+
}
|
|
67
|
+
var _iterator4 = _createForOfIteratorHelper(rejectedByLimit),
|
|
68
|
+
_step4;
|
|
69
|
+
try {
|
|
70
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
71
|
+
var _i3 = _step4.value;
|
|
72
|
+
excludedByLimit.add(_i3);
|
|
73
|
+
}
|
|
74
|
+
} catch (err) {
|
|
75
|
+
_iterator4.e(err);
|
|
76
|
+
} finally {
|
|
77
|
+
_iterator4.f();
|
|
78
|
+
}
|
|
79
|
+
if (acceptedIndexes.length === 0) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
groupedBySection.set(section.id, {
|
|
83
|
+
indexes: acceptedIndexes,
|
|
84
|
+
section: section
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
} catch (err) {
|
|
88
|
+
_iterator.e(err);
|
|
89
|
+
} finally {
|
|
90
|
+
_iterator.f();
|
|
91
|
+
}
|
|
92
|
+
var flattenedItems = [];
|
|
93
|
+
var sections = [];
|
|
94
|
+
var _iterator2 = _createForOfIteratorHelper(sectionDefinitions),
|
|
95
|
+
_step2;
|
|
96
|
+
try {
|
|
97
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
98
|
+
var _section = _step2.value;
|
|
99
|
+
var grouped = groupedBySection.get(_section.id);
|
|
100
|
+
if (!grouped) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
var startIndex = flattenedItems.length;
|
|
104
|
+
flattenedItems.push.apply(flattenedItems, (0, _toConsumableArray2.default)(grouped.indexes.map(function (i) {
|
|
105
|
+
return items[i];
|
|
106
|
+
})));
|
|
107
|
+
var endIndex = flattenedItems.length - 1;
|
|
108
|
+
sections.push({
|
|
109
|
+
endIndex: endIndex,
|
|
110
|
+
id: _section.id,
|
|
111
|
+
startIndex: startIndex,
|
|
112
|
+
title: _section.title
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Append items not claimed by any section and not excluded by a limit
|
|
117
|
+
} catch (err) {
|
|
118
|
+
_iterator2.e(err);
|
|
119
|
+
} finally {
|
|
120
|
+
_iterator2.f();
|
|
121
|
+
}
|
|
122
|
+
for (var i = 0; i < items.length; i++) {
|
|
123
|
+
if (!assignedToSection.has(i) && !excludedByLimit.has(i)) {
|
|
124
|
+
flattenedItems.push(items[i]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
items: flattenedItems,
|
|
129
|
+
sections: sections
|
|
130
|
+
};
|
|
131
|
+
};
|