Comparing version 1.0.9 to 1.1.0
@@ -60,4 +60,2 @@ "use strict"; | ||
return _this.buildSelect(column, params); | ||
// case 'selectDynamic': | ||
// return this.buildSelectDynamic(column, params); | ||
case 'radio': | ||
@@ -64,0 +62,0 @@ return _this.buildRadio(column, params); |
/// <reference types="react" /> | ||
import { DataTableProps } from '../TableLayout/interface'; | ||
import * as React from 'react'; | ||
export default class ListModal<T> extends React.Component<DataTableProps<T>> { | ||
import { ListModalProps, MODE } from './interface'; | ||
import { ColumnProps } from 'antd/lib/table/interface'; | ||
export default class ListModal<T> extends React.Component<ListModalProps<T>> { | ||
rowKey: string; | ||
mode: MODE; | ||
editObject: {}; | ||
doAdd(record: any, save: any): void; | ||
doEdit(record: any, save: any): void; | ||
exitEditMode(record: any, save: boolean): void; | ||
edit(record: any): void; | ||
renderColumns(text: any, record: any, column: any): JSX.Element; | ||
del(record: any): void; | ||
buildEditColumn(): ColumnProps<T>[]; | ||
buildOption(): ColumnProps<T>[]; | ||
state: { | ||
list: any[]; | ||
total: number; | ||
columns: any[]; | ||
}; | ||
param: {}; | ||
search(pagination: any, filters: any, sorter: any): void; | ||
componentWillMount(): void; | ||
componentDidUpdate(old: any): void; | ||
add(): void; | ||
render(): JSX.Element; | ||
} |
@@ -24,2 +24,3 @@ "use strict"; | ||
var _ = require("lodash"); | ||
var interface_1 = require("./interface"); | ||
var utils_1 = require("../../../utils"); | ||
@@ -32,8 +33,2 @@ var EditableCell = function (_a) { | ||
}; | ||
var MODE; | ||
(function (MODE) { | ||
MODE[MODE["ADD"] = 0] = "ADD"; | ||
MODE[MODE["EDIT"] = 1] = "EDIT"; | ||
MODE[MODE["COMMON"] = 2] = "COMMON"; | ||
})(MODE || (MODE = {})); | ||
var ListModal = /** @class */ (function (_super) { | ||
@@ -44,3 +39,3 @@ __extends(ListModal, _super); | ||
_this.rowKey = 'id'; | ||
_this.mode = MODE.COMMON; | ||
_this.mode = interface_1.MODE.COMMON; | ||
_this.editObject = {}; | ||
@@ -61,3 +56,3 @@ _this.state = { | ||
antd_1.message.success('添加成功'); | ||
list[0] = _.assign(list[0], _this.editObject, { _edit: false }); | ||
list[0] = _.assign(list[0], _this.props.param, _this.editObject, { _edit: false }); | ||
_this.setState({ list: list }); | ||
@@ -71,3 +66,3 @@ _this.editObject = {}; | ||
} | ||
this.mode = MODE.COMMON; | ||
this.mode = interface_1.MODE.COMMON; | ||
}; | ||
@@ -90,10 +85,10 @@ ListModal.prototype.doEdit = function (record, save) { | ||
} | ||
this.mode = MODE.COMMON; | ||
this.mode = interface_1.MODE.COMMON; | ||
}; | ||
ListModal.prototype.exitEditMode = function (record, save) { | ||
switch (this.mode) { | ||
case MODE.ADD: | ||
case interface_1.MODE.ADD: | ||
this.doAdd(record, save); | ||
break; | ||
case MODE.EDIT: | ||
case interface_1.MODE.EDIT: | ||
this.doEdit(record, save); | ||
@@ -107,4 +102,4 @@ break; | ||
var _this = this; | ||
if (this.mode === MODE.COMMON) { | ||
this.mode = MODE.EDIT; | ||
if (this.mode === interface_1.MODE.COMMON) { | ||
this.mode = interface_1.MODE.EDIT; | ||
this.editObject = _.assign({}, record); | ||
@@ -148,3 +143,3 @@ var list = _.concat([], this.state.list); | ||
var _this = this; | ||
var columns; | ||
var columns = []; | ||
if (this.props.edit) { | ||
@@ -212,4 +207,4 @@ columns = this.buildEditColumn(); | ||
ListModal.prototype.add = function () { | ||
if (this.mode === MODE.COMMON) { | ||
this.mode = MODE.ADD; | ||
if (this.mode === interface_1.MODE.COMMON) { | ||
this.mode = interface_1.MODE.ADD; | ||
var list = _.concat([], this.state.list); | ||
@@ -216,0 +211,0 @@ this.editObject = { |
{ | ||
"name": "vap", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "vap", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,3 +7,4 @@ declare const _default: { | ||
DELETE: (url: any, param: any, callback?: Function) => Promise<any>; | ||
WHEN: (...pos: Promise<void>[]) => Promise<void[]>; | ||
}; | ||
export default _default; |
@@ -260,2 +260,28 @@ "use strict"; | ||
} | ||
exports["default"] = { GET: GET, POST: POST, PUT: PUT, PATCH: PATCH, DELETE: DELETE }; | ||
/** | ||
* 请多个请求一起返回了再处理,两个以上请求时,可以使用 | ||
* @param pos 异步请求, | ||
* 示例 | ||
* ``` | ||
Ajax.WHEN( | ||
Ajax.GET('/api-common/user'), | ||
Ajax.GET('/api-common/user/ip'), | ||
Ajax.POST('/api-common/user') | ||
).then(function(resp){ | ||
console.log(resp[0],resp[1],resp[2]); | ||
}); | ||
* ``` | ||
* | ||
*/ | ||
function WHEN() { | ||
var pos = []; | ||
for (var _a = 0; _a < arguments.length; _a++) { | ||
pos[_a] = arguments[_a]; | ||
} | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_b) { | ||
return [2 /*return*/, Promise.all(pos)]; | ||
}); | ||
}); | ||
} | ||
exports["default"] = { GET: GET, POST: POST, PUT: PUT, PATCH: PATCH, DELETE: DELETE, WHEN: WHEN }; |
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
72991
35
1819