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

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