cnhis-design-vue 3.1.31-beta.3 → 3.1.31-beta.4

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 (57) hide show
  1. package/es/components/button-print/index.d.ts +1 -1
  2. package/es/components/button-print/src/ButtonPrint.vue.d.ts +1 -1
  3. package/es/components/button-print/src/components/{edit.js → EditFormat.js} +3 -3
  4. package/es/components/button-print/src/components/{edit.vue.d.ts → EditFormat.vue.d.ts} +0 -0
  5. package/es/components/button-print/src/components/IdentityVerification.js +2 -2
  6. package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +1 -1
  7. package/es/components/button-print/src/components/Preview.js +6 -0
  8. package/es/components/button-print/src/components/Preview.vue.d.ts +41 -0
  9. package/es/components/button-print/src/components/Preview.vue_vue_type_script_setup_true_lang.js +67 -0
  10. package/es/components/button-print/src/utils/browserPrint.d.ts +1 -1
  11. package/es/components/button-print/src/utils/browserPrint.js +1 -2
  12. package/es/components/button-print/src/utils/dialog.d.ts +5 -1
  13. package/es/components/button-print/src/utils/dialog.js +64 -22
  14. package/es/components/button-print/src/utils/print.d.ts +4 -1
  15. package/es/components/button-print/src/utils/print.js +11 -2
  16. package/es/components/button-print/style/index.css +1 -1
  17. package/es/components/iho-table/index.d.ts +124 -66
  18. package/es/components/iho-table/src/IhoTable.js +2 -1
  19. package/es/components/iho-table/src/IhoTable.vue.d.ts +124 -66
  20. package/es/components/iho-table/src/components/IhoTableColumn.js +14 -11
  21. package/es/components/iho-table/src/constants/index.d.ts +5 -3
  22. package/es/components/iho-table/src/constants/index.js +5 -3
  23. package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +64 -5
  24. package/es/components/iho-table/src/hooks/tapHooks/index.js +17 -9
  25. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.d.ts +60 -1
  26. package/es/components/iho-table/src/hooks/useTableContext.d.ts +1 -1
  27. package/es/components/iho-table/src/plugins/anchorPlugin/useAnchor.js +3 -2
  28. package/es/components/iho-table/src/plugins/filterPlugin/filter.js +1 -0
  29. package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.d.ts +1 -1
  30. package/es/components/iho-table/src/plugins/index.js +14 -12
  31. package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.d.ts +1 -0
  32. package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +32 -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/dateRendererPlugin/index.js +9 -11
  35. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js +11 -15
  36. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +17 -24
  37. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +11 -13
  38. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/editSeparate.js +2 -1
  39. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/editSeparate.vue.d.ts +1 -1
  40. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +8 -11
  41. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin.js +13 -17
  42. package/es/components/iho-table/src/types/index.d.ts +6 -6
  43. package/es/components/iho-table/src/types/pluginType.d.ts +2 -1
  44. package/es/components/iho-table/src/utils/index.d.ts +12 -2
  45. package/es/components/iho-table/src/utils/index.js +33 -2
  46. package/es/components/iho-table/style/index.css +1 -1
  47. package/es/components/index.css +1 -1
  48. package/es/components/keyboard/index.d.ts +113 -63
  49. package/es/components/keyboard/src/Keyboard.js +108 -252
  50. package/es/components/keyboard/src/Keyboard.vue.d.ts +115 -65
  51. package/es/components/keyboard/src/components/InputNumber.vue.d.ts +6 -4
  52. package/es/components/keyboard/src/components/NumberPanel.js +206 -0
  53. package/es/components/keyboard/src/components/NumberPanel.vue.d.ts +118 -0
  54. package/es/components/search-cascader/src/components/SearchMenu.js +5 -5
  55. package/es/shared/utils/index.d.ts +1 -1
  56. package/es/shared/utils/index.js +3 -3
  57. package/package.json +2 -2
@@ -1,12 +1,13 @@
1
1
  import * as index from './anchorPlugin/index.js';
2
2
  import * as index$1 from './defaultConfigPlugin/index.js';
3
3
  import * as index$2 from './filterPlugin/index.js';
4
- import * as index$3 from './lowCodeFieldAdaptorPlugin/index.js';
5
- import * as index$4 from './rendererPlugins/editableWidgets/dateRendererPlugin/index.js';
4
+ import * as index$3 from './keyboardEventPlugin/index.js';
5
+ import * as index$4 from './lowCodeFieldAdaptorPlugin/index.js';
6
+ import * as index$5 from './rendererPlugins/editableWidgets/dateRendererPlugin/index.js';
6
7
  import * as inputRendererPlugin from './rendererPlugins/editableWidgets/inputRendererPlugin.js';
7
8
  import * as numberRendererPlugin from './rendererPlugins/editableWidgets/numberRendererPlugin.js';
8
- import * as index$5 from './rendererPlugins/editableWidgets/selectRendererPlugin/index.js';
9
- import * as index$6 from './rendererPlugins/editableWidgets/separateRendererPlugin/index.js';
9
+ import * as index$6 from './rendererPlugins/editableWidgets/selectRendererPlugin/index.js';
10
+ import * as index$7 from './rendererPlugins/editableWidgets/separateRendererPlugin/index.js';
10
11
  import * as timeRendererPlugin from './rendererPlugins/editableWidgets/timeRendererPlugin.js';
