Skip to content

Commit

Permalink
fix for dart style guidline and other bugs on datePicker
Browse files Browse the repository at this point in the history
  • Loading branch information
insinfo committed Apr 30, 2020
1 parent f6784b5 commit aac13c2
Show file tree
Hide file tree
Showing 113 changed files with 1,737 additions and 1,552 deletions.
6 changes: 2 additions & 4 deletions example/lib/app_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:essential_components/essential_components.dart';
import 'package:example/src/pages/content_page/content_component.dart';
import 'package:example/src/pages/menu_aside_component/menu_aside_component.dart';
import 'package:example/src/pages/menu_sidebar_options_component/menu_sidebar_options_component.dart';
import 'package:example/src/pages/notification_component/notification_component.dart';

@Component(
selector: 'my-app',
Expand All @@ -25,9 +24,8 @@ import 'package:example/src/pages/notification_component/notification_component.
],
exports: [])
class AppComponent {

static EssentialNotificationService notificationService = EssentialNotificationService();
static EssentialNotificationService notificationService =
EssentialNotificationService();

AppComponent();

}
12 changes: 6 additions & 6 deletions example/lib/app_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ abstract class AppConfig {
static Map<String, String> headers = {
'Content-type': 'application/json',
'Accept': 'application/json',
"Authorization": "Bearer " + window.localStorage["YWNjZXNzX3Rva2Vu"].toString()
'Authorization':
'Bearer ' + window.localStorage['YWNjZXNzX3Rva2Vu'].toString()
};

//static UriMuProtoType PROTOCOL_REST_API = UriMuProtoType.http;
static String PROTOTOCOL_HOST_REST_API = "http://";
static String HOST_REST_API = "local.riodasostras.rj.gov.br";
static String BASE_PATH_REST_API = "/siscec2server/api";
static String CONTRATO_API_ENDPOINT = "/contratos";

static String PROTOTOCOL_HOST_REST_API = 'http://';
static String HOST_REST_API = 'local.riodasostras.rj.gov.br';
static String BASE_PATH_REST_API = '/siscec2server/api';
static String CONTRATO_API_ENDPOINT = '/contratos';
}
70 changes: 52 additions & 18 deletions example/lib/src/models/person.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Person implements IDataTableRender, ISimpleSelectRender, TimelineRender {
}

String get birthdayAsString {
var dt = birthday != null ? birthday.toIso8601String().substring(0, 10) : "";
var dt =
birthday != null ? birthday.toIso8601String().substring(0, 10) : '';
return dt;
}

