Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vap

Package Overview
Dependencies
Maintainers
1
Versions
568
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vap - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

layouts/display/Page/Radio.d.ts

1

layouts/admin/BaseModal/index.d.ts

@@ -5,2 +5,3 @@ /// <reference types="react" />

export default class BaseModal extends React.PureComponent<BaseModalProps, any> {
_isReShow(old: any): boolean;
}

@@ -19,4 +19,10 @@ "use strict";

}
BaseModal.prototype._isReShow = function (old) {
if (old.show === false && this.props.show === true) {
return true;
}
return false;
};
return BaseModal;
}(React.PureComponent));
exports.default = BaseModal;

2

layouts/admin/InfoModal/index.js

@@ -34,3 +34,3 @@ "use strict";

React.createElement(antd_1.Col, { span: 8, className: "info-label" }, column.title),
React.createElement(antd_1.Col, { span: 15, className: "info-value" }, _this.props.data[column.field]));
React.createElement(antd_1.Col, { span: 15, className: "info-value" }, column.render ? column.render(_this.props.data[column.field]) : _this.props.data[column.field]));
});

@@ -37,0 +37,0 @@ };

@@ -5,5 +5,4 @@ import { ModalProps } from 'antd/lib/modal/Modal';

field: string;
map?: any;
list?: any[];
key?: string;
render: Function;
}

@@ -10,0 +9,0 @@ export interface InfoModalProps extends ModalProps {

@@ -47,6 +47,7 @@ "use strict";

};
_this.props.dispatch({
var param = {
type: _this.props.fetch,
query: _this.query
});
};
_this.props.dispatch(param);
return _this;

@@ -120,3 +121,3 @@ }

}
// //选择功能,跨页记忆选择。
// //选择功能,跨页记忆选择, 有BUG,暂时取消此功能
// if (this.props.select) {

@@ -140,2 +141,5 @@ // params.rowSelection = {

onChange: function (selectedRowKeys) { return _this.onSelect(selectedRowKeys); },
getCheckboxProps: function (record) { return ({
disabled: !_.has(record, _this.rowKey)
}); },
};

@@ -146,3 +150,8 @@ }

