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


TypeScript PureComputed.default方法代碼示例

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


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

示例1: calculateInsideOffset

export const timeBoundariesByDrag: TimeBoundariesByDrag = (
  payload, targetData, targetType,
  cellDurationMinutes, insidePart, offsetTimeTopBase,
) => {
  let offsetTimeTop;
  let appointmentStartTime;
  let appointmentEndTime;

  const insideOffset = calculateInsideOffset(targetType, insidePart, cellDurationMinutes);
  const start = moment(targetData.startDate as Date).add(insideOffset, SECONDS);

  if (offsetTimeTopBase === null) {
    offsetTimeTop = moment(targetData.startDate as Date)
      .diff(payload.startDate as Date, SECONDS) + insideOffset;
  } else {
    offsetTimeTop = offsetTimeTopBase;
  }

  if (payload.type === targetType) {
    const appointmentDurationSeconds = intervalDuration(payload, SECONDS);
    appointmentStartTime = moment(start).add((offsetTimeTop) * (-1), SECONDS).toDate();
    appointmentEndTime = moment(start)
      .add((appointmentDurationSeconds - offsetTimeTop), SECONDS).toDate();
  } else {
    appointmentStartTime = moment(targetData.startDate as Date)
      .add(insideOffset, SECONDS).toDate();
    appointmentEndTime = moment(targetData.endDate as Date).add(insideOffset, SECONDS).toDate();
  }

  return { appointmentStartTime, appointmentEndTime, offsetTimeTop };
};
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:31,代碼來源:helpers.ts

示例2: rectCalculatorBase

> = (
  appointment,
  {
    rectByDates,
    multiline,
    rectByDatesMeta: {
      cellElements,
      viewCellsData,
    },
  },
) => {
  const {
    top, left,
    width, height, parentWidth,
  } = rectCalculatorBase(
    appointment,
    rectByDates,
    {
      multiline,
      cellElements,
      viewCellsData,
    },
  );

  return {
    top: top + ((height / appointment.reduceValue) * appointment.offset),
    height: height / appointment.reduceValue,
    left: toPercentage(left, parentWidth),
    width: toPercentage(width, parentWidth),
    dataItem: appointment.dataItem,
    fromPrev: appointment.fromPrev,
    toNext: appointment.toNext,
    type: HORIZONTAL_TYPE,
  };
};
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:35,代碼來源:utils.ts

示例3: pluckSubarray

export const mergeRows: MergeRowsFn = (
  rowsInterval, cacheInterval, rows, cacheRows, rowsStart, cacheStart,
) => {
  const breakpoints = [
    rowsInterval.start, rowsInterval.end,
    cacheInterval.start, cacheInterval.end,
  ]
    .filter(i => 0 <= i && i < Number.POSITIVE_INFINITY)
    .sort((a, b) => a - b);

  let result: Row[] = [];
  if (breakpoints.length > 1) {
    for (let i = 0; i < breakpoints.length - 1; i += 1) {
      const left = breakpoints[i];
      const right = breakpoints[i + 1];
      const chunk = rowsInterval.start <= left && right <= rowsInterval.end
        ? pluckSubarray(rows, rowsStart, left, right) // rows have higher priority
        : pluckSubarray(cacheRows, cacheStart, left, right);

      result = result.concat(chunk);
    }
  }

  return {
    skip: breakpoints[0],
    rows: result,
  };
};
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:28,代碼來源:helpers.ts

示例4: calculateTextByDays

export const viewBoundText: ViewBoundTextFn = (
  startViewDate, endViewDate, step, currentDate, intervalCount, formatDate,
) => (
  step !== 'month'
    ? calculateTextByDays(startViewDate, endViewDate, formatDate)
    : calculateTextByMonths(currentDate, intervalCount, formatDate)
);
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:7,代碼來源:helpers.ts

示例5: getColumnBoundaries

