當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。