camunda-bpmn-js 0.24.1 → 1.1.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.
- package/dist/assets/base-modeler.css +2 -1
- package/dist/assets/color-picker.css +10 -0
- package/dist/assets/diagram-js.css +1 -3
- package/dist/base-modeler.development.js +751 -243
- package/dist/base-modeler.production.min.js +22 -22
- package/dist/base-navigated-viewer.development.js +3 -0
- package/dist/base-navigated-viewer.production.min.js +1 -1
- package/dist/base-viewer.development.js +3 -0
- package/dist/base-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-modeler.development.js +1570 -415
- package/dist/camunda-cloud-modeler.production.min.js +22 -22
- package/dist/camunda-cloud-navigated-viewer.development.js +3 -0
- package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-viewer.development.js +3 -0
- package/dist/camunda-cloud-viewer.production.min.js +1 -1
- package/dist/camunda-platform-modeler.development.js +1180 -269
- package/dist/camunda-platform-modeler.production.min.js +26 -26
- package/dist/camunda-platform-navigated-viewer.development.js +3 -0
- package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-platform-viewer.development.js +3 -0
- package/dist/camunda-platform-viewer.production.min.js +1 -1
- package/lib/camunda-cloud/Modeler.js +5 -1
- package/lib/camunda-cloud/features/replace/ElementTemplatesReplaceProvider.js +3 -141
- package/lib/camunda-platform/Modeler.js +6 -1
- package/lib/shared/features/replace/UnlinkTemplateReplaceProvider.js +178 -0
- package/lib/shared/features/replace/index.js +8 -0
- package/lib/{camunda-cloud/features/replace → shared/features/replace/util}/ReplaceOptionsUtil.js +0 -0
- package/package.json +9 -7
- package/styles/base-modeler.css +2 -1
|
@@ -22147,6 +22147,9 @@
|
|
|
22147
22147
|
|
|
22148
22148
|
};
|
|
22149
22149
|
|
|
22150
|
+
Overlays.prototype.isShown = function() {
|
|
22151
|
+
return this._overlayRoot.style.display !== 'none';
|
|
22152
|
+
};
|
|
22150
22153
|
|
|
22151
22154
|
Overlays.prototype.show = function() {
|
|
22152
22155
|
setVisible$1(this._overlayRoot);
|
|
@@ -28053,7 +28056,9 @@
|
|
|
28053
28056
|
|
|
28054
28057
|
|
|
28055
28058
|
/**
|
|
28056
|
-
* Trigger context pad
|
|
28059
|
+
* Trigger context pad via DOM event.
|
|
28060
|
+
*
|
|
28061
|
+
* The entry to trigger is determined by the target element.
|
|
28057
28062
|
*
|
|
28058
28063
|
* @param {string} action
|
|
28059
28064
|
* @param {Event} event
|
|
@@ -28061,10 +28066,7 @@
|
|
|
28061
28066
|
*/
|
|
28062
28067
|
ContextPad.prototype.trigger = function(action, event, autoActivate) {
|
|
28063
28068
|
|
|
28064
|
-
var
|
|
28065
|
-
entries = this._current.entries,
|
|
28066
|
-
entry,
|
|
28067
|
-
handler,
|
|
28069
|
+
var entry,
|
|
28068
28070
|
originalEvent,
|
|
28069
28071
|
button = event.delegateTarget || event.target;
|
|
28070
28072
|
|
|
@@ -28072,19 +28074,45 @@
|
|
|
28072
28074
|
return event.preventDefault();
|
|
28073
28075
|
}
|
|
28074
28076
|
|
|
28075
|
-
entry =
|
|
28076
|
-
handler = entry.action;
|
|
28077
|
-
|
|
28077
|
+
entry = attr$1(button, 'data-action');
|
|
28078
28078
|
originalEvent = event.originalEvent || event;
|
|
28079
28079
|
|
|
28080
|
+
return this.triggerEntry(entry, action, originalEvent, autoActivate);
|
|
28081
|
+
};
|
|
28082
|
+
|
|
28083
|
+
/**
|
|
28084
|
+
* Trigger context pad entry entry.
|
|
28085
|
+
*
|
|
28086
|
+
* @param {string} entryId
|
|
28087
|
+
* @param {string} action
|
|
28088
|
+
* @param {Event} event
|
|
28089
|
+
* @param {boolean} [autoActivate=false]
|
|
28090
|
+
*/
|
|
28091
|
+
ContextPad.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
|
|
28092
|
+
|
|
28093
|
+
if (!this.isShown()) {
|
|
28094
|
+
return;
|
|
28095
|
+
}
|
|
28096
|
+
|
|
28097
|
+
var target = this._current.target,
|
|
28098
|
+
entries = this._current.entries;
|
|
28099
|
+
|
|
28100
|
+
var entry = entries[entryId];
|
|
28101
|
+
|
|
28102
|
+
if (!entry) {
|
|
28103
|
+
return;
|
|
28104
|
+
}
|
|
28105
|
+
|
|
28106
|
+
var handler = entry.action;
|
|
28107
|
+
|
|
28080
28108
|
// simple action (via callback function)
|
|
28081
28109
|
if (isFunction(handler)) {
|
|
28082
28110
|
if (action === 'click') {
|
|
28083
|
-
return handler(
|
|
28111
|
+
return handler(event, target, autoActivate);
|
|
28084
28112
|
}
|
|
28085
28113
|
} else {
|
|
28086
28114
|
if (handler[action]) {
|
|
28087
|
-
return handler[action](
|
|
28115
|
+
return handler[action](event, target, autoActivate);
|
|
28088
28116
|
}
|
|
28089
28117
|
}
|
|
28090
28118
|
|
|
@@ -28285,6 +28313,16 @@
|
|
|
28285
28313
|
};
|
|
28286
28314
|
|
|
28287
28315
|
|
|
28316
|
+
/**
|
|
28317
|
+
* Check if pad is open and not hidden.
|
|
28318
|
+
*
|
|
28319
|
+
* @return {boolean}
|
|
28320
|
+
*/
|
|
28321
|
+
ContextPad.prototype.isShown = function() {
|
|
28322
|
+
return this.isOpen() && this._overlays.isShown();
|
|
28323
|
+
};
|
|
28324
|
+
|
|
28325
|
+
|
|
28288
28326
|
/**
|
|
28289
28327
|
* Get contex pad position.
|
|
28290
28328
|
*
|
|
@@ -28337,11 +28375,11 @@
|
|
|
28337
28375
|
|
|
28338
28376
|
var n$3,l$3,u$3,t$5,o$5,f$3={},e$5=[],c$3=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s$3(n,l){for(var u in l)n[u]=l[u];return n}function a$4(n){var l=n.parentNode;l&&l.removeChild(n);}function h$3(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n$3.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$3(l,f,t,o,null)}function v$3(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$3:r};return null==r&&null!=l$3.vnode&&l$3.vnode(f),f}function p$4(n){return n.children}function d$3(n,l){this.props=n,this.context=l;}function _$3(n,l){if(null==l)return n.__?_$3(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_$3(n):null}function k$4(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$4(n)}}function b$3(n){(!n.__d&&(n.__d=!0)&&t$5.push(n)&&!g$4.__r++||o$5!==l$3.debounceRendering)&&((o$5=l$3.debounceRendering)||setTimeout)(g$4);}function g$4(){for(var n;g$4.__r=t$5.length;)n=t$5.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$5=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s$3({},t)).__v=t.__v+1,j$4(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_$3(t):o,t.__h),z$3(u,t),t.__e!=o&&k$4(t)));});}function w$4(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$5,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$3(null,k,null,null,k):Array.isArray(k)?v$3(p$4,{children:k},null,null,null):k.__b>0?v$3(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$4(n,k,d=d||f$3,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$4(k,s,n):s=A$3(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_$3(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&N$2(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M$2(w[h],w[++h],w[++h]);}function m$4(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$4(i,l,u):A$3(u,i,i,t,i.__e,l));return l}function A$3(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C$3(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H$2(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H$2(n,o,l[o],u[o],i);}function $$2(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$3.test(l)?u:u+"px";}function H$2(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$$2(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$$2(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T$4:I$2,o):n.removeEventListener(l,o?T$4:I$2,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u));}}function I$2(n){this.l[n.type+!1](l$3.event?l$3.event(n):n);}function T$4(n){this.l[n.type+!0](l$3.event?l$3.event(n):n);}function j$4(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$3.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d$3(g,x),h.constructor=T,h.render=O$2),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s$3({},h.__s)),s$3(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l$3.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s$3(s$3({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p$4&&null==a.key?a.props.children:a,w$4(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L$2(i.__e,u,i,t,o,r,f,c);(a=l$3.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$3.__e(n,u,i);}}function z$3(n,u){l$3.__c&&l$3.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$3.__e(n,u.__v);}});}function L$2(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n$3.call(l.childNodes),h=(y=i.props||f$3).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C$3(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$4(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_$3(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$4(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H$2(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H$2(l,"checked",k,y.checked,!1));}return l}function M$2(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$3.__e(n,i);}}function N$2(n,u,i){var t,o;if(l$3.unmount&&l$3.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M$2(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$3.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N$2(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a$4(n.__e),n.__=n.__e=n.__d=void 0;}function O$2(n,l,u){return this.constructor(n,u)}function P$2(u,i,t){var o,r,e;l$3.__&&l$3.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$4(i,u=(!o&&t||i).__k=h$3(p$4,null,[u]),r||f$3,f$3,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n$3.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$3(e,u);}n$3=e$5.slice,l$3={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$3=0,d$3.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s$3({},this.state),"function"==typeof n&&(n=n(s$3({},u),this.props)),n&&s$3(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b$3(this));},d$3.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$3(this));},d$3.prototype.render=p$4,t$5=[],g$4.__r=0;
|
|
28339
28377
|
|
|
28340
|
-
var
|
|
28378
|
+
var n$2=function(t,s,r,e){var u;s[0]=0;for(var h=1;h<s.length;h++){var p=s[h++],a=s[h]?(s[0]|=p?1:2,r[s[h++]]):s[++h];3===p?e[0]=a:4===p?e[1]=Object.assign(e[1]||{},a):5===p?(e[1]=e[1]||{})[s[++h]]=a:6===p?e[1][s[++h]]+=a+"":p?(u=t.apply(a,n$2(t,a,r,["",null])),e.push(u),a[0]?s[0]|=2:(s[h-2]=0,s[h]=u)):e.push(a);}return e},t$4=new Map;function e$4(s){var r=t$4.get(this);return r||(r=new Map,t$4.set(this,r)),(r=n$2(this,r.get(s)||(r.set(s,r=function(n){for(var t,s,r=1,e="",u="",h=[0],p=function(n){1===r&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?h.push(0,n,e):3===r&&(n||e)?(h.push(3,n,e),r=2):2===r&&"..."===e&&n?h.push(4,n,0):2===r&&e&&!n?h.push(5,0,!0,e):r>=5&&((e||!n&&5===r)&&(h.push(r,0,e,s),r=6),n&&(h.push(r,n,0,s),r=6)),e="";},a=0;a<n.length;a++){a&&(1===r&&p(),p(a));for(var l=0;l<n[a].length;l++)t=n[a][l],1===r?"<"===t?(p(),h=[h],r=3):e+=t:4===r?"--"===e&&">"===t?(r=1,e=""):e=t+e[0]:u?t===u?u="":e+=t:'"'===t||"'"===t?u=t:">"===t?(p(),r=1):r&&("="===t?(r=5,s=e,e=""):"/"===t&&(r<5||">"===n[a][l+1])?(p(),3===r&&(h=h[0]),r=h,(h=h[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(p(),r=2):e+=t),3===r&&"!--"===e&&(r=4,h=h[0]);}return p(),h}(s)),r),arguments,[])).length>1?r:r[0]}
|
|
28341
28379
|
|
|
28342
|
-
var
|
|
28380
|
+
var m$3=e$4.bind(h$3);
|
|
28343
28381
|
|
|
28344
|
-
var
|
|
28382
|
+
var t$3,r$3,u$2,i$4,o$4=0,f$2=[],c$2=[],e$3=l$3.__b,a$3=l$3.__r,v$2=l$3.diffed,l$2=l$3.__c,m$2=l$3.unmount;function d$2(t,u){l$3.__h&&l$3.__h(r$3,t,o$4||u),o$4=0;var i=r$3.__H||(r$3.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c$2}),i.__[t]}function p$3(n){return o$4=1,y$2(B$1,n)}function y$2(n,u,i){var o=d$2(t$3++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$3,!r$3.u)){r$3.u=!0;var f=r$3.shouldComponentUpdate;r$3.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h$2(u,i){var o=d$2(t$3++,3);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__H.__h.push(o));}function s$2(u,i){var o=d$2(t$3++,4);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__h.push(o));}function _$2(n){return o$4=5,F$2(function(){return {current:n}},[])}function F$2(n,r){var u=d$2(t$3++,7);return z$2(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T$3(n,t){return o$4=8,F$2(function(){return n},t)}function b$2(){for(var t;t=f$2.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k$3),t.__H.__h.forEach(w$3),t.__H.__h=[];}catch(r){t.__H.__h=[],l$3.__e(r,t.__v);}}l$3.__b=function(n){r$3=null,e$3&&e$3(n);},l$3.__r=function(n){a$3&&a$3(n),t$3=0;var i=(r$3=n.__c).__H;i&&(u$2===r$3?(i.__h=[],r$3.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c$2,n.__N=n.i=void 0;})):(i.__h.forEach(k$3),i.__h.forEach(w$3),i.__h=[])),u$2=r$3;},l$3.diffed=function(t){v$2&&v$2(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f$2.push(o)&&i$4===l$3.requestAnimationFrame||((i$4=l$3.requestAnimationFrame)||j$3)(b$2)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c$2&&(n.__=n.__V),n.i=void 0,n.__V=c$2;})),u$2=r$3=null;},l$3.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k$3),t.__h=t.__h.filter(function(n){return !n.__||w$3(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$3.__e(u,t.__v);}}),l$2&&l$2(t,r);},l$3.unmount=function(t){m$2&&m$2(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k$3(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$3.__e(r,u.__v));};var g$3="function"==typeof requestAnimationFrame;function j$3(n){var t,r=function(){clearTimeout(u),g$3&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g$3&&(t=requestAnimationFrame(r));}function k$3(n){var t=r$3,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$3=t;}function w$3(n){var t=r$3;n.__c=n.__(),r$3=t;}function z$2(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B$1(n,t){return "function"==typeof t?t(n):t}
|
|
28345
28383
|
|
|
28346
28384
|
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))for(t=0;t<e.length;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
|
|
28347
28385
|
|
|
@@ -28364,7 +28402,7 @@
|
|
|
28364
28402
|
onClick
|
|
28365
28403
|
} = props;
|
|
28366
28404
|
|
|
28367
|
-
return m$
|
|
28405
|
+
return m$3`
|
|
28368
28406
|
<li
|
|
28369
28407
|
class=${ clsx('entry', { selected }) }
|
|
28370
28408
|
data-id=${ entry.id }
|
|
@@ -28377,17 +28415,17 @@
|
|
|
28377
28415
|
<span
|
|
28378
28416
|
class=${ clsx('djs-popup-entry-name', entry.className) }
|
|
28379
28417
|
>
|
|
28380
|
-
${ entry.imageUrl ? m$
|
|
28418
|
+
${ entry.imageUrl ? m$3`
|
|
28381
28419
|
<img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
|
|
28382
28420
|
` : null }
|
|
28383
28421
|
|
|
28384
|
-
${ entry.label ? m$
|
|
28422
|
+
${ entry.label ? m$3`
|
|
28385
28423
|
<span class="djs-popup-label">
|
|
28386
28424
|
${ entry.label }
|
|
28387
28425
|
</span>
|
|
28388
28426
|
` : null }
|
|
28389
28427
|
</span>
|
|
28390
|
-
${ entry.description && m$
|
|
28428
|
+
${ entry.description && m$3`
|
|
28391
28429
|
<span
|
|
28392
28430
|
class="djs-popup-entry-description"
|
|
28393
28431
|
title=${ entry.description }
|
|
@@ -28396,7 +28434,7 @@
|
|
|
28396
28434
|
</span>
|
|
28397
28435
|
` }
|
|
28398
28436
|
</div>
|
|
28399
|
-
${ entry.documentationRef && m$
|
|
28437
|
+
${ entry.documentationRef && m$3`
|
|
28400
28438
|
<div class="djs-popup-entry-docs">
|
|
28401
28439
|
<a
|
|
28402
28440
|
href="${ entry.documentationRef }"
|
|
@@ -28451,16 +28489,16 @@
|
|
|
28451
28489
|
}
|
|
28452
28490
|
}, [ selectedEntry ]);
|
|
28453
28491
|
|
|
28454
|
-
return m$
|
|
28492
|
+
return m$3`
|
|
28455
28493
|
<div class="djs-popup-results" ref=${ resultsRef }>
|
|
28456
|
-
${ groups.map(group => m$
|
|
28457
|
-
${ group.name && m$
|
|
28494
|
+
${ groups.map(group => m$3`
|
|
28495
|
+
${ group.name && m$3`
|
|
28458
28496
|
<div key=${ group.id } class="entry-header" title=${ group.name }>
|
|
28459
28497
|
${ group.name }
|
|
28460
28498
|
</div>
|
|
28461
28499
|
` }
|
|
28462
28500
|
<ul class="djs-popup-group" data-group=${ group.id }>
|
|
28463
|
-
${ group.entries.map(entry => m$
|
|
28501
|
+
${ group.entries.map(entry => m$3`
|
|
28464
28502
|
<${PopupMenuItem}
|
|
28465
28503
|
key=${ entry.id }
|
|
28466
28504
|
entry=${ entry }
|
|
@@ -28679,7 +28717,7 @@
|
|
|
28679
28717
|
|
|
28680
28718
|
const displayHeader = F$2(() => title || headerEntries.length > 0, [ title, headerEntries ]);
|
|
28681
28719
|
|
|
28682
|
-
return m$
|
|
28720
|
+
return m$3`
|
|
28683
28721
|
<${PopupMenuWrapper}
|
|
28684
28722
|
onClose=${ onClose }
|
|
28685
28723
|
onKeyup=${ handleKey }
|
|
@@ -28689,10 +28727,10 @@
|
|
|
28689
28727
|
width=${ width }
|
|
28690
28728
|
scale=${ scale }
|
|
28691
28729
|
>
|
|
28692
|
-
${ displayHeader && m$
|
|
28730
|
+
${ displayHeader && m$3`
|
|
28693
28731
|
<div class="djs-popup-header">
|
|
28694
28732
|
<h3 class="djs-popup-title" title=${ title }>${ title }</h3>
|
|
28695
|
-
${ headerEntries.map(entry => m$
|
|
28733
|
+
${ headerEntries.map(entry => m$3`
|
|
28696
28734
|
<span
|
|
28697
28735
|
class=${ getHeaderClasses(entry, entry === selectedEntry) }
|
|
28698
28736
|
onClick=${ event => onSelect(event, entry) }
|
|
@@ -28701,21 +28739,21 @@
|
|
|
28701
28739
|
onMouseEnter=${ () => setSelectedEntry(entry) }
|
|
28702
28740
|
onMouseLeave=${ () => setSelectedEntry(null) }
|
|
28703
28741
|
>
|
|
28704
|
-
${ entry.imageUrl ? m$
|
|
28742
|
+
${ entry.imageUrl ? m$3`
|
|
28705
28743
|
<img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
|
|
28706
28744
|
` : null }
|
|
28707
28745
|
|
|
28708
|
-
${ entry.label ? m$
|
|
28746
|
+
${ entry.label ? m$3`
|
|
28709
28747
|
<span class="djs-popup-label">${ entry.label }</span>
|
|
28710
28748
|
` : null }
|
|
28711
28749
|
</span>
|
|
28712
28750
|
`) }
|
|
28713
28751
|
</div>
|
|
28714
28752
|
` }
|
|
28715
|
-
${ originalEntries.length > 0 && m$
|
|
28753
|
+
${ originalEntries.length > 0 && m$3`
|
|
28716
28754
|
<div class="djs-popup-body">
|
|
28717
28755
|
|
|
28718
|
-
${ searchable && m$
|
|
28756
|
+
${ searchable && m$3`
|
|
28719
28757
|
<div class="djs-popup-search">
|
|
28720
28758
|
<svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
28721
28759
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
@@ -28734,7 +28772,7 @@
|
|
|
28734
28772
|
onClick=${ onSelect }
|
|
28735
28773
|
/>
|
|
28736
28774
|
</div>
|
|
28737
|
-
${ entries.length === 0 && m$
|
|
28775
|
+
${ entries.length === 0 && m$3`
|
|
28738
28776
|
<div class="djs-popup-no-results">No matching entries found.</div>
|
|
28739
28777
|
` }
|
|
28740
28778
|
` }
|
|
@@ -28787,7 +28825,7 @@
|
|
|
28787
28825
|
popupRef.current && popupRef.current.focus();
|
|
28788
28826
|
}, []);
|
|
28789
28827
|
|
|
28790
|
-
return m$
|
|
28828
|
+
return m$3`
|
|
28791
28829
|
<div
|
|
28792
28830
|
class="djs-popup-backdrop"
|
|
28793
28831
|
onClick=${ checkClose }
|
|
@@ -28918,7 +28956,7 @@
|
|
|
28918
28956
|
const onSelect = (event, entry) => this.trigger(event, entry);
|
|
28919
28957
|
|
|
28920
28958
|
P$2(
|
|
28921
|
-
m$
|
|
28959
|
+
m$3`
|
|
28922
28960
|
<${PopupMenuComponent}
|
|
28923
28961
|
onClose=${ onClose }
|
|
28924
28962
|
onSelect=${ onSelect }
|
|
@@ -29042,13 +29080,10 @@
|
|
|
29042
29080
|
|
|
29043
29081
|
PopupMenu.prototype._createContainer = function(config) {
|
|
29044
29082
|
|
|
29045
|
-
|
|
29046
|
-
|
|
29047
|
-
if (typeof parent === 'string') {
|
|
29048
|
-
parent = document.querySelector(parent);
|
|
29049
|
-
}
|
|
29083
|
+
var canvas = this._canvas,
|
|
29084
|
+
parent = canvas.getContainer();
|
|
29050
29085
|
|
|
29051
|
-
const container = domify$1(`<div class="djs-popup-parent djs-
|
|
29086
|
+
const container = domify$1(`<div class="djs-popup-parent djs-scrollable" data-popup=${config.provider}></div>`);
|
|
29052
29087
|
|
|
29053
29088
|
parent.appendChild(container);
|
|
29054
29089
|
|
|
@@ -39927,6 +39962,7 @@
|
|
|
39927
39962
|
var directEditing = injector.get('directEditing', false);
|
|
39928
39963
|
var searchPad = injector.get('searchPad', false);
|
|
39929
39964
|
var modeling = injector.get('modeling', false);
|
|
39965
|
+
var contextPad = injector.get('contextPad', false);
|
|
39930
39966
|
|
|
39931
39967
|
// (2) check components and register actions
|
|
39932
39968
|
|
|
@@ -40050,6 +40086,12 @@
|
|
|
40050
40086
|
});
|
|
40051
40087
|
}
|
|
40052
40088
|
|
|
40089
|
+
if (selection && contextPad) {
|
|
40090
|
+
this._registerAction('replaceElement', function(event) {
|
|
40091
|
+
contextPad.triggerEntry('replace', 'click', event);
|
|
40092
|
+
});
|
|
40093
|
+
}
|
|
40094
|
+
|
|
40053
40095
|
};
|
|
40054
40096
|
|
|
40055
40097
|
var EditorActionsModule = {
|
|
@@ -41168,6 +41210,23 @@
|
|
|
41168
41210
|
}
|
|
41169
41211
|
});
|
|
41170
41212
|
|
|
41213
|
+
// activate replace element
|
|
41214
|
+
// R
|
|
41215
|
+
addListener('replaceElement', function(context) {
|
|
41216
|
+
|
|
41217
|
+
var event = context.keyEvent;
|
|
41218
|
+
|
|
41219
|
+
if (keyboard.hasModifier(event)) {
|
|
41220
|
+
return;
|
|
41221
|
+
}
|
|
41222
|
+
|
|
41223
|
+
if (keyboard.isKey([ 'r', 'R' ], event)) {
|
|
41224
|
+
editorActions.trigger('replaceElement', event);
|
|
41225
|
+
|
|
41226
|
+
return true;
|
|
41227
|
+
}
|
|
41228
|
+
});
|
|
41229
|
+
|
|
41171
41230
|
};
|
|
41172
41231
|
|
|
41173
41232
|
var KeyboardModule = {
|
|
@@ -64453,10 +64512,11 @@
|
|
|
64453
64512
|
/**
|
|
64454
64513
|
Create a selection range.
|
|
64455
64514
|
*/
|
|
64456
|
-
static range(anchor, head, goalColumn) {
|
|
64457
|
-
let
|
|
64458
|
-
|
|
64459
|
-
|
|
64515
|
+
static range(anchor, head, goalColumn, bidiLevel) {
|
|
64516
|
+
let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) |
|
|
64517
|
+
(bidiLevel == null ? 3 : Math.min(2, bidiLevel));
|
|
64518
|
+
return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags)
|
|
64519
|
+
: SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags);
|
|
64460
64520
|
}
|
|
64461
64521
|
/**
|
|
64462
64522
|
@internal
|
|
@@ -67286,6 +67346,26 @@
|
|
|
67286
67346
|
}
|
|
67287
67347
|
}
|
|
67288
67348
|
}
|
|
67349
|
+
function scrollableParent(dom) {
|
|
67350
|
+
let doc = dom.ownerDocument;
|
|
67351
|
+
for (let cur = dom.parentNode; cur;) {
|
|
67352
|
+
if (cur == doc.body) {
|
|
67353
|
+
break;
|
|
67354
|
+
}
|
|
67355
|
+
else if (cur.nodeType == 1) {
|
|
67356
|
+
if (cur.scrollHeight > cur.clientHeight || cur.scrollWidth > cur.clientWidth)
|
|
67357
|
+
return cur;
|
|
67358
|
+
cur = cur.assignedSlot || cur.parentNode;
|
|
67359
|
+
}
|
|
67360
|
+
else if (cur.nodeType == 11) {
|
|
67361
|
+
cur = cur.host;
|
|
67362
|
+
}
|
|
67363
|
+
else {
|
|
67364
|
+
break;
|
|
67365
|
+
}
|
|
67366
|
+
}
|
|
67367
|
+
return null;
|
|
67368
|
+
}
|
|
67289
67369
|
class DOMSelectionState {
|
|
67290
67370
|
constructor() {
|
|
67291
67371
|
this.anchorNode = null;
|
|
@@ -68422,7 +68502,9 @@
|
|
|
68422
68502
|
super(-200000000 /* Side.Line */, -200000000 /* Side.Line */, null, spec);
|
|
68423
68503
|
}
|
|
68424
68504
|
eq(other) {
|
|
68425
|
-
return other instanceof LineDecoration &&
|
|
68505
|
+
return other instanceof LineDecoration &&
|
|
68506
|
+
this.spec.class == other.spec.class &&
|
|
68507
|
+
attrsEq(this.spec.attributes, other.spec.attributes);
|
|
68426
68508
|
}
|
|
68427
68509
|
range(from, to = from) {
|
|
68428
68510
|
if (to != from)
|
|
@@ -68697,6 +68779,7 @@
|
|
|
68697
68779
|
this.curLine = null;
|
|
68698
68780
|
this.breakAtStart = 0;
|
|
68699
68781
|
this.pendingBuffer = 0 /* Buf.No */;
|
|
68782
|
+
this.bufferMarks = [];
|
|
68700
68783
|
// Set to false directly after a widget that covers the position after it
|
|
68701
68784
|
this.atCursorPos = true;
|
|
68702
68785
|
this.openStart = -1;
|
|
@@ -68719,20 +68802,20 @@
|
|
|
68719
68802
|
}
|
|
68720
68803
|
return this.curLine;
|
|
68721
68804
|
}
|
|
68722
|
-
flushBuffer(active) {
|
|
68805
|
+
flushBuffer(active = this.bufferMarks) {
|
|
68723
68806
|
if (this.pendingBuffer) {
|
|
68724
68807
|
this.curLine.append(wrapMarks(new WidgetBufferView(-1), active), active.length);
|
|
68725
68808
|
this.pendingBuffer = 0 /* Buf.No */;
|
|
68726
68809
|
}
|
|
68727
68810
|
}
|
|
68728
68811
|
addBlockWidget(view) {
|
|
68729
|
-
this.flushBuffer(
|
|
68812
|
+
this.flushBuffer();
|
|
68730
68813
|
this.curLine = null;
|
|
68731
68814
|
this.content.push(view);
|
|
68732
68815
|
}
|
|
68733
68816
|
finish(openEnd) {
|
|
68734
|
-
if (
|
|
68735
|
-
this.flushBuffer(
|
|
68817
|
+
if (this.pendingBuffer && openEnd <= this.bufferMarks.length)
|
|
68818
|
+
this.flushBuffer();
|
|
68736
68819
|
else
|
|
68737
68820
|
this.pendingBuffer = 0 /* Buf.No */;
|
|
68738
68821
|
if (!this.posCovered())
|
|
@@ -68752,8 +68835,9 @@
|
|
|
68752
68835
|
this.content[this.content.length - 1].breakAfter = 1;
|
|
68753
68836
|
else
|
|
68754
68837
|
this.breakAtStart = 1;
|
|
68755
|
-
this.flushBuffer(
|
|
68838
|
+
this.flushBuffer();
|
|
68756
68839
|
this.curLine = null;
|
|
68840
|
+
this.atCursorPos = true;
|
|
68757
68841
|
length--;
|
|
68758
68842
|
continue;
|
|
68759
68843
|
}
|
|
@@ -68795,7 +68879,7 @@
|
|
|
68795
68879
|
else {
|
|
68796
68880
|
let view = WidgetView.create(deco.widget || new NullWidget("span"), len, len ? 0 : deco.startSide);
|
|
68797
68881
|
let cursorBefore = this.atCursorPos && !view.isEditable && openStart <= active.length && (from < to || deco.startSide > 0);
|
|
68798
|
-
let cursorAfter = !view.isEditable && (from < to || deco.startSide <= 0);
|
|
68882
|
+
let cursorAfter = !view.isEditable && (from < to || openStart > active.length || deco.startSide <= 0);
|
|
68799
68883
|
let line = this.getLine();
|
|
68800
68884
|
if (this.pendingBuffer == 2 /* Buf.IfCursor */ && !cursorBefore)
|
|
68801
68885
|
this.pendingBuffer = 0 /* Buf.No */;
|
|
@@ -68806,7 +68890,9 @@
|
|
|
68806
68890
|
}
|
|
68807
68891
|
line.append(wrapMarks(view, active), openStart);
|
|
68808
68892
|
this.atCursorPos = cursorAfter;
|
|
68809
|
-
this.pendingBuffer = !cursorAfter ? 0 /* Buf.No */ : from < to ? 1 /* Buf.Yes */ : 2 /* Buf.IfCursor */;
|
|
68893
|
+
this.pendingBuffer = !cursorAfter ? 0 /* Buf.No */ : from < to || openStart > active.length ? 1 /* Buf.Yes */ : 2 /* Buf.IfCursor */;
|
|
68894
|
+
if (this.pendingBuffer)
|
|
68895
|
+
this.bufferMarks = active.slice();
|
|
68810
68896
|
}
|
|
68811
68897
|
}
|
|
68812
68898
|
else if (this.doc.lineAt(this.pos).from == this.pos) { // Line decoration
|
|
@@ -70480,22 +70566,30 @@
|
|
|
70480
70566
|
this.compositionFirstChange = null;
|
|
70481
70567
|
this.compositionEndedAt = 0;
|
|
70482
70568
|
this.mouseSelection = null;
|
|
70569
|
+
let handleEvent = (handler, event) => {
|
|
70570
|
+
if (this.ignoreDuringComposition(event))
|
|
70571
|
+
return;
|
|
70572
|
+
if (event.type == "keydown" && this.keydown(view, event))
|
|
70573
|
+
return;
|
|
70574
|
+
if (this.mustFlushObserver(event))
|
|
70575
|
+
view.observer.forceFlush();
|
|
70576
|
+
if (this.runCustomHandlers(event.type, view, event))
|
|
70577
|
+
event.preventDefault();
|
|
70578
|
+
else
|
|
70579
|
+
handler(view, event);
|
|
70580
|
+
};
|
|
70483
70581
|
for (let type in handlers) {
|
|
70484
70582
|
let handler = handlers[type];
|
|
70485
|
-
view.contentDOM.addEventListener(type,
|
|
70486
|
-
if (
|
|
70487
|
-
|
|
70488
|
-
if (type == "keydown" && this.keydown(view, event))
|
|
70489
|
-
return;
|
|
70490
|
-
if (this.mustFlushObserver(event))
|
|
70491
|
-
view.observer.forceFlush();
|
|
70492
|
-
if (this.runCustomHandlers(type, view, event))
|
|
70493
|
-
event.preventDefault();
|
|
70494
|
-
else
|
|
70495
|
-
handler(view, event);
|
|
70583
|
+
view.contentDOM.addEventListener(type, event => {
|
|
70584
|
+
if (eventBelongsToEditor(view, event))
|
|
70585
|
+
handleEvent(handler, event);
|
|
70496
70586
|
}, handlerOptions[type]);
|
|
70497
70587
|
this.registeredEvents.push(type);
|
|
70498
70588
|
}
|
|
70589
|
+
view.scrollDOM.addEventListener("mousedown", (event) => {
|
|
70590
|
+
if (event.target == view.scrollDOM)
|
|
70591
|
+
handleEvent(handlers.mousedown, event);
|
|
70592
|
+
});
|
|
70499
70593
|
if (browser.chrome && browser.chrome_version == 102) { // FIXME remove at some point
|
|
70500
70594
|
// On Chrome 102, viewport updates somehow stop wheel-based
|
|
70501
70595
|
// scrolling. Turning off pointer events during the scroll seems
|
|
@@ -70652,12 +70746,18 @@
|
|
|
70652
70746
|
const EmacsyPendingKeys = "dthko";
|
|
70653
70747
|
// Key codes for modifier keys
|
|
70654
70748
|
const modifierCodes = [16, 17, 18, 20, 91, 92, 224, 225];
|
|
70749
|
+
function dragScrollSpeed(dist) {
|
|
70750
|
+
return dist * 0.7 + 8;
|
|
70751
|
+
}
|
|
70655
70752
|
class MouseSelection {
|
|
70656
70753
|
constructor(view, startEvent, style, mustSelect) {
|
|
70657
70754
|
this.view = view;
|
|
70658
70755
|
this.style = style;
|
|
70659
70756
|
this.mustSelect = mustSelect;
|
|
70757
|
+
this.scrollSpeed = { x: 0, y: 0 };
|
|
70758
|
+
this.scrolling = -1;
|
|
70660
70759
|
this.lastEvent = startEvent;
|
|
70760
|
+
this.scrollParent = scrollableParent(view.contentDOM);
|
|
70661
70761
|
let doc = view.contentDOM.ownerDocument;
|
|
70662
70762
|
doc.addEventListener("mousemove", this.move = this.move.bind(this));
|
|
70663
70763
|
doc.addEventListener("mouseup", this.up = this.up.bind(this));
|
|
@@ -70673,11 +70773,24 @@
|
|
|
70673
70773
|
}
|
|
70674
70774
|
}
|
|
70675
70775
|
move(event) {
|
|
70776
|
+
var _a;
|
|
70676
70777
|
if (event.buttons == 0)
|
|
70677
70778
|
return this.destroy();
|
|
70678
70779
|
if (this.dragging !== false)
|
|
70679
70780
|
return;
|
|
70680
70781
|
this.select(this.lastEvent = event);
|
|
70782
|
+
let sx = 0, sy = 0;
|
|
70783
|
+
let rect = ((_a = this.scrollParent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect())
|
|
70784
|
+
|| { left: 0, top: 0, right: this.view.win.innerWidth, bottom: this.view.win.innerHeight };
|
|
70785
|
+
if (event.clientX <= rect.left)
|
|
70786
|
+
sx = -dragScrollSpeed(rect.left - event.clientX);
|
|
70787
|
+
else if (event.clientX >= rect.right)
|
|
70788
|
+
sx = dragScrollSpeed(event.clientX - rect.right);
|
|
70789
|
+
if (event.clientY <= rect.top)
|
|
70790
|
+
sy = -dragScrollSpeed(rect.top - event.clientY);
|
|
70791
|
+
else if (event.clientY >= rect.bottom)
|
|
70792
|
+
sy = dragScrollSpeed(event.clientY - rect.bottom);
|
|
70793
|
+
this.setScrollSpeed(sx, sy);
|
|
70681
70794
|
}
|
|
70682
70795
|
up(event) {
|
|
70683
70796
|
if (this.dragging == null)
|
|
@@ -70687,19 +70800,41 @@
|
|
|
70687
70800
|
this.destroy();
|
|
70688
70801
|
}
|
|
70689
70802
|
destroy() {
|
|
70803
|
+
this.setScrollSpeed(0, 0);
|
|
70690
70804
|
let doc = this.view.contentDOM.ownerDocument;
|
|
70691
70805
|
doc.removeEventListener("mousemove", this.move);
|
|
70692
70806
|
doc.removeEventListener("mouseup", this.up);
|
|
70693
70807
|
this.view.inputState.mouseSelection = null;
|
|
70694
70808
|
}
|
|
70809
|
+
setScrollSpeed(sx, sy) {
|
|
70810
|
+
this.scrollSpeed = { x: sx, y: sy };
|
|
70811
|
+
if (sx || sy) {
|
|
70812
|
+
if (this.scrolling < 0)
|
|
70813
|
+
this.scrolling = setInterval(() => this.scroll(), 50);
|
|
70814
|
+
}
|
|
70815
|
+
else if (this.scrolling > -1) {
|
|
70816
|
+
clearInterval(this.scrolling);
|
|
70817
|
+
this.scrolling = -1;
|
|
70818
|
+
}
|
|
70819
|
+
}
|
|
70820
|
+
scroll() {
|
|
70821
|
+
if (this.scrollParent) {
|
|
70822
|
+
this.scrollParent.scrollLeft += this.scrollSpeed.x;
|
|
70823
|
+
this.scrollParent.scrollTop += this.scrollSpeed.y;
|
|
70824
|
+
}
|
|
70825
|
+
else {
|
|
70826
|
+
this.view.win.scrollBy(this.scrollSpeed.x, this.scrollSpeed.y);
|
|
70827
|
+
}
|
|
70828
|
+
if (this.dragging === false)
|
|
70829
|
+
this.select(this.lastEvent);
|
|
70830
|
+
}
|
|
70695
70831
|
select(event) {
|
|
70696
70832
|
let selection = this.style.get(event, this.extend, this.multiple);
|
|
70697
70833
|
if (this.mustSelect || !selection.eq(this.view.state.selection) ||
|
|
70698
70834
|
selection.main.assoc != this.view.state.selection.main.assoc)
|
|
70699
70835
|
this.view.dispatch({
|
|
70700
70836
|
selection,
|
|
70701
|
-
userEvent: "select.pointer"
|
|
70702
|
-
scrollIntoView: true
|
|
70837
|
+
userEvent: "select.pointer"
|
|
70703
70838
|
});
|
|
70704
70839
|
this.mustSelect = false;
|
|
70705
70840
|
}
|
|
@@ -70890,23 +71025,15 @@
|
|
|
70890
71025
|
function basicMouseSelection(view, event) {
|
|
70891
71026
|
let start = queryPos(view, event), type = getClickType(event);
|
|
70892
71027
|
let startSel = view.state.selection;
|
|
70893
|
-
let last = start, lastEvent = event;
|
|
70894
71028
|
return {
|
|
70895
71029
|
update(update) {
|
|
70896
71030
|
if (update.docChanged) {
|
|
70897
71031
|
start.pos = update.changes.mapPos(start.pos);
|
|
70898
71032
|
startSel = startSel.map(update.changes);
|
|
70899
|
-
lastEvent = null;
|
|
70900
71033
|
}
|
|
70901
71034
|
},
|
|
70902
71035
|
get(event, extend, multiple) {
|
|
70903
|
-
let cur;
|
|
70904
|
-
if (lastEvent && event.clientX == lastEvent.clientX && event.clientY == lastEvent.clientY)
|
|
70905
|
-
cur = last;
|
|
70906
|
-
else {
|
|
70907
|
-
cur = last = queryPos(view, event);
|
|
70908
|
-
lastEvent = event;
|
|
70909
|
-
}
|
|
71036
|
+
let cur = queryPos(view, event);
|
|
70910
71037
|
let range = rangeForClick(view, cur.pos, cur.bias, type);
|
|
70911
71038
|
if (start.pos != cur.pos && !extend) {
|
|
70912
71039
|
let startRange = rangeForClick(view, start.pos, start.bias, type);
|
|
@@ -72352,7 +72479,7 @@
|
|
|
72352
72479
|
});
|
|
72353
72480
|
}
|
|
72354
72481
|
const baseTheme$1$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
|
72355
|
-
"
|
|
72482
|
+
"&": {
|
|
72356
72483
|
position: "relative !important",
|
|
72357
72484
|
boxSizing: "border-box",
|
|
72358
72485
|
"&.cm-focused": {
|
|
@@ -72383,7 +72510,6 @@
|
|
|
72383
72510
|
margin: 0,
|
|
72384
72511
|
flexGrow: 2,
|
|
72385
72512
|
flexShrink: 0,
|
|
72386
|
-
minHeight: "100%",
|
|
72387
72513
|
display: "block",
|
|
72388
72514
|
whiteSpace: "pre",
|
|
72389
72515
|
wordWrap: "normal",
|
|
@@ -72405,14 +72531,13 @@
|
|
|
72405
72531
|
"&dark .cm-content": { caretColor: "white" },
|
|
72406
72532
|
".cm-line": {
|
|
72407
72533
|
display: "block",
|
|
72408
|
-
padding: "0 2px 0
|
|
72534
|
+
padding: "0 2px 0 6px"
|
|
72409
72535
|
},
|
|
72410
|
-
".cm-
|
|
72411
|
-
|
|
72412
|
-
|
|
72413
|
-
|
|
72414
|
-
|
|
72415
|
-
position: "absolute",
|
|
72536
|
+
".cm-layer": {
|
|
72537
|
+
contain: "size style",
|
|
72538
|
+
"& > *": {
|
|
72539
|
+
position: "absolute"
|
|
72540
|
+
}
|
|
72416
72541
|
},
|
|
72417
72542
|
"&light .cm-selectionBackground": {
|
|
72418
72543
|
background: "#d9d9d9"
|
|
@@ -72427,8 +72552,6 @@
|
|
|
72427
72552
|
background: "#233"
|
|
72428
72553
|
},
|
|
72429
72554
|
".cm-cursorLayer": {
|
|
72430
|
-
zIndex: 100,
|
|
72431
|
-
contain: "size style",
|
|
72432
72555
|
pointerEvents: "none"
|
|
72433
72556
|
},
|
|
72434
72557
|
"&.cm-focused .cm-cursorLayer": {
|
|
@@ -72440,7 +72563,6 @@
|
|
|
72440
72563
|
"@keyframes cm-blink": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },
|
|
72441
72564
|
"@keyframes cm-blink2": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },
|
|
72442
72565
|
".cm-cursor, .cm-dropCursor": {
|
|
72443
|
-
position: "absolute",
|
|
72444
72566
|
borderLeft: "1.2px solid black",
|
|
72445
72567
|
marginLeft: "-0.6px",
|
|
72446
72568
|
pointerEvents: "none",
|
|
@@ -72534,6 +72656,21 @@
|
|
|
72534
72656
|
display: "inline-block",
|
|
72535
72657
|
verticalAlign: "top",
|
|
72536
72658
|
},
|
|
72659
|
+
".cm-highlightSpace:before": {
|
|
72660
|
+
content: "attr(data-display)",
|
|
72661
|
+
position: "absolute",
|
|
72662
|
+
pointerEvents: "none",
|
|
72663
|
+
color: "#888"
|
|
72664
|
+
},
|
|
72665
|
+
".cm-highlightTab": {
|
|
72666
|
+
backgroundImage: `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,
|
|
72667
|
+
backgroundSize: "auto 100%",
|
|
72668
|
+
backgroundPosition: "right 90%",
|
|
72669
|
+
backgroundRepeat: "no-repeat"
|
|
72670
|
+
},
|
|
72671
|
+
".cm-trailingSpace": {
|
|
72672
|
+
backgroundColor: "#ff332255"
|
|
72673
|
+
},
|
|
72537
72674
|
".cm-button": {
|
|
72538
72675
|
verticalAlign: "middle",
|
|
72539
72676
|
color: "inherit",
|
|
@@ -72626,7 +72763,7 @@
|
|
|
72626
72763
|
insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };
|
|
72627
72764
|
}
|
|
72628
72765
|
}
|
|
72629
|
-
else if (newSel && (!view.hasFocus
|
|
72766
|
+
else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
|
|
72630
72767
|
newSel = null;
|
|
72631
72768
|
}
|
|
72632
72769
|
if (!change && !newSel)
|
|
@@ -72836,7 +72973,8 @@
|
|
|
72836
72973
|
this.lastChange = 0;
|
|
72837
72974
|
this.scrollTargets = [];
|
|
72838
72975
|
this.intersection = null;
|
|
72839
|
-
this.
|
|
72976
|
+
this.resizeScroll = null;
|
|
72977
|
+
this.resizeContent = null;
|
|
72840
72978
|
this.intersecting = false;
|
|
72841
72979
|
this.gapIntersection = null;
|
|
72842
72980
|
this.gaps = [];
|
|
@@ -72874,12 +73012,14 @@
|
|
|
72874
73012
|
this.onPrint = this.onPrint.bind(this);
|
|
72875
73013
|
this.onScroll = this.onScroll.bind(this);
|
|
72876
73014
|
if (typeof ResizeObserver == "function") {
|
|
72877
|
-
this.
|
|
73015
|
+
this.resizeScroll = new ResizeObserver(() => {
|
|
72878
73016
|
var _a;
|
|
72879
73017
|
if (((_a = this.view.docView) === null || _a === void 0 ? void 0 : _a.lastUpdate) < Date.now() - 75)
|
|
72880
73018
|
this.onResize();
|
|
72881
73019
|
});
|
|
72882
|
-
this.
|
|
73020
|
+
this.resizeScroll.observe(view.scrollDOM);
|
|
73021
|
+
this.resizeContent = new ResizeObserver(() => this.view.requestMeasure());
|
|
73022
|
+
this.resizeContent.observe(view.contentDOM);
|
|
72883
73023
|
}
|
|
72884
73024
|
this.addWindowListeners(this.win = view.win);
|
|
72885
73025
|
this.start();
|
|
@@ -73198,11 +73338,12 @@
|
|
|
73198
73338
|
win.document.removeEventListener("selectionchange", this.onSelectionChange);
|
|
73199
73339
|
}
|
|
73200
73340
|
destroy() {
|
|
73201
|
-
var _a, _b, _c;
|
|
73341
|
+
var _a, _b, _c, _d;
|
|
73202
73342
|
this.stop();
|
|
73203
73343
|
(_a = this.intersection) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
73204
73344
|
(_b = this.gapIntersection) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
73205
|
-
(_c = this.
|
|
73345
|
+
(_c = this.resizeScroll) === null || _c === void 0 ? void 0 : _c.disconnect();
|
|
73346
|
+
(_d = this.resizeContent) === null || _d === void 0 ? void 0 : _d.disconnect();
|
|
73206
73347
|
for (let dom of this.scrollTargets)
|
|
73207
73348
|
dom.removeEventListener("scroll", this.onScroll);
|
|
73208
73349
|
this.removeWindowListeners(this.win);
|
|
@@ -73301,7 +73442,7 @@
|
|
|
73301
73442
|
this.scrollDOM.className = "cm-scroller";
|
|
73302
73443
|
this.scrollDOM.appendChild(this.contentDOM);
|
|
73303
73444
|
this.announceDOM = document.createElement("div");
|
|
73304
|
-
this.announceDOM.style.cssText = "position:
|
|
73445
|
+
this.announceDOM.style.cssText = "position: fixed; top: -10000px";
|
|
73305
73446
|
this.announceDOM.setAttribute("aria-live", "polite");
|
|
73306
73447
|
this.dom = document.createElement("div");
|
|
73307
73448
|
this.dom.appendChild(this.announceDOM);
|
|
@@ -73686,6 +73827,8 @@
|
|
|
73686
73827
|
if (this.measureScheduled < 0)
|
|
73687
73828
|
this.measureScheduled = this.win.requestAnimationFrame(() => this.measure());
|
|
73688
73829
|
if (request) {
|
|
73830
|
+
if (this.measureRequests.indexOf(request) > -1)
|
|
73831
|
+
return;
|
|
73689
73832
|
if (request.key != null)
|
|
73690
73833
|
for (let i = 0; i < this.measureRequests.length; i++) {
|
|
73691
73834
|
if (this.measureRequests[i].key === request.key) {
|
|
@@ -74361,6 +74504,8 @@
|
|
|
74361
74504
|
if (runFor(scopeObj[prefix + modifiers(name, event, !isChar)]))
|
|
74362
74505
|
return true;
|
|
74363
74506
|
if (isChar && (event.altKey || event.metaKey || event.ctrlKey) &&
|
|
74507
|
+
// Ctrl-Alt may be used for AltGr on Windows
|
|
74508
|
+
!(browser.windows && event.ctrlKey && event.altKey) &&
|
|
74364
74509
|
(baseName = base[event.keyCode]) && baseName != name) {
|
|
74365
74510
|
if (runFor(scopeObj[prefix + modifiers(baseName, event, true)]))
|
|
74366
74511
|
return true;
|
|
@@ -74598,6 +74743,17 @@
|
|
|
74598
74743
|
: pos.bottom + (size.bottom - size.top) + offset.y > space.bottom) &&
|
|
74599
74744
|
above == (space.bottom - pos.bottom > pos.top - space.top))
|
|
74600
74745
|
above = !above;
|
|
74746
|
+
let spaceVert = (above ? pos.top - space.top : space.bottom - pos.bottom) - arrowHeight;
|
|
74747
|
+
if (spaceVert < height && tView.resize !== false) {
|
|
74748
|
+
if (spaceVert < this.view.defaultLineHeight) {
|
|
74749
|
+
dom.style.top = Outside;
|
|
74750
|
+
continue;
|
|
74751
|
+
}
|
|
74752
|
+
dom.style.height = (height = spaceVert) + "px";
|
|
74753
|
+
}
|
|
74754
|
+
else if (dom.style.height) {
|
|
74755
|
+
dom.style.height = "";
|
|
74756
|
+
}
|
|
74601
74757
|
let top = above ? pos.top - height - arrowHeight - offset.y : pos.bottom + arrowHeight + offset.y;
|
|
74602
74758
|
let right = left + width;
|
|
74603
74759
|
if (tView.overlap !== true)
|
|
@@ -74641,7 +74797,8 @@
|
|
|
74641
74797
|
});
|
|
74642
74798
|
const baseTheme$4 = /*@__PURE__*/EditorView.baseTheme({
|
|
74643
74799
|
".cm-tooltip": {
|
|
74644
|
-
zIndex: 100
|
|
74800
|
+
zIndex: 100,
|
|
74801
|
+
boxSizing: "border-box"
|
|
74645
74802
|
},
|
|
74646
74803
|
"&light .cm-tooltip": {
|
|
74647
74804
|
border: "1px solid #bbb",
|
|
@@ -75206,8 +75363,8 @@
|
|
|
75206
75363
|
/// Define a node type.
|
|
75207
75364
|
static define(spec) {
|
|
75208
75365
|
let props = spec.props && spec.props.length ? Object.create(null) : noProps;
|
|
75209
|
-
let flags = (spec.top ? 1 /* Top */ : 0) | (spec.skipped ? 2 /* Skipped */ : 0) |
|
|
75210
|
-
(spec.error ? 4 /* Error */ : 0) | (spec.name == null ? 8 /* Anonymous */ : 0);
|
|
75366
|
+
let flags = (spec.top ? 1 /* NodeFlag.Top */ : 0) | (spec.skipped ? 2 /* NodeFlag.Skipped */ : 0) |
|
|
75367
|
+
(spec.error ? 4 /* NodeFlag.Error */ : 0) | (spec.name == null ? 8 /* NodeFlag.Anonymous */ : 0);
|
|
75211
75368
|
let type = new NodeType(spec.name || "", props, spec.id, flags);
|
|
75212
75369
|
if (spec.props)
|
|
75213
75370
|
for (let src of spec.props) {
|
|
@@ -75225,14 +75382,14 @@
|
|
|
75225
75382
|
/// the prop isn't present on this node.
|
|
75226
75383
|
prop(prop) { return this.props[prop.id]; }
|
|
75227
75384
|
/// True when this is the top node of a grammar.
|
|
75228
|
-
get isTop() { return (this.flags & 1 /* Top */) > 0; }
|
|
75385
|
+
get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }
|
|
75229
75386
|
/// True when this node is produced by a skip rule.
|
|
75230
|
-
get isSkipped() { return (this.flags & 2 /* Skipped */) > 0; }
|
|
75387
|
+
get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }
|
|
75231
75388
|
/// Indicates whether this is an error node.
|
|
75232
|
-
get isError() { return (this.flags & 4 /* Error */) > 0; }
|
|
75389
|
+
get isError() { return (this.flags & 4 /* NodeFlag.Error */) > 0; }
|
|
75233
75390
|
/// When true, this node type doesn't correspond to a user-declared
|
|
75234
75391
|
/// named node, for example because it is used to cache repetition.
|
|
75235
|
-
get isAnonymous() { return (this.flags & 8 /* Anonymous */) > 0; }
|
|
75392
|
+
get isAnonymous() { return (this.flags & 8 /* NodeFlag.Anonymous */) > 0; }
|
|
75236
75393
|
/// Returns true when this node's name or one of its
|
|
75237
75394
|
/// [groups](#common.NodeProp^group) matches the given string.
|
|
75238
75395
|
is(name) {
|
|
@@ -75265,7 +75422,7 @@
|
|
|
75265
75422
|
}
|
|
75266
75423
|
}
|
|
75267
75424
|
/// An empty dummy node type to use when no actual type is available.
|
|
75268
|
-
NodeType.none = new NodeType("", Object.create(null), 0, 8 /* Anonymous */);
|
|
75425
|
+
NodeType.none = new NodeType("", Object.create(null), 0, 8 /* NodeFlag.Anonymous */);
|
|
75269
75426
|
/// A node set holds a collection of node types. It is used to
|
|
75270
75427
|
/// compactly represent trees by storing their type ids, rather than a
|
|
75271
75428
|
/// full pointer to the type object, in a numeric array. Each parser
|
|
@@ -75474,7 +75631,7 @@
|
|
|
75474
75631
|
/// which may have children grouped into subtrees with type
|
|
75475
75632
|
/// [`NodeType.none`](#common.NodeType^none).
|
|
75476
75633
|
balance(config = {}) {
|
|
75477
|
-
return this.children.length <= 8 /* BranchFactor */ ? this :
|
|
75634
|
+
return this.children.length <= 8 /* Balance.BranchFactor */ ? this :
|
|
75478
75635
|
balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));
|
|
75479
75636
|
}
|
|
75480
75637
|
/// Build a tree from a postfix-ordered buffer of node information,
|
|
@@ -75553,26 +75710,27 @@
|
|
|
75553
75710
|
return pick;
|
|
75554
75711
|
}
|
|
75555
75712
|
/// @internal
|
|
75556
|
-
slice(startI, endI, from
|
|
75713
|
+
slice(startI, endI, from) {
|
|
75557
75714
|
let b = this.buffer;
|
|
75558
|
-
let copy = new Uint16Array(endI - startI);
|
|
75715
|
+
let copy = new Uint16Array(endI - startI), len = 0;
|
|
75559
75716
|
for (let i = startI, j = 0; i < endI;) {
|
|
75560
75717
|
copy[j++] = b[i++];
|
|
75561
75718
|
copy[j++] = b[i++] - from;
|
|
75562
|
-
copy[j++] = b[i++] - from;
|
|
75719
|
+
let to = copy[j++] = b[i++] - from;
|
|
75563
75720
|
copy[j++] = b[i++] - startI;
|
|
75721
|
+
len = Math.max(len, to);
|
|
75564
75722
|
}
|
|
75565
|
-
return new TreeBuffer(copy,
|
|
75723
|
+
return new TreeBuffer(copy, len, this.set);
|
|
75566
75724
|
}
|
|
75567
75725
|
}
|
|
75568
75726
|
function checkSide(side, pos, from, to) {
|
|
75569
75727
|
switch (side) {
|
|
75570
|
-
case -2 /* Before */: return from < pos;
|
|
75571
|
-
case -1 /* AtOrBefore */: return to >= pos && from < pos;
|
|
75572
|
-
case 0 /* Around */: return from < pos && to > pos;
|
|
75573
|
-
case 1 /* AtOrAfter */: return from <= pos && to > pos;
|
|
75574
|
-
case 2 /* After */: return to > pos;
|
|
75575
|
-
case 4 /* DontCare */: return true;
|
|
75728
|
+
case -2 /* Side.Before */: return from < pos;
|
|
75729
|
+
case -1 /* Side.AtOrBefore */: return to >= pos && from < pos;
|
|
75730
|
+
case 0 /* Side.Around */: return from < pos && to > pos;
|
|
75731
|
+
case 1 /* Side.AtOrAfter */: return from <= pos && to > pos;
|
|
75732
|
+
case 2 /* Side.After */: return to > pos;
|
|
75733
|
+
case 4 /* Side.DontCare */: return true;
|
|
75576
75734
|
}
|
|
75577
75735
|
}
|
|
75578
75736
|
function enterUnfinishedNodesBefore(node, pos) {
|
|
@@ -75662,10 +75820,10 @@
|
|
|
75662
75820
|
return null;
|
|
75663
75821
|
}
|
|
75664
75822
|
}
|
|
75665
|
-
get firstChild() { return this.nextChild(0, 1, 0, 4 /* DontCare */); }
|
|
75666
|
-
get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* DontCare */); }
|
|
75667
|
-
childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* After */); }
|
|
75668
|
-
childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Before */); }
|
|
75823
|
+
get firstChild() { return this.nextChild(0, 1, 0, 4 /* Side.DontCare */); }
|
|
75824
|
+
get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */); }
|
|
75825
|
+
childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* Side.After */); }
|
|
75826
|
+
childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */); }
|
|
75669
75827
|
enter(pos, side, mode = 0) {
|
|
75670
75828
|
let mounted;
|
|
75671
75829
|
if (!(mode & IterMode.IgnoreOverlays) && (mounted = this._tree.prop(NodeProp.mounted)) && mounted.overlay) {
|
|
@@ -75688,10 +75846,10 @@
|
|
|
75688
75846
|
return this._parent ? this._parent.nextSignificantParent() : null;
|
|
75689
75847
|
}
|
|
75690
75848
|
get nextSibling() {
|
|
75691
|
-
return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* DontCare */) : null;
|
|
75849
|
+
return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* Side.DontCare */) : null;
|
|
75692
75850
|
}
|
|
75693
75851
|
get prevSibling() {
|
|
75694
|
-
return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* DontCare */) : null;
|
|
75852
|
+
return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* Side.DontCare */) : null;
|
|
75695
75853
|
}
|
|
75696
75854
|
cursor(mode = 0) { return new TreeCursor(this, mode); }
|
|
75697
75855
|
get tree() { return this._tree; }
|
|
@@ -75753,24 +75911,24 @@
|
|
|
75753
75911
|
}
|
|
75754
75912
|
}
|
|
75755
75913
|
class BufferNode {
|
|
75914
|
+
get name() { return this.type.name; }
|
|
75915
|
+
get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
|
|
75916
|
+
get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
|
|
75756
75917
|
constructor(context, _parent, index) {
|
|
75757
75918
|
this.context = context;
|
|
75758
75919
|
this._parent = _parent;
|
|
75759
75920
|
this.index = index;
|
|
75760
75921
|
this.type = context.buffer.set.types[context.buffer.buffer[index]];
|
|
75761
75922
|
}
|
|
75762
|
-
get name() { return this.type.name; }
|
|
75763
|
-
get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
|
|
75764
|
-
get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
|
|
75765
75923
|
child(dir, pos, side) {
|
|
75766
75924
|
let { buffer } = this.context;
|
|
75767
75925
|
let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side);
|
|
75768
75926
|
return index < 0 ? null : new BufferNode(this.context, this, index);
|
|
75769
75927
|
}
|
|
75770
|
-
get firstChild() { return this.child(1, 0, 4 /* DontCare */); }
|
|
75771
|
-
get lastChild() { return this.child(-1, 0, 4 /* DontCare */); }
|
|
75772
|
-
childAfter(pos) { return this.child(1, pos, 2 /* After */); }
|
|
75773
|
-
childBefore(pos) { return this.child(-1, pos, -2 /* Before */); }
|
|
75928
|
+
get firstChild() { return this.child(1, 0, 4 /* Side.DontCare */); }
|
|
75929
|
+
get lastChild() { return this.child(-1, 0, 4 /* Side.DontCare */); }
|
|
75930
|
+
childAfter(pos) { return this.child(1, pos, 2 /* Side.After */); }
|
|
75931
|
+
childBefore(pos) { return this.child(-1, pos, -2 /* Side.Before */); }
|
|
75774
75932
|
enter(pos, side, mode = 0) {
|
|
75775
75933
|
if (mode & IterMode.ExcludeBuffers)
|
|
75776
75934
|
return null;
|
|
@@ -75782,7 +75940,7 @@
|
|
|
75782
75940
|
return this._parent || this.context.parent.nextSignificantParent();
|
|
75783
75941
|
}
|
|
75784
75942
|
externalSibling(dir) {
|
|
75785
|
-
return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* DontCare */);
|
|
75943
|
+
return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* Side.DontCare */);
|
|
75786
75944
|
}
|
|
75787
75945
|
get nextSibling() {
|
|
75788
75946
|
let { buffer } = this.context;
|
|
@@ -75796,7 +75954,7 @@
|
|
|
75796
75954
|
let parentStart = this._parent ? this._parent.index + 4 : 0;
|
|
75797
75955
|
if (this.index == parentStart)
|
|
75798
75956
|
return this.externalSibling(-1);
|
|
75799
|
-
return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
|
|
75957
|
+
return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
|
|
75800
75958
|
}
|
|
75801
75959
|
cursor(mode = 0) { return new TreeCursor(this, mode); }
|
|
75802
75960
|
get tree() { return null; }
|
|
@@ -75805,8 +75963,8 @@
|
|
|
75805
75963
|
let { buffer } = this.context;
|
|
75806
75964
|
let startI = this.index + 4, endI = buffer.buffer[this.index + 3];
|
|
75807
75965
|
if (endI > startI) {
|
|
75808
|
-
let from = buffer.buffer[this.index + 1]
|
|
75809
|
-
children.push(buffer.slice(startI, endI, from
|
|
75966
|
+
let from = buffer.buffer[this.index + 1];
|
|
75967
|
+
children.push(buffer.slice(startI, endI, from));
|
|
75810
75968
|
positions.push(0);
|
|
75811
75969
|
}
|
|
75812
75970
|
return new Tree(this.type, children, positions, this.to - this.from);
|
|
@@ -75833,6 +75991,8 @@
|
|
|
75833
75991
|
/// A tree cursor object focuses on a given node in a syntax tree, and
|
|
75834
75992
|
/// allows you to move to adjacent nodes.
|
|
75835
75993
|
class TreeCursor {
|
|
75994
|
+
/// Shorthand for `.type.name`.
|
|
75995
|
+
get name() { return this.type.name; }
|
|
75836
75996
|
/// @internal
|
|
75837
75997
|
constructor(node,
|
|
75838
75998
|
/// @internal
|
|
@@ -75856,8 +76016,6 @@
|
|
|
75856
76016
|
this.yieldBuf(node.index);
|
|
75857
76017
|
}
|
|
75858
76018
|
}
|
|
75859
|
-
/// Shorthand for `.type.name`.
|
|
75860
|
-
get name() { return this.type.name; }
|
|
75861
76019
|
yieldNode(node) {
|
|
75862
76020
|
if (!node)
|
|
75863
76021
|
return false;
|
|
@@ -75902,13 +76060,13 @@
|
|
|
75902
76060
|
}
|
|
75903
76061
|
/// Move the cursor to this node's first child. When this returns
|
|
75904
76062
|
/// false, the node has no child, and the cursor has not been moved.
|
|
75905
|
-
firstChild() { return this.enterChild(1, 0, 4 /* DontCare */); }
|
|
76063
|
+
firstChild() { return this.enterChild(1, 0, 4 /* Side.DontCare */); }
|
|
75906
76064
|
/// Move the cursor to this node's last child.
|
|
75907
|
-
lastChild() { return this.enterChild(-1, 0, 4 /* DontCare */); }
|
|
76065
|
+
lastChild() { return this.enterChild(-1, 0, 4 /* Side.DontCare */); }
|
|
75908
76066
|
/// Move the cursor to the first child that ends after `pos`.
|
|
75909
|
-
childAfter(pos) { return this.enterChild(1, pos, 2 /* After */); }
|
|
76067
|
+
childAfter(pos) { return this.enterChild(1, pos, 2 /* Side.After */); }
|
|
75910
76068
|
/// Move to the last child that starts before `pos`.
|
|
75911
|
-
childBefore(pos) { return this.enterChild(-1, pos, -2 /* Before */); }
|
|
76069
|
+
childBefore(pos) { return this.enterChild(-1, pos, -2 /* Side.Before */); }
|
|
75912
76070
|
/// Move the cursor to the child around `pos`. If side is -1 the
|
|
75913
76071
|
/// child may end at that position, when 1 it may start there. This
|
|
75914
76072
|
/// will also enter [overlaid](#common.MountedTree.overlay)
|
|
@@ -75934,19 +76092,19 @@
|
|
|
75934
76092
|
if (!this.buffer)
|
|
75935
76093
|
return !this._tree._parent ? false
|
|
75936
76094
|
: this.yield(this._tree.index < 0 ? null
|
|
75937
|
-
: this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* DontCare */, this.mode));
|
|
76095
|
+
: this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode));
|
|
75938
76096
|
let { buffer } = this.buffer, d = this.stack.length - 1;
|
|
75939
76097
|
if (dir < 0) {
|
|
75940
76098
|
let parentStart = d < 0 ? 0 : this.stack[d] + 4;
|
|
75941
76099
|
if (this.index != parentStart)
|
|
75942
|
-
return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
|
|
76100
|
+
return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
|
|
75943
76101
|
}
|
|
75944
76102
|
else {
|
|
75945
76103
|
let after = buffer.buffer[this.index + 3];
|
|
75946
76104
|
if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))
|
|
75947
76105
|
return this.yieldBuf(after);
|
|
75948
76106
|
}
|
|
75949
|
-
return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* DontCare */, this.mode)) : false;
|
|
76107
|
+
return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode)) : false;
|
|
75950
76108
|
}
|
|
75951
76109
|
/// Move to this node's next sibling, if any.
|
|
75952
76110
|
nextSibling() { return this.sibling(1); }
|
|
@@ -75983,7 +76141,7 @@
|
|
|
75983
76141
|
return true;
|
|
75984
76142
|
}
|
|
75985
76143
|
move(dir, enter) {
|
|
75986
|
-
if (enter && this.enterChild(dir, 0, 4 /* DontCare */))
|
|
76144
|
+
if (enter && this.enterChild(dir, 0, 4 /* Side.DontCare */))
|
|
75987
76145
|
return true;
|
|
75988
76146
|
for (;;) {
|
|
75989
76147
|
if (this.sibling(dir))
|
|
@@ -75993,7 +76151,7 @@
|
|
|
75993
76151
|
}
|
|
75994
76152
|
}
|
|
75995
76153
|
/// Move to the next node in a
|
|
75996
|
-
/// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-
|
|
76154
|
+
/// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)
|
|
75997
76155
|
/// traversal, going from a node to its first child or, if the
|
|
75998
76156
|
/// current node is empty or `enter` is false, its next sibling or
|
|
75999
76157
|
/// the next sibling of the first parent node that has one.
|
|
@@ -76109,17 +76267,17 @@
|
|
|
76109
76267
|
let lookAheadAtStart = lookAhead;
|
|
76110
76268
|
while (size < 0) {
|
|
76111
76269
|
cursor.next();
|
|
76112
|
-
if (size == -1 /* Reuse */) {
|
|
76270
|
+
if (size == -1 /* SpecialRecord.Reuse */) {
|
|
76113
76271
|
let node = reused[id];
|
|
76114
76272
|
children.push(node);
|
|
76115
76273
|
positions.push(start - parentStart);
|
|
76116
76274
|
return;
|
|
76117
76275
|
}
|
|
76118
|
-
else if (size == -3 /* ContextChange */) { // Context change
|
|
76276
|
+
else if (size == -3 /* SpecialRecord.ContextChange */) { // Context change
|
|
76119
76277
|
contextHash = id;
|
|
76120
76278
|
return;
|
|
76121
76279
|
}
|
|
76122
|
-
else if (size == -4 /* LookAhead */) {
|
|
76280
|
+
else if (size == -4 /* SpecialRecord.LookAhead */) {
|
|
76123
76281
|
lookAhead = id;
|
|
76124
76282
|
return;
|
|
76125
76283
|
}
|
|
@@ -76236,7 +76394,7 @@
|
|
|
76236
76394
|
fork.next();
|
|
76237
76395
|
while (fork.pos > startPos) {
|
|
76238
76396
|
if (fork.size < 0) {
|
|
76239
|
-
if (fork.size == -3 /* ContextChange */)
|
|
76397
|
+
if (fork.size == -3 /* SpecialRecord.ContextChange */)
|
|
76240
76398
|
localSkipped += 4;
|
|
76241
76399
|
else
|
|
76242
76400
|
break scan;
|
|
@@ -76272,10 +76430,10 @@
|
|
|
76272
76430
|
buffer[--index] = start - bufferStart;
|
|
76273
76431
|
buffer[--index] = id;
|
|
76274
76432
|
}
|
|
76275
|
-
else if (size == -3 /* ContextChange */) {
|
|
76433
|
+
else if (size == -3 /* SpecialRecord.ContextChange */) {
|
|
76276
76434
|
contextHash = id;
|
|
76277
76435
|
}
|
|
76278
|
-
else if (size == -4 /* LookAhead */) {
|
|
76436
|
+
else if (size == -4 /* SpecialRecord.LookAhead */) {
|
|
76279
76437
|
lookAhead = id;
|
|
76280
76438
|
}
|
|
76281
76439
|
return index;
|
|
@@ -76322,7 +76480,7 @@
|
|
|
76322
76480
|
let total = 0;
|
|
76323
76481
|
for (let i = from; i < to; i++)
|
|
76324
76482
|
total += nodeSize(balanceType, children[i]);
|
|
76325
|
-
let maxChild = Math.ceil((total * 1.5) / 8 /* BranchFactor */);
|
|
76483
|
+
let maxChild = Math.ceil((total * 1.5) / 8 /* Balance.BranchFactor */);
|
|
76326
76484
|
let localChildren = [], localPositions = [];
|
|
76327
76485
|
function divide(children, positions, from, to, offset) {
|
|
76328
76486
|
for (let i = from; i < to;) {
|
|
@@ -76383,16 +76541,16 @@
|
|
|
76383
76541
|
this.to = to;
|
|
76384
76542
|
this.tree = tree;
|
|
76385
76543
|
this.offset = offset;
|
|
76386
|
-
this.open = (openStart ? 1 /* Start */ : 0) | (openEnd ? 2 /* End */ : 0);
|
|
76544
|
+
this.open = (openStart ? 1 /* Open.Start */ : 0) | (openEnd ? 2 /* Open.End */ : 0);
|
|
76387
76545
|
}
|
|
76388
76546
|
/// Whether the start of the fragment represents the start of a
|
|
76389
76547
|
/// parse, or the end of a change. (In the second case, it may not
|
|
76390
76548
|
/// be safe to reuse some nodes at the start, depending on the
|
|
76391
76549
|
/// parsing algorithm.)
|
|
76392
|
-
get openStart() { return (this.open & 1 /* Start */) > 0; }
|
|
76550
|
+
get openStart() { return (this.open & 1 /* Open.Start */) > 0; }
|
|
76393
76551
|
/// Whether the end of the fragment represents the end of a
|
|
76394
76552
|
/// full-document parse, or the start of a change.
|
|
76395
|
-
get openEnd() { return (this.open & 2 /* End */) > 0; }
|
|
76553
|
+
get openEnd() { return (this.open & 2 /* Open.End */) > 0; }
|
|
76396
76554
|
/// Create a set of fragments from a freshly parsed tree, or update
|
|
76397
76555
|
/// an existing set of fragments by replacing the ones that overlap
|
|
76398
76556
|
/// with a tree with content from the new tree. When `partial` is
|
|
@@ -76636,10 +76794,10 @@
|
|
|
76636
76794
|
tags = [tags];
|
|
76637
76795
|
for (let part of prop.split(" "))
|
|
76638
76796
|
if (part) {
|
|
76639
|
-
let pieces = [], mode = 2 /* Normal */, rest = part;
|
|
76797
|
+
let pieces = [], mode = 2 /* Mode.Normal */, rest = part;
|
|
76640
76798
|
for (let pos = 0;;) {
|
|
76641
76799
|
if (rest == "..." && pos > 0 && pos + 3 == part.length) {
|
|
76642
|
-
mode = 1 /* Inherit */;
|
|
76800
|
+
mode = 1 /* Mode.Inherit */;
|
|
76643
76801
|
break;
|
|
76644
76802
|
}
|
|
76645
76803
|
let m = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest);
|
|
@@ -76651,7 +76809,7 @@
|
|
|
76651
76809
|
break;
|
|
76652
76810
|
let next = part[pos++];
|
|
76653
76811
|
if (pos == part.length && next == "!") {
|
|
76654
|
-
mode = 0 /* Opaque */;
|
|
76812
|
+
mode = 0 /* Mode.Opaque */;
|
|
76655
76813
|
break;
|
|
76656
76814
|
}
|
|
76657
76815
|
if (next != "/")
|
|
@@ -76675,8 +76833,8 @@
|
|
|
76675
76833
|
this.context = context;
|
|
76676
76834
|
this.next = next;
|
|
76677
76835
|
}
|
|
76678
|
-
get opaque() { return this.mode == 0 /* Opaque */; }
|
|
76679
|
-
get inherit() { return this.mode == 1 /* Inherit */; }
|
|
76836
|
+
get opaque() { return this.mode == 0 /* Mode.Opaque */; }
|
|
76837
|
+
get inherit() { return this.mode == 1 /* Mode.Inherit */; }
|
|
76680
76838
|
sort(other) {
|
|
76681
76839
|
if (!other || other.depth < this.depth) {
|
|
76682
76840
|
this.next = other;
|
|
@@ -76687,7 +76845,7 @@
|
|
|
76687
76845
|
}
|
|
76688
76846
|
get depth() { return this.context ? this.context.length : 0; }
|
|
76689
76847
|
}
|
|
76690
|
-
Rule.empty = new Rule([], 2 /* Normal */, null);
|
|
76848
|
+
Rule.empty = new Rule([], 2 /* Mode.Normal */, null);
|
|
76691
76849
|
/// Define a [highlighter](#highlight.Highlighter) from an array of
|
|
76692
76850
|
/// tag/class pairs. Classes associated with more specific tags will
|
|
76693
76851
|
/// take precedence.
|
|
@@ -76774,7 +76932,7 @@
|
|
|
76774
76932
|
if (cls)
|
|
76775
76933
|
cls += " ";
|
|
76776
76934
|
cls += tagCls;
|
|
76777
|
-
if (rule.mode == 1 /* Inherit */)
|
|
76935
|
+
if (rule.mode == 1 /* Mode.Inherit */)
|
|
76778
76936
|
inheritedClass += (inheritedClass ? " " : "") + tagCls;
|
|
76779
76937
|
}
|
|
76780
76938
|
this.startSpan(cursor.from, cls);
|
|
@@ -76792,7 +76950,7 @@
|
|
|
76792
76950
|
if (rangeFrom < rangeTo && hasChild) {
|
|
76793
76951
|
while (cursor.from < rangeTo) {
|
|
76794
76952
|
this.highlightRange(cursor, rangeFrom, rangeTo, inheritedClass, highlighters);
|
|
76795
|
-
this.startSpan(Math.min(
|
|
76953
|
+
this.startSpan(Math.min(rangeTo, cursor.to), cls);
|
|
76796
76954
|
if (cursor.to >= nextPos || !cursor.nextSibling())
|
|
76797
76955
|
break;
|
|
76798
76956
|
}
|
|
@@ -78733,6 +78891,7 @@
|
|
|
78733
78891
|
closeOnBlur: true,
|
|
78734
78892
|
maxRenderedOptions: 100,
|
|
78735
78893
|
defaultKeymap: true,
|
|
78894
|
+
tooltipClass: () => "",
|
|
78736
78895
|
optionClass: () => "",
|
|
78737
78896
|
aboveCursor: false,
|
|
78738
78897
|
icons: true,
|
|
@@ -78743,6 +78902,7 @@
|
|
|
78743
78902
|
defaultKeymap: (a, b) => a && b,
|
|
78744
78903
|
closeOnBlur: (a, b) => a && b,
|
|
78745
78904
|
icons: (a, b) => a && b,
|
|
78905
|
+
tooltipClass: (a, b) => c => joinClass(a(c), b(c)),
|
|
78746
78906
|
optionClass: (a, b) => c => joinClass(a(c), b(c)),
|
|
78747
78907
|
addToOptions: (a, b) => a.concat(b)
|
|
78748
78908
|
});
|
|
@@ -78821,14 +78981,17 @@
|
|
|
78821
78981
|
key: this
|
|
78822
78982
|
};
|
|
78823
78983
|
this.space = null;
|
|
78984
|
+
this.currentClass = "";
|
|
78824
78985
|
let cState = view.state.field(stateField);
|
|
78825
78986
|
let { options, selected } = cState.open;
|
|
78826
78987
|
let config = view.state.facet(completionConfig);
|
|
78827
78988
|
this.optionContent = optionContent(config);
|
|
78828
78989
|
this.optionClass = config.optionClass;
|
|
78990
|
+
this.tooltipClass = config.tooltipClass;
|
|
78829
78991
|
this.range = rangeAroundSelected(options.length, selected, config.maxRenderedOptions);
|
|
78830
78992
|
this.dom = document.createElement("div");
|
|
78831
78993
|
this.dom.className = "cm-tooltip-autocomplete";
|
|
78994
|
+
this.updateTooltipClass(view.state);
|
|
78832
78995
|
this.dom.addEventListener("mousedown", (e) => {
|
|
78833
78996
|
for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {
|
|
78834
78997
|
if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
|
|
@@ -78849,12 +79012,25 @@
|
|
|
78849
79012
|
var _a, _b, _c;
|
|
78850
79013
|
let cState = update.state.field(this.stateField);
|
|
78851
79014
|
let prevState = update.startState.field(this.stateField);
|
|
79015
|
+
this.updateTooltipClass(update.state);
|
|
78852
79016
|
if (cState != prevState) {
|
|
78853
79017
|
this.updateSel();
|
|
78854
79018
|
if (((_a = cState.open) === null || _a === void 0 ? void 0 : _a.disabled) != ((_b = prevState.open) === null || _b === void 0 ? void 0 : _b.disabled))
|
|
78855
79019
|
this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!((_c = cState.open) === null || _c === void 0 ? void 0 : _c.disabled));
|
|
78856
79020
|
}
|
|
78857
79021
|
}
|
|
79022
|
+
updateTooltipClass(state) {
|
|
79023
|
+
let cls = this.tooltipClass(state);
|
|
79024
|
+
if (cls != this.currentClass) {
|
|
79025
|
+
for (let c of this.currentClass.split(" "))
|
|
79026
|
+
if (c)
|
|
79027
|
+
this.dom.classList.remove(c);
|
|
79028
|
+
for (let c of cls.split(" "))
|
|
79029
|
+
if (c)
|
|
79030
|
+
this.dom.classList.add(c);
|
|
79031
|
+
this.currentClass = cls;
|
|
79032
|
+
}
|
|
79033
|
+
}
|
|
78858
79034
|
positioned(space) {
|
|
78859
79035
|
this.space = space;
|
|
78860
79036
|
if (this.info)
|
|
@@ -79115,13 +79291,13 @@
|
|
|
79115
79291
|
if (active.length == this.active.length && active.every((a, i) => a == this.active[i]))
|
|
79116
79292
|
active = this.active;
|
|
79117
79293
|
let open = this.open;
|
|
79294
|
+
if (open && tr.docChanged)
|
|
79295
|
+
open = open.map(tr.changes);
|
|
79118
79296
|
if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||
|
|
79119
79297
|
!sameResults(active, this.active))
|
|
79120
|
-
open = CompletionDialog.build(active, state, this.id,
|
|
79298
|
+
open = CompletionDialog.build(active, state, this.id, open, conf);
|
|
79121
79299
|
else if (open && open.disabled && !active.some(a => a.state == 1 /* State.Pending */))
|
|
79122
79300
|
open = null;
|
|
79123
|
-
else if (open && tr.docChanged)
|
|
79124
|
-
open = open.map(tr.changes);
|
|
79125
79301
|
if (!open && active.every(a => a.state != 1 /* State.Pending */) && active.some(a => a.hasResult()))
|
|
79126
79302
|
active = active.map(a => a.hasResult() ? new ActiveSource(a.source, 0 /* State.Inactive */) : a);
|
|
79127
79303
|
for (let effect of tr.effects)
|
|
@@ -79476,6 +79652,7 @@
|
|
|
79476
79652
|
maxWidth: "min(700px, 95vw)",
|
|
79477
79653
|
minWidth: "250px",
|
|
79478
79654
|
maxHeight: "10em",
|
|
79655
|
+
height: "100%",
|
|
79479
79656
|
listStyle: "none",
|
|
79480
79657
|
margin: 0,
|
|
79481
79658
|
padding: 0,
|
|
@@ -80430,7 +80607,7 @@
|
|
|
80430
80607
|
function extendSel(view, how) {
|
|
80431
80608
|
let selection = updateSel(view.state.selection, range => {
|
|
80432
80609
|
let head = how(range);
|
|
80433
|
-
return EditorSelection.range(range.anchor, head.head, head.goalColumn);
|
|
80610
|
+
return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);
|
|
80434
80611
|
});
|
|
80435
80612
|
if (selection.eq(view.state.selection))
|
|
80436
80613
|
return false;
|
|
@@ -84403,6 +84580,88 @@
|
|
|
84403
84580
|
}
|
|
84404
84581
|
});
|
|
84405
84582
|
|
|
84583
|
+
/**
|
|
84584
|
+
* Create an array of syntax errors in the given tree.
|
|
84585
|
+
*
|
|
84586
|
+
* @param {Tree} syntaxTree
|
|
84587
|
+
* @returns {LintMessage[]} array of syntax errors
|
|
84588
|
+
*/
|
|
84589
|
+
function lintSyntax(syntaxTree) {
|
|
84590
|
+
|
|
84591
|
+
const lintMessages = [];
|
|
84592
|
+
|
|
84593
|
+
syntaxTree.iterate({
|
|
84594
|
+
enter: node => {
|
|
84595
|
+
if (node.type.isError) {
|
|
84596
|
+
|
|
84597
|
+
const error = node.toString();
|
|
84598
|
+
|
|
84599
|
+
/* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
|
|
84600
|
+
const match = /\((.*?)\)/.exec(error);
|
|
84601
|
+
const nodeType = match && match[1];
|
|
84602
|
+
|
|
84603
|
+
let message;
|
|
84604
|
+
|
|
84605
|
+
if (nodeType) {
|
|
84606
|
+
message = 'unexpected ' + nodeType;
|
|
84607
|
+
} else {
|
|
84608
|
+
message = 'expression expected';
|
|
84609
|
+
}
|
|
84610
|
+
|
|
84611
|
+
lintMessages.push(
|
|
84612
|
+
{
|
|
84613
|
+
from: node.from,
|
|
84614
|
+
to: node.to,
|
|
84615
|
+
severity: 'error',
|
|
84616
|
+
message: message,
|
|
84617
|
+
type: 'syntaxError'
|
|
84618
|
+
}
|
|
84619
|
+
);
|
|
84620
|
+
}
|
|
84621
|
+
}
|
|
84622
|
+
});
|
|
84623
|
+
|
|
84624
|
+
return lintMessages;
|
|
84625
|
+
}
|
|
84626
|
+
|
|
84627
|
+
/**
|
|
84628
|
+
* Generates lint messages for the given syntax tree.
|
|
84629
|
+
*
|
|
84630
|
+
* @param {Tree} syntaxTree
|
|
84631
|
+
* @returns {LintMessage[]} array of all lint messages
|
|
84632
|
+
*/
|
|
84633
|
+
function lintAll(syntaxTree) {
|
|
84634
|
+
|
|
84635
|
+
const lintMessages = [
|
|
84636
|
+
... lintSyntax(syntaxTree)
|
|
84637
|
+
];
|
|
84638
|
+
|
|
84639
|
+
return lintMessages;
|
|
84640
|
+
}
|
|
84641
|
+
|
|
84642
|
+
/**
|
|
84643
|
+
* CodeMirror extension that provides linting for FEEL expressions.
|
|
84644
|
+
*
|
|
84645
|
+
* @param {EditorView} editorView
|
|
84646
|
+
* @returns {Source} CodeMirror linting source
|
|
84647
|
+
*/
|
|
84648
|
+
const cmFeelLinter = () => editorView => {
|
|
84649
|
+
|
|
84650
|
+
// don't lint if the Editor is empty
|
|
84651
|
+
if (editorView.state.doc.length === 0) {
|
|
84652
|
+
return [];
|
|
84653
|
+
}
|
|
84654
|
+
|
|
84655
|
+
const tree = syntaxTree(editorView.state);
|
|
84656
|
+
|
|
84657
|
+
const messages = lintAll(tree);
|
|
84658
|
+
|
|
84659
|
+
return messages.map(message => ({
|
|
84660
|
+
...message,
|
|
84661
|
+
source: 'syntaxError'
|
|
84662
|
+
}));
|
|
84663
|
+
};
|
|
84664
|
+
|
|
84406
84665
|
// helpers ///////////////////////////////
|
|
84407
84666
|
|
|
84408
84667
|
function isNodeEmpty(node) {
|
|
@@ -84766,9 +85025,10 @@
|
|
|
84766
85025
|
label: tag.name,
|
|
84767
85026
|
type: 'function',
|
|
84768
85027
|
info: () => {
|
|
84769
|
-
const html = domify$1(tag.description);
|
|
85028
|
+
const html = domify$1(`<div class="description">${tag.description}<div>`);
|
|
84770
85029
|
return html;
|
|
84771
|
-
}
|
|
85030
|
+
},
|
|
85031
|
+
boost: -1
|
|
84772
85032
|
}
|
|
84773
85033
|
));
|
|
84774
85034
|
|
|
@@ -84807,6 +85067,109 @@
|
|
|
84807
85067
|
*/
|
|
84808
85068
|
const variablesFacet = Facet.define();
|
|
84809
85069
|
|
|
85070
|
+
var pathExpression = context => {
|
|
85071
|
+
const variables = context.state.facet(variablesFacet)[0];
|
|
85072
|
+
const nodeBefore = syntaxTree(context.state).resolve(context.pos, -1);
|
|
85073
|
+
|
|
85074
|
+
if (!isPathExpression(nodeBefore)) {
|
|
85075
|
+
return;
|
|
85076
|
+
}
|
|
85077
|
+
|
|
85078
|
+
const expression = findPathExpression(nodeBefore);
|
|
85079
|
+
|
|
85080
|
+
// if the cursor is directly after the `.`, variable starts at the cursor position
|
|
85081
|
+
const from = nodeBefore === expression ? context.pos : nodeBefore.from;
|
|
85082
|
+
|
|
85083
|
+
const path = getPath(expression, context);
|
|
85084
|
+
|
|
85085
|
+
let options = variables;
|
|
85086
|
+
for (var i = 0; i < path.length - 1; i++) {
|
|
85087
|
+
var childVar = options.find(val => val.name === path[i].name);
|
|
85088
|
+
|
|
85089
|
+
if (!childVar) {
|
|
85090
|
+
return null;
|
|
85091
|
+
}
|
|
85092
|
+
|
|
85093
|
+
// only suggest if variable type matches
|
|
85094
|
+
if (
|
|
85095
|
+
childVar.isList !== 'optional' &&
|
|
85096
|
+
!!childVar.isList !== path[i].isList
|
|
85097
|
+
) {
|
|
85098
|
+
return;
|
|
85099
|
+
}
|
|
85100
|
+
|
|
85101
|
+
options = childVar.entries;
|
|
85102
|
+
}
|
|
85103
|
+
|
|
85104
|
+
if (!options) return;
|
|
85105
|
+
|
|
85106
|
+
options = options.map(v => ({
|
|
85107
|
+
label: v.name,
|
|
85108
|
+
type: 'variable',
|
|
85109
|
+
info: v.info,
|
|
85110
|
+
detail: v.detail
|
|
85111
|
+
}));
|
|
85112
|
+
|
|
85113
|
+
const result = {
|
|
85114
|
+
from: from,
|
|
85115
|
+
options: options
|
|
85116
|
+
};
|
|
85117
|
+
|
|
85118
|
+
return result;
|
|
85119
|
+
};
|
|
85120
|
+
|
|
85121
|
+
|
|
85122
|
+
function findPathExpression(node) {
|
|
85123
|
+
while (node) {
|
|
85124
|
+
if (node.name === 'PathExpression') {
|
|
85125
|
+
return node;
|
|
85126
|
+
}
|
|
85127
|
+
node = node.parent;
|
|
85128
|
+
}
|
|
85129
|
+
}
|
|
85130
|
+
|
|
85131
|
+
// parses the path expression into a list of variable names with type information
|
|
85132
|
+
// e.g. foo[0].bar => [ { name: 'foo', isList: true }, { name: 'bar', isList: false } ]
|
|
85133
|
+
function getPath(node, context) {
|
|
85134
|
+
let path = [];
|
|
85135
|
+
|
|
85136
|
+
for (let child = node.firstChild; child; child = child.nextSibling) {
|
|
85137
|
+
if (child.name === 'PathExpression') {
|
|
85138
|
+
path.push(...getPath(child, context));
|
|
85139
|
+
} else if (child.name === 'FilterExpression') {
|
|
85140
|
+
path.push(...getFilter(child, context));
|
|
85141
|
+
}
|
|
85142
|
+
else {
|
|
85143
|
+
path.push({
|
|
85144
|
+
name: getNodeContent(child, context),
|
|
85145
|
+
isList: false
|
|
85146
|
+
});
|
|
85147
|
+
}
|
|
85148
|
+
}
|
|
85149
|
+
return path;
|
|
85150
|
+
}
|
|
85151
|
+
|
|
85152
|
+
function getFilter(node, context) {
|
|
85153
|
+
const list = node.firstChild;
|
|
85154
|
+
|
|
85155
|
+
if (list.name === 'PathExpression') {
|
|
85156
|
+
const path = getPath(list, context);
|
|
85157
|
+
const last = path[path.length - 1];
|
|
85158
|
+
last.isList = true;
|
|
85159
|
+
|
|
85160
|
+
return path;
|
|
85161
|
+
}
|
|
85162
|
+
|
|
85163
|
+
return [ {
|
|
85164
|
+
name: getNodeContent(list, context),
|
|
85165
|
+
isList: true
|
|
85166
|
+
} ];
|
|
85167
|
+
}
|
|
85168
|
+
|
|
85169
|
+
function getNodeContent(node, context) {
|
|
85170
|
+
return context.state.sliceDoc(node.from, node.to);
|
|
85171
|
+
}
|
|
85172
|
+
|
|
84810
85173
|
/**
|
|
84811
85174
|
* @type {import('@codemirror/autocomplete').CompletionSource}
|
|
84812
85175
|
*/
|
|
@@ -84858,7 +85221,8 @@
|
|
|
84858
85221
|
override: [
|
|
84859
85222
|
variables,
|
|
84860
85223
|
builtins,
|
|
84861
|
-
completeFromList(snippets)
|
|
85224
|
+
completeFromList(snippets.map(s => ({ ...s, boost: -1 }))),
|
|
85225
|
+
pathExpression
|
|
84862
85226
|
]
|
|
84863
85227
|
})
|
|
84864
85228
|
];
|
|
@@ -84868,53 +85232,7 @@
|
|
|
84868
85232
|
return new LanguageSupport(feelLanguage, [ ]);
|
|
84869
85233
|
}
|
|
84870
85234
|
|
|
84871
|
-
|
|
84872
|
-
const messages = [];
|
|
84873
|
-
|
|
84874
|
-
// don't lint if the Editor is empty
|
|
84875
|
-
if (editorView.state.doc.length === 0) {
|
|
84876
|
-
return messages;
|
|
84877
|
-
}
|
|
84878
|
-
|
|
84879
|
-
const tree = syntaxTree(editorView.state);
|
|
84880
|
-
|
|
84881
|
-
tree.iterate({
|
|
84882
|
-
enter: node => {
|
|
84883
|
-
if (node.type.isError) {
|
|
84884
|
-
|
|
84885
|
-
const error = node.toString();
|
|
84886
|
-
|
|
84887
|
-
/* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
|
|
84888
|
-
const match = /\((.*?)\)/.exec(error);
|
|
84889
|
-
const nodeType = match && match[1];
|
|
84890
|
-
|
|
84891
|
-
let message;
|
|
84892
|
-
|
|
84893
|
-
if (nodeType) {
|
|
84894
|
-
message = 'unexpected ' + nodeType;
|
|
84895
|
-
} else {
|
|
84896
|
-
message = 'expression expected';
|
|
84897
|
-
}
|
|
84898
|
-
|
|
84899
|
-
messages.push(
|
|
84900
|
-
{
|
|
84901
|
-
from: node.from,
|
|
84902
|
-
to: node.to,
|
|
84903
|
-
severity: 'error',
|
|
84904
|
-
message: message,
|
|
84905
|
-
source: 'syntaxError'
|
|
84906
|
-
}
|
|
84907
|
-
);
|
|
84908
|
-
}
|
|
84909
|
-
}
|
|
84910
|
-
});
|
|
84911
|
-
|
|
84912
|
-
return messages;
|
|
84913
|
-
};
|
|
84914
|
-
|
|
84915
|
-
var syntaxLinter = linter$1(FeelLinter);
|
|
84916
|
-
|
|
84917
|
-
var linter = [ syntaxLinter ];
|
|
85235
|
+
var linter = [ linter$1(cmFeelLinter()) ];
|
|
84918
85236
|
|
|
84919
85237
|
const baseTheme = EditorView.theme({
|
|
84920
85238
|
'& .cm-content': {
|
|
@@ -84982,9 +85300,11 @@
|
|
|
84982
85300
|
|
|
84983
85301
|
/**
|
|
84984
85302
|
* @typedef {object} Variable
|
|
84985
|
-
* @property {string} name
|
|
84986
|
-
* @property {string} [info]
|
|
84987
|
-
* @property {string} [detail]
|
|
85303
|
+
* @property {string} name name or key of the variable
|
|
85304
|
+
* @property {string} [info] short information about the variable, e.g. type
|
|
85305
|
+
* @property {string} [detail] longer description of the variable content
|
|
85306
|
+
* @property {boolean} [isList] whether the variable is a list
|
|
85307
|
+
* @property {array<Variable>} [schema] array of child variables if the variable is a context or list
|
|
84988
85308
|
*/
|
|
84989
85309
|
|
|
84990
85310
|
const autocompletionConf = new Compartment();
|
|
@@ -86877,7 +87197,7 @@
|
|
|
86877
87197
|
label,
|
|
86878
87198
|
onChange,
|
|
86879
87199
|
options = [],
|
|
86880
|
-
value,
|
|
87200
|
+
value = '',
|
|
86881
87201
|
disabled,
|
|
86882
87202
|
onFocus,
|
|
86883
87203
|
onBlur
|
|
@@ -87922,28 +88242,41 @@
|
|
|
87922
88242
|
|
|
87923
88243
|
// api /////////////////////////
|
|
87924
88244
|
|
|
88245
|
+
/**
|
|
88246
|
+
* Extractors add ProcessVariables to the `options.processVariables` parameter.
|
|
88247
|
+
* @callback extractor
|
|
88248
|
+
* @param {Object} options
|
|
88249
|
+
* @param {Array<ModdleElement>} options.elements
|
|
88250
|
+
* @param {ModdleElement} options.containerElement
|
|
88251
|
+
* @param {Array<ProcessVariable>} options.processVariables
|
|
88252
|
+
*/
|
|
88253
|
+
|
|
87925
88254
|
/**
|
|
87926
88255
|
* Retrieves all process variables for a given container element.
|
|
87927
88256
|
* @param {ModdleElement} containerElement
|
|
88257
|
+
* @param {Array<extractor>} [additionalExtractors]
|
|
87928
88258
|
*
|
|
87929
|
-
* @returns {Array<ProcessVariable
|
|
88259
|
+
* @returns {Promise<Array<ProcessVariable>>}
|
|
87930
88260
|
*/
|
|
87931
|
-
function getProcessVariables$1(containerElement) {
|
|
88261
|
+
function getProcessVariables$1(containerElement, additionalExtractors = []) {
|
|
87932
88262
|
var processVariables = [];
|
|
87933
88263
|
|
|
87934
88264
|
// (1) extract all flow elements inside the container
|
|
87935
88265
|
var elements = selfAndAllFlowElements$1([ containerElement ], false);
|
|
87936
88266
|
|
|
88267
|
+
const allPromises = [];
|
|
88268
|
+
|
|
87937
88269
|
// (2) extract all variables from the extractors
|
|
87938
|
-
minDash$1.forEach(extractors$1, function(extractor) {
|
|
87939
|
-
extractor({
|
|
88270
|
+
minDash$1.forEach([ ...extractors$1, ...additionalExtractors ], function(extractor) {
|
|
88271
|
+
allPromises.push(extractor({
|
|
87940
88272
|
elements: elements,
|
|
87941
88273
|
containerElement: containerElement,
|
|
87942
88274
|
processVariables: processVariables
|
|
87943
|
-
});
|
|
88275
|
+
}));
|
|
87944
88276
|
});
|
|
87945
88277
|
|
|
87946
|
-
return
|
|
88278
|
+
return Promise.all(allPromises)
|
|
88279
|
+
.then(() => processVariables);
|
|
87947
88280
|
}
|
|
87948
88281
|
|
|
87949
88282
|
/**
|
|
@@ -87955,12 +88288,13 @@
|
|
|
87955
88288
|
*
|
|
87956
88289
|
* @param {string} scope
|
|
87957
88290
|
* @param {ModdleElement} rootElement element from where to extract all variables
|
|
88291
|
+
* @param {Array<extractor>} [additionalExtractors]
|
|
87958
88292
|
*
|
|
87959
|
-
* @returns {Array<ProcessVariable
|
|
88293
|
+
* @returns {Promise<Array<ProcessVariable>>}
|
|
87960
88294
|
*/
|
|
87961
|
-
function getVariablesForScope$1(scope, rootElement) {
|
|
88295
|
+
async function getVariablesForScope$1(scope, rootElement, additionalExtractors = []) {
|
|
87962
88296
|
|
|
87963
|
-
var allVariables = getProcessVariables$1(rootElement);
|
|
88297
|
+
var allVariables = await getProcessVariables$1(rootElement, additionalExtractors);
|
|
87964
88298
|
|
|
87965
88299
|
var scopeElement = getElement$1(scope, rootElement);
|
|
87966
88300
|
|
|
@@ -87982,8 +88316,8 @@
|
|
|
87982
88316
|
}
|
|
87983
88317
|
|
|
87984
88318
|
|
|
87985
|
-
function getVariablesForElement(element) {
|
|
87986
|
-
return getVariablesForScope$1(getScope$2(element), getRootElement$2(element));
|
|
88319
|
+
function getVariablesForElement(element, additionalExtractors = []) {
|
|
88320
|
+
return getVariablesForScope$1(getScope$2(element), getRootElement$2(element), additionalExtractors);
|
|
87987
88321
|
}
|
|
87988
88322
|
|
|
87989
88323
|
function getScope$2(element) {
|
|
@@ -88688,30 +89022,46 @@
|
|
|
88688
89022
|
* @property {ModdleElement} scope
|
|
88689
89023
|
*/
|
|
88690
89024
|
|
|
89025
|
+
|
|
89026
|
+
/**
|
|
89027
|
+
* Extractors add ProcessVariables to the `options.processVariables` parameter.
|
|
89028
|
+
* @callback extractor
|
|
89029
|
+
* @param {Object} options
|
|
89030
|
+
* @param {Array<ModdleElement>} options.elements
|
|
89031
|
+
* @param {ModdleElement} options.containerElement
|
|
89032
|
+
* @param {Array<ProcessVariable>} options.processVariables
|
|
89033
|
+
*/
|
|
89034
|
+
|
|
88691
89035
|
// api /////////////////////////
|
|
88692
89036
|
|
|
88693
89037
|
/**
|
|
88694
89038
|
* Retrieves all process variables for a given container element.
|
|
88695
89039
|
* @param {ModdleElement} containerElement
|
|
89040
|
+
* @param {Array<extractor>} additionalExtractors
|
|
88696
89041
|
*
|
|
88697
|
-
* @returns {Array<ProcessVariable
|
|
89042
|
+
* @returns {Promise<Array<ProcessVariable>>}
|
|
88698
89043
|
*/
|
|
88699
|
-
function getProcessVariables(containerElement) {
|
|
89044
|
+
function getProcessVariables(containerElement, additionalExtractors = []) {
|
|
89045
|
+
const allPromises = [];
|
|
89046
|
+
|
|
88700
89047
|
var processVariables = [];
|
|
88701
89048
|
|
|
88702
89049
|
// (1) extract all flow elements inside the container
|
|
88703
89050
|
var elements = selfAndAllFlowElements([ containerElement ], false);
|
|
88704
89051
|
|
|
88705
89052
|
// (2) extract all variables from the extractors
|
|
88706
|
-
minDash.forEach(extractors, function(extractor) {
|
|
88707
|
-
|
|
88708
|
-
|
|
88709
|
-
|
|
88710
|
-
|
|
88711
|
-
|
|
89053
|
+
minDash.forEach([ ...extractors, ...additionalExtractors ], function(extractor) {
|
|
89054
|
+
allPromises.push(
|
|
89055
|
+
extractor({
|
|
89056
|
+
elements: elements,
|
|
89057
|
+
containerElement: containerElement,
|
|
89058
|
+
processVariables: processVariables
|
|
89059
|
+
})
|
|
89060
|
+
);
|
|
88712
89061
|
});
|
|
88713
89062
|
|
|
88714
|
-
return
|
|
89063
|
+
return Promise.all(allPromises)
|
|
89064
|
+
.then(() => processVariables);
|
|
88715
89065
|
}
|
|
88716
89066
|
|
|
88717
89067
|
/**
|
|
@@ -88723,12 +89073,13 @@
|
|
|
88723
89073
|
*
|
|
88724
89074
|
* @param {string} scope
|
|
88725
89075
|
* @param {ModdleElement} rootElement element from where to extract all variables
|
|
89076
|
+
* @param {Array<extractor>} additionalExtractors
|
|
88726
89077
|
*
|
|
88727
|
-
* @returns {Array<ProcessVariable
|
|
89078
|
+
* @returns {Promise<Array<ProcessVariable>>}
|
|
88728
89079
|
*/
|
|
88729
|
-
function getVariablesForScope(scope, rootElement) {
|
|
89080
|
+
async function getVariablesForScope(scope, rootElement, additionalExtractors = []) {
|
|
88730
89081
|
|
|
88731
|
-
var allVariables = getProcessVariables(rootElement);
|
|
89082
|
+
var allVariables = await getProcessVariables(rootElement, additionalExtractors);
|
|
88732
89083
|
|
|
88733
89084
|
var scopeElement = getElement(scope, rootElement);
|
|
88734
89085
|
|
|
@@ -91739,7 +92090,7 @@
|
|
|
91739
92090
|
/**
|
|
91740
92091
|
* @returns {Array<Entry>} entries
|
|
91741
92092
|
*/
|
|
91742
|
-
function ErrorProps$
|
|
92093
|
+
function ErrorProps$2(props) {
|
|
91743
92094
|
const {
|
|
91744
92095
|
element
|
|
91745
92096
|
} = props;
|
|
@@ -91759,7 +92110,7 @@
|
|
|
91759
92110
|
isEdited: isEdited$1
|
|
91760
92111
|
}, {
|
|
91761
92112
|
id: 'errorCode',
|
|
91762
|
-
component: ErrorCode$
|
|
92113
|
+
component: ErrorCode$2,
|
|
91763
92114
|
isEdited: isEdited$1
|
|
91764
92115
|
}];
|
|
91765
92116
|
}
|
|
@@ -91875,7 +92226,7 @@
|
|
|
91875
92226
|
debounce
|
|
91876
92227
|
});
|
|
91877
92228
|
}
|
|
91878
|
-
function ErrorCode$
|
|
92229
|
+
function ErrorCode$2(props) {
|
|
91879
92230
|
const {
|
|
91880
92231
|
element
|
|
91881
92232
|
} = props;
|
|
@@ -93349,7 +93700,7 @@
|
|
|
93349
93700
|
id: 'error',
|
|
93350
93701
|
label: translate('Error'),
|
|
93351
93702
|
component: Group,
|
|
93352
|
-
entries: [...ErrorProps$
|
|
93703
|
+
entries: [...ErrorProps$2({
|
|
93353
93704
|
element
|
|
93354
93705
|
})]
|
|
93355
93706
|
};
|
|
@@ -93528,8 +93879,8 @@
|
|
|
93528
93879
|
const [variables, setVariables] = l$1([]);
|
|
93529
93880
|
const eventBus = useService('eventBus');
|
|
93530
93881
|
y(() => {
|
|
93531
|
-
const callback = () => {
|
|
93532
|
-
const variables = getVariablesForElement_1(bo);
|
|
93882
|
+
const callback = async () => {
|
|
93883
|
+
const variables = await getVariablesForElement_1(bo);
|
|
93533
93884
|
setVariables(variables.map(variable => {
|
|
93534
93885
|
return {
|
|
93535
93886
|
name: variable.name,
|
|
@@ -93814,8 +94165,8 @@
|
|
|
93814
94165
|
}
|
|
93815
94166
|
|
|
93816
94167
|
const DMN_IMPLEMENTATION_OPTION = 'dmn',
|
|
93817
|
-
JOB_WORKER_IMPLEMENTATION_OPTION = 'jobWorker',
|
|
93818
|
-
DEFAULT_IMPLEMENTATION_OPTION = '';
|
|
94168
|
+
JOB_WORKER_IMPLEMENTATION_OPTION$1 = 'jobWorker',
|
|
94169
|
+
DEFAULT_IMPLEMENTATION_OPTION$1 = '';
|
|
93819
94170
|
function BusinessRuleImplementationProps(props) {
|
|
93820
94171
|
const {
|
|
93821
94172
|
element
|
|
@@ -93841,10 +94192,10 @@
|
|
|
93841
94192
|
if (getCalledDecision$1(element)) {
|
|
93842
94193
|
return DMN_IMPLEMENTATION_OPTION;
|
|
93843
94194
|
}
|
|
93844
|
-
if (getTaskDefinition$
|
|
93845
|
-
return JOB_WORKER_IMPLEMENTATION_OPTION;
|
|
94195
|
+
if (getTaskDefinition$3(element)) {
|
|
94196
|
+
return JOB_WORKER_IMPLEMENTATION_OPTION$1;
|
|
93846
94197
|
}
|
|
93847
|
-
return DEFAULT_IMPLEMENTATION_OPTION;
|
|
94198
|
+
return DEFAULT_IMPLEMENTATION_OPTION$1;
|
|
93848
94199
|
};
|
|
93849
94200
|
|
|
93850
94201
|
/**
|
|
@@ -93857,26 +94208,26 @@
|
|
|
93857
94208
|
if (value === DMN_IMPLEMENTATION_OPTION) {
|
|
93858
94209
|
extensionElement = getCalledDecision$1(element);
|
|
93859
94210
|
extensionElementType = 'zeebe:CalledDecision';
|
|
93860
|
-
} else if (value === JOB_WORKER_IMPLEMENTATION_OPTION) {
|
|
93861
|
-
extensionElement = getTaskDefinition$
|
|
94211
|
+
} else if (value === JOB_WORKER_IMPLEMENTATION_OPTION$1) {
|
|
94212
|
+
extensionElement = getTaskDefinition$3(element);
|
|
93862
94213
|
extensionElementType = 'zeebe:TaskDefinition';
|
|
93863
94214
|
} else {
|
|
93864
|
-
resetElement(element, commandStack);
|
|
94215
|
+
resetElement$1(element, commandStack);
|
|
93865
94216
|
}
|
|
93866
94217
|
if (!extensionElement && extensionElementType) {
|
|
93867
94218
|
extensionElement = createElement$1(extensionElementType, {}, null, bpmnFactory);
|
|
93868
|
-
updateExtensionElements(element, extensionElement, bpmnFactory, commandStack);
|
|
94219
|
+
updateExtensionElements$1(element, extensionElement, bpmnFactory, commandStack);
|
|
93869
94220
|
}
|
|
93870
94221
|
};
|
|
93871
94222
|
const getOptions = () => {
|
|
93872
94223
|
const options = [{
|
|
93873
|
-
value: DEFAULT_IMPLEMENTATION_OPTION,
|
|
94224
|
+
value: DEFAULT_IMPLEMENTATION_OPTION$1,
|
|
93874
94225
|
label: translate('<none>')
|
|
93875
94226
|
}, {
|
|
93876
94227
|
value: DMN_IMPLEMENTATION_OPTION,
|
|
93877
94228
|
label: translate('DMN decision')
|
|
93878
94229
|
}, {
|
|
93879
|
-
value: JOB_WORKER_IMPLEMENTATION_OPTION,
|
|
94230
|
+
value: JOB_WORKER_IMPLEMENTATION_OPTION$1,
|
|
93880
94231
|
label: translate('Job worker')
|
|
93881
94232
|
}];
|
|
93882
94233
|
return options;
|
|
@@ -93893,7 +94244,7 @@
|
|
|
93893
94244
|
|
|
93894
94245
|
// helper ///////////////////////
|
|
93895
94246
|
|
|
93896
|
-
function getTaskDefinition$
|
|
94247
|
+
function getTaskDefinition$3(element) {
|
|
93897
94248
|
const businessObject = getBusinessObject$1(element);
|
|
93898
94249
|
return getExtensionElementsList$1(businessObject, 'zeebe:TaskDefinition')[0];
|
|
93899
94250
|
}
|
|
@@ -93902,11 +94253,11 @@
|
|
|
93902
94253
|
return getExtensionElementsList$1(businessObject, 'zeebe:CalledDecision')[0];
|
|
93903
94254
|
}
|
|
93904
94255
|
function isBusinessRuleImplementationEdited(element) {
|
|
93905
|
-
return getTaskDefinition$
|
|
94256
|
+
return getTaskDefinition$3(element);
|
|
93906
94257
|
}
|
|
93907
|
-
function resetElement(element, commandStack) {
|
|
94258
|
+
function resetElement$1(element, commandStack) {
|
|
93908
94259
|
const businessObject = getBusinessObject$1(element);
|
|
93909
|
-
const taskDefintion = getTaskDefinition$
|
|
94260
|
+
const taskDefintion = getTaskDefinition$3(element);
|
|
93910
94261
|
const calledDecision = getCalledDecision$1(element);
|
|
93911
94262
|
if (taskDefintion) {
|
|
93912
94263
|
removeExtensionElements$1(element, businessObject, taskDefintion, commandStack);
|
|
@@ -93915,7 +94266,7 @@
|
|
|
93915
94266
|
removeExtensionElements$1(element, businessObject, calledDecision, commandStack);
|
|
93916
94267
|
}
|
|
93917
94268
|
}
|
|
93918
|
-
function updateExtensionElements(element, extensionElementToAdd, bpmnFactory, commandStack) {
|
|
94269
|
+
function updateExtensionElements$1(element, extensionElementToAdd, bpmnFactory, commandStack) {
|
|
93919
94270
|
const businessObject = getBusinessObject$1(element);
|
|
93920
94271
|
const commands = [];
|
|
93921
94272
|
let extensionElements = businessObject.get('extensionElements');
|
|
@@ -93943,7 +94294,7 @@
|
|
|
93943
94294
|
if (is$5(extensionElementToAdd, 'zeebe:TaskDefinition')) {
|
|
93944
94295
|
extensionElementValues = without(extensionElements.get('values'), getCalledDecision$1(element));
|
|
93945
94296
|
} else if (is$5(extensionElementToAdd, 'zeebe:CalledDecision')) {
|
|
93946
|
-
extensionElementValues = without(extensionElements.get('values'), getTaskDefinition$
|
|
94297
|
+
extensionElementValues = without(extensionElements.get('values'), getTaskDefinition$3(element));
|
|
93947
94298
|
}
|
|
93948
94299
|
|
|
93949
94300
|
// (3) add extension element to list
|
|
@@ -93973,7 +94324,7 @@
|
|
|
93973
94324
|
isEdited: isEdited$6
|
|
93974
94325
|
}, {
|
|
93975
94326
|
id: 'resultVariable',
|
|
93976
|
-
component: ResultVariable$
|
|
94327
|
+
component: ResultVariable$4,
|
|
93977
94328
|
isEdited: isEdited$1
|
|
93978
94329
|
}];
|
|
93979
94330
|
}
|
|
@@ -94052,7 +94403,7 @@
|
|
|
94052
94403
|
debounce
|
|
94053
94404
|
});
|
|
94054
94405
|
}
|
|
94055
|
-
function ResultVariable$
|
|
94406
|
+
function ResultVariable$4(props) {
|
|
94056
94407
|
const {
|
|
94057
94408
|
element,
|
|
94058
94409
|
id
|
|
@@ -94232,6 +94583,52 @@
|
|
|
94232
94583
|
}
|
|
94233
94584
|
}
|
|
94234
94585
|
|
|
94586
|
+
function ErrorProps$1(props) {
|
|
94587
|
+
const {
|
|
94588
|
+
element
|
|
94589
|
+
} = props;
|
|
94590
|
+
const error = getError(element);
|
|
94591
|
+
const entries = [];
|
|
94592
|
+
if (error) {
|
|
94593
|
+
entries.push({
|
|
94594
|
+
id: 'errorCode',
|
|
94595
|
+
component: ErrorCode$1,
|
|
94596
|
+
isEdited: isEdited$6
|
|
94597
|
+
});
|
|
94598
|
+
}
|
|
94599
|
+
return entries;
|
|
94600
|
+
}
|
|
94601
|
+
function ErrorCode$1(props) {
|
|
94602
|
+
const {
|
|
94603
|
+
element
|
|
94604
|
+
} = props;
|
|
94605
|
+
const commandStack = useService('commandStack');
|
|
94606
|
+
const translate = useService('translate');
|
|
94607
|
+
const debounce = useService('debounceInput');
|
|
94608
|
+
const error = getError(element);
|
|
94609
|
+
const getValue = () => {
|
|
94610
|
+
return error.get('errorCode');
|
|
94611
|
+
};
|
|
94612
|
+
const setValue = value => {
|
|
94613
|
+
return commandStack.execute('element.updateModdleProperties', {
|
|
94614
|
+
element,
|
|
94615
|
+
moddleElement: error,
|
|
94616
|
+
properties: {
|
|
94617
|
+
errorCode: value
|
|
94618
|
+
}
|
|
94619
|
+
});
|
|
94620
|
+
};
|
|
94621
|
+
return FeelEntryWithContext({
|
|
94622
|
+
element,
|
|
94623
|
+
id: 'errorCode',
|
|
94624
|
+
label: translate('Code'),
|
|
94625
|
+
feel: 'optional',
|
|
94626
|
+
getValue,
|
|
94627
|
+
setValue,
|
|
94628
|
+
debounce
|
|
94629
|
+
});
|
|
94630
|
+
}
|
|
94631
|
+
|
|
94235
94632
|
function FormProps$1(props) {
|
|
94236
94633
|
const {
|
|
94237
94634
|
element,
|
|
@@ -94648,9 +95045,9 @@
|
|
|
94648
95045
|
return !!getMessageEventDefinition(element);
|
|
94649
95046
|
}
|
|
94650
95047
|
|
|
94651
|
-
//
|
|
95048
|
+
// BusinessRuleTask and ScriptTask are ServiceTasks only if they have a TaskDefinition
|
|
94652
95049
|
// (ie. if the implementation is set to ==JobWorker)
|
|
94653
|
-
if (
|
|
95050
|
+
if (isAny(element, ['bpmn:BusinessRuleTask', 'bpmn:ScriptTask']) && !getTaskDefinition$2(element)) {
|
|
94654
95051
|
return false;
|
|
94655
95052
|
}
|
|
94656
95053
|
return true;
|
|
@@ -94664,7 +95061,7 @@
|
|
|
94664
95061
|
|
|
94665
95062
|
// helper ////////////////
|
|
94666
95063
|
|
|
94667
|
-
function getTaskDefinition$
|
|
95064
|
+
function getTaskDefinition$2(element) {
|
|
94668
95065
|
const businessObject = getBusinessObject$1(element);
|
|
94669
95066
|
return getExtensionElementsList$1(businessObject, 'zeebe:TaskDefinition')[0];
|
|
94670
95067
|
}
|
|
@@ -94967,7 +95364,7 @@
|
|
|
94967
95364
|
return getParameters$1.apply(this, [element, 'outputParameters']);
|
|
94968
95365
|
}
|
|
94969
95366
|
function areInputParametersSupported$1(element) {
|
|
94970
|
-
return isAny(element, ['bpmn:UserTask', 'bpmn:SubProcess', 'bpmn:CallActivity', 'bpmn:BusinessRuleTask']) || isZeebeServiceTask(element);
|
|
95367
|
+
return isAny(element, ['bpmn:UserTask', 'bpmn:SubProcess', 'bpmn:CallActivity', 'bpmn:BusinessRuleTask', 'bpmn:ScriptTask']) || isZeebeServiceTask(element);
|
|
94971
95368
|
}
|
|
94972
95369
|
function areOutputParametersSupported$1(element) {
|
|
94973
95370
|
return isAny(element, ['zeebe:ZeebeServiceTask', 'bpmn:UserTask', 'bpmn:SubProcess', 'bpmn:ReceiveTask', 'bpmn:CallActivity', 'bpmn:Event', 'bpmn:BusinessRuleTask']);
|
|
@@ -95010,7 +95407,8 @@
|
|
|
95010
95407
|
element,
|
|
95011
95408
|
bpmnFactory,
|
|
95012
95409
|
commandStack
|
|
95013
|
-
})
|
|
95410
|
+
}),
|
|
95411
|
+
shouldSort: false
|
|
95014
95412
|
};
|
|
95015
95413
|
}
|
|
95016
95414
|
function removeFactory$b({
|
|
@@ -95691,7 +96089,8 @@
|
|
|
95691
96089
|
element,
|
|
95692
96090
|
bpmnFactory,
|
|
95693
96091
|
commandStack
|
|
95694
|
-
})
|
|
96092
|
+
}),
|
|
96093
|
+
shouldSort: false
|
|
95695
96094
|
};
|
|
95696
96095
|
}
|
|
95697
96096
|
function removeFactory$a({
|
|
@@ -95806,37 +96205,196 @@
|
|
|
95806
96205
|
};
|
|
95807
96206
|
}
|
|
95808
96207
|
|
|
95809
|
-
|
|
96208
|
+
const SCRIPT_IMPLEMENTATION_OPTION = 'script',
|
|
96209
|
+
JOB_WORKER_IMPLEMENTATION_OPTION = 'jobWorker',
|
|
96210
|
+
DEFAULT_IMPLEMENTATION_OPTION = '';
|
|
96211
|
+
function ScriptImplementationProps(props) {
|
|
95810
96212
|
const {
|
|
95811
96213
|
element
|
|
95812
96214
|
} = props;
|
|
95813
|
-
if (!is$5(element, 'bpmn:
|
|
96215
|
+
if (!is$5(element, 'bpmn:ScriptTask')) {
|
|
95814
96216
|
return [];
|
|
95815
96217
|
}
|
|
95816
96218
|
return [{
|
|
95817
|
-
id: '
|
|
95818
|
-
component:
|
|
96219
|
+
id: 'scriptImplementation',
|
|
96220
|
+
component: ScriptImplementation,
|
|
96221
|
+
isEdited: () => isScriptImplementationEdited(element)
|
|
96222
|
+
}];
|
|
96223
|
+
}
|
|
96224
|
+
function ScriptImplementation(props) {
|
|
96225
|
+
const {
|
|
96226
|
+
element,
|
|
96227
|
+
id
|
|
96228
|
+
} = props;
|
|
96229
|
+
const commandStack = useService('commandStack');
|
|
96230
|
+
const bpmnFactory = useService('bpmnFactory');
|
|
96231
|
+
const translate = useService('translate');
|
|
96232
|
+
const getValue = () => {
|
|
96233
|
+
if (getScript$1(element)) {
|
|
96234
|
+
return SCRIPT_IMPLEMENTATION_OPTION;
|
|
96235
|
+
}
|
|
96236
|
+
if (getTaskDefinition$1(element)) {
|
|
96237
|
+
return JOB_WORKER_IMPLEMENTATION_OPTION;
|
|
96238
|
+
}
|
|
96239
|
+
return DEFAULT_IMPLEMENTATION_OPTION;
|
|
96240
|
+
};
|
|
96241
|
+
|
|
96242
|
+
/**
|
|
96243
|
+
* Set value by either creating a zeebe:script or a zeebe:taskDefintion
|
|
96244
|
+
* extension element. Note that they must not exist both at the same time, however
|
|
96245
|
+
* this will be ensured by a bpmn-js behavior (and not by the propPanel).
|
|
96246
|
+
*/
|
|
96247
|
+
const setValue = value => {
|
|
96248
|
+
let extensionElement, extensionElementType;
|
|
96249
|
+
if (value === SCRIPT_IMPLEMENTATION_OPTION) {
|
|
96250
|
+
extensionElement = getScript$1(element);
|
|
96251
|
+
extensionElementType = 'zeebe:Script';
|
|
96252
|
+
} else if (value === JOB_WORKER_IMPLEMENTATION_OPTION) {
|
|
96253
|
+
extensionElement = getTaskDefinition$1(element);
|
|
96254
|
+
extensionElementType = 'zeebe:TaskDefinition';
|
|
96255
|
+
} else {
|
|
96256
|
+
resetElement(element, commandStack);
|
|
96257
|
+
}
|
|
96258
|
+
if (!extensionElement && extensionElementType) {
|
|
96259
|
+
extensionElement = createElement$1(extensionElementType, {}, null, bpmnFactory);
|
|
96260
|
+
updateExtensionElements(element, extensionElement, bpmnFactory, commandStack);
|
|
96261
|
+
}
|
|
96262
|
+
};
|
|
96263
|
+
const getOptions = () => {
|
|
96264
|
+
const options = [{
|
|
96265
|
+
value: DEFAULT_IMPLEMENTATION_OPTION,
|
|
96266
|
+
label: translate('<none>')
|
|
96267
|
+
}, {
|
|
96268
|
+
value: SCRIPT_IMPLEMENTATION_OPTION,
|
|
96269
|
+
label: translate('FEEL expression')
|
|
96270
|
+
}, {
|
|
96271
|
+
value: JOB_WORKER_IMPLEMENTATION_OPTION,
|
|
96272
|
+
label: translate('Job worker')
|
|
96273
|
+
}];
|
|
96274
|
+
return options;
|
|
96275
|
+
};
|
|
96276
|
+
return SelectEntry({
|
|
96277
|
+
element,
|
|
96278
|
+
id,
|
|
96279
|
+
label: translate('Implementation'),
|
|
96280
|
+
getValue,
|
|
96281
|
+
setValue,
|
|
96282
|
+
getOptions
|
|
96283
|
+
});
|
|
96284
|
+
}
|
|
96285
|
+
|
|
96286
|
+
// helper ///////////////////////
|
|
96287
|
+
|
|
96288
|
+
function getTaskDefinition$1(element) {
|
|
96289
|
+
const businessObject = getBusinessObject$1(element);
|
|
96290
|
+
return getExtensionElementsList$1(businessObject, 'zeebe:TaskDefinition')[0];
|
|
96291
|
+
}
|
|
96292
|
+
function getScript$1(element) {
|
|
96293
|
+
const businessObject = getBusinessObject$1(element);
|
|
96294
|
+
return getExtensionElementsList$1(businessObject, 'zeebe:Script')[0];
|
|
96295
|
+
}
|
|
96296
|
+
function getTaskHeaders$2(element) {
|
|
96297
|
+
const businessObject = getBusinessObject$1(element);
|
|
96298
|
+
return getExtensionElementsList$1(businessObject, 'zeebe:TaskHeaders');
|
|
96299
|
+
}
|
|
96300
|
+
function isScriptImplementationEdited(element) {
|
|
96301
|
+
return getTaskDefinition$1(element) || getScript$1(element);
|
|
96302
|
+
}
|
|
96303
|
+
function resetElement(element, commandStack) {
|
|
96304
|
+
const businessObject = getBusinessObject$1(element);
|
|
96305
|
+
const taskDefinition = getTaskDefinition$1(element);
|
|
96306
|
+
const taskHeaders = getTaskHeaders$2(element);
|
|
96307
|
+
const script = getScript$1(element);
|
|
96308
|
+
if (taskDefinition) {
|
|
96309
|
+
const removed = [taskDefinition, taskHeaders].filter(Boolean);
|
|
96310
|
+
removeExtensionElements$1(element, businessObject, removed, commandStack);
|
|
96311
|
+
return;
|
|
96312
|
+
}
|
|
96313
|
+
if (script) {
|
|
96314
|
+
removeExtensionElements$1(element, businessObject, script, commandStack);
|
|
96315
|
+
}
|
|
96316
|
+
}
|
|
96317
|
+
function updateExtensionElements(element, extensionElementToAdd, bpmnFactory, commandStack) {
|
|
96318
|
+
const businessObject = getBusinessObject$1(element);
|
|
96319
|
+
const commands = [];
|
|
96320
|
+
let extensionElements = businessObject.get('extensionElements');
|
|
96321
|
+
let extensionElementValues;
|
|
96322
|
+
|
|
96323
|
+
// (1) create bpmn:ExtensionElements if it doesn't exist
|
|
96324
|
+
if (!extensionElements) {
|
|
96325
|
+
extensionElements = createElement$1('bpmn:ExtensionElements', {
|
|
96326
|
+
values: []
|
|
96327
|
+
}, businessObject, bpmnFactory);
|
|
96328
|
+
commands.push({
|
|
96329
|
+
cmd: 'element.updateModdleProperties',
|
|
96330
|
+
context: {
|
|
96331
|
+
element,
|
|
96332
|
+
moddleElement: businessObject,
|
|
96333
|
+
properties: {
|
|
96334
|
+
extensionElements
|
|
96335
|
+
}
|
|
96336
|
+
}
|
|
96337
|
+
});
|
|
96338
|
+
}
|
|
96339
|
+
extensionElementToAdd.$parent = extensionElements;
|
|
96340
|
+
|
|
96341
|
+
// (2) remove old exension element from extensionElements
|
|
96342
|
+
if (is$5(extensionElementToAdd, 'zeebe:TaskDefinition')) {
|
|
96343
|
+
extensionElementValues = without(extensionElements.get('values'), getScript$1(element));
|
|
96344
|
+
} else if (is$5(extensionElementToAdd, 'zeebe:Script')) {
|
|
96345
|
+
const matcher = extension => isAny(extension, ['zeebe:TaskDefinition', 'zeebe:TaskHeaders']);
|
|
96346
|
+
extensionElementValues = without(extensionElements.get('values'), matcher);
|
|
96347
|
+
}
|
|
96348
|
+
|
|
96349
|
+
// (3) add extension element to list
|
|
96350
|
+
commands.push({
|
|
96351
|
+
cmd: 'element.updateModdleProperties',
|
|
96352
|
+
context: {
|
|
96353
|
+
element,
|
|
96354
|
+
moddleElement: extensionElements,
|
|
96355
|
+
properties: {
|
|
96356
|
+
values: [...extensionElementValues, extensionElementToAdd]
|
|
96357
|
+
}
|
|
96358
|
+
}
|
|
96359
|
+
});
|
|
96360
|
+
commandStack.execute('properties-panel.multi-command-executor', commands);
|
|
96361
|
+
}
|
|
96362
|
+
|
|
96363
|
+
function ScriptProps$1(props) {
|
|
96364
|
+
const {
|
|
96365
|
+
element
|
|
96366
|
+
} = props;
|
|
96367
|
+
if (!is$5(element, 'bpmn:ScriptTask') || !getScript(element)) {
|
|
96368
|
+
return [];
|
|
96369
|
+
}
|
|
96370
|
+
return [{
|
|
96371
|
+
id: 'scriptExpression',
|
|
96372
|
+
component: Expression$3,
|
|
95819
96373
|
isEdited: isEdited$6
|
|
96374
|
+
}, {
|
|
96375
|
+
id: 'resultVariable',
|
|
96376
|
+
component: ResultVariable$3,
|
|
96377
|
+
isEdited: isEdited$1
|
|
95820
96378
|
}];
|
|
95821
96379
|
}
|
|
95822
|
-
function
|
|
96380
|
+
function Expression$3(props) {
|
|
95823
96381
|
const {
|
|
95824
96382
|
element,
|
|
95825
96383
|
id
|
|
95826
96384
|
} = props;
|
|
95827
|
-
const commandStack = useService('commandStack')
|
|
95828
|
-
|
|
95829
|
-
|
|
95830
|
-
|
|
96385
|
+
const commandStack = useService('commandStack');
|
|
96386
|
+
const bpmnFactory = useService('bpmnFactory');
|
|
96387
|
+
const translate = useService('translate');
|
|
96388
|
+
const debounce = useService('debounceInput');
|
|
95831
96389
|
const getValue = () => {
|
|
95832
|
-
return
|
|
96390
|
+
return (getScript(element) || {}).get('expression');
|
|
95833
96391
|
};
|
|
95834
96392
|
const setValue = value => {
|
|
95835
96393
|
const commands = [];
|
|
95836
96394
|
const businessObject = getBusinessObject$1(element);
|
|
96395
|
+
let extensionElements = businessObject.get('extensionElements');
|
|
95837
96396
|
|
|
95838
96397
|
// (1) ensure extension elements
|
|
95839
|
-
let extensionElements = businessObject.get('extensionElements');
|
|
95840
96398
|
if (!extensionElements) {
|
|
95841
96399
|
extensionElements = createElement$1('bpmn:ExtensionElements', {
|
|
95842
96400
|
values: []
|
|
@@ -95853,66 +96411,48 @@
|
|
|
95853
96411
|
});
|
|
95854
96412
|
}
|
|
95855
96413
|
|
|
95856
|
-
// (2) ensure
|
|
95857
|
-
let
|
|
95858
|
-
if (!
|
|
95859
|
-
|
|
96414
|
+
// (2) ensure script
|
|
96415
|
+
let script = getScript(element);
|
|
96416
|
+
if (!script) {
|
|
96417
|
+
script = createElement$1('zeebe:Script', {}, extensionElements, bpmnFactory);
|
|
95860
96418
|
commands.push({
|
|
95861
96419
|
cmd: 'element.updateModdleProperties',
|
|
95862
96420
|
context: {
|
|
95863
96421
|
element,
|
|
95864
96422
|
moddleElement: extensionElements,
|
|
95865
96423
|
properties: {
|
|
95866
|
-
values: [...extensionElements.get('values'),
|
|
96424
|
+
values: [...extensionElements.get('values'), script]
|
|
95867
96425
|
}
|
|
95868
96426
|
}
|
|
95869
96427
|
});
|
|
95870
96428
|
}
|
|
95871
96429
|
|
|
95872
|
-
// (3)
|
|
96430
|
+
// (3) update script.expression
|
|
95873
96431
|
commands.push({
|
|
95874
96432
|
cmd: 'element.updateModdleProperties',
|
|
95875
96433
|
context: {
|
|
95876
96434
|
element,
|
|
95877
|
-
moddleElement:
|
|
96435
|
+
moddleElement: script,
|
|
95878
96436
|
properties: {
|
|
95879
|
-
|
|
96437
|
+
expression: value
|
|
95880
96438
|
}
|
|
95881
96439
|
}
|
|
95882
96440
|
});
|
|
95883
96441
|
|
|
95884
|
-
// (4)
|
|
96442
|
+
// (4) commit all updates
|
|
95885
96443
|
commandStack.execute('properties-panel.multi-command-executor', commands);
|
|
95886
96444
|
};
|
|
95887
96445
|
return FeelEntryWithContext({
|
|
95888
96446
|
element,
|
|
95889
96447
|
id,
|
|
95890
|
-
label: translate('
|
|
95891
|
-
feel: '
|
|
96448
|
+
label: translate('FEEL expression'),
|
|
96449
|
+
feel: 'required',
|
|
95892
96450
|
getValue,
|
|
95893
96451
|
setValue,
|
|
95894
96452
|
debounce
|
|
95895
96453
|
});
|
|
95896
96454
|
}
|
|
95897
|
-
|
|
95898
|
-
function TaskDefinitionProps(props) {
|
|
95899
|
-
const {
|
|
95900
|
-
element
|
|
95901
|
-
} = props;
|
|
95902
|
-
if (!isZeebeServiceTask(element)) {
|
|
95903
|
-
return [];
|
|
95904
|
-
}
|
|
95905
|
-
return [{
|
|
95906
|
-
id: 'taskDefinitionType',
|
|
95907
|
-
component: TaskDefinitionType,
|
|
95908
|
-
isEdited: isEdited$6
|
|
95909
|
-
}, {
|
|
95910
|
-
id: 'taskDefinitionRetries',
|
|
95911
|
-
component: TaskDefinitionRetries,
|
|
95912
|
-
isEdited: isEdited$6
|
|
95913
|
-
}];
|
|
95914
|
-
}
|
|
95915
|
-
function TaskDefinitionType(props) {
|
|
96455
|
+
function ResultVariable$3(props) {
|
|
95916
96456
|
const {
|
|
95917
96457
|
element,
|
|
95918
96458
|
id
|
|
@@ -95922,7 +96462,195 @@
|
|
|
95922
96462
|
const translate = useService('translate');
|
|
95923
96463
|
const debounce = useService('debounceInput');
|
|
95924
96464
|
const getValue = () => {
|
|
95925
|
-
return (
|
|
96465
|
+
return (getScript(element) || {}).resultVariable;
|
|
96466
|
+
};
|
|
96467
|
+
const setValue = value => {
|
|
96468
|
+
const commands = [];
|
|
96469
|
+
const businessObject = getBusinessObject$1(element);
|
|
96470
|
+
let extensionElements = businessObject.get('extensionElements');
|
|
96471
|
+
|
|
96472
|
+
// (1) ensure extension elements
|
|
96473
|
+
if (!extensionElements) {
|
|
96474
|
+
extensionElements = createElement$1('bpmn:ExtensionElements', {
|
|
96475
|
+
values: []
|
|
96476
|
+
}, businessObject, bpmnFactory);
|
|
96477
|
+
commands.push({
|
|
96478
|
+
cmd: 'element.updateModdleProperties',
|
|
96479
|
+
context: {
|
|
96480
|
+
element,
|
|
96481
|
+
moddleElement: businessObject,
|
|
96482
|
+
properties: {
|
|
96483
|
+
extensionElements
|
|
96484
|
+
}
|
|
96485
|
+
}
|
|
96486
|
+
});
|
|
96487
|
+
}
|
|
96488
|
+
|
|
96489
|
+
// (2) ensure script
|
|
96490
|
+
let script = getScript(element);
|
|
96491
|
+
if (!script) {
|
|
96492
|
+
script = createElement$1('zeebe:Script', {}, extensionElements, bpmnFactory);
|
|
96493
|
+
commands.push({
|
|
96494
|
+
cmd: 'element.updateModdleProperties',
|
|
96495
|
+
context: {
|
|
96496
|
+
element,
|
|
96497
|
+
moddleElement: extensionElements,
|
|
96498
|
+
properties: {
|
|
96499
|
+
values: [...extensionElements.get('values'), script]
|
|
96500
|
+
}
|
|
96501
|
+
}
|
|
96502
|
+
});
|
|
96503
|
+
}
|
|
96504
|
+
|
|
96505
|
+
// (3) update script.resultVariable
|
|
96506
|
+
commands.push({
|
|
96507
|
+
cmd: 'element.updateModdleProperties',
|
|
96508
|
+
context: {
|
|
96509
|
+
element,
|
|
96510
|
+
moddleElement: script,
|
|
96511
|
+
properties: {
|
|
96512
|
+
resultVariable: value
|
|
96513
|
+
}
|
|
96514
|
+
}
|
|
96515
|
+
});
|
|
96516
|
+
|
|
96517
|
+
// (4) commit all updates
|
|
96518
|
+
commandStack.execute('properties-panel.multi-command-executor', commands);
|
|
96519
|
+
};
|
|
96520
|
+
return TextfieldEntry({
|
|
96521
|
+
element,
|
|
96522
|
+
id,
|
|
96523
|
+
label: translate('Result variable'),
|
|
96524
|
+
getValue,
|
|
96525
|
+
setValue,
|
|
96526
|
+
debounce
|
|
96527
|
+
});
|
|
96528
|
+
}
|
|
96529
|
+
|
|
96530
|
+
// helper ///////////////////////
|
|
96531
|
+
|
|
96532
|
+
function getScript(element) {
|
|
96533
|
+
const businessObject = getBusinessObject$1(element);
|
|
96534
|
+
return getExtensionElementsList$1(businessObject, 'zeebe:Script')[0];
|
|
96535
|
+
}
|
|
96536
|
+
|
|
96537
|
+
function TargetProps(props) {
|
|
96538
|
+
const {
|
|
96539
|
+
element
|
|
96540
|
+
} = props;
|
|
96541
|
+
if (!is$5(element, 'bpmn:CallActivity')) {
|
|
96542
|
+
return [];
|
|
96543
|
+
}
|
|
96544
|
+
return [{
|
|
96545
|
+
id: 'targetProcessId',
|
|
96546
|
+
component: TargetProcessId,
|
|
96547
|
+
isEdited: isEdited$6
|
|
96548
|
+
}];
|
|
96549
|
+
}
|
|
96550
|
+
function TargetProcessId(props) {
|
|
96551
|
+
const {
|
|
96552
|
+
element,
|
|
96553
|
+
id
|
|
96554
|
+
} = props;
|
|
96555
|
+
const commandStack = useService('commandStack'),
|
|
96556
|
+
bpmnFactory = useService('bpmnFactory'),
|
|
96557
|
+
translate = useService('translate'),
|
|
96558
|
+
debounce = useService('debounceInput');
|
|
96559
|
+
const getValue = () => {
|
|
96560
|
+
return getProcessId(element);
|
|
96561
|
+
};
|
|
96562
|
+
const setValue = value => {
|
|
96563
|
+
const commands = [];
|
|
96564
|
+
const businessObject = getBusinessObject$1(element);
|
|
96565
|
+
|
|
96566
|
+
// (1) ensure extension elements
|
|
96567
|
+
let extensionElements = businessObject.get('extensionElements');
|
|
96568
|
+
if (!extensionElements) {
|
|
96569
|
+
extensionElements = createElement$1('bpmn:ExtensionElements', {
|
|
96570
|
+
values: []
|
|
96571
|
+
}, businessObject, bpmnFactory);
|
|
96572
|
+
commands.push({
|
|
96573
|
+
cmd: 'element.updateModdleProperties',
|
|
96574
|
+
context: {
|
|
96575
|
+
element,
|
|
96576
|
+
moddleElement: businessObject,
|
|
96577
|
+
properties: {
|
|
96578
|
+
extensionElements
|
|
96579
|
+
}
|
|
96580
|
+
}
|
|
96581
|
+
});
|
|
96582
|
+
}
|
|
96583
|
+
|
|
96584
|
+
// (2) ensure zeebe:calledElement
|
|
96585
|
+
let calledElement = getCalledElement$1(businessObject);
|
|
96586
|
+
if (!calledElement) {
|
|
96587
|
+
calledElement = createElement$1('zeebe:CalledElement', {}, extensionElements, bpmnFactory);
|
|
96588
|
+
commands.push({
|
|
96589
|
+
cmd: 'element.updateModdleProperties',
|
|
96590
|
+
context: {
|
|
96591
|
+
element,
|
|
96592
|
+
moddleElement: extensionElements,
|
|
96593
|
+
properties: {
|
|
96594
|
+
values: [...extensionElements.get('values'), calledElement]
|
|
96595
|
+
}
|
|
96596
|
+
}
|
|
96597
|
+
});
|
|
96598
|
+
}
|
|
96599
|
+
|
|
96600
|
+
// (3) Update processId attribute
|
|
96601
|
+
commands.push({
|
|
96602
|
+
cmd: 'element.updateModdleProperties',
|
|
96603
|
+
context: {
|
|
96604
|
+
element,
|
|
96605
|
+
moddleElement: calledElement,
|
|
96606
|
+
properties: {
|
|
96607
|
+
processId: value
|
|
96608
|
+
}
|
|
96609
|
+
}
|
|
96610
|
+
});
|
|
96611
|
+
|
|
96612
|
+
// (4) Execute the commands
|
|
96613
|
+
commandStack.execute('properties-panel.multi-command-executor', commands);
|
|
96614
|
+
};
|
|
96615
|
+
return FeelEntryWithContext({
|
|
96616
|
+
element,
|
|
96617
|
+
id,
|
|
96618
|
+
label: translate('Process ID'),
|
|
96619
|
+
feel: 'optional',
|
|
96620
|
+
getValue,
|
|
96621
|
+
setValue,
|
|
96622
|
+
debounce
|
|
96623
|
+
});
|
|
96624
|
+
}
|
|
96625
|
+
|
|
96626
|
+
function TaskDefinitionProps(props) {
|
|
96627
|
+
const {
|
|
96628
|
+
element
|
|
96629
|
+
} = props;
|
|
96630
|
+
if (!isZeebeServiceTask(element)) {
|
|
96631
|
+
return [];
|
|
96632
|
+
}
|
|
96633
|
+
return [{
|
|
96634
|
+
id: 'taskDefinitionType',
|
|
96635
|
+
component: TaskDefinitionType,
|
|
96636
|
+
isEdited: isEdited$6
|
|
96637
|
+
}, {
|
|
96638
|
+
id: 'taskDefinitionRetries',
|
|
96639
|
+
component: TaskDefinitionRetries,
|
|
96640
|
+
isEdited: isEdited$6
|
|
96641
|
+
}];
|
|
96642
|
+
}
|
|
96643
|
+
function TaskDefinitionType(props) {
|
|
96644
|
+
const {
|
|
96645
|
+
element,
|
|
96646
|
+
id
|
|
96647
|
+
} = props;
|
|
96648
|
+
const commandStack = useService('commandStack');
|
|
96649
|
+
const bpmnFactory = useService('bpmnFactory');
|
|
96650
|
+
const translate = useService('translate');
|
|
96651
|
+
const debounce = useService('debounceInput');
|
|
96652
|
+
const getValue = () => {
|
|
96653
|
+
return (getTaskDefinition$4(element) || {}).type;
|
|
95926
96654
|
};
|
|
95927
96655
|
const setValue = value => {
|
|
95928
96656
|
const commands = [];
|
|
@@ -95947,7 +96675,7 @@
|
|
|
95947
96675
|
}
|
|
95948
96676
|
|
|
95949
96677
|
// (2) ensure task definition
|
|
95950
|
-
let taskDefinition = getTaskDefinition$
|
|
96678
|
+
let taskDefinition = getTaskDefinition$4(element);
|
|
95951
96679
|
if (!taskDefinition) {
|
|
95952
96680
|
taskDefinition = createElement$1('zeebe:TaskDefinition', {}, extensionElements, bpmnFactory);
|
|
95953
96681
|
commands.push({
|
|
@@ -95997,7 +96725,7 @@
|
|
|
95997
96725
|
const translate = useService('translate');
|
|
95998
96726
|
const debounce = useService('debounceInput');
|
|
95999
96727
|
const getValue = () => {
|
|
96000
|
-
return (getTaskDefinition$
|
|
96728
|
+
return (getTaskDefinition$4(element) || {}).retries;
|
|
96001
96729
|
};
|
|
96002
96730
|
const setValue = value => {
|
|
96003
96731
|
let commands = [];
|
|
@@ -96022,7 +96750,7 @@
|
|
|
96022
96750
|
}
|
|
96023
96751
|
|
|
96024
96752
|
// (2) ensure task definition
|
|
96025
|
-
let taskDefinition = getTaskDefinition$
|
|
96753
|
+
let taskDefinition = getTaskDefinition$4(element);
|
|
96026
96754
|
if (!taskDefinition) {
|
|
96027
96755
|
taskDefinition = createElement$1('zeebe:TaskDefinition', {}, extensionElements, bpmnFactory);
|
|
96028
96756
|
commands.push({
|
|
@@ -96063,7 +96791,7 @@
|
|
|
96063
96791
|
|
|
96064
96792
|
// helper ///////////////////////
|
|
96065
96793
|
|
|
96066
|
-
function getTaskDefinition$
|
|
96794
|
+
function getTaskDefinition$4(element) {
|
|
96067
96795
|
const businessObject = getBusinessObject$1(element);
|
|
96068
96796
|
return getExtensionElementsList$1(businessObject, 'zeebe:TaskDefinition')[0];
|
|
96069
96797
|
}
|
|
@@ -96658,7 +97386,7 @@
|
|
|
96658
97386
|
}
|
|
96659
97387
|
|
|
96660
97388
|
const LOW_PRIORITY$1 = 500;
|
|
96661
|
-
const ZEEBE_GROUPS = [BusinessRuleImplementationGroup, CalledDecisionGroup, TaskDefinitionGroup, AssignmentDefinitionGroup, FormGroup$1, ConditionGroup$1, TargetGroup, InputGroup$1, OutputPropagationGroup, OutputGroup$1, HeaderGroup, ExtensionPropertiesGroup$1];
|
|
97389
|
+
const ZEEBE_GROUPS = [BusinessRuleImplementationGroup, CalledDecisionGroup, ScriptImplementationGroup, ScriptGroup$1, TaskDefinitionGroup, AssignmentDefinitionGroup, FormGroup$1, ConditionGroup$1, TargetGroup, InputGroup$1, OutputPropagationGroup, OutputGroup$1, HeaderGroup, ExtensionPropertiesGroup$1];
|
|
96662
97390
|
class ZeebePropertiesProvider$1 {
|
|
96663
97391
|
constructor(propertiesPanel, injector) {
|
|
96664
97392
|
propertiesPanel.registerProvider(LOW_PRIORITY$1, this);
|
|
@@ -96670,6 +97398,7 @@
|
|
|
96670
97398
|
groups = groups.concat(this._getGroups(element));
|
|
96671
97399
|
|
|
96672
97400
|
// (2) update existing groups with zeebe specific properties
|
|
97401
|
+
updateErrorGroup$1(groups, element);
|
|
96673
97402
|
updateMessageGroup(groups, element);
|
|
96674
97403
|
updateTimerGroup$1(groups, element, this._injector);
|
|
96675
97404
|
updateMultiInstanceGroup$1(groups, element);
|
|
@@ -96696,6 +97425,17 @@
|
|
|
96696
97425
|
};
|
|
96697
97426
|
return group.entries.length ? group : null;
|
|
96698
97427
|
}
|
|
97428
|
+
function ScriptGroup$1(element) {
|
|
97429
|
+
const group = {
|
|
97430
|
+
id: 'script',
|
|
97431
|
+
label: 'Script',
|
|
97432
|
+
entries: [...ScriptProps$1({
|
|
97433
|
+
element
|
|
97434
|
+
})],
|
|
97435
|
+
component: Group
|
|
97436
|
+
};
|
|
97437
|
+
return group.entries.length ? group : null;
|
|
97438
|
+
}
|
|
96699
97439
|
function TaskDefinitionGroup(element) {
|
|
96700
97440
|
const group = {
|
|
96701
97441
|
id: 'taskDefinition',
|
|
@@ -96799,6 +97539,17 @@
|
|
|
96799
97539
|
};
|
|
96800
97540
|
return group.entries.length ? group : null;
|
|
96801
97541
|
}
|
|
97542
|
+
function ScriptImplementationGroup(element) {
|
|
97543
|
+
const group = {
|
|
97544
|
+
id: 'scriptImplementation',
|
|
97545
|
+
label: 'Implementation',
|
|
97546
|
+
entries: [...ScriptImplementationProps({
|
|
97547
|
+
element
|
|
97548
|
+
})],
|
|
97549
|
+
component: Group
|
|
97550
|
+
};
|
|
97551
|
+
return group.entries.length ? group : null;
|
|
97552
|
+
}
|
|
96802
97553
|
function AssignmentDefinitionGroup(element) {
|
|
96803
97554
|
const group = {
|
|
96804
97555
|
id: 'assignmentDefinition',
|
|
@@ -96826,6 +97577,15 @@
|
|
|
96826
97577
|
}
|
|
96827
97578
|
return null;
|
|
96828
97579
|
}
|
|
97580
|
+
function updateErrorGroup$1(groups, element) {
|
|
97581
|
+
const errorGroup = findGroup$1(groups, 'error');
|
|
97582
|
+
if (!errorGroup) {
|
|
97583
|
+
return;
|
|
97584
|
+
}
|
|
97585
|
+
errorGroup.entries = overrideGenericEntries(errorGroup.entries, ErrorProps$1({
|
|
97586
|
+
element
|
|
97587
|
+
}));
|
|
97588
|
+
}
|
|
96829
97589
|
function updateMessageGroup(groups, element) {
|
|
96830
97590
|
const messageGroup = findGroup$1(groups, 'message');
|
|
96831
97591
|
if (!messageGroup) {
|
|
@@ -97750,7 +98510,7 @@
|
|
|
97750
98510
|
// different conditions but same bindings
|
|
97751
98511
|
return oldProperties.filter(property => !findPropertyWithBinding(newTemplate, property));
|
|
97752
98512
|
}
|
|
97753
|
-
function normalizeReplacer(key, value) {
|
|
98513
|
+
function normalizeReplacer$1(key, value) {
|
|
97754
98514
|
if (isObject(value)) {
|
|
97755
98515
|
const keys = Object.keys(value).sort();
|
|
97756
98516
|
return keys.reduce((obj, key) => {
|
|
@@ -97761,7 +98521,7 @@
|
|
|
97761
98521
|
return value;
|
|
97762
98522
|
}
|
|
97763
98523
|
function equals(a, b) {
|
|
97764
|
-
return JSON.stringify(a, normalizeReplacer) === JSON.stringify(b, normalizeReplacer);
|
|
98524
|
+
return JSON.stringify(a, normalizeReplacer$1) === JSON.stringify(b, normalizeReplacer$1);
|
|
97765
98525
|
}
|
|
97766
98526
|
|
|
97767
98527
|
/**
|
|
@@ -99240,11 +100000,15 @@
|
|
|
99240
100000
|
// only keep value if old value is a valid option
|
|
99241
100001
|
return newProperty.choices && newProperty.choices.some(choice => choice.value === currentValue);
|
|
99242
100002
|
}
|
|
100003
|
+
|
|
100004
|
+
// keep existing old property if
|
|
100005
|
+
// user changed it from the original
|
|
99243
100006
|
if (oldProperty) {
|
|
99244
100007
|
return propertyChanged$1(element, oldProperty);
|
|
99245
|
-
} else {
|
|
99246
|
-
return !!getPropertyValue(element, newProperty);
|
|
99247
100008
|
}
|
|
100009
|
+
|
|
100010
|
+
// keep existing property value
|
|
100011
|
+
return !!getPropertyValue(element, newProperty);
|
|
99248
100012
|
}
|
|
99249
100013
|
|
|
99250
100014
|
/**
|
|
@@ -100679,14 +101443,172 @@
|
|
|
100679
101443
|
return groups;
|
|
100680
101444
|
}
|
|
100681
101445
|
|
|
101446
|
+
/**
|
|
101447
|
+
* Restores the original order of the template properties
|
|
101448
|
+
* on the moddle element.
|
|
101449
|
+
*/
|
|
101450
|
+
class UpdateTemplatePropertiesOrder extends CommandInterceptor {
|
|
101451
|
+
constructor(eventBus, elementTemplates, commandStack, bpmnFactory) {
|
|
101452
|
+
super(eventBus);
|
|
101453
|
+
this._eventBus = eventBus;
|
|
101454
|
+
this._elementTemplates = elementTemplates;
|
|
101455
|
+
this._commandStack = commandStack;
|
|
101456
|
+
this._bpmnFactory = bpmnFactory;
|
|
101457
|
+
this.postExecute(['element.updateProperties', 'element.updateModdleProperties'], this._updatePropertiesOrder, true, this);
|
|
101458
|
+
}
|
|
101459
|
+
_updatePropertiesOrder(context) {
|
|
101460
|
+
const {
|
|
101461
|
+
element
|
|
101462
|
+
} = context;
|
|
101463
|
+
const template = this._elementTemplates.get(element);
|
|
101464
|
+
const businessObject = element.businessObject;
|
|
101465
|
+
const commands = [];
|
|
101466
|
+
if (!template) {
|
|
101467
|
+
return;
|
|
101468
|
+
}
|
|
101469
|
+
const templateProperties = template.properties;
|
|
101470
|
+
|
|
101471
|
+
// zeebe:Property
|
|
101472
|
+
const zeebeProperties = findExtension$1(businessObject, 'zeebe:Properties');
|
|
101473
|
+
if (zeebeProperties) {
|
|
101474
|
+
this._updateZeebePropertiesOrder(zeebeProperties, templateProperties, commands, context);
|
|
101475
|
+
}
|
|
101476
|
+
|
|
101477
|
+
// zeebe:IoMapping
|
|
101478
|
+
const ioMapping = findExtension$1(businessObject, 'zeebe:IoMapping');
|
|
101479
|
+
if (ioMapping) {
|
|
101480
|
+
// zeebe:Input
|
|
101481
|
+
this._updateInputOrder(ioMapping, templateProperties, commands, context);
|
|
101482
|
+
|
|
101483
|
+
// zeebe:Output
|
|
101484
|
+
this._updateOutputOrder(ioMapping, templateProperties, commands, context);
|
|
101485
|
+
}
|
|
101486
|
+
|
|
101487
|
+
// zeebe:TaskHeaders
|
|
101488
|
+
const taskHeaders = findExtension$1(businessObject, 'zeebe:TaskHeaders');
|
|
101489
|
+
if (taskHeaders) {
|
|
101490
|
+
this._updateTaskHeadersOrder(taskHeaders, templateProperties, commands, context);
|
|
101491
|
+
}
|
|
101492
|
+
if (commands.length) {
|
|
101493
|
+
const commandsToExecute = commands.filter(command => command !== null);
|
|
101494
|
+
commandsToExecute.length && this._commandStack.execute('properties-panel.multi-command-executor', commandsToExecute);
|
|
101495
|
+
return;
|
|
101496
|
+
}
|
|
101497
|
+
}
|
|
101498
|
+
_updateZeebePropertiesOrder(zeebeProperties, templateProperties, commands, context) {
|
|
101499
|
+
const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:property' && prop.binding.name === propertyToFind.get('name'));
|
|
101500
|
+
const properties = zeebeProperties.get('properties');
|
|
101501
|
+
if (properties.length < 1) return;
|
|
101502
|
+
let newPropertiesOrder = [...properties];
|
|
101503
|
+
sortProperties(newPropertiesOrder, findIndex, templateProperties);
|
|
101504
|
+
if (!arrayEquals(newPropertiesOrder, properties)) {
|
|
101505
|
+
commands.push({
|
|
101506
|
+
cmd: 'element.updateModdleProperties',
|
|
101507
|
+
context: {
|
|
101508
|
+
...context,
|
|
101509
|
+
moddleElement: zeebeProperties,
|
|
101510
|
+
properties: {
|
|
101511
|
+
properties: newPropertiesOrder
|
|
101512
|
+
}
|
|
101513
|
+
}
|
|
101514
|
+
});
|
|
101515
|
+
}
|
|
101516
|
+
}
|
|
101517
|
+
_updateInputOrder(ioMapping, templateProperties, commands, context) {
|
|
101518
|
+
const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:input' && prop.binding.name === propertyToFind.get('target'));
|
|
101519
|
+
const inputParameters = ioMapping.get('inputParameters');
|
|
101520
|
+
if (inputParameters.length < 1) return;
|
|
101521
|
+
let newInputOrder = [...inputParameters];
|
|
101522
|
+
sortProperties(newInputOrder, findIndex, templateProperties);
|
|
101523
|
+
if (!arrayEquals(newInputOrder, inputParameters)) {
|
|
101524
|
+
commands.push({
|
|
101525
|
+
cmd: 'element.updateModdleProperties',
|
|
101526
|
+
context: {
|
|
101527
|
+
...context,
|
|
101528
|
+
moddleElement: ioMapping,
|
|
101529
|
+
properties: {
|
|
101530
|
+
inputParameters: newInputOrder
|
|
101531
|
+
}
|
|
101532
|
+
}
|
|
101533
|
+
});
|
|
101534
|
+
}
|
|
101535
|
+
}
|
|
101536
|
+
_updateOutputOrder(ioMapping, templateProperties, commands, context) {
|
|
101537
|
+
const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:output' && prop.binding.source === propertyToFind.get('source'));
|
|
101538
|
+
const outputParameters = ioMapping.get('outputParameters');
|
|
101539
|
+
if (outputParameters.length < 1) return;
|
|
101540
|
+
let newOutputOrder = [...outputParameters];
|
|
101541
|
+
sortProperties(newOutputOrder, findIndex, templateProperties);
|
|
101542
|
+
if (!arrayEquals(newOutputOrder, outputParameters)) {
|
|
101543
|
+
commands.push({
|
|
101544
|
+
cmd: 'element.updateModdleProperties',
|
|
101545
|
+
context: {
|
|
101546
|
+
...context,
|
|
101547
|
+
moddleElement: ioMapping,
|
|
101548
|
+
properties: {
|
|
101549
|
+
outputParameters: newOutputOrder
|
|
101550
|
+
}
|
|
101551
|
+
}
|
|
101552
|
+
});
|
|
101553
|
+
}
|
|
101554
|
+
}
|
|
101555
|
+
_updateTaskHeadersOrder(taskHeaders, templateProperties, commands, context) {
|
|
101556
|
+
const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:taskHeader' && prop.binding.key === propertyToFind.get('key'));
|
|
101557
|
+
const headers = taskHeaders.get('zeebe:values');
|
|
101558
|
+
if (headers.length < 1) return;
|
|
101559
|
+
let newHeadersOrder = [...headers];
|
|
101560
|
+
sortProperties(newHeadersOrder, findIndex, templateProperties);
|
|
101561
|
+
if (!arrayEquals(newHeadersOrder, headers)) {
|
|
101562
|
+
commands.push({
|
|
101563
|
+
cmd: 'element.updateModdleProperties',
|
|
101564
|
+
context: {
|
|
101565
|
+
...context,
|
|
101566
|
+
moddleElement: taskHeaders,
|
|
101567
|
+
properties: {
|
|
101568
|
+
values: newHeadersOrder
|
|
101569
|
+
}
|
|
101570
|
+
}
|
|
101571
|
+
});
|
|
101572
|
+
}
|
|
101573
|
+
}
|
|
101574
|
+
}
|
|
101575
|
+
UpdateTemplatePropertiesOrder.$inject = ['eventBus', 'elementTemplates', 'commandStack', 'bpmnFactory'];
|
|
101576
|
+
|
|
101577
|
+
// helpers
|
|
101578
|
+
|
|
101579
|
+
function normalizeReplacer(key, value) {
|
|
101580
|
+
if (isObject(value)) {
|
|
101581
|
+
const keys = Object.keys(value).sort();
|
|
101582
|
+
return keys.reduce((obj, key) => {
|
|
101583
|
+
obj[key] = value[key];
|
|
101584
|
+
return obj;
|
|
101585
|
+
}, {});
|
|
101586
|
+
}
|
|
101587
|
+
return value;
|
|
101588
|
+
}
|
|
101589
|
+
function objectEquals(a, b) {
|
|
101590
|
+
return JSON.stringify(a, normalizeReplacer) === JSON.stringify(b, normalizeReplacer);
|
|
101591
|
+
}
|
|
101592
|
+
function arrayEquals(a, b) {
|
|
101593
|
+
return a.every((element, idx) => objectEquals(element, b[idx]));
|
|
101594
|
+
}
|
|
101595
|
+
function sortProperties(array, findIndex, templateProperties) {
|
|
101596
|
+
return array.sort((a, b) => {
|
|
101597
|
+
const aIndex = findIndex(templateProperties, a);
|
|
101598
|
+
const bIndex = findIndex(templateProperties, b);
|
|
101599
|
+
return aIndex - bIndex;
|
|
101600
|
+
});
|
|
101601
|
+
}
|
|
101602
|
+
|
|
100682
101603
|
var index$1 = {
|
|
100683
101604
|
__depends__: [commandsModule$1, templateElementFactoryModule, translateModule, zeebePropertiesProviderModule],
|
|
100684
|
-
__init__: ['elementTemplatesLoader', 'replaceBehavior', 'elementTemplatesPropertiesProvider', 'elementTemplatesConditionChecker'],
|
|
101605
|
+
__init__: ['elementTemplatesLoader', 'replaceBehavior', 'elementTemplatesPropertiesProvider', 'elementTemplatesConditionChecker', 'updateTemplatePropertiesOrder'],
|
|
100685
101606
|
elementTemplates: ['type', ElementTemplates],
|
|
100686
101607
|
elementTemplatesLoader: ['type', ElementTemplatesLoader],
|
|
100687
101608
|
replaceBehavior: ['type', ReplaceBehavior$1],
|
|
100688
101609
|
elementTemplatesPropertiesProvider: ['type', ElementTemplatesPropertiesProvider$1],
|
|
100689
|
-
elementTemplatesConditionChecker: ['type', ElementTemplatesConditionChecker]
|
|
101610
|
+
elementTemplatesConditionChecker: ['type', ElementTemplatesConditionChecker],
|
|
101611
|
+
updateTemplatePropertiesOrder: ['type', UpdateTemplatePropertiesOrder]
|
|
100690
101612
|
};
|
|
100691
101613
|
|
|
100692
101614
|
/**
|
|
@@ -102076,6 +102998,124 @@
|
|
|
102076
102998
|
bpmnRules: [ 'type', CustomRules ]
|
|
102077
102999
|
};
|
|
102078
103000
|
|
|
103001
|
+
/**
|
|
103002
|
+
* A replace menu provider that allows to replace elements with
|
|
103003
|
+
* element templates.
|
|
103004
|
+
*/
|
|
103005
|
+
function ElementTemplatesReplaceProvider(popupMenu, translate, elementTemplates) {
|
|
103006
|
+
|
|
103007
|
+
this._popupMenu = popupMenu;
|
|
103008
|
+
this._translate = translate;
|
|
103009
|
+
this._elementTemplates = elementTemplates;
|
|
103010
|
+
|
|
103011
|
+
this.register();
|
|
103012
|
+
}
|
|
103013
|
+
|
|
103014
|
+
ElementTemplatesReplaceProvider.$inject = [
|
|
103015
|
+
'popupMenu',
|
|
103016
|
+
'translate',
|
|
103017
|
+
'elementTemplates'
|
|
103018
|
+
];
|
|
103019
|
+
|
|
103020
|
+
/**
|
|
103021
|
+
* Register replace menu provider in the popup menu
|
|
103022
|
+
*/
|
|
103023
|
+
ElementTemplatesReplaceProvider.prototype.register = function() {
|
|
103024
|
+
this._popupMenu.registerProvider('bpmn-replace', this);
|
|
103025
|
+
};
|
|
103026
|
+
|
|
103027
|
+
/**
|
|
103028
|
+
* Adds the element templates to the replace menu.
|
|
103029
|
+
* @param {djs.model.Base} element
|
|
103030
|
+
*
|
|
103031
|
+
* @returns {Object}
|
|
103032
|
+
*/
|
|
103033
|
+
ElementTemplatesReplaceProvider.prototype.getPopupMenuEntries = function(element) {
|
|
103034
|
+
|
|
103035
|
+
return (entries) => {
|
|
103036
|
+
|
|
103037
|
+
// convert our entries into something sortable
|
|
103038
|
+
let entrySet = Object.entries(entries);
|
|
103039
|
+
|
|
103040
|
+
// add template entries
|
|
103041
|
+
entrySet = [ ...entrySet, ...this.getTemplateEntries(element) ];
|
|
103042
|
+
|
|
103043
|
+
// convert back to object
|
|
103044
|
+
return entrySet.reduce((entries, [ key, value ]) => {
|
|
103045
|
+
entries[key] = value;
|
|
103046
|
+
|
|
103047
|
+
return entries;
|
|
103048
|
+
}, {});
|
|
103049
|
+
};
|
|
103050
|
+
};
|
|
103051
|
+
|
|
103052
|
+
/**
|
|
103053
|
+
* Get all element templates that can be used to replace the given element.
|
|
103054
|
+
*
|
|
103055
|
+
* @param {djs.model.Base} element
|
|
103056
|
+
*
|
|
103057
|
+
* @return {Array<Object>} a list of element templates as menu entries
|
|
103058
|
+
*/
|
|
103059
|
+
ElementTemplatesReplaceProvider.prototype.getTemplateEntries = function(element) {
|
|
103060
|
+
|
|
103061
|
+
const templates = this._getMatchingTemplates(element);
|
|
103062
|
+
return templates.map(template => {
|
|
103063
|
+
|
|
103064
|
+
const {
|
|
103065
|
+
icon = {},
|
|
103066
|
+
category,
|
|
103067
|
+
} = template;
|
|
103068
|
+
|
|
103069
|
+
const entryId = `replace.template-${template.id}`;
|
|
103070
|
+
|
|
103071
|
+
const defaultGroup = {
|
|
103072
|
+
id: 'templates',
|
|
103073
|
+
name: this._translate('Templates')
|
|
103074
|
+
};
|
|
103075
|
+
|
|
103076
|
+
return [ entryId, {
|
|
103077
|
+
label: template.name,
|
|
103078
|
+
description: template.description,
|
|
103079
|
+
documentationRef: template.documentationRef,
|
|
103080
|
+
imageUrl: icon.contents,
|
|
103081
|
+
group: category || defaultGroup,
|
|
103082
|
+
action: () => {
|
|
103083
|
+
this._elementTemplates.applyTemplate(element, template);
|
|
103084
|
+
}
|
|
103085
|
+
} ];
|
|
103086
|
+
});
|
|
103087
|
+
};
|
|
103088
|
+
|
|
103089
|
+
/**
|
|
103090
|
+
* Returns the templates that can the element can be replaced with.
|
|
103091
|
+
*
|
|
103092
|
+
* @param {djs.model.Base} element
|
|
103093
|
+
*
|
|
103094
|
+
* @return {Array<ElementTemplate>}
|
|
103095
|
+
*/
|
|
103096
|
+
ElementTemplatesReplaceProvider.prototype._getMatchingTemplates = function(element) {
|
|
103097
|
+
return this._elementTemplates.getLatest().filter(template => {
|
|
103098
|
+
return isAny(element, template.appliesTo) && !isTemplateApplied(element, template);
|
|
103099
|
+
});
|
|
103100
|
+
};
|
|
103101
|
+
|
|
103102
|
+
|
|
103103
|
+
// helpers ////////////
|
|
103104
|
+
function isTemplateApplied(element, template) {
|
|
103105
|
+
const businessObject = getBusinessObject$1(element);
|
|
103106
|
+
|
|
103107
|
+
if (businessObject) {
|
|
103108
|
+
return businessObject.get('zeebe:modelerTemplate') === template.id;
|
|
103109
|
+
}
|
|
103110
|
+
|
|
103111
|
+
return false;
|
|
103112
|
+
}
|
|
103113
|
+
|
|
103114
|
+
var replaceModule = {
|
|
103115
|
+
__init__: [ 'elementTemplatesProvider' ],
|
|
103116
|
+
elementTemplatesProvider: [ 'type', ElementTemplatesReplaceProvider ]
|
|
103117
|
+
};
|
|
103118
|
+
|
|
102079
103119
|
const ALL_OPTIONS = Object.values(replaceOptions);
|
|
102080
103120
|
|
|
102081
103121
|
function getReplaceOptionGroups() {
|
|
@@ -102084,23 +103124,18 @@
|
|
|
102084
103124
|
|
|
102085
103125
|
/**
|
|
102086
103126
|
* A replace menu provider that allows to replace elements with
|
|
102087
|
-
* element
|
|
103127
|
+
* templates applied with the correspondent plain element.
|
|
102088
103128
|
*/
|
|
102089
|
-
function
|
|
103129
|
+
function UnlinkTemplateReplaceProvider(popupMenu, translate, elementTemplates) {
|
|
102090
103130
|
|
|
102091
103131
|
this._popupMenu = popupMenu;
|
|
102092
103132
|
this._translate = translate;
|
|
102093
103133
|
this._elementTemplates = elementTemplates;
|
|
102094
103134
|
|
|
102095
|
-
|
|
102096
|
-
|
|
102097
|
-
if (enabled) {
|
|
102098
|
-
this.register();
|
|
102099
|
-
}
|
|
103135
|
+
this.register();
|
|
102100
103136
|
}
|
|
102101
103137
|
|
|
102102
|
-
|
|
102103
|
-
'config.elementTemplatesReplaceProvider',
|
|
103138
|
+
UnlinkTemplateReplaceProvider.$inject = [
|
|
102104
103139
|
'popupMenu',
|
|
102105
103140
|
'translate',
|
|
102106
103141
|
'elementTemplates'
|
|
@@ -102109,7 +103144,7 @@
|
|
|
102109
103144
|
/**
|
|
102110
103145
|
* Register replace menu provider in the popup menu
|
|
102111
103146
|
*/
|
|
102112
|
-
|
|
103147
|
+
UnlinkTemplateReplaceProvider.prototype.register = function() {
|
|
102113
103148
|
this._popupMenu.registerProvider('bpmn-replace', this);
|
|
102114
103149
|
};
|
|
102115
103150
|
|
|
@@ -102119,7 +103154,7 @@
|
|
|
102119
103154
|
*
|
|
102120
103155
|
* @returns {Object}
|
|
102121
103156
|
*/
|
|
102122
|
-
|
|
103157
|
+
UnlinkTemplateReplaceProvider.prototype.getPopupMenuEntries = function(element) {
|
|
102123
103158
|
|
|
102124
103159
|
return (entries) => {
|
|
102125
103160
|
|
|
@@ -102129,12 +103164,9 @@
|
|
|
102129
103164
|
if (this._elementTemplates.get(element)) {
|
|
102130
103165
|
|
|
102131
103166
|
// add unlink template option
|
|
102132
|
-
this.
|
|
103167
|
+
this.addPlainElementEntry(element, entrySet, this._translate, this._elementTemplates);
|
|
102133
103168
|
}
|
|
102134
103169
|
|
|
102135
|
-
// add template entries
|
|
102136
|
-
entrySet = [ ...entrySet, ...this.getTemplateEntries(element) ];
|
|
102137
|
-
|
|
102138
103170
|
// convert back to object
|
|
102139
103171
|
return entrySet.reduce((entries, [ key, value ]) => {
|
|
102140
103172
|
entries[key] = value;
|
|
@@ -102144,15 +103176,16 @@
|
|
|
102144
103176
|
};
|
|
102145
103177
|
};
|
|
102146
103178
|
|
|
103179
|
+
|
|
102147
103180
|
/**
|
|
102148
103181
|
* Adds the option to replace with plain element (unlink template).
|
|
102149
103182
|
*
|
|
102150
103183
|
* @param {djs.model.Base} element
|
|
102151
103184
|
* @param {Array<Object>} entries
|
|
102152
103185
|
*/
|
|
102153
|
-
|
|
103186
|
+
UnlinkTemplateReplaceProvider.prototype.addPlainElementEntry = function(element, entries, translate, elementTemplates) {
|
|
102154
103187
|
|
|
102155
|
-
const replaceOption = this.
|
|
103188
|
+
const replaceOption = this.getPlainEntry(element, entries, translate, elementTemplates);
|
|
102156
103189
|
|
|
102157
103190
|
if (!replaceOption) {
|
|
102158
103191
|
return;
|
|
@@ -102175,7 +103208,7 @@
|
|
|
102175
103208
|
*
|
|
102176
103209
|
* @returns {Array<Object, number>}
|
|
102177
103210
|
*/
|
|
102178
|
-
|
|
103211
|
+
UnlinkTemplateReplaceProvider.prototype.getPlainEntry = function(element, entries, translate, elementTemplates) {
|
|
102179
103212
|
|
|
102180
103213
|
const {
|
|
102181
103214
|
options,
|
|
@@ -102190,9 +103223,9 @@
|
|
|
102190
103223
|
const entry = {
|
|
102191
103224
|
id: 'replace-unlink-element-template',
|
|
102192
103225
|
action: () => {
|
|
102193
|
-
|
|
103226
|
+
elementTemplates.applyTemplate(element, null);
|
|
102194
103227
|
},
|
|
102195
|
-
label:
|
|
103228
|
+
label: translate(option.label),
|
|
102196
103229
|
className: option.className
|
|
102197
103230
|
};
|
|
102198
103231
|
|
|
@@ -102223,66 +103256,34 @@
|
|
|
102223
103256
|
];
|
|
102224
103257
|
};
|
|
102225
103258
|
|
|
103259
|
+
|
|
102226
103260
|
/**
|
|
102227
|
-
*
|
|
102228
|
-
*
|
|
102229
|
-
* @param {djs.model.Base} element
|
|
103261
|
+
* @param {ModdleElement} element
|
|
102230
103262
|
*
|
|
102231
|
-
* @return {Array<
|
|
103263
|
+
* @return { { options: Array<any>, option: any, optionIndex: number } | null }
|
|
102232
103264
|
*/
|
|
102233
|
-
|
|
102234
|
-
|
|
102235
|
-
const templates = this._getMatchingTemplates(element);
|
|
102236
|
-
return templates.map(template => {
|
|
102237
|
-
|
|
102238
|
-
const {
|
|
102239
|
-
icon = {},
|
|
102240
|
-
category,
|
|
102241
|
-
} = template;
|
|
102242
|
-
|
|
102243
|
-
const entryId = `replace.template-${template.id}`;
|
|
102244
|
-
|
|
102245
|
-
const defaultGroup = {
|
|
102246
|
-
id: 'templates',
|
|
102247
|
-
name: this._translate('Templates')
|
|
102248
|
-
};
|
|
103265
|
+
function findReplaceOptions(element) {
|
|
102249
103266
|
|
|
102250
|
-
|
|
102251
|
-
name: template.name,
|
|
102252
|
-
description: template.description,
|
|
102253
|
-
documentationRef: template.documentationRef,
|
|
102254
|
-
imageUrl: icon.contents,
|
|
102255
|
-
group: category || defaultGroup,
|
|
102256
|
-
action: () => {
|
|
102257
|
-
this._elementTemplates.applyTemplate(element, template);
|
|
102258
|
-
}
|
|
102259
|
-
} ];
|
|
102260
|
-
});
|
|
102261
|
-
};
|
|
103267
|
+
const isSameType = (element, option) => option.target && !isDifferentType(element)(option);
|
|
102262
103268
|
|
|
102263
|
-
|
|
102264
|
-
* Returns the templates that can the element can be replaced with.
|
|
102265
|
-
*
|
|
102266
|
-
* @param {djs.model.Base} element
|
|
102267
|
-
*
|
|
102268
|
-
* @return {Array<ElementTemplate>}
|
|
102269
|
-
*/
|
|
102270
|
-
ElementTemplatesReplaceProvider.prototype._getMatchingTemplates = function(element) {
|
|
102271
|
-
return this._elementTemplates.getLatest().filter(template => {
|
|
102272
|
-
return isAny(element, template.appliesTo) && !isTemplateApplied(element, template);
|
|
102273
|
-
});
|
|
102274
|
-
};
|
|
103269
|
+
return getReplaceOptionGroups().reduce((result, options) => {
|
|
102275
103270
|
|
|
103271
|
+
if (result) {
|
|
103272
|
+
return result;
|
|
103273
|
+
}
|
|
102276
103274
|
|
|
102277
|
-
|
|
102278
|
-
function isTemplateApplied(element, template) {
|
|
102279
|
-
const businessObject = getBusinessObject$1(element);
|
|
103275
|
+
const optionIndex = options.findIndex(option => isSameType(element, option));
|
|
102280
103276
|
|
|
102281
|
-
|
|
102282
|
-
|
|
102283
|
-
|
|
103277
|
+
if (optionIndex === -1) {
|
|
103278
|
+
return;
|
|
103279
|
+
}
|
|
102284
103280
|
|
|
102285
|
-
|
|
103281
|
+
return {
|
|
103282
|
+
options,
|
|
103283
|
+
option: options[optionIndex],
|
|
103284
|
+
optionIndex
|
|
103285
|
+
};
|
|
103286
|
+
}, null);
|
|
102286
103287
|
}
|
|
102287
103288
|
|
|
102288
103289
|
function getOptionIndex(options, index, entries) {
|
|
@@ -102297,38 +103298,190 @@
|
|
|
102297
103298
|
);
|
|
102298
103299
|
}
|
|
102299
103300
|
|
|
102300
|
-
|
|
102301
|
-
|
|
102302
|
-
|
|
102303
|
-
|
|
102304
|
-
|
|
102305
|
-
|
|
103301
|
+
var sharedReplaceModule = {
|
|
103302
|
+
__init__: [
|
|
103303
|
+
'unlinkTemplateReplaceProvider'
|
|
103304
|
+
],
|
|
103305
|
+
unlinkTemplateReplaceProvider: [ 'type', UnlinkTemplateReplaceProvider ]
|
|
103306
|
+
};
|
|
102306
103307
|
|
|
102307
|
-
|
|
103308
|
+
const colorImageSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="m12.5 5.5.3-.4 3.6-3.6c.5-.5 1.3-.5 1.7 0l1 1c.5.4.5 1.2 0 1.7l-3.6 3.6-.4.2v.2c0 1.4.6 2 1 2.7v.6l-1.7 1.6c-.2.2-.4.2-.6 0L7.3 6.6a.4.4 0 0 1 0-.6l.3-.3.5-.5.8-.8c.2-.2.4-.1.6 0 .9.5 1.5 1.1 3 1.1zm-9.9 6 4.2-4.2 6.3 6.3-4.2 4.2c-.3.3-.9.3-1.2 0l-.8-.8-.9-.8-2.3-2.9" /></svg>';
|
|
103309
|
+
|
|
103310
|
+
const colorImageUrl = 'data:image/svg+xml;utf8,' + encodeURIComponent(colorImageSvg);
|
|
103311
|
+
|
|
103312
|
+
|
|
103313
|
+
function ColorContextPadProvider(contextPad, popupMenu, canvas, translate) {
|
|
103314
|
+
|
|
103315
|
+
this._contextPad = contextPad;
|
|
103316
|
+
this._popupMenu = popupMenu;
|
|
103317
|
+
this._canvas = canvas;
|
|
103318
|
+
this._translate = translate;
|
|
103319
|
+
|
|
103320
|
+
contextPad.registerProvider(this);
|
|
103321
|
+
}
|
|
103322
|
+
|
|
103323
|
+
|
|
103324
|
+
ColorContextPadProvider.$inject = [
|
|
103325
|
+
'contextPad',
|
|
103326
|
+
'popupMenu',
|
|
103327
|
+
'canvas',
|
|
103328
|
+
'translate'
|
|
103329
|
+
];
|
|
103330
|
+
|
|
103331
|
+
|
|
103332
|
+
ColorContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
103333
|
+
return this._createPopupAction([ element ]);
|
|
103334
|
+
};
|
|
103335
|
+
|
|
103336
|
+
|
|
103337
|
+
ColorContextPadProvider.prototype.getMultiElementContextPadEntries = function(elements) {
|
|
103338
|
+
|
|
103339
|
+
return this._createPopupAction(elements);
|
|
103340
|
+
};
|
|
103341
|
+
|
|
103342
|
+
ColorContextPadProvider.prototype._createPopupAction = function(elements) {
|
|
103343
|
+
|
|
103344
|
+
const canvas = this._canvas;
|
|
103345
|
+
const translate = this._translate;
|
|
103346
|
+
const contextPad = this._contextPad;
|
|
103347
|
+
const popupMenu = this._popupMenu;
|
|
103348
|
+
|
|
103349
|
+
return {
|
|
103350
|
+
'set-color': {
|
|
103351
|
+
group: 'edit',
|
|
103352
|
+
className: 'bpmn-icon-color',
|
|
103353
|
+
title: translate('Set Color'),
|
|
103354
|
+
imageUrl: colorImageUrl,
|
|
103355
|
+
action: {
|
|
103356
|
+
click: (event, element) => {
|
|
103357
|
+
|
|
103358
|
+
// get start popup draw start position
|
|
103359
|
+
var position = {
|
|
103360
|
+
...getStartPosition(canvas, contextPad, elements),
|
|
103361
|
+
cursor: {
|
|
103362
|
+
x: event.x,
|
|
103363
|
+
y: event.y
|
|
103364
|
+
}
|
|
103365
|
+
};
|
|
103366
|
+
|
|
103367
|
+
// open new color-picker popup
|
|
103368
|
+
popupMenu.open(elements, 'color-picker', position);
|
|
103369
|
+
}
|
|
103370
|
+
}
|
|
103371
|
+
}
|
|
103372
|
+
};
|
|
103373
|
+
|
|
103374
|
+
};
|
|
103375
|
+
|
|
103376
|
+
|
|
103377
|
+
// helpers //////////////////////
|
|
103378
|
+
|
|
103379
|
+
function getStartPosition(canvas, contextPad, elements) {
|
|
103380
|
+
|
|
103381
|
+
var Y_OFFSET = 5;
|
|
103382
|
+
|
|
103383
|
+
var diagramContainer = canvas.getContainer(),
|
|
103384
|
+
pad = contextPad.getPad(elements).html;
|
|
103385
|
+
|
|
103386
|
+
var diagramRect = diagramContainer.getBoundingClientRect(),
|
|
103387
|
+
padRect = pad.getBoundingClientRect();
|
|
103388
|
+
|
|
103389
|
+
var top = padRect.top - diagramRect.top;
|
|
103390
|
+
var left = padRect.left - diagramRect.left;
|
|
103391
|
+
|
|
103392
|
+
var pos = {
|
|
103393
|
+
x: left,
|
|
103394
|
+
y: top + padRect.height + Y_OFFSET
|
|
103395
|
+
};
|
|
103396
|
+
|
|
103397
|
+
return pos;
|
|
103398
|
+
}
|
|
102308
103399
|
|
|
102309
|
-
|
|
103400
|
+
const COLORS = [ {
|
|
103401
|
+
label: 'Default',
|
|
103402
|
+
fill: undefined,
|
|
103403
|
+
stroke: undefined
|
|
103404
|
+
}, {
|
|
103405
|
+
label: 'Blue',
|
|
103406
|
+
fill: '#BBDEFB',
|
|
103407
|
+
stroke: '#0D4372'
|
|
103408
|
+
}, {
|
|
103409
|
+
label: 'Orange',
|
|
103410
|
+
fill: '#FFE0B2',
|
|
103411
|
+
stroke: '#6B3C00'
|
|
103412
|
+
}, {
|
|
103413
|
+
label: 'Green',
|
|
103414
|
+
fill: '#C8E6C9',
|
|
103415
|
+
stroke: '#205022'
|
|
103416
|
+
}, {
|
|
103417
|
+
label: 'Red',
|
|
103418
|
+
fill: '#FFCDD2',
|
|
103419
|
+
stroke: '#831311'
|
|
103420
|
+
}, {
|
|
103421
|
+
label: 'Purple',
|
|
103422
|
+
fill: '#E1BEE7',
|
|
103423
|
+
stroke: '#5B176D'
|
|
103424
|
+
} ];
|
|
102310
103425
|
|
|
102311
|
-
if (result) {
|
|
102312
|
-
return result;
|
|
102313
|
-
}
|
|
102314
103426
|
|
|
102315
|
-
|
|
103427
|
+
function ColorPopupProvider(config, popupMenu, modeling, translate) {
|
|
103428
|
+
this._popupMenu = popupMenu;
|
|
103429
|
+
this._modeling = modeling;
|
|
103430
|
+
this._translate = translate;
|
|
102316
103431
|
|
|
102317
|
-
|
|
102318
|
-
|
|
102319
|
-
|
|
103432
|
+
this._colors = config && config.colors || COLORS;
|
|
103433
|
+
|
|
103434
|
+
this._popupMenu.registerProvider('color-picker', this);
|
|
103435
|
+
}
|
|
103436
|
+
|
|
103437
|
+
|
|
103438
|
+
ColorPopupProvider.$inject = [
|
|
103439
|
+
'config.colorPicker',
|
|
103440
|
+
'popupMenu',
|
|
103441
|
+
'modeling',
|
|
103442
|
+
'translate'
|
|
103443
|
+
];
|
|
103444
|
+
|
|
103445
|
+
|
|
103446
|
+
ColorPopupProvider.prototype.getEntries = function(elements) {
|
|
103447
|
+
var self = this;
|
|
103448
|
+
|
|
103449
|
+
var colorIcon = domify$1(`
|
|
103450
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="100%">
|
|
103451
|
+
<rect rx="2" x="1" y="1" width="22" height="22" fill="var(--fill-color)" stroke="var(--stroke-color)"></rect>
|
|
103452
|
+
</svg>
|
|
103453
|
+
`);
|
|
103454
|
+
|
|
103455
|
+
var entries = this._colors.map(function(color) {
|
|
103456
|
+
|
|
103457
|
+
colorIcon.style.setProperty('--fill-color', color.fill || 'white');
|
|
103458
|
+
colorIcon.style.setProperty('--stroke-color', color.stroke || 'rgb(34, 36, 42)');
|
|
102320
103459
|
|
|
102321
103460
|
return {
|
|
102322
|
-
|
|
102323
|
-
|
|
102324
|
-
|
|
103461
|
+
title: self._translate(color.label),
|
|
103462
|
+
id: color.label.toLowerCase() + '-color',
|
|
103463
|
+
imageUrl: `data:image/svg+xml;utf8,${ encodeURIComponent(colorIcon.outerHTML) }`,
|
|
103464
|
+
action: createAction(self._modeling, elements, color)
|
|
102325
103465
|
};
|
|
102326
|
-
}
|
|
103466
|
+
});
|
|
103467
|
+
|
|
103468
|
+
return entries;
|
|
103469
|
+
};
|
|
103470
|
+
|
|
103471
|
+
|
|
103472
|
+
function createAction(modeling, element, color) {
|
|
103473
|
+
return function() {
|
|
103474
|
+
modeling.setColor(element, color);
|
|
103475
|
+
};
|
|
102327
103476
|
}
|
|
102328
103477
|
|
|
102329
|
-
var
|
|
102330
|
-
__init__: [
|
|
102331
|
-
|
|
103478
|
+
var colorPickerModule = {
|
|
103479
|
+
__init__: [
|
|
103480
|
+
'colorContextPadProvider',
|
|
103481
|
+
'colorPopupProvider'
|
|
103482
|
+
],
|
|
103483
|
+
colorContextPadProvider: [ 'type', ColorContextPadProvider ],
|
|
103484
|
+
colorPopupProvider: [ 'type', ColorPopupProvider ]
|
|
102332
103485
|
};
|
|
102333
103486
|
|
|
102334
103487
|
function getModelerTemplateIcon(element) {
|
|
@@ -102872,7 +104025,9 @@
|
|
|
102872
104025
|
rulesModule,
|
|
102873
104026
|
zeebePropertiesProviderModule,
|
|
102874
104027
|
index$1,
|
|
102875
|
-
replaceModule
|
|
104028
|
+
replaceModule,
|
|
104029
|
+
sharedReplaceModule,
|
|
104030
|
+
colorPickerModule
|
|
102876
104031
|
];
|
|
102877
104032
|
|
|
102878
104033
|
Modeler.prototype._modules = [].concat(
|