export const getCollapsedGrids: GetCollapsedGridsFn = ({
    headerRows = [],
    bodyRows = [],
    footerRows = [],
    columns,
    loadedRowsStart,
    totalRowCount,
    getCellColSpan,
    viewportLeft,
    containerWidth,
    visibleRowBoundaries,
    getColumnWidth,
    getRowHeight,
  },
) => {
  const getColSpan = (
    tableRow: any, tableColumn: any,
  ) => getCellColSpan!({ tableRow, tableColumn, tableColumns: columns });

  const columnBoundaries = getColumnBoundaries(
    columns, viewportLeft, containerWidth, getColumnWidth,
  );
  const getCollapsedGridBlock: PureComputed<
    [any[], any[]?, number?, number?], CollapsedGrid
  > = (
    rows, rowsVisibleBoundary, rowCount = rows.length, offset = 0,
  ) => getCollapsedGrid({
    rows,
    columns,
    rowsVisibleBoundary,
    columnsVisibleBoundary: columnBoundaries,
    getColumnWidth,
    getRowHeight,
    getColSpan,
    totalRowCount: rowCount,
    offset,
  });

  const headerGrid = getCollapsedGridBlock(
    headerRows, getRenderRowBounds(visibleRowBoundaries.header, headerRows.length),
  );
  const bodyGrid = getCollapsedGridBlock(
    bodyRows,
    adjustedRenderRowBounds(
      visibleRowBoundaries.body, bodyRows.length, loadedRowsStart,
    ),
    totalRowCount || 1,
    loadedRowsStart,
  );
  const footerGrid = getCollapsedGridBlock(
    footerRows, getRenderRowBounds(visibleRowBoundaries.footer, footerRows.length),
  );

  return {
    headerGrid,
    bodyGrid,
    footerGrid,
  };
};
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:59,代碼來源:virtual-table.ts

示例6: clamp

> = (timeTableCells, clientOffset) => timeTableCells.findIndex((timeTableCell) => {
  const {
    left, top,
    right, bottom,
  } = timeTableCell.getBoundingClientRect();
  const isOver = clientOffset
      && clamp(clientOffset.x, left, right) === clientOffset.x
      && clamp(clientOffset.y, top, bottom) === clientOffset.y;
  return isOver;
});
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:10,代碼來源:helpers.ts

示例7: isOnTheSameLine

    .findIndex((geometry, index) => {
      const inVerticalBounds = isOnTheSameLine(geometry, y);
      const inHorizontalBounds = x >= geometry.left && x <= geometry.right;
      const shouldGoFirst = index === 0 && x < geometry.left;
      const shouldGoOnLineBreak = !inVerticalBounds
        && !!geometries[index - 1]
        && isOnTheSameLine(geometries[index - 1], y);

      return (inVerticalBounds && inHorizontalBounds)
        || shouldGoFirst
        || shouldGoOnLineBreak;
    });
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:12,代碼來源:group-panel.ts

示例8: unwrapGroups

export const calculateRectByDateIntervals: CalculateRectByDateIntervalsFn = (
  type, intervals, rectByDates, rectByDatesMeta,
) => {
  const { growDirection, multiline } = type;
  const sorted = sortAppointments(intervals, multiline);
  const grouped = findOverlappedAppointments(sorted as AppointmentMoment[], multiline);

  const rectCalculator = growDirection === HORIZONTAL_TYPE
    ? horizontalRectCalculator
    : verticalRectCalculator;

  return unwrapGroups(adjustAppointments(grouped, multiline))
    .map(appointment => rectCalculator(appointment, { rectByDates, multiline, rectByDatesMeta }));
};
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:14,代碼來源:utils.ts

示例9: mergeSort

export const sortedRows: SortedRowsFn = (
  rows, sorting, getCellValue, getColumnCompare, isGroupRow, getRowLevelKey,
) => {
  if (!sorting.length || !rows.length) return rows;

  let compare;
  if (!getRowLevelKey) {
    compare = createCompare(sorting, getColumnCompare, getCellValue);
    return mergeSort(rows.slice(), compare);
  }

  compare = createCompare(sorting, getColumnCompare, (row, columnName) => {
    if (isGroupRow && isGroupRow(row)) {
      if (row.groupedBy === columnName) {
        return row.value;
      }
      return undefined;
    }
    return getCellValue(row, columnName);
  });
  return sortHierarchicalRows(
    rows,
    compare,
    getRowLevelKey,
  );
};
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:26,代碼來源:computeds.ts

示例10: warnIfRowIdUndefined

export const rowIdGetter: PureComputed<[GetRowIdFn, Row[]]> = (getRowId, rows) => {
  if (!getRowId) {
    const map = new Map(rows.map((row, rowIndex) => [row, rowIndex]) as [any, number]);
    return (row: Row) => map.get(row) as RowId;
  }
  return warnIfRowIdUndefined(getRowId);
};
開發者ID:MaximKudriavtsev,項目名稱:devextreme-reactive,代碼行數:7,代碼來源:computeds.ts


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