当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript delegateTo.delegateTo函数代码示例

本文整理汇总了TypeScript中app/utils/delegateTo.delegateTo函数的典型用法代码示例。如果您正苦于以下问题:TypeScript delegateTo函数的具体用法?TypeScript delegateTo怎么用?TypeScript delegateTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了delegateTo函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: DateFieldInput

export function DateFieldInput(value) {
  var input = new TextFieldInput(value);
  var datePickerButton = createDatePickerButton(this);

  this.getValue = delegateTo(input, 'getValue');
  this.setValue = delegateTo(input, 'setValue');
  this.focus = delegateTo(input, 'focus');
  this.addDatePicker = delegateTo(input, 'precedeWith');
  this.setStyle = delegateTo(input, 'setStyle');

  this.appendTo = function(parentDomElement) {
    input.appendTo(parentDomElement);
    parentDomElement.appendChild(datePickerButton);
  };

  this.getDate = function() {
    var text = input.getValue();
    return text ? DateFormatting.parse(text, DateFieldInput.DATE_FORMAT) : new Date();
  };

  this.setDate = function(date) {
    var formattedDate = DateFormatting.format(date, DateFieldInput.DATE_FORMAT);
    input.setValue(formattedDate);
  };
}
开发者ID:gurdiga,项目名称:xo,代码行数:25,代码来源:DateFieldInput.ts

示例2: Section

export function Section(labelText) {
  var container = createContainer(labelText);

  this.appendTo = delegateTo(container, 'appendTo');
  this.setStyle = delegateTo(container, 'setStyle');
  this.appendWidgets = delegateTo(container, 'appendWidgets');
}
开发者ID:gurdiga,项目名称:xo,代码行数:7,代码来源:Section.ts

示例3: DateField

export function DateField(defaultValue) {
  var domElement = createDOMElement('date-field');
  WidgetRole.apply(this, [domElement]);

  var dateFieldInput = new DateFieldInput(defaultValue);
  dateFieldInput.appendTo(domElement);

  this.getValue = delegateTo(dateFieldInput, 'getValue');
  this.focus = delegateTo(dateFieldInput, 'focus');
  this.setStyle = delegateTo(dateFieldInput, 'setStyle');
}
开发者ID:gurdiga,项目名称:xo,代码行数:11,代码来源:DateField.ts

示例4: LabeledLargeTextField

export function LabeledLargeTextField(labelText, value) {
  var domElement = createElement();
  WidgetRole.apply(this, [domElement]);

  var textarea = createTextareaElement(value);
  var label = new FieldLabel(labelText, [textarea]);
  label.appendTo(domElement);

  this.focus = delegateTo(textarea, 'focus');
  this.getValue = delegateTo(textarea, 'value');
}
开发者ID:gurdiga,项目名称:xo,代码行数:11,代码来源:LabeledLargeTextField.ts

示例5: before

    before(function() {
      date = new Date();
      date.format = 'YY-MM-DD';
      date.falsyProperty = '';

      dateWrapper = {
        toString: delegateTo(date, 'toString'),
        getFormat: delegateTo(date, 'format'),
        getFalsyProperty: delegateTo(date, 'falsyProperty')
      };
    });
开发者ID:gurdiga,项目名称:xo,代码行数:11,代码来源:delegateToTest.ts

示例6: LabeledTextField

export function LabeledTextField(labelText, value) {
  var domElement = createElement();
  WidgetRole.apply(this, [domElement]);

  var input = new TextFieldInput(value);
  addLabel(domElement, labelText, input);

  this.getValue = delegateTo(input, 'getValue');

  this.focus = delegateTo(input, 'focus');
}
开发者ID:gurdiga,项目名称:xo,代码行数:11,代码来源:LabeledTextField.ts

示例7: LabeledDateField

export function LabeledDateField(labelText, value) {
  var domElement = createElement();
  WidgetRole.apply(this, [domElement]);

  var input = new DateField(value);
  var label = new FieldLabel(labelText, [input]);
  label.appendTo(domElement);

  this.getValue = delegateTo(input, 'getValue');
  this.focus = delegateTo(input, 'focus');
  this.setStyle = delegateTo(input, 'setStyle');
}
开发者ID:gurdiga,项目名称:xo,代码行数:12,代码来源:LabeledDateField.ts

示例8: InstitutionActivity

export function InstitutionActivity() {
  var descriptionText = 'Intentarea';
  var activity = new Activity('InstitutionActivity', descriptionText);
  var todoList = new TodoList();

  activity.setDetailWidgets([todoList]);

  this.getDescription = delegateTo(activity, 'getDescription');
  this.appendTo = delegateTo(activity, 'appendTo');
  this.setDetailWidgets = delegateTo(activity, 'setDetailWidgets');

  this.setData = function(data) {
    todoList.setData(data['todo-items']);
  };
}
开发者ID:gurdiga,项目名称:xo,代码行数:15,代码来源:InstitutionActivity.ts

示例9: RefusalActivity

export function RefusalActivity() {
  var descriptionText = 'Refuz';
  var activity = new Activity('RefusalActivity', descriptionText);

  activity.setDetailWidgets([
    document.createTextNode('RefusalActivity TODO')
  ]);

  this.getDescription = delegateTo(activity, 'getDescription');
  this.appendTo = delegateTo(activity, 'appendTo');

  this.setData = function() {
     // TODO
  };
}
开发者ID:gurdiga,项目名称:xo,代码行数:15,代码来源:RefusalActivity.ts

示例10: TextFieldInput

export function TextFieldInput(value) {
  var domElement = createElement(value);
  WidgetRole.apply(this, [domElement]);

  this.getValue = delegateTo(domElement, 'value');

  this.setValue = function(value) {
    domElement.value = value;
  };

  this.focus = delegateTo(domElement, 'focus');

  this.precedeWith = function(elementToInsert) {
    domElement.parentNode.insertBefore(elementToInsert, domElement);
  };
}
开发者ID:gurdiga,项目名称:xo,代码行数:16,代码来源:TextFieldInput.ts


注:本文中的app/utils/delegateTo.delegateTo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。