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.
@@ -59,6 +59,7 @@
59
59
  --popup-font-size: 14px;
60
60
  --popup-header-entry-selected-color: var(--color-blue-205-100-50);
61
61
  --popup-header-font-weight: bolder;
62
+ --popup-header-group-divider-color: var(--color-grey-225-10-75);
62
63
  --popup-background-color: var(--color-white);
63
64
  --popup-border-color: transparent;
64
65
  --popup-shadow-color: var(--color-black-opacity-30);
@@ -568,6 +569,29 @@ marker.djs-dragger tspan {
568
569
  color: inherit;
569
570
  }
570
571
 
572
+ .djs-popup-header-group {
573
+ display: flex;
574
+ flex-direction: row;
575
+ align-items: center;
576
+ list-style: none;
577
+ margin: 0;
578
+ padding: 0;
579
+ }
580
+
581
+ .djs-popup-header-group .entry {
582
+ display: flex;
583
+ flex-direction: row;
584
+ align-items: center;
585
+ }
586
+
587
+ .djs-popup-header-group + .djs-popup-header-group:before {
588
+ content: '';
589
+ width: 1px;
590
+ height: 20px;
591
+ background: var(--popup-header-group-divider-color);
592
+ margin: 0 5px;
593
+ }
594
+
571
595
  .djs-popup-search {
572
596
  margin: 10px 12px;
573
597
  }
@@ -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
  /**