import{s as m,bl as v,cN as d,an as y,K as p,z as c,P as S,Q as s,f as g,a1 as _}from"./index-DT8qTvyx.js";var C=function(r){m(n,r);function n(){var t=r!==null&&r.apply(this,arguments)||this;return t.inited=!1,t}return n.prototype.componentDidMount=function(){var t=this.props,i=t.formInited,o=t.initSet,e=t.addHook;this.unHook=e?e(this.handleFormInit,"init"):void 0,i!==!1&&(this.inited=!0,o===!1||this.initSet())},n.prototype.componentDidUpdate=function(t){var i=this.props,o=i.formInited,e=i.initSet,a=i.autoSet;this.inited?a===!1||this.autoSet(t):typeof o>"u"&&(this.inited=!0,e===!1||this.initSet())},n.prototype.componentWillUnmount=function(){var t;(t=this.unHook)===null||t===void 0||t.call(this)},n.prototype.handleFormInit=function(t){this.inited=!0;var i=this.props,o=i.name,e=i.initSet;if(e!==!1){var a=this.initSet();typeof o=="string"&&typeof a<"u"&&v(t,o,a)}},n.prototype.initSet=function(){var t=this.props,i=t.formula,o=t.data,e=t.setPrinstineValue;t.initSet;var a=t.condition;if(i){if(a&&!~a.indexOf("$")&&!~a.indexOf("<%")&&!d(a,o))return}else return;var f=d(i,o);return f!==null&&(e==null||e(f)),f},n.prototype.autoSet=function(t){var i=this.props,o=t.formula,e=t.data,a=t.onChange,f=t.value,u=t.condition;if(o&&i.formula&&y(e,i.data,!1)&&f===i.value){var l=d(i.formula,i.data);if(u&&i.condition)~u.indexOf("$")||~u.indexOf("<%")?p(u,e)!==p(i.condition,i.data)&&a(l):d(i.condition,i.data)&&a(l);else{var h=d(o,e);JSON.stringify(h)!==JSON.stringify(l)&&a(l??"")}}},n.prototype.doAction=function(){var t=this.props,i=t.formula,o=t.data,e=t.onChange;t.autoSet,t.value;var a=d(i,o);e(a)},n.prototype.render=function(){return null},c([S,s("design:type",Function),s("design:paramtypes",[Object]),s("design:returntype",void 0)],n.prototype,"handleFormInit",null),n}(g.Component),I=function(r){m(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}return n=c([_({type:"formula",wrap:!1,strictMode:!1,sizeMutable:!1})],n),n}(C);export{I as FormulaControlRenderer,C as default};
