更新 openhis-ui
This commit is contained in:
1
openhis-ui-vue2-bk/bpmnlint-plugin-local/.gitignore
vendored
Normal file
1
openhis-ui-vue2-bk/bpmnlint-plugin-local/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
39
openhis-ui-vue2-bk/bpmnlint-plugin-local/README.md
Normal file
39
openhis-ui-vue2-bk/bpmnlint-plugin-local/README.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# bpmnlint-plugin-local
|
||||
|
||||
A bpmlint plug-in based on the [bpmnlint plug-in example](https://github.com/bpmn-io/bpmnlint-plugin-example).
|
||||
|
||||
|
||||
## About
|
||||
|
||||
This plugin contributes [rules](#add-rules) and [configuration](#add-configuration) under the `local` prefix to bpmnlint.
|
||||
|
||||
|
||||
## Add Rules
|
||||
|
||||
The [`./rules`](./rules) folder contains rules that are made available via
|
||||
this plug-in. Configure them with the `local` prefix in your `.bpmnlintrc`:
|
||||
|
||||
```json
|
||||
{
|
||||
"rules": {
|
||||
"local/no-manual-task": "warn"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Checkout [`./test.js`](./test.js) to learn how to test your rules.
|
||||
|
||||
|
||||
## Add Configuration
|
||||
|
||||
As part of the [`./index.js`](./index.js) the plug-in exposes configurations
|
||||
to extend from using `extends` in the bpmnlint configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": [
|
||||
"bpmnlint:recommended",
|
||||
"plugin:local/recommended"
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="5.0.4">
|
||||
<process id="Process_1" isExecutable="false">
|
||||
<userTask id="Task_14wqr7n" />
|
||||
</process>
|
||||
<bpmndi:BPMNDiagram id="BpmnDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Process_1">
|
||||
<bpmndi:BPMNShape id="UserTask_0xvet6g_di" bpmnElement="Task_14wqr7n">
|
||||
<omgdc:Bounds x="160" y="80" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</definitions>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="5.0.4">
|
||||
<process id="Process_1" isExecutable="false">
|
||||
<manualTask id="Task_14wqr7n" />
|
||||
</process>
|
||||
<bpmndi:BPMNDiagram id="BpmnDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Process_1">
|
||||
<bpmndi:BPMNShape id="ManualTask_0jr4uio_di" bpmnElement="Task_14wqr7n">
|
||||
<omgdc:Bounds x="160" y="80" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</definitions>
|
||||
@@ -0,0 +1,16 @@
|
||||
# No Manual Task (no-manual-task)
|
||||
|
||||
Checks that the diagram does not contain manual tasks that have no execution semantics.
|
||||
|
||||
Example of __incorrect__ usage of this rule:
|
||||
|
||||

|
||||
|
||||
Cf. [`no-manual-task-incorrect.bpmn`](./examples/no-manual-task-incorrect.bpmn).
|
||||
|
||||
|
||||
Example of __correct__ usage of this rule:
|
||||
|
||||

|
||||
|
||||
Cf. [`no-manual-task-correct.bpmn`](./examples/no-manual-task-correct.bpmn).
|
||||
15
openhis-ui-vue2-bk/bpmnlint-plugin-local/index.js
Normal file
15
openhis-ui-vue2-bk/bpmnlint-plugin-local/index.js
Normal file
@@ -0,0 +1,15 @@
|
||||
module.exports = {
|
||||
configs: {
|
||||
recommended: {
|
||||
rules: {
|
||||
'target-namespace': 'error'
|
||||
}
|
||||
},
|
||||
all: {
|
||||
rules: {
|
||||
'target-namespace': 'warn',
|
||||
'no-manual-task': 'warn'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
openhis-ui-vue2-bk/bpmnlint-plugin-local/package.json
Normal file
26
openhis-ui-vue2-bk/bpmnlint-plugin-local/package.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "bpmnlint-plugin-local",
|
||||
"version": "0.0.0",
|
||||
"description": "The bpmnlint local plug-in",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"all": "npm test",
|
||||
"test": "mocha test.js"
|
||||
},
|
||||
"keywords": [
|
||||
"bpmnlint",
|
||||
"plugin"
|
||||
],
|
||||
"devDependencies": {
|
||||
"bpmnlint": "^7.2.1",
|
||||
"chai": "^4.2.0",
|
||||
"mocha": "^9.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"bpmnlint-utils": "^1.0.2"
|
||||
},
|
||||
"files": [
|
||||
"rules",
|
||||
"index.js"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
const {
|
||||
is
|
||||
} = require('bpmnlint-utils');
|
||||
|
||||
|
||||
/**
|
||||
* Rule that reports manual tasks being used.
|
||||
*/
|
||||
module.exports = function() {
|
||||
|
||||
function check(node, reporter) {
|
||||
if (is(node, 'bpmn:ManualTask')) {
|
||||
reporter.report(node.id, 'Element has disallowed type bpmn:ManualTask');
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
check: check
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
const {
|
||||
is
|
||||
} = require('bpmnlint-utils');
|
||||
|
||||
|
||||
/**
|
||||
* Rule that reports missing targetNamespace on bpmn:Definitions.
|
||||
*/
|
||||
module.exports = function() {
|
||||
|
||||
function check(node, reporter) {
|
||||
if (is(node, 'bpmn:Definitions') && !node.targetNamespace) {
|
||||
reporter.report(node.id, 'Element is missing targetNamespace');
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
check: check
|
||||
};
|
||||
};
|
||||
55
openhis-ui-vue2-bk/bpmnlint-plugin-local/test.js
Normal file
55
openhis-ui-vue2-bk/bpmnlint-plugin-local/test.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const { expect } = require('chai');
|
||||
|
||||
const { createModdle } = require('bpmnlint/lib/testers/helper');
|
||||
|
||||
const RuleTester = require('bpmnlint/lib/testers/rule-tester');
|
||||
|
||||
const manualTaskRule = require('./rules/no-manual-task');
|
||||
const targetNamespaceRule = require('./rules/target-namespace');
|
||||
|
||||
|
||||
RuleTester.verify('no-manual-task', manualTaskRule, {
|
||||
valid: [
|
||||
{
|
||||
moddleElement: createModdle(
|
||||
'<startEvent xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="startEvent" />',
|
||||
'bpmn:StartEvent'
|
||||
)
|
||||
}
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
moddleElement: createModdle(
|
||||
'<manualTask xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="manualTask" />',
|
||||
'bpmn:ManualTask'
|
||||
),
|
||||
report: {
|
||||
id: 'manualTask',
|
||||
message: 'Element has disallowed type bpmn:ManualTask'
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
RuleTester.verify('target-namespace', targetNamespaceRule, {
|
||||
valid: [
|
||||
{
|
||||
moddleElement: createModdle(
|
||||
'<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="definitions" targetNamespace="http://foo" />',
|
||||
)
|
||||
}
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
moddleElement: createModdle(
|
||||
'<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="definitions" />',
|
||||
),
|
||||
report: {
|
||||
id: 'definitions',
|
||||
message: 'Element is missing targetNamespace'
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user