cnhis-design-vue 3.1.48-beta.13 → 3.1.48-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,computed as t,inject as o,
|
|
1
|
+
import{defineComponent as e,computed as t,inject as o,useAttrs as a,createVNode as l}from"vue";import{useDebounceFn as r}from"@vueuse/core";import{cloneDeep as u,isArray as n,isString as s}from"lodash-es";import{useCommonInjection as i,useSelectOptionProps as p}from"../../hooks/useCommonInjection.js";import{InjectionChangeContextCollector as m}from"../../constants/index.js";import"../../../../../shared/utils/index.js";import"../../../index.js";import"@formily/core";import"@formily/path";import"@vue/shared";import"date-fns";import{assignUpdateValue as c,assignClearBindVisited as d,createVisitedSetter as v}from"../../utils/schema.js";import{useFormField as y}from"../../hooks/useFormField.js";import{NSelect as f}from"naive-ui";import"../../../../../shared/utils/tapable/SyncHook.js";import"../../../../../shared/utils/tapable/SyncBailHook.js";import"../../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import"../../hooks/useFormValidator.js";import{connect as h,mapProps as j}from"@formily/vue";import"./index.js";import{useUrlConfigOptions as b,useAutographOptions as k,useRecommendOptions as S,searchContentMatcher as g}from"../../hooks/useFormRenderOptions.js";const F=h(e({name:"FormSelect",props:{value:{type:[String,Array,Number]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},allowCreate:Boolean,urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},commonNum:{type:Number,default:10},recentNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1}},emits:["update:value","postRecommend"],setup(e,{slots:c,emit:d}){const h=t({get:()=>e.value,async set(e){d("update:value",e),O(e)}}),{labelKey:j,valueKey:F,fetchData:C,searchContent:A,fullOptions:H,filterOptions:B}=e.urlConfig?b(e,h):k(e,h),{getRecommend:x,postRecommend:O,sortedOptions:R}=S(e,B,d,j,F),{field:V,fieldKey:w}=y();o(m).setContext(w.value,(e=>{return{currentOption:u((t=e,n(t)?function(e){const t=H.value.reduce(((e,t)=>(e[t[F.value]]=t,e)),{});return e.map((e=>t[e]))}(t):(o=t,H.value.find((e=>e[F.value]===o)))))};var t,o}));const L=r((async(e="")=>{A.value=e,C(e),x(e)}),300),{injectValueValidate:N,injectValueWatchFromEmpty:K,injectValueBindKey:P}=i();K(h,L),N(h);const W=P(h),{menuProps:q,nodeProps:I}=p();function U(e){const t=e[j.value];if(!t||!s(t))return"";const o=A.value?g(A.value,t):null;return o?l("section",null,[o.map(((e,t)=>0!==t&&e?l("span",{style:{color:t%2==0?"var(--n-option-text-color-active)":""}},[e]):null))]):t}const z=t((()=>R.value.length||!e.allowCreate?R.value:A.value?[{[j.value]:A.value,[F.value]:A.value},...R.value]:R.value)),D=a(),E=t((()=>{if(e.allowCreate)return h.value;const t=D.multiple&&n(h.value);return z.value.find((e=>t?h.value.includes(e[F.value]):e[F.value]===h.value))?h.value:null}));function G(e){if(e)return L();A.value=""}return()=>l(f,{key:W.value,remote:!0,filterable:!0,value:E.value,onUpdateValue:e=>h.value=e,"menu-props":q,"node-props":I,labelField:j.value,valueField:F.value,options:z.value,onSearch:L,"onUpdate:show":G,onFocus:v(V),renderLabel:U},c)}}),j({dataSource:"options"},c,d));export{F as SELECT};
|
|
@@ -29,6 +29,7 @@ export declare function useUrlConfigOptions(props: {
|
|
|
29
29
|
filterOptions: import("vue").ComputedRef<AnyObject[]>;
|
|
30
30
|
fullOptions: import("vue").ComputedRef<AnyObject[]>;
|
|
31
31
|
fetchData: (content?: string) => Promise<null | undefined>;
|
|
32
|
+
searchContent: Ref<string | undefined>;
|
|
32
33
|
};
|
|
33
34
|
export declare function useAutographOptions(props: Partial<{
|
|
34
35
|
labelField: string;
|
|
@@ -44,4 +45,5 @@ export declare function useAutographOptions(props: Partial<{
|
|
|
44
45
|
filterOptions: import("vue").ComputedRef<AnyObject[]>;
|
|
45
46
|
fullOptions: import("vue").ComputedRef<AnyObject[]>;
|
|
46
47
|
fetchData: (content?: string) => Promise<null | undefined>;
|
|
48
|
+
searchContent: Ref<string | undefined>;
|
|
47
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{checkInSetupEnv as e,jsonParse as n,keywordMatcher as t}from"../../../../shared/utils/index.js";import{useForm as l}from"@formily/vue";import{useMemoize as u,useDebounceFn as o}from"@vueuse/core";import{identity as r,uniqBy as a,isString as i,isEqual as c,isArray as s,omit as v,isFunction as m}from"lodash-es";import{computed as f,inject as d,ref as y,toRaw as p,watch as h}from"vue";import"../../index.js";import{InjectionAsyncQueue as g,InjectionFormLifeCycleCaller as w,InjectionFormItemDepsCollector as k}from"../constants/index.js";import{useFormField as b}from"./useFormField.js";import{createUrlConfigParams as
|
|
1
|
+
import{checkInSetupEnv as e,jsonParse as n,keywordMatcher as t}from"../../../../shared/utils/index.js";import{useForm as l}from"@formily/vue";import{useMemoize as u,useDebounceFn as o}from"@vueuse/core";import{identity as r,uniqBy as a,isString as i,isEqual as c,isArray as s,omit as v,isFunction as m}from"lodash-es";import{computed as f,inject as d,ref as y,toRaw as p,watch as h}from"vue";import"../../index.js";import{InjectionAsyncQueue as g,InjectionFormLifeCycleCaller as w,InjectionFormItemDepsCollector as k}from"../constants/index.js";import{useFormField as b}from"./useFormField.js";import{createUrlConfigParams as C,formRenderLog as R}from"../utils/index.js";import{useFormRequest as F}from"./useFormRequest.js";function K(e,n){const t=y();return f({get:()=>t.value?t.value:e[n],set(e){t.value=e}})}const q=(()=>{const e=u((e=>new RegExp(`(.*)${e.split("").map((e=>`(${function(e){return e.match(/[()\[\]{}$^\/]/)?"\\"+e:e}(e)})`)).join("(.*)")}(.*)`)),{getKey:r});return(n,t)=>t.match(e(n))})();function O(){const e=y();return{searchContent:e,optionSearchFilter:function(n,l,u){if(!e.value)return n;const o=s(u)?u.filter((e=>e&&i(e))):[];return n.filter((n=>function(n,l,u){if(!e.value)return!0;const o=n?n[l]:"";return!!i(o)&&(!!q(e.value,o)||!!t(e.value,n.keyword)||!!u.length&&u.some((t=>i(n[t])&&n[t].includes(e.value))))}(n,l,o)))}}}function j(e,t,l,u,o){const r=K(e,"commonList"),i=K(e,"recentList"),{searchContent:c,optionSearchFilter:s}=O();function y(e){return n(e.itemObj)}const p=f((()=>{var e,n;return null!=(n=null==(e=r.value)?void 0:e.map(y))?n:[]})),h=f((()=>{var e,n;return null!=(n=null==(e=i.value)?void 0:e.map(y))?n:[]})),w=f((()=>{if(!e.recommend||!p.value.length&&!h.value.length)return t.value;const n=a(p.value.concat(h.value),(e=>e[o.value])),l=t.value.filter((e=>n.every((function(n){return n[o.value]!==e[o.value]}))));return[...s(n,u.value),...l]})),{getRecommendRequestInfo:k,getHttpInstance:C}=F();function R(n){const{url:t,getRecommendIds:l}=k(),u=m(l)?l():{},o=m(e.getRecommendInfo)?e.getRecommendInfo():{};return{url:t[n],info:Object.assign({},u,o)}}const{fieldKey:q}=b(),j=d(g);return{postRecommend:async function(n){if(!e.recommend)return;const t=C();if(!t)return;const{url:u,info:r}=R("post"),a=w.value.find((e=>e[o.value]===n));a&&l("postRecommend",await t.post(u,{...r,keyword:"",itemId:o.value,itemObj:JSON.stringify(a)}))},getRecommend:async function(n){if(!e.recommend)return;if(c.value=n,r.value&&i.value&&e.recommendCache)return;const t=await j.addAsync(function(n,t){const{url:l,info:u}=R("get");return{url:l,method:"get",key:n,cache:t,params:{...u,recNum:Math.max(e.commonNum,e.recentNum),keyword:""}}}(q.value,e.recommendCache)),{commonly:l,recently:u}=t.reduce(((e,n)=>("commonly"===n.type?e.commonly.push(v(n,["type"])):"recently"===n.type&&e.recently.push(v(n,["type"])),e)),{commonly:[],recently:[]});r.value=l.slice(0,e.commonNum),i.value=u.slice(0,e.recentNum)},sortedOptions:w}}function I(n,t){e();const l=d(g),u=d(w),r=f((()=>{var e,t,l;return null!=(l=null!=(t=null==(e=n.urlConfig)?void 0:e.nameKey)?t:n.labelField)?l:"text"})),a=f((()=>{var e,t,l;return null!=(l=null!=(t=null==(e=n.urlConfig)?void 0:e.valueKey)?t:n.valueField)?l:"value"})),{searchContent:s,optionSearchFilter:v}=O(),m=y(null),{field:F,fieldKey:K}=b(),q=o((async function(e){if(s.value=e||"",!n.urlConfig)return m.value=null;try{const e=await l.addAsync(await C({config:n.urlConfig,cache:n.requestCache,field:F.value}));p(m.value)!==e&&(m.value=e,u("afterOptionInit",[K.value,m.value]))}catch(e){i(e)&&R(e)}}),300),j=f((()=>m.value?v(m.value,r.value):Array.isArray(n.options)?v(n.options,r.value):[])),I=f((()=>m.value||n.options||[])),x=d(k);return h((()=>n.urlConfig),((e,l)=>{if(!c(e,l)){if(m.value=null,!e)return m.value=null;x.setDeps(K.value,e.dependKey||[],(async()=>{m.value=null,t.value=null,!n.lazyRequest&&await q()})),(t.value||!n.lazyRequest)&&q()}}),{immediate:!0}),{labelKey:r,valueKey:a,filterOptions:j,fullOptions:I,fetchData:q,searchContent:s}}function x(n,t){e();const u=d(g),r=d(w),a=l(),v=f((()=>{var e,t,l,u;const o=null==(t=null==(e=n.wordbook)?void 0:e.render_key)?void 0:t[0];if(i(o))return o;let r=null==(l=n.wordbook)?void 0:l.show_key;return s(r)&&(r=r[0]),i(r)?r:null!=(u=n.labelField)?u:"text"})),m=f((()=>{var e,t,l;return null!=(l=null!=(t=null==(e=n.wordbook)?void 0:e.value_key)?t:n.valueField)?l:"value"})),C=f((()=>{var e;return(null==(e=n.wordbook)?void 0:e.search_key)||[]})),{searchContent:K,optionSearchFilter:q}=O(),j=y(null),{fieldKey:I}=b(),{getSearchRequestInfo:x}=F(),A=o((async function(e){if(K.value=e||"",!n.autograph||!n.wordbook)return j.value=null;try{const e=await u.addAsync(function(e,t,l){var u,o,r;const i={autograph:t,wordbookId:e.id,wordbookType:e.type,fieldKeys:e.search_key,keyword:"",page:1};if(null==(u=e.queryParams)?void 0:u.length){const n=null!=(r=null==(o=a.value)?void 0:o.getFormState().values)?r:{};e.queryParams.forEach((e=>{i[e]=n[e]}))}return console.log(i),{...x(),params:i,key:l,cache:n.requestCache}}(n.wordbook,n.autograph,I.value));p(j.value)!==e&&(j.value=e,r("afterOptionInit",[I.value,j.value]))}catch(e){i(e)&&R(e)}}),300),S=f((()=>j.value?q(j.value,v.value,C.value):Array.isArray(n.options)?q(n.options,v.value):[])),N=f((()=>j.value||n.options||[])),_=d(k);return h((()=>n.wordbook),((e,l)=>{if(!c(e,l)){if(j.value=null,!e)return j.value=null;_.setDeps(I.value,e.queryParams||[],(async()=>{j.value=null,A()})),(t.value||!n.lazyRequest)&&A()}}),{immediate:!0}),{labelKey:v,valueKey:m,filterOptions:S,fullOptions:N,fetchData:A,searchContent:K}}export{q as searchContentMatcher,x as useAutographOptions,j as useRecommendOptions,I as useUrlConfigOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.1.48-beta.
|
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.1.48-beta.14",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.48-beta.14",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.48-beta.
|
|
3
|
+
"version": "3.1.48-beta.14",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"iOS 7",
|
|
64
64
|
"last 3 iOS versions"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "f26db2176840ea9b0b7f1080dc31c0026c718905"
|
|
67
67
|
}
|