@bpmn-io/form-js-playground 0.8.0 → 0.9.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.
@@ -3442,10 +3442,10 @@
3442
3442
  injector.init();
3443
3443
  return injector;
3444
3444
  }
3445
- /**
3446
- * @param {string?} prefix
3447
- *
3448
- * @returns Element
3445
+ /**
3446
+ * @param {string?} prefix
3447
+ *
3448
+ * @returns Element
3449
3449
  */
3450
3450
 
3451
3451
 
@@ -3482,11 +3482,11 @@
3482
3482
  function generateIdForType(type) {
3483
3483
  return `${type}${generateIndexForType(type)}`;
3484
3484
  }
3485
- /**
3486
- * @template T
3487
- * @param {T} data
3488
- * @param {(this: any, key: string, value: any) => any} [replacer]
3489
- * @return {T}
3485
+ /**
3486
+ * @template T
3487
+ * @param {T} data
3488
+ * @param {(this: any, key: string, value: any) => any} [replacer]
3489
+ * @return {T}
3490
3490
  */
3491
3491
 
3492
3492
 
@@ -3495,24 +3495,24 @@
3495
3495
  }
3496
3496
 
3497
3497
  class Importer$1 {
3498
- /**
3499
- * @constructor
3500
- * @param { import('../core').FormFieldRegistry } formFieldRegistry
3501
- * @param { import('../render/FormFields').default } formFields
3498
+ /**
3499
+ * @constructor
3500
+ * @param { import('../core').FormFieldRegistry } formFieldRegistry
3501
+ * @param { import('../render/FormFields').default } formFields
3502
3502
  */
3503
3503
  constructor(formFieldRegistry, formFields) {
3504
3504
  this._formFieldRegistry = formFieldRegistry;
3505
3505
  this._formFields = formFields;
3506
3506
  }
3507
- /**
3508
- * Import schema adding `id`, `_parent` and `_path`
3509
- * information to each field and adding it to the
3510
- * form field registry.
3511
- *
3512
- * @param {any} schema
3513
- * @param {any} [data]
3514
- *
3515
- * @return { { warnings: Array<any>, schema: any, data: any } }
3507
+ /**
3508
+ * Import schema adding `id`, `_parent` and `_path`
3509
+ * information to each field and adding it to the
3510
+ * form field registry.
3511
+ *
3512
+ * @param {any} schema
3513
+ * @param {any} [data]
3514
+ *
3515
+ * @return { { warnings: Array<any>, schema: any, data: any } }
3516
3516
  */
3517
3517
 
3518
3518
 
@@ -3533,11 +3533,11 @@
3533
3533
  throw err;
3534
3534
  }
3535
3535
  }
3536
- /**
3537
- * @param {any} formField
3538
- * @param {string} [parentId]
3539
- *
3540
- * @return {any} importedField
3536
+ /**
3537
+ * @param {any} formField
3538
+ * @param {string} [parentId]
3539
+ *
3540
+ * @return {any} importedField
3541
3541
  */
3542
3542
 
3543
3543
 
@@ -3599,10 +3599,10 @@
3599
3599
  this.importFormField(component, parentId);
3600
3600
  });
3601
3601
  }
3602
- /**
3603
- * @param {Object} data
3604
- *
3605
- * @return {Object} importedData
3602
+ /**
3603
+ * @param {Object} data
3604
+ *
3605
+ * @return {Object} importedData
3606
3606
  */
3607
3607
 
3608
3608
 
@@ -3662,11 +3662,11 @@
3662
3662
  const ATTR_WHITESPACE_PATTERN = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g; // eslint-disable-line no-control-regex
3663
3663
 
3664
3664
  const FORM_ELEMENT = document.createElement('form');
3665
- /**
3666
- * Sanitize a HTML string and return the cleaned, safe version.
3667
- *
3668
- * @param {string} html
3669
- * @return {string}
3665
+ /**
3666
+ * Sanitize a HTML string and return the cleaned, safe version.
3667
+ *
3668
+ * @param {string} html
3669
+ * @return {string}
3670
3670
  */
3671
3671
 
3672
3672
  function sanitizeHTML(html) {
@@ -3685,15 +3685,15 @@
3685
3685
  return '';
3686
3686
  }
3687
3687
  }
