本文整理汇总了TypeScript中@devexpress/dx-core.slice函数的典型用法代码示例。如果您正苦于以下问题:TypeScript slice函数的具体用法?TypeScript slice怎么用?TypeScript slice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slice函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: default
export default (
array: any[] | ReadonlyArray<any>,
compare: CompareFn = (a, b): number => {
if (a < b) return -1;
if (a > b) return 1;
return 0;
},
) => {
const result = slice(array);
const auxiliary = slice(array);
sortAuxiliaryToArray(result, auxiliary, 0, result.length - 1, compare);
return result;
};
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:13,代码来源:merge-sort.ts
示例2: Set
export const tableRowsWithEditing: TableRowsWithEditingFn = (
tableRows, editingRowIds, addedRows, rowHeight,
) => {
const rowIds = new Set(editingRowIds);
const editedTableRows = tableRows
.map(tableRow => (
tableRow.type === TABLE_DATA_TYPE && rowIds.has(tableRow.rowId!)
? {
...tableRow,
type: TABLE_EDIT_TYPE,
height: rowHeight,
}
: tableRow
));
const addedTableRows = addedRows
.map((row, rowIndex) => ({
row,
key: `${TABLE_ADDED_TYPE.toString()}_${rowIndex}`,
type: TABLE_ADDED_TYPE,
rowId: rowIndex,
height: rowHeight,
}));
return [
...slice(addedTableRows).reverse(),
...editedTableRows,
];
};
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:29,代码来源:computeds.ts
示例3: getFixedColumnKeys
export const calculateFixedColumnProps: CalculateFixedColumnPropsFn = (
{ tableColumn },
{ leftColumns, rightColumns },
tableColumns,
tableColumnDimensions,
tableHeaderColumnChains,
) => {
const side = tableColumn.fixed!;
const targetArray = side === FIXED_COLUMN_LEFT_SIDE
? getFixedColumnKeys(tableColumns, leftColumns)
: slice(getFixedColumnKeys(tableColumns, rightColumns)).reverse();
const index = tableColumns.findIndex(({ key }) => key === tableColumn.key);
const fixedIndex = targetArray.indexOf(tableColumn.key);
const columnChain = findChainByColumnIndex(tableHeaderColumnChains[0], index)!;
const showLeftDivider = columnChain.start === index && index !== 0;
const showRightDivider = columnChain.start + columnChain.columns.length - 1 === index
&& index < tableColumns.length - 1;
const position = calculatePosition(targetArray, fixedIndex, tableColumnDimensions);
return {
showRightDivider,
showLeftDivider,
position,
side,
};
};
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:29,代码来源:helpers.ts
示例4: slice
export const changeColumnOrder: PureReducer<ColumnOrder, ChangeColumnOrderPayload> = (
order, { sourceColumnName, targetColumnName },
) => {
const sourceColumnIndex = order.indexOf(sourceColumnName);
const targetColumnIndex = order.indexOf(targetColumnName);
const newOrder = slice(order);
newOrder.splice(sourceColumnIndex, 1);
newOrder.splice(targetColumnIndex, 0, sourceColumnName);
return newOrder;
};
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:11,代码来源:reducers.ts
示例5: slice
export const draftOrder: DraftOrderComputed = (order, sourceColumnIndex, targetColumnIndex) => {
if (sourceColumnIndex === -1
|| targetColumnIndex === -1
|| sourceColumnIndex === targetColumnIndex) {
return order;
}
const result = slice(order);
const sourceColumn = order[sourceColumnIndex];
result.splice(sourceColumnIndex, 1);
result.splice(targetColumnIndex, 0, sourceColumn);
return result;
};
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:14,代码来源:computeds.ts
注:本文中的@devexpress/dx-core.slice函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论