本文整理汇总了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
};
};
示例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 });
};
示例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)
};
}, {
示例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
};
};
示例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
)
));
});
示例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);
};
示例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;
};
示例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);
};
示例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
}));
});