@dazhicheng/ui 1.5.198 → 1.5.201
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/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/api/dataTypeContext.js +17 -0
- package/dist/assets/img/empty_images/no_data.png.js +4 -0
- package/dist/assets/img/empty_images/search.png.js +4 -0
- package/dist/assets/img/image_status/develop.png.js +4 -0
- package/dist/assets/img/image_status/loading.gif.js +4 -0
- package/dist/assets/img/image_status/loading_fail.png.js +4 -0
- package/dist/assets/img/image_status/no_network.png.js +4 -0
- package/dist/assets/img/image_status/no_permission.png.js +4 -0
- package/dist/assets/svg/action_more.svg.js +4 -0
- package/dist/assets/svg/close.svg.js +4 -0
- package/dist/assets/svg/item_error.svg.js +4 -0
- package/dist/assets/svg/paixu-jiangxu.svg.js +4 -0
- package/dist/assets/svg/paixu-moren.svg.js +4 -0
- package/dist/assets/svg/paixu-shengxu.svg.js +4 -0
- package/dist/assets/svg/quanping.svg.js +4 -0
- package/dist/assets/svg/suoxiao.svg.js +4 -0
- package/dist/components/tt-api-component/index.js +7 -0
- package/dist/components/tt-api-component/index.vue.js +7 -0
- package/dist/components/tt-api-component/index.vue2.js +199 -0
- package/dist/components/tt-area/TtArea.vue.js +7 -0
- package/dist/components/tt-area/TtArea.vue2.js +36 -0
- package/dist/components/tt-button/components/AddButton.vue.js +24 -0
- package/dist/components/tt-button/components/AddButton.vue2.js +4 -0
- package/dist/components/tt-button/index.js +9 -0
- package/dist/components/tt-button/index.vue.js +7 -0
- package/dist/components/tt-button/index.vue2.js +68 -0
- package/dist/components/tt-checkbox/index.js +7 -0
- package/dist/components/tt-checkbox/index.vue.js +77 -0
- package/dist/components/tt-checkbox/index.vue2.js +4 -0
- package/dist/components/tt-drawer/index.js +14 -0
- package/dist/components/tt-drawer/src/RenderDrawer.vue.js +156 -0
- package/dist/components/tt-drawer/src/RenderDrawer.vue3.js +5 -0
- package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +56 -0
- package/dist/components/tt-drawer/src/components/DrawerFooter.vue3.js +5 -0
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +7 -0
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +21 -0
- package/dist/components/tt-drawer/src/hooks/useDrawerRender.js +124 -0
- package/dist/components/tt-drawer/src/hooks/useResizable.js +98 -0
- package/dist/components/tt-drawer/src/index.js +17 -0
- package/dist/components/tt-drawer/src/props.js +72 -0
- package/dist/components/tt-drawer/src/utils/drawer-api.js +191 -0
- package/dist/components/tt-empty/index.js +34 -0
- package/dist/components/tt-form/index.js +65 -0
- package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +38 -0
- package/dist/components/tt-form/src/components/ExpandableArrow.vue3.js +5 -0
- package/dist/components/tt-form/src/components/FormActions.vue2.js +177 -0
- package/dist/components/tt-form/src/components/FormActions.vue3.js +5 -0
- package/dist/components/tt-form/src/components/FormElInput.vue.js +80 -0
- package/dist/components/tt-form/src/components/FormElInput.vue2.js +4 -0
- package/dist/components/tt-form/src/components/Slot.js +28 -0
- package/dist/components/tt-form/src/config.js +57 -0
- package/dist/components/tt-form/src/form/FormControl.vue.js +16 -0
- package/dist/components/tt-form/src/form/FormControl.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormDescription.vue.js +21 -0
- package/dist/components/tt-form/src/form/FormDescription.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormItem.vue.js +20 -0
- package/dist/components/tt-form/src/form/FormItem.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormLabel.vue.js +19 -0
- package/dist/components/tt-form/src/form/FormLabel.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormMessage.vue.js +18 -0
- package/dist/components/tt-form/src/form/FormMessage.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormMessageToolTip.vue.js +30 -0
- package/dist/components/tt-form/src/form/FormMessageToolTip.vue2.js +4 -0
- package/dist/components/tt-form/src/form/RenderContent.vue.js +31 -0
- package/dist/components/tt-form/src/form/RenderContent.vue2.js +4 -0
- package/dist/components/tt-form/src/form/injectionKeys.js +4 -0
- package/dist/components/tt-form/src/form/useFormField.js +24 -0
- package/dist/components/tt-form/src/form-render/FormField.vue.js +4 -0
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +346 -0
- package/dist/components/tt-form/src/form-render/FormFieldContact.js +54 -0
- package/dist/components/tt-form/src/form-render/FormLabel.vue.js +4 -0
- package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +102 -0
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +195 -0
- package/dist/components/tt-form/src/form-render/array-register/props.js +47 -0
- package/dist/components/tt-form/src/form-render/array-register/utils.js +12 -0
- package/dist/components/tt-form/src/form-render/context.js +15 -0
- package/dist/components/tt-form/src/form-render/dependencies.js +51 -0
- package/dist/components/tt-form/src/form-render/expandable.js +46 -0
- package/dist/components/tt-form/src/form-render/form.vue2.js +197 -0
- package/dist/components/tt-form/src/form-render/form.vue3.js +5 -0
- package/dist/components/tt-form/src/form-render/helper.js +22 -0
- package/dist/components/tt-form/src/form-render/rootWrapperClass.js +10 -0
- package/dist/components/tt-form/src/formApi.js +790 -0
- package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +223 -0
- package/dist/components/tt-form/src/group-form/GroupForm.vue3.js +5 -0
- package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +278 -0
- package/dist/components/tt-form/src/group-form/GroupSection.vue3.js +5 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +153 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue3.js +5 -0
- package/dist/components/tt-form/src/group-form/groupFormApi.js +700 -0
- package/dist/components/tt-form/src/group-form/lazyContext.js +38 -0
- package/dist/components/tt-form/src/group-form/useGroupForm.js +83 -0
- package/dist/components/tt-form/src/group-form/utils.js +106 -0
- package/dist/components/tt-form/src/hooks/useArrayRegistry.js +22 -0
- package/dist/components/tt-form/src/hooks/useFieldArray.js +137 -0
- package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +33 -0
- package/dist/components/tt-form/src/hooks/useSelectCollapse.js +81 -0
- package/dist/components/tt-form/src/index.vue2.js +149 -0
- package/dist/components/tt-form/src/index.vue3.js +5 -0
- package/dist/components/tt-form/src/shared/createContext.js +14 -0
- package/dist/components/tt-form/src/shared/global-state.js +22 -0
- package/dist/components/tt-form/src/shared/zod-defaults.js +47 -0
- package/dist/components/tt-form/src/types/forms.js +6 -0
- package/dist/components/tt-form/src/useForm.js +28 -0
- package/dist/components/tt-form/src/useFormContext.js +320 -0
- package/dist/components/tt-form/src/utils/array-path.js +18 -0
- package/dist/components/tt-form-item-error-tooltip/index.js +9 -0
- package/dist/components/tt-form-item-error-tooltip/index.vue.js +183 -0
- package/dist/components/tt-form-item-error-tooltip/index.vue3.js +5 -0
- package/dist/components/tt-icon/components/AddIcon.vue.js +28 -0
- package/dist/components/tt-icon/components/AddIcon.vue2.js +4 -0
- package/dist/components/tt-icon/components/SubIcon.vue.js +28 -0
- package/dist/components/tt-icon/components/SubIcon.vue2.js +4 -0
- package/dist/components/tt-icon/index.js +11 -0
- package/dist/components/tt-icon/index.vue.js +8 -0
- package/dist/components/tt-icon/index.vue2.js +115 -0
- package/dist/components/tt-image/index.js +9 -0
- package/dist/components/tt-image/src/components/ImageViewer.js +41 -0
- package/dist/components/tt-image/tt-image.js +55 -0
- package/dist/components/tt-loading/index.js +8 -0
- package/dist/components/tt-loading/src/directive.js +51 -0
- package/dist/components/tt-loading/src/loading.vue.js +7 -0
- package/dist/components/tt-loading/src/loading.vue2.js +75 -0
- package/dist/components/tt-loading/src/service.js +79 -0
- package/dist/components/tt-log/index.js +7 -0
- package/dist/components/tt-log/index.vue.js +30 -0
- package/dist/components/tt-log/index.vue2.js +4 -0
- package/dist/components/tt-modal/index.js +14 -0
- package/dist/components/tt-modal/src/RenderModal.vue.js +310 -0
- package/dist/components/tt-modal/src/RenderModal.vue3.js +5 -0
- package/dist/components/tt-modal/src/components/ModalFooter.vue.js +7 -0
- package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +74 -0
- package/dist/components/tt-modal/src/components/ModalHeader.vue.js +7 -0
- package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +22 -0
- package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +48 -0
- package/dist/components/tt-modal/src/components/ModalWrapper.vue2.js +4 -0
- package/dist/components/tt-modal/src/hooks/useModalRender.js +131 -0
- package/dist/components/tt-modal/src/index.js +17 -0
- package/dist/components/tt-modal/src/props.js +75 -0
- package/dist/components/tt-modal/src/utils/modal-api.js +200 -0
- package/dist/components/tt-modal/src/utils/modal-stack.js +28 -0
- package/dist/components/tt-modal-form/hooks/useModalFormSlot.js +22 -0
- package/dist/components/tt-modal-form/index.vue.js +178 -0
- package/dist/components/tt-modal-form/index.vue2.js +4 -0
- package/dist/components/tt-modal-form/useModalForm.js +30 -0
- package/dist/components/tt-nav-anchor/index.js +8 -0
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +234 -0
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue3.js +5 -0
- package/dist/components/tt-nav-anchor/src/constants.js +4 -0
- package/dist/components/tt-panel-select/index.js +7 -0
- package/dist/components/tt-panel-select/src/common.js +4 -0
- package/dist/components/tt-panel-select/src/components/PanelLeft.vue.js +56 -0
- package/dist/components/tt-panel-select/src/components/PanelLeft.vue2.js +4 -0
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.js +277 -0
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue2.js +4 -0
- package/dist/components/tt-panel-select/src/components/PanelRight.vue.js +108 -0
- package/dist/components/tt-panel-select/src/components/PanelRight.vue2.js +4 -0
- package/dist/components/tt-panel-select/src/hooks/usePanelData.js +184 -0
- package/dist/components/tt-panel-select/src/hooks/usePanelSelection.js +91 -0
- package/dist/components/tt-panel-select/src/index.vue.js +386 -0
- package/dist/components/tt-panel-select/src/index.vue2.js +4 -0
- package/dist/components/tt-select/index.js +8 -0
- package/dist/components/tt-select/src/Select.vue.js +315 -0
- package/dist/components/tt-select/src/Select.vue3.js +5 -0
- package/dist/components/tt-select/src/components/SelectTable.vue.js +86 -0
- package/dist/components/tt-select/src/components/SelectTable.vue3.js +5 -0
- package/dist/components/tt-select/src/components/Table.vue.js +307 -0
- package/dist/components/tt-select/src/components/Table.vue3.js +5 -0
- package/dist/components/tt-select/src/const.js +19 -0
- package/dist/components/tt-select/src/hooks/useDataSource.js +196 -0
- package/dist/components/tt-select/src/hooks/useGrid.js +97 -0
- package/dist/components/tt-select/src/hooks/useKeyboard.js +63 -0
- package/dist/components/tt-select/src/hooks/usePagination.js +45 -0
- package/dist/components/tt-select/src/hooks/useSelect.js +100 -0
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +345 -0
- package/dist/components/tt-select/src/props.js +201 -0
- package/dist/components/tt-select/src/utils/index.js +16 -0
- package/dist/components/tt-table/index.js +33 -0
- package/dist/components/tt-table/src/Table.vue.js +623 -0
- package/dist/components/tt-table/src/Table.vue3.js +5 -0
- package/dist/components/tt-table/src/TableForm.vue.js +317 -0
- package/dist/components/tt-table/src/TableForm.vue2.js +4 -0
- package/dist/components/tt-table/src/componentMap.js +4 -0
- package/dist/components/tt-table/src/components/RowContext.js +24 -0
- package/dist/components/tt-table/src/components/TableAction.vue.js +222 -0
- package/dist/components/tt-table/src/components/TableAction.vue2.js +4 -0
- package/dist/components/tt-table/src/components/TableButtons.js +117 -0
- package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +233 -0
- package/dist/components/tt-table/src/components/TableColumnModal.vue3.js +5 -0
- package/dist/components/tt-table/src/components/TableToobalTools.vue.js +87 -0
- package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +4 -0
- package/dist/components/tt-table/src/emits.js +15 -0
- package/dist/components/tt-table/src/hooks/useCellArea.js +15 -0
- package/dist/components/tt-table/src/hooks/useColumns.js +275 -0
- package/dist/components/tt-table/src/hooks/useCustomColumns.js +53 -0
- package/dist/components/tt-table/src/hooks/useDataSource.js +224 -0
- package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +64 -0
- package/dist/components/tt-table/src/hooks/usePagination.js +44 -0
- package/dist/components/tt-table/src/hooks/useRowSelection.js +84 -0
- package/dist/components/tt-table/src/hooks/useTableContext.js +20 -0
- package/dist/components/tt-table/src/hooks/useTableEvent.js +197 -0
- package/dist/components/tt-table/src/hooks/useTableForm.js +60 -0
- package/dist/components/tt-table/src/hooks/useTableRender.js +33 -0
- package/dist/components/tt-table/src/hooks/useTableSlot.js +17 -0
- package/dist/components/tt-table/src/props.js +482 -0
- package/dist/components/tt-table/src/toolProps.js +30 -0
- package/dist/components/tt-table/src/utils/context.js +17 -0
- package/dist/components/tt-table/src/utils/table-api.js +386 -0
- package/dist/components/tt-table/src/utils/table-form-api.js +122 -0
- package/dist/components/tt-text/index.js +7 -0
- package/dist/components/tt-text/index.vue.js +7 -0
- package/dist/components/tt-text/index.vue2.js +73 -0
- package/dist/components/tt-upload/index.js +9 -0
- package/dist/components/tt-upload/src/TtUpload.vue.js +305 -0
- package/dist/components/tt-upload/src/TtUpload.vue2.js +4 -0
- package/dist/components/tt-upload/src/typing.js +107 -0
- package/dist/directives/auto-tip/index.js +62 -0
- package/dist/directives/dialog-resize/index.js +49 -0
- package/dist/directives/dialog-resize/use-css-variable.js +44 -0
- package/dist/directives/dialog-resize/use-draggable.js +35 -0
- package/dist/directives/dialog-resize/use-fullscreen.js +38 -0
- package/dist/directives/dialog-resize/use-parse-translate.js +9 -0
- package/dist/directives/dialog-resize/use-resizer.js +37 -0
- package/dist/directives/disabled-tip/index.js +78 -0
- package/dist/directives/index.js +8 -0
- package/dist/hooks/useDataPermissionOptions.js +142 -0
- package/dist/hooks/useFormSchemasLink.js +261 -0
- package/dist/hooks/useFormat.js +44 -0
- package/dist/hooks/useLoading.js +22 -0
- package/dist/hooks/useScreenshotOss.js +69 -0
- package/dist/hooks/useSetup.js +59 -0
- package/dist/index.js +142 -60274
- package/dist/plugins/default/renderCellContent.js +58 -0
- package/dist/plugins/vxeTable/switchStatus.js +91 -0
- package/dist/plugins.js +4 -146
- package/dist/style.css +1 -1
- package/dist/utils/xhr.js +8 -0
- package/package.json +5 -3
- package/dist/index-NG5FNCLD.js +0 -3430
- package/dist/index.modern-4Cf3dcJP.js +0 -3069
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { defineComponent as te, useSlots as re, provide as C, computed as s, useTemplateRef as ne, ref as le, createElementBlock as k, openBlock as T, Fragment as L, createBlock as V, createCommentVNode as ae, createElementVNode as K, mergeProps as A, unref as y, withModifiers as se, normalizeClass as ie, normalizeStyle as ce, renderList as D, createSlots as ue, withCtx as me, renderSlot as pe, h as fe, nextTick as ve } from "vue";
|
|
2
|
+
import de from "@dazhicheng-ui/components/tt-nav-anchor";
|
|
3
|
+
import { useDesign as ge } from "@dazhicheng/hooks";
|
|
4
|
+
import { isFunction as he } from "@dazhicheng/utils";
|
|
5
|
+
import { DEFAULT_FORM_COMMON_CONFIG as Ce, COMPONENT_BIND_EVENT_MAP as Te, COMPONENT_MAP as ye } from "../config.js";
|
|
6
|
+
import { provideFormRenderProps as Ee } from "../form-render/context.js";
|
|
7
|
+
import { useForwardPriorityValues as _e } from "../hooks/useForwardPriorityValues.js";
|
|
8
|
+
import { useFormInitial as we, provideFormProps as Re, provideComponentRefMap as Se } from "../useFormContext.js";
|
|
9
|
+
import Ae from "./GroupSection.vue2.js";
|
|
10
|
+
/* empty css */
|
|
11
|
+
import { VIRTUAL_ERROR_CACHE_KEY as Fe, RENDER_SCHEDULER_KEY as Be, createRenderScheduler as Me, GROUP_VISIBILITY_CALLBACK_KEY as be, HIDDEN_GROUP_KEYS_KEY as Oe } from "./lazyContext.js";
|
|
12
|
+
import { getSchemaKey as He, isGroupSchema as Ne } from "./utils.js";
|
|
13
|
+
import { getFormRootWrapperClass as Ie } from "../form-render/rootWrapperClass.js";
|
|
14
|
+
const Pe = 5, Ge = 500, Je = /* @__PURE__ */ te({
|
|
15
|
+
name: "TtVirtualGroupForm",
|
|
16
|
+
inheritAttrs: !1,
|
|
17
|
+
__name: "GroupForm",
|
|
18
|
+
props: {
|
|
19
|
+
virtual: { type: Boolean },
|
|
20
|
+
scrollToFirstError: { type: Boolean },
|
|
21
|
+
containerHeight: {},
|
|
22
|
+
rootMargin: {},
|
|
23
|
+
estimateFieldHeight: {},
|
|
24
|
+
wrapperClass: {},
|
|
25
|
+
layout: {},
|
|
26
|
+
compact: { type: Boolean },
|
|
27
|
+
commonConfig: { default: () => ({}) },
|
|
28
|
+
actionWrapperClass: {},
|
|
29
|
+
showCollapseButton: { type: Boolean },
|
|
30
|
+
collapsed: { type: Boolean },
|
|
31
|
+
collapsedRows: {},
|
|
32
|
+
collapseTriggerResize: { type: Boolean },
|
|
33
|
+
submitOnChange: { type: Boolean },
|
|
34
|
+
submitOnEnter: { type: Boolean },
|
|
35
|
+
fieldMappingTime: {},
|
|
36
|
+
arrayToStringFields: {},
|
|
37
|
+
formApi: {},
|
|
38
|
+
navAnchorProps: {}
|
|
39
|
+
},
|
|
40
|
+
setup(Y, { expose: x }) {
|
|
41
|
+
var G;
|
|
42
|
+
const { prefixCls: F } = ge("group-form"), v = Y, d = re(), i = v.formApi;
|
|
43
|
+
C(Fe, i.errorCacheMap);
|
|
44
|
+
const g = Me();
|
|
45
|
+
C(Be, g), C(be, (e) => {
|
|
46
|
+
e.type === "group" ? i.setGroupVisible(e.key, e.visible) : i.setFieldsVisible(e.fieldNames, e.visible);
|
|
47
|
+
}), C(Oe, i.hiddenGroupKeys);
|
|
48
|
+
const { collapseStates: B } = i, p = v.formApi.useStore(), r = _e(v, p), M = /* @__PURE__ */ new Map(), U = s(
|
|
49
|
+
() => ({
|
|
50
|
+
...r.value,
|
|
51
|
+
schema: p.value.schema
|
|
52
|
+
})
|
|
53
|
+
), { form: u } = we(U);
|
|
54
|
+
Re([r, u]);
|
|
55
|
+
const b = s(() => p.value.groupSchema ?? []), $ = s(() => ({
|
|
56
|
+
collapseStates: B,
|
|
57
|
+
commonConfig: r.value.commonConfig,
|
|
58
|
+
globalCommonConfig: Ce,
|
|
59
|
+
layout: r.value.layout,
|
|
60
|
+
compact: r.value.compact,
|
|
61
|
+
virtual: r.value.virtual,
|
|
62
|
+
scrollElement: E.value,
|
|
63
|
+
rootMargin: r.value.rootMargin,
|
|
64
|
+
estimateFieldHeight: r.value.estimateFieldHeight
|
|
65
|
+
}));
|
|
66
|
+
Ee({
|
|
67
|
+
schema: p.value.schema,
|
|
68
|
+
commonConfig: r.value.commonConfig,
|
|
69
|
+
componentMap: ye,
|
|
70
|
+
componentBindEventMap: Te,
|
|
71
|
+
form: u,
|
|
72
|
+
layout: r.value.layout,
|
|
73
|
+
compact: r.value.compact,
|
|
74
|
+
wrapperClass: r.value.wrapperClass
|
|
75
|
+
}), Se(M), v.formApi.mount(u, M);
|
|
76
|
+
const E = ne("scrollRef"), _ = s(() => {
|
|
77
|
+
const e = r.value.containerHeight;
|
|
78
|
+
return e !== "100%" && e !== void 0;
|
|
79
|
+
}), z = s(() => {
|
|
80
|
+
const e = r.value.containerHeight, o = typeof e == "number" ? `${e}px` : e;
|
|
81
|
+
return {
|
|
82
|
+
height: _.value ? void 0 : "100%",
|
|
83
|
+
maxHeight: _.value ? o : void 0,
|
|
84
|
+
overflow: _.value ? "auto" : void 0
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
function q(e) {
|
|
88
|
+
i.toggleCollapse(e);
|
|
89
|
+
}
|
|
90
|
+
function W(e) {
|
|
91
|
+
const o = [];
|
|
92
|
+
for (const t of e)
|
|
93
|
+
if (Ne(t)) {
|
|
94
|
+
const n = t.title, l = he(n) ? () => n(u.values, u) : n;
|
|
95
|
+
o.push({ key: t.key, title: l });
|
|
96
|
+
}
|
|
97
|
+
return o;
|
|
98
|
+
}
|
|
99
|
+
const j = s(
|
|
100
|
+
() => Ie({
|
|
101
|
+
layout: r.value.layout,
|
|
102
|
+
compact: r.value.compact,
|
|
103
|
+
wrapperClass: r.value.wrapperClass
|
|
104
|
+
})
|
|
105
|
+
), O = s(() => ({
|
|
106
|
+
...r.value.navAnchorProps ?? {},
|
|
107
|
+
badgeCounts: i.navErrorCounts
|
|
108
|
+
})), H = s(() => O.value.show ?? !1), w = s(() => H.value ? W(b.value).filter((e) => !i.hiddenGroupKeys.has(e.key)) : []), J = s(() => {
|
|
109
|
+
const { show: e, ...o } = O.value;
|
|
110
|
+
return { ...o, items: w.value };
|
|
111
|
+
}), R = le(((G = w.value[0]) == null ? void 0 : G.key) || "");
|
|
112
|
+
function Q(e) {
|
|
113
|
+
var o;
|
|
114
|
+
return ((o = d[`nav-description-${e.row.key}`]) == null ? void 0 : o.call(d, {
|
|
115
|
+
row: e.row,
|
|
116
|
+
values: u.values
|
|
117
|
+
})) ?? [];
|
|
118
|
+
}
|
|
119
|
+
function X() {
|
|
120
|
+
return fe(
|
|
121
|
+
de,
|
|
122
|
+
{
|
|
123
|
+
...J.value,
|
|
124
|
+
modelValue: R.value,
|
|
125
|
+
"onUpdate:modelValue": (e) => {
|
|
126
|
+
R.value = e;
|
|
127
|
+
},
|
|
128
|
+
onChange: oe
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
description: Q
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
function Z(e) {
|
|
136
|
+
let o = e;
|
|
137
|
+
for (; o && o !== document.documentElement; ) {
|
|
138
|
+
const { overflowY: t } = getComputedStyle(o);
|
|
139
|
+
if ((t === "auto" || t === "scroll") && o.scrollHeight > o.clientHeight)
|
|
140
|
+
return o;
|
|
141
|
+
o = o.parentElement;
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
function N(e, o, t) {
|
|
146
|
+
return o ? e.getBoundingClientRect().top - o.getBoundingClientRect().top + o.scrollTop - t : e.getBoundingClientRect().top + window.scrollY - t;
|
|
147
|
+
}
|
|
148
|
+
function I(e, o, t) {
|
|
149
|
+
const n = Math.max(0, o);
|
|
150
|
+
e ? e.scrollTo({ top: n, behavior: t }) : window.scrollTo({ top: n, behavior: t });
|
|
151
|
+
}
|
|
152
|
+
function P(e) {
|
|
153
|
+
g.pause(), ve(() => {
|
|
154
|
+
const o = E.value, t = o == null ? void 0 : o.querySelector(`[data-group-key="${e}"]`);
|
|
155
|
+
if (!t) {
|
|
156
|
+
g.resume();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const n = p.value.scrollOffset ?? 0, l = Z(t) || o, a = l && l.scrollHeight > l.clientHeight ? l : null, c = a ?? document.documentElement, h = N(t, a, n);
|
|
160
|
+
I(a, h, "smooth");
|
|
161
|
+
let f = !1;
|
|
162
|
+
const m = () => {
|
|
163
|
+
f || (f = !0, c.removeEventListener("scrollend", m), clearTimeout(S), g.resume(), r.value.virtual && ee(t, a, n));
|
|
164
|
+
};
|
|
165
|
+
c.addEventListener("scrollend", m, { once: !0 });
|
|
166
|
+
const S = setTimeout(m, 800);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function ee(e, o, t) {
|
|
170
|
+
const n = o ?? document.documentElement;
|
|
171
|
+
let l, a;
|
|
172
|
+
function c() {
|
|
173
|
+
f.disconnect(), clearTimeout(l), cancelAnimationFrame(a);
|
|
174
|
+
}
|
|
175
|
+
function h() {
|
|
176
|
+
clearTimeout(l), l = setTimeout(c, Ge);
|
|
177
|
+
}
|
|
178
|
+
const f = new ResizeObserver(() => {
|
|
179
|
+
if (!e.isConnected) {
|
|
180
|
+
c();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
cancelAnimationFrame(a), a = requestAnimationFrame(() => {
|
|
184
|
+
const m = N(e, o, t), S = o ? o.scrollTop : window.scrollY;
|
|
185
|
+
Math.abs(m - S) > Pe && I(o, m, "instant");
|
|
186
|
+
}), h();
|
|
187
|
+
});
|
|
188
|
+
f.observe(n), h();
|
|
189
|
+
}
|
|
190
|
+
function oe(e) {
|
|
191
|
+
R.value = e, B[e] && i.toggleCollapse(e), P(e);
|
|
192
|
+
}
|
|
193
|
+
return x({ scrollToGroup: P, navItems: w }), (e, o) => (T(), k(L, null, [
|
|
194
|
+
H.value ? (T(), V(X, { key: 0 })) : ae("", !0),
|
|
195
|
+
K("form", A({ class: y(F) }, e.$attrs, {
|
|
196
|
+
onSubmit: o[0] || (o[0] = se(() => {
|
|
197
|
+
}, ["prevent"]))
|
|
198
|
+
}), [
|
|
199
|
+
K("div", {
|
|
200
|
+
ref_key: "scrollRef",
|
|
201
|
+
ref: E,
|
|
202
|
+
style: ce(z.value),
|
|
203
|
+
class: ie([`${y(F)}-scroll`, j.value])
|
|
204
|
+
}, [
|
|
205
|
+
(T(!0), k(L, null, D(b.value, (t, n) => (T(), V(Ae, A({
|
|
206
|
+
key: y(He)(t, n),
|
|
207
|
+
schema: t
|
|
208
|
+
}, { ref_for: !0 }, $.value, { onToggleCollapse: q }), ue({ _: 2 }, [
|
|
209
|
+
D(y(d), (l, a) => ({
|
|
210
|
+
name: a,
|
|
211
|
+
fn: me((c) => [
|
|
212
|
+
pe(e.$slots, a, A({ ref_for: !0 }, c || {}))
|
|
213
|
+
])
|
|
214
|
+
}))
|
|
215
|
+
]), 1040, ["schema"]))), 128))
|
|
216
|
+
], 6)
|
|
217
|
+
], 16)
|
|
218
|
+
], 64));
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
export {
|
|
222
|
+
Je as default
|
|
223
|
+
};
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { defineComponent as we, computed as a, inject as ne, watch as Se, useSlots as be, createElementBlock as h, createCommentVNode as J, openBlock as i, normalizeClass as p, createBlock as w, unref as r, renderSlot as m, normalizeProps as y, mergeProps as f, resolveDynamicComponent as Fe, Fragment as H, renderList as S, createSlots as M, withCtx as k, guardReactiveProps as b, createElementVNode as F, withDirectives as Pe, createVNode as Ie, vShow as Ee } from "vue";
|
|
2
|
+
import Re from "@dazhicheng-ui/assets/svg/arrowDown.svg?raw";
|
|
3
|
+
import Ne from "@dazhicheng-ui/assets/svg/arrowSUp.svg?raw";
|
|
4
|
+
import Ve from "@dazhicheng-ui/components/tt-icon";
|
|
5
|
+
import { useDesign as Le } from "@dazhicheng/hooks";
|
|
6
|
+
import { isFunction as Q, mergeWithArrayOverride as ue, clnm as c, isString as De } from "@dazhicheng/utils";
|
|
7
|
+
import { useFormValues as Oe } from "vee-validate";
|
|
8
|
+
import { injectRenderFormProps as Be } from "../form-render/context.js";
|
|
9
|
+
import "../components/Slot.js";
|
|
10
|
+
import "@dazhicheng-ui/components/tt-form-item-error-tooltip";
|
|
11
|
+
import "@dazhicheng-ui/assets/img/FormItemWarning.jpeg?inline";
|
|
12
|
+
import "@vueuse/core";
|
|
13
|
+
import "element-plus";
|
|
14
|
+
/* empty css */
|
|
15
|
+
import Ge from "../form/RenderContent.vue.js";
|
|
16
|
+
import { FieldRenderer as X } from "../form-render/FormFieldContact.js";
|
|
17
|
+
/* empty css */
|
|
18
|
+
import { HIDDEN_GROUP_KEYS_KEY as Ae, GROUP_VISIBILITY_CALLBACK_KEY as He } from "./lazyContext.js";
|
|
19
|
+
import { isGroupSchema as K, isRowSchema as ie, isSlotSchema as Z, getFieldNames as Me, getSchemaKey as Ke } from "./utils.js";
|
|
20
|
+
const Te = ["data-group-key"], je = ["data-group-scroll-anchor"], me = "grid-cols-1", ze = /* @__PURE__ */ we({
|
|
21
|
+
__name: "GroupSection",
|
|
22
|
+
props: {
|
|
23
|
+
schema: {},
|
|
24
|
+
collapseStates: {},
|
|
25
|
+
commonConfig: { default: () => ({}) },
|
|
26
|
+
globalCommonConfig: { default: () => ({}) },
|
|
27
|
+
layout: { default: "horizontal" },
|
|
28
|
+
compact: { type: Boolean, default: !1 },
|
|
29
|
+
depth: { default: 0 },
|
|
30
|
+
virtual: { type: Boolean, default: !1 },
|
|
31
|
+
scrollElement: { default: null },
|
|
32
|
+
rootMargin: { default: "200px 0px" },
|
|
33
|
+
estimateFieldHeight: { default: 52 }
|
|
34
|
+
},
|
|
35
|
+
emits: ["toggleCollapse"],
|
|
36
|
+
setup(fe, { emit: pe }) {
|
|
37
|
+
const { prefixCls: s } = Le("group-section"), R = Oe(), N = Be().form, l = fe, x = pe, P = a(() => K(l.schema)), V = a(() => ie(l.schema)), ee = a(() => Z(l.schema)), o = a(() => P.value ? l.schema : null), $ = a(() => V.value ? l.schema : null), I = a(() => ee.value ? l.schema : null), T = ne(Ae, void 0), le = a(() => {
|
|
38
|
+
const u = l.schema.ifShow;
|
|
39
|
+
return u === void 0 || u === !0 ? !0 : Q(u) ? !!u(R.value, N) : !!u;
|
|
40
|
+
}), ce = a(() => !(!le.value || P.value && o.value && (T != null && T.has(o.value.key)))), j = ne(He, void 0), oe = a(() => $.value ? Me($.value.children) : []);
|
|
41
|
+
Se(
|
|
42
|
+
[le],
|
|
43
|
+
([e]) => {
|
|
44
|
+
j && (P.value && o.value ? j({ type: "group", key: o.value.key, visible: e }) : V.value && oe.value.length && j({ type: "row", fieldNames: oe.value, visible: e }));
|
|
45
|
+
},
|
|
46
|
+
{ immediate: !0 }
|
|
47
|
+
);
|
|
48
|
+
const E = a(() => {
|
|
49
|
+
if (!o.value) return !1;
|
|
50
|
+
const { collapsible: e } = o.value;
|
|
51
|
+
return Q(e) ? e(R.value, N) : !!e;
|
|
52
|
+
}), z = a(
|
|
53
|
+
() => o.value && E.value ? !!l.collapseStates[o.value.key] : !1
|
|
54
|
+
), re = a(() => o.value ? ue(o.value.commonConfig ?? {}, l.commonConfig, l.globalCommonConfig) : ue(l.commonConfig, l.globalCommonConfig)), ve = a(() => ({
|
|
55
|
+
collapseStates: l.collapseStates,
|
|
56
|
+
commonConfig: re.value,
|
|
57
|
+
globalCommonConfig: l.globalCommonConfig,
|
|
58
|
+
layout: l.layout,
|
|
59
|
+
compact: l.compact,
|
|
60
|
+
virtual: l.virtual,
|
|
61
|
+
scrollElement: l.scrollElement,
|
|
62
|
+
rootMargin: l.rootMargin,
|
|
63
|
+
estimateFieldHeight: l.estimateFieldHeight
|
|
64
|
+
})), de = a(() => o.value ? c("grid gap-x-4", o.value.wrapperClass || me) : ""), ge = a(() => $.value ? c("grid gap-x-4 col-span-full", $.value.wrapperClass || me) : ""), Ce = a(() => P.value ? c(s, `${s}--group`, {
|
|
65
|
+
[`${s}--nested`]: l.depth > 0
|
|
66
|
+
}) : V.value ? c(s, `${s}--row`, ge.value) : c(s, `${s}--transparent`));
|
|
67
|
+
function U(e, u) {
|
|
68
|
+
const {
|
|
69
|
+
colon: v = !1,
|
|
70
|
+
componentProps: _ = {},
|
|
71
|
+
controlClass: D = "",
|
|
72
|
+
disabled: O,
|
|
73
|
+
disabledOnChangeListener: B = !0,
|
|
74
|
+
disabledOnInputListener: G = !0,
|
|
75
|
+
emptyStateValue: A = void 0,
|
|
76
|
+
formFieldProps: t = {},
|
|
77
|
+
formItemClass: d = "",
|
|
78
|
+
hideLabel: g = !1,
|
|
79
|
+
hideRequiredMark: n = !1,
|
|
80
|
+
labelClass: C = "",
|
|
81
|
+
labelWidth: ke = 70,
|
|
82
|
+
modelPropName: $e = "",
|
|
83
|
+
wrapperClass: se = ""
|
|
84
|
+
} = re.value;
|
|
85
|
+
let q = e.formItemClass;
|
|
86
|
+
if (Q(e.formItemClass))
|
|
87
|
+
try {
|
|
88
|
+
q = e.formItemClass();
|
|
89
|
+
} catch {
|
|
90
|
+
q = "";
|
|
91
|
+
}
|
|
92
|
+
const _e = e.useArraySchema && !e.wrapperClass ? c(se, u) : e.wrapperClass || se;
|
|
93
|
+
return {
|
|
94
|
+
colon: v,
|
|
95
|
+
disabled: O,
|
|
96
|
+
disabledOnChangeListener: B,
|
|
97
|
+
disabledOnInputListener: G,
|
|
98
|
+
emptyStateValue: A,
|
|
99
|
+
hideLabel: g,
|
|
100
|
+
hideRequiredMark: n,
|
|
101
|
+
labelWidth: ke,
|
|
102
|
+
modelPropName: $e,
|
|
103
|
+
...e,
|
|
104
|
+
wrapperClass: _e,
|
|
105
|
+
commonComponentProps: _,
|
|
106
|
+
componentProps: e.componentProps,
|
|
107
|
+
controlClass: c(D, e.controlClass),
|
|
108
|
+
formFieldProps: { ...t, ...e.formFieldProps },
|
|
109
|
+
formItemClass: c("flex-shrink-0", d, q),
|
|
110
|
+
labelClass: c(C, e.labelClass)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const L = a(() => ({
|
|
114
|
+
group: o.value,
|
|
115
|
+
collapsed: z.value,
|
|
116
|
+
isCollapsible: E.value,
|
|
117
|
+
values: R.value,
|
|
118
|
+
formActions: N
|
|
119
|
+
})), te = be(), he = a(() => {
|
|
120
|
+
var v;
|
|
121
|
+
const e = (v = o.value) == null ? void 0 : v.key, u = Object.keys(te);
|
|
122
|
+
return e ? u.filter((_) => !_.startsWith(`${e}-`)) : u;
|
|
123
|
+
});
|
|
124
|
+
function ye() {
|
|
125
|
+
E.value && o.value && x("toggleCollapse", o.value.key);
|
|
126
|
+
}
|
|
127
|
+
const ae = a(() => ({
|
|
128
|
+
values: R.value,
|
|
129
|
+
formActions: N
|
|
130
|
+
})), W = a(() => ({
|
|
131
|
+
virtual: l.virtual,
|
|
132
|
+
scrollElement: l.scrollElement,
|
|
133
|
+
rootMargin: l.rootMargin,
|
|
134
|
+
estimateFieldHeight: l.estimateFieldHeight
|
|
135
|
+
})), Y = a(() => Object.keys(te).filter((e) => e !== "default"));
|
|
136
|
+
return (e, u) => {
|
|
137
|
+
var v, _, D, O, B, G, A;
|
|
138
|
+
return ce.value ? (i(), h("div", {
|
|
139
|
+
key: 0,
|
|
140
|
+
class: p(Ce.value),
|
|
141
|
+
"data-group-key": (v = o.value) == null ? void 0 : v.key
|
|
142
|
+
}, [
|
|
143
|
+
ee.value && I.value ? (i(), h("div", {
|
|
144
|
+
key: 0,
|
|
145
|
+
class: p([`${r(s)}__slot`, I.value.wrapperClass])
|
|
146
|
+
}, [
|
|
147
|
+
r(De)(I.value.content) ? m(e.$slots, I.value.content, y(f({ key: 0 }, ae.value))) : (i(), w(Fe(I.value.content(ae.value)), { key: 1 }))
|
|
148
|
+
], 2)) : V.value ? (i(!0), h(H, { key: 1 }, S($.value.children, (t, d) => {
|
|
149
|
+
var g;
|
|
150
|
+
return i(), w(r(X), f({
|
|
151
|
+
key: t.fieldName || `row-field-${d}`,
|
|
152
|
+
"field-config": U(t, (g = $.value) == null ? void 0 : g.wrapperClass),
|
|
153
|
+
rules: t.rules
|
|
154
|
+
}, { ref_for: !0 }, W.value), M({
|
|
155
|
+
default: k((n) => [
|
|
156
|
+
m(e.$slots, t.fieldName, f({ ref_for: !0 }, n))
|
|
157
|
+
]),
|
|
158
|
+
_: 2
|
|
159
|
+
}, [
|
|
160
|
+
S(Y.value, (n) => ({
|
|
161
|
+
name: n,
|
|
162
|
+
fn: k((C) => [
|
|
163
|
+
m(e.$slots, n, f({ ref_for: !0 }, C))
|
|
164
|
+
])
|
|
165
|
+
}))
|
|
166
|
+
]), 1040, ["field-config", "rules"]);
|
|
167
|
+
}), 128)) : P.value ? (i(), h(H, { key: 3 }, [
|
|
168
|
+
F("div", {
|
|
169
|
+
class: p([
|
|
170
|
+
`${r(s)}__header`,
|
|
171
|
+
{ [`${r(s)}__header--collapsible`]: E.value, [`${r(s)}__header--bar`]: e.depth === 0 }
|
|
172
|
+
]),
|
|
173
|
+
"data-group-scroll-anchor": (_ = o.value) == null ? void 0 : _.key,
|
|
174
|
+
onClick: ye
|
|
175
|
+
}, [
|
|
176
|
+
F("div", {
|
|
177
|
+
class: p(`${r(s)}__header-left`)
|
|
178
|
+
}, [
|
|
179
|
+
m(e.$slots, `${(D = o.value) == null ? void 0 : D.key}-header-left`, y(b(L.value))),
|
|
180
|
+
F("span", {
|
|
181
|
+
class: p(`${r(s)}__title`)
|
|
182
|
+
}, [
|
|
183
|
+
(O = o.value) != null && O.title ? (i(), w(r(Ge), {
|
|
184
|
+
key: 0,
|
|
185
|
+
content: o.value.title
|
|
186
|
+
}, null, 8, ["content"])) : J("", !0)
|
|
187
|
+
], 2),
|
|
188
|
+
m(e.$slots, `${(B = o.value) == null ? void 0 : B.key}-title-right`, y(b(L.value)))
|
|
189
|
+
], 2),
|
|
190
|
+
F("div", {
|
|
191
|
+
class: p(`${r(s)}__header-right`)
|
|
192
|
+
}, [
|
|
193
|
+
m(e.$slots, `${(G = o.value) == null ? void 0 : G.key}-arrow-left`, y(b(L.value))),
|
|
194
|
+
E.value ? (i(), h("span", {
|
|
195
|
+
key: 0,
|
|
196
|
+
class: p(`${r(s)}__arrow`)
|
|
197
|
+
}, [
|
|
198
|
+
Ie(r(Ve), {
|
|
199
|
+
icon: z.value ? r(Re) : r(Ne),
|
|
200
|
+
size: 12,
|
|
201
|
+
"is-custom-svg": ""
|
|
202
|
+
}, null, 8, ["icon"])
|
|
203
|
+
], 2)) : J("", !0),
|
|
204
|
+
m(e.$slots, `${(A = o.value) == null ? void 0 : A.key}-header-right`, y(b(L.value)))
|
|
205
|
+
], 2)
|
|
206
|
+
], 10, je),
|
|
207
|
+
Pe(F("div", {
|
|
208
|
+
class: p(`${r(s)}__body`)
|
|
209
|
+
}, [
|
|
210
|
+
F("div", {
|
|
211
|
+
class: p(de.value)
|
|
212
|
+
}, [
|
|
213
|
+
(i(!0), h(H, null, S(o.value.children, (t, d) => {
|
|
214
|
+
var g;
|
|
215
|
+
return i(), h(H, {
|
|
216
|
+
key: r(Ke)(t, d)
|
|
217
|
+
}, [
|
|
218
|
+
r(K)(t) || r(ie)(t) || r(Z)(t) ? (i(), w(ze, f({
|
|
219
|
+
key: 0,
|
|
220
|
+
schema: t
|
|
221
|
+
}, { ref_for: !0 }, ve.value, {
|
|
222
|
+
depth: r(K)(t) ? e.depth + 1 : e.depth,
|
|
223
|
+
class: { "col-span-full": r(K)(t) || r(Z)(t) },
|
|
224
|
+
onToggleCollapse: u[0] || (u[0] = (n) => x("toggleCollapse", n))
|
|
225
|
+
}), M({ _: 2 }, [
|
|
226
|
+
S(he.value, (n) => ({
|
|
227
|
+
name: n,
|
|
228
|
+
fn: k((C) => [
|
|
229
|
+
m(e.$slots, n, f({ ref_for: !0 }, C))
|
|
230
|
+
])
|
|
231
|
+
}))
|
|
232
|
+
]), 1040, ["schema", "depth", "class"])) : (i(), w(r(X), f({
|
|
233
|
+
key: 1,
|
|
234
|
+
"field-config": U(t, (g = o.value) == null ? void 0 : g.wrapperClass),
|
|
235
|
+
rules: t.rules
|
|
236
|
+
}, { ref_for: !0 }, W.value), M({
|
|
237
|
+
default: k((n) => [
|
|
238
|
+
m(e.$slots, t.fieldName, f({ ref_for: !0 }, n))
|
|
239
|
+
]),
|
|
240
|
+
_: 2
|
|
241
|
+
}, [
|
|
242
|
+
S(Y.value, (n) => ({
|
|
243
|
+
name: n,
|
|
244
|
+
fn: k((C) => [
|
|
245
|
+
m(e.$slots, n, f({ ref_for: !0 }, C))
|
|
246
|
+
])
|
|
247
|
+
}))
|
|
248
|
+
]), 1040, ["field-config", "rules"]))
|
|
249
|
+
], 64);
|
|
250
|
+
}), 128))
|
|
251
|
+
], 2)
|
|
252
|
+
], 2), [
|
|
253
|
+
[Ee, !z.value]
|
|
254
|
+
])
|
|
255
|
+
], 64)) : (i(), w(r(X), f({
|
|
256
|
+
key: 2,
|
|
257
|
+
"field-config": U(e.schema),
|
|
258
|
+
rules: e.schema.rules
|
|
259
|
+
}, W.value), M({
|
|
260
|
+
default: k((t) => [
|
|
261
|
+
m(e.$slots, l.schema.fieldName, y(b(t)))
|
|
262
|
+
]),
|
|
263
|
+
_: 2
|
|
264
|
+
}, [
|
|
265
|
+
S(Y.value, (t) => ({
|
|
266
|
+
name: t,
|
|
267
|
+
fn: k((d) => [
|
|
268
|
+
m(e.$slots, t, y(b(d)))
|
|
269
|
+
])
|
|
270
|
+
}))
|
|
271
|
+
]), 1040, ["field-config", "rules"]))
|
|
272
|
+
], 10, Te)) : J("", !0);
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
export {
|
|
277
|
+
ze as default
|
|
278
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { defineComponent as D, inject as A, computed as U, ref as B, watch as Y, useTemplateRef as j, shallowRef as K, onMounted as O, onBeforeUnmount as G, createElementBlock as S, openBlock as h, normalizeClass as d, unref as n, createBlock as V, createCommentVNode as J, mergeProps as Q, withCtx as x, renderSlot as W, normalizeProps as X, guardReactiveProps as Z, normalizeStyle as N, createElementVNode as ee, createVNode as T, nextTick as z } from "vue";
|
|
2
|
+
import { ElSkeleton as te, ElSkeletonItem as L } from "element-plus";
|
|
3
|
+
import { useDesign as le } from "@dazhicheng/hooks";
|
|
4
|
+
import { isFunction as re, isBoolean as oe, clnm as ne } from "@dazhicheng/utils";
|
|
5
|
+
import { useFormValues as ie } from "vee-validate";
|
|
6
|
+
import se from "../form-render/FormField.vue2.js";
|
|
7
|
+
import { injectRenderFormProps as ae } from "../form-render/context.js";
|
|
8
|
+
import { VIRTUAL_ERROR_CACHE_KEY as ue, RENDER_SCHEDULER_KEY as fe } from "./lazyContext.js";
|
|
9
|
+
import { resolveValueByFieldName as ce } from "../form-render/dependencies.js";
|
|
10
|
+
const Ce = /* @__PURE__ */ D({
|
|
11
|
+
name: "LazyFormField",
|
|
12
|
+
inheritAttrs: !1,
|
|
13
|
+
__name: "LazyFormField",
|
|
14
|
+
props: {
|
|
15
|
+
fieldProps: {},
|
|
16
|
+
rules: { default: void 0 },
|
|
17
|
+
fieldClass: { default: "" },
|
|
18
|
+
root: { default: null },
|
|
19
|
+
rootMargin: { default: "200px 0px" },
|
|
20
|
+
estimateHeight: { default: 52 },
|
|
21
|
+
skeleton: { type: Boolean, default: !0 },
|
|
22
|
+
skeletonAnimated: { type: Boolean, default: !0 }
|
|
23
|
+
},
|
|
24
|
+
setup(q) {
|
|
25
|
+
const { prefixCls: s } = le("lazy-form-field"), m = q, g = ae().form, p = m.fieldProps.fieldName, v = A(ue, void 0), _ = A(fe, void 0), C = ie(), k = U(() => m.fieldProps.dependencies), i = B(!0);
|
|
26
|
+
Y(
|
|
27
|
+
() => {
|
|
28
|
+
var l;
|
|
29
|
+
const e = k.value;
|
|
30
|
+
if ((l = e == null ? void 0 : e.triggerFields) != null && l.length)
|
|
31
|
+
return e.triggerFields.map((t) => ce(C.value, t));
|
|
32
|
+
},
|
|
33
|
+
async () => {
|
|
34
|
+
const e = k.value;
|
|
35
|
+
if (!e || e.if === void 0) {
|
|
36
|
+
i.value = !0;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
re(e.if) ? i.value = !!await e.if(C.value, g) : oe(e.if) && (i.value = e.if);
|
|
40
|
+
},
|
|
41
|
+
{ deep: !0, immediate: !0 }
|
|
42
|
+
);
|
|
43
|
+
const r = j("containerRef"), u = B(!1);
|
|
44
|
+
let f = !1;
|
|
45
|
+
const E = `${s}--offscreen`, H = K(m.estimateHeight);
|
|
46
|
+
let a = null, o = null, y = null;
|
|
47
|
+
async function I() {
|
|
48
|
+
if (!g || !p) return;
|
|
49
|
+
const l = v == null ? void 0 : v.get(p);
|
|
50
|
+
l && (v.delete(p), await z(), g.setFieldError(p, l));
|
|
51
|
+
}
|
|
52
|
+
function w(e) {
|
|
53
|
+
let l = e.parentElement;
|
|
54
|
+
for (; l; ) {
|
|
55
|
+
const t = getComputedStyle(l).overflowY;
|
|
56
|
+
if (t === "auto" || t === "scroll") return l;
|
|
57
|
+
l = l.parentElement;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
function P() {
|
|
62
|
+
const e = r.value;
|
|
63
|
+
if (!e || u.value) return;
|
|
64
|
+
const l = e.offsetHeight;
|
|
65
|
+
e.style.height = `${l}px`, e.style.overflow = "hidden", u.value = !0, I(), z(() => {
|
|
66
|
+
requestAnimationFrame(() => {
|
|
67
|
+
const t = r.value;
|
|
68
|
+
if (!t) return;
|
|
69
|
+
const $ = t.scrollHeight - l;
|
|
70
|
+
t.style.height = "", t.style.overflow = "", !(Math.abs($) <= 2) && requestAnimationFrame(() => {
|
|
71
|
+
const R = r.value;
|
|
72
|
+
if (!R) return;
|
|
73
|
+
const F = y ?? w(R);
|
|
74
|
+
if (!F) return;
|
|
75
|
+
const M = R.getBoundingClientRect().top, b = F.getBoundingClientRect().top;
|
|
76
|
+
M < b && (F.scrollTop += $);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return O(() => {
|
|
82
|
+
r.value && (y = w(r.value), a = new IntersectionObserver(
|
|
83
|
+
(e) => {
|
|
84
|
+
const l = e[0];
|
|
85
|
+
if (l)
|
|
86
|
+
if (l.isIntersecting) {
|
|
87
|
+
f = !0;
|
|
88
|
+
const t = r.value;
|
|
89
|
+
t && (t.style.minHeight = "", t.classList.remove(E)), !u.value && !o && i.value && (o = _ ? _.request(() => {
|
|
90
|
+
o = null, !(!f || !i.value) && P();
|
|
91
|
+
}) : (() => {
|
|
92
|
+
const c = requestAnimationFrame(() => {
|
|
93
|
+
o = null, !(!f || !i.value) && P();
|
|
94
|
+
});
|
|
95
|
+
return () => cancelAnimationFrame(c);
|
|
96
|
+
})());
|
|
97
|
+
} else
|
|
98
|
+
f = !1, u.value && r.value && requestAnimationFrame(() => {
|
|
99
|
+
if (f) return;
|
|
100
|
+
const t = r.value;
|
|
101
|
+
if (!(t != null && t.isConnected)) return;
|
|
102
|
+
const c = t.offsetHeight;
|
|
103
|
+
c !== 0 && (t.style.minHeight = `${c}px`, t.classList.add(E));
|
|
104
|
+
}), o && (o(), o = null);
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
root: y,
|
|
108
|
+
rootMargin: m.rootMargin
|
|
109
|
+
}
|
|
110
|
+
), a.observe(r.value));
|
|
111
|
+
}), G(() => {
|
|
112
|
+
o && (o(), o = null), a == null || a.disconnect(), a = null;
|
|
113
|
+
}), (e, l) => (h(), S("div", {
|
|
114
|
+
ref_key: "containerRef",
|
|
115
|
+
ref: r,
|
|
116
|
+
class: d(n(ne)(n(s), e.fieldClass, { [`${n(s)}--hidden`]: !i.value }))
|
|
117
|
+
}, [
|
|
118
|
+
u.value ? (h(), V(se, Q({ key: 0 }, e.fieldProps, { rules: e.rules }), {
|
|
119
|
+
default: x((t) => [
|
|
120
|
+
W(e.$slots, "default", X(Z(t)))
|
|
121
|
+
]),
|
|
122
|
+
_: 3
|
|
123
|
+
}, 16, ["rules"])) : e.skeleton && i.value ? (h(), V(n(te), {
|
|
124
|
+
key: 1,
|
|
125
|
+
animated: e.skeletonAnimated,
|
|
126
|
+
class: d(`${n(s)}__skeleton`),
|
|
127
|
+
style: N({ minHeight: `${H.value}px` })
|
|
128
|
+
}, {
|
|
129
|
+
template: x(() => [
|
|
130
|
+
ee("div", {
|
|
131
|
+
class: d(`${n(s)}__row`)
|
|
132
|
+
}, [
|
|
133
|
+
T(n(L), {
|
|
134
|
+
variant: "text",
|
|
135
|
+
class: d(`${n(s)}__label`)
|
|
136
|
+
}, null, 8, ["class"]),
|
|
137
|
+
T(n(L), {
|
|
138
|
+
variant: "rect",
|
|
139
|
+
class: d(`${n(s)}__control`)
|
|
140
|
+
}, null, 8, ["class"])
|
|
141
|
+
], 2)
|
|
142
|
+
]),
|
|
143
|
+
_: 1
|
|
144
|
+
}, 8, ["animated", "class", "style"])) : i.value ? (h(), S("div", {
|
|
145
|
+
key: 2,
|
|
146
|
+
style: N({ height: `${H.value}px` })
|
|
147
|
+
}, null, 4)) : J("", !0)
|
|
148
|
+
], 2));
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
export {
|
|
152
|
+
Ce as default
|
|
153
|
+
};
|