projects/rebirth-ng/src/lib/rebirth-ng.config.ts
Properties |
Methods |
|
extend | ||||||
extend(obj: any)
|
||||||
Parameters :
|
Private extendConfig |
extendConfig(obj: any, targetObj: any)
|
Returns :
void
|
accordion |
accordion:
|
Type : object
|
Default value : {
type: '',
keepOneItem: true,
closable: false
}
|
alertBox |
alertBox:
|
Type : object
|
Default value : {
type: 'info',
closable: false,
removeIcon: 'glyphicon glyphicon-remove'
}
|
alertBoxPanel |
alertBoxPanel:
|
Type : object
|
Default value : {
placement: 'top-right',
cssClass: '',
width: '',
}
|
autoComplete |
autoComplete:
|
Type : object
|
Default value : {
delay: 300,
minLength: 3,
itemTemplate: null,
noResultItemTemplate: null,
formatter: (item) => item ? (item.label || item.toString()) : '',
}
|
carousel |
carousel:
|
Type : object
|
Default value : {
interval: 0,
animate: false,
reflowDuration: 30,
animationDuration: 600
}
|
checkboxGroup |
checkboxGroup:
|
Type : object
|
Default value : {
formatter: (item) => item ? (item.label || item.toString()) : '',
valueParser: (item) => item
}
|
datePicker |
datePicker:
|
Type : object
|
Default value : {
locale: 'en-US',
today: 'Today',
timePicker: false,
dateConverter: null, // DateConverter
weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
min: 1900,
max: 2099,
format: {
date: 'YYYY-MM-DD',
time: 'YYYY-MM-DD HH:mm'
}
}
|
dialog |
dialog:
|
Type : object
|
Default value : {
button: {
yes: 'Yes',
btnYesType: 'primary',
no: 'No',
btnNoType: 'warning'
}
}
|
ellipsis |
ellipsis:
|
Type : object
|
Default value : {
length: 60,
placement: 'top'
}
|
fileUpload |
fileUpload:
|
Type : object
|
Default value : {
imgPreview: false,
previewWidth: '104px',
previewHeight: '104px',
uploadParamName: 'file',
showErrors: true,
fileSizeErrorMessage: '{0}: size is too large, allowed size is {1};',
fileTypeErrorMessage: '{0}: file type is invalid, allowed file type is {1};',
chooseButton: 'Choose',
uploadButton: 'Upload',
cancelButton: 'Cancel',
plusIcon: 'glyphicon glyphicon-plus',
loadingIcon: 'glyphicon glyphicon-refresh',
uploadIcon: 'glyphicon glyphicon-upload',
removeIcon: 'glyphicon glyphicon-trash',
transformResponseUrl: (res) => res.url
}
|
imageUpload |
imageUpload:
|
Type : object
|
Default value : {
viewIcon: 'glyphicon glyphicon-eye-open'
}
|
modal |
modal:
|
Type : object
|
Default value : {
animation: true
}
|
pager |
pager:
|
Type : object
|
Default value : {
pageSize: 10,
aligned: true,
button: {
previous: '« Previous',
next: 'Next »'
}
}
|
pagination |
pagination:
|
Type : object
|
Default value : {
boundary: true,
pageSize: 10,
maxItems: 5,
size: '', // '' | 'lg' | 'sm'
button: {
first: 'First',
last: 'Last',
pre: 'Previous',
next: 'Next',
firstLinkCssClass: 'firstLink',
preLinkCssClass: 'preLink',
nextLinkCssClass: 'nextLink',
lastLinkCssClass: 'lastLink'
}
}
|
panel |
panel:
|
Type : object
|
Default value : {
type: 'default',
closable: false,
collapsable: false,
}
|
progressBar |
progressBar:
|
Type : object
|
Default value : {
type: '',
max: 100,
animate: false,
striped: false
}
|
radioGroup |
radioGroup:
|
Type : object
|
Default value : {
formatter: (item) => item ? (item.label || item.toString()) : '',
valueParser: (item) => item
}
|
rating |
rating:
|
Type : object
|
Default value : {
max: 10,
icons: { stateOn: 'glyphicon glyphicon-star', stateOff: 'glyphicon glyphicon-star-empty' }
}
|
rootContainer |
rootContainer:
|
Type : ViewContainerRef
|
select |
select:
|
Type : object
|
Default value : {
iconDown: 'glyphicon glyphicon-menu-down',
formatter: (item) => item ? (item.label || item.toString()) : '',
}
|
selectButton |
selectButton:
|
Type : object
|
Default value : {
type: 'primary',
justified: false,
multiple: false
}
|
slider |
slider:
|
Type : object
|
Default value : {
max: 100,
min: 0
}
|
switchBtn |
switchBtn:
|
Type : object
|
Default value : {
onText: 'ON',
offText: 'OFF',
type: 'primary'
}
|
tabs |
tabs:
|
Type : object
|
Default value : {
type: 'tabs', // 'tabs' | 'pills'
justified: false,
vertical: false
}
|
tags |
tags:
|
Type : object
|
Default value : {
type: 'primary',
newTagText: 'NEW TAG',
plusIcon: 'glyphicon glyphicon-plus',
removeIcon: 'glyphicon glyphicon-remove',
maxlength: 20,
maxSize: 0
}
|
treeView |
treeView:
|
Type : object
|
Default value : {
textField: 'label',
valueField: 'id',
leafIcon: 'glyphicon glyphicon-leaf',
expendIcon: 'glyphicon glyphicon-chevron-down',
collapseIcon: 'glyphicon glyphicon-chevron-right',
loadingIcon: 'glyphicon glyphicon-cloud-download',
}
|
import { Inject, Injectable, Input, LOCALE_ID, ViewContainerRef } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class RebirthNGConfig {
rootContainer: ViewContainerRef;
accordion = {
type: '',
keepOneItem: true,
closable: false
};
alertBox = {
type: 'info',
closable: false,
removeIcon: 'glyphicon glyphicon-remove'
};
alertBoxPanel = {
placement: 'top-right',
cssClass: '',
width: '',
};
autoComplete = {
delay: 300,
minLength: 3,
itemTemplate: null,
noResultItemTemplate: null,
formatter: (item) => item ? (item.label || item.toString()) : '',
};
carousel = {
interval: 0,
animate: false,
reflowDuration: 30,
animationDuration: 600
};
checkboxGroup = {
formatter: (item) => item ? (item.label || item.toString()) : '',
valueParser: (item) => item
};
datePicker = {
locale: 'en-US',
today: 'Today',
timePicker: false,
dateConverter: null, // DateConverter
weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
min: 1900,
max: 2099,
format: {
date: 'YYYY-MM-DD',
time: 'YYYY-MM-DD HH:mm'
}
};
dialog = {
button: {
yes: 'Yes',
btnYesType: 'primary',
no: 'No',
btnNoType: 'warning'
}
};
ellipsis = {
length: 60,
placement: 'top'
};
fileUpload = {
imgPreview: false,
previewWidth: '104px',
previewHeight: '104px',
uploadParamName: 'file',
showErrors: true,
fileSizeErrorMessage: '{0}: size is too large, allowed size is {1};',
fileTypeErrorMessage: '{0}: file type is invalid, allowed file type is {1};',
chooseButton: 'Choose',
uploadButton: 'Upload',
cancelButton: 'Cancel',
plusIcon: 'glyphicon glyphicon-plus',
loadingIcon: 'glyphicon glyphicon-refresh',
uploadIcon: 'glyphicon glyphicon-upload',
removeIcon: 'glyphicon glyphicon-trash',
transformResponseUrl: (res) => res.url
};
imageUpload = {
viewIcon: 'glyphicon glyphicon-eye-open'
};
modal = {
animation: true
};
pager = {
pageSize: 10,
aligned: true,
button: {
previous: '« Previous',
next: 'Next »'
}
};
pagination = {
boundary: true,
pageSize: 10,
maxItems: 5,
size: '', // '' | 'lg' | 'sm'
button: {
first: 'First',
last: 'Last',
pre: 'Previous',
next: 'Next',
firstLinkCssClass: 'firstLink',
preLinkCssClass: 'preLink',
nextLinkCssClass: 'nextLink',
lastLinkCssClass: 'lastLink'
}
};
panel = {
type: 'default',
closable: false,
collapsable: false,
};
progressBar = {
type: '',
max: 100,
animate: false,
striped: false
};
radioGroup = {
formatter: (item) => item ? (item.label || item.toString()) : '',
valueParser: (item) => item
};
rating = {
max: 10,
icons: { stateOn: 'glyphicon glyphicon-star', stateOff: 'glyphicon glyphicon-star-empty' }
};
select = {
iconDown: 'glyphicon glyphicon-menu-down',
formatter: (item) => item ? (item.label || item.toString()) : '',
};
selectButton = {
type: 'primary',
justified: false,
multiple: false
};
switchBtn = {
onText: 'ON',
offText: 'OFF',
type: 'primary'
};
slider = {
max: 100,
min: 0
};
tabs = {
type: 'tabs', // 'tabs' | 'pills'
justified: false,
vertical: false
};
tags = {
type: 'primary',
newTagText: 'NEW TAG',
plusIcon: 'glyphicon glyphicon-plus',
removeIcon: 'glyphicon glyphicon-remove',
maxlength: 20,
maxSize: 0
};
treeView = {
textField: 'label',
valueField: 'id',
leafIcon: 'glyphicon glyphicon-leaf',
expendIcon: 'glyphicon glyphicon-chevron-down',
collapseIcon: 'glyphicon glyphicon-chevron-right',
loadingIcon: 'glyphicon glyphicon-cloud-download',
};
// constructor(@Inject(LOCALE_ID) private locale: string) {
// }
extend(obj: any): this {
this.extendConfig(obj, this);
return this;
}
private extendConfig(obj: any, targetObj: any) {
Object.keys(obj || {})
.reduce((target, key) => {
const value = obj[key];
if (value instanceof Object) {
this.extendConfig(value, target[key])
} else {
target[key] = value;
}
return target;
}, targetObj);
}
}