Skip to content

Commit

Permalink
feat: use @visactor/vutils
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Oct 20, 2023
1 parent 2b1101e commit 9b4ecc5
Show file tree
Hide file tree
Showing 24 changed files with 25 additions and 31 deletions.
2 changes: 1 addition & 1 deletion packages/vtable/src/ListTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {
} from './ts-types';
import { HierarchyState } from './ts-types';
import { SimpleHeaderLayoutMap } from './layout';
import { isValid } from './tools/util';
import { isValid } from '@visactor/vutils';
import { _setDataSource } from './core/tableHelper';
import { BaseTable } from './core';
import type { ListTableProtected } from './ts-types/base-table';
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/body-helper/style.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isValid } from '../tools/util';
import { isValid } from '@visactor/vutils';
import type {
ColumnStyle,
ColumnStyleOption,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createElement } from '../../../../tools/dom';
import { importStyle } from './MenuElementStyle';
import { TABLE_EVENT_TYPE } from '../../../../core/TABLE_EVENT_TYPE';
import { cellInRange } from '../../../../tools/helper';
import { isValid } from '../../../../tools/util';
import { isValid } from '@visactor/vutils';
import type { PivotHeaderLayoutMap } from '../../../../layout/pivot-header-layout';
import { regUrl } from '../../../../tools/global';
import type { BaseTableAPI } from '../../../../ts-types/base-table';
Expand Down
5 changes: 2 additions & 3 deletions packages/vtable/src/core/BaseTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as columnStyleContents from '../body-helper/style';
import * as headerStyleContents from '../header-helper/style';
import { importStyle } from './style';
import * as style from '../tools/style';
import { AABBBounds, isNumber } from '@visactor/vutils';
import {
type CellAddress,
type CellRange,
Expand Down Expand Up @@ -47,7 +46,7 @@ import { EventTarget } from '../event/EventTarget';
import { NumberMap } from '../tools/NumberMap';
import { Rect } from '../tools/Rect';
import type { TableTheme } from '../themes/theme';
import { defaultOrderFn, isValid, throttle2 } from '../tools/util';
import { defaultOrderFn, throttle2 } from '../tools/util';
import themes from '../themes';
import { Env } from '../tools/env';
import { Scenegraph } from '../scenegraph/scenegraph';
Expand All @@ -58,7 +57,7 @@ import { HeaderHelper } from '../header-helper/header-helper';
import type { PivotHeaderLayoutMap } from '../layout/pivot-header-layout';
import { TooltipHandler } from '../components/tooltip/TooltipHandler';
import type { CachedDataSource, DataSource } from '../data';
import { isBoolean, isFunction, type ITextSize } from '@visactor/vutils';
import { AABBBounds, isNumber, isBoolean, isFunction, type ITextSize, isValid } from '@visactor/vutils';
import { textMeasure } from '../scenegraph/utils/text-measure';
import { getProp } from '../scenegraph/utils/get-prop';
import type {
Expand Down
3 changes: 2 additions & 1 deletion packages/vtable/src/data/DataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import type {
import { HierarchyState } from '../ts-types';
import { applyChainSafe, getOrApply, obj, isPromise, emptyFn } from '../tools/helper';
import { EventTarget } from '../event/EventTarget';
import { getValueByPath, isValid } from '../tools/util';
import { getValueByPath } from '../tools/util';
import { diffCellIndices } from '../tools/diff-cell';
import { isValid } from '@visactor/vutils';

/**
* 判断字段数据是否为访问器的格式
Expand Down
1 change: 0 additions & 1 deletion packages/vtable/src/dataset/dataset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { isArray } from '@visactor/vutils';
import { isValid } from '../tools/util';
import type {
FilterRules,
IDataConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/event/EventTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
TableEventHandlersEventArgumentMap,
TableEventHandlersReturnMap
} from '../ts-types';
import { isValid } from '../tools/util';
import { isValid } from '@visactor/vutils';

let idCount = 1;

Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/header-helper/style.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isValid } from '../tools/util';
import { isValid } from '@visactor/vutils';
import type { FullExtendStyle, HeaderStyleOption, StylePropertyFunctionArg } from '../ts-types';
import { TextHeaderStyle } from './style/MultilineTextHeaderStyle';
// import { SortHeaderStyle } from "./style/SortHeaderStyle";
Expand Down
4 changes: 2 additions & 2 deletions packages/vtable/src/layout/pivot-header-layout.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable sort-imports */
import { isValid, transpose } from '../tools/util';
import { transpose } from '../tools/util';
import type {
CellAddress,
CellRange,
Expand Down Expand Up @@ -35,7 +35,7 @@ import { getChartAxes, getChartDataId, getChartSpec, getRawChartSpec } from './c
import type { IPivotLayoutHeadNode } from './pivot-layout-helper';
import { DimensionTree } from './pivot-layout-helper';
import type { Dataset } from '../dataset/dataset';
import { cloneDeep, isArray } from '@visactor/vutils';
import { cloneDeep, isArray, isValid } from '@visactor/vutils';
import type { TextStyle } from '../body-helper/style';
import type { ITableAxisOption } from '../ts-types/component/axis';
import { getQuadProps } from '../scenegraph/utils/padding';
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/layout/simple-header-layout.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable sort-imports */
import { isValid } from '@visactor/vutils';
import type { ListTable } from '../ListTable';
import { DefaultSparklineSpec } from '../tools/global';
import { isValid } from '../tools/util';
import type { CellAddress, CellRange, CellLocation, IListTableCellHeaderPaths, LayoutObjectId } from '../ts-types';
import type { ColumnsDefine, TextColumnDefine } from '../ts-types/list-table/define';
import type {
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/render/layout/container.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNumber } from '../../tools/util';
import { isNumber } from '@visactor/vutils';
import type { BaseTableAPI } from '../../ts-types/base-table';
import type { DirectionKey } from './direction';
import { DIRECTION_KEY } from './direction';
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/render/layout/icon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isString } from '../../tools/util';
import { isString } from '@visactor/vutils';
import type { ElementOptions } from './element';
import { BaseElement } from './element';
import * as registerIcons from '../../icons';
Expand Down
2 changes: 0 additions & 2 deletions packages/vtable/src/render/layout/image.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { isString } from '../../tools/util';
import type { ElementOptions } from './element';
import { BaseElement } from './element';
import * as registerIcons from '../../icons';
import type { ColumnIconOption } from '../../ts-types';

type ImageOptions = {
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/scenegraph/component/custom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Cursor } from '@visactor/vrender';
import { createArc, createCircle, createLine, createRect, Group as VGroup } from '@visactor/vrender';
import { isFunction, isString, isValid } from '../../tools/util';
import { isFunction, isString, isValid } from '@visactor/vutils';
import type { ICustomLayout, ICustomRender, ICustomRenderElement, ICustomRenderElements } from '../../ts-types';
import { Group } from '../graphic/group';
import { Icon } from '../graphic/icon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { IStage } from '@visactor/vrender';
import { isValid } from '../../../tools/util';
import type { Chart } from '../chart';
import { Bounds } from '@visactor/vutils';
import { Bounds, isValid } from '@visactor/vutils';
export const cancelRenderChartQueue = false;
export const chartRenderKeys: string[] = [];
export const chartRenderQueueList: Chart[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Group } from '../../graphic/group';
import { Chart } from '../../graphic/chart';
import * as registerChartTypes from '../../../chartModule';
import { getFunctionalProp } from '../../utils/get-prop';
import { isValid } from '../../../tools/util';
import { isValid } from '@visactor/vutils';
import type { BaseTableAPI } from '../../../ts-types/base-table';
import type { IThemeSpec } from '@visactor/vrender';
export function createChartCellGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { calcKeepAspectRatioSize } from '../../utils/keep-aspect-ratio';
import { calcStartPosition } from '../../utils/cell-pos';
import type { Scenegraph } from '../../scenegraph';
import { getProp, getFunctionalProp } from '../../utils/get-prop';
import { isValid } from '../../../tools/util';
import { isValid } from '@visactor/vutils';
import { getQuadProps } from '../../utils/padding';

const regedIcons = icons.get();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ILine, ISymbol, IThemeSpec } from '@visactor/vrender';
import { createLine, createSymbol } from '@visactor/vrender';
import { PointScale, LinearScale } from '@visactor/vscale';
import { isValid } from '../../../tools/util';
import { isValid } from '@visactor/vutils';
import { Group } from '../../graphic/group';
import type { CellInfo, SparklineSpec } from '../../../ts-types';
import type { BaseTableAPI } from '../../../ts-types/base-table';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-undef */
import type { IThemeSpec } from '@visactor/vrender';
import { createArc } from '@visactor/vrender';
import { isValid } from '../../../tools/util';
import { isValid } from '@visactor/vutils';
import { Group } from '../../graphic/group';
// import { parseFont } from '../../utils/font';
import { getFunctionalProp } from '../../utils/get-prop';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Icon } from '../../graphic/icon';
import { calcStartPosition } from '../../utils/cell-pos';
import { _adjustWidthHeight } from './image-cell';
import { getFunctionalProp, getProp } from '../../utils/get-prop';
import { isValid } from '../../../tools/util';
import { isValid } from '@visactor/vutils';
import type { BaseTableAPI } from '../../../ts-types/base-table';

const regedIcons = icons.get();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { isValid } from '../../../../tools/util';
import type { Group } from '../../../graphic/group';
import { computeRowsHeight } from '../../../layout/compute-row-height';
import type { SceneProxy } from '../proxy';
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/scenegraph/utils/get-prop.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isValid } from '../../tools/util';
import { isValid } from '@visactor/vutils';
import type { StylePropertyFunctionArg } from '../../ts-types';
import type { BaseTableAPI } from '../../ts-types/base-table';

