cnhis-design-vue 3.1.14 → 3.1.15-beta.2
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_vue_type_script_setup_true_lang.js +9 -5
- package/es/packages/big-table/src/components/edit-form/edit-date.js +11 -3
- package/es/packages/big-table/src/components/edit-form/edit-separate.js +11 -9
- package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +1 -0
- package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +44 -34
- package/es/packages/big-table/src/hooks/useEdit.d.ts +1 -0
- package/es/packages/big-table/src/hooks/useFormat.js +8 -1
- package/es/packages/big-table/style/index.css +11 -0
- package/es/packages/fabric-chart/src/hooks/useCenter.js +28 -68
- package/es/packages/form-render/src/FormRender.js +18 -3
- package/es/packages/form-render/src/components/renderer/combination.js +34 -11
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +6 -3
- package/es/packages/form-render/src/types/fieldItem.d.ts +17 -4
- package/es/packages/form-render/src/utils/index.d.ts +2 -0
- package/es/packages/form-render/src/utils/index.js +35 -4
- package/es/packages/index.css +11 -0
- package/es/packages/shortcut-provider/index.d.ts +2 -11
- package/es/packages/shortcut-provider/src/ShortcutProvider.js +1 -5
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +2 -11
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +11 -8
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +44 -28
- package/es/packages/shortcut-provider/src/types/index.d.ts +32 -4
- package/es/packages/shortcut-provider/src/utils/index.d.ts +3 -0
- package/es/packages/shortcut-provider/src/utils/index.js +15 -5
- package/es/packages/shortcut-setter/index.d.ts +6 -4
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -4
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +6 -4
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +6 -4
- package/package.json +1 -1
|
@@ -2314,7 +2314,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2314
2314
|
"span-method": colspanMethod,
|
|
2315
2315
|
"footer-span-method": footerRowspanMethod,
|
|
2316
2316
|
"tooltip-config": {
|
|
2317
|
-
enterable: false
|
|
2317
|
+
enterable: false,
|
|
2318
|
+
..._ctx.$attrs.tooltipConfig || {}
|
|
2318
2319
|
},
|
|
2319
2320
|
"checkbox-config": {
|
|
2320
2321
|
checkField: "checked",
|
|
@@ -2330,10 +2331,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2330
2331
|
checkField: "checked",
|
|
2331
2332
|
trigger: "cell",
|
|
2332
2333
|
reserve: true,
|
|
2333
|
-
highlight: true
|
|
2334
|
+
highlight: true,
|
|
2335
|
+
..._ctx.$attrs.radioConfig || {}
|
|
2334
2336
|
},
|
|
2335
2337
|
"scroll-y": {
|
|
2336
|
-
gt: 50
|
|
2338
|
+
gt: 50,
|
|
2339
|
+
..._ctx.$attrs.scrollY || {}
|
|
2337
2340
|
},
|
|
2338
2341
|
"row-style": unref(getRowStyle),
|
|
2339
2342
|
"edit-config": state.editConfig,
|
|
@@ -2343,7 +2346,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2343
2346
|
loadMethod: unref(loadExpandMethod),
|
|
2344
2347
|
toggleMethod: unref(toggleExpandMethod),
|
|
2345
2348
|
iconOpen: "iconfont icon-a-xitongtubiaozhediejian",
|
|
2346
|
-
iconClose: "iconfont icon-a-xitongtubiaotianjia"
|
|
2349
|
+
iconClose: "iconfont icon-a-xitongtubiaotianjia",
|
|
2350
|
+
..._ctx.$attrs.expandConfig || {}
|
|
2347
2351
|
},
|
|
2348
2352
|
"keyboard-config": _ctx.columnConfig.keyboardConfig || {},
|
|
2349
2353
|
"edit-rules": _ctx.columnConfig.editRules || {},
|
|
@@ -2413,7 +2417,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2413
2417
|
}
|
|
2414
2418
|
})]),
|
|
2415
2419
|
_: 3
|
|
2416
|
-
}, 16, ["height", "seq-config", "tree-config", "cell-class-name", "row-config", "show-footer", "checkbox-config", "row-style", "edit-config", "expand-config", "keyboard-config", "edit-rules", "menu-config", "onScroll", "onKeydown"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
|
|
2420
|
+
}, 16, ["height", "seq-config", "tree-config", "cell-class-name", "row-config", "show-footer", "tooltip-config", "checkbox-config", "radio-config", "scroll-y", "row-style", "edit-config", "expand-config", "keyboard-config", "edit-rules", "menu-config", "onScroll", "onKeydown"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
|
|
2417
2421
|
class: "refresh",
|
|
2418
2422
|
onClick: hanldeClickRefresh
|
|
2419
2423
|
}, [createVNode(unref(NIcon), {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, createVNode, mergeProps } from 'vue';
|
|
2
|
+
import { isFunction } from 'lodash-es';
|
|
2
3
|
import { NDatePicker } from 'naive-ui';
|
|
3
4
|
|
|
4
5
|
var EditDate = defineComponent({
|
|
@@ -94,16 +95,23 @@ var EditDate = defineComponent({
|
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
97
|
};
|
|
98
|
+
function customDateDisabledDecorator(customDateDisabled) {
|
|
99
|
+
if (!isFunction(customDateDisabled))
|
|
100
|
+
return null;
|
|
101
|
+
return (ts) => {
|
|
102
|
+
return customDateDisabled(ts, props.row);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
97
105
|
const config = {
|
|
98
|
-
type: props.col.type || "datetime",
|
|
106
|
+
type: props.col.type || props.col.dateType || "datetime",
|
|
99
107
|
clearable: props.col.clearable || true,
|
|
100
108
|
disabled: props.col.disabled || false,
|
|
101
109
|
valueFormat: props.col.valueFormat || "yyyy-MM-dd HH:mm:ss",
|
|
102
|
-
isDateDisabled: props.col.isDateDisabled || isDateDisabled,
|
|
110
|
+
isDateDisabled: customDateDisabledDecorator(props.col.isDateDisabled) || isDateDisabled,
|
|
103
111
|
placeholder: props.col.placeholder || "\u8BF7\u9009\u62E9"
|
|
104
112
|
};
|
|
105
113
|
if (config.type.includes("time")) {
|
|
106
|
-
config.isTimeDisabled = props.col.isTimeDisabled || isTimeDisabled;
|
|
114
|
+
config.isTimeDisabled = customDateDisabledDecorator(props.col.isTimeDisabled) || isTimeDisabled;
|
|
107
115
|
}
|
|
108
116
|
return () => createVNode(NDatePicker, mergeProps(attrs, config, {
|
|
109
117
|
"onUpdateFormattedValue": onConfirm
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, openBlock, createBlock, unref, withCtx, createVNode, withModifiers } from 'vue';
|
|
1
|
+
import { defineComponent, ref, watch, openBlock, createBlock, unref, withCtx, createVNode, withModifiers } from 'vue';
|
|
2
2
|
import SlotRender from '../../../../../src/components/SlotRender';
|
|
3
3
|
import { cloneDeep, isObject, isArray } from 'lodash-es';
|
|
4
4
|
import { NPopover, NInput } from 'naive-ui';
|
|
@@ -17,13 +17,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
17
17
|
setup(__props, { emit }) {
|
|
18
18
|
const props = __props;
|
|
19
19
|
const popoverRef = ref();
|
|
20
|
+
const show = ref(false);
|
|
21
|
+
watch(show, updateShow);
|
|
20
22
|
const editContent = ref();
|
|
21
23
|
const { getRowData } = useSeparateMap();
|
|
22
|
-
function updateShow(
|
|
24
|
+
function updateShow(show2) {
|
|
23
25
|
const target = getRowData(props.row);
|
|
24
26
|
if (!target)
|
|
25
27
|
return;
|
|
26
|
-
if (
|
|
28
|
+
if (show2) {
|
|
27
29
|
editContent.value = cloneDeep(target.row[props.col.field]);
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
@@ -52,14 +54,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
52
54
|
return openBlock(), createBlock(unref(NPopover), {
|
|
53
55
|
ref_key: "popoverRef",
|
|
54
56
|
ref: popoverRef,
|
|
55
|
-
trigger: "
|
|
56
|
-
|
|
57
|
-
"onUpdate:show":
|
|
57
|
+
trigger: "manual",
|
|
58
|
+
show: show.value,
|
|
59
|
+
"onUpdate:show": _cache[3] || (_cache[3] = ($event) => show.value = $event),
|
|
60
|
+
"show-arrow": false
|
|
58
61
|
}, {
|
|
59
62
|
trigger: withCtx(() => [
|
|
60
63
|
createVNode(Separate, {
|
|
61
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(() =>
|
|
62
|
-
}, ["stop"])),
|
|
64
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => show.value = !show.value, ["stop"])),
|
|
63
65
|
style,
|
|
64
66
|
col: __props.col,
|
|
65
67
|
row: __props.row
|
|
@@ -81,7 +83,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
81
83
|
}, null, 8, ["value"]))
|
|
82
84
|
]),
|
|
83
85
|
_: 1
|
|
84
|
-
},
|
|
86
|
+
}, 8, ["show"]);
|
|
85
87
|
};
|
|
86
88
|
}
|
|
87
89
|
});
|
|
@@ -31,6 +31,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
31
31
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
32
32
|
}>>;
|
|
33
33
|
popoverRef: import("vue").Ref<any>;
|
|
34
|
+
show: import("vue").Ref<boolean>;
|
|
34
35
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
35
36
|
editContent: import("vue").Ref<any>;
|
|
36
37
|
getRowData: (row: AnyObject) => {
|
|
@@ -31,42 +31,52 @@ function useColumnConfigAdaptor() {
|
|
|
31
31
|
...["INPUT"].map((type) => [type, "input"]),
|
|
32
32
|
...["DIGITAL"].map((type) => [type, "number"])
|
|
33
33
|
]);
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
const isNullHandler = (value, result, _fieldItem, _editRules) => {
|
|
35
|
+
if (value === "1")
|
|
36
|
+
return;
|
|
37
|
+
if (value === "0")
|
|
38
|
+
_editRules[_fieldItem.val_key] = [{ required: true, message: "\u5FC5\u586B" }];
|
|
39
|
+
};
|
|
40
|
+
const validateHandler = (value, result) => {
|
|
41
|
+
if (!isObject(value))
|
|
42
|
+
return;
|
|
43
|
+
result.componentProps = Object.assign({}, result.comonentProps, {
|
|
44
|
+
maxlength: value.max_length,
|
|
45
|
+
minlength: value.min_length,
|
|
46
|
+
max: value.max_value,
|
|
47
|
+
min: value.min_value,
|
|
48
|
+
precision: value.decimal_length
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const dateRangeValidate = (value, result) => {
|
|
52
|
+
if (!isObject(value))
|
|
53
|
+
return;
|
|
54
|
+
result.isDateDisabled = (ts, row) => {
|
|
55
|
+
if (!isObject(row))
|
|
56
|
+
return;
|
|
57
|
+
const { startDate, endDate } = value;
|
|
58
|
+
let invalid = false;
|
|
59
|
+
if (startDate) {
|
|
60
|
+
invalid = new Date(row[startDate]).getTime() > ts;
|
|
43
61
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"validate",
|
|
47
|
-
(value, result) => {
|
|
48
|
-
if (!isObject(value))
|
|
49
|
-
return;
|
|
50
|
-
result.componentProps = Object.assign({}, result.comonentProps, {
|
|
51
|
-
maxlength: value.max_length,
|
|
52
|
-
minlength: value.min_length,
|
|
53
|
-
max: value.max_value,
|
|
54
|
-
min: value.min_value,
|
|
55
|
-
precision: value.decimal_length
|
|
56
|
-
});
|
|
62
|
+
if (endDate) {
|
|
63
|
+
invalid = invalid || new Date(row[endDate]).getTime() < ts;
|
|
57
64
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
return invalid;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const switchOptionHandler = (value, result) => {
|
|
69
|
+
if (!isObject(value))
|
|
70
|
+
return;
|
|
71
|
+
const option = { label: value.describe, ...value };
|
|
72
|
+
result.options = isArray(result.options) ? [...result.options, option] : [option];
|
|
73
|
+
};
|
|
74
|
+
const settingMap = new Map([
|
|
75
|
+
["multi_select_value", { property: "multiple", valueMap: multipleValueMap }],
|
|
76
|
+
["is_null", isNullHandler],
|
|
77
|
+
["validate", validateHandler],
|
|
78
|
+
["dateValidate", dateRangeValidate],
|
|
79
|
+
...["open", "close"].map((key) => [key, switchOptionHandler]),
|
|
70
80
|
["is_edit", { property: "isEdit", valueMap: isEditValueMap }],
|
|
71
81
|
["html_type", { property: "formType", valueMap: htmlTypeValueMap }],
|
|
72
82
|
["option", { property: "options", fieldMap: /* @__PURE__ */ new Map([["text", "label"]]) }]
|
|
@@ -223,6 +223,7 @@ export declare const comps: {
|
|
|
223
223
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
224
224
|
}>>;
|
|
225
225
|
popoverRef: import("vue").Ref<any>;
|
|
226
|
+
show: import("vue").Ref<boolean>;
|
|
226
227
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
227
228
|
editContent: import("vue").Ref<any>;
|
|
228
229
|
getRowData: (row: import("../../../../src/types").AnyObject) => {
|
|
@@ -133,7 +133,14 @@ const useFormat = (state) => {
|
|
|
133
133
|
item[key] = temp.change_text;
|
|
134
134
|
} else {
|
|
135
135
|
if (temp.background != "#ffffff") {
|
|
136
|
-
|
|
136
|
+
const reg = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
137
|
+
let color = temp.background;
|
|
138
|
+
let iconHtml = `<span class="${temp.icon}"></span>`;
|
|
139
|
+
if (reg.test(temp.icon)) {
|
|
140
|
+
color = temp.icon;
|
|
141
|
+
iconHtml = `<span class="icon-dot-custom" style="--table-icon-color:${temp.icon};--table-icon-shadow:${temp.icon}80"></span>`;
|
|
142
|
+
}
|
|
143
|
+
item[key] = `<span class="field-span" style="color:${color}">${iconHtml}${temp.change_text || ""}</span>`;
|
|
137
144
|
} else {
|
|
138
145
|
item[key] = temp.change_text;
|
|
139
146
|
}
|
|
@@ -396,6 +396,17 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
396
396
|
height: var(--tableImageHeight);
|
|
397
397
|
width: var(--tableImageWidth);
|
|
398
398
|
}
|
|
399
|
+
.custom-big-table .domPropsInnerHTML-span .icon-dot-custom {
|
|
400
|
+
width: 8px;
|
|
401
|
+
height: 8px;
|
|
402
|
+
-webkit-border-radius: 50%;
|
|
403
|
+
-moz-border-radius: 50%;
|
|
404
|
+
border-radius: 50%;
|
|
405
|
+
background: var(--table-icon-color);
|
|
406
|
+
display: inline-block;
|
|
407
|
+
margin-right: 6px;
|
|
408
|
+
box-shadow: 0px 2px 4px 0px var(--table-icon-shadow);
|
|
409
|
+
}
|
|
399
410
|
.custom-big-table .domPropsInnerHTML-span .icon-dot-red {
|
|
400
411
|
width: 8px;
|
|
401
412
|
height: 8px;
|
|
@@ -8,6 +8,18 @@ import { TEMPERATURE_MENU, PAIN_MENU } from './constant.js';
|
|
|
8
8
|
function isEffectiveNode(node) {
|
|
9
9
|
return (node == null ? void 0 : node.time) && ((node == null ? void 0 : node.value) || (node == null ? void 0 : node.value) === 0);
|
|
10
10
|
}
|
|
11
|
+
function getPointArr(arr) {
|
|
12
|
+
let _arr = [];
|
|
13
|
+
return arr.reduce((pre, cur, index) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
_arr.push([cur.left, cur.top]);
|
|
16
|
+
if (((_b = (_a = cur.origin) == null ? void 0 : _a.data) == null ? void 0 : _b.breakpoint) || arr.length - 1 === index) {
|
|
17
|
+
pre.push(_arr);
|
|
18
|
+
_arr = [];
|
|
19
|
+
}
|
|
20
|
+
return pre;
|
|
21
|
+
}, []);
|
|
22
|
+
}
|
|
11
23
|
function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, getYValue, addRenderItem) {
|
|
12
24
|
useGrid(canvas, propItems);
|
|
13
25
|
const {
|
|
@@ -36,6 +48,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
36
48
|
target: null
|
|
37
49
|
});
|
|
38
50
|
const shadowLinesCache = /* @__PURE__ */ new Set();
|
|
51
|
+
let shadowPointCache = [];
|
|
39
52
|
const maiboPoints = /* @__PURE__ */ new Set();
|
|
40
53
|
const otherPoints = /* @__PURE__ */ new Set();
|
|
41
54
|
const prevLines = /* @__PURE__ */ new Set();
|
|
@@ -45,7 +58,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
45
58
|
});
|
|
46
59
|
});
|
|
47
60
|
function init() {
|
|
48
|
-
|
|
61
|
+
shadowPointCache = [];
|
|
49
62
|
maiboPoints.clear();
|
|
50
63
|
otherPoints.clear();
|
|
51
64
|
prevLines.clear();
|
|
@@ -55,6 +68,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
55
68
|
drawPolyLine(item, dataIndex, scaleValue);
|
|
56
69
|
});
|
|
57
70
|
});
|
|
71
|
+
drawShaDow();
|
|
58
72
|
drawOverlapPoint();
|
|
59
73
|
setCanvasEvent();
|
|
60
74
|
}
|
|
@@ -67,89 +81,34 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
67
81
|
canvas.value.renderAll();
|
|
68
82
|
}
|
|
69
83
|
function drawShaDow(target) {
|
|
70
|
-
var _a
|
|
84
|
+
var _a;
|
|
71
85
|
const pulseObj = left.yScaleValue.find((item) => item.type === "pulse");
|
|
72
86
|
if (!pulseObj || !((_a = pulseObj.dataList) == null ? void 0 : _a.length))
|
|
73
87
|
return;
|
|
74
88
|
if (shadowLinesCache.size)
|
|
75
89
|
canvas.value.remove(...shadowLinesCache);
|
|
76
90
|
shadowLinesCache.clear();
|
|
77
|
-
|
|
78
|
-
if (((_b = pulseObj.dataList) == null ? void 0 : _b.length) > 1) {
|
|
79
|
-
let points1 = [];
|
|
80
|
-
let points2 = [];
|
|
81
|
-
const copyDataList = JSON.parse(JSON.stringify(pulseObj.dataList));
|
|
91
|
+
if (shadowPointCache.length > 1) {
|
|
82
92
|
if (target) {
|
|
83
93
|
const { type, dataIndex, index } = target.origin || {};
|
|
84
94
|
if (type === "pulse") {
|
|
85
|
-
|
|
86
|
-
x: target.left,
|
|
87
|
-
y: target.top
|
|
88
|
-
});
|
|
95
|
+
shadowPointCache[dataIndex].splice(index, 1, target);
|
|
89
96
|
}
|
|
90
97
|
}
|
|
91
|
-
const [data1, data2] =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
const point = getPointer(item, pulseObj);
|
|
100
|
-
if (point == null ? void 0 : point.length) {
|
|
101
|
-
return {
|
|
102
|
-
x: point[0],
|
|
103
|
-
y: point[1]
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
data1.list.forEach((item, index) => {
|
|
108
|
-
const point1 = getPoint(item);
|
|
109
|
-
const item2 = data2.list[index];
|
|
110
|
-
const point2 = item2 ? getPoint(item2) : null;
|
|
111
|
-
if (point1 && point2 && point1.x === point2.x && point1.y !== point2.y) {
|
|
112
|
-
points1.push(point1);
|
|
113
|
-
points2.push(point2);
|
|
114
|
-
const itemPrev = data1.list[index - 1];
|
|
115
|
-
const itemNext = data1.list[index + 1];
|
|
116
|
-
const itemNext2 = data2.list[index + 1];
|
|
117
|
-
if (itemPrev && points1.length === 1) {
|
|
118
|
-
const point = getPoint(itemPrev);
|
|
119
|
-
point && points1.unshift(point);
|
|
120
|
-
}
|
|
121
|
-
if (itemNext && itemNext2) {
|
|
122
|
-
const pointNext = getPoint(itemNext);
|
|
123
|
-
const pointNext2 = getPoint(itemNext2);
|
|
124
|
-
if (pointNext && pointNext2 && pointNext.x === pointNext2.x && pointNext.y === pointNext2.y) {
|
|
125
|
-
points1.push(pointNext);
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
data.push({ points1, points2 });
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
if (points1.length && points2.length) {
|
|
132
|
-
data.push({ points1, points2 });
|
|
133
|
-
points1 = [];
|
|
134
|
-
points2 = [];
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
if (data.length) {
|
|
140
|
-
const newData = data.reduce((pre, cur) => {
|
|
141
|
-
const arr1 = cur.points1.map((v) => [v.x, v.y]);
|
|
142
|
-
const arr2 = cur.points2.map((v) => [v.x, v.y]);
|
|
143
|
-
return pre.concat([[...arr1, ...arr2.reverse()]]);
|
|
144
|
-
}, []);
|
|
98
|
+
const [data1, data2] = shadowPointCache;
|
|
99
|
+
if (!data1.length || !data2.length)
|
|
100
|
+
return;
|
|
101
|
+
const points1 = getPointArr(data1);
|
|
102
|
+
const points2 = getPointArr(data2);
|
|
103
|
+
const data = points1.reduce((pre, cur, index) => pre.concat([[...cur, ...points2[index].reverse()]]), []);
|
|
145
104
|
const { createShadowLines } = useShadow();
|
|
146
|
-
|
|
147
|
-
var _a2,
|
|
105
|
+
data.forEach((item) => {
|
|
106
|
+
var _a2, _b, _c, _d;
|
|
148
107
|
if (((_a2 = pulseObj.shadow) == null ? void 0 : _a2.mode) == "color") {
|
|
149
108
|
const points = item.map((v) => ({ x: v[0], y: v[1] }));
|
|
150
109
|
const polygon = new fabric.Polygon(points, {
|
|
151
110
|
...defaultStyle,
|
|
152
|
-
...((
|
|
111
|
+
...((_b = pulseObj.shadow) == null ? void 0 : _b.style) || {}
|
|
153
112
|
});
|
|
154
113
|
shadowLinesCache.add(polygon);
|
|
155
114
|
canvas.value.add(polygon);
|
|
@@ -414,6 +373,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
414
373
|
pointList.push(point);
|
|
415
374
|
}
|
|
416
375
|
});
|
|
376
|
+
scaleValue.type === "pulse" && shadowPointCache.push(pointList);
|
|
417
377
|
Promise.all(pointList).then((res) => {
|
|
418
378
|
const lineListFilter = lineList.filter((v) => v);
|
|
419
379
|
let prevPoint = null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent, computed, watch, openBlock, createBlock, unref, withCtx, createElementBlock, createVNode, isRef, Fragment, renderList, createCommentVNode, createElementVNode, normalizeStyle, renderSlot, toDisplayString, nextTick } from 'vue';
|
|
2
2
|
import { createForm, onFieldValueChange, isField } from '@formily/core';
|
|
3
3
|
import { FormProvider, FormConsumer } from '@formily/vue';
|
|
4
|
-
import { cloneDeep } from 'lodash-es';
|
|
4
|
+
import { cloneDeep, isArray, isObject } from 'lodash-es';
|
|
5
5
|
import { NForm, NTabs, NTabPane, NConfigProvider } from 'naive-ui';
|
|
6
6
|
import { FormItemLineBarDepKeyPrepend } from '../../../packages/form-render/src/constants';
|
|
7
|
-
import { queryDecorator, queryInput, getParentLinebar } from '../../../packages/form-render/src/utils';
|
|
7
|
+
import { arrayed, queryDecorator, queryInput, getParentLinebar } from '../../../packages/form-render/src/utils';
|
|
8
8
|
import { useNuiThemeOverrides } from '../../../packages/form-table/src/hooks/useNuiThemeOverrides';
|
|
9
9
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
|
|
10
10
|
import { useFormContext } from './hooks/useFormContext.js';
|
|
@@ -95,9 +95,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
95
95
|
expose({
|
|
96
96
|
validate(path = "*") {
|
|
97
97
|
return formModel.validate(path).catch((err) => {
|
|
98
|
-
return Promise.reject(Array.isArray(err) ? err.
|
|
98
|
+
return Promise.reject(Array.isArray(err) ? err.reduce(errInfoNormalize, []) : err);
|
|
99
99
|
});
|
|
100
|
+
function errInfoNormalize(result, error) {
|
|
101
|
+
let childMessageNum = 0;
|
|
102
|
+
if (isArray(error.messages)) {
|
|
103
|
+
error.messages.forEach((message) => {
|
|
104
|
+
if (!isObject(message))
|
|
105
|
+
return;
|
|
106
|
+
result.push(...arrayed(message).map(bindInfo));
|
|
107
|
+
childMessageNum++;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
!childMessageNum && result.push(bindInfo(error));
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
100
113
|
function bindInfo(info) {
|
|
114
|
+
if (info.decoratorElement)
|
|
115
|
+
return info;
|
|
101
116
|
info.title = formModel.query(info.path).get("title");
|
|
102
117
|
info.decoratorElement = queryDecorator(info.path, scrollbarRef.value, formUUID);
|
|
103
118
|
Object.assign(info, queryInput(info.decoratorElement));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch,
|
|
1
|
+
import { defineComponent, onMounted, ref, computed, watch, createVNode, createTextVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
3
|
import { Path } from '../../../../../node_modules/@formily/path/esm/index.js';
|
|
4
|
-
import { isNumber } from 'lodash-es';
|
|
5
|
-
import {
|
|
4
|
+
import { flatten, isNumber } from 'lodash-es';
|
|
5
|
+
import { useFormField } from '../../../../../packages/form-render';
|
|
6
|
+
import { arrayed, assignUpdateValue, mergeDeepProperties, formRenderLog } from '../../utils/index.js';
|
|
6
7
|
import { connect, mapProps } from '@formily/vue';
|
|
7
8
|
import { useDebounceFn, isObject } from '@vueuse/core';
|
|
8
9
|
import { NButton } from 'naive-ui';
|
|
@@ -32,7 +33,26 @@ const script = defineComponent({
|
|
|
32
33
|
}) {
|
|
33
34
|
const emitChange = useDebounceFn(function emitChange2() {
|
|
34
35
|
emit("update:value", JSON.stringify(_values.value));
|
|
36
|
+
formRenderRefs.value.splice(groupNum.value);
|
|
35
37
|
}, 300);
|
|
38
|
+
const {
|
|
39
|
+
field
|
|
40
|
+
} = useFormField();
|
|
41
|
+
onMounted(() => {
|
|
42
|
+
if (!isField(field.value))
|
|
43
|
+
return;
|
|
44
|
+
const tempValidator = field.value.validator;
|
|
45
|
+
field.value.validator = [{
|
|
46
|
+
async validator() {
|
|
47
|
+
return Promise.allSettled(formRenderRefs.value.map((formRenderRef) => formRenderRef.validate())).then((resultList) => {
|
|
48
|
+
const rejected = resultList.filter((res) => res.status === "rejected");
|
|
49
|
+
if (!rejected.length)
|
|
50
|
+
return "";
|
|
51
|
+
return flatten(rejected.map((res) => res.reason));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, ...tempValidator ? arrayed(tempValidator) : []];
|
|
55
|
+
});
|
|
36
56
|
const formRenderRefs = ref([]);
|
|
37
57
|
const groupNum = ref(1);
|
|
38
58
|
const maxGroupNum = computed(() => {
|
|
@@ -44,7 +64,7 @@ const script = defineComponent({
|
|
|
44
64
|
});
|
|
45
65
|
function add() {
|
|
46
66
|
groupNum.value++;
|
|
47
|
-
_values.value.push({});
|
|
67
|
+
_values.value.push(mergeDeepProperties({}, props.getProperties()));
|
|
48
68
|
emitChange();
|
|
49
69
|
}
|
|
50
70
|
function remove(idx) {
|
|
@@ -56,13 +76,13 @@ const script = defineComponent({
|
|
|
56
76
|
if (groupNum.value <= value)
|
|
57
77
|
return;
|
|
58
78
|
groupNum.value = value;
|
|
59
|
-
_values.value.splice(
|
|
79
|
+
_values.value.splice(value);
|
|
60
80
|
emitChange();
|
|
61
81
|
}, {
|
|
62
82
|
immediate: true
|
|
63
83
|
});
|
|
64
84
|
const _values = ref([{}]);
|
|
65
|
-
function initValues(data) {
|
|
85
|
+
function initValues(data, withInitialData = false) {
|
|
66
86
|
if (!data)
|
|
67
87
|
return;
|
|
68
88
|
try {
|
|
@@ -72,10 +92,10 @@ const script = defineComponent({
|
|
|
72
92
|
parsed.forEach((v, idx) => {
|
|
73
93
|
if (idx > maxGroupNum.value - 1)
|
|
74
94
|
return;
|
|
75
|
-
if (isObject(v))
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
95
|
+
if (isObject(v)) {
|
|
96
|
+
_values.value[idx] = v;
|
|
97
|
+
withInitialData && mergeDeepProperties(v, props.getProperties());
|
|
98
|
+
}
|
|
79
99
|
});
|
|
80
100
|
groupNum.value = Math.min(_values.value.length, maxGroupNum.value);
|
|
81
101
|
} catch (e) {
|
|
@@ -95,7 +115,10 @@ const script = defineComponent({
|
|
|
95
115
|
}
|
|
96
116
|
}
|
|
97
117
|
watch(() => props.value, (value) => initValues(value));
|
|
98
|
-
onMounted(() =>
|
|
118
|
+
onMounted(() => {
|
|
119
|
+
initValues(props.value || "[{}]", true);
|
|
120
|
+
emitChange();
|
|
121
|
+
});
|
|
99
122
|
function stop(event) {
|
|
100
123
|
event.stopPropagation();
|
|
101
124
|
}
|
|
@@ -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, transformDateFormat } from '../utils/index.js';
|
|
4
|
+
import { fieldKeyEscape, arrayed, createLinebarId, elementIdEscape, transformDateFormat } from '../utils/index.js';
|
|
5
5
|
|
|
6
6
|
function useFieldListAdaptor(collector, uuid) {
|
|
7
7
|
const { createValidatorSchema } = useFormValidator();
|
|
@@ -31,7 +31,7 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
31
31
|
showLabel: item.hide_title !== "1",
|
|
32
32
|
propertyKey: item.val_key,
|
|
33
33
|
annotation: item.annotation,
|
|
34
|
-
id: `${uuid}-${item.val_key}
|
|
34
|
+
id: elementIdEscape(`${uuid}-${item.val_key}`),
|
|
35
35
|
...item.decoratorProps || {}
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -96,7 +96,10 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
96
96
|
};
|
|
97
97
|
const createCombinationSchema = (item) => {
|
|
98
98
|
const schema = createStandardSchema(item);
|
|
99
|
-
schema["x-decorator-props"]
|
|
99
|
+
Object.assign(schema["x-decorator-props"], {
|
|
100
|
+
showLabel: false,
|
|
101
|
+
showFeedback: false
|
|
102
|
+
});
|
|
100
103
|
Object.assign(schema["x-component-props"], {
|
|
101
104
|
title: item.alias || item.name,
|
|
102
105
|
maxGroupNum: item.maxGroupNum,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { AnyObject, ArrayAble } from '../../../../../es/src/types';
|
|
2
|
-
import { SchemaReaction } from '@formily/json-schema/esm/types';
|
|
3
2
|
import { SchemaTypes } from '@formily/vue';
|
|
4
3
|
import { CSSProperties, VNode } from 'vue';
|
|
5
4
|
import { DependKeyType, FormCommonState } from '../../../../../es/packages/form-render';
|
|
6
|
-
|
|
5
|
+
declare type FieldBusinessType = 'password' | 'id_card' | 'age' | 'age_unit' | 'mobile' | 'telephone' | 'email' | 'sex' | 'birthday' | 'bank_card' | 'website' | 'gestational_weeks' | 'gestational_stage' | 'customer_name';
|
|
7
6
|
export declare type ValidateItem = Partial<{
|
|
8
7
|
/**
|
|
9
8
|
* 业务类型
|
|
10
9
|
*/
|
|
11
|
-
obj_type:
|
|
10
|
+
obj_type: FieldBusinessType;
|
|
12
11
|
/**
|
|
13
12
|
* 校验类型
|
|
14
13
|
*/
|
|
@@ -41,6 +40,20 @@ interface SwitchProperty {
|
|
|
41
40
|
value?: any;
|
|
42
41
|
describe?: string;
|
|
43
42
|
}
|
|
43
|
+
interface ReactionType {
|
|
44
|
+
dependencies?: string[];
|
|
45
|
+
target?: string;
|
|
46
|
+
when?: string | boolean;
|
|
47
|
+
fulfill?: {
|
|
48
|
+
state?: AnyObject;
|
|
49
|
+
run?: string;
|
|
50
|
+
};
|
|
51
|
+
otherwise?: {
|
|
52
|
+
state?: AnyObject;
|
|
53
|
+
run?: string;
|
|
54
|
+
};
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}
|
|
44
57
|
export declare type FieldItem = {
|
|
45
58
|
/**
|
|
46
59
|
* 字段的key
|
|
@@ -181,7 +194,7 @@ export declare type FieldItem = {
|
|
|
181
194
|
/**
|
|
182
195
|
* 表单联动配置
|
|
183
196
|
*/
|
|
184
|
-
reactions: ArrayAble<
|
|
197
|
+
reactions: ArrayAble<ReactionType>;
|
|
185
198
|
[key: string]: any;
|
|
186
199
|
}>;
|
|
187
200
|
export {};
|
|
@@ -12,6 +12,7 @@ export declare function transformDateFormat(format?: string): "date" | "datetime
|
|
|
12
12
|
export declare function isIdCard(idCardNo: string): boolean;
|
|
13
13
|
export declare function isMobile(mobile: string): boolean;
|
|
14
14
|
export declare function parseBirthday(birthday: string): AgeContext;
|
|
15
|
+
export declare function mergeDeepProperties(target: AnyObject, fieldList: FieldItem[], traverseProperties?: string[], property?: string, targetProperty?: string): AnyObject;
|
|
15
16
|
export declare function parseIdCard(idCardNo: string): IdCardParseInfo;
|
|
16
17
|
export declare function injectOrProvide<T>(key: InjectionKey<T>, creator: () => T): T;
|
|
17
18
|
export declare function traverseDependKey(dependKeys: DependKeyType, handler: {
|
|
@@ -28,6 +29,7 @@ export declare function queryInput(decoratorElement?: HTMLElement | null): {
|
|
|
28
29
|
widgetElementList: HTMLInputElement[];
|
|
29
30
|
};
|
|
30
31
|
export declare function getParentLinebar(key: string, fieldList: FieldItem[]): string | null;
|
|
32
|
+
export declare function elementIdEscape(id: string): string;
|
|
31
33
|
export declare function createLinebarId(id: string): string;
|
|
32
34
|
export declare function fieldKeyEscape(fieldList: FieldItem[]): string;
|
|
33
35
|
export declare function createInputSlot(props: AnyObject): import("vue").ComputedRef<Record<string, FunctionalComponent<{}, {}>>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { inject, provide, computed, createVNode, Fragment } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { isObject } from '@vue/shared';
|
|
3
|
+
import { isArray, isString, isFunction } from 'lodash-es';
|
|
3
4
|
import { FIELD_SEX_VALUE } from '../constants/index.js';
|
|
4
5
|
import { isField } from '@formily/core';
|
|
5
6
|
import differenceInDays from '../../../../node_modules/date-fns/esm/differenceInDays/index.js';
|
|
@@ -46,6 +47,33 @@ function parseBirthday(birthday) {
|
|
|
46
47
|
result.age = result.year = differenceInYears(d, birthDate);
|
|
47
48
|
return result;
|
|
48
49
|
}
|
|
50
|
+
function mergeDeepProperties(target, fieldList, traverseProperties = ["children", "properties", "suffixConfig"], property = "val_key", targetProperty = "default_val") {
|
|
51
|
+
function traverse(_target, _fieldList) {
|
|
52
|
+
_fieldList.forEach((field) => {
|
|
53
|
+
if (!isObject(field))
|
|
54
|
+
return;
|
|
55
|
+
if (targetPropertyFor(field) != null && _target[propertyFor(field)] == null) {
|
|
56
|
+
_target[propertyFor(field)] = targetPropertyFor(field);
|
|
57
|
+
}
|
|
58
|
+
traverseProperties.forEach((p) => {
|
|
59
|
+
if (!field[p])
|
|
60
|
+
return;
|
|
61
|
+
if (!_target[propertyFor(field)]) {
|
|
62
|
+
_target[propertyFor(field)] = {};
|
|
63
|
+
}
|
|
64
|
+
traverse(_target[propertyFor(field)], arrayed(field[p]));
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
traverse(target, fieldList);
|
|
69
|
+
return target;
|
|
70
|
+
function propertyFor(field) {
|
|
71
|
+
return field[property];
|
|
72
|
+
}
|
|
73
|
+
function targetPropertyFor(field) {
|
|
74
|
+
return field[targetProperty];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
49
77
|
function parseIdCard(idCardNo) {
|
|
50
78
|
const parseInner = (certificateNo, idxSexStart, birthYearSpan) => {
|
|
51
79
|
const res = {};
|
|
@@ -124,7 +152,7 @@ function createSlot(renderer, props) {
|
|
|
124
152
|
};
|
|
125
153
|
}
|
|
126
154
|
function queryDecorator(key, wrapperElement, formUUID) {
|
|
127
|
-
return wrapperElement.querySelector(`#${formUUID}-${key}`);
|
|
155
|
+
return wrapperElement.querySelector(elementIdEscape(`#${formUUID}-${key}`));
|
|
128
156
|
}
|
|
129
157
|
function queryInput(decoratorElement) {
|
|
130
158
|
var _a;
|
|
@@ -150,8 +178,11 @@ function getParentLinebar(key, fieldList) {
|
|
|
150
178
|
return field.html_type === "LINEBAR";
|
|
151
179
|
}
|
|
152
180
|
}
|
|
181
|
+
function elementIdEscape(id) {
|
|
182
|
+
return id.replace(".", "-");
|
|
183
|
+
}
|
|
153
184
|
function createLinebarId(id) {
|
|
154
|
-
return `id-${id}
|
|
185
|
+
return elementIdEscape(`id-${id}`);
|
|
155
186
|
}
|
|
156
187
|
function fieldKeyEscape(fieldList) {
|
|
157
188
|
return fieldList.map((f) => f.val_key).join("-").replace(/[.]/g, "_");
|
|
@@ -169,4 +200,4 @@ function createInputSlot(props) {
|
|
|
169
200
|
});
|
|
170
201
|
}
|
|
171
202
|
|
|
172
|
-
export { arrayed, assignUpdateValue, createInputSlot, createLinebarId, createSlot, fieldKeyEscape, formRenderLog, getParentLinebar, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseDependKey, traverseSchema, uuidGenerator };
|
|
203
|
+
export { arrayed, assignUpdateValue, createInputSlot, createLinebarId, createSlot, elementIdEscape, fieldKeyEscape, formRenderLog, getParentLinebar, injectOrProvide, isIdCard, isMobile, mergeDeepProperties, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseDependKey, traverseSchema, uuidGenerator };
|
package/es/packages/index.css
CHANGED
|
@@ -396,6 +396,17 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
396
396
|
height: var(--tableImageHeight);
|
|
397
397
|
width: var(--tableImageWidth);
|
|
398
398
|
}
|
|
399
|
+
.custom-big-table .domPropsInnerHTML-span .icon-dot-custom {
|
|
400
|
+
width: 8px;
|
|
401
|
+
height: 8px;
|
|
402
|
+
-webkit-border-radius: 50%;
|
|
403
|
+
-moz-border-radius: 50%;
|
|
404
|
+
border-radius: 50%;
|
|
405
|
+
background: var(--table-icon-color);
|
|
406
|
+
display: inline-block;
|
|
407
|
+
margin-right: 6px;
|
|
408
|
+
box-shadow: 0px 2px 4px 0px var(--table-icon-shadow);
|
|
409
|
+
}
|
|
399
410
|
.custom-big-table .domPropsInnerHTML-span .icon-dot-red {
|
|
400
411
|
width: 8px;
|
|
401
412
|
height: 8px;
|
|
@@ -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
|
-
},
|
|
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
|
|
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
|
-
},
|
|
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
|
|
10
|
-
get traverse():
|
|
11
|
-
query(key: string):
|
|
12
|
-
|
|
13
|
-
update(key: string, info
|
|
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: () =>
|
|
27
|
-
query: (key: string) =>
|
|
27
|
+
traverse: () => Omit<ShortcutItem, "callback">[];
|
|
28
|
+
query: (key: string) => Omit<ShortcutItem, "callback">;
|
|
28
29
|
update: (key: string, info: KeyboardEvent | Partial<ShortcutSignatureInfo>) => void;
|
|
29
|
-
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
42
|
-
|
|
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", "
|
|
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.
|
|
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
|
|
152
|
-
manager.
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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 + " : ""}${
|
|
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) =>
|
|
62
|
+
query: (key: string) => Omit<import("..").ShortcutItem, "callback">;
|
|
63
63
|
update: (key: string, info: KeyboardEvent | Partial<import("..").ShortcutSignatureInfo>) => void;
|
|
64
|
-
updateState:
|
|
65
|
-
|
|
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
|
-
|
|
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) =>
|
|
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:
|
|
65
|
-
|
|
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
|
-
|
|
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
|
|
83
|
+
function onSignatureReset() {
|
|
82
84
|
if (!shortcutItem.value)
|
|
83
85
|
return;
|
|
84
|
-
updateDecorator(() =>
|
|
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:
|
|
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) =>
|
|
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:
|
|
55
|
-
|
|
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
|
-
|
|
74
|
+
onSignatureReset: () => void;
|
|
73
75
|
NButton: import("vue").DefineComponent<{
|
|
74
76
|
readonly color: StringConstructor;
|
|
75
77
|
readonly textColor: StringConstructor;
|