@acorex/platform 20.8.4 → 20.8.5
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.
|
@@ -111,6 +111,28 @@ const AXP_ENTITY_ACTION_PLUGIN = new InjectionToken('AXP_ENTITY_ACTION_PLUGIN');
|
|
|
111
111
|
function createModifierContext(entity) {
|
|
112
112
|
const ctx = {
|
|
113
113
|
entity,
|
|
114
|
+
plugins: {
|
|
115
|
+
list: () => entity.plugins ?? [],
|
|
116
|
+
add: (...items) => {
|
|
117
|
+
entity.plugins ??= [];
|
|
118
|
+
entity.plugins.push(...items);
|
|
119
|
+
return ctx;
|
|
120
|
+
},
|
|
121
|
+
remove: (predicate) => {
|
|
122
|
+
if (entity.plugins)
|
|
123
|
+
entity.plugins = entity.plugins.filter((p) => !predicate(p));
|
|
124
|
+
return ctx;
|
|
125
|
+
},
|
|
126
|
+
find: (name) => ({
|
|
127
|
+
get: () => entity.plugins?.find((p) => p.name === name),
|
|
128
|
+
update: (updater) => {
|
|
129
|
+
const index = entity.plugins?.findIndex((p) => p.name === name);
|
|
130
|
+
if (index !== undefined && index !== -1 && entity.plugins)
|
|
131
|
+
entity.plugins[index] = updater(entity.plugins[index]);
|
|
132
|
+
return ctx;
|
|
133
|
+
},
|
|
134
|
+
}),
|
|
135
|
+
},
|
|
114
136
|
title: {
|
|
115
137
|
get: () => entity.title,
|
|
116
138
|
set: (newTitle) => {
|