@alitajs/f2
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -21,5 +21,10 @@ import { defineConfig } from 'dumi'; | ||
}, | ||
outputPath: 'doc_dist', | ||
sitemap: { | ||
hostname: 'https://f2.alitajs.com', | ||
}, | ||
// 用于替换 __VERSION__ pkg.version | ||
extraBabelPlugins: ['version'], | ||
scripts: [ | ||
`https://cdn.jsdelivr.net/gh/alitajs/autoTouchemulator@1.0.0/dist/index.umd.min.js`, | ||
], | ||
}); |
import React from 'react'; | ||
import { Chart as F2Chart, AnimateChartParams } from '@antv/f2'; | ||
export interface AnimateProps extends AnimateChartParams { | ||
import { Chart as F2Chart, AnimateChartParams, AnimateConfig } from '@antv/f2'; | ||
export interface AnimateProps extends AnimateConfig, AnimateChartParams { | ||
chart: F2Chart; | ||
@@ -5,0 +5,0 @@ /** |
@@ -7,2 +7,3 @@ import React from 'react'; | ||
* 当 enable 为 false 时,关闭 field 对应的坐标轴。 | ||
* @default true | ||
*/ | ||
@@ -14,5 +15,8 @@ enable?: boolean; | ||
disable?: boolean; | ||
[key: string]: any; | ||
/** | ||
* 代表坐标轴对应的数据字段名 | ||
*/ | ||
field?: string; | ||
} | ||
declare const _default: React.ForwardRefExoticComponent<Pick<AxisProps, React.ReactText> & React.RefAttributes<AxisProps>>; | ||
declare const _default: React.ForwardRefExoticComponent<AxisProps & React.RefAttributes<AxisProps>>; | ||
export default _default; |
@@ -18,6 +18,2 @@ import React from 'react'; | ||
style?: React.HTMLAttributes<HTMLDivElement>['style']; | ||
/** | ||
* @todo 补全所有的内部属性后去除该项 | ||
*/ | ||
[key: string]: any; | ||
} | ||
@@ -32,3 +28,3 @@ export declare type ChartChildRenderProps = { | ||
}; | ||
declare const Chart: React.ForwardRefExoticComponent<Pick<(ChartProps & { | ||
declare const Chart: React.ForwardRefExoticComponent<(ChartProps & { | ||
children?: ((data: { | ||
@@ -38,7 +34,9 @@ chart: F2Chart; | ||
}) => void) | undefined; | ||
}) | (ChartProps & { | ||
} & React.RefAttributes<ChartProps & { | ||
chart?: F2Chart<Record<any, any>> | undefined; | ||
}>) | (ChartProps & { | ||
children?: React.ReactNode; | ||
}), React.ReactText> & React.RefAttributes<ChartProps & { | ||
} & React.RefAttributes<ChartProps & { | ||
chart?: F2Chart<Record<any, any>> | undefined; | ||
}>>; | ||
}>)>; | ||
export default Chart; |
declare const init: (chart: any) => void; | ||
export { init, }; | ||
export { init }; | ||
declare const _default: { | ||
@@ -4,0 +4,0 @@ init: (chart: any) => void; |
import React from 'react'; | ||
import { Chart as F2Chart, CoordinateKind } from '@antv/f2'; | ||
export interface CoordinateProps { | ||
import { Chart as F2Chart, CoordinateKind, CoordinateRectParams, CoordinatePolarParams } from '@antv/f2'; | ||
export interface CoordinateProps extends CoordinateRectParams, CoordinatePolarParams { | ||
/** | ||
@@ -9,5 +9,4 @@ * 坐标系类型 | ||
chart: F2Chart; | ||
[key: string]: any; | ||
} | ||
declare const _default: React.ForwardRefExoticComponent<Pick<CoordinateProps, React.ReactText> & React.RefAttributes<CoordinateProps>>; | ||
declare const _default: React.ForwardRefExoticComponent<CoordinateProps & React.RefAttributes<CoordinateProps>>; | ||
export default _default; |
@@ -7,7 +7,6 @@ import React from 'react'; | ||
config?: GeometryParams; | ||
[key: string]: any; | ||
} | ||
declare const _default: React.ForwardRefExoticComponent<Pick<GeometryProps & { | ||
declare const _default: React.ForwardRefExoticComponent<GeometryProps & { | ||
geometry: GeometryProps; | ||
}, React.ReactText> & React.RefAttributes<GeometryProps>>; | ||
} & React.RefAttributes<GeometryProps>>; | ||
export default _default; |
/// <reference types="react" /> | ||
import { GeometryProps } from './'; | ||
export interface UseGeometry extends GeometryProps { | ||
[key: string]: any; | ||
} | ||
declare const _default: (props?: UseGeometry) => { | ||
geometry: GeometryProps | undefined; | ||
setGeometry: import("react").Dispatch<import("react").SetStateAction<GeometryProps | undefined>>; | ||
geometry: UseGeometry | undefined; | ||
setGeometry: import("react").Dispatch<import("react").SetStateAction<UseGeometry | undefined>>; | ||
}; | ||
export default _default; |
@@ -174,3 +174,4 @@ import React, { useMemo, forwardRef, useImperativeHandle, useState, useRef, useEffect, Fragment } from 'react'; | ||
field = props.field, | ||
enable = props.enable, | ||
_props$enable = props.enable, | ||
enable = _props$enable === void 0 ? true : _props$enable, | ||
disable = props.disable, | ||
@@ -475,2 +476,7 @@ reset = _objectWithoutProperties(props, ["chart", "field", "enable", "disable"]); | ||
if (!geometry) { | ||
setGeometry(undefined); | ||
return; | ||
} | ||
for (var key in reset) { | ||
@@ -632,9 +638,2 @@ var fn = geometry[key]; | ||
var index$8 = /*#__PURE__*/forwardRef(function (props, ref) { | ||
useImperativeHandle(ref, function () { | ||
return _objectSpread2({}, props); | ||
}, []); | ||
return null; | ||
}); | ||
var useScale = (function () { | ||
@@ -654,2 +653,10 @@ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var index$8 = /*#__PURE__*/forwardRef(function (props, ref) { | ||
useScale(props); | ||
useImperativeHandle(ref, function () { | ||
return _objectSpread2({}, props); | ||
}, []); | ||
return null; | ||
}); | ||
var useScrollBar = (function () { | ||
@@ -656,0 +663,0 @@ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
@@ -182,3 +182,4 @@ 'use strict'; | ||
field = props.field, | ||
enable = props.enable, | ||
_props$enable = props.enable, | ||
enable = _props$enable === void 0 ? true : _props$enable, | ||
disable = props.disable, | ||
@@ -483,2 +484,7 @@ reset = _objectWithoutProperties(props, ["chart", "field", "enable", "disable"]); | ||
if (!geometry) { | ||
setGeometry(undefined); | ||
return; | ||
} | ||
for (var key in reset) { | ||
@@ -640,9 +646,2 @@ var fn = geometry[key]; | ||
var index$8 = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
React.useImperativeHandle(ref, function () { | ||
return _objectSpread2({}, props); | ||
}, []); | ||
return null; | ||
}); | ||
var useScale = (function () { | ||
@@ -662,2 +661,10 @@ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var index$8 = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
useScale(props); | ||
React.useImperativeHandle(ref, function () { | ||
return _objectSpread2({}, props); | ||
}, []); | ||
return null; | ||
}); | ||
var useScrollBar = (function () { | ||
@@ -664,0 +671,0 @@ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
import React from 'react'; | ||
import { Chart as F2Chart } from '@antv/f2'; | ||
import { Chart as F2Chart, InteractionKind } from '@antv/f2'; | ||
export interface InteractionProps { | ||
chart: F2Chart; | ||
[key: string]: any; | ||
/** | ||
* 交互行为类型 | ||
*/ | ||
field: InteractionKind; | ||
} | ||
declare const _default: React.ForwardRefExoticComponent<Pick<InteractionProps, React.ReactText> & React.RefAttributes<InteractionProps>>; | ||
declare const _default: React.ForwardRefExoticComponent<InteractionProps & React.RefAttributes<InteractionProps>>; | ||
export default _default; |
@@ -10,11 +10,10 @@ import React from 'react'; | ||
/** | ||
* 用于自定义鼠标点击图例项的交互,当 clickable 为 false 时不生效。 | ||
*/ | ||
onClick?: ({ clickedItem, selectShapeByLegend }: { | ||
* 用于自定义鼠标点击图例项的交互,当 clickable 为 false 时不生效。 | ||
*/ | ||
onClick?: ({ clickedItem, selectShapeByLegend, }: { | ||
clickedItem: any; | ||
selectShapeByLegend: (name: string, onEnd?: (clickedShape: any, coord: any, canvas: any) => void) => void; | ||
}) => any; | ||
[key: string]: any; | ||
} | ||
declare const _default: React.ForwardRefExoticComponent<Pick<LegendProps, React.ReactText> & React.RefAttributes<LegendProps>>; | ||
declare const _default: React.ForwardRefExoticComponent<LegendProps & React.RefAttributes<LegendProps>>; | ||
export default _default; |
@@ -5,5 +5,4 @@ import React from 'react'; | ||
chart: F2Chart; | ||
[key: string]: any; | ||
} | ||
declare const _default: React.ForwardRefExoticComponent<Pick<PieLabelProps, React.ReactText> & React.RefAttributes<PieLabelProps>>; | ||
declare const _default: React.ForwardRefExoticComponent<PieLabelProps & React.RefAttributes<PieLabelProps>>; | ||
export default _default; |
@@ -5,6 +5,8 @@ import React from 'react'; | ||
chart: F2Chart; | ||
/** | ||
* 交互行为类型 | ||
*/ | ||
field: string; | ||
[key: string]: any; | ||
} | ||
declare const _default: React.ForwardRefExoticComponent<Pick<ScaleProps, React.ReactText> & React.RefAttributes<ScaleProps>>; | ||
declare const _default: React.ForwardRefExoticComponent<ScaleProps & React.RefAttributes<ScaleProps>>; | ||
export default _default; |
@@ -5,5 +5,4 @@ import React from 'react'; | ||
chart: F2Chart; | ||
[key: string]: any; | ||
} | ||
declare const _default: React.ForwardRefExoticComponent<Pick<ScrollBarProps, React.ReactText> & React.RefAttributes<ScrollBarProps>>; | ||
declare const _default: React.ForwardRefExoticComponent<ScrollBarProps & React.RefAttributes<ScrollBarProps>>; | ||
export default _default; |
@@ -9,5 +9,4 @@ import React from 'react'; | ||
disable?: boolean; | ||
[key: string]: any; | ||
} | ||
declare const _default: React.ForwardRefExoticComponent<Pick<TooltipProps, React.ReactText> & React.RefAttributes<TooltipProps>>; | ||
declare const _default: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<TooltipProps>>; | ||
export default _default; |
{ | ||
"name": "@alitajs/f2", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"scripts": { | ||
@@ -40,3 +40,5 @@ "start": "dumi dev", | ||
"dependencies": { | ||
"@antv/f2": "^3.8.1" | ||
"@antv/f2": "^3.8.1", | ||
"jquery": "^3.6.0", | ||
"lodash": "^4.17.21" | ||
}, | ||
@@ -52,2 +54,3 @@ "devDependencies": { | ||
"prettier": "^1.19.1", | ||
"sitemap": "^6.4.0", | ||
"yorkie": "^2.0.0" | ||
@@ -54,0 +57,0 @@ }, |
@@ -8,3 +8,3 @@ // Invoked on the commit-msg git hook by yorkie. | ||
.trim(); | ||
// feat fix chore | ||
const commitRE = /^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release|dep)(\(.+\))?: .{1,50}/; | ||
@@ -11,0 +11,0 @@ |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Animate | ||
group: | ||
title: Animate | ||
--- | ||
@@ -7,0 +10,0 @@ |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Axis | ||
group: | ||
title: Axis | ||
--- | ||
@@ -12,4 +15,2 @@ | ||
### 使用 hooks | ||
<API/> | ||
<API /> |
@@ -7,3 +7,3 @@ import { useMemo } from 'react'; | ||
export default (props = {} as UseAxis) => { | ||
const { chart, field, enable, disable, ...reset } = props; | ||
const { chart, field, enable = true, disable, ...reset } = props; | ||
useMemo(() => { | ||
@@ -10,0 +10,0 @@ if (!chart) return; |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Chart | ||
group: | ||
title: Chart | ||
--- | ||
@@ -7,0 +10,0 @@ |
@@ -7,3 +7,6 @@ import F2 from '../../F2'; | ||
const init = (chart: any) => { | ||
const selectShapeByLegendName = (name: string, onEnd?: (clickedShape: any, coord: any, canvas: any) => void) => { | ||
const selectShapeByLegendName = ( | ||
name: string, | ||
onEnd?: (clickedShape: any, coord: any, canvas: any) => void, | ||
) => { | ||
const canvas = chart.get('canvas'); | ||
@@ -32,3 +35,3 @@ const coord = chart.get('coord'); | ||
}) | ||
.onStart(function () { | ||
.onStart(function() { | ||
if (lastClickedShape.label) { | ||
@@ -38,3 +41,3 @@ lastClickedShape.label.hide(); | ||
}) | ||
.onEnd(function () { | ||
.onEnd(function() { | ||
lastClickedShape.set('selected', false); | ||
@@ -53,3 +56,3 @@ }); | ||
}) | ||
.onStart(function () { | ||
.onStart(function() { | ||
if (clickedShape.label) { | ||
@@ -59,3 +62,3 @@ clickedShape.label.hide(); | ||
}) | ||
.onEnd(function () { | ||
.onEnd(function() { | ||
clickedShape.set('selected', false); | ||
@@ -74,3 +77,3 @@ }); | ||
}) | ||
.onStart(function () { | ||
.onStart(function() { | ||
clickedShape.attr('stroke', color); | ||
@@ -80,3 +83,3 @@ clickedShape.set('zIndex', 1); | ||
}) | ||
.onEnd(function () { | ||
.onEnd(function() { | ||
clickedShape.set('selected', true); | ||
@@ -89,14 +92,12 @@ clickedShape.set('zIndex', 0); | ||
} else if (isFunction(onEnd)) { | ||
onEnd && onEnd(clickedShape, coord, canvas,) | ||
onEnd && onEnd(clickedShape, coord, canvas); | ||
// drawLabel(clickedShape, coord, canvas, x, y, total); | ||
} | ||
return { clickedShape, coord, canvas } | ||
return { clickedShape, coord, canvas }; | ||
}); | ||
} | ||
}; | ||
chart.set('selectShapeByLegendName', selectShapeByLegendName) | ||
} | ||
export { | ||
init, | ||
chart.set('selectShapeByLegendName', selectShapeByLegendName); | ||
}; | ||
export { init }; | ||
@@ -103,0 +104,0 @@ export default { |
@@ -7,3 +7,3 @@ import { useEffect, useState, useRef } from 'react'; | ||
F2.Chart.plugins.register([ selectShapeByLegendName ]); | ||
F2.Chart.plugins.register([selectShapeByLegendName]); | ||
export interface UseChart extends ChartProps { | ||
@@ -10,0 +10,0 @@ /** |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Coordinate | ||
group: | ||
title: Coordinate | ||
--- | ||
@@ -7,0 +10,0 @@ |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Geometry | ||
group: | ||
title: Geometry | ||
--- | ||
@@ -20,15 +23,20 @@ | ||
点 | ||
#### 点 | ||
<code src="./demo/point.tsx" /> | ||
线 | ||
#### 线 | ||
<code src="./demo/path.tsx" /> | ||
折线 | ||
#### 折线 | ||
<code src="./demo/line.tsx" /> | ||
面积 | ||
#### 面积 | ||
<code src="./demo/area.tsx" /> | ||
柱形 | ||
#### 柱形 | ||
<code src="./demo/interval.tsx" /> |
@@ -5,10 +5,16 @@ import { useState, useMemo } from 'react'; | ||
export interface UseGeometry extends GeometryProps {} | ||
export interface UseGeometry extends GeometryProps { | ||
[key: string]: any; | ||
} | ||
export default (props = {} as UseGeometry) => { | ||
const { chart, config, container, type, ...reset } = props; | ||
const [geometry, setGeometry] = useState<GeometryProps | undefined>(); | ||
const [geometry, setGeometry] = useState<UseGeometry | undefined>(); | ||
useMemo(() => { | ||
if (!chart) return; | ||
const geometry = chart[type](config) as GeometryProps; | ||
const geometry = chart[type](config) as UseGeometry; | ||
if (!geometry) { | ||
setGeometry(undefined); | ||
return; | ||
} | ||
for (const key in reset) { | ||
@@ -15,0 +21,0 @@ const fn = geometry[key]; |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Guide | ||
group: | ||
title: Guide | ||
--- | ||
@@ -7,0 +10,0 @@ |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Interaction | ||
group: | ||
title: Interaction | ||
--- | ||
@@ -7,0 +10,0 @@ |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Legend | ||
group: | ||
title: Legend | ||
--- | ||
@@ -7,0 +10,0 @@ |
import { useMemo } from 'react'; | ||
import { LegendProps } from './'; | ||
export interface UseLegend extends LegendProps { } | ||
export interface UseLegend extends LegendProps {} | ||
@@ -9,5 +9,5 @@ export default (props = {} as UseLegend) => { | ||
const onLegendClick = (e: any) => { | ||
const selectShapeByLegend = chart.get('selectShapeByLegendName') | ||
onClick && onClick({ ...e, chart, selectShapeByLegend }) | ||
} | ||
const selectShapeByLegend = chart.get('selectShapeByLegendName'); | ||
onClick && onClick({ ...e, chart, selectShapeByLegend }); | ||
}; | ||
useMemo(() => { | ||
@@ -14,0 +14,0 @@ if (!chart) return; |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: PieLabel | ||
group: | ||
title: PieLabel | ||
--- | ||
@@ -7,0 +10,0 @@ |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Scale | ||
group: | ||
title: Scale | ||
--- | ||
@@ -7,0 +10,0 @@ |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: ScrollBar | ||
group: | ||
title: ScrollBar | ||
--- | ||
@@ -7,0 +10,0 @@ |
@@ -5,2 +5,5 @@ --- | ||
path: /api | ||
title: Tooltip | ||
group: | ||
title: Tooltip | ||
--- | ||
@@ -7,0 +10,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199656
156
8238
4
10
+ Addedjquery@^3.6.0
+ Addedlodash@^4.17.21
+ Addedjquery@3.7.1(transitive)
+ Addedlodash@4.17.21(transitive)