forked from apache/incubator-kie-tools
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge main-apache and exclude white-listed changes from the merge
- Loading branch information
Showing
477 changed files
with
14,504 additions
and
3,591 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
## DMN Editor Standalone Examples | ||
|
||
A series of examples on how to use the DMN Editor Standalone in different applications. | ||
|
||
### Examples | ||
|
||
- [State Control]("src/stateControl/index.ts"): Shows how to leverage the Editor API to undo/redo changes to a decision, get its contents and download an SVG of the diagram. | ||
- [Read Only]("src/readOnly/index.ts"): Loads the editor in "Read Only" mode, where a decision can be displayed and navigated but not changed. | ||
- [With Included Models]("src/withIncludedModels/index.ts"): Displays how Decisions can be imported into other Decisions as "Included Models", using the `resources` parameter from the DMN Editor. | ||
|
||
### Build | ||
|
||
To build the examples, execute one of the following commands on the root folder of the project: | ||
|
||
```shell script | ||
KIE_TOOLS_BUILD__buildExamples=true pnpm -F @kie-tools-examples/dmn-editor-standalone-examples... build:dev | ||
KIE_TOOLS_BUILD__buildExamples=true pnpm -F @kie-tools-examples/dmn-editor-standalone-examples... build:prod | ||
``` | ||
|
||
### Run | ||
|
||
To start the examples application, execute the following command on the root folder of the project: | ||
|
||
```shell script | ||
pnpm -F @kie-tools-examples/dmn-editor-standalone-examples start | ||
``` | ||
|
||
Open http://localhost:9102 to see the list of files bundled by webpack, then choose an example: | ||
|
||
- State Control: http://localhost:9102/state_control.html | ||
- Read Only: http://localhost:9102/read_only.html | ||
- With Included Models: http://localhost:9102/with_included_models.html | ||
|
||
--- | ||
|
||
Apache KIE (incubating) is an effort undergoing incubation at The Apache Software | ||
Foundation (ASF), sponsored by the name of Apache Incubator. Incubation is | ||
required of all newly accepted projects until a further review indicates that | ||
the infrastructure, communications, and decision making process have stabilized | ||
in a manner consistent with other successful ASF projects. While incubation | ||
status is not necessarily a reflection of the completeness or stability of the | ||
code, it does indicate that the project has yet to be fully endorsed by the ASF. | ||
|
||
Some of the incubating project’s releases may not be fully compliant with ASF | ||
policy. For example, releases may have incomplete or un-reviewed licensing | ||
conditions. What follows is a list of known issues the project is currently | ||
aware of (note that this list, by definition, is likely to be incomplete): | ||
|
||
- Hibernate, an LGPL project, is being used. Hibernate is in the process of | ||
relicensing to ASL v2 | ||
- Some files, particularly test files, and those not supporting comments, may | ||
be missing the ASF Licensing Header | ||
|
||
If you are planning to incorporate this work into your product/project, please | ||
be aware that you will need to conduct a thorough licensing review to determine | ||
the overall implications of including this work. For the current status of this | ||
project through the Apache Incubator visit: | ||
https://incubator.apache.org/projects/kie.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
const { varsWithName, composeEnv } = require("@kie-tools-scripts/build-env"); | ||
|
||
module.exports = composeEnv([require("@kie-tools/root-env/env")], { | ||
vars: varsWithName({}), | ||
get env() { | ||
return { | ||
dmnEditorStandaloneExamples: { | ||
port: 9102, | ||
}, | ||
}; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"private": true, | ||
"name": "@kie-tools-examples/dmn-editor-standalone-examples", | ||
"version": "0.0.0", | ||
"description": "", | ||
"license": "Apache-2.0", | ||
"homepage": "https://github.com/apache/incubator-kie-tools", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/apache/incubator-kie-tools.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/apache/incubator-kie-tools/issues" | ||
}, | ||
"scripts": { | ||
"build:dev": "rimraf dist && webpack --env dev", | ||
"build:prod": "rimraf dist && webpack --env prod", | ||
"start": "webpack serve --host 0.0.0.0 --env dev" | ||
}, | ||
"dependencies": { | ||
"@kie-tools/dmn-editor-standalone": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@kie-tools-core/webpack-base": "workspace:*", | ||
"@kie-tools/root-env": "workspace:*", | ||
"@kie-tools/tsconfig": "workspace:*", | ||
"copy-webpack-plugin": "^11.0.0", | ||
"html-webpack-plugin": "^5.3.2", | ||
"process": "^0.11.10", | ||
"raw-loader": "^4.0.2", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^5.5.3", | ||
"webpack": "^5.92.1", | ||
"webpack-bundle-analyzer": "^4.10.2", | ||
"webpack-cli": "^4.10.0", | ||
"webpack-dev-server": "^4.15.1", | ||
"webpack-merge": "^5.9.0" | ||
}, | ||
"kieTools": { | ||
"requiredPreinstalledCliCommands": [ | ||
"java", | ||
"mvn" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { DmnEditorStandaloneApi } from "@kie-tools/dmn-editor-standalone/dist"; | ||
|
||
export function loadFile(fileName: string) { | ||
return fetch(`/static/models/${fileName}`).then((value) => value.text()); | ||
} | ||
|
||
export function initFileLoader(files: Array<string>, editor: DmnEditorStandaloneApi) { | ||
files.map((fileName) => { | ||
document.getElementById(fileName)?.addEventListener("click", () => { | ||
loadFile(fileName).then((fileContent) => editor.setContent(fileName, fileContent)); | ||
}); | ||
}); | ||
} |
45 changes: 45 additions & 0 deletions
45
examples/dmn-editor-standalone-examples/src/readOnly/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one | ||
~ or more contributor license agreements. See the NOTICE file | ||
~ distributed with this work for additional information | ||
~ regarding copyright ownership. The ASF licenses this file | ||
~ to you under the Apache License, Version 2.0 (the | ||
~ "License"); you may not use this file except in compliance | ||
~ with the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, | ||
~ software distributed under the License is distributed on an | ||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
~ KIND, either express or implied. See the License for the | ||
~ specific language governing permissions and limitations | ||
~ under the License. | ||
--> | ||
|
||
<!-- This file is used for test purposes only --> | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<style> | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
#dmn-editor-container { | ||
height: calc(100vh - 6px); | ||
} | ||
</style> | ||
|
||
<title></title> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
</head> | ||
|
||
<body> | ||
<div id="dmn-editor-container" /> | ||
</body> | ||
</html> |
43 changes: 43 additions & 0 deletions
43
examples/dmn-editor-standalone-examples/src/readOnly/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import * as DmnEditor from "@kie-tools/dmn-editor-standalone/dist"; | ||
import { loadFile } from "../fileLoader"; | ||
|
||
document.addEventListener("DOMContentLoaded", function () { | ||
loadEditor(); | ||
}); | ||
|
||
function loadEditor() { | ||
// Loads the DMN Editor in the `<div id="dmn-editor-container" />` element. | ||
// Initializes with an existing file called `loan-pre-qualification.dmn` on the root of the | ||
// workspace. | ||
// The `loadFile` function loads the file from the /static/models directory and returns | ||
// a Promise that resolves into a string. | ||
// The `readOnly` flag changes the editor, locking all changes to the model, making it | ||
// useful for displaying diagrams without editing the Decision. | ||
const editor = DmnEditor.open({ | ||
container: document.getElementById("dmn-editor-container")!, | ||
initialFileNormalizedPosixPathRelativeToTheWorkspaceRoot: "loan-pre-qualification.dmn", | ||
initialContent: loadFile("loan-pre-qualification.dmn"), | ||
readOnly: true, | ||
}); | ||
|
||
console.log({ editor }); | ||
} |
86 changes: 86 additions & 0 deletions
86
examples/dmn-editor-standalone-examples/src/stateControl/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one | ||
~ or more contributor license agreements. See the NOTICE file | ||
~ distributed with this work for additional information | ||
~ regarding copyright ownership. The ASF licenses this file | ||
~ to you under the Apache License, Version 2.0 (the | ||
~ "License"); you may not use this file except in compliance | ||
~ with the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, | ||
~ software distributed under the License is distributed on an | ||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
~ KIND, either express or implied. See the License for the | ||
~ specific language governing permissions and limitations | ||
~ under the License. | ||
--> | ||
|
||
<!-- This file is used for test purposes only --> | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<style> | ||
* { | ||
margin: 0; | ||
} | ||
|
||
#dmn-editor-container { | ||
height: calc(100vh - 36px); | ||
} | ||
|
||
.toolbar { | ||
height: 30px; | ||
display: flex; | ||
font-size: 16px; | ||
border-bottom: 1px solid #d2d2d2; | ||
box-sizing: border-box; | ||
align-items: center; | ||
} | ||
|
||
.toolbar button { | ||
font-size: 16px; | ||
} | ||
|
||
.toolbar .toolbar-items { | ||
flex: 1 1; | ||
} | ||
|
||
.toolbar .load-files { | ||
text-align: right; | ||
} | ||
|
||
.hidden { | ||
display: none; | ||
} | ||
</style> | ||
|
||
<title></title> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
</head> | ||
|
||
<body> | ||
<div class="toolbar"> | ||
<div class="toolbar-items actions"> | ||
<button id="undo">Undo</button> | ||
<button id="redo">Redo</button> | ||
<button id="download">Download</button> | ||
<button id="downloadSvg">Download SVG</button> | ||
<span id="unsavedChanges" class="hidden">File contains unsaved changes.</span> | ||
</div> | ||
<br /> | ||
<div class="toolbar-items load-files"> | ||
Load DMN: | ||
<button id="empty.dmn">Empty</button> | ||
<button id="empty-drd.dmn">Empty DRD</button> | ||
<button id="find-employees.dmn">Find Employees</button> | ||
<button id="loan-pre-qualification.dmn">Loan Pre Qualification</button> | ||
</div> | ||
</div> | ||
<div id="dmn-editor-container" /> | ||
</body> | ||
</html> |
Oops, something went wrong.