本文整理匯總了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
}));
});