@bpmn-io/properties-panel 0.13.0 → 0.13.1
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 +5 -0
- package/dist/index.esm.js +13 -479
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -478
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,11 @@ All notable changes to [`@bpmn-io/properties-panel`](https://github.com/bpmn-io/
|
|
|
6
6
|
|
|
7
7
|
___Note:__ Yet to be released changes appear here._
|
|
8
8
|
|
|
9
|
+
## 0.13.1
|
|
10
|
+
|
|
11
|
+
* `FIX`: add accessible title for documentation ref ([#144](https://github.com/bpmn-io/properties-panel/pull/144))
|
|
12
|
+
* `FIX`: make event bus prop optional ([#143](https://github.com/bpmn-io/properties-panel/pull/143))
|
|
13
|
+
|
|
9
14
|
## 0.13.0
|
|
10
15
|
|
|
11
16
|
* `FEAT`: allow showing entries and errors through events ([#137](https://github.com/bpmn-io/properties-panel/pull/137))
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext, useEffect, useRef, useMemo, useState, useCallback } from '../preact/hooks';
|
|
2
|
-
import {
|
|
2
|
+
import { isFunction, get, assign, set, sortBy, find, isNumber, debounce } from 'min-dash';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import '../preact/compat';
|
|
5
5
|
import { jsx, jsxs } from '../preact/jsx-runtime';
|
|
@@ -153,6 +153,7 @@ function Header(props) {
|
|
|
153
153
|
rel: "noopener",
|
|
154
154
|
class: "bio-properties-panel-header-link",
|
|
155
155
|
href: documentationRef,
|
|
156
|
+
title: "Open documentation",
|
|
156
157
|
target: "_blank",
|
|
157
158
|
children: jsx(ExternalLinkIcon, {})
|
|
158
159
|
}) : null
|
|
@@ -165,480 +166,6 @@ const DescriptionContext = createContext({
|
|
|
165
166
|
getDescriptionForId: () => {}
|
|
166
167
|
});
|
|
167
168
|
|
|
168
|
-
var FN_REF = '__fn';
|
|
169
|
-
var DEFAULT_PRIORITY$1 = 1000;
|
|
170
|
-
var slice = Array.prototype.slice;
|
|
171
|
-
/**
|
|
172
|
-
* A general purpose event bus.
|
|
173
|
-
*
|
|
174
|
-
* This component is used to communicate across a diagram instance.
|
|
175
|
-
* Other parts of a diagram can use it to listen to and broadcast events.
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* ## Registering for Events
|
|
179
|
-
*
|
|
180
|
-
* The event bus provides the {@link EventBus#on} and {@link EventBus#once}
|
|
181
|
-
* methods to register for events. {@link EventBus#off} can be used to
|
|
182
|
-
* remove event registrations. Listeners receive an instance of {@link Event}
|
|
183
|
-
* as the first argument. It allows them to hook into the event execution.
|
|
184
|
-
*
|
|
185
|
-
* ```javascript
|
|
186
|
-
*
|
|
187
|
-
* // listen for event
|
|
188
|
-
* eventBus.on('foo', function(event) {
|
|
189
|
-
*
|
|
190
|
-
* // access event type
|
|
191
|
-
* event.type; // 'foo'
|
|
192
|
-
*
|
|
193
|
-
* // stop propagation to other listeners
|
|
194
|
-
* event.stopPropagation();
|
|
195
|
-
*
|
|
196
|
-
* // prevent event default
|
|
197
|
-
* event.preventDefault();
|
|
198
|
-
* });
|
|
199
|
-
*
|
|
200
|
-
* // listen for event with custom payload
|
|
201
|
-
* eventBus.on('bar', function(event, payload) {
|
|
202
|
-
* console.log(payload);
|
|
203
|
-
* });
|
|
204
|
-
*
|
|
205
|
-
* // listen for event returning value
|
|
206
|
-
* eventBus.on('foobar', function(event) {
|
|
207
|
-
*
|
|
208
|
-
* // stop event propagation + prevent default
|
|
209
|
-
* return false;
|
|
210
|
-
*
|
|
211
|
-
* // stop event propagation + return custom result
|
|
212
|
-
* return {
|
|
213
|
-
* complex: 'listening result'
|
|
214
|
-
* };
|
|
215
|
-
* });
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* // listen with custom priority (default=1000, higher is better)
|
|
219
|
-
* eventBus.on('priorityfoo', 1500, function(event) {
|
|
220
|
-
* console.log('invoked first!');
|
|
221
|
-
* });
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* // listen for event and pass the context (`this`)
|
|
225
|
-
* eventBus.on('foobar', function(event) {
|
|
226
|
-
* this.foo();
|
|
227
|
-
* }, this);
|
|
228
|
-
* ```
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
* ## Emitting Events
|
|
232
|
-
*
|
|
233
|
-
* Events can be emitted via the event bus using {@link EventBus#fire}.
|
|
234
|
-
*
|
|
235
|
-
* ```javascript
|
|
236
|
-
*
|
|
237
|
-
* // false indicates that the default action
|
|
238
|
-
* // was prevented by listeners
|
|
239
|
-
* if (eventBus.fire('foo') === false) {
|
|
240
|
-
* console.log('default has been prevented!');
|
|
241
|
-
* };
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* // custom args + return value listener
|
|
245
|
-
* eventBus.on('sum', function(event, a, b) {
|
|
246
|
-
* return a + b;
|
|
247
|
-
* });
|
|
248
|
-
*
|
|
249
|
-
* // you can pass custom arguments + retrieve result values.
|
|
250
|
-
* var sum = eventBus.fire('sum', 1, 2);
|
|
251
|
-
* console.log(sum); // 3
|
|
252
|
-
* ```
|
|
253
|
-
*/
|
|
254
|
-
|
|
255
|
-
function EventBus() {
|
|
256
|
-
this._listeners = {}; // cleanup on destroy on lowest priority to allow
|
|
257
|
-
// message passing until the bitter end
|
|
258
|
-
|
|
259
|
-
this.on('diagram.destroy', 1, this._destroy, this);
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Register an event listener for events with the given name.
|
|
263
|
-
*
|
|
264
|
-
* The callback will be invoked with `event, ...additionalArguments`
|
|
265
|
-
* that have been passed to {@link EventBus#fire}.
|
|
266
|
-
*
|
|
267
|
-
* Returning false from a listener will prevent the events default action
|
|
268
|
-
* (if any is specified). To stop an event from being processed further in
|
|
269
|
-
* other listeners execute {@link Event#stopPropagation}.
|
|
270
|
-
*
|
|
271
|
-
* Returning anything but `undefined` from a listener will stop the listener propagation.
|
|
272
|
-
*
|
|
273
|
-
* @param {string|Array<string>} events
|
|
274
|
-
* @param {number} [priority=1000] the priority in which this listener is called, larger is higher
|
|
275
|
-
* @param {Function} callback
|
|
276
|
-
* @param {Object} [that] Pass context (`this`) to the callback
|
|
277
|
-
*/
|
|
278
|
-
|
|
279
|
-
EventBus.prototype.on = function (events, priority, callback, that) {
|
|
280
|
-
events = isArray(events) ? events : [events];
|
|
281
|
-
|
|
282
|
-
if (isFunction(priority)) {
|
|
283
|
-
that = callback;
|
|
284
|
-
callback = priority;
|
|
285
|
-
priority = DEFAULT_PRIORITY$1;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
if (!isNumber(priority)) {
|
|
289
|
-
throw new Error('priority must be a number');
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
var actualCallback = callback;
|
|
293
|
-
|
|
294
|
-
if (that) {
|
|
295
|
-
actualCallback = bind(callback, that); // make sure we remember and are able to remove
|
|
296
|
-
// bound callbacks via {@link #off} using the original
|
|
297
|
-
// callback
|
|
298
|
-
|
|
299
|
-
actualCallback[FN_REF] = callback[FN_REF] || callback;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
var self = this;
|
|
303
|
-
events.forEach(function (e) {
|
|
304
|
-
self._addListener(e, {
|
|
305
|
-
priority: priority,
|
|
306
|
-
callback: actualCallback,
|
|
307
|
-
next: null
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
};
|
|
311
|
-
/**
|
|
312
|
-
* Register an event listener that is executed only once.
|
|
313
|
-
*
|
|
314
|
-
* @param {string} event the event name to register for
|
|
315
|
-
* @param {number} [priority=1000] the priority in which this listener is called, larger is higher
|
|
316
|
-
* @param {Function} callback the callback to execute
|
|
317
|
-
* @param {Object} [that] Pass context (`this`) to the callback
|
|
318
|
-
*/
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
EventBus.prototype.once = function (event, priority, callback, that) {
|
|
322
|
-
var self = this;
|
|
323
|
-
|
|
324
|
-
if (isFunction(priority)) {
|
|
325
|
-
that = callback;
|
|
326
|
-
callback = priority;
|
|
327
|
-
priority = DEFAULT_PRIORITY$1;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
if (!isNumber(priority)) {
|
|
331
|
-
throw new Error('priority must be a number');
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function wrappedCallback() {
|
|
335
|
-
wrappedCallback.__isTomb = true;
|
|
336
|
-
var result = callback.apply(that, arguments);
|
|
337
|
-
self.off(event, wrappedCallback);
|
|
338
|
-
return result;
|
|
339
|
-
} // make sure we remember and are able to remove
|
|
340
|
-
// bound callbacks via {@link #off} using the original
|
|
341
|
-
// callback
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
wrappedCallback[FN_REF] = callback;
|
|
345
|
-
this.on(event, priority, wrappedCallback);
|
|
346
|
-
};
|
|
347
|
-
/**
|
|
348
|
-
* Removes event listeners by event and callback.
|
|
349
|
-
*
|
|
350
|
-
* If no callback is given, all listeners for a given event name are being removed.
|
|
351
|
-
*
|
|
352
|
-
* @param {string|Array<string>} events
|
|
353
|
-
* @param {Function} [callback]
|
|
354
|
-
*/
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
EventBus.prototype.off = function (events, callback) {
|
|
358
|
-
events = isArray(events) ? events : [events];
|
|
359
|
-
var self = this;
|
|
360
|
-
events.forEach(function (event) {
|
|
361
|
-
self._removeListener(event, callback);
|
|
362
|
-
});
|
|
363
|
-
};
|
|
364
|
-
/**
|
|
365
|
-
* Create an EventBus event.
|
|
366
|
-
*
|
|
367
|
-
* @param {Object} data
|
|
368
|
-
*
|
|
369
|
-
* @return {Object} event, recognized by the eventBus
|
|
370
|
-
*/
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
EventBus.prototype.createEvent = function (data) {
|
|
374
|
-
var event = new InternalEvent();
|
|
375
|
-
event.init(data);
|
|
376
|
-
return event;
|
|
377
|
-
};
|
|
378
|
-
/**
|
|
379
|
-
* Fires a named event.
|
|
380
|
-
*
|
|
381
|
-
* @example
|
|
382
|
-
*
|
|
383
|
-
* // fire event by name
|
|
384
|
-
* events.fire('foo');
|
|
385
|
-
*
|
|
386
|
-
* // fire event object with nested type
|
|
387
|
-
* var event = { type: 'foo' };
|
|
388
|
-
* events.fire(event);
|
|
389
|
-
*
|
|
390
|
-
* // fire event with explicit type
|
|
391
|
-
* var event = { x: 10, y: 20 };
|
|
392
|
-
* events.fire('element.moved', event);
|
|
393
|
-
*
|
|
394
|
-
* // pass additional arguments to the event
|
|
395
|
-
* events.on('foo', function(event, bar) {
|
|
396
|
-
* alert(bar);
|
|
397
|
-
* });
|
|
398
|
-
*
|
|
399
|
-
* events.fire({ type: 'foo' }, 'I am bar!');
|
|
400
|
-
*
|
|
401
|
-
* @param {string} [name] the optional event name
|
|
402
|
-
* @param {Object} [event] the event object
|
|
403
|
-
* @param {...Object} additional arguments to be passed to the callback functions
|
|
404
|
-
*
|
|
405
|
-
* @return {boolean} the events return value, if specified or false if the
|
|
406
|
-
* default action was prevented by listeners
|
|
407
|
-
*/
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
EventBus.prototype.fire = function (type, data) {
|
|
411
|
-
var event, firstListener, returnValue, args;
|
|
412
|
-
args = slice.call(arguments);
|
|
413
|
-
|
|
414
|
-
if (typeof type === 'object') {
|
|
415
|
-
data = type;
|
|
416
|
-
type = data.type;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
if (!type) {
|
|
420
|
-
throw new Error('no event type specified');
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
firstListener = this._listeners[type];
|
|
424
|
-
|
|
425
|
-
if (!firstListener) {
|
|
426
|
-
return;
|
|
427
|
-
} // we make sure we fire instances of our home made
|
|
428
|
-
// events here. We wrap them only once, though
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
if (data instanceof InternalEvent) {
|
|
432
|
-
// we are fine, we alread have an event
|
|
433
|
-
event = data;
|
|
434
|
-
} else {
|
|
435
|
-
event = this.createEvent(data);
|
|
436
|
-
} // ensure we pass the event as the first parameter
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
args[0] = event; // original event type (in case we delegate)
|
|
440
|
-
|
|
441
|
-
var originalType = event.type; // update event type before delegation
|
|
442
|
-
|
|
443
|
-
if (type !== originalType) {
|
|
444
|
-
event.type = type;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
try {
|
|
448
|
-
returnValue = this._invokeListeners(event, args, firstListener);
|
|
449
|
-
} finally {
|
|
450
|
-
// reset event type after delegation
|
|
451
|
-
if (type !== originalType) {
|
|
452
|
-
event.type = originalType;
|
|
453
|
-
}
|
|
454
|
-
} // set the return value to false if the event default
|
|
455
|
-
// got prevented and no other return value exists
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
if (returnValue === undefined && event.defaultPrevented) {
|
|
459
|
-
returnValue = false;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
return returnValue;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
EventBus.prototype.handleError = function (error) {
|
|
466
|
-
return this.fire('error', {
|
|
467
|
-
error: error
|
|
468
|
-
}) === false;
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
EventBus.prototype._destroy = function () {
|
|
472
|
-
this._listeners = {};
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
EventBus.prototype._invokeListeners = function (event, args, listener) {
|
|
476
|
-
var returnValue;
|
|
477
|
-
|
|
478
|
-
while (listener) {
|
|
479
|
-
// handle stopped propagation
|
|
480
|
-
if (event.cancelBubble) {
|
|
481
|
-
break;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
returnValue = this._invokeListener(event, args, listener);
|
|
485
|
-
listener = listener.next;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
return returnValue;
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
EventBus.prototype._invokeListener = function (event, args, listener) {
|
|
492
|
-
var returnValue;
|
|
493
|
-
|
|
494
|
-
if (listener.callback.__isTomb) {
|
|
495
|
-
return returnValue;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
try {
|
|
499
|
-
// returning false prevents the default action
|
|
500
|
-
returnValue = invokeFunction(listener.callback, args); // stop propagation on return value
|
|
501
|
-
|
|
502
|
-
if (returnValue !== undefined) {
|
|
503
|
-
event.returnValue = returnValue;
|
|
504
|
-
event.stopPropagation();
|
|
505
|
-
} // prevent default on return false
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
if (returnValue === false) {
|
|
509
|
-
event.preventDefault();
|
|
510
|
-
}
|
|
511
|
-
} catch (error) {
|
|
512
|
-
if (!this.handleError(error)) {
|
|
513
|
-
console.error('unhandled error in event listener', error);
|
|
514
|
-
throw error;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
return returnValue;
|
|
519
|
-
};
|
|
520
|
-
/*
|
|
521
|
-
* Add new listener with a certain priority to the list
|
|
522
|
-
* of listeners (for the given event).
|
|
523
|
-
*
|
|
524
|
-
* The semantics of listener registration / listener execution are
|
|
525
|
-
* first register, first serve: New listeners will always be inserted
|
|
526
|
-
* after existing listeners with the same priority.
|
|
527
|
-
*
|
|
528
|
-
* Example: Inserting two listeners with priority 1000 and 1300
|
|
529
|
-
*
|
|
530
|
-
* * before: [ 1500, 1500, 1000, 1000 ]
|
|
531
|
-
* * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
|
|
532
|
-
*
|
|
533
|
-
* @param {string} event
|
|
534
|
-
* @param {Object} listener { priority, callback }
|
|
535
|
-
*/
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
EventBus.prototype._addListener = function (event, newListener) {
|
|
539
|
-
var listener = this._getListeners(event),
|
|
540
|
-
previousListener; // no prior listeners
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
if (!listener) {
|
|
544
|
-
this._setListeners(event, newListener);
|
|
545
|
-
|
|
546
|
-
return;
|
|
547
|
-
} // ensure we order listeners by priority from
|
|
548
|
-
// 0 (high) to n > 0 (low)
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
while (listener) {
|
|
552
|
-
if (listener.priority < newListener.priority) {
|
|
553
|
-
newListener.next = listener;
|
|
554
|
-
|
|
555
|
-
if (previousListener) {
|
|
556
|
-
previousListener.next = newListener;
|
|
557
|
-
} else {
|
|
558
|
-
this._setListeners(event, newListener);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
previousListener = listener;
|
|
565
|
-
listener = listener.next;
|
|
566
|
-
} // add new listener to back
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
previousListener.next = newListener;
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
EventBus.prototype._getListeners = function (name) {
|
|
573
|
-
return this._listeners[name];
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
EventBus.prototype._setListeners = function (name, listener) {
|
|
577
|
-
this._listeners[name] = listener;
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
EventBus.prototype._removeListener = function (event, callback) {
|
|
581
|
-
var listener = this._getListeners(event),
|
|
582
|
-
nextListener,
|
|
583
|
-
previousListener,
|
|
584
|
-
listenerCallback;
|
|
585
|
-
|
|
586
|
-
if (!callback) {
|
|
587
|
-
// clear listeners
|
|
588
|
-
this._setListeners(event, null);
|
|
589
|
-
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
while (listener) {
|
|
594
|
-
nextListener = listener.next;
|
|
595
|
-
listenerCallback = listener.callback;
|
|
596
|
-
|
|
597
|
-
if (listenerCallback === callback || listenerCallback[FN_REF] === callback) {
|
|
598
|
-
if (previousListener) {
|
|
599
|
-
previousListener.next = nextListener;
|
|
600
|
-
} else {
|
|
601
|
-
// new first listener
|
|
602
|
-
this._setListeners(event, nextListener);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
previousListener = listener;
|
|
607
|
-
listener = nextListener;
|
|
608
|
-
}
|
|
609
|
-
};
|
|
610
|
-
/**
|
|
611
|
-
* A event that is emitted via the event bus.
|
|
612
|
-
*/
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
function InternalEvent() {}
|
|
616
|
-
|
|
617
|
-
InternalEvent.prototype.stopPropagation = function () {
|
|
618
|
-
this.cancelBubble = true;
|
|
619
|
-
};
|
|
620
|
-
|
|
621
|
-
InternalEvent.prototype.preventDefault = function () {
|
|
622
|
-
this.defaultPrevented = true;
|
|
623
|
-
};
|
|
624
|
-
|
|
625
|
-
InternalEvent.prototype.init = function (data) {
|
|
626
|
-
assign(this, data || {});
|
|
627
|
-
};
|
|
628
|
-
/**
|
|
629
|
-
* Invoke function. Be fast...
|
|
630
|
-
*
|
|
631
|
-
* @param {Function} fn
|
|
632
|
-
* @param {Array<Object>} args
|
|
633
|
-
*
|
|
634
|
-
* @return {Any}
|
|
635
|
-
*/
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
function invokeFunction(fn, args) {
|
|
639
|
-
return fn.apply(null, args);
|
|
640
|
-
}
|
|
641
|
-
|
|
642
169
|
/**
|
|
643
170
|
* @typedef {Function} <propertiesPanel.showEntry> callback
|
|
644
171
|
*
|
|
@@ -653,9 +180,8 @@ function invokeFunction(fn, args) {
|
|
|
653
180
|
*
|
|
654
181
|
* @returns void
|
|
655
182
|
*/
|
|
656
|
-
const eventBus = new EventBus();
|
|
657
183
|
const EventContext = createContext({
|
|
658
|
-
eventBus
|
|
184
|
+
eventBus: null
|
|
659
185
|
});
|
|
660
186
|
|
|
661
187
|
const LayoutContext = createContext({
|
|
@@ -704,9 +230,13 @@ function useEvent(event, callback, priority = DEFAULT_PRIORITY) {
|
|
|
704
230
|
eventBus
|
|
705
231
|
} = useContext(EventContext);
|
|
706
232
|
useEffect(() => {
|
|
233
|
+
if (!eventBus) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
707
237
|
eventBus.on(event, priority, callback);
|
|
708
238
|
return () => eventBus.off(event, callback);
|
|
709
|
-
}, [event, eventBus,
|
|
239
|
+
}, [callback, event, eventBus, priority]);
|
|
710
240
|
}
|
|
711
241
|
|
|
712
242
|
const HIGH_PRIORITY = 10000;
|
|
@@ -912,7 +442,10 @@ function useShowErrorEvent(show) {
|
|
|
912
442
|
setTemporaryError(null);
|
|
913
443
|
|
|
914
444
|
if (show(event)) {
|
|
915
|
-
eventBus
|
|
445
|
+
if (eventBus) {
|
|
446
|
+
eventBus.fire('propertiesPanel.showEntry', event);
|
|
447
|
+
}
|
|
448
|
+
|
|
916
449
|
setTemporaryError(event.message);
|
|
917
450
|
}
|
|
918
451
|
}, [show]);
|
|
@@ -1065,6 +598,7 @@ const bufferedEvents = ['propertiesPanel.showEntry', 'propertiesPanel.showError'
|
|
|
1065
598
|
* @param {Function} [props.layoutChanged]
|
|
1066
599
|
* @param {DescriptionConfig} [props.descriptionConfig]
|
|
1067
600
|
* @param {Function} [props.descriptionLoaded]
|
|
601
|
+
* @param {Object} [props.eventBus]
|
|
1068
602
|
*/
|
|
1069
603
|
|
|
1070
604
|
function PropertiesPanel(props) {
|