cnhis-design-vue 3.1.14 → 3.1.15-beta.10
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/annotation-edit/src/AnnotationEdit.js +2 -1
- package/es/packages/big-table/index.d.ts +8 -11
- package/es/packages/big-table/src/BigTable.vue.d.ts +24 -19
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +17 -11
- package/es/packages/big-table/src/bigTableProps.d.ts +4 -3
- package/es/packages/big-table/src/bigTableProps.js +1 -1
- package/es/packages/big-table/src/components/edit-form/edit-date.js +13 -4
- package/es/packages/big-table/src/components/edit-form/edit-select.js +2 -1
- package/es/packages/big-table/src/components/edit-form/edit-separate.js +18 -9
- package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +3 -1
- package/es/packages/big-table/src/hooks/useAnnotation.d.ts +4 -0
- package/es/packages/big-table/src/hooks/useAnnotation.js +21 -0
- package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +51 -36
- package/es/packages/big-table/src/hooks/useEdit.d.ts +3 -1
- package/es/packages/big-table/src/hooks/useFormat.js +8 -1
- package/es/packages/big-table/style/index.css +38 -1
- package/es/packages/bpmn-workflow/src/BpmnWorkflow.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/BpmnRenderer.js +8 -8
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomContextPadProvider.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomPalette.js +1 -1
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRenderer.js +4 -3
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRules.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customModeler/index.js +1 -1
- package/es/packages/bpmn-workflow/src/custom/customOtherModule/CustomPopupMenu.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customOtherModule/zoomScroll.js +3 -3
- package/es/packages/button-print/src/utils/print.d.ts +1 -1
- package/es/packages/button-print/src/utils/print.js +1 -1
- package/es/packages/fabric-chart/index.d.ts +1 -0
- package/es/packages/fabric-chart/src/FabricChart.js +17 -17
- package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +12 -10
- package/es/packages/fabric-chart/src/hooks/useCenter.js +35 -73
- package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +4 -2
- package/es/packages/fabric-chart/src/hooks/useDraw.js +1 -0
- package/es/packages/fabric-chart/src/hooks/useLeft.js +5 -4
- package/es/packages/field-set/index.d.ts +4365 -0
- package/es/packages/field-set/src/FieldSet.js +53 -54
- package/es/packages/field-set/src/FieldSet.vue.d.ts +4365 -0
- package/es/packages/field-set/style/index.css +0 -9
- package/es/packages/form-config/index.d.ts +12111 -0
- package/es/packages/form-config/index.js +10 -0
- package/es/packages/form-config/src/FormConfig.js +113 -0
- package/es/packages/form-config/src/FormConfig.vue.d.ts +12113 -0
- package/es/packages/form-config/src/components/FormConfigCreator.js +97 -0
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +5094 -0
- package/es/packages/form-config/src/components/FormConfigEdit.js +81 -0
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +3591 -0
- package/es/packages/form-config/src/constants/index.d.ts +28 -0
- package/es/packages/form-config/src/constants/index.js +28 -0
- package/es/packages/form-config/src/hooks/index.d.ts +2 -0
- package/es/packages/form-config/src/hooks/index.js +2 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.d.ts +6 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.js +103 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.d.ts +5 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.js +117 -0
- package/es/packages/form-config/src/hooks/useSortable.d.ts +11 -0
- package/es/packages/form-config/src/hooks/useSortable.js +31 -0
- package/es/packages/form-config/src/types/index.d.ts +18 -0
- package/es/packages/form-config/src/types/index.js +1 -0
- package/es/packages/form-config/style/index.css +108 -0
- package/es/packages/form-render/index.d.ts +24 -3
- package/es/packages/form-render/src/FormRender.js +25 -6
- package/es/packages/form-render/src/FormRender.vue.d.ts +24 -3
- package/es/packages/form-render/src/components/renderer/cascader.js +7 -7
- package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.d.ts +5 -0
- package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.js +32 -0
- package/es/packages/form-render/src/components/renderer/{combination.d.ts → combination/index.d.ts} +7 -1
- package/es/packages/form-render/src/components/renderer/combination/index.js +157 -0
- package/es/packages/form-render/src/components/renderer/complex.d.ts +2 -0
- package/es/packages/form-render/src/components/renderer/complex.js +2 -5
- package/es/packages/form-render/src/components/renderer/date.d.ts +29 -0
- package/es/packages/form-render/src/components/renderer/date.js +63 -56
- package/es/packages/form-render/src/components/renderer/formItem.js +3 -3
- package/es/packages/form-render/src/components/renderer/index.js +1 -1
- package/es/packages/form-render/src/components/renderer/radio.js +4 -1
- package/es/packages/form-render/src/components/renderer/select.d.ts +9 -0
- package/es/packages/form-render/src/components/renderer/select.js +28 -17
- package/es/packages/form-render/src/constants/index.d.ts +2 -1
- package/es/packages/form-render/src/hooks/useAnchor.d.ts +7 -6
- package/es/packages/form-render/src/hooks/useAnchor.js +1 -2
- package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +6 -1
- package/es/packages/form-render/src/hooks/useAsyncQueue.js +12 -7
- package/es/packages/form-render/src/hooks/useCommonInjection.d.ts +6 -0
- package/es/packages/form-render/src/hooks/useCommonInjection.js +19 -0
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +9 -7
- package/es/packages/form-render/src/hooks/useFormContext.d.ts +3 -3
- package/es/packages/form-render/src/hooks/useFormContext.js +21 -3
- package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.d.ts +13 -0
- package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.js +10 -0
- package/es/packages/form-render/src/types/fieldItem.d.ts +33 -4
- package/es/packages/form-render/src/types/index.d.ts +30 -2
- package/es/packages/form-render/src/utils/index.d.ts +8 -5
- package/es/packages/form-render/src/utils/index.js +64 -13
- package/es/packages/form-render/style/index.css +11 -10
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +1 -1
- package/es/packages/index.css +158 -21
- package/es/packages/index.d.ts +3 -1
- package/es/packages/index.js +4 -1
- package/es/packages/info-header/index.d.ts +1 -3
- package/es/packages/info-header/src/HiddenContent.js +1 -1
- package/es/packages/info-header/src/HiddenContent.vue.d.ts +1 -3
- package/es/packages/info-header/src/InfoHeader.vue.d.ts +1 -3
- package/es/packages/info-header/style/index.css +1 -1
- 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 +32 -9
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +32 -9
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +8 -6
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +8 -6
- package/es/src/utils/state.d.ts +29 -0
- package/es/src/utils/state.js +44 -0
- package/package.json +10 -1
- package/es/_virtual/_commonjsHelpers.js +0 -7
- package/es/_virtual/css.escape.js +0 -3
- package/es/_virtual/inherits.js +0 -3
- package/es/_virtual/inherits_browser.js +0 -3
- package/es/node_modules/@formily/path/esm/contexts.js +0 -22
- package/es/node_modules/@formily/path/esm/destructor.js +0 -124
- package/es/node_modules/@formily/path/esm/index.js +0 -579
- package/es/node_modules/@formily/path/esm/matcher.js +0 -199
- package/es/node_modules/@formily/path/esm/parser.js +0 -402
- package/es/node_modules/@formily/path/esm/shared.js +0 -73
- package/es/node_modules/@formily/path/esm/tokenizer.js +0 -287
- package/es/node_modules/@formily/path/esm/tokens.js +0 -240
- package/es/node_modules/@formily/path/esm/types.js +0 -17
- package/es/node_modules/css.escape/css.escape.js +0 -110
- package/es/node_modules/date-fns/esm/_lib/defaultOptions/index.js +0 -6
- package/es/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +0 -18
- package/es/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js +0 -17
- package/es/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js +0 -27
- package/es/node_modules/date-fns/esm/_lib/getUTCWeek/index.js +0 -17
- package/es/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js +0 -38
- package/es/node_modules/date-fns/esm/_lib/requiredArgs/index.js +0 -7
- package/es/node_modules/date-fns/esm/_lib/setUTCDay/index.js +0 -27
- package/es/node_modules/date-fns/esm/_lib/setUTCISODay/index.js +0 -23
- package/es/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/setUTCWeek/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js +0 -25
- package/es/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js +0 -21
- package/es/node_modules/date-fns/esm/_lib/toInteger/index.js +0 -15
- package/es/node_modules/date-fns/esm/compareAsc/index.js +0 -52
- package/es/node_modules/date-fns/esm/constants/index.js +0 -40
- package/es/node_modules/date-fns/esm/differenceInCalendarDays/index.js +0 -49
- package/es/node_modules/date-fns/esm/differenceInCalendarMonths/index.js +0 -35
- package/es/node_modules/date-fns/esm/differenceInCalendarYears/index.js +0 -33
- package/es/node_modules/date-fns/esm/differenceInDays/index.js +0 -86
- package/es/node_modules/date-fns/esm/differenceInMonths/index.js +0 -59
- package/es/node_modules/date-fns/esm/differenceInYears/index.js +0 -43
- package/es/node_modules/date-fns/esm/endOfDay/index.js +0 -30
- package/es/node_modules/date-fns/esm/endOfMonth/index.js +0 -32
- package/es/node_modules/date-fns/esm/isLastDayOfMonth/index.js +0 -30
- package/es/node_modules/date-fns/esm/parse/_lib/Parser.js +0 -32
- package/es/node_modules/date-fns/esm/parse/_lib/Setter.js +0 -37
- package/es/node_modules/date-fns/esm/parse/_lib/constants.js +0 -48
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js +0 -55
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js +0 -55
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js +0 -55
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js +0 -52
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js +0 -80
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js +0 -56
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js +0 -53
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js +0 -30
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js +0 -29
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js +0 -48
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js +0 -41
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js +0 -42
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js +0 -50
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js +0 -99
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js +0 -46
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js +0 -46
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js +0 -43
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js +0 -33
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js +0 -96
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js +0 -43
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js +0 -61
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js +0 -41
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js +0 -80
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js +0 -73
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js +0 -41
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js +0 -96
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js +0 -80
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js +0 -73
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js +0 -26
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js +0 -26
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js +0 -66
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/index.js +0 -109
- package/es/node_modules/date-fns/esm/parse/_lib/utils.js +0 -133
- package/es/node_modules/date-fns/esm/startOfDay/index.js +0 -30
- package/es/node_modules/date-fns/esm/toDate/index.js +0 -55
- package/es/node_modules/diagram-js/lib/command/CommandInterceptor.js +0 -139
- package/es/node_modules/diagram-js/lib/draw/BaseRenderer.js +0 -88
- package/es/node_modules/diagram-js/lib/features/popup-menu/PopupMenu.js +0 -591
- package/es/node_modules/diagram-js/lib/features/rules/RuleProvider.js +0 -88
- package/es/node_modules/diagram-js/lib/navigation/movecanvas/MoveCanvas.js +0 -120
- package/es/node_modules/diagram-js/lib/navigation/movecanvas/index.js +0 -8
- package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomScroll.js +0 -227
- package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomUtil.js +0 -24
- package/es/node_modules/diagram-js/lib/util/ClickTrap.js +0 -23
- package/es/node_modules/diagram-js/lib/util/Cursor.js +0 -20
- package/es/node_modules/diagram-js/lib/util/Event.js +0 -22
- package/es/node_modules/diagram-js/lib/util/Math.js +0 -9
- package/es/node_modules/diagram-js/lib/util/Mouse.js +0 -30
- package/es/node_modules/diagram-js/lib/util/Platform.js +0 -5
- package/es/node_modules/diagram-js/lib/util/PositionUtil.js +0 -8
- package/es/node_modules/diagram-js/lib/util/RenderUtil.js +0 -25
- package/es/node_modules/diagram-js/lib/util/SvgTransformUtil.js +0 -48
- package/es/node_modules/ids/dist/index.esm.js +0 -164
- package/es/node_modules/inherits/inherits.js +0 -19
- package/es/node_modules/inherits/inherits_browser.js +0 -38
- package/es/node_modules/inherits-browser/dist/index.es.js +0 -3
- package/es/node_modules/min-dash/dist/index.esm.js +0 -169
- package/es/node_modules/min-dom/dist/index.esm.js +0 -588
- package/es/node_modules/tiny-svg/dist/index.esm.js +0 -525
- package/es/packages/form-render/src/components/renderer/combination.js +0 -148
|
@@ -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 };
|
|
@@ -57,17 +57,19 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
57
57
|
fieldItem: import("..").FieldItem;
|
|
58
58
|
placeholder: string;
|
|
59
59
|
editPlaceholder: string;
|
|
60
|
-
operation: ("
|
|
60
|
+
operation: ("reset" | "state")[];
|
|
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
|
-
|
|
65
|
-
|
|
64
|
+
updateDisabled: (key: string, state?: boolean | undefined) => void;
|
|
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>;
|
|
69
71
|
isEditState: import("vue").ComputedRef<boolean>;
|
|
70
|
-
hasOperation: (operation: "
|
|
72
|
+
hasOperation: (operation: "reset" | "state") => boolean;
|
|
71
73
|
currentEditShortcut: import("vue").Ref<string>;
|
|
72
74
|
showContent: import("vue").ComputedRef<string>;
|
|
73
75
|
placeholder: import("vue").ComputedRef<string>;
|
|
@@ -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;
|
|
@@ -4392,6 +4394,13 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4392
4394
|
uuid: {
|
|
4393
4395
|
type: StringConstructor;
|
|
4394
4396
|
};
|
|
4397
|
+
lifeCycle: {
|
|
4398
|
+
type: import("vue").PropType<Partial<{
|
|
4399
|
+
onSetup(): void;
|
|
4400
|
+
beforeRequest(fieldKey: string, params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
4401
|
+
afterRequest(fieldKey: string, payload?: any): import("../../../es/src/types").AnyObject[];
|
|
4402
|
+
}>>;
|
|
4403
|
+
};
|
|
4395
4404
|
}, {
|
|
4396
4405
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
4397
4406
|
fieldList: {
|
|
@@ -4500,6 +4509,13 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4500
4509
|
uuid: {
|
|
4501
4510
|
type: StringConstructor;
|
|
4502
4511
|
};
|
|
4512
|
+
lifeCycle: {
|
|
4513
|
+
type: import("vue").PropType<Partial<{
|
|
4514
|
+
onSetup(): void;
|
|
4515
|
+
beforeRequest(fieldKey: string, params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
4516
|
+
afterRequest(fieldKey: string, payload?: any): import("../../../es/src/types").AnyObject[];
|
|
4517
|
+
}>>;
|
|
4518
|
+
};
|
|
4503
4519
|
}>> & {
|
|
4504
4520
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
4505
4521
|
}>>;
|
|
@@ -4509,10 +4525,11 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4509
4525
|
businessCollector: import("..").BusinessCollector;
|
|
4510
4526
|
formItemDepsCollector: import("..").FormItemDepsCollector;
|
|
4511
4527
|
changeContextCollector: import("..").ContextCollector;
|
|
4512
|
-
formUUID:
|
|
4528
|
+
formUUID: string;
|
|
4513
4529
|
formModel: import("@formily/core").Form<{
|
|
4514
4530
|
[x: string]: any;
|
|
4515
4531
|
}>;
|
|
4532
|
+
scrollbarRef: import("vue").Ref<HTMLElement | undefined>;
|
|
4516
4533
|
schemaAdaptor: (fieldList: import("..").FieldItem[]) => Record<string, import("@formily/json-schema").Stringify<{
|
|
4517
4534
|
[key: symbol]: any;
|
|
4518
4535
|
[key: `x-${string}`]: any;
|
|
@@ -4628,7 +4645,6 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4628
4645
|
"x-compile-omitted"?: string[] | undefined;
|
|
4629
4646
|
}>>;
|
|
4630
4647
|
currentAnchor: import("vue").WritableComputedRef<string>;
|
|
4631
|
-
scrollbarRef: import("vue").Ref<HTMLElement | undefined>;
|
|
4632
4648
|
generateAnchorList: (schema: import("@formily/json-schema").Stringify<{
|
|
4633
4649
|
[key: symbol]: any;
|
|
4634
4650
|
[key: `x-${string}`]: any;
|
|
@@ -4690,7 +4706,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4690
4706
|
name: string;
|
|
4691
4707
|
title: string;
|
|
4692
4708
|
}[]>;
|
|
4693
|
-
formHeight: import("vue").ComputedRef<
|
|
4709
|
+
formHeight: import("vue").ComputedRef<string | undefined>;
|
|
4694
4710
|
onScroll: () => void;
|
|
4695
4711
|
queryWidget: (key: string, wrapperElement: HTMLElement, fieldList: import("..").FieldItem[]) => Promise<{
|
|
4696
4712
|
widgetElement: HTMLInputElement | null | undefined;
|
|
@@ -5995,6 +6011,13 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
5995
6011
|
uuid: {
|
|
5996
6012
|
type: StringConstructor;
|
|
5997
6013
|
};
|
|
6014
|
+
lifeCycle: {
|
|
6015
|
+
type: import("vue").PropType<Partial<{
|
|
6016
|
+
onSetup(): void;
|
|
6017
|
+
beforeRequest(fieldKey: string, params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
6018
|
+
afterRequest(fieldKey: string, payload?: any): import("../../../es/src/types").AnyObject[];
|
|
6019
|
+
}>>;
|
|
6020
|
+
};
|
|
5998
6021
|
}>> & {
|
|
5999
6022
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
6000
6023
|
}, {
|
|
@@ -57,17 +57,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
57
57
|
fieldItem: FieldItem;
|
|
58
58
|
placeholder: string;
|
|
59
59
|
editPlaceholder: string;
|
|
60
|
-
operation: ("
|
|
60
|
+
operation: ("reset" | "state")[];
|
|
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
|
-
|
|
65
|
-
|
|
64
|
+
updateDisabled: (key: string, state?: boolean | undefined) => void;
|
|
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>;
|
|
69
71
|
isEditState: import("vue").ComputedRef<boolean>;
|
|
70
|
-
hasOperation: (operation: "
|
|
72
|
+
hasOperation: (operation: "reset" | "state") => boolean;
|
|
71
73
|
currentEditShortcut: import("vue").Ref<string>;
|
|
72
74
|
showContent: import("vue").ComputedRef<string>;
|
|
73
75
|
placeholder: import("vue").ComputedRef<string>;
|
|
@@ -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;
|
|
@@ -4392,6 +4394,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4392
4394
|
uuid: {
|
|
4393
4395
|
type: StringConstructor;
|
|
4394
4396
|
};
|
|
4397
|
+
lifeCycle: {
|
|
4398
|
+
type: import("vue").PropType<Partial<{
|
|
4399
|
+
onSetup(): void;
|
|
4400
|
+
beforeRequest(fieldKey: string, params?: import("../../../src/types").AnyObject | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject>;
|
|
4401
|
+
afterRequest(fieldKey: string, payload?: any): import("../../../src/types").AnyObject[];
|
|
4402
|
+
}>>;
|
|
4403
|
+
};
|
|
4395
4404
|
}, {
|
|
4396
4405
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
4397
4406
|
fieldList: {
|
|
@@ -4500,6 +4509,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4500
4509
|
uuid: {
|
|
4501
4510
|
type: StringConstructor;
|
|
4502
4511
|
};
|
|
4512
|
+
lifeCycle: {
|
|
4513
|
+
type: import("vue").PropType<Partial<{
|
|
4514
|
+
onSetup(): void;
|
|
4515
|
+
beforeRequest(fieldKey: string, params?: import("../../../src/types").AnyObject | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject>;
|
|
4516
|
+
afterRequest(fieldKey: string, payload?: any): import("../../../src/types").AnyObject[];
|
|
4517
|
+
}>>;
|
|
4518
|
+
};
|
|
4503
4519
|
}>> & {
|
|
4504
4520
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
4505
4521
|
}>>;
|
|
@@ -4509,10 +4525,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4509
4525
|
businessCollector: import("../../../../es/packages/form-render").BusinessCollector;
|
|
4510
4526
|
formItemDepsCollector: import("../../../../es/packages/form-render").FormItemDepsCollector;
|
|
4511
4527
|
changeContextCollector: import("../../../../es/packages/form-render").ContextCollector;
|
|
4512
|
-
formUUID:
|
|
4528
|
+
formUUID: string;
|
|
4513
4529
|
formModel: import("@formily/core").Form<{
|
|
4514
4530
|
[x: string]: any;
|
|
4515
4531
|
}>;
|
|
4532
|
+
scrollbarRef: import("vue").Ref<HTMLElement | undefined>;
|
|
4516
4533
|
schemaAdaptor: (fieldList: FieldItem[]) => Record<string, import("@formily/json-schema").Stringify<{
|
|
4517
4534
|
[key: symbol]: any;
|
|
4518
4535
|
[key: `x-${string}`]: any;
|
|
@@ -4628,7 +4645,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4628
4645
|
"x-compile-omitted"?: string[] | undefined;
|
|
4629
4646
|
}>>;
|
|
4630
4647
|
currentAnchor: import("vue").WritableComputedRef<string>;
|
|
4631
|
-
scrollbarRef: import("vue").Ref<HTMLElement | undefined>;
|
|
4632
4648
|
generateAnchorList: (schema: import("@formily/json-schema").Stringify<{
|
|
4633
4649
|
[key: symbol]: any;
|
|
4634
4650
|
[key: `x-${string}`]: any;
|
|
@@ -4690,7 +4706,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4690
4706
|
name: string;
|
|
4691
4707
|
title: string;
|
|
4692
4708
|
}[]>;
|
|
4693
|
-
formHeight: import("vue").ComputedRef<
|
|
4709
|
+
formHeight: import("vue").ComputedRef<string | undefined>;
|
|
4694
4710
|
onScroll: () => void;
|
|
4695
4711
|
queryWidget: (key: string, wrapperElement: HTMLElement, fieldList: FieldItem[]) => Promise<{
|
|
4696
4712
|
widgetElement: HTMLInputElement | null | undefined;
|
|
@@ -5995,6 +6011,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
5995
6011
|
uuid: {
|
|
5996
6012
|
type: StringConstructor;
|
|
5997
6013
|
};
|
|
6014
|
+
lifeCycle: {
|
|
6015
|
+
type: import("vue").PropType<Partial<{
|
|
6016
|
+
onSetup(): void;
|
|
6017
|
+
beforeRequest(fieldKey: string, params?: import("../../../src/types").AnyObject | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject>;
|
|
6018
|
+
afterRequest(fieldKey: string, payload?: any): import("../../../src/types").AnyObject[];
|
|
6019
|
+
}>>;
|
|
6020
|
+
};
|
|
5998
6021
|
}>> & {
|
|
5999
6022
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
6000
6023
|
}, {
|
|
@@ -24,7 +24,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
24
24
|
},
|
|
25
25
|
setup(__props) {
|
|
26
26
|
const props = __props;
|
|
27
|
-
const { query, update,
|
|
27
|
+
const { query, update, updateDisabled, 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();
|
|
@@ -76,12 +78,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
76
78
|
function onStop() {
|
|
77
79
|
if (!shortcutItem.value)
|
|
78
80
|
return;
|
|
79
|
-
updateDecorator(() =>
|
|
81
|
+
updateDecorator(() => updateDisabled(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, [
|
|
@@ -97,7 +99,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
97
99
|
onKeyup: withModifiers(unref(onInputKeyUp), ["prevent", "stop"])
|
|
98
100
|
}, null, 8, ["disabled", "value", "placeholder", "onKeydown", "onKeyup"]),
|
|
99
101
|
createElementVNode("section", _hoisted_2, [
|
|
100
|
-
hasOperation("
|
|
102
|
+
hasOperation("state") ? (openBlock(), createBlock(unref(NButton), {
|
|
101
103
|
key: 0,
|
|
102
104
|
text: "",
|
|
103
105
|
onClick: onStop,
|
|
@@ -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), {
|
|
@@ -47,17 +47,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
47
47
|
fieldItem: FieldItem;
|
|
48
48
|
placeholder: string;
|
|
49
49
|
editPlaceholder: string;
|
|
50
|
-
operation: Array<'
|
|
50
|
+
operation: Array<'state' | '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
|
-
|
|
55
|
-
|
|
54
|
+
updateDisabled: (key: string, state?: boolean | undefined) => void;
|
|
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>;
|
|
59
61
|
isEditState: import("vue").ComputedRef<boolean>;
|
|
60
|
-
hasOperation: (operation: '
|
|
62
|
+
hasOperation: (operation: 'state' | 'reset') => boolean;
|
|
61
63
|
currentEditShortcut: import("vue").Ref<string>;
|
|
62
64
|
showContent: import("vue").ComputedRef<string>;
|
|
63
65
|
placeholder: import("vue").ComputedRef<string>;
|
|
@@ -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;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Ref, UnwrapRef, WritableComputedOptions, WritableComputedRef, ComputedRef } from 'vue';
|
|
2
|
+
interface GetState<T> {
|
|
3
|
+
(isRef: true): Ref<UnwrapRef<T>>;
|
|
4
|
+
(isRef?: false): UnwrapRef<T>;
|
|
5
|
+
}
|
|
6
|
+
export declare function useState<T>(initValue?: T): [GetState<T>, (val: UnwrapRef<T>) => UnwrapRef<T>];
|
|
7
|
+
export declare function useRef<T>(): GetState<T | null>;
|
|
8
|
+
/**
|
|
9
|
+
* v-for的ref引用
|
|
10
|
+
*/
|
|
11
|
+
export declare function useRefs<T>(): [Set<T>, (el: T) => void];
|
|
12
|
+
/**
|
|
13
|
+
* v-for的ref引用
|
|
14
|
+
* @return 数组
|
|
15
|
+
*/
|
|
16
|
+
export declare function useRefsArray<T>(): [T[], (el: T) => void];
|
|
17
|
+
interface GetComputed<T, R> {
|
|
18
|
+
(isRef: true): R;
|
|
19
|
+
(isRef: false): T;
|
|
20
|
+
(): T;
|
|
21
|
+
}
|
|
22
|
+
export declare function useComputed<T>(getter: WritableComputedOptions<T>['get']): GetComputed<T, ComputedRef<T>>;
|
|
23
|
+
export declare function useComputed<T>(options: WritableComputedOptions<T>): [GetComputed<T, WritableComputedRef<T>>, (val: T) => void];
|
|
24
|
+
/**
|
|
25
|
+
* 返回{ [key]: Ref }
|
|
26
|
+
* @params obj { [变量名]: useState或useComputed返回的getter函数 }
|
|
27
|
+
*/
|
|
28
|
+
export declare function getRefs(obj: Record<string, GetState<any> | GetComputed<any, any>>): Record<string, Ref<any>>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ref, onBeforeUpdate, computed, unref } from 'vue';
|
|
2
|
+
|
|
3
|
+
function useState(initValue) {
|
|
4
|
+
const state = ref(initValue);
|
|
5
|
+
const getState = (isRef) => isRef ? state : unref(state);
|
|
6
|
+
return [getState, (val) => state.value = val];
|
|
7
|
+
}
|
|
8
|
+
function useRef() {
|
|
9
|
+
return useState(null)[0];
|
|
10
|
+
}
|
|
11
|
+
function useRefs() {
|
|
12
|
+
const itemRefs = /* @__PURE__ */ new Set();
|
|
13
|
+
const setItemRef = (el) => el && itemRefs.add(el);
|
|
14
|
+
onBeforeUpdate(() => itemRefs.clear());
|
|
15
|
+
return [itemRefs, setItemRef];
|
|
16
|
+
}
|
|
17
|
+
function useRefsArray() {
|
|
18
|
+
let itemRefs = [];
|
|
19
|
+
const setItemRef = (el) => {
|
|
20
|
+
itemRefs.push(el);
|
|
21
|
+
};
|
|
22
|
+
onBeforeUpdate(() => {
|
|
23
|
+
itemRefs = [];
|
|
24
|
+
});
|
|
25
|
+
return [itemRefs, setItemRef];
|
|
26
|
+
}
|
|
27
|
+
function isWritableComputedOptions(arg) {
|
|
28
|
+
return typeof arg === "object" && Reflect.has(arg || {}, "set");
|
|
29
|
+
}
|
|
30
|
+
function useComputed(arg) {
|
|
31
|
+
const data = isWritableComputedOptions(arg) ? computed(arg) : computed(arg);
|
|
32
|
+
const getData = (isRef) => isRef ? data : data.value;
|
|
33
|
+
if (!isWritableComputedOptions(arg)) {
|
|
34
|
+
return getData;
|
|
35
|
+
}
|
|
36
|
+
return [getData, (val) => data.value = val];
|
|
37
|
+
}
|
|
38
|
+
function getRefs(obj) {
|
|
39
|
+
const result = {};
|
|
40
|
+
Object.entries(obj).forEach(([k, fn]) => result[k] = fn(true));
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { getRefs, useComputed, useRef, useRefs, useRefsArray, useState };
|