cnhis-design-vue 3.1.15-beta.7 → 3.1.15

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 (66) hide show
  1. package/es/packages/big-table/src/hooks/useAnnotation.js +1 -2
  2. package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +7 -2
  3. package/es/packages/big-table/src/hooks/useEdit.js +16 -8
  4. package/es/packages/fabric-chart/src/hooks/useDraw.js +1 -0
  5. package/es/packages/fabric-chart/src/hooks/useLeft.js +1 -2
  6. package/es/packages/form-config/index.d.ts +13854 -0
  7. package/es/packages/form-config/index.js +10 -0
  8. package/es/packages/form-config/src/FormConfig.js +113 -0
  9. package/es/packages/form-config/src/FormConfig.vue.d.ts +13856 -0
  10. package/es/packages/form-config/src/components/FormConfigCreator.js +97 -0
  11. package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +5094 -0
  12. package/es/packages/form-config/src/components/FormConfigEdit.js +81 -0
  13. package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +5336 -0
  14. package/es/packages/form-config/src/constants/index.d.ts +28 -0
  15. package/es/packages/form-config/src/constants/index.js +28 -0
  16. package/es/packages/form-config/src/hooks/index.d.ts +2 -0
  17. package/es/packages/form-config/src/hooks/index.js +2 -0
  18. package/es/packages/form-config/src/hooks/useConfigurationField.d.ts +6 -0
  19. package/es/packages/form-config/src/hooks/useConfigurationField.js +103 -0
  20. package/es/packages/form-config/src/hooks/usePresetRenderer.d.ts +5 -0
  21. package/es/packages/form-config/src/hooks/usePresetRenderer.js +117 -0
  22. package/es/packages/form-config/src/hooks/useSortable.d.ts +11 -0
  23. package/es/packages/form-config/src/hooks/useSortable.js +31 -0
  24. package/es/packages/form-config/src/types/index.d.ts +18 -0
  25. package/es/packages/form-config/src/types/index.js +1 -0
  26. package/es/packages/form-config/style/index.css +108 -0
  27. package/es/packages/form-render/index.d.ts +3 -3
  28. package/es/packages/form-render/src/FormRender.vue.d.ts +3 -3
  29. package/es/packages/form-render/src/components/renderer/combination/index.js +3 -3
  30. package/es/packages/form-render/src/components/renderer/date.d.ts +2 -2
  31. package/es/packages/form-render/src/components/renderer/formItem.js +3 -3
  32. package/es/packages/form-render/src/components/renderer/select.js +16 -9
  33. package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +2 -2
  34. package/es/packages/form-render/src/hooks/useAsyncQueue.js +4 -8
  35. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -3
  36. package/es/packages/form-render/src/hooks/useFormContext.js +10 -4
  37. package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.d.ts +2 -2
  38. package/es/packages/form-render/src/types/fieldItem.d.ts +8 -0
  39. package/es/packages/form-render/src/types/index.d.ts +7 -3
  40. package/es/packages/form-render/src/utils/index.d.ts +3 -2
  41. package/es/packages/form-render/src/utils/index.js +30 -7
  42. package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +1 -1
  43. package/es/packages/index.css +108 -0
  44. package/es/packages/index.d.ts +4 -1
  45. package/es/packages/index.js +5 -2
  46. package/es/packages/scale-view/src/hooks/scaleview-init.js +35 -35
  47. package/es/packages/shortcut-provider/index.d.ts +17 -2
  48. package/es/packages/shortcut-provider/index.js +1 -1
  49. package/es/packages/shortcut-provider/src/ShortcutProvider.js +5 -1
  50. package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +17 -2
  51. package/es/packages/shortcut-provider/src/hooks/index.js +1 -1
  52. package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +10 -10
  53. package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +45 -38
  54. package/es/packages/shortcut-provider/src/types/index.d.ts +2 -19
  55. package/es/packages/shortcut-setter/index.d.ts +1701 -4286
  56. package/es/packages/shortcut-setter/src/ShortcutSetter.js +63 -10
  57. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +1723 -4306
  58. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +26 -95
  59. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +30 -3363
  60. package/es/packages/shortcut-setter/src/types/index.d.ts +6 -0
  61. package/es/packages/shortcut-setter/src/types/index.js +1 -0
  62. package/es/src/utils/state.d.ts +29 -0
  63. package/es/src/utils/state.js +44 -0
  64. package/package.json +2 -1
  65. package/es/packages/shortcut-setter/constant/index.d.ts +0 -4
  66. package/es/packages/shortcut-setter/constant/index.js +0 -7
@@ -1,46 +1,26 @@
1
- import { defineComponent, computed, ref, openBlock, createElementBlock, createVNode, unref, withModifiers, createElementVNode, createBlock, withCtx, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
2
- import { debounce, isString } from 'lodash-es';
3
- import { useMessage, NInput, NButton, NPopconfirm } from 'naive-ui';
4
- import { useShortcuts } from '../../../packages/shortcut-provider';
5
- import { transformKey2DisplaySignature, getDisplaySignature } from '../../../packages/shortcut-provider/src/utils';
6
- import { ShortcutInputState } from '../../../packages/shortcut-setter/constant';
1
+ import { defineComponent, ref, computed, openBlock, createElementBlock, createVNode, unref, withModifiers } from 'vue';
2
+ import { NInput } from 'naive-ui';
3
+ import { getDisplaySignature } from '../../../packages/shortcut-provider/src/utils';
7
4
  import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
8
5
 
9
6
  const _hoisted_1 = { class: "shortcut-setter-item__wrapper" };
10
- const _hoisted_2 = { class: "shortcut-setter-item__operation" };
11
- const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u91CD\u7F6E");
12
- const _hoisted_4 = /* @__PURE__ */ createTextVNode(" \u786E\u8BA4\u91CD\u7F6E\u5FEB\u6377\u952E\u5417 ");
13
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
14
8
  __name: "ShortcutSetterItem",
15
9
  props: {
16
- glob: { type: Boolean },
10
+ shortcutKey: null,
11
+ shortcutSignature: null,
17
12
  value: null,
18
13
  onChange: null,
19
14
  onFocus: null,
20
- fieldItem: null,
21
15
  placeholder: { default: "\u70B9\u51FB\u8BBE\u7F6E\u5FEB\u6377\u952E" },
22
- editPlaceholder: { default: "\u952E\u76D8\u6309\u4E0B\u8981\u8BBE\u7F6E\u7684\u5FEB\u6377\u952E\u7EC4\u5408" },
23
- operation: { default: () => [] }
16
+ editPlaceholder: { default: "\u952E\u76D8\u6309\u4E0B\u8981\u8BBE\u7F6E\u7684\u5FEB\u6377\u952E\u7EC4\u5408" }
24
17
  },
25
- setup(__props) {
18
+ emits: ["shortcutChange"],
19
+ setup(__props, { emit }) {
26
20
  const props = __props;
27
- const { query, update, updateDisabled, onReset, updateManagerDisabled } = useShortcuts(props.glob);
28
- const shortcutItem = computed(() => {
29
- return query(props.fieldItem.val_key);
30
- });
31
- const disabledState = computed(() => {
32
- var _a;
33
- return !!((_a = shortcutItem.value) == null ? void 0 : _a.disabled);
34
- });
35
- const currentSetShortcut = computed(() => {
36
- var _a, _b;
37
- return transformKey2DisplaySignature((_b = (_a = shortcutItem.value) == null ? void 0 : _a.currentKeySignature) != null ? _b : "");
38
- });
39
- const state = ref(ShortcutInputState.STATIC);
40
- const isEditState = computed(() => state.value === ShortcutInputState.STATIC);
41
- function hasOperation(operation) {
42
- return props.operation.includes(operation);
43
- }
21
+ const currentSetShortcut = ref(getDisplaySignature(props.shortcutSignature));
22
+ const state = ref(0);
23
+ const isEditState = computed(() => state.value === 0);
44
24
  const currentEditShortcut = ref("");
45
25
  const showContent = computed(() => {
46
26
  return isEditState.value ? currentSetShortcut.value : currentEditShortcut.value;
@@ -49,90 +29,41 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
29
  return isEditState.value ? props.placeholder : props.editPlaceholder;
50
30
  });
51
31
  function onInputFocus() {
52
- updateManagerDisabled(true);
53
- state.value = ShortcutInputState.EDIT;
32
+ state.value = 1;
54
33
  }
55
34
  const inputRef = ref();
56
35
  function onInputBlur() {
57
36
  var _a;
58
- updateManagerDisabled(false);
59
- state.value = ShortcutInputState.STATIC;
37
+ state.value = 0;
60
38
  currentEditShortcut.value = "";
61
39
  (_a = inputRef.value) == null ? void 0 : _a.blur();
62
40
  }
63
- const onInputKeyDown = debounce((event) => {
41
+ const onInputKeyDown = (event) => {
64
42
  currentEditShortcut.value = getDisplaySignature(event);
65
- }, 200, { leading: true, trailing: false });
66
- const $message = useMessage();
67
- function updateDecorator(fn, afterUpdate) {
43
+ };
44
+ const onInputKeyUp = async (event) => {
68
45
  try {
69
- fn();
70
- } catch (e) {
71
- isString(e) && $message.error(e);
72
- currentEditShortcut.value = "";
46
+ await new Promise((resolve, reject) => {
47
+ emit("shortcutChange", { key: props.shortcutKey, info: event, resolve, reject });
48
+ });
49
+ currentSetShortcut.value = getDisplaySignature(event);
73
50
  } finally {
74
- afterUpdate == null ? void 0 : afterUpdate();
51
+ onInputBlur();
52
+ currentEditShortcut.value = "";
75
53
  }
76
- }
77
- const onInputKeyUp = debounce((event) => updateDecorator(() => update(props.fieldItem.val_key, event), () => event.target.blur()), 200, { leading: true, trailing: false });
78
- function onStop() {
79
- if (!shortcutItem.value)
80
- return;
81
- updateDecorator(() => updateDisabled(props.fieldItem.val_key, !disabledState.value), onInputBlur);
82
- }
83
- function onSignatureReset() {
84
- if (!shortcutItem.value)
85
- return;
86
- updateDecorator(() => onReset(props.fieldItem.val_key), onInputBlur);
87
- }
54
+ };
88
55
  return (_ctx, _cache) => {
89
56
  return openBlock(), createElementBlock("section", _hoisted_1, [
90
57
  createVNode(unref(NInput), {
91
58
  ref_key: "inputRef",
92
59
  ref: inputRef,
93
- disabled: unref(disabledState),
94
60
  value: unref(showContent),
95
61
  placeholder: unref(placeholder),
96
62
  onFocus: onInputFocus,
97
63
  onBlur: onInputBlur,
98
- onKeydown: withModifiers(unref(onInputKeyDown), ["prevent", "stop"]),
99
- onKeyup: withModifiers(unref(onInputKeyUp), ["prevent", "stop"])
100
- }, null, 8, ["disabled", "value", "placeholder", "onKeydown", "onKeyup"]),
101
- createElementVNode("section", _hoisted_2, [
102
- hasOperation("disabled") ? (openBlock(), createBlock(unref(NButton), {
103
- key: 0,
104
- text: "",
105
- onClick: onStop,
106
- type: unref(disabledState) ? "info" : "warning"
107
- }, {
108
- default: withCtx(() => [
109
- createTextVNode(toDisplayString(unref(disabledState) ? "\u542F\u7528" : "\u7981\u7528"), 1)
110
- ]),
111
- _: 1
112
- }, 8, ["type"])) : createCommentVNode("v-if", true),
113
- hasOperation("reset") ? (openBlock(), createBlock(unref(NPopconfirm), {
114
- key: 1,
115
- onPositiveClick: onSignatureReset
116
- }, {
117
- trigger: withCtx(() => [
118
- createVNode(unref(NButton), {
119
- disabled: unref(disabledState),
120
- text: "",
121
- onClick: onInputBlur,
122
- type: "info"
123
- }, {
124
- default: withCtx(() => [
125
- _hoisted_3
126
- ]),
127
- _: 1
128
- }, 8, ["disabled"])
129
- ]),
130
- default: withCtx(() => [
131
- _hoisted_4
132
- ]),
133
- _: 1
134
- })) : createCommentVNode("v-if", true)
135
- ])
64
+ onKeydown: withModifiers(onInputKeyDown, ["prevent", "stop"]),
65
+ onKeyup: withModifiers(onInputKeyUp, ["prevent", "stop"])
66
+ }, null, 8, ["value", "placeholder", "onKeydown", "onKeyup"])
136
67
  ]);
137
68
  };
138
69
  }