3688
- /**
3689
- * Recursively sanitize a HTML node, potentially
3690
- * removing it, its children or attributes.
3691
- *
3692
- * Inspired by https://github.com/developit/snarkdown/issues/70
3693
- * and https://github.com/cure53/DOMPurify. Simplified
3694
- * for our use-case.
3695
- *
3696
- * @param {Element} node
3688
+ /**
3689
+ * Recursively sanitize a HTML node, potentially
3690
+ * removing it, its children or attributes.
3691
+ *
3692
+ * Inspired by https://github.com/developit/snarkdown/issues/70
3693
+ * and https://github.com/cure53/DOMPurify. Simplified
3694
+ * for our use-case.
3695
+ *
3696
+ * @param {Element} node
3697
3697
  */
3698
3698
 
3699
3699
 
@@ -3741,13 +3741,13 @@
3741
3741
  node.childNodes[i]);
3742
3742
  }
3743
3743
  }
3744
- /**
3745
- * Validates attributes for validity.
3746
- *
3747
- * @param {string} lcTag
3748
- * @param {string} lcName
3749
- * @param {string} value
3750
- * @return {boolean}
3744
+ /**
3745
+ * Validates attributes for validity.
3746
+ *
3747
+ * @param {string} lcTag
3748
+ * @param {string} lcName
3749
+ * @param {string} value
3750
+ * @return {boolean}
3751
3751
  */
3752
3752
 
3753
3753
 
@@ -3891,11 +3891,11 @@
3891
3891
  return props.children;
3892
3892
  }
3893
3893
  });
3894
- /**
3895
- * @param {string} type
3896
- * @param {boolean} [strict]
3897
- *
3898
- * @returns {any}
3894
+ /**
3895
+ * @param {string} type
3896
+ * @param {boolean} [strict]
3897
+ *
3898
+ * @returns {any}
3899
3899
  */
3900
3900
 
3901
3901
  function getService$2(type, strict) {}
@@ -4026,8 +4026,8 @@
4026
4026
  } = F$1(FormContext);
4027
4027
  return getService(type, strict);
4028
4028
  }
4029
- /**
4030
- * @enum { String }
4029
+ /**
4030
+ * @enum { String }
4031
4031
  */
4032
4032
 
4033
4033
 
@@ -4036,17 +4036,17 @@
4036
4036
  LOADED: 'loaded',
4037
4037
  ERROR: 'error'
4038
4038
  };
4039
- /**
4040
- * @typedef {Object} ValuesGetter
4041
- * @property {Object[]} values - The values data
4042
- * @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
4039
+ /**
4040
+ * @typedef {Object} ValuesGetter
4041
+ * @property {Object[]} values - The values data
4042
+ * @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
4043
4043
  */
4044
4044
 
4045
- /**
4046
- * A hook to load values for single and multiselect components.
4047
- *
4048
- * @param {Object} field - The form field to handle values for
4049
- * @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
4045
+ /**
4046
+ * A hook to load values for single and multiselect components.
4047
+ *
4048
+ * @param {Object} field - The form field to handle values for
4049
+ * @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
4050
4050
  */
4051
4051
 
