cnhis-design-vue 3.1.46-release.4 → 3.1.46

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.
Files changed (92) hide show
  1. package/es/components/button-print/src/utils/print.js +1 -1
  2. package/es/components/form-config/index.d.ts +67 -16
  3. package/es/components/form-config/src/FormConfig.vue.d.ts +67 -16
  4. package/es/components/form-config/src/FormConfig.vue2.js +1 -1
  5. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +5 -4
  6. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +29 -7
  7. package/es/components/form-config/src/hooks/useDataNormalize.d.ts +1 -1
  8. package/es/components/form-config/src/hooks/useDataNormalize.js +1 -1
  9. package/es/components/form-config/src/types/index.d.ts +1 -1
  10. package/es/components/form-render/index.d.ts +5 -4
  11. package/es/components/form-render/src/FormRender.vue.d.ts +4 -3
  12. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  13. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +5 -4
  14. package/es/components/form-render/src/components/renderer/levelSearchCascader.d.ts +16 -2
  15. package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
  16. package/es/components/form-render/src/components/renderer/radio&checkbox.d.ts +32 -4
  17. package/es/components/form-render/src/components/renderer/remoteSearch.d.ts +3 -0
  18. package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
  19. package/es/components/form-render/src/components/renderer/select.d.ts +16 -2
  20. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  21. package/es/components/form-render/src/hooks/useFormEvent.d.ts +1 -1
  22. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  23. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  24. package/es/components/form-render/src/hooks/useOperationalForm.d.ts +1 -1
  25. package/es/components/form-render/src/hooks/useOperationalForm.js +1 -1
  26. package/es/components/form-render/src/hooks/useWordbookSetting.d.ts +5 -0
  27. package/es/components/form-render/src/hooks/useWordbookSetting.js +1 -0
  28. package/es/components/form-render/src/types/fieldItem.d.ts +8 -1
  29. package/es/components/form-render/src/types/index.d.ts +1 -7
  30. package/es/components/iho-table/index.d.ts +12 -0
  31. package/es/components/iho-table/src/IhoTable.vue.d.ts +12 -0
  32. package/es/components/iho-table/src/plugins/defaultConfigPlugin/index.js +1 -1
  33. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +1 -1
  34. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  35. package/es/components/iho-table/src/plugins/index.js +1 -1
  36. package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
  37. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +1 -1
  38. package/es/components/iho-table/src/plugins/operationalFormPlugin/index.d.ts +1 -0
  39. package/es/components/iho-table/src/plugins/operationalFormPlugin/index.js +1 -0
  40. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  41. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -1
  42. package/es/components/iho-table/src/types/index.d.ts +5 -3
  43. package/es/components/iho-table/src/utils/index.d.ts +1 -1
  44. package/es/components/iho-table/src/utils/index.js +1 -1
  45. package/es/components/index.css +1 -1
  46. package/es/components/info-header/index.d.ts +14 -12
  47. package/es/components/info-header/src/InfoHeader.vue.d.ts +14 -12
  48. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +5 -4
  49. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +5 -4
  50. package/es/components/search-cascader/src/SearchCascader.vue2.js +1 -1
  51. package/es/components/search-cascader/src/components/SearchMenu.js +1 -1
  52. package/es/components/select-person/index.d.ts +153 -14
  53. package/es/components/select-person/src/SearchMultiple.vue2.js +1 -1
  54. package/es/components/select-person/src/SearchOrgAndStaff.vue.d.ts +106 -0
  55. package/es/components/select-person/src/SearchOrgAndStaff.vue.js +1 -0
  56. package/es/components/select-person/src/SearchOrgAndStaff.vue2.js +1 -0
  57. package/es/components/select-person/src/SelectPerson.vue.d.ts +150 -12
  58. package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
  59. package/es/components/select-person/src/types/enums.d.ts +4 -0
  60. package/es/components/select-person/src/types/enums.js +1 -0
  61. package/es/components/select-person/src/utils/index.d.ts +1 -1
  62. package/es/components/select-person/src/utils/index.js +1 -1
  63. package/es/components/select-person/style/index.css +1 -1
  64. package/es/components/shortcut-setter/index.d.ts +13 -5
  65. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +13 -5
  66. package/es/components/steps-wheel/index.d.ts +16 -0
  67. package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +16 -0
  68. package/es/components/steps-wheel/src/StepsWheel.vue2.js +1 -1
  69. package/es/components/steps-wheel/style/index.css +1 -1
  70. package/es/components/table-export-field/src/components/ExportModal.vue2.js +1 -1
  71. package/es/shared/package.json.js +1 -1
  72. package/es/shared/types/business.d.ts +6 -0
  73. package/es/shared/utils/business.d.ts +6 -1
  74. package/es/shared/utils/business.js +1 -1
  75. package/es/shared/utils/index.js +1 -1
  76. package/es/shared/utils/tapableLess.d.ts +28 -0
  77. package/es/shared/utils/tapableLess.js +1 -0
  78. package/package.json +2 -2
  79. package/es/components/form-render/src/components/renderer/dist/levelSearchCascader.d.ts +0 -77
  80. package/es/components/form-render/src/components/renderer/dist/searchCascade.d.ts +0 -93
  81. package/es/components/iho-table/src/plugins/dist/highLightSetPlugin.d.ts +0 -3
  82. package/es/components/iho-table/src/plugins/filterRenderPlugin/dist/index.d.ts +0 -3
  83. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/dist/index.d.ts +0 -3
  84. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/dist/defaultRendererPlugin.d.ts +0 -3
  85. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/dist/seqRendererPlugin.d.ts +0 -3
  86. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/dist/index.d.ts +0 -3
  87. package/es/components/iho-table/src/utils/dist/index.d.ts +0 -44
  88. package/es/components/scale-view/src/components/formitem/dist/r-address.d.ts +0 -36
  89. package/es/components/scale-view/src/components/formitem/dist/r-sign.d.ts +0 -36
  90. package/es/components/scale-view/src/components/formitem/dist/standard-modal.d.ts +0 -82
  91. package/es/components/search-cascader/src/components/dist/SearchMenu.d.ts +0 -57
  92. package/es/components/search-cascader/src/components/dist/SearchMenu1.d.ts +0 -57
@@ -89,15 +89,22 @@ declare const _default: import("vue").DefineComponent<{
89
89
  name?: string | undefined;
90
90
  render_key?: string[] | undefined;
91
91
  search_key?: string[] | undefined;
92
+ value_key?: string | undefined;
93
+ queryParams?: string[] | undefined;
92
94
  primary_key?: string | undefined;
93
95
  type?: string | undefined;
94
- value_key?: string | undefined;
95
96
  level_key?: string | undefined;
96
97
  link_key?: string | undefined;
97
98
  link_key_split?: string | undefined;
98
99
  show_key?: string[] | undefined;
99
100
  conObj?: import("../../../../../es/shared/types").AnyObject[] | undefined;
100
101
  conObjFirstLevel?: import("../../../../../es/shared/types").AnyObject[] | undefined;
102
+ setting?: {
103
+ cascading?: {
104
+ 'form.name': string;
105
+ value: string;
106
+ }[] | undefined;
107
+ } | undefined;
101
108
  } | undefined;
