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

mc-form

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mc-form - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

utils/modules/state.js

2

configs/modules/picker.js

@@ -24,2 +24,4 @@ /**

arrowControl: false,
// 选中日期后的默认具体时刻 非范围选择时:string / 范围选择时:string[]
defaultTime: ['00:00:00', '00:00:00']
};

24

mixins/options.js

@@ -6,3 +6,3 @@ /**

import extend from '../utils/extend';
import { error, genFn, getJsonValue, isObject, isArray } from '../utils';
import { error, getJsonValue, isObject, isArray, isFunction } from '../utils';

@@ -25,10 +25,2 @@ export default {

if (ajax) {
// 转换为函数
this.genFn(ajax.data);
this.genFn(ajax.params);
if (ajax.beforeSend) {
ajax.beforeSend = genFn(ajax.beforeSend);
}
this.init();

@@ -45,12 +37,2 @@ }

methods: {
genFn(object) {
if (!isObject(object)) {
return;
}
Object.keys(object).forEach(key => {
object[key] = genFn(object[key]);
});
},
genData(object) {

@@ -185,3 +167,3 @@ let ret = {};

if (isArray(include)) {
if (isFunction(include) && isArray((include = include(this.state)))) {
options = options.filter(option => include.some(val => val === option[opts.value]));

@@ -192,3 +174,3 @@ }

if (isArray(exclude)) {
if (isFunction(exclude) && isArray((exclude = exclude(this.state)))) {
options = options.filter(option => exclude.every(val => val !== option[opts.value]));

@@ -195,0 +177,0 @@ }

{
"name": "mc-form",
"version": "1.0.1",
"version": "1.0.2",
"description": "a configurable form component base on element-ui, wangEditor",

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

@@ -0,1 +1,2 @@

import { isArray } from '../../utils';
import { PROPS_MIXIN } from '../../mixins';

@@ -11,2 +12,8 @@

methods: {
isRange(type) {
return type.slice(-5) === 'range';
}
},
render(h) {

@@ -18,2 +25,3 @@ if (this.hidden) {

let { ui, picker, field, label, type } = this.config;
let defaultTime = picker.defaultTime;

@@ -39,2 +47,3 @@ return (

pickerOptions={ picker.pickerOptions }
defaultTime={ this.isRange(type) ? defaultTime : (isArray(defaultTime) ? defaultTime[0] : defaultTime) }
onInput={ value => this.$emit('input', value) }></el-date-picker>

@@ -41,0 +50,0 @@ </el-form-item>

@@ -84,2 +84,4 @@ ## 介绍 ##

{
// 是否开启特殊符号拼接的字段解析 后续详解
symbol: false,
// el-row的gutter

@@ -220,5 +222,5 @@ gutter: 10,

},
// 包含的值
// 包含的值 支持dx表达式
include: [],
// 排除的值
// 排除的值 支持dx表达式
exclude: []

@@ -379,2 +381,4 @@ },

arrowControl: false,
// 选中日期后的默认具体时刻 非范围选择时:string / 范围选择时:string[]
defaultTime: ['00:00:00', '00:00:00']
}

@@ -707,2 +711,12 @@ }

## 关于特殊符号拼接的字段 ##
> 为了更方便地获取和设置`mc-form`的`state`,可以使用`symbol: true`开启以下特殊符号在字段中的特殊作用
* `-`: 范围字段设置。例如: state['a-b'] = [ state.a, state.b ],主要应用于range相关的组件
* `>`: 路径字段设置。例如: state['a>b'] = state.a.b
* `@`: 设置关联字段为数组。例如字段 tagIds@tagNames, state = {tagIds: [1,2,3], tagNames: ['刘', '伟', '健']},会被设置为 state['tagIds@tagNames'] = [{id: 1, name: '刘'}, {id: 2, name: '伟'}, {id: 3, name: '健'}]
* `&`: 设置关联字段为对象。例如字段 tagId&tagName, state = {tagId: 1, tagName: '刘伟健'},会被设置为 state['tagId&tagName'] = { id: 1, name: '刘伟健' }
## 关于请求缓存 ##

@@ -709,0 +723,0 @@

@@ -8,1 +8,2 @@

export * from './modules/console';
export * from './modules/state';
const hasConsole = typeof console !== 'undefined';
const isProduction = process.env.NODE_ENV === 'production';
export function error(msg) {
if (!isProduction && hasConsole) {
if (hasConsole) {
console.error(msg);
}
}
import { error } from './console';
import { isPrimitive } from './type';
import { isPrimitive, isObject } from './type';

@@ -141,2 +141,12 @@ /**

export function genFns(object) {
if (!isObject(object)) {
return;
}
Object.keys(object).forEach(key => {
object[key] = genFn(object[key]);
});
}
const ESCAPE_RE = /[-.*+?^${}()|[\]/\\]/g;

@@ -143,0 +153,0 @@

@@ -6,3 +6,3 @@ const path = require('path');

module.exports = {
mode: 'development',
mode: 'production',
entry: {

@@ -9,0 +9,0 @@ 'index': './index.js',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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