11
12
  import * as checkRendererPlugin from './rendererPlugins/widgets/checkRendererPlugin.js';
12
13
  import * as colorRendererPlugin from './rendererPlugins/widgets/colorRendererPlugin.js';
@@ -14,20 +15,21 @@ import * as defaultRendererPlugin from './rendererPlugins/widgets/defaultRendere
14
15
  import * as labelRendererPlugin from './rendererPlugins/widgets/labelRendererPlugin.js';
15
16
  import * as pictureRendererPlugin from './rendererPlugins/widgets/pictureRendererPlugin.js';
16
17
  import * as seqRendererPlugin from './rendererPlugins/widgets/seqRendererPlugin.js';
17
- import * as index$7 from './rowGroupSettingPlugin/index.js';
18
- import * as index$8 from './virtualTreePlugin/index.js';
18
+ import * as index$8 from './rowGroupSettingPlugin/index.js';
19
+ import * as index$9 from './virtualTreePlugin/index.js';
19
20
  import { separateMetaModule } from '../../../../shared/utils/index.js';
20
21
 
21
22
  const modules = Object.assign({
22
23
  "./anchorPlugin/index.tsx": index,
23
24
  "./defaultConfigPlugin/index.ts": index$1,
24
25
  "./filterPlugin/index.ts": index$2,
25
- "./lowCodeFieldAdaptorPlugin/index.ts": index$3,
26
- "./rendererPlugins/editableWidgets/dateRendererPlugin/index.tsx": index$4,
26
+ "./keyboardEventPlugin/index.ts": index$3,
27
+ "./lowCodeFieldAdaptorPlugin/index.ts": index$4,
28
+ "./rendererPlugins/editableWidgets/dateRendererPlugin/index.tsx": index$5,
27
29
  "./rendererPlugins/editableWidgets/inputRendererPlugin.tsx": inputRendererPlugin,
28
30
  "./rendererPlugins/editableWidgets/numberRendererPlugin.tsx": numberRendererPlugin,
29
- "./rendererPlugins/editableWidgets/selectRendererPlugin/index.tsx": index$5,
30
- "./rendererPlugins/editableWidgets/separateRendererPlugin/index.tsx": index$6,
31
+ "./rendererPlugins/editableWidgets/selectRendererPlugin/index.tsx": index$6,
32
+ "./rendererPlugins/editableWidgets/separateRendererPlugin/index.tsx": index$7,
31
33
  "./rendererPlugins/editableWidgets/timeRendererPlugin.tsx": timeRendererPlugin,
32
34
  "./rendererPlugins/widgets/checkRendererPlugin.tsx": checkRendererPlugin,
33
35
  "./rendererPlugins/widgets/colorRendererPlugin.tsx": colorRendererPlugin,
@@ -35,8 +37,8 @@ const modules = Object.assign({
35
37
  "./rendererPlugins/widgets/labelRendererPlugin.tsx": labelRendererPlugin,
36
38
  "./rendererPlugins/widgets/pictureRendererPlugin.tsx": pictureRendererPlugin,
37
39
  "./rendererPlugins/widgets/seqRendererPlugin.tsx": seqRendererPlugin,
38
- "./rowGroupSettingPlugin/index.ts": index$7,
39
- "./virtualTreePlugin/index.ts": index$8
40
+ "./rowGroupSettingPlugin/index.ts": index$8,
41
+ "./virtualTreePlugin/index.ts": index$9
40
42
  });
41
43
  var PluginPresets = separateMetaModule(modules);
42
44
 
@@ -0,0 +1 @@
1
+ export declare function keyboardEventPlugin(): import("../../../../../../es/components/iho-table").TablePlugin;
@@ -0,0 +1,32 @@
1
+ import { targetStringIncludes } from '../../../../../shared/utils/index.js';
2
+ import { promiseTimeout } from '@vueuse/shared';
3
+ import '../../../index.js';
4
+ import { defineTablePlugin } from '../../hooks/useTablePlugin.js';
5
+
6
+ function keyboardEventPlugin() {
7
+ const pluginName = "keyboardEventPlugin";
8
+ return defineTablePlugin({
9
+ name: pluginName,
10
+ apply(hooks) {
11
+ hooks.eventHooks.onKeydown.tap(pluginName, async ({ $event, $table }, { emits }) => {
12
+ await promiseTimeout(0);
13
+ const activeCellInfo = $table.getSelectedCell();
14
+ const editCellInfo = $table.getEditRecord();
15
+ const { row, column } = activeCellInfo || editCellInfo;
16
+ if (!row || !column)
17
+ return;
18
+ const key = $event.key;
19
+ !targetStringIncludes(["Arrow", "Escape", "Control", "Shift", "Alt", "Meta"], key) && await $table.setEditCell(row, column);
20
+ emits("keyboard", {
21
+ key,
22
+ index: $table.getRowIndex(row),
23
+ value: row[column.field],
24
+ row,
25
+ column
26
+ });
27
+ });
28
+ }
29
+ });
30
+ }
31
+
32
+ export { keyboardEventPlugin };
@@ -42,7 +42,7 @@ declare const _default: import("vue").DefineComponent<{
42
42
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
43
43
  }>>;
44
44
  emit: (event: "update:value", ...args: any[]) => void;
45
- globEmit: <T extends "toggleRowExpand" | "toggleTreeExpand" | "copy" | "scroll" | "formChange" | "settingClick" | "formClick" | "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("../../../../../../../../es/components/iho-table").IhoTableEmitPayload<T>) => void;
45
+ globEmit: import("../../../../../../../../es/components/iho-table").IhoTableEmits;
46
46
  formRef: import("vue").Ref<HTMLElement | null>;
47
47
  isShow: import("vue").Ref<boolean>;
48
48
  formattedValue: import("vue").Ref<string | undefined>;
@@ -1,6 +1,7 @@
1
- import { createVNode, inject, mergeProps } from 'vue';
1
+ import { createVNode, mergeProps } from 'vue';
2
2
  import '../../../../../index.js';
3
- import { EDITABLE_WIDGET_TYPE, InjectionIhoTableEmits } from '../../../../constants/index.js';
3
+ import { EDITABLE_WIDGET_TYPE } from '../../../../constants/index.js';
4
+ import { useIhoTableFormEvent } from '../../../../utils/index.js';
4
5
  import EditDate from './editDate.js';
5
6
  import { defineTablePlugin } from '../../../../hooks/useTablePlugin.js';
6
7
 
@@ -25,16 +26,13 @@ function dateRendererPlugin() {
25
26
  column,
26
27
  $rowIndex
27
28
  }) {
28
- const globEmit = inject(InjectionIhoTableEmits);
29
- const common = {
30
- value: row[column.field],
29
+ const {
30
+ emitFormClick
31
+ } = useIhoTableFormEvent({
31
32
  row,
32
33
  column,
33
- index: $rowIndex
34
- };
35
- function onClick() {
36
- globEmit("formClick", common);
37
- }
34
+ $rowIndex
35
+ });
38
36
  return [createVNode(EditDate, mergeProps({
39
37
  "value": row[column.field],
40
38
  "onUpdate:value": ($event) => row[column.field] = $event
@@ -42,7 +40,7 @@ function dateRendererPlugin() {
42
40
  "column": column,
43
41
  "row": row,
44
42
  "index": $rowIndex,
45
- "onClick": onClick
43
+ "onClick": emitFormClick
46
44
  }), null)];
47
45
  }
48
46
  });