102
109
  open?: {
103
110
  value?: any;
@@ -1813,15 +1820,22 @@ declare const _default: import("vue").DefineComponent<{
1813
1820
  name?: string | undefined;
1814
1821
  render_key?: string[] | undefined;
1815
1822
  search_key?: string[] | undefined;
1823
+ value_key?: string | undefined;
1824
+ queryParams?: string[] | undefined;
1816
1825
  primary_key?: string | undefined;
1817
1826
  type?: string | undefined;
1818
- value_key?: string | undefined;
1819
1827
  level_key?: string | undefined;
1820
1828
  link_key?: string | undefined;
1821
1829
  link_key_split?: string | undefined;
1822
1830
  show_key?: string[] | undefined;
1823
1831
  conObj?: import("../../../../../es/shared/types").AnyObject[] | undefined;
1824
1832
  conObjFirstLevel?: import("../../../../../es/shared/types").AnyObject[] | undefined;
1833
+ setting?: {
1834
+ cascading?: {
1835
+ 'form.name': string;
1836
+ value: string;
1837
+ }[] | undefined;
1838
+ } | undefined;
1825
1839
  } | undefined;
1826
1840
  open?: {
1827
1841
  value?: any;
@@ -3510,15 +3524,22 @@ declare const _default: import("vue").DefineComponent<{
3510
3524
  name?: string | undefined;
3511
3525
  render_key?: string[] | undefined;
3512
3526
  search_key?: string[] | undefined;
3527
+ value_key?: string | undefined;
3528
+ queryParams?: string[] | undefined;
3513
3529
  primary_key?: string | undefined;
3514
3530
  type?: string | undefined;
3515
- value_key?: string | undefined;
3516
3531
  level_key?: string | undefined;
3517
3532
  link_key?: string | undefined;
3518
3533
  link_key_split?: string | undefined;
3519
3534
  show_key?: string[] | undefined;
3520
3535
  conObj?: import("../../../../../es/shared/types").AnyObject[] | undefined;
3521
3536
  conObjFirstLevel?: import("../../../../../es/shared/types").AnyObject[] | undefined;
3537
+ setting?: {
3538
+ cascading?: {
3539
+ 'form.name': string;
3540
+ value: string;
3541
+ }[] | undefined;
3542
+ } | undefined;
3522
3543
  } | undefined;
3523
3544
  open?: {
3524
3545
  value?: any;
@@ -5278,7 +5299,7 @@ declare const _default: import("vue").DefineComponent<{
5278
5299
  type: PropType<import("../../../../../es/components/form-render").FormLowCodeReactions.Config[]>;
5279
5300
  };
5280
5301
  operationalForm: {
5281
- type: PropType<import("../../../../../es/components/form-render").FormOperationalConfig[]>;
5302
+ type: PropType<import("../../../../../es/shared/types").FormOperationalConfig[]>;
5282
5303
  };
5283
5304
  linebarAutoHidden: {
5284
5305
  type: BooleanConstructor;
@@ -5418,7 +5439,7 @@ declare const _default: import("vue").DefineComponent<{
5418
5439
  type: PropType<import("../../../../../es/components/form-render").FormLowCodeReactions.Config[]>;
5419
5440
  };
5420
5441
  operationalForm: {
5421
- type: PropType<import("../../../../../es/components/form-render").FormOperationalConfig[]>;
5442
+ type: PropType<import("../../../../../es/shared/types").FormOperationalConfig[]>;
5422
5443
  };
5423
5444
  linebarAutoHidden: {
5424
5445
  type: BooleanConstructor;
@@ -5479,6 +5500,7 @@ declare const _default: import("vue").DefineComponent<{
5479
5500
  triggerAllReactionsHandler: () => void;
5480
5501
  operationalFormHandler: (field: string) => void;
5481
5502
  triggerAllOperationalFormHandler: () => void;
5503
+ wordbookSettingHandler: (fieldKey: string, value: unknown) => void;
5482
5504
  schemaAdaptor: (fieldList: FieldItem[]) => Record<string, import("@formily/json-schema").Stringify<{
5483
5505
  [key: symbol]: any;
5484
5506
  [key: `x-${string}`]: any;
@@ -5594,7 +5616,7 @@ declare const _default: import("vue").DefineComponent<{
5594
5616
  "x-read-pretty"?: boolean | undefined;
5595
5617
  "x-compile-omitted"?: string[] | undefined;
5596
5618
  }>>;
5597
- onKeydown: (event: KeyboardEvent) => void;
5619
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
5598
5620
  clearSpan: (uuid: string) => void;
5599
5621
  exposeEvent: {
5600
5622
  validate(path?: string): Promise<void>;
@@ -5886,7 +5908,7 @@ declare const _default: import("vue").DefineComponent<{
5886
5908
  type: PropType<import("../../../../../es/components/form-render").FormLowCodeReactions.Config[]>;
5887
5909
  };
5888
5910
  operationalForm: {
5889
- type: PropType<import("../../../../../es/components/form-render").FormOperationalConfig[]>;
5911
+ type: PropType<import("../../../../../es/shared/types").FormOperationalConfig[]>;
5890
5912
  };
5891
5913
  linebarAutoHidden: {
5892
5914
  type: BooleanConstructor;
@@ -3,5 +3,5 @@ export declare function useDataNormalize(props: {
3
3
  fieldVisitor?: FormConfigVisitor;
4
4
  }): {
5
5
  transform: (fieldList: FormConfigItem[]) => FormConfigItem[];
6
- inverseTransform: (fieldList: FormConfigItem[]) => FormConfigItem[];
6
+ inverseTransform: (fieldList: FormConfigItem[], withOriginalSetting: boolean) => FormConfigItem[];
7
7
  };
@@ -1 +1 @@
1
- import{isObject as e,omit as n}from"lodash-es";function r(r){return{transform:function(n){let i=null;const t=r.fieldVisitor;return n.reduce(((n,r)=>(r.originalSetting&&e(t)&&t[r.key]&&t[r.key]({field:r.originalSetting,replace(e){r.originalSetting=e}}),"LINE_BAR"===r.type?(r.children=[],i=r.children,n.push(r),n):i?(i.push(r),n):(n.push(r),n))),[])},inverseTransform:function(e){return e.reduce(((e,r)=>("LINE_BAR"===r.type?(e.push(n(r,["children"])),e.push(...r.children||[])):e.push(r),e)),[]).map((e=>n(e,["originalSetting"])))}}}export{r as useDataNormalize};
1
+ import{isObject as e,omit as n}from"lodash-es";function r(r){return{transform:function(n){let i=null;const t=r.fieldVisitor;return n.reduce(((n,r)=>(r.originalSetting&&e(t)&&t[r.key]&&t[r.key]({field:r.originalSetting,replace(e){r.originalSetting=e}}),"LINE_BAR"===r.type?(r.children=[],i=r.children,n.push(r),n):i?(i.push(r),n):(n.push(r),n))),[])},inverseTransform:function(e,r){return e.reduce(((e,r)=>("LINE_BAR"===r.type?(e.push(n(r,["children"])),e.push(...r.children||[])):e.push(r),e)),[]).map((e=>r?e:n(e,["originalSetting"])))}}}export{r as useDataNormalize};
@@ -38,7 +38,7 @@ export interface FormConfigTextFormatter {
38
38
  export interface FormConfigExpose {
39
39
  loadData(payload: Record<'fieldList', FormConfigItem[]>): void;
40
40
  validate(): Promise<unknown>;
41
- getData(): Record<'fieldList' | 'materialList', FormConfigItem[]>;
41
+ getData(withOriginalSetting?: boolean): Record<'fieldList' | 'materialList', FormConfigItem[]>;
42
42
  clearExtraList(): void;
43
43
  }
44
44
  interface FieldVisitorContext {
@@ -134,7 +134,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
134
134
  type: import("vue").PropType<import("./src/types").FormLowCodeReactions.Config[]>;
135
135
  };
136
136
  operationalForm: {
137
- type: import("vue").PropType<import("./src/types").FormOperationalConfig[]>;
137
+ type: import("vue").PropType<import("../../../es/shared/types").FormOperationalConfig[]>;
138
138
  };
139
139
  linebarAutoHidden: {
140
140
  type: BooleanConstructor;
@@ -274,7 +274,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
274
274
  type: import("vue").PropType<import("./src/types").FormLowCodeReactions.Config[]>;
275
275
  };
276
276
  operationalForm: {
277
- type: import("vue").PropType<import("./src/types").FormOperationalConfig[]>;
277
+ type: import("vue").PropType<import("../../../es/shared/types").FormOperationalConfig[]>;
278
278
  };
279
279
  linebarAutoHidden: {
280
280
  type: BooleanConstructor;
@@ -335,6 +335,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
335
335
  triggerAllReactionsHandler: () => void;
336
336
  operationalFormHandler: (field: string) => void;
337
337
  triggerAllOperationalFormHandler: () => void;
338
+ wordbookSettingHandler: (fieldKey: string, value: unknown) => void;
338
339
  schemaAdaptor: (fieldList: import("./src/types").FieldItem[]) => Record<string, import("@formily/json-schema").Stringify<{
339
340
  [key: symbol]: any;
340
341
  [key: `x-${string}`]: any;
@@ -450,7 +451,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
450
451
  "x-read-pretty"?: boolean | undefined;
451
452
  "x-compile-omitted"?: string[] | undefined;
452
453
  }>>;
453
- onKeydown: (event: KeyboardEvent) => void;
454
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
454
455
  clearSpan: (uuid: string) => void;
455
456
  exposeEvent: {
456
457
  validate(path?: string): Promise<void>;
@@ -742,7 +743,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
742
743
  type: import("vue").PropType<import("./src/types").FormLowCodeReactions.Config[]>;
743
744
  };
744
745
  operationalForm: {
745
- type: import("vue").PropType<import("./src/types").FormOperationalConfig[]>;
746
+ type: import("vue").PropType<import("../../../es/shared/types").FormOperationalConfig[]>;
746
747
  };
747
748
  linebarAutoHidden: {
748
749
  type: BooleanConstructor;
@@ -1,7 +1,7 @@
1
- import { AnyObject } from '../../../../es/shared/types';
1
+ import { AnyObject, FormOperationalConfig } from '../../../../es/shared/types';
2
2
  import { Component, FunctionalComponent, PropType } from 'vue';
3
3
  import { RequestInstance } from './hooks';
4
- import { FieldItem, FieldVisitor, FormBusinessFormatter, FormLowCodeReactions, FormOperationalConfig } from './types';
4
+ import { FieldItem, FieldVisitor, FormBusinessFormatter, FormLowCodeReactions } from './types';
5
5
  declare const _default: import("vue").DefineComponent<{
6
6
  fieldList: {
7
7
  type: PropType<FieldItem[]>;
@@ -329,6 +329,7 @@ declare const _default: import("vue").DefineComponent<{
329
329
  triggerAllReactionsHandler: () => void;
330
330
  operationalFormHandler: (field: string) => void;
331
331
  triggerAllOperationalFormHandler: () => void;
332
+ wordbookSettingHandler: (fieldKey: string, value: unknown) => void;
332
333
  schemaAdaptor: (fieldList: FieldItem[]) => Record<string, import("@formily/vue").Stringify<{
333
334
  [key: symbol]: any;
334
335
  [key: `x-${string}`]: any;
@@ -444,7 +445,7 @@ declare const _default: import("vue").DefineComponent<{
444
445
  "x-read-pretty"?: boolean | undefined;
445
446
  "x-compile-omitted"?: string[] | undefined;
446
447
  }>>;
447
- onKeydown: (event: KeyboardEvent) => void;
448
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
448
449
  clearSpan: (uuid: string) => void;
449
450
  exposeEvent: {
450
451
  validate(path?: string): Promise<void>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,nextTick as i,openBlock as l,createBlock as n,unref as m,normalizeClass as d,normalizeStyle as p,withCtx as u,createElementBlock as c,createVNode as f,isRef as h,Fragment as y,renderList as j,createCommentVNode as g,createElementVNode as b,withKeys as k,withModifiers as v,toDisplayString as F,renderSlot as C}from"vue";import{useTheme as H}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as S,cloneDeep as x}from"lodash-es";import{createForm as A,onFieldValueChange as L,onFieldMount as O,onFieldUnmount as R,onFieldReact as w,onFormMount as B}from"@formily/core";import{FormProvider as _,FormConsumer as V}from"@formily/vue";import{NForm as D,NTabs as I,NTabPane as N,NConfigProvider as q}from"naive-ui";import{InjectionFormLifeCycleCaller as T,InjectionFormGraph as U}from"./constants/index.js";import{useAutoHidden as W}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as E}from"./hooks/useComplexOptions.js";import{useFormDomEvent as G,useFormExposeEvent as K}from"./hooks/useFormEvent.js";import{useFormGraph as M}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as P}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeEvent as J}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as $}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as z}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as Q}from"./hooks/useOperationalForm.js";import"./utils/index.js";import{useFieldListAdaptor as X}from"./hooks/useFieldListAdaptor.js";import"../../../shared/utils/index.js";import"../index.js";import{useFieldVisitor as Y}from"./hooks/useFieldVisitor.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{validateMessageLocale as Z}from"./hooks/useFormValidator.js";import{useAnchor as ee}from"./hooks/useAnchor.js";import{useFormContext as oe}from"./hooks/useFormContext.js";import"./hooks/useFormRenderOptions.js";import{createObjSchema as te}from"./utils/schema.js";const re={key:0,style:{height:"54px"}},se={style:{"white-space":"pre"}};var ae=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:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},operationalForm:{type:Object},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},uniqueCacheData:{type:Boolean,default:!1}},emits:["formChange","annotationChange","scroll"],setup(e,{expose:ae,emit:ie}){const le=e,ne=H(),{nuiThemeOverrides:me}=z();Z();const de=o(),pe=t((()=>S(le.maxHeight)?le.maxHeight+"px":le.maxHeight)),{SchemaField:ue,businessCollector:ce,formItemDepsCollector:fe,changeContextCollector:he,formUUID:ye}=oe(le,ie),{anchorBarRef:je,currentAnchor:ge,updateAnchorList:be,anchorIdList:ke,onScroll:ve}=ee(le,ie,de,fe),{callLifeCycle:Fe}=P(le);r(T,Fe),Fe("onSetup");const{trigger:Ce}=W(),{observeFormGraph:He,setGraph:Se,removeGraph:xe}=M();r(U,He);const{lowCodeEventTrigger:Ae}=J(),Le=A({initialValues:le.initialData,effects(e){L("*",(o=>{const t=o.props.name.toString();ce.trigger(e,t),fe.trigger(t),ie("formChange",{fieldInstance:o,fieldKey:t,fieldName:o.title,value:o.value,context:he.getContext(t,o.value)}),Ae(o),Oe(t,o.value),we(t)})),O("*",Se),R("*",xe),le.linebarAutoHidden&&(w("*",Ce),B((e=>e.query("*").forEach(Ce)))),le.anchor&&w("*",be)}}),{lowCodeReactionsHandler:Oe,triggerAllReactionsHandler:Re}=$(t((()=>le.lowCodeReactions)),Le),{operationalFormHandler:we,triggerAllOperationalFormHandler:Be}=Q(t((()=>le.operationalForm)),Le);s(Re),s(Be);const{schemaAdaptor:_e}=X(ce);let Ve=le.fieldList||[];const De=t((()=>le.schema?le.schema:le.fieldList?(Ve=Y().traverse(x(le.fieldList),le.fieldVisitor),te(_e(Ve))):te({}))),{onKeydown:Ie}=G({formModel:Le,formRenderRef:de,props:le}),{clearSpan:Ne}=E();a((()=>Ne(ye)));const qe=K({formModel:Le,formRenderRef:de,formItemDepsCollector:fe,getFieldList:()=>Ve,formUUID:ye});return ae({formModel:Le,validate:(e="*")=>qe.validate(e),getFormValues:(e=!0)=>qe.getFormValues(e),async setFormValues(e,o=!0,t=!1,r=!0){t&&(ce.triggerLock=!0),qe.setFormValues(e,o,r),await i(),ce.triggerLock=!1},setFieldState(e,o){qe.setFieldState(e,o)},resetFields(e="*"){qe.resetFields(e)},queryWidget:async e=>qe.queryWidget(e),getFieldList:()=>Ve,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(l(),n(m(D),{class:d(["form-render",{"form-render--no-border":!e.bordered,"form-render--underline":"underline"===e.bordered}]),"require-mark-placement":"left",style:p(m(ne))},{default:u((()=>[e.anchor?(l(),c("section",re,[f(m(I),{value:m(ge),"onUpdate:value":t[0]||(t[0]=e=>h(ge)?ge.value=e:null),type:"line",ref_key:"anchorBarRef",ref:je},{default:u((()=>[(l(!0),c(y,null,j(m(ke),(e=>(l(),n(m(N),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):g("v-if",!0),f(m(q),{"theme-overrides":m(me)},{default:u((()=>[b("section",{class:"form-render__wrapper",style:p({"--column":e.column,"--form-height":m(pe)}),ref_key:"formRenderRef",ref:de,onScroll:t[1]||(t[1]=(...e)=>m(ve)&&m(ve)(...e)),onKeydownCapture:t[2]||(t[2]=k(v(((...e)=>m(Ie)&&m(Ie)(...e)),["prevent"]),["enter"]))},[f(m(_),{form:m(Le)},{default:u((()=>[f(m(ue),{schema:m(De)},null,8,["schema"]),e.consumer?(l(),n(m(V),{key:0},{default:u((({form:e})=>[b("div",se,F(JSON.stringify(e.values,null,2)),1)])),_:1})):g("v-if",!0),C(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},8,["class","style"]))}});export{ae as default};
1
+ import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,nextTick as i,openBlock as l,createBlock as n,unref as m,normalizeClass as d,normalizeStyle as p,withCtx as u,createElementBlock as c,createVNode as f,isRef as h,Fragment as y,renderList as g,createCommentVNode as j,createElementVNode as b,withKeys as k,withModifiers as v,toDisplayString as F,renderSlot as C}from"vue";import{useTheme as H}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as S,cloneDeep as x}from"lodash-es";import{createForm as A,onFieldValueChange as L,onFieldMount as O,onFieldUnmount as R,onFieldReact as w,onFormMount as B}from"@formily/core";import{FormProvider as _,FormConsumer as V}from"@formily/vue";import{NForm as D,NTabs as I,NTabPane as N,NConfigProvider as q}from"naive-ui";import{InjectionFormLifeCycleCaller as W,InjectionFormGraph as T}from"./constants/index.js";import{useAutoHidden as U}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as E}from"./hooks/useComplexOptions.js";import{useFormDomEvent as G,useFormExposeEvent as K}from"./hooks/useFormEvent.js";import{useFormGraph as M}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as P}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeEvent as J}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as $}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as z}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as Q}from"./hooks/useOperationalForm.js";import{useWordbookSetting as X}from"./hooks/useWordbookSetting.js";import"./utils/index.js";import{useFieldListAdaptor as Y}from"./hooks/useFieldListAdaptor.js";import"../../../shared/utils/index.js";import"../index.js";import{useFieldVisitor as Z}from"./hooks/useFieldVisitor.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{validateMessageLocale as ee}from"./hooks/useFormValidator.js";import{useAnchor as oe}from"./hooks/useAnchor.js";import{useFormContext as te}from"./hooks/useFormContext.js";import"./hooks/useFormRenderOptions.js";import{createObjSchema as re}from"./utils/schema.js";const se={key:0,style:{height:"54px"}},ae={style:{"white-space":"pre"}};var ie=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:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},operationalForm:{type:Object},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},uniqueCacheData:{type:Boolean,default:!1}},emits:["formChange","annotationChange","scroll"],setup(e,{expose:ie,emit:le}){const ne=e,me=H(),{nuiThemeOverrides:de}=z();ee();const pe=o(),ue=t((()=>S(ne.maxHeight)?ne.maxHeight+"px":ne.maxHeight)),{SchemaField:ce,businessCollector:fe,formItemDepsCollector:he,changeContextCollector:ye,formUUID:ge}=te(ne,le),{anchorBarRef:je,currentAnchor:be,updateAnchorList:ke,anchorIdList:ve,onScroll:Fe}=oe(ne,le,pe,he),{callLifeCycle:Ce}=P(ne);r(W,Ce),Ce("onSetup");const{trigger:He}=U(),{observeFormGraph:Se,setGraph:xe,removeGraph:Ae}=M();r(T,Se);const{lowCodeEventTrigger:Le}=J(),Oe=A({initialValues:ne.initialData,effects(e){L("*",(o=>{const t=o.props.name.toString();fe.trigger(e,t),he.trigger(t),le("formChange",{fieldInstance:o,fieldKey:t,fieldName:o.title,value:o.value,context:ye.getContext(t,o.value)}),Le(o),Re(t,o.value),Be(t),Ve(t,o.value)})),O("*",xe),R("*",Ae),ne.linebarAutoHidden&&(w("*",He),B((e=>e.query("*").forEach(He)))),ne.anchor&&w("*",ke)}}),{lowCodeReactionsHandler:Re,triggerAllReactionsHandler:we}=$(t((()=>ne.lowCodeReactions)),Oe),{operationalFormHandler:Be,triggerAllOperationalFormHandler:_e}=Q(t((()=>ne.operationalForm)),Oe),{wordbookSettingHandler:Ve}=X(Oe,ye);s(we),s(_e);const{schemaAdaptor:De}=Y(fe);let Ie=ne.fieldList||[];const Ne=t((()=>ne.schema?ne.schema:ne.fieldList?(Ie=Z().traverse(x(ne.fieldList),ne.fieldVisitor),re(De(Ie))):re({}))),{onKeydown:qe}=G({formModel:Oe,formRenderRef:pe,props:ne}),{clearSpan:We}=E();a((()=>We(ge)));const Te=K({formModel:Oe,formRenderRef:pe,formItemDepsCollector:he,getFieldList:()=>Ie,formUUID:ge});return ie({formModel:Oe,validate:(e="*")=>Te.validate(e),getFormValues:(e=!0)=>Te.getFormValues(e),async setFormValues(e,o=!0,t=!1,r=!0){t&&(fe.triggerLock=!0),Te.setFormValues(e,o,r),await i(),fe.triggerLock=!1},setFieldState(e,o){Te.setFieldState(e,o)},resetFields(e="*"){Te.resetFields(e)},queryWidget:async e=>Te.queryWidget(e),getFieldList:()=>Ie,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(l(),n(m(D),{class:d(["form-render",{"form-render--no-border":!e.bordered,"form-render--underline":"underline"===e.bordered}]),"require-mark-placement":"left",style:p(m(me))},{default:u((()=>[e.anchor?(l(),c("section",se,[f(m(I),{value:m(be),"onUpdate:value":t[0]||(t[0]=e=>h(be)?be.value=e:null),type:"line",ref_key:"anchorBarRef",ref:je},{default:u((()=>[(l(!0),c(y,null,g(m(ve),(e=>(l(),n(m(N),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):j("v-if",!0),f(m(q),{"theme-overrides":m(de)},{default:u((()=>[b("section",{class:"form-render__wrapper",style:p({"--column":e.column,"--form-height":m(ue)}),ref_key:"formRenderRef",ref:pe,onScroll:t[1]||(t[1]=(...e)=>m(Fe)&&m(Fe)(...e)),onKeydownCapture:t[2]||(t[2]=k(v(((...e)=>m(qe)&&m(qe)(...e)),["prevent"]),["enter"]))},[f(m(_),{form:m(Oe)},{default:u((()=>[f(m(ce),{schema:m(Ne)},null,8,["schema"]),e.consumer?(l(),n(m(V),{key:0},{default:u((({form:e})=>[b("div",ae,F(JSON.stringify(e.values,null,2)),1)])),_:1})):j("v-if",!0),C(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},8,["class","style"]))}});export{ie as default};
@@ -132,7 +132,7 @@ declare const _default: import("vue").DefineComponent<{}, {
132
132
  type: import("vue").PropType<import("../../../../es/components/form-render").FormLowCodeReactions.Config[]>;
133
133
  };
134
134
  operationalForm: {
135
- type: import("vue").PropType<import("../../../../es/components/form-render").FormOperationalConfig[]>;
135
+ type: import("vue").PropType<import("../../../../es/shared/types").FormOperationalConfig[]>;
136
136
  };
137
137
  linebarAutoHidden: {
138
138
  type: BooleanConstructor;
@@ -272,7 +272,7 @@ declare const _default: import("vue").DefineComponent<{}, {
272
272
  type: import("vue").PropType<import("../../../../es/components/form-render").FormLowCodeReactions.Config[]>;
273
273
  };
274
274
  operationalForm: {
275
- type: import("vue").PropType<import("../../../../es/components/form-render").FormOperationalConfig[]>;
275
+ type: import("vue").PropType<import("../../../../es/shared/types").FormOperationalConfig[]>;
276
276
  };
277
277
  linebarAutoHidden: {
278
278
  type: BooleanConstructor;
@@ -333,6 +333,7 @@ declare const _default: import("vue").DefineComponent<{}, {
333
333
  triggerAllReactionsHandler: () => void;
334
334
  operationalFormHandler: (field: string) => void;
335
335
  triggerAllOperationalFormHandler: () => void;
336
+ wordbookSettingHandler: (fieldKey: string, value: unknown) => void;
336
337
  schemaAdaptor: (fieldList: import("../../../../es/components/form-render").FieldItem[]) => Record<string, import("@formily/json-schema").Stringify<{
337
338
  [key: symbol]: any;
338
339
  [key: `x-${string}`]: any;
@@ -448,7 +449,7 @@ declare const _default: import("vue").DefineComponent<{}, {
448
449
  "x-read-pretty"?: boolean | undefined;
449
450
  "x-compile-omitted"?: string[] | undefined;
450
451
  }>>;
451
- onKeydown: (event: KeyboardEvent) => void;
452
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
452
453
  clearSpan: (uuid: string) => void;
453
454
  exposeEvent: {
454
455
  validate(path?: string): Promise<void>;
@@ -740,7 +741,7 @@ declare const _default: import("vue").DefineComponent<{}, {
740
741
  type: import("vue").PropType<import("../../../../es/components/form-render").FormLowCodeReactions.Config[]>;
741
742
  };
742
743
  operationalForm: {
743
- type: import("vue").PropType<import("../../../../es/components/form-render").FormOperationalConfig[]>;
744
+ type: import("vue").PropType<import("../../../../es/shared/types").FormOperationalConfig[]>;
744
745
  };
745
746
  linebarAutoHidden: {
746
747
  type: BooleanConstructor;
@@ -33,15 +33,22 @@ export declare const LEVEL_SEARCH_CASCADER: import("vue").DefineComponent<{
33
33
  name: string;
34
34
  render_key: string[];
35
35
  search_key: string[];
36
+ value_key: string;
37
+ queryParams: string[];
36
38
  primary_key: string;
37
39
  type: string;
38
- value_key: string;
39
40
  level_key: string;
40
41
  link_key: string;
41
42
  link_key_split: string;
42
43
  show_key: string[];
43
44
  conObj: AnyObject[];
44
45
  conObjFirstLevel: AnyObject[];
46
+ setting: Partial<{
47
+ cascading: {
48
+ 'form.name': string;
49
+ value: string;
50
+ }[];
51
+ }>;
45
52
  }>>;
46
53
  required: true;
47
54
  };
@@ -81,15 +88,22 @@ export declare const LEVEL_SEARCH_CASCADER: import("vue").DefineComponent<{
81
88
  name: string;
82
89
  render_key: string[];
83
90
  search_key: string[];
91
+ value_key: string;
92
+ queryParams: string[];
84
93
  primary_key: string;
85
94
  type: string;
86
- value_key: string;
87
95
  level_key: string;
88
96
  link_key: string;
89
97
  link_key_split: string;
90
98
  show_key: string[];
91
99
  conObj: AnyObject[];
92
100
  conObjFirstLevel: AnyObject[];
101
+ setting: Partial<{
102
+ cascading: {
103
+ 'form.name': string;
104
+ value: string;
105
+ }[];
106
+ }>;
93
107
  }>>;
94
108
  required: true;
95
109
  };
@@ -1 +1 @@
1
- import{defineComponent as e,ref as r,computed as t,inject as o,watch as a,createVNode as n}from"vue";import{useVModel as u}from"@vueuse/core";import{isEqual as l,isArray as i,isString as s,isNumber as c,isEmpty as d,isFunction as v,omit as p,cloneDeep as f}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as m}from"../../constants/index.js";import{useCommonInjection as y}from"../../hooks/useCommonInjection.js";import{formRenderLog as h}from"../../utils/index.js";import{connect as k,mapProps as j}from"@formily/vue";import g from"../../../../search-cascader/index.js";import w from"../../../../../shared/components/no-data/NoData.vue.js";import{assignUpdateValue as _}from"../../utils/schema.js";import{useFormField as b}from"../../hooks/useFormField.js";import{useFormRequest as F}from"../../hooks/useFormRequest.js";const K=k(e({name:"FormSearchCascade",props:{options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},autograph:{type:String,required:!0},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},wordbook:{type:Object,required:!0},onChange:{},value:{type:[String,Array]}},emits:["update:value"],setup(e,{emit:k}){const j=u(e,"value",k),_=r(!1),K=r([]),{field:O,fieldKey:q}=b(),S=t((()=>{var r,t,o;return null!=(o=null==(t=null==(r=e.wordbook)?void 0:r.show_key)?void 0:t[0])?o:e.labelField})),x=t((()=>{var r,t;return null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField})),C=t((()=>{var r,t;return null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0]})),L=t((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),V=o(m),{getSearchRequestInfo:A}=F(),I=r(150),P=r();async function R(r,t){var o;if(i(e.value)&&e.value.length&&!r&&!t){const[r,t]=function(e){if(!e.length)return[];const r=[(e=f(e))[0]];let t=e[0];for(let r=1;r<e.length;r++){const o=e[r];o&&(t.children=[o],o.parent=t,t=o)}return[e,r]}(e.value);K.value=t;const o=r[Math.max(0,r.length-2)];return await R(o),o}try{if(r&&!r.__keyword&&r.isLeaf)return a(r);if(null==r?void 0:r.__keyword){if(!s(r.id_link))return Promise.reject();const t=r.id_link.split("_").filter((e=>e));c(L.value)&&L.value!==1/0&&t.splice(L.value);const o=await async function(r){if(!A().primaryKeyUrl)return[];try{return await V.addAsync(t(e.wordbook,e.autograph,r,q.value))}catch(e){s(e)&&h(e)}function t(r,t,o,a){const n=A();return{key:a,params:{autograph:t,tableId:r.id,primaryKeyValue:o.join(","),page:1},...n,url:n.primaryKeyUrl,cache:e.requestCache}}}(t);if(!o)return Promise.reject();const{lastOption:a,options:n}=function(e,r){let t=e[0];return{options:r.reduce(((r,a,n)=>{const u=o(e,a);return 0===n?(t=u,[u]):(Object.assign(u,{parent:t,isLeaf:n+1>=L.value}),t.children=[u],t=u,r)}),[]),lastOption:t};function o(e,r){return e.find((e=>e[x.value]===r))}}(o,t);return n.length<L.value&&(await R(a),d(a.children))?(j.value=function(e,r){return r.map((r=>e.find((e=>e[x.value]===r))))}(o,t),_.value=!1,Promise.reject()):(K.value=n,a)}{const u=await V.addAsync(function(r,o,a,n,u){const l={autograph:()=>o,wordbookId:"id",wordbookType:"type",fieldKeys:()=>r.search_key?JSON.stringify(r.search_key):void 0,conObj:()=>JSON.stringify(function(e,r,t){return r?e.conObj||[]:t?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:t[x.value]}]:e.conObjFirstLevel||[]}(r,t,n)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},i=Object.entries(l).reduce(((e,[t,o])=>(e[t]=s(o)?r[o]:v(o)?o():void 0,e)),{});return{...A(),params:i,key:u,cache:e.requestCache}}(e.wordbook,e.autograph,O.value,r,q.value));if(r){if(!u.length)return a(r);r.children=u.map((e=>function(e,r,t){return{...e,parent:r,isLeaf:n(r)+1>=t}}(e,r,L.value)))}else K.value=u.map((e=>function(e,r){e.__keyword=!!r,e.isLeaf=!!r,r&&(e[S.value]=e[C.value||S.value]||e[S.value]);return e}(e,t))),I.value=t&&(null==(o=P.value)?void 0:o.getWidth())||150}}catch(e){s(e)&&h(e)}function a(e){return j.value=function(e){const r=[];let t=e;for(;t;)r.unshift(p(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),_.value=!1,Promise.reject()}function n(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}function U(){I.value=150}a((()=>e.wordbook),((r,t)=>{l(r,t)||(K.value=[],r&&(j.value||!e.lazyRequest)&&R())}),{immediate:!0});const{injectValueValidate:B,injectValueWatchFromEmpty:N,injectValueBindKey:W}=y();N(j,R),B(j);const z=W(j);return()=>n(g,{ref:P,value:j.value,"onUpdate:value":e=>j.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:K.value,key:z.value,labelKey:S.value,valueKey:x.value,search:R,onFocus:U,menuWidth:I.value},{empty:()=>n(w,null,null)})}}),j({dataSource:"options"},_));export{K as LEVEL_SEARCH_CASCADER};
1
+ import{defineComponent as e,ref as r,computed as t,inject as a,watch as o,createVNode as n}from"vue";import{useVModel as u}from"@vueuse/core";import{isEqual as l,isArray as i,isString as s,isNumber as c,isEmpty as d,isFunction as v,omit as p,cloneDeep as f}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as m}from"../../constants/index.js";import{useCommonInjection as y}from"../../hooks/useCommonInjection.js";import{formRenderLog as h}from"../../utils/index.js";import{connect as k,mapProps as j}from"@formily/vue";import g from"../../../../search-cascader/index.js";import w from"../../../../../shared/components/no-data/NoData.vue.js";import{assignUpdateValue as _}from"../../utils/schema.js";import{useFormField as b}from"../../hooks/useFormField.js";import{useFormRequest as F}from"../../hooks/useFormRequest.js";const K=k(e({name:"FormSearchCascade",props:{options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},autograph:{type:String,required:!0},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},wordbook:{type:Object,required:!0},onChange:{},value:{type:[String,Array]}},emits:["update:value"],setup(e,{emit:k}){const j=u(e,"value",k),_=r(!1),K=r([]),{field:O,fieldKey:q}=b(),S=t((()=>{var r,t,a;return null!=(a=null==(t=null==(r=e.wordbook)?void 0:r.show_key)?void 0:t[0])?a:e.labelField})),C=t((()=>{var r,t;return null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField})),x=t((()=>{var r,t;return null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0]})),L=t((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),V=a(m),{getSearchRequestInfo:A}=F(),I=r(150),P=r();async function R(r,t){var a,o,n;if(I.value=t&&(null==(a=P.value)?void 0:a.getWidth())||150,i(e.value)&&e.value.length&&!r&&!t){const[r,t]=function(e){if(!e.length)return[];const r=[(e=f(e))[0]];let t=e[0];for(let r=1;r<e.length;r++){const a=e[r];a&&(t.children=[a],a.parent=t,t=a)}return[e,r]}(e.value);K.value=t;const a=r[Math.max(0,r.length-2)];return await R(a),a}try{if(r&&!r.__keyword&&r.isLeaf)return u(r);if(null==r?void 0:r.__keyword){if(!s(r.id_link))return Promise.reject();const t=r.id_link.split("_").filter((e=>e));c(L.value)&&L.value!==1/0&&t.splice(L.value);const a=await async function(r){if(!A().primaryKeyUrl)return[];try{return await V.addAsync(t(e.wordbook,e.autograph,r,q.value))}catch(e){s(e)&&h(e)}function t(r,t,a,o){const n=A();return{key:o,params:{autograph:t,tableId:r.id,primaryKeyValue:a.join(","),page:1},...n,url:n.primaryKeyUrl,cache:e.requestCache}}}(t);if(!a)return Promise.reject();const{lastOption:o,options:u}=function(e,r){let t=e[0];return{options:r.reduce(((r,o,n)=>{const u=a(e,o);return 0===n?(t=u,[u]):(Object.assign(u,{parent:t,isLeaf:n+1>=L.value}),t.children=[u],t=u,r)}),[]),lastOption:t};function a(e,r){return e.find((e=>e[C.value]===r))}}(a,t);return u.length<L.value&&(await R(o),d(o.children))?(j.value=function(e,r){return r.map((r=>e.find((e=>e[C.value]===r))))}(a,t),_.value=!1,Promise.reject()):(K.value=u,null==(n=P.value)||n.setCursor(o),o)}{const a=await V.addAsync(function(r,a,o,n,u){const l={autograph:()=>a,wordbookId:"id",wordbookType:"type",fieldKeys:()=>r.search_key?JSON.stringify(r.search_key):void 0,conObj:()=>JSON.stringify(function(e,r,t){return r?e.conObj||[]:t?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:t[C.value]}]:e.conObjFirstLevel||[]}(r,t,n)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},i=Object.entries(l).reduce(((e,[t,a])=>(e[t]=s(a)?r[a]:v(a)?a():void 0,e)),{});return{...A(),params:i,key:u,cache:e.requestCache}}(e.wordbook,e.autograph,O.value,r,q.value));if(r){if(!a.length)return u(r);r.children=a.map((e=>function(e,r,t){return{...e,parent:r,isLeaf:l(r)+1>=t}}(e,r,L.value)))}else K.value=a.map((e=>function(e,r){e.__keyword=!!r,e.isLeaf=!!r,r&&(e[S.value]=e[x.value||S.value]||e[S.value]);return e}(e,t))),t&&(null==(o=P.value)||o.setCursor(K.value[0]))}}catch(e){s(e)&&h(e)}function u(e){return j.value=function(e){const r=[];let t=e;for(;t;)r.unshift(p(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),_.value=!1,Promise.reject()}function l(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}function U(){I.value=150}o((()=>e.wordbook),((r,t)=>{l(r,t)||(K.value=[],r&&(j.value||!e.lazyRequest)&&R())}),{immediate:!0});const{injectValueValidate:B,injectValueWatchFromEmpty:N,injectValueBindKey:W}=y();N(j,R),B(j);const z=W(j);return()=>n(g,{ref:P,value:j.value,"onUpdate:value":e=>j.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:K.value,key:z.value,labelKey:S.value,valueKey:C.value,search:R,onFocus:U,menuWidth:I.value},{empty:()=>n(w,null,null)})}}),j({dataSource:"options"},_));export{K as LEVEL_SEARCH_CASCADER};
@@ -34,15 +34,22 @@ export declare const RADIO: import("vue").DefineComponent<{
34
34
  name: string;
35
35
  render_key: string[];
36
36
  search_key: string[];
37
+ value_key: string;
38
+ queryParams: string[];
37
39
  primary_key: string;
38
40
  type: string;
39
- value_key: string;
40
41
  level_key: string;
41
42
  link_key: string;
42
43
  link_key_split: string;
43
44
  show_key: string[];
44
45
  conObj: AnyObject[];
45
46
  conObjFirstLevel: AnyObject[];
47
+ setting: Partial<{
48
+ cascading: {
49
+ 'form.name': string;
50
+ value: string;
51
+ }[];
52
+ }>;
46
53
  }>>;
47
54
  };
48
55
  vertical: {
@@ -89,15 +96,22 @@ export declare const RADIO: import("vue").DefineComponent<{
89
96
  name: string;
90
97
  render_key: string[];
91
98
  search_key: string[];
99
+ value_key: string;
100
+ queryParams: string[];
92
101
  primary_key: string;
93
102
  type: string;
94
- value_key: string;
95
103
  level_key: string;
96
104
  link_key: string;
97
105
  link_key_split: string;
98
106
  show_key: string[];
99
107
  conObj: AnyObject[];
100
108
  conObjFirstLevel: AnyObject[];
109
+ setting: Partial<{
110
+ cascading: {
111
+ 'form.name': string;
112
+ value: string;
113
+ }[];
114
+ }>;
101
115
  }>>;
102
116
  };
103
117
  vertical: {
@@ -156,15 +170,22 @@ export declare const CHECKBOX: import("vue").DefineComponent<{
156
170
  name: string;
157
171
  render_key: string[];
158
172
  search_key: string[];
173
+ value_key: string;
174
+ queryParams: string[];
159
175
  primary_key: string;
160
176
  type: string;
161
- value_key: string;
162
177
  level_key: string;
163
178
  link_key: string;
164
179
  link_key_split: string;
165
180
  show_key: string[];
166
181
  conObj: AnyObject[];
167
182
  conObjFirstLevel: AnyObject[];
183
+ setting: Partial<{
184
+ cascading: {
185
+ 'form.name': string;
186
+ value: string;
187
+ }[];
188
+ }>;
168
189
  }>>;
169
190
  };
170
191
  vertical: {
@@ -211,15 +232,22 @@ export declare const CHECKBOX: import("vue").DefineComponent<{
211
232
  name: string;
212
233
  render_key: string[];
213
234
  search_key: string[];
235
+ value_key: string;
236
+ queryParams: string[];
214
237
  primary_key: string;
215
238
  type: string;
216
- value_key: string;
217
239
  level_key: string;
218
240
  link_key: string;
219
241
  link_key_split: string;
220
242
  show_key: string[];
221
243
  conObj: AnyObject[];
222
244
  conObjFirstLevel: AnyObject[];
245
+ setting: Partial<{
246
+ cascading: {
247
+ 'form.name': string;
248
+ value: string;
249
+ }[];
250
+ }>;
223
251
  }>>;
224
252
  };
225
253
  vertical: {
@@ -13,6 +13,7 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
13
13
  type: PropType<AnyObject[]>;
14
14
  default: () => never[];
15
15
  };
16
+ allowCreate: BooleanConstructor;
16
17
  labelField: {
17
18
  type: StringConstructor;
18
19
  default: string;
@@ -37,6 +38,7 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
37
38
  type: PropType<AnyObject[]>;
38
39
  default: () => never[];
39
40
  };
41
+ allowCreate: BooleanConstructor;
40
42
  labelField: {
41
43
  type: StringConstructor;
42
44
  default: string;
@@ -56,4 +58,5 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
56
58
  labelField: string;
57
59
  valueField: string;
58
60
  requestCache: boolean;
61
+ allowCreate: boolean;
59
62
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as u,inject as a,watch as o,createVNode as t}from"vue";import{connect as n,mapProps as r}from"@formily/vue";import{useVModel as i,useDebounceFn as s}from"@vueuse/core";import{isString as v,isArray as m,cloneDeep as p,isEqual as d}from"lodash-es";import{NSelect as f}from"naive-ui";import"../../../index.js";import{InjectionAsyncQueue as c,InjectionChangeContextCollector as y,InjectionFormItemDepsCollector as g}from"../../constants/index.js";import{createUrlConfigParams as h,formRenderLog as C}from"../../utils/index.js";import{useCommonInjection as j,useSelectOptionProps as F}from"../../hooks/useCommonInjection.js";import{assignUpdateValue as x,assignClearBindVisited as b,createVisitedSetter as K}from"../../utils/schema.js";import{useFormField as S}from"../../hooks/useFormField.js";const k=n(e({name:"FormRemoteSearch",props:{value:{type:String},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},urlConfig:{type:Object},onChange:{}},emits:["update:value"],setup(e,{slots:n,emit:r}){const x=i(e,"value",r),{field:b,fieldKey:k}=S(),w=l(null),V=u((()=>{var l,u,a;return null!=(a=null!=(u=null==(l=e.urlConfig)?void 0:l.nameKey)?u:e.labelField)?a:"text"})),q=u((()=>{var l,u,a;return null!=(a=null!=(u=null==(l=e.urlConfig)?void 0:l.valueKey)?u:e.valueField)?a:"value"})),A=a(c),B=s((async(l="",u="label")=>{if(!e.urlConfig)return w.value=null;try{w.value=await A.addAsync(await h({config:{...e.urlConfig,params:{...e.urlConfig.params,["value"===u?q.value:"keyword"]:l}},cache:e.requestCache,field:b.value}))}catch(e){v(e)&&C(e)}})),O=u((()=>m(w.value)?w.value:m(e.options)?e.options:[])),{injectValueValidate:P,injectValueBindKey:U}=j();P(x);const D=U(x);o(x,(e=>{if(e&&!O.value.find((l=>l[q.value]===e)))return B(e,"value")}));a(y).setContext(k.value,(e=>{return{currentOption:p((l=e,O.value.find((e=>e[q.value]===l))))};var l}));const I=a(g);o((()=>e.urlConfig),((e,l)=>{d(e,l)||(w.value=null,e&&(I.setDeps(k.value,e.dependKey||[],(async()=>{w.value=null,x.value=null})),x.value&&B(x.value,"value")))}),{immediate:!0});const{menuProps:R,nodeProps:z}=F();return()=>t(f,{remote:!0,filterable:!0,key:D.value,value:x.value,"onUpdate:value":e=>x.value=e,labelField:V.value,valueField:q.value,"menu-props":R,"node-props":z,onSearch:B,"onUpdate:show":e=>e&&B(),options:O.value,onFocus:K(b)},n)}}),r(x,b));export{k as REMOTE_SEARCH};
1
+ import{defineComponent as e,ref as l,computed as a,inject as u,watch as o,createVNode as t}from"vue";import{connect as n,mapProps as r}from"@formily/vue";import{useVModel as i,useDebounceFn as v}from"@vueuse/core";import{isString as s,isArray as m,cloneDeep as p,isEqual as d}from"lodash-es";import{NSelect as f}from"naive-ui";import"../../../index.js";import{InjectionAsyncQueue as c,InjectionChangeContextCollector as y,InjectionFormItemDepsCollector as C}from"../../constants/index.js";import{createUrlConfigParams as g,formRenderLog as h}from"../../utils/index.js";import{useCommonInjection as j,useSelectOptionProps as F}from"../../hooks/useCommonInjection.js";import{assignUpdateValue as x,assignClearBindVisited as b,createVisitedSetter as w}from"../../utils/schema.js";import{useFormField as K}from"../../hooks/useFormField.js";const S=n(e({name:"FormRemoteSearch",props:{value:{type:String},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},allowCreate:Boolean,labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},urlConfig:{type:Object},onChange:{}},emits:["update:value"],setup(e,{slots:n,emit:r}){const x=i(e,"value",r),{field:b,fieldKey:S}=K(),k=l(null),B=a((()=>{var l,a,u;return null!=(u=null!=(a=null==(l=e.urlConfig)?void 0:l.nameKey)?a:e.labelField)?u:"text"})),V=a((()=>{var l,a,u;return null!=(u=null!=(a=null==(l=e.urlConfig)?void 0:l.valueKey)?a:e.valueField)?u:"value"})),q=u(c),A=l(""),O=v((async(l="",a="label")=>{if(A.value=l,!e.urlConfig)return k.value=null;try{k.value=await q.addAsync(await g({config:{...e.urlConfig,params:{...e.urlConfig.params,["value"===a?V.value:"keyword"]:l}},cache:e.requestCache,field:b.value}))}catch(e){s(e)&&h(e)}})),P=a((()=>m(k.value)?k.value:m(e.options)?e.options:[])),{injectValueValidate:U,injectValueBindKey:D}=j();U(x);const I=D(x);o(x,(e=>{if(e&&!P.value.find((l=>l[V.value]===e)))return O(e,"value")}));u(y).setContext(S.value,(e=>{return{currentOption:p((l=e,P.value.find((e=>e[V.value]===l))))};var l}));const R=u(C);o((()=>e.urlConfig),((e,l)=>{d(e,l)||(k.value=null,e&&(R.setDeps(S.value,e.dependKey||[],(async()=>{k.value=null,x.value=null})),x.value&&O(x.value,"value")))}),{immediate:!0});const{menuProps:z,nodeProps:E}=F(),G=a((()=>P.value.length||!e.allowCreate?P.value:A.value?[{[B.value]:A.value,[V.value]:A.value},...P.value]:P.value));return()=>t(f,{remote:!0,filterable:!0,key:I.value,value:x.value,"onUpdate:value":e=>x.value=e,labelField:B.value,valueField:V.value,"menu-props":z,"node-props":E,onSearch:O,"onUpdate:show":e=>e&&O(),options:G.value,onFocus:w(b)},n)}}),r(x,b));export{S as REMOTE_SEARCH};
@@ -42,15 +42,22 @@ export declare const SELECT: import("vue").DefineComponent<{
42
42
  name: string;
43
43
  render_key: string[];
44
44
  search_key: string[];
45
+ value_key: string;
46
+ queryParams: string[];
45
47
  primary_key: string;
46
48
  type: string;
47
- value_key: string;
48
49
  level_key: string;
49
50
  link_key: string;
50
51
  link_key_split: string;
51
52
  show_key: string[];
52
53
  conObj: AnyObject[];
53
54
  conObjFirstLevel: AnyObject[];
55
+ setting: Partial<{
56
+ cascading: {
57
+ 'form.name': string;
58
+ value: string;
59
+ }[];
60
+ }>;
54
61
  }>>;
