cnhis-design-vue 3.1.15-beta.7 → 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 (65) 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/shortcut-provider/index.d.ts +17 -2
  47. package/es/packages/shortcut-provider/index.js +1 -1
  48. package/es/packages/shortcut-provider/src/ShortcutProvider.js +5 -1
  49. package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +17 -2
  50. package/es/packages/shortcut-provider/src/hooks/index.js +1 -1
  51. package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +10 -10
  52. package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +45 -38
  53. package/es/packages/shortcut-provider/src/types/index.d.ts +2 -19
  54. package/es/packages/shortcut-setter/index.d.ts +2 -6040
  55. package/es/packages/shortcut-setter/src/ShortcutSetter.js +60 -10
  56. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -6041
  57. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +26 -95
  58. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +30 -3363
  59. package/es/packages/shortcut-setter/src/types/index.d.ts +6 -0
  60. package/es/packages/shortcut-setter/src/types/index.js +1 -0
  61. package/es/src/utils/state.d.ts +29 -0
  62. package/es/src/utils/state.js +44 -0
  63. package/package.json +2 -1
  64. package/es/packages/shortcut-setter/constant/index.d.ts +0 -4
  65. package/es/packages/shortcut-setter/constant/index.js +0 -7
@@ -1,15 +1,18 @@
1
- import { ShortcutStatus, InjectionShortcutManager } from '../../../../packages/shortcut-provider/src/constants';
2
- import { normalizeSignatureInfo, getKeySignature, getDisplaySignature, isInvalidSignature, isKeyboardEvent, findAncestor, isShortcutProvider } from '../../../../packages/shortcut-provider/src/utils';
3
- import { reactive, ref, unref, getCurrentInstance, inject, onBeforeUnmount } from 'vue';
4
1
  import { useEventListener, useDebounceFn } from '@vueuse/core';
5
2
  import { pick, omit, isFunction, isString } from 'lodash-es';
