當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Merger.deepMerge方法代碼示例

本文整理匯總了TypeScript中@ephox/katamari.Merger.deepMerge方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Merger.deepMerge方法的具體用法?TypeScript Merger.deepMerge怎麽用?TypeScript Merger.deepMerge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ephox/katamari.Merger的用法示例。


在下文中一共展示了Merger.deepMerge方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

const getFromExpandingItem = function (item) {
  const newItem = Merger.deepMerge(
    Objects.exclude(item, [ 'items' ]),
    {
      menu: true
    }
  );

  const rest = expand(item.items);

  const newMenus = Merger.deepMerge(
    rest.menus,
    Objects.wrap(
      item.title,
      rest.items
    )
  );
  const newExpansions = Merger.deepMerge(
    rest.expansions,
    Objects.wrap(item.title, item.title)
  );

  return {
    item: newItem,
    menus: newMenus,
    expansions: newExpansions
  };
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:28,代碼來源:StyleConversions.ts

示例2:

const renderCommonSpec = (spec, actionOpt, extraBehaviours = [], dom, components) => {
  const action = actionOpt.fold(() => {
    return {};
  }, (action) => {
    return {
      action
    };
  });

  const common = {
    buttonBehaviours: Behaviour.derive([
      DisablingConfigs.button(spec.disabled),
      Tabstopping.config({}),
      AddEventsBehaviour.config('button press', [
        AlloyEvents.preventDefault('click'),
        AlloyEvents.preventDefault('mousedown')
      ])
    ].concat(extraBehaviours)),
    eventOrder: {
      click: ['button press', 'alloy.base.behaviour'],
      mousedown: ['button press', 'alloy.base.behaviour']
    },
    ...action
  };
  const domFinal = Merger.deepMerge(common, { dom });
  return Merger.deepMerge(domFinal, { components });
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:27,代碼來源:Button.ts

示例3: generateValueIfRequired

 return Arr.foldr(realItems, (acc, item) => {
   const itemWithValue = generateValueIfRequired(item);
   const newData = getFromItem(itemWithValue, menuItems);
   return {
     menus: Merger.deepMerge(acc.menus, newData.menus),
     items: [ newData.item ].concat(acc.items),
     expansions: Merger.deepMerge(acc.expansions, newData.expansions)
   };
 }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:MenuConversion.ts

示例4: function

const convert = function (formats, memMenuThunk) {
  const mainMenu = makeMenu('Styles', [
  ].concat(
    Arr.map(formats.items, function (k) {
      return makeItem(getValue(k), k.title, k.isSelected(), k.getPreview(), Objects.hasKey(formats.expansions, getValue(k)));
    })
  ), memMenuThunk, false);

  const submenus = Obj.map(formats.menus, function (menuItems, menuName) {
    const items = Arr.map(menuItems, function (item) {
      return makeItem(
        getValue(item),
        item.title,
        item.isSelected !== undefined ? item.isSelected() : false,
        item.getPreview !== undefined ? item.getPreview() : '',
        Objects.hasKey(formats.expansions, getValue(item))
      );
    });
    return makeMenu(menuName, items, memMenuThunk, true);
  });

  const menus = Merger.deepMerge(submenus, Objects.wrap('styles', mainMenu));

  const tmenu = TieredMenu.tieredData('styles', menus, formats.expansions);

  return {
    tmenu
  };
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:29,代碼來源:StylesMenu.ts

示例5: createPartialChoiceMenu

 }).map((items) => {
   return Option.from(createTieredDataFrom(
     Merger.deepMerge(
       createPartialChoiceMenu(
         Id.generate('menu-value'),
         items,
         (value) => {
           spec.onItemAction(getApi(comp), value);
         },
         spec.columns,
         spec.presets,
         ItemResponse.CLOSE_ON_EXECUTE,
         spec.select.getOr(() => false),
         providersBackstage
       ),
       {
         movement: deriveMenuMovement(spec.columns, spec.presets),
         menuBehaviours: SimpleBehaviours.unnamedEvents(spec.columns !== 'auto' ? [ ] : [
           AlloyEvents.runOnAttached((comp, se) => {
             detectSize(comp, 4, classForPreset(spec.presets)).each(({ numRows, numColumns }) => {
               Keying.setGridSize(comp, numRows, numColumns);
             });
           })
         ])
       } as TieredMenuTypes.PartialMenuSpec
     )
   ));
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:28,代碼來源:ToolbarButtons.ts

示例6: toValidValues

 const updateDataWithForm = (form: AlloyComponent): void => {
   const formData = Representing.getValue(form);
   const validData = toValidValues(formData).getOr({ });
   const currentData = storedValue.get();
   const newData = Merger.deepMerge(currentData, validData);
   storedValue.set(newData);
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:TabPanel.ts

示例7:

 const getAnchor = (position: Toolbar.ContextToolbarPosition, element: Option<Element>) => {
   const anchorage = position === 'node' ? extras.backstage.shared.anchors.node(element) : extras.backstage.shared.anchors.cursor();
   const anchor = Merger.deepMerge(
     anchorage,
     position === 'line' ? lineAnchorSpec : anchorSpec
   );
   return anchor;
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:8,代碼來源:ContextToolbar.ts

示例8: isSelectedFor

const processBasic = (item: { format: string }, isSelectedFor, getPreviewFor): FormatItem => {
  const formatterSpec: Partial<FormatItem> = {
    type: 'formatter',
    isSelected: isSelectedFor(item.format),
    getStylePreview: getPreviewFor(item.format)
  };
  return Merger.deepMerge(item, formatterSpec);
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:8,代碼來源:FormatRegister.ts

示例9: next

  return Step.stateful(function (value, next, die) {
    const style = Element.fromTag('style');
    const head = Element.fromDom(doc.dom().head);
    Insert.append(head, style);
    Html.set(style, styles.join('\n'));

    next(Merger.deepMerge(value, {
      style
    }));
  });
開發者ID:abstask,項目名稱:tinymce,代碼行數:10,代碼來源:GuiSetup.ts


注:本文中的@ephox/katamari.Merger.deepMerge方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。