|
1 |
| - |
2 | 1 | property_boolean <- function(allow_null = FALSE, default = TRUE) {
|
3 | 2 | class <- S7::class_logical
|
4 | 3 | class <- if (allow_null) S7::new_union(class, NULL) else class
|
@@ -38,65 +37,9 @@ property_choice <- function(options, allow_null = FALSE, default = NULL) {
|
38 | 37 | )
|
39 | 38 | }
|
40 | 39 |
|
41 |
| -element_props <- list( |
42 |
| - fill = S7::new_property( |
43 |
| - S7::new_union(S7::class_character, S7::new_S3_class("GridPattern"), S7::class_logical, NULL), |
44 |
| - default = NULL |
45 |
| - ), |
46 |
| - colour = S7::new_property( |
47 |
| - S7::new_union(S7::class_character, S7::class_logical, NULL), |
48 |
| - default = NULL |
49 |
| - ), |
50 |
| - family = S7::new_property( |
51 |
| - S7::new_union(S7::class_character, NULL), |
52 |
| - default = NULL |
53 |
| - ), |
54 |
| - hjust = S7::new_property( |
55 |
| - S7::new_union(S7::class_numeric, NULL), |
56 |
| - default = NULL |
57 |
| - ), |
58 |
| - vjust = S7::new_property( |
59 |
| - S7::new_union(S7::class_numeric, NULL), |
60 |
| - default = NULL |
61 |
| - ), |
62 |
| - angle = S7::new_property( |
63 |
| - S7::new_union(S7::class_numeric, NULL), |
64 |
| - default = NULL |
65 |
| - ), |
66 |
| - size = S7::new_property( |
67 |
| - S7::new_union(S7::class_numeric, NULL), |
68 |
| - default = NULL |
69 |
| - ), |
70 |
| - lineheight = S7::new_property( |
71 |
| - S7::new_union(S7::class_numeric, NULL), |
72 |
| - default = NULL |
73 |
| - ), |
74 |
| - margin = S7::new_property( |
75 |
| - S7::new_union(S7::new_S3_class("margin"), NULL), |
76 |
| - default = NULL |
77 |
| - ), |
78 |
| - face = property_choice(c("plain", "bold", "italic", "oblique", "bold.italic"), allow_null = TRUE), |
79 |
| - linewidth = S7::new_property( |
80 |
| - S7::new_union(S7::class_numeric, NULL), |
81 |
| - default = NULL |
82 |
| - ), |
83 |
| - linetype = S7::new_property( |
84 |
| - S7::new_union(S7::class_numeric, S7::class_character, NULL), |
85 |
| - default = NULL |
86 |
| - ), |
87 |
| - lineend = property_choice(c("round", "butt", "square"), allow_null = TRUE), |
88 |
| - shape = S7::new_property( |
89 |
| - S7::new_union(S7::class_numeric, S7::class_character, NULL), |
90 |
| - default = NULL |
91 |
| - ), |
92 |
| - arrow = S7::new_property( |
93 |
| - S7::new_union(S7::new_S3_class("arrow"), S7::class_logical, NULL), |
94 |
| - default = NULL |
95 |
| - ), |
96 |
| - arrow.fill = S7::new_property( |
97 |
| - S7::new_union(S7::class_character, S7::class_logical, NULL), |
98 |
| - default = NULL |
99 |
| - ), |
100 |
| - debug = property_boolean(allow_null = TRUE, default = NULL), |
101 |
| - inherit.blank = property_boolean(default = FALSE) |
102 |
| -) |
| 40 | +property_nullable <- function(class = S7::class_any, ...) { |
| 41 | + S7::new_property( |
| 42 | + class = S7::new_union(NULL, class), |
| 43 | + ... |
| 44 | + ) |
| 45 | +} |
0 commit comments