camunda-bpmn-js 4.6.2 → 4.7.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.
@@ -28233,6 +28233,94 @@
28233
28233
 
28234
28234
  function r$2(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
28235
28235
 
28236
+ /**
28237
+ * @typedef {import('./PopupMenuProvider').PopupMenuHeaderEntry} PopupMenuHeaderEntry
28238
+ */
28239
+
28240
+ /**
28241
+ * Component that renders a popup menu header.
28242
+ *
28243
+ * @param {Object} props
28244
+ * @param {PopupMenuHeaderEntry[]} props.headerEntries
28245
+ * @param {PopupMenuHeaderEntry} props.selectedEntry
28246
+ * @param {(event: MouseEvent, entry: PopupMenuHeaderEntry) => void} props.onSelect
28247
+ * @param {(entry: PopupMenuHeaderEntry | null) => void} props.setSelectedEntry
28248
+ * @param {string} props.title
28249
+ */
28250
+ function PopupMenuHeader(props) {
28251
+ const {
28252
+ headerEntries,
28253
+ onSelect,
28254
+ selectedEntry,
28255
+ setSelectedEntry,
28256
+ title
28257
+ } = props;
28258
+
28259
+ const groups = F$3(() => groupEntries$1(headerEntries), [ headerEntries ]);
28260
+
28261
+ return m$3`
28262
+ <div class="djs-popup-header">
28263
+ <h3 class="djs-popup-title" title=${ title }>${ title }</h3>
28264
+ ${ groups.map((group) => m$3`
28265
+ <ul key=${ group.id } class="djs-popup-header-group" data-header-group=${ group.id }>
28266
+
28267
+ ${ group.entries.map(entry => m$3`
28268
+ <li key=${ entry.id }>
28269
+ <${ entry.action ? 'button' : 'span' }
28270
+ class=${ getHeaderClasses(entry, entry === selectedEntry) }
28271
+ onClick=${ event => entry.action && onSelect(event, entry) }
28272
+ title=${ entry.title || entry.label }
28273
+ data-id=${ entry.id }
28274
+ onMouseEnter=${ () => entry.action && setSelectedEntry(entry) }
28275
+ onMouseLeave=${ () => entry.action && setSelectedEntry(null) }
28276
+ onFocus=${ () => entry.action && setSelectedEntry(entry) }
28277
+ onBlur=${ () => entry.action && setSelectedEntry(null) }
28278
+ >
28279
+ ${(entry.imageUrl && m$3`<img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />`) ||
28280
+ (entry.imageHtml && m$3`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${ { __html: entry.imageHtml } } />`)}
28281
+ ${ entry.label ? m$3`
28282
+ <span class="djs-popup-label">${ entry.label }</span>
28283
+ ` : null }
28284
+ </${ entry.action ? 'button' : 'span' }>
28285
+ </li>
28286
+ `) }
28287
+ </ul>
28288
+ `) }
28289
+ </div>
28290
+ `;
28291
+ }
28292
+
28293
+
28294
+ // helpers
28295
+ function groupEntries$1(entries) {
28296
+ return entries.reduce((groups, entry) => {
28297
+ const groupId = entry.group || 'default';
28298
+
28299
+ const group = groups.find(group => group.id === groupId);
28300
+
28301
+ if (group) {
28302
+ group.entries.push(entry);
28303
+ } else {
28304
+ groups.push({
28305
+ id: groupId,
28306
+ entries: [ entry ]
28307
+ });
28308
+ }
28309
+
28310
+ return groups;
28311
+ }, []);
28312
+ }
28313
+
28314
+ function getHeaderClasses(entry, selected) {
28315
+ return clsx(
28316
+ 'entry',
28317
+ entry.className,
28318
+ entry.active ? 'active' : '',
28319
+ entry.disabled ? 'disabled' : '',
28320
+ selected ? 'selected' : ''
28321
+ );
28322
+ }
28323
+
28236
28324
  /**
28237
28325
  * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry
28238
28326
  */
@@ -28430,6 +28518,7 @@
28430
28518
  *
28431
28519
  * @param {Object} props
28432
28520
  * @param {() => void} props.onClose
28521
+ * @param {() => void} props.onSelect
28433
28522
  * @param {(element: HTMLElement) => Point} props.position
28434
28523
  * @param {string} props.className
28435
28524
  * @param {PopupMenuEntry[]} props.entries
@@ -28580,28 +28669,13 @@
28580
28669
  scale=${ scale }
28581
28670
  >
28582
28671
  ${ displayHeader && m$3`
28583
- <div class="djs-popup-header">
28584
- <h3 class="djs-popup-title" title=${ title }>${ title }</h3>
28585
- ${ headerEntries.map(entry => m$3`
28586
- <${ entry.action ? 'button' : 'span' }
28587
- class=${ getHeaderClasses(entry, entry === selectedEntry) }
28588
- onClick=${ event => onSelect(event, entry) }
28589
- title=${ entry.title || entry.label }
28590
- data-id=${ entry.id }
28591
- onMouseEnter=${ () => setSelectedEntry(entry) }
28592
- onMouseLeave=${ () => setSelectedEntry(null) }
28593
- onFocus=${ () => setSelectedEntry(entry) }
28594
- onBlur=${ () => setSelectedEntry(null) }
28595
- >
28596
- ${(entry.imageUrl && m$3`<img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />`) ||
28597
- (entry.imageHtml && m$3`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${ { __html: entry.imageHtml } } />`)}
28598
-
28599
- ${ entry.label ? m$3`
28600
- <span class="djs-popup-label">${ entry.label }</span>
28601
- ` : null }
28602
- </${ entry.action ? 'button' : 'span' }>
28603
- `) }
28604
- </div>
28672
+ <${PopupMenuHeader}
28673
+ headerEntries=${ headerEntries }
28674
+ onSelect=${ onSelect }
28675
+ selectedEntry=${ selectedEntry }
28676
+ setSelectedEntry=${ setSelectedEntry }
28677
+ title=${ title }
28678
+ />
28605
28679
  ` }
28606
28680
  ${ originalEntries.length > 0 && m$3`
28607
28681
  <div class="djs-popup-body">
@@ -28724,16 +28798,6 @@
28724
28798
  width: `${props.width}px`,
28725
28799
  'transform-origin': 'top left'
28726
28800
  };
28727
- }
28728
-
28729
- function getHeaderClasses(entry, selected) {
28730
- return clsx(
28731
- 'entry',
28732
- entry.className,
28733
- entry.active ? 'active' : '',
28734
- entry.disabled ? 'disabled' : '',
28735
- selected ? 'selected' : ''
28736
- );
28737
28801
  }
28738
28802
 
28739
28803
  /**
@@ -123031,6 +123095,16 @@
123031
123095
 
123032
123096
  const PRIMITIVE_MODDLE_TYPES$1 = ['Boolean', 'Integer', 'String'];
123033
123097
  function getPropertyValue(element, property, scope) {
123098
+ const rawValue = getRawPropertyValue(element, property);
123099
+ const {
123100
+ type
123101
+ } = property;
123102
+ if (type === 'Boolean') {
123103
+ return getBooleanPropertyValue(rawValue);
123104
+ }
123105
+ return rawValue;
123106
+ }
123107
+ function getRawPropertyValue(element, property, scope) {
123034
123108
  let businessObject = getBusinessObject$2(element);
123035
123109
  const defaultValue = '';
123036
123110
  const {
@@ -123145,6 +123219,22 @@
123145
123219
  // should never throw as templates are validated beforehand
123146
123220
  throw unknownBindingError$1(element, property);
123147
123221
  }
123222
+
123223
+ /**
123224
+ * Cast a string value to a boolean if possible. Otherwise return the value.
123225
+ * Cannot always cast due to FEEL expressions.
123226
+ *
123227
+ * @param {string|boolean} value
123228
+ */
123229
+ function getBooleanPropertyValue(value) {
123230
+ switch (value) {
123231
+ case 'true':
123232
+ return true;
123233
+ case 'false':
123234
+ return false;
123235
+ }
123236
+ return value;
123237
+ }
123148
123238
  const NO_OP = null;
123149
123239
  function setPropertyValue(bpmnFactory, commandStack, element, property, value) {
123150
123240
  let businessObject = getBusinessObject$2(element);