@opens/service-workflow-ui
Service workflow editor
Import the package stylesheet once in the consuming application, then bind the service flow with
v-model. Existing rules are always displayed; allowed-node-types controls which types can be
created by the editor.
import { createPinia } from 'pinia';
import ServiceWorkflowUi, {
AppServiceWorkflowAddForm,
AppServiceWorkflowEditNodeForm,
AppServiceWorkflowEditor,
} from '@opens/service-workflow-ui';
import '@opens/service-workflow-ui/dist/yunique_ui.css';
app.use(createPinia());
app.use(ServiceWorkflowUi);
<app-service-workflow-editor
workflow-id="main-flow"
v-model="flow"
:allowed-node-types="[
{ id: 'widget-base-screen' },
{ id: 'widget-identification-screen' },
{ id: 'widget-service-screen' },
]"
@node="handleNode"
@change="handleChange"
@invalid-change="handleInvalidChange"
></app-service-workflow-editor>
<app-service-workflow-add-form workflow-id="main-flow"></app-service-workflow-add-form>
<app-service-workflow-edit-node-form
workflow-id="main-flow"
@close="handleEditClose"
></app-service-workflow-edit-node-form>
workflow-id connects one editor to external add and edit forms through Pinia. The consumer owns
the Pinia instance; the library never installs or replaces it. Both forms can be positioned
anywhere in the application. Selecting an editable widget-base-screen,
widget-service-screen, or widget-identification-screen node opens the matching form; saving
emits the updated workflow through the editor's v-model and change event. The edit form emits
close whenever an active form closes.
The editor keeps externally supplied workflows editable, including partially configured rules and
connections. It does not validate the complete workflow or switch to a global read-only mode.
Node-type descriptors use id as their primary key and may define a maximum number of outgoing
children. Every rule with remaining capacity displays one rolling purple add placeholder,
regardless of how many slots remain. maxChildren: 0 disables child creation for that type.
const allowedNodeTypes = [
{ id: 'widget-base-screen', maxChildren: 2 },
{ id: 'widget-identification-screen', maxChildren: 1 },
{ id: 'widget-service-screen', maxChildren: 0 },
];
The editor rejects add, connect, or cross-source reconnect operations that exceed a finite limit
through invalid-change. Existing over-capacity payloads remain visible and editable so their
connections can be removed or corrected.
This template should help get you started developing with Vue 3 in Vite.
Recommended IDE Setup
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
Type Support for .vue Imports in TS
TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensions from VSCode's command palette
- Find
TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
- Reload the VSCode window by running
Developer: Reload Window from the command palette.
Customize configuration
See Vite Configuration Reference.
Project Setup
npm install
Compile and Hot-Reload for Development
npm run dev
Type-Check, Compile and Minify for Production
npm run build
Run Unit Tests with Vitest
npm run test:unit
Run End-to-End Tests with Cypress
npm run test:e2e:dev
This runs the end-to-end tests against the Vite development server.
It is much faster than the production build.
But it's still recommended to test the production build with test:e2e before deploying (e.g. in CI environments):
npm run build
npm run test:e2e
Novas versões
Para fechar novas versões deve-se atualizar o parâmetro version no package.json com o valor da nova versão. Após isso, o pipeline já irá fazer o build e atualizar no npm.