cnhis-design-vue 3.1.26-beta.3 → 3.1.26-beta.5

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 (43) hide show
  1. package/es/components/form-config/index.d.ts +888 -872
  2. package/es/components/form-config/src/FormConfig.vue.d.ts +888 -872
  3. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +444 -436
  4. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +444 -436
  5. package/es/components/form-render/index.d.ts +445 -436
  6. package/es/components/form-render/index.js +5 -1
  7. package/es/components/form-render/src/FormRender.js +23 -9
  8. package/es/components/form-render/src/FormRender.vue.d.ts +1 -0
  9. package/es/components/form-render/src/FormRenderWrapper.js +45 -0
  10. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +620 -0
  11. package/es/components/form-render/src/components/renderer/jsonCombination/index.js +2 -2
  12. package/es/components/form-render/src/components/renderer/simpleComponent.js +2 -2
  13. package/es/components/form-render/src/hooks/useFormContext.js +2 -2
  14. package/es/components/form-render/src/types/index.d.ts +3 -1
  15. package/es/components/form-render/src/utils/index.d.ts +2 -1
  16. package/es/components/form-render/src/utils/index.js +26 -4
  17. package/es/components/iho-table/index.d.ts +46 -0
  18. package/es/components/iho-table/index.js +1 -0
  19. package/es/components/iho-table/src/IhoTable.js +36 -22
  20. package/es/components/iho-table/src/IhoTable.vue.d.ts +46 -0
  21. package/es/components/iho-table/src/components/ColumnAnchor.d.ts +28 -0
  22. package/es/components/iho-table/src/components/ColumnAnchor.js +47 -0
  23. package/es/components/iho-table/src/components/index.d.ts +1 -0
  24. package/es/components/iho-table/src/components/index.js +1 -0
  25. package/es/components/iho-table/src/constants/index.d.ts +5 -3
  26. package/es/components/iho-table/src/constants/index.js +9 -1
  27. package/es/components/iho-table/src/hooks/index.d.ts +1 -0
  28. package/es/components/iho-table/src/hooks/index.js +1 -0
  29. package/es/components/iho-table/src/hooks/useAnchor.d.ts +13 -0
  30. package/es/components/iho-table/src/hooks/useAnchor.js +66 -0
  31. package/es/components/iho-table/src/hooks/useTableContext.d.ts +7 -0
  32. package/es/components/iho-table/src/hooks/useTableContext.js +15 -0
  33. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +1 -1
  34. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/editSeparate.vue.d.ts +1 -1
  35. package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/rowGroupUtils.d.ts +3 -3
  36. package/es/components/iho-table/src/plugins/virtualTreePlugin/index.js +3 -1
  37. package/es/components/iho-table/src/types/index.d.ts +12 -8
  38. package/es/components/iho-table/src/types/pluginType.d.ts +2 -2
  39. package/es/components/index.js +4 -0
  40. package/es/components/shortcut-setter/index.d.ts +444 -436
  41. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +444 -436
  42. package/es/shared/types/index.d.ts +6 -2
  43. package/package.json +2 -2
@@ -8,11 +8,11 @@ import components from '../components/renderer/index.js';
8
8
  import { useFormRenderLifeCycle } from './useFormRenderLifeCycle.js';
9
9
  import { usePresetScope } from './usePresetScope.js';
10
10
  import { injectOrProvide, presetRequestHandler } from '../utils/index.js';
11
- import { InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionAnnotation, InjectAsyncQueue, InjectionSchemaField } from '../constants/index.js';
11
+ import { InjectAsyncQueue, InjectionSchemaField, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionAnnotation } from '../constants/index.js';
12
+ import { useAsyncQueue } from './useAsyncQueue.js';
12
13
  import { useBusinessBinding } from './useBusinessBinding.js';
13
14
  import { useChangeContext } from './useChangeContext.js';
14
15
  import { useFormItemDeps } from './useFormItemDeps.js';
15
- import { useAsyncQueue } from './useAsyncQueue.js';
16
16
 
