@bpmn-io/form-js-viewer 1.15.2 → 1.16.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/dist/index.cjs CHANGED
@@ -549,6 +549,8 @@ const SECURITY_ATTRIBUTES_DEFINITIONS = [{
549
549
  label: 'Storage access by user'
550
550
  }];
551
551
 
552
+ const TEXT_VIEW_DEFAULT_TEXT = '# Text';
553
+
552
554
  function createInjector(bootstrapModules) {
553
555
  const injector = new didi.Injector(bootstrapModules);
554
556
  injector.init();
@@ -3878,6 +3880,9 @@ function Numberfield(props) {
3878
3880
  e.preventDefault();
3879
3881
  return;
3880
3882
  }
3883
+ if (e.code === 'Enter') {
3884
+ flushOnChange && flushOnChange();
3885
+ }
3881
3886
  };
3882
3887
 
3883
3888
  // intercept key presses which would lead to an invalid number
@@ -5016,7 +5021,7 @@ Text.config = {
5016
5021
  name: 'Text view',
5017
5022
  group: 'presentation',
5018
5023
  create: (options = {}) => ({
5019
- text: '# Text',
5024
+ text: TEXT_VIEW_DEFAULT_TEXT,
5020
5025
  ...options
5021
5026
  }),
5022
5027
  getSubheading: field => {
@@ -5187,6 +5192,11 @@ function Textfield(props) {
5187
5192
  const onInputFocus = () => {
5188
5193
  onFocus && onFocus();
5189
5194
  };
5195
+ const onKeyDown = e => {
5196
+ if (e.code === 'Enter') {
5197
+ flushOnChange && flushOnChange();
5198
+ }
5199
+ };
5190
5200
  const descriptionId = `${domId}-description`;
5191
5201
  const errorMessageId = `${domId}-error-message`;
5192
5202
  return jsxRuntime.jsxs("div", {
@@ -5212,6 +5222,7 @@ function Textfield(props) {
5212
5222
  onInput: onInputChange,
5213
5223
  onBlur: onInputBlur,
5214
5224
  onFocus: onInputFocus,
5225
+ onKeyDown: onKeyDown,
5215
5226
  type: "text",
5216
5227
  value: value,
5217
5228
  "aria-describedby": [descriptionId, errorMessageId].join(' '),
@@ -5749,7 +5760,10 @@ function serializeCellData(cellData) {
5749
5760
  if (cellData !== null && typeof cellData === 'object') {
5750
5761
  return JSON.stringify(cellData);
5751
5762
  }
5752
- return `${cellData || ''}`;
5763
+ if (cellData === null || cellData === undefined) {
5764
+ return '';
5765
+ }
5766
+ return `${cellData}`;
5753
5767
  }
5754
5768
 
5755
5769
  const FILE_PICKER_FILE_KEY_PREFIX = 'files::';
@@ -7971,7 +7985,7 @@ EventBus.prototype.once = function (events, priority, callback, that) {
7971
7985
  * If no callback is given, all listeners for a given event name are being removed.
7972
7986
  *
7973
7987
  * @param {string|string[]} events
7974
- * @param {EventBusEventCallback} [callback]
7988
+ * @param {EventBusEventCallback<unknown>} [callback]
7975
7989
  */
7976
7990
  EventBus.prototype.off = function (events, callback) {
7977
7991
  events = minDash.isArray(events) ? events : [events];
@@ -8359,7 +8373,7 @@ function runNumberValidation(field, value) {
8359
8373
  function runPresetValidation(field, validation, value) {
8360
8374
  const errors = [];
8361
8375
  if (validation.pattern && value && !new RegExp(validation.pattern).test(value)) {
8362
- errors.push(`Field must match pattern ${validation.pattern}.`);
8376
+ errors.push(validation.patternErrorMessage || `Field must match pattern ${validation.pattern}.`);
8363
8377
  }
8364
8378
  if (validation.required) {
8365
8379
  const isUncheckedCheckbox = field.type === 'checkbox' && value === false;
@@ -9837,7 +9851,7 @@ class Form {
9837
9851
  }
9838
9852
  }
9839
9853
 
9840
- const schemaVersion = 18;
9854
+ const schemaVersion = 19;
9841
9855
 
9842
9856
  /**
9843
9857
  * @typedef { import('./types').CreateFormOptions } CreateFormOptions
@@ -9920,6 +9934,7 @@ exports.SECURITY_ATTRIBUTES_DEFINITIONS = SECURITY_ATTRIBUTES_DEFINITIONS;
9920
9934
  exports.Select = Select;
9921
9935
  exports.Separator = Separator;
9922
9936
  exports.Spacer = Spacer;
9937
+ exports.TEXT_VIEW_DEFAULT_TEXT = TEXT_VIEW_DEFAULT_TEXT;
9923
9938
  exports.TIME_INTERVAL_PATH = TIME_INTERVAL_PATH;
9924
9939
  exports.TIME_LABEL_PATH = TIME_LABEL_PATH;
9925
9940
  exports.TIME_SERIALISINGFORMAT_LABELS = TIME_SERIALISINGFORMAT_LABELS;