Skip to content

Commit

Permalink
Create bpmn-io typings
Browse files Browse the repository at this point in the history
  • Loading branch information
Edoardo Luppi committed May 30, 2019
0 parents commit 704e2ff
Show file tree
Hide file tree
Showing 8 changed files with 1,191 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea
*.iml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/
cmake-build-release/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
target
package-lock.json
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 90,
"singleQuote": true,
"tabWidth": 2,
"endOfLine": "lf"
}
167 changes: 167 additions & 0 deletions src/@types/bpmn-js-properties-panel/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
declare module 'bpmn-js-properties-panel/lib/PropertiesActivator' {
import { Base, ModdleElement } from 'bpmn-js';
import EventBus from 'diagram-js/lib/core/EventBus';

export default class PropertiesActivator {
constructor(eventBus: EventBus, priority?: number);

isEntryVisible(entry: any, element: ModdleElement): boolean;

isPropertyEditable(entry: any, propertyName: string, element: ModdleElement): boolean;

getTabs(element: Base | ModdleElement): Tab[];
}

export interface Tab {
id: string;
label: string;
groups: Group[];
enabled?: (element: Base | ModdleElement) => boolean;
}

export interface Group {
id: string;
label: string;
entries: Entry[];
enabled?: (element: Base | ModdleElement) => boolean;
}

export interface Entry {
id: string;
description: string;
validate: (...args: any[]) => { id: string };
html: string;

get?(element: ModdleElement): any;

set?(element: ModdleElement, values?: { [k: string]: any }): any;
}
}

declare module 'bpmn-js-properties-panel/lib/factory/EntryFactory' {
import { Base, ModdleElement } from 'bpmn-js';
import { Entry } from 'bpmn-js-properties-panel/lib/PropertiesActivator';

export default class EntryFactory {
static textField(options: TextOptions): Entry;

static validationAwareTextField(options: ValidationTextOptions): Entry;

static checkbox(options: CheckBoxOptions): Entry;

static textBox(options: TextBoxOptions): Entry;

static selectBox(options: SelectBoxOptions): Entry;

static comboBox(options: ComboBoxOptions): Entry;

static table(options: TableOptions): Entry;

static label(options: LabelOptions): Entry;

static link(options: LinkOptions): Entry;
}

type Element = Base | ModdleElement;

export interface Command {
cmd: string;
context: {
element: Element;
businessObject?: ModdleElement;
currentObject?: ModdleElement;
objectsToAdd?: any;
objectsToRemove?: any;
ny;
updatedObjectList?: any[];
propertyName?: string;
referencePropertyName?: string;
properties?: { [k: string]: any };
};
}

export interface Options {
id: string;
description?: string;
label?: string;
get?: (element: Element, node) => { formKey: any };
set?: (element: Element, values, node /* opt */) => Command;
validate?: (element: Element, values: { [k: string]: any }) => any;
modelProperty?: string;
}

export interface ValidationTextOptions {
getProperty: (element: Element) => string;
setProperty: (element: Element, properties?: { [k: string]: any }) => Command;
}

export interface TextOptions extends Options {
buttonAction?: {
name: string;
method: () => any;
};
buttonShow?: {
name: string;
method: () => any;
};
disabled?: (element: Element) => boolean;
hidden?: (element: Element, node /* opt */) => { formKey: any };
}

export interface CheckBoxOptions extends Options {
disabled?: (element: Element) => boolean;
hidden?: (element: Element, node /* opt */) => { formKey: any };
}

export interface TextBoxOptions extends Options {
show?: (element: Element, node) => boolean;
}

export interface SelectBoxOptions extends Options {
selectOptions: {
name: string;
value: string;
}[];
emptyParameter?: boolean;
disabled?: (element: Element) => boolean;
hidden?: (element: Element, node /* opt */) => { formKey: any };
}

export interface ComboBoxOptions extends Options {
selectOptions: {
name: string;
value: string;
}[];
emptyParameter?: boolean;
customValue?: string;
customName?: string;
disabled?: (element: Element) => boolean;
}

export interface TableOptions extends Options {
modelProperties: string[];
labels: string[];
addLabel: string;
getElements: (element: Element, node) => ModdleElement[];
addElement: (element: Element, node) => Command | Command[];
updateElement: (
element: Element,
value: any | null,
node,
idx: number
) => Command | Command[];
removeElement: (element: Element, node, idx: number) => Command | Command[];
show?: (element: Element, node) => boolean;
}

export interface LabelOptions extends Options {
labelText?: string;
divider?: boolean;
showLabel?: (element: Element, node) => boolean;
}

export interface LinkOptions extends Options {
handleClick: (element: Element, node, event) => boolean;
showLink?: (element: Element, node) => boolean;
}
}
Loading

0 comments on commit 704e2ff

Please sign in to comment.