@@ -1,7 +1,8 @@
1
- import { createVNode, inject, mergeProps } from 'vue';
1
+ import { createVNode, mergeProps } from 'vue';
2
2
  import { NInput } from 'naive-ui';
3
3
  import '../../../../index.js';
4
- import { EDITABLE_WIDGET_TYPE, InjectionIhoTableEmits } from '../../../constants/index.js';
4
+ import { EDITABLE_WIDGET_TYPE } from '../../../constants/index.js';
5
+ import { useIhoTableFormEvent } from '../../../utils/index.js';
5
6
  import { defineTablePlugin } from '../../../hooks/useTablePlugin.js';
6
7
 
7
8
  function inputRendererPlugin() {
@@ -23,24 +24,19 @@ function inputRendererPlugin() {
23
24
  column,
24
25
  $rowIndex
25
26
  }) {
26
- const emit = inject(InjectionIhoTableEmits);
27
- const common = {
28
- value: row[column.field],
27
+ const {
28
+ emitFormClick,
29
+ emitFormChange
30
+ } = useIhoTableFormEvent({
29
31
  row,
30
32
  column,
31
- index: $rowIndex
32
- };
33
- function onBlur() {
34
- emit("formChange", common);
35
- }
36
- function onClick() {
37
- emit("formClick", common);
38
- }
33
+ $rowIndex
34
+ });
39
35
  return [createVNode(NInput, mergeProps({
40
36
  "value": row[column.field],
41
37
  "onUpdate:value": ($event) => row[column.field] = $event,
42
- "onBlur": onBlur,
43
- "onClick": onClick
38
+ "onBlur": emitFormChange,
39
+ "onClick": emitFormClick
44
40
  }, props == null ? void 0 : props.componentProps), null)];
45
41
  }
46
42
  });
@@ -1,7 +1,8 @@
1
- import { createVNode, inject, mergeProps } from 'vue';
1
+ import { createVNode, mergeProps } from 'vue';
2
2
  import { NInputNumber } from 'naive-ui';
3
3
  import '../../../../index.js';
4
- import { EDITABLE_WIDGET_TYPE, InjectionIhoTableEmits } from '../../../constants/index.js';
4
+ import { EDITABLE_WIDGET_TYPE } from '../../../constants/index.js';
5
+ import { useIhoTableFormEvent } from '../../../utils/index.js';
5
6
  import { defineTablePlugin } from '../../../hooks/useTablePlugin.js';
6
7
 
