Skip to content

Commit

Permalink
Merge pull request #906 from EnsembleUI/feat/calendar
Browse files Browse the repository at this point in the history
Enhance calendar
  • Loading branch information
snehmehta authored Oct 26, 2023
2 parents f56c33b + 36ea117 commit c510e91
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 47 deletions.
13 changes: 11 additions & 2 deletions assets/schema/ensemble_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5268,6 +5268,9 @@
"type": "boolean",
"description": "Set visibility of calendar header. Default true."
},
"header": {
"$ref": "#/$defs/Widget"
},
"rowSpans": {
"type": "array",
"items": {
Expand All @@ -5288,10 +5291,16 @@
"$ref": "#/$defs/Widget"
}
},
"required": ["start", "end", "widget"]
"required": [
"start",
"end",
"widget"
]
}
},
"required": ["span"]
"required": [
"span"
]
}
},
"headerTextStyle": {
Expand Down
6 changes: 4 additions & 2 deletions lib/action/invoke_api_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,15 @@ class InvokeAPIController {
EnsembleAction.fromYaml(apiDefinition['onError']);
if (onErrorAction != null) {
ScreenController().nowExecuteAction(
context, localizedContext, onErrorAction, apiMap, scopeManager, event: apiEvent);
context, localizedContext, onErrorAction, apiMap, scopeManager,
event: apiEvent);
}

// if our Action has onError, invoke that next
if (action.onError != null) {
ScreenController().nowExecuteAction(
context, localizedContext, action.onError!, apiMap, scopeManager, event: apiEvent);
context, localizedContext, action.onError!, apiMap, scopeManager,
event: apiEvent);
}

// silently fail if error handle is not defined? or should we alert user?
Expand Down
2 changes: 1 addition & 1 deletion lib/framework/data_context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ class Formatter with Invokable {
'prettyCurrency': (input) => InvokablePrimitive.prettyCurrency(input),
'prettyDuration': (input) =>
InvokablePrimitive.prettyDuration(input, locale: locale),
'pluralize': pluralize
'pluralize': pluralize,
};
}

Expand Down
8 changes: 3 additions & 5 deletions lib/framework/ensemble_widget.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import 'package:ensemble_ts_interpreter/invokables/invokable.dart';
import 'package:flutter/cupertino.dart';

abstract class EnsembleWidget<C extends EnsembleController> extends StatefulWidget {
abstract class EnsembleWidget<C extends EnsembleController>
extends StatefulWidget {
const EnsembleWidget(this.controller, {super.key});
final C controller;
}

abstract class EnsembleWidgetState<W extends EnsembleWidget> extends State<W> {
void _update() {
setState(() {

});
setState(() {});
}

@override
Expand All @@ -32,4 +31,3 @@ abstract class EnsembleWidgetState<W extends EnsembleWidget> extends State<W> {
super.dispose();
}
}

12 changes: 8 additions & 4 deletions lib/framework/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ mixin ViewBuilder on IsScopeManager {
if (model.inputs![param] != null) {
// set the Custom Widget's inputs from parent scope
evalPropertyAndRegisterBinding(
scopeManager._parent!, // widget inputs are set in the parent's scope
scopeManager
._parent!, // widget inputs are set in the parent's scope
payload.widget as Invokable,
param,
model.inputs![param]);
Expand All @@ -276,7 +277,8 @@ mixin ViewBuilder on IsScopeManager {
// set props and styles on the widget. At this stage the widget
// has not been attached, so no worries about ValueNotifier
for (String key in model.props.keys) {
if (InvokableController.getSettableProperties(invokable).contains(key)) {
if (InvokableController.getSettableProperties(invokable)
.contains(key)) {
if (_isPassthroughProperty(key, invokable)) {
InvokableController.setProperty(invokable, key, model.props[key]);
} else {
Expand All @@ -286,9 +288,11 @@ mixin ViewBuilder on IsScopeManager {
}
}
for (String key in model.styles.keys) {
if (InvokableController.getSettableProperties(invokable).contains(key)) {
if (InvokableController.getSettableProperties(invokable)
.contains(key)) {
if (_isPassthroughProperty(key, invokable)) {
InvokableController.setProperty(invokable, key, model.styles[key]);
InvokableController.setProperty(
invokable, key, model.styles[key]);
} else {
evalPropertyAndRegisterBinding(
scopeManager, invokable, key, model.styles[key]);
Expand Down
3 changes: 1 addition & 2 deletions lib/framework/widget/view_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ class ViewUtil {
EnsembleController? previousController;
String? id = model.props['id']?.toString();
if (id != null) {
dynamic controller =
scopeNode.scope.dataContext.getContextById(id);
dynamic controller = scopeNode.scope.dataContext.getContextById(id);
if (controller is EnsembleController) {
previousController = controller;
}
Expand Down
Loading

0 comments on commit c510e91

Please sign in to comment.