diff --git a/CHANGELOG.md b/CHANGELOG.md index 26823e6..de73e70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`: diff --git a/lib/src/bones_ui.dart b/lib/src/bones_ui.dart index 5d47dab..2e54cc0 100644 --- a/lib/src/bones_ui.dart +++ b/lib/src/bones_ui.dart @@ -1,3 +1,3 @@ class BonesUI { - static const String version = '2.1.19'; + static const String version = '2.1.20'; } diff --git a/lib/src/component/input_config.dart b/lib/src/component/input_config.dart index e01ef7e..765faec 100644 --- a/lib/src/component/input_config.dart +++ b/lib/src/component/input_config.dart @@ -53,6 +53,8 @@ class InputConfig { List classes; + String? labelStyle; + String? style; static InputConfig? from(dynamic config, [String? id]) { @@ -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); @@ -94,6 +97,7 @@ class InputConfig { options: options, optional: optional, classes: classes, + labelStyle: labelStyle, style: style); } @@ -111,6 +115,7 @@ class InputConfig { Map? options, bool? optional = false, Object? classes, + String? labelStyle, String? style, FieldInputRender? inputRender, FieldValueProvider? valueProvider, @@ -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; @@ -459,6 +469,9 @@ class UIInputTable extends UIComponent { final List _extraRows; + final List _tableClasses; + final String? _tableStyle; + final List _inputsClasses; final String? inputErrorClass; @@ -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); @@ -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) { @@ -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( diff --git a/pubspec.yaml b/pubspec.yaml index 87249ca..8d5cec2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: @@ -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