@bpmn-io/form-js-editor 0.12.0 → 0.12.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.es.js CHANGED
@@ -716,7 +716,7 @@ function EditorText(props) {
716
716
  type,
717
717
  text = ''
718
718
  } = props.field;
719
- const Icon = iconsByType['text'];
719
+ const Icon = iconsByType('text');
720
720
  if (!text) {
721
721
  return jsx("div", {
722
722
  class: editorFormFieldClasses(type),
@@ -882,11 +882,11 @@ function Palette(props) {
882
882
  label,
883
883
  type
884
884
  }) => {
885
- const Icon = iconsByType[type];
885
+ const Icon = iconsByType(type);
886
886
  return jsxs("div", {
887
887
  class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
888
888
  "data-field-type": type,
889
- title: `Create a ${label} element`,
889
+ title: `Create ${getIndefiniteArticle(type)} ${label} element`,
890
890
  children: [Icon ? jsx(Icon, {
891
891
  class: "fjs-palette-field-icon",
892
892
  width: "36",
@@ -925,6 +925,12 @@ function groupEntries(entries) {
925
925
  });
926
926
  return groups.filter(g => g.entries.length);
927
927
  }
928
+ function getIndefiniteArticle(type) {
929
+ if (['image'].includes(type)) {
930
+ return 'an';
931
+ }
932
+ return 'a';
933
+ }
928
934
 
929
935
  const CURSOR_CLS_PATTERN = /^fjs-cursor-.*$/;
930
936
  function set(mode) {
@@ -1263,7 +1269,7 @@ function CreatePreview(props) {
1263
1269
  } = useContext(DragAndDropContext$1);
1264
1270
  function handleCloned(clone, original, type) {
1265
1271
  const fieldType = clone.dataset.fieldType;
1266
- const Icon = iconsByType[fieldType];
1272
+ const Icon = iconsByType(fieldType);
1267
1273
  const {
1268
1274
  label
1269
1275
  } = findPaletteEntry(fieldType);
@@ -5486,7 +5492,7 @@ const PropertiesPanelHeaderProvider = {
5486
5492
  const {
5487
5493
  type
5488
5494
  } = field;
5489
- const Icon = iconsByType[type];
5495
+ const Icon = iconsByType(type);
5490
5496
  if (Icon) {
5491
5497
  return () => jsx(Icon, {
5492
5498
  width: "36",
@@ -5733,6 +5739,7 @@ function Description(props) {
5733
5739
  });
5734
5740
  }
5735
5741
 
5742
+ const EMPTY_OPTION = null;
5736
5743
  function DefaultOptionEntry(props) {
5737
5744
  const {
5738
5745
  editField,
@@ -5878,13 +5885,14 @@ function DefaultValueSingleSelect(props) {
5878
5885
  label
5879
5886
  } = props;
5880
5887
  const {
5881
- defaultValue,
5888
+ defaultValue = EMPTY_OPTION,
5882
5889
  values = []
5883
5890
  } = field;
5884
5891
  const path = ['defaultValue'];
5885
5892
  const getOptions = () => {
5886
5893
  return [{
5887
- label: '<none>'
5894
+ label: '<none>',
5895
+ value: EMPTY_OPTION
5888
5896
  }, ...values];
5889
5897
  };
5890
5898
  const setValue = value => {
@@ -7344,7 +7352,7 @@ function ConstraintsGroup(field, editField) {
7344
7352
 
7345
7353
  const VALIDATION_TYPE_OPTIONS = {
7346
7354
  custom: {
7347
- value: undefined,
7355
+ value: '',
7348
7356
  label: 'Custom'
7349
7357
  },
7350
7358
  email: {
@@ -7361,7 +7369,7 @@ function ValidationGroup(field, editField) {
7361
7369
  type
7362
7370
  } = field;
7363
7371
  const validate = get(field, ['validate'], {});
7364
- const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate && validate.validationType);
7372
+ const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate.validationType);
7365
7373
  if (!(INPUTS.includes(type) && type !== 'checkbox' && type !== 'checklist' && type !== 'taglist')) {
7366
7374
  return null;
7367
7375
  }