Expand Down
5 changes: 2 additions & 3 deletions packages/vtable/src/state/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ import type { ListTable } from '../ListTable';
import { PIVOT_TABLE_EVENT_TYPE } from '../ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE';
import type { PivotHeaderLayoutMap } from '../layout/pivot-header-layout';
import { TABLE_EVENT_TYPE } from '../core/TABLE_EVENT_TYPE';
import { Bounds } from '@visactor/vutils';
import { Bounds, isObject, isString, isValid } from '@visactor/vutils';
import { updateDrill } from './drill';
import { clearChartHover, updateChartHover } from './spark-line';
import { endMoveCol, startMoveCol, updateMoveCol } from './cell-move';
import type { FederatedEvent } from '@visactor/vrender';
import type { TooltipOptions } from '../ts-types/tooltip';
import { getIconAndPositionFromTarget } from '../scenegraph/utils/icon';
import type { BaseTableAPI } from '../ts-types/base-table';
import { isObject, isString, isValid } from '../tools/util';
import { debounce } from '../tools/debounce';
import { updateResizeColumn } from './resize/update-resize-column';

Expand Down Expand Up @@ -791,7 +790,7 @@ export class StateManeger {
if (dropDownMenu) {
for (let i = 0; i < dropDownMenu.length; i++) {
const item: any = dropDownMenu[i];
if (isObject(item) && (item.menuKey || item.text) === (menuKey || '') && i === index) {
if (isObject(item) && ((item as any).menuKey || (item as any).text) === (menuKey || '') && i === index) {
// return i === index;
return true;
} else if (isString(item) && item === menuKey && i === index) {
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/tools/NumberMap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isValid } from '../tools/util';
import { isValid } from '@visactor/vutils';

const indexFirst = (arr: number[], elm: number): number => {
let low = 0;
Expand Down

0 comments on commit 9b4ecc5

Please sign in to comment.