Comparing version 1.2.9 to 1.3.0
@@ -175,8 +175,4 @@ "use strict"; | ||
} | ||
if (_.has(column, 'onChange')) { | ||
params.onChange = function (value) { return column.onChange(value); }; | ||
} | ||
if (_.has(column, 'onChange')) { | ||
params.onChange = function (value) { return column.onChange(value); }; | ||
} | ||
console.log(params); | ||
console.log(column); | ||
return React.createElement(antd_1.Select, __assign({}, params), column.options.map(function (item) { return React.createElement(antd_1.Select.Option, { value: item.value }, item.name); })); | ||
@@ -186,3 +182,25 @@ }; | ||
FromContent.prototype.buildRadio = function (column, params) { | ||
if (_.has(column, 'onChange')) { | ||
var _this = this; | ||
var _a = this.props.form, setFieldsValue = _a.setFieldsValue, getFieldValue = _a.getFieldValue; | ||
if (_.has(column, 'onChange') && column.update) { | ||
var rowIndex = 0; | ||
for (var i in this.props.columns) { | ||
if (this.props.columns[i][0].field == column.update) { | ||
//@ts-ignore | ||
rowIndex = i; | ||
break; | ||
} | ||
} | ||
params.onChange = function (e) { | ||
var p = _.concat([], _this.state.columns); | ||
p[rowIndex][0] = _.extend(p[rowIndex][0], column.onChange(e.target.value)); | ||
var val = {}; | ||
val[column.update] = p[rowIndex][0].value || ''; | ||
setFieldsValue(val); | ||
_this.setState({ columns: p }); | ||
}; | ||
// console.log() | ||
// params.onChange(getFieldValue(column.field)); | ||
} | ||
else if (_.has(column, 'onChange')) { | ||
params.onChange = function (e) { return column.onChange(e.target.value); }; | ||
@@ -362,2 +380,6 @@ } | ||
var onOk = this.props.onOk; | ||
// let param:any = _.extend({},this.props); | ||
// if(param.className){ | ||
// param.className = param.className + ' from-modal'; | ||
// } | ||
return (React.createElement(antd_1.Modal, __assign({}, this.props, { onOk: function () { return _this.submit(); } }), | ||
@@ -364,0 +386,0 @@ React.createElement(DataFrom, { data: data, columns: columns, show: this.props.visible, ref: "modalfrom" }))); |
@@ -81,2 +81,4 @@ import { ModalProps } from 'antd/lib/modal/Modal'; | ||
}; | ||
update?: string; | ||
onChange?: Function; | ||
} | ||
@@ -83,0 +85,0 @@ export interface FromModalProps extends ModalProps { |
@@ -11,2 +11,6 @@ /// <reference types="react" /> | ||
/** | ||
* 标题前面打个 ICON图标 | ||
*/ | ||
icon?: string; | ||
/** | ||
* 宽度 | ||
@@ -19,6 +23,19 @@ */ | ||
span?: number; | ||
/** | ||
* 标签页 | ||
*/ | ||
tabList?: CardTabListType[]; | ||
} | ||
export interface RowPanelProps extends CardProps { | ||
/** | ||
* 标题前面打个 ICON图标 | ||
*/ | ||
icon?: string; | ||
/** | ||
* Panel高度 | ||
*/ | ||
height: number | string; | ||
/** | ||
* 标签页 | ||
*/ | ||
tabList?: CardTabListType[]; | ||
@@ -25,0 +42,0 @@ } |
@@ -8,2 +8,3 @@ /// <reference types="react" /> | ||
tabContext: any; | ||
activeTabKey: any; | ||
}; | ||
@@ -16,2 +17,3 @@ componentWillMount(): void; | ||
state: { | ||
activeTabKey: any; | ||
tabContext: any; | ||
@@ -18,0 +20,0 @@ }; |
@@ -32,2 +32,3 @@ "use strict"; | ||
tabContext: null, | ||
activeTabKey: null, | ||
}; | ||
@@ -38,16 +39,20 @@ return _this; | ||
var _this = this; | ||
if (this.props.tabList && !_.has(this.props, 'onTabChange')) { | ||
if (this.props.tabList) { | ||
this.setState({ | ||
activeTabKey: this.props.tabList[0].key, | ||
tabContext: this.props.tabList[0].content | ||
}); | ||
if (this.props.onTabChange) { | ||
this.props.onTabChange(this.props.tabList[0].key); | ||
} | ||
this.cardParam.onTabChange = function (key) { | ||
var tab = _.find(_this.props.tabList, { key: key }); | ||
_this.setState({ | ||
activeTabKey: key, | ||
tabContext: tab.content | ||
}); | ||
if (_this.props.onTabChange) { | ||
_this.props.onTabChange(key); | ||
} | ||
}; | ||
// let tab = _.find(this.props.tabList,{default:true})||this.props.tabList[0]; | ||
// this.setState({ | ||
// tabContext: tab.content | ||
// }); | ||
} | ||
@@ -73,6 +78,9 @@ }; | ||
if (_.has(this.props, 'title')) { | ||
if (_.has(this.props, 'icon')) { | ||
this.cardParam.title = [React.createElement(antd_1.Icon, { type: this.props.icon, className: "title-icon" }), this.props.title]; | ||
} | ||
className.push("vap-panel-header"); | ||
} | ||
return React.createElement(antd_1.Col, __assign({ className: className.join(" ") }, param), | ||
React.createElement(antd_1.Card, __assign({ className: "vap-panel" }, this.props, this.cardParam), this.state.tabContext || this.props.children)); | ||
React.createElement(antd_1.Card, __assign({ className: "vap-panel" }, this.props, this.cardParam, { activeTabKey: this.state.activeTabKey }), this.state.tabContext || this.props.children)); | ||
}; | ||
@@ -88,2 +96,3 @@ return Panel; | ||
_this.state = { | ||
activeTabKey: null, | ||
tabContext: null, | ||
@@ -95,11 +104,19 @@ }; | ||
var _this = this; | ||
if (this.props.tabList && !_.has(this.props, 'onTabChange')) { | ||
if (this.props.tabList) { | ||
this.setState({ | ||
tabContext: this.props.tabList[0].content | ||
tabContext: this.props.tabList[0].content, | ||
activeTabKey: this.props.tabList[0].key, | ||
}); | ||
if (this.props.onTabChange) { | ||
this.props.onTabChange(this.props.tabList[0].key); | ||
} | ||
this.cardParam.onTabChange = function (key) { | ||
var tab = _.find(_this.props.tabList, { key: key }); | ||
_this.setState({ | ||
activeTabKey: key, | ||
tabContext: tab.content | ||
}); | ||
if (_this.props.onTabChange) { | ||
_this.props.onTabChange(key); | ||
} | ||
}; | ||
@@ -109,9 +126,11 @@ } | ||
RowPanel.prototype.render = function () { | ||
var param = {}; | ||
var className = ["vap-row", "vap-row-block"]; | ||
if (_.has(this.props, 'title')) { | ||
if (_.has(this.props, 'icon')) { | ||
this.cardParam.title = [React.createElement(antd_1.Icon, { type: this.props.icon, className: "title-icon" }), this.props.title]; | ||
} | ||
className.push("vap-panel-header"); | ||
} | ||
return React.createElement("div", { className: className.join(" "), style: { height: this.props.height } }, | ||
React.createElement(antd_1.Card, __assign({ className: "vap-panel" }, this.props, this.cardParam), this.props.children)); | ||
React.createElement(antd_1.Card, __assign({ className: "vap-panel" }, this.props, this.cardParam, { activeTabKey: this.state.activeTabKey }), this.props.children)); | ||
}; | ||
@@ -118,0 +137,0 @@ return RowPanel; |
import { Column } from "./admin/FromModal/interface"; | ||
export declare function ruleMessage(column: Column): any[]; | ||
export declare function ruleMessage(column: Column): any; |
@@ -21,3 +21,3 @@ "use strict"; | ||
/** | ||
* 大屏组件根节点,用 <Page> 包住后,可实现自动resize,收放 | ||
* ScrollList | ||
*/ | ||
@@ -78,3 +78,3 @@ var default_1 = /** @class */ (function (_super) { | ||
var _this = this; | ||
return React.createElement("ul", { id: this.id, className: this.props.className, style: { width: '100%', height: '100%', overflow: 'hidden' } }, this.props.list.map(function (item) { return React.createElement("li", null, _this.props.render(item)); })); | ||
return React.createElement("ul", { id: this.id, className: this.props.className, style: { width: '100%', height: '100%', overflow: 'hidden' } }, this.props.list.map(function (item) { return _this.props.render(item); })); | ||
}; | ||
@@ -81,0 +81,0 @@ return default_1; |
{ | ||
"name": "vap", | ||
"version": "1.2.9", | ||
"version": "1.3.0", | ||
"description": "vap", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -51,2 +51,3 @@ export default abstract class { | ||
static formatSize(mbSize: number): string; | ||
static formatDate(date: string | Date, format?: string): string; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var moment = require("moment"); | ||
var _ = require("lodash"); | ||
var formatDecimal = function (number, limit) { | ||
@@ -75,2 +77,9 @@ if (limit === void 0) { limit = 2; } | ||
}; | ||
default_1.formatDate = function (date, format) { | ||
if (format === void 0) { format = 'YYYY-MM-DD HH:mm:ss'; } | ||
if (_.isString(date)) { | ||
return moment(new Date(date)).format(format); | ||
} | ||
return moment(date).format(format); | ||
}; | ||
/** | ||
@@ -77,0 +86,0 @@ * @param number 一个数字 |
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
190206
5034
85