bpmn-js 17.6.4 → 17.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
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v17.6.4
2
+ * bpmn-js - bpmn-modeler v17.7.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2024-05-09
11
+ * Date: 2024-05-22
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -27699,6 +27699,94 @@
27699
27699
 
27700
27700
  function r(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(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(e))&&(n&&(n+=" "),n+=t);return n}
27701
27701
 
27702
+ /**
27703
+ * @typedef {import('./PopupMenuProvider').PopupMenuHeaderEntry} PopupMenuHeaderEntry
27704
+ */
27705
+
27706
+ /**
27707
+ * Component that renders a popup menu header.
27708
+ *
27709
+ * @param {Object} props
27710
+ * @param {PopupMenuHeaderEntry[]} props.headerEntries
27711
+ * @param {PopupMenuHeaderEntry} props.selectedEntry
27712
+ * @param {(event: MouseEvent, entry: PopupMenuHeaderEntry) => void} props.onSelect
27713
+ * @param {(entry: PopupMenuHeaderEntry | null) => void} props.setSelectedEntry
27714
+ * @param {string} props.title
27715
+ */
27716
+ function PopupMenuHeader(props) {
27717
+ const {
27718
+ headerEntries,
27719
+ onSelect,
27720
+ selectedEntry,
27721
+ setSelectedEntry,
27722
+ title
27723
+ } = props;
27724
+
27725
+ const groups = q(() => groupEntries$1(headerEntries), [ headerEntries ]);
27726
+
27727
+ return m$1`
27728
+ <div class="djs-popup-header">
27729
+ <h3 class="djs-popup-title" title=${ title }>${ title }</h3>
27730
+ ${ groups.map((group) => m$1`
27731
+ <ul key=${ group.id } class="djs-popup-header-group" data-header-group=${ group.id }>
27732
+
27733
+ ${ group.entries.map(entry => m$1`
27734
+ <li key=${ entry.id }>
27735
+ <${ entry.action ? 'button' : 'span' }
27736
+ class=${ getHeaderClasses(entry, entry === selectedEntry) }
27737
+ onClick=${ event => entry.action && onSelect(event, entry) }
27738
+ title=${ entry.title || entry.label }
27739
+ data-id=${ entry.id }
27740
+ onMouseEnter=${ () => entry.action && setSelectedEntry(entry) }
27741
+ onMouseLeave=${ () => entry.action && setSelectedEntry(null) }
27742
+ onFocus=${ () => entry.action && setSelectedEntry(entry) }
27743
+ onBlur=${ () => entry.action && setSelectedEntry(null) }
27744
+ >
27745
+ ${(entry.imageUrl && m$1`<img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />`) ||
27746
+ (entry.imageHtml && m$1`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${ { __html: entry.imageHtml } } />`)}
27747
+ ${ entry.label ? m$1`
27748
+ <span class="djs-popup-label">${ entry.label }</span>
27749
+ ` : null }
27750
+ </${ entry.action ? 'button' : 'span' }>
27751
+ </li>
27752
+ `) }
27753
+ </ul>
27754
+ `) }
27755
+ </div>
27756
+ `;
27757
+ }
27758
+
27759
+
27760
+ // helpers
27761
+ function groupEntries$1(entries) {
27762
+ return entries.reduce((groups, entry) => {
27763
+ const groupId = entry.group || 'default';
27764
+
27765
+ const group = groups.find(group => group.id === groupId);
27766
+
27767
+ if (group) {
27768
+ group.entries.push(entry);
27769
+ } else {
27770
+ groups.push({
27771
+ id: groupId,
27772
+ entries: [ entry ]
27773
+ });
27774
+ }
27775
+
27776
+ return groups;
27777
+ }, []);
27778
+ }
27779
+
27780
+ function getHeaderClasses(entry, selected) {
27781
+ return clsx(
27782
+ 'entry',
27783
+ entry.className,
27784
+ entry.active ? 'active' : '',
27785
+ entry.disabled ? 'disabled' : '',
27786
+ selected ? 'selected' : ''
27787
+ );
27788
+ }
27789
+
27702
27790
  /**
27703
27791
  * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry
27704
27792
  */
@@ -27896,6 +27984,7 @@
27896
27984
  *
27897
27985
  * @param {Object} props
27898
27986
  * @param {() => void} props.onClose
27987
+ * @param {() => void} props.onSelect
27899
27988
  * @param {(element: HTMLElement) => Point} props.position
27900
27989
  * @param {string} props.className
27901
27990
  * @param {PopupMenuEntry[]} props.entries
@@ -28046,28 +28135,13 @@
28046
28135
  scale=${ scale }
28047
28136
  >
28048
28137
  ${ displayHeader && m$1`
28049
- <div class="djs-popup-header">
28050
- <h3 class="djs-popup-title" title=${ title }>${ title }</h3>
28051
- ${ headerEntries.map(entry => m$1`
28052
- <${ entry.action ? 'button' : 'span' }
28053
- class=${ getHeaderClasses(entry, entry === selectedEntry) }
28054
- onClick=${ event => onSelect(event, entry) }
28055
- title=${ entry.title || entry.label }
28056
- data-id=${ entry.id }
28057
- onMouseEnter=${ () => setSelectedEntry(entry) }
28058
- onMouseLeave=${ () => setSelectedEntry(null) }
28059
- onFocus=${ () => setSelectedEntry(entry) }
28060
- onBlur=${ () => setSelectedEntry(null) }
28061
- >
28062
- ${(entry.imageUrl && m$1`<img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />`) ||
28063
- (entry.imageHtml && m$1`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${ { __html: entry.imageHtml } } />`)}
28064
-
28065
- ${ entry.label ? m$1`
28066
- <span class="djs-popup-label">${ entry.label }</span>
28067
- ` : null }
28068
- </${ entry.action ? 'button' : 'span' }>
28069
- `) }
28070
- </div>
28138
+ <${PopupMenuHeader}
28139
+ headerEntries=${ headerEntries }
28140
+ onSelect=${ onSelect }
28141
+ selectedEntry=${ selectedEntry }
28142
+ setSelectedEntry=${ setSelectedEntry }
28143
+ title=${ title }
28144
+ />
28071
28145
  ` }
28072
28146
  ${ originalEntries.length > 0 && m$1`
28073
28147
  <div class="djs-popup-body">
@@ -28190,16 +28264,6 @@
28190
28264
  width: `${props.width}px`,
28191
28265
  'transform-origin': 'top left'
28192
28266
  };
28193
- }
28194
-
28195
- function getHeaderClasses(entry, selected) {
28196
- return clsx(
28197
- 'entry',
28198
- entry.className,
28199
- entry.active ? 'active' : '',
28200
- entry.disabled ? 'disabled' : '',
28201
- selected ? 'selected' : ''
28202
- );
28203
28267
  }
28204
28268
 
28205
28269
  /**