cnhis-design-vue 3.1.15-beta.0 → 3.1.15-beta.3

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 (46) hide show
  1. package/es/packages/annotation-edit/src/AnnotationEdit.js +2 -1
  2. package/es/packages/big-table/index.d.ts +12 -11
  3. package/es/packages/big-table/src/BigTable.vue.d.ts +28 -19
  4. package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +16 -11
  5. package/es/packages/big-table/src/bigTableProps.d.ts +5 -3
  6. package/es/packages/big-table/src/bigTableProps.js +1 -1
  7. package/es/packages/big-table/src/components/edit-form/edit-separate.js +18 -9
  8. package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +3 -1
  9. package/es/packages/big-table/src/hooks/useAnnotation.d.ts +4 -0
  10. package/es/packages/big-table/src/hooks/useAnnotation.js +21 -0
  11. package/es/packages/big-table/src/hooks/useEdit.d.ts +3 -1
  12. package/es/packages/big-table/style/index.css +27 -1
  13. package/es/packages/button-print/src/utils/print.d.ts +1 -1
  14. package/es/packages/button-print/src/utils/print.js +1 -1
  15. package/es/packages/fabric-chart/index.d.ts +1 -0
  16. package/es/packages/fabric-chart/src/FabricChart.js +12 -16
  17. package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +5 -4
  18. package/es/packages/fabric-chart/src/hooks/useCenter.js +29 -71
  19. package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +4 -2
  20. package/es/packages/form-render/src/components/renderer/cascader.js +7 -7
  21. package/es/packages/form-render/src/components/renderer/combination.js +11 -8
  22. package/es/packages/form-render/src/components/renderer/complex.d.ts +2 -0
  23. package/es/packages/form-render/src/components/renderer/complex.js +2 -5
  24. package/es/packages/form-render/src/components/renderer/date.d.ts +29 -0
  25. package/es/packages/form-render/src/components/renderer/date.js +63 -56
  26. package/es/packages/form-render/src/components/renderer/select.js +7 -7
  27. package/es/packages/form-render/src/hooks/useCommonInjection.d.ts +6 -0
  28. package/es/packages/form-render/src/hooks/useCommonInjection.js +19 -0
  29. package/es/packages/form-render/src/types/fieldItem.d.ts +15 -2
  30. package/es/packages/form-render/src/utils/index.d.ts +1 -0
  31. package/es/packages/form-render/src/utils/index.js +30 -2
  32. package/es/packages/form-render/style/index.css +11 -10
  33. package/es/packages/index.css +38 -11
  34. package/es/packages/shortcut-provider/index.d.ts +2 -11
  35. package/es/packages/shortcut-provider/src/ShortcutProvider.js +1 -5
  36. package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +2 -11
  37. package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +11 -8
  38. package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +44 -28
  39. package/es/packages/shortcut-provider/src/types/index.d.ts +32 -4
  40. package/es/packages/shortcut-provider/src/utils/index.d.ts +3 -0
  41. package/es/packages/shortcut-provider/src/utils/index.js +15 -5
  42. package/es/packages/shortcut-setter/index.d.ts +6 -4
  43. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -4
  44. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +6 -4
  45. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +6 -4
  46. package/package.json +1 -1
@@ -291,7 +291,7 @@ body > .vxe-table--tooltip-wrapper {
291
291
  width: 100%;
292
292
  }
293
293
  .custom-big-table .filter-box .text-over-tooltip-components {
294
- max-width: calc(100% - 20px);
294
+ max-width: calc(100% - 40px);
295
295
  }
