cnhis-design-vue 3.2.9-release.3 → 3.2.10-beta.0
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.
- package/es/components/ai-chat/index.d.ts +27 -9
- package/es/components/ai-chat/src/Index.vue.d.ts +27 -9
- package/es/components/ai-chat/src/Index.vue2.js +1 -1
- package/es/components/ai-chat/src/components/ChatFooter.vue.d.ts +9 -0
- package/es/components/ai-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/ai-chat/src/components/ChatMain.js +1 -1
- package/es/components/ai-chat/style/index.css +1 -1
- package/es/components/classification/index.d.ts +52 -0
- package/es/components/classification/src/components/search-filter/index.vue.d.ts +52 -0
- package/es/components/classification/src/components/set-classification/index.vue.d.ts +52 -0
- package/es/components/classification/src/index.vue.d.ts +52 -0
- package/es/components/form-render/index.js +1 -1
- package/es/components/form-render/src/FormRender.vue2.js +1 -1
- package/es/components/form-render/src/components/renderer/combination/combination.js +1 -1
- package/es/components/form-render/src/components/renderer/complex.js +1 -1
- package/es/components/form-render/src/components/renderer/date.js +1 -1
- package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
- package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
- package/es/components/form-render/src/components/renderer/select.js +1 -1
- package/es/components/form-render/src/components/renderer/switch.js +1 -1
- package/es/components/form-render/src/components/renderer/textarea.js +1 -1
- package/es/components/form-render/src/hooks/useAnchor.js +1 -1
- package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -1
- package/es/components/form-render/src/utils/business.d.ts +1 -0
- package/es/components/form-render/src/utils/business.js +1 -1
- package/es/components/form-render/src/utils/index.js +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.js +1 -1
- package/es/components/table-filter/src/components/bi-filter/ValueCfg.vue.d.ts +1 -0
- package/es/components/table-filter/src/components/bi-filter/index.vue.d.ts +1 -0
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +51 -0
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue2.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/SelectTreeDynamic.vue.d.ts +51 -0
- package/es/components/table-filter/src/components/classify-filter/components/SelectTreeDynamic.vue.js +1 -0
- package/es/components/table-filter/src/components/classify-filter/components/SelectTreeDynamic.vue2.js +1 -0
- package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +51 -1
- package/es/components/table-filter/src/components/classify-filter/components/index.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +51 -0
- package/es/components/table-filter/src/components/render-widget/components/SelectTreeDynamic.vue.d.ts +47 -0
- package/es/components/table-filter/src/components/render-widget/components/SelectTreeDynamic.vue.js +1 -0
- package/es/components/table-filter/src/components/render-widget/components/SelectTreeDynamic.vue2.js +1 -0
- package/es/components/table-filter/src/components/render-widget/components/index.d.ts +45 -1
- package/es/components/table-filter/src/components/render-widget/components/index.js +1 -1
- package/es/components/table-filter/src/components/render-widget/index.vue.js +1 -1
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +61 -0
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
- package/es/components/table-filter/src/hooks/useAdvanced.d.ts +2 -2
- package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
- package/es/components/table-filter/src/tool/transformData.js +1 -1
- package/es/components/table-filter/src/types/enums.d.ts +1 -0
- package/es/components/table-filter/src/types/enums.js +1 -1
- package/es/components/table-filter/src/types/index.d.ts +1 -0
- package/es/shared/assets/img/logo.png.js +1 -0
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as o,provide as t,computed as r,nextTick as a,onUnmounted as s,openBlock as i,createBlock as l,unref as n,mergeProps as m,withCtx as p,createElementBlock as
|
1
|
+
import{defineComponent as e,ref as o,provide as t,computed as r,nextTick as a,onUnmounted as s,openBlock as i,createBlock as l,unref as n,mergeProps as m,withCtx as p,createElementBlock as u,createVNode as d,isRef as c,Fragment as f,renderList as h,createCommentVNode as y,createElementVNode as g,normalizeStyle as v,toDisplayString as b,renderSlot as j}from"vue";import{useTheme as k}from"../../../shared/hooks/useTheme.js";import{useElementSize as C}from"@vueuse/core";import"date-fns";import{isNumber as F,cloneDeep as S}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NForm as w,NTabs as x,NTabPane as A,NConfigProvider as B}from"naive-ui";import{useVersion as L}from"../../../shared/hooks/useVersion.js";import"../../../shared/hooks/useScrollLoading.js";import{createForm as R,onFormMount as H,onFieldValueChange as O,onFieldMount as T,onFieldUnmount as I,onFieldReact as V}from"@formily/core";import{Path as N}from"@formily/path";import{FormProvider as _,FormConsumer as D}from"@formily/vue";import{InjectionFormColumnWidth as W,InjectionFormLifeCycleCaller as U,InjectionFormGraph as E}from"./constants/index.js";import"./utils/business.js";import{createObjSchema as q}from"./utils/schema.js";import{useAnchor as P}from"./hooks/useAnchor.js";import"../index.js";import{useComplexOptionsSpan as G}from"./hooks/useComplexOptions.js";import{useFieldListAdaptor as M}from"./hooks/useFieldListAdaptor.js";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{useFieldVisitor as K}from"./hooks/useFieldVisitor.js";import{useFormContext as z}from"./hooks/useFormContext.js";import{useFormDomEvent as J,useFormExposeEvent as Q}from"./hooks/useFormEvent.js";import{useFormGraph as $}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as X}from"./hooks/useFormRenderLifeCycle.js";import{validateMessageLocale as Y}from"./hooks/useFormValidator.js";import{useLowCodeEvent as Z}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as ee}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as oe}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as te}from"./hooks/useOperationalForm.js";import{useWordbookSetting as re}from"./hooks/useWordbookSetting.js";import{useNewLowCodeReactions as ae}from"./hooks/useNewLowCodeReactions.js";const se={key:0,style:{height:"54px"}},ie={style:{"white-space":"pre"}};var le=e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:5},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},annotationShortcuts:{type:Array},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},autoExpand:Boolean,lowCodeReactions:{type:Array},newLowCodeReactions:{type:Array},operationalForm:{type:Array},dateOperationalForm:{type:Object},operationalFormInit:{type:Boolean,default:!0},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},labelPlacementOverwrite:Boolean,outBordered:{type:Boolean,default:!1},uniqueCacheData:{type:Boolean,default:!1},forceClearable:Boolean,wordSplitFilter:{type:Boolean,default:!0},selectMode:Boolean,selectedFields:{type:Array},linebarDirection:{type:String,default:"vertical"},linebarTextDirection:{type:String,default:"horizontal"},linebarWidth:{type:[Number,String],default:120},autoWidth:{type:[Boolean,Number],default:!1},incrementalRender:{type:Boolean,default:!1},feedbackType:{type:String,default:"default"}},emits:["formChange","annotationChange","scroll","update:selectedFields","linebarChange","ready"],setup(e,{expose:le,emit:ne}){const me=e,pe=k(),{nuiThemeOverrides:ue}=oe();Y();const de=o(),{width:ce}=C(de);t(W,r((()=>ce.value?(ce.value-16*(me.column-1))/24:0)));const fe=r((()=>F(me.maxHeight)?me.maxHeight+"px":me.maxHeight)),{SchemaField:he,businessCollector:ye,formItemDepsCollector:ge,changeContextCollector:ve,asyncQueue:be,formUUID:je}=z(me,ne),{anchorBarRef:ke,currentAnchor:Ce,updateAnchorList:Fe,anchorIdList:Se,onScroll:we,generateAnchorList:xe}=P(me,ne,de,ge),{callLifeCycle:Ae}=X(me);t(U,Ae),Ae("onSetup");const{observeFormGraph:Be,setGraph:Le,removeGraph:Re}=$();t(E,Be);const{lowCodeEventTrigger:He}=Z(),Oe=o(!0),Te=R({initialValues:me.initialData,effects(e){const o={};H((()=>{Object.assign(o,S(e.values))})),O("*",(t=>{const r=N.getIn(o,t.path);N.setIn(o,t.path,t.value);const a=t.props.name.toString();ye.trigger(e,a),ge.trigger(t.path),Oe.value&&ne("formChange",{fieldInstance:t,fieldKey:a,oldValue:r,fieldName:t.title,value:t.value,context:ve.getContext(a,t.value)}),He(t),Ie(a),Ve(a),Ne.trigger(a),_e.trigger(a,t.value)})),T("*",Le),T("*",(e=>{const o=e.props.name.toString();Ie(o),Ve(o),me.operationalFormInit&&Ne.trigger(o)})),I("*",Re),me.anchor&&V("*",Fe)}}),{lowCodeReactionsHandler:Ie}=ee(r((()=>me.lowCodeReactions)),Te),{newLowCodeReactionsHandler:Ve}=ae(r((()=>me.newLowCodeReactions)),Te),Ne=te(me,Te),_e=re().create(Te,ve),{schemaAdaptor:De}=M(ye,me.lifeCycle);let We=me.fieldList||[],Ue=[];const Ee=r((()=>{let e=!1;const o=me.schema?me.schema:me.fieldList?(We!==me.fieldList&&0!==We.length||(e=!0),We=K().traverse(S(me.fieldList),me.fieldVisitor),q(De(We,me))):q({});return me.incrementalRender&&e&&(Ue=[],Object.values(o.properties).forEach((e=>{var o;"visible"===e["x-display"]&&"LINEBAR"===e["x-component"]&&!1!==(null==(o=e["x-component-props"])?void 0:o.show)&&(Ue.push(e),e["x-component-props"].show=!1)})),qe()),o}));function qe(){Ue.length&&setTimeout((()=>{const e=Ue.shift();e&&(ge.trigger(N.parse(e.name),!0),Te.setFieldState(e.name,(e=>{e.componentProps.show=!0})),Ue.length?qe():a().then((()=>{ne("ready")})))}),300)}const{onKeydown:Pe}=J({formModel:Te,formRenderRef:de,props:me,formUUID:je}),{clearSpan:Ge}=G();s((()=>Ge(je)));const Me=Q({formModel:Te,formRenderRef:de,formItemDepsCollector:ge,businessCollector:ye,wordbookSettingHandler:_e,operationalFormHandler:Ne,getFieldList:()=>We,formUUID:je,changeContextCollector:ve,emitFormChange:Oe});return le({formModel:Te,validate:(e="*",o={})=>Me.validate(e,o),getFormValues:(e=!0)=>Me.getFormValues(e),setFormValues:async(e,o={})=>Me.setFormValues(e,o),setFieldState(e,o){Me.setFieldState(e,o)},resetFields(e="*"){Me.resetFields(e)},queryWidget:async e=>Me.queryWidget(e),getFieldList:()=>We,applySelectedSetting:e=>Me.applySelectedSetting(e),async reload(){console.error("reload function is abstract,it should be overwrite!")},async optionInited(e={}){if(await a(),be.activeTasks)return new Promise((o=>{var t;const r=()=>{o(),be.onActiveTaskChange=null};be.onActiveTaskChange=()=>{be.activeTasks||r()},setTimeout(r,null!=(t=e.timeout)?t:5e3)}))},updateAnchor(){xe(Te)},getTextFormValues:()=>Me.getTextFormValues()}),(o,t)=>(i(),l(n(w),m({class:["form-render",{"form-render--out-border":e.outBordered}],"require-mark-placement":"left",style:n(pe)},n(L)(),{uuid:n(je)}),{default:p((()=>[e.anchor?(i(),u("section",se,[d(n(x),{value:n(Ce),"onUpdate:value":t[0]||(t[0]=e=>c(Ce)?Ce.value=e:null),type:"line",ref_key:"anchorBarRef",ref:ke},{default:p((()=>[(i(!0),u(f,null,h(n(Se),(e=>(i(),l(n(A),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):y("v-if",!0),d(n(B),{"theme-overrides":n(ue)},{default:p((()=>[g("section",{class:"form-render__wrapper",style:v({"--column":e.column,"--form-height":n(fe)}),ref_key:"formRenderRef",ref:de,onScroll:t[1]||(t[1]=(...e)=>n(we)&&n(we)(...e)),onKeydownCapture:t[2]||(t[2]=(...e)=>n(Pe)&&n(Pe)(...e))},[d(n(_),{form:n(Te)},{default:p((()=>[d(n(he),{schema:n(Ee)},null,8,["schema"]),e.consumer?(i(),l(n(D),{key:0},{default:p((({form:e})=>[g("div",ie,b(JSON.stringify(e.values,null,2)),1)])),_:1})):y("v-if",!0),j(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},16,["class","style","uuid"]))}});export{le as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,inject as o,createVNode as r}from"vue";import{isObjectField as t}from"@formily/core";import{connect as i,RecursionField as n}from"@formily/vue";import{range as m}from"lodash-es";import"../../../../index.js";import{InjectionBusinessCollector as
|
1
|
+
import{defineComponent as e,inject as o,createVNode as r}from"vue";import{isObjectField as t}from"@formily/core";import{connect as i,RecursionField as n}from"@formily/vue";import{range as m}from"lodash-es";import"../../../../index.js";import{InjectionBusinessCollector as s,InjectionFormGlobalProps as a}from"../../../constants/index.js";import"../../../../../../shared/utils/index.js";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"naive-ui";import"../../../utils/business.js";import{createObjSchema as u}from"../../../utils/schema.js";import{useCombination as l}from"./hooks/useCombination.js";import{useFormField as p}from"../../../hooks/useFormField.js";import{useFieldListAdaptor as c}from"../../../hooks/useFieldListAdaptor.js";const f=i(e({name:"FormCombination",props:{title:{type:String,default:""},value:{type:Array},maxGroupNum:{type:Number},minGroupNum:{type:Number,default:1},disabled:{type:Boolean},properties:{type:Array,default:()=>[]},combinationItemDeletable:{type:[Boolean,Function],default:!0},showLabel:Boolean,onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e){const{field:i,fieldKey:f}=p(),{currentGroupNum:d,renderRemoveBtn:v,renderHeader:y}=l(e);function b(){d.value++}const h=o(s),j=o(a),{schemaAdaptor:C}=c(h,j.lifeCycle);return()=>r("section",{class:"form-render__combination"},[y({onClick:b}),m(d.value).map(((o,m)=>r("section",{class:"form-render__combinationContent"},[r(n,{schema:u(C(e.properties)),name:m},null),v({onClick:()=>async function(o){if(d.value>e.minGroupNum)d.value--,await i.value.remove(o);else{const e=i.value.query(`${f.value}.${o}`).take();if(!e||!t(e))return;await e.reset()}}(m),class:"form-render__combinationClose"},m)])))])}}));export{f as COMBINATION};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,createVNode as r}from"vue";import{connect as t,mapProps as o}from"@formily/vue";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"lodash-es";import"naive-ui";import"
|
1
|
+
import{defineComponent as e,createVNode as r}from"vue";import{connect as t,mapProps as o}from"@formily/vue";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"lodash-es";import"naive-ui";import"../../utils/business.js";import{assignUpdateValue as s}from"../../utils/schema.js";const i=t(e({props:{onChange:{},span:{type:Number,default:6},display:{type:String,default:"grid"},wrapperStyle:{type:Object,default:()=>({})}},setup:(e,{slots:t})=>()=>r("section",{class:"form-render__complex"},[r("section",{class:`form-render__complexContent--${e.display}`,style:e.wrapperStyle},[t.default&&t.default()])])}),o(s));export{i as COMPLEX};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,computed as t,watch as a,ref as o,onMounted as
|
1
|
+
import{defineComponent as e,computed as t,watch as a,ref as o,onMounted as i,createVNode as n,mergeProps as r}from"vue";import{generateTimeFormat as u}from"../../../../../shared/utils/index.js";import{connect as l,mapProps as s}from"@formily/vue";import{isObject as d,useEventListener as m}from"@vueuse/core";import{format as v}from"date-fns";import c from"../../../../date-picker/index.js";import{useCommonInjection as p}from"../../hooks/useCommonInjection.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"lodash-es";import"naive-ui";import"../../utils/business.js";import{assignUpdateValue as f,assignClearBindVisited as y}from"../../utils/schema.js";const b=l(e({props:{onChange:{},disabled:{type:Boolean},value:{type:String},validate:{type:Object},valueFormat:{type:String,default:"yyyy-MM-dd"},allowedInvalidValue:{type:String,default:"-"},dbclickToCurrent:{type:Boolean,default:!0}},emits:["update:value"],setup(e,{emit:l}){const{injectValueValidate:s,injectValueBindKey:f}=p();function y(){var t;return"currTime"===(null==(t=e.validate)?void 0:t.min_date)}function b(){var t;return"currTime"===(null==(t=e.validate)?void 0:t.max_date)}function w(e){return y()&&e<Date.now()-864e5||b()&&e>Date.now()}function D(e){const t=new Date(e),a=new Date,o=new Date(t);o.setHours(0),o.setMinutes(0),o.setSeconds(0);const i=new Date(t);i.setHours(23),i.setMinutes(59),i.setSeconds(59);const n=o>a,r=i<a,u=t.getHours(),l=a.getHours(),s=a.getMinutes();return{isHourDisabled:function(e){return y()&&!n&&e<l||b()&&!r&&e>l},isMinuteDisabled:function(e){if(u===l)return y()&&!n&&e<s||b()&&!r&&e>s;return y()&&!n&&u<l||b()&&!r&&u>l}}}s((()=>e.value));const j=t((()=>{const t={};if(d(e.validate)){const{min_date:a,max_date:o}=e.validate;(a||o)&&(t.isDateDisabled=w,t.isTimeDisabled=D)}return t})),g=t((()=>({valueFormat:e.valueFormat,format:e.valueFormat,timePickerProps:{format:u(e.valueFormat)}})));function h(t){return t?t===e.allowedInvalidValue?t:v(new Date(t),e.valueFormat):null}a((()=>e.value),(e=>{e&&h(e)!==e&&l("update:value",h(e))}));const k=t({get:()=>h(e.value),set:e=>{l("update:value",e)}}),F=f(k),V=o();return i((()=>{var t;if(!e.dbclickToCurrent)return;const a=null==(t=V.value)?void 0:t.$el;if(!a)return;const o=a.querySelector("input");o&&m(a,"dblclick",(()=>function(t){e.disabled||(t.value=v(Date.now(),e.valueFormat),t.dispatchEvent(new Event("input")))}(o)))})),()=>n(c,r({ref:V,key:F.value,disabled:e.disabled,allowedInvalidValue:e.allowedInvalidValue},j.value,g.value,{"formatted-value":k.value,"onUpdate:formatted-value":e=>k.value=e}),null)}}),s(f,y));export{b as DATE};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,computed as t,inject as l,createVNode as a,mergeProps as o,isVNode as n}from"vue";import
|
1
|
+
import{defineComponent as e,computed as t,inject as l,createVNode as a,mergeProps as o,isVNode as n}from"vue";import i from"../../../../../shared/components/CancelRadio/CancelRadio.js";import{connect as r,mapProps as u}from"@formily/vue";import{cloneDeep as s,isArray as c,xor as d,isNumber as p,isEmpty as v}from"lodash-es";import{NCheckboxGroup as m,NCheckbox as f,NRadioGroup as h}from"naive-ui";import"../../../index.js";import{InjectionChangeContextCollector as y}from"../../constants/index.js";import{useComplexOptions as g}from"../../hooks/useComplexOptions.js";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"../../utils/business.js";import{assignUpdateValue as j,createVisitedSetter as b}from"../../utils/schema.js";import{useUrlConfigOptions as x,useAutographOptions as F}from"../../hooks/useFormRenderOptions.js";import{useCommonInjection as C}from"../../hooks/useCommonInjection.js";import{useFormField as k}from"../../hooks/useFormField.js";function S(i,r,u){return e({name:i,props:{value:{type:[String,Number,Object,Array]},options:{type:Array,default:()=>[]},urlConfig:{type:Object},autograph:{type:String},lazyRequest:{type:Boolean,default:!1},requestCache:{type:Boolean,default:!0},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},wordbook:{type:Object},vertical:{type:Boolean,default:!1},childFieldStrategy:{type:String,default:"checked"},childWidthMode:{type:String,default:"outer"},clearable:Boolean,selectAll:Boolean,onChange:{}},emits:["update:value"],setup(e,{emit:i,attrs:h}){const{field:j,fieldKey:S}=k();const O=t({get(){return t=e.value,p(t)?t+"":t;var t},set(e){i("update:value",e)}}),{renderComplexOption:w}=g(e,O),{labelKey:_,valueKey:B,fullOptions:K}=e.urlConfig?x(e,O):F(e,O);l(y).setContext(S.value,(e=>{return{currentOption:s((t=e,c(t)?function(e){const t=K.value.reduce(((e,t)=>(e[t[B.value]]=t,e)),{});return e.map((e=>t[e]))}(t):(l=t,K.value.find((e=>e[B.value]===l))))),labelField:_.value,valueField:B.value};var t,l}));const{injectValueBindKey:W,injectValueValidate:R}=C();R(O);const A=W(O);function I(){O.value=null}const M=t({get:()=>c(O.value)&&O.value.length===K.value.length,set(e){const t=e?K.value.map((e=>e[B.value])):[];d(t,O.value).length&&(O.value=t)}}),V=t((()=>c(e.value)&&e.value.length&&e.value.length<K.value.length));function P(t){let l;const o={display:"flex",alignItems:"center"};if(t.__spanPercent&&"inner"===e.childWidthMode){const e=`${t.__spanPercent}%`;o.maxWidth=e,function(e,t){return!v(t.childrenFields)&&(c(e)?e.includes(t[B.value]):e===t[B.value])}(O.value,t)&&(o.width=e)}return a(u,{key:t[B.value],value:t[B.value],disabled:t.disabled,currentValue:O.value,cancelable:e.clearable,onCancel:I,style:o},"function"==typeof(i=l=w({value:O.value,option:t,valueKey:B.value,labelKey:_.value,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode}))||"[object Object]"===Object.prototype.toString.call(i)&&!n(i)?l:{default:()=>[l]});var i}return()=>{const t=K.value.map((e=>{var t;const l=null==(t=e.childrenFields)?void 0:t.reduce(((e,t)=>e+ +(t.elem_width||3)),0);return{...e,__spanPercent:(l||0)/12*100}})),l={display:"flex",flexDirection:e.vertical?"column":"row",flexWrap:"wrap",justifyItems:"flex-start",alignItems:e.vertical?"flex-start":"center",width:"100%"},n=a(r,o({key:A.value,value:O.value,"onUpdate:value":e=>O.value=e,onClick:b(j),style:{width:"100%"}},h),{default:()=>[a("section",{style:l},[t.map(P)])]});return e.selectAll?a("section",null,[[r!==m?null:a(f,{checked:M.value,"onUpdate:checked":e=>M.value=e,indeterminate:V.value},{default:()=>"全选"}),n]]):n}}})}const O=r(S("FormRadio",h,i),u({dataSource:"options"},j)),w=r(S("FormCheckbox",m,f),u({dataSource:"options"},j));export{w as CHECKBOX,O as RADIO};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as a,inject as l,watch as o,createVNode as r,nextTick as n}from"vue";import{connect as u,mapProps as i}from"@formily/vue";import{last as s,isEqual as c,isArray as p,isString as d}from"lodash-es";import{NCascader as v}from"naive-ui";import"../../../index.js";import{useCommonInjection as m}from"../../hooks/useCommonInjection.js";import{InjectionChangeContextCollector as f,InjectionAsyncQueue as h,InjectionFormUUID as y}from"../../constants/index.js";import"@formily/path";import"@vueuse/core";import"../../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"
|
1
|
+
import{defineComponent as e,ref as t,computed as a,inject as l,watch as o,createVNode as r,nextTick as n}from"vue";import{connect as u,mapProps as i}from"@formily/vue";import{last as s,isEqual as c,isArray as p,isString as d}from"lodash-es";import{NCascader as v}from"naive-ui";import"../../../index.js";import{useCommonInjection as m}from"../../hooks/useCommonInjection.js";import{InjectionChangeContextCollector as f,InjectionAsyncQueue as h,InjectionFormUUID as y}from"../../constants/index.js";import"@formily/path";import"@vueuse/core";import"../../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"../../utils/business.js";import{assignUpdateValue as k,createVisitedSetter as j,traverseDependKey as g}from"../../utils/schema.js";import"date-fns";import"../../hooks/useComplexOptions.js";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"@vueuse/shared";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import"../../../../../shared/hooks/useScrollLoading.js";import"./index.js";import{useFormField as b}from"../../hooks/useFormField.js";import"@formily/reactive";import"../../hooks/useFormValidator.js";const C=u(e({name:"FormCascader",props:{options:{type:Array,default:()=>[]},depth:{type:[Number,String]},urlConfig:{type:Object},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},onFocus:{type:Function},filterable:{type:Boolean,default:!1},checkStrategy:{type:String,default:"child"},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},onChange:{},value:{}},emits:["update:value"],setup(e,{slots:u,emit:i}){const k=t(),{field:C,title:S,fieldKey:F}=b(),w=t(1),A=t(!0);const H=a((()=>{var t,a,l;return null!=(l=null!=(a=null==(t=e.urlConfig)?void 0:t.nameKey)?a:e.labelField)?l:"text"})),x=a((()=>{var t,a,l;return null!=(l=null!=(a=null==(t=e.urlConfig)?void 0:t.valueKey)?a:e.valueField)?l:"value"}));l(f).setContext(F.value,(()=>({labelField:H.value,valueField:x.value})));const q=a((()=>{var t;try{const a=Array.isArray(e.value)?e.value:JSON.parse(e.value||"");if(!Array.isArray(a)||!a.length)return null;const l=null==(t=s(a))?void 0:t[x.value];return null!=l?l:a.map((e=>e[H.value])).join(" / ")}catch(e){return null}}));function K(e,t,a){i("update:value",p(a)?a.map((function(e){return{...e,label:e[H.value],children:void 0,parent:void 0,mergeItemValue:void 0}})):null)}const L=l(h);async function V(t){e.filterable?await async function(){if(!e.urlConfig||k.value&&e.requestCache)return;const t=await L.addAsync({...e.urlConfig,params:{lvlnr:"1"},key:F.value,cache:e.requestCache,payload:{field:C.value,labelKey:H.value,valueKey:x.value}});function a(e,t,o){const r=[...o,...l(e)],n={[H.value]:e[H.value],[x.value]:e[x.value],depth:t+1,isLeaf:!0,keyword:e.keyword,mergeItemValue:r};return p(e.children)&&(n.children=e.children.map((e=>a(e,t+1,r))),n.isLeaf=!e.children.length),w.value=Math.max(w.value,t+1),n}function l(e){let t=[];if(d(e[H.value])&&(t=[...t,e[H.value]]),d(e.keyword)&&e.keyword.length>0){const a=e.keyword.split(",");t=[...t,...a]}return t}k.value=t.map((e=>a(e,0,[])))}():await async function(t){if(o(e,t))return;const a=await L.addAsync(r(s(t),i(e),S.value,t));if(!a.length&&t)return t.isLeaf=!0,K(0,0,n(t)),void(N.value=!1);const l=a.map((e=>u(e,s(t))));function o(e,t){return!i(e)||!t&&k.value&&e.requestCache||s(t)>=s(e)-1}function r(t,a,l,o){const r={lvlnr:t+1+""};return o&&a.dependKey&&g(a.dependKey,((e,t)=>{r[t]=o[e]})),{params:r,...a,key:l,cache:e.requestCache}}function n(e){let t=e;const a=[e];for(;t.parent;)a.unshift(t.parent),t=t.parent;return a}function u(a,l){return{[H.value]:a[H.value],[x.value]:a[x.value],depth:l+1,parent:t,isLeaf:l+2>=s(e)}}function i(e){return e.urlConfig}function s(e){var t;return null!=(t=null==e?void 0:e.depth)?t:-1}t?t.children=l:k.value=l}(t),await I()}const B=`form-render__cascade--menu-${l(y)}`;async function I(){await n();const e=document.querySelector(`.${B} .v-vl`);e&&e.dispatchEvent(new CustomEvent("scroll"))}function E(t,a){if(!t||!a)return!1;const{mergeItemValue:l}=a;return!(e.checkStrategy.includes("child")&&a.depth<w.value)&&(l.length>0&&l.some((e=>e.includes(t.trim()))))}const{injectValueValidate:O,injectValueWatchFromEmpty:W,injectValueBindKey:z}=m();W((()=>e.value),V),O((()=>e.value)),o((()=>e.urlConfig),(async(t,a)=>{c(t,a)||(k.value=null,A.value?e.lazyRequest||(V(),A.value=!A.value):await V())}),{immediate:!0});const N=t(!1);function P(e){N.value=!!e,e&&V()}const R=a((()=>k.value||e.options||[])),U=a((()=>!e.filterable)),$=z(q);return()=>r(v,{key:$.value,remote:U.value,filterable:e.filterable,"menu-props":{class:B,onClick:I},"check-strategy":e.checkStrategy,show:!!N.value,"onUpdate:show":P,value:q.value,filter:E,"onUpdate:value":K,labelField:H.value,valueField:x.value,options:R.value,onLoad:V,onFocus:j(C)},u)}}),i({dataSource:"options"},k));export{C as SEARCH_CASCADER};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,computed as o,watch as t,inject as l,useAttrs as a,ref as r,createVNode as s,mergeProps as n,toRaw as u}from"vue";import{arrayed as i}from"../../../../../shared/utils/index.js";import{NSelect as p}from"naive-ui";import"@vueuse/core";import"date-fns";import{cloneDeep as m,isArray as d,isObject as c,omit as v,xor as y}from"lodash-es";import"@vue/shared";import{useSelectAllowModify as f}from"../../../../../shared/hooks/selectHooks/useSelectAllowModify.js";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import{useSelectRenders as h}from"../../../../../shared/hooks/selectHooks/useSelectRenders.js";import"../../../../../shared/hooks/useScrollLoading.js";import{connect as b,mapProps as j}from"@formily/vue";import{useCommonInjection as S,useSelectOptionProps as g}from"../../hooks/useCommonInjection.js";import{useComplexOptions as k,useComplexOptionsSpan as C}from"../../hooks/useComplexOptions.js";import{InjectionChangeContextCollector as F,InjectionFormUUID as B}from"../../constants/index.js";import"@formily/path";import"@formily/core";import"@vicons/ionicons5";import{assignUpdateValue as w,assignClearBindVisited as A,createVisitedSetter as H}from"../../utils/schema.js";import"../../../index.js";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"./index.js";import"@vueuse/shared";import{useFormField as O}from"../../hooks/useFormField.js";import"@formily/reactive";import{useUrlConfigOptions as K,useAutographOptions as R,useRecommendOptions as x}from"../../hooks/useFormRenderOptions.js";import"../../hooks/useFormValidator.js";const V=b(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"},showField:{type:String},allowCreate:Boolean,shouldSave:Boolean,allowModify:Boolean,showCustomValue:Boolean,cursorPlacement:{type:String,default:"end"},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},useLoading:{type:Boolean,default:!0},multiple:{type:Boolean},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean},searchByValue:{type:Boolean},wordSplitFilter:{}},emits:["update:value","postRecommend","patternChange"],setup(e,{slots:b,emit:j}){const w=o({get:()=>e.value,async set(e){j("update:value",e),G(e)}}),{labelKey:A,valueKey:V,showKey:L,fetchData:P,searchContent:_,fullOptions:N,filterOptions:I,remoteOptions:W,loading:q}=e.urlConfig?K(e,w):R(e,w);t(_,(e=>{j("patternChange",{pattern:e,options:ue.value})}));const{modifyEvent:E,modifyAbleRef:z,getOptionsWithCreated:M}=f(e,{searchContent:_,labelKey:A,valueKey:V,valueRef:w,fullOptions:N}),{renderComplexOption:T,hasComplexOption:U}=k(e,w),{getRecommend:D,postRecommend:G,sortedOptions:J}=x(e,I,j,A,V),{field:Q,fieldKey:X}=O();l(F).setContext(X.value,(e=>({currentOption:m(function(e){const o=M(N.value);return d(e)?function(e){const t=o.reduce(((e,o)=>(e[o[V.value]]=o,e)),{});return e.map((e=>t[e]))}(e):(t=e,o.find((e=>e[V.value]===t)));var t}(e)),labelField:A.value,valueField:V.value})));const Y=async e=>(_.value=e,Promise.allSettled([P(e),D(e)])),{injectValueValidate:Z,injectValueWatchFromEmpty:$,injectValueBindKey:ee}=S();$(w,(()=>e.lazyRequest&&Y())),Z(w);const oe=ee(w),{menuProps:te,nodeProps:le}=g(),{renderTag:ae,renderLabel:re,renderSelectAll:se,titleRef:ne}=h(e,{labelKey:A,valueKey:V,valueRef:w,showKey:L,searchContent:_}),ue=o((()=>M(z.value?N.value:J.value))),ie=a(),pe=o((()=>{if(e.allowCreate||e.showCustomValue)return w.value;const o=e.multiple&&d(w.value);return N.value.find((e=>o?w.value.includes(e[V.value]):e[V.value]===w.value))?w.value:null})),me=r(!1);async function de(e){e&&await Y(),me.value=e}async function ce(e,o){await E.updateValue(e,o),W.value&&o&&i(o).forEach((e=>{if(!c(e))return;const o=e;o.created&&o.shouldSave&&W.value.push(v(u(o),["created","shouldSave"]))}))}const ve=l(B),{getSpan:ye}=C(),fe=H(Q,E.focus);function he(o){if(!e.multiple)return;const t=o?ue.value.map((e=>e[V.value])):[];y(t,e.value).length&&(w.value=t)}function be(o){let t=b;return e.multiple&&e.selectAll&&(t={action:()=>se(he),...b}),s(p,n({title:ne.value,key:oe.value,multiple:e.multiple,remote:!0,filterable:!0,loading:q.value,value:pe.value,onUpdateValue:ce,"menu-props":te,"node-props":le,labelField:A.value,valueField:V.value,options:ue.value,onSearch:Y,show:me.value,"onUpdate:show":de,onFocus:fe,onBlur:E.blur,renderLabel:re,renderTag:ae},o,ie),t)}return()=>{var e,o;if(!U.value)return be();const t=null!=(o=null==(e=Q.value.decoratorProps)?void 0:e.span)?o:6,l=ye(ve,Q.value.address);return s("section",{class:"form-render__selectChildField",style:{"--column":l+t}},[be({class:"form-render__selectChildFieldItem",style:{"--form-item-column":t}}),N.value.map((e=>T({option:e,value:w.value,valueKey:V.value,labelKey:A.value,childFieldStrategy:"checked",renderLabel:!1,attrs:{class:"form-render__selectChildFieldItem",style:{"--form-item-column":l}}})))])}}}),j({dataSource:"options"},w,A));export{V as SELECT};
|
1
|
+
import{defineComponent as e,computed as o,watch as t,inject as l,useAttrs as a,ref as r,createVNode as s,mergeProps as n,toRaw as u}from"vue";import{arrayed as i}from"../../../../../shared/utils/index.js";import{NSelect as p}from"naive-ui";import"@vueuse/core";import"date-fns";import{cloneDeep as m,isArray as d,isObject as c,omit as v,xor as y}from"lodash-es";import"@vue/shared";import{useSelectAllowModify as f}from"../../../../../shared/hooks/selectHooks/useSelectAllowModify.js";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import{useSelectRenders as h}from"../../../../../shared/hooks/selectHooks/useSelectRenders.js";import"../../../../../shared/hooks/useScrollLoading.js";import{connect as b,mapProps as j}from"@formily/vue";import{useCommonInjection as S,useSelectOptionProps as g}from"../../hooks/useCommonInjection.js";import{useComplexOptions as k,useComplexOptionsSpan as C}from"../../hooks/useComplexOptions.js";import{InjectionChangeContextCollector as F,InjectionFormUUID as B}from"../../constants/index.js";import"@formily/path";import"@formily/core";import"@vicons/ionicons5";import"../../utils/business.js";import{assignUpdateValue as w,assignClearBindVisited as A,createVisitedSetter as H}from"../../utils/schema.js";import"../../../index.js";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"./index.js";import"@vueuse/shared";import{useFormField as O}from"../../hooks/useFormField.js";import"@formily/reactive";import{useUrlConfigOptions as K,useAutographOptions as R,useRecommendOptions as x}from"../../hooks/useFormRenderOptions.js";import"../../hooks/useFormValidator.js";const V=b(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"},showField:{type:String},allowCreate:Boolean,shouldSave:Boolean,allowModify:Boolean,showCustomValue:Boolean,cursorPlacement:{type:String,default:"end"},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},useLoading:{type:Boolean,default:!0},multiple:{type:Boolean},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean},searchByValue:{type:Boolean},wordSplitFilter:{}},emits:["update:value","postRecommend","patternChange"],setup(e,{slots:b,emit:j}){const w=o({get:()=>e.value,async set(e){j("update:value",e),G(e)}}),{labelKey:A,valueKey:V,showKey:L,fetchData:P,searchContent:_,fullOptions:N,filterOptions:I,remoteOptions:W,loading:q}=e.urlConfig?K(e,w):R(e,w);t(_,(e=>{j("patternChange",{pattern:e,options:ue.value})}));const{modifyEvent:E,modifyAbleRef:z,getOptionsWithCreated:M}=f(e,{searchContent:_,labelKey:A,valueKey:V,valueRef:w,fullOptions:N}),{renderComplexOption:T,hasComplexOption:U}=k(e,w),{getRecommend:D,postRecommend:G,sortedOptions:J}=x(e,I,j,A,V),{field:Q,fieldKey:X}=O();l(F).setContext(X.value,(e=>({currentOption:m(function(e){const o=M(N.value);return d(e)?function(e){const t=o.reduce(((e,o)=>(e[o[V.value]]=o,e)),{});return e.map((e=>t[e]))}(e):(t=e,o.find((e=>e[V.value]===t)));var t}(e)),labelField:A.value,valueField:V.value})));const Y=async e=>(_.value=e,Promise.allSettled([P(e),D(e)])),{injectValueValidate:Z,injectValueWatchFromEmpty:$,injectValueBindKey:ee}=S();$(w,(()=>e.lazyRequest&&Y())),Z(w);const oe=ee(w),{menuProps:te,nodeProps:le}=g(),{renderTag:ae,renderLabel:re,renderSelectAll:se,titleRef:ne}=h(e,{labelKey:A,valueKey:V,valueRef:w,showKey:L,searchContent:_}),ue=o((()=>M(z.value?N.value:J.value))),ie=a(),pe=o((()=>{if(e.allowCreate||e.showCustomValue)return w.value;const o=e.multiple&&d(w.value);return N.value.find((e=>o?w.value.includes(e[V.value]):e[V.value]===w.value))?w.value:null})),me=r(!1);async function de(e){e&&await Y(),me.value=e}async function ce(e,o){await E.updateValue(e,o),W.value&&o&&i(o).forEach((e=>{if(!c(e))return;const o=e;o.created&&o.shouldSave&&W.value.push(v(u(o),["created","shouldSave"]))}))}const ve=l(B),{getSpan:ye}=C(),fe=H(Q,E.focus);function he(o){if(!e.multiple)return;const t=o?ue.value.map((e=>e[V.value])):[];y(t,e.value).length&&(w.value=t)}function be(o){let t=b;return e.multiple&&e.selectAll&&(t={action:()=>se(he),...b}),s(p,n({title:ne.value,key:oe.value,multiple:e.multiple,remote:!0,filterable:!0,loading:q.value,value:pe.value,onUpdateValue:ce,"menu-props":te,"node-props":le,labelField:A.value,valueField:V.value,options:ue.value,onSearch:Y,show:me.value,"onUpdate:show":de,onFocus:fe,onBlur:E.blur,renderLabel:re,renderTag:ae},o,ie),t)}return()=>{var e,o;if(!U.value)return be();const t=null!=(o=null==(e=Q.value.decoratorProps)?void 0:e.span)?o:6,l=ye(ve,Q.value.address);return s("section",{class:"form-render__selectChildField",style:{"--column":l+t}},[be({class:"form-render__selectChildFieldItem",style:{"--form-item-column":t}}),N.value.map((e=>T({option:e,value:w.value,valueKey:V.value,labelKey:A.value,childFieldStrategy:"checked",renderLabel:!1,attrs:{class:"form-render__selectChildFieldItem",style:{"--form-item-column":l}}})))])}}}),j({dataSource:"options"},w,A));export{V as SELECT};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,useAttrs as o,ref as t,computed as i,createVNode as l,mergeProps as r,createTextVNode as u}from"vue";import{NSwitch as n,NModal as a,NCheckbox as s}from"naive-ui";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"lodash-es";import"
|
1
|
+
import{defineComponent as e,useAttrs as o,ref as t,computed as i,createVNode as l,mergeProps as r,createTextVNode as u}from"vue";import{NSwitch as n,NModal as a,NCheckbox as s}from"naive-ui";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"lodash-es";import"../../utils/business.js";import{assignUpdateValue as v,assignValueBindKey as p}from"../../utils/schema.js";import{connect as d,mapProps as c}from"@formily/vue";import"../../../index.js";import{useFormField as m}from"../../hooks/useFormField.js";const h=d(e({name:"FormSwitch",props:{value:{},openDescription:{type:Object},closeDescription:{type:Object},showMode:{type:String,default:"SWITCH"},onChange:{}},emits:["update:value"],setup(e,{emit:v}){const p=o(),d=t(!1),{field:c,fieldKey:h}=m(),f=i((()=>{var e,o;return null==(o=null==(e=c.value.decoratorProps)?void 0:e.fieldItem)?void 0:o.requiredReminderContent})),y=i((()=>{var o,t;return null==(t=null==(o=e.openDescription)?void 0:o.value)||t})),j=i((()=>{var o,t;return null!=(t=null==(o=e.closeDescription)?void 0:o.value)&&t})),w=()=>{var o,t;return u(null!=(t=null==(o=e.openDescription)?void 0:o.describe)?t:"")},k=()=>{var o,t;return u(null!=(t=null==(o=e.closeDescription)?void 0:o.describe)?t:"")},C=i({get:()=>e.value===y.value,set(o){if(!f.value||"SWITCH"!==e.showMode||o)return v("update:value",o?y.value:j.value);d.value=!0}});function D(){v("update:value",j.value)}return()=>"SWITCH"===e.showMode?[l(n,r({value:C.value,"onUpdate:value":e=>C.value=e},p),{checked:w,unchecked:k}),f.value?l(a,{show:d.value,"onUpdate:show":e=>d.value=e,"display-directive":"show",preset:"dialog",title:"确认","positive-text":"确认","negative-text":"取消",content:f.value,onPositiveClick:D},null):null]:l(s,{checked:C.value,"onUpdate:checked":e=>C.value=e},{default:w})}}),c(v,p));export{h as SWITCH};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,computed as o,inject as r,createVNode as t,mergeProps as i}from"vue";import{InjectionFormGlobalProps as
|
1
|
+
import{defineComponent as e,computed as o,inject as r,createVNode as t,mergeProps as i}from"vue";import{InjectionFormGlobalProps as s}from"../../constants/index.js";import{useCommonInjection as u}from"../../hooks/useCommonInjection.js";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"lodash-es";import{NInput as m}from"naive-ui";import"../../utils/business.js";import{assignUpdateValue as a,assignClearBindVisited as l}from"../../utils/schema.js";import{connect as n,mapProps as p,useField as v}from"@formily/vue";const d=n(e({name:"FormTextarea",props:{value:{type:String},rows:{type:Number}},emits:["update:value"],setup(e,{emit:a}){const l=o({get:()=>e.value,set:e=>a("update:value",e)}),n=u().injectValueBindKey(l),p=v(),d=r(s,{}),c=o((()=>{var e,o,r;return null!=(r=null==(o=null==(e=p.value.decoratorProps)?void 0:e.fieldItem)?void 0:o.bordered)?r:d.bordered})),f=o((()=>"underline"===c.value?{autosize:{minRows:e.rows,maxRows:99}}:{rows:e.rows}));return()=>t(m,i({type:"textarea"},f.value,{key:n.value,value:l.value,"onUpdate:value":e=>l.value=e}),null)}}),p(a,l));export{d as TEXTAREA};
|
@@ -1 +1 @@
|
|
1
|
-
import{doAnimation as e}from"../../../../shared/utils/anime.js";import{Path as o}from"@formily/path";import{useDebounceFn as r,watchOnce as t}from"@vueuse/core";import{ref as n,nextTick as i,computed as l}from"vue";import"../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"lodash-es";import"naive-ui";import"
|
1
|
+
import{doAnimation as e}from"../../../../shared/utils/anime.js";import{Path as o}from"@formily/path";import{useDebounceFn as r,watchOnce as t}from"@vueuse/core";import{ref as n,nextTick as i,computed as l}from"vue";import"../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"lodash-es";import"naive-ui";import"../utils/business.js";import{createLinebarId as s}from"../utils/schema.js";function a(a,u,c,m){const v=n(),p=n(""),f=n([]),d=r((async function(e){var o;f.value=Object.values(e.fields).reduce(((e,o)=>{var r,t,n,i;return"LINEBAR"===o.componentType&&"visible"===o.selfDisplay&&e.push({title:null!=(t=null==(r=o.componentProps)?void 0:r.title)?t:o.title,name:o.address.toString(),index:null!=(i=null==(n=o.decoratorProps)?void 0:n._index)?i:0}),e}),[]).sort(((e,o)=>e.index-o.index)),await i(),null==(o=v.value)||o.syncBarPosition()}),100);let h=!1;async function y(r){h=!0;try{if(!c.value)return;m.trigger(o.parse(r),!0),await i();const t=c.value.querySelector(`#${s(r)}`);if(!t)return;await new Promise((o=>{e(c.value.scrollTop,t.offsetTop,300,(e=>{var o;null==(o=c.value)||o.scrollTo({top:e})}),"easeInSine",(()=>setTimeout(o,300)))}))}finally{h=!1}}const T=r((function(e){var o;if(h||!c.value)return;const{scrollTop:r,clientHeight:t}=c.value,n=f.value.find(((e,o,n)=>{const i=n[o+1];if(!i)return!0;const l=c.value.querySelector(`#${s(i.name)}`);return l?l.offsetTop>r+t/2:void 0}))||f.value[f.value.length-1];p.value=null!=(o=null==n?void 0:n.name)?o:"",u("scroll",e)}),300);t(f,(e=>{var o,r;p.value=null!=(r=null==(o=e[0])?void 0:o.name)?r:""}));return{currentAnchor:l({get:()=>p.value,async set(e){p.value=e,await new Promise((e=>setTimeout(e,100))),await y(e)}}),onScroll:T,anchorIdList:f,generateAnchorList:d,updateAnchorList:function(e){"LINEBAR"===e.componentType&&e.selfDisplay&&d(e.form)},scrollTo:y,anchorBarRef:v}}export{a as useAnchor};
|
@@ -1 +1 @@
|
|
1
|
-
import{isField as e}from"@formily/core";import{Path as t}from"@formily/path";import{isString as s}from"@vueuse/core";import{format as i}from"date-fns";import{isFunction as r,isNumber as
|
1
|
+
import{isField as e}from"@formily/core";import{Path as t}from"@formily/path";import{isString as s}from"@vueuse/core";import{format as i}from"date-fns";import{isFunction as r,isNumber as n}from"lodash-es";import{FIELD_BUSINESS_TYPE as l}from"../constants/index.js";import"vue";import"../../../../shared/utils/index.js";import"@vicons/ionicons5";import"@vue/shared";import"naive-ui";import{isIdCard as a,parseIdCard as o,parseAgeFromContext as u,parseBirthday as h,parseAge2Birthday as y}from"../utils/business.js";class c{constructor(e){this.businessFormatter=e,this.triggerDisabled=!1,this.typeLockMap=new Map,this.typeCollector=new Map,this.fieldNameCollector=new Map,this.changeHandlerMap=new Map([])}formatter(...e){return r(this.businessFormatter)?this.businessFormatter(...e):e[0].value}collect(e,t){this.typeCollector.set(e,t),this.fieldNameCollector.set(t.val_key,e)}getField(e){return this.typeCollector.get(e)}getFieldInstanceByType(e,t){const s=this.getField(t);return s?e.query(s.val_key).take():null}getType(e){return this.fieldNameCollector.get(e)}getValueByField(t,s){const i=t.query(s).take();return e(i)?i.value:null}getValueByType(e,t){const s=this.getField(t);return s?this.getValueByField(e,s.val_key):null}setValueByType(e,i,r,n){const l=this.getField(i);l&&e.setFieldState(l.val_key,(e=>{e.value!==r&&(!this.typeLockMap.get(i)&&this.typeLockMap.set(i,1),this.triggerDisabled&&s(this.triggerDisabled)&&t.parse(this.triggerDisabled).match(l.val_key)||(e.value=this.formatter({value:r,type:i,fieldKey:l.val_key,from:n})))}))}registerChangeBusiness(e,t){return this.changeHandlerMap.set(e,t),this}trigger(e,t,s="change"){var i;if(!0===this.triggerDisabled)return;const r=this.getType(t);if(!r)return;if("change"===s&&this.typeLockMap.get(r))return this.typeLockMap.set(r,0);const n="change"===s?this.changeHandlerMap:null;n&&(null==(i=n.get(r))||i.call(this,e))}}function g(){function e(){var e;const t=this.getField(l.BIRTHDAY);return null!=(e=null==t?void 0:t.date_format)?e:"yyyy-MM-dd HH:mm"}function t(t){const r=this.getValueByType(t,l.ID_CARD);if(!r||!s(r)||!a(r))return;const n=o(r),{age:h,ageUnit:y}=u(n);null!=y&&this.setValueByType(t,l.AGE_UNIT,y,l.ID_CARD),null!=h&&this.setValueByType(t,l.AGE,h,l.ID_CARD),null!=n.sex&&this.setValueByType(t,l.SEX,n.sex,l.ID_CARD),null!=n.birthday&&this.setValueByType(t,l.BIRTHDAY,i(new Date(n.birthday),e.call(this)),l.ID_CARD)}function r(e){const t=this.getValueByType(e,l.BIRTHDAY);if(!s(t))return;const{age:i,ageUnit:r}=u(h(t));this.setValueByType(e,l.AGE_UNIT,r,l.BIRTHDAY),this.setValueByType(e,l.AGE,i,l.BIRTHDAY)}function g(t){return function(i){const r=this.getValueByType(i,l.AGE),a=this.getValueByType(i,l.AGE_UNIT);(s(r)||n(r))&&""!==r&&s(a)&&""!==a&&this.setValueByType(i,l.BIRTHDAY,y(+r,a,e.call(this)),t)}}return{create:function(e){return new c(e).registerChangeBusiness(l.ID_CARD,t).registerChangeBusiness(l.AGE_UNIT,g(l.AGE_UNIT)).registerChangeBusiness(l.AGE,g(l.AGE)).registerChangeBusiness(l.BIRTHDAY,r)}}}export{c as BusinessCollector,g as useBusinessBinding};
|
@@ -2,6 +2,7 @@ import { AgeContext, IdCardParseInfo } from '../../../../components/form-render'
|
|
2
2
|
import { FIELD_AGE_UNIT } from '../../../../components/form-render/src/constants';
|
3
3
|
export declare function parseIdCard(idCardNo: string): IdCardParseInfo;
|
4
4
|
export declare function transformDateFormat(format?: string): "year" | "month" | "date" | "datetime" | "time";
|
5
|
+
export declare function isForeignerID(id: string): boolean;
|
5
6
|
export declare function isIdCard(idCardNo: string): boolean;
|
6
7
|
export declare function isMobile(mobile: string): boolean;
|
7
8
|
export declare function parseBirthday(birthday: string): AgeContext;
|
@@ -1 +1 @@
|
|
1
|
-
import{format as t,differenceInDays as e,differenceInMonths as n,differenceInYears as r,differenceInHours as s,differenceInMinutes as a}from"date-fns";import{isString as
|
1
|
+
import{format as t,differenceInDays as e,differenceInMonths as n,differenceInYears as r,differenceInHours as s,differenceInMinutes as a}from"date-fns";import{range as u,isString as i}from"lodash-es";import{FIELD_AGE_UNIT as c,FIELD_SEX_VALUE as o}from"../constants/index.js";function d(t){function e(t,e,n,r){t.birthday=e+"-"+n+"-"+r+" 00:00";const s=new Date,a=s.getMonth()+1<parseInt(n,10)||s.getMonth()+1==parseInt(n,10)&&s.getDate()<parseInt(r,10)?1:0;return Object.assign(t,U(t.birthday)),t.age=t.year=s.getFullYear()-parseInt(e,10)-a,t}return t.match(/^[A-Z]{3}/)?e({},"19"+(n=t).slice(7,9),n.slice(9,11),n.slice(11,13)):((t,n,r)=>{const s={};if(!t.startsWith("9")){const e=1-+t.substr(n,1)%2;s.sex=1===e?o.FEMALE:o.MALE}return e(s,(2==r?"19":"")+t.substr(6,r),t.substr(6+r,2),t.substr(8+r,2))})(t,15==t.length?14:16,15==t.length?2:4);var n}function l(t=""){if(!i(t)||!t)return"date";const e=t.includes("y"),n=t.includes("M"),r=t.includes("d"),s=t.includes("H"),a=t.includes("m"),u=t.includes("s");return e||n||r||!(s||a||u)?s||a||u?"datetime":!e||n||r?!e&&n&&r?"month":"date":"year":"time"}const f=/^\d{6}(((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|x|X))|(\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}))$/,h=/^[1-9]\d{5}\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}$/,g=u(65,91).reduce(((t,e,n)=>(t[String.fromCharCode(e)]=10+n,t)),{}),m=[7,3,1,7,3,1,7,3,1,7,3,1,7,3],p=/^[A-Z]{3}[0-9]{12}$/,M=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2],y=["1","0","X","9","8","7","6","5","4","3","2"];function D(t){try{if(!t||![15,18].includes(t.length))return!1;if(15===t.length){if(!p.test(t))return!1;if(!("19"+t.slice(7,13)))return!1;const e=t.split("");e[0]=g[e[0]],e[1]=g[e[1]],e[2]=g[e[2]];let n=0;for(let t=0;t<14;t++){n+=parseInt(e[t])*m[t]}return n%10===parseInt(e[14])}{t=t.toUpperCase();if(!/^9[0-9]{16}[0-9X]$/.test(t))return!1;if(!t.slice(6,14))return!1;let e=0;for(let n=0;n<17;n++){e+=parseInt(t.slice(n,n+1))*M[n]}return y[e%11]===t.slice(17)}}catch(t){return!1}}function E(t){return f.test(t)&&function(t){if(!t||18!==t.length)return!1;const e=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];let n=0;for(let r=0;r<17;r++)n+=+t[r]*e[r];return t.charAt(17).toUpperCase()===["1","0","X","9","8","7","6","5","4","3","2"][n%11]}(t)||h.test(t)||D(t)}function $(t){return/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(t)}function U(t){const u={},i=new Date,c=new Date(t),o=[["day",e],["month",n],["year",r],["hours",s],["minutes",a]];return Object.defineProperties(u,o.reduce(((t,[e,n])=>(t[e]={get:(()=>{let t=null;return()=>(null===t&&(t=n(i,c)),t)})()},t)),{})),u}function A(e,n,r="yyyy-MM-dd HH:mm"){var s;const a=new Date,u={[c.MINUTE]:()=>i(a,"Minutes",e),[c.HOUR]:()=>i(a,"Hours",e),[c.DAY]:()=>i(a,"Date",e),[c.WEEK]:()=>i(a,"Date",7*e),[c.MONTH]:()=>i(a,"Month",e),[c.YEAR]:()=>i(a,"FullYear",e)};return null==(s=u[n])||s.call(u),t(function(t,e){const n=[{[c.DAY]:"Date",[c.WEEK]:"Date",[c.MONTH]:"Date",[c.YEAR]:"Date"},{[c.HOUR]:"Hours"},{[c.MINUTE]:"Minutes"}],r=n.findIndex((t=>Reflect.has(t,e)));~r&&n.slice(r+1).forEach((e=>{Object.values(e).forEach((e=>{t[`set${e}`]("Date"===e?1:0)}))}));return t.setSeconds(0),t}(a,n),r);function i(t,e,n){t[`set${e}`](t[`get${e}`]()-n)}}function H(t){const e=t.minutes<60?{ageUnit:c.MINUTE,age:t.minutes}:t.hours<24?{ageUnit:c.HOUR,age:t.hours}:t.day<30?{ageUnit:c.DAY,age:t.day}:t.day<365?{ageUnit:c.MONTH,age:t.month}:{ageUnit:c.YEAR,age:t.year};return e.age=Math.max(e.age,1),e}const I=/^(\d{4})-?(\d{2})-?(\d{2})?\s?(\d{2})?:?(\d{2})?:?(\d{2})?$/;function b(t){if(!i(t))return;const e=t.match(I);if(!e)return;const[,n,r,s,a,u,c]=e;return new Date(`${n}-${r}-${s||"01"} ${a||"00"}:${u||"00"}:${c||"00"}`)}export{b as businessDateParser,D as isForeignerID,E as isIdCard,$ as isMobile,A as parseAge2Birthday,H as parseAgeFromContext,U as parseBirthday,d as parseIdCard,l as transformDateFormat};
|
@@ -1 +1 @@
|
|
1
|
-
import{inject as
|
1
|
+
import{inject as e,provide as t,computed as n,createVNode as r,Fragment as o}from"vue";import{traverse as i,arrayed as u}from"../../../../shared/utils/index.js";import{isGeneralField as c}from"@formily/core";import{Path as s}from"@formily/path";import{HelpCircleSharp as f}from"@vicons/ionicons5";import{isObject as l}from"@vue/shared";import{useMemoize as a}from"@vueuse/core";import{isString as p,isFunction as d,omit as E,castArray as T,flattenDeep as h}from"lodash-es";import{NTooltip as m,NIcon as x}from"naive-ui";import{NESTED_FORM_ITEM_TYPE as y}from"../constants/index.js";export{businessDateParser,isForeignerID,isIdCard,isMobile,parseAge2Birthday,parseAgeFromContext,parseBirthday,parseIdCard,transformDateFormat}from"./business.js";function R(e){console.warn(`[FormRender]: ${e}`)}function g(e,t,n=["children","properties","suffixConfig"],r="val_key",o="default_val"){return function e(t,r){r.forEach((r=>{l(r)&&(null!=c(r)&&null==t[i(r)]&&s.setIn(t,i(r),c(r)),n.forEach((n=>{r[n]&&(t[i(r)]||(t[i(r)]={}),e(t[i(r)],u(r[n])))})))}))}(e,t),e;function i(e){return e[r]}function c(e){return e[o]}}function v(n,r){let o=e(n,null);return o||(o=r(),t(n,o)),o}function I(e){return e&&p(e)?+e:e}function A(e,t,n){if(l(e)&&!d(e)){const n={};return Object.entries(e).forEach((([e,r])=>{d(r)&&(n[e]=()=>r(t))})),n}return{default:()=>d(e)?e(t):n?n(e):[e]}}function D(e,t){return n((()=>{const n={};return e.prefix&&(n.prefix=()=>r(o,null,[A(e.prefix,e,t).default()])),e.suffix&&(n.suffix=()=>r(o,null,[A(e.suffix,e,t).default()])),n}))}function P(e,t){return p(e)&&e?e.replace(/\$\{([^}]*)}/g,(function(e,n){const r=n.split("||");for(const e of r){const n=t[e.trim()];if(n)return n}return""})):""}function W(e){return e.reduce(((e,t)=>(p(t.extendKey)&&t.extendKey&&e.push(t),$(t)&&e.push(...W(t.children||[])),e)),[])}function _(e,t){const n=W(e);if(!n.length)return t;const r={},o=new Map;return Object.entries(t).forEach((([e,i])=>{const u=n.find((t=>t.val_key===e));if(!u)return r[e]=i;const{val_key:c,extendKey:s}=u,f=o.get(s)||{};o.set(s,f),f[c]=t[c]})),[...o.entries()].forEach((([e,t])=>{r[e]=JSON.stringify(t)})),r}function G(e,t){const n=W(e);if(!n.length)return t;const r=a((e=>{try{return l(t[e])?t[e]:JSON.parse(t[e])||{}}catch(e){return{}}})),o=E(t,n.map((e=>e.extendKey)));return n.forEach((({val_key:e,extendKey:t})=>{Reflect.has(o,e)||(o[e]=r(t)[e])})),o}function S(e){return e&&y.includes(e)}function $(e){return S(c(e)?e.componentType:e.html_type)}function b(e,t){return r("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[e,t.desc?r(m,null,{trigger:()=>r(x,{component:f},null),default:()=>t.desc}):null])}function j(e,t){return s.parse(e.startsWith(".")?e:`.${e}`,t).toString()}function w(e){return e.replace(/</g,"<").replace(/>/g,">")}function K(e,t){return e.reduce(((e,n)=>(t(n)||(e.push(n),n.properties&&(n.properties=K(n.properties,t)),n.children&&(n.children=K(n.children,t))),e)),[])}function X(e,t){let n=null;return i(e,((e,r)=>{t(e)&&(n=e,r())}),["children","properties"]),n}var k=function(e){return e[e.PREPARE=0]="PREPARE",e[e.TEXT=1]="TEXT",e[e.WIDGET_START=2]="WIDGET_START",e[e.WIDGET=3]="WIDGET",e}(k||{});function C(e){const t=[...e],n=[];let r=k.PREPARE,o="";function i(e){switch(r=e,r){case k.PREPARE:case k.WIDGET_START:case k.WIDGET:o=""}}function u(e="text",t=o){n.push({type:e,content:t})}function c(){const e=n.pop();e&&("text"===e.type?o=e.content:n.push(e))}return t.forEach(((e,n)=>{const s=n===t.length-1;switch(r){case k.PREPARE:return"#"===e?(i(k.WIDGET_START),void(s&&u())):(i(k.TEXT),o=e,void(s&&u()));case k.TEXT:return"#"===e?void(s?(o+=e,u()):(u(),i(k.WIDGET_START))):(o+=e,void(s&&u()));case k.WIDGET_START:return"{"!==e||s?(c(),i(k.TEXT),o+=`#${e}`,void(s&&u())):void i(k.WIDGET);case k.WIDGET:return"}"===e?(u("widget"),void i(k.PREPARE)):"#"===e?(c(),u(),i(k.WIDGET_START),o+=`#${e}`,void(s&&u())):(o+=e,void(s&&u("text",`#{${o}`)))}})),n}function F(e,t){let n=T(e);return t.forEach((({from:e,to:t})=>{n.forEach(((r,o)=>{p(r)&&(n[o]=r.split(e).map(((e,n,r)=>[e,n<r.length-1?t:null])))})),n=h(n)})),n}function O(e){return"Enter"===e.code||"NumpadEnter"===e.code}export{K as FieldListFilter,_ as combineExtendKey,D as createInputSlot,A as createSlot,w as editorUnescape,X as findItemByValCondition,R as formRenderLog,j as getAbsoluteKey,v as injectOrProvide,O as isEnter,$ as isNestedFieldType,S as isNestedType,g as mergeDeepProperties,C as parseEnhanceText,I as parseNumberFromMaybeString,b as renderDescOption,F as replace2Any,G as splitExtendKey,P as validateMessageParser};
|