55
62
  };
56
63
  recommend: {
@@ -117,15 +124,22 @@ export declare const SELECT: import("vue").DefineComponent<{
117
124
  name: string;
118
125
  render_key: string[];
119
126
  search_key: string[];
127
+ value_key: string;
128
+ queryParams: string[];
120
129
  primary_key: string;
121
130
  type: string;
122
- value_key: string;
123
131
  level_key: string;
124
132
  link_key: string;
125
133
  link_key_split: string;
126
134
  show_key: string[];
127
135
  conObj: AnyObject[];
128
136
  conObjFirstLevel: AnyObject[];
137
+ setting: Partial<{
138
+ cascading: {
139
+ 'form.name': string;
140
+ value: string;
141
+ }[];
142
+ }>;
129
143
  }>>;
130
144
  };
131
145
  recommend: {
@@ -1 +1 @@
1
- import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as i}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as l}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function d(d){const{createValidatorSchema:u}=l(),x=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=u(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},f=e=>{var o;const t=x(e);e.urlConfig?function(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig"])})}(t,e):e.autograph&&m(t,e);const i=!!e.__multiple;return Object.assign(t["x-component-props"],{multiple:i,options:e.option||(null==(o=e.componentProps)?void 0:o.options),allowCreate:"1"===e.free_entry||!!t["x-component-props"].allowCreate,maxTagCount:r(e.multi_select_value),...n(e,["lazyRequest","requestCache"])}),i&&(t.type="array"),t},_=e=>{const o=x(e);return Object.assign(o["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,vertical:e.__vertical}),m(o,e),o},h=e=>{const t=x(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},g=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark}}),b=new Map([["LINEBAR",g],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=x(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=x(e),{decimal_length:t,validate:n}=e;return Object.assign(o["x-component-props"],{precision:null!=t?t:null==n?void 0:n.decimal_length,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",f],["REMOTE_SEARCH",f],["DATE",e=>{const o=x(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),o}],["SEARCH_CASCADER",e=>{var o;const t=x(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=x(e);return o.type="array",!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",_],["CHECKBOX",_],["SWITCH",e=>{const o=x(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close}),o}],["SLIDER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=x(e);Array.isArray(e.properties)&&i("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?C(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),y=e=>{if(e.suffixConfig)return v(e);return(b.get(e.html_type)||h)(e)},v=o=>{if(!o.suffixConfig)return y(o);const t=e(o.suffixConfig),n=[{...o,is_show:"1",hide_title:"1",suffixConfig:void 0}].concat(t.map((e=>({...e,hide_title:"1",is_show:"1"})))),r=x(o);return Object.assign(r,{type:"void",name:a(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:2*(o.elem_width||3)},"x-decorator-props":{...r["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:C(n)}),r},{FieldNormalizeWaterfallHook:O}=s();function C(o){let n=null;return o.reduce(((e,o,s)=>{var a;const p=null==(a=(o=O.call(t(o))).validate)?void 0:a.obj_type;return p&&d&&d.collect(p,t(o)),"LINEBAR"===o.html_type?(e[i(o)]=r(g(o),s),n=e[i(o)].properties={}):n?n[i(o)]=r(y(o),s):(n=null,e[i(o)]=r(y(o),s)),e}),{});function r(e,o){return e["x-index"]=o,e}function i(o){return o.suffixConfig?a([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:C}}export{d as useFieldListAdaptor};
1
+ import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as i}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as l}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function d(d){const{createValidatorSchema:u}=l(),x=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=u(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},f=e=>{var o;const t=x(e);e.urlConfig?function(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig","wordbook"])})}(t,e):e.autograph&&m(t,e);const i=!!e.__multiple;return Object.assign(t["x-component-props"],{multiple:i,options:e.option||(null==(o=e.componentProps)?void 0:o.options),allowCreate:"1"===e.free_entry||!!t["x-component-props"].allowCreate,maxTagCount:r(e.multi_select_value),...n(e,["lazyRequest","requestCache"])}),i&&(t.type="array"),t},_=e=>{const o=x(e);return Object.assign(o["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,vertical:e.__vertical}),m(o,e),o},h=e=>{const t=x(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},g=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark}}),b=new Map([["LINEBAR",g],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=x(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=x(e),{decimal_length:t,validate:n}=e;return Object.assign(o["x-component-props"],{precision:null!=t?t:null==n?void 0:n.decimal_length,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",f],["REMOTE_SEARCH",f],["DATE",e=>{const o=x(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),o}],["SEARCH_CASCADER",e=>{var o;const t=x(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=x(e);return o.type="array",!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",_],["CHECKBOX",_],["SWITCH",e=>{const o=x(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close}),o}],["SLIDER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=x(e);Array.isArray(e.properties)&&i("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?C(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),y=e=>{if(e.suffixConfig)return v(e);return(b.get(e.html_type)||h)(e)},v=o=>{if(!o.suffixConfig)return y(o);const t=e(o.suffixConfig),n=[{...o,is_show:"1",hide_title:"1",suffixConfig:void 0}].concat(t.map((e=>({...e,hide_title:"1",is_show:"1"})))),r=x(o);return Object.assign(r,{type:"void",name:a(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:2*(o.elem_width||3)},"x-decorator-props":{...r["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:C(n)}),r},{FieldNormalizeWaterfallHook:O}=s();function C(o){let n=null;return o.reduce(((e,o,s)=>{var a;const p=null==(a=(o=O.call(t(o))).validate)?void 0:a.obj_type;return p&&d&&d.collect(p,t(o)),"LINEBAR"===o.html_type?(e[i(o)]=r(g(o),s),n=e[i(o)].properties={}):n?n[i(o)]=r(y(o),s):(n=null,e[i(o)]=r(y(o),s)),e}),{});function r(e,o){return e["x-index"]=o,e}function i(o){return o.suffixConfig?a([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:C}}export{d as useFieldListAdaptor};
@@ -25,5 +25,5 @@ export declare function useFormDomEvent({ props, formRenderRef, formModel }: {
25
25
  formRenderRef: Ref<HTMLElement | undefined>;
26
26
  formModel: Form;
27
27
  }): {
28
- onKeydown: (event: KeyboardEvent) => void;
28
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
29
29
  };
@@ -1 +1 @@
1
- import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isArray as s,isFunction as a}from"lodash-es";import{nextTick as m}from"vue";import"../../index.js";import{FormItemLineBarDepKeyPrepend as u,NESTED_FORM_ITEM_TYPE as f}from"../constants/index.js";import{queryDecoratorByAddress as l,queryInput as d,queryDecoratorByFieldKey as c,findNextWidget as p}from"../utils/dom.js";import{validateMessageParser as g,combineExtendKey as v,splitExtendKey as y}from"../utils/index.js";import{getParentLinebar as h}from"../utils/schema.js";function I({formModel:t,formRenderRef:n,formUUID:a,getFieldList:f,formItemDepsCollector:p}){return{validate(r="*"){return t.validate(r).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(o,[]):e)));function o(t,r){if(!i(r))return t;let o=!1;return s(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(m)),o=!0)})),!o&&t.push(m(r)),t}function m(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),s=e.messages.map((e=>function(e,t){var r;return t&&i(t.fieldItem)?g(null!=(r=t.fieldItem.defined_error_msg)?r:e,t.fieldItem):e}(e,r.get("decoratorProps")))),m=l(e.address,n.value,a);return{...e,messages:s,title:o,decoratorElement:m,...d(m)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=v(f(),r)),r},setFormValues(e,i=!0,n=!0){i&&(e=y(f(),e)),t.setFieldState("*",(t=>{r(t)&&(n||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))}))},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:async e=>n.value?await async function(e,t,r){if(!n.value)return s();const o=c(e,t,a);if(o)return s(o);const i=h(e,r);return i?(p.trigger(u+i,!0),await m(),s(c(e,t,a))):s();function s(e){return{decoratorElement:e,...d(e)}}}(e,n.value,f()):null}}function x({props:e,formRenderRef:r,formModel:o}){return{onKeydown:function i(s){var m;if(!e.enterToNextWidget||!r.value)return;const u=t(s.target,(e=>e.classList.contains("form-render__formItem")));if(!u)return;const l=`.form-render__formItem${f.map((e=>`:not([widget-type=${e}])`)).join("")}`,d=Array.from(r.value.querySelectorAll(l)),c=d.findIndex((e=>e.id===u.id));if(!~c)return;const{widget:g,field:v}=p(d,c,s.target);if(g)if(a(e.enterToNextWidget)){const t=v&&o.query(v).take();!t||e.enterToNextWidget(null==(m=t.decoratorProps)?void 0:m.fieldItem)?y():i({target:g})}else y();async function y(){await n(0),g.focus()}}}}export{x as useFormDomEvent,I as useFormExposeEvent};
1
+ import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isArray as s,isFunction as a}from"lodash-es";import{nextTick as m}from"vue";import"../../index.js";import{FormItemLineBarDepKeyPrepend as u,NESTED_FORM_ITEM_TYPE as f}from"../constants/index.js";import{queryDecoratorByAddress as l,queryInput as d,queryDecoratorByFieldKey as c,findNextWidget as p}from"../utils/dom.js";import{validateMessageParser as g,combineExtendKey as v,splitExtendKey as y}from"../utils/index.js";import{getParentLinebar as h}from"../utils/schema.js";function I({formModel:t,formRenderRef:n,formUUID:a,getFieldList:f,formItemDepsCollector:p}){return{validate(r="*"){return t.validate(r).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(o,[]):e)));function o(t,r){if(!i(r))return t;let o=!1;return s(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(m)),o=!0)})),!o&&t.push(m(r)),t}function m(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),s=e.messages.map((e=>function(e,t){var r;return t&&i(t.fieldItem)?g(null!=(r=t.fieldItem.defined_error_msg)?r:e,t.fieldItem):e}(e,r.get("decoratorProps")))),m=l(e.address,n.value,a);return{...e,messages:s,title:o,decoratorElement:m,...d(m)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=v(f(),r)),r},setFormValues(e,i=!0,n=!0){i&&(e=y(f(),e)),t.setFieldState("*",(t=>{r(t)&&(n||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))}))},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:async e=>n.value?await async function(e,t,r){if(!n.value)return s();const o=c(e,t,a);if(o)return s(o);const i=h(e,r);return i?(p.trigger(u+i,!0),await m(),s(c(e,t,a))):s();function s(e){return{decoratorElement:e,...d(e)}}}(e,n.value,f()):null}}function x({props:e,formRenderRef:r,formModel:o}){return{onKeydown:async function i(s){var m;if(await n(0),Reflect.get(s,"stopCapture")||!e.enterToNextWidget||!r.value)return;const u=t(s.target,(e=>e.classList.contains("form-render__formItem")));if(!u)return;const l=`.form-render__formItem${f.map((e=>`:not([widget-type=${e}])`)).join("")}`,d=Array.from(r.value.querySelectorAll(l)),c=d.findIndex((e=>e.id===u.id));if(!~c)return;const{widget:g,field:v}=p(d,c,s.target);if(g)if(a(e.enterToNextWidget)){const t=v&&o.query(v).take();!t||e.enterToNextWidget(null==(m=t.decoratorProps)?void 0:m.fieldItem)?y():i({target:g})}else y();async function y(){await n(0),g.focus()}}}}export{x as useFormDomEvent,I as useFormExposeEvent};