-
+
-
-
-
-
- Checkbox with success
-
-
-
-
-
-
-
- Checkbox with warning
-
-
-
-
-
-
-
- Checkbox with error
-
-
-
-
+
Input with success
diff --git a/src/app/theme/components/baCheckbox/baCheckbox.component.ts b/src/app/theme/components/baCheckbox/baCheckbox.component.ts
new file mode 100644
index 00000000..a058fe3c
--- /dev/null
+++ b/src/app/theme/components/baCheckbox/baCheckbox.component.ts
@@ -0,0 +1,36 @@
+import {Component, Input, Self} from '@angular/core';
+import {ControlValueAccessor, NgModel} from '@angular/forms';
+
+@Component({
+ selector: 'ba-checkbox[ngModel]',
+ styles: [require('./baCheckbox.scss')],
+ template: require('./baCheckbox.html')
+})
+export class BaCheckbox implements ControlValueAccessor {
+ @Input() disabled:boolean;
+ @Input() label:string;
+ @Input() value:string;
+ @Input() baCheckboxClass:string;
+
+ public model: NgModel;
+ public state: boolean;
+
+ public constructor(@Self() state:NgModel) {
+ this.model = state;
+ state.valueAccessor = this;
+ }
+
+ public onChange(value: any): void {}
+ public onTouch(value: any): void {}
+ public writeValue(state: any): void {
+ this.state = state;
+ }
+
+ public registerOnChange(fn: any): void {
+ this.onChange = function(state: boolean) {
+ this.writeValue(state);
+ this.model.viewToModelUpdate(state);
+ }
+ }
+ public registerOnTouched(fn: any): void { this.onTouch = fn; }
+}
diff --git a/src/app/theme/components/baCheckbox/baCheckbox.html b/src/app/theme/components/baCheckbox/baCheckbox.html
new file mode 100644
index 00000000..b8409ea6
--- /dev/null
+++ b/src/app/theme/components/baCheckbox/baCheckbox.html
@@ -0,0 +1,8 @@
+
+
+
+ {{label}}
+
+
diff --git a/src/app/theme/components/baCheckbox/baCheckbox.scss b/src/app/theme/components/baCheckbox/baCheckbox.scss
new file mode 100644
index 00000000..69ae431b
--- /dev/null
+++ b/src/app/theme/components/baCheckbox/baCheckbox.scss
@@ -0,0 +1,128 @@
+@import '../../sass/conf/conf';
+
+@mixin validationState($color, $focusColor) {
+ .control-label {
+ color: $content-text;
+ }
+ .form-control {
+ border: 1px solid $color;
+ &:focus {
+ box-shadow: none;
+ border-color: $focusColor;
+ }
+ }
+ label.custom-checkbox {
+ color: $color;
+ & > span {
+ &:before {
+ color: $color;
+ }
+ &:hover {
+ &:before {
+ border-color: $color;
+ }
+ }
+ }
+ }
+ .form-control-feedback {
+ color: $color;
+ }
+ .input-group-addon {
+ background-color: $color;
+ color: $label-text;
+ }
+}
+
+.has-success {
+ @include validationState($success-bg, $success);
+ position: relative;
+}
+
+.has-warning {
+ @include validationState($warning-bg, $warning);
+ position: relative;
+}
+
+.has-error {
+ @include validationState($danger-bg, $danger);
+ position: relative;
+}
+
+label.custom-checkbox > span {
+ display: block;
+ margin-top: -13px;
+ margin-right: 10px;
+}
+
+label.custom-checkbox {
+ padding-right: 0;
+ padding-left: 0;
+ margin-bottom: 0;
+ & > input {
+ height: 0;
+ z-index: -100 !important;
+ opacity: 0;
+ position: absolute;
+ &:checked {
+ & + span {
+ &:before {
+ content: "\f00c";
+ font-weight: $font-light;
+ }
+ }
+ }
+ &:disabled {
+ & + span {
+ color: $disabled;
+ cursor: not-allowed;
+ &:before {
+ border-color: $disabled !important;
+ cursor: not-allowed;
+ }
+ }
+ }
+ }
+ & > span {
+ position: relative;
+ display: inline-block;
+ margin: 0;
+ line-height: 16px;
+ font-weight: $font-light;
+ cursor: pointer;
+ padding-left: 22px;
+ width: 100%;
+ &:before {
+ cursor: pointer;
+ font-family: fontAwesome;
+ font-weight: $font-light;
+ font-size: 12px;
+ color: $content-text;
+ content: "\a0";
+ background-color: transparent;
+ border: 1px solid $border;
+ border-radius: 0;
+ display: inline-block;
+ text-align: center;
+ height: 16px;
+ line-height: 14px;
+ min-width: 16px;
+ margin-right: 6px;
+ position: relative;
+ top: 0;
+ margin-left: -22px;
+ float: left;
+ }
+ &:hover {
+ &:before {
+ border-color: $primary-bg;
+ }
+ }
+ }
+}
+
+.form-horizontal {
+ .checkbox, .checkbox-inline{
+ padding-top: 0;
+ }
+}
+
diff --git a/src/app/theme/components/baCheckbox/index.ts b/src/app/theme/components/baCheckbox/index.ts
new file mode 100644
index 00000000..5bd11d98
--- /dev/null
+++ b/src/app/theme/components/baCheckbox/index.ts
@@ -0,0 +1 @@
+export * from './baCheckbox.component';
diff --git a/src/app/theme/components/baMultiCheckbox/baMultiCheckbox.component.ts b/src/app/theme/components/baMultiCheckbox/baMultiCheckbox.component.ts
new file mode 100644
index 00000000..f369bce3
--- /dev/null
+++ b/src/app/theme/components/baMultiCheckbox/baMultiCheckbox.component.ts
@@ -0,0 +1,45 @@
+import {Component, Input, Self} from '@angular/core';
+import {ControlValueAccessor, NgModel} from '@angular/forms';
+import {BaCheckbox} from '../baCheckbox';
+
+@Component({
+ selector: 'ba-multi-checkbox[ngModel]',
+ template: require('./baMultiCheckbox.html'),
+ directives: [BaCheckbox]
+})
+export class BaMultiCheckbox implements ControlValueAccessor {
+ @Input() baMultiCheckboxClass:string;
+ @Input() propertiesMapping:any;
+
+ public model: NgModel;
+ public state: boolean;
+
+ public constructor(@Self() state:NgModel) {
+ this.model = state;
+ state.valueAccessor = this;
+ }
+
+ public getProp(item: any, propName: string): string {
+ const prop = this.propertiesMapping[propName];
+
+ if (!prop) {
+ return item[propName];
+ } else if (typeof prop === 'function') {
+ return prop(item);
+ }
+ return item[prop];
+ }
+ public onChange(value: any): void {}
+ public onTouch(value: any): void {}
+ public writeValue(state: any): void {
+ this.state = state;
+ }
+
+ public registerOnChange(fn: any): void {
+ this.onChange = function(state: boolean) {
+ this.writeValue(state);
+ this.model.viewToModelUpdate(state);
+ }
+ }
+ public registerOnTouched(fn: any): void { this.onTouch = fn; }
+}
diff --git a/src/app/theme/components/baMultiCheckbox/baMultiCheckbox.html b/src/app/theme/components/baMultiCheckbox/baMultiCheckbox.html
new file mode 100644
index 00000000..8e12a62b
--- /dev/null
+++ b/src/app/theme/components/baMultiCheckbox/baMultiCheckbox.html
@@ -0,0 +1,10 @@
+
+
+
+
diff --git a/src/app/theme/components/baMultiCheckbox/index.ts b/src/app/theme/components/baMultiCheckbox/index.ts
new file mode 100644
index 00000000..31d030f2
--- /dev/null
+++ b/src/app/theme/components/baMultiCheckbox/index.ts
@@ -0,0 +1 @@
+export * from './baMultiCheckbox.component'
diff --git a/src/app/theme/components/index.ts b/src/app/theme/components/index.ts
index a96111fc..f5726b77 100644
--- a/src/app/theme/components/index.ts
+++ b/src/app/theme/components/index.ts
@@ -9,3 +9,5 @@ export * from './baChartistChart';
export * from './baBackTop';
export * from './baFullCalendar';
export * from './baPictureUploader';
+export * from './baCheckbox';
+export * from './baMultiCheckbox';
diff --git a/src/app/theme/sass/_form.scss b/src/app/theme/sass/_form.scss
index 29b60ada..7b9941b8 100644
--- a/src/app/theme/sass/_form.scss
+++ b/src/app/theme/sass/_form.scss
@@ -75,12 +75,6 @@ textarea.form-control {
button[type="submit"] {
margin-left: 12px;
}
-
- label.custom-checkbox > span {
- display: block;
- margin-top: -13px;
- margin-right: 10px;
- }
}
@mixin setSwitchBorder($color) {
@@ -182,8 +176,19 @@ textarea.form-control {
}
}
-label.custom-checkbox {
- padding-right: 0;
+
+.nowrap {
+ white-space: nowrap;
+}
+
+.cut-with-dots {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: block;
+}
+
+label.custom-radio {
+ @padding-right: 0;
padding-left: 0;
margin-bottom: 0;
& > input {
@@ -246,20 +251,6 @@ label.custom-checkbox {
}
}
}
-}
-
-.nowrap {
- white-space: nowrap;
-}
-
-.cut-with-dots {
- overflow: hidden;
- text-overflow: ellipsis;
- display: block;
-}
-
-label.custom-radio {
- @extend .custom-checkbox;
& > input {
&:checked {
& + span {
@@ -307,7 +298,7 @@ label.custom-input-danger {
}
.form-horizontal {
- .radio, .checkbox, .radio-inline, .checkbox-inline {
+ .radio, .radio-inline {
padding-top: 0;
}
}
@@ -327,7 +318,6 @@ label.custom-input-danger {
border-color: $focusColor;
}
}
-
label.custom-checkbox {
color: $color;
& > span {
@@ -363,21 +353,6 @@ label.custom-input-danger {
pointer-events: none;
}
-.has-success {
- @include validationState($success-bg, $success);
- position: relative;
-}
-
-.has-warning {
- @include validationState($warning-bg, $warning);
- position: relative;
-}
-
-.has-error {
- @include validationState($danger-bg, $danger);
- position: relative;
-}
-
.has-feedback {
.form-control {
padding-right: 42.5px;