@bpmn-io/form-js-editor 1.8.0 → 1.8.2

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/dist/index.cjs CHANGED
@@ -147,6 +147,8 @@ var slice = Array.prototype.slice;
147
147
  * var sum = eventBus.fire('sum', 1, 2);
148
148
  * console.log(sum); // 3
149
149
  * ```
150
+ *
151
+ * @template [EventMap=null]
150
152
  */
151
153
  function EventBus() {
152
154
  /**
@@ -160,6 +162,8 @@ function EventBus() {
160
162
  }
161
163
 
162
164
  /**
165
+ * @overlord
166
+ *
163
167
  * Register an event listener for events with the given name.
164
168
  *
165
169
  * The callback will be invoked with `event, ...additionalArguments`
@@ -178,6 +182,25 @@ function EventBus() {
178
182
  * @param {EventBusEventCallback<T>} callback
179
183
  * @param {any} [that] callback context
180
184
  */
185
+ /**
186
+ * Register an event listener for events with the given name.
187
+ *
188
+ * The callback will be invoked with `event, ...additionalArguments`
189
+ * that have been passed to {@link EventBus#fire}.
190
+ *
191
+ * Returning false from a listener will prevent the events default action
192
+ * (if any is specified). To stop an event from being processed further in
193
+ * other listeners execute {@link Event#stopPropagation}.
194
+ *
195
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
196
+ *
197
+ * @template {keyof EventMap} EventName
198
+ *
199
+ * @param {EventName} events to subscribe to
200
+ * @param {number} [priority=1000] listen priority
201
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
202
+ * @param {any} [that] callback context
203
+ */
181
204
  EventBus.prototype.on = function (events, priority, callback, that) {
182
205
  events = minDash.isArray(events) ? events : [events];
183
206
  if (minDash.isFunction(priority)) {
@@ -208,6 +231,8 @@ EventBus.prototype.on = function (events, priority, callback, that) {
208
231
  };
209
232
 
210
233
  /**
234
+ * @overlord
235
+ *
211
236
  * Register an event listener that is called only once.
212
237
  *
213
238
  * @template T
@@ -217,6 +242,16 @@ EventBus.prototype.on = function (events, priority, callback, that) {
217
242
  * @param {EventBusEventCallback<T>} callback
218
243
  * @param {any} [that] callback context
219
244
  */
245
+ /**
246
+ * Register an event listener that is called only once.
247
+ *
248
+ * @template {keyof EventMap} EventName
249
+ *
250
+ * @param {EventName} events to subscribe to
251
+ * @param {number} [priority=1000] listen priority
252
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
253
+ * @param {any} [that] callback context
254
+ */
220
255
  EventBus.prototype.once = function (events, priority, callback, that) {
221
256
  var self = this;
222
257
  if (minDash.isFunction(priority)) {
@@ -2888,9 +2923,9 @@ EditorActions.prototype.unregister = function (action) {
2888
2923
  };
2889
2924
 
2890
2925
  /**
2891
- * Returns the number of actions that are currently registered
2926
+ * Returns the identifiers of all currently registered editor actions
2892
2927
  *
2893
- * @return {number}
2928
+ * @return {string[]}
2894
2929
  */
2895
2930
  EditorActions.prototype.getActions = function () {
2896
2931
  return Object.keys(this._actions);
@@ -3143,7 +3178,7 @@ Keyboard.prototype._isEventIgnored = function (event) {
3143
3178
  if (event.defaultPrevented) {
3144
3179
  return true;
3145
3180
  }
3146
- return isInput(event.target) && this._isModifiedKeyIgnored(event);
3181
+ return (isInput(event.target) || isButton(event.target) && isKey([' ', 'Enter'], event)) && this._isModifiedKeyIgnored(event);
3147
3182
  };
3148
3183
  Keyboard.prototype._isModifiedKeyIgnored = function (event) {
3149
3184
  if (!isCmd(event)) {
@@ -3240,6 +3275,9 @@ Keyboard.prototype.isKey = isKey;
3240
3275
  function isInput(target) {
3241
3276
  return target && (minDom.matches(target, 'input, textarea') || target.contentEditable === 'true');
3242
3277
  }
3278
+ function isButton(target) {
3279
+ return target && minDom.matches(target, 'button, input[type=submit], input[type=button], a[href], [aria-role=button]');
3280
+ }
3243
3281
 
3244
3282
  var LOW_PRIORITY$1 = 500;
3245
3283
 
@@ -8963,6 +9001,14 @@ function textToLabel(text) {
8963
9001
  function isValidDotPath(path) {
8964
9002
  return /^\w+(\.\w+)*$/.test(path);
8965
9003
  }
9004
+
9005
+ /**
9006
+ * @param {string} path
9007
+ */
9008
+ function isProhibitedPath(path) {
9009
+ const prohibitedSegments = ['__proto__', 'prototype', 'constructor'];
9010
+ return path.split('.').some(segment => prohibitedSegments.includes(segment));
9011
+ }
8966
9012
  const LABELED_NON_INPUTS = ['button', 'group', 'dynamiclist', 'iframe', 'table'];
8967
9013
  const INPUTS = ['checkbox', 'checklist', 'datetime', 'number', 'radio', 'select', 'taglist', 'textfield', 'textarea'];
8968
9014
  const OPTIONS_INPUTS = ['checklist', 'radio', 'select', 'taglist'];
@@ -9902,6 +9948,9 @@ function Key$2(props) {
9902
9948
  if (hasIntegerPathSegment(value)) {
9903
9949
  return 'Must not contain numerical path segments.';
9904
9950
  }
9951
+ if (isProhibitedPath(value)) {
9952
+ return 'Must not be a prohibited path.';
9953
+ }
9905
9954
  const replacements = {
9906
9955
  [field.id]: value.split('.')
9907
9956
  };
@@ -9994,11 +10043,15 @@ function Path(props) {
9994
10043
  }
9995
10044
 
9996
10045
  // Check for integer segments in the path
9997
- const hasIntegerPathSegment = value.split('.').some(segment => /^\d+$/.test(segment));
9998
- if (hasIntegerPathSegment) {
10046
+ if (hasIntegerPathSegment(value)) {
9999
10047
  return 'Must not contain numerical path segments.';
10000
10048
  }
10001
10049
 
10050
+ // Check for special prohibited paths
10051
+ if (isProhibitedPath(value)) {
10052
+ return 'Must not be a prohibited path.';
10053
+ }
10054
+
10002
10055
  // Check for path collisions
10003
10056
  const options = {
10004
10057
  replacements: {