4052
4052
  function useValuesAsync(field) {
@@ -4249,10 +4249,10 @@
4249
4249
 
4250
4250
  Default.type = 'default';
4251
4251
  Default.keyed = false;
4252
- /**
4253
- * This file must not be changed or exchanged.
4254
- *
4255
- * @see http://bpmn.io/license for more information.
4252
+ /**
4253
+ * This file must not be changed or exchanged.
4254
+ *
4255
+ * @see http://bpmn.io/license for more information.
4256
4256
  */
4257
4257
 
4258
4258
  function Logo() {
@@ -7142,10 +7142,10 @@
7142
7142
  function invokeFunction(fn, args) {
7143
7143
  return fn.apply(null, args);
7144
7144
  }
7145
- /**
7146
- * A factory to create a configurable debouncer.
7147
- *
7148
- * @param {number|boolean} [config=true]
7145
+ /**
7146
+ * A factory to create a configurable debouncer.
7147
+ *
7148
+ * @param {number|boolean} [config=true]
7149
7149
  */
7150
7150
 
7151
7151
 
@@ -7162,11 +7162,11 @@
7162
7162
  DebounceFactory.$inject = ['config.debounce'];
7163
7163
 
7164
7164
  class FieldFactory {
7165
- /**
7166
- * @constructor
7167
- *
7168
- * @param { import('./FormFieldRegistry').default } formFieldRegistry
7169
- * @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
7165
+ /**
7166
+ * @constructor
7167
+ *
7168
+ * @param { import('./FormFieldRegistry').default } formFieldRegistry
7169
+ * @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
7170
7170
  */
7171
7171
  constructor(formFieldRegistry, formFields) {
7172
7172
  this._formFieldRegistry = formFieldRegistry;
@@ -7244,11 +7244,11 @@
7244
7244
  FieldFactory.$inject = ['formFieldRegistry', 'formFields'];
7245
7245
 
7246
7246
  class FormFieldRegistry extends FormFieldRegistry$1 {
7247
- /**
7248
- * Updates a form fields id.
7249
- *
7250
- * @param {Object} formField
7251
- * @param {string} newId
7247
+ /**
7248
+ * Updates a form fields id.
7249
+ *
7250
+ * @param {Object} formField
7251
+ * @param {string} newId
7252
7252
  */
7253
7253
  updateId(formField, newId) {
7254
7254
  this._validateId(newId);
@@ -7269,13 +7269,13 @@
7269
7269
  }
7270
7270
  }
7271
7271
  }
7272
- /**
7273
- * Validate the suitability of the given id and signals a problem
7274
- * with an exception.
7275
- *
7276
- * @param {string} id
7277
- *
7278
- * @throws {Error} if id is empty or already assigned
7272
+ /**
7273
+ * Validate the suitability of the given id and signals a problem
7274
+ * with an exception.
7275
+ *
7276
+ * @param {string} id
7277
+ *
7278
+ * @throws {Error} if id is empty or already assigned
7279
7279
  */
7280
7280
 
7281
7281
 
@@ -7292,30 +7292,30 @@
7292
7292
  }
7293
7293
 
7294
7294
  class Importer {
7295
- /**
7296
- * @constructor
7297
- * @param { import('../core/FormFieldRegistry').default } formFieldRegistry
7298
- * @param { import('../core/FieldFactory').default } fieldFactory
7295
+ /**
7296
+ * @constructor
7297
+ * @param { import('../core/FormFieldRegistry').default } formFieldRegistry
7298
+ * @param { import('../core/FieldFactory').default } fieldFactory
7299
7299
  */
7300
7300
  constructor(formFieldRegistry, fieldFactory) {
7301
7301
  this._formFieldRegistry = formFieldRegistry;
7302
7302
  this._fieldFactory = fieldFactory;
7303
7303
  }
7304
- /**
7305
- * Import schema creating fields, attaching additional
7306
- * information to each field and adding fields to the
7307
- * field registry.
7308
- *
7309
- * Additional information attached:
7310
- *
7311
- * * `id` (unless present)
7312
- * * `_parent`
7313
- * * `_path`
7314
- *
7315
- * @param {any} schema
7316
- *
7317
- * @typedef {{ warnings: Error[], schema: any }} ImportResult
7318
- * @returns {ImportResult}
7304
+ /**
7305
+ * Import schema creating fields, attaching additional
7306
+ * information to each field and adding fields to the
7307
+ * field registry.
7308
+ *
7309
+ * Additional information attached:
7310
+ *
7311
+ * * `id` (unless present)
7312
+ * * `_parent`
7313
+ * * `_path`
7314
+ *
7315
+ * @param {any} schema
7316
+ *
7317
+ * @typedef {{ warnings: Error[], schema: any }} ImportResult
7318
+ * @returns {ImportResult}
7319
7319
  */
7320
7320
 
7321
7321
 
@@ -7334,12 +7334,12 @@
7334
7334
  throw err;
7335
7335
  }
7336
7336
  }
7337
- /**
7338
- * @param {{[x: string]: any}} fieldAttrs
7339
- * @param {String} [parentId]
7340
- * @param {number} [index]
7341
- *
7342
- * @return {any} field
7337
+ /**
7338
+ * @param {{[x: string]: any}} fieldAttrs
7339
+ * @param {String} [parentId]
7340
+ * @param {number} [index]
7341
+ *
7342
+ * @return {any} field
7343
7343
  */
7344
7344
 
7345
7345
 
@@ -7381,11 +7381,11 @@
7381
7381
 
7382
7382
  return field;
7383
7383
  }
