@gravity-ui/dashkit 8.2.0 → 8.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/build/cjs/shared/modules/state-and-params.d.ts +2 -1
- package/build/cjs/shared/modules/state-and-params.js +18 -4
- package/build/cjs/utils/update-manager.d.ts +8 -1
- package/build/cjs/utils/update-manager.js +28 -13
- package/build/esm/shared/modules/state-and-params.d.ts +2 -1
- package/build/esm/shared/modules/state-and-params.js +18 -4
- package/build/esm/utils/update-manager.d.ts +8 -1
- package/build/esm/utils/update-manager.js +26 -12
- package/package.json +1 -1
|
@@ -5,9 +5,10 @@ export interface GetItemsParamsArg {
|
|
|
5
5
|
config: Config;
|
|
6
6
|
itemsStateAndParams: ItemsStateAndParams;
|
|
7
7
|
plugins: PluginBase[];
|
|
8
|
+
useStateAsInitial?: boolean;
|
|
8
9
|
}
|
|
9
10
|
type GetItemsParamsReturn = Record<string, StringParams | Record<string, StringParams>>;
|
|
10
|
-
export declare function getItemsParams({ defaultGlobalParams, globalParams, config, itemsStateAndParams, plugins, }: GetItemsParamsArg): GetItemsParamsReturn;
|
|
11
|
+
export declare function getItemsParams({ defaultGlobalParams, globalParams, config, itemsStateAndParams, plugins, useStateAsInitial, }: GetItemsParamsArg): GetItemsParamsReturn;
|
|
11
12
|
export declare function getItemsState({ config, itemsStateAndParams, }: {
|
|
12
13
|
config: Config;
|
|
13
14
|
itemsStateAndParams: ItemsStateAndParams;
|
|
@@ -5,7 +5,18 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const groupBy_1 = tslib_1.__importDefault(require("lodash/groupBy"));
|
|
6
6
|
const constants_1 = require("../constants");
|
|
7
7
|
const helpers_1 = require("./helpers");
|
|
8
|
-
|
|
8
|
+
const getParamsFromStateAndParams = ({ itemsStateAndParams, parentItemId, item, }) => {
|
|
9
|
+
const widgetId = parentItemId || item.id;
|
|
10
|
+
if (!(widgetId in itemsStateAndParams)) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
const stateAndParams = itemsStateAndParams;
|
|
14
|
+
const itemParams = parentItemId
|
|
15
|
+
? Object.assign({}, stateAndParams[widgetId].params[item.id])
|
|
16
|
+
: Object.assign({}, stateAndParams[widgetId].params);
|
|
17
|
+
return itemParams;
|
|
18
|
+
};
|
|
19
|
+
function getItemParams({ item, itemsStateAndParams, mapItemsIgnores, itemsWithDefaultsByNamespace, getMergedParams, defaultGlobalParams, globalParams, isFirstVersion, queueData, parentItemId, useStateAsInitial, }) {
|
|
9
20
|
var _a, _b;
|
|
10
21
|
const { id, namespace } = item;
|
|
11
22
|
let defaultWidgetParams = {};
|
|
@@ -24,7 +35,9 @@ function getItemParams({ item, itemsStateAndParams, mapItemsIgnores, itemsWithDe
|
|
|
24
35
|
// default parameters to begin with
|
|
25
36
|
affectingItemsWithDefaults.reduceRight((defaultParams, itemWithDefaults) => {
|
|
26
37
|
return Object.assign(Object.assign({}, defaultParams), getMergedParams(itemWithDefaults.defaults || {}));
|
|
27
|
-
}, {}), getMergedParams(globalParams)
|
|
38
|
+
}, {}), getMergedParams(globalParams), useStateAsInitial
|
|
39
|
+
? getParamsFromStateAndParams({ parentItemId, item, itemsStateAndParams })
|
|
40
|
+
: {});
|
|
28
41
|
if (isFirstVersion) {
|
|
29
42
|
itemParams = Object.assign(itemParams, ((_b = itemsStateAndParams === null || itemsStateAndParams === void 0 ? void 0 : itemsStateAndParams[id]) === null || _b === void 0 ? void 0 : _b.params) || {});
|
|
30
43
|
}
|
|
@@ -49,7 +62,7 @@ function getItemParams({ item, itemsStateAndParams, mapItemsIgnores, itemsWithDe
|
|
|
49
62
|
}
|
|
50
63
|
return Object.assign(Object.assign({}, defaultWidgetParams), itemParams);
|
|
51
64
|
}
|
|
52
|
-
function getItemsParams({ defaultGlobalParams = {}, globalParams = {}, config, itemsStateAndParams, plugins, }) {
|
|
65
|
+
function getItemsParams({ defaultGlobalParams = {}, globalParams = {}, config, itemsStateAndParams, plugins, useStateAsInitial, }) {
|
|
53
66
|
const { aliases, connections } = config;
|
|
54
67
|
const items = (0, helpers_1.prerenderItems)({ items: config.items, plugins });
|
|
55
68
|
const isFirstVersion = (0, helpers_1.getCurrentVersion)(itemsStateAndParams) === 1;
|
|
@@ -92,10 +105,11 @@ function getItemsParams({ defaultGlobalParams = {}, globalParams = {}, config, i
|
|
|
92
105
|
globalParams,
|
|
93
106
|
isFirstVersion,
|
|
94
107
|
queueData,
|
|
108
|
+
useStateAsInitial,
|
|
95
109
|
};
|
|
96
110
|
if ((0, helpers_1.isItemWithGroup)(item)) {
|
|
97
111
|
const groupParams = item.data.group.reduce((groupItemParams, groupItem) => {
|
|
98
|
-
groupItemParams[groupItem.id] = getItemParams(Object.assign({ item: groupItem }, paramsOptions));
|
|
112
|
+
groupItemParams[groupItem.id] = getItemParams(Object.assign({ item: groupItem, parentItemId: item.id }, paramsOptions));
|
|
99
113
|
return groupItemParams;
|
|
100
114
|
}, {});
|
|
101
115
|
return Object.assign(Object.assign({}, itemsParams), { [id]: groupParams });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, ConfigItem, ItemStateAndParams, ItemStateAndParamsChangeOptions, ItemsStateAndParams } from '../shared';
|
|
1
|
+
import type { Config, ConfigItem, ConfigItemGroup, ItemStateAndParams, ItemStateAndParamsChangeOptions, ItemsStateAndParams } from '../shared';
|
|
2
2
|
import type { AddConfigItem, SetItemOptions, SetNewItemOptions, WidgetLayout } from '../typings';
|
|
3
3
|
import { RegisterManagerPluginLayout } from './register-manager';
|
|
4
4
|
interface RemoveItemArg {
|
|
@@ -13,6 +13,13 @@ interface ChangeStateAndParamsArg {
|
|
|
13
13
|
stateAndParams: ItemStateAndParams;
|
|
14
14
|
options?: ItemStateAndParamsChangeOptions;
|
|
15
15
|
}
|
|
16
|
+
export declare const getChangedParams: ({ initiatorItem, stateAndParams, itemsStateAndParams, }: {
|
|
17
|
+
initiatorItem: ConfigItem | ConfigItemGroup;
|
|
18
|
+
stateAndParams: ItemStateAndParams;
|
|
19
|
+
itemsStateAndParams: ItemsStateAndParams;
|
|
20
|
+
}) => {
|
|
21
|
+
[x: string]: string | string[];
|
|
22
|
+
};
|
|
16
23
|
export declare class UpdateManager {
|
|
17
24
|
static addItem({ item, namespace, layout, config, options, }: {
|
|
18
25
|
item: AddConfigItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateManager = void 0;
|
|
3
|
+
exports.UpdateManager = exports.getChangedParams = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const immutability_helper_1 = tslib_1.__importStar(require("immutability-helper"));
|
|
6
6
|
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
@@ -78,6 +78,12 @@ function getAllowableChangedParams(item, stateAndParams, itemsStateAndParams, pa
|
|
|
78
78
|
: allowedParams;
|
|
79
79
|
}
|
|
80
80
|
const stateParamsConf = stateAndParams.params;
|
|
81
|
+
// check if structure is StringParams or Record<string, StringParams>
|
|
82
|
+
// if it's Record<string, StringParams>, then this is a group application of params
|
|
83
|
+
// and checking for comparison of allowedParams and stateParamsConf is not necessary
|
|
84
|
+
const isGroupParamsApply = typeof (stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id]) === 'object' &&
|
|
85
|
+
(stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id]) !== null &&
|
|
86
|
+
!Array.isArray(stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id]);
|
|
81
87
|
if ((0, shared_1.isItemWithTabs)(item)) {
|
|
82
88
|
let tab;
|
|
83
89
|
if ('state' in stateAndParams && ((_a = stateAndParams.state) === null || _a === void 0 ? void 0 : _a.tabId)) {
|
|
@@ -90,14 +96,11 @@ function getAllowableChangedParams(item, stateAndParams, itemsStateAndParams, pa
|
|
|
90
96
|
allowedParams = (0, pick_1.default)(stateParamsConf, Object.keys((tab === null || tab === void 0 ? void 0 : tab.params) || {}));
|
|
91
97
|
}
|
|
92
98
|
else {
|
|
93
|
-
|
|
94
|
-
const paramsConf = typeof (stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id]) === 'object' &&
|
|
95
|
-
!Array.isArray(stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id])
|
|
96
|
-
? stateParamsConf[item.id]
|
|
97
|
-
: stateParamsConf;
|
|
99
|
+
const paramsConf = isGroupParamsApply ? stateParamsConf[item.id] : stateParamsConf;
|
|
98
100
|
allowedParams = (0, pick_1.default)(paramsConf, Object.keys(item.defaults || {}));
|
|
99
101
|
}
|
|
100
|
-
if (
|
|
102
|
+
if (!isGroupParamsApply &&
|
|
103
|
+
Object.keys(allowedParams || {}).length !== Object.keys(stateParamsConf || {}).length) {
|
|
101
104
|
console.warn('Параметры, которых нет в defaults, будут проигнорированы!');
|
|
102
105
|
}
|
|
103
106
|
return allowedParams;
|
|
@@ -180,6 +183,12 @@ function getNewItemData({ item, config, counter: argsCounter, salt, options }) {
|
|
|
180
183
|
}
|
|
181
184
|
return { data, counter, excludeIds };
|
|
182
185
|
}
|
|
186
|
+
const getChangedParams = ({ initiatorItem, stateAndParams, itemsStateAndParams, }) => {
|
|
187
|
+
const allowableParams = getAllowableChangedParams(initiatorItem, stateAndParams, itemsStateAndParams);
|
|
188
|
+
const allowableActionParams = getAllowableChangedParams(initiatorItem, stateAndParams, itemsStateAndParams, { type: 'actionParams', returnPrefix: true });
|
|
189
|
+
return Object.assign(Object.assign({}, allowableParams), allowableActionParams);
|
|
190
|
+
};
|
|
191
|
+
exports.getChangedParams = getChangedParams;
|
|
183
192
|
function changeGroupParams({ groupItemIds, initiatorId, initiatorItem, itemsStateAndParams, stateAndParams, config, unusedIds, }) {
|
|
184
193
|
var _a;
|
|
185
194
|
const meta = (0, shared_1.addGroupToQueue)({
|
|
@@ -192,9 +201,12 @@ function changeGroupParams({ groupItemIds, initiatorId, initiatorItem, itemsStat
|
|
|
192
201
|
const currentItemParams = (_a = itemsStateAndParams[initiatorId]) === null || _a === void 0 ? void 0 : _a.params;
|
|
193
202
|
for (const groupItem of initiatorItem.data.group) {
|
|
194
203
|
if (groupItemIds.includes(groupItem.id)) {
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
204
|
+
const changedParams = (0, exports.getChangedParams)({
|
|
205
|
+
initiatorItem: groupItem,
|
|
206
|
+
stateAndParams,
|
|
207
|
+
itemsStateAndParams,
|
|
208
|
+
});
|
|
209
|
+
updatedItems[groupItem.id] = changedParams;
|
|
198
210
|
continue;
|
|
199
211
|
}
|
|
200
212
|
if (currentItemParams && currentItemParams[groupItem.id]) {
|
|
@@ -354,8 +366,11 @@ class UpdateManager {
|
|
|
354
366
|
});
|
|
355
367
|
}
|
|
356
368
|
if ('params' in stateAndParams) {
|
|
357
|
-
const
|
|
358
|
-
|
|
369
|
+
const changedParams = (0, exports.getChangedParams)({
|
|
370
|
+
initiatorItem,
|
|
371
|
+
stateAndParams,
|
|
372
|
+
itemsStateAndParams,
|
|
373
|
+
});
|
|
359
374
|
const tabId = (0, shared_1.isItemWithTabs)(initiatorItem)
|
|
360
375
|
? newTabId || (0, shared_1.resolveItemInnerId)({ item: initiatorItem, itemsStateAndParams })
|
|
361
376
|
: undefined;
|
|
@@ -370,7 +385,7 @@ class UpdateManager {
|
|
|
370
385
|
$unset: unusedIds,
|
|
371
386
|
[initiatorId]: {
|
|
372
387
|
$auto: Object.assign({ params: {
|
|
373
|
-
[commandUpdateParams]:
|
|
388
|
+
[commandUpdateParams]: changedParams,
|
|
374
389
|
} }, (hasState ? { state: { $set: stateAndParams.state } } : {})),
|
|
375
390
|
},
|
|
376
391
|
[shared_1.META_KEY]: { $set: meta },
|
|
@@ -5,9 +5,10 @@ export interface GetItemsParamsArg {
|
|
|
5
5
|
config: Config;
|
|
6
6
|
itemsStateAndParams: ItemsStateAndParams;
|
|
7
7
|
plugins: PluginBase[];
|
|
8
|
+
useStateAsInitial?: boolean;
|
|
8
9
|
}
|
|
9
10
|
type GetItemsParamsReturn = Record<string, StringParams | Record<string, StringParams>>;
|
|
10
|
-
export declare function getItemsParams({ defaultGlobalParams, globalParams, config, itemsStateAndParams, plugins, }: GetItemsParamsArg): GetItemsParamsReturn;
|
|
11
|
+
export declare function getItemsParams({ defaultGlobalParams, globalParams, config, itemsStateAndParams, plugins, useStateAsInitial, }: GetItemsParamsArg): GetItemsParamsReturn;
|
|
11
12
|
export declare function getItemsState({ config, itemsStateAndParams, }: {
|
|
12
13
|
config: Config;
|
|
13
14
|
itemsStateAndParams: ItemsStateAndParams;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import groupBy from 'lodash/groupBy';
|
|
2
2
|
import { META_KEY } from '../constants';
|
|
3
3
|
import { formQueueData, getCurrentVersion, getMapItemsIgnores, hasActionParam, isItemWithGroup, isItemWithTabs, mergeParamsWithAliases, pickActionParamsFromParams, pickExceptActionParamsFromParams, prerenderItems, resolveItemInnerId, } from './helpers';
|
|
4
|
-
|
|
4
|
+
const getParamsFromStateAndParams = ({ itemsStateAndParams, parentItemId, item, }) => {
|
|
5
|
+
const widgetId = parentItemId || item.id;
|
|
6
|
+
if (!(widgetId in itemsStateAndParams)) {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
const stateAndParams = itemsStateAndParams;
|
|
10
|
+
const itemParams = parentItemId
|
|
11
|
+
? Object.assign({}, stateAndParams[widgetId].params[item.id])
|
|
12
|
+
: Object.assign({}, stateAndParams[widgetId].params);
|
|
13
|
+
return itemParams;
|
|
14
|
+
};
|
|
15
|
+
function getItemParams({ item, itemsStateAndParams, mapItemsIgnores, itemsWithDefaultsByNamespace, getMergedParams, defaultGlobalParams, globalParams, isFirstVersion, queueData, parentItemId, useStateAsInitial, }) {
|
|
5
16
|
var _a, _b;
|
|
6
17
|
const { id, namespace } = item;
|
|
7
18
|
let defaultWidgetParams = {};
|
|
@@ -20,7 +31,9 @@ function getItemParams({ item, itemsStateAndParams, mapItemsIgnores, itemsWithDe
|
|
|
20
31
|
// default parameters to begin with
|
|
21
32
|
affectingItemsWithDefaults.reduceRight((defaultParams, itemWithDefaults) => {
|
|
22
33
|
return Object.assign(Object.assign({}, defaultParams), getMergedParams(itemWithDefaults.defaults || {}));
|
|
23
|
-
}, {}), getMergedParams(globalParams)
|
|
34
|
+
}, {}), getMergedParams(globalParams), useStateAsInitial
|
|
35
|
+
? getParamsFromStateAndParams({ parentItemId, item, itemsStateAndParams })
|
|
36
|
+
: {});
|
|
24
37
|
if (isFirstVersion) {
|
|
25
38
|
itemParams = Object.assign(itemParams, ((_b = itemsStateAndParams === null || itemsStateAndParams === void 0 ? void 0 : itemsStateAndParams[id]) === null || _b === void 0 ? void 0 : _b.params) || {});
|
|
26
39
|
}
|
|
@@ -45,7 +58,7 @@ function getItemParams({ item, itemsStateAndParams, mapItemsIgnores, itemsWithDe
|
|
|
45
58
|
}
|
|
46
59
|
return Object.assign(Object.assign({}, defaultWidgetParams), itemParams);
|
|
47
60
|
}
|
|
48
|
-
export function getItemsParams({ defaultGlobalParams = {}, globalParams = {}, config, itemsStateAndParams, plugins, }) {
|
|
61
|
+
export function getItemsParams({ defaultGlobalParams = {}, globalParams = {}, config, itemsStateAndParams, plugins, useStateAsInitial, }) {
|
|
49
62
|
const { aliases, connections } = config;
|
|
50
63
|
const items = prerenderItems({ items: config.items, plugins });
|
|
51
64
|
const isFirstVersion = getCurrentVersion(itemsStateAndParams) === 1;
|
|
@@ -88,10 +101,11 @@ export function getItemsParams({ defaultGlobalParams = {}, globalParams = {}, co
|
|
|
88
101
|
globalParams,
|
|
89
102
|
isFirstVersion,
|
|
90
103
|
queueData,
|
|
104
|
+
useStateAsInitial,
|
|
91
105
|
};
|
|
92
106
|
if (isItemWithGroup(item)) {
|
|
93
107
|
const groupParams = item.data.group.reduce((groupItemParams, groupItem) => {
|
|
94
|
-
groupItemParams[groupItem.id] = getItemParams(Object.assign({ item: groupItem }, paramsOptions));
|
|
108
|
+
groupItemParams[groupItem.id] = getItemParams(Object.assign({ item: groupItem, parentItemId: item.id }, paramsOptions));
|
|
95
109
|
return groupItemParams;
|
|
96
110
|
}, {});
|
|
97
111
|
return Object.assign(Object.assign({}, itemsParams), { [id]: groupParams });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, ConfigItem, ItemStateAndParams, ItemStateAndParamsChangeOptions, ItemsStateAndParams } from '../shared';
|
|
1
|
+
import type { Config, ConfigItem, ConfigItemGroup, ItemStateAndParams, ItemStateAndParamsChangeOptions, ItemsStateAndParams } from '../shared';
|
|
2
2
|
import type { AddConfigItem, SetItemOptions, SetNewItemOptions, WidgetLayout } from '../typings';
|
|
3
3
|
import { RegisterManagerPluginLayout } from './register-manager';
|
|
4
4
|
interface RemoveItemArg {
|
|
@@ -13,6 +13,13 @@ interface ChangeStateAndParamsArg {
|
|
|
13
13
|
stateAndParams: ItemStateAndParams;
|
|
14
14
|
options?: ItemStateAndParamsChangeOptions;
|
|
15
15
|
}
|
|
16
|
+
export declare const getChangedParams: ({ initiatorItem, stateAndParams, itemsStateAndParams, }: {
|
|
17
|
+
initiatorItem: ConfigItem | ConfigItemGroup;
|
|
18
|
+
stateAndParams: ItemStateAndParams;
|
|
19
|
+
itemsStateAndParams: ItemsStateAndParams;
|
|
20
|
+
}) => {
|
|
21
|
+
[x: string]: string | string[];
|
|
22
|
+
};
|
|
16
23
|
export declare class UpdateManager {
|
|
17
24
|
static addItem({ item, namespace, layout, config, options, }: {
|
|
18
25
|
item: AddConfigItem;
|
|
@@ -74,6 +74,12 @@ function getAllowableChangedParams(item, stateAndParams, itemsStateAndParams, pa
|
|
|
74
74
|
: allowedParams;
|
|
75
75
|
}
|
|
76
76
|
const stateParamsConf = stateAndParams.params;
|
|
77
|
+
// check if structure is StringParams or Record<string, StringParams>
|
|
78
|
+
// if it's Record<string, StringParams>, then this is a group application of params
|
|
79
|
+
// and checking for comparison of allowedParams and stateParamsConf is not necessary
|
|
80
|
+
const isGroupParamsApply = typeof (stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id]) === 'object' &&
|
|
81
|
+
(stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id]) !== null &&
|
|
82
|
+
!Array.isArray(stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id]);
|
|
77
83
|
if (isItemWithTabs(item)) {
|
|
78
84
|
let tab;
|
|
79
85
|
if ('state' in stateAndParams && ((_a = stateAndParams.state) === null || _a === void 0 ? void 0 : _a.tabId)) {
|
|
@@ -86,14 +92,11 @@ function getAllowableChangedParams(item, stateAndParams, itemsStateAndParams, pa
|
|
|
86
92
|
allowedParams = pick(stateParamsConf, Object.keys((tab === null || tab === void 0 ? void 0 : tab.params) || {}));
|
|
87
93
|
}
|
|
88
94
|
else {
|
|
89
|
-
|
|
90
|
-
const paramsConf = typeof (stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id]) === 'object' &&
|
|
91
|
-
!Array.isArray(stateParamsConf === null || stateParamsConf === void 0 ? void 0 : stateParamsConf[item.id])
|
|
92
|
-
? stateParamsConf[item.id]
|
|
93
|
-
: stateParamsConf;
|
|
95
|
+
const paramsConf = isGroupParamsApply ? stateParamsConf[item.id] : stateParamsConf;
|
|
94
96
|
allowedParams = pick(paramsConf, Object.keys(item.defaults || {}));
|
|
95
97
|
}
|
|
96
|
-
if (
|
|
98
|
+
if (!isGroupParamsApply &&
|
|
99
|
+
Object.keys(allowedParams || {}).length !== Object.keys(stateParamsConf || {}).length) {
|
|
97
100
|
console.warn('Параметры, которых нет в defaults, будут проигнорированы!');
|
|
98
101
|
}
|
|
99
102
|
return allowedParams;
|
|
@@ -176,6 +179,11 @@ function getNewItemData({ item, config, counter: argsCounter, salt, options }) {
|
|
|
176
179
|
}
|
|
177
180
|
return { data, counter, excludeIds };
|
|
178
181
|
}
|
|
182
|
+
export const getChangedParams = ({ initiatorItem, stateAndParams, itemsStateAndParams, }) => {
|
|
183
|
+
const allowableParams = getAllowableChangedParams(initiatorItem, stateAndParams, itemsStateAndParams);
|
|
184
|
+
const allowableActionParams = getAllowableChangedParams(initiatorItem, stateAndParams, itemsStateAndParams, { type: 'actionParams', returnPrefix: true });
|
|
185
|
+
return Object.assign(Object.assign({}, allowableParams), allowableActionParams);
|
|
186
|
+
};
|
|
179
187
|
function changeGroupParams({ groupItemIds, initiatorId, initiatorItem, itemsStateAndParams, stateAndParams, config, unusedIds, }) {
|
|
180
188
|
var _a;
|
|
181
189
|
const meta = addGroupToQueue({
|
|
@@ -188,9 +196,12 @@ function changeGroupParams({ groupItemIds, initiatorId, initiatorItem, itemsStat
|
|
|
188
196
|
const currentItemParams = (_a = itemsStateAndParams[initiatorId]) === null || _a === void 0 ? void 0 : _a.params;
|
|
189
197
|
for (const groupItem of initiatorItem.data.group) {
|
|
190
198
|
if (groupItemIds.includes(groupItem.id)) {
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
199
|
+
const changedParams = getChangedParams({
|
|
200
|
+
initiatorItem: groupItem,
|
|
201
|
+
stateAndParams,
|
|
202
|
+
itemsStateAndParams,
|
|
203
|
+
});
|
|
204
|
+
updatedItems[groupItem.id] = changedParams;
|
|
194
205
|
continue;
|
|
195
206
|
}
|
|
196
207
|
if (currentItemParams && currentItemParams[groupItem.id]) {
|
|
@@ -350,8 +361,11 @@ export class UpdateManager {
|
|
|
350
361
|
});
|
|
351
362
|
}
|
|
352
363
|
if ('params' in stateAndParams) {
|
|
353
|
-
const
|
|
354
|
-
|
|
364
|
+
const changedParams = getChangedParams({
|
|
365
|
+
initiatorItem,
|
|
366
|
+
stateAndParams,
|
|
367
|
+
itemsStateAndParams,
|
|
368
|
+
});
|
|
355
369
|
const tabId = isItemWithTabs(initiatorItem)
|
|
356
370
|
? newTabId || resolveItemInnerId({ item: initiatorItem, itemsStateAndParams })
|
|
357
371
|
: undefined;
|
|
@@ -366,7 +380,7 @@ export class UpdateManager {
|
|
|
366
380
|
$unset: unusedIds,
|
|
367
381
|
[initiatorId]: {
|
|
368
382
|
$auto: Object.assign({ params: {
|
|
369
|
-
[commandUpdateParams]:
|
|
383
|
+
[commandUpdateParams]: changedParams,
|
|
370
384
|
} }, (hasState ? { state: { $set: stateAndParams.state } } : {})),
|
|
371
385
|
},
|
|
372
386
|
[META_KEY]: { $set: meta },
|