Expand All @@ -45,13 +46,23 @@ class Person implements IDataTableRender, ISimpleSelectRender, TimelineRender {
Person.fromJson(Map<String, dynamic> json) {
try {
id = Helper.isNotNullOrEmptyAndContain(json, 'id') ? json['id'] : -1;
name = Helper.isNotNullOrEmptyAndContain(json, 'name') ? json['name'] : '';
name =
Helper.isNotNullOrEmptyAndContain(json, 'name') ? json['name'] : '';
age = Helper.isNotNullOrEmptyAndContain(json, 'age') ? json['age'] : -1;
phone = Helper.isNotNullOrEmptyAndContain(json, 'phone') ? json['phone'] : '';
birthdayAsString = Helper.isNotNullOrEmptyAndContain(json, 'birthday') ? json['birthday'] : null;
avatar = Helper.isNotNullOrEmptyAndContain(json, 'avatar') ? json['avatar'] : '';
enable = Helper.isNotNullOrEmptyAndContain(json, 'enable') ? json['enable'] : null;
description = Helper.isNotNullOrEmptyAndContain(json, 'description') ? json['description'] : '';
phone =
Helper.isNotNullOrEmptyAndContain(json, 'phone') ? json['phone'] : '';
birthdayAsString = Helper.isNotNullOrEmptyAndContain(json, 'birthday')
? json['birthday']
: null;
avatar = Helper.isNotNullOrEmptyAndContain(json, 'avatar')
? json['avatar']
: '';
enable = Helper.isNotNullOrEmptyAndContain(json, 'enable')
? json['enable']
: null;
description = Helper.isNotNullOrEmptyAndContain(json, 'description')
? json['description']
: '';

timelineInit();
} catch (e) {
Expand All @@ -61,7 +72,7 @@ class Person implements IDataTableRender, ISimpleSelectRender, TimelineRender {

Map<String, dynamic> toJson() {
return {
'id': id != null ? id : null,
'id': id,
'name': name,
'age': age,
'phone': phone,
Expand All @@ -74,19 +85,42 @@ class Person implements IDataTableRender, ISimpleSelectRender, TimelineRender {

@override
DataTableRow getRowDefinition() {
DataTableRow settings = DataTableRow();
settings.addSet(DataTableColumn(key: 'avatar', value: avatar, title: 'Avatar', type: DataTableColumnType.img));
var settings = DataTableRow();
settings.addSet(DataTableColumn(
key: 'name', value: name, title: 'Name', type: DataTableColumnType.text, primaryDisplayValue: true));
settings.addSet(DataTableColumn(key: 'age', value: age, title: 'Age', type: DataTableColumnType.text));
settings.addSet(DataTableColumn(key: 'phone', value: phone, title: 'Phone', type: DataTableColumnType.text));
settings
.addSet(DataTableColumn(key: 'birthday', value: birthday, title: 'Birthday', type: DataTableColumnType.date));
key: 'avatar',
value: avatar,
title: 'Avatar',
type: DataTableColumnType.img));
settings.addSet(DataTableColumn(
key: 'name',
value: name,
title: 'Name',
type: DataTableColumnType.text,
primaryDisplayValue: true));
settings.addSet(DataTableColumn(
key: 'age', value: age, title: 'Age', type: DataTableColumnType.text));
settings.addSet(DataTableColumn(
key: 'phone',
value: phone,
title: 'Phone',
type: DataTableColumnType.text));
settings.addSet(DataTableColumn(
key: 'birthday',
value: birthday,
title: 'Birthday',
type: DataTableColumnType.date));

settings
.addSet(DataTableColumn(key: 'enable', value: enable, title: 'Enable', type: DataTableColumnType.boolLabel));
settings.addSet(DataTableColumn(
key: 'description', value: description, title: 'Description', limit: 100, type: DataTableColumnType.text));
key: 'enable',
value: enable,
title: 'Enable',
type: DataTableColumnType.boolLabel));
settings.addSet(DataTableColumn(
key: 'description',
value: description,
title: 'Description',
limit: 100,
type: DataTableColumnType.text));

return settings;
}
Expand Down
23 changes: 12 additions & 11 deletions example/lib/src/models/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@ class User implements IDataTableRender {

User.fromJson(Map<String, dynamic> json) {
try {
id = json.containsKey("id") ? json['id'] : -1;
name = json.containsKey("name") ? json['name'] : "";
id = json.containsKey('id') ? json['id'] : -1;
name = json.containsKey('name') ? json['name'] : '';
} catch (e) {
print('User.fromJson: ${e}');
}
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> json = Map<String, dynamic>();
if (this.id != null) {
json['id'] = this.id;
final json = <String, dynamic>{};
if (id != null) {
json['id'] = id;
}
json['name'] = this.name;
json['name'] = name;
return json;
}

@override
DataTableRow getRowDefinition() {
var settings = DataTableRow();
settings.addSet(DataTableColumn(
key: "name",
key: 'name',
value: name,
title: "Name",
title: 'Name',
customRender: (html.TableCellElement cellElement) {
if (name == "Leanne Graham") {
cellElement?.closest('tr')?.style?.background = "#e8fbee";
if (name == 'Leanne Graham') {
cellElement?.closest('tr')?.style?.background = '#e8fbee"';
return '''<span style="font-size: .8125rem;
padding: 5px 15px; color: #fff; font-weight: 400;
border-radius: 10px; background: #2fa433d9;">
Expand All @@ -45,7 +45,8 @@ class User implements IDataTableRender {
return name;
}));

settings.addSet(DataTableColumn(key: "username", value: username, title: "username", limit: 20));
settings.addSet(DataTableColumn(
key: 'username', value: username, title: 'username', limit: 20));
return settings;
}
}
25 changes: 10 additions & 15 deletions example/lib/src/pages/accordeon_example/accordeon_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ import 'package:example/src/services/person_service.dart';
import 'package:example/src/utils/highlighting_js.dart';

@Component(
selector: 'accordeon-example',
styleUrls: ['accordeon_example.css'],
templateUrl: 'accordeon_example.html',
directives: [
coreDirectives,
esDynamicTabsDirectives,
EsAccordionPanelComponent
],
exports: [],
providers: [ClassProvider(PersonService)]
)
selector: 'accordeon-example',
styleUrls: ['accordeon_example.css'],
templateUrl: 'accordeon_example.html',
directives: [
coreDirectives,
esDynamicTabsDirectives,
EsAccordionPanelComponent
],
exports: [],
providers: [ClassProvider(PersonService)])
class AccordeonComponent implements OnInit {

String codeHtml = '''
<es-accordion-panel heading="Título do acordeon">
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Delectus dignissimos site.</p>
Expand All @@ -40,14 +38,11 @@ import 'package:example/src/services/person_service.dart';
class AccordeonComponent { }
''';



AccordeonComponent();

@override
void ngOnInit() {
codeHtml = highlightingHtml(codeHtml);
codeComponent = highlightingHtml(codeComponent);
}

}
53 changes: 24 additions & 29 deletions example/lib/src/pages/content_page/content_component.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:angular/angular.dart';
import 'package:essential_components/essential_components.dart';

import 'package:example/src/pages/recaptcha_example/recaptcha_example.dart';

import '../accordeon_example/accordeon_example.dart';
Expand All @@ -18,37 +18,32 @@ import '../timeline_component/timeline_component.dart';
import '../toast_component/toast_component.dart';
import '../recaptcha_example/recaptcha_example.dart';


@Component(
selector: 'content-component',
styleUrls: ['content_component.css'],
templateUrl: 'content_component.html',
directives: [
coreDirectives,
DataTableComponent,
AccordeonComponent,
DataPickerComponent,
DropdownDialogComponent,
DynamicTabsComponent,
ModalComponent,
NotificationComponent,
RestApiExampleComponent,
SelectDialogComponent,
SimpleCardComponent,
ExSimpleDialogComponent,
SimpleSelectComponent,
TimelineExComponent,
ToastExComponent,
RecaptchaExample
],
exports: []
)
selector: 'content-component',
styleUrls: ['content_component.css'],
templateUrl: 'content_component.html',
directives: [
coreDirectives,
DataTableComponent,
AccordeonComponent,
DataPickerComponent,
DropdownDialogComponent,
DynamicTabsComponent,
ModalComponent,
NotificationComponent,
RestApiExampleComponent,
SelectDialogComponent,
SimpleCardComponent,
ExSimpleDialogComponent,
SimpleSelectComponent,
TimelineExComponent,
ToastExComponent,
RecaptchaExample
],
exports: [])
class ContentComponent implements OnInit {

ContentComponent();

@override
void ngOnInit() async {
}

void ngOnInit() async {}
}
14 changes: 10 additions & 4 deletions example/lib/src/pages/content_page/content_component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<recaptcha_example></recaptcha_example>

<recaptcha_example></recaptcha_example>
<rest-api-example></rest-api-example>
<datatable-component></datatable-component>
<accordeon-component></accordeon-component>
Expand All @@ -8,10 +8,16 @@
<dynamic-tabs-component></dynamic-tabs-component>
<modal-component></modal-component>
<notification-component></notification-component>
<simple-select-component></simple-select-component>
<select-dialog-component></select-dialog-component>
<simple-card-component></simple-card-component>
<simple-dialog-component></simple-dialog-component>
<simple-loading-component></simple-loading-component>
<simple-select-component></simple-select-component>
<timeline-component></timeline-component>
<toast-ex-component></toast-ex-component>
<!--
--><toast-ex-component></toast-ex-component>

Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ import 'package:angular_forms/angular_forms.dart';
import 'package:example/src/utils/highlighting_js.dart';

@Component(
selector: 'datapicker-component',
styleUrls: ['datapicker_component.css'],
templateUrl: 'datapicker_component.html',
directives: [
formDirectives,
coreDirectives,
EssentialToastComponent,
routerDirectives,
EssentialDataTableComponent,
MaxlengthDirective,
esDynamicTabsDirectives,
EssentialSimpleSelectComponent,
EsSimpleSelectOptionComponent,
EsDatePickerPopupComponent,
EsDatePickerComponent
],
exports: [],
providers: [ClassProvider(PersonService)]
)
selector: 'datapicker-component',
styleUrls: ['datapicker_component.css'],
templateUrl: 'datapicker_component.html',
directives: [
formDirectives,
coreDirectives,
EssentialToastComponent,
routerDirectives,
EssentialDataTableComponent,
MaxlengthDirective,
esDynamicTabsDirectives,
EssentialSimpleSelectComponent,
EsSimpleSelectOptionComponent,
EsDatePickerPopupComponent,
EsDatePickerComponent
],
exports: [],
providers: [ClassProvider(PersonService)])
class DataPickerComponent implements OnInit {

@Input('btnRadio')
EsRadioButtonDirective btnRadio;

Expand Down Expand Up @@ -63,8 +61,7 @@ class AccordeonComponent { }
codeComponent = highlightingHtml(codeComponent);
}

reloadData(dynamic event) {
void reloadData(dynamic event) {
//print(event);
}

}
Loading

0 comments on commit aac13c2

Please sign in to comment.