7384
- /**
7385
- * @param {Array<any>} components
7386
- * @param {string} parentId
7387
- *
7388
- * @return {Array<any>} imported components
7384
+ /**
7385
+ * @param {Array<any>} components
7386
+ * @param {string} parentId
7387
+ *
7388
+ * @return {Array<any>} imported components
7389
7389
  */
7390
7390
 
7391
7391
 
@@ -7404,11 +7404,11 @@
7404
7404
  const DragAndDropContext = D$1({
7405
7405
  drake: null
7406
7406
  });
7407
- /**
7408
- * @param {string} type
7409
- * @param {boolean} [strict]
7410
- *
7411
- * @returns {any}
7407
+ /**
7408
+ * @param {string} type
7409
+ * @param {boolean} [strict]
7410
+ *
7411
+ * @returns {any}
7412
7412
  */
7413
7413
 
7414
7414
  function getService$1(type, strict) {}
@@ -8935,10 +8935,10 @@
8935
8935
  }
8936
8936
 
8937
8937
  class AddFormFieldHandler {
8938
- /**
8939
- * @constructor
8940
- * @param { import('../../../FormEditor').default } formEditor
8941
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8938
+ /**
8939
+ * @constructor
8940
+ * @param { import('../../../FormEditor').default } formEditor
8941
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8942
8942
  */
8943
8943
  constructor(formEditor, formFieldRegistry) {
8944
8944
  this._formEditor = formEditor;
@@ -9001,10 +9001,10 @@
9001
9001
  AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
9002
9002
 
9003
9003
  class EditFormFieldHandler {
9004
- /**
9005
- * @constructor
9006
- * @param { import('../../../FormEditor').default } formEditor
9007
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9004
+ /**
9005
+ * @constructor
9006
+ * @param { import('../../../FormEditor').default } formEditor
9007
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9008
9008
  */
9009
9009
  constructor(formEditor, formFieldRegistry) {
9010
9010
  this._formEditor = formEditor;
@@ -9080,10 +9080,10 @@
9080
9080
  EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
9081
9081
 
9082
9082
  class MoveFormFieldHandler {
9083
- /**
9084
- * @constructor
9085
- * @param { import('../../../FormEditor').default } formEditor
9086
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9083
+ /**
9084
+ * @constructor
9085
+ * @param { import('../../../FormEditor').default } formEditor
9086
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9087
9087
  */
9088
9088
  constructor(formEditor, formFieldRegistry) {
9089
9089
  this._formEditor = formEditor;
@@ -9163,10 +9163,10 @@
9163
9163
  MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
9164
9164
 
9165
9165
  class RemoveFormFieldHandler {
9166
- /**
9167
- * @constructor
9168
- * @param { import('../../../FormEditor').default } formEditor
9169
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9166
+ /**
9167
+ * @constructor
9168
+ * @param { import('../../../FormEditor').default } formEditor
9169
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9170
9170
  */
9171
9171
  constructor(formEditor, formFieldRegistry) {
9172
9172
  this._formEditor = formEditor;
@@ -9228,9 +9228,9 @@
9228
9228
  RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
9229
9229
 
9230
9230
  class UpdateIdClaimHandler {
9231
- /**
9232
- * @constructor
9233
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9231
+ /**
9232
+ * @constructor
9233
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9234
9234
  */
9235
9235
  constructor(formFieldRegistry) {
9236
9236
  this._formFieldRegistry = formFieldRegistry;
@@ -9269,9 +9269,9 @@
9269
9269
  UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
9270
9270
 
9271
9271
  class UpdateKeyClaimHandler {
9272
- /**
9273
- * @constructor
9274
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9272
+ /**
9273
+ * @constructor
9274
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
9275
9275
  */
9276
9276
  constructor(formFieldRegistry) {
9277
9277
  this._formFieldRegistry = formFieldRegistry;
@@ -10267,7 +10267,7 @@
10267
10267
  height: "36",
10268
10268
  viewBox: "0 0 54 54"
10269
10269
  }) : null, e$1("span", {
10270
- class: "fjs-palette-field-text fjs-hide-compact",
10270
+ class: "fjs-palette-field-text",
10271
10271
  children: label
10272
10272
  })]
10273
10273
  });
@@ -10292,10 +10292,10 @@
10292
10292
  this._render();
10293
10293
  });
10294
10294
  }
10295
- /**
10296
- * Attach the palette to a parent node.
10297
- *
10298
- * @param {HTMLElement} container
10295
+ /**
10296
+ * Attach the palette to a parent node.
10297
+ *
10298
+ * @param {HTMLElement} container
10299
10299
  */
10300
10300
 
10301
10301
 
@@ -10315,8 +10315,8 @@
10315
10315
 
10316
10316
  this._eventBus.fire('palette.attach');
10317
10317
  }
10318
- /**
10319
- * Detach the palette from its parent node.
10318
+ /**
10319
+ * Detach the palette from its parent node.
10320
10320
  */
10321
10321
 
10322
10322
 
@@ -11971,11 +11971,11 @@
11971
11971
  function prefixId$1(id) {
11972
11972
  return `bio-properties-panel-${id}`;
11973
11973
  }
11974
- /**
11975
- * @param {string} type
11976
- * @param {boolean} [strict]
11977
- *
11978
- * @returns {any}
11974
+ /**
11975
+ * @param {string} type
11976
+ * @param {boolean} [strict]
11977
+ *
11978
+ * @returns {any}
11979
11979
  */
11980
11980
 
11981
11981
 
@@ -12051,8 +12051,8 @@
12051
12051
  return labelsByType[type];
12052
12052
  }
12053
12053
  };
12054
- /**
12055
- * Provide placeholders for empty and multiple state.
12054
+ /**
12055
+ * Provide placeholders for empty and multiple state.
12056
12056
  */
12057
12057
 
12058
12058
  const PropertiesPanelPlaceholderProvider = {
@@ -12935,14 +12935,14 @@
12935
12935
  });