296
296
  .custom-big-table .filter-box .vxe-filter--btn {
297
297
  border-top-color: #c0c4cc;
@@ -539,6 +539,21 @@ body > .vxe-table--tooltip-wrapper {
539
539
  margin-right: 6px;
540
540
  box-shadow: 0px 2px 4px 0px rgba(99, 129, 249, 0.5);
541
541
  }
542
+ .annotation-edit {
543
+ cursor: pointer;
544
+ color: #0067ee;
545
+ font-size: 16px;
546
+ user-select: none;
547
+ display: inline-flex;
548
+ align-items: center;
549
+ }
550
+ .annotation-edit.is-active {
551
+ color: rgba(255, 152, 40);
552
+ }
553
+ .annotation-edit__icon {
554
+ display: inline-flex;
555
+ align-items: center;
556
+ }
542
557
  .no-data-tip {
543
558
  display: flex;
544
559
  flex-direction: column;
@@ -601,6 +616,17 @@ body > .vxe-table--tooltip-wrapper {
601
616
  fill: currentColor;
602
617
  overflow: hidden;
603
618
  }
619
+ .vxe-header--column [annotation-hover-show='true'] {
620
+ visibility: hidden;
621
+ }
622
+ .vxe-header--column:hover [annotation-hover-show='true'] {
623
+ visibility: visible;
624
+ }
625
+ .big-table__annotationWrapper {
626
+ width: 20px;
627
+ display: inline-flex;
628
+ align-items: center;
629
+ }
604
630
  .people-tree {
605
631
  display: flex;
606
632
  }
@@ -2830,7 +2856,8 @@ body > .vxe-table--tooltip-wrapper {
2830
2856
  .form-render__formItem {
2831
2857
  grid-column: span var(--form-item-column) / span var(--form-item-column);
2832
2858
  }
2833
- .form-render__formItem .n-date-picker {
2859
+ .form-render__formItem .n-date-picker,
2860
+ .form-render__formItem .n-input-number {
2834
2861
  width: 100%;
2835
2862
  }
2836
2863
  .form-render__formItemLabel {
@@ -2847,6 +2874,15 @@ body > .vxe-table--tooltip-wrapper {
2847
2874
  transform: translateY(-50%);
2848
2875
  right: calc(var(--icon-right) * 1px);
2849
2876
  }
2877
+ .form-render__formItem .n-form-item-label {
2878
+ display: inline-flex;
2879
+ }
2880
+ .form-render__formItem .n-form-item-label [annotation-hover-show='true'] {
2881
+ visibility: hidden;
2882
+ }
2883
+ .form-render__formItem .n-form-item-label:hover [annotation-hover-show='true'] {
2884
+ visibility: visible;
2885
+ }
2850
2886
  .form-render__linebar {
2851
2887
  grid-column: span var(--column) / span var(--column);
2852
2888
  }
@@ -2936,15 +2972,6 @@ body > .vxe-table--tooltip-wrapper {
2936
2972
  display: flex !important;
2937
2973
  gap: 0 8px;
2938
2974
  }
2939
- .form-render .n-form-item-label {
2940
- display: inline-flex;
2941
- }
2942
- .form-render .n-form-item-label [annotation-hover-show='true'] {
2943
- visibility: hidden;
2944
- }
2945
- .form-render .n-form-item-label:hover [annotation-hover-show='true'] {
2946
- visibility: visible;
2947
- }
2948
2975
  .c-fabric-chart-popup-tip,
2949
2976
  .c-fabric-chart-popup-menu {
2950
2977
  position: absolute;
@@ -1,17 +1,8 @@
1
1
  import { SFCWithInstall } from '../../../es/src/types';
2
2
  export * from './src/hooks';
3
3
  export * from './src/types';
4
- declare const ShortcutProvider: SFCWithInstall<import("vue").DefineComponent<{
5
- cacheKey: StringConstructor;
6
- }, {
4
+ declare const ShortcutProvider: SFCWithInstall<import("vue").DefineComponent<{}, {
7
5
  shortcutWrapperRef: import("vue").Ref<HTMLElement | undefined>;
8
- props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
9
- cacheKey: StringConstructor;
10
- }>> & {
11
- [x: `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
12
- }>>;
13
6
  manager: import("./src/hooks").ShortcutManager;
14
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
- cacheKey: StringConstructor;
16
- }>>, {}>>;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
17
8
  export default ShortcutProvider;
@@ -5,13 +5,9 @@ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
5
5
 
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  __name: "ShortcutProvider",
8
- props: {
9
- cacheKey: String
10
- },
11
8
  setup(__props) {
12
- const props = __props;
13
9
  const shortcutWrapperRef = ref();
14
- const manager = new ShortcutManager(shortcutWrapperRef, props.cacheKey).start();
10
+ const manager = new ShortcutManager(shortcutWrapperRef).start();
15
11
  provide(InjectionShortcutManager, manager);
16
12
  onBeforeUnmount(() => {
17
13
  manager.destroy();
@@ -1,15 +1,6 @@
1
1
  import { ShortcutManager } from '../../../../es/packages/shortcut-provider';
2
- declare const _default: import("vue").DefineComponent<{
3
- cacheKey: StringConstructor;
4
- }, {
2
+ declare const _default: import("vue").DefineComponent<{}, {
5
3
  shortcutWrapperRef: import("vue").Ref<HTMLElement | undefined>;
6
- props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
7
- cacheKey: StringConstructor;
8
- }>> & {
9
- [x: `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
10
- }>>;
11
4
  manager: ShortcutManager;
12
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
13
- cacheKey: StringConstructor;
14
- }>>, {}>;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
15
6
  export default _default;
@@ -5,12 +5,13 @@ export declare class ShortcutManager {
5
5
  private readonly shortcutCache;
6
6
  private readonly environmentEle;
7
7
  private handle?;
8
+ disabled: boolean;
8
9
  static log(message: string, dryRun?: boolean): string;
9
- constructor(environmentEle?: MaybeRef<HTMLElement | undefined>, cacheKey?: string);
10
- get traverse(): unknown[];
11
- query(key: string): any;
12
- updateState(key: string, state?: boolean): void;
13
- update(key: string, info: KeyboardEvent | Partial<ShortcutSignatureInfo>): void;
10
+ constructor(environmentEle?: MaybeRef<HTMLElement | undefined>);
11
+ get traverse(): Omit<ShortcutItem, "callback">[];
12
+ query(key: string): Omit<ShortcutItem, "callback">;
13
+ updateDisabled(key: string, state?: boolean): Promise<void>;
14
+ update(key: string, info?: KeyboardEvent | Partial<ShortcutSignatureInfo>): Promise<void>;
14
15
  register(shortcutItem: ShortcutItem): {
15
16
  stop: () => void;
16
17
  signature: () => string;
@@ -23,8 +24,10 @@ export declare function useShortcuts(glob?: boolean): {
23
24
  stop: () => void;
24
25
  signature: () => string;
25
26
  };
26
- traverse: () => unknown[];
27
- query: (key: string) => any;
27
+ traverse: () => Omit<ShortcutItem, "callback">[];
28
+ query: (key: string) => Omit<ShortcutItem, "callback">;
28
29
  update: (key: string, info: KeyboardEvent | Partial<ShortcutSignatureInfo>) => void;
29
- updateState: (key: string, state?: boolean) => void;
30
+ onReset: (key: string) => void;
31
+ updateDisabled: (key: string, state?: boolean) => void;
32
+ updateManagerDisabled: (disabled?: boolean) => void;
30
33
  };
@@ -1,17 +1,15 @@
1
1
  import { ShortcutStatus, InjectionShortcutManager } from '../../../../packages/shortcut-provider/src/constants';
2
- import { getKeySignature, getDisplaySignature, isKeyboardEvent, findAncestor, isShortcutProvider } from '../../../../packages/shortcut-provider/src/utils';
3
- import { reactive, unref, getCurrentInstance, inject, onBeforeUnmount } from 'vue';
4
- import { useStorage, useEventListener, useDebounceFn } from '@vueuse/core';
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
+ import { useEventListener, useDebounceFn } from '@vueuse/core';
5
5
  import { pick, omit, isFunction, isString } from 'lodash-es';
6
6
 
7
7
  class ShortcutManager {
8
- constructor(environmentEle, cacheKey = "__shortcut__glob") {
8
+ constructor(environmentEle) {
9
9
  this.shortcutCallbackMap = reactive(/* @__PURE__ */ new Map());
10
+ this.shortcutCache = ref({});
11
+ this.disabled = false;
10
12
  this.environmentEle = environmentEle || window;
11
- this.shortcutCache = useStorage(cacheKey, {}, localStorage, {
12
- listenToStorageChanges: true,
13
- deep: true
14
- });
15
13
  }
16
14
  static log(message, dryRun = false) {
17
15
  const _message = `[ShortcutManager] ${message}`;
@@ -24,30 +22,43 @@ class ShortcutManager {
24
22
  query(key) {
25
23
  return this.shortcutCache.value[key];
26
24
  }
27
- updateState(key, state) {
28
- this.query(key) && (this.query(key).disabled = !!state);
29
- }
30
- update(key, info) {
25
+ async updateDisabled(key, state) {
31
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
+ async update(key, info) {
32
+ var _a, _b;
32
33
  const oldKeySignature = (_a = this.query(key)) == null ? void 0 : _a.currentKeySignature;
33
- if (oldKeySignature === getKeySignature(info))
34
- return;
35
- if (Object.values(this.shortcutCache.value).some((v) => v.currentKeySignature === getKeySignature(info))) {
36
- throw `\u91CD\u590D\u7684\u5FEB\u6377\u952E=> ${getDisplaySignature(info)}`;
37
- }
34
+ info && checkSignature(this.shortcutCache, info);
38
35
  const item = this.query(key);
39
36
  if (!item)
40
37
  return;
41
- item.currentKeySignature = getKeySignature(info);
42
- this.shortcutCallbackMap.set(getKeySignature(info), this.shortcutCallbackMap.get(oldKeySignature));
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);
43
+ this.shortcutCallbackMap.set(item.currentKeySignature, this.shortcutCallbackMap.get(oldKeySignature));
43
44
  this.shortcutCallbackMap.delete(oldKeySignature);
45
+ function checkSignature(shortcutCache, info2) {
46
+ if (oldKeySignature === getKeySignature(info2))
47
+ return;
48
+ if (Object.values(shortcutCache.value).some((v) => v.currentKeySignature === getKeySignature(info2))) {
49
+ throw `\u91CD\u590D\u7684\u5FEB\u6377\u952E=> ${getDisplaySignature(info2)}`;
50
+ }
51
+ if (isInvalidSignature(info2)) {
52
+ throw `\u975E\u6CD5\u7684\u5FEB\u6377\u952E=>${info2.key}`;
53
+ }
54
+ }
44
55
  }
45
56
  register(shortcutItem) {
46
57
  const item = this.query(shortcutItem.key);
47
58
  if (item) {
48
59
  item.status = ShortcutStatus.ACTIVE;
49
60
  this.shortcutCallbackMap.set(item.currentKeySignature, shortcutItem.callback);
50
- Object.assign(item, pick(shortcutItem, ["debounce", "debounceOption", "label", "defaultShortcut", "order", "key"]));
61
+ Object.assign(item, pick(shortcutItem, ["debounce", "debounceOption", "label", "order", "key"]));
51
62
  return createHandler(item);
52
63
  }
53
64
  this.shortcutCache.value[shortcutItem.key] = omit(shortcutItem, ["callback"]);
@@ -68,7 +79,7 @@ class ShortcutManager {
68
79
  return this;
69
80
  }
70
81
  this.handle = async (event) => {
71
- if (!isKeyboardEvent(event))
82
+ if (!isKeyboardEvent(event) || this.disabled)
72
83
  return;
73
84
  const providerWrapper = findAncestor(event.target, isShortcutProvider);
74
85
  if (providerWrapper && providerWrapper !== unref(this.environmentEle)) {
@@ -107,10 +118,9 @@ function useShortcuts(glob = false) {
107
118
  function createShortcutItem(shortcut) {
108
119
  return {
109
120
  ...shortcut,
110
- currentKeySignature: getKeySignature(shortcut.defaultShortcut),
121
+ currentKeySignature: getKeySignature(shortcut.shortcutSignature),
111
122
  key: keyFor(shortcut),
112
123
  status: ShortcutStatus.ACTIVE,
113
- disabled: false,
114
124
  callback: callbackFor(shortcut)
115
125
  };
116
126
  function callbackFor(shortcut2) {
@@ -132,10 +142,10 @@ function useShortcuts(glob = false) {
132
142
  }
133
143
  function register(shortcut) {
134
144
  const { stop, signature } = manager.register(createShortcutItem(shortcut));
135
- if (getCurrentInstance()) {
145
+ if (getCurrentInstance() && !glob) {
136
146
  onBeforeUnmount(stop);
137
147
  } else {
138
- ShortcutManager.log("\u5728\u975Esetup\u8BED\u5883\u4E0B\u4F7F\u7528register\u51FD\u6570,\u7EC4\u4EF6\u9500\u6BC1\u65F6\u9700\u8981\u624B\u52A8\u8C03\u7528stop\u51FD\u6570\u4F7F\u5FEB\u6377\u952E\u5931\u6D3B");
148
+ 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");
139
149
  }
140
150
  return { stop, signature };
141
151
  }
@@ -148,10 +158,16 @@ function useShortcuts(glob = false) {
148
158
  function update(key, info) {
149
159
  manager.update(key, info);
150
160
  }
151
- function updateState(key, state) {
152
- manager.updateState(key, state);
161
+ function onReset(key) {
162
+ manager.update(key);
163
+ }
164
+ function updateDisabled(key, state) {
165
+ manager.updateDisabled(key, state);
166
+ }
167
+ function updateManagerDisabled(disabled) {
168
+ manager.disabled = !!disabled;
153
169
  }
154
- return { register, traverse, query, update, updateState };
170
+ return { register, traverse, query, update, onReset, updateDisabled, updateManagerDisabled };
155
171
  }
156
172
 
157
173
  export { ShortcutManager, useShortcuts };
@@ -1,4 +1,4 @@
1
- import { ArrayAble } from '../../../../../es/src/types';
1
+ import { ArrayAble, WithUndefined } from '../../../../../es/src/types';
2
2
  import { VNode } from 'vue';
3
3
  import { ShortcutStatus } from '../../../../../es/packages/shortcut-provider/src/constants';
4
4
  declare type Render = () => ArrayAble<VNode>;
@@ -8,25 +8,53 @@ export interface ShortcutSignatureInfo {
8
8
  alt?: boolean;
9
9
  key: string;
10
10
  }
11
+ declare type UpdateResult = Promise<WithUndefined<ShortcutSignatureInfo> | void>;
11
12
  export declare type ShortcutOption = {
12
13
  label: string | Render;
13
- defaultShortcut: ShortcutSignatureInfo;
14
+ shortcutSignature: ShortcutSignatureInfo;
14
15
  callback(): void;
15
16
  } & Partial<{
17
+ /**
18
+ * @description 重置时回调
19
+ * @param key
20
+ */
21
+ onReset(key: string): Promise<any>;
22
+ /**
23
+ * @description 更新快捷键回调
24
+ * @param key
25
+ * @param newSignature 用户输入的快捷键签名
26
+ * @return
27
+ */
28
+ onUpdate(key: string, newSignature?: ShortcutSignatureInfo): UpdateResult;
29
+ /**
30
+ * @description 更新快捷键disabled状态回调
31
+ * @param key
32
+ * @param newState
33
+ */
34
+ onUpdateDisabled(key: string, newState?: boolean): Promise<any>;
35
+ /**
36
+ * 快捷键输入框展位文本
37
+ */
16
38
  placeholder: string;
39
+ /**
40
+ * 快捷键输入框编辑状态下的展位文本
41
+ */
17
42
  editPlaceholder: string;
18
43
  key: string;
19
44
  order: number;
45
+ disabled: boolean;
20
46
  debounce: boolean;
21
47
  debounceOption: {
22
48
  duration?: number;
23
49
  };
24
- operation: Array<'disabled' | 'reset'>;
50
+ /**
51
+ * 快捷键编辑组件的操作按钮
52
+ */
53
+ operation: Array<'state' | 'reset'>;
25
54
  }>;
26
55
  export interface ShortcutItem extends ShortcutOption {
27
56
  status: ShortcutStatus;
28
57
  currentKeySignature: string;
29
58
  key: string;
30
- disabled: boolean;
31
59
  }
32
60
  export {};
@@ -1,6 +1,9 @@
1
1
  import { ShortcutSignatureInfo } from '../../../../../es/packages/shortcut-provider/src/types';
2
2
  export declare function isKeyboardEvent(event: any): event is KeyboardEvent;
3
+ export declare function normalizeSignatureInfo(info: KeyboardEvent | Partial<ShortcutSignatureInfo>): Required<ShortcutSignatureInfo>;
3
4
  export declare function getKeySignature(info: KeyboardEvent | Partial<ShortcutSignatureInfo>): string;
5
+ export declare function inKeyBlackList(key: string): boolean | undefined;
6
+ export declare function isInvalidSignature(info: KeyboardEvent | Partial<ShortcutSignatureInfo>): boolean | undefined;
4
7
  export declare function getDisplaySignature(info: KeyboardEvent | Partial<ShortcutSignatureInfo>): string;
5
8
  export declare function transformKey2DisplaySignature(keySignature: string): string;
6
9
  export declare function isShortcutProvider(ele: HTMLElement): boolean;
@@ -1,3 +1,5 @@
1
+ import { isString } from 'lodash-es';
2
+
1
3
  function isKeyboardEvent(event) {
2
4
  return Reflect.get(event, "view") === window && Reflect.get(event, "shiftKey") != void 0;
3
5
  }
@@ -21,12 +23,20 @@ function getKeySignature(info) {
21
23
  return `${ctrl ? "Ctrl_" : ""}${shift ? "Shift_" : ""}${alt ? "Alt_" : ""}${key}`;
22
24
  }
23
25
  const keyBlackList = ["CONTROL", "ALT", "SHIFT"];
24
- const inBlackList = (key) => {
25
- return keyBlackList.includes(key);
26
- };
26
+ function inKeyBlackList(key) {
27
+ if (!isString(key))
28
+ return;
29
+ return keyBlackList.includes(key.toUpperCase());
30
+ }
31
+ function isInvalidSignature(info) {
32
+ const { ctrl, shift, alt, key } = normalizeSignatureInfo(info);
33
+ if (!ctrl && !shift && !alt)
34
+ return !/F\d/.test(key);
35
+ return inKeyBlackList(key);
36
+ }
27
37
  function getDisplaySignature(info) {
28
38
  const { ctrl, shift, alt, key } = normalizeSignatureInfo(info);
29
- return `${ctrl ? "Ctrl+ " : ""}${alt ? "Alt + " : ""}${shift ? "Shift + " : ""}${inBlackList(key) ? "" : key}`;
39
+ return `${ctrl ? "Ctrl+ " : ""}${alt ? "Alt + " : ""}${shift ? "Shift + " : ""}${inKeyBlackList(key) ? "" : key}`;
30
40
  }
31
41
  function transformKey2DisplaySignature(keySignature) {
32
42
  return keySignature.replace(/_/g, " + ");
@@ -46,4 +56,4 @@ function findAncestor(ele, finder) {
46
56
  return next;
47
57
  }
48
58
 
49
- export { findAncestor, getDisplaySignature, getKeySignature, isKeyboardEvent, isShortcutProvider, transformKey2DisplaySignature };
59
+ export { findAncestor, getDisplaySignature, getKeySignature, inKeyBlackList, isInvalidSignature, isKeyboardEvent, isShortcutProvider, normalizeSignatureInfo, transformKey2DisplaySignature };
@@ -59,10 +59,12 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
59
59
  editPlaceholder: string;
60
60
  operation: ("disabled" | "reset")[];
61
61
  };
62
- query: (key: string) => any;
62
+ query: (key: string) => Omit<import("..").ShortcutItem, "callback">;
63
63
  update: (key: string, info: KeyboardEvent | Partial<import("..").ShortcutSignatureInfo>) => void;
64
- updateState: (key: string, state?: boolean | undefined) => void;
65
- shortcutItem: import("vue").ComputedRef<any>;
64
+ updateState: any;
65
+ onReset: (key: string) => void;
66
+ updateManagerDisabled: (disabled?: boolean | undefined) => void;
67
+ shortcutItem: import("vue").ComputedRef<Omit<import("..").ShortcutItem, "callback">>;
66
68
  disabledState: import("vue").ComputedRef<boolean>;
67
69
  currentSetShortcut: import("vue").ComputedRef<string>;
68
70
  state: import("vue").Ref<import("./constant").ShortcutInputState>;
@@ -79,7 +81,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
79
81
  updateDecorator: (fn: () => unknown, afterUpdate?: (() => void) | undefined) => void;
80
82
  onInputKeyUp: import("lodash").DebouncedFuncLeading<(event: KeyboardEvent) => void>;
81
83
  onStop: () => void;
82
- onReset: () => void;
84
+ onSignatureReset: () => void;
83
85
  NButton: import("vue").DefineComponent<{
84
86
  readonly color: StringConstructor;
85
87
  readonly textColor: StringConstructor;
@@ -59,10 +59,12 @@ declare const _default: import("vue").DefineComponent<{
59
59
  editPlaceholder: string;
60
60
  operation: ("disabled" | "reset")[];
61
61
  };
62
- query: (key: string) => any;
62
+ query: (key: string) => Omit<import("../../../../es/packages/shortcut-provider").ShortcutItem, "callback">;
63
63
  update: (key: string, info: KeyboardEvent | Partial<import("../../../../es/packages/shortcut-provider").ShortcutSignatureInfo>) => void;
64
- updateState: (key: string, state?: boolean | undefined) => void;
65
- shortcutItem: import("vue").ComputedRef<any>;
64
+ updateState: any;
65
+ onReset: (key: string) => void;
66
+ updateManagerDisabled: (disabled?: boolean | undefined) => void;
67
+ shortcutItem: import("vue").ComputedRef<Omit<import("../../../../es/packages/shortcut-provider").ShortcutItem, "callback">>;
66
68
  disabledState: import("vue").ComputedRef<boolean>;
67
69
  currentSetShortcut: import("vue").ComputedRef<string>;
68
70
  state: import("vue").Ref<import("../constant").ShortcutInputState>;
@@ -79,7 +81,7 @@ declare const _default: import("vue").DefineComponent<{
79
81
  updateDecorator: (fn: () => unknown, afterUpdate?: (() => void) | undefined) => void;
80
82
  onInputKeyUp: import("lodash").DebouncedFuncLeading<(event: KeyboardEvent) => void>;
81
83
  onStop: () => void;
82
- onReset: () => void;
84
+ onSignatureReset: () => void;
83
85
  NButton: import("vue").DefineComponent<{
84
86
  readonly color: StringConstructor;
85
87
  readonly textColor: StringConstructor;
@@ -24,7 +24,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
24
24
  },
25
25
  setup(__props) {
26
26
  const props = __props;
27
- const { query, update, updateState } = useShortcuts(props.glob);
27
+ const { query, update, updateState, onReset, updateManagerDisabled } = useShortcuts(props.glob);
28
28
  const shortcutItem = computed(() => {
29
29
  return query(props.fieldItem.val_key);
30
30
  });
@@ -49,11 +49,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
49
  return isEditState.value ? props.placeholder : props.editPlaceholder;
50
50
  });
51
51
  function onInputFocus() {
52
+ updateManagerDisabled(true);
52
53
  state.value = ShortcutInputState.EDIT;
53
54
  }
54
55
  const inputRef = ref();
55
56
  function onInputBlur() {
56
57
  var _a;
58
+ updateManagerDisabled(false);
57
59
  state.value = ShortcutInputState.STATIC;
58
60
  currentEditShortcut.value = "";
59
61
  (_a = inputRef.value) == null ? void 0 : _a.blur();
@@ -78,10 +80,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
78
80
  return;
79
81
  updateDecorator(() => updateState(props.fieldItem.val_key, !disabledState.value), onInputBlur);
80
82
  }
81
- function onReset() {
83
+ function onSignatureReset() {
82
84
  if (!shortcutItem.value)
83
85
  return;
84
- updateDecorator(() => update(props.fieldItem.val_key, shortcutItem.value.defaultShortcut), onInputBlur);
86
+ updateDecorator(() => onReset(props.fieldItem.val_key), onInputBlur);
85
87
  }
86
88
  return (_ctx, _cache) => {
87
89
  return openBlock(), createElementBlock("section", _hoisted_1, [
@@ -110,7 +112,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
110
112
  }, 8, ["type"])) : createCommentVNode("v-if", true),
111
113
  hasOperation("reset") ? (openBlock(), createBlock(unref(NPopconfirm), {
112
114
  key: 1,
113
- onPositiveClick: onReset
115
+ onPositiveClick: onSignatureReset
114
116
  }, {
115
117
  trigger: withCtx(() => [
116
118
  createVNode(unref(NButton), {
@@ -49,10 +49,12 @@ declare const _default: import("vue").DefineComponent<{
49
49
  editPlaceholder: string;
50
50
  operation: Array<'disabled' | 'reset'>;
51
51
  };
52
- query: (key: string) => any;
52
+ query: (key: string) => Omit<import("../../../../es/packages/shortcut-provider").ShortcutItem, "callback">;
53
53
  update: (key: string, info: KeyboardEvent | Partial<import("../../../../es/packages/shortcut-provider").ShortcutSignatureInfo>) => void;
54
- updateState: (key: string, state?: boolean | undefined) => void;
55
- shortcutItem: import("vue").ComputedRef<any>;
54
+ updateState: any;
55
+ onReset: (key: string) => void;
56
+ updateManagerDisabled: (disabled?: boolean | undefined) => void;
57
+ shortcutItem: import("vue").ComputedRef<Omit<import("../../../../es/packages/shortcut-provider").ShortcutItem, "callback">>;
56
58
  disabledState: import("vue").ComputedRef<boolean>;
57
59
  currentSetShortcut: import("vue").ComputedRef<string>;
58
60
  state: import("vue").Ref<ShortcutInputState>;
@@ -69,7 +71,7 @@ declare const _default: import("vue").DefineComponent<{
69
71
  updateDecorator: (fn: () => unknown, afterUpdate?: () => void) => void;
70
72
  onInputKeyUp: import("lodash").DebouncedFuncLeading<(event: KeyboardEvent) => void>;
71
73
  onStop: () => void;
72
- onReset: () => void;
74
+ onSignatureReset: () => void;
73
75
  NButton: import("vue").DefineComponent<{
74
76
  readonly color: StringConstructor;
75
77
  readonly textColor: StringConstructor;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
3
  "private": false,
4
- "version": "3.1.15-beta.0",
4
+ "version": "3.1.15-beta.3",
5
5
  "license": "ISC",
6
6
  "module": "es/packages/index.js",
7
7
  "main": "es/packages/index.js",