File

projects/rebirth-ng/src/lib/rebirth-ng.config.ts

Index

Properties
Methods

Methods

extend
extend(obj: any)
Parameters :
Name Type Optional
obj any no
Private extendConfig
extendConfig(obj: any, targetObj: any)
Parameters :
Name Type Optional
obj any no
targetObj any no
Returns : void

Properties

accordion
accordion: object
Type : object
Default value : { type: '', keepOneItem: true, closable: false }
alertBox
alertBox: object
Type : object
Default value : { type: 'info', closable: false, removeIcon: 'glyphicon glyphicon-remove' }
alertBoxPanel
alertBoxPanel: object
Type : object
Default value : { placement: 'top-right', cssClass: '', width: '', }
autoComplete
autoComplete: object
Type : object
Default value : { delay: 300, minLength: 3, itemTemplate: null, noResultItemTemplate: null, formatter: (item) => item ? (item.label || item.toString()) : '', }
carousel
carousel: object
Type : object
Default value : { interval: 0, animate: false, reflowDuration: 30, animationDuration: 600 }
checkboxGroup
checkboxGroup: object
Type : object
Default value : { formatter: (item) => item ? (item.label || item.toString()) : '', valueParser: (item) => item }
datePicker
datePicker: object
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: object
Type : object
Default value : { button: { yes: 'Yes', btnYesType: 'primary', no: 'No', btnNoType: 'warning' } }
ellipsis
ellipsis: object
Type : object
Default value : { length: 60, placement: 'top' }
fileUpload
fileUpload: object
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: object
Type : object
Default value : { viewIcon: 'glyphicon glyphicon-eye-open' }
modal
modal: object
Type : object
Default value : { animation: true }
pager
pager: object
Type : object
Default value : { pageSize: 10, aligned: true, button: { previous: '« Previous', next: 'Next »' } }
pagination
pagination: object
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: object
Type : object
Default value : { type: 'default', closable: false, collapsable: false, }
progressBar
progressBar: object
Type : object
Default value : { type: '', max: 100, animate: false, striped: false }
radioGroup
radioGroup: object
Type : object
Default value : { formatter: (item) => item ? (item.label || item.toString()) : '', valueParser: (item) => item }
rating
rating: object
Type : object
Default value : { max: 10, icons: { stateOn: 'glyphicon glyphicon-star', stateOff: 'glyphicon glyphicon-star-empty' } }
rootContainer
rootContainer: ViewContainerRef
Type : ViewContainerRef
select
select: object
Type : object
Default value : { iconDown: 'glyphicon glyphicon-menu-down', formatter: (item) => item ? (item.label || item.toString()) : '', }
selectButton
selectButton: object
Type : object
Default value : { type: 'primary', justified: false, multiple: false }
slider
slider: object
Type : object
Default value : { max: 100, min: 0 }
switchBtn
switchBtn: object
Type : object
Default value : { onText: 'ON', offText: 'OFF', type: 'primary' }
tabs
tabs: object
Type : object
Default value : { type: 'tabs', // 'tabs' | 'pills' justified: false, vertical: false }
tags
tags: object
Type : object
Default value : { type: 'primary', newTagText: 'NEW TAG', plusIcon: 'glyphicon glyphicon-plus', removeIcon: 'glyphicon glyphicon-remove', maxlength: 20, maxSize: 0 }
treeView
treeView: object
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);
  }
}

results matching ""

    No results matching ""