Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dmn-js-shared

Package Overview
Dependencies
Maintainers
8
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dmn-js-shared - npm Package Compare versions

Comparing version 15.1.0 to 16.0.0

10

lib/base/EditingManager.js

@@ -17,6 +17,8 @@ import Manager from './Manager';

});
this.on('viewer.created', _ref => {
var viewer = _ref.viewer;
viewer.on('elements.changed', _ref2 => {
var elements = _ref2.elements;
this.on('viewer.created', ({
viewer
}) => {
viewer.on('elements.changed', ({
elements
}) => {
var viewsChanged = elements.some(function (e) {

@@ -23,0 +25,0 @@ return isAny(e, ['dmn:Decision', 'dmn:Definitions']);

54

lib/base/Manager.js

@@ -1,6 +0,1 @@

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import EventBus from 'diagram-js/lib/core/EventBus';

@@ -20,3 +15,3 @@ import DmnModdle from 'dmn-moddle';

var DEFAULT_CONTAINER_OPTIONS = {
const DEFAULT_CONTAINER_OPTIONS = {
width: '100%',

@@ -40,10 +35,3 @@ height: '100%',

*/
constructor() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_defineProperty(this, "_viewsChanged", () => {
this._emit('views.changed', {
views: this._views,
activeView: this._activeView
});
});
constructor(options = {}) {
this._eventBus = new EventBus();

@@ -204,3 +192,3 @@ this._viewsChanged = debounce(this._viewsChanged, 0);

enumerable: true,
get: function get() {
get: function () {
console.warn(new Error('import.parse.complete <context> is deprecated ' + 'and will be removed in future library versions'));

@@ -323,4 +311,4 @@ return {

*/
on() {
this._eventBus.on(...arguments);
on(...args) {
this._eventBus.on(...args);
}

@@ -334,4 +322,4 @@

*/
off() {
this._eventBus.off(...arguments);
off(...args) {
this._eventBus.off(...args);
}

@@ -347,4 +335,4 @@

*/
once() {
this._eventBus.once(...arguments);
once(...args) {
this._eventBus.once(...args);
}

@@ -378,4 +366,4 @@ attachTo(parentNode) {

this._views = [];
var container = domify('<div class="dmn-js-parent"></div>');
var containerOptions = assign({}, DEFAULT_CONTAINER_OPTIONS, options);
const container = domify('<div class="dmn-js-parent"></div>');
const containerOptions = assign({}, DEFAULT_CONTAINER_OPTIONS, options);
assign(container.style, {

@@ -409,2 +397,9 @@ width: ensureUnit(containerOptions.width),

}
_viewsChanged = () => {
this._emit('views.changed', {
views: this._views,
activeView: this._activeView
});
};
/**

@@ -427,4 +422,3 @@ * Recompute changed views after elements in

newViews = [];
for (var _i = 0, _displayableElements = displayableElements; _i < _displayableElements.length; _i++) {
var element = _displayableElements[_i];
for (var element of displayableElements) {
var provider = find(viewProviders, function (provider) {

@@ -571,3 +565,5 @@ if (typeof provider.opens === 'string') {

var commonOptions = this._options.common || {};
return new Viewer(_objectSpread(_objectSpread(_objectSpread({}, commonOptions), providerOptions), {}, {
return new Viewer({
...commonOptions,
...providerOptions,
additionalModules: [...(providerOptions.additionalModules || []), {

@@ -577,3 +573,3 @@ _parent: ['value', this],

}]
}));
});
}

@@ -584,4 +580,4 @@

*/
_emit() {
return this._eventBus.fire(...arguments);
_emit(...args) {
return this._eventBus.fire(...args);
}

@@ -588,0 +584,0 @@ _createModdle(options) {

@@ -49,3 +49,3 @@ /**

*/
on(event) {}
on(event, ...args) {}

@@ -58,3 +58,3 @@ /**

*/
off(event) {}
off(event, ...args) {}

@@ -61,0 +61,0 @@ /**

export default class ChangeSupport {
constructor(eventBus) {
this._listeners = {};
eventBus.on('elements.changed', _ref => {
var elements = _ref.elements;
eventBus.on('elements.changed', ({
elements
}) => {
this.elementsChanged(elements);
});
eventBus.on('element.updateId', _ref2 => {
var element = _ref2.element,
newId = _ref2.newId;
eventBus.on('element.updateId', ({
element,
newId
}) => {
this.updateId(element.id, newId);

@@ -15,6 +17,8 @@ });

elementsChanged(elements) {
var invoked = {};
var elementsLength = elements.length;
for (var i = 0; i < elementsLength; i++) {
var id = elements[i].id;
const invoked = {};
const elementsLength = elements.length;
for (let i = 0; i < elementsLength; i++) {
const {
id
} = elements[i];
if (invoked[id]) {

@@ -24,5 +28,5 @@ return;

invoked[id] = true;
var listenersLength = this._listeners[id] && this._listeners[id].length;
const listenersLength = this._listeners[id] && this._listeners[id].length;
if (listenersLength) {
for (var j = 0; j < listenersLength; j++) {
for (let j = 0; j < listenersLength; j++) {
// listeners might remove themselves before they get called

@@ -47,3 +51,3 @@ this._listeners[id][j] && this._listeners[id][j]();

if (listener) {
var idx = this._listeners[id].indexOf(listener);
const idx = this._listeners[id].indexOf(listener);
if (idx !== -1) {

@@ -50,0 +54,0 @@ this._listeners[id].splice(idx, 1);

import { isFunction, isNumber } from 'min-dash';
var DEFAULT_PRIORITY = 1000;
const DEFAULT_PRIORITY = 1000;
export default class Components {

@@ -8,8 +8,8 @@ constructor() {

getComponent(type, context) {
var listeners = this._listeners[type];
const listeners = this._listeners[type];
if (!listeners) {
return;
}
var component;
for (var i = 0; i < listeners.length; i++) {
let component;
for (let i = 0; i < listeners.length; i++) {
component = listeners[i].callback(context);

@@ -23,9 +23,9 @@ if (component) {

getComponents(type, context) {
var listeners = this._listeners[type];
const listeners = this._listeners[type];
if (!listeners) {
return;
}
var components = [];
for (var i = 0; i < listeners.length; i++) {
var component = listeners[i].callback(context);
const components = [];
for (let i = 0; i < listeners.length; i++) {
const component = listeners[i].callback(context);
if (component) {

@@ -48,5 +48,5 @@ components.push(component);

}
var listeners = this._getListeners(type);
var existingListener, idx;
var newListener = {
const listeners = this._getListeners(type);
let existingListener, idx;
const newListener = {
priority,

@@ -65,4 +65,4 @@ callback

offGetComponent(type, callback) {
var listeners = this._getListeners(type);
var listener, listenerCallback, idx;
const listeners = this._getListeners(type);
let listener, listenerCallback, idx;
if (callback) {

@@ -83,3 +83,3 @@ // move through listeners from back to front

_getListeners(type) {
var listeners = this._listeners[type];
let listeners = this._listeners[type];
if (!listeners) {

@@ -86,0 +86,0 @@ this._listeners[type] = listeners = [];

@@ -6,3 +6,3 @@ import { createVNode, createComponentVNode } from "inferno";

super(props);
var injector = this._injector = props.injector;
const injector = this._injector = props.injector;
this._changeSupport = injector.get('changeSupport');

@@ -21,3 +21,3 @@ this._components = injector.get('components');

render() {
var components = this._components.getComponents('viewer');
const components = this._components.getComponents('viewer');
return createVNode(1, "div", "viewer-container", components && components.map((Component, index) => createComponentVNode(2, Component, null, index)), 0);

@@ -24,0 +24,0 @@ }

@@ -6,3 +6,5 @@ import { createComponentVNode } from "inferno";

constructor(changeSupport, components, config, eventBus, injector) {
var container = config.container;
const {
container
} = config;
this._container = container;

@@ -9,0 +11,0 @@ eventBus.on('renderer.mount', () => {

@@ -1,4 +0,1 @@

var _excluded = ["modules"];
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import { Injector } from 'didi';

@@ -11,9 +8,11 @@ import core from './core';

export default class Viewer {
constructor() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var injector = options.injector;
constructor(options = {}) {
let {
injector
} = options;
if (!injector) {
var _this$_init = this._init(options),
modules = _this$_init.modules,
config = _this$_init.config;
let {
modules,
config
} = this._init(options);
injector = createInjector(config, modules);

@@ -34,4 +33,6 @@ }

_init(options) {
var modules = options.modules,
config = _objectWithoutProperties(options, _excluded);
let {
modules,
...config
} = options;
return {

@@ -47,3 +48,3 @@ modules,

destroy() {
var eventBus = this.get('eventBus');
const eventBus = this.get('eventBus');
eventBus.fire('viewer.destroy');

@@ -56,3 +57,3 @@ }

clear() {
var eventBus = this.get('eventBus');
const eventBus = this.get('eventBus');
eventBus.fire('viewer.clear');

@@ -65,6 +66,6 @@ }

function createInjector(config, modules) {
var bootstrapModules = [{
const bootstrapModules = [{
config: ['value', config]
}, core].concat(modules || []);
var injector = new Injector(bootstrapModules);
const injector = new Injector(bootstrapModules);
injector.init();

@@ -71,0 +72,0 @@ return injector;

import { createVNode } from "inferno";
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Component } from 'inferno';

@@ -9,26 +6,34 @@ export default class Button extends Component {

super(props, context);
_defineProperty(this, "onClick", event => {
var onClick = this.props.onClick;
if (typeof onClick !== 'function') {
return;
}
onClick(event);
});
_defineProperty(this, "onMouseDown", event => {
var onMouseDown = this.props.onMouseDown;
if (typeof onMouseDown !== 'function') {
return;
}
onMouseDown(event);
});
_defineProperty(this, "onMouseUp", event => {
var onMouseUp = this.props.onMouseUp;
if (typeof onMouseUp !== 'function') {
return;
}
onMouseUp(event);
});
}
onClick = event => {
const {
onClick
} = this.props;
if (typeof onClick !== 'function') {
return;
}
onClick(event);
};
onMouseDown = event => {
const {
onMouseDown
} = this.props;
if (typeof onMouseDown !== 'function') {
return;
}
onMouseDown(event);
};
onMouseUp = event => {
const {
onMouseUp
} = this.props;
if (typeof onMouseUp !== 'function') {
return;
}
onMouseUp(event);
};
render() {
var className = this.props.className;
const {
className
} = this.props;
return createVNode(1, "button", [className || '', 'button'].join(' '), this.props.children, 0, {

@@ -35,0 +40,0 @@ "onClick": this.onClick,

import { createVNode } from "inferno";
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Component } from 'inferno';

@@ -40,63 +37,2 @@ import escapeHtml from 'escape-html';

super(props, context);
_defineProperty(this, "onFocus", event => {
var propsFocus = this.props.onFocus;
this.setState({
focussed: true
});
if (typeof propsFocus === 'function') {
propsFocus(event);
}
});
_defineProperty(this, "onBlur", event => {
var propsBlur = this.props.onBlur;
this.setState({
focussed: false
});
if (typeof propsBlur === 'function') {
propsBlur(event);
}
});
_defineProperty(this, "onKeydown", event => {
// enter
if (event.which === 13) {
// prevent default action (<br/> insert)
event.preventDefault();
if (this.props.ctrlForNewline && !isCmd(event)) {
return;
}
if (this.props.singleLine) {
return;
}
event.stopPropagation();
insertLineBreak();
this.onInput(event);
}
});
_defineProperty(this, "onInput", event => {
var propsInput = this.props.onInput;
if (typeof propsInput !== 'function') {
return;
}
var text = innerText(this.node);
propsInput(text);
});
// TODO(barmac): remove once we drop IE 11 support
_defineProperty(this, "onKeyPress", event => {
if (this.onInputIEPolyfill) {
this.onInputIEPolyfill(event);
}
});
_defineProperty(this, "onPaste", event => {
// TODO(barmac): remove once we drop IE 11 support
if (this.onInputIEPolyfill) {
this.onInputIEPolyfill(event);
}
if (this.props.singleLine) {
var text = (event.clipboardData || window.clipboardData).getData('text');
// replace newline with space
document.execCommand('insertText', false, text.replace(/\n/g, ' '));
event.preventDefault();
}
});
this.state = {};

@@ -136,19 +72,84 @@

var range = selected.range;
var text = selected.text;
var node = this.node;
var newText = innerText(node);
var newRange = newText !== text ? selectionUpdate(range, text, newText) : range;
const range = selected.range;
const text = selected.text;
const node = this.node;
const newText = innerText(node);
const newRange = newText !== text ? selectionUpdate(range, text, newText) : range;
setRange(node, newRange);
}
onFocus = event => {
var propsFocus = this.props.onFocus;
this.setState({
focussed: true
});
if (typeof propsFocus === 'function') {
propsFocus(event);
}
};
onBlur = event => {
var propsBlur = this.props.onBlur;
this.setState({
focussed: false
});
if (typeof propsBlur === 'function') {
propsBlur(event);
}
};
onKeydown = event => {
// enter
if (event.which === 13) {
// prevent default action (<br/> insert)
event.preventDefault();
if (this.props.ctrlForNewline && !isCmd(event)) {
return;
}
if (this.props.singleLine) {
return;
}
event.stopPropagation();
insertLineBreak();
this.onInput(event);
}
};
onInput = event => {
var propsInput = this.props.onInput;
if (typeof propsInput !== 'function') {
return;
}
var text = innerText(this.node);
propsInput(text);
};
// TODO(barmac): remove once we drop IE 11 support
onKeyPress = event => {
if (this.onInputIEPolyfill) {
this.onInputIEPolyfill(event);
}
};
onPaste = event => {
// TODO(barmac): remove once we drop IE 11 support
if (this.onInputIEPolyfill) {
this.onInputIEPolyfill(event);
}
if (this.props.singleLine) {
const text = (event.clipboardData || window.clipboardData).getData('text');
// replace newline with space
document.execCommand('insertText', false, text.replace(/\n/g, ' '));
event.preventDefault();
}
};
getClassName() {
var _this$props = this.props,
className = _this$props.className,
placeholder = _this$props.placeholder,
value = _this$props.value;
const {
className,
placeholder,
value
} = this.props;
return [className || '', 'content-editable', !value && placeholder ? 'placeholder' : ''].join(' ');
}
render(props) {
var value = props.value,
placeholder = props.placeholder;
var {
value,
placeholder
} = props;

@@ -155,0 +156,0 @@ // QUIRK: must add trailing <br/> for line

import { createComponentVNode } from "inferno";
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Component } from 'inferno';

@@ -40,27 +37,2 @@ import ContentEditable from './ContentEditable';

super(props, context);
_defineProperty(this, "onFocus", event => {
this.setState({
focussed: true
});
var onFocus = this.props.onFocus;
if (typeof onFocus === 'function') {
onFocus(event);
}
});
_defineProperty(this, "onBlur", event => {
this.setState({
focussed: false
});
var invalid = this.state.invalid;
if (invalid) {
this.setState({
changing: false,
invalid: false
});
}
var onBlur = this.props.onBlur;
if (typeof onBlur === 'function') {
onBlur(event);
}
});
this.state = {

@@ -70,6 +42,10 @@ changing: false,

};
var injector = context.injector;
var debounceInput = injector.get('debounceInput');
const {
injector
} = context;
const debounceInput = injector.get('debounceInput');
this.inputChanged = debounceInput(value => {
var onChange = this.props.onChange;
const {
onChange
} = this.props;
if (typeof onChange === 'function') {

@@ -82,3 +58,3 @@ onChange(value);

// input jumping back to the saved, good value.
var currentValue = this.state.changing;
const currentValue = this.state.changing;
this.setState({

@@ -100,10 +76,43 @@ changing: currentValue === value ? false : currentValue

}
onFocus = event => {
this.setState({
focussed: true
});
var {
onFocus
} = this.props;
if (typeof onFocus === 'function') {
onFocus(event);
}
};
onBlur = event => {
this.setState({
focussed: false
});
const {
invalid
} = this.state;
if (invalid) {
this.setState({
changing: false,
invalid: false
});
}
const {
onBlur
} = this.props;
if (typeof onBlur === 'function') {
onBlur(event);
}
};
getClassName() {
var _this$props = this.props,
className = _this$props.className,
value = _this$props.value;
var _this$state = this.state,
changing = _this$state.changing,
focussed = _this$state.focussed,
invalid = _this$state.invalid;
var {
className,
value
} = this.props;
var {
changing,
focussed,
invalid
} = this.state;
className += ' editable';

@@ -122,8 +131,10 @@ if (focussed) {

getDisplayValue() {
var _this$props2 = this.props,
value = _this$props2.value,
placeholder = _this$props2.placeholder;
var _this$state2 = this.state,
focussed = _this$state2.focussed,
changing = _this$state2.changing;
var {
value,
placeholder
} = this.props;
var {
focussed,
changing
} = this.state;
if (typeof changing === 'string') {

@@ -137,4 +148,3 @@ value = changing;

}
getEditor() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
getEditor(props = {}) {
return createComponentVNode(2, ContentEditable, {

@@ -141,0 +151,0 @@ "className": props.className,

import { createVNode } from "inferno";
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Component } from 'inferno';

@@ -9,30 +6,37 @@ export default class Input extends Component {

super(props, context);
_defineProperty(this, "onInput", event => {
var onInput = this.props.onInput;
if (typeof onInput !== 'function') {
return;
}
onInput(event.target.value);
});
_defineProperty(this, "onKeyDown", event => {
var onKeyDown = this.props.onKeyDown;
if (typeof onKeyDown !== 'function') {
return;
}
onKeyDown(event);
});
_defineProperty(this, "onKeyUp", event => {
var onKeyUp = this.props.onKeyUp;
if (typeof onKeyUp !== 'function') {
return;
}
onKeyUp(event);
});
}
onInput = event => {
const {
onInput
} = this.props;
if (typeof onInput !== 'function') {
return;
}
onInput(event.target.value);
};
onKeyDown = event => {
const {
onKeyDown
} = this.props;
if (typeof onKeyDown !== 'function') {
return;
}
onKeyDown(event);
};
onKeyUp = event => {
const {
onKeyUp
} = this.props;
if (typeof onKeyUp !== 'function') {
return;
}
onKeyUp(event);
};
render() {
var _this$props = this.props,
className = _this$props.className,
placeholder = _this$props.placeholder,
type = _this$props.type,
value = _this$props.value;
const {
className,
placeholder,
type,
value
} = this.props;
return createVNode(64, "input", [className || '', 'dms-input'].join(' '), null, 1, {

@@ -39,0 +43,0 @@ "placeholder": placeholder || '',

import { createVNode } from "inferno";
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Component, createPortal } from 'inferno';

@@ -12,75 +9,8 @@ import { inject } from 'table-js/lib/components';

super(props, context);
_defineProperty(this, "onChange", value => {
this.setState({
value
});
var onChange = this.props.onChange;
if (typeof onChange !== 'function') {
return;
}
onChange(value);
});
_defineProperty(this, "onInputClick", event => {
event.preventDefault();
event.stopPropagation();
this.setOptionsVisible(!this.state.optionsVisible);
this.focusInput();
});
_defineProperty(this, "onInput", event => {
var value = event.target.value;
this.onChange(value);
});
_defineProperty(this, "onOptionClick", (value, event) => {
event.preventDefault();
event.stopPropagation();
this.setOptionsVisible(false);
this.onChange(value);
this.focusInput();
});
_defineProperty(this, "onFocusChanged", evt => {
this.checkClose(evt.target);
});
_defineProperty(this, "onGlobalClick", evt => {
this.checkClose(evt.target);
});
_defineProperty(this, "onKeyDown", evt => {
var optionsVisible = this.state.optionsVisible;
var code = evt.which;
// DOWN or UP
if (code === 40 || code === 38) {
evt.stopPropagation();
evt.preventDefault();
if (!optionsVisible) {
this.setOptionsVisible(true);
} else {
this.select(code === 40 ? 1 : -1);
}
}
if (optionsVisible) {
// ENTER
// ESC
if (code === 13 || code === 27) {
evt.stopPropagation();
evt.preventDefault();
this.setOptionsVisible(false);
}
}
});
_defineProperty(this, "onKeyboard", keycode => {
var optionsVisible = this.state.optionsVisible;
if (!optionsVisible) {
return;
}
// close on ESC
if (keycode === 27) {
this.setOptionsVisible(false);
return true;
}
});
inject(this);
var _value = props.value;
const {
value
} = props;
this.state = {
value: _value,
value,
optionsVisible: false

@@ -102,3 +32,5 @@ };

componentWillReceiveProps(props) {
var value = props.value;
const {
value
} = props;
this.setState({

@@ -109,3 +41,5 @@ value

componentWillUpdate(nextProps, nextState) {
var optionsVisible = nextState.optionsVisible;
const {
optionsVisible
} = nextState;
if (optionsVisible) {

@@ -122,28 +56,32 @@ if (!this._portalEl) {

componentDidUpdate() {
var optionsVisible = this.state.optionsVisible;
const {
optionsVisible
} = this.state;
if (!optionsVisible || !this.inputNode) {
return;
}
var optionsBounds = this.getOptionsBounds();
const optionsBounds = this.getOptionsBounds();
assign(this._portalEl.style, optionsBounds);
}
getOptionsBounds() {
var container = this.renderer.getContainer();
var _container$getBoundin = container.getBoundingClientRect(),
containerTop = _container$getBoundin.top,
containerLeft = _container$getBoundin.left,
containerBottom = _container$getBoundin.bottom;
var _this$inputNode$getBo = this.inputNode.getBoundingClientRect(),
inputTop = _this$inputNode$getBo.top,
inputLeft = _this$inputNode$getBo.left,
width = _this$inputNode$getBo.width,
height = _this$inputNode$getBo.height,
inputBottom = _this$inputNode$getBo.bottom;
var top = inputTop + height - containerTop + container.scrollTop;
var left = inputLeft - containerLeft + container.scrollLeft;
var bounds = {
top: "".concat(top, "px"),
left: "".concat(left, "px"),
width: "".concat(width, "px"),
'max-height': "calc(100% - ".concat(top, "px)")
const container = this.renderer.getContainer();
const {
top: containerTop,
left: containerLeft,
bottom: containerBottom
} = container.getBoundingClientRect();
const {
top: inputTop,
left: inputLeft,
width,
height,
bottom: inputBottom
} = this.inputNode.getBoundingClientRect();
const top = inputTop + height - containerTop + container.scrollTop;
const left = inputLeft - containerLeft + container.scrollLeft;
const bounds = {
top: `${top}px`,
left: `${left}px`,
width: `${width}px`,
'max-height': `calc(100% - ${top}px)`
};

@@ -153,5 +91,5 @@

if (containerBottom - inputBottom < height) {
var bottom = containerBottom - inputTop;
bounds.bottom = "".concat(bottom, "px");
bounds['max-height'] = "calc(100% - ".concat(bottom, ")");
const bottom = containerBottom - inputTop;
bounds.bottom = `${bottom}px`;
bounds['max-height'] = `calc(100% - ${bottom})`;
delete bounds.top;

@@ -163,3 +101,3 @@ }

this._portalEl = domify('<div class="dms-select-options"></div>');
var container = this.renderer.getContainer();
const container = this.renderer.getContainer();
container.appendChild(this._portalEl);

@@ -177,2 +115,34 @@

}
onChange = value => {
this.setState({
value
});
const {
onChange
} = this.props;
if (typeof onChange !== 'function') {
return;
}
onChange(value);
};
onInputClick = event => {
event.preventDefault();
event.stopPropagation();
this.setOptionsVisible(!this.state.optionsVisible);
this.focusInput();
};
onInput = event => {
const {
value
} = event.target;
this.onChange(value);
};
onOptionClick = (value, event) => {
event.preventDefault();
event.stopPropagation();
this.setOptionsVisible(false);
this.onChange(value);
this.focusInput();
};
/**

@@ -182,3 +152,3 @@ * Focus input node

focusInput() {
var node = this.inputNode;
const node = this.inputNode;
node.focus();

@@ -196,12 +166,22 @@

}
onFocusChanged = evt => {
this.checkClose(evt.target);
};
onGlobalClick = evt => {
this.checkClose(evt.target);
};
select(direction) {
var options = this.props.options;
var value = this.state.value;
const {
options
} = this.props;
const {
value
} = this.state;
if (!options) {
return;
}
var option = options.filter(o => o.value === value)[0];
var idx = option ? options.indexOf(option) : -1;
var nextIdx = idx === -1 ? direction === 1 ? 0 : options.length - 1 : (idx + direction) % options.length;
var nextOption = options[nextIdx < 0 ? options.length + nextIdx : nextIdx];
const option = options.filter(o => o.value === value)[0];
const idx = option ? options.indexOf(option) : -1;
const nextIdx = idx === -1 ? direction === 1 ? 0 : options.length - 1 : (idx + direction) % options.length;
const nextOption = options[nextIdx < 0 ? options.length + nextIdx : nextIdx];
this.onChange(nextOption.value);

@@ -214,2 +194,42 @@ }

}
onKeyDown = evt => {
const {
optionsVisible
} = this.state;
var code = evt.which;
// DOWN or UP
if (code === 40 || code === 38) {
evt.stopPropagation();
evt.preventDefault();
if (!optionsVisible) {
this.setOptionsVisible(true);
} else {
this.select(code === 40 ? 1 : -1);
}
}
if (optionsVisible) {
// ENTER
// ESC
if (code === 13 || code === 27) {
evt.stopPropagation();
evt.preventDefault();
this.setOptionsVisible(false);
}
}
};
onKeyboard = keycode => {
const {
optionsVisible
} = this.state;
if (!optionsVisible) {
return;
}
// close on ESC
if (keycode === 27) {
this.setOptionsVisible(false);
return true;
}
};
renderOptions(options, activeOption) {

@@ -224,12 +244,14 @@ return createVNode(1, "div", "options", options.map(option => {

render() {
var _this$props = this.props,
className = _this$props.className,
options = _this$props.options,
noInput = _this$props.noInput,
title = _this$props.title;
var _this$state = this.state,
optionsVisible = _this$state.optionsVisible,
value = _this$state.value;
var option = options ? options.filter(o => o.value === value)[0] : false;
var label = option ? option.label : value;
const {
className,
options,
noInput,
title
} = this.props;
const {
optionsVisible,
value
} = this.state;
const option = options ? options.filter(o => o.value === value)[0] : false;
const label = option ? option.label : value;
return createVNode(1, "div", [className || '', 'dms-input-select'].join(' '), [noInput ? createVNode(1, "div", "dms-input", label, 0, {

@@ -236,0 +258,0 @@ "tabindex": "0",

import { createVNode, createTextVNode } from "inferno";
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Component } from 'inferno';
import { groupBy } from 'min-dash';
var RADIO = 'radio';
var REMOVE_BTN_CLS = 'remove dmn-icon-clear';
const RADIO = 'radio';
const REMOVE_BTN_CLS = 'remove dmn-icon-clear';

@@ -25,46 +22,5 @@ /**

super(props, context);
_defineProperty(this, "getRemoveClickHandler", item => {
return e => {
e.stopPropagation();
this.removeItem(item);
};
});
_defineProperty(this, "getToggleClickHandler", item => {
return e => {
e.stopPropagation();
this.toggleItem(item);
};
});
_defineProperty(this, "removeItem", item => {
var onChange = this.props.onChange;
// remove item
var newItems = this.state.items.filter(i => i !== item);
this.setState({
items: newItems
});
onChange && onChange(newItems);
});
_defineProperty(this, "toggleItem", item => {
var _this$props = this.props,
onChange = _this$props.onChange,
type = _this$props.type;
// toggle item
var newItems = this.state.items.map(i => {
if (i === item) {
i.isChecked = !i.isChecked;
} else {
if (type === RADIO) {
i.isChecked = false;
}
}
return i;
});
this.setState({
items: newItems
});
onChange && onChange(newItems);
});
var items = props.items;
const {
items
} = props;
this.state = {

@@ -75,3 +31,5 @@ items

componentWillReceiveProps(props) {
var items = props.items;
const {
items
} = props;
this.setState({

@@ -81,9 +39,56 @@ items

}
getRemoveClickHandler = item => {
return e => {
e.stopPropagation();
this.removeItem(item);
};
};
getToggleClickHandler = item => {
return e => {
e.stopPropagation();
this.toggleItem(item);
};
};
removeItem = item => {
const {
onChange
} = this.props;
// remove item
const newItems = this.state.items.filter(i => i !== item);
this.setState({
items: newItems
});
onChange && onChange(newItems);
};
toggleItem = item => {
const {
onChange,
type
} = this.props;
// toggle item
const newItems = this.state.items.map(i => {
if (i === item) {
i.isChecked = !i.isChecked;
} else {
if (type === RADIO) {
i.isChecked = false;
}
}
return i;
});
this.setState({
items: newItems
});
onChange && onChange(newItems);
};
render() {
var _this$props2 = this.props,
className = _this$props2.className,
items = _this$props2.items,
type = _this$props2.type,
labelComponent = _this$props2.labelComponent;
var classes = ['dms-list-component'];
const {
className,
items,
type,
labelComponent
} = this.props;
const classes = ['dms-list-component'];
if (className) {

@@ -94,6 +99,6 @@ classes.push(className);

// group items by group title
var groupedItems = groupBy(items, 'group');
var asPairs = toPairs(groupedItems);
const groupedItems = groupBy(items, 'group');
const asPairs = toPairs(groupedItems);
return createVNode(1, "div", classes.join(' '), asPairs.map(pair => {
var groupTitle = pair[0],
const groupTitle = pair[0],
groupItems = pair[1];

@@ -117,4 +122,4 @@ return createVNode(1, "div", "group", [labelComponent && labelComponent(groupTitle) || createVNode(1, "h4", "dms-heading", groupTitle, 0), createVNode(1, "ul", "items no-wrap", groupItems.map(item => {

function toPairs(object) {
var entrys = [];
for (var key in object) {
const entrys = [];
for (let key in object) {
entrys.push([key, object[key]]);

@@ -121,0 +126,0 @@ }

import { createVNode } from "inferno";
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Component } from 'inferno';

@@ -39,42 +36,2 @@ import FeelEditor from '@bpmn-io/feel-editor';

/** @type {HTMLElement} */
_defineProperty(this, "handleMouseEvent", event => {
event.stopPropagation();
});
_defineProperty(this, "handleKeyDownCapture", event => {
if (event.key === 'Enter') {
if (isAutocompleteOpen(this.node)) {
event.triggeredFromAutocomplete = true;
return;
}
// supress non cmd+enter newline
if (this.props.ctrlForNewline && !isCmd(event)) {
event.preventDefault();
}
if (this.props.singleLine) {
event.preventDefault();
}
}
});
/**
* @param {KeyboardEvent} event
*/
_defineProperty(this, "handleKeyDown", event => {
// contain the event in the component to not trigger global handlers
if (['Enter', 'Escape'].includes(event.key) && event.triggeredFromAutocomplete) {
event.stopPropagation();
}
});
_defineProperty(this, "handleChange", value => {
var onInput = this.props.onInput;
this.setState({
value
});
if (onInput) {
onInput(value);
}
});
_defineProperty(this, "setNode", node => {
this.node = node;
});
this.node = null;

@@ -103,3 +60,5 @@ this.editor = null;

componentDidUpdate(prevProps) {
var value = this.props.value;
const {
value
} = this.props;
if (prevProps.value !== value && value !== this.state.value) {

@@ -123,2 +82,45 @@ this.setState({

}
handleMouseEvent = event => {
event.stopPropagation();
};
handleKeyDownCapture = event => {
if (event.key === 'Enter') {
if (isAutocompleteOpen(this.node)) {
event.triggeredFromAutocomplete = true;
return;
}
// supress non cmd+enter newline
if (this.props.ctrlForNewline && !isCmd(event)) {
event.preventDefault();
}
if (this.props.singleLine) {
event.preventDefault();
}
}
};
/**
* @param {KeyboardEvent} event
*/
handleKeyDown = event => {
// contain the event in the component to not trigger global handlers
if (['Enter', 'Escape'].includes(event.key) && event.triggeredFromAutocomplete) {
event.stopPropagation();
}
};
handleChange = value => {
const {
onInput
} = this.props;
this.setState({
value
});
if (onInput) {
onInput(value);
}
};
setNode = node => {
this.node = node;
};
render() {

@@ -125,0 +127,0 @@ return createVNode(1, "div", ['literal-expression', this.props.className || ''].join(' '), null, 1, {

@@ -1,11 +0,2 @@

var _excluded = ["type", "context"],
_excluded2 = ["type", "context"];
import { createComponentVNode, normalizeProps } from "inferno";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
/**

@@ -16,10 +7,15 @@ * A simple slot extension, built upon the components service.

*/
var ComponentWithSlots = {
const ComponentWithSlots = {
slotFill(slotProps, DefaultFill) {
var type = slotProps.type,
context = slotProps.context,
props = _objectWithoutProperties(slotProps, _excluded);
var Fill = this.components.getComponent(type, context) || DefaultFill;
const {
type,
context,
...props
} = slotProps;
const Fill = this.components.getComponent(type, context) || DefaultFill;
if (Fill) {
return normalizeProps(createComponentVNode(2, Fill, _objectSpread(_objectSpread({}, context), props)));
return normalizeProps(createComponentVNode(2, Fill, {
...context,
...props
}));
}

@@ -29,7 +25,12 @@ return null;

slotFills(slotProps) {
var type = slotProps.type,
context = slotProps.context,
props = _objectWithoutProperties(slotProps, _excluded2);
var fills = this.components.getComponents(type, context);
return fills.map(Fill => normalizeProps(createComponentVNode(2, Fill, _objectSpread(_objectSpread({}, context), props))));
const {
type,
context,
...props
} = slotProps;
const fills = this.components.getComponents(type, context);
return fills.map(Fill => normalizeProps(createComponentVNode(2, Fill, {
...context,
...props
})));
}

@@ -36,0 +37,0 @@ };

import { createVNode } from "inferno";
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Component } from 'inferno';

@@ -9,20 +6,13 @@ export default class Select extends Component {

super(props, context);
_defineProperty(this, "onChange", event => {
var value = event.target.value;
this.setState({
value
});
var onChange = this.props.onChange;
if (typeof onChange !== 'function') {
return;
}
onChange(value);
});
var _value = props.value;
const {
value
} = props;
this.state = {
value: _value
value
};
}
componentWillReceiveProps(props) {
var value = props.value;
const {
value
} = props;
this.setState({

@@ -32,10 +22,29 @@ value

}
onChange = event => {
const {
value
} = event.target;
this.setState({
value
});
const {
onChange
} = this.props;
if (typeof onChange !== 'function') {
return;
}
onChange(value);
};
render() {
var _this$props = this.props,
className = _this$props.className,
options = _this$props.options;
var value = this.state.value;
return createVNode(256, "select", [className || '', 'dms-select'].join(' '), (options || []).map(_ref => {
var label = _ref.label,
value = _ref.value;
const {
className,
options
} = this.props;
const {
value
} = this.state;
return createVNode(256, "select", [className || '', 'dms-select'].join(' '), (options || []).map(({
label,
value
}) => {
return createVNode(1, "option", "option", label, 0, {

@@ -42,0 +51,0 @@ "value": value

@@ -13,5 +13,7 @@ import { createVNode, createComponentVNode } from "inferno";

super(props, context);
var validate = props.validate,
value = props.value;
var validationWarning = validate ? validate(value || '') : undefined;
const {
validate,
value
} = props;
const validationWarning = validate ? validate(value || '') : undefined;
this.state = {

@@ -26,5 +28,7 @@ validationWarning,

componentWillReceiveProps(props) {
var validate = props.validate,
value = props.value;
var validationWarning = validate ? validate(value || '') : undefined;
const {
validate,
value
} = props;
const validationWarning = validate ? validate(value || '') : undefined;
this.setState({

@@ -36,6 +40,7 @@ validationWarning,

onInput(value) {
var _this$props = this.props,
onInput = _this$props.onInput,
validate = _this$props.validate;
var validationWarning = validate ? validate(value) : undefined;
const {
onInput,
validate
} = this.props;
const validationWarning = validate ? validate(value) : undefined;
this.setState({

@@ -54,8 +59,13 @@ validationWarning,

onKeyDown(event) {
var target = event.target,
value = target.value;
var _this$props2 = this.props,
onKeyDown = _this$props2.onKeyDown,
validate = _this$props2.validate;
var validationWarning = validate ? validate(value) : undefined;
const {
target
} = event,
{
value
} = target;
const {
onKeyDown,
validate
} = this.props;
const validationWarning = validate ? validate(value) : undefined;
if (typeof onKeyDown !== 'function') {

@@ -71,8 +81,13 @@ return;

onKeyUp(event) {
var target = event.target,
value = target.value;
var _this$props3 = this.props,
onKeyUp = _this$props3.onKeyUp,
validate = _this$props3.validate;
var validationWarning = validate ? validate(value) : undefined;
const {
target
} = event,
{
value
} = target;
const {
onKeyUp,
validate
} = this.props;
const validationWarning = validate ? validate(value) : undefined;
if (typeof onKeyUp !== 'function') {

@@ -88,11 +103,13 @@ return;

render() {
var _this$props4 = this.props,
placeholder = _this$props4.placeholder,
type = _this$props4.type,
className = _this$props4.className;
var _this$state = this.state,
validationWarning = _this$state.validationWarning,
value = _this$state.value;
var parentClasses = ['dms-validated-input', className].join(' ');
var inputClasses = [];
const {
placeholder,
type,
className
} = this.props;
const {
validationWarning,
value
} = this.state;
const parentClasses = ['dms-validated-input', className].join(' ');
const inputClasses = [];
if (validationWarning) {

@@ -99,0 +116,0 @@ inputClasses.push('invalid');

@@ -1,2 +0,2 @@

var DEFAULT_DATA_TYPES = ['string', 'boolean', 'number', 'date', 'time', 'dateTime', 'dayTimeDuration', 'yearMonthDuration', 'Any'];
const DEFAULT_DATA_TYPES = ['string', 'boolean', 'number', 'date', 'time', 'dateTime', 'dayTimeDuration', 'yearMonthDuration', 'Any'];

@@ -3,0 +3,0 @@ /**

import { debounce, isNumber } from 'min-dash';
var DEFAULT_DEBOUNCE_TIME = 300;
const DEFAULT_DEBOUNCE_TIME = 300;
export default function debounceInput(shouldDebounce) {

@@ -4,0 +4,0 @@ return function _debounceInput(fn) {

import { assign, find } from 'min-dash';
var EXPRESSION_LANGUAGE_OPTIONS = [{
const EXPRESSION_LANGUAGE_OPTIONS = [{
label: 'FEEL',

@@ -39,3 +39,3 @@ value: 'feel'

this._injector = injector;
var config = injector.get('config.expressionLanguages') || {};
const config = injector.get('config.expressionLanguages') || {};
this._config = {

@@ -52,3 +52,3 @@ options: EXPRESSION_LANGUAGE_OPTIONS,

}
var legacyDefaults = this._getLegacyDefaults();
const legacyDefaults = this._getLegacyDefaults();
assign(this._config.defaults, legacyDefaults, config.defaults);

@@ -65,4 +65,6 @@ }

getDefault(componentName) {
var defaults = this._config.defaults;
var defaultFromConfig = defaults[componentName] || defaults.editor;
const {
defaults
} = this._config;
const defaultFromConfig = defaults[componentName] || defaults.editor;
return this._getLanguageByValue(defaultFromConfig) || this.getAll()[0];

@@ -78,3 +80,3 @@ }

getLabel(expressionLanguageValue) {
var langauge = this._getLanguageByValue(expressionLanguageValue);
const langauge = this._getLanguageByValue(expressionLanguageValue);
return langauge ? langauge.label : expressionLanguageValue;

@@ -92,6 +94,6 @@ }

_getLegacyDefaults() {
var defaults = {},
const defaults = {},
injector = this._injector;
var inputCellValue = injector.get('config.defaultInputExpressionLanguage');
var outputCellValue = injector.get('config.defaultOutputExpressionLanguage');
const inputCellValue = injector.get('config.defaultInputExpressionLanguage');
const outputCellValue = injector.get('config.defaultOutputExpressionLanguage');
if (inputCellValue) {

@@ -98,0 +100,0 @@ defaults.inputCell = inputCellValue;

import { forEach } from 'min-dash';
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
import { is, getBusinessObject } from '../../../util/ModelUtil';
var ID = 'id';
const ID = 'id';
export default class IdChangeBehavior extends CommandInterceptor {

@@ -10,17 +10,20 @@ constructor(eventBus) {

}
updateIds(_ref) {
var context = _ref.context;
var element = context.element,
oldProperties = context.oldProperties,
properties = context.properties;
var bo = getBusinessObject(element);
updateIds({
context
}) {
const {
element,
oldProperties,
properties
} = context;
const bo = getBusinessObject(element);
if (this.shouldSkipUpdate(bo, oldProperties, properties)) {
return;
}
var definitions = getDefinitions(bo);
var drgElements = definitions.get('drgElement');
const definitions = getDefinitions(bo);
const drgElements = definitions.get('drgElement');
drgElements.forEach(drgElement => {
updateElementReferences(drgElement, oldProperties.id, properties.id);
});
var artifacts = definitions.get('artifact');
const artifacts = definitions.get('artifact');
artifacts.forEach(artifact => {

@@ -48,3 +51,3 @@ updateAssociationReferences(artifact, oldProperties.id, properties.id);

function getDefinitions(element) {
var definitions = element;
let definitions = element;
while (!is(definitions, 'dmn:Definitions')) {

@@ -56,16 +59,18 @@ definitions = definitions.$parent;

function updateElementReferences(element, oldId, id) {
var handlers = {
const handlers = {
authorityRequirement: () => {
element.authorityRequirement.forEach(authorityRequirement => {
var requiredAuthority = authorityRequirement.requiredAuthority,
requiredDecision = authorityRequirement.requiredDecision,
requiredInput = authorityRequirement.requiredInput;
if (requiredAuthority && requiredAuthority.href === "#".concat(oldId)) {
requiredAuthority.href = "#".concat(id);
const {
requiredAuthority,
requiredDecision,
requiredInput
} = authorityRequirement;
if (requiredAuthority && requiredAuthority.href === `#${oldId}`) {
requiredAuthority.href = `#${id}`;
}
if (requiredDecision && requiredDecision.href === "#".concat(oldId)) {
requiredDecision.href = "#".concat(id);
if (requiredDecision && requiredDecision.href === `#${oldId}`) {
requiredDecision.href = `#${id}`;
}
if (requiredInput && requiredInput.href === "#".concat(oldId)) {
requiredInput.href = "#".concat(id);
if (requiredInput && requiredInput.href === `#${oldId}`) {
requiredInput.href = `#${id}`;
}

@@ -76,9 +81,11 @@ });

element.informationRequirement.forEach(informationRequirement => {
var requiredDecision = informationRequirement.requiredDecision,
requiredInput = informationRequirement.requiredInput;
if (requiredDecision && requiredDecision.href === "#".concat(oldId)) {
requiredDecision.href = "#".concat(id);
const {
requiredDecision,
requiredInput
} = informationRequirement;
if (requiredDecision && requiredDecision.href === `#${oldId}`) {
requiredDecision.href = `#${id}`;
}
if (requiredInput && requiredInput.href === "#".concat(oldId)) {
requiredInput.href = "#".concat(id);
if (requiredInput && requiredInput.href === `#${oldId}`) {
requiredInput.href = `#${id}`;
}

@@ -89,5 +96,7 @@ });

element.knowledgeRequirement.forEach(knowledgeRequirement => {
var requiredKnowledge = knowledgeRequirement.requiredKnowledge;
if (requiredKnowledge && requiredKnowledge.href === "#".concat(oldId)) {
requiredKnowledge.href = "#".concat(id);
const {
requiredKnowledge
} = knowledgeRequirement;
if (requiredKnowledge && requiredKnowledge.href === `#${oldId}`) {
requiredKnowledge.href = `#${id}`;
}

@@ -104,13 +113,17 @@ });

function updateAssociationReferences(element, oldId, id) {
var handlers = {
const handlers = {
sourceRef: () => {
var sourceRef = element.sourceRef;
if (sourceRef.href === "#".concat(oldId)) {
sourceRef.href = "#".concat(id);
const {
sourceRef
} = element;
if (sourceRef.href === `#${oldId}`) {
sourceRef.href = `#${id}`;
}
},
targetRef: () => {
var targetRef = element.targetRef;
if (targetRef.href === "#".concat(oldId)) {
targetRef.href = "#".concat(id);
const {
targetRef
} = element;
if (targetRef.href === `#${oldId}`) {
targetRef.href = `#${id}`;
}

@@ -117,0 +130,0 @@ }

@@ -1,9 +0,4 @@

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { isObject, isDefined, reduce } from 'min-dash';
import { getBusinessObject } from '../../../util/ModelUtil';
var ID = 'id';
const ID = 'id';

@@ -23,8 +18,11 @@ /**

execute(context) {
var element = context.element,
properties = context.properties;
var bo = getBusinessObject(element);
var _this$updatePropertie = this.updateProperties(bo, properties),
changed = _this$updatePropertie.changed,
oldProperties = _this$updatePropertie.oldProperties;
const {
element,
properties
} = context;
const bo = getBusinessObject(element);
const {
changed,
oldProperties
} = this.updateProperties(bo, properties);
context.oldProperties = oldProperties;

@@ -38,7 +36,10 @@ return [...changed, element];

revert(context) {
var element = context.element,
oldProperties = context.oldProperties;
const {
element,
oldProperties
} = context;
var bo = getBusinessObject(element);
var _this$updatePropertie2 = this.updateProperties(bo, oldProperties),
changed = _this$updatePropertie2.changed;
var {
changed
} = this.updateProperties(bo, oldProperties);
return [...changed, element];

@@ -52,3 +53,3 @@ }

updateProperties(bo, newProps) {
var ids = this._moddle.ids;
const ids = this._moddle.ids;

@@ -62,3 +63,3 @@ // Reduce over all new properties and return

return reduce(newProps, (result, value, key) => {
var propertyValue = bo.get(key);
const propertyValue = bo.get(key);

@@ -68,12 +69,14 @@ // handle nested update

if (!isContainer(propertyValue)) {
throw new Error("non-existing property <".concat(key, ">: cannot update values"));
throw new Error(`non-existing property <${key}>: cannot update values`);
}
var _this$updatePropertie3 = this.updateProperties(propertyValue, value),
changed = _this$updatePropertie3.changed,
oldProperties = _this$updatePropertie3.oldProperties;
let {
changed,
oldProperties
} = this.updateProperties(propertyValue, value);
return {
changed: [...result.changed, ...changed, propertyValue],
oldProperties: _objectSpread(_objectSpread({}, result.oldProperties), {}, {
oldProperties: {
...result.oldProperties,
[key]: oldProperties
})
}
};

@@ -93,5 +96,6 @@ }

changed: result.changed,
oldProperties: _objectSpread(_objectSpread({}, result.oldProperties), {}, {
oldProperties: {
...result.oldProperties,
[key]: propertyValue
})
}
};

@@ -98,0 +102,0 @@ }, {

@@ -1,9 +0,9 @@

var SPACE_REGEX = /\s/;
const SPACE_REGEX = /\s/;
// for QName validation as per http://www.w3.org/TR/REC-xml/#NT-NameChar
var QNAME_REGEX = /^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i;
const QNAME_REGEX = /^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i;
// for ID validation as per BPMN Schema (QName - Namespace)
var ID_REGEX = /^[a-z_][\w-.]*$/i;
var PLACEHOLDER_REGEX = /\$\{([^}]*)\}/g;
const ID_REGEX = /^[a-z_][\w-.]*$/i;
const PLACEHOLDER_REGEX = /\$\{([^}]*)\}/g;

@@ -19,4 +19,4 @@ /**

export function validateId(businessObject, id) {
var assigned = businessObject.$model.ids.assigned(id);
var idExists = assigned && assigned !== businessObject;
const assigned = businessObject.$model.ids.assigned(id);
const idExists = assigned && assigned !== businessObject;
if (!id) {

@@ -23,0 +23,0 @@ return 'Element must have ID.';

{
"name": "dmn-js-shared",
"description": "Shared components used by dmn-js",
"version": "15.1.0",
"version": "16.0.0",
"files": [

@@ -26,7 +26,7 @@ "assets",

"dependencies": {
"@bpmn-io/feel-editor": "^1.1.0",
"diagram-js": "^13.4.0",
"didi": "^10.0.1",
"@bpmn-io/feel-editor": "^1.3.0",
"diagram-js": "^14.3.1",
"didi": "^10.2.2",
"dmn-moddle": "^10.0.0",
"ids": "^1.0.0",
"ids": "^1.0.5",
"inferno": "~5.6.2",

@@ -37,5 +37,5 @@ "min-dash": "^4.0.0",

"selection-update": "^0.1.2",
"table-js": "^9.0.0"
"table-js": "^9.1.0"
},
"gitHead": "39f2a01ea86ab9e0ad306498231ab8937c6d0897"
"gitHead": "529e71c60bb15e56739a9d2d801636a63d45c976"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc