cnhis-design-vue 3.1.15-beta.9 → 3.1.15
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/hooks/useAnnotation.js +1 -2
- package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +7 -2
- package/es/packages/big-table/src/hooks/useEdit.js +16 -8
- package/es/packages/fabric-chart/src/hooks/useDraw.js +1 -0
- package/es/packages/fabric-chart/src/hooks/useLeft.js +1 -2
- package/es/packages/form-config/index.d.ts +1749 -0
- package/es/packages/form-config/src/FormConfig.vue.d.ts +1749 -0
- package/es/packages/form-config/src/components/FormConfigEdit.js +3 -3
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +1747 -0
- package/es/packages/form-config/style/index.css +1 -1
- package/es/packages/form-render/src/components/renderer/combination/index.js +3 -3
- package/es/packages/form-render/src/components/renderer/formItem.js +1 -2
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +2 -2
- package/es/packages/form-render/src/types/fieldItem.d.ts +8 -0
- package/es/packages/form-render/src/utils/index.d.ts +1 -0
- package/es/packages/form-render/src/utils/index.js +9 -2
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +1 -1
- package/es/packages/index.css +1 -1
- package/es/packages/index.d.ts +1 -0
- package/es/packages/index.js +1 -1
- package/es/packages/scale-view/src/hooks/scaleview-init.js +35 -35
- package/es/packages/shortcut-provider/index.d.ts +17 -2
- package/es/packages/shortcut-provider/index.js +1 -1
- package/es/packages/shortcut-provider/src/ShortcutProvider.js +5 -1
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +17 -2
- package/es/packages/shortcut-provider/src/hooks/index.js +1 -1
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +10 -10
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +45 -38
- package/es/packages/shortcut-provider/src/types/index.d.ts +2 -19
- package/es/packages/shortcut-setter/index.d.ts +1698 -4283
- package/es/packages/shortcut-setter/src/ShortcutSetter.js +63 -10
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +1723 -4306
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +26 -95
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +30 -3363
- package/es/packages/shortcut-setter/src/types/index.d.ts +6 -0
- package/es/packages/shortcut-setter/src/types/index.js +1 -0
- package/package.json +1 -1
- package/es/packages/shortcut-setter/constant/index.d.ts +0 -4
- package/es/packages/shortcut-setter/constant/index.js +0 -7
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
padding: 16px;
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
width: 200px;
|
|
9
|
-
min-height: 400px;
|
|
10
9
|
background: white;
|
|
11
10
|
}
|
|
12
11
|
.form-config__materialHeader {
|
|
@@ -17,6 +16,7 @@
|
|
|
17
16
|
}
|
|
18
17
|
.form-config__materialContent {
|
|
19
18
|
padding: 8px;
|
|
19
|
+
min-height: 400px;
|
|
20
20
|
display: flex;
|
|
21
21
|
flex-direction: column;
|
|
22
22
|
gap: 8px;
|
|
@@ -37,20 +37,20 @@ const script = defineComponent({
|
|
|
37
37
|
const emitChange = useDebounceFn(function emitChange2() {
|
|
38
38
|
emit("update:value", JSON.stringify(combinationData.value));
|
|
39
39
|
}, 300);
|
|
40
|
-
const combinationData = ref([
|
|
40
|
+
const combinationData = ref([]);
|
|
41
41
|
const currentGroupNum = computed(() => combinationData.value.length);
|
|
42
42
|
function setCombinationData(data, withInitialData = false) {
|
|
43
43
|
const parsedData = getParsedData(data);
|
|
44
44
|
if (!needLoad(parsedData))
|
|
45
45
|
return;
|
|
46
46
|
parsedData.splice(maxGroupNum.value);
|
|
47
|
-
parsedData.forEach(
|
|
47
|
+
parsedData.forEach(setCombinationItemData);
|
|
48
48
|
combinationData.value.splice(parsedData.length);
|
|
49
49
|
combinationData.value.forEach(setFormRenderData);
|
|
50
50
|
function needLoad(_data) {
|
|
51
51
|
return !!_data && !isEqual(_data, combinationData.value);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function setCombinationItemData(v, idx) {
|
|
54
54
|
if (!isObject(v))
|
|
55
55
|
return;
|
|
56
56
|
combinationData.value[idx] = v;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineComponent, inject, computed, createVNode } from 'vue';
|
|
2
2
|
import { isVoidField } from '@formily/core';
|
|
3
3
|
import { connect, mapProps } from '@formily/vue';
|
|
4
|
-
import { isBoolean } from 'lodash-es';
|
|
5
4
|
import { NFormItem } from 'naive-ui';
|
|
6
5
|
import AnnotationEdit from '../../../../../packages/annotation-edit';
|
|
7
6
|
import { InjectionAnnotation } from '../../../../../packages/form-render/src/constants';
|
|
@@ -36,7 +35,7 @@ const script = defineComponent({
|
|
|
36
35
|
}, null);
|
|
37
36
|
}
|
|
38
37
|
const showAnnotation = computed(() => {
|
|
39
|
-
return annotation.value &&
|
|
38
|
+
return annotation.value && props.annotation !== false;
|
|
40
39
|
});
|
|
41
40
|
const showLabel = computed(() => props.label && props.label !== " ");
|
|
42
41
|
function renderLabel() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isObject } from '@vueuse/core';
|
|
2
2
|
import { pick } from 'lodash-es';
|
|
3
3
|
import { useFormValidator, useTypeNormalize } from '../../../../packages/form-render';
|
|
4
|
-
import { fieldKeyEscape, arrayed, createLinebarId, elementIdEscape, transformDateFormat } from '../utils/index.js';
|
|
4
|
+
import { fieldKeyEscape, arrayed, createLinebarId, elementIdEscape, parseNumberFromMaybeString, transformDateFormat } from '../utils/index.js';
|
|
5
5
|
|
|
6
6
|
function useFieldListAdaptor(collector, uuid) {
|
|
7
7
|
const { createValidatorSchema } = useFormValidator();
|
|
@@ -54,7 +54,7 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
54
54
|
...pick(item, ["lazyRequest", "urlConfig"]),
|
|
55
55
|
options: item.option,
|
|
56
56
|
multiple: item.multi_select === "0",
|
|
57
|
-
maxTagCount:
|
|
57
|
+
maxTagCount: parseNumberFromMaybeString(item.multi_select_value)
|
|
58
58
|
});
|
|
59
59
|
return schema;
|
|
60
60
|
};
|
|
@@ -111,6 +111,14 @@ export declare type FieldItem = {
|
|
|
111
111
|
placeholder: string;
|
|
112
112
|
validate: ValidateItem;
|
|
113
113
|
option: OptionItem[];
|
|
114
|
+
/**
|
|
115
|
+
* 是否开启多选('0'表示开启, 值是反的)
|
|
116
|
+
*/
|
|
117
|
+
multi_select: FormCommonState;
|
|
118
|
+
/**
|
|
119
|
+
* 多选时最大选择数量
|
|
120
|
+
*/
|
|
121
|
+
multi_select_value: number | string;
|
|
114
122
|
/**
|
|
115
123
|
* 用于cascader控件提供层级参数
|
|
116
124
|
*/
|
|
@@ -15,6 +15,7 @@ export declare function parseBirthday(birthday: string): AgeContext;
|
|
|
15
15
|
export declare function mergeDeepProperties(target: AnyObject, fieldList: FieldItem[], traverseProperties?: string[], property?: string, targetProperty?: string): AnyObject;
|
|
16
16
|
export declare function parseIdCard(idCardNo: string): IdCardParseInfo;
|
|
17
17
|
export declare function injectOrProvide<T>(key: InjectionKey<T>, creator: () => T): T;
|
|
18
|
+
export declare function parseNumberFromMaybeString(value: unknown): unknown;
|
|
18
19
|
export declare function traverseDependKey(dependKeys: DependKeyType, handler: {
|
|
19
20
|
(dependKey: string, valueKey: string, required?: boolean): void;
|
|
20
21
|
}): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inject, provide, computed, createVNode, Fragment } from 'vue';
|
|
2
2
|
import { isObject } from '@vue/shared';
|
|
3
|
-
import { isString, isArray, isFunction } from 'lodash-es';
|
|
3
|
+
import { isNumber, isString, isArray, isFunction } from 'lodash-es';
|
|
4
4
|
import { FIELD_SEX_VALUE } from '../constants/index.js';
|
|
5
5
|
import { isField } from '@formily/core';
|
|
6
6
|
import { differenceInDays, differenceInMonths, differenceInYears } from 'date-fns';
|
|
@@ -101,6 +101,13 @@ function injectOrProvide(key, creator) {
|
|
|
101
101
|
}
|
|
102
102
|
return injected;
|
|
103
103
|
}
|
|
104
|
+
function parseNumberFromMaybeString(value) {
|
|
105
|
+
if (isNumber(value))
|
|
106
|
+
return value;
|
|
107
|
+
if (isString(value))
|
|
108
|
+
return +value;
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
104
111
|
function traverseDependKey(dependKeys, handler) {
|
|
105
112
|
if (!dependKeys)
|
|
106
113
|
return;
|
|
@@ -213,4 +220,4 @@ function createInputSlot(props) {
|
|
|
213
220
|
});
|
|
214
221
|
}
|
|
215
222
|
|
|
216
|
-
export { arrayed, assignUpdateValue, createInputSlot, createLinebarId, createSlot, elementIdEscape, fieldKeyEscape, formRenderLog, getParentLinebar, injectOrProvide, isIdCard, isMobile, mergeDeepProperties, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseDependKey, traverseSchema, uuidGenerator };
|
|
223
|
+
export { arrayed, assignUpdateValue, createInputSlot, createLinebarId, createSlot, elementIdEscape, fieldKeyEscape, formRenderLog, getParentLinebar, injectOrProvide, isIdCard, isMobile, mergeDeepProperties, parseBirthday, parseIdCard, parseNumberFromMaybeString, queryDecorator, queryInput, transformDateFormat, traverseDependKey, traverseSchema, uuidGenerator };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function useNuiThemeOverrides() {
|
|
2
2
|
const nuiThemeOverrides = {
|
|
3
3
|
Input: { paddingMedium: "8px", paddingSmall: "8px", paddingLarge: "8px", paddingTiny: "8px" },
|
|
4
|
-
InternalSelection: { paddingSingle: "8px", paddingMultiple: "
|
|
4
|
+
InternalSelection: { paddingSingle: "8px", paddingMultiple: "2px" },
|
|
5
5
|
Form: {
|
|
6
6
|
feedbackHeightMedium: "16px",
|
|
7
7
|
feedbackHeightLarge: "16px",
|
package/es/packages/index.css
CHANGED
|
@@ -3186,7 +3186,6 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
3186
3186
|
padding: 16px;
|
|
3187
3187
|
box-sizing: border-box;
|
|
3188
3188
|
width: 200px;
|
|
3189
|
-
min-height: 400px;
|
|
3190
3189
|
background: white;
|
|
3191
3190
|
}
|
|
3192
3191
|
.form-config__materialHeader {
|
|
@@ -3197,6 +3196,7 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
3197
3196
|
}
|
|
3198
3197
|
.form-config__materialContent {
|
|
3199
3198
|
padding: 8px;
|
|
3199
|
+
min-height: 400px;
|
|
3200
3200
|
display: flex;
|
|
3201
3201
|
flex-direction: column;
|
|
3202
3202
|
gap: 8px;
|
package/es/packages/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import CShortcutSetter from './shortcut-setter';
|
|
|
22
22
|
import CFormConfig from './form-config';
|
|
23
23
|
export * from './form-render';
|
|
24
24
|
export * from './shortcut-provider';
|
|
25
|
+
export * from './shortcut-setter';
|
|
25
26
|
export * from './big-table';
|
|
26
27
|
export * from './button-print';
|
|
27
28
|
export * from './form-config';
|
package/es/packages/index.js
CHANGED
|
@@ -54,7 +54,7 @@ export { FormItemDepsCollector, useFormItemDeps } from './form-render/src/hooks/
|
|
|
54
54
|
export { useInitialData } from './form-render/src/hooks/useInitialData.js';
|
|
55
55
|
export { useAnchor } from './form-render/src/hooks/useAnchor.js';
|
|
56
56
|
export { useFormContext } from './form-render/src/hooks/useFormContext.js';
|
|
57
|
-
export { ShortcutManager, useShortcuts } from './shortcut-provider/src/hooks/useShortcuts.js';
|
|
57
|
+
export { GlobalShortcutProvider, ShortcutManager, useShortcuts } from './shortcut-provider/src/hooks/useShortcuts.js';
|
|
58
58
|
export { useShortcutSignature } from './shortcut-provider/src/hooks/useShortcutSignature.js';
|
|
59
59
|
export { useColumnConfigAdaptor } from './big-table/src/hooks/useColumnConfigAdaptor.js';
|
|
60
60
|
export { Print } from './button-print/src/utils/print.js';
|
|
@@ -14,7 +14,7 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
14
14
|
const { formatRules } = ScaleViewValidate(props, state, config);
|
|
15
15
|
const { nextLogicEvent } = useEvent(props, state);
|
|
16
16
|
const setEvaluateStartTime = (evaluateResultSetting) => {
|
|
17
|
-
|
|
17
|
+
const evaluateStartTime = evaluateResultSetting == null ? void 0 : evaluateResultSetting.evaluateStartTime;
|
|
18
18
|
if (!evaluateStartTime)
|
|
19
19
|
return;
|
|
20
20
|
if (!vexutils.isValidDate(new Date(evaluateStartTime)) && vexutils.isValidDate(new Date(Number(evaluateStartTime)))) {
|
|
@@ -57,12 +57,12 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
57
57
|
state.showEvaluateCountdownWrap = true;
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
const { evaluateResultSetting = {} } = state.config;
|
|
61
61
|
if (!evaluateResultSetting || !Object.keys(evaluateResultSetting).length)
|
|
62
62
|
return;
|
|
63
63
|
state.showEvaluateCountdownWrap = true;
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const { evaluateStartTime } = evaluateResultSetting;
|
|
65
|
+
const { evaluateName } = ((_a = state.originConfig) == null ? void 0 : _a.evaluateResultSetting) || {};
|
|
66
66
|
if (!evaluateStartTime) {
|
|
67
67
|
state.showEvaluatePage = true;
|
|
68
68
|
return;
|
|
@@ -76,7 +76,7 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
76
76
|
const initForm = (data) => {
|
|
77
77
|
var _a;
|
|
78
78
|
let { list = [], map = {}, isFinished = false } = data;
|
|
79
|
-
|
|
79
|
+
const curUrl = handleFrontAddress(list);
|
|
80
80
|
if (curUrl) {
|
|
81
81
|
window.location.href = curUrl;
|
|
82
82
|
return;
|
|
@@ -112,13 +112,13 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
112
112
|
}
|
|
113
113
|
state.originConfig = JSON.parse(JSON.stringify(state.config));
|
|
114
114
|
if (props.params && Object.keys(props.params).length) {
|
|
115
|
-
|
|
115
|
+
const res = handleBtnParamsEvaluate(props.params);
|
|
116
116
|
res && Object.keys(res).length && (state.paramsEvaluate = res);
|
|
117
117
|
}
|
|
118
118
|
handleEvaluateParams(state.config.evaluateResultSetting);
|
|
119
119
|
handleShowEvaluate();
|
|
120
120
|
state.defaultFormArray = JSON.parse(JSON.stringify(list));
|
|
121
|
-
|
|
121
|
+
const filterArr = state.filterArr;
|
|
122
122
|
list = list.filter((v) => !filterArr.includes(v.type));
|
|
123
123
|
state.formArray = formatArray(list || []);
|
|
124
124
|
state.form = defaultFormValue(state.formArray);
|
|
@@ -128,13 +128,13 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
128
128
|
state.hasFrontAddress = false;
|
|
129
129
|
};
|
|
130
130
|
const replaceConditionItem = (options, value) => {
|
|
131
|
-
|
|
131
|
+
const matchOption = options.find((v) => value === v.value);
|
|
132
132
|
if (!matchOption)
|
|
133
133
|
return value;
|
|
134
134
|
return matchOption.key;
|
|
135
135
|
};
|
|
136
136
|
const isRadioOrCheckBox = (options, type) => {
|
|
137
|
-
|
|
137
|
+
const typeArr = ["RADIO_BLOCK", "CHECKBOX_BLOCK"];
|
|
138
138
|
if (!typeArr.includes(type))
|
|
139
139
|
return;
|
|
140
140
|
if (!options)
|
|
@@ -147,10 +147,10 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
147
147
|
return true;
|
|
148
148
|
};
|
|
149
149
|
const handLenextLogic = (item) => {
|
|
150
|
-
|
|
150
|
+
const { nextLogic, options, type } = item || {};
|
|
151
151
|
if (!nextLogic || !isRadioOrCheckBox(options, type))
|
|
152
152
|
return;
|
|
153
|
-
|
|
153
|
+
const { condition } = nextLogic || {};
|
|
154
154
|
if (!condition || !condition.length)
|
|
155
155
|
return;
|
|
156
156
|
condition.forEach((c) => {
|
|
@@ -166,12 +166,12 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
166
166
|
});
|
|
167
167
|
};
|
|
168
168
|
const handleRelationLogic = (list, item) => {
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
const relationLogicObj = vexutils.isString(item.relationLogic) ? JSON.parse(item.relationLogic) : item.relationLogic;
|
|
170
|
+
const { condition } = relationLogicObj || {};
|
|
171
171
|
if (!condition || !condition.length)
|
|
172
172
|
return;
|
|
173
173
|
condition.forEach((c) => {
|
|
174
|
-
|
|
174
|
+
const matchItem = list.find((f) => f.seq == c.subject_seq);
|
|
175
175
|
if (!matchItem)
|
|
176
176
|
return;
|
|
177
177
|
if (!isRadioOrCheckBox(matchItem.options, matchItem.type))
|
|
@@ -192,10 +192,10 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
192
192
|
var _a, _b;
|
|
193
193
|
if (!list || !list.length)
|
|
194
194
|
return;
|
|
195
|
-
|
|
195
|
+
const query = handleQueryParams();
|
|
196
196
|
if ((props == null ? void 0 : props.noBtn) || (query == null ? void 0 : query.noBtn))
|
|
197
197
|
return;
|
|
198
|
-
|
|
198
|
+
const matchItem = list.find((item) => item.type === "FRONT_ADDRESS");
|
|
199
199
|
if (!matchItem || !Object.keys(matchItem).length)
|
|
200
200
|
return;
|
|
201
201
|
let setting;
|
|
@@ -206,22 +206,22 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
206
206
|
return;
|
|
207
207
|
if ((query == null ? void 0 : query.redirect) == 1 || ((_a = props.params) == null ? void 0 : _a.redirect) == 1 || query.isEdit == 3 || ((_b = props.params) == null ? void 0 : _b.isEdit) == 3)
|
|
208
208
|
return;
|
|
209
|
-
|
|
209
|
+
const { frontAddress } = setting;
|
|
210
210
|
if (frontAddress) {
|
|
211
|
-
|
|
211
|
+
const urlHref = window.location.href;
|
|
212
212
|
let preStr = "?";
|
|
213
213
|
if (frontAddress.includes("?")) {
|
|
214
214
|
preStr = "&";
|
|
215
215
|
}
|
|
216
|
-
|
|
216
|
+
const curUrl = `${frontAddress}${preStr}redirect_url=${encodeURIComponent(urlHref)}`;
|
|
217
217
|
return curUrl;
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
220
|
const handleBtnParamsEvaluate = (params) => {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
for (
|
|
224
|
-
|
|
221
|
+
const defaultVariable = ["evaname", "evadesc", "evast", "evadur", "evaan"];
|
|
222
|
+
const res = {};
|
|
223
|
+
for (const key in params) {
|
|
224
|
+
const value = params[key];
|
|
225
225
|
if (defaultVariable.includes(key) && value) {
|
|
226
226
|
res[key] = value;
|
|
227
227
|
}
|
|
@@ -235,18 +235,18 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
235
235
|
if (hasparamsEvaluate.value) {
|
|
236
236
|
query = state.paramsEvaluate;
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
const obj = {
|
|
239
239
|
evaluateName: "evaname",
|
|
240
240
|
evaluateExplain: "evadesc",
|
|
241
241
|
evaluateStartTime: "evast",
|
|
242
242
|
evaluateTime: "evadur",
|
|
243
243
|
evaluateAnswer: "evaan"
|
|
244
244
|
};
|
|
245
|
-
for (
|
|
246
|
-
|
|
247
|
-
|
|
245
|
+
for (const key in evaluateResultSetting) {
|
|
246
|
+
const value = evaluateResultSetting[key];
|
|
247
|
+
const isParseKey = value && key != "evaluateAnswer" && typeof value === "string" && value.includes("${");
|
|
248
248
|
if (isParseKey) {
|
|
249
|
-
|
|
249
|
+
const parseValue = value.replace(/\$\{([^}]+)\}/g, (_v, $1) => {
|
|
250
250
|
let param;
|
|
251
251
|
if ($1.startsWith("form.")) {
|
|
252
252
|
param = query[$1.split(".")[1]];
|
|
@@ -263,8 +263,8 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
if (hasDefault.value) {
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
const defaultVariable = ["evaname", "evadesc", "evast", "evadur", "evaan"];
|
|
267
|
+
const defObj = {
|
|
268
268
|
evaname: "evaluateName",
|
|
269
269
|
evadesc: "evaluateExplain",
|
|
270
270
|
evast: "evaluateStartTime",
|
|
@@ -272,7 +272,7 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
272
272
|
evaan: "evaluateAnswer"
|
|
273
273
|
};
|
|
274
274
|
defaultVariable.forEach((item) => {
|
|
275
|
-
|
|
275
|
+
const key = defObj[item];
|
|
276
276
|
if (!evaluateResultSetting[key]) {
|
|
277
277
|
let val = query[item];
|
|
278
278
|
if (item == "evaan") {
|
|
@@ -354,12 +354,12 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
354
354
|
defValue = item.dbValue;
|
|
355
355
|
} else {
|
|
356
356
|
if (((_a = item.setting) == null ? void 0 : _a.defValType) == 3) {
|
|
357
|
-
|
|
357
|
+
const urlKey = (_c = (_b = item.setting) == null ? void 0 : _b.outDefaultValue) == null ? void 0 : _c.urlKey;
|
|
358
358
|
if (urlKey) {
|
|
359
|
-
|
|
359
|
+
const list = urlKey.split(",");
|
|
360
360
|
if (list.length > 1) {
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
const val2 = list.map((l) => {
|
|
362
|
+
const tempV = getQueryVariable(l, state, props.params);
|
|
363
363
|
if (tempV)
|
|
364
364
|
return decodeURIComponent(tempV);
|
|
365
365
|
return null;
|
|
@@ -1,8 +1,23 @@
|
|
|
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<{
|
|
4
|
+
declare const ShortcutProvider: SFCWithInstall<import("vue").DefineComponent<{
|
|
5
|
+
scope: {
|
|
6
|
+
type: (SymbolConstructor | StringConstructor)[];
|
|
7
|
+
};
|
|
8
|
+
}, {
|
|
9
|
+
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
scope: {
|
|
11
|
+
type: (SymbolConstructor | StringConstructor)[];
|
|
12
|
+
};
|
|
13
|
+
}>> & {
|
|
14
|
+
[x: `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
|
|
15
|
+
}>>;
|
|
5
16
|
shortcutWrapperRef: import("vue").Ref<HTMLElement | undefined>;
|
|
6
17
|
manager: import("./src/hooks").ShortcutManager;
|
|
7
|
-
},
|
|
18
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
|
+
scope: {
|
|
20
|
+
type: (SymbolConstructor | StringConstructor)[];
|
|
21
|
+
};
|
|
22
|
+
}>>, {}>>;
|
|
8
23
|
export default ShortcutProvider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { COMPONENT_NAMESPACE } from '../../src/global/variable';
|
|
2
2
|
import { safeComponentRegister } from '../../src/utils';
|
|
3
3
|
import script from './src/ShortcutProvider.js';
|
|
4
|
-
export { ShortcutManager, useShortcuts } from './src/hooks/useShortcuts.js';
|
|
4
|
+
export { GlobalShortcutProvider, ShortcutManager, useShortcuts } from './src/hooks/useShortcuts.js';
|
|
5
5
|
export { useShortcutSignature } from './src/hooks/useShortcutSignature.js';
|
|
6
6
|
|
|
7
7
|
const ShortcutProvider = script;
|
|
@@ -5,9 +5,13 @@ 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
|
+
scope: { type: [String, Symbol] }
|
|
10
|
+
},
|
|
8
11
|
setup(__props) {
|
|
12
|
+
const props = __props;
|
|
9
13
|
const shortcutWrapperRef = ref();
|
|
10
|
-
const manager = new ShortcutManager(shortcutWrapperRef).start();
|
|
14
|
+
const manager = new ShortcutManager(shortcutWrapperRef, props.scope || String(Date.now())).start();
|
|
11
15
|
provide(InjectionShortcutManager, manager);
|
|
12
16
|
onBeforeUnmount(() => {
|
|
13
17
|
manager.destroy();
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { ShortcutManager } from '../../../../es/packages/shortcut-provider';
|
|
2
|
-
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
scope: {
|
|
4
|
+
type: (SymbolConstructor | StringConstructor)[];
|
|
5
|
+
};
|
|
6
|
+
}, {
|
|
7
|
+
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
8
|
+
scope: {
|
|
9
|
+
type: (SymbolConstructor | StringConstructor)[];
|
|
10
|
+
};
|
|
11
|
+
}>> & {
|
|
12
|
+
[x: `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
|
|
13
|
+
}>>;
|
|
3
14
|
shortcutWrapperRef: import("vue").Ref<HTMLElement | undefined>;
|
|
4
15
|
manager: ShortcutManager;
|
|
5
|
-
},
|
|
16
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
+
scope: {
|
|
18
|
+
type: (SymbolConstructor | StringConstructor)[];
|
|
19
|
+
};
|
|
20
|
+
}>>, {}>;
|
|
6
21
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ShortcutManager, useShortcuts } from './useShortcuts.js';
|
|
1
|
+
export { GlobalShortcutProvider, ShortcutManager, useShortcuts } from './useShortcuts.js';
|
|
2
2
|
export { useShortcutSignature } from './useShortcutSignature.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ShortcutItem, ShortcutOption, ShortcutSignatureInfo } from '../../../../../es/packages/shortcut-provider/src/types';
|
|
2
1
|
import { MaybeRef } from '@vueuse/core';
|
|
2
|
+
import { ShortcutItem, ShortcutOption, ShortcutSignatureInfo } from '../../../../../es/packages/shortcut-provider/src/types';
|
|
3
|
+
export declare const GlobalShortcutProvider: unique symbol;
|
|
3
4
|
export declare class ShortcutManager {
|
|
4
5
|
private readonly shortcutCallbackMap;
|
|
5
6
|
private readonly shortcutCache;
|
|
@@ -7,27 +8,26 @@ export declare class ShortcutManager {
|
|
|
7
8
|
private handle?;
|
|
8
9
|
disabled: boolean;
|
|
9
10
|
static log(message: string, dryRun?: boolean): string;
|
|
10
|
-
constructor(environmentEle?: MaybeRef<HTMLElement | undefined
|
|
11
|
+
constructor(environmentEle?: MaybeRef<HTMLElement | undefined>, scope?: string | Symbol);
|
|
11
12
|
get traverse(): Omit<ShortcutItem, "callback">[];
|
|
12
|
-
query
|
|
13
|
-
|
|
14
|
-
update(key: string, info?: KeyboardEvent | Partial<ShortcutSignatureInfo>): Promise<void>;
|
|
13
|
+
private query;
|
|
14
|
+
update(key: string, info: KeyboardEvent | Partial<ShortcutSignatureInfo>): Promise<void>;
|
|
15
15
|
register(shortcutItem: ShortcutItem): {
|
|
16
16
|
stop: () => void;
|
|
17
|
+
start: () => void;
|
|
17
18
|
signature: () => string;
|
|
18
19
|
};
|
|
19
20
|
start(): this;
|
|
20
21
|
destroy(): void;
|
|
22
|
+
clear(): void;
|
|
21
23
|
}
|
|
22
|
-
export declare function useShortcuts(
|
|
24
|
+
export declare function useShortcuts(scope?: MaybeRef<string | Symbol | undefined>): {
|
|
23
25
|
register: (shortcut: ShortcutOption) => {
|
|
24
26
|
stop: () => void;
|
|
25
27
|
signature: () => string;
|
|
26
28
|
};
|
|
27
29
|
traverse: () => Omit<ShortcutItem, "callback">[];
|
|
28
|
-
|
|
29
|
-
update: (key: string, info: KeyboardEvent | Partial<ShortcutSignatureInfo>) => void
|
|
30
|
-
onReset: (key: string) => void;
|
|
31
|
-
updateDisabled: (key: string, state?: boolean) => void;
|
|
30
|
+
clear: () => void;
|
|
31
|
+
update: (key: string, info: KeyboardEvent | Partial<ShortcutSignatureInfo>) => Promise<void>;
|
|
32
32
|
updateManagerDisabled: (disabled?: boolean) => void;
|
|
33
33
|
};
|
|
@@ -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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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(
|
|
111
|
+
function useShortcuts(scope) {
|
|
109
112
|
function useManager() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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()
|
|
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
|
|
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,
|
|
177
|
+
return { register, traverse, clear, update, updateManagerDisabled };
|
|
171
178
|
}
|
|
172
179
|
|
|
173
|
-
export { ShortcutManager, useShortcuts };
|
|
180
|
+
export { GlobalShortcutProvider, ShortcutManager, useShortcuts };
|