7
8
  function numberRendererPlugin() {
@@ -23,7 +24,15 @@ function numberRendererPlugin() {
23
24
  column,
24
25
  $rowIndex
25
26
  }) {
26
- const emit = inject(InjectionIhoTableEmits);
27
+ const {
28
+ emitFormClick,
29
+ emitFormChange,
30
+ createCustomEvent
31
+ } = useIhoTableFormEvent({
32
+ row,
33
+ column,
34
+ $rowIndex
35
+ });
27
36
  const {
28
37
  placeholder = "\u8BF7\u8F93\u5165"
29
38
  } = (props == null ? void 0 : props.componentProps) || {};
@@ -31,28 +40,12 @@ function numberRendererPlugin() {
31
40
  ...(props == null ? void 0 : props.componentProps) || {},
32
41
  clearable: true,
33
42
  placeholder,
34
- onBlur,
35
- onUpdateValue,
36
- onClick
37
- };
38
- const common = {
39
- value: row[column.field],
40
- row,
41
- column,
42
- index: $rowIndex
43
- };
44
- function onBlur() {
45
- emit("formChange", {
46
- ...common,
43
+ onBlur: createCustomEvent("formChange", {
47
44
  type: "blur"
48
- });
49
- }
50
- function onUpdateValue() {
51
- emit("formChange", common);
52
- }
53
- function onClick() {
54
- emit("formClick", common);
55
- }
45
+ }),
46
+ onUpdateValue: emitFormChange,
47
+ onClick: emitFormClick
48
+ };
56
49
  return [createVNode(NInputNumber, mergeProps({
57
50
  "value": row[column.field],
58
51
  "onUpdate:value": ($event) => row[column.field] = $event
@@ -1,6 +1,7 @@
1
- import { createVNode, inject, mergeProps } from 'vue';
1
+ import { createVNode, mergeProps } from 'vue';
2
2
  import '../../../../../index.js';
3
- import { EDITABLE_WIDGET_TYPE, InjectionIhoTableEmits } from '../../../../constants/index.js';
3
+ import { EDITABLE_WIDGET_TYPE } from '../../../../constants/index.js';
4
+ import { useIhoTableFormEvent } from '../../../../utils/index.js';
4
5
  import EditSelect from './editSelect.js';
5
6
  import { getDefaultValue } from './selectUtils.js';
6
7
  import { defineTablePlugin } from '../../../../hooks/useTablePlugin.js';
@@ -26,23 +27,20 @@ function selectRendererPlugin() {
26
27
  column,
27
28
  $rowIndex
28
29
  }) {
29
- const emit = inject(InjectionIhoTableEmits);
30
- function onClick() {
31
- const common = {
32
- value: row[column.field],
33
- row,
34
- column,
35
- index: $rowIndex
36
- };
37
- emit("formClick", common);
38
- }
30
+ const {
31
+ emitFormClick
32
+ } = useIhoTableFormEvent({
33
+ row,
34
+ column,
35
+ $rowIndex
36
+ });
39
37
  return [createVNode(EditSelect, mergeProps((props == null ? void 0 : props.componentProps) || {}, {
40
38
  "column": column,
41
39
  "row": row,
42
40
  "index": $rowIndex,
43
41
  "value": row[column.field],
44
42
  "onUpdate:value": ($event) => row[column.field] = $event,
45
- "onClick": onClick
43
+ "onClick": emitFormClick
46
44
  }), null)];
47
45
  }
48
46
  });
@@ -1,4 +1,4 @@
1
- import { defineComponent, inject, ref, watch, computed, onDeactivated, openBlock, createBlock, unref, withCtx, createElementVNode, withModifiers, normalizeStyle, toDisplayString, renderSlot, createVNode } from 'vue';
1
+ import { defineComponent, inject, ref, watch, computed, onMounted, onDeactivated, openBlock, createBlock, unref, withCtx, createElementVNode, withModifiers, normalizeStyle, toDisplayString, renderSlot, createVNode } from 'vue';
2
2
  import { cloneDeep, isObject, isArray } from 'lodash-es';
3
3
  import { NPopover, NInput } from 'naive-ui';
4
4
  import { InjectionIhoTableEmits, InjectionIhoTableHandler } from '../../../../constants/index.js';
@@ -62,6 +62,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
62
62
  boxSizing: "border-box",
63
63
  "border-radius": "4px"
64
64
  }));
65
+ onMounted(() => setShow(true));
65
66
  onDeactivated(onClose);
