Skip to content

Commit

Permalink
v2.1.20
Browse files Browse the repository at this point in the history
- `InputConfig`:
  - Added field `labelStyle`.
- `UIInputTable`:
  - Added field `tableClasses`, `tableStyle`.
- dom_builder: ^2.1.6
  • Loading branch information
gmpassos committed Apr 2, 2023
1 parent 59fdb10 commit 80e9bc8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.1.20

- `InputConfig`:
- Added field `labelStyle`.
- `UIInputTable`:
- Added field `tableClasses`, `tableStyle`.
- dom_builder: ^2.1.6

## 2.1.19

- `UIDialog`:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bones_ui.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class BonesUI {
static const String version = '2.1.19';
static const String version = '2.1.20';
}
33 changes: 33 additions & 0 deletions lib/src/component/input_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class InputConfig {

List<String> classes;

String? labelStyle;

String? style;

static InputConfig? from(dynamic config, [String? id]) {
Expand All @@ -74,6 +76,7 @@ class InputConfig {
var checked = parseBool(findKeyValue(config, ['checked'], true));
var attributes = findKeyValue(config, ['attributes'], true);
var classes = findKeyValue(config, ['class', 'classes'], true);
var labelStyle = findKeyValue(config, ['labelStyle'], true);
var style = findKeyValue(config, ['style'], true);
var options = findKeyValue(config, ['options'], true);
var optional = parseBool(findKeyValue(config, ['optional'], true), false);
Expand All @@ -94,6 +97,7 @@ class InputConfig {
options: options,
optional: optional,
classes: classes,
labelStyle: labelStyle,
style: style);
}

Expand All @@ -111,6 +115,7 @@ class InputConfig {
Map<String, String>? options,
bool? optional = false,
Object? classes,
String? labelStyle,
String? style,
FieldInputRender? inputRender,
FieldValueProvider? valueProvider,
Expand Down Expand Up @@ -146,6 +151,11 @@ class InputConfig {

_label = label;

if (labelStyle != null) {
labelStyle = labelStyle.trim();
this.labelStyle = labelStyle.isNotEmpty ? labelStyle : null;
}

if (style != null) {
style = style.trim();
this.style = style.isNotEmpty ? style : null;
Expand Down Expand Up @@ -459,6 +469,9 @@ class UIInputTable extends UIComponent {

final List _extraRows;

final List<String> _tableClasses;
final String? _tableStyle;

final List<String> _inputsClasses;

final String? inputErrorClass;
Expand All @@ -475,10 +488,14 @@ class UIInputTable extends UIComponent {
this.showInvalidMessages = true,
dynamic classes,
dynamic style,
dynamic tableClasses,
String? tableStyle,
dynamic inputsClasses})
: _onChangeTriggerDelay =
onChangeTriggerDelay ?? defaultOnChangeTriggerDelay,
_extraRows = extraRows ?? [],
_tableClasses = UIComponent.parseClasses(tableClasses),
_tableStyle = tableStyle?.trim(),
_inputsClasses = UIComponent.parseClasses(inputsClasses),
super(parent,
componentClass: 'ui-infos-table', classes: classes, style: style);
Expand Down Expand Up @@ -613,6 +630,15 @@ class UIInputTable extends UIComponent {
form.autocomplete = 'off';

var table = TableElement();

if (_tableClasses.isNotEmpty) {
table.classes.addAll(_tableClasses);
}

if (_tableStyle?.isNotEmpty ?? false) {
table.style.cssText = _tableStyle!;
}

var tBody = table.createTBody();

for (var input in _inputs) {
Expand All @@ -625,6 +651,13 @@ class UIInputTable extends UIComponent {
..style.verticalAlign = 'top'
..style.textAlign = 'right';

var labelStyle = input.labelStyle;
if (labelStyle != null) {
var cssText = cell.style.cssText;
cell.style.cssText =
isNotEmptyObject(cssText) ? '$cssText ; $labelStyle' : labelStyle;
}

if (label.isNotEmpty) {
if (containsIntlMessage(label)) {
var domLabel = $label(
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: bones_ui
description: Bones_UI - Simple and easy Web User Interface Framework for Dart
version: 2.1.19
version: 2.1.20
homepage: https://github.com/Colossus-Services/bones_ui

environment:
Expand All @@ -17,7 +17,7 @@ dependencies:
mercury_client: ^2.1.8
intl_messages: ^2.0.6
dom_tools: ^2.1.13
dom_builder: ^2.1.5
dom_builder: ^2.1.6
json_render: ^2.0.5
json_object_mapper: ^2.0.1
html_unescape: ^2.0.0
Expand Down

0 comments on commit 80e9bc8

Please sign in to comment.