Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to style BPMN Elements #247

Merged
merged 10 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Generated by roxygen2: do not edit by hand

export(bpmnVisualizationROutput)
export(create_edge_style)
export(create_gradient_fill)
export(create_overlay)
export(create_overlay_style)
export(create_shape_style)
export(display)
export(overlay_edge_position)
export(overlay_shape_position)
Expand Down
51 changes: 49 additions & 2 deletions R/bpmnVisualizationR.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#' Use the [`create_overlay`] function to create an overlay object with content and a relative position.
#' @param enableDefaultOverlayStyle If no style is set on an overlay, and this parameter is set to `TRUE`, the default style will be applied to the overlay.
#' By default, `enableDefaultOverlayStyle` is set to `TRUE`.
#' @param bpmnElementStyles a list of existing elements with their style to apply.
#' Use the [`create_shape_style`] or [`create_edge_style`] functions to create the style of 'BPMN' elements.
#' @param width A fixed width for the widget (in CSS units).
#' The default value is `NULL`, which results in intelligent automatic sizing based on the widget's container.
#' @param height A fixed height for the widget (in CSS units).
Expand Down Expand Up @@ -98,7 +100,50 @@
#' height='auto'
#' )
#'
#' @seealso [`create_overlay`] to create an overlay
#' # Example 5: Display the BPMN diagram featuring styling for BPMN elements
#' bpmnElementStyles <- list(
#' bpmnVisualizationR::create_shape_style(
#' elementIds = list("call_activity_1_1"),
#' stroke_color = 'RoyalBlue',
#' font_color = 'DarkOrange',
#' font_family = 'Arial',
#' font_size = 12,
#' font_bold = TRUE,
#' font_italic = TRUE,
#' font_strike_through = TRUE,
#' font_underline = TRUE,
#' opacity = 75,
#' fill_color = 'Yellow',
#' fill_opacity = 50
#' ),
#' bpmnVisualizationR::create_edge_style(
#' elementIds = list("sequence_flow_1_4"),
#' stroke_color = 'DeepPink',
#' stroke_width = 3,
#' stroke_opacity = 70,
#' font_color = 'ForestGreen',
#' font_family = 'Courier New',
#' font_size = 14,
#' font_bold = TRUE,
#' font_italic = TRUE,
#' font_strike_through = FALSE,
#' font_underline = FALSE,
#' font_opacity = 80,
#' opacity = 80
#' )
#' )
#'
#' bpmnVisualizationR::display(
#' bpmn_file,
#' bpmnElementStyles = bpmnElementStyles,
#' width='auto',
#' height='auto'
#' )
#'
#' @seealso
#' * [`create_overlay`] to create an overlay
#' * [`create_shape_style`] to create the structure style for the shape
#' * [`create_edge_style`] to create the structure style for the edge
#'
#' @import htmlwidgets
#' @import xml2
Expand All @@ -108,14 +153,16 @@ display <- function(
bpmnXML,
overlays = NULL,
enableDefaultOverlayStyle = TRUE,
bpmnElementStyles = NULL,
width = NULL,
height = NULL,
elementId = NULL
) {
x <- build_bpmnContent(
bpmnXML,
overlays = overlays,
enableDefaultOverlayStyle = enableDefaultOverlayStyle
enableDefaultOverlayStyle = enableDefaultOverlayStyle,
bpmnElementStyles = bpmnElementStyles
)
# create widget
htmlwidgets::createWidget(
Expand Down
Loading