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

ac-gridcn-refer-field

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ac-gridcn-refer-field - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

49

build/GridcnReferField.js

@@ -93,3 +93,26 @@ 'use strict';

_this.onCancel = function () {
if (!_this.valueChanged) {
_this.modelOrg.setValue(_this.props.text);
}
};
_this.setValue = function (value) {
if (typeof value == 'string' && value && value.indexOf(',') != -1) {
value = value.split(',');
}
//TODO 值临时从cb中取
if (_index.cb.custom) {
_index.cb.custom.referFieldValueKeys = value || [];
} else {
_index.cb.custom = {
referFieldValueKeys: value || []
};
}
};
_this.afterValueChange = function (data) {
if (_this.changeed) {
_this.valueChanged = true;
}
if (Array.isArray(data.value) && data.value.length === 0 && !_this.props.multiple) return; //解决问题树参照根节点问题

@@ -164,2 +187,3 @@ _this.handlerChange(data.value);

};
_this.valueChanged = false;
_this.modelOrg = new _index.cb.models.MdfReferModel(_extends({

@@ -174,4 +198,16 @@ cRefType: props.cRefType,

};
_this.modelOrg.on('beforeBrowse', function () {
if (_this.props.value) {
_this.modelOrg.setValue(_this.props.value.id ? _this.props.value.id : _this.props.value);
} else {
_this.modelOrg.setValue('');
}
setTimeout(function () {
document.querySelector('.referModal .refer-footer-container .refer-footer-btns-container .refer-modal-footer-cancle-btn').onclick = _this.onCancel;
document.querySelector('.referModal .refer-modal-header .anticon.anticon-close').onclick = _this.onCancel;
}, 500);
});
return _this;
}
/**

@@ -184,4 +220,2 @@ * 参数发生变化回调

*/
ReferField.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {

@@ -194,6 +228,11 @@ var _this2 = this;

if ('value' in nextProps) {
var value = nextProps.value;
this.setState({
value: nextProps.value
value: value
}, function () {
_this2.modelOrg.setValue(nextProps.value);
if (Array.isArray(value)) {
_this2.modelOrg.setValue(value);
} else {
_this2.setValue(value);
}
});

@@ -205,2 +244,4 @@ }

this.changeed = false;
this.setValue(this.props.value, true);
this.modelOrg.setValue(this.props.text);
};

@@ -207,0 +248,0 @@

@@ -0,1 +1,11 @@

<a name="0.0.17"></a>
## [0.0.17](https://github.com/tinper-bee/ac-gridcn-refer-field/compare/v0.0.16...v0.0.17) (2020-05-19)
### Features
* 参照回选问题 ([5434520](https://github.com/tinper-bee/ac-gridcn-refer-field/commit/5434520))
<a name="0.0.16"></a>

@@ -2,0 +12,0 @@ ## [0.0.16](https://github.com/tinper-bee/ac-gridcn-refer-field/compare/v0.0.15...v0.0.16) (2020-05-15)

2

package.json
{
"name": "ac-gridcn-refer-field",
"version": "0.0.16",
"version": "0.0.17",
"description": "GridcnReferField ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

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

}
this.valueChanged = false;
this.modelOrg = new cb.models.MdfReferModel({

@@ -67,6 +68,22 @@ cRefType: props.cRefType,

modelconfig: {
afterValueChange: this.afterValueChange,
afterValueChange: this.afterValueChange
}
}
this.modelOrg.on('beforeBrowse',()=>{
if(this.props.value){
this.modelOrg.setValue(this.props.value.id?this.props.value.id:this.props.value);
}else{
this.modelOrg.setValue('')
}
setTimeout(()=>{
document.querySelector('.referModal .refer-footer-container .refer-footer-btns-container .refer-modal-footer-cancle-btn').onclick=this.onCancel
document.querySelector('.referModal .refer-modal-header .anticon.anticon-close').onclick=this.onCancel
},500)
})
}
onCancel=()=>{
if(!this.valueChanged){
this.modelOrg.setValue(this.props.text);
}
}
/**

@@ -84,6 +101,11 @@ * 参数发生变化回调

if('value' in nextProps ){
let value = nextProps.value;
this.setState({
value:nextProps.value
value
},()=>{
this.modelOrg.setValue(nextProps.value);
if(Array.isArray(value)){
this.modelOrg.setValue(value)
}else{
this.setValue(value)
}
})

@@ -93,4 +115,20 @@ }

setValue=(value)=>{
if(typeof value == 'string' && value&&value.indexOf(',')!=-1){
value = value.split(',')
}
//TODO 值临时从cb中取
if(cb.custom){
cb.custom.referFieldValueKeys = value||[];
}else{
cb.custom = {
referFieldValueKeys:value||[]
}
}
}
componentDidMount(){
this.changeed = false;
this.setValue(this.props.value,true)
this.modelOrg.setValue(this.props.text);
}

@@ -102,2 +140,5 @@ componentDidUpdate(){

afterValueChange = (data) => {
if(this.changeed){
this.valueChanged = true;
}
if(Array.isArray(data.value) && data.value.length === 0 && !this.props.multiple) return;//解决问题树参照根节点问题

@@ -104,0 +145,0 @@ this.handlerChange(data.value)

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