Comparing version 1.6.7 to 1.6.8
@@ -26,3 +26,3 @@ /// <reference types="react" /> | ||
private query; | ||
constructor(props: any); | ||
componentDidMount(): void; | ||
reflush: () => void; | ||
@@ -29,0 +29,0 @@ onQuery(param: any): void; |
@@ -40,4 +40,4 @@ "use strict"; | ||
__extends(TableLayout, _super); | ||
function TableLayout(props) { | ||
var _this = _super.call(this, props) || this; | ||
function TableLayout() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.rowKey = 'id'; | ||
@@ -61,9 +61,19 @@ _this.sorter = {}; | ||
}; | ||
return _this; | ||
} | ||
TableLayout.prototype.componentDidMount = function () { | ||
//@ts-ignore | ||
this.rowKey = this.props.rowKey || 'id'; | ||
this.query.order_ = this.rowKey; | ||
var sotred = {}; | ||
if (_.has(this.props, 'sort')) { | ||
sotred['order_'] = this.props.sort.order; | ||
sotred['by_'] = this.props.sort.by; | ||
} | ||
var param = { | ||
type: _this.props.fetch, | ||
query: _.extend({}, _this.props.default, _this.query) | ||
type: this.props.fetch, | ||
query: _.extend({}, this.props.default, this.query, sotred) | ||
}; | ||
_this.props.dispatch(param); | ||
return _this; | ||
} | ||
this.props.dispatch(param); | ||
}; | ||
TableLayout.prototype.onQuery = function (param) { | ||
@@ -123,5 +133,2 @@ _.extend(this.query, param, { start_: 0 }); | ||
var _this = this; | ||
//@ts-ignore | ||
this.rowKey = this.props.rowKey || 'id'; | ||
this.query.order_ = this.rowKey; | ||
var params = {}; | ||
@@ -128,0 +135,0 @@ if (!_.has(this.props, 'size')) { |
@@ -129,5 +129,5 @@ import { TableProps, ColumnProps } from 'antd/lib/table/interface'; | ||
*/ | ||
order?: { | ||
sort?: { | ||
order: string; | ||
by: string; | ||
desc: boolean; | ||
}; | ||
@@ -134,0 +134,0 @@ /** |
@@ -41,3 +41,3 @@ "use strict"; | ||
default_1.prototype.sort = function () { | ||
this.DATA = _.orderBy(this.props.data, this.props.value, 'desc'); | ||
this.DATA = _.orderBy(this.props.data, this.props.valueField, 'desc'); | ||
this.DATA.length = this.DATA.length < this.CONFIG.max ? this.DATA.length : this.CONFIG.max; | ||
@@ -49,61 +49,65 @@ this.HEIGHT = 40 * this.DATA.length; | ||
default_1.prototype.build = function () { | ||
var _this = this; | ||
var min = _.minBy(this.DATA, this.props.value); | ||
var max = _.maxBy(this.DATA, this.props.value); | ||
//建立坐标轴 | ||
var arr = []; | ||
this.DATA.map(function (d) { return arr.push(d[_this.props.label]); }); | ||
this.x.domain([min[this.props.value] / 2, max[this.props.value] + min[this.props.value] / 2]).range([0, this.WIDTH - this.CONFIG.labelWidth - this.CONFIG.right - this.CONFIG.left]); | ||
this.y.domain(arr).range([0, this.HEIGHT - this.CONFIG.labelWidth - this.CONFIG.top - this.CONFIG.bottom]); | ||
this.SVG.append("g") | ||
.attr("class", "axis axis-x") | ||
.attr("transform", "translate(" + (this.CONFIG.labelWidth + this.CONFIG.left) + "," + (this.HEIGHT - this.CONFIG.bottom - this.CONFIG.labelWidth) + ")") | ||
.call(d3.axisBottom(this.x) | ||
.ticks(this.CONFIG.tickNumber) | ||
.tickPadding(12)); | ||
this.SVG.append("g") | ||
.attr("class", "axis axis-y") | ||
.attr("transform", "translate(" + (this.CONFIG.labelWidth + this.CONFIG.left) + "," + this.CONFIG.top + ")") | ||
.call(d3.axisLeft(this.y) | ||
.tickSize(this.DATA.length)); | ||
//添加外框 | ||
var bandWidth = (this.HEIGHT - this.CONFIG.labelWidth - this.CONFIG.top - this.CONFIG.bottom) / (this.DATA.length); | ||
var rectGroup = this.SVG.selectAll('g.bar-rect') | ||
.data(this.DATA) | ||
.enter() | ||
.append('g') | ||
.attr('class', 'bar-rect') | ||
.attr('style', 'cursor:pointer;'); | ||
rectGroup.append("rect") | ||
.attr("opacity", "0.3") | ||
.attr('x', function (d, i) { return _this.CONFIG.labelWidth + _this.CONFIG.left; }) | ||
.attr('y', function (d, i) { return (i + 1 / 4) * bandWidth + _this.CONFIG.top; }) | ||
.attr("height", bandWidth / 2) | ||
.attr('width', this.WIDTH - this.CONFIG.labelWidth - this.CONFIG.right - this.CONFIG.left) | ||
.attr("fill", chartTheme[3]); | ||
//添加柱 | ||
rectGroup.append("rect") | ||
.attr("id", function (d, i) { return 'bar-rect' + i; }) | ||
.attr("style", "filter: url(#bar_shadow);rx: 5") | ||
.attr("opacity", "0.7") | ||
.attr('x', function (d, i) { return _this.CONFIG.labelWidth + _this.CONFIG.left; }) | ||
.attr('y', function (d, i) { return (i + 1 / 4) * bandWidth + _this.CONFIG.top; }) | ||
.attr("height", bandWidth / 2) | ||
.attr('width', 0) | ||
.attr("fill", function (d, i) { return i > 3 ? chartTheme[3] : chartTheme[i]; }) | ||
.on("click", function (d, i) { | ||
if (_this.props.onClick) { | ||
_this.props.onClick(d, i); | ||
} | ||
}) | ||
.on("mouseover", function (d, i) { | ||
d3.select(this).attr("opacity", "1.0"); | ||
}) | ||
.on("mouseout", function (d, i) { | ||
d3.select(this).attr("opacity", "0.7"); | ||
}) | ||
//@ts-ignore | ||
.transition() | ||
.duration(3000) | ||
.attr('width', function (d) { return _this.x(d[_this.props.value]); }); | ||
// @ts-ignore | ||
return; | ||
// let min = _.minBy(this.DATA, this.props.valueField); | ||
// let max = _.maxBy(this.DATA, this.props.valueField); | ||
// //建立坐标轴 | ||
// let arr = []; | ||
// this.DATA.map(d => arr.push(d[this.props.labelField])); | ||
// this.x.domain([min[this.props.valueField] / 2, max[this.props.valueField] + min[this.props.valueField] / 2]) | ||
// .range([0, this.WIDTH - this.CONFIG.labelWidth - this.CONFIG.right - this.CONFIG.left]); | ||
// this.y.domain(arr).range([0, this.HEIGHT - this.CONFIG.labelWidth - this.CONFIG.top - this.CONFIG.bottom]); | ||
// this.SVG.append("g") | ||
// .attr("class", "axis axis-x") | ||
// .attr("transform", `translate(${this.CONFIG.labelWidth + this.CONFIG.left},${this.HEIGHT - this.CONFIG.bottom - this.CONFIG.labelWidth})`) | ||
// .call(d3.axisBottom(this.x) | ||
// .ticks(this.CONFIG.tickNumber) | ||
// .tickPadding(12) | ||
// ); | ||
// this.SVG.append("g") | ||
// .attr("class", "axis axis-y") | ||
// .attr("transform", `translate(${this.CONFIG.labelWidth + this.CONFIG.left},${this.CONFIG.top})`) | ||
// .call(d3.axisLeft(this.y) | ||
// .tickSize(this.DATA.length) | ||
// ); | ||
// //添加外框 | ||
// var bandWidth = (this.HEIGHT - this.CONFIG.labelWidth - this.CONFIG.top - this.CONFIG.bottom) / (this.DATA.length); | ||
// let rectGroup = this.SVG.selectAll('g.bar-rect') | ||
// .data(this.DATA) | ||
// .enter() | ||
// .append('g') | ||
// .attr('class', 'bar-rect') | ||
// .attr('style', 'cursor:pointer;'); | ||
// rectGroup.append("rect") | ||
// .attr("opacity", "0.3") | ||
// .attr('x', (d, i) => this.CONFIG.labelWidth + this.CONFIG.left) | ||
// .attr('y', (d, i) => (i + 1 / 4) * bandWidth + this.CONFIG.top) | ||
// .attr("height", bandWidth / 2) | ||
// .attr('width', this.WIDTH - this.CONFIG.labelWidth - this.CONFIG.right - this.CONFIG.left) | ||
// .attr("fill", chartTheme[3]); | ||
// //添加柱 | ||
// rectGroup.append("rect") | ||
// .attr("id", (d, i) => 'bar-rect' + i) | ||
// .attr("style", "filter: url(#bar_shadow);rx: 5") | ||
// .attr("opacity", "0.7") | ||
// .attr('x', (d, i) => this.CONFIG.labelWidth + this.CONFIG.left) | ||
// .attr('y', (d, i) => (i + 1 / 4) * bandWidth + this.CONFIG.top) | ||
// .attr("height", bandWidth / 2) | ||
// .attr('width', 0) | ||
// .attr("fill", (d, i) => i > 3 ? chartTheme[3] : chartTheme[i]) | ||
// .on("click", (d, i) => { | ||
// if (this.props.onClick) { | ||
// this.props.onClick(d, i); | ||
// } | ||
// }) | ||
// .on("mouseover", function (d, i) { | ||
// d3.select(this).attr("opacity", "1.0"); | ||
// }) | ||
// .on("mouseout", function (d, i) { | ||
// d3.select(this).attr("opacity", "0.7"); | ||
// }) | ||
// //@ts-ignore | ||
// .transition() | ||
// .duration(3000) | ||
// .attr('width', d => this.x(d[this.props.valueField])); | ||
}; | ||
@@ -113,3 +117,3 @@ default_1.prototype.update = function () { | ||
// console.log('need update'); | ||
console.log(this.DATA); | ||
// console.log(this.DATA); | ||
}; | ||
@@ -116,0 +120,0 @@ return default_1; |
@@ -35,1 +35,2 @@ /** | ||
export { default as EChart } from './OptChart'; | ||
export { default as PieChart } from './PieChart'; |
@@ -42,1 +42,3 @@ "use strict"; | ||
exports.EChart = OptChart_1.default; | ||
var PieChart_1 = require("./PieChart"); | ||
exports.PieChart = PieChart_1.default; |
@@ -42,4 +42,4 @@ export interface Item { | ||
export interface BarOpts extends ChartOpts { | ||
label: string; | ||
value: string; | ||
labelField: string; | ||
valueField: string; | ||
title?: string; | ||
@@ -46,0 +46,0 @@ onClick?: Function; |
{ | ||
"name": "vap", | ||
"version": "1.6.7", | ||
"version": "1.6.8", | ||
"description": "vap", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
323579
151
8354