66
67
  return (_ctx, _cache) => {
67
68
  return openBlock(), createBlock(unref(NPopover), {
@@ -49,7 +49,7 @@ declare const _default: import("vue").DefineComponent<{
49
49
  }>> & {
50
50
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
51
51
  }>>;
52
- globEmit: <T extends "toggleRowExpand" | "toggleTreeExpand" | "copy" | "scroll" | "formChange" | "settingClick" | "formClick" | "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("../../../../../../../../es/components/iho-table").IhoTableEmitPayload<T>) => void;
52
+ globEmit: import("../../../../../../../../es/components/iho-table").IhoTableEmits;
53
53
  tableHandler: import("../../../../../../../../es/components/iho-table").IhoTableHandler;
54
54
  popoverRef: import("vue").Ref<any>;
55
55
  editContent: import("vue").Ref<any>;
@@ -2,8 +2,8 @@ import { reactive, inject, createVNode, toRaw, h, onBeforeUnmount } from 'vue';
2
2
  import { traverse } from '../../../../../../../shared/utils/index.js';
3
3
  import { isFunction, isObject } from 'lodash-es';
4
4
  import '../../../../../index.js';
5
- import { EDITABLE_WIDGET_TYPE, InjectionIhoTableUUID, InjectionIhoTableEmits } from '../../../../constants/index.js';
6
- import { getRowHeight, getColumnRenderWidth } from '../../../../utils/index.js';
5
+ import { EDITABLE_WIDGET_TYPE, InjectionIhoTableUUID } from '../../../../constants/index.js';
6
+ import { getRowHeight, useIhoTableFormEvent, getColumnRenderWidth } from '../../../../utils/index.js';
7
7
  import { isSeparateColumn, contentSeparate, getColumnInfoMaxLength, generateSeparateRowData } from './separateUtils.js';
8
8
  import EditSeparate from './editSeparate.js';
9
9
  import { defineTablePlugin } from '../../../../hooks/useTablePlugin.js';
@@ -42,7 +42,6 @@ function separateRendererPlugins() {
42
42
  }) {
43
43
  var _a, _b;
44
44
  const uuid = inject(InjectionIhoTableUUID);
45
- const emit = inject(InjectionIhoTableEmits);
46
45
  const separateRow = getSeparateRowData(uuid, row);
47
46
  const height = getRowHeight();
48
47
  const slots = {};
@@ -50,15 +49,13 @@ function separateRendererPlugins() {
50
49
  const separate = toRaw(renderOpts.props.separateSlot);
51
50
  slots.menu = isFunction(separate) ? separate : isObject(separate) ? (props) => h(separate, props) : void 0;
52
51
  }
53
- const common = {
54
- value: row[column.field],
52
+ const {
53
+ emitFormClick
54
+ } = useIhoTableFormEvent({
55
55
  row,
56
56
  column,
57
- index: $rowIndex
58
- };
59
- function onClick() {
60
- emit("formClick", common);
61
- }
57
+ $rowIndex
58
+ });
62
59
  return [createVNode(EditSeparate, {
63
60
  "value": row[column.field],
64
61
  "onUpdate:value": ($event) => row[column.field] = $event,
@@ -67,7 +64,7 @@ function separateRendererPlugins() {
67
64
  "column": column,
68
65
  "row": row,
69
66
  "displayContent": (_b = separateRow == null ? void 0 : separateRow.separateData) == null ? void 0 : _b[column.field],
70
- "onClick": onClick
67
+ "onClick": emitFormClick
71
68
  }, slots)];
72
69
  }
73
70
  });
@@ -1,7 +1,8 @@
1
- import { createVNode, inject, mergeProps } from 'vue';
1
+ import { createVNode, mergeProps } from 'vue';
2
2
  import '../../../../index.js';
3
- import { EDITABLE_WIDGET_TYPE, InjectionIhoTableEmits } from '../../../constants/index.js';
3
+ import { EDITABLE_WIDGET_TYPE } from '../../../constants/index.js';
4
4
  import { NTimePicker } from 'naive-ui';
5
+ import { useIhoTableFormEvent } from '../../../utils/index.js';
5
6
  import { defineTablePlugin } from '../../../hooks/useTablePlugin.js';
6
7
 
7
8
  function timeRendererPlugin() {
@@ -23,7 +24,14 @@ function timeRendererPlugin() {
23
24
  column,
24
25
  $rowIndex
25
26
  }) {
26
- const emit = inject(InjectionIhoTableEmits);
27
+ const {
28
+ emitFormClick,
29
+ emitFormChange
30
+ } = useIhoTableFormEvent({
31
+ row,
32
+ column,
33
+ $rowIndex
34
+ });
27
35
  const {
28
36
  placeholder = "\u8BF7\u9009\u62E9",
29
37
  valueFormat = "HH:mm"
@@ -33,21 +41,9 @@ function timeRendererPlugin() {
33
41
  placeholder,
34
42
  valueFormat,
35
43
  format: valueFormat || "yyyy-MM-dd HH:mm:ss",
36
- onUpdateFormattedValue: onUpdateValue,
37
- onClick
38
- };
39
- const common = {
40
- value: row[column.field],
41
- row,
42
- column,
43
- index: $rowIndex
44
+ onUpdateFormattedValue: emitFormChange,
45
+ onClick: emitFormClick
44
46
  };
45
- function onUpdateValue() {
46
- emit("formChange", common);
47
- }
48
- function onClick() {
49
- emit("formClick", common);
50
- }
51
47
  return [createVNode(NTimePicker, mergeProps({
52
48
  "formattedValue": row[column.field],
53
49
  "onUpdate:formattedValue": ($event) => row[column.field] = $event
@@ -1,7 +1,7 @@
1
1
  import { AnyObject, TupleToUnion } from '../../../../../es/shared/types';
2
2
  import { VxeTableProps, VxeTableDefines, VxeTableInstance, VxeColumnPropTypes } from 'vxe-table';
3
3
  import { VxeTableEventProps } from 'vxe-table/types/table';
4
- import { IHO_TABLE_STRING_STATUS, IhoTableEventNameTuple, IhoTableRowGroupSequence, VxeEventListenerNameList } from '../../../../../es/components/iho-table/src/constants';
4
+ import { IHO_TABLE_STRING_STATUS, IhoTableCustomEventNameTuple, IhoTableEventNameTuple, IhoTableRowGroupSequence, VxeEventListenerNameList } from '../../../../../es/components/iho-table/src/constants';
5
5
  import { IHO_TABLE_FILTER_STATUS } from '../../../../../es/components/iho-table/src/plugins/filterPlugin/types';
6
6
  export * from './pluginType';
7
7
  export interface IhoTableRowGroupItem {
@@ -24,10 +24,6 @@ export declare type IhoTableConfig = VxeTableProps & Partial<{
24
24
  }>;
25
25
  export declare type IhoTableFieldItem = {
26
26
  [K in keyof VxeTableDefines.ColumnInfo]?: K extends 'children' ? IhoTableFieldItem[] : K extends keyof VxeTableDefines.ColumnInfo ? VxeTableDefines.ColumnInfo[K] : never;
27
- } & Partial<{
28
- annotation: boolean;
29
- }> & {
30
- [K: string]: unknown;
31
27
  };
32
28
  export declare namespace IhoTableLowCodeField {
33
29
  type FieldSetting = {
@@ -62,6 +58,7 @@ export declare type LowCodeTableFieldItem = {
62
58
  componentProps: AnyObject;
63
59
  showOverflow: VxeTableDefines.ColumnInfo['showOverflow'];
64
60
  options: AnyObject[];
61
+ annotation: boolean;
65
62
  }> & Partial<Pick<VxeTableDefines.ColumnInfo, 'resizable'>>;
66
63
  export declare type IhoTableFormChangePayload = {
67
64
  column: IhoTableFieldItem;
@@ -70,6 +67,7 @@ export declare type IhoTableFormChangePayload = {
70
67
  index: number;
71
68
  type?: string;
72
69
  };
70
+ export declare type IhoTableEmits = <T extends typeof IhoTableEventNameTuple[number]>(event: T, ...args: IhoTableEmitPayload<T>) => void;
73
71
  export declare type EventListenerToEventName<T extends string> = T extends `on${infer R}` ? R extends `${infer F}${infer L}` ? `${Lowercase<F>}${L}` : never : never;
74
72
  export declare type EventNameToEventListener<T extends string> = T extends `${infer L}${infer R}` ? `on${Uppercase<L>}${R}` : never;
75
73
  export declare type IhoTableHandler = Record<'updateConfigRef' | 'updateFieldListRef' | 'updateTableDataRef', () => void>;
@@ -81,7 +79,9 @@ export declare type IhoTableFilterPayload = {
81
79
  type: 'filter';
82
80
  value: string[];
83
81
  };
84
- export declare type IhoTableEmitPayload<T extends typeof IhoTableEventNameTuple[number]> = T extends 'formChange' | 'formClick' ? [IhoTableFormChangePayload] : T extends 'settingClick' ? [] : T extends 'sortChange' ? [IhoTableFilterPayload] : Parameters<NonNullable<VxeTableEventProps[EventNameToEventListener<Exclude<T, 'formChange' | 'settingClick' | 'formClick' | 'sortChange'>>]>>;
82
+ export declare type IhoTableEmitPayload<T extends typeof IhoTableEventNameTuple[number]> = T extends 'formChange' | 'formClick' ? [IhoTableFormChangePayload] : T extends 'keyboard' ? [IhoTableFormChangePayload & {
83
+ key: string;
84
+ }] : T extends 'settingClick' ? [] : T extends 'sortChange' ? [IhoTableFilterPayload] : Parameters<NonNullable<VxeTableEventProps[EventNameToEventListener<Exclude<T, typeof IhoTableCustomEventNameTuple[number]>>]>>;
85
85
  export declare type IhoTableAnchorItem = {
86
86
  field: string;
87
87
  title: string;
@@ -5,7 +5,7 @@ import { Ref, VNode } from 'vue';
5
5
  import { VxeGlobalCommands, VxeGlobalFormats, VxeGlobalHooks, VxeGlobalMenus, VxeGlobalRenderer, VxeTableInstance } from 'vxe-table';
6
6
  import { VxeTableEventProps, VxeTableEvents } from 'vxe-table/types/table';
7
7
  import { VxeGlobalInterceptor } from 'vxe-table/types/v-x-e-table';
8
- import { IhoTableConfig, IhoTableFieldItem, IhoTableHandler } from '.';
8
+ import { IhoTableConfig, IhoTableEmits, IhoTableFieldItem, IhoTableHandler } from '.';
9
9
  export declare type IhoTableInstance = {
10
10
  interceptor: VxeGlobalInterceptor;
11
11
  renderer: VxeGlobalRenderer;
@@ -63,6 +63,7 @@ export declare abstract class AbstractFieldHooks {
63
63
  }
64
64
  export declare type WithIhoEventContext<T> = T extends any[] ? [...T, IhoTableHandler & {
65
65
  $table: Nullable<VxeTableInstance>;
66
+ emits: IhoTableEmits;
66
67
  }, IhoTableConfig] : [T, IhoTableHandler & {
67
68
  $table: Nullable<VxeTableInstance>;
68
69
  }, IhoTableConfig];
@@ -1,7 +1,7 @@
1
1
  import { AnyObject, Nullable } from '../../../../../es/shared/types';
2
2
  import { MaybeRef } from '@vueuse/core';
3
- import { VxeTableInstance } from 'vxe-table';
4
- import { EventListenerToEventName, LowCodeTableFieldItem } from '../../../../../es/components/iho-table';
3
+ import { VxeTableDefines, VxeTableInstance } from 'vxe-table';
4
+ import { EventListenerToEventName, IhoTableFieldItem, IhoTableFormChangePayload, LowCodeTableFieldItem } from '../../../../../es/components/iho-table';
5
5
  export declare function IhoTableLog(message: string): void;
6
6
  export declare function IhoTableWarn(message: string): void;
7
7
  export declare const IhoTableUtils: Readonly<{
@@ -14,3 +14,13 @@ export declare function useUUIDMap<T>(creator: () => T, isReactive?: boolean): {
14
14
  removeItemFromUUID: (uuid: string) => void;
15
15
  };
16
16
  export declare function getColumnRenderWidth(column: AnyObject, $table: MaybeRef<Nullable<VxeTableInstance>>): Promise<number>;
17
+ export declare function useIhoTableFormEvent({ row, column, $rowIndex }: {
18
+ row: AnyObject;
19
+ column: VxeTableDefines.ColumnInfo;
20
+ $rowIndex: number;
21
+ }): {
22
+ emitFormChange: () => void;
23
+ emitFormClick: () => void;
24
+ createCustomEvent: (eventName: 'formChange' | 'formClick', params: Partial<IhoTableFormChangePayload>) => () => void;
25
+ };
26
+ export declare function getLowCodeFieldFromField(field: IhoTableFieldItem): LowCodeTableFieldItem | undefined;
@@ -1,6 +1,6 @@
1
1
  import { isNumber } from 'lodash-es';
2
2
  import { inject, reactive, nextTick, unref } from 'vue';
3
- import { InjectionIhoTableConfig } from '../constants/index.js';
3
+ import { InjectionIhoTableConfig, InjectionIhoTableEmits } from '../constants/index.js';
4
4
 
5
5
  function IhoTableLog(message) {
6
6
  return console.log(`[IhoTable]: ${message}`);
@@ -53,5 +53,36 @@ async function getColumnRenderWidth(column, $table) {
53
53
  return isNumber(column.width) ? column.width : 64;
54
54
  }
55
55
  }
56
+ function useIhoTableFormEvent({
57
+ row,
58
+ column,
59
+ $rowIndex
60
+ }) {
61
+ const emit = inject(InjectionIhoTableEmits);
62
+ function getPayload() {
63
+ return {
64
+ value: row[column.field],
65
+ row,
66
+ column,
67
+ index: $rowIndex
68
+ };
69
+ }
70
+ function emitFormChange() {
71
+ emit("formChange", getPayload());
72
+ }
73
+ function emitFormClick() {
74
+ emit("formClick", getPayload());
75
+ }
76
+ function createCustomEvent(eventName, params) {
77
+ return function() {
78
+ emit(eventName, { ...getPayload(), ...params });
79
+ };
80
+ }
81
+ return { emitFormChange, emitFormClick, createCustomEvent };
82
+ }
83
+ function getLowCodeFieldFromField(field) {
84
+ var _a;
85
+ return (_a = field.editRender) == null ? void 0 : _a.props;
86
+ }
56
87
 
57
- export { IhoTableLog, IhoTableUtils, IhoTableWarn, getColumnRenderWidth, getEventName, getRowHeight, useUUIDMap };
88
+ export { IhoTableLog, IhoTableUtils, IhoTableWarn, getColumnRenderWidth, getEventName, getLowCodeFieldFromField, getRowHeight, useIhoTableFormEvent, useUUIDMap };
@@ -1 +1 @@
1
- .iho-table .vxe-table--render-default .vxe-table--fixed-left-wrapper.scrolling--middle{box-shadow:7px 0 8px -3px rgba(0,0,0,.15)}.iho-table .vxe-table--render-default .vxe-table--fixed-right-wrapper.scrolling--middle{box-shadow:-7px 0 8px -3px rgba(0,0,0,.15)}.iho-table__boldCell{font-weight:700}.iho-table .icon-dot{background:var(--table-icon-color);box-shadow:0 2px 4px 0 var(--table-icon-shadow)}.iho-table .icon-dot,.iho-table .icon-dot-red{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-red{background:red;box-shadow:0 2px 4px 0 rgba(255,0,0,.5)}.iho-table .icon-dot-blue{background:blue;box-shadow:0 2px 4px 0 rgba(0,0,255,.5)}.iho-table .icon-dot-blue,.iho-table .icon-dot-green{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-green{background:green;box-shadow:0 2px 4px 0 rgba(0,128,0,.5)}.iho-table .icon-dot-gray{background:gray;box-shadow:0 2px 4px 0 hsla(0,0%,50%,.5)}.iho-table .icon-dot-gray,.iho-table .icon-dot-yellow{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-yellow{background:#ff0;box-shadow:0 2px 4px 0 rgba(255,255,0,.5)}.iho-table .icon-dot-resolved{background:#36be8c;box-shadow:0 2px 4px 0 rgba(54,190,140,.5)}.iho-table .icon-dot-huifu,.iho-table .icon-dot-resolved{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-huifu{background:#42d0f6;box-shadow:0 2px 4px 0 rgba(66,208,246,.5)}.iho-table .icon-dot-close{background:#718391;box-shadow:0 2px 4px 0 rgba(113,131,145,.5)}.iho-table .icon-dot-audit,.iho-table .icon-dot-close{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-audit{background:#f4ba32;box-shadow:0 2px 4px 0 rgba(244,186,50,.5)}.iho-table .icon-dot-design{background:#927ce1;box-shadow:0 2px 4px 0 rgba(146,124,225,.5)}.iho-table .icon-dot-design,.iho-table .icon-dot-develop{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-develop{background:#4eb0ef;box-shadow:0 2px 4px 0 rgba(78,176,239,.5)}.iho-table .icon-dot-develop-complete{background:#6381f9;border-radius:50%;box-shadow:0 2px 4px 0 rgba(99,129,249,.5);display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table__filterIcon{cursor:pointer;padding:0 4px}.iho-table__filterIcon:hover{opacity:.7}.iho-table__filterWrapper{display:flex;flex-direction:column;gap:8px;width:200px}.iho-table__filterButton{align-items:center;border-radius:4px;cursor:pointer;display:flex;height:30px;padding:0 8px}.iho-table__filterButton--active{color:#5585f5}.iho-table__filterButton:hover{background:rgba(0,0,0,.05)}.iho-table__filterListWrapper{border:1px solid rgba(0,0,0,.05)}.iho-table__filterListItem{align-items:center;border-radius:4px;display:flex;height:32px;padding:0 8px}.iho-table__filterListItem:hover{background:rgba(0,0,0,.05)}.iho-table__filterFooter{display:flex;justify-content:space-between}.iho-table .vxe-header--column [annotation-hover-show=true]{visibility:hidden}.iho-table .vxe-header--column:hover [annotation-hover-show=true]{visibility:visible}.iho-table__headerWrapper{display:inline-flex}
1
+ .iho-table .vxe-table--render-default .vxe-table--fixed-left-wrapper.scrolling--middle{box-shadow:7px 0 8px -3px rgba(0,0,0,.15)}.iho-table .vxe-table--render-default .vxe-table--fixed-right-wrapper.scrolling--middle{box-shadow:-7px 0 8px -3px rgba(0,0,0,.15)}.iho-table__boldCell{font-weight:700}.iho-table .vxe-table--body-wrapper::-webkit-scrollbar,.iho-table .vxe-table--footer-wrapper.body--wrapper::-webkit-scrollbar{background-color:transparent;height:10px;width:10px}.iho-table .vxe-table--body-wrapper::-webkit-scrollbar-thumb,.iho-table .vxe-table--footer-wrapper.body--wrapper::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:#f2f2f2;border:3px dashed transparent;border-radius:5px}.iho-table .vxe-table--body-wrapper::-webkit-scrollbar-thumb:hover,.iho-table .vxe-table--footer-wrapper.body--wrapper::-webkit-scrollbar-thumb:hover{background:#b2b2b2}.iho-table .icon-dot{background:var(--table-icon-color);box-shadow:0 2px 4px 0 var(--table-icon-shadow)}.iho-table .icon-dot,.iho-table .icon-dot-red{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-red{background:red;box-shadow:0 2px 4px 0 rgba(255,0,0,.5)}.iho-table .icon-dot-blue{background:blue;box-shadow:0 2px 4px 0 rgba(0,0,255,.5)}.iho-table .icon-dot-blue,.iho-table .icon-dot-green{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-green{background:green;box-shadow:0 2px 4px 0 rgba(0,128,0,.5)}.iho-table .icon-dot-gray{background:gray;box-shadow:0 2px 4px 0 hsla(0,0%,50%,.5)}.iho-table .icon-dot-gray,.iho-table .icon-dot-yellow{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-yellow{background:#ff0;box-shadow:0 2px 4px 0 rgba(255,255,0,.5)}.iho-table .icon-dot-resolved{background:#36be8c;box-shadow:0 2px 4px 0 rgba(54,190,140,.5)}.iho-table .icon-dot-huifu,.iho-table .icon-dot-resolved{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-huifu{background:#42d0f6;box-shadow:0 2px 4px 0 rgba(66,208,246,.5)}.iho-table .icon-dot-close{background:#718391;box-shadow:0 2px 4px 0 rgba(113,131,145,.5)}.iho-table .icon-dot-audit,.iho-table .icon-dot-close{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-audit{background:#f4ba32;box-shadow:0 2px 4px 0 rgba(244,186,50,.5)}.iho-table .icon-dot-design{background:#927ce1;box-shadow:0 2px 4px 0 rgba(146,124,225,.5)}.iho-table .icon-dot-design,.iho-table .icon-dot-develop{border-radius:50%;display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table .icon-dot-develop{background:#4eb0ef;box-shadow:0 2px 4px 0 rgba(78,176,239,.5)}.iho-table .icon-dot-develop-complete{background:#6381f9;border-radius:50%;box-shadow:0 2px 4px 0 rgba(99,129,249,.5);display:inline-block;height:8px;margin-right:6px;width:8px}.iho-table__filterIcon{cursor:pointer;padding:0 4px}.iho-table__filterIcon:hover{opacity:.7}.iho-table__filterWrapper{display:flex;flex-direction:column;gap:8px;width:200px}.iho-table__filterButton{align-items:center;border-radius:4px;cursor:pointer;display:flex;height:30px;padding:0 8px}.iho-table__filterButton--active{color:#5585f5}.iho-table__filterButton:hover{background:rgba(0,0,0,.05)}.iho-table__filterListWrapper{border:1px solid rgba(0,0,0,.05)}.iho-table__filterListItem{align-items:center;border-radius:4px;display:flex;height:32px;padding:0 8px}.iho-table__filterListItem:hover{background:rgba(0,0,0,.05)}.iho-table__filterFooter{display:flex;justify-content:space-between}.iho-table .vxe-header--column [annotation-hover-show=true]{visibility:hidden}.iho-table .vxe-header--column:hover [annotation-hover-show=true]{visibility:visible}.iho-table__headerWrapper{display:inline-flex}