17
17
  function useFormContext(props, formModel) {
18
18
  const { callLifeCycle } = useFormRenderLifeCycle(props);
@@ -27,7 +27,8 @@ export declare type AgeContext = Record<'age' | 'day' | 'month' | 'year', number
27
27
  export declare type IdCardParseInfo = Record<'sex' | 'birthday', string> & AgeContext;
28
28
  export declare type FormRenderExpose = {
29
29
  validate(path?: string): Promise<unknown>;
30
- getFormValues(): AnyObject;
30
+ getFormValues(needCombineExtendKey?: boolean): AnyObject;
31
+ setFormValues(values: AnyObject, needSplitExtendKey?: boolean): AnyObject;
31
32
  setFieldState(path: string, setter: (field: Field) => void): void;
32
33
  resetFields(path?: string): void;
33
34
  queryWidget(key: string): Promise<{
@@ -35,6 +36,7 @@ export declare type FormRenderExpose = {
35
36
  widgetElementList: HTMLInputElement[];
36
37
  decoratorElement: HTMLElement | null;
37
38
  }>;
39
+ reload(): Promise<any>;
38
40
  };
39
41
  export declare type FormChangeContext = Partial<{
40
42
  currentOption: AnyObject;
@@ -17,4 +17,5 @@ export declare function optionMatcher(options: AnyObject[], input: Nullable<stri
17
17
  keyword?: string;
18
18
  }): AnyObject[];
19
19
  export declare function validateMessageParser(message: string, fieldItem: Omit<FieldItem, 'reactions'>): string;
20
- export declare function transformExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
20
+ export declare function combineExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
21
+ export declare function splitExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
@@ -1,9 +1,9 @@
1
- import { computed, createVNode, Fragment, inject, provide } from 'vue';
1
+ import { inject, provide, computed, createVNode, Fragment } from 'vue';
2
2
  import { arrayed } from '../../../../shared/utils/index.js';
3
3
  import { Path } from '@formily/path';
4
4
  import { isObject } from '@vue/shared';
5
5
  import { useMemoize } from '@vueuse/core';
6
- import { isString, isFunction } from 'lodash-es';
6
+ import { isString, isFunction, omit } from 'lodash-es';
7
7
  import 'date-fns';
8
8
  import '@formily/core';
9
9
 
@@ -133,7 +133,7 @@ function validateMessageParser(message, fieldItem) {
133
133
  return (_a = fieldItem[property.trim()]) != null ? _a : "";
134
134
  }
135
135
  }
136
- function transformExtendKey(fieldList, values) {
136
+ function combineExtendKey(fieldList, values) {
137
137
  const fieldListWithExtendKey = fieldList.filter((field) => isString(field.extendKey) && field.extendKey);
138
138
  if (!fieldListWithExtendKey.length)
139
139
  return values;
@@ -157,5 +157,27 @@ function transformExtendKey(fieldList, values) {
157
157
  });
158
158
  return result;
159
159
  }
160
+ function splitExtendKey(fieldList, values) {
161
+ const fieldListWithExtendKey = fieldList.filter((field) => isString(field.extendKey) && field.extendKey);
162
+ if (!fieldListWithExtendKey.length)
163
+ return values;
164
+ const queryFieldValue = useMemoize((extendKey) => {
165
+ try {
166
+ return JSON.parse(values[extendKey]);
167
+ } catch (e) {
168
+ return {};
169
+ }
170
+ });
171
+ const result = omit(values, fieldListWithExtendKey.map((field) => field.extendKey));
172
+ fieldListWithExtendKey.forEach(({
173
+ val_key,
174
+ extendKey
175
+ }) => {
176
+ if (Reflect.has(result, val_key))
177
+ return;
178
+ result[val_key] = queryFieldValue(extendKey)[val_key];
179
+ });
180
+ return result;
181
+ }
160
182
 
161
- export { createInputSlot, createSlot, formRenderLog, injectOrProvide, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, transformExtendKey, validateMessageParser };
183
+ export { combineExtendKey, createInputSlot, createSlot, formRenderLog, injectOrProvide, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser };
@@ -16,6 +16,10 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
16
16
  type: import("vue").PropType<import("../../../es/shared/types").AnyObject[]>;
17
17
  default: () => never[];
18
18
  };
19
+ anchorList: {
20
+ type: import("vue").PropType<string[]>;
21
+ default: () => never[];
22
+ };
19
23
  }, {
20
24
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
21
25
  tableConfig: {
@@ -30,6 +34,10 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
30
34
  type: import("vue").PropType<import("../../../es/shared/types").AnyObject[]>;
31
35
  default: () => never[];
32
36
  };
37
+ anchorList: {
38
+ type: import("vue").PropType<string[]>;
39
+ default: () => never[];
40
+ };
33
41
  }>> & {
34
42
  onFormChange?: ((...args: any[]) => any) | undefined;
35
43
  onCopy?: ((...args: any[]) => any) | undefined;
@@ -4384,6 +4392,14 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
4384
4392
  }[] | undefined;
4385
4393
  } | undefined;
4386
4394
  }>;
4395
+ onScroll: (params: any) => void;
4396
+ updateAnchor: (field: string) => Promise<void>;
4397
+ currentAnchorList: import("vue").Ref<{
4398
+ field: string;
4399
+ title: string;
4400
+ left: number;
4401
+ }[]>;
4402
+ anchorValue: import("vue").Ref<any>;
4387
4403
  IhoTableColumn: import("vue").DefineComponent<{
4388
4404
  field: {
4389
4405
  type: import("vue").PropType<import("../../../es/components/iho-table/src/types").IhoTableFieldItem>;
@@ -4395,6 +4411,31 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
4395
4411
  required: true;
4396
4412
  };
4397
4413
  }>>, {}>;