12936
12936
  } // helpers //////////
12937
12937
 
12938
- /**
12939
- * Returns copy of object with updated value.
12940
- *
12941
- * @param {Object} properties
12942
- * @param {string} key
12943
- * @param {string} value
12944
- *
12945
- * @returns {Object}
12938
+ /**
12939
+ * Returns copy of object with updated value.
12940
+ *
12941
+ * @param {Object} properties
12942
+ * @param {string} key
12943
+ * @param {string} value
12944
+ *
12945
+ * @returns {Object}
12946
12946
  */
12947
12947
 
12948
12948
 
@@ -12951,14 +12951,14 @@
12951
12951
  [key]: value
12952
12952
  };
12953
12953
  }
12954
- /**
12955
- * Returns copy of object with updated key.
12956
- *
12957
- * @param {Object} properties
12958
- * @param {string} oldKey
12959
- * @param {string} newKey
12960
- *
12961
- * @returns {Object}
12954
+ /**
12955
+ * Returns copy of object with updated key.
12956
+ *
12957
+ * @param {Object} properties
12958
+ * @param {string} oldKey
12959
+ * @param {string} newKey
12960
+ *
12961
+ * @returns {Object}
12962
12962
  */
12963
12963
 
12964
12964
 
@@ -13398,8 +13398,8 @@
13398
13398
  field
13399
13399
  };
13400
13400
  const valuesSourceId = `${fieldId}-valuesSource`;
13401
- /**
13402
- * @type {Array<Group|ListGroup>}
13401
+ /**
13402
+ * @type {Array<Group|ListGroup>}
13403
13403
  */
13404
13404
 
13405
13405
  const groups = [{
@@ -13504,13 +13504,13 @@
13504
13504
  };
13505
13505
  } // helpers //////////
13506
13506
 
13507
- /**
13508
- * Returns copy of object without key.
13509
- *
13510
- * @param {Object} properties
13511
- * @param {string} oldKey
13512
- *
13513
- * @returns {Object}
13507
+ /**
13508
+ * Returns copy of object without key.
13509
+ *
13510
+ * @param {Object} properties
13511
+ * @param {string} oldKey
13512
+ *
13513
+ * @returns {Object}
13514
13514
  */
13515
13515
 
13516
13516
 
@@ -13577,9 +13577,9 @@
13577
13577
  }, []);
