@xiaohaih/condition-core
Advanced tools
Comparing version 0.2.0 to 0.2.1
# @xiaohaih/condition-core | ||
## 0.2.1 | ||
### Patch Changes | ||
- 1. 优化第三方开发环境下调源码, 以便调试 | ||
- 2. 不同类型的组件增加类名以作区分, 方便设置样式 | ||
## 0.2.0 | ||
@@ -4,0 +11,0 @@ |
@@ -540,3 +540,3 @@ 'use strict'; | ||
/** 初始是否存在回填值 */ | ||
const initialBackfillValue = props.backfill && props.backfill[props.field]; | ||
const initialBackfillValue = props.backfill && (props.fields?.length ? props.fields.map(key => props.backfill[key]) : props.backfill[props.field]); | ||
/** 当前选中值 */ | ||
@@ -543,0 +543,0 @@ const checked = vueDemi.ref(initialBackfillValue || (props.defaultValue !== undefined ? initialValue.value : props.multiple ? [] : '' |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("vue-demi");function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)}var i=["attrs","props","domProps"],a=["class","style","directives"],n=["on","nativeOn"],l=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},u=t((function(e){return e.reduce((function(e,t){for(var u in t)if(e[u])if(-1!==i.indexOf(u))e[u]=r({},e[u],t[u]);else if(-1!==a.indexOf(u)){var o=e[u]instanceof Array?e[u]:[e[u]],s=t[u]instanceof Array?t[u]:[t[u]];e[u]=[].concat(o,s)}else if(-1!==n.indexOf(u))for(var d in t[u])if(e[u][d]){var p=e[u][d]instanceof Array?e[u][d]:[e[u][d]],c=t[u][d]instanceof Array?t[u][d]:[t[u][d]];e[u][d]=[].concat(p,c)}else e[u][d]=t[u][d];else if("hook"===u)for(var f in t[u])e[u][f]=e[u][f]?l(e[u][f],t[u][f]):t[u][f];else e[u]=t[u];else e[u]=t[u];return e}),{})}));function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function s(e,t){return Array.isArray(e)?e.filter(Boolean).length?e:t:"number"==typeof e?e:e||t}function d(e,t,r="children"){for(const i of e){if(t(i))return[i];if(i[r]?.length){const e=d(i[r],t);if(e.length)return e.unshift(i),e}}return[]}function p(e,t){return o(t,"$scopedSlots")&&t.$scopedSlots[e]||t.$slots[e]}const c="2.7"===e.version.slice(0,3),f=e.isVue2?"value":"modelValue",y={field:{type:String,required:!0},as:{type:String},customGetQuery:{type:Function},emptyValue:{type:[String,null,void 0],default:void 0},resetToInitialValue:{type:[Boolean]},query:{type:Object,required:!0},backfill:{type:Object},disabled:{type:[Boolean,Function]},hide:{type:[Boolean,Function]},validator:{type:[Function]},defaultValue:{type:[String,Array,Function]},depend:{type:Boolean,default:void 0},dependFields:{type:[String,Array]}},h={tag:{type:[String,Object],default:"div"},resetToInitialValue:{type:Boolean,default:void 0},datum:{type:Object,default:()=>({})},backfill:{type:Object},realtime:{type:Boolean,default:void 0},immediateSearch:{type:Boolean,default:void 0},toast:{type:Function,default:()=>{}},searchAtDatumChanged:{type:Boolean,default:void 0}},v={...y,fields:{type:[Array]},backfillToValue:{type:Function,default:e=>e},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:void 0},getOptions:{type:Function}},g={...y,fields:{type:[Array]},valueKey:{type:String,required:!0},childrenKey:{type:String},emitPath:{type:[Boolean],default:!1},options:{type:Array,default:()=>[]},getOptions:{type:Function}},m={search:e=>!0},b={...m,ready:e=>!0,reset:e=>!0},S={...m},O={...m},Q="condition-wrapper";function k(e){return e}function V(e){return e}var w=e.defineComponent({name:"CoreWrapper",props:h,emits:b,setup(t,r){const i=[];e.onBeforeUnmount((()=>i.splice(0)));const a={};let n=!1,l=[];const u={realtime:e.toRef(t,"realtime"),register(r){i.push(r);const u=()=>{n=!0,r.reset(),r.updateWrapperQuery();const u=i.indexOf(r);-1!==u&&i.splice(u,1),t.searchAtDatumChanged&&this.search(),n=!1,l.forEach((t=>{e.del(o.value,t),delete a[t]})),l=[]},s=e.getCurrentInstance();return s&&e.onBeforeUnmount(u,c?s.proxy:s),u},updateQueryValue(t,r){n&&l.push(t),e.set(o.value,t,r),a[t]=r},insetSearch(){t.realtime&&this.search()},search:d,removeUnreferencedField(t){let r=0;i.some((e=>(e.getQuery().hasOwnProperty(t)&&(r+=1),r))),r||(e.del(o.value,t),delete a[t])}};e.provide(Q,u);const o=e.ref({...t.backfill}),s=()=>({...o.value,...t.backfill,...a});async function d(){const e=(await Promise.all(i.map((e=>e.validator?.(o.value))))).find((e=>e&&"string"==typeof e));if(e?t.toast(e):r.emit("search",s()),e)return e}function p(){i.forEach((e=>{e.reset(),e.updateWrapperQuery()})),r.emit("reset",s())}return e.onMounted((()=>{t.immediateSearch&&r.emit("ready",s())})),{child:i,wrapperInstance:u,query:o,getQuery:s,querySearch:d,resetAndSearch:function(){p(),d()},reset:p}},render(){const{resetToInitialValue:t,backfill:r,query:i,getQuery:a,querySearch:n,resetAndSearch:l,reset:s}=this,d=this.tag,c=this.datum,f=p("default",this),y=p("btn",this),{class:h,style:v,...g}=this.$attrs,m=(e.isVue2,{});return o(this,"$listeners")&&(m.on=this.$listeners),e.h(d,u([{},m]),[Object.entries(c).map((([e,a])=>a?"function"==typeof f?f({...g,key:e,field:a.as||e,resetToInitialValue:t,backfill:r,query:i,...a}):f||"":void 0)),"function"==typeof y?y({search:n,getQuery:a,resetAndSearch:l,reset:s}):y])}});function F(t){const r=e.ref();return e.computed({set(e){r.value=e},get:()=>void 0===r.value?void 0!==t.defaultValue?"function"==typeof t.defaultValue?t.defaultValue(t.query,t.backfill):t.defaultValue:void 0:r.value})}function q(t,r){const i=e.ref("boolean"==typeof t.disabled&&t.disabled),a=e.ref("boolean"==typeof t.hide&&t.hide),n=()=>({query:t.query,backfill:t.backfill,option:r}),l=()=>{if("function"==typeof t.hide){a.value!==t.hide(n())&&(a.value=t.hide(n()))}else if("function"==typeof t.disabled){i.value!==t.disabled(n())&&(i.value=t.disabled(n()))}};let u=[e.watch((()=>t.query),l,{immediate:!0,deep:!0}),e.watch((()=>[t.disabled,t.hide]),((e,t)=>{e[0]!==t[0]&&(i.value="boolean"==typeof e[0]&&e[0],e[0]),e[1]!==t[1]&&(a.value="boolean"==typeof e[1]&&e[1],e[1]),l()}))];return e.onBeforeUnmount((()=>(u.forEach((e=>e())),u=[]))),{insetDisabled:i,insetHide:a}}function A(t=!0){const r=e.ref(t);return{flag:r,updateFlag:()=>{r.value=!t,e.nextTick((()=>{r.value=t}))}}}var j=e.defineComponent({inheritAttrs:!1,name:"CorePlain",props:v,setup(t,r){const i=e.inject(Q),a=F(t),n=t.backfill&&t.backfill[t.field],l=e.ref(n||(void 0!==t.defaultValue?a.value:t.multiple?[]:"").slice()),u=e.ref([]),o=e.computed((()=>u.value.length?u.value:t.options)),d=()=>t.customGetQuery?t.customGetQuery(l.value,s,t):t.multiple&&t.fields?t.fields.reduce(((e,r,i)=>(e[r]=s(l.value?.[i],t.emptyValue),e)),{}):{[t.field]:s(l.value,t.emptyValue)},{flag:p,updateFlag:c}=A(),{flag:f,updateFlag:y}=A(),h={reset(){const{multiple:e}=t;c(),y(),l.value=t.resetToInitialValue&&a.value?.slice()||(e?[]:"")},updateWrapperQuery(){c(),i&&Object.entries(d()).forEach((([e,t])=>i.updateQueryValue(e,t)))},get validator(){return t.validator},getQuery:d};i?.register(h);const{insetDisabled:v,insetHide:g}=q(t,h);!n&&t.defaultValue&&h.updateWrapperQuery();const m=[];function b(e){t.getOptions?.((e=>{const t=l.value;l.value=void 0,u.value=e||[],l.value=t}),t.query||{},{trigger:e,change:(e,t)=>{t&&(a.value=e),O(e)},search:(e,t)=>{t&&(a.value=e),S(e),i?.search()}})}function S(e){e!==l.value&&(l.value=e,h.updateWrapperQuery())}function O(e){S(e),i?.insetSearch()}return e.onBeforeUnmount((()=>m.forEach((e=>e())))),m.push(e.watch((()=>t.field),((e,t)=>{e!==t&&i?.removeUnreferencedField(t),h.updateWrapperQuery()}))),m.push(e.watch((()=>[t.fields||t.field,t.fields?t.fields.map((e=>t.query[e])).filter(Boolean):t.query[t.field]]),(([e,r],[i])=>{const a=t.backfillToValue(r,e,t.query);e.toString()===i.toString()&&a?.toString()!==l.value?.toString()&&p.value&&(l.value=a)}))),m.push(e.watch((()=>[t.fields||t.field,t.fields?t.fields.map((e=>t.backfill?.[e])).filter(Boolean):t.backfill?.[t.field]]),(([e,r],[i])=>{const a=t.backfillToValue(r,e,t.backfill);e.toString()===i.toString()&&a?.toString()!==l.value?.toString()&&(y(),S(a))}))),m.push(e.watch((()=>[t.depend,t.dependFields,t.dependFields&&[].concat(t.dependFields).map((e=>t.query?.[e])).join(",")||""]),(([e,r,i],[a,n,u])=>{f.value&&i!==u&&(b("depend"),e===a&&r?.toString()===n?.toString()&&void 0!==l.value&&""!==l.value.toString()&&S(t.multiple?[]:""))}))),m.push(e.watch((()=>t.getOptions),b.bind(null,"initial"),{immediate:!0})),{wrapper:i,option:h,checked:l,getQuery:d,insetDisabled:v,insetHide:g,finalOption:o,updateCheckedValue:S,change:O,reset:h.reset}},render(){const{checked:e,getQuery:t,insetDisabled:r,insetHide:i,finalOption:a,change:n,reset:l,multiple:u}=this;if(i)return;const s=p("default",this),d=o(this,"$listeners")?this.$listeners:null;return"function"==typeof s?s({...this.$attrs,listeners:d,[f]:e,options:a,disabled:r,change:n,multiple:u}):s}}),x=e.defineComponent({inheritAttrs:!1,name:"CoreTree",props:g,setup(t,r){const i=e.inject(Q),a=F(t),n=e.ref([]),l=e.ref([]),u=e.computed((()=>l.value.length?l.value:t.options)),o=()=>b.value||a.value?t.customGetQuery?t.customGetQuery(n.value,s,t):t.fields?.length?t.fields.reduce(((e,r,i)=>Object.assign(e,{[r]:s(n.value[i],t.emptyValue)})),{}):{[t.field]:s(t.emitPath?[...n.value]:n.value.slice(-1)[0],t.emptyValue)}:{},{flag:p,updateFlag:c}=A(),{flag:f,updateFlag:y}=A(),h={reset(){return c(),y(),n.value=t.resetToInitialValue&&a.value?.slice()||[],this},get validator(){return t.validator},updateWrapperQuery(){c(),i&&Object.entries(o()).forEach((([e,t])=>i.updateQueryValue(e,t)))},getQuery:o};i?.register(h);const{insetDisabled:v,insetHide:g}=q(t,h),m=[];e.onBeforeUnmount((()=>m.forEach((e=>e()))));const b=e.ref("function"!=typeof t.getOptions||!!t.fields?.length);function S(e){t.getOptions?.((e=>{l.value=e||[],b.value=!0}),t.query||{},{trigger:e,change:(e,t)=>{t&&(a.value=e),k(e)},search:(e,t)=>{t&&(a.value=e),O(e),i?.search()}})}function O(e){const t=Array.isArray(e)?e:V(e);t.join("")!==n.value.join("")&&(n.value=t,h.updateWrapperQuery())}function k(e){O(e),i?.insetSearch()}function V(e){if(!e&&0!==e)return[];const{valueKey:r,childrenKey:i}=t;return d(u.value,(t=>t[r]===e)).map((e=>e[r]),i).filter(Boolean)}return e.watch(b,(e=>e&&function(){const{backfill:e,field:r,fields:i}=t;if(e)if(i){const t=i.reduce(((t,r)=>(e[r]&&t.push(e[r]),t)),[]);if(t.length)return n.value=t,void h.updateWrapperQuery()}else if(e[r])return n.value=V(e[r]),void h.updateWrapperQuery();a.value?.length&&(n.value="string"==typeof a.value?V(a.value):a.value.slice(),"string"==typeof a.value&&(a.value=n.value.slice()),h.updateWrapperQuery())}()),{immediate:!0}),m.push(e.watch((()=>t.fields||[t.field]),((e,t)=>{e.toString()!==t.toString()&&i&&t.forEach((t=>e.includes(t)||i.removeUnreferencedField(t))),h.updateWrapperQuery()}))),m.push(e.watch((()=>[t.fields?.toString()||t.field,t.fields?.map((e=>t.query[e])).filter(Boolean)||t.query[t.field]]),(([e,t],[r])=>{e===r&&p.value&&(n.value="string"==typeof t?V(t):t)}))),m.push(e.watch((()=>t.fields?.length?t.fields.reduce(((e,r)=>(t.backfill?.[r]&&e.push(t.backfill[r]),e)),[]):t.backfill?.[t.field]),(e=>{if(b.value)if(y(),Array.isArray(e))O(e);else{if(!e&&0!==e)return void(n.value.length&&(n.value=[]));O(V(e))}}))),m.push(e.watch((()=>[t.depend,t.dependFields,t.dependFields&&[].concat(t.dependFields).map((e=>t.query?.[e])).join(",")||""]),(([e,t,r],[i,a,l])=>{f.value&&r!==l&&(S("depend"),e===i&&t?.toString()===a?.toString()&&n.value.length&&O("string"==typeof n.value?"":[]))}))),m.push(e.watch((()=>t.getOptions),S.bind(null,"initial"),{immediate:!0})),{wrapper:i,option:h,checked:n,getQuery:o,finalOption:u,insetDisabled:v,insetHide:g,change:k,reset:h.reset}},render(){const{checked:e,getQuery:t,finalOption:r,insetHide:i,insetDisabled:a,change:n,reset:l}=this;if(i)return;const u=p("default",this),s=o(this,"$listeners")?this.$listeners:null;return"function"==typeof u?u({...this.$attrs,listeners:s,[f]:e,options:r,disabled:a,change:n}):u}});exports.CorePlain=j,exports.CoreTree=x,exports.CoreWrapper=w,exports.commonEmits=m,exports.commonProps=y,exports.defineCommonMethod=V,exports.defineProvideValue=k,exports.plainProps=v,exports.provideKey=Q,exports.selectEmits=S,exports.treeEmits=O,exports.treeProps=g,exports.wrapperEmits=b,exports.wrapperProps=h; | ||
"use strict";var e=require("vue-demi");function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)}var i=["attrs","props","domProps"],a=["class","style","directives"],n=["on","nativeOn"],l=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},u=t((function(e){return e.reduce((function(e,t){for(var u in t)if(e[u])if(-1!==i.indexOf(u))e[u]=r({},e[u],t[u]);else if(-1!==a.indexOf(u)){var o=e[u]instanceof Array?e[u]:[e[u]],s=t[u]instanceof Array?t[u]:[t[u]];e[u]=[].concat(o,s)}else if(-1!==n.indexOf(u))for(var d in t[u])if(e[u][d]){var p=e[u][d]instanceof Array?e[u][d]:[e[u][d]],c=t[u][d]instanceof Array?t[u][d]:[t[u][d]];e[u][d]=[].concat(p,c)}else e[u][d]=t[u][d];else if("hook"===u)for(var f in t[u])e[u][f]=e[u][f]?l(e[u][f],t[u][f]):t[u][f];else e[u]=t[u];else e[u]=t[u];return e}),{})}));function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function s(e,t){return Array.isArray(e)?e.filter(Boolean).length?e:t:"number"==typeof e?e:e||t}function d(e,t,r="children"){for(const i of e){if(t(i))return[i];if(i[r]?.length){const e=d(i[r],t);if(e.length)return e.unshift(i),e}}return[]}function p(e,t){return o(t,"$scopedSlots")&&t.$scopedSlots[e]||t.$slots[e]}const c="2.7"===e.version.slice(0,3),f=e.isVue2?"value":"modelValue",y={field:{type:String,required:!0},as:{type:String},customGetQuery:{type:Function},emptyValue:{type:[String,null,void 0],default:void 0},resetToInitialValue:{type:[Boolean]},query:{type:Object,required:!0},backfill:{type:Object},disabled:{type:[Boolean,Function]},hide:{type:[Boolean,Function]},validator:{type:[Function]},defaultValue:{type:[String,Array,Function]},depend:{type:Boolean,default:void 0},dependFields:{type:[String,Array]}},h={tag:{type:[String,Object],default:"div"},resetToInitialValue:{type:Boolean,default:void 0},datum:{type:Object,default:()=>({})},backfill:{type:Object},realtime:{type:Boolean,default:void 0},immediateSearch:{type:Boolean,default:void 0},toast:{type:Function,default:()=>{}},searchAtDatumChanged:{type:Boolean,default:void 0}},v={...y,fields:{type:[Array]},backfillToValue:{type:Function,default:e=>e},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:void 0},getOptions:{type:Function}},g={...y,fields:{type:[Array]},valueKey:{type:String,required:!0},childrenKey:{type:String},emitPath:{type:[Boolean],default:!1},options:{type:Array,default:()=>[]},getOptions:{type:Function}},m={search:e=>!0},b={...m,ready:e=>!0,reset:e=>!0},S={...m},O={...m},k="condition-wrapper";function Q(e){return e}function V(e){return e}var w=e.defineComponent({name:"CoreWrapper",props:h,emits:b,setup(t,r){const i=[];e.onBeforeUnmount((()=>i.splice(0)));const a={};let n=!1,l=[];const u={realtime:e.toRef(t,"realtime"),register(r){i.push(r);const u=()=>{n=!0,r.reset(),r.updateWrapperQuery();const u=i.indexOf(r);-1!==u&&i.splice(u,1),t.searchAtDatumChanged&&this.search(),n=!1,l.forEach((t=>{e.del(o.value,t),delete a[t]})),l=[]},s=e.getCurrentInstance();return s&&e.onBeforeUnmount(u,c?s.proxy:s),u},updateQueryValue(t,r){n&&l.push(t),e.set(o.value,t,r),a[t]=r},insetSearch(){t.realtime&&this.search()},search:d,removeUnreferencedField(t){let r=0;i.some((e=>(e.getQuery().hasOwnProperty(t)&&(r+=1),r))),r||(e.del(o.value,t),delete a[t])}};e.provide(k,u);const o=e.ref({...t.backfill}),s=()=>({...o.value,...t.backfill,...a});async function d(){const e=(await Promise.all(i.map((e=>e.validator?.(o.value))))).find((e=>e&&"string"==typeof e));if(e?t.toast(e):r.emit("search",s()),e)return e}function p(){i.forEach((e=>{e.reset(),e.updateWrapperQuery()})),r.emit("reset",s())}return e.onMounted((()=>{t.immediateSearch&&r.emit("ready",s())})),{child:i,wrapperInstance:u,query:o,getQuery:s,querySearch:d,resetAndSearch:function(){p(),d()},reset:p}},render(){const{resetToInitialValue:t,backfill:r,query:i,getQuery:a,querySearch:n,resetAndSearch:l,reset:s}=this,d=this.tag,c=this.datum,f=p("default",this),y=p("btn",this),{class:h,style:v,...g}=this.$attrs,m=(e.isVue2,{});return o(this,"$listeners")&&(m.on=this.$listeners),e.h(d,u([{},m]),[Object.entries(c).map((([e,a])=>a?"function"==typeof f?f({...g,key:e,field:a.as||e,resetToInitialValue:t,backfill:r,query:i,...a}):f||"":void 0)),"function"==typeof y?y({search:n,getQuery:a,resetAndSearch:l,reset:s}):y])}});function F(t){const r=e.ref();return e.computed({set(e){r.value=e},get:()=>void 0===r.value?void 0!==t.defaultValue?"function"==typeof t.defaultValue?t.defaultValue(t.query,t.backfill):t.defaultValue:void 0:r.value})}function q(t,r){const i=e.ref("boolean"==typeof t.disabled&&t.disabled),a=e.ref("boolean"==typeof t.hide&&t.hide),n=()=>({query:t.query,backfill:t.backfill,option:r}),l=()=>{if("function"==typeof t.hide){a.value!==t.hide(n())&&(a.value=t.hide(n()))}else if("function"==typeof t.disabled){i.value!==t.disabled(n())&&(i.value=t.disabled(n()))}};let u=[e.watch((()=>t.query),l,{immediate:!0,deep:!0}),e.watch((()=>[t.disabled,t.hide]),((e,t)=>{e[0]!==t[0]&&(i.value="boolean"==typeof e[0]&&e[0],e[0]),e[1]!==t[1]&&(a.value="boolean"==typeof e[1]&&e[1],e[1]),l()}))];return e.onBeforeUnmount((()=>(u.forEach((e=>e())),u=[]))),{insetDisabled:i,insetHide:a}}function A(t=!0){const r=e.ref(t);return{flag:r,updateFlag:()=>{r.value=!t,e.nextTick((()=>{r.value=t}))}}}var j=e.defineComponent({inheritAttrs:!1,name:"CorePlain",props:v,setup(t,r){const i=e.inject(k),a=F(t),n=t.backfill&&(t.fields?.length?t.fields.map((e=>t.backfill[e])):t.backfill[t.field]),l=e.ref(n||(void 0!==t.defaultValue?a.value:t.multiple?[]:"").slice()),u=e.ref([]),o=e.computed((()=>u.value.length?u.value:t.options)),d=()=>t.customGetQuery?t.customGetQuery(l.value,s,t):t.multiple&&t.fields?t.fields.reduce(((e,r,i)=>(e[r]=s(l.value?.[i],t.emptyValue),e)),{}):{[t.field]:s(l.value,t.emptyValue)},{flag:p,updateFlag:c}=A(),{flag:f,updateFlag:y}=A(),h={reset(){const{multiple:e}=t;c(),y(),l.value=t.resetToInitialValue&&a.value?.slice()||(e?[]:"")},updateWrapperQuery(){c(),i&&Object.entries(d()).forEach((([e,t])=>i.updateQueryValue(e,t)))},get validator(){return t.validator},getQuery:d};i?.register(h);const{insetDisabled:v,insetHide:g}=q(t,h);!n&&t.defaultValue&&h.updateWrapperQuery();const m=[];function b(e){t.getOptions?.((e=>{const t=l.value;l.value=void 0,u.value=e||[],l.value=t}),t.query||{},{trigger:e,change:(e,t)=>{t&&(a.value=e),O(e)},search:(e,t)=>{t&&(a.value=e),S(e),i?.search()}})}function S(e){e!==l.value&&(l.value=e,h.updateWrapperQuery())}function O(e){S(e),i?.insetSearch()}return e.onBeforeUnmount((()=>m.forEach((e=>e())))),m.push(e.watch((()=>t.field),((e,t)=>{e!==t&&i?.removeUnreferencedField(t),h.updateWrapperQuery()}))),m.push(e.watch((()=>[t.fields||t.field,t.fields?t.fields.map((e=>t.query[e])).filter(Boolean):t.query[t.field]]),(([e,r],[i])=>{const a=t.backfillToValue(r,e,t.query);e.toString()===i.toString()&&a?.toString()!==l.value?.toString()&&p.value&&(l.value=a)}))),m.push(e.watch((()=>[t.fields||t.field,t.fields?t.fields.map((e=>t.backfill?.[e])).filter(Boolean):t.backfill?.[t.field]]),(([e,r],[i])=>{const a=t.backfillToValue(r,e,t.backfill);e.toString()===i.toString()&&a?.toString()!==l.value?.toString()&&(y(),S(a))}))),m.push(e.watch((()=>[t.depend,t.dependFields,t.dependFields&&[].concat(t.dependFields).map((e=>t.query?.[e])).join(",")||""]),(([e,r,i],[a,n,u])=>{f.value&&i!==u&&(b("depend"),e===a&&r?.toString()===n?.toString()&&void 0!==l.value&&""!==l.value.toString()&&S(t.multiple?[]:""))}))),m.push(e.watch((()=>t.getOptions),b.bind(null,"initial"),{immediate:!0})),{wrapper:i,option:h,checked:l,getQuery:d,insetDisabled:v,insetHide:g,finalOption:o,updateCheckedValue:S,change:O,reset:h.reset}},render(){const{checked:e,getQuery:t,insetDisabled:r,insetHide:i,finalOption:a,change:n,reset:l,multiple:u}=this;if(i)return;const s=p("default",this),d=o(this,"$listeners")?this.$listeners:null;return"function"==typeof s?s({...this.$attrs,listeners:d,[f]:e,options:a,disabled:r,change:n,multiple:u}):s}}),x=e.defineComponent({inheritAttrs:!1,name:"CoreTree",props:g,setup(t,r){const i=e.inject(k),a=F(t),n=e.ref([]),l=e.ref([]),u=e.computed((()=>l.value.length?l.value:t.options)),o=()=>b.value||a.value?t.customGetQuery?t.customGetQuery(n.value,s,t):t.fields?.length?t.fields.reduce(((e,r,i)=>Object.assign(e,{[r]:s(n.value[i],t.emptyValue)})),{}):{[t.field]:s(t.emitPath?[...n.value]:n.value.slice(-1)[0],t.emptyValue)}:{},{flag:p,updateFlag:c}=A(),{flag:f,updateFlag:y}=A(),h={reset(){return c(),y(),n.value=t.resetToInitialValue&&a.value?.slice()||[],this},get validator(){return t.validator},updateWrapperQuery(){c(),i&&Object.entries(o()).forEach((([e,t])=>i.updateQueryValue(e,t)))},getQuery:o};i?.register(h);const{insetDisabled:v,insetHide:g}=q(t,h),m=[];e.onBeforeUnmount((()=>m.forEach((e=>e()))));const b=e.ref("function"!=typeof t.getOptions||!!t.fields?.length);function S(e){t.getOptions?.((e=>{l.value=e||[],b.value=!0}),t.query||{},{trigger:e,change:(e,t)=>{t&&(a.value=e),Q(e)},search:(e,t)=>{t&&(a.value=e),O(e),i?.search()}})}function O(e){const t=Array.isArray(e)?e:V(e);t.join("")!==n.value.join("")&&(n.value=t,h.updateWrapperQuery())}function Q(e){O(e),i?.insetSearch()}function V(e){if(!e&&0!==e)return[];const{valueKey:r,childrenKey:i}=t;return d(u.value,(t=>t[r]===e)).map((e=>e[r]),i).filter(Boolean)}return e.watch(b,(e=>e&&function(){const{backfill:e,field:r,fields:i}=t;if(e)if(i){const t=i.reduce(((t,r)=>(e[r]&&t.push(e[r]),t)),[]);if(t.length)return n.value=t,void h.updateWrapperQuery()}else if(e[r])return n.value=V(e[r]),void h.updateWrapperQuery();a.value?.length&&(n.value="string"==typeof a.value?V(a.value):a.value.slice(),"string"==typeof a.value&&(a.value=n.value.slice()),h.updateWrapperQuery())}()),{immediate:!0}),m.push(e.watch((()=>t.fields||[t.field]),((e,t)=>{e.toString()!==t.toString()&&i&&t.forEach((t=>e.includes(t)||i.removeUnreferencedField(t))),h.updateWrapperQuery()}))),m.push(e.watch((()=>[t.fields?.toString()||t.field,t.fields?.map((e=>t.query[e])).filter(Boolean)||t.query[t.field]]),(([e,t],[r])=>{e===r&&p.value&&(n.value="string"==typeof t?V(t):t)}))),m.push(e.watch((()=>t.fields?.length?t.fields.reduce(((e,r)=>(t.backfill?.[r]&&e.push(t.backfill[r]),e)),[]):t.backfill?.[t.field]),(e=>{if(b.value)if(y(),Array.isArray(e))O(e);else{if(!e&&0!==e)return void(n.value.length&&(n.value=[]));O(V(e))}}))),m.push(e.watch((()=>[t.depend,t.dependFields,t.dependFields&&[].concat(t.dependFields).map((e=>t.query?.[e])).join(",")||""]),(([e,t,r],[i,a,l])=>{f.value&&r!==l&&(S("depend"),e===i&&t?.toString()===a?.toString()&&n.value.length&&O("string"==typeof n.value?"":[]))}))),m.push(e.watch((()=>t.getOptions),S.bind(null,"initial"),{immediate:!0})),{wrapper:i,option:h,checked:n,getQuery:o,finalOption:u,insetDisabled:v,insetHide:g,change:Q,reset:h.reset}},render(){const{checked:e,getQuery:t,finalOption:r,insetHide:i,insetDisabled:a,change:n,reset:l}=this;if(i)return;const u=p("default",this),s=o(this,"$listeners")?this.$listeners:null;return"function"==typeof u?u({...this.$attrs,listeners:s,[f]:e,options:r,disabled:a,change:n}):u}});exports.CorePlain=j,exports.CoreTree=x,exports.CoreWrapper=w,exports.commonEmits=m,exports.commonProps=y,exports.defineCommonMethod=V,exports.defineProvideValue=Q,exports.plainProps=v,exports.provideKey=k,exports.selectEmits=S,exports.treeEmits=O,exports.treeProps=g,exports.wrapperEmits=b,exports.wrapperProps=h; | ||
//# sourceMappingURL=index.cjs.min.js.map |
@@ -538,3 +538,3 @@ import { version, isVue2, defineComponent, onBeforeUnmount, toRef, getCurrentInstance, set, del, provide, ref, onMounted, h, computed, watch, nextTick, inject } from 'vue-demi'; | ||
/** 初始是否存在回填值 */ | ||
const initialBackfillValue = props.backfill && props.backfill[props.field]; | ||
const initialBackfillValue = props.backfill && (props.fields?.length ? props.fields.map(key => props.backfill[key]) : props.backfill[props.field]); | ||
/** 当前选中值 */ | ||
@@ -541,0 +541,0 @@ const checked = ref(initialBackfillValue || (props.defaultValue !== undefined ? initialValue.value : props.multiple ? [] : '' |
@@ -1,2 +0,2 @@ | ||
import{version as e,isVue2 as t,defineComponent as i,onBeforeUnmount as a,toRef as r,getCurrentInstance as l,set as n,del as u,provide as o,ref as s,onMounted as d,h as p,computed as c,watch as f,nextTick as y,inject as v}from"vue-demi";function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t,i=1;i<arguments.length;i++)for(var a in t=arguments[i])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},g.apply(this,arguments)}var m=["attrs","props","domProps"],b=["class","style","directives"],S=["on","nativeOn"],O=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},Q=function(e){return e.reduce((function(e,t){for(var i in t)if(e[i])if(-1!==m.indexOf(i))e[i]=g({},e[i],t[i]);else if(-1!==b.indexOf(i)){var a=e[i]instanceof Array?e[i]:[e[i]],r=t[i]instanceof Array?t[i]:[t[i]];e[i]=[].concat(a,r)}else if(-1!==S.indexOf(i))for(var l in t[i])if(e[i][l]){var n=e[i][l]instanceof Array?e[i][l]:[e[i][l]],u=t[i][l]instanceof Array?t[i][l]:[t[i][l]];e[i][l]=[].concat(n,u)}else e[i][l]=t[i][l];else if("hook"===i)for(var o in t[i])e[i][o]=e[i][o]?O(e[i][o],t[i][o]):t[i][o];else e[i]=t[i];else e[i]=t[i];return e}),{})},k=h(Q);function V(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function F(e,t){return Array.isArray(e)?e.filter(Boolean).length?e:t:"number"==typeof e?e:e||t}function A(e,t,i="children"){for(const a of e){if(t(a))return[a];if(a[i]?.length){const e=A(a[i],t);if(e.length)return e.unshift(a),e}}return[]}function q(e,t){return V(t,"$scopedSlots")&&t.$scopedSlots[e]||t.$slots[e]}const j="2.7"===e.slice(0,3),B=t?"value":"modelValue",W={field:{type:String,required:!0},as:{type:String},customGetQuery:{type:Function},emptyValue:{type:[String,null,void 0],default:void 0},resetToInitialValue:{type:[Boolean]},query:{type:Object,required:!0},backfill:{type:Object},disabled:{type:[Boolean,Function]},hide:{type:[Boolean,Function]},validator:{type:[Function]},defaultValue:{type:[String,Array,Function]},depend:{type:Boolean,default:void 0},dependFields:{type:[String,Array]}},$={tag:{type:[String,Object],default:"div"},resetToInitialValue:{type:Boolean,default:void 0},datum:{type:Object,default:()=>({})},backfill:{type:Object},realtime:{type:Boolean,default:void 0},immediateSearch:{type:Boolean,default:void 0},toast:{type:Function,default:()=>{}},searchAtDatumChanged:{type:Boolean,default:void 0}},T={...W,fields:{type:[Array]},backfillToValue:{type:Function,default:e=>e},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:void 0},getOptions:{type:Function}},P={...W,fields:{type:[Array]},valueKey:{type:String,required:!0},childrenKey:{type:String},emitPath:{type:[Boolean],default:!1},options:{type:Array,default:()=>[]},getOptions:{type:Function}},w={search:e=>!0},C={...w,ready:e=>!0,reset:e=>!0},D={...w},E={...w},H="condition-wrapper";function I(e){return e}function x(e){return e}var G=i({name:"CoreWrapper",props:$,emits:C,setup(e,t){const i=[];a((()=>i.splice(0)));const p={};let c=!1,f=[];const y={realtime:r(e,"realtime"),register(t){i.push(t);const r=()=>{c=!0,t.reset(),t.updateWrapperQuery();const a=i.indexOf(t);-1!==a&&i.splice(a,1),e.searchAtDatumChanged&&this.search(),c=!1,f.forEach((e=>{u(v.value,e),delete p[e]})),f=[]},n=l();return n&&a(r,j?n.proxy:n),r},updateQueryValue(e,t){c&&f.push(e),n(v.value,e,t),p[e]=t},insetSearch(){e.realtime&&this.search()},search:g,removeUnreferencedField(e){let t=0;i.some((i=>(i.getQuery().hasOwnProperty(e)&&(t+=1),t))),t||(u(v.value,e),delete p[e])}};o(H,y);const v=s({...e.backfill}),h=()=>({...v.value,...e.backfill,...p});async function g(){const a=(await Promise.all(i.map((e=>e.validator?.(v.value))))).find((e=>e&&"string"==typeof e));if(a?e.toast(a):t.emit("search",h()),a)return a}function m(){i.forEach((e=>{e.reset(),e.updateWrapperQuery()})),t.emit("reset",h())}return d((()=>{e.immediateSearch&&t.emit("ready",h())})),{child:i,wrapperInstance:y,query:v,getQuery:h,querySearch:g,resetAndSearch:function(){m(),g()},reset:m}},render(){const{resetToInitialValue:e,backfill:t,query:i,getQuery:a,querySearch:r,resetAndSearch:l,reset:n}=this,u=this.tag,o=this.datum,s=q("default",this),d=q("btn",this),{class:c,style:f,...y}=this.$attrs,v={};return V(this,"$listeners")&&(v.on=this.$listeners),p(u,k([{},v]),[Object.entries(o).map((([a,r])=>r?"function"==typeof s?s({...y,key:a,field:r.as||a,resetToInitialValue:e,backfill:t,query:i,...r}):s||"":void 0)),"function"==typeof d?d({search:r,getQuery:a,resetAndSearch:l,reset:n}):d])}});function K(e){const t=s();return c({set(e){t.value=e},get:()=>void 0===t.value?void 0!==e.defaultValue?"function"==typeof e.defaultValue?e.defaultValue(e.query,e.backfill):e.defaultValue:void 0:t.value})}function U(e,t){const i=s("boolean"==typeof e.disabled&&e.disabled),r=s("boolean"==typeof e.hide&&e.hide),l=()=>({query:e.query,backfill:e.backfill,option:t}),n=()=>{if("function"==typeof e.hide){r.value!==e.hide(l())&&(r.value=e.hide(l()))}else if("function"==typeof e.disabled){i.value!==e.disabled(l())&&(i.value=e.disabled(l()))}};let u=[f((()=>e.query),n,{immediate:!0,deep:!0}),f((()=>[e.disabled,e.hide]),((e,t)=>{e[0]!==t[0]&&(i.value="boolean"==typeof e[0]&&e[0],e[0]),e[1]!==t[1]&&(r.value="boolean"==typeof e[1]&&e[1],e[1]),n()}))];return a((()=>(u.forEach((e=>e())),u=[]))),{insetDisabled:i,insetHide:r}}function _(e=!0){const t=s(e);return{flag:t,updateFlag:()=>{t.value=!e,y((()=>{t.value=e}))}}}var M=i({inheritAttrs:!1,name:"CorePlain",props:T,setup(e,t){const i=v(H),r=K(e),l=e.backfill&&e.backfill[e.field],n=s(l||(void 0!==e.defaultValue?r.value:e.multiple?[]:"").slice()),u=s([]),o=c((()=>u.value.length?u.value:e.options)),d=()=>e.customGetQuery?e.customGetQuery(n.value,F,e):e.multiple&&e.fields?e.fields.reduce(((t,i,a)=>(t[i]=F(n.value?.[a],e.emptyValue),t)),{}):{[e.field]:F(n.value,e.emptyValue)},{flag:p,updateFlag:y}=_(),{flag:h,updateFlag:g}=_(),m={reset(){const{multiple:t}=e;y(),g(),n.value=e.resetToInitialValue&&r.value?.slice()||(t?[]:"")},updateWrapperQuery(){y(),i&&Object.entries(d()).forEach((([e,t])=>i.updateQueryValue(e,t)))},get validator(){return e.validator},getQuery:d};i?.register(m);const{insetDisabled:b,insetHide:S}=U(e,m);!l&&e.defaultValue&&m.updateWrapperQuery();const O=[];function Q(t){e.getOptions?.((e=>{const t=n.value;n.value=void 0,u.value=e||[],n.value=t}),e.query||{},{trigger:t,change:(e,t)=>{t&&(r.value=e),V(e)},search:(e,t)=>{t&&(r.value=e),k(e),i?.search()}})}function k(e){e!==n.value&&(n.value=e,m.updateWrapperQuery())}function V(e){k(e),i?.insetSearch()}return a((()=>O.forEach((e=>e())))),O.push(f((()=>e.field),((e,t)=>{e!==t&&i?.removeUnreferencedField(t),m.updateWrapperQuery()}))),O.push(f((()=>[e.fields||e.field,e.fields?e.fields.map((t=>e.query[t])).filter(Boolean):e.query[e.field]]),(([t,i],[a])=>{const r=e.backfillToValue(i,t,e.query);t.toString()===a.toString()&&r?.toString()!==n.value?.toString()&&p.value&&(n.value=r)}))),O.push(f((()=>[e.fields||e.field,e.fields?e.fields.map((t=>e.backfill?.[t])).filter(Boolean):e.backfill?.[e.field]]),(([t,i],[a])=>{const r=e.backfillToValue(i,t,e.backfill);t.toString()===a.toString()&&r?.toString()!==n.value?.toString()&&(g(),k(r))}))),O.push(f((()=>[e.depend,e.dependFields,e.dependFields&&[].concat(e.dependFields).map((t=>e.query?.[t])).join(",")||""]),(([t,i,a],[r,l,u])=>{h.value&&a!==u&&(Q("depend"),t===r&&i?.toString()===l?.toString()&&void 0!==n.value&&""!==n.value.toString()&&k(e.multiple?[]:""))}))),O.push(f((()=>e.getOptions),Q.bind(null,"initial"),{immediate:!0})),{wrapper:i,option:m,checked:n,getQuery:d,insetDisabled:b,insetHide:S,finalOption:o,updateCheckedValue:k,change:V,reset:m.reset}},render(){const{checked:e,getQuery:t,insetDisabled:i,insetHide:a,finalOption:r,change:l,reset:n,multiple:u}=this;if(a)return;const o=q("default",this),s=V(this,"$listeners")?this.$listeners:null;return"function"==typeof o?o({...this.$attrs,listeners:s,[B]:e,options:r,disabled:i,change:l,multiple:u}):o}}),z=i({inheritAttrs:!1,name:"CoreTree",props:P,setup(e,t){const i=v(H),r=K(e),l=s([]),n=s([]),u=c((()=>n.value.length?n.value:e.options)),o=()=>O.value||r.value?e.customGetQuery?e.customGetQuery(l.value,F,e):e.fields?.length?e.fields.reduce(((t,i,a)=>Object.assign(t,{[i]:F(l.value[a],e.emptyValue)})),{}):{[e.field]:F(e.emitPath?[...l.value]:l.value.slice(-1)[0],e.emptyValue)}:{},{flag:d,updateFlag:p}=_(),{flag:y,updateFlag:h}=_(),g={reset(){return p(),h(),l.value=e.resetToInitialValue&&r.value?.slice()||[],this},get validator(){return e.validator},updateWrapperQuery(){p(),i&&Object.entries(o()).forEach((([e,t])=>i.updateQueryValue(e,t)))},getQuery:o};i?.register(g);const{insetDisabled:m,insetHide:b}=U(e,g),S=[];a((()=>S.forEach((e=>e()))));const O=s("function"!=typeof e.getOptions||!!e.fields?.length);function Q(t){e.getOptions?.((e=>{n.value=e||[],O.value=!0}),e.query||{},{trigger:t,change:(e,t)=>{t&&(r.value=e),V(e)},search:(e,t)=>{t&&(r.value=e),k(e),i?.search()}})}function k(e){const t=Array.isArray(e)?e:q(e);t.join("")!==l.value.join("")&&(l.value=t,g.updateWrapperQuery())}function V(e){k(e),i?.insetSearch()}function q(t){if(!t&&0!==t)return[];const{valueKey:i,childrenKey:a}=e;return A(u.value,(e=>e[i]===t)).map((e=>e[i]),a).filter(Boolean)}return f(O,(t=>t&&function(){const{backfill:t,field:i,fields:a}=e;if(t)if(a){const e=a.reduce(((e,i)=>(t[i]&&e.push(t[i]),e)),[]);if(e.length)return l.value=e,void g.updateWrapperQuery()}else if(t[i])return l.value=q(t[i]),void g.updateWrapperQuery();r.value?.length&&(l.value="string"==typeof r.value?q(r.value):r.value.slice(),"string"==typeof r.value&&(r.value=l.value.slice()),g.updateWrapperQuery())}()),{immediate:!0}),S.push(f((()=>e.fields||[e.field]),((e,t)=>{e.toString()!==t.toString()&&i&&t.forEach((t=>e.includes(t)||i.removeUnreferencedField(t))),g.updateWrapperQuery()}))),S.push(f((()=>[e.fields?.toString()||e.field,e.fields?.map((t=>e.query[t])).filter(Boolean)||e.query[e.field]]),(([e,t],[i])=>{e===i&&d.value&&(l.value="string"==typeof t?q(t):t)}))),S.push(f((()=>e.fields?.length?e.fields.reduce(((t,i)=>(e.backfill?.[i]&&t.push(e.backfill[i]),t)),[]):e.backfill?.[e.field]),(e=>{if(O.value)if(h(),Array.isArray(e))k(e);else{if(!e&&0!==e)return void(l.value.length&&(l.value=[]));k(q(e))}}))),S.push(f((()=>[e.depend,e.dependFields,e.dependFields&&[].concat(e.dependFields).map((t=>e.query?.[t])).join(",")||""]),(([e,t,i],[a,r,n])=>{y.value&&i!==n&&(Q("depend"),e===a&&t?.toString()===r?.toString()&&l.value.length&&k("string"==typeof l.value?"":[]))}))),S.push(f((()=>e.getOptions),Q.bind(null,"initial"),{immediate:!0})),{wrapper:i,option:g,checked:l,getQuery:o,finalOption:u,insetDisabled:m,insetHide:b,change:V,reset:g.reset}},render(){const{checked:e,getQuery:t,finalOption:i,insetHide:a,insetDisabled:r,change:l,reset:n}=this;if(a)return;const u=q("default",this),o=V(this,"$listeners")?this.$listeners:null;return"function"==typeof u?u({...this.$attrs,listeners:o,[B]:e,options:i,disabled:r,change:l}):u}});export{M as CorePlain,z as CoreTree,G as CoreWrapper,w as commonEmits,W as commonProps,x as defineCommonMethod,I as defineProvideValue,T as plainProps,H as provideKey,D as selectEmits,E as treeEmits,P as treeProps,C as wrapperEmits,$ as wrapperProps}; | ||
import{version as e,isVue2 as t,defineComponent as i,onBeforeUnmount as a,toRef as r,getCurrentInstance as l,set as n,del as u,provide as s,ref as o,onMounted as d,h as p,computed as c,watch as f,nextTick as y,inject as h}from"vue-demi";function v(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t,i=1;i<arguments.length;i++)for(var a in t=arguments[i])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},g.apply(this,arguments)}var m=["attrs","props","domProps"],b=["class","style","directives"],S=["on","nativeOn"],O=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},Q=function(e){return e.reduce((function(e,t){for(var i in t)if(e[i])if(-1!==m.indexOf(i))e[i]=g({},e[i],t[i]);else if(-1!==b.indexOf(i)){var a=e[i]instanceof Array?e[i]:[e[i]],r=t[i]instanceof Array?t[i]:[t[i]];e[i]=[].concat(a,r)}else if(-1!==S.indexOf(i))for(var l in t[i])if(e[i][l]){var n=e[i][l]instanceof Array?e[i][l]:[e[i][l]],u=t[i][l]instanceof Array?t[i][l]:[t[i][l]];e[i][l]=[].concat(n,u)}else e[i][l]=t[i][l];else if("hook"===i)for(var s in t[i])e[i][s]=e[i][s]?O(e[i][s],t[i][s]):t[i][s];else e[i]=t[i];else e[i]=t[i];return e}),{})},k=v(Q);function V(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function F(e,t){return Array.isArray(e)?e.filter(Boolean).length?e:t:"number"==typeof e?e:e||t}function A(e,t,i="children"){for(const a of e){if(t(a))return[a];if(a[i]?.length){const e=A(a[i],t);if(e.length)return e.unshift(a),e}}return[]}function q(e,t){return V(t,"$scopedSlots")&&t.$scopedSlots[e]||t.$slots[e]}const j="2.7"===e.slice(0,3),B=t?"value":"modelValue",W={field:{type:String,required:!0},as:{type:String},customGetQuery:{type:Function},emptyValue:{type:[String,null,void 0],default:void 0},resetToInitialValue:{type:[Boolean]},query:{type:Object,required:!0},backfill:{type:Object},disabled:{type:[Boolean,Function]},hide:{type:[Boolean,Function]},validator:{type:[Function]},defaultValue:{type:[String,Array,Function]},depend:{type:Boolean,default:void 0},dependFields:{type:[String,Array]}},$={tag:{type:[String,Object],default:"div"},resetToInitialValue:{type:Boolean,default:void 0},datum:{type:Object,default:()=>({})},backfill:{type:Object},realtime:{type:Boolean,default:void 0},immediateSearch:{type:Boolean,default:void 0},toast:{type:Function,default:()=>{}},searchAtDatumChanged:{type:Boolean,default:void 0}},T={...W,fields:{type:[Array]},backfillToValue:{type:Function,default:e=>e},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:void 0},getOptions:{type:Function}},P={...W,fields:{type:[Array]},valueKey:{type:String,required:!0},childrenKey:{type:String},emitPath:{type:[Boolean],default:!1},options:{type:Array,default:()=>[]},getOptions:{type:Function}},w={search:e=>!0},C={...w,ready:e=>!0,reset:e=>!0},D={...w},E={...w},H="condition-wrapper";function I(e){return e}function x(e){return e}var G=i({name:"CoreWrapper",props:$,emits:C,setup(e,t){const i=[];a((()=>i.splice(0)));const p={};let c=!1,f=[];const y={realtime:r(e,"realtime"),register(t){i.push(t);const r=()=>{c=!0,t.reset(),t.updateWrapperQuery();const a=i.indexOf(t);-1!==a&&i.splice(a,1),e.searchAtDatumChanged&&this.search(),c=!1,f.forEach((e=>{u(h.value,e),delete p[e]})),f=[]},n=l();return n&&a(r,j?n.proxy:n),r},updateQueryValue(e,t){c&&f.push(e),n(h.value,e,t),p[e]=t},insetSearch(){e.realtime&&this.search()},search:g,removeUnreferencedField(e){let t=0;i.some((i=>(i.getQuery().hasOwnProperty(e)&&(t+=1),t))),t||(u(h.value,e),delete p[e])}};s(H,y);const h=o({...e.backfill}),v=()=>({...h.value,...e.backfill,...p});async function g(){const a=(await Promise.all(i.map((e=>e.validator?.(h.value))))).find((e=>e&&"string"==typeof e));if(a?e.toast(a):t.emit("search",v()),a)return a}function m(){i.forEach((e=>{e.reset(),e.updateWrapperQuery()})),t.emit("reset",v())}return d((()=>{e.immediateSearch&&t.emit("ready",v())})),{child:i,wrapperInstance:y,query:h,getQuery:v,querySearch:g,resetAndSearch:function(){m(),g()},reset:m}},render(){const{resetToInitialValue:e,backfill:t,query:i,getQuery:a,querySearch:r,resetAndSearch:l,reset:n}=this,u=this.tag,s=this.datum,o=q("default",this),d=q("btn",this),{class:c,style:f,...y}=this.$attrs,h={};return V(this,"$listeners")&&(h.on=this.$listeners),p(u,k([{},h]),[Object.entries(s).map((([a,r])=>r?"function"==typeof o?o({...y,key:a,field:r.as||a,resetToInitialValue:e,backfill:t,query:i,...r}):o||"":void 0)),"function"==typeof d?d({search:r,getQuery:a,resetAndSearch:l,reset:n}):d])}});function K(e){const t=o();return c({set(e){t.value=e},get:()=>void 0===t.value?void 0!==e.defaultValue?"function"==typeof e.defaultValue?e.defaultValue(e.query,e.backfill):e.defaultValue:void 0:t.value})}function U(e,t){const i=o("boolean"==typeof e.disabled&&e.disabled),r=o("boolean"==typeof e.hide&&e.hide),l=()=>({query:e.query,backfill:e.backfill,option:t}),n=()=>{if("function"==typeof e.hide){r.value!==e.hide(l())&&(r.value=e.hide(l()))}else if("function"==typeof e.disabled){i.value!==e.disabled(l())&&(i.value=e.disabled(l()))}};let u=[f((()=>e.query),n,{immediate:!0,deep:!0}),f((()=>[e.disabled,e.hide]),((e,t)=>{e[0]!==t[0]&&(i.value="boolean"==typeof e[0]&&e[0],e[0]),e[1]!==t[1]&&(r.value="boolean"==typeof e[1]&&e[1],e[1]),n()}))];return a((()=>(u.forEach((e=>e())),u=[]))),{insetDisabled:i,insetHide:r}}function _(e=!0){const t=o(e);return{flag:t,updateFlag:()=>{t.value=!e,y((()=>{t.value=e}))}}}var M=i({inheritAttrs:!1,name:"CorePlain",props:T,setup(e,t){const i=h(H),r=K(e),l=e.backfill&&(e.fields?.length?e.fields.map((t=>e.backfill[t])):e.backfill[e.field]),n=o(l||(void 0!==e.defaultValue?r.value:e.multiple?[]:"").slice()),u=o([]),s=c((()=>u.value.length?u.value:e.options)),d=()=>e.customGetQuery?e.customGetQuery(n.value,F,e):e.multiple&&e.fields?e.fields.reduce(((t,i,a)=>(t[i]=F(n.value?.[a],e.emptyValue),t)),{}):{[e.field]:F(n.value,e.emptyValue)},{flag:p,updateFlag:y}=_(),{flag:v,updateFlag:g}=_(),m={reset(){const{multiple:t}=e;y(),g(),n.value=e.resetToInitialValue&&r.value?.slice()||(t?[]:"")},updateWrapperQuery(){y(),i&&Object.entries(d()).forEach((([e,t])=>i.updateQueryValue(e,t)))},get validator(){return e.validator},getQuery:d};i?.register(m);const{insetDisabled:b,insetHide:S}=U(e,m);!l&&e.defaultValue&&m.updateWrapperQuery();const O=[];function Q(t){e.getOptions?.((e=>{const t=n.value;n.value=void 0,u.value=e||[],n.value=t}),e.query||{},{trigger:t,change:(e,t)=>{t&&(r.value=e),V(e)},search:(e,t)=>{t&&(r.value=e),k(e),i?.search()}})}function k(e){e!==n.value&&(n.value=e,m.updateWrapperQuery())}function V(e){k(e),i?.insetSearch()}return a((()=>O.forEach((e=>e())))),O.push(f((()=>e.field),((e,t)=>{e!==t&&i?.removeUnreferencedField(t),m.updateWrapperQuery()}))),O.push(f((()=>[e.fields||e.field,e.fields?e.fields.map((t=>e.query[t])).filter(Boolean):e.query[e.field]]),(([t,i],[a])=>{const r=e.backfillToValue(i,t,e.query);t.toString()===a.toString()&&r?.toString()!==n.value?.toString()&&p.value&&(n.value=r)}))),O.push(f((()=>[e.fields||e.field,e.fields?e.fields.map((t=>e.backfill?.[t])).filter(Boolean):e.backfill?.[e.field]]),(([t,i],[a])=>{const r=e.backfillToValue(i,t,e.backfill);t.toString()===a.toString()&&r?.toString()!==n.value?.toString()&&(g(),k(r))}))),O.push(f((()=>[e.depend,e.dependFields,e.dependFields&&[].concat(e.dependFields).map((t=>e.query?.[t])).join(",")||""]),(([t,i,a],[r,l,u])=>{v.value&&a!==u&&(Q("depend"),t===r&&i?.toString()===l?.toString()&&void 0!==n.value&&""!==n.value.toString()&&k(e.multiple?[]:""))}))),O.push(f((()=>e.getOptions),Q.bind(null,"initial"),{immediate:!0})),{wrapper:i,option:m,checked:n,getQuery:d,insetDisabled:b,insetHide:S,finalOption:s,updateCheckedValue:k,change:V,reset:m.reset}},render(){const{checked:e,getQuery:t,insetDisabled:i,insetHide:a,finalOption:r,change:l,reset:n,multiple:u}=this;if(a)return;const s=q("default",this),o=V(this,"$listeners")?this.$listeners:null;return"function"==typeof s?s({...this.$attrs,listeners:o,[B]:e,options:r,disabled:i,change:l,multiple:u}):s}}),z=i({inheritAttrs:!1,name:"CoreTree",props:P,setup(e,t){const i=h(H),r=K(e),l=o([]),n=o([]),u=c((()=>n.value.length?n.value:e.options)),s=()=>O.value||r.value?e.customGetQuery?e.customGetQuery(l.value,F,e):e.fields?.length?e.fields.reduce(((t,i,a)=>Object.assign(t,{[i]:F(l.value[a],e.emptyValue)})),{}):{[e.field]:F(e.emitPath?[...l.value]:l.value.slice(-1)[0],e.emptyValue)}:{},{flag:d,updateFlag:p}=_(),{flag:y,updateFlag:v}=_(),g={reset(){return p(),v(),l.value=e.resetToInitialValue&&r.value?.slice()||[],this},get validator(){return e.validator},updateWrapperQuery(){p(),i&&Object.entries(s()).forEach((([e,t])=>i.updateQueryValue(e,t)))},getQuery:s};i?.register(g);const{insetDisabled:m,insetHide:b}=U(e,g),S=[];a((()=>S.forEach((e=>e()))));const O=o("function"!=typeof e.getOptions||!!e.fields?.length);function Q(t){e.getOptions?.((e=>{n.value=e||[],O.value=!0}),e.query||{},{trigger:t,change:(e,t)=>{t&&(r.value=e),V(e)},search:(e,t)=>{t&&(r.value=e),k(e),i?.search()}})}function k(e){const t=Array.isArray(e)?e:q(e);t.join("")!==l.value.join("")&&(l.value=t,g.updateWrapperQuery())}function V(e){k(e),i?.insetSearch()}function q(t){if(!t&&0!==t)return[];const{valueKey:i,childrenKey:a}=e;return A(u.value,(e=>e[i]===t)).map((e=>e[i]),a).filter(Boolean)}return f(O,(t=>t&&function(){const{backfill:t,field:i,fields:a}=e;if(t)if(a){const e=a.reduce(((e,i)=>(t[i]&&e.push(t[i]),e)),[]);if(e.length)return l.value=e,void g.updateWrapperQuery()}else if(t[i])return l.value=q(t[i]),void g.updateWrapperQuery();r.value?.length&&(l.value="string"==typeof r.value?q(r.value):r.value.slice(),"string"==typeof r.value&&(r.value=l.value.slice()),g.updateWrapperQuery())}()),{immediate:!0}),S.push(f((()=>e.fields||[e.field]),((e,t)=>{e.toString()!==t.toString()&&i&&t.forEach((t=>e.includes(t)||i.removeUnreferencedField(t))),g.updateWrapperQuery()}))),S.push(f((()=>[e.fields?.toString()||e.field,e.fields?.map((t=>e.query[t])).filter(Boolean)||e.query[e.field]]),(([e,t],[i])=>{e===i&&d.value&&(l.value="string"==typeof t?q(t):t)}))),S.push(f((()=>e.fields?.length?e.fields.reduce(((t,i)=>(e.backfill?.[i]&&t.push(e.backfill[i]),t)),[]):e.backfill?.[e.field]),(e=>{if(O.value)if(v(),Array.isArray(e))k(e);else{if(!e&&0!==e)return void(l.value.length&&(l.value=[]));k(q(e))}}))),S.push(f((()=>[e.depend,e.dependFields,e.dependFields&&[].concat(e.dependFields).map((t=>e.query?.[t])).join(",")||""]),(([e,t,i],[a,r,n])=>{y.value&&i!==n&&(Q("depend"),e===a&&t?.toString()===r?.toString()&&l.value.length&&k("string"==typeof l.value?"":[]))}))),S.push(f((()=>e.getOptions),Q.bind(null,"initial"),{immediate:!0})),{wrapper:i,option:g,checked:l,getQuery:s,finalOption:u,insetDisabled:m,insetHide:b,change:V,reset:g.reset}},render(){const{checked:e,getQuery:t,finalOption:i,insetHide:a,insetDisabled:r,change:l,reset:n}=this;if(a)return;const u=q("default",this),s=V(this,"$listeners")?this.$listeners:null;return"function"==typeof u?u({...this.$attrs,listeners:s,[B]:e,options:i,disabled:r,change:l}):u}});export{M as CorePlain,z as CoreTree,G as CoreWrapper,w as commonEmits,W as commonProps,x as defineCommonMethod,I as defineProvideValue,T as plainProps,H as provideKey,D as selectEmits,E as treeEmits,P as treeProps,C as wrapperEmits,$ as wrapperProps}; | ||
//# sourceMappingURL=index.esm.min.js.map |
@@ -658,3 +658,3 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) { | ||
/** 初始是否存在回填值 */ | ||
const initialBackfillValue = props.backfill && props.backfill[props.field]; | ||
const initialBackfillValue = props.backfill && (props.fields?.length ? props.fields.map(key => props.backfill[key]) : props.backfill[props.field]); | ||
/** 当前选中值 */ | ||
@@ -661,0 +661,0 @@ const checked = vueDemi.ref(initialBackfillValue || (props.defaultValue !== undefined ? initialValue.value : props.multiple ? [] : '' |
@@ -1,2 +0,2 @@ | ||
var VueDemi=function(e,t,i){if(e.install)return e;if(!t)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if("2.7."===t.version.slice(0,4)){for(var n in t)e[n]=t[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=t,e.Vue2=t,e.version=t.version,e.warn=t.util.warn,e.hasInjectionContext=()=>!!e.getCurrentInstance(),e.createApp=function(e,i){var n,r={},a={config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),provide:function(e,t){return r[e]=t,this},directive:function(e,i){return i?(t.directive(e,i),a):t.directive(e)},mount:function(a,o){return n||((n=new t(Object.assign({propsData:i},e,{provide:Object.assign(r,e.provide)}))).$mount(a,o),n)},unmount:function(){n&&(n.$destroy(),n=void 0)}};return a}}else if("2."===t.version.slice(0,2))if(i){for(var n in i)e[n]=i[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=t,e.Vue2=t,e.version=t.version,e.hasInjectionContext=()=>!!e.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if("3."===t.version.slice(0,2)){for(var n in t)e[n]=t[n];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=t,e.Vue2=void 0,e.version=t.version,e.set=function(e,t,i){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,i),i):(e[t]=i,i)},e.del=function(e,t){Array.isArray(e)?e.splice(t,1):delete e[t]}}else console.error("[vue-demi] Vue version "+t.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(void 0!==VueDemi?VueDemi:{}),this.Vue||("undefined"!=typeof Vue?Vue:void 0),this.VueCompositionAPI||("undefined"!=typeof VueCompositionAPI?VueCompositionAPI:void 0));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue-demi")):"function"==typeof define&&define.amd?define(["exports","vue-demi"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CoreCondition={},e.VueDemi)}(this,(function(e,t){"use strict";function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t,i=1;i<arguments.length;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},n.apply(this,arguments)}var r=["attrs","props","domProps"],a=["class","style","directives"],o=["on","nativeOn"],u=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},l=i((function(e){return e.reduce((function(e,t){for(var i in t)if(e[i])if(-1!==r.indexOf(i))e[i]=n({},e[i],t[i]);else if(-1!==a.indexOf(i)){var l=e[i]instanceof Array?e[i]:[e[i]],s=t[i]instanceof Array?t[i]:[t[i]];e[i]=[].concat(l,s)}else if(-1!==o.indexOf(i))for(var d in t[i])if(e[i][d]){var c=e[i][d]instanceof Array?e[i][d]:[e[i][d]],f=t[i][d]instanceof Array?t[i][d]:[t[i][d]];e[i][d]=[].concat(c,f)}else e[i][d]=t[i][d];else if("hook"===i)for(var p in t[i])e[i][p]=e[i][p]?u(e[i][p],t[i][p]):t[i][p];else e[i]=t[i];else e[i]=t[i];return e}),{})}));function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d(e,t){return Array.isArray(e)?e.filter(Boolean).length?e:t:"number"==typeof e?e:e||t}function c(e,t,i="children"){for(const n of e){if(t(n))return[n];if(n[i]?.length){const e=c(n[i],t);if(e.length)return e.unshift(n),e}}return[]}function f(e,t){return s(t,"$scopedSlots")&&t.$scopedSlots[e]||t.$slots[e]}const p="2.7"===t.version.slice(0,3),v=t.isVue2?"value":"modelValue",y={field:{type:String,required:!0},as:{type:String},customGetQuery:{type:Function},emptyValue:{type:[String,null,void 0],default:void 0},resetToInitialValue:{type:[Boolean]},query:{type:Object,required:!0},backfill:{type:Object},disabled:{type:[Boolean,Function]},hide:{type:[Boolean,Function]},validator:{type:[Function]},defaultValue:{type:[String,Array,Function]},depend:{type:Boolean,default:void 0},dependFields:{type:[String,Array]}},h={tag:{type:[String,Object],default:"div"},resetToInitialValue:{type:Boolean,default:void 0},datum:{type:Object,default:()=>({})},backfill:{type:Object},realtime:{type:Boolean,default:void 0},immediateSearch:{type:Boolean,default:void 0},toast:{type:Function,default:()=>{}},searchAtDatumChanged:{type:Boolean,default:void 0}},m={...y,fields:{type:[Array]},backfillToValue:{type:Function,default:e=>e},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:void 0},getOptions:{type:Function}},g={...y,fields:{type:[Array]},valueKey:{type:String,required:!0},childrenKey:{type:String},emitPath:{type:[Boolean],default:!1},options:{type:Array,default:()=>[]},getOptions:{type:Function}},b={search:e=>!0},V={...b,ready:e=>!0,reset:e=>!0},O={...b},S={...b},A="condition-wrapper";function Q(e){return e}function k(e){return e}var w=t.defineComponent({name:"CoreWrapper",props:h,emits:V,setup(e,i){const n=[];t.onBeforeUnmount((()=>n.splice(0)));const r={};let a=!1,o=[];const u={realtime:t.toRef(e,"realtime"),register(i){n.push(i);const u=()=>{a=!0,i.reset(),i.updateWrapperQuery();const u=n.indexOf(i);-1!==u&&n.splice(u,1),e.searchAtDatumChanged&&this.search(),a=!1,o.forEach((e=>{t.del(l.value,e),delete r[e]})),o=[]},s=t.getCurrentInstance();return s&&t.onBeforeUnmount(u,p?s.proxy:s),u},updateQueryValue(e,i){a&&o.push(e),t.set(l.value,e,i),r[e]=i},insetSearch(){e.realtime&&this.search()},search:d,removeUnreferencedField(e){let i=0;n.some((t=>(t.getQuery().hasOwnProperty(e)&&(i+=1),i))),i||(t.del(l.value,e),delete r[e])}};t.provide(A,u);const l=t.ref({...e.backfill}),s=()=>({...l.value,...e.backfill,...r});async function d(){const t=(await Promise.all(n.map((e=>e.validator?.(l.value))))).find((e=>e&&"string"==typeof e));if(t?e.toast(t):i.emit("search",s()),t)return t}function c(){n.forEach((e=>{e.reset(),e.updateWrapperQuery()})),i.emit("reset",s())}return t.onMounted((()=>{e.immediateSearch&&i.emit("ready",s())})),{child:n,wrapperInstance:u,query:l,getQuery:s,querySearch:d,resetAndSearch:function(){c(),d()},reset:c}},render(){const{resetToInitialValue:e,backfill:i,query:n,getQuery:r,querySearch:a,resetAndSearch:o,reset:u}=this,d=this.tag,c=this.datum,p=f("default",this),v=f("btn",this),{class:y,style:h,...m}=this.$attrs,g=(t.isVue2,{});return s(this,"$listeners")&&(g.on=this.$listeners),t.h(d,l([{},g]),[Object.entries(c).map((([t,r])=>r?"function"==typeof p?p({...m,key:t,field:r.as||t,resetToInitialValue:e,backfill:i,query:n,...r}):p||"":void 0)),"function"==typeof v?v({search:a,getQuery:r,resetAndSearch:o,reset:u}):v])}});function j(e){const i=t.ref();return t.computed({set(e){i.value=e},get:()=>void 0===i.value?void 0!==e.defaultValue?"function"==typeof e.defaultValue?e.defaultValue(e.query,e.backfill):e.defaultValue:void 0:i.value})}function C(e,i){const n=t.ref("boolean"==typeof e.disabled&&e.disabled),r=t.ref("boolean"==typeof e.hide&&e.hide),a=()=>({query:e.query,backfill:e.backfill,option:i}),o=()=>{if("function"==typeof e.hide){r.value!==e.hide(a())&&(r.value=e.hide(a()))}else if("function"==typeof e.disabled){n.value!==e.disabled(a())&&(n.value=e.disabled(a()))}};let u=[t.watch((()=>e.query),o,{immediate:!0,deep:!0}),t.watch((()=>[e.disabled,e.hide]),((e,t)=>{e[0]!==t[0]&&(n.value="boolean"==typeof e[0]&&e[0],e[0]),e[1]!==t[1]&&(r.value="boolean"==typeof e[1]&&e[1],e[1]),o()}))];return t.onBeforeUnmount((()=>(u.forEach((e=>e())),u=[]))),{insetDisabled:n,insetHide:r}}function F(e=!0){const i=t.ref(e);return{flag:i,updateFlag:()=>{i.value=!e,t.nextTick((()=>{i.value=e}))}}}var q=t.defineComponent({inheritAttrs:!1,name:"CorePlain",props:m,setup(e,i){const n=t.inject(A),r=j(e),a=e.backfill&&e.backfill[e.field],o=t.ref(a||(void 0!==e.defaultValue?r.value:e.multiple?[]:"").slice()),u=t.ref([]),l=t.computed((()=>u.value.length?u.value:e.options)),s=()=>e.customGetQuery?e.customGetQuery(o.value,d,e):e.multiple&&e.fields?e.fields.reduce(((t,i,n)=>(t[i]=d(o.value?.[n],e.emptyValue),t)),{}):{[e.field]:d(o.value,e.emptyValue)},{flag:c,updateFlag:f}=F(),{flag:p,updateFlag:v}=F(),y={reset(){const{multiple:t}=e;f(),v(),o.value=e.resetToInitialValue&&r.value?.slice()||(t?[]:"")},updateWrapperQuery(){f(),n&&Object.entries(s()).forEach((([e,t])=>n.updateQueryValue(e,t)))},get validator(){return e.validator},getQuery:s};n?.register(y);const{insetDisabled:h,insetHide:m}=C(e,y);!a&&e.defaultValue&&y.updateWrapperQuery();const g=[];function b(t){e.getOptions?.((e=>{const t=o.value;o.value=void 0,u.value=e||[],o.value=t}),e.query||{},{trigger:t,change:(e,t)=>{t&&(r.value=e),O(e)},search:(e,t)=>{t&&(r.value=e),V(e),n?.search()}})}function V(e){e!==o.value&&(o.value=e,y.updateWrapperQuery())}function O(e){V(e),n?.insetSearch()}return t.onBeforeUnmount((()=>g.forEach((e=>e())))),g.push(t.watch((()=>e.field),((e,t)=>{e!==t&&n?.removeUnreferencedField(t),y.updateWrapperQuery()}))),g.push(t.watch((()=>[e.fields||e.field,e.fields?e.fields.map((t=>e.query[t])).filter(Boolean):e.query[e.field]]),(([t,i],[n])=>{const r=e.backfillToValue(i,t,e.query);t.toString()===n.toString()&&r?.toString()!==o.value?.toString()&&c.value&&(o.value=r)}))),g.push(t.watch((()=>[e.fields||e.field,e.fields?e.fields.map((t=>e.backfill?.[t])).filter(Boolean):e.backfill?.[e.field]]),(([t,i],[n])=>{const r=e.backfillToValue(i,t,e.backfill);t.toString()===n.toString()&&r?.toString()!==o.value?.toString()&&(v(),V(r))}))),g.push(t.watch((()=>[e.depend,e.dependFields,e.dependFields&&[].concat(e.dependFields).map((t=>e.query?.[t])).join(",")||""]),(([t,i,n],[r,a,u])=>{p.value&&n!==u&&(b("depend"),t===r&&i?.toString()===a?.toString()&&void 0!==o.value&&""!==o.value.toString()&&V(e.multiple?[]:""))}))),g.push(t.watch((()=>e.getOptions),b.bind(null,"initial"),{immediate:!0})),{wrapper:n,option:y,checked:o,getQuery:s,insetDisabled:h,insetHide:m,finalOption:l,updateCheckedValue:V,change:O,reset:y.reset}},render(){const{checked:e,getQuery:t,insetDisabled:i,insetHide:n,finalOption:r,change:a,reset:o,multiple:u}=this;if(n)return;const l=f("default",this),d=s(this,"$listeners")?this.$listeners:null;return"function"==typeof l?l({...this.$attrs,listeners:d,[v]:e,options:r,disabled:i,change:a,multiple:u}):l}}),B=t.defineComponent({inheritAttrs:!1,name:"CoreTree",props:g,setup(e,i){const n=t.inject(A),r=j(e),a=t.ref([]),o=t.ref([]),u=t.computed((()=>o.value.length?o.value:e.options)),l=()=>b.value||r.value?e.customGetQuery?e.customGetQuery(a.value,d,e):e.fields?.length?e.fields.reduce(((t,i,n)=>Object.assign(t,{[i]:d(a.value[n],e.emptyValue)})),{}):{[e.field]:d(e.emitPath?[...a.value]:a.value.slice(-1)[0],e.emptyValue)}:{},{flag:s,updateFlag:f}=F(),{flag:p,updateFlag:v}=F(),y={reset(){return f(),v(),a.value=e.resetToInitialValue&&r.value?.slice()||[],this},get validator(){return e.validator},updateWrapperQuery(){f(),n&&Object.entries(l()).forEach((([e,t])=>n.updateQueryValue(e,t)))},getQuery:l};n?.register(y);const{insetDisabled:h,insetHide:m}=C(e,y),g=[];t.onBeforeUnmount((()=>g.forEach((e=>e()))));const b=t.ref("function"!=typeof e.getOptions||!!e.fields?.length);function V(t){e.getOptions?.((e=>{o.value=e||[],b.value=!0}),e.query||{},{trigger:t,change:(e,t)=>{t&&(r.value=e),S(e)},search:(e,t)=>{t&&(r.value=e),O(e),n?.search()}})}function O(e){const t=Array.isArray(e)?e:Q(e);t.join("")!==a.value.join("")&&(a.value=t,y.updateWrapperQuery())}function S(e){O(e),n?.insetSearch()}function Q(t){if(!t&&0!==t)return[];const{valueKey:i,childrenKey:n}=e;return c(u.value,(e=>e[i]===t)).map((e=>e[i]),n).filter(Boolean)}return t.watch(b,(t=>t&&function(){const{backfill:t,field:i,fields:n}=e;if(t)if(n){const e=n.reduce(((e,i)=>(t[i]&&e.push(t[i]),e)),[]);if(e.length)return a.value=e,void y.updateWrapperQuery()}else if(t[i])return a.value=Q(t[i]),void y.updateWrapperQuery();r.value?.length&&(a.value="string"==typeof r.value?Q(r.value):r.value.slice(),"string"==typeof r.value&&(r.value=a.value.slice()),y.updateWrapperQuery())}()),{immediate:!0}),g.push(t.watch((()=>e.fields||[e.field]),((e,t)=>{e.toString()!==t.toString()&&n&&t.forEach((t=>e.includes(t)||n.removeUnreferencedField(t))),y.updateWrapperQuery()}))),g.push(t.watch((()=>[e.fields?.toString()||e.field,e.fields?.map((t=>e.query[t])).filter(Boolean)||e.query[e.field]]),(([e,t],[i])=>{e===i&&s.value&&(a.value="string"==typeof t?Q(t):t)}))),g.push(t.watch((()=>e.fields?.length?e.fields.reduce(((t,i)=>(e.backfill?.[i]&&t.push(e.backfill[i]),t)),[]):e.backfill?.[e.field]),(e=>{if(b.value)if(v(),Array.isArray(e))O(e);else{if(!e&&0!==e)return void(a.value.length&&(a.value=[]));O(Q(e))}}))),g.push(t.watch((()=>[e.depend,e.dependFields,e.dependFields&&[].concat(e.dependFields).map((t=>e.query?.[t])).join(",")||""]),(([e,t,i],[n,r,o])=>{p.value&&i!==o&&(V("depend"),e===n&&t?.toString()===r?.toString()&&a.value.length&&O("string"==typeof a.value?"":[]))}))),g.push(t.watch((()=>e.getOptions),V.bind(null,"initial"),{immediate:!0})),{wrapper:n,option:y,checked:a,getQuery:l,finalOption:u,insetDisabled:h,insetHide:m,change:S,reset:y.reset}},render(){const{checked:e,getQuery:t,finalOption:i,insetHide:n,insetDisabled:r,change:a,reset:o}=this;if(n)return;const u=f("default",this),l=s(this,"$listeners")?this.$listeners:null;return"function"==typeof u?u({...this.$attrs,listeners:l,[v]:e,options:i,disabled:r,change:a}):u}});e.CorePlain=q,e.CoreTree=B,e.CoreWrapper=w,e.commonEmits=b,e.commonProps=y,e.defineCommonMethod=k,e.defineProvideValue=Q,e.plainProps=m,e.provideKey=A,e.selectEmits=O,e.treeEmits=S,e.treeProps=g,e.wrapperEmits=V,e.wrapperProps=h})); | ||
var VueDemi=function(e,t,i){if(e.install)return e;if(!t)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if("2.7."===t.version.slice(0,4)){for(var n in t)e[n]=t[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=t,e.Vue2=t,e.version=t.version,e.warn=t.util.warn,e.hasInjectionContext=()=>!!e.getCurrentInstance(),e.createApp=function(e,i){var n,r={},a={config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),provide:function(e,t){return r[e]=t,this},directive:function(e,i){return i?(t.directive(e,i),a):t.directive(e)},mount:function(a,o){return n||((n=new t(Object.assign({propsData:i},e,{provide:Object.assign(r,e.provide)}))).$mount(a,o),n)},unmount:function(){n&&(n.$destroy(),n=void 0)}};return a}}else if("2."===t.version.slice(0,2))if(i){for(var n in i)e[n]=i[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=t,e.Vue2=t,e.version=t.version,e.hasInjectionContext=()=>!!e.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if("3."===t.version.slice(0,2)){for(var n in t)e[n]=t[n];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=t,e.Vue2=void 0,e.version=t.version,e.set=function(e,t,i){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,i),i):(e[t]=i,i)},e.del=function(e,t){Array.isArray(e)?e.splice(t,1):delete e[t]}}else console.error("[vue-demi] Vue version "+t.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(void 0!==VueDemi?VueDemi:{}),this.Vue||("undefined"!=typeof Vue?Vue:void 0),this.VueCompositionAPI||("undefined"!=typeof VueCompositionAPI?VueCompositionAPI:void 0));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue-demi")):"function"==typeof define&&define.amd?define(["exports","vue-demi"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CoreCondition={},e.VueDemi)}(this,(function(e,t){"use strict";function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t,i=1;i<arguments.length;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},n.apply(this,arguments)}var r=["attrs","props","domProps"],a=["class","style","directives"],o=["on","nativeOn"],l=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},u=i((function(e){return e.reduce((function(e,t){for(var i in t)if(e[i])if(-1!==r.indexOf(i))e[i]=n({},e[i],t[i]);else if(-1!==a.indexOf(i)){var u=e[i]instanceof Array?e[i]:[e[i]],s=t[i]instanceof Array?t[i]:[t[i]];e[i]=[].concat(u,s)}else if(-1!==o.indexOf(i))for(var d in t[i])if(e[i][d]){var c=e[i][d]instanceof Array?e[i][d]:[e[i][d]],f=t[i][d]instanceof Array?t[i][d]:[t[i][d]];e[i][d]=[].concat(c,f)}else e[i][d]=t[i][d];else if("hook"===i)for(var p in t[i])e[i][p]=e[i][p]?l(e[i][p],t[i][p]):t[i][p];else e[i]=t[i];else e[i]=t[i];return e}),{})}));function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d(e,t){return Array.isArray(e)?e.filter(Boolean).length?e:t:"number"==typeof e?e:e||t}function c(e,t,i="children"){for(const n of e){if(t(n))return[n];if(n[i]?.length){const e=c(n[i],t);if(e.length)return e.unshift(n),e}}return[]}function f(e,t){return s(t,"$scopedSlots")&&t.$scopedSlots[e]||t.$slots[e]}const p="2.7"===t.version.slice(0,3),v=t.isVue2?"value":"modelValue",y={field:{type:String,required:!0},as:{type:String},customGetQuery:{type:Function},emptyValue:{type:[String,null,void 0],default:void 0},resetToInitialValue:{type:[Boolean]},query:{type:Object,required:!0},backfill:{type:Object},disabled:{type:[Boolean,Function]},hide:{type:[Boolean,Function]},validator:{type:[Function]},defaultValue:{type:[String,Array,Function]},depend:{type:Boolean,default:void 0},dependFields:{type:[String,Array]}},h={tag:{type:[String,Object],default:"div"},resetToInitialValue:{type:Boolean,default:void 0},datum:{type:Object,default:()=>({})},backfill:{type:Object},realtime:{type:Boolean,default:void 0},immediateSearch:{type:Boolean,default:void 0},toast:{type:Function,default:()=>{}},searchAtDatumChanged:{type:Boolean,default:void 0}},m={...y,fields:{type:[Array]},backfillToValue:{type:Function,default:e=>e},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:void 0},getOptions:{type:Function}},g={...y,fields:{type:[Array]},valueKey:{type:String,required:!0},childrenKey:{type:String},emitPath:{type:[Boolean],default:!1},options:{type:Array,default:()=>[]},getOptions:{type:Function}},b={search:e=>!0},V={...b,ready:e=>!0,reset:e=>!0},O={...b},S={...b},A="condition-wrapper";function k(e){return e}function Q(e){return e}var w=t.defineComponent({name:"CoreWrapper",props:h,emits:V,setup(e,i){const n=[];t.onBeforeUnmount((()=>n.splice(0)));const r={};let a=!1,o=[];const l={realtime:t.toRef(e,"realtime"),register(i){n.push(i);const l=()=>{a=!0,i.reset(),i.updateWrapperQuery();const l=n.indexOf(i);-1!==l&&n.splice(l,1),e.searchAtDatumChanged&&this.search(),a=!1,o.forEach((e=>{t.del(u.value,e),delete r[e]})),o=[]},s=t.getCurrentInstance();return s&&t.onBeforeUnmount(l,p?s.proxy:s),l},updateQueryValue(e,i){a&&o.push(e),t.set(u.value,e,i),r[e]=i},insetSearch(){e.realtime&&this.search()},search:d,removeUnreferencedField(e){let i=0;n.some((t=>(t.getQuery().hasOwnProperty(e)&&(i+=1),i))),i||(t.del(u.value,e),delete r[e])}};t.provide(A,l);const u=t.ref({...e.backfill}),s=()=>({...u.value,...e.backfill,...r});async function d(){const t=(await Promise.all(n.map((e=>e.validator?.(u.value))))).find((e=>e&&"string"==typeof e));if(t?e.toast(t):i.emit("search",s()),t)return t}function c(){n.forEach((e=>{e.reset(),e.updateWrapperQuery()})),i.emit("reset",s())}return t.onMounted((()=>{e.immediateSearch&&i.emit("ready",s())})),{child:n,wrapperInstance:l,query:u,getQuery:s,querySearch:d,resetAndSearch:function(){c(),d()},reset:c}},render(){const{resetToInitialValue:e,backfill:i,query:n,getQuery:r,querySearch:a,resetAndSearch:o,reset:l}=this,d=this.tag,c=this.datum,p=f("default",this),v=f("btn",this),{class:y,style:h,...m}=this.$attrs,g=(t.isVue2,{});return s(this,"$listeners")&&(g.on=this.$listeners),t.h(d,u([{},g]),[Object.entries(c).map((([t,r])=>r?"function"==typeof p?p({...m,key:t,field:r.as||t,resetToInitialValue:e,backfill:i,query:n,...r}):p||"":void 0)),"function"==typeof v?v({search:a,getQuery:r,resetAndSearch:o,reset:l}):v])}});function j(e){const i=t.ref();return t.computed({set(e){i.value=e},get:()=>void 0===i.value?void 0!==e.defaultValue?"function"==typeof e.defaultValue?e.defaultValue(e.query,e.backfill):e.defaultValue:void 0:i.value})}function C(e,i){const n=t.ref("boolean"==typeof e.disabled&&e.disabled),r=t.ref("boolean"==typeof e.hide&&e.hide),a=()=>({query:e.query,backfill:e.backfill,option:i}),o=()=>{if("function"==typeof e.hide){r.value!==e.hide(a())&&(r.value=e.hide(a()))}else if("function"==typeof e.disabled){n.value!==e.disabled(a())&&(n.value=e.disabled(a()))}};let l=[t.watch((()=>e.query),o,{immediate:!0,deep:!0}),t.watch((()=>[e.disabled,e.hide]),((e,t)=>{e[0]!==t[0]&&(n.value="boolean"==typeof e[0]&&e[0],e[0]),e[1]!==t[1]&&(r.value="boolean"==typeof e[1]&&e[1],e[1]),o()}))];return t.onBeforeUnmount((()=>(l.forEach((e=>e())),l=[]))),{insetDisabled:n,insetHide:r}}function F(e=!0){const i=t.ref(e);return{flag:i,updateFlag:()=>{i.value=!e,t.nextTick((()=>{i.value=e}))}}}var q=t.defineComponent({inheritAttrs:!1,name:"CorePlain",props:m,setup(e,i){const n=t.inject(A),r=j(e),a=e.backfill&&(e.fields?.length?e.fields.map((t=>e.backfill[t])):e.backfill[e.field]),o=t.ref(a||(void 0!==e.defaultValue?r.value:e.multiple?[]:"").slice()),l=t.ref([]),u=t.computed((()=>l.value.length?l.value:e.options)),s=()=>e.customGetQuery?e.customGetQuery(o.value,d,e):e.multiple&&e.fields?e.fields.reduce(((t,i,n)=>(t[i]=d(o.value?.[n],e.emptyValue),t)),{}):{[e.field]:d(o.value,e.emptyValue)},{flag:c,updateFlag:f}=F(),{flag:p,updateFlag:v}=F(),y={reset(){const{multiple:t}=e;f(),v(),o.value=e.resetToInitialValue&&r.value?.slice()||(t?[]:"")},updateWrapperQuery(){f(),n&&Object.entries(s()).forEach((([e,t])=>n.updateQueryValue(e,t)))},get validator(){return e.validator},getQuery:s};n?.register(y);const{insetDisabled:h,insetHide:m}=C(e,y);!a&&e.defaultValue&&y.updateWrapperQuery();const g=[];function b(t){e.getOptions?.((e=>{const t=o.value;o.value=void 0,l.value=e||[],o.value=t}),e.query||{},{trigger:t,change:(e,t)=>{t&&(r.value=e),O(e)},search:(e,t)=>{t&&(r.value=e),V(e),n?.search()}})}function V(e){e!==o.value&&(o.value=e,y.updateWrapperQuery())}function O(e){V(e),n?.insetSearch()}return t.onBeforeUnmount((()=>g.forEach((e=>e())))),g.push(t.watch((()=>e.field),((e,t)=>{e!==t&&n?.removeUnreferencedField(t),y.updateWrapperQuery()}))),g.push(t.watch((()=>[e.fields||e.field,e.fields?e.fields.map((t=>e.query[t])).filter(Boolean):e.query[e.field]]),(([t,i],[n])=>{const r=e.backfillToValue(i,t,e.query);t.toString()===n.toString()&&r?.toString()!==o.value?.toString()&&c.value&&(o.value=r)}))),g.push(t.watch((()=>[e.fields||e.field,e.fields?e.fields.map((t=>e.backfill?.[t])).filter(Boolean):e.backfill?.[e.field]]),(([t,i],[n])=>{const r=e.backfillToValue(i,t,e.backfill);t.toString()===n.toString()&&r?.toString()!==o.value?.toString()&&(v(),V(r))}))),g.push(t.watch((()=>[e.depend,e.dependFields,e.dependFields&&[].concat(e.dependFields).map((t=>e.query?.[t])).join(",")||""]),(([t,i,n],[r,a,l])=>{p.value&&n!==l&&(b("depend"),t===r&&i?.toString()===a?.toString()&&void 0!==o.value&&""!==o.value.toString()&&V(e.multiple?[]:""))}))),g.push(t.watch((()=>e.getOptions),b.bind(null,"initial"),{immediate:!0})),{wrapper:n,option:y,checked:o,getQuery:s,insetDisabled:h,insetHide:m,finalOption:u,updateCheckedValue:V,change:O,reset:y.reset}},render(){const{checked:e,getQuery:t,insetDisabled:i,insetHide:n,finalOption:r,change:a,reset:o,multiple:l}=this;if(n)return;const u=f("default",this),d=s(this,"$listeners")?this.$listeners:null;return"function"==typeof u?u({...this.$attrs,listeners:d,[v]:e,options:r,disabled:i,change:a,multiple:l}):u}}),B=t.defineComponent({inheritAttrs:!1,name:"CoreTree",props:g,setup(e,i){const n=t.inject(A),r=j(e),a=t.ref([]),o=t.ref([]),l=t.computed((()=>o.value.length?o.value:e.options)),u=()=>b.value||r.value?e.customGetQuery?e.customGetQuery(a.value,d,e):e.fields?.length?e.fields.reduce(((t,i,n)=>Object.assign(t,{[i]:d(a.value[n],e.emptyValue)})),{}):{[e.field]:d(e.emitPath?[...a.value]:a.value.slice(-1)[0],e.emptyValue)}:{},{flag:s,updateFlag:f}=F(),{flag:p,updateFlag:v}=F(),y={reset(){return f(),v(),a.value=e.resetToInitialValue&&r.value?.slice()||[],this},get validator(){return e.validator},updateWrapperQuery(){f(),n&&Object.entries(u()).forEach((([e,t])=>n.updateQueryValue(e,t)))},getQuery:u};n?.register(y);const{insetDisabled:h,insetHide:m}=C(e,y),g=[];t.onBeforeUnmount((()=>g.forEach((e=>e()))));const b=t.ref("function"!=typeof e.getOptions||!!e.fields?.length);function V(t){e.getOptions?.((e=>{o.value=e||[],b.value=!0}),e.query||{},{trigger:t,change:(e,t)=>{t&&(r.value=e),S(e)},search:(e,t)=>{t&&(r.value=e),O(e),n?.search()}})}function O(e){const t=Array.isArray(e)?e:k(e);t.join("")!==a.value.join("")&&(a.value=t,y.updateWrapperQuery())}function S(e){O(e),n?.insetSearch()}function k(t){if(!t&&0!==t)return[];const{valueKey:i,childrenKey:n}=e;return c(l.value,(e=>e[i]===t)).map((e=>e[i]),n).filter(Boolean)}return t.watch(b,(t=>t&&function(){const{backfill:t,field:i,fields:n}=e;if(t)if(n){const e=n.reduce(((e,i)=>(t[i]&&e.push(t[i]),e)),[]);if(e.length)return a.value=e,void y.updateWrapperQuery()}else if(t[i])return a.value=k(t[i]),void y.updateWrapperQuery();r.value?.length&&(a.value="string"==typeof r.value?k(r.value):r.value.slice(),"string"==typeof r.value&&(r.value=a.value.slice()),y.updateWrapperQuery())}()),{immediate:!0}),g.push(t.watch((()=>e.fields||[e.field]),((e,t)=>{e.toString()!==t.toString()&&n&&t.forEach((t=>e.includes(t)||n.removeUnreferencedField(t))),y.updateWrapperQuery()}))),g.push(t.watch((()=>[e.fields?.toString()||e.field,e.fields?.map((t=>e.query[t])).filter(Boolean)||e.query[e.field]]),(([e,t],[i])=>{e===i&&s.value&&(a.value="string"==typeof t?k(t):t)}))),g.push(t.watch((()=>e.fields?.length?e.fields.reduce(((t,i)=>(e.backfill?.[i]&&t.push(e.backfill[i]),t)),[]):e.backfill?.[e.field]),(e=>{if(b.value)if(v(),Array.isArray(e))O(e);else{if(!e&&0!==e)return void(a.value.length&&(a.value=[]));O(k(e))}}))),g.push(t.watch((()=>[e.depend,e.dependFields,e.dependFields&&[].concat(e.dependFields).map((t=>e.query?.[t])).join(",")||""]),(([e,t,i],[n,r,o])=>{p.value&&i!==o&&(V("depend"),e===n&&t?.toString()===r?.toString()&&a.value.length&&O("string"==typeof a.value?"":[]))}))),g.push(t.watch((()=>e.getOptions),V.bind(null,"initial"),{immediate:!0})),{wrapper:n,option:y,checked:a,getQuery:u,finalOption:l,insetDisabled:h,insetHide:m,change:S,reset:y.reset}},render(){const{checked:e,getQuery:t,finalOption:i,insetHide:n,insetDisabled:r,change:a,reset:o}=this;if(n)return;const l=f("default",this),u=s(this,"$listeners")?this.$listeners:null;return"function"==typeof l?l({...this.$attrs,listeners:u,[v]:e,options:i,disabled:r,change:a}):l}});e.CorePlain=q,e.CoreTree=B,e.CoreWrapper=w,e.commonEmits=b,e.commonProps=y,e.defineCommonMethod=Q,e.defineProvideValue=k,e.plainProps=m,e.provideKey=A,e.selectEmits=O,e.treeEmits=S,e.treeProps=g,e.wrapperEmits=V,e.wrapperProps=h})); | ||
//# sourceMappingURL=index.umd.min.js.map |
@@ -98,5 +98,5 @@ import { PropType } from 'vue-demi'; | ||
}>> & { | ||
onSearch?: ((query: Record<string, any>) => any) | undefined; | ||
onReset?: ((query: Record<string, any>) => any) | undefined; | ||
onReady?: ((query: Record<string, any>) => any) | undefined; | ||
onSearch?: ((query: Record<string, any>) => any) | undefined; | ||
}, { | ||
@@ -103,0 +103,0 @@ readonly resetToInitialValue: boolean; |
@@ -145,5 +145,5 @@ import * as vue_demi from 'vue-demi'; | ||
}>> & { | ||
onSearch?: ((query: Record<string, any>) => any) | undefined; | ||
onReady?: ((query: Record<string, any>) => any) | undefined; | ||
onReset?: ((query: Record<string, any>) => any) | undefined; | ||
onSearch?: ((query: Record<string, any>) => any) | undefined; | ||
}, { | ||
@@ -150,0 +150,0 @@ readonly tag: string | object; |
{ | ||
"name": "@xiaohaih/condition-core", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "", | ||
@@ -13,5 +13,5 @@ "main": "dist/index.cjs.js", | ||
"require": "./dist/index.cjs.js", | ||
"import": "./dist/index.esm.js", | ||
"import": "./index.ts", | ||
"browser": "./dist/index.esm.js", | ||
"types": "./dist/types/index.d.ts" | ||
"types": "./index.ts" | ||
}, | ||
@@ -18,0 +18,0 @@ "./*": "./*" |
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 not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
491108
0