Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@grid-form/common

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grid-form/common - npm Package Compare versions

Comparing version
0.2.0
to
0.2.1
+1
-1
package.json
{
"name": "@grid-form/common",
"version": "0.2.0",
"version": "0.2.1",
"description": "",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/0604hx/grid-form",

@@ -144,2 +144,27 @@ import { ref, reactive, toRaw, unref, onMounted, computed, nextTick, watch } from 'vue'

const triggerSubmit = (withHook=false)=>{
if(props.debug) track(`外部触发提交事件 withHook=${withHook}`)
if(withHook)
toSubmit()
else
_submitDo(_raw(formData))
}
/**
*
* @param {Boolean} check
* @returns
*/
const getFormData = (check=true)=> {
if(props.debug) track(`获取表单数据,预检测=${check}`)
if(!check) return { error: null, data: _raw(formData) }
let data = _raw(formData)
delete data['_disabled']
let fails = []
_checkRequire(props.form.items, data, fails)
return fails.length? { error: fails, data: undefined } : { error: null, data }
}
const _computeValue = async (text, id)=>{

@@ -291,6 +316,21 @@ /**

/**
* 对外提供的方法,用于调用各类动作
* 注意这是一个异步方法
* @param {String} action
* @param {*} ps
* @returns
*/
const exec = async (action, ps)=>{
if(action=='triggerSubmit') return triggerSubmit(ps)
if(action=='getFormData') return getFormData(ps)
if(props.debug) track(`调用 exec 方法(action=${action}),暂无实现...`)
}
return {
_raw, track,
inited, formData,
toSubmit, onExtraBtn
toSubmit, onExtraBtn,
triggerSubmit, getFormData, exec
}

@@ -297,0 +337,0 @@ }