13578
13578
  h(() => {
13579
13579
  const onFieldChanged = () => {
13580
- /**
13581
- * TODO(pinussilvestrus): update with actual updated element,
13582
- * once we have a proper updater/change support
13580
+ /**
13581
+ * TODO(pinussilvestrus): update with actual updated element,
13582
+ * once we have a proper updater/change support
13583
13583
  */
13584
13584
  _update(selection.get() || schema);
13585
13585
  };
@@ -13637,10 +13637,10 @@
13637
13637
  this._render();
13638
13638
  });
13639
13639
  }
13640
- /**
13641
- * Attach the properties panel to a parent node.
13642
- *
13643
- * @param {HTMLElement} container
13640
+ /**
13641
+ * Attach the properties panel to a parent node.
13642
+ *
13643
+ * @param {HTMLElement} container
13644
13644
  */
13645
13645
 
13646
13646
 
@@ -13660,8 +13660,8 @@
13660
13660
 
13661
13661
  this._eventBus.fire('propertiesPanel.attach');
13662
13662
  }
13663
- /**
13664
- * Detach the properties panel from its parent node.
13663
+ /**
13664
+ * Detach the properties panel from its parent node.
13665
13665
  */
13666
13666
 
13667
13667
 
@@ -13700,48 +13700,48 @@
13700
13700
  propertiesPanel: ['type', PropertiesPanelRenderer]
13701
13701
  };
13702
13702
  const ids = new Ids([32, 36, 1]);
13703
- /**
13704
- * @typedef { import('./types').Injector } Injector
13705
- * @typedef { import('./types').Module } Module
13706
- * @typedef { import('./types').Schema } Schema
13707
- *
13708
- * @typedef { import('./types').FormEditorOptions } FormEditorOptions
13709
- * @typedef { import('./types').FormEditorProperties } FormEditorProperties
13710
- *
13711
- * @typedef { {
13712
- * properties: FormEditorProperties,
13713
- * schema: Schema
13714
- * } } State
13715
- *
13716
- * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
13717
- * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
13718
- * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
13703
+ /**
13704
+ * @typedef { import('./types').Injector } Injector
13705
+ * @typedef { import('./types').Module } Module
13706
+ * @typedef { import('./types').Schema } Schema
13707
+ *
13708
+ * @typedef { import('./types').FormEditorOptions } FormEditorOptions
13709
+ * @typedef { import('./types').FormEditorProperties } FormEditorProperties
13710
+ *
13711
+ * @typedef { {
13712
+ * properties: FormEditorProperties,
13713
+ * schema: Schema
13714
+ * } } State
13715
+ *
13716
+ * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
13717
+ * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
13718
+ * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
13719
13719
  */
13720
13720
 
13721
- /**
13722
- * The form editor.
13721
+ /**
13722
+ * The form editor.
13723
13723
  */
13724
13724
 
13725
13725
  class FormEditor {
13726
- /**
13727
- * @constructor
13728
- * @param {FormEditorOptions} options
13726
+ /**
13727
+ * @constructor
13728
+ * @param {FormEditorOptions} options
13729
13729
  */
13730
13730
  constructor(options = {}) {
13731
- /**
13732
- * @public
13733
- * @type {OnEventType}
13731
+ /**
13732
+ * @public
13733
+ * @type {OnEventType}
13734
13734
  */
13735
13735
  this.on = this._onEvent;
13736
- /**
13737
- * @public
13738
- * @type {String}
13736
+ /**
13737
+ * @public
13738
+ * @type {String}
13739
13739
  */
13740
13740
 
13741
13741
  this._id = ids.next();
13742
- /**
13743
- * @private
13744
- * @type {Element}
13742
+ /**
13743
+ * @private
13744
+ * @type {Element}
13745
13745
  */
13746
13746
 
13747
13747
  this._container = createFormContainer();
@@ -13754,15 +13754,15 @@
13754
13754
  injector = this._createInjector(options, this._container),
13755
13755
  properties = {}
13756
13756
  } = options;
13757
- /**
13758
- * @private
13759
- * @type {any}
13757
+ /**
13758
+ * @private
13759
+ * @type {any}
13760
13760
  */
13761
13761
 
13762
13762
  this.exporter = exporter;
13763
- /**
13764
- * @private
13765
- * @type {State}
13763
+ /**
13764
+ * @private
13765
+ * @type {State}
13766
13766
  */
13767
13767
 
13768
13768
  this._state = {
@@ -13794,10 +13794,10 @@
13794
13794
 
13795
13795
  this._detach(false);
13796
13796
  }
13797
- /**
13798
- * @param {Schema} schema
13799
- *
13800
- * @return {Promise<{ warnings: Array<any> }>}
13797
+ /**
13798
+ * @param {Schema} schema
13799
+ *
13800
+ * @return {Promise<{ warnings: Array<any> }>}
13801
13801
  */
13802
13802
 
13803
13803
 
@@ -13831,16 +13831,16 @@
13831
13831
  }
