mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#440 Dropdown widget stub, base widget component
This commit is contained in:
@@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, AfterViewInit } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormFieldModel } from './../widget.model';
|
import { WidgetComponent } from './../widget.component';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
declare var componentHandler;
|
declare var componentHandler;
|
||||||
@@ -26,20 +26,6 @@ declare var componentHandler;
|
|||||||
selector: 'checkbox-widget',
|
selector: 'checkbox-widget',
|
||||||
templateUrl: './checkbox.widget.html'
|
templateUrl: './checkbox.widget.html'
|
||||||
})
|
})
|
||||||
export class CheckboxWidget implements AfterViewInit {
|
export class CheckboxWidget extends WidgetComponent {
|
||||||
|
|
||||||
@Input()
|
|
||||||
field: FormFieldModel;
|
|
||||||
|
|
||||||
hasField() {
|
|
||||||
return this.field ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewInit() {
|
|
||||||
// workaround for MDL issues with dynamic components
|
|
||||||
if (componentHandler) {
|
|
||||||
componentHandler.upgradeAllRegistered();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,9 @@
|
|||||||
<div *ngSwitchCase="'boolean'">
|
<div *ngSwitchCase="'boolean'">
|
||||||
<checkbox-widget [field]="field"></checkbox-widget>
|
<checkbox-widget [field]="field"></checkbox-widget>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngSwitchCase="'dropdown'">
|
||||||
|
<dropdown-widget [field]="field"></dropdown-widget>
|
||||||
|
</div>
|
||||||
<div *ngSwitchDefault>
|
<div *ngSwitchDefault>
|
||||||
<span>UNKNOWN WIDGET TYPE: {{field.type}}</span>
|
<span>UNKNOWN WIDGET TYPE: {{field.type}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -22,6 +22,7 @@ import { TextWidget } from './../text/text.widget';
|
|||||||
import { NumberWidget } from './../number/number.widget';
|
import { NumberWidget } from './../number/number.widget';
|
||||||
import { CheckboxWidget } from './../checkbox/checkbox.widget';
|
import { CheckboxWidget } from './../checkbox/checkbox.widget';
|
||||||
import { MultilineTextWidget } from './../multiline-text/multiline-text.widget';
|
import { MultilineTextWidget } from './../multiline-text/multiline-text.widget';
|
||||||
|
import { DropdownWidget } from './../dropdown/dropdown.widget';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
declare var componentHandler;
|
declare var componentHandler;
|
||||||
@@ -30,7 +31,13 @@ declare var componentHandler;
|
|||||||
moduleId: __moduleName,
|
moduleId: __moduleName,
|
||||||
selector: 'container-widget',
|
selector: 'container-widget',
|
||||||
templateUrl: './container.widget.html',
|
templateUrl: './container.widget.html',
|
||||||
directives: [TextWidget, NumberWidget, CheckboxWidget, MultilineTextWidget]
|
directives: [
|
||||||
|
TextWidget,
|
||||||
|
NumberWidget,
|
||||||
|
CheckboxWidget,
|
||||||
|
MultilineTextWidget,
|
||||||
|
DropdownWidget
|
||||||
|
]
|
||||||
})
|
})
|
||||||
export class ContainerWidget implements AfterViewInit {
|
export class ContainerWidget implements AfterViewInit {
|
||||||
|
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
<select>
|
||||||
|
<option value="1">One</option>
|
||||||
|
<option value="2">Two</option>
|
||||||
|
</select>
|
@@ -0,0 +1,31 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { WidgetComponent } from './../widget.component';
|
||||||
|
|
||||||
|
declare let __moduleName: string;
|
||||||
|
declare var componentHandler;
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
moduleId: __moduleName,
|
||||||
|
selector: 'dropdown-widget',
|
||||||
|
templateUrl: './dropdown.widget.html'
|
||||||
|
})
|
||||||
|
export class DropdownWidget extends WidgetComponent {
|
||||||
|
|
||||||
|
}
|
@@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, AfterViewInit } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormFieldModel } from './../widget.model';
|
import { WidgetComponent } from './../widget.component';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
declare var componentHandler;
|
declare var componentHandler;
|
||||||
@@ -27,20 +27,6 @@ declare var componentHandler;
|
|||||||
templateUrl: './multiline-text.widget.html',
|
templateUrl: './multiline-text.widget.html',
|
||||||
styleUrls: ['./multiline-text.widget.css']
|
styleUrls: ['./multiline-text.widget.css']
|
||||||
})
|
})
|
||||||
export class MultilineTextWidget implements AfterViewInit {
|
export class MultilineTextWidget extends WidgetComponent {
|
||||||
|
|
||||||
@Input()
|
|
||||||
field: FormFieldModel;
|
|
||||||
|
|
||||||
hasField() {
|
|
||||||
return this.field ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewInit() {
|
|
||||||
// workaround for MDL issues with dynamic components
|
|
||||||
if (componentHandler) {
|
|
||||||
componentHandler.upgradeAllRegistered();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, AfterViewInit } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormFieldModel } from './../widget.model';
|
import { WidgetComponent } from './../widget.component';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
declare var componentHandler;
|
declare var componentHandler;
|
||||||
@@ -27,20 +27,6 @@ declare var componentHandler;
|
|||||||
templateUrl: './number.widget.html',
|
templateUrl: './number.widget.html',
|
||||||
styleUrls: ['./number.widget.css']
|
styleUrls: ['./number.widget.css']
|
||||||
})
|
})
|
||||||
export class NumberWidget implements AfterViewInit {
|
export class NumberWidget extends WidgetComponent {
|
||||||
|
|
||||||
@Input()
|
|
||||||
field: FormFieldModel;
|
|
||||||
|
|
||||||
hasField() {
|
|
||||||
return this.field ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewInit() {
|
|
||||||
// workaround for MDL issues with dynamic components
|
|
||||||
if (componentHandler) {
|
|
||||||
componentHandler.upgradeAllRegistered();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, AfterViewInit } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormFieldModel } from './../widget.model';
|
import { WidgetComponent } from './../widget.component';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
declare var componentHandler;
|
declare var componentHandler;
|
||||||
@@ -27,20 +27,6 @@ declare var componentHandler;
|
|||||||
templateUrl: './text.widget.html',
|
templateUrl: './text.widget.html',
|
||||||
styleUrls: ['./text.widget.css']
|
styleUrls: ['./text.widget.css']
|
||||||
})
|
})
|
||||||
export class TextWidget implements AfterViewInit {
|
export class TextWidget extends WidgetComponent {
|
||||||
|
|
||||||
@Input()
|
|
||||||
field: FormFieldModel;
|
|
||||||
|
|
||||||
hasField() {
|
|
||||||
return this.field ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewInit() {
|
|
||||||
// workaround for MDL issues with dynamic components
|
|
||||||
if (componentHandler) {
|
|
||||||
componentHandler.upgradeAllRegistered();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,43 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Input, AfterViewInit } from '@angular/core';
|
||||||
|
import { FormFieldModel } from './widget.model';
|
||||||
|
|
||||||
|
declare let __moduleName: string;
|
||||||
|
declare var componentHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base widget component.
|
||||||
|
*/
|
||||||
|
export class WidgetComponent implements AfterViewInit {
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
field: FormFieldModel;
|
||||||
|
|
||||||
|
hasField() {
|
||||||
|
return this.field ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
// workaround for MDL issues with dynamic components
|
||||||
|
if (componentHandler) {
|
||||||
|
componentHandler.upgradeAllRegistered();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user