@bpmn-io/form-js-editor 0.13.1 → 0.14.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.
@@ -101,6 +101,7 @@
101
101
  .fjs-editor-container .fjs-input:disabled,
102
102
  .fjs-editor-container .fjs-textarea:disabled,
103
103
  .fjs-editor-container .fjs-taglist-input:disabled,
104
+ .fjs-editor-container .fjs-button:disabled,
104
105
  .fjs-editor-container .fjs-select:disabled {
105
106
  pointer-events: none;
106
107
  }
@@ -118,24 +119,29 @@
118
119
  display: flex;
119
120
  width: 100%;
120
121
  padding: 3px 0px;
122
+ position: relative;
121
123
  }
122
124
 
123
125
  .fjs-editor-container .fjs-row-dragger {
124
- visibility: hidden;
125
126
  z-index: 2;
126
- position: relative;
127
- margin-left: -12px;
128
- margin-top: auto;
129
- margin-bottom: auto;
127
+ position: absolute;
128
+ top: 25%;
129
+ height: 50%;
130
+ left: -33px;
131
+ width: 23px;
132
+ padding-right: 7px;
130
133
  cursor: grab;
131
- width: 32px;
132
- height: 32px;
133
134
  display: flex;
134
135
  justify-content: center;
135
136
  align-items: center;
136
137
  }
137
138
 
138
- .fjs-editor-container .fjs-drag-row-move:hover .fjs-row-dragger {
139
+ .fjs-editor-container .fjs-row-dragger svg {
140
+ visibility: hidden;
141
+ }
142
+
143
+ .fjs-editor-container .fjs-row-dragger:hover svg,
144
+ .fjs-editor-container .fjs-drag-row-move:hover .fjs-row-dragger svg {
139
145
  visibility: visible;
140
146
  }
141
147
 
@@ -404,11 +410,8 @@
404
410
  /* row drop preview */
405
411
  .fjs-children > .gu-transit {
406
412
  height: 28px !important;
407
- margin-left: 28px !important;
408
- margin-right: -8px !important;
413
+ width: 100% !important;
409
414
  flex: unset !important;
410
- width: unset !important;
411
- max-width: unset !important;
412
415
  }
413
416
 
414
417
  /* error drop preview */
@@ -99,6 +99,7 @@
99
99
  .fjs-editor-container .fjs-input:disabled,
100
100
  .fjs-editor-container .fjs-textarea:disabled,
101
101
  .fjs-editor-container .fjs-taglist-input:disabled,
102
+ .fjs-editor-container .fjs-button:disabled,
102
103
  .fjs-editor-container .fjs-select:disabled {
103
104
  pointer-events: none;
104
105
  }
@@ -116,24 +117,29 @@
116
117
  display: flex;
117
118
  width: 100%;
118
119
  padding: 3px 0px;
120
+ position: relative;
119
121
  }
120
122
 
121
123
  .fjs-editor-container .fjs-row-dragger {
122
- visibility: hidden;
123
124
  z-index: 2;
124
- position: relative;
125
- margin-left: -12px;
126
- margin-top: auto;
127
- margin-bottom: auto;
125
+ position: absolute;
126
+ top: 25%;
127
+ height: 50%;
128
+ left: -33px;
129
+ width: 23px;
130
+ padding-right: 7px;
128
131
  cursor: grab;
129
- width: 32px;
130
- height: 32px;
131
132
  display: flex;
132
133
  justify-content: center;
133
134
  align-items: center;
134
135
  }
135
136
 
136
- .fjs-editor-container .fjs-drag-row-move:hover .fjs-row-dragger {
137
+ .fjs-editor-container .fjs-row-dragger svg {
138
+ visibility: hidden;
139
+ }
140
+
141
+ .fjs-editor-container .fjs-row-dragger:hover svg,
142
+ .fjs-editor-container .fjs-drag-row-move:hover .fjs-row-dragger svg {
137
143
  visibility: visible;
138
144
  }
139
145
 
@@ -401,11 +407,8 @@
401
407
  /* row drop preview */
402
408
  .fjs-children > .gu-transit {
403
409
  height: 28px !important;
404
- margin-left: 28px !important;
405
- margin-right: -8px !important;
410
+ width: 100% !important;
406
411
  flex: unset !important;
407
- width: unset !important;
408
- max-width: unset !important;
409
412
  }
410
413
 
411
414
  /* error drop preview */
package/dist/index.cjs CHANGED
@@ -7514,7 +7514,7 @@ function Label(props) {
7514
7514
  id,
7515
7515
  label: 'Label',
7516
7516
  setValue,
7517
- validate: validateFactory(getValue())
7517
+ validate: validateFactory(getValue(), entry => entry.label)
7518
7518
  });