13832
13832
  });
13833
13833
  }
13834
- /**
13835
- * @returns {Schema}
13834
+ /**
13835
+ * @returns {Schema}
13836
13836
  */
13837
13837
 
13838
13838
 
13839
13839
  saveSchema() {
13840
13840
  return this.getSchema();
13841
13841
  }
13842
- /**
13843
- * @returns {Schema}
13842
+ /**
13843
+ * @returns {Schema}
13844
13844
  */
13845
13845
 
13846
13846
 
@@ -13851,8 +13851,8 @@
13851
13851
 
13852
13852
  return exportSchema(schema, this.exporter, schemaVersion);
13853
13853
  }
13854
- /**
13855
- * @param {Element|string} parentNode
13854
+ /**
13855
+ * @param {Element|string} parentNode
13856
13856
  */
13857
13857
 
13858
13858
 
@@ -13876,10 +13876,10 @@
13876
13876
  detach() {
13877
13877
  this._detach();
13878
13878
  }
13879
- /**
13880
- * @internal
13881
- *
13882
- * @param {boolean} [emit]
13879
+ /**
13880
+ * @internal
13881
+ *
13882
+ * @param {boolean} [emit]
13883
13883
  */
13884
13884
 
13885
13885
 
@@ -13897,9 +13897,9 @@
13897
13897
 
13898
13898
  parentNode.removeChild(container);
13899
13899
  }
13900
- /**
13901
- * @param {any} property
13902
- * @param {any} value
13900
+ /**
13901
+ * @param {any} property
13902
+ * @param {any} value
13903
13903
  */
13904
13904
 
13905
13905
 
@@ -13910,22 +13910,22 @@
13910
13910
  properties
13911
13911
  });
13912
13912
  }
13913
- /**
13914
- * @param {string} type
13915
- * @param {Function} handler
13913
+ /**
13914
+ * @param {string} type
13915
+ * @param {Function} handler
13916
13916
  */
13917
13917
 
13918
13918
 
13919
13919
  off(type, handler) {
13920
13920
  this.get('eventBus').off(type, handler);
13921
13921
  }
13922
- /**
13923
- * @internal
13924
- *
13925
- * @param {FormEditorOptions} options
13926
- * @param {Element} container
13927
- *
13928
- * @returns {Injector}
13922
+ /**
13923
+ * @internal
13924
+ *
13925
+ * @param {FormEditorOptions} options
13926
+ * @param {Element} container
13927
+ *
13928
+ * @returns {Injector}
13929
13929
  */
13930
13930
 
13931
13931
 
@@ -13946,24 +13946,24 @@
13946
13946
  formEditor: ['value', this]
13947
13947
  }, core, ...modules, ...additionalModules]);
13948
13948
  }
13949
- /**
13950
- * @internal
13949
+ /**
13950
+ * @internal
13951
13951
  */
13952
13952
 
13953
13953
 
13954
13954
  _emit(type, data) {
13955
13955
  this.get('eventBus').fire(type, data);
13956
13956
  }
13957
- /**
13958
- * @internal
13957
+ /**
13958
+ * @internal
13959
13959
  */
13960
13960
 
13961
13961
 
13962
13962
  _getState() {
13963
13963
  return this._state;
13964
13964
  }
13965
- /**
13966
- * @internal
13965
+ /**
13966
+ * @internal
13967
13967
  */
13968
13968
 
13969
13969
 
@@ -13974,16 +13974,16 @@
13974
13974
 
13975
13975
  this._emit('changed', this._getState());
13976
13976
  }
13977
- /**
13978
- * @internal
13977
+ /**
13978
+ * @internal
13979
13979
  */
13980
13980
 
13981
13981
 
13982
13982
  _getModules() {
13983
13983
  return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule, PaletteModule, PropertiesPanelModule];