3
+ import { reactive, ref, unref, computed, getCurrentInstance, inject, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
4
+ import { ShortcutStatus, InjectionShortcutManager } from '../../../../packages/shortcut-provider/src/constants';
5
+ import { normalizeSignatureInfo, getKeySignature, getDisplaySignature, isInvalidSignature, isKeyboardEvent, findAncestor, isShortcutProvider } from '../../../../packages/shortcut-provider/src/utils';
6
6
 
7
+ const GlobalShortcutProvider = Symbol("Glob");
8
+ const ShortcutManagerCacheMap = /* @__PURE__ */ new Map();
7
9
  class ShortcutManager {
8
- constructor(environmentEle) {
10
+ constructor(environmentEle, scope = GlobalShortcutProvider) {
9
11
  this.shortcutCallbackMap = reactive(/* @__PURE__ */ new Map());
10
12
  this.shortcutCache = ref({});
11
13
  this.disabled = false;
12
14
  this.environmentEle = environmentEle || window;
15
+ ShortcutManagerCacheMap.set(scope, this);
13
16
  }
14
17
  static log(message, dryRun = false) {
15
18
  const _message = `[ShortcutManager] ${message}`;
@@ -22,12 +25,6 @@ class ShortcutManager {
22
25
  query(key) {
23
26
  return this.shortcutCache.value[key];
24
27
  }
25
- async updateDisabled(key, state) {
26
- var _a;
27
- const item = this.query(key);
28
- await ((_a = item.onUpdateDisabled) == null ? void 0 : _a.call(item, key, state));
29
- item.disabled = !!state;
30
- }
31
28
  async update(key, info) {
32
29
  var _a, _b;
33
30
  const oldKeySignature = (_a = this.query(key)) == null ? void 0 : _a.currentKeySignature;
@@ -35,11 +32,10 @@ class ShortcutManager {
35
32
  const item = this.query(key);
36
33
  if (!item)
37
34
  return;
38
- const newInfo = await ((_b = item.onUpdate) == null ? void 0 : _b.call(item, key, info ? normalizeSignatureInfo(info) : void 0)) || info;
39
- if (!newInfo)
40
- return;
41
- checkSignature(this.shortcutCache, newInfo);
42
- item.currentKeySignature = getKeySignature(newInfo);
35
+ await ((_b = item.onUpdate) == null ? void 0 : _b.call(item, key, info ? normalizeSignatureInfo(info) : void 0));
36
+ checkSignature(this.shortcutCache, info);
37
+ item.currentKeySignature = getKeySignature(info);
38
+ item.shortcutSignature = normalizeSignatureInfo(info);
43
39
  this.shortcutCallbackMap.set(item.currentKeySignature, this.shortcutCallbackMap.get(oldKeySignature));
44
40
  this.shortcutCallbackMap.delete(oldKeySignature);
45
41
  function checkSignature(shortcutCache, info2) {
@@ -69,6 +65,9 @@ class ShortcutManager {
69
65
  stop: () => {
70
66
  shortcut.status = ShortcutStatus.INACTIVE;
71
67
  },
68
+ start: () => {
69
+ shortcut.status = ShortcutStatus.ACTIVE;
70
+ },
72
71
  signature: () => shortcut.currentKeySignature
73
72
  };
74
73
  }
@@ -101,23 +100,35 @@ class ShortcutManager {
101
100
  var _a;
102
101
  this.handle && ((_a = unref(this.environmentEle)) == null ? void 0 : _a.removeEventListener("keyup", this.handle, { capture: true }));
103
102
  this.handle = void 0;
103
+ this.clear();
104
+ }
105
+ clear() {
104
106
  this.shortcutCallbackMap.clear();
107
+ this.shortcutCache.value = {};
105
108
  }
106
109
  }
107
110
  const globManager = new ShortcutManager().start();
108
- function useShortcuts(glob = false) {
111
+ function useShortcuts(scope) {
109
112
  function useManager() {
110
- if (getCurrentInstance() && !glob) {
111
- return inject(InjectionShortcutManager, globManager);
112
- } else {
113
- ShortcutManager.log("\u975Esetup\u8BED\u5883\u4E0B\u7684shortcut\u5C06\u5F71\u54CD\u5168\u5C40");
114
- return globManager;
115
- }
113
+ return computed(() => {
114
+ if (unref(scope)) {
115
+ const result = ShortcutManagerCacheMap.get(unref(scope));
116
+ if (!result)
117
+ ShortcutManager.log(`\u4E0D\u5B58\u5728\u7684scope=>${scope}, \u5C06\u4F7F\u7528\u5168\u5C40\u5FEB\u6377\u952E`);
118
+ return result || globManager;
119
+ } else if (getCurrentInstance()) {
120
+ return inject(InjectionShortcutManager, globManager);
121
+ } else {
122
+ ShortcutManager.log("\u975Esetup\u8BED\u5883\u4E0B\u7684shortcut\u5C06\u5F71\u54CD\u5168\u5C40");
123
+ return globManager;
124
+ }
125
+ });
116
126
  }
117
127
  const manager = useManager();
118
128
  function createShortcutItem(shortcut) {
119
129
  return {
120
130
  ...shortcut,
131
+ shortcutSignature: normalizeSignatureInfo(shortcut.shortcutSignature),
121
132
  currentKeySignature: getKeySignature(shortcut.shortcutSignature),
122
133
  key: keyFor(shortcut),
123
134
  status: ShortcutStatus.ACTIVE,
@@ -141,33 +152,29 @@ function useShortcuts(glob = false) {
141
152
  }
142
153
  }
143
154
  function register(shortcut) {
144
- const { stop, signature } = manager.register(createShortcutItem(shortcut));
145
- if (getCurrentInstance() && !glob) {
155
+ const { stop, signature, start } = unref(manager).register(createShortcutItem(shortcut));
156
+ if (getCurrentInstance()) {
146
157
  onBeforeUnmount(stop);
158
+ onDeactivated(stop);
159
+ onActivated(start);
147
160
  } else {
148
161
  ShortcutManager.log("\u5728\u975Esetup\u8BED\u5883\u4E0B\u4F7F\u7528register\u51FD\u6570,\u7EC4\u4EF6\u9500\u6BC1\u65F6\u53EF\u80FD\u9700\u8981\u624B\u52A8\u8C03\u7528stop\u51FD\u6570\u4F7F\u5FEB\u6377\u952E\u5931\u6D3B");
149
162
  }
150
163
  return { stop, signature };
151
164
  }
152
165
  function traverse() {
153
- return glob ? globManager.traverse : manager.traverse;
154
- }
155
- function query(key) {
156
- return manager.query(key);
166
+ return unref(manager).traverse;
157
167
  }
158
168
  function update(key, info) {
159
- manager.update(key, info);
160
- }
161
- function onReset(key) {
162
- manager.update(key);
163
- }
164
- function updateDisabled(key, state) {
165
- manager.updateDisabled(key, state);
169
+ return unref(manager).update(key, info);
166
170
  }
167
171
  function updateManagerDisabled(disabled) {
168
- manager.disabled = !!disabled;
172
+ unref(manager).disabled = !!disabled;
173
+ }
174
+ function clear() {
175
+ unref(manager).clear();
169
176
  }
170
- return { register, traverse, query, update, onReset, updateDisabled, updateManagerDisabled };
177
+ return { register, traverse, clear, update, updateManagerDisabled };
171
178
  }
172
179
 
173
- export { ShortcutManager, useShortcuts };
180
+ export { GlobalShortcutProvider, ShortcutManager, useShortcuts };
@@ -1,37 +1,21 @@
1
- import { ArrayAble, WithUndefined } from '../../../../../es/src/types';
2
- import { VNode } from 'vue';
3
1
  import { ShortcutStatus } from '../../../../../es/packages/shortcut-provider/src/constants';
4
- declare type Render = () => ArrayAble<VNode>;
5
2
  export interface ShortcutSignatureInfo {
6
3
  ctrl?: boolean;
7
4
  shift?: boolean;
8
5
  alt?: boolean;
9
6
  key: string;
10
7
  }
11
- declare type UpdateResult = Promise<WithUndefined<ShortcutSignatureInfo> | void>;
12
8
  export declare type ShortcutOption = {
13
- label: string | Render;
9
+ label: string;
14
10
  shortcutSignature: ShortcutSignatureInfo;
15
11
  callback(): void;
16
12
  } & Partial<{
17
- /**
18
- * @description 重置时回调
19
- * @param key
20
- */
21
- onReset(key: string): Promise<any>;
22
13
  /**
23
14
  * @description 更新快捷键回调
24
15
  * @param key
25
16
  * @param newSignature 用户输入的快捷键签名
26
- * @return
27
- */
28
- onUpdate(key: string, newSignature?: ShortcutSignatureInfo): UpdateResult;
29
- /**
30
- * @description 更新快捷键disabled状态回调
31
- * @param key
32
- * @param newState
33
17
  */
34
- onUpdateDisabled(key: string, newState?: boolean): Promise<any>;
18
+ onUpdate(key: string, newSignature?: ShortcutSignatureInfo): Promise<void>;
35
19
  /**
36
20
  * 快捷键输入框展位文本
37
21
  */
@@ -57,4 +41,3 @@ export interface ShortcutItem extends ShortcutOption {
57
41
  currentKeySignature: string;
58
42
  key: string;
59
43
  }
60
- export {};