cnhis-design-vue 3.1.15-beta.3 → 3.1.15-beta.6
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/index.d.ts +0 -4
- package/es/packages/big-table/src/BigTable.vue.d.ts +2 -6
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +1 -0
- package/es/packages/big-table/src/bigTableProps.d.ts +0 -1
- package/es/packages/big-table/src/bigTableProps.js +1 -1
- package/es/packages/big-table/src/components/edit-form/edit-date.js +2 -1
- package/es/packages/big-table/src/components/edit-form/edit-select.js +2 -1
- package/es/packages/big-table/src/hooks/useAnnotation.js +2 -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/fabric-chart/src/FabricChart.js +5 -1
- package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +7 -6
- package/es/packages/fabric-chart/src/hooks/useCenter.js +6 -2
- package/es/packages/fabric-chart/src/hooks/useLeft.js +4 -2
- 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-render/index.d.ts +24 -3
- package/es/packages/form-render/src/FormRender.js +10 -6
- package/es/packages/form-render/src/FormRender.vue.d.ts +24 -3
- 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/date.d.ts +2 -2
- 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 +5 -1
- 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 +11 -2
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +2 -4
- package/es/packages/form-render/src/hooks/useFormContext.d.ts +3 -3
- package/es/packages/form-render/src/hooks/useFormContext.js +15 -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 +8 -0
- package/es/packages/form-render/src/types/index.d.ts +25 -1
- package/es/packages/form-render/src/utils/index.d.ts +3 -3
- package/es/packages/form-render/src/utils/index.js +1 -4
- package/es/packages/index.css +1 -10
- 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-setter/index.d.ts +25 -4
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +25 -4
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +2 -2
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +1 -1
- package/package.json +9 -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 -171
|
@@ -56,15 +56,6 @@
|
|
|
56
56
|
height: 52px;
|
|
57
57
|
line-height: 52px;
|
|
58
58
|
}
|
|
59
|
-
.c-field-set .set-show .alias-style {
|
|
60
|
-
outline: none;
|
|
61
|
-
border-radius: 4px 4px 4px 4px;
|
|
62
|
-
border: solid 1px #d5d5d5;
|
|
63
|
-
height: 32px;
|
|
64
|
-
text-indent: 16px;
|
|
65
|
-
color: #38454f;
|
|
66
|
-
width: 100%;
|
|
67
|
-
}
|
|
68
59
|
.c-field-set .set-show .is-sort-style {
|
|
69
60
|
outline: none;
|
|
70
61
|
border-radius: 4px 4px 4px 4px;
|
|
@@ -109,6 +109,13 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
109
109
|
uuid: {
|
|
110
110
|
type: StringConstructor;
|
|
111
111
|
};
|
|
112
|
+
lifeCycle: {
|
|
113
|
+
type: import("vue").PropType<Partial<{
|
|
114
|
+
onSetup(): void;
|
|
115
|
+
beforeRequest(params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
116
|
+
afterRequest(payload?: import("../../../es/src/types").AnyObject[] | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject[]>;
|
|
117
|
+
}>>;
|
|
118
|
+
};
|
|
112
119
|
}, {
|
|
113
120
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
114
121
|
fieldList: {
|
|
@@ -217,6 +224,13 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
217
224
|
uuid: {
|
|
218
225
|
type: StringConstructor;
|
|
219
226
|
};
|
|
227
|
+
lifeCycle: {
|
|
228
|
+
type: import("vue").PropType<Partial<{
|
|
229
|
+
onSetup(): void;
|
|
230
|
+
beforeRequest(params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
231
|
+
afterRequest(payload?: import("../../../es/src/types").AnyObject[] | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject[]>;
|
|
232
|
+
}>>;
|
|
233
|
+
};
|
|
220
234
|
}>> & {
|
|
221
235
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
222
236
|
}>>;
|
|
@@ -226,10 +240,11 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
226
240
|
businessCollector: import("./src/hooks").BusinessCollector;
|
|
227
241
|
formItemDepsCollector: import("./src/hooks").FormItemDepsCollector;
|
|
228
242
|
changeContextCollector: import("./src/hooks").ContextCollector;
|
|
229
|
-
formUUID:
|
|
243
|
+
formUUID: string;
|
|
230
244
|
formModel: import("@formily/core").Form<{
|
|
231
245
|
[x: string]: any;
|
|
232
246
|
}>;
|
|
247
|
+
scrollbarRef: import("vue").Ref<HTMLElement | undefined>;
|
|
233
248
|
schemaAdaptor: (fieldList: import("./src/types").FieldItem[]) => Record<string, import("@formily/json-schema").Stringify<{
|
|
234
249
|
[key: symbol]: any;
|
|
235
250
|
[key: `x-${string}`]: any;
|
|
@@ -345,7 +360,6 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
345
360
|
"x-compile-omitted"?: string[] | undefined;
|
|
346
361
|
}>>;
|
|
347
362
|
currentAnchor: import("vue").WritableComputedRef<string>;
|
|
348
|
-
scrollbarRef: import("vue").Ref<HTMLElement | undefined>;
|
|
349
363
|
generateAnchorList: (schema: import("@formily/json-schema").Stringify<{
|
|
350
364
|
[key: symbol]: any;
|
|
351
365
|
[key: `x-${string}`]: any;
|
|
@@ -407,7 +421,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
407
421
|
name: string;
|
|
408
422
|
title: string;
|
|
409
423
|
}[]>;
|
|
410
|
-
formHeight: import("vue").ComputedRef<
|
|
424
|
+
formHeight: import("vue").ComputedRef<string | undefined>;
|
|
411
425
|
onScroll: () => void;
|
|
412
426
|
queryWidget: (key: string, wrapperElement: HTMLElement, fieldList: import("./src/types").FieldItem[]) => Promise<{
|
|
413
427
|
widgetElement: HTMLInputElement | null | undefined;
|
|
@@ -1712,6 +1726,13 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1712
1726
|
uuid: {
|
|
1713
1727
|
type: StringConstructor;
|
|
1714
1728
|
};
|
|
1729
|
+
lifeCycle: {
|
|
1730
|
+
type: import("vue").PropType<Partial<{
|
|
1731
|
+
onSetup(): void;
|
|
1732
|
+
beforeRequest(params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
1733
|
+
afterRequest(payload?: import("../../../es/src/types").AnyObject[] | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject[]>;
|
|
1734
|
+
}>>;
|
|
1735
|
+
};
|
|
1715
1736
|
}>> & {
|
|
1716
1737
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
1717
1738
|
}, {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineComponent, computed, watch, openBlock, createBlock, unref, withCtx, createElementBlock, createVNode, isRef, Fragment, renderList, createCommentVNode, createElementVNode, normalizeStyle, renderSlot, toDisplayString, nextTick } from 'vue';
|
|
1
|
+
import { defineComponent, ref, 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
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 { useFormRenderLifeCycle } from '../../../packages/form-render/src/hooks/useFormRenderLifeCycle';
|
|
7
8
|
import { arrayed, queryDecorator, queryInput, getParentLinebar } from '../../../packages/form-render/src/utils';
|
|
8
9
|
import { useNuiThemeOverrides } from '../../../packages/form-table/src/hooks/useNuiThemeOverrides';
|
|
9
10
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
|
|
@@ -37,7 +38,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
38
|
scope: { type: Object, default: () => ({}) },
|
|
38
39
|
annotation: { type: Object },
|
|
39
40
|
consumer: { type: Boolean, default: false },
|
|
40
|
-
uuid: { type: String }
|
|
41
|
+
uuid: { type: String },
|
|
42
|
+
lifeCycle: { type: Object }
|
|
41
43
|
},
|
|
42
44
|
emits: [
|
|
43
45
|
"formChange"
|
|
@@ -45,6 +47,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
45
47
|
setup(__props, { expose, emit }) {
|
|
46
48
|
const props = __props;
|
|
47
49
|
const { nuiThemeOverrides } = useNuiThemeOverrides();
|
|
50
|
+
useFormRenderLifeCycle(props).callLifeCycle("onSetup");
|
|
48
51
|
const { SchemaField, businessCollector, formItemDepsCollector, changeContextCollector, formUUID } = useFormContext(props);
|
|
49
52
|
const formModel = createForm({
|
|
50
53
|
initialValues: useInitialData().assignInitialData(props.initialData, props.fieldList),
|
|
@@ -63,6 +66,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
63
66
|
});
|
|
64
67
|
}
|
|
65
68
|
});
|
|
69
|
+
const scrollbarRef = ref();
|
|
66
70
|
const { schemaAdaptor } = useFieldListAdaptor(businessCollector, formUUID);
|
|
67
71
|
const parsedSchema = computed(() => {
|
|
68
72
|
if (props.schema) {
|
|
@@ -74,7 +78,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
74
78
|
}
|
|
75
79
|
return { type: "object", properties: {} };
|
|
76
80
|
});
|
|
77
|
-
const { currentAnchor,
|
|
81
|
+
const { currentAnchor, generateAnchorList, anchorIdList, formHeight, onScroll } = useAnchor(props, scrollbarRef, formItemDepsCollector);
|
|
78
82
|
watch(parsedSchema, generateAnchorList, { immediate: true });
|
|
79
83
|
async function queryWidget(key, wrapperElement, fieldList) {
|
|
80
84
|
if (!scrollbarRef.value)
|
|
@@ -98,16 +102,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
98
102
|
return Promise.reject(Array.isArray(err) ? err.reduce(errInfoNormalize, []) : err);
|
|
99
103
|
});
|
|
100
104
|
function errInfoNormalize(result, error) {
|
|
101
|
-
let
|
|
105
|
+
let hasChildMessage = false;
|
|
102
106
|
if (isArray(error.messages)) {
|
|
103
107
|
error.messages.forEach((message) => {
|
|
104
108
|
if (!isObject(message))
|
|
105
109
|
return;
|
|
106
110
|
result.push(...arrayed(message).map(bindInfo));
|
|
107
|
-
|
|
111
|
+
hasChildMessage = true;
|
|
108
112
|
});
|
|
109
113
|
}
|
|
110
|
-
!
|
|
114
|
+
!hasChildMessage && result.push(bindInfo(error));
|
|
111
115
|
return result;
|
|
112
116
|
}
|
|
113
117
|
function bindInfo(info) {
|
|
@@ -109,6 +109,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
109
109
|
uuid: {
|
|
110
110
|
type: StringConstructor;
|
|
111
111
|
};
|
|
112
|
+
lifeCycle: {
|
|
113
|
+
type: PropType<Partial<{
|
|
114
|
+
onSetup(): void;
|
|
115
|
+
beforeRequest(params?: AnyObject | undefined): void | import("../../../../es/src/types").WithUndefined<AnyObject>;
|
|
116
|
+
afterRequest(payload?: AnyObject[] | undefined): void | import("../../../../es/src/types").WithUndefined<AnyObject[]>;
|
|
117
|
+
}>>;
|
|
118
|
+
};
|
|
112
119
|
}, {
|
|
113
120
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
114
121
|
fieldList: {
|
|
@@ -217,6 +224,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
217
224
|
uuid: {
|
|
218
225
|
type: StringConstructor;
|
|
219
226
|
};
|
|
227
|
+
lifeCycle: {
|
|
228
|
+
type: PropType<Partial<{
|
|
229
|
+
onSetup(): void;
|
|
230
|
+
beforeRequest(params?: AnyObject | undefined): void | import("../../../../es/src/types").WithUndefined<AnyObject>;
|
|
231
|
+
afterRequest(payload?: AnyObject[] | undefined): void | import("../../../../es/src/types").WithUndefined<AnyObject[]>;
|
|
232
|
+
}>>;
|
|
233
|
+
};
|
|
220
234
|
}>> & {
|
|
221
235
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
222
236
|
}>>;
|
|
@@ -226,10 +240,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
226
240
|
businessCollector: import("./hooks").BusinessCollector;
|
|
227
241
|
formItemDepsCollector: import("./hooks").FormItemDepsCollector;
|
|
228
242
|
changeContextCollector: import("./hooks").ContextCollector;
|
|
229
|
-
formUUID:
|
|
243
|
+
formUUID: string;
|
|
230
244
|
formModel: import("@formily/core").Form<{
|
|
231
245
|
[x: string]: any;
|
|
232
246
|
}>;
|
|
247
|
+
scrollbarRef: import("vue").Ref<HTMLElement | undefined>;
|
|
233
248
|
schemaAdaptor: (fieldList: FieldItem[]) => Record<string, import("@formily/vue").Stringify<{
|
|
234
249
|
[key: symbol]: any;
|
|
235
250
|
[key: `x-${string}`]: any;
|
|
@@ -345,7 +360,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
345
360
|
"x-compile-omitted"?: string[] | undefined;
|
|
346
361
|
}>>;
|
|
347
362
|
currentAnchor: import("vue").WritableComputedRef<string>;
|
|
348
|
-
scrollbarRef: import("vue").Ref<HTMLElement | undefined>;
|
|
349
363
|
generateAnchorList: (schema: import("@formily/vue").Stringify<{
|
|
350
364
|
[key: symbol]: any;
|
|
351
365
|
[key: `x-${string}`]: any;
|
|
@@ -407,7 +421,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
407
421
|
name: string;
|
|
408
422
|
title: string;
|
|
409
423
|
}[]>;
|
|
410
|
-
formHeight: import("vue").ComputedRef<
|
|
424
|
+
formHeight: import("vue").ComputedRef<string | undefined>;
|
|
411
425
|
onScroll: () => void;
|
|
412
426
|
queryWidget: (key: string, wrapperElement: HTMLElement, fieldList: FieldItem[]) => Promise<{
|
|
413
427
|
widgetElement: HTMLInputElement | null | undefined;
|
|
@@ -1712,6 +1726,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1712
1726
|
uuid: {
|
|
1713
1727
|
type: StringConstructor;
|
|
1714
1728
|
};
|
|
1729
|
+
lifeCycle: {
|
|
1730
|
+
type: PropType<Partial<{
|
|
1731
|
+
onSetup(): void;
|
|
1732
|
+
beforeRequest(params?: AnyObject | undefined): void | import("../../../../es/src/types").WithUndefined<AnyObject>;
|
|
1733
|
+
afterRequest(payload?: AnyObject[] | undefined): void | import("../../../../es/src/types").WithUndefined<AnyObject[]>;
|
|
1734
|
+
}>>;
|
|
1735
|
+
};
|
|
1715
1736
|
}>> & {
|
|
1716
1737
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
1717
1738
|
}, {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isField } from '@formily/core';
|
|
2
|
+
import { flatten } from 'lodash-es';
|
|
3
|
+
import { onMounted } from 'vue';
|
|
4
|
+
import { useFormField } from '../../../../../../../packages/form-render';
|
|
5
|
+
import { arrayed } from '../../../../../../../packages/form-render/src/utils';
|
|
6
|
+
|
|
7
|
+
function useDeepValidate() {
|
|
8
|
+
function bindDeepValidate(formRenderRefs) {
|
|
9
|
+
const { field } = useFormField();
|
|
10
|
+
onMounted(() => {
|
|
11
|
+
if (!isField(field.value))
|
|
12
|
+
return;
|
|
13
|
+
const tempValidator = field.value.validator;
|
|
14
|
+
field.value.validator = [
|
|
15
|
+
{
|
|
16
|
+
async validator() {
|
|
17
|
+
return Promise.allSettled(formRenderRefs.value.map((formRenderRef) => formRenderRef.validate())).then((resultList) => {
|
|
18
|
+
const rejected = resultList.filter((res) => res.status === "rejected");
|
|
19
|
+
if (!rejected.length)
|
|
20
|
+
return "";
|
|
21
|
+
return flatten(rejected.map((res) => res.reason));
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
...tempValidator ? arrayed(tempValidator) : []
|
|
26
|
+
];
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return { bindDeepValidate };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { useDeepValidate };
|
package/es/packages/form-render/src/components/renderer/{combination.d.ts → combination/index.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldItem } from '
|
|
1
|
+
import { FieldItem } from '../../../../../../../es/packages/form-render';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
export declare const COMBINATION: import("vue").DefineComponent<{
|
|
4
4
|
title: {
|
|
@@ -15,6 +15,9 @@ export declare const COMBINATION: import("vue").DefineComponent<{
|
|
|
15
15
|
type: PropType<() => FieldItem[]>;
|
|
16
16
|
default: () => never[];
|
|
17
17
|
};
|
|
18
|
+
onInput: {};
|
|
19
|
+
onBlur: {};
|
|
20
|
+
onChange: {};
|
|
18
21
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
22
|
title: {
|
|
20
23
|
type: StringConstructor;
|
|
@@ -30,6 +33,9 @@ export declare const COMBINATION: import("vue").DefineComponent<{
|
|
|
30
33
|
type: PropType<() => FieldItem[]>;
|
|
31
34
|
default: () => never[];
|
|
32
35
|
};
|
|
36
|
+
onInput: {};
|
|
37
|
+
onBlur: {};
|
|
38
|
+
onChange: {};
|
|
33
39
|
}>> & {
|
|
34
40
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
35
41
|
}, {
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, watch, onMounted, createVNode, createTextVNode } from 'vue';
|
|
2
|
+
import { isField } from '@formily/core';
|
|
3
|
+
import { Path } from '@formily/path';
|
|
4
|
+
import { isNumber, isEqual } from 'lodash-es';
|
|
5
|
+
import { useDeepValidate } from '../../../../../../packages/form-render/src/components/renderer/combination/hooks/useDeepValidate';
|
|
6
|
+
import { assignUpdateValue, mergeDeepProperties, formRenderLog } from '../../../utils/index.js';
|
|
7
|
+
import { connect, mapProps } from '@formily/vue';
|
|
8
|
+
import { useDebounceFn, isObject } from '@vueuse/core';
|
|
9
|
+
import { NButton } from 'naive-ui';
|
|
10
|
+
import FormRender from '../../../FormRender.js';
|
|
11
|
+
|
|
12
|
+
const script = defineComponent({
|
|
13
|
+
name: "FormCombination",
|
|
14
|
+
props: {
|
|
15
|
+
title: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ""
|
|
18
|
+
},
|
|
19
|
+
value: {
|
|
20
|
+
type: String
|
|
21
|
+
},
|
|
22
|
+
maxGroupNum: {
|
|
23
|
+
type: Number
|
|
24
|
+
},
|
|
25
|
+
getProperties: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default: () => []
|
|
28
|
+
},
|
|
29
|
+
onInput: {},
|
|
30
|
+
onBlur: {},
|
|
31
|
+
onChange: {}
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:value"],
|
|
34
|
+
setup(props, {
|
|
35
|
+
emit
|
|
36
|
+
}) {
|
|
37
|
+
const emitChange = useDebounceFn(function emitChange2() {
|
|
38
|
+
emit("update:value", JSON.stringify(combinationData.value));
|
|
39
|
+
}, 300);
|
|
40
|
+
const combinationData = ref([{}]);
|
|
41
|
+
const currentGroupNum = computed(() => combinationData.value.length);
|
|
42
|
+
function setCombinationData(data, withInitialData = false) {
|
|
43
|
+
const parsedData = getParsedData(data);
|
|
44
|
+
if (!needLoad(parsedData))
|
|
45
|
+
return;
|
|
46
|
+
parsedData.splice(maxGroupNum.value);
|
|
47
|
+
parsedData.forEach(setCombinationData2);
|
|
48
|
+
combinationData.value.splice(parsedData.length);
|
|
49
|
+
combinationData.value.forEach(setFormRenderData);
|
|
50
|
+
function needLoad(_data) {
|
|
51
|
+
return !!_data && !isEqual(_data, combinationData.value);
|
|
52
|
+
}
|
|
53
|
+
function setCombinationData2(v, idx) {
|
|
54
|
+
if (!isObject(v))
|
|
55
|
+
return;
|
|
56
|
+
combinationData.value[idx] = v;
|
|
57
|
+
withInitialData && mergeDeepProperties(v, props.getProperties());
|
|
58
|
+
}
|
|
59
|
+
function getParsedData(data2) {
|
|
60
|
+
try {
|
|
61
|
+
if (!data2)
|
|
62
|
+
return null;
|
|
63
|
+
const result = JSON.parse(data2);
|
|
64
|
+
if (!Array.isArray(result))
|
|
65
|
+
return null;
|
|
66
|
+
return result;
|
|
67
|
+
} catch (e) {
|
|
68
|
+
formRenderLog(`invalid JSON value ${data2} in COMBINATION => ${props.title}`, "warn");
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
watch(() => props.value, (value) => setCombinationData(value));
|
|
74
|
+
onMounted(() => {
|
|
75
|
+
setCombinationData(props.value || "[{}]", true);
|
|
76
|
+
emitChange();
|
|
77
|
+
});
|
|
78
|
+
const formRenderRefs = ref([]);
|
|
79
|
+
useDeepValidate().bindDeepValidate(formRenderRefs);
|
|
80
|
+
function setFormRenderData(item, idx) {
|
|
81
|
+
var _a;
|
|
82
|
+
(_a = formRenderRefs.value[idx]) == null ? void 0 : _a.setFieldState("*", (state) => {
|
|
83
|
+
if (!isField(state))
|
|
84
|
+
return;
|
|
85
|
+
state.value = Path.getIn(item, state.path);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function setFormRenderRef(idx, _ref) {
|
|
89
|
+
formRenderRefs.value[idx] = _ref;
|
|
90
|
+
setFormRenderData(combinationData.value[idx] || {}, idx);
|
|
91
|
+
}
|
|
92
|
+
function addGroup() {
|
|
93
|
+
combinationData.value.push(mergeDeepProperties({}, props.getProperties()));
|
|
94
|
+
emitChange();
|
|
95
|
+
}
|
|
96
|
+
function removeGroup(idx) {
|
|
97
|
+
combinationData.value.splice(idx, 1);
|
|
98
|
+
formRenderRefs.value.splice(idx, 1);
|
|
99
|
+
emitChange();
|
|
100
|
+
}
|
|
101
|
+
const maxGroupNum = computed(() => {
|
|
102
|
+
if (!isNumber(props.maxGroupNum))
|
|
103
|
+
return Infinity;
|
|
104
|
+
if (props.maxGroupNum < 1)
|
|
105
|
+
return 0;
|
|
106
|
+
return ~~props.maxGroupNum;
|
|
107
|
+
});
|
|
108
|
+
watch(maxGroupNum, (value) => {
|
|
109
|
+
if (currentGroupNum.value <= value)
|
|
110
|
+
return;
|
|
111
|
+
combinationData.value.splice(value);
|
|
112
|
+
emitChange();
|
|
113
|
+
formRenderRefs.value.splice(value);
|
|
114
|
+
}, {
|
|
115
|
+
immediate: true
|
|
116
|
+
});
|
|
117
|
+
function onChange(idx, {
|
|
118
|
+
fieldKey,
|
|
119
|
+
value
|
|
120
|
+
}) {
|
|
121
|
+
!combinationData.value[idx] && (combinationData.value[idx] = {});
|
|
122
|
+
Path.setIn(combinationData.value[idx], fieldKey, value);
|
|
123
|
+
emitChange();
|
|
124
|
+
}
|
|
125
|
+
const FormRenderComponent = FormRender;
|
|
126
|
+
return () => {
|
|
127
|
+
return createVNode("section", {
|
|
128
|
+
"class": "form-render__combination"
|
|
129
|
+
}, [createVNode("header", {
|
|
130
|
+
"class": "form-render__combinationHeader"
|
|
131
|
+
}, [createVNode("div", {
|
|
132
|
+
"class": "form-render__combinationHeaderText"
|
|
133
|
+
}, [props.title]), createVNode(NButton, {
|
|
134
|
+
"onClick": addGroup,
|
|
135
|
+
"type": "info",
|
|
136
|
+
"text": true,
|
|
137
|
+
"disabled": currentGroupNum.value >= maxGroupNum.value
|
|
138
|
+
}, {
|
|
139
|
+
default: () => [createTextVNode("\u65B0\u589E")]
|
|
140
|
+
})]), Array.from({
|
|
141
|
+
length: currentGroupNum.value
|
|
142
|
+
}).map((_, idx) => createVNode("section", {
|
|
143
|
+
"class": "form-render__combinationContent"
|
|
144
|
+
}, [createVNode(FormRenderComponent, {
|
|
145
|
+
"ref": (_ref) => setFormRenderRef(idx, _ref),
|
|
146
|
+
"fieldList": props.getProperties(),
|
|
147
|
+
"onFormChange": (payload) => onChange(idx, payload)
|
|
148
|
+
}, null), idx === 0 ? null : createVNode("i", {
|
|
149
|
+
"class": "form-render__combinationClose",
|
|
150
|
+
"onClick": () => removeGroup(idx)
|
|
151
|
+
}, ["-"])]))]);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const COMBINATION = connect(script, mapProps(assignUpdateValue));
|
|
156
|
+
|
|
157
|
+
export { COMBINATION };
|
|
@@ -5,7 +5,7 @@ export declare const DATE: import("vue").DefineComponent<{
|
|
|
5
5
|
validate: {
|
|
6
6
|
type: PropType<Partial<{
|
|
7
7
|
[key: string]: any;
|
|
8
|
-
obj_type: "password" | "sex" | "age" | "email" | "
|
|
8
|
+
obj_type: "password" | "sex" | "age" | "email" | "id_card" | "age_unit" | "mobile" | "telephone" | "birthday" | "bank_card" | "website" | "gestational_weeks" | "gestational_stage" | "customer_name";
|
|
9
9
|
vali_obj: string;
|
|
10
10
|
max_value: string | number;
|
|
11
11
|
min_value: string | number;
|
|
@@ -22,7 +22,7 @@ export declare const DATE: import("vue").DefineComponent<{
|
|
|
22
22
|
validate: {
|
|
23
23
|
type: PropType<Partial<{
|
|
24
24
|
[key: string]: any;
|
|
25
|
-
obj_type: "password" | "sex" | "age" | "email" | "
|
|
25
|
+
obj_type: "password" | "sex" | "age" | "email" | "id_card" | "age_unit" | "mobile" | "telephone" | "birthday" | "bank_card" | "website" | "gestational_weeks" | "gestational_stage" | "customer_name";
|
|
26
26
|
vali_obj: string;
|
|
27
27
|
max_value: string | number;
|
|
28
28
|
min_value: string | number;
|
|
@@ -7,7 +7,7 @@ export { LINEBAR } from './linebar.js';
|
|
|
7
7
|
export { INPUT_GROUP } from './inputGroup.js';
|
|
8
8
|
export { DATE } from './date.js';
|
|
9
9
|
export { SEARCH_CASCADE } from './cascader.js';
|
|
10
|
-
export { COMBINATION } from './combination.js';
|
|
10
|
+
export { COMBINATION } from './combination/index.js';
|
|
11
11
|
export { CHECKBOX } from './checkbox.js';
|
|
12
12
|
export { SWITCH } from './switch.js';
|
|
13
13
|
export { RADIO } from './radio.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, createVNode } from 'vue';
|
|
2
2
|
import { connect, mapProps } from '@formily/vue';
|
|
3
|
+
import { isNumber } from 'lodash-es';
|
|
3
4
|
import { NRadioGroup, NSpace, NRadio } from 'naive-ui';
|
|
4
5
|
import { assignUpdateValue } from '../../utils/index.js';
|
|
5
6
|
|
|
@@ -23,7 +24,9 @@ const script = defineComponent({
|
|
|
23
24
|
emit
|
|
24
25
|
}) {
|
|
25
26
|
function dangerousTypeTransform(value) {
|
|
26
|
-
|
|
27
|
+
if (isNumber(value))
|
|
28
|
+
return value + "";
|
|
29
|
+
return value;
|
|
27
30
|
}
|
|
28
31
|
const valueRef = computed({
|
|
29
32
|
get() {
|
|
@@ -13,6 +13,10 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
13
13
|
value: {
|
|
14
14
|
type: StringConstructor;
|
|
15
15
|
};
|
|
16
|
+
lazyRequest: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
16
20
|
options: {
|
|
17
21
|
type: PropType<AnyObject[]>;
|
|
18
22
|
default: () => never[];
|
|
@@ -28,6 +32,10 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
28
32
|
value: {
|
|
29
33
|
type: StringConstructor;
|
|
30
34
|
};
|
|
35
|
+
lazyRequest: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
31
39
|
options: {
|
|
32
40
|
type: PropType<AnyObject[]>;
|
|
33
41
|
default: () => never[];
|
|
@@ -43,5 +51,6 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
43
51
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
44
52
|
}, {
|
|
45
53
|
options: AnyObject[];
|
|
54
|
+
lazyRequest: boolean;
|
|
46
55
|
}>;
|
|
47
56
|
export {};
|
|
@@ -14,6 +14,10 @@ const script = defineComponent({
|
|
|
14
14
|
value: {
|
|
15
15
|
type: String
|
|
16
16
|
},
|
|
17
|
+
lazyRequest: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
17
21
|
options: {
|
|
18
22
|
type: Array,
|
|
19
23
|
default: () => []
|
|
@@ -103,7 +107,7 @@ const script = defineComponent({
|
|
|
103
107
|
remoteOptions.value = null;
|
|
104
108
|
emit("update:value", null);
|
|
105
109
|
});
|
|
106
|
-
props.value && fetchData();
|
|
110
|
+
(props.value || !props.lazyRequest) && fetchData();
|
|
107
111
|
}, {
|
|
108
112
|
immediate: true
|
|
109
113
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WithNull } from '../../../../../es/src/types';
|
|
1
2
|
import { ContextCollector } from '../../../../../es/packages/form-render/src/hooks/useChangeContext';
|
|
2
3
|
import { BusinessCollector, FormItemDepsCollector } from '../hooks';
|
|
3
4
|
import { FormAsyncQueue } from '../types';
|
|
@@ -8,7 +9,7 @@ export declare const InjectionBusinessCollector: InjectionKey<BusinessCollector>
|
|
|
8
9
|
export declare const InjectionChangeContextCollector: InjectionKey<ContextCollector>;
|
|
9
10
|
export declare const InjectionFormItemDepsCollector: InjectionKey<FormItemDepsCollector>;
|
|
10
11
|
export declare const InjectionFormUUID: InjectionKey<string>;
|
|
11
|
-
export declare const InjectionAnnotation: InjectionKey<WritableComputedRef<Record<string, string
|
|
12
|
+
export declare const InjectionAnnotation: InjectionKey<WritableComputedRef<WithNull<Record<string, string>>>>;
|
|
12
13
|
export declare const FormItemLineBarDepKeyPrepend = "__dep_LINEBAR_";
|
|
13
14
|
export declare enum FIELD_BUSINESS_TYPE {
|
|
14
15
|
PASSWORD = "password",
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WithUndefined } from '../../../../../es/src/types';
|
|
2
2
|
import { ISchema } from '@formily/json-schema/esm/types';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { Ref } from 'vue';
|
|
4
|
+
import { FormItemDepsCollector, FormRenderProps } from '../../../../../es/packages/form-render';
|
|
5
|
+
export declare function useAnchor(props: Readonly<FormRenderProps>, scrollbarRef: Ref<WithUndefined<HTMLElement>>, collector: FormItemDepsCollector): {
|
|
5
6
|
currentAnchor: import("vue").WritableComputedRef<string>;
|
|
6
7
|
onScroll: () => void;
|
|
7
|
-
formHeight: import("vue").ComputedRef<
|
|
8
|
-
anchorIdList:
|
|
8
|
+
formHeight: import("vue").ComputedRef<string | undefined>;
|
|
9
|
+
anchorIdList: Ref<{
|
|
9
10
|
name: string;
|
|
10
11
|
title: string;
|
|
11
12
|
}[]>;
|
|
12
13
|
generateAnchorList: (schema: ISchema) => void;
|
|
13
|
-
scrollbarRef:
|
|
14
|
+
scrollbarRef: Ref<WithUndefined<HTMLElement>>;
|
|
14
15
|
scrollTo: (id: string) => Promise<void>;
|
|
15
16
|
};
|
|
@@ -5,7 +5,7 @@ import { ref, computed, watch, nextTick } from 'vue';
|
|
|
5
5
|
import { FormItemLineBarDepKeyPrepend } from '../../../../packages/form-render/src/constants';
|
|
6
6
|
import { createLinebarId, traverseSchema } from '../../../../packages/form-render/src/utils';
|
|
7
7
|
|
|
8
|
-
function useAnchor(props, collector) {
|
|
8
|
+
function useAnchor(props, scrollbarRef, collector) {
|
|
9
9
|
const __currentAnchor = ref("");
|
|
10
10
|
const formHeight = computed(() => {
|
|
11
11
|
if (isNumber(props.maxHeight))
|
|
@@ -22,7 +22,6 @@ function useAnchor(props, collector) {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
const scrollbarRef = ref();
|
|
26
25
|
let scrollLock = false;
|
|
27
26
|
async function scrollTo(id) {
|
|
28
27
|
scrollLock = true;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { AnyObject, WithUndefined } from '../../../../../es/src/types';
|
|
1
2
|
import { FormAsyncQueueItem } from '../types';
|
|
3
|
+
declare type ProcessorOption = Partial<{
|
|
4
|
+
afterRequest(payload?: AnyObject[]): WithUndefined<AnyObject[]> | void;
|
|
5
|
+
beforeRequest(params?: AnyObject): WithUndefined<AnyObject> | void;
|
|
6
|
+
}>;
|
|
2
7
|
interface EntryCallback {
|
|
3
8
|
(err?: any, result?: any): void;
|
|
4
9
|
}
|
|
@@ -32,7 +37,7 @@ export declare class AsyncQueue<T = any, K = any, R = any> {
|
|
|
32
37
|
private _handlerResult;
|
|
33
38
|
}
|
|
34
39
|
export declare function useAsyncQueue(): {
|
|
35
|
-
create: (parallelism?: number) => AsyncQueue<FormAsyncQueueItem, any, {
|
|
40
|
+
create: (parallelism?: number, option?: ProcessorOption) => AsyncQueue<FormAsyncQueueItem, any, {
|
|
36
41
|
label: string;
|
|
37
42
|
value: unknown;
|
|
38
43
|
}[]>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isFunction } from 'lodash-es';
|
|
1
2
|
import { useFormRequest, useCommonLog } from '../../../../packages/form-render';
|
|
2
3
|
|
|
3
4
|
class AsyncQueueEntry {
|
|
@@ -103,11 +104,12 @@ class AsyncQueue {
|
|
|
103
104
|
}
|
|
104
105
|
function useAsyncQueue() {
|
|
105
106
|
const { getHttpInstance } = useFormRequest();
|
|
106
|
-
function create(parallelism = 3) {
|
|
107
|
+
function create(parallelism = 3, option) {
|
|
107
108
|
return new AsyncQueue({
|
|
108
109
|
name: "FormRenderAsyncQueue",
|
|
109
110
|
parallelism,
|
|
110
111
|
async processor({ method = "post", params, url }, cb, removeCache) {
|
|
112
|
+
var _a, _b;
|
|
111
113
|
const http = getHttpInstance();
|
|
112
114
|
if (!http) {
|
|
113
115
|
useCommonLog().invalidHttpInstanceLog();
|
|
@@ -116,11 +118,18 @@ function useAsyncQueue() {
|
|
|
116
118
|
return;
|
|
117
119
|
}
|
|
118
120
|
try {
|
|
121
|
+
if (option && isFunction(option.beforeRequest)) {
|
|
122
|
+
params = (_a = option.beforeRequest(params)) != null ? _a : {};
|
|
123
|
+
}
|
|
119
124
|
const res = await http[method](url, params);
|
|
120
125
|
const { data, success } = res;
|
|
121
126
|
if (!success)
|
|
122
127
|
throw res;
|
|
123
|
-
|
|
128
|
+
let payload = Array.isArray(data) ? data : [];
|
|
129
|
+
if (option && isFunction(option.afterRequest)) {
|
|
130
|
+
payload = (_b = option.afterRequest(payload)) != null ? _b : [];
|
|
131
|
+
}
|
|
132
|
+
cb(void 0, payload);
|
|
124
133
|
} catch (e) {
|
|
125
134
|
cb(new Error(`Request error => ${e}`));
|
|
126
135
|
removeCache();
|