React.createElement(antd_1.Layout.Content, null,
React.createElement(antd_1.Table, __assign({}, this.props, params, { onChange: function (pagination, filters, sorter) { return _this.search(pagination, filters, sorter); }, pagination: {
React.createElement(antd_1.Table, __assign({}, this.props, params, { rowClassName: function (record, index) {
if (_.has(record, _this.rowKey)) {
return '';
}
return 'new_record';
}, onChange: function (pagination, filters, sorter) { return _this.search(pagination, filters, sorter); }, pagination: {
current: this.state.current,

@@ -149,0 +158,0 @@ total: this.props.total,

@@ -5,3 +5,29 @@ "use strict";

* 基于d3,threejs的图形
* 为保证不重复引入,请保证请入前自行引入了相关的依赖,如 echarts,d3,threejs,g2 等。具体需要引入哪个参考图形说明
*
* 计划中:
* 1. 线条图
* 时间序列
* 堆叠
*
* 2. 饼图
* 圆饼图
* 圆环图
* 玫瑰图
*
* 3. 条形图
* 横向条形图
* 纵向条形图
*
* 4. 地图
* 3D地图
* 伪3D地图
* 2D地图
*
* 5. 雷达图
*
* 6. 虚拟地图
*
* 7. 3D地球
*/
exports.default = {};

@@ -38,3 +38,2 @@ /**

export { Progress } from 'antd';
export { Radio } from 'antd';
export { Rate } from 'antd';

@@ -83,1 +82,3 @@ export { Select } from 'antd';

export declare function HEIGHT(...height: number[]): string;
import { VapRadio } from './Page/Radio';
export { VapRadio as Radio };

@@ -75,38 +75,37 @@ "use strict";

exports.Progress = antd_34.Progress;
// export { Radio } from 'antd';
var antd_35 = require("antd");
exports.Radio = antd_35.Radio;
exports.Rate = antd_35.Rate;
var antd_36 = require("antd");
exports.Rate = antd_36.Rate;
exports.Select = antd_36.Select;
var antd_37 = require("antd");
exports.Select = antd_37.Select;
exports.Slider = antd_37.Slider;
var antd_38 = require("antd");
exports.Slider = antd_38.Slider;
exports.Spin = antd_38.Spin;
var antd_39 = require("antd");
exports.Spin = antd_39.Spin;
exports.Steps = antd_39.Steps;
var antd_40 = require("antd");
exports.Steps = antd_40.Steps;
exports.Switch = antd_40.Switch;
var antd_41 = require("antd");
exports.Switch = antd_41.Switch;
exports.Transfer = antd_41.Transfer;
var antd_42 = require("antd");
exports.Transfer = antd_42.Transfer;
exports.Tree = antd_42.Tree;
var antd_43 = require("antd");
exports.Tree = antd_43.Tree;
exports.TreeSelect = antd_43.TreeSelect;
var antd_44 = require("antd");
exports.TreeSelect = antd_44.TreeSelect;
exports.Tabs = antd_44.Tabs;
var antd_45 = require("antd");
exports.Tabs = antd_45.Tabs;
exports.Tag = antd_45.Tag;
var antd_46 = require("antd");
exports.Tag = antd_46.Tag;
exports.TimePicker = antd_46.TimePicker;
var antd_47 = require("antd");
exports.TimePicker = antd_47.TimePicker;
exports.Timeline = antd_47.Timeline;
var antd_48 = require("antd");
exports.Timeline = antd_48.Timeline;
exports.Tooltip = antd_48.Tooltip;
var antd_49 = require("antd");
exports.Tooltip = antd_49.Tooltip;
exports.Mention = antd_49.Mention;
var antd_50 = require("antd");
exports.Mention = antd_50.Mention;
exports.Upload = antd_50.Upload;
var antd_51 = require("antd");
exports.Upload = antd_51.Upload;
var antd_52 = require("antd");
exports.version = antd_52.version;
exports.version = antd_51.version;
/**

@@ -153,1 +152,6 @@ * Row 被重写

exports.HEIGHT = HEIGHT;
//Radio
var Radio_1 = require("./Page/Radio");
exports.Radio = Radio_1.VapRadio;
Radio_1.VapRadio.Button = Radio_1.Button;
Radio_1.VapRadio.Group = Radio_1.Group;

@@ -15,3 +15,122 @@ "use strict";

var antd_1 = require("antd");
var zh_CN_1 = require("antd/lib/locale-provider/zh_CN");
// @ts-ignore
var zh_ch = antd.locales.zh_CN;
// // 自定义
// import { Locale } from 'antd/lib/locale-provider';
// let zh_ch: Locale = {
// "locale": "zh-cn",
// "Pagination": {
// "items_per_page": "条/页",
// "jump_to": "跳至",
// "jump_to_confirm": "确定",
// "page": "页",
// "prev_page": "上一页",
// "next_page": "下一页",
// "prev_5": "向前 5 页",
// "next_5": "向后 5 页",
// "prev_3": "向前 3 页",
// "next_3": "向后 3 页"
// },
// "DatePicker": {
// "lang": {
// "placeholder": "请选择日期",
// "rangePlaceholder": ["开始日期", "结束日期"],
// "today": "今天",
// "now": "此刻",
// "backToToday": "返回今天",
// "ok": "确 定",
// "timeSelect": "选择时间",
// "dateSelect": "选择日期",
// "clear": "清除",
// "month": "月",
// "year": "年",
// "previousMonth": "上个月 (翻页上键)",
// "nextMonth": "下个月 (翻页下键)",
// "monthSelect": "选择月份",
// "yearSelect": "选择年份",
// "decadeSelect": "选择年代",
// "yearFormat": "YYYY年",
// "dayFormat": "D日",
// "dateFormat": "YYYY年M月D日",
// "dateTimeFormat": "YYYY年M月D日 HH时mm分ss秒",
// "previousYear": "上一年 (Control键加左方向键)",
// "nextYear": "下一年 (Control键加右方向键)",
// "previousDecade": "上一年代",
// "nextDecade": "下一年代",
// "previousCentury": "上一世纪",
// "nextCentury": "下一世纪"
// },
// "timePickerLocale": {
// "placeholder": "请选择时间"
// }
// },
// "TimePicker": {
// "placeholder": "请选择时间"
// },
// "Calendar": {
// "lang": {
// "placeholder": "请选择日期",
// "rangePlaceholder": ["开始日期", "结束日期"],
// "today": "今天",
// "now": "此刻",
// "backToToday": "返回今天",
// "ok": "确 定",
// "timeSelect": "选择时间",
// "dateSelect": "选择日期",
// "clear": "清除",
// "month": "月",
// "year": "年",
// "previousMonth": "上个月 (翻页上键)",
// "nextMonth": "下个月 (翻页下键)",
// "monthSelect": "选择月份",
// "yearSelect": "选择年份",
// "decadeSelect": "选择年代",
// "yearFormat": "YYYY年",
// "dayFormat": "D日",
// "dateFormat": "YYYY年M月D日",
// "dateTimeFormat": "YYYY年M月D日 HH时mm分ss秒",
// "previousYear": "上一年 (Control键加左方向键)",
// "nextYear": "下一年 (Control键加右方向键)",
// "previousDecade": "上一年代",
// "nextDecade": "下一年代",
// "previousCentury": "上一世纪",
// "nextCentury": "下一世纪"
// },
// "timePickerLocale": {
// "placeholder": "请选择时间"
// }
// },
// "Table": {
// "filterTitle": "筛选",
// "filterConfirm": "确定",
// "filterReset": "重置",
// "emptyText": "暂无数据",
// "selectAll": "全选当页",
// "selectInvert": "反选当页"
// },
// "Modal": {
// "okText": "确定",
// "cancelText": "取消",
// "justOkText": "知道了"
// },
// "Popconfirm": {
// "cancelText": "取消",
// "okText": "确定"
// },
// "Transfer": {
// "notFoundContent": "无匹配结果",
// "searchPlaceholder": "请输入搜索内容",
// "itemUnit": "项",
// "itemsUnit": "项"
// },
// "Select": {
// "notFoundContent": "无匹配结果"
// },
// "Upload": {
// "uploading": "文件上传中",
// "removeFile": "删除文件",
// "uploadError": "上传错误",
// "previewFile": "预览文件"
// }
// }
var default_1 = /** @class */ (function (_super) {

@@ -23,3 +142,3 @@ __extends(default_1, _super);

default_1.prototype.render = function () {
return React.createElement(antd_1.LocaleProvider, { locale: zh_CN_1.default },
return React.createElement(antd_1.LocaleProvider, { locale: zh_ch },
React.createElement("div", { className: "vap-container" }, this.props.children));

@@ -26,0 +145,0 @@ };

@@ -57,2 +57,3 @@ "use strict";

param.style = {
width: this.props.width,
minWidth: this.props.width

@@ -59,0 +60,0 @@ };

@@ -7,3 +7,7 @@ import { ModalProps } from 'antd/lib/modal/Modal';

columns?: ColumnProps<T>[];
/**
* 基本查询参数
*/
param?: any;
export?: string;
}
import { Column } from "./admin/FromModal/interface";
export declare function ruleMessage(column: Column): any[];
export declare function status(key: string, val?: number): boolean;

@@ -29,2 +29,10 @@ "use strict";

// email: Must be of type email.
function buildMessage(rule, title) {
// if(rule.required){
// }
// if(rule.pattern){
// return `${title} 必须符合格式 ${rule.pattern}`
// }
return title + " \u4E3A\u5FC5\u586B\u9879\uFF01";
}
// TODO:需要完善

@@ -39,3 +47,3 @@ function ruleMessage(column) {

else {
rules.push(_.assign({}, item, { message: column.title + ' 为必填项!' }));
rules.push(_.assign({}, item, { message: buildMessage(item, column.title) }));
}

@@ -48,15 +56,1 @@ });

;
var STATUS = {};
function status(key, val) {
if (val === void 0) { val = 500; }
var time = _.now();
if (_.has(STATUS, key)) {
if ((time - STATUS[key]) > val) {
_.unset(STATUS, key);
return true;
}
}
STATUS[key] = time;
return false;
}
exports.status = status;
{
"name": "vap",
"version": "1.2.0",
"version": "1.2.1",
"description": "vap",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -52,2 +52,3 @@ "use strict";

var cleanParam = function (obj) {
if (obj === void 0) { obj = {}; }
var keys = Object.keys(obj);

@@ -54,0 +55,0 @@ for (var i = 0, _i = keys.length; i < _i; i++) {

declare const _default: {
GET: (key: string, def?: any) => any;
SET: (key: string, value: any) => void;
LISTEN: (key: string, callback: Function) => void;
};
export default _default;

@@ -6,2 +6,5 @@ "use strict";

exports.default = {
/**
* 获取缓存
*/
GET: function (key, def) {

@@ -14,2 +17,5 @@ if (def === void 0) { def = null; }

},
/**
* 设置缓存
*/
SET: function (key, value) {

@@ -22,3 +28,9 @@ if (value === null) {

}
},
/**
* 监听缓存,当值变化时,回调
*/
LISTEN: function (key, callback) {
console.log(key);
}
};

@@ -6,1 +6,2 @@ export { default as Ajax } from './Ajax';

export { default as Format } from './Format';
export { default as Renders } from './Renders';

@@ -13,1 +13,3 @@ "use strict";

exports.Format = Format_1.default;
var Renders_1 = require("./Renders");
exports.Renders = Renders_1.default;

@@ -5,3 +5,9 @@ declare const _default: {

del: (list: any[], ids: any[], rowKey?: string) => any[];
BuildModel: (modelName: string, api: string | {
query: string;
del?: string;
update?: string;
add?: string;
}, objectName?: string, rowKey?: string, nameField?: string) => any;
};
export default _default;
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
var React = require("react");
var Ajax_1 = require("./Ajax");
var antd_1 = require("antd");
/**

@@ -53,2 +91,227 @@ * utils - Model 提供对模型的增删改功能

}
exports.default = { add: add, update: update, del: del };
/**
* 构建一个脐具备增删改查功能的 Model.
* 构造出的Model 具备 _query,_add,_update,_delete 四个属性
* _query : ({query}) _query 必须传入一个 query 表示查询条件
* _add : ({data}) _add 必须传入一个 data 表示新增对象
* _update: ({data}) _update 必须传一个 data 表示修改对象
* _delete: ({data}) _delete 时,传入的data 可以是一个对象(以rowKey为ID),也可以是一个ID的数组
* 另外说明,_delete 请求以 ids 为参数,多条记录删除时,以逗号分隔
*/
function BuildModel(modelName, api, objectName, rowKey, nameField) {
if (objectName === void 0) { objectName = '对象'; }
if (rowKey === void 0) { rowKey = 'id'; }
if (nameField === void 0) { nameField = null; }
var tip = function (data) { return React.createElement("span", null,
objectName,
" ",
nameField ? React.createElement("strong", null, data[nameField]) : React.createElement(React.Fragment, null),
" "); };
// {
// return objectName + (nameField?(' : ' + data[nameField] + ' ') :'');
// }
var apis = { query: '' };
if (_.isString(api)) {
apis = {
query: api,
add: api,
del: api,
update: api,
};
}
else {
apis = api;
}
var model = {
//命名空间,不能重复
namespace: modelName,
//如果需要使用 TableLayout 进行快速管理,则必须包含 list, 和 total 两个状态
state: {
list: [],
total: 0,
},
effects: {
// 查询用户列表
_query: function (_a, _b) {
var query = _a.query;
var call = _b.call, put = _b.put;
var resp;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, Ajax_1.default.POST(apis.query, query)];
case 1:
resp = _c.sent();
return [4 /*yield*/, put({
type: '_list',
list: resp.list,
total: resp.total
})];
case 2:
_c.sent();
return [2 /*return*/];
}
});
},
//说明:需要使用 Ajax 队列功能的方法 需要为 *function 类型,这样可以使用 yield 获取值
//增加一个用户
_add: function (_a, _b) {
var data = _a.data, callback = _a.callback;
var put = _b.put;
var resp;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
if (!_.has(apis, 'add')) {
return [2 /*return*/];
}
;
return [4 /*yield*/, Ajax_1.default.PUT(apis.add, _.assign({}, data))];
case 1:
resp = _c.sent();
if (!(resp.code != '0')) return [3 /*break*/, 2];
antd_1.message.error(React.createElement(React.Fragment, null,
tip(data),
"\u521B\u5EFA\u5931\u8D25"));
return [3 /*break*/, 4];
case 2:
antd_1.message.success(React.createElement(React.Fragment, null,
tip(data),
"\u521B\u5EFA\u6210\u529F"));
// 成功后,用 put 方法可以再次调用 reducers 里面的 `doAdd` 事件
return [4 /*yield*/, put({
type: '_doAdd',
data: data
})];
case 3:
// 成功后,用 put 方法可以再次调用 reducers 里面的 `doAdd` 事件
_c.sent();
_c.label = 4;
case 4:
if (callback)
callback(data, resp);
return [2 /*return*/];
}
});
},
//修改一个用户
_update: function (_a, _b) {
var data = _a.data, callback = _a.callback;
var put = _b.put;
var param, resp;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
if (!_.has(apis, 'update')) {
return [2 /*return*/];
}
;
param = _.assign({}, data);
return [4 /*yield*/, Ajax_1.default.PATCH(apis.update, param)];
case 1:
resp = _c.sent();
if (!(resp.code != '0')) return [3 /*break*/, 2];
antd_1.message.error(React.createElement(React.Fragment, null,
tip(data),
"\u4FEE\u6539\u5931\u8D25"));
return [3 /*break*/, 4];
case 2:
antd_1.message.success(React.createElement(React.Fragment, null,
tip(data),
"\u4FEE\u6539\u6210\u529F"));
return [4 /*yield*/, put({
type: '_doUpdate',
data: data
})];
case 3:
_c.sent();
_c.label = 4;
case 4:
if (callback)
callback(data, resp);
return [2 /*return*/];
}
});
},
//批量删除用户
_delete: function (_a, _b) {
var data = _a.data;
var put = _b.put;
var resp, resp;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
if (!_.has(apis, 'del')) {
return [2 /*return*/];
}
;
if (!_.isArray(data)) return [3 /*break*/, 5];
return [4 /*yield*/, Ajax_1.default.DELETE(apis.del, { ids: data.join(',') })];
case 1:
resp = _c.sent();
if (!(resp.code != '0')) return [3 /*break*/, 2];
antd_1.message.error(objectName + "\u5220\u9664\u5931\u8D25");
return [3 /*break*/, 4];
case 2:
// message.success(<React.Fragment>{tip(data)}修改成功</React.Fragment>);
antd_1.message.success(data.length + "\u4E2A" + objectName + "\u5DF2\u7ECF\u88AB\u5220\u9664");
return [4 /*yield*/, put({
type: '_doDelete',
data: data
})];
case 3:
_c.sent();
_c.label = 4;
case 4: return [3 /*break*/, 9];
case 5: return [4 /*yield*/, Ajax_1.default.DELETE(apis.del, { ids: data[rowKey] })];
case 6:
resp = _c.sent();
if (!(resp.code != '0')) return [3 /*break*/, 7];
antd_1.message.error(React.createElement(React.Fragment, null,
tip(data),
"\u5220\u9664\u5931\u8D25"));
return [3 /*break*/, 9];
case 7:
antd_1.message.success(React.createElement(React.Fragment, null,
tip(data),
"\u5DF2\u7ECF\u88AB\u5220\u9664"));
return [4 /*yield*/, put({
type: '_doDelete',
data: [data[rowKey]]
})];
case 8:
_c.sent();
_c.label = 9;
case 9: return [2 /*return*/];
}
});
},
},
reducers: {
//添加成功后,将用户 push 到 模型里面
_doAdd: function (state, _a) {
var data = _a.data;
return __assign({}, state, { list: add(state.list, data) });
},
//编辑成功后,将模型里面修改的用户进行 update
_doUpdate: function (state, _a) {
var data = _a.data;
return __assign({}, state, { list: update(state.list, data, rowKey) });
},
//删除成功后,将模型里面对应的用户删掉
_doDelete: function (state, _a) {
var data = _a.data;
return {
state: state,
list: del(state.list, data, rowKey)
};
},
//查询,将模型里面的用户重置为查到的
_list: function (state, _a) {
var list = _a.list, total = _a.total;
return __assign({}, state, { list: list, total: total });
},
},
};
return model;
}
exports.default = { add: add, update: update, del: del, BuildModel: BuildModel };
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc