cnhis-design-vue 3.1.15-beta.9 → 3.1.16-beta.1

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 (39) 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 +1749 -0
  7. package/es/packages/form-config/src/FormConfig.vue.d.ts +1749 -0
  8. package/es/packages/form-config/src/components/FormConfigEdit.js +3 -3
  9. package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +1747 -0
  10. package/es/packages/form-config/style/index.css +1 -1
  11. package/es/packages/form-render/src/components/renderer/combination/index.js +3 -3
  12. package/es/packages/form-render/src/components/renderer/formItem.js +1 -2
  13. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +2 -2
  14. package/es/packages/form-render/src/types/fieldItem.d.ts +8 -0
  15. package/es/packages/form-render/src/utils/index.d.ts +1 -0
  16. package/es/packages/form-render/src/utils/index.js +9 -2
  17. package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +1 -1
  18. package/es/packages/index.css +1 -1
  19. package/es/packages/index.d.ts +1 -0
  20. package/es/packages/index.js +1 -1
  21. package/es/packages/scale-view/src/hooks/scaleview-init.js +35 -35
  22. package/es/packages/shortcut-provider/index.d.ts +17 -2
  23. package/es/packages/shortcut-provider/index.js +1 -1
  24. package/es/packages/shortcut-provider/src/ShortcutProvider.js +5 -1
  25. package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +17 -2
  26. package/es/packages/shortcut-provider/src/hooks/index.js +1 -1
  27. package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +10 -10
  28. package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +45 -38
  29. package/es/packages/shortcut-provider/src/types/index.d.ts +2 -19
  30. package/es/packages/shortcut-setter/index.d.ts +1698 -4283
  31. package/es/packages/shortcut-setter/src/ShortcutSetter.js +63 -10
  32. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +1723 -4306
  33. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +26 -95
  34. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +30 -3363
  35. package/es/packages/shortcut-setter/src/types/index.d.ts +6 -0
  36. package/es/packages/shortcut-setter/src/types/index.js +1 -0
  37. package/package.json +1 -1
  38. package/es/packages/shortcut-setter/constant/index.d.ts +0 -4
  39. package/es/packages/shortcut-setter/constant/index.js +0 -7
@@ -1,5 +1,7 @@
1
- import { defineComponent, computed, openBlock, createBlock, unref } from 'vue';
2
- import { useShortcuts } from '../../../packages/shortcut-provider';
1
+ import { defineComponent, ref, computed, watch, openBlock, createBlock, unref } from 'vue';
2
+ import { isEqual, cloneDeep } from 'lodash-es';
3
+ import { GlobalShortcutProvider, useShortcuts } from '../../../packages/shortcut-provider';
4
+ import { normalizeSignatureInfo, isInvalidSignature, getDisplaySignature } from '../../../packages/shortcut-provider/src/utils';
3
5
  import ShortcutSetterItem from './ShortcutSetterItem.js';
4
6
  import FormRender from '../../form-render/index.js';
5
7
  import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
@@ -7,18 +9,37 @@ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
7
9
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
10
  __name: "ShortcutSetter",
9
11
  props: {
10
- glob: { type: Boolean, default: false }
12
+ glob: { type: Boolean, default: false },
13
+ scope: { type: [String, Symbol] }
11
14
  },
12
- setup(__props) {
15
+ emits: [
16
+ "error",
17
+ "update"
18
+ ],
19
+ setup(__props, { expose, emit }) {
13
20
  const props = __props;
14
- const fieldList = computed(() => {
15
- return useShortcuts(props.glob).traverse().map((shortcut) => {
21
+ const components = { SHORTCUT: ShortcutSetterItem };
22
+ const key = ref(0);
23
+ const scope = computed(() => {
24
+ return props.glob ? GlobalShortcutProvider : props.scope;
25
+ });
26
+ const manager = useShortcuts(scope);
27
+ const fieldList = ref([]);
28
+ let shortcutCache = {};
29
+ watch([scope, () => manager.traverse()], loadSignature, { immediate: true, deep: true });
30
+ function loadSignature() {
31
+ shortcutCache = {};
32
+ fieldList.value = manager.traverse().map((shortcut) => {
33
+ shortcutCache[shortcut.key] = normalizeSignatureInfo(shortcut.shortcutSignature);
16
34
  return {
17
35
  val_key: shortcut.key,
18
36
  alias: shortcut.label,
19
37
  html_type: "SHORTCUT",
20
38
  componentProps: {
21
- glob: props.glob,
39
+ scope: scope.value,
40
+ onShortcutChange,
41
+ shortcutKey: shortcut.key,
42
+ shortcutSignature: shortcut.shortcutSignature,
22
43
  editPlaceholder: shortcut.editPlaceholder,
23
44
  placeholder: shortcut.placeholder,
24
45
  operation: shortcut.operation
@@ -26,13 +47,45 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26
47
  elem_width: 12
27
48
  };
28
49
  });
50
+ key.value++;
51
+ }
52
+ function onShortcutChange({
53
+ key: key2,
54
+ info,
55
+ resolve,
56
+ reject
57
+ }) {
58
+ const _info = normalizeSignatureInfo(info);
59
+ if (isInvalidSignature(_info)) {
60
+ emit("error", `\u975E\u6CD5\u7684\u5FEB\u6377\u952E\u7EC4\u5408=> ${getDisplaySignature(_info)}`);
61
+ return reject();
62
+ }
63
+ if (Object.values(shortcutCache).some((v) => isEqual(v, _info))) {
64
+ emit("error", `\u91CD\u590D\u7684\u5FEB\u6377\u952E=> ${getDisplaySignature(_info)}`);
65
+ return reject();
66
+ }
67
+ emit("update", { key: key2, info: _info });
68
+ shortcutCache[key2] = _info;
69
+ resolve();
70
+ }
71
+ expose({
72
+ loadSignature() {
73
+ loadSignature();
74
+ },
75
+ getSignature() {
76
+ return cloneDeep(shortcutCache);
77
+ },
78
+ setSignature() {
79
+ Object.entries(shortcutCache).forEach(([key2, info]) => {
80
+ manager.update(key2, info);
81
+ });
82
+ }
29
83
  });
30
- const components = { SHORTCUT: ShortcutSetterItem };
31
84
  return (_ctx, _cache) => {
32
85
  return openBlock(), createBlock(unref(FormRender), {
33
- key: String(props.glob),
86
+ key: key.value,
34
87
  "label-placement": "left",
35
- "field-list": unref(fieldList),
88
+ "field-list": fieldList.value,
36
89
  components
37
90
  }, null, 8, ["field-list"]);
38
91
  };