7519
7519
  }
7520
7520
  function Value$1(props) {
@@ -7540,7 +7540,7 @@ function Value$1(props) {
7540
7540
  id,
7541
7541
  label: 'Value',
7542
7542
  setValue,
7543
- validate: validateFactory(getValue())
7543
+ validate: validateFactory(getValue(), entry => entry.value)
7544
7544
  });
7545
7545
  }
7546
7546
 
@@ -7782,13 +7782,13 @@ function StaticValuesSourceEntry(props) {
7782
7782
  const addEntry = e => {
7783
7783
  e.stopPropagation();
7784
7784
  const index = values.length + 1;
7785
- const entry = getIndexedEntry(index);
7785
+ const entry = getIndexedEntry(index, values);
7786
7786
  editField(field, formJsViewer.VALUES_SOURCES_PATHS[formJsViewer.VALUES_SOURCES.STATIC], arrayAdd(values, values.length, entry));
7787
7787
  };
7788
7788
  const removeEntry = entry => {
7789
7789
  editField(field, formJsViewer.VALUES_SOURCES_PATHS[formJsViewer.VALUES_SOURCES.STATIC], minDash.without(values, entry));
7790
7790
  };
7791
- const validateFactory = key => {
7791
+ const validateFactory = (key, getValue) => {
7792
7792
  return value => {
7793
7793
  if (value === key) {
7794
7794
  return;
@@ -7796,7 +7796,7 @@ function StaticValuesSourceEntry(props) {
7796
7796
  if (minDash.isUndefined(value) || !value.length) {
7797
7797
  return 'Must not be empty.';
7798
7798
  }
7799
- const isValueAssigned = values.find(entry => entry.value === value);
7799
+ const isValueAssigned = values.find(entry => getValue(entry) === value);
7800
7800
  if (isValueAssigned) {
7801
7801
  return 'Must be unique.';
7802
7802
  }
@@ -7827,17 +7827,23 @@ function StaticValuesSourceEntry(props) {
7827
7827
 
7828
7828
  // helper
7829
7829
 
7830
- function getIndexedEntry(index) {
7830
+ function getIndexedEntry(index, values) {
7831
7831
  const entry = {
7832
7832
  label: 'Value',
7833
7833
  value: 'value'
7834
7834
  };
7835
+ while (labelOrValueIsAlreadyAssignedForIndex(index, values)) {
7836
+ index++;
7837
+ }
7835
7838
  if (index > 1) {
7836
7839
  entry.label += ` ${index}`;
7837
7840
  entry.value += `${index}`;
7838
7841
  }
7839
7842
  return entry;
7840
7843
  }
7844
+ function labelOrValueIsAlreadyAssignedForIndex(index, values) {
7845
+ return values.some(existingEntry => existingEntry.label === `Value ${index}` || existingEntry.value === `value${index}`);
7846
+ }
7841
7847
 
7842
7848
  function AdornerEntry(props) {
7843
7849
  const {
@@ -8066,7 +8072,7 @@ function ValidationGroup(field, editField) {
8066
8072
  } = field;
8067
8073
  const validate = minDash.get(field, ['validate'], {});
8068
8074
  const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate.validationType);
8069
- if (!(INPUTS.includes(type) && type !== 'checkbox' && type !== 'checklist' && type !== 'taglist')) {
8075
+ if (!INPUTS.includes(type)) {
8070
8076
  return null;
8071
8077
  }
8072
8078
  const onChange = key => {
@@ -8338,12 +8344,13 @@ function CustomValuesGroup(field, editField) {
8338
8344
  }
8339
8345
  const addEntry = event => {
8340
8346
  event.stopPropagation();
8341
- const index = Object.keys(properties).length + 1;
8342
- const key = `key${index}`,
8343
- value = 'value';
8347
+ let index = Object.keys(properties).length + 1;
8348
+ while (`key${index}` in properties) {
8349
+ index++;
8350
+ }
8344
8351
  editField(field, ['properties'], {
8345
8352
  ...properties,
8346
- [key]: value
8353
+ [`key${index}`]: 'value'
8347
8354
  });
8348
8355
  };
8349
8356
  const validateFactory = key => {