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


TypeScript dx-core.slice函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。