cnhis-design-vue 3.1.51-beta.0 → 3.1.51-beta.10
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/base-search/index.d.ts +0 -1
- package/es/components/base-search/src/index.vue.d.ts +0 -1
- package/es/components/base-search/src/index.vue2.js +1 -1
- package/es/components/callback/index.d.ts +69 -0
- package/es/components/callback/index.js +1 -0
- package/es/components/callback/src/components/dialog/drawer.vue.d.ts +353 -0
- package/es/components/callback/src/components/dialog/drawer.vue.js +1 -0
- package/es/components/callback/src/components/dialog/drawer.vue2.js +1 -0
- package/es/components/callback/src/components/dialog/modal.vue.d.ts +166 -0
- package/es/components/callback/src/components/dialog/modal.vue.js +1 -0
- package/es/components/callback/src/components/dialog/modal.vue2.js +1 -0
- package/es/components/callback/src/components/popup/index.vue.d.ts +48 -0
- package/es/components/callback/src/components/popup/index.vue.js +1 -0
- package/es/components/callback/src/components/render/drawerIframe/index.vue.d.ts +62 -0
- package/es/components/callback/src/components/render/drawerIframe/index.vue.js +1 -0
- package/es/components/callback/src/components/render/drawerIframe/index.vue2.js +1 -0
- package/es/components/callback/src/components/render/enums.d.ts +5 -0
- package/es/components/callback/src/components/render/enums.js +1 -0
- package/es/components/callback/src/components/render/index.vue.d.ts +57 -0
- package/es/components/callback/src/components/render/index.vue.js +1 -0
- package/es/components/callback/src/components/render/popupMaps.d.ts +5700 -0
- package/es/components/callback/src/components/render/popupMaps.js +1 -0
- package/es/components/callback/src/index.vue.d.ts +68 -0
- package/es/components/callback/src/index.vue.js +1 -0
- package/es/components/callback/src/index.vue2.js +1 -0
- package/es/components/callback/src/types/index.d.ts +11 -0
- package/es/components/callback/style/callback-iconfont.ttf +0 -0
- package/es/components/callback/style/index.css +1 -0
- package/es/components/classification/index.d.ts +57 -15
- package/es/components/classification/src/components/search-filter/index.vue.d.ts +57 -15
- package/es/components/classification/src/components/set-classification/index.vue.d.ts +57 -15
- package/es/components/classification/src/index.vue.d.ts +57 -15
- package/es/components/classification/src/index.vue2.js +1 -1
- package/es/components/expand-field/index.d.ts +0 -13
- package/es/components/expand-field/src/components/FormItemPerson.vue.d.ts +0 -13
- package/es/components/expand-field/src/components/PersonModal.vue.d.ts +0 -13
- package/es/components/expand-field/src/components/PersonModal.vue2.js +1 -1
- package/es/components/expand-field/src/components/form.vue.d.ts +0 -13
- package/es/components/expand-field/src/index.vue.d.ts +0 -13
- package/es/components/expand-field/src/index.vue2.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
- package/es/components/form-render/src/components/renderer/remoteSearch.d.ts +79 -2
- package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
- package/es/components/form-render/src/components/renderer/select.d.ts +10 -1
- package/es/components/form-render/src/components/renderer/select.js +1 -1
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +16 -10
- package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
- package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useSelectOption.d.ts +2 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useSelectOption.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +28 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/separateUtils.d.ts +4 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/separateUtils.js +1 -1
- package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -1
- package/es/components/iho-table/src/types/index.d.ts +7 -1
- package/es/components/index.css +1 -1
- package/es/components/index.d.ts +4 -3
- package/es/components/index.js +1 -1
- package/es/components/scale-view/src/hooks/use-component.d.ts +615 -255
- package/es/components/select-label/index.d.ts +617 -256
- package/es/components/select-label/index.js +1 -1
- package/es/components/{iho-select-label/src/LabelFormContent.vue.d.ts → select-label/src/ihoLabel/IhoLabelFormContent.vue.d.ts} +5 -5
- package/es/components/select-label/src/ihoLabel/IhoLabelFormContent.vue.js +1 -0
- package/es/components/select-label/src/ihoLabel/IhoLabelFormContent.vue2.js +1 -0
- package/es/components/{iho-select-label/src/SelectLabel.vue.d.ts → select-label/src/ihoLabel/IhoSelectLabel.vue.d.ts} +7 -7
- package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue.js +1 -0
- package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue2.js +1 -0
- package/es/components/{iho-select-label/src/components/label-classify.vue.d.ts → select-label/src/ihoLabel/iho-label-classify.vue.d.ts} +1 -1
- package/es/components/select-label/src/ihoLabel/iho-label-classify.vue.js +1 -0
- package/es/components/select-label/src/ihoLabel/iho-label-classify.vue2.js +1 -0
- package/es/components/select-label/src/index.vue.d.ts +899 -0
- package/es/components/select-label/src/index.vue.js +1 -0
- package/es/components/select-label/src/index.vue2.js +1 -0
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +52 -7
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue2.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/InputFilter.vue.d.ts +34 -2
- package/es/components/table-filter/src/components/classify-filter/components/InputFilter.vue2.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +36 -4
- package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.d.ts +1 -6
- 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 +57 -15
- package/es/components/table-filter/src/components/classify-filter/index.vue2.js +1 -1
- package/es/components/table-filter/src/components/render-widget/components/SelectDynamicOption/index.vue2.js +1 -1
- package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
- package/es/components/table-filter/src/hooks/useRenderWidget.js +1 -1
- package/es/components/table-filter/src/tool/transformData.d.ts +1 -6
- package/es/components/table-filter/src/tool/transformData.js +1 -1
- package/es/components/table-filter/src/types/index.d.ts +11 -2
- package/es/shared/directive/flexibleResize.d.ts +4 -0
- package/es/{components/classification/src → shared}/directive/flexibleResize.js +1 -1
- package/es/shared/directive/index.d.ts +1 -0
- package/es/shared/directive/index.js +1 -0
- package/es/shared/package.json.js +1 -1
- package/es/shared/types/business.d.ts +7 -0
- package/es/shared/utils/index.js +1 -1
- package/package.json +2 -2
- package/es/components/classification/src/directive/flexibleResize.d.ts +0 -28
- package/es/components/iho-select-label/index.d.ts +0 -363
- package/es/components/iho-select-label/index.js +0 -1
- package/es/components/iho-select-label/src/LabelFormContent.vue.js +0 -1
- package/es/components/iho-select-label/src/LabelFormContent.vue2.js +0 -1
- package/es/components/iho-select-label/src/SelectLabel.vue.js +0 -1
- package/es/components/iho-select-label/src/SelectLabel.vue2.js +0 -1
- package/es/components/iho-select-label/src/components/label-classify.vue.js +0 -1
- package/es/components/iho-select-label/src/components/label-classify.vue2.js +0 -1
- package/es/components/iho-select-label/style/iho-select-label-iconfont.ttf +0 -0
- package/es/components/iho-select-label/style/index.css +0 -1
- package/es/components/table-filter/src/types/tool.d.ts +0 -7
- /package/es/components/{iho-select-label → callback}/src/types/index.js +0 -0
- /package/es/components/{iho-select-label → select-label}/src/types/index.d.ts +0 -0
- /package/es/components/{table-filter/src/types/tool.js → select-label/src/types/index.js} +0 -0
|
@@ -2,6 +2,11 @@ import { AnyObject, Func } from '../../../../../es/shared/types';
|
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
import { FormWordbook, RecommendIds, UrlConfig } from '../../../../../es/components/form-render';
|
|
4
4
|
import { RecommendItem } from '../../../../../es/components/recommend-search/src/types';
|
|
5
|
+
declare type UseOptionHooks = Partial<Record<'onRequestConfigChange' | 'onDepsChange', (payload: {
|
|
6
|
+
fetchData: (content?: string | null, otherParams?: AnyObject) => any;
|
|
7
|
+
labelKey: string;
|
|
8
|
+
valueKey: string;
|
|
9
|
+
}) => any>>;
|
|
5
10
|
export declare const searchContentMatcher: (searchContent: string, label: string) => RegExpMatchArray | null;
|
|
6
11
|
export declare function useRecommendOptions(props: {
|
|
7
12
|
recommend: boolean;
|
|
@@ -16,15 +21,15 @@ export declare function useRecommendOptions(props: {
|
|
|
16
21
|
getRecommend: (content?: string) => Promise<void>;
|
|
17
22
|
sortedOptions: import("vue").ComputedRef<AnyObject[]>;
|
|
18
23
|
};
|
|
19
|
-
export declare function useUrlConfigOptions(props: {
|
|
20
|
-
labelField
|
|
21
|
-
valueField
|
|
22
|
-
showField
|
|
23
|
-
urlConfig
|
|
24
|
-
options
|
|
24
|
+
export declare function useUrlConfigOptions(props: Partial<{
|
|
25
|
+
labelField: string;
|
|
26
|
+
valueField: string;
|
|
27
|
+
showField: string;
|
|
28
|
+
urlConfig: UrlConfig;
|
|
29
|
+
options: AnyObject[];
|
|
25
30
|
requestCache: boolean;
|
|
26
31
|
lazyRequest: boolean;
|
|
27
|
-
}
|
|
32
|
+
}>, valueRef: Ref, hooks?: UseOptionHooks): {
|
|
28
33
|
labelKey: import("vue").ComputedRef<string>;
|
|
29
34
|
loading: Ref<boolean>;
|
|
30
35
|
showKey: import("vue").ComputedRef<string | undefined>;
|
|
@@ -32,7 +37,7 @@ export declare function useUrlConfigOptions(props: {
|
|
|
32
37
|
remoteOptions: Ref<AnyObject[] | null>;
|
|
33
38
|
filterOptions: import("vue").ComputedRef<AnyObject[]>;
|
|
34
39
|
fullOptions: import("vue").ComputedRef<AnyObject[]>;
|
|
35
|
-
fetchData: (content?: string) => Promise<null | undefined>;
|
|
40
|
+
fetchData: (content?: string | null, otherParams?: AnyObject) => Promise<null | undefined>;
|
|
36
41
|
searchContent: Ref<string | undefined>;
|
|
37
42
|
};
|
|
38
43
|
export declare function useAutographOptions(props: Partial<{
|
|
@@ -44,7 +49,7 @@ export declare function useAutographOptions(props: Partial<{
|
|
|
44
49
|
autograph: string;
|
|
45
50
|
lazyRequest: boolean;
|
|
46
51
|
options: AnyObject[];
|
|
47
|
-
}>, valueRef: Ref): {
|
|
52
|
+
}>, valueRef: Ref, hooks?: UseOptionHooks): {
|
|
48
53
|
labelKey: import("vue").ComputedRef<string>;
|
|
49
54
|
showKey: import("vue").ComputedRef<string | undefined>;
|
|
50
55
|
loading: Ref<boolean>;
|
|
@@ -52,6 +57,7 @@ export declare function useAutographOptions(props: Partial<{
|
|
|
52
57
|
valueKey: import("vue").ComputedRef<string>;
|
|
53
58
|
filterOptions: import("vue").ComputedRef<AnyObject[]>;
|
|
54
59
|
fullOptions: import("vue").ComputedRef<AnyObject[]>;
|
|
55
|
-
fetchData: (content?: string) => Promise<null | undefined>;
|
|
60
|
+
fetchData: (content?: string | null, otherParams?: AnyObject) => Promise<null | undefined>;
|
|
56
61
|
searchContent: Ref<string | undefined>;
|
|
57
62
|
};
|
|
63
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{checkInSetupEnv as e,arrayed as l,jsonParse as n,keywordMatcher as u}from"../../../../shared/utils/index.js";import{useForm as t}from"@formily/vue";import{useMemoize as a}from"@vueuse/core";import{identity as o,uniqBy as r,isEqual as i,isString as v,omit as
|
|
1
|
+
import{checkInSetupEnv as e,arrayed as l,jsonParse as n,keywordMatcher as u}from"../../../../shared/utils/index.js";import{useForm as t}from"@formily/vue";import{useMemoize as a}from"@vueuse/core";import{identity as o,uniqBy as r,isEqual as i,isString as v,omit as s,isArray as c,isFunction as m}from"lodash-es";import{computed as f,inject as d,ref as y,watch as p,toRaw as h}from"vue";import"../../index.js";import{InjectionAsyncQueue as g,InjectionFormLifeCycleCaller as w,InjectionFormItemDepsCollector as K}from"../constants/index.js";import{createUrlConfigParams as C,formRenderLog as b}from"../utils/index.js";import{useFormField as k}from"./useFormField.js";import{useFormRequest as R}from"./useFormRequest.js";function F(e,l){const n=y();return f({get:()=>n.value?n.value:e[l],set(e){n.value=e}})}const q=(()=>{const e=a((e=>new RegExp(`(.*)${e.split("").map((e=>`(${function(e){return e.match(/[()\[\]{}$^\/]/)?"\\"+e:e}(e)})`)).join("(.*)")}(.*)`)),{getKey:o});return(l,n)=>n.match(e(l))})();function O(){const e=y();return{searchContent:e,optionSearchFilter:function(l,n,t){if(!e.value)return l;const a=c(t)?t.filter((e=>e&&v(e))):[];return l.filter((l=>function(l,n,t){if(!e.value)return!0;const a=l?l[n]:"";return!!v(a)&&(!!q(e.value,a)||!!u(e.value,l.keyword)||!!t.length&&t.some((n=>v(l[n])&&l[n].includes(e.value))))}(l,n,a)))}}}function j(e,l,u,t,a){const o=F(e,"commonList"),i=F(e,"recentList"),{searchContent:v,optionSearchFilter:c}=O();function y(e){return n(e.itemObj)}const p=f((()=>{var e,l;return null!=(l=null==(e=o.value)?void 0:e.map(y))?l:[]})),h=f((()=>{var e,l;return null!=(l=null==(e=i.value)?void 0:e.map(y))?l:[]})),w=f((()=>{if(!e.recommend||!p.value.length&&!h.value.length)return l.value;const n=r(p.value.concat(h.value),(e=>e[a.value])),u=l.value.filter((e=>n.every((function(l){return l[a.value]!==e[a.value]}))));return[...c(n,t.value),...u]})),{getRecommendRequestInfo:K,getHttpInstance:C}=R();function b(l){const{url:n,getRecommendIds:u}=K(),t=m(u)?u():{},a=m(e.getRecommendInfo)?e.getRecommendInfo():{};return{url:n[l],info:Object.assign({},t,a)}}const{fieldKey:q,field:j}=k(),I=d(g);return{postRecommend:async function(l){if(!e.recommend)return;const n=C();if(!n)return;const{url:t,info:o}=b("post"),r=w.value.find((e=>e[a.value]===l));r&&u("postRecommend",await n.post(t,{...o,keyword:"",itemId:a.value,itemObj:JSON.stringify(r)}))},getRecommend:async function(l){if(!e.recommend)return;if(v.value=l,o.value&&i.value&&e.recommendCache)return;const n=await I.addAsync(function(l,n){const{url:u,info:o}=b("get");return{url:u,method:"get",key:l,cache:n,params:{...o,recNum:Math.max(e.commonNum,e.recentNum),keyword:""},payload:{field:j.value,labelKey:t.value,valueKey:a.value}}}(q.value,e.recommendCache)),{commonly:u,recently:r}=n.reduce(((e,l)=>("commonly"===l.type?e.commonly.push(s(l,["type"])):"recently"===l.type&&e.recently.push(s(l,["type"])),e)),{commonly:[],recently:[]});o.value=u.slice(0,e.commonNum),i.value=r.slice(0,e.recentNum)},sortedOptions:w}}function I(l,n,u){e();const t=d(g),a=d(w),o=f((()=>{var e,n,u;return null!=(u=null!=(n=null==(e=l.urlConfig)?void 0:e.nameKey)?n:l.labelField)?u:"text"})),r=f((()=>{var e,n,u;return null!=(u=null!=(n=null==(e=l.urlConfig)?void 0:e.valueKey)?n:l.valueField)?u:"value"})),s=f((()=>{var e,n;return null!=(n=null==(e=l.urlConfig)?void 0:e.showKey)?n:l.showField})),{searchContent:c,optionSearchFilter:m}=O(),R=y(null),{field:F,fieldKey:q}=k(),j=y(!1),I=async function(e,n){if(c.value=e||"",!l.urlConfig)return R.value=null;try{j.value=!0;const e={field:F.value,labelKey:o.value,valueKey:r.value},u=await t.addAsync(await C({config:{...l.urlConfig,payload:e,params:{...l.urlConfig.params,...n}},cache:l.requestCache,field:F.value}));h(R.value)!==u&&(R.value=u,a("afterOptionInit",[q.value,R.value,e]))}catch(e){v(e)&&b(e)}finally{j.value=!1}},x=f((()=>R.value?m(R.value,o.value):Array.isArray(l.options)?m(l.options,o.value):[])),D=f((()=>R.value||l.options||[])),A=d(K);return p((()=>l.urlConfig),((e,t)=>{if(i(e,t))return;if(R.value=null,!e)return R.value=null;const a={fetchData:I,labelKey:o.value,valueKey:r.value},{onRequestConfigChange:v,onDepsChange:s}=u||{};A.setDeps(q.value,e.dependKey||[],(async()=>{R.value=null,n.value=null,l.lazyRequest||(s?s(a):I())})),!n.value&&l.lazyRequest||(v?v(a):I())}),{immediate:!0}),{labelKey:o,loading:j,showKey:s,valueKey:r,remoteOptions:R,filterOptions:x,fullOptions:D,fetchData:I,searchContent:c}}function x(n,u,a){e();const o=d(g),r=d(w),s=t(),c=f((()=>{var e;const u=l(null==(e=n.wordbook)?void 0:e.show_key)[0];return v(u)?u:null})),m=f((()=>{var e,l,u,t;const a=null==(l=null==(e=n.wordbook)?void 0:e.render_key)?void 0:l[0];return v(a)?a:null!=(t=null!=(u=c.value)?u:n.labelField)?t:"text"})),C=f((()=>{var e,l,u;return null!=(u=null!=(l=null==(e=n.wordbook)?void 0:e.value_key)?l:n.valueField)?u:"value"})),F=f((()=>{var e;return(null==(e=n.wordbook)?void 0:e.search_key)||[]})),q=f((()=>{var e;return null!=(e=c.value)?e:n.showField})),{searchContent:j,optionSearchFilter:I}=O(),x=y(null),{fieldKey:D,field:A}=k(),{getSearchRequestInfo:S}=R(),N=y(!1),_=async function(e,l){if(j.value=e||"",!n.autograph||!n.wordbook)return x.value=null;try{N.value=!0;const e={field:A.value,labelKey:m.value,valueKey:C.value},u=await o.addAsync(function(e,l,u,t,a){var o,r,i;const v={autograph:l,wordbookId:e.id,wordbookType:e.type,fieldKeys:e.search_key,keyword:"",page:1,...a};if(null==(o=e.queryParams)?void 0:o.length){const l=null!=(i=null==(r=s.value)?void 0:r.getFormState().values)?i:{};e.queryParams.forEach((e=>{v[e]=l[e]}))}return{...S(),params:v,key:u,cache:n.requestCache,payload:t}}(n.wordbook,n.autograph,D.value,e,l));h(x.value)!==u&&(x.value=u,r("afterOptionInit",[D.value,x.value,e]))}catch(e){v(e)&&b(e)}finally{N.value=!1}},z=f((()=>x.value?I(x.value,m.value,F.value):Array.isArray(n.options)?I(n.options,m.value):[])),P=f((()=>x.value||n.options||[])),$=d(K);return p((()=>n.wordbook),((e,l)=>{if(i(e,l))return;if(x.value=null,!e)return x.value=null;const t={fetchData:_,labelKey:m.value,valueKey:C.value},{onRequestConfigChange:o,onDepsChange:r}=a||{};$.setDeps(D.value,e.queryParams||[],(async()=>{x.value=null,r?r(t):_()})),!u.value&&n.lazyRequest||(o?o(t):_())}),{immediate:!0}),{labelKey:m,showKey:q,loading:N,remoteOptions:x,valueKey:C,filterOptions:z,fullOptions:P,fetchData:_,searchContent:j}}export{q as searchContentMatcher,x as useAutographOptions,j as useRecommendOptions,I as useUrlConfigOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{unref as e}from"vue";import{promiseTimeout as t}from"@vueuse/shared";import"../../../index.js";import{useSessionStorage as n}from"@vueuse/core";import{
|
|
1
|
+
import{unref as e}from"vue";import{promiseTimeout as t}from"@vueuse/shared";import"../../../index.js";import{useSessionStorage as n}from"@vueuse/core";import{selectOptionsMap as o}from"../rendererPlugins/editableWidgets/hooks/useSelectOption.js";import{IhoTableUtils as l}from"../../utils/index.js";import{EDITABLE_WIDGET_TYPE as i}from"../../constants/index.js";import{isString as r,trim as u,isEmpty as d,isEqual as a,isFunction as s}from"lodash-es";import{parse as c,isValid as p,compareDesc as f}from"date-fns";import{defineTablePlugin as m}from"../../hooks/useTablePlugin.js";function v(){const v="keyboardEventPlugin",g=n("ihoTableClipData","");return m({name:v,apply(n){function m(t,n,m,v,w){var b,C;if(!(null==(b=null==m?void 0:m.keyboardConfig)?void 0:b.isClip))return;if("paste"===t&&!n.getSelectedCell())return;const{row:y,column:R}=n.getSelectedCell()||n.getEditRecord()||{};if(!y||!R||!E(R,i.SELECT)&&e(g)===y[R.field])return;const x=m.uuid&&E(R,i.SELECT)&&o.get(m.uuid)[R.field],T=y[R.field];if("copy"===t){const e=(null==(C=(x||[]).filter((e=>T.includes(e.value))))?void 0:C.map((e=>e.label)).join(","))||T;g.value=e}else{if(r(e(g))&&(g.value=u(e(g)||"")),!e(g)||!function(e){var t;const n=null==(t=e.editRender)?void 0:t.props;return n&&Object.keys(i).includes(l.getCellType(n))}(R)||y.$__SEPARATE||!function(e,t,n,o){var l,i;const{beforeEditMethod:r}=t.editConfig||{},u={rowIndex:null!=(l=e.getRowIndex(n))?l:0,columnIndex:null!=(i=e.getColumnIndex(o))?i:0};return!r||s(r)&&r({row:n,column:o,...u,$table:e,$grid:void 0})}(n,m,y,R))return;if(E(R,i.DATE)&&function(t,n){var o;const l=null==(o=t.editRender)?void 0:o.props,i=e(g)||"";return!p(new Date(i))||r(l.connectField)&&n[l.connectField]&&(l.isStartDate&&f(new Date(i),new Date(n[l.connectField]))<0||l.isEndDate&&f(new Date(i),new Date(n[l.connectField]))>0)}(R,y))return;if(E(R,i.NUMBER)&&!/^-?\d*\.?\d+$/.test((e(g)||"").toString()))return;if(E(R,i.TIME)&&function(t){var n,o;const l=e(g)||"",i=null==(n=t.editRender)?void 0:n.props,r=c(l,(null==(o=null==i?void 0:i.componentProps)?void 0:o.valueFormat)||"HH:mm",new Date);return!p(r)}(R))return;let t=e(g)||"";if(x&&!d(x)){const e=x.filter((e=>t.split(",").includes(e.label))).map((e=>e.value));if(d(e))return;if(function(e){var t,n;const o=null==(t=e.editRender)?void 0:t.props;return E(e,i.SELECT)&&(null==(n=o.componentProps)?void 0:n.multiple)}(R)){if(a(T,e))return;t=e}else{if(e.includes(T))return;t=e[0]}}y[R.field]=t,v("formChange",{column:R,row:y,oldValue:T,value:t,index:n.getRowIndex(y)}),E(R,i.SEPARATE)&&(null==w||w())}}function E(e,t){var n;const o=null==(n=e.editRender)?void 0:n.props;return o&&l.getCellType(o)===t}n.eventHooks.onCopy.tap(v,(({$table:e},t,{emits:n})=>m("copy",e,t,n))),n.eventHooks.onPaste.tap(v,(({$table:e},t,{emits:n,updateTableDataRef:o})=>m("paste",e,t,n,o))),n.eventHooks.onKeydown.tap(v,(async({$event:e,$table:n},o,{emits:l})=>{await t(0);const{row:i,column:r}=n.getSelectedCell()||n.getEditRecord()||{};if(!i||!r)return;l("keyboard",{$table:n,key:e.key,index:n.getRowIndex(i),value:i[r.field],row:i,column:r})}))}})}export{v as keyboardEventPlugin};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { AnyObject } from '../../../../../../../../es/shared/types';
|
|
2
|
+
import { VxeTableConstructor } from 'vxe-table';
|
|
2
3
|
export declare const selectOptionsMap: Map<string, Record<string, AnyObject[]>>;
|
|
4
|
+
export declare function getSelectOptions(uuid: string, row: AnyObject, field: string, $table: VxeTableConstructor): AnyObject[];
|
package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useSelectOption.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reactive as
|
|
1
|
+
import{reactive as e}from"vue";const n=e(new Map);function t(e,t,i,l){if(!e||!i||!l)return[];const{tableColumn:o}=l.reactData,r=o.find((e=>{var n,t;const l=null==(t=(null==(n=e.editRender)?void 0:n.props).connectField||"")?void 0:t.split(",");return null==l?void 0:l.includes(i)}));return r&&t[r.field]?n.get(e)[`${i}__${r.field}-${t[r.field]}`]:n.get(e)[i]}export{t as getSelectOptions,n as selectOptionsMap};
|
|
@@ -55,6 +55,18 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
55
55
|
menuProps: {
|
|
56
56
|
type: PropType<AnyObject>;
|
|
57
57
|
};
|
|
58
|
+
multiple: {
|
|
59
|
+
type: BooleanConstructor;
|
|
60
|
+
default: boolean;
|
|
61
|
+
};
|
|
62
|
+
deletable: {
|
|
63
|
+
type: BooleanConstructor;
|
|
64
|
+
default: boolean;
|
|
65
|
+
};
|
|
66
|
+
selectAll: {
|
|
67
|
+
type: BooleanConstructor;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
58
70
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
59
71
|
value: {
|
|
60
72
|
type: PropType<string | number | (string | number)[]>;
|
|
@@ -108,15 +120,30 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
108
120
|
menuProps: {
|
|
109
121
|
type: PropType<AnyObject>;
|
|
110
122
|
};
|
|
123
|
+
multiple: {
|
|
124
|
+
type: BooleanConstructor;
|
|
125
|
+
default: boolean;
|
|
126
|
+
};
|
|
127
|
+
deletable: {
|
|
128
|
+
type: BooleanConstructor;
|
|
129
|
+
default: boolean;
|
|
130
|
+
};
|
|
131
|
+
selectAll: {
|
|
132
|
+
type: BooleanConstructor;
|
|
133
|
+
default: boolean;
|
|
134
|
+
};
|
|
111
135
|
}>> & {
|
|
112
136
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
113
137
|
}, {
|
|
114
138
|
options: AnyObject[];
|
|
139
|
+
multiple: boolean;
|
|
115
140
|
labelField: string;
|
|
116
141
|
valueField: string;
|
|
117
142
|
placeholder: string;
|
|
143
|
+
deletable: boolean;
|
|
144
|
+
shouldSave: boolean;
|
|
118
145
|
consistentMenuWidth: boolean;
|
|
119
146
|
allowCreate: boolean;
|
|
120
|
-
|
|
147
|
+
selectAll: boolean;
|
|
121
148
|
}>;
|
|
122
149
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,inject as l,ref as
|
|
1
|
+
import{defineComponent as e,inject as l,ref as t,computed as o,createVNode as n,toRaw as a,Fragment as u,createTextVNode as i}from"vue";import{keywordMatcher as r,arrayed as d}from"../../../../../../../shared/utils/index.js";import{NSelect as s,NTooltip as p,NIcon as c,NTag as v,NButton as f}from"naive-ui";import{HelpCircleSharp as m}from"@vicons/ionicons5";import{InjectionIhoTableUUID as y}from"../../../../constants/index.js";import{getSelectOptions as h,selectOptionsMap as b}from"../hooks/useSelectOption.js";import{useIhoTableFormEvent as F}from"../../../../utils/index.js";import{useDebounceFn as w}from"@vueuse/core";import{isEmpty as g,isFunction as S,isArray as O,isObject as q,omit as x,cloneDeep as C}from"lodash-es";var $=e({name:"EditSelect",props:{value:{type:[Array,String,Number]},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0},options:{type:Array,default:()=>[]},queryOptions:{type:Function},placeholder:{type:String,default:"请选择"},allowCreate:{type:Boolean,default:!1},shouldSave:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},aliasField:{type:String},menuProps:{type:Object},multiple:{type:Boolean,default:!1},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean,default:!0}},emits:["update:value"],setup(e,{emit:$}){const _=l("$xetable"),j=t(null);function k(e){j.value=e}const P=t(!1),{emitFormChangeWithParams:B}=F({...e,$table:_}),W=t("");function A(){return I()}const D=t([]),E=o((()=>{let l=g(D.value)?e.options:D.value;return W.value?(l=l.filter((l=>l[e.labelField]&&l[e.labelField].includes(W.value)||r(W.value,l.keyword))),!e.allowCreate||l.some((l=>l[e.labelField]===W.value))?l:[...l,{[e.labelField]:W.value,[e.valueField]:W.value,created:!0,shouldSave:e.shouldSave}]):l})),M=t(!1),I=w((async function(l=""){W.value=l;try{if(M.value=!0,!S(e.queryOptions)||!g(e.options))return;D.value=await e.queryOptions({keyword:l,row:e.row,column:e.column,rowIndex:e.rowIndex})}catch(l){console.log(`获取${e.column.field}options错误`)}finally{M.value=!1}}),400),U=l(y);function V(l,t){var o,n;const u=e.value;$("update:value",l);const i=h(U,e.row,e.column.field,_);U&&O(i)&&d(t).forEach((e=>{if(!q(e))return;const l=e;l.created&&l.shouldSave&&i.push(x(a(l),["created","shouldSave"]))}));const r=null==(o=e.column.editRender)?void 0:o.props;if(U&&r.connectField){const t=null==(n=r.connectField)?void 0:n.split(","),o=b.get(U);t.forEach((async t=>{var n;const{tableColumn:a}=_.reactData,u=a.find((e=>e.field===t)),i=null==(n=null==u?void 0:u.editRender)?void 0:n.props;if(null==i?void 0:i.queryOptions){const n=l?`${t}__${e.column.field}-${l}`:t;if(o[n])return;const a=await i.queryOptions({row:e.row,column:u,isFullData:!0});o[n]=a}}))}B({oldValue:u,option:C(t)})}function z(e){var l,t;"Tab"===e.key&&j.value&&(null==(t=(l=j.value).handleKeydown)||t.call(l,{...e,key:"Enter",preventDefault:e.preventDefault.bind(e)}))}function K(l){const t=l?E.value.map((l=>l[e.valueField])):[],o=e.value,n=O(o)?o.length:0;t.length!==n&&($("update:value",t),B({oldValue:o,option:l?C(E.value):[]}))}function N({node:e,option:l}){return l.desc?n("div",{class:"iho-table__selectOptionWrapper"},[[e,n(p,null,{trigger:()=>n(c,{component:m},null),default:()=>l.desc})]]):e}function R({option:l,handleClose:t}){var o;const a=null!=(o=e.aliasField&&l[e.aliasField])?o:l[e.labelField];return O(e.value)?e.deletable?n(v,{closable:!0,onClose:e=>{e.stopPropagation(),t()}},{default:()=>a}):`${a} ;`:n(u,null,[a])}function T(){return n(u,null,[n(f,{quaternary:!0,type:"primary",size:"tiny",onClick:()=>K(!0)},{default:()=>[i("全选")]}),n(f,{quaternary:!0,type:"primary",size:"tiny",onClick:()=>K(!1)},{default:()=>[i("清空")]})])}const G=()=>({class:"iho-table__selectOption"}),H=o((()=>{var l,t;return{...e.menuProps,class:`iho-table__selectMenu ${null!=(t=null==(l=e.menuProps)?void 0:l.class)?t:""}`}}));return()=>{const l={};return e.multiple&&e.selectAll&&(l.action=T),n(s,{ref:k,show:P.value,"onUpdate:show":e=>P.value=e,consistentMenuWidth:e.consistentMenuWidth,placeholder:e.placeholder,labelField:e.labelField,valueField:e.valueField,loading:M.value,options:E.value,multiple:e.multiple,value:e.value,remote:!0,onSearch:I,clearable:!0,filterable:!0,nodeProps:G,menuProps:H.value,renderTag:R,renderOption:N,onUpdateShow:A,onUpdateValue:V,onKeydown:z},l)}}});export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{reactive as e,inject as o,createVNode as t,mergeProps as n,onBeforeUnmount as l}from"vue";import{arrayed as i}from"../../../../../../../shared/utils/index.js";import"../../../../../index.js";import{EDITABLE_WIDGET_TYPE as r,InjectionIhoTableUUID as s}from"../../../../constants/index.js";import{useAutoFocus as u}from"../hooks/useAutoFocus.js";import{createIhoTableClearActivedInterceptor as d,getTitle as a,IhoTableRenderHelper as c,IhoTableUtils as p}from"../../../../utils/index.js";import m from"./editSelect.js";import{getDefaultValue as f,getArray as v}from"./selectUtils.js";import{getSelectOptions as E,selectOptionsMap as g}from"../hooks/useSelectOption.js";import{cloneDeep as w,isEqual as b}from"lodash-es";import{defineTablePlugin as h}from"../../../../hooks/useTablePlugin.js";function C(){const C="selectRendererPlugin",x=e(new Map);return h({name:C,vxe(e){e.interceptor.add("event.clearActived",d(r.SELECT,(e=>e.classList.contains("iho-table__selectMenu")))),e.renderer.add(r.SELECT,{renderCell({props:e},{row:n,column:l,$table:r}){var u;const d=o(s),c=E(d,n,l.field,r),p=f(n,e,c),m=i(p).join(","),v=e&&(!0===(g=e.variableHeight)||"1"===g||(null==(u=e.componentProps)?void 0:u.indexedText));var g;return[t("span",{title:a(l,m)},[v?i(p).filter((e=>null!=e)).map(((e,o)=>[o+1,".",e,";",t("br",null,null)])):m])]},renderEdit:c.createRenderEdit((({fieldItem:e,emitFormClick:l,row:i,column:r,$rowIndex:u,$table:d})=>{const a=o(s),c=E(a,i,r.field,d);return[t(m,n({queryOptions:e.queryOptions},e.componentProps,{options:c,column:r,row:i,"row-index":u,value:i[r.field],"onUpdate:value":e=>i[r.field]=e,onClick:l}),null)]}))})},apply(e){async function o(e,o={}){var t,n,l;const i=null==(t=e.editRender)?void 0:t.props;let r=v(i.options)||v(null==(n=i.componentProps)?void 0:n.options)||[];if(i.queryOptions)try{const t={column:e,isFullData:!0,...o};r=await(null==(l=i.queryOptions)?void 0:l.call(i,t))}catch(e){console.log(`获取${i.field}_options错误`)}return r}u(e).bindAutoFocusConfig(C,r.SELECT,".n-base-selection-input"),e.fieldHooks.fieldList.tap(C,((e,{uuid:o})=>(o&&(g.get(o)||g.set(o,{}),x.set(o,w(e))),e))),e.dataHooks.data.tapPromise(C,(async(e,{uuid:t},n)=>{if(!t)return;const l=x.get(t);if(!l||!l.length)return;const i=g.get(t);l.forEach((async t=>{var n;const r=null==(n=t.editRender)?void 0:n.props;if(t.field&&r&&"SELECT"===p.getCellType(r)){if(r.connectField){const n=r.connectField.split(","),s=e[r.columnName];n.forEach((async n=>{const u=null==l?void 0:l.find((e=>e.field===n));if(!u)return;if(!s&&!i[r.columnName])return void(i[r.columnName]=await o(t));const d=`${n}__${r.columnName}-${s}`;i[d]||(i[d]=await o(u,{row:e}))}))}i[t.field]||(i[t.field]=await o(t))}}))})),e.setupHooks.setup.tap(C,(e=>{l((()=>{var o;const t=null==(o=e.value)?void 0:o.uuid;t&&(g.delete(t),x.delete(t))}))})),e.eventHooks.onCellDblclick.tap(C,(({$table:e},o,{emits:t})=>{var n;const{column:l,row:i}=e.reactData.editStore.actived,s=null==(n=l.editRender)?void 0:n.props,{cellDblclickSelectable:u=!1,multiple:d=!1,valueField:a="value"}=s.componentProps||{};if(!u||!l||!function(e){return e&&p.getCellType(e)===r.SELECT}(s))return;const c=o.uuid&&E(o.uuid,i,l.field,e);if(1!==(null==c?void 0:c.length))return;const m=d?[c[0][a]]:c[0][a],f=i[l.field];e.clearEdit(),b(m,f)||(i[l.field]=m,t("formChange",{column:l,row:i,oldValue:f,value:m,index:e.getRowIndex(i),$table:e,option:c[0]}))}))}})}export{C as selectRendererPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function l(l,r,u=[]){const{aliasField:
|
|
1
|
+
function l(l,r,u=[]){const{aliasField:e="",labelField:i="label",valueField:o="value"}=(null==r?void 0:r.componentProps)||{},a=l[r.columnName];return Array.isArray(a)?a.map((l=>t(l))):t(a);function t(l){var r,a,t;const d=null==(r=n(u))?void 0:r.find((n=>n[o]==l));return null!=(t=null!=(a=null==d?void 0:d[e])?a:null==d?void 0:d[i])?t:l}}function n(l){return Array.isArray(l)&&!l.length?null:l}export{n as getArray,l as getDefaultValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reactive as e,inject as t,createVNode as
|
|
1
|
+
import{reactive as e,inject as t,createVNode as a,toRaw as r,h as o,onBeforeUnmount as i}from"vue";import{traverse as n}from"../../../../../../../shared/utils/index.js";import{isArray as u,isFunction as l,isObject as s,range as d,flatten as p}from"lodash-es";import{NInput as c}from"naive-ui";import"../../../../../index.js";import{EDITABLE_WIDGET_TYPE as f,InjectionIhoTableUUID as _,InjectionIhoTableHandler as m}from"../../../../constants/index.js";import{useAutoFocus as v}from"../hooks/useAutoFocus.js";import{createIhoTableClearActivedInterceptor as h,getLowCodeFieldFromField as A,IhoTableRenderHelper as E,getRowHeight as g,getColumnRenderWidth as R,parseMergeField as D}from"../../../../utils/index.js";import w from"./editSeparate.vue.js";import{contentSeparate as T,getLengthDiffArray as b,getColumnInfoMaxLength as P,generateSeparateRowData as k,isSeparateColumn as x}from"./separateUtils.js";import{getSeparateInfo as S,setSeparateInfo as $,deleteSeparateInfo as j}from"../../../../utils/separateMap.js";import{defineTablePlugin as H}from"../../../../hooks/useTablePlugin.js";function M(){const M="separateRendererPlugins",C=e(new Map);return H({name:M,vxe(e){e.interceptor.add("event.clearActived",h(f.SEPARATE,(e=>e.classList.contains("v-binder-follower-content")))),e.interceptor.add("event.clearActived",(({row:e,column:t})=>{if(!e.$__uuid)return!0;const a=A(t);if(!a||!a.separateRowEdit)return!0;const r=S(e.$__uuid,e);if(!r)return!0;const{separateData:o,originalData:i,ihoTableHandler:n}=r,{field:l}=t;if(o["__"+l]&&o["__"+l]!==o[l]&&u(i.$__SEPARATE_DATA)){const e=i.$__SEPARATE_DATA.map((e=>{var t;return null!=(t=e["__"+l])?t:e[l]}));i[l]=u(i[l])?e:e.join(""),null==n||n.updateTableDataRef()}return!0})),e.renderer.add(f.SEPARATE,{renderCell(e,{column:r,row:o}){var i,n;const u=t(_),l=null!=(n=null==(i=S(u,o))?void 0:i.separateData)?n:{},s=A(r),d=(null==s?void 0:s.separateFormatter)?s.separateFormatter(l[r.field]):l[r.field];return a("section",{class:"iho-table__ellipsis",title:d},[d])},renderEdit:E.createRenderEdit((({fieldItem:e,column:i,row:n,emitFormClick:u})=>{var d,p;const f=t(_),v=S(f,n),h=g(),A={};let E=null!=(p=null==(d=e.componentProps)?void 0:d.separateSlot)?p:e.separateSlot;return E&&(E=r(E),A.menu=l(E)?E:s(E)?e=>o(E,e):void 0),e.separateRowEdit?function(){if(!v)return[];if(v.ihoTableHandler=t(m),v.separateData["__"+i.field]=v.separateData["__"+i.field]||v.separateData[i.field],A.menu){const e=A.menu;return a(e,{column:i,col:i,row:n,value:v.separateData["__"+i.field],"onUpdate:value":e=>v.separateData["__"+i.field]=e},null)}return[a(c,{value:v.separateData["__"+i.field],"onUpdate:value":e=>v.separateData["__"+i.field]=e},null)]}():[a(w,{value:n[i.field],"onUpdate:value":e=>n[i.field]=e,"row-index":null==v?void 0:v.index,height:h,column:i,row:n,"display-content":null==(R=null==v?void 0:v.separateData)?void 0:R[i.field],onClick:u},A)];var R}))})},apply(e){function t(e){return(...t)=>{var a;return!(null==(a=t[0].row)?void 0:a.$__SEPARATE)&&(!l(e)||e(...t))}}v(e).bindAutoFocusConfig(M,f.SEPARATE,".iho-table__separateText"),e.fieldHooks.fieldList.tap(M,((e,{uuid:t})=>(t&&C.set(t,e.reduce(((e,t)=>(n(t,(t=>{x(t)&&(e.push(r(t)),t.showOverflow="ellipsis")})),e)),[])),e))),e.dataHooks.data.tapPromise(M,(async(e,t,{insertAfter:a,index:r,$table:o})=>{var i;if(!t.uuid)return;const n=C.get(t.uuid);if(!n||!n.length)return;const l=[];for(const t of n){if(!t.field)continue;const a=await R(t,o),r={field:t.field,column:t,data:T(D(e,t),t,a,null==(i=A(t))?void 0:i.separateDeep)};l.push(r)}l.forEach((({column:e,data:t})=>{const a=A(e);if(!a)return;if(!a.separateDeep||!a.separateBinder)return;const r=(o=a.separateBinder,l.find((e=>e.field===o)));var o;r&&t.forEach(((e,a)=>{const o=r.data[a];if(!o||!u(e))return;const i=u(o)?o.length:1;if(i===e.length)return;const n=b(i,e.length);i>e.length?t[a].push(...n):u(o)?o.push(...n):r.data[a]=d(e.length).map(((e,t)=>0===t?o:""))}))})),l.forEach((e=>{e.data=p(e.data)})),d(P(l)).forEach(((o,i,n)=>{const u=k(l,i),s={index:r,originalData:e,separateData:u,separateIndex:i,separateLength:n.length,isOriginRow:0===i,isLastRow:i===n.length-1};if(0===i)return e.$__SEPARATE_DATA=[u],e.$__uuid=t.uuid,void $(t.uuid,e,s);const d={$__SEPARATE:!0,$__uuid:t.uuid,$__ORIGIN_INDEX:r};$(t.uuid,d,s),e.$__SEPARATE_DATA.push(u),a(d)}))})),e.eventHooks.onResizableChange.tap(M,(async({column:e},t,a)=>{x(e)&&a.updateTableDataRef()})),e.configHooks.editConfig.tap(M,((e={},t)=>{const a=e.beforeEditMethod;return e.beforeEditMethod=(...e)=>{var r;if(!t.uuid)return c();const o=C.get(t.uuid);if(!o||!o.length)return c();const{row:i,column:n}=e[0],u=S(t.uuid,i);if(!u)return c();const s=null==(r=n.editRender)?void 0:r.props;if(!s||s.separateRowEdit)return c();const{isOriginRow:d,isLastRow:p}=u;return("bottom"===s.separatePlacement?p:d)&&c();function c(){return!l(a)||a(...e)}},e})),e.configHooks.checkboxConfig.tap(M,((e={},a)=>(e.checkMethod=t(e.checkMethod),e.visibleMethod=t(e.visibleMethod),e))),e.setupHooks.setup.tap(M,(e=>{i((()=>{e.value.uuid&&(C.delete(e.value.uuid),j(e.value.uuid))}))}))}})}export{M as separateRendererPlugins};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../../../../es/shared/types';
|
|
1
|
+
import { AnyObject, ArrayAble } from '../../../../../../../../es/shared/types';
|
|
2
2
|
import { VxeTableDefines } from 'vxe-table';
|
|
3
3
|
import { IhoTableFieldItem } from '../../../../../../../../es/components/iho-table';
|
|
4
4
|
declare type ParsedRowDataInfo = {
|
|
5
5
|
field: string;
|
|
6
|
-
data: string[];
|
|
6
|
+
data: ArrayAble<string>[];
|
|
7
7
|
};
|
|
8
8
|
export declare function getColumnInfoMaxLength(parsedRowDataInfo: ParsedRowDataInfo[]): number;
|
|
9
9
|
export declare function generateSeparateRowData(parsedRowDataInfo: ParsedRowDataInfo[], index: number): AnyObject;
|
|
10
|
-
export declare function contentSeparate(value: unknown, field: IhoTableFieldItem, width: number): any[];
|
|
10
|
+
export declare function contentSeparate(value: unknown, field: IhoTableFieldItem, width: number, isDeep?: boolean): any[];
|
|
11
11
|
export declare function isSeparateColumn(field: IhoTableFieldItem | VxeTableDefines.ColumnInfo): boolean | "" | undefined;
|
|
12
|
+
export declare function getLengthDiffArray(l1: number, l2: number, defaultValue?: string): string[];
|
|
12
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getStringWidth as
|
|
1
|
+
import{getStringWidth as r}from"../../../../../../../shared/utils/index.js";import{isArray as t,isString as n,isNumber as e}from"lodash-es";import{EDITABLE_WIDGET_TYPE as o}from"../../../../constants/index.js";import{getLowCodeFieldFromField as i}from"../../../../utils/index.js";function a(r){return Math.max(...r.map((r=>r.data.length)),1)}function u(r,t){return r.reduce(((r,n)=>(r[n.field]=n.data[t],r)),{})}function s(o,a,u,d=!1){var f;if(t(o)){if(d){const r=null==(f=i(a))?void 0:f.separateFormatter;return o.map((t=>s(r?r(t):t,a,u)))}return o}if(!n(o)||!e(u))return[o];u-=24;const m=[...o].reduce(((t,n)=>{const e=t[t.length-1];return r(e+n)>u?t.push(n):t[t.length-1]=e+n,t}),[""]);return d?[m]:m}function d(r){var t;return r.field&&(null==(t=r.editRender)?void 0:t.name)===o.SEPARATE}function f(r,t,n=""){const e=Math.abs(r-t);return Array.from({length:e}).map((()=>n))}export{s as contentSeparate,u as generateSeparateRowData,a as getColumnInfoMaxLength,f as getLengthDiffArray,d as isSeparateColumn};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{unref as e,onBeforeUnmount as t,shallowReactive as o,createVNode as l,defineComponent as n,inject as r,ref as a,computed as s,provide as i,watch as u,onMounted as d,h as c}from"vue";import{traverse as p,widthAppend as f}from"../../../../../shared/utils/index.js";import{doAnimation as m}from"../../../../../shared/utils/anime.js";import{useThrottleFn as h}from"@vueuse/core";import{promiseTimeout as g}from"@vueuse/shared";import{last as v,isFunction as x,isNumber as y}from"lodash-es";import"../../../index.js";import{EDITABLE_WIDGET_TYPE as b,InjectionIhoTableUUID as I}from"../../constants/index.js";import{useUUIDMap as T,IhoTableUtils as w}from"../../utils/index.js";import{defineTablePlugin as R}from"../../hooks/useTablePlugin.js";class D{constructor(){this.records={},this.maxRecords=o(new Map)}set(e,t,o){if(this.records[e]||(this.records[e]={}),this.records[e][t]===o)return;this.records[e][t]=o;const l=Math.max(...Object.values(this.records[e]),0);this.maxRecords.get(e)!==l&&this.maxRecords.set(e,l)}getMax(e){return this.maxRecords.get(e)||0}}const{getItemFromUUID:H,removeItemFromUUID:M}=T((()=>new D),!0),{getItemFromUUID:S,removeItemFromUUID:C,setItemFromUUID:U}=T((()=>null)),{getItemFromUUID:$,removeItemFromUUID:k,setItemFromUUID:F}=T((()=>{}));let j={};function E(t,o,{scrollTop:l=0}){var n,r;const{uuid:a,rowConfig:s={}}=o;if(!a)return;const i=H(a),{oSize:u=0,gt:d=100}=null!=(n=$(a))?n:{},{internalData:c,reactData:p}=t,{scrollYStore:f,elemStore:m,afterFullData:h,fullDataRowIdData:g}=c;if(d>h.length)return;const y=null!=(r=s.height)?r:36,b=m["main-body-wrapper"],I=b?e(b):null;let T=I?Math.max(8,Math.ceil(I.clientHeight/y)+2+u):8;const w=[0];let R=0;if(l&&h.find(((e,o)=>{const n=t.getRowSeq(e),r=(v(w)||0)+Math.max(y,i.getMax(n));if(w.push(r),r>l)return R=Math.max(0,o-u),T+=Math.min(R,u),!0})),R>0&&x(o.spanMethod)){const{spanMethod:e}=o,l={rowspan:1,colspan:1};for(;R>0;){if(!t.getColumns().some(((t,o)=>{const{rowspan:n,colspan:r}=e({column:t,columnIndex:o,$columnIndex:o,row:h[R],rowIndex:R,$rowIndex:R,_rowIndex:R,isHidden:!t.visible,fixed:t.fixed,type:t.type,visibleData:h})||l;if(0===n&&0===r)return R--,!0})))break}}const D=`${w[R]}px`,M=`${h.reduce(((e,o)=>{const l=t.getRowSeq(o);return e+Math.max(y,i.getMax(l))}),0)}px`;["main","left","right"].forEach((t=>{const o=m[`${t}-body-table`],n=o?e(o):null;n&&(n.style.marginTop=D,n.scrollTop=l),["header","body","footer"].forEach((o=>{const l=m[`${t}-${o}-ySpace`],n=l?e(l):null;n&&(n.style.height=M)}))}));const S=Math.min(h.length,R+T);if(f.startIndex===R&&f.endIndex===S)return;f.startIndex=R,f.endIndex=S;const C=h.slice(f.startIndex,f.endIndex);C.forEach(((e,o)=>{const l=t.getRowid(e),n=g[l];n&&(n.$index=o)})),p.tableData.length=0,p.tableData.push(...C)}const Y=h(E,300);function q(e){var t,o;return(!0===e.variableHeight||"1"===e.variableHeight)&&(null!=(o=null==(t=e.editRender)?void 0:t.name)?o:w.getCellType(e))!==b.SEPARATE}function L(){const o="variableHeightRendererPlugin";return R({name:o,vxe(e){j=n({props:{payload:{type:Object,required:!0}},setup(t){const o=r(I),n=r("$xetable"),p=a(),m=H(o),h=s((()=>t.payload.row[t.payload.column.field]));function v(){const{row:e,column:o}=t.payload,l=n.getRowSeq(e);if(!m||null==l||!p.value)return;const r=p.value.clientHeight;m.set(l,o.field,r)}i("updateCellHeight",v),u([()=>t.payload.rowIndex,()=>t.payload.column.field,h,()=>t.payload.column.renderWidth],(async()=>{await g(0),v()})),d((()=>{n&&!S(o)&&U(o,n),v()}));const b=s((()=>{var o,l,n,r,a;const s=null!=(l=null==(o=t.payload.column.editRender)?void 0:o.props)?l:{},i=null!=(r=null==(n=s.slots)?void 0:n.default)?r:s.slotFn;if(x(i))return i;const u=null==(a=t.payload.column.editRender)?void 0:a.name;if(u){const o=e.renderer.get(u);if(null==o?void 0:o.renderCell)return()=>o.renderCell(t.payload.column.editRender,t.payload)}return()=>h.value})),T=s((()=>{if(t.payload.column.treeNode)return"";const e=t.payload.column.renderWidth;return y(e)&&e>0?f(e-20-2):""}));return()=>l("div",{ref:p,style:{padding:"7px 0",width:T.value,overflow:"hidden"}},[c(b.value,t.payload)])}})},apply(n){function r(t){const o=S(t.uuid);if(!o)return;t.scrollY={enabled:!1},o.reactData.scrollYLoad=!1;const l=function(t){const o=t.internalData.elemStore["main-body-wrapper"];return o?e(o):null}(o);l&&E(o,t,{scrollTop:l.scrollTop})}function a(e){if(!e.uuid)return;const t=$(e.uuid);t&&(e.scrollY=t),setTimeout((()=>r(e)),300)}function s(e){return l(j,{payload:e},null)}n.dataHooks.dataStart.tap(o,a),n.eventHooks.onFilterChange.tap(o,((e,t)=>a(t))),n.eventHooks.onSortChange.tap(o,((e,t)=>a(t))),n.eventHooks.onToggleTreeExpand.tap(o,((e,t)=>a(t))),n.eventHooks.onResizableChange.tap(o,(async({column:e},t)=>{e.editRender&&e.editRender.props&&q(e.editRender.props)&&a(t)})),n.eventHooks.onScroll.tap(o,h(((e,t)=>{if(e.isX)return;const{uuid:o}=t;if(!o)return;const l=S(o);l&&E(l,t,e)}),100,!0,!0)),n.fieldHooks.field.tap(o,(e=>{if(q(e)){e.slots={...e.slots,default:s};const t=e.className,o="variable-height";e.className=t?function(e){return x(t)?[t(e),o]:[t,o]}:o}return e})),n.fieldHooks.fieldList.tap(o,((t,o,{$table:l})=>(o.uuid&&p(t,((t,n)=>{var a,s
|
|
1
|
+
import{unref as e,onBeforeUnmount as t,shallowReactive as o,createVNode as l,defineComponent as n,inject as r,ref as a,computed as s,provide as i,watch as u,onMounted as d,h as c}from"vue";import{traverse as p,widthAppend as f}from"../../../../../shared/utils/index.js";import{doAnimation as m}from"../../../../../shared/utils/anime.js";import{useThrottleFn as h}from"@vueuse/core";import{promiseTimeout as g}from"@vueuse/shared";import{last as v,isFunction as x,isNumber as y}from"lodash-es";import"../../../index.js";import{EDITABLE_WIDGET_TYPE as b,InjectionIhoTableUUID as I}from"../../constants/index.js";import{useUUIDMap as T,IhoTableUtils as w}from"../../utils/index.js";import{defineTablePlugin as R}from"../../hooks/useTablePlugin.js";class D{constructor(){this.records={},this.maxRecords=o(new Map)}set(e,t,o){if(this.records[e]||(this.records[e]={}),this.records[e][t]===o)return;this.records[e][t]=o;const l=Math.max(...Object.values(this.records[e]),0);this.maxRecords.get(e)!==l&&this.maxRecords.set(e,l)}getMax(e){return this.maxRecords.get(e)||0}}const{getItemFromUUID:H,removeItemFromUUID:M}=T((()=>new D),!0),{getItemFromUUID:S,removeItemFromUUID:C,setItemFromUUID:U}=T((()=>null)),{getItemFromUUID:$,removeItemFromUUID:k,setItemFromUUID:F}=T((()=>{}));let j={};function E(t,o,{scrollTop:l=0}){var n,r;const{uuid:a,rowConfig:s={}}=o;if(!a)return;const i=H(a),{oSize:u=0,gt:d=100}=null!=(n=$(a))?n:{},{internalData:c,reactData:p}=t,{scrollYStore:f,elemStore:m,afterFullData:h,fullDataRowIdData:g}=c;if(d>h.length)return;const y=null!=(r=s.height)?r:36,b=m["main-body-wrapper"],I=b?e(b):null;let T=I?Math.max(8,Math.ceil(I.clientHeight/y)+2+u):8;const w=[0];let R=0;if(l&&h.find(((e,o)=>{const n=t.getRowSeq(e),r=(v(w)||0)+Math.max(y,i.getMax(n));if(w.push(r),r>l)return R=Math.max(0,o-u),T+=Math.min(R,u),!0})),R>0&&x(o.spanMethod)){const{spanMethod:e}=o,l={rowspan:1,colspan:1};for(;R>0;){if(!t.getColumns().some(((t,o)=>{const{rowspan:n,colspan:r}=e({column:t,columnIndex:o,$columnIndex:o,row:h[R],rowIndex:R,$rowIndex:R,_rowIndex:R,isHidden:!t.visible,fixed:t.fixed,type:t.type,visibleData:h})||l;if(0===n&&0===r)return R--,!0})))break}}const D=`${w[R]}px`,M=`${h.reduce(((e,o)=>{const l=t.getRowSeq(o);return e+Math.max(y,i.getMax(l))}),0)}px`;["main","left","right"].forEach((t=>{const o=m[`${t}-body-table`],n=o?e(o):null;n&&(n.style.marginTop=D,n.scrollTop=l),["header","body","footer"].forEach((o=>{const l=m[`${t}-${o}-ySpace`],n=l?e(l):null;n&&(n.style.height=M)}))}));const S=Math.min(h.length,R+T);if(f.startIndex===R&&f.endIndex===S)return;f.startIndex=R,f.endIndex=S;const C=h.slice(f.startIndex,f.endIndex);C.forEach(((e,o)=>{const l=t.getRowid(e),n=g[l];n&&(n.$index=o)})),p.tableData.length=0,p.tableData.push(...C)}const Y=h(E,300);function q(e){var t,o;return(!0===e.variableHeight||"1"===e.variableHeight)&&(null!=(o=null==(t=e.editRender)?void 0:t.name)?o:w.getCellType(e))!==b.SEPARATE}function L(){const o="variableHeightRendererPlugin";return R({name:o,vxe(e){j=n({props:{payload:{type:Object,required:!0}},setup(t){const o=r(I),n=r("$xetable"),p=a(),m=H(o),h=s((()=>t.payload.row[t.payload.column.field]));function v(){const{row:e,column:o}=t.payload,l=n.getRowSeq(e);if(!m||null==l||!p.value)return;const r=p.value.clientHeight;m.set(l,o.field,r)}i("updateCellHeight",v),u([()=>t.payload.rowIndex,()=>t.payload.column.field,h,()=>t.payload.column.renderWidth],(async()=>{await g(0),v()})),d((()=>{n&&!S(o)&&U(o,n),v()}));const b=s((()=>{var o,l,n,r,a;const s=null!=(l=null==(o=t.payload.column.editRender)?void 0:o.props)?l:{},i=null!=(r=null==(n=s.slots)?void 0:n.default)?r:s.slotFn;if(x(i))return i;const u=null==(a=t.payload.column.editRender)?void 0:a.name;if(u){const o=e.renderer.get(u);if(null==o?void 0:o.renderCell)return()=>o.renderCell(t.payload.column.editRender,t.payload)}return()=>h.value})),T=s((()=>{if(t.payload.column.treeNode)return"";const e=t.payload.column.renderWidth;return y(e)&&e>0?f(e-20-2):""}));return()=>l("div",{ref:p,style:{padding:"7px 0",width:T.value,overflow:"hidden"}},[c(b.value,t.payload)])}})},apply(n){function r(t){const o=S(t.uuid);if(!o)return;t.scrollY={enabled:!1},o.reactData.scrollYLoad=!1;const l=function(t){const o=t.internalData.elemStore["main-body-wrapper"];return o?e(o):null}(o);l&&E(o,t,{scrollTop:l.scrollTop})}function a(e){if(!e.uuid)return;const t=$(e.uuid);t&&(e.scrollY=t),setTimeout((()=>r(e)),300)}function s(e){return l(j,{payload:e},null)}n.dataHooks.dataStart.tap(o,a),n.eventHooks.onFilterChange.tap(o,((e,t)=>a(t))),n.eventHooks.onSortChange.tap(o,((e,t)=>a(t))),n.eventHooks.onToggleTreeExpand.tap(o,((e,t)=>a(t))),n.eventHooks.onResizableChange.tap(o,(async({column:e},t)=>{e.editRender&&e.editRender.props&&q(e.editRender.props)&&a(t)})),n.eventHooks.onScroll.tap(o,h(((e,t)=>{if(e.isX)return;const{uuid:o}=t;if(!o)return;const l=S(o);l&&E(l,t,e)}),100,!0,!0)),n.fieldHooks.field.tap(o,(e=>{if(q(e)){e.slots={...e.slots,default:s};const t=e.className,o="variable-height";e.className=t?function(e){return x(t)?[t(e),o]:[t,o]}:o}return e})),n.fieldHooks.fieldList.tap(o,((t,o,{$table:l})=>(o.uuid&&p(t,((t,n)=>{var a,s;if(q(t)){const t=null!=(s=null==(a=o.rowConfig)?void 0:a.height)?s:36,i=H(o.uuid),u=o.cellStyle;if(o.cellStyle=function(e){const o={};if(l.value){const n=Math.max(t,i.getMax(l.value.getRowSeq(e.row)));o.height=`${n}px`}return Object.assign(o,u?x(u)?u(e):u:null)},o.sortableConfig&&o.sortableConfig.enable){const t=o.sortableConfig.onEnd;o.sortableConfig.onEnd=function(l){const n=S(o.uuid);if(n){const{internalData:{elemStore:t}}=n,l=t["main-table-body"];l&&e(l)&&E(n,o,{scrollTop:e(l).scrollTop})}x(t)&&t(l)}}o.scrollY={...o.scrollY,mode:"default"},o.onWheel=function(t){let o=null,l=0,n=!0;return function(r){if(!t.uuid)return;const a=S(t.uuid);if(!a)return;const{internalData:s}=a,{isHover:i}=t.rowConfig||{},{deltaX:u,deltaY:d}=r,{refTableLeftBody:c,refTableRightBody:p,refTableBody:f}=a.getRefMaps(),h=d,g=u,v=h<0,x=e(f),y=x?x.$el:null;if(!y)return;if(v?y.scrollTop<=0:y.scrollTop>=y.scrollHeight-y.clientHeight)return;const b=y.scrollTop+h,I=y.scrollLeft+g;if(b===s.lastScrollTop)return;r.preventDefault(),s.lastScrollTop=b,s.lastScrollLeft=I,s.lastScrollTime=Date.now(),i&&a.clearHoverRow();const T=c.value,w=p.value,R=T?T.$el:null,D=w?w.$el:null,H=Math.min(100,Math.abs(Math.floor(h/2)));n&&(l=y.scrollTop,n=!1),l+=H*(v?-1:1),o&&o(),o=m(y.scrollTop,l,400,(e=>{y.scrollTop=e,R&&(R.scrollTop=e),D&&(D.scrollTop=e)}),"easeOutCubic",(()=>{l=y.scrollTop,n=!0})),Y(a,t,y)}}(o),setTimeout((()=>{F(o.uuid,o.scrollY),r(o)}),300),n()}})),t))),n.setupHooks.setup.tap(o,(e=>{t((()=>{e.value.uuid&&(M(e.value.uuid),C(e.value.uuid),k(e.value.uuid))}))}))}})}export{L as variableHeightRendererPlugin};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyObject, ArrayAble, BindEventSettingItem, FormOperationalConfig, LOW_CODE_VALUE_RELATION, MaybeString, TupleToUnion } from '../../../../../es/shared/types';
|
|
1
|
+
import { AnyObject, ArrayAble, BindEventSettingItem, FormOperationalConfig, Func, LOW_CODE_VALUE_RELATION, MaybeString, TupleToUnion } from '../../../../../es/shared/types';
|
|
2
2
|
import { VxeTableProps, VxeTableDefines, VxeTableInstance, VxeColumnPropTypes, VxeTablePropTypes, VxeTableConstructor } from 'vxe-table';
|
|
3
3
|
import { VxePagerEventProps } from 'vxe-table/types/pager';
|
|
4
4
|
import { VxeTableEventProps, VxeTableListeners, VxeTablePrivateMethods } from 'vxe-table/types/table';
|
|
@@ -122,6 +122,11 @@ export declare type LowCodeTableFieldItem = {
|
|
|
122
122
|
headerSlotFn: NonNullable<IhoTableFieldItem['slots']>['header'];
|
|
123
123
|
editSlotFn: NonNullable<IhoTableFieldItem['slots']>['edit'];
|
|
124
124
|
footerSlotFn: NonNullable<IhoTableFieldItem['slots']>['footer'];
|
|
125
|
+
separateSlot: AnyObject | Func;
|
|
126
|
+
separateFormatter: (row: AnyObject) => any;
|
|
127
|
+
separateDeep: boolean;
|
|
128
|
+
separateBinder: string;
|
|
129
|
+
separateRowEdit: boolean;
|
|
125
130
|
/**
|
|
126
131
|
* 即将被废弃,请使用表格外层的beforeEditMethod属性
|
|
127
132
|
* @deprecated
|
|
@@ -174,4 +179,5 @@ export declare type IhoTableSeparateInfo = {
|
|
|
174
179
|
originalData: AnyObject;
|
|
175
180
|
separateIndex: number;
|
|
176
181
|
separateLength: number;
|
|
182
|
+
ihoTableHandler?: IhoTableHandler;
|
|
177
183
|
};
|