cnhis-design-vue 3.1.13-beta.0 → 3.1.13-beta.11
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.
- package/es/packages/big-table/src/BigTable.vue.d.ts +3 -16
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +40 -21
- package/es/packages/big-table/src/bigTableEmits.js +2 -1
- package/es/packages/big-table/src/utils.js +2 -1
- package/es/packages/big-table/style/index.css +5 -0
- package/es/packages/bpmn-workflow/src/BpmnWorkflow.d.ts +5 -0
- package/es/packages/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/packages/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/packages/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/packages/button-print/index.d.ts +15 -1
- package/es/packages/button-print/src/ButtonPrint.vue.d.ts +199 -185
- package/es/packages/button-print/src/ButtonPrint.vue_vue_type_script_setup_true_lang.js +39 -4
- package/es/packages/button-print/src/utils/print.d.ts +41 -0
- package/es/packages/button-print/src/utils/print.js +325 -0
- package/es/packages/fabric-chart/index.d.ts +3 -4
- package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +3 -4
- package/es/packages/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +24 -18
- package/es/packages/fabric-chart/src/hooks/useBottom.js +1 -2
- package/es/packages/fabric-chart/src/hooks/useCenter.js +89 -19
- package/es/packages/fabric-chart/src/hooks/useCumputedPoint.d.ts +2 -2
- package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +27 -13
- package/es/packages/fabric-chart/src/hooks/useDraw.d.ts +1 -1
- package/es/packages/fabric-chart/src/hooks/useDraw.js +64 -7
- package/es/packages/fabric-chart/src/hooks/useLeft.js +83 -22
- package/es/packages/fabric-chart/src/hooks/useOther.js +3 -2
- package/es/packages/fabric-chart/src/hooks/useShadow.js +1 -1
- package/es/packages/fabric-chart/src/hooks/useTop.js +6 -4
- package/es/packages/fabric-chart/src/interface.d.ts +2 -2
- package/es/packages/fabric-chart/src/utils/index.d.ts +6823 -2
- package/es/packages/form-render/index.d.ts +311 -0
- package/es/packages/form-render/src/FormRender.vue.d.ts +313 -2
- package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.js +58 -27
- package/es/packages/form-render/src/components/renderer/cascader.d.ts +7 -1
- package/es/packages/form-render/src/components/renderer/cascader.js +65 -53
- package/es/packages/form-render/src/components/renderer/formItem.d.ts +8 -293
- package/es/packages/form-render/src/components/renderer/formItem.js +137 -2
- package/es/packages/form-render/src/components/renderer/input.js +3 -3
- package/es/packages/form-render/src/components/renderer/select.d.ts +7 -5
- package/es/packages/form-render/src/components/renderer/select.js +35 -40
- package/es/packages/form-render/src/components/renderer/simpleComponent.js +2 -15
- package/es/packages/form-render/src/constants/index.d.ts +2 -1
- package/es/packages/form-render/src/constants/index.js +2 -1
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -2
- package/es/packages/form-render/src/hooks/useFormContext.d.ts +2 -1
- package/es/packages/form-render/src/hooks/useFormContext.js +13 -2
- package/es/packages/form-render/src/types/fieldItem.d.ts +58 -7
- package/es/packages/form-render/src/types/index.d.ts +5 -0
- package/es/packages/form-render/src/utils/index.d.ts +13 -4
- package/es/packages/form-render/src/utils/index.js +44 -3
- package/es/packages/form-render/style/index.css +44 -6
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.d.ts +4 -0
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +18 -0
- package/es/packages/index.css +228 -8
- package/es/packages/index.d.ts +5 -1
- package/es/packages/index.js +12 -1
- package/es/packages/scale-view/src/hooks/scaleview-init.js +1 -5
- package/es/packages/scale-view/src/hooks/scaleview-submit.js +1 -6
- package/es/packages/scale-view/src/hooks/scaleview-validate.js +0 -3
- package/es/packages/shortcut-provider/index.d.ts +17 -0
- package/es/packages/shortcut-provider/index.js +13 -0
- package/es/packages/shortcut-provider/src/ShortcutProvider.js +4 -0
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +15 -0
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue_vue_type_script_setup_true_lang.js +32 -0
- package/es/packages/shortcut-provider/src/constants/index.d.ts +7 -0
- package/es/packages/shortcut-provider/src/constants/index.js +8 -0
- package/es/packages/shortcut-provider/src/hooks/index.d.ts +2 -0
- package/es/packages/shortcut-provider/src/hooks/index.js +2 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.d.ts +4 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.js +12 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +30 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +157 -0
- package/es/packages/shortcut-provider/src/types/index.d.ts +30 -0
- package/es/packages/shortcut-provider/src/types/index.js +1 -0
- package/es/packages/shortcut-provider/src/utils/index.d.ts +7 -0
- package/es/packages/shortcut-provider/src/utils/index.js +49 -0
- package/es/packages/shortcut-provider/style/index.css +3 -0
- package/es/packages/shortcut-setter/constant/index.d.ts +4 -0
- package/es/packages/shortcut-setter/constant/index.js +7 -0
- package/es/packages/shortcut-setter/index.d.ts +4258 -0
- package/es/packages/shortcut-setter/index.js +11 -0
- package/es/packages/shortcut-setter/src/ShortcutSetter.js +4 -0
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +4258 -0
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue_vue_type_script_setup_true_lang.js +38 -0
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +4 -0
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +4238 -0
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue_vue_type_script_setup_true_lang.js +125 -0
- package/es/packages/shortcut-setter/style/index.css +8 -0
- package/es/packages/steps-wheel/index.d.ts +548 -0
- package/es/packages/steps-wheel/index.js +11 -0
- package/es/packages/steps-wheel/src/StepsWheel.js +4 -0
- package/es/packages/steps-wheel/src/StepsWheel.vue.d.ts +547 -0
- package/es/packages/steps-wheel/src/StepsWheel.vue_vue_type_script_setup_true_lang.js +252 -0
- package/es/packages/steps-wheel/style/index.css +161 -0
- package/es/packages/time-line/index.d.ts +1 -0
- package/es/packages/time-line/src/TimeLine.vue.d.ts +1 -0
- package/es/packages/time-line/src/TimeLine.vue_vue_type_script_setup_true_lang.js +6 -1
- package/es/packages/time-line/style/index.css +7 -2
- package/es/src/types/index.d.ts +1 -0
- package/package.json +153 -153
- package/es/packages/button-print/src/utils/print.es.min.d.ts +0 -2
- package/es/packages/button-print/src/utils/print.es.min.js +0 -2532
- package/test.ts +0 -326
|
@@ -0,0 +1,157 @@
|
|
|
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';
|
|
5
|
+
import { pick, omit, isFunction, isString } from 'lodash-es';
|
|
6
|
+
|
|
7
|
+
class ShortcutManager {
|
|
8
|
+
constructor(environmentEle, cacheKey = "__shortcut__glob") {
|
|
9
|
+
this.shortcutCallbackMap = reactive(/* @__PURE__ */ new Map());
|
|
10
|
+
this.environmentEle = environmentEle || window;
|
|
11
|
+
this.shortcutCache = useStorage(cacheKey, {}, localStorage, {
|
|
12
|
+
listenToStorageChanges: true,
|
|
13
|
+
deep: true
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static log(message, dryRun = false) {
|
|
17
|
+
const _message = `[ShortcutManager] ${message}`;
|
|
18
|
+
!dryRun && console.warn(_message);
|
|
19
|
+
return _message;
|
|
20
|
+
}
|
|
21
|
+
get traverse() {
|
|
22
|
+
return [...Object.values(this.shortcutCache.value)].sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
23
|
+
}
|
|
24
|
+
query(key) {
|
|
25
|
+
return this.shortcutCache.value[key];
|
|
26
|
+
}
|
|
27
|
+
updateState(key, state) {
|
|
28
|
+
this.query(key) && (this.query(key).disabled = !!state);
|
|
29
|
+
}
|
|
30
|
+
update(key, info) {
|
|
31
|
+
var _a;
|
|
32
|
+
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
|
+
}
|
|
38
|
+
const item = this.query(key);
|
|
39
|
+
if (!item)
|
|
40
|
+
return;
|
|
41
|
+
item.currentKeySignature = getKeySignature(info);
|
|
42
|
+
this.shortcutCallbackMap.set(getKeySignature(info), this.shortcutCallbackMap.get(oldKeySignature));
|
|
43
|
+
this.shortcutCallbackMap.delete(oldKeySignature);
|
|
44
|
+
}
|
|
45
|
+
register(shortcutItem) {
|
|
46
|
+
const item = this.query(shortcutItem.key);
|
|
47
|
+
if (item) {
|
|
48
|
+
item.status = ShortcutStatus.ACTIVE;
|
|
49
|
+
this.shortcutCallbackMap.set(item.currentKeySignature, shortcutItem.callback);
|
|
50
|
+
Object.assign(item, pick(shortcutItem, ["debounce", "debounceOption", "label", "defaultShortcut", "order", "key"]));
|
|
51
|
+
return createHandler(item);
|
|
52
|
+
}
|
|
53
|
+
this.shortcutCache.value[shortcutItem.key] = omit(shortcutItem, ["callback"]);
|
|
54
|
+
this.shortcutCallbackMap.set(shortcutItem.currentKeySignature, shortcutItem.callback);
|
|
55
|
+
return createHandler(this.shortcutCache.value[shortcutItem.key]);
|
|
56
|
+
function createHandler(shortcut) {
|
|
57
|
+
return {
|
|
58
|
+
stop: () => {
|
|
59
|
+
shortcut.status = ShortcutStatus.INACTIVE;
|
|
60
|
+
},
|
|
61
|
+
signature: () => shortcut.currentKeySignature
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
start() {
|
|
66
|
+
if (this.handle) {
|
|
67
|
+
ShortcutManager.log(`\u8BF7\u52FF\u91CD\u590D\u542F\u52A8=>${this}`);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
this.handle = async (event) => {
|
|
71
|
+
if (!isKeyboardEvent(event))
|
|
72
|
+
return;
|
|
73
|
+
const providerWrapper = findAncestor(event.target, isShortcutProvider);
|
|
74
|
+
if (providerWrapper && providerWrapper !== unref(this.environmentEle)) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const keySignature = getKeySignature(event);
|
|
78
|
+
const callback = this.shortcutCallbackMap.get(keySignature);
|
|
79
|
+
if (!callback)
|
|
80
|
+
return;
|
|
81
|
+
const shortcutItem = Object.values(this.shortcutCache.value).find((item) => item.currentKeySignature === keySignature);
|
|
82
|
+
if (!shortcutItem || shortcutItem.status !== ShortcutStatus.ACTIVE || shortcutItem.disabled)
|
|
83
|
+
return;
|
|
84
|
+
callback();
|
|
85
|
+
};
|
|
86
|
+
useEventListener(this.environmentEle, "keyup", this.handle, { capture: true });
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
destroy() {
|
|
90
|
+
var _a;
|
|
91
|
+
this.handle && ((_a = unref(this.environmentEle)) == null ? void 0 : _a.removeEventListener("keyup", this.handle, { capture: true }));
|
|
92
|
+
this.handle = void 0;
|
|
93
|
+
this.shortcutCallbackMap.clear();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const globManager = new ShortcutManager().start();
|
|
97
|
+
function useShortcuts(glob = false) {
|
|
98
|
+
function useManager() {
|
|
99
|
+
if (getCurrentInstance() && !glob) {
|
|
100
|
+
return inject(InjectionShortcutManager, globManager);
|
|
101
|
+
} else {
|
|
102
|
+
ShortcutManager.log("\u975Esetup\u8BED\u5883\u4E0B\u7684shortcut\u5C06\u5F71\u54CD\u5168\u5C40");
|
|
103
|
+
return globManager;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const manager = useManager();
|
|
107
|
+
function createShortcutItem(shortcut) {
|
|
108
|
+
return {
|
|
109
|
+
...shortcut,
|
|
110
|
+
currentKeySignature: getKeySignature(shortcut.defaultShortcut),
|
|
111
|
+
key: keyFor(shortcut),
|
|
112
|
+
status: ShortcutStatus.ACTIVE,
|
|
113
|
+
disabled: false,
|
|
114
|
+
callback: callbackFor(shortcut)
|
|
115
|
+
};
|
|
116
|
+
function callbackFor(shortcut2) {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
if (!isFunction(shortcut2.callback)) {
|
|
119
|
+
throw new Error(ShortcutManager.log(`\u975E\u6CD5\u7684callback\u7C7B\u578B=>${shortcut2.callback}`, true));
|
|
120
|
+
}
|
|
121
|
+
if (!shortcut2.debounce)
|
|
122
|
+
return shortcut2.callback;
|
|
123
|
+
return useDebounceFn(shortcut2.callback, (_b = (_a = shortcut2.debounceOption) == null ? void 0 : _a.duration) != null ? _b : 300);
|
|
124
|
+
}
|
|
125
|
+
function keyFor(shortcut2) {
|
|
126
|
+
const key = shortcut2.key || shortcut2.label;
|
|
127
|
+
if (!isString(key)) {
|
|
128
|
+
throw new Error(ShortcutManager.log(`\u975E\u6CD5\u7684key\u7C7B\u578B=>${key}`, true));
|
|
129
|
+
}
|
|
130
|
+
return key;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function register(shortcut) {
|
|
134
|
+
const { stop, signature } = manager.register(createShortcutItem(shortcut));
|
|
135
|
+
if (getCurrentInstance()) {
|
|
136
|
+
onBeforeUnmount(stop);
|
|
137
|
+
} 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");
|
|
139
|
+
}
|
|
140
|
+
return { stop, signature };
|
|
141
|
+
}
|
|
142
|
+
function traverse() {
|
|
143
|
+
return glob ? globManager.traverse : manager.traverse;
|
|
144
|
+
}
|
|
145
|
+
function query(key) {
|
|
146
|
+
return manager.query(key);
|
|
147
|
+
}
|
|
148
|
+
function update(key, info) {
|
|
149
|
+
manager.update(key, info);
|
|
150
|
+
}
|
|
151
|
+
function updateState(key, state) {
|
|
152
|
+
manager.updateState(key, state);
|
|
153
|
+
}
|
|
154
|
+
return { register, traverse, query, update, updateState };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export { ShortcutManager, useShortcuts };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ArrayAble } from '../../../../../es/src/types';
|
|
2
|
+
import { VNode } from 'vue';
|
|
3
|
+
import { ShortcutStatus } from '../../../../../es/packages/shortcut-provider/src/constants';
|
|
4
|
+
declare type Render = () => ArrayAble<VNode>;
|
|
5
|
+
export interface ShortcutSignatureInfo {
|
|
6
|
+
ctrl?: boolean;
|
|
7
|
+
shift?: boolean;
|
|
8
|
+
alt?: boolean;
|
|
9
|
+
key: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ShortcutOption {
|
|
12
|
+
label: string | Render;
|
|
13
|
+
key?: string;
|
|
14
|
+
defaultShortcut: ShortcutSignatureInfo;
|
|
15
|
+
order?: number;
|
|
16
|
+
debounce?: boolean;
|
|
17
|
+
debounceOption?: {
|
|
18
|
+
duration?: number;
|
|
19
|
+
};
|
|
20
|
+
beforeTrigger?(): void | Promise<unknown>;
|
|
21
|
+
callback(): void;
|
|
22
|
+
afterTrigger?(): void | Promise<unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface ShortcutItem extends ShortcutOption {
|
|
25
|
+
status: ShortcutStatus;
|
|
26
|
+
currentKeySignature: string;
|
|
27
|
+
key: string;
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ShortcutSignatureInfo } from '../../../../../es/packages/shortcut-provider/src/types';
|
|
2
|
+
export declare function isKeyboardEvent(event: any): event is KeyboardEvent;
|
|
3
|
+
export declare function getKeySignature(info: KeyboardEvent | Partial<ShortcutSignatureInfo>): string;
|
|
4
|
+
export declare function getDisplaySignature(info: KeyboardEvent | Partial<ShortcutSignatureInfo>): string;
|
|
5
|
+
export declare function transformKey2DisplaySignature(keySignature: string): string;
|
|
6
|
+
export declare function isShortcutProvider(ele: HTMLElement): boolean;
|
|
7
|
+
export declare function findAncestor(ele: HTMLElement | null, finder: (ele: HTMLElement) => boolean): HTMLElement | null;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function isKeyboardEvent(event) {
|
|
2
|
+
return Reflect.get(event, "view") === window && Reflect.get(event, "shiftKey") != void 0;
|
|
3
|
+
}
|
|
4
|
+
function normalizeSignatureInfo(info) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
let ctrl, shift, alt;
|
|
7
|
+
const key = (_b = (_a = info.key) == null ? void 0 : _a.toLowerCase()) != null ? _b : "";
|
|
8
|
+
if (isKeyboardEvent(info)) {
|
|
9
|
+
ctrl = info.ctrlKey;
|
|
10
|
+
shift = info.shiftKey;
|
|
11
|
+
alt = info.altKey;
|
|
12
|
+
} else {
|
|
13
|
+
ctrl = !!info.ctrl;
|
|
14
|
+
shift = !!info.shift;
|
|
15
|
+
alt = !!info.alt;
|
|
16
|
+
}
|
|
17
|
+
return { ctrl, shift, alt, key };
|
|
18
|
+
}
|
|
19
|
+
function getKeySignature(info) {
|
|
20
|
+
const { ctrl, shift, alt, key } = normalizeSignatureInfo(info);
|
|
21
|
+
return `${ctrl ? "CTRL_" : ""}${shift ? "SHIFT_" : ""}${alt ? "ALT_" : ""}${key}`;
|
|
22
|
+
}
|
|
23
|
+
const keyBlackList = ["control", "alt", "shift"];
|
|
24
|
+
const inBlackList = (key) => {
|
|
25
|
+
return keyBlackList.includes(key);
|
|
26
|
+
};
|
|
27
|
+
function getDisplaySignature(info) {
|
|
28
|
+
const { ctrl, shift, alt, key } = normalizeSignatureInfo(info);
|
|
29
|
+
return `${ctrl ? "ctrl+ " : ""}${alt ? "alt + " : ""}${shift ? "shift + " : ""}${inBlackList(key) ? "" : key}`;
|
|
30
|
+
}
|
|
31
|
+
function transformKey2DisplaySignature(keySignature) {
|
|
32
|
+
return keySignature.toLowerCase().replace(/_/g, " + ");
|
|
33
|
+
}
|
|
34
|
+
function isShortcutProvider(ele) {
|
|
35
|
+
return ele && ele.getAttribute("is-shortcut-capture") != void 0;
|
|
36
|
+
}
|
|
37
|
+
function findAncestor(ele, finder) {
|
|
38
|
+
if (!ele)
|
|
39
|
+
return ele;
|
|
40
|
+
if (finder(ele))
|
|
41
|
+
return ele;
|
|
42
|
+
let next = ele.parentElement;
|
|
43
|
+
while (next && !finder(next)) {
|
|
44
|
+
next = next.parentElement;
|
|
45
|
+
}
|
|
46
|
+
return next;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { findAncestor, getDisplaySignature, getKeySignature, isKeyboardEvent, isShortcutProvider, transformKey2DisplaySignature };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var ShortcutInputState = /* @__PURE__ */ ((ShortcutInputState2) => {
|
|
2
|
+
ShortcutInputState2[ShortcutInputState2["STATIC"] = 0] = "STATIC";
|
|
3
|
+
ShortcutInputState2[ShortcutInputState2["EDIT"] = 1] = "EDIT";
|
|
4
|
+
return ShortcutInputState2;
|
|
5
|
+
})(ShortcutInputState || {});
|
|
6
|
+
|
|
7
|
+
export { ShortcutInputState };
|