4414
+ ColumnAnchor: import("vue").DefineComponent<{
4415
+ anchorList: {
4416
+ type: import("vue").PropType<import("../../../es/components/iho-table/src/types").IanchorObj[]>;
4417
+ default: () => never[];
4418
+ };
4419
+ value: {
4420
+ type: StringConstructor;
4421
+ default: string;
4422
+ };
4423
+ }, () => JSX.Element | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "updateAnchor")[], "updateAnchor" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
4424
+ anchorList: {
4425
+ type: import("vue").PropType<import("../../../es/components/iho-table/src/types").IanchorObj[]>;
4426
+ default: () => never[];
4427
+ };
4428
+ value: {
4429
+ type: StringConstructor;
4430
+ default: string;
4431
+ };
4432
+ }>> & {
4433
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
4434
+ onUpdateAnchor?: ((...args: any[]) => any) | undefined;
4435
+ }, {
4436
+ anchorList: import("../../../es/components/iho-table/src/types").IanchorObj[];
4437
+ value: string;
4438
+ }>;
4398
4439
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("toggleRowExpand" | "toggleTreeExpand" | "copy" | "scroll" | "formChange" | "settingClick" | "cut" | "paste" | "keydown" | "keydownStart" | "keydownEnd" | "currentChange" | "radioChange" | "checkboxChange" | "checkboxAll" | "checkboxRangeStart" | "checkboxRangeChange" | "checkboxRangeEnd" | "cellClick" | "cellDblclick" | "cellMenu" | "cellMouseenter" | "cellMouseleave" | "headerCellClick" | "headerCellDblclick" | "headerCellMenu" | "footerCellClick" | "footerCellDblclick" | "footerCellMenu" | "sortChange" | "filterChange" | "filterVisible" | "resizableChange" | "menuClick" | "editClosed" | "editActived" | "editDisabled" | "validError" | "custom" | "openFnr" | "fnrChange" | "fnrFind" | "fnrFindAll" | "fnrReplace" | "fnrReplaceAll" | "cellAreaCopy" | "cellAreaCut" | "cellAreaPaste" | "cellAreaMerge" | "clearCellAreaMerge" | "headerCellAreaSelection" | "cellAreaSelectionStart" | "cellAreaSelectionDrag" | "cellAreaSelectionEnd" | "cellAreaExtensionStart" | "cellAreaExtensionDrag" | "cellAreaExtensionEnd" | "cellAreaArrowsStart" | "cellAreaArrowsEnd" | "activeCellChangeStart" | "activeCellChangeEnd")[], "toggleRowExpand" | "toggleTreeExpand" | "copy" | "scroll" | "formChange" | "settingClick" | "cut" | "paste" | "keydown" | "keydownStart" | "keydownEnd" | "currentChange" | "radioChange" | "checkboxChange" | "checkboxAll" | "checkboxRangeStart" | "checkboxRangeChange" | "checkboxRangeEnd" | "cellClick" | "cellDblclick" | "cellMenu" | "cellMouseenter" | "cellMouseleave" | "headerCellClick" | "headerCellDblclick" | "headerCellMenu" | "footerCellClick" | "footerCellDblclick" | "footerCellMenu" | "sortChange" | "filterChange" | "filterVisible" | "resizableChange" | "menuClick" | "editClosed" | "editActived" | "editDisabled" | "validError" | "custom" | "openFnr" | "fnrChange" | "fnrFind" | "fnrFindAll" | "fnrReplace" | "fnrReplaceAll" | "cellAreaCopy" | "cellAreaCut" | "cellAreaPaste" | "cellAreaMerge" | "clearCellAreaMerge" | "headerCellAreaSelection" | "cellAreaSelectionStart" | "cellAreaSelectionDrag" | "cellAreaSelectionEnd" | "cellAreaExtensionStart" | "cellAreaExtensionDrag" | "cellAreaExtensionEnd" | "cellAreaArrowsStart" | "cellAreaArrowsEnd" | "activeCellChangeStart" | "activeCellChangeEnd", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
4399
4440
  tableConfig: {
4400
4441
  type: import("vue").PropType<import("../../../es/components/iho-table/src/types").IhoTableConfig>;
@@ -4408,6 +4449,10 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
4408
4449
  type: import("vue").PropType<import("../../../es/shared/types").AnyObject[]>;
4409
4450
  default: () => never[];
4410
4451
  };
