Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/fs 0.13.0 #434

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,844 changes: 1,857 additions & 987 deletions packages/vtable/examples/pivot-chart/aeolus.ts

Large diffs are not rendered by default.

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
8 changes: 4 additions & 4 deletions packages/vtable/src/components/axis/get-axis-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ const DEFAULT_TITLE_STYLE = {
angle: {}
};

const DEFAULT_TEXT_FONT_FAMILY =
export const DEFAULT_TEXT_FONT_FAMILY =
// eslint-disable-next-line max-len
'PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol';

const DEFAULT_TEXT_FONT_SIZE = 14;
export const DEFAULT_TEXT_FONT_SIZE = 14;

const THEME_CONSTANTS = {
FONT_FAMILY: DEFAULT_TEXT_FONT_FAMILY,
Expand Down Expand Up @@ -96,8 +96,8 @@ export const commonAxis = {
};

export function getAxisAttributes(option: ICellAxisOption) {
// const spec = merge({}, option, commonAxis);
const spec = option;
const spec = merge({}, option);
// const spec = option;
let titleAngle = spec.title?.angle ?? 0;
let titleTextStyle;
if (spec.orient === 'left' || spec.orient === 'right') {
Expand Down
38 changes: 19 additions & 19 deletions packages/vtable/src/components/axis/get-axis-component-size.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isArray, merge } from '@visactor/vutils';
import type { BaseTableAPI } from '../../ts-types/base-table';
import type { ICellAxisOption } from '../../ts-types/component/axis';
import { commonAxis } from './get-axis-attributes';
import { DEFAULT_TEXT_FONT_FAMILY, DEFAULT_TEXT_FONT_SIZE, commonAxis } from './get-axis-attributes';

/**
* @description: compuational vertical axis width
Expand All @@ -26,9 +26,9 @@ export function computeAxisComponentWidth(config: ICellAxisOption, table: BaseTa
text = attribute.label.formatMethod(text);
}
const { width, height } = table.measureText(text, {
fontSize: attribute.label?.style?.fontSize,
fontWeight: attribute.label?.style?.fontWeight,
fontFamily: attribute.label?.style?.fontFamily
fontSize: attribute.label?.style?.fontSize ?? DEFAULT_TEXT_FONT_SIZE,
fontWeight: attribute.label?.style?.fontWeight ?? 'normal',
fontFamily: attribute.label?.style?.fontFamily ?? DEFAULT_TEXT_FONT_FAMILY
});
const widthLimit = attribute.label?.style?.maxLineWidth || Infinity;
const angel =
Expand All @@ -54,9 +54,9 @@ export function computeAxisComponentWidth(config: ICellAxisOption, table: BaseTa
text = attribute.label.formatMethod(text);
}
const { width, height } = table.measureText(text, {
fontSize: attribute.label?.style?.fontSize,
fontWeight: attribute.label?.style?.fontWeight,
fontFamily: attribute.label?.style?.fontFamily
fontSize: attribute.label?.style?.fontSize ?? DEFAULT_TEXT_FONT_SIZE,
fontWeight: attribute.label?.style?.fontWeight ?? 'normal',
fontFamily: attribute.label?.style?.fontFamily ?? DEFAULT_TEXT_FONT_FAMILY
});
const widthLimit = attribute.label?.style?.maxLineWidth || Infinity;
const angle =
Expand All @@ -71,9 +71,9 @@ export function computeAxisComponentWidth(config: ICellAxisOption, table: BaseTa
let titleWidth = 0;
if (attribute.title.visible && attribute.title.text) {
const { width, height } = table.measureText(attribute.title.text, {
fontSize: attribute.title?.style?.fontSize,
fontWeight: attribute.title?.style?.fontWeight,
fontFamily: attribute.title?.style?.fontFamily
fontSize: attribute.title?.style?.fontSize ?? DEFAULT_TEXT_FONT_SIZE,
fontWeight: attribute.title?.style?.fontWeight ?? 'normal',
fontFamily: attribute.title?.style?.fontFamily ?? DEFAULT_TEXT_FONT_FAMILY
});
const widthLimit = attribute.label?.style?.maxLineWidth || Infinity;
const size = getSizeAfterResize(Math.min(width, widthLimit), height, attribute.title?.style?.angle);
Expand Down Expand Up @@ -111,9 +111,9 @@ export function computeAxisComponentHeight(config: ICellAxisOption, table: BaseT
text = attribute.label.formatMethod(text);
}
const { width, height } = table.measureText(text, {
fontSize: attribute.label?.style?.fontSize,
fontWeight: attribute.label?.style?.fontWeight,
fontFamily: attribute.label?.style?.fontFamily
fontSize: attribute.label?.style?.fontSize ?? DEFAULT_TEXT_FONT_SIZE,
fontWeight: attribute.label?.style?.fontWeight ?? 'normal',
fontFamily: attribute.label?.style?.fontFamily ?? DEFAULT_TEXT_FONT_FAMILY
});
const widthLimit = attribute.label?.style?.maxLineWidth || Infinity;
const angle =
Expand All @@ -139,9 +139,9 @@ export function computeAxisComponentHeight(config: ICellAxisOption, table: BaseT
text = attribute.label.formatMethod(text);
}
const { width, height } = table.measureText(text, {
fontSize: attribute.label?.style?.fontSize,
fontWeight: attribute.label?.style?.fontWeight,
fontFamily: attribute.label?.style?.fontFamily
fontSize: attribute.label?.style?.fontSize ?? DEFAULT_TEXT_FONT_SIZE,
fontWeight: attribute.label?.style?.fontWeight ?? 'normal',
fontFamily: attribute.label?.style?.fontFamily ?? DEFAULT_TEXT_FONT_FAMILY
});
const widthLimit = attribute.label?.style?.maxLineWidth || Infinity;
const angle =
Expand All @@ -156,9 +156,9 @@ export function computeAxisComponentHeight(config: ICellAxisOption, table: BaseT
let titleHeight = 0;
if (attribute.title.visible && attribute.title.text) {
const { width, height } = table.measureText(attribute.title.text, {
fontSize: attribute.title?.style?.fontSize,
fontWeight: attribute.title?.style?.fontWeight,
fontFamily: attribute.title?.style?.fontFamily
fontSize: attribute.title?.style?.fontSize ?? DEFAULT_TEXT_FONT_SIZE,
fontWeight: attribute.title?.style?.fontWeight ?? 'normal',
fontFamily: attribute.title?.style?.fontFamily ?? DEFAULT_TEXT_FONT_FAMILY
});
const widthLimit = attribute.label?.style?.maxLineWidth || Infinity;
const size = getSizeAfterResize(Math.min(width, widthLimit), height, attribute.title?.style?.angle);
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
Loading