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


TypeScript Section.appendWidgets方法代码示例

本文整理汇总了TypeScript中app/widgets/Section.Section.appendWidgets方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Section.appendWidgets方法的具体用法?TypeScript Section.appendWidgets怎么用?TypeScript Section.appendWidgets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app/widgets/Section.Section的用法示例。


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

示例1: ActivitiesSection

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

  var activityListContainer = createActivityListContainer();
  var addActivityButton = createAddActivityButton(addActivity);

  var section = new Section('AcĹŁiuni procedurale');

  section.appendWidgets([
    activityListContainer,
    addActivityButton
  ]);

  section.appendTo(domElement);

  this.setActivities = function(activitiesArray) {
    activitiesArray.forEach(addActivityFromData);
  };

  function addActivityFromData(activityData) {
    var ActivityWidgetClass = ActivityWidgetClasses[activityData.widgetClassName];
    var activityWidget = ActivityWidgetClass.createWithData(activityData);

    addActivity(activityWidget);
  }

  function addActivity(activityWidget) {
    activityWidget.appendTo(activityListContainer);
  }
}
开发者ID:gurdiga,项目名称:xo,代码行数:31,代码来源:ActivitiesSection.ts

示例2: createSection

function createSection(childWidgets) {
  var labelText = 'Cerere de intentare';
  var section = new Section(labelText);

  section.appendWidgets(childWidgets);

  return section;
}
开发者ID:gurdiga,项目名称:xo,代码行数:8,代码来源:InquirySection.ts

示例3: PersonSection

export function PersonSection(labelText, fieldValues) {
  fieldValues = fieldValues || {};

  var domElement = createElement();
  WidgetRole.apply(this, [domElement]);

  var personTypeField = createPersonTypeField(fieldValues);
  var personTypeSpecificFields = createPersonTypeSpecificFields(fieldValues);
  personTypeField.onChange(renderPersonTypeSpecificFields);

  var section = new Section(labelText);
  section.appendWidgets(getAllFields());
  section.appendTo(domElement);

  this.makeRemovable = function(onRemoveCallback) {
    var buttonStyle = {
      top: '10px',
      fontSize: '20px',
      color: 'black'
    };

    makeRemovable(domElement, onRemoveCallback, buttonStyle);
    hideRemoveButtonUnlessOver();
  };

  this.getValue = getFieldValueCollector(getAllFields);

  function getAllFields() {
    return [personTypeField].concat(personTypeSpecificFields);
  }

  function renderPersonTypeSpecificFields(personType) {
    personTypeSpecificFields.forEach(removeField);
    fieldValues[PERSON_TYPE_INTERNAL_NAME] = personType;
    personTypeSpecificFields = createPersonTypeSpecificFields(fieldValues);
    section.appendWidgets(personTypeSpecificFields);
    personTypeSpecificFields[0].focus();
  }

  function hideRemoveButtonUnlessOver() {
    var removeButton = domElement.querySelector('button[type="remove"]');
    var initialOpacity = removeButton.style.opacity;
    removeButton.style.opacity = '0';

    domElement.addEventListener('mouseenter', function() {
      removeButton.style.opacity = initialOpacity;
    });

    domElement.addEventListener('mouseleave', function() {
      removeButton.style.opacity = '0';
    });
  }
}
开发者ID:gurdiga,项目名称:xo,代码行数:53,代码来源:PersonSection.ts

示例4: SentenceSection

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

  var fields = createFields(fieldValues);
  var section = new Section('Document executoriu');

  section.appendWidgets(fields);
  section.appendTo(domElement);

  this.getValue = getFieldValueCollector(fields);
}
开发者ID:gurdiga,项目名称:xo,代码行数:12,代码来源:SentenceSection.ts


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