4452
+ anchorList: {
4453
+ type: import("vue").PropType<string[]>;
4454
+ default: () => never[];
4455
+ };
4411
4456
  }>> & {
4412
4457
  onFormChange?: ((...args: any[]) => any) | undefined;
4413
4458
  onCopy?: ((...args: any[]) => any) | undefined;
@@ -4471,6 +4516,7 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
4471
4516
  onActiveCellChangeEnd?: ((...args: any[]) => any) | undefined;
4472
4517
  onSettingClick?: ((...args: any[]) => any) | undefined;
4473
4518
  }, {
4519
+ anchorList: string[];
4474
4520
  fieldList: import("../../../es/components/iho-table/src/types").LowCodeTableFieldItem[];
4475
4521
  tableConfig: import("../../../es/components/iho-table/src/types").IhoTableConfig;
4476
4522
  tableData: import("../../../es/shared/types").AnyObject[];
@@ -18,6 +18,7 @@ import '../../shared/utils/tapable/AsyncSeriesWaterfallHook.js';
18
18
  export { AbstractConfigHooks, AbstractDataHooks, AbstractEventHooks, AbstractFieldHooks, AbstractSetupHooks } from './src/types/pluginType.js';
19
19
  import { useTablePlugin } from './src/hooks/useTablePlugin.js';
20
20
  export { defineTablePlugin, useTablePlugin } from './src/hooks/useTablePlugin.js';
21
+ import '@vueuse/core';
21
22
 
22
23
  const { use } = useTablePlugin();
23
24
  const useIhoTablePresetPlugins = (instance) => {
@@ -1,11 +1,13 @@
1
- import { defineComponent, provide, ref, computed, watch, resolveComponent, openBlock, createElementBlock, createVNode, mergeProps, unref, withCtx, Fragment, renderList, createBlock } from 'vue';
1
+ import { defineComponent, provide, ref, computed, watch, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, unref, isRef, createElementVNode, mergeProps, withCtx, renderList, createBlock } from 'vue';
2
2
  import { uuidGenerator } from '../../../shared/utils/index.js';
3
3
  import { useDebounceFn } from '@vueuse/core';
4
- import { VxeEventListenerNameList, InjectionIhoTableEmits, InjectionIhoTableUUID, InjectionIhoTableConfig, InjectionIhoTableHandler } from './constants/index.js';
4
+ import { VxeEventListenerNameList, InjectionIhoTableEmits, InjectionIhoTableUUID, InjectionIhoTableConfig, InjectionIhoTableFieldList, InjectionIhoTableHandler } from './constants/index.js';
5
5
  import { createTableHooks, applyTableConfigHooks, applyTableFieldHooks, createTableEventHandlers, createDataTransfer } from './hooks/tapHooks/index.js';
6
6
  import 'lodash-es';
7
+ import { useAnchor } from './hooks/useAnchor.js';
7
8
  import { getEventName } from './utils/index.js';
8
9
  import ColumnComponent from './components/IhoTableColumn.js';
10
+ import ColumnAnchor from './components/ColumnAnchor.js';
9
11
  import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
10
12
 
11
13
  const _hoisted_1 = { class: "iho-table" };
@@ -14,7 +16,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
16
  props: {
15
17
  tableConfig: { type: Object, default: () => ({}) },
16
18
  fieldList: { type: Array, default: () => [] },
17
- tableData: { type: Array, default: () => [] }
19
+ tableData: { type: Array, default: () => [] },
20
+ anchorList: { type: Array, default: () => [] }
18
21
  },
19
22
  emits: [
20
23
  "formChange",
@@ -37,6 +40,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
37
40
  configRef.value.uuid = uuidRef.value;
38
41
  }, 10);
39
42
  const fieldListRef = ref([]);
43
+ provide(InjectionIhoTableFieldList, fieldListRef);
40
44
  const updateFieldListRef = useDebounceFn(() => {
41
45
  fieldListRef.value = applyTableFieldHooks(hooks, props.fieldList, configRef.value);
42
46
  }, 10);
@@ -57,6 +61,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
61
  emits
58
62
  });
59
63
  const bindProperties = computed(() => ({ ...configRef.value, ...eventHookHandler }));
64
+ const { onScroll, updateAnchor, currentAnchorList, anchorValue } = useAnchor(props.anchorList, $table, fieldListRef);
60
65
  watch(
61
66
  () => props.tableConfig,
62
67
  () => {
@@ -79,25 +84,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
79
84
  hooks.setupHooks.setup.call(configRef, fieldListRef);
80
85
  return (_ctx, _cache) => {
81
86
  const _component_vxe_table = resolveComponent("vxe-table");
82
- return openBlock(), createElementBlock("section", _hoisted_1, [
83
- createVNode(_component_vxe_table, mergeProps({
84
- ref_key: "$table",
85
- ref: $table
86
- }, unref(bindProperties), {
87
- eventHookHandler: "",
88
- data: tableDataRef.value
89
- }), {
90
- default: withCtx(() => [
91
- (openBlock(true), createElementBlock(Fragment, null, renderList(fieldListRef.value, (field) => {
92
- return openBlock(), createBlock(unref(ColumnComponent), {
93
- key: field.field,
94
- field
95
- }, null, 8, ["field"]);
96
- }), 128))
97
- ]),
98
- _: 1
99
- }, 16, ["data"])
100
- ]);
87
+ return openBlock(), createElementBlock(Fragment, null, [
88
+ createVNode(unref(ColumnAnchor), {
89
+ "anchor-list": unref(currentAnchorList),
90
+ value: unref(anchorValue),
91
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => isRef(anchorValue) ? anchorValue.value = $event : null),
92
+ onUpdateAnchor: unref(updateAnchor)
93
+ }, null, 8, ["anchor-list", "value", "onUpdateAnchor"]),
94
+ createElementVNode("section", _hoisted_1, [
95
+ createVNode(_component_vxe_table, mergeProps({
96
+ ref_key: "$table",
97
+ ref: $table
98
+ }, unref(bindProperties), {
99
+ eventHookHandler: "",
100
+ data: tableDataRef.value,
101
+ onScroll: unref(onScroll)
102
+ }), {
103
+ default: withCtx(() => [
104
+ (openBlock(true), createElementBlock(Fragment, null, renderList(fieldListRef.value, (field) => {
105
+ return openBlock(), createBlock(unref(ColumnComponent), {
106
+ key: field.field,
107
+ field
108
+ }, null, 8, ["field"]);
109
+ }), 128))
110
+ ]),
111
+ _: 1
112
+ }, 16, ["data", "onScroll"])
113
+ ])
114
+ ], 64);
101
115
  };
102
116
  }
103
117
  });
@@ -15,6 +15,10 @@ declare const _default: import("vue").DefineComponent<{
15
15
  type: PropType<AnyObject[]>;
16
16
  default: () => never[];
17
17
  };
