Comparing version 1.1.8 to 1.1.9
@@ -227,2 +227,6 @@ "use strict"; | ||
if (_.has(this.props.data, column.field)) { | ||
var date = moment(this.props.data[column.field], 'YYYY-MM-DD HH:mm:ss'); | ||
if (date.format() == 'Invalid date') { | ||
return moment(new Date(), 'YYYY-MM-DD HH:mm:ss'); | ||
} | ||
return moment(this.props.data[column.field], 'YYYY-MM-DD HH:mm:ss'); | ||
@@ -313,7 +317,17 @@ } | ||
if (_.has(values, column.field)) { | ||
values[column.field] = values[column.field] ? column.options[0].value : column.options[1].value; | ||
if (values[column.field] === true) { | ||
values[column.field] = column.options[0].value; | ||
} | ||
else if (values[column.field] === false) { | ||
values[column.field] = column.options[1].value; | ||
} | ||
} | ||
} | ||
else if (column.type == 'date') { | ||
values[column.field] = values[column.field].format('YYYY-MM-DD'); | ||
} | ||
else if (column.type == 'datetime') { | ||
values[column.field] = values[column.field].format('YYYY-MM-DD HH:mm:ss'); | ||
} | ||
else if (column.type == 'daterange') { | ||
// console.log(); | ||
var _a = values[column.field], start = _a[0], end = _a[1]; | ||
@@ -320,0 +334,0 @@ var fields = column.field.split(','); |
@@ -22,2 +22,3 @@ "use strict"; | ||
var antd_1 = require("antd"); | ||
var utils_1 = require("../../../utils"); | ||
var TableHeader_1 = require("./TableHeader"); | ||
@@ -149,3 +150,3 @@ var React = require("react"); | ||
pageSize: this.state.pageSize, | ||
pageSizeOptions: ["10", "15", "50", "100"], | ||
pageSizeOptions: utils_1.Const.PAGE_OPTIONS, | ||
} }))))); | ||
@@ -152,0 +153,0 @@ }; |
@@ -75,2 +75,3 @@ /** | ||
export { default as Table } from './Table/Table'; | ||
export { default as DataTable } from './Table/DataTable'; | ||
export { default as ESTable } from './Table/ESTable'; | ||
@@ -80,2 +81,2 @@ export { default as Page } from './Page/Page'; | ||
export { default as Row } from './Page/Row'; | ||
export declare function HEIGHT(height: number, cols?: number): string; | ||
export declare function HEIGHT(...height: number[]): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var _ = require("lodash"); | ||
/** | ||
@@ -130,2 +131,4 @@ * 导出 antd 原生模块 | ||
exports.Table = Table_1.default; | ||
var DataTable_1 = require("./Table/DataTable"); | ||
exports.DataTable = DataTable_1.default; | ||
var ESTable_1 = require("./Table/ESTable"); | ||
@@ -140,6 +143,9 @@ exports.ESTable = ESTable_1.default; | ||
exports.Row = Row_1.default; | ||
function HEIGHT(height, cols) { | ||
if (cols === void 0) { cols = 1; } | ||
return 'calc(100% - ' + (height + 10 * cols) + 'px)'; | ||
function HEIGHT() { | ||
var height = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
height[_i] = arguments[_i]; | ||
} | ||
return 'calc(100% - ' + (_.sum(height) + 10 * height.length) + 'px)'; | ||
} | ||
exports.HEIGHT = HEIGHT; |
@@ -0,9 +1,23 @@ | ||
/// <reference types="react" /> | ||
import { CardProps } from 'antd/lib/card'; | ||
import { RowProps } from 'antd/lib/row'; | ||
export interface CardTabListType { | ||
key: string; | ||
tab: React.ReactNode; | ||
content?: React.ReactNode; | ||
} | ||
export interface PanelProps extends CardProps { | ||
/** | ||
* 宽度 | ||
*/ | ||
width?: number; | ||
/** | ||
* 跨度大小,分成24份 | ||
*/ | ||
span?: number; | ||
tabList?: CardTabListType[]; | ||
} | ||
export interface RowPanelProps extends CardProps { | ||
height: number | string; | ||
tabList?: CardTabListType[]; | ||
} | ||
@@ -10,0 +24,0 @@ export interface VRowProps extends RowProps { |
@@ -14,2 +14,4 @@ "use strict"; | ||
var React = require("react"); | ||
var antd_1 = require("antd"); | ||
var zh_CN_1 = require("antd/lib/locale-provider/zh_CN"); | ||
var default_1 = /** @class */ (function (_super) { | ||
@@ -21,3 +23,4 @@ __extends(default_1, _super); | ||
default_1.prototype.render = function () { | ||
return React.createElement("div", { className: "vap-container" }, this.props.children); | ||
return React.createElement(antd_1.LocaleProvider, { locale: zh_CN_1.default }, | ||
React.createElement("div", { className: "vap-container" }, this.props.children)); | ||
}; | ||
@@ -24,0 +27,0 @@ return default_1; |
@@ -5,6 +5,16 @@ /// <reference types="react" /> | ||
export declare class Panel extends React.Component<PanelProps> { | ||
cardParam: any; | ||
state: { | ||
tabContext: any; | ||
}; | ||
componentWillMount(): void; | ||
render(): JSX.Element; | ||
} | ||
export declare class RowPanel extends React.Component<RowPanelProps> { | ||
cardParam: any; | ||
state: { | ||
tabContext: any; | ||
}; | ||
componentWillMount(): void; | ||
render(): JSX.Element; | ||
} |
@@ -24,7 +24,31 @@ "use strict"; | ||
var _ = require("lodash"); | ||
// const findContext = (key){} | ||
var Panel = /** @class */ (function (_super) { | ||
__extends(Panel, _super); | ||
function Panel() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.cardParam = {}; | ||
_this.state = { | ||
tabContext: null, | ||
}; | ||
return _this; | ||
} | ||
Panel.prototype.componentWillMount = function () { | ||
var _this = this; | ||
if (this.props.tabList && !_.has(this.props, 'onTabChange')) { | ||
this.setState({ | ||
tabContext: this.props.tabList[0].content | ||
}); | ||
this.cardParam.onTabChange = function (key) { | ||
var tab = _.find(_this.props.tabList, { key: key }); | ||
_this.setState({ | ||
tabContext: tab.content | ||
}); | ||
}; | ||
// let tab = _.find(this.props.tabList,{default:true})||this.props.tabList[0]; | ||
// this.setState({ | ||
// tabContext: tab.content | ||
// }); | ||
} | ||
}; | ||
Panel.prototype.render = function () { | ||
@@ -50,3 +74,3 @@ var param = {}; | ||
return React.createElement(antd_1.Col, __assign({ className: className.join(" ") }, param), | ||
React.createElement(antd_1.Card, __assign({ className: "vap-panel" }, this.props), this.props.children)); | ||
React.createElement(antd_1.Card, __assign({ className: "vap-panel" }, this.props, this.cardParam), this.state.tabContext || this.props.children)); | ||
}; | ||
@@ -59,17 +83,25 @@ return Panel; | ||
function RowPanel() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.cardParam = {}; | ||
_this.state = { | ||
tabContext: null, | ||
}; | ||
return _this; | ||
} | ||
RowPanel.prototype.componentWillMount = function () { | ||
var _this = this; | ||
if (this.props.tabList && !_.has(this.props, 'onTabChange')) { | ||
this.setState({ | ||
tabContext: this.props.tabList[0].content | ||
}); | ||
this.cardParam.onTabChange = function (key) { | ||
var tab = _.find(_this.props.tabList, { key: key }); | ||
_this.setState({ | ||
tabContext: tab.content | ||
}); | ||
}; | ||
} | ||
}; | ||
RowPanel.prototype.render = function () { | ||
var param = {}; | ||
// if(this.props.width){ | ||
// param.style = { | ||
// minWidth:this.props.width | ||
// } | ||
// }else if(this.props.span){ | ||
// param.span = this.props.span; | ||
// }else{ | ||
// param.style ={ | ||
// flex:'1 1' | ||
// } | ||
// } | ||
var className = ["vap-row"]; | ||
@@ -80,3 +112,3 @@ if (_.has(this.props, 'title')) { | ||
return React.createElement("div", { className: className.join(" "), style: { height: this.props.height } }, | ||
React.createElement(antd_1.Card, __assign({ className: "vap-panel" }, this.props), this.props.children)); | ||
React.createElement(antd_1.Card, __assign({ className: "vap-panel" }, this.props, this.cardParam), this.props.children)); | ||
}; | ||
@@ -83,0 +115,0 @@ return RowPanel; |
@@ -20,5 +20,5 @@ import { TableProps } from 'antd/lib/table/interface'; | ||
/** | ||
* 是否需要分页栏位 | ||
* 每页记录数量,默认为10 | ||
*/ | ||
page?: boolean; | ||
pageSize?: number; | ||
} |
/// <reference types="react" /> | ||
import { TableProps } from 'antd/lib/table/interface'; | ||
import * as React from 'react'; | ||
import { DisplayTableProps } from './interface'; | ||
export default class <T> extends React.PureComponent<DisplayTableProps<T>> { | ||
param: { | ||
start: number; | ||
count: number; | ||
}; | ||
state: { | ||
list: any[]; | ||
total: number; | ||
}; | ||
componentWillMount(): void; | ||
export default class <T> extends React.Component<TableProps<T>> { | ||
render(): JSX.Element; | ||
} |
@@ -27,23 +27,11 @@ "use strict"; | ||
function default_1() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.param = { | ||
start: 0, | ||
count: 10, | ||
}; | ||
_this.state = { | ||
list: [], | ||
total: 0, | ||
}; | ||
return _this; | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
default_1.prototype.componentWillMount = function () { | ||
if (!this.props.autoLoad === false) { | ||
_.assign(this.param, this.props.param); | ||
} | ||
}; | ||
default_1.prototype.render = function () { | ||
return React.createElement(antd_1.Table, __assign({}, this.props, { dataSource: this.state.list })); | ||
var param = _.assign({}, this.props); | ||
param.size = param.size || 'small'; | ||
return React.createElement(antd_1.Table, __assign({}, param)); | ||
}; | ||
return default_1; | ||
}(React.PureComponent)); | ||
}(React.Component)); | ||
exports.default = default_1; |
{ | ||
"name": "vap", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "vap", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
declare const _default: { | ||
PAGE_OPTIONS: string[]; | ||
STATUS_OPTION: { | ||
@@ -3,0 +4,0 @@ name: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = { | ||
PAGE_OPTIONS: ["10", "15", "50", "100"], | ||
/** | ||
@@ -5,0 +6,0 @@ * 启用 / 禁用 Switch 开关选项,用于表单元素的输入 |
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
108348
63
2827