Permalink
Browse files

feature: M4DListComponent added, InplaceEdit-Example works

  • Loading branch information...
MikeMitterer committed Dec 6, 2018
1 parent dc742f8 commit 4ba55edaee4db005b4b1f0befdf47a9ba8d5d6ed
@@ -52,3 +52,9 @@ abstract class TemplateComponent {
/// }
Map<String,Function> get events => <String,Function>{ };
}

/// Needed for M4DListComponent
abstract class SimpleDataObject {
bool contains(final String name);
String asString(final String name);
}
@@ -21,8 +21,8 @@ dependencies:
m4d_core: '>=0.1.0 <1.0.0'
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_core

m4d_directive: # '>=0.1.0 <1.0.0'
path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_directive
m4d_directive: '>=0.1.0 <1.0.0'
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_directive

m4d_flux: '>=0.1.0 <1.0.0'
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_flux
@@ -26,6 +26,7 @@ dependencies:
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_form

m4d_directive: '>=0.1.0 <1.0.0'
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_directive

dev_dependencies:
build_runner: any
@@ -22,11 +22,11 @@ dependencies:
m4d_flux: '>=0.1.0 <1.0.0'
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_flux

m4d_form: # '>=0.1.0 <1.0.0'
path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_form
m4d_form: '>=0.1.0 <1.0.0'
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_form

m4d_directive: # '>=0.1.0 <1.0.0'
path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_directive
m4d_directive: '>=0.1.0 <1.0.0'
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_directive

dev_dependencies:
build_runner: any
@@ -26,40 +26,17 @@ import 'package:console_log_handler/console_log_handler.dart';
import 'package:validate/validate.dart';

import 'package:m4d_core/m4d_ioc.dart' as ioc;
import 'package:m4d_inplace_sample/services.dart' as inplaceServices;

import 'package:m4d_flux/m4d_flux.dart';
import 'package:m4d_directive/m4d_directive.dart';
import 'package:m4d_directive/services.dart' as directiveServices;

import 'package:m4d_directive/directive/components/interfaces/stores.dart';
import 'package:m4d_template/m4d_template.dart';

import "package:m4d_inplace_sample/components/interfaces/actions.dart";
import "package:m4d_inplace_sample/components/interfaces/stores.dart";
import 'package:m4d_inplace_sample/services.dart' as inplaceServices;
import "package:m4d_inplace_sample/m4d_inplace_sample.dart" show Person;

class PersonForList extends Person implements SimpleDataObject {

PersonForList(final String firstname,final String lastname, final int age, final String bio)
: super(firstname, lastname, age, bio);

@override
String asString(final String name) {
if(name == "id") {
return id;
}
throw "asString ist not implemented for ${name}!";
}

@override
bool contains(final String name) {
if(name == "id") {
return true;
}
throw "contains ist not implemented for ${name}!";
}
}

/// Concrete implementation for our stores.
///
/// We could use two separate implementations for each store but as you can see here,
@@ -152,4 +129,34 @@ class InplaceStoreModule extends ioc.IOCModule {
ioc.IOCContainer().bind(inplaceServices.PersonsStore).to(_store);
ioc.IOCContainer().bind(directiveServices.SimpleValueStore).to(_store);
}
}
}

/// m4d-list component asks for "id" and for this give it to the component this way
///
/// <m4d-list model="persons">
/// <template>
/// <sample-inplace-edit class="sample-inplace-edit--shadow" data-id="{{id}}"></sample-inplace-edit>
/// </template>
/// </m4d-list>
///
class PersonForList extends Person implements SimpleDataObject {

PersonForList(final String firstname,final String lastname, final int age, final String bio)
: super(firstname, lastname, age, bio);

@override
String asString(final String name) {
if(name == "id") {
return id;
}
throw "asString ist not implemented for ${name}!";
}

@override
bool contains(final String name) {
if(name == "id") {
return true;
}
throw "contains ist not implemented for ${name}!";
}
}
@@ -26,6 +26,7 @@ dependencies:
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_form

m4d_directive: '>=0.1.0 <1.0.0'
# path: /Volumes/Daten/DevLocal/DevDart/m4d/m4d_directive

dev_dependencies:
build_runner: any

0 comments on commit 4ba55ed

Please sign in to comment.