18
+ anchorList: {
19
+ type: PropType<string[]>;
20
+ default: () => never[];
21
+ };
18
22
  }, {
19
23
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
20
24
  tableConfig: {
@@ -29,6 +33,10 @@ declare const _default: import("vue").DefineComponent<{
29
33
  type: PropType<AnyObject[]>;
30
34
  default: () => never[];
31
35
  };
36
+ anchorList: {
37
+ type: PropType<string[]>;
38
+ default: () => never[];
39
+ };
32
40
  }>> & {
33
41
  onFormChange?: ((...args: any[]) => any) | undefined;
34
42
  onCopy?: ((...args: any[]) => any) | undefined;
@@ -4383,6 +4391,14 @@ declare const _default: import("vue").DefineComponent<{
4383
4391
  }[] | undefined;
4384
4392
  } | undefined;
4385
4393
  }>;
4394
+ onScroll: (params: any) => void;
4395
+ updateAnchor: (field: string) => Promise<void>;
4396
+ currentAnchorList: import("vue").Ref<{
4397
+ field: string;
4398
+ title: string;
4399
+ left: number;
4400
+ }[]>;
4401
+ anchorValue: import("vue").Ref<any>;
4386
4402
  IhoTableColumn: import("vue").DefineComponent<{
4387
4403
  field: {
4388
4404
  type: PropType<IhoTableFieldItem>;
@@ -4394,6 +4410,31 @@ declare const _default: import("vue").DefineComponent<{
4394
4410
  required: true;
4395
4411
  };
4396
4412
  }>>, {}>;
4413
+ ColumnAnchor: import("vue").DefineComponent<{
4414
+ anchorList: {
4415
+ type: PropType<import("../../../../es/components/iho-table/src/types").IanchorObj[]>;
4416
+ default: () => never[];
4417
+ };
4418
+ value: {
4419
+ type: StringConstructor;
4420
+ default: string;
4421
+ };
4422
+ }, () => JSX.Element | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "updateAnchor")[], "updateAnchor" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
4423
+ anchorList: {
4424
+ type: PropType<import("../../../../es/components/iho-table/src/types").IanchorObj[]>;
4425
+ default: () => never[];
4426
+ };
4427
+ value: {
4428
+ type: StringConstructor;
4429
+ default: string;
4430
+ };
4431
+ }>> & {
4432
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
4433
+ onUpdateAnchor?: ((...args: any[]) => any) | undefined;
4434
+ }, {
4435
+ anchorList: import("../../../../es/components/iho-table/src/types").IanchorObj[];
4436
+ value: string;
4437
+ }>;
4397
4438
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("toggleRowExpand" | "toggleTreeExpand" | "copy" | "scroll" | "formChange" | "settingClick" | "cut" | "paste" | "keydown" | "keydownStart" | "keydownEnd" | "currentChange" | "radioChange" | "checkboxChange" | "checkboxAll" | "checkboxRangeStart" | "checkboxRangeChange" | "checkboxRangeEnd" | "cellClick" | "cellDblclick" | "cellMenu" | "cellMouseenter" | "cellMouseleave" | "headerCellClick" | "headerCellDblclick" | "headerCellMenu" | "footerCellClick" | "footerCellDblclick" | "footerCellMenu" | "sortChange" | "filterChange" | "filterVisible" | "resizableChange" | "menuClick" | "editClosed" | "editActived" | "editDisabled" | "validError" | "custom" | "openFnr" | "fnrChange" | "fnrFind" | "fnrFindAll" | "fnrReplace" | "fnrReplaceAll" | "cellAreaCopy" | "cellAreaCut" | "cellAreaPaste" | "cellAreaMerge" | "clearCellAreaMerge" | "headerCellAreaSelection" | "cellAreaSelectionStart" | "cellAreaSelectionDrag" | "cellAreaSelectionEnd" | "cellAreaExtensionStart" | "cellAreaExtensionDrag" | "cellAreaExtensionEnd" | "cellAreaArrowsStart" | "cellAreaArrowsEnd" | "activeCellChangeStart" | "activeCellChangeEnd")[], "toggleRowExpand" | "toggleTreeExpand" | "copy" | "scroll" | "formChange" | "settingClick" | "cut" | "paste" | "keydown" | "keydownStart" | "keydownEnd" | "currentChange" | "radioChange" | "checkboxChange" | "checkboxAll" | "checkboxRangeStart" | "checkboxRangeChange" | "checkboxRangeEnd" | "cellClick" | "cellDblclick" | "cellMenu" | "cellMouseenter" | "cellMouseleave" | "headerCellClick" | "headerCellDblclick" | "headerCellMenu" | "footerCellClick" | "footerCellDblclick" | "footerCellMenu" | "sortChange" | "filterChange" | "filterVisible" | "resizableChange" | "menuClick" | "editClosed" | "editActived" | "editDisabled" | "validError" | "custom" | "openFnr" | "fnrChange" | "fnrFind" | "fnrFindAll" | "fnrReplace" | "fnrReplaceAll" | "cellAreaCopy" | "cellAreaCut" | "cellAreaPaste" | "cellAreaMerge" | "clearCellAreaMerge" | "headerCellAreaSelection" | "cellAreaSelectionStart" | "cellAreaSelectionDrag" | "cellAreaSelectionEnd" | "cellAreaExtensionStart" | "cellAreaExtensionDrag" | "cellAreaExtensionEnd" | "cellAreaArrowsStart" | "cellAreaArrowsEnd" | "activeCellChangeStart" | "activeCellChangeEnd", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
4398
4439
  tableConfig: {
4399
4440
  type: PropType<IhoTableConfig>;
@@ -4407,6 +4448,10 @@ declare const _default: import("vue").DefineComponent<{
4407
4448
  type: PropType<AnyObject[]>;
4408
4449
  default: () => never[];
4409
4450
  };
4451
+ anchorList: {
4452
+ type: PropType<string[]>;
4453
+ default: () => never[];
4454
+ };
4410
4455
  }>> & {
4411
4456
  onFormChange?: ((...args: any[]) => any) | undefined;
4412
4457
  onCopy?: ((...args: any[]) => any) | undefined;
@@ -4470,6 +4515,7 @@ declare const _default: import("vue").DefineComponent<{
4470
4515
  onActiveCellChangeEnd?: ((...args: any[]) => any) | undefined;
4471
4516
  onSettingClick?: ((...args: any[]) => any) | undefined;
4472
4517
  }, {
4518
+ anchorList: string[];
4473
4519
  fieldList: LowCodeTableFieldItem[];
4474
4520
  tableConfig: IhoTableConfig;
4475
4521
  tableData: AnyObject[];
@@ -0,0 +1,28 @@
1
+ import { PropType } from 'vue';
2
+ import { IanchorObj } from '../../../../../es/components/iho-table/src/types';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ anchorList: {
5
+ type: PropType<IanchorObj[]>;
6
+ default: () => never[];
7
+ };
8
+ value: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ }, () => JSX.Element | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "updateAnchor")[], "updateAnchor" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
13
+ anchorList: {
14
+ type: PropType<IanchorObj[]>;
15
+ default: () => never[];
16
+ };
17
+ value: {
18
+ type: StringConstructor;
19
+ default: string;
20
+ };
21
+ }>> & {
22
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
23
+ onUpdateAnchor?: ((...args: any[]) => any) | undefined;
24
+ }, {
25
+ anchorList: IanchorObj[];
26
+ value: string;
27
+ }>;
28
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import { defineComponent, createVNode, isVNode } from 'vue';
2
+ import { NTabs, NTabPane } from 'naive-ui';
3
+
4
+ function _isSlot(s) {
5
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
6
+ }
7
+ var ColumnAnchor = defineComponent({
8
+ name: "ColumnAnchor",
9
+ props: {
10
+ anchorList: {
11
+ type: Array,
12
+ default: () => []
13
+ },
14
+ value: {
15
+ type: String,
16
+ default: ""
17
+ }
18
+ },
19
+ emits: ["update:value", "updateAnchor"],
20
+ setup(props, {
21
+ attrs,
22
+ slots,
23
+ emit
24
+ }) {
25
+ function onUpdatedValue(value) {
26
+ emit("update:value", value);
27
+ emit("updateAnchor", value);
28
+ }
29
+ return () => {
30
+ let _slot;
31
+ return props.anchorList.length > 0 ? createVNode(NTabs, {
32
+ "type": "line",
33
+ "animated": true,
34
+ "pane-style": "padding: 0",
35
+ "value": props.value,
36
+ "onUpdate:value": onUpdatedValue
37
+ }, _isSlot(_slot = props.anchorList.map((field) => createVNode(NTabPane, {
38
+ "name": field.field,
39
+ "tab": field.title
40
+ }, null))) ? _slot : {
41
+ default: () => [_slot]
42
+ }) : null;
43
+ };
44
+ }
45
+ });
46
+
47
+ export { ColumnAnchor as default };
@@ -1 +1,2 @@
1
1
  export { default as IhoTableColumn } from './IhoTableColumn';