13984
13984
  }
13985
- /**
13986
- * @internal
13985
+ /**
13986
+ * @internal
13987
13987
  */
13988
13988
 
13989
13989
 
@@ -42765,7 +42765,8 @@
42765
42765
  const {
42766
42766
  actions: actionsConfig = {},
42767
42767
  editor: editorConfig = {},
42768
- emit
42768
+ emit,
42769
+ exporter: exporterConfig = {}
42769
42770
  } = props;
42770
42771
  const {
42771
42772
  display: displayActions = true
@@ -42801,7 +42802,10 @@
42801
42802
  attachPropertiesPanelContainer: node => propertiesPanelRef.current.attachTo(node),
42802
42803
  attachResultContainer: node => resultViewRef.current.attachTo(node),
42803
42804
  get: (name, strict) => formEditorRef.current.get(name, strict),
42804
- setSchema: setInitialSchema
42805
+ getEditor: () => formEditorRef.current,
42806
+ getSchema: () => formEditorRef.current.getSchema(),
42807
+ setSchema: setInitialSchema,
42808
+ saveSchema: () => formEditorRef.current.saveSchema()
42805
42809
  });
42806
42810
  });
42807
42811
  y(() => {
@@ -42825,7 +42829,8 @@
42825
42829
  },
42826
42830
  propertiesPanel: {
42827
42831
  parent: !inlinePropertiesPanel && propertiesPanelContainerRef.current
42828
- }
42832
+ },
42833
+ exporter: exporterConfig
42829
42834
  });
42830
42835
  paletteRef.current = formEditor.get('palette');
42831
42836
  propertiesPanelRef.current = formEditor.get('propertiesPanel');
@@ -42864,10 +42869,10 @@
42864
42869
  dataEditorRef.current.setValue(toJSON(initialData));
42865
42870
  }, [initialData]);
42866
42871
  y(() => {
42867
- formEditorRef.current.importSchema(initialSchema);
42872
+ initialSchema && formEditorRef.current.importSchema(initialSchema);
42868
42873
  }, [initialSchema]);
42869
42874
  y(() => {
42870
- formRef.current.importSchema(schema, data);
42875
+ schema && formRef.current.importSchema(schema, data);
42871
42876
  }, [schema, data]);
42872
42877
  y(() => {
42873
42878
  resultViewRef.current.setValue(toJSON(resultData));
@@ -42989,17 +42994,22 @@
42989
42994
  throw new Error('Playground is not initialized.');
42990
42995
  }
42991
42996
 
42992
- fn(...args);
42997
+ return fn(...args);
42993
42998
  };
42994
42999
  };
42995
43000
 
43001
+ const onInit = function (_ref) {
43002
+ ref = _ref;
43003
+ emitter.emit('formPlayground.init');
43004
+ };
43005
+
42996
43006
  container.addEventListener('dragover', handleDrop);
42997
43007
  S$1(e$1(PlaygroundRoot, {
42998
- schema: schema,
42999
43008
  data: data,
43000
- onStateChanged: _state => state = _state,
43001
- onInit: _ref => ref = _ref,
43002
43009
  emit: emitter.emit,
43010
+ onInit: onInit,
43011
+ onStateChanged: _state => state = _state,
43012
+ schema: schema,
43003
43013
  ...rest
43004
43014
  }), container);
43005
43015
  this.on = emitter.on;
@@ -43016,13 +43026,21 @@
43016
43026
  return state;
43017
43027
  };
43018
43028
 
43019
- this.setSchema = function (schema) {
43029
+ this.getSchema = withRef(function () {
43030
+ return ref.getSchema();
43031
+ });
43032
+ this.setSchema = withRef(function (schema) {
43020
43033
  return ref.setSchema(schema);
43021
- };
43022
-
43023
- this.get = function (name, strict) {
43034
+ });
43035
+ this.saveSchema = withRef(function () {
43036
+ return ref.saveSchema();
43037
+ });
43038
+ this.get = withRef(function (name, strict) {
43024
43039
  return ref.get(name, strict);
43025
- };
43040
+ });
43041
+ this.getEditor = withRef(function () {
43042
+ return ref.getEditor();
43043
+ });
43026
43044
 
43027
43045
  this.destroy = function () {
43028
43046
  this.emit('destroy');