2
+ export { default as ColumnAnchor } from './ColumnAnchor';
@@ -1 +1,2 @@
1
1
  export { default as IhoTableColumn } from './IhoTableColumn.js';
2
+ export { default as ColumnAnchor } from './ColumnAnchor.js';
@@ -1,7 +1,7 @@
1
- import { Nullable } from '../../../../../es/shared/types';
1
+ import { Nullable, UnionToTuple } from '../../../../../es/shared/types';
2
2
  import { InjectionKey, Ref } from 'vue';
3
3
  import { VxeTableEventProps } from 'vxe-table/types/table';
4
- import { IhoTableConfig, IhoTableHandler, UnionToTuple } from '../../../../../es/components/iho-table';
4
+ import { IhoTableConfig, IhoTableEmitPayload, IhoTableFieldItem, IhoTableHandler } from '../../../../../es/components/iho-table';
5
5
  export declare enum WIDGET_TYPE {
6
6
  DEFAULT = "DEFAULT",
7
7
  PICTURE = "PICTURE",
@@ -46,7 +46,9 @@ export declare enum EDITABLE_WIDGET_TYPE {
46
46
  TIME = "TIME",
47
47
  NUMBER = "NUMBER"
48
48
  }
49
+ export declare const IhoTableEventNameTuple: readonly ["formChange", "settingClick", ...("toggleRowExpand" | "toggleTreeExpand" | "copy" | "scroll" | "cut" | "paste" | "keydown" | "keydownStart" | "keydownEnd" | "currentChange" | "radioChange" | "checkboxChange" | "checkboxAll" | "checkboxRangeStart" | "checkboxRangeChange" | "checkboxRangeEnd" | "cellClick" | "cellDblclick" | "cellMenu" | "cellMouseenter" | "cellMouseleave" | "headerCellClick" | "headerCellDblclick" | "headerCellMenu" | "footerCellClick" | "footerCellDblclick" | "footerCellMenu" | "sortChange" | "filterChange" | "filterVisible" | "resizableChange" | "menuClick" | "editClosed" | "editActived" | "editDisabled" | "validError" | "custom" | "openFnr" | "fnrChange" | "fnrFind" | "fnrFindAll" | "fnrReplace" | "fnrReplaceAll" | "cellAreaCopy" | "cellAreaCut" | "cellAreaPaste" | "cellAreaMerge" | "clearCellAreaMerge" | "headerCellAreaSelection" | "cellAreaSelectionStart" | "cellAreaSelectionDrag" | "cellAreaSelectionEnd" | "cellAreaExtensionStart" | "cellAreaExtensionDrag" | "cellAreaExtensionEnd" | "cellAreaArrowsStart" | "cellAreaArrowsEnd" | "activeCellChangeStart" | "activeCellChangeEnd")[]];
49
50
  export declare const InjectionIhoTableConfig: InjectionKey<Ref<Nullable<IhoTableConfig>>>;
50
- export declare const InjectionIhoTableEmits: InjectionKey<(event: string, ...args: unknown[]) => void>;
51
+ export declare const InjectionIhoTableFieldList: InjectionKey<Ref<Nullable<IhoTableFieldItem[]>>>;
52
+ export declare const InjectionIhoTableEmits: InjectionKey<(<T extends typeof IhoTableEventNameTuple[number]>(event: T, ...args: IhoTableEmitPayload<T>) => void)>;
51
53
  export declare const InjectionIhoTableUUID: InjectionKey<Ref<string>>;
52
54
  export declare const InjectionIhoTableHandler: InjectionKey<IhoTableHandler>;
@@ -1,3 +1,5 @@
1
+ import { getEventName } from '../utils/index.js';
2
+
1
3
  var WIDGET_TYPE = /* @__PURE__ */ ((WIDGET_TYPE2) => {
2
4
  WIDGET_TYPE2["DEFAULT"] = "DEFAULT";
3
5
  WIDGET_TYPE2["PICTURE"] = "PICTURE";
@@ -115,9 +117,15 @@ var EDITABLE_WIDGET_TYPE = /* @__PURE__ */ ((EDITABLE_WIDGET_TYPE2) => {
115
117
  EDITABLE_WIDGET_TYPE2["NUMBER"] = "NUMBER";
116
118
  return EDITABLE_WIDGET_TYPE2;
117
119
  })(EDITABLE_WIDGET_TYPE || {});
120
+ const IhoTableEventNameTuple = [
121
+ "formChange",
122
+ "settingClick",
123
+ ...VxeEventListenerNameList.map(getEventName)
124
+ ];
118
125
  const InjectionIhoTableConfig = Symbol("injectionIhoTableConfig");
126
+ const InjectionIhoTableFieldList = Symbol("injectionIhoTableFieldList");
119
127
  const InjectionIhoTableEmits = Symbol("InjectionIhoTableEmits");
120
128
  const InjectionIhoTableUUID = Symbol("InjectionIhoTableUUID");
121
129
  const InjectionIhoTableHandler = Symbol("InjectionIhoTableHandler");
122
130
 
123
- export { EDITABLE_WIDGET_TYPE, HIGHEST_PRIORITY, IhoTableRowGroupSequence, InjectionIhoTableConfig, InjectionIhoTableEmits, InjectionIhoTableHandler, InjectionIhoTableUUID, VxeEventListenerNameList, WIDGET_TYPE };
131
+ export { EDITABLE_WIDGET_TYPE, HIGHEST_PRIORITY, IhoTableEventNameTuple, IhoTableRowGroupSequence, InjectionIhoTableConfig, InjectionIhoTableEmits, InjectionIhoTableFieldList, InjectionIhoTableHandler, InjectionIhoTableUUID, VxeEventListenerNameList, WIDGET_TYPE };
@@ -1,2 +1,3 @@
1
1
  export * from './tapHooks';
2
2
  export * from './useTablePlugin';
3
+ export * from './useAnchor';
@@ -1,2 +1,3 @@
1
1
  export { applyTableConfigHooks, applyTableFieldHooks, createDataTransfer, createTableEventHandlers, createTableHooks } from './tapHooks/index.js';
2
2
  export { defineTablePlugin, useTablePlugin } from './useTablePlugin.js';
3
+ export { useAnchor } from './useAnchor.js';
@@ -0,0 +1,13 @@
1
+ import { Ref } from 'vue';
2
+ import { VxeTableInstance } from 'vxe-table';
3
+ import { IhoTableFieldItem } from '../../../../../es/components/iho-table/src/types';
4
+ export declare const useAnchor: (anchorList: string[], $table: Ref<VxeTableInstance | undefined>, fieldListRef: Ref<IhoTableFieldItem[]>) => {
5
+ updateAnchor: (field: string) => Promise<void>;
6
+ onScroll: (params: any) => void;
7
+ currentAnchorList: Ref<{
8
+ field: string;
9
+ title: string;
10
+ left: number;
11
+ }[]>;
12
+ anchorValue: Ref<any>;
13
+ };
@@ -0,0 +1,66 @@
1
+ import { ref, watch } from 'vue';
2
+ import { useThrottleFn } from '@vueuse/core';
3
+
4
+ const useAnchor = (anchorList, $table, fieldListRef) => {
5
+ const currentAnchorList = ref([]);
6
+ const anchorValue = ref();
7
+ let setAnchorStatus = true;
8
+ function initAnchor() {
9
+ var _a, _b;
10
+ if (anchorList == null ? void 0 : anchorList.length) {
11
+ let left = 0;
12
+ fieldListRef.value.forEach((column) => {
13
+ const { field, minWidth, width, fixed, title, visible } = column;
14
+ const colWidth = +(minWidth || width);
15
+ if (fixed == "left") ; else {
16
+ left += colWidth;
17
+ const anchorObj = anchorList.find((fieldItem) => fieldItem === field);
18
+ anchorObj && visible && currentAnchorList.value.push({
19
+ field,
20
+ title,
21
+ left: left - colWidth
22
+ });
23
+ }
24
+ });
25
+ anchorValue.value = ((_b = (_a = currentAnchorList.value) == null ? void 0 : _a[0]) == null ? void 0 : _b.field) || "";
26
+ }
27
+ }
28
+ async function updateAnchor(field) {
29
+ var _a, _b;
30
+ setAnchorStatus = false;
31
+ const anchorObj = currentAnchorList.value.find((fieldItem) => fieldItem.field === field);
32
+ if (anchorObj) {
33
+ await ((_b = $table.value) == null ? void 0 : _b.scrollTo((_a = anchorObj.left) != null ? _a : 0));
34
+ setTimeout(() => {
35
+ setAnchorStatus = true;
36
+ });
37
+ }
38
+ }
39
+ function setAnchorValue({ scrollLeft }) {
40
+ if (currentAnchorList.value.length && setAnchorStatus) {
41
+ const anchorObj = currentAnchorList.value.find((fieldItem) => scrollLeft < (fieldItem == null ? void 0 : fieldItem.left));
42
+ if (anchorObj) {
43
+ anchorValue.value = anchorObj.field;
44
+ }
45
+ }
46
+ }
47
+ const anchorEvent = useThrottleFn(setAnchorValue, 800);
48
+ function onScroll(params) {
49
+ anchorEvent(params);
50
+ }
51
+ watch(
52
+ () => fieldListRef.value,
53
+ (value) => {
54
+ initAnchor();
55
+ },
56
+ { immediate: true }
57
+ );
58
+ return {
59
+ updateAnchor,
60
+ onScroll,
61
+ currentAnchorList,
62
+ anchorValue
63
+ };
64
+ };
65
+
66
+ export { useAnchor };
@@ -0,0 +1,7 @@
1
+ export declare function useTableContext(): {
2
+ configRef: import("vue").Ref<import("../../../../shared/types").Nullable<import("../types").IhoTableConfig>> | undefined;
3
+ fieldListRef: import("vue").Ref<import("../../../../shared/types").Nullable<import("../types").IhoTableFieldItem[]>> | undefined;
4
+ tableHandler: import("../types").IhoTableHandler | undefined;
5
+ tableEmit: (<T extends "toggleRowExpand" | "toggleTreeExpand" | "copy" | "scroll" | "formChange" | "settingClick" | "cut" | "paste" | "keydown" | "keydownStart" | "keydownEnd" | "currentChange" | "radioChange" | "checkboxChange" | "checkboxAll" | "checkboxRangeStart" | "checkboxRangeChange" | "checkboxRangeEnd" | "cellClick" | "cellDblclick" | "cellMenu" | "cellMouseenter" | "cellMouseleave" | "headerCellClick" | "headerCellDblclick" | "headerCellMenu" | "footerCellClick" | "footerCellDblclick" | "footerCellMenu" | "sortChange" | "filterChange" | "filterVisible" | "resizableChange" | "menuClick" | "editClosed" | "editActived" | "editDisabled" | "validError" | "custom" | "openFnr" | "fnrChange" | "fnrFind" | "fnrFindAll" | "fnrReplace" | "fnrReplaceAll" | "cellAreaCopy" | "cellAreaCut" | "cellAreaPaste" | "cellAreaMerge" | "clearCellAreaMerge" | "headerCellAreaSelection" | "cellAreaSelectionStart" | "cellAreaSelectionDrag" | "cellAreaSelectionEnd" | "cellAreaExtensionStart" | "cellAreaExtensionDrag" | "cellAreaExtensionEnd" | "cellAreaArrowsStart" | "cellAreaArrowsEnd" | "activeCellChangeStart" | "activeCellChangeEnd">(event: T, ...args: import("../types").IhoTableEmitPayload<T>) => void) | undefined;
6
+ uuid: import("vue").Ref<string> | undefined;
7
+ };
@@ -0,0 +1,15 @@
1
+ import { getCurrentInstance, inject } from 'vue';
2
+ import { InjectionIhoTableConfig, InjectionIhoTableFieldList, InjectionIhoTableHandler, InjectionIhoTableUUID, InjectionIhoTableEmits } from '../constants/index.js';
3
+
4
+ function useTableContext() {
5
+ if (!getCurrentInstance())
6
+ throw new Error("useTableContext can only be used in setup environment");
7
+ const configRef = inject(InjectionIhoTableConfig);
8
+ const fieldListRef = inject(InjectionIhoTableFieldList);
9
+ const tableHandler = inject(InjectionIhoTableHandler);
10
+ const uuid = inject(InjectionIhoTableUUID);
11
+ const tableEmit = inject(InjectionIhoTableEmits);
12
+ return { configRef, fieldListRef, tableHandler, tableEmit, uuid };
13
+ }
14
+
15
+ export { useTableContext };