@dazhicheng/ui 1.5.199 → 1.5.202
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/RiRefreshLine.svg.js +4 -0
- package/dist/assets/svg/action_more.svg.js +4 -0
- package/dist/assets/svg/add.svg.js +4 -0
- package/dist/assets/svg/addCircleLine.svg.js +4 -0
- package/dist/assets/svg/arrowDown.svg.js +4 -0
- package/dist/assets/svg/arrowLineDown.svg.js +5 -0
- package/dist/assets/svg/arrowSUp.svg.js +4 -0
- package/dist/assets/svg/arrowUp.svg.js +4 -0
- package/dist/assets/svg/close.svg.js +4 -0
- package/dist/assets/svg/columnSet.svg.js +4 -0
- package/dist/assets/svg/determinateCircleLine.svg.js +5 -0
- package/dist/assets/svg/drag.svg.js +5 -0
- package/dist/assets/svg/exportSvg.svg.js +4 -0
- package/dist/assets/svg/fileSvg.svg.js +4 -0
- package/dist/assets/svg/help.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.vue3.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 +157 -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 +59 -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 +345 -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 +101 -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 +196 -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 +277 -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 +147 -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 +31 -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 +201 -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 +63 -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 +356 -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 +234 -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 +306 -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/hooks/useTable.js +13 -0
- package/dist/hooks/useTemplateSlot.js +13 -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,101 @@
|
|
|
1
|
+
import { defineComponent as h, createBlock as l, openBlock as t, unref as o, normalizeClass as g, withCtx as r, createElementBlock as s, createCommentVNode as i, Fragment as m, createElementVNode as u, toDisplayString as f, createVNode as a, normalizeProps as b, mergeProps as k, createTextVNode as y } from "vue";
|
|
2
|
+
import _ from "../../../../assets/svg/help.svg.js";
|
|
3
|
+
import { TtIcon as v } from "../../../tt-icon/index.js";
|
|
4
|
+
import { TtText as x } from "../../../tt-text/index.js";
|
|
5
|
+
import { isObject as B, isFunction as C, clnm as V } from "@dazhicheng/utils";
|
|
6
|
+
import { ElTooltip as d } from "element-plus";
|
|
7
|
+
import "../components/Slot.js";
|
|
8
|
+
import "vee-validate";
|
|
9
|
+
import z from "../form/FormLabel.vue.js";
|
|
10
|
+
import "../../../tt-form-item-error-tooltip/index.js";
|
|
11
|
+
import "@vueuse/core";
|
|
12
|
+
/* empty css */
|
|
13
|
+
import p from "../form/RenderContent.vue.js";
|
|
14
|
+
const N = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "mr-[2px] text-destructive color-var(--el-color-error)"
|
|
17
|
+
}, E = { class: "flex items-center" }, F = { key: 0 }, q = { class: "flex items-center" }, L = {
|
|
18
|
+
key: 3,
|
|
19
|
+
class: "ml-[2px]"
|
|
20
|
+
}, Q = /* @__PURE__ */ h({
|
|
21
|
+
__name: "FormLabel",
|
|
22
|
+
props: {
|
|
23
|
+
class: {},
|
|
24
|
+
colon: { type: Boolean },
|
|
25
|
+
help: {},
|
|
26
|
+
label: {},
|
|
27
|
+
required: { type: Boolean },
|
|
28
|
+
helpTrigger: { default: "hover" },
|
|
29
|
+
toolTip: { default: () => ({
|
|
30
|
+
toolTipLine: 3
|
|
31
|
+
}) },
|
|
32
|
+
toolTipText: {}
|
|
33
|
+
},
|
|
34
|
+
setup(T) {
|
|
35
|
+
const n = T, c = (B(n.label) || C(n.label)) && n.label !== null;
|
|
36
|
+
return (e, P) => (t(), l(o(z), {
|
|
37
|
+
class: g(o(V)("flex items-center text-var(--el-font-size-base)", n.class))
|
|
38
|
+
}, {
|
|
39
|
+
default: r(() => [
|
|
40
|
+
e.required ? (t(), s("span", N, "*")) : i("", !0),
|
|
41
|
+
e.label ? (t(), s(m, { key: 1 }, [
|
|
42
|
+
e.toolTipText ? (t(), l(o(d), {
|
|
43
|
+
key: 0,
|
|
44
|
+
"popper-class": "mx-1",
|
|
45
|
+
placement: "top",
|
|
46
|
+
trigger: "hover"
|
|
47
|
+
}, {
|
|
48
|
+
content: r(() => [
|
|
49
|
+
a(o(p), { content: e.toolTipText }, null, 8, ["content"])
|
|
50
|
+
]),
|
|
51
|
+
default: r(() => [
|
|
52
|
+
u("div", E, [
|
|
53
|
+
o(c) ? (t(), l(o(p), {
|
|
54
|
+
key: 1,
|
|
55
|
+
content: e.label
|
|
56
|
+
}, null, 8, ["content"])) : (t(), s("div", F, f(e.label), 1))
|
|
57
|
+
])
|
|
58
|
+
]),
|
|
59
|
+
_: 1
|
|
60
|
+
})) : (t(), s(m, { key: 1 }, [
|
|
61
|
+
o(c) ? (t(), l(o(p), {
|
|
62
|
+
key: 1,
|
|
63
|
+
content: e.label
|
|
64
|
+
}, null, 8, ["content"])) : (t(), l(o(x), b(k({ key: 0 }, n.toolTip)), {
|
|
65
|
+
default: r(() => [
|
|
66
|
+
y(f(e.label), 1)
|
|
67
|
+
]),
|
|
68
|
+
_: 1
|
|
69
|
+
}, 16))
|
|
70
|
+
], 64))
|
|
71
|
+
], 64)) : i("", !0),
|
|
72
|
+
e.help ? (t(), l(o(d), {
|
|
73
|
+
key: 2,
|
|
74
|
+
"popper-class": "mx-1",
|
|
75
|
+
placement: "top",
|
|
76
|
+
trigger: e.helpTrigger
|
|
77
|
+
}, {
|
|
78
|
+
content: r(() => [
|
|
79
|
+
a(o(p), { content: e.help }, null, 8, ["content"])
|
|
80
|
+
]),
|
|
81
|
+
default: r(() => [
|
|
82
|
+
u("div", q, [
|
|
83
|
+
a(o(v), {
|
|
84
|
+
class: "ml-[4px] cursor-pointer",
|
|
85
|
+
size: 14,
|
|
86
|
+
"is-custom-svg": "",
|
|
87
|
+
icon: o(_)
|
|
88
|
+
}, null, 8, ["icon"])
|
|
89
|
+
])
|
|
90
|
+
]),
|
|
91
|
+
_: 1
|
|
92
|
+
}, 8, ["trigger"])) : i("", !0),
|
|
93
|
+
e.colon && e.label ? (t(), s("span", L, ":")) : i("", !0)
|
|
94
|
+
]),
|
|
95
|
+
_: 1
|
|
96
|
+
}, 8, ["class"]));
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
export {
|
|
100
|
+
Q as default
|
|
101
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { defineComponent as M, computed as h, unref as C, reactive as T, onMounted as Y, onUnmounted as z, createVNode as N, toValue as b, Fragment as B, mergeProps as G, isVNode as U } from "vue";
|
|
2
|
+
import { clnm as W } from "@dazhicheng/utils";
|
|
3
|
+
import { set as q, get as J, omit as Q } from "lodash-es";
|
|
4
|
+
import { useFormValues as X } from "vee-validate";
|
|
5
|
+
import { useArrayRegistry as Z } from "../../hooks/useArrayRegistry.js";
|
|
6
|
+
import { useFieldArray as ee } from "../../hooks/useFieldArray.js";
|
|
7
|
+
import { injectFormProps as re, resolveArraySchemasForRuntime as ae, createArraySchemaContext as te } from "../../useFormContext.js";
|
|
8
|
+
import { normalizeArrayFieldPath as I } from "../../utils/array-path.js";
|
|
9
|
+
import { injectRenderFormProps as ne } from "../context.js";
|
|
10
|
+
import le from "../dependencies.js";
|
|
11
|
+
import { FieldRenderer as ie } from "../FormFieldContact.js";
|
|
12
|
+
import { formArrayRegisterProps as oe } from "./props.js";
|
|
13
|
+
import { getMergedDisabled as de, resolveArrayItemState as x } from "./utils.js";
|
|
14
|
+
function me(r) {
|
|
15
|
+
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !U(r);
|
|
16
|
+
}
|
|
17
|
+
const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rules", "formItemClass", "wrapperClass", "defaultValue", "hide", "disabled", "dependencies"], se = /* @__PURE__ */ M({
|
|
18
|
+
name: "FormArrayRegister",
|
|
19
|
+
props: oe,
|
|
20
|
+
setup(r, {
|
|
21
|
+
slots: i,
|
|
22
|
+
attrs: D
|
|
23
|
+
}) {
|
|
24
|
+
const o = ee(() => r.fieldName), [O, _] = Z(r.fieldName, r), y = X(), p = ne().form, [j] = re(), $ = h(() => {
|
|
25
|
+
var e;
|
|
26
|
+
return (e = C(j)) == null ? void 0 : e.formApi;
|
|
27
|
+
}), v = h(() => {
|
|
28
|
+
var e;
|
|
29
|
+
return (e = $.value) == null ? void 0 : e.arrayAction;
|
|
30
|
+
}), A = T(new Proxy(y.value, {
|
|
31
|
+
get(e, a) {
|
|
32
|
+
return J(y.value, a);
|
|
33
|
+
},
|
|
34
|
+
set(e, a, t) {
|
|
35
|
+
return q(y.value, a, t), p == null || p.validateField(String(a)), !0;
|
|
36
|
+
},
|
|
37
|
+
ownKeys() {
|
|
38
|
+
return Reflect.ownKeys(y.value);
|
|
39
|
+
},
|
|
40
|
+
getOwnPropertyDescriptor(e, a) {
|
|
41
|
+
return Object.getOwnPropertyDescriptor(y.value, a);
|
|
42
|
+
}
|
|
43
|
+
})), {
|
|
44
|
+
dynamicRules: F,
|
|
45
|
+
isDisabled: R,
|
|
46
|
+
isIf: H,
|
|
47
|
+
isShow: L
|
|
48
|
+
} = le(() => r.dependencies), w = h(() => Q(D, ue)), g = h(() => I(r.fieldName)), P = h(() => {
|
|
49
|
+
var e;
|
|
50
|
+
return (e = v.value) == null ? void 0 : e.at(g.value);
|
|
51
|
+
});
|
|
52
|
+
Y(() => {
|
|
53
|
+
O(o);
|
|
54
|
+
}), z(_);
|
|
55
|
+
function V(e) {
|
|
56
|
+
var n;
|
|
57
|
+
const {
|
|
58
|
+
entry: a,
|
|
59
|
+
index: t,
|
|
60
|
+
itemFieldName: s,
|
|
61
|
+
parentItemPath: d
|
|
62
|
+
} = e;
|
|
63
|
+
return te({
|
|
64
|
+
arrayPath: g.value,
|
|
65
|
+
itemPath: I(s),
|
|
66
|
+
index: t,
|
|
67
|
+
row: a.value,
|
|
68
|
+
arrayLength: ((n = b(o.fields)) == null ? void 0 : n.length) ?? 0,
|
|
69
|
+
parentItemPath: d,
|
|
70
|
+
form: A,
|
|
71
|
+
arrayAction: v.value,
|
|
72
|
+
arrayHandle: P.value
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function k(e, a) {
|
|
76
|
+
const {
|
|
77
|
+
entry: t,
|
|
78
|
+
index: s,
|
|
79
|
+
itemFieldName: d,
|
|
80
|
+
parentItemPath: n
|
|
81
|
+
} = a, m = `${d}.${e.fieldName}`;
|
|
82
|
+
if (e.useArraySchema) {
|
|
83
|
+
const l = x(e, {
|
|
84
|
+
dynamicRules: F.value,
|
|
85
|
+
dynamicDisabled: R.value,
|
|
86
|
+
props: r
|
|
87
|
+
}), u = {
|
|
88
|
+
...w.value,
|
|
89
|
+
...e,
|
|
90
|
+
fieldName: m,
|
|
91
|
+
rules: l.rules,
|
|
92
|
+
disabled: l.disabled,
|
|
93
|
+
formItemClass: l.formItemClass,
|
|
94
|
+
virtual: r.virtual,
|
|
95
|
+
arraySchema: e.arraySchema
|
|
96
|
+
};
|
|
97
|
+
return N(se, G({
|
|
98
|
+
key: m
|
|
99
|
+
}, u), me(i) ? i : {
|
|
100
|
+
default: () => [i]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const c = x(e, {
|
|
104
|
+
dynamicRules: F.value,
|
|
105
|
+
dynamicDisabled: R.value,
|
|
106
|
+
props: r
|
|
107
|
+
}), S = {
|
|
108
|
+
...w.value,
|
|
109
|
+
...e,
|
|
110
|
+
fieldName: m,
|
|
111
|
+
rules: c.rules,
|
|
112
|
+
disabled: c.disabled,
|
|
113
|
+
formItemClass: c.formItemClass
|
|
114
|
+
};
|
|
115
|
+
return N(ie, {
|
|
116
|
+
key: `${t.key}-${m}`,
|
|
117
|
+
fieldConfig: S,
|
|
118
|
+
rules: S.rules,
|
|
119
|
+
virtual: r.virtual
|
|
120
|
+
}, {
|
|
121
|
+
default: (l) => {
|
|
122
|
+
var u, f;
|
|
123
|
+
return (f = i[e.fieldName]) == null ? void 0 : f.call(i, {
|
|
124
|
+
...l,
|
|
125
|
+
action: o,
|
|
126
|
+
entry: t,
|
|
127
|
+
index: s,
|
|
128
|
+
fieldName: d,
|
|
129
|
+
form: A,
|
|
130
|
+
arrayPath: g.value,
|
|
131
|
+
arrayHandle: P.value,
|
|
132
|
+
arrayAction: v.value,
|
|
133
|
+
parentItemPath: n,
|
|
134
|
+
arrayLength: ((u = b(o.fields)) == null ? void 0 : u.length) ?? 0
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function E(e, a) {
|
|
140
|
+
var u;
|
|
141
|
+
const t = `${r.fieldName}[${a}]`, s = i[r.fieldName], d = r.fieldName.lastIndexOf("."), n = d !== -1 ? r.fieldName.slice(0, d) : void 0;
|
|
142
|
+
if (s) {
|
|
143
|
+
const f = de(R.value, void 0, r.disabled);
|
|
144
|
+
return s({
|
|
145
|
+
action: o,
|
|
146
|
+
entry: e,
|
|
147
|
+
index: a,
|
|
148
|
+
fieldName: t,
|
|
149
|
+
disabled: f,
|
|
150
|
+
form: A,
|
|
151
|
+
arrayPath: g.value,
|
|
152
|
+
arrayHandle: P.value,
|
|
153
|
+
arrayAction: v.value,
|
|
154
|
+
parentItemPath: n,
|
|
155
|
+
arrayLength: ((u = b(o.fields)) == null ? void 0 : u.length) ?? 0
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
const m = {
|
|
159
|
+
entry: e,
|
|
160
|
+
index: a,
|
|
161
|
+
itemFieldName: t,
|
|
162
|
+
parentItemPath: n
|
|
163
|
+
}, c = V(m), l = ae({
|
|
164
|
+
item: r,
|
|
165
|
+
arrayPath: g.value,
|
|
166
|
+
itemPath: c.itemPath,
|
|
167
|
+
index: a,
|
|
168
|
+
row: e.value,
|
|
169
|
+
arrayLength: c.arrayLength,
|
|
170
|
+
parentItemPath: n,
|
|
171
|
+
form: A,
|
|
172
|
+
arrayAction: v.value,
|
|
173
|
+
arrayHandle: P.value
|
|
174
|
+
}).map((f) => k(f, m));
|
|
175
|
+
return l.length ? N(B, {
|
|
176
|
+
key: e.key
|
|
177
|
+
}, [l]) : null;
|
|
178
|
+
}
|
|
179
|
+
function K(e) {
|
|
180
|
+
return e.some(Boolean) ? r.wrapperClass : void 0;
|
|
181
|
+
}
|
|
182
|
+
return () => {
|
|
183
|
+
if (r.hide || !H.value) return null;
|
|
184
|
+
const a = (C(o.fields) ?? []).map(E);
|
|
185
|
+
return N("div", {
|
|
186
|
+
class: W("grid col-span-full", {
|
|
187
|
+
hidden: !L.value
|
|
188
|
+
}, K(a))
|
|
189
|
+
}, [a]);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
export {
|
|
194
|
+
se as FormArrayRegister
|
|
195
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
fieldName: {
|
|
3
|
+
type: String,
|
|
4
|
+
required: !0
|
|
5
|
+
},
|
|
6
|
+
hide: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
default: void 0
|
|
9
|
+
},
|
|
10
|
+
disabled: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: void 0
|
|
13
|
+
},
|
|
14
|
+
dependencies: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: void 0
|
|
17
|
+
},
|
|
18
|
+
arraySchema: {
|
|
19
|
+
type: [Array, Function],
|
|
20
|
+
default: () => []
|
|
21
|
+
},
|
|
22
|
+
useArraySchema: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: void 0
|
|
25
|
+
},
|
|
26
|
+
defaultValue: {
|
|
27
|
+
type: null,
|
|
28
|
+
default: void 0
|
|
29
|
+
},
|
|
30
|
+
formItemClass: {
|
|
31
|
+
type: [String, Function],
|
|
32
|
+
default: void 0
|
|
33
|
+
},
|
|
34
|
+
rules: {
|
|
35
|
+
type: null,
|
|
36
|
+
default: void 0
|
|
37
|
+
},
|
|
38
|
+
virtual: { type: Boolean, default: !1 },
|
|
39
|
+
/** useArraySchema 时:数组整体最外层容器 class(边框、间距等) */
|
|
40
|
+
wrapperClass: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: void 0
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
e as formArrayRegisterProps
|
|
47
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isFunction as m, clnm as c } from "@dazhicheng/utils";
|
|
2
|
+
function p(s, r, e) {
|
|
3
|
+
return s || !!r || !!e;
|
|
4
|
+
}
|
|
5
|
+
function f(s, r) {
|
|
6
|
+
const { dynamicRules: e, dynamicDisabled: o, props: t } = r, n = s.rules ?? e ?? t.rules, l = s.formItemClass || t.formItemClass, a = m(l) ? l() : l, i = s.wrapperClass, d = p(o, !!s.disabled, !!t.disabled);
|
|
7
|
+
return { rules: n, formItemClass: c("col-span-1", a), disabled: d, wrapperClass: i };
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
p as getMergedDisabled,
|
|
11
|
+
f as resolveArrayItemState
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { computed as n } from "vue";
|
|
2
|
+
import { createContext as r } from "../shared/createContext.js";
|
|
3
|
+
const [p, i] = r("FormRenderProps"), a = () => {
|
|
4
|
+
const o = p(), e = n(() => o.layout === "vertical"), t = n(() => o.componentMap);
|
|
5
|
+
return {
|
|
6
|
+
componentBindEventMap: n(() => o.componentBindEventMap),
|
|
7
|
+
componentMap: t,
|
|
8
|
+
isVertical: e
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
p as injectRenderFormProps,
|
|
13
|
+
i as provideFormRenderProps,
|
|
14
|
+
a as useFormContext
|
|
15
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ref as u, computed as C, watch as I } from "vue";
|
|
2
|
+
import { isFunction as o, isBoolean as p } from "@dazhicheng/utils";
|
|
3
|
+
import { get as S } from "es-toolkit/compat";
|
|
4
|
+
import { useFormValues as W } from "vee-validate";
|
|
5
|
+
import { injectRenderFormProps as j } from "./context.js";
|
|
6
|
+
function x(a, e) {
|
|
7
|
+
if (e.startsWith("[") && e.endsWith("]")) {
|
|
8
|
+
const h = e.slice(1, -1);
|
|
9
|
+
return a[h];
|
|
10
|
+
}
|
|
11
|
+
return S(a, e);
|
|
12
|
+
}
|
|
13
|
+
function _(a) {
|
|
14
|
+
var F;
|
|
15
|
+
const e = W(), t = j().form;
|
|
16
|
+
if (!e)
|
|
17
|
+
throw new Error("useDependencies should be used within <TtForm>");
|
|
18
|
+
const s = u(!0), l = u(!1), n = u(!0), w = u(!1), g = u({}), d = u(), b = C(() => {
|
|
19
|
+
var r;
|
|
20
|
+
return (((r = a()) == null ? void 0 : r.triggerFields) ?? []).map((f) => x(e.value, f));
|
|
21
|
+
}), q = () => {
|
|
22
|
+
l.value = !1, s.value = !0, n.value = !0, w.value = !1, d.value = void 0, g.value = {};
|
|
23
|
+
};
|
|
24
|
+
return I(
|
|
25
|
+
[b, a],
|
|
26
|
+
async ([B, r]) => {
|
|
27
|
+
var V;
|
|
28
|
+
if (!r || !((V = r == null ? void 0 : r.triggerFields) != null && V.length))
|
|
29
|
+
return;
|
|
30
|
+
q();
|
|
31
|
+
const { componentProps: f, disabled: m, if: v, required: y, rules: P, show: c, trigger: R } = r, i = e.value;
|
|
32
|
+
if (o(v)) {
|
|
33
|
+
if (s.value = !!await v(i, t), !s.value) return;
|
|
34
|
+
} else if (p(v) && (s.value = v, !s.value))
|
|
35
|
+
return;
|
|
36
|
+
o(c) ? n.value = !!await c(i, t) : p(c) && (n.value = c), o(f) && (g.value = await f(i, t)), o(P) && (d.value = await P(i, t)), o(m) ? l.value = !!await m(i, t) : p(m) && (l.value = m), o(y) && (w.value = !!await y(i, t)), o(R) && await R(i, t);
|
|
37
|
+
},
|
|
38
|
+
{ deep: !0, immediate: ((F = a()) == null ? void 0 : F.immediate) ?? !0 }
|
|
39
|
+
), {
|
|
40
|
+
dynamicComponentProps: g,
|
|
41
|
+
dynamicRules: d,
|
|
42
|
+
isDisabled: l,
|
|
43
|
+
isIf: s,
|
|
44
|
+
isRequired: w,
|
|
45
|
+
isShow: n
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
_ as default,
|
|
50
|
+
x as resolveValueByFieldName
|
|
51
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useTemplateRef as b, ref as f, computed as k, watch as x, nextTick as m, onMounted as C } from "vue";
|
|
2
|
+
import { useElementVisibility as B, useBreakpoints as I, breakpointsTailwind as S } from "@vueuse/core";
|
|
3
|
+
function M(o) {
|
|
4
|
+
const n = b("wrapperRef"), w = B(n), i = f({}), r = f(!1), d = I(S), v = k(() => {
|
|
5
|
+
const e = o.collapsedRows ?? 1, t = i.value;
|
|
6
|
+
let s = 0;
|
|
7
|
+
for (let a = 1; a <= e; a++)
|
|
8
|
+
s += (t == null ? void 0 : t[a]) ?? 0;
|
|
9
|
+
return s - 1 || 1;
|
|
10
|
+
});
|
|
11
|
+
x(
|
|
12
|
+
[
|
|
13
|
+
() => o.showCollapseButton,
|
|
14
|
+
() => d.active().value,
|
|
15
|
+
() => {
|
|
16
|
+
var e;
|
|
17
|
+
return (e = o.schema) == null ? void 0 : e.length;
|
|
18
|
+
},
|
|
19
|
+
() => w.value
|
|
20
|
+
],
|
|
21
|
+
async ([e]) => {
|
|
22
|
+
e && (await m(), i.value = {}, r.value = !1, await c());
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
async function c() {
|
|
26
|
+
if (!o.showCollapseButton || (await m(), !n.value))
|
|
27
|
+
return;
|
|
28
|
+
const e = Array.from(n.value.children), t = n.value, a = window.getComputedStyle(t).getPropertyValue("grid-template-rows").split(" "), g = t == null ? void 0 : t.getBoundingClientRect();
|
|
29
|
+
e.forEach((p) => {
|
|
30
|
+
const R = p.getBoundingClientRect().top - g.top;
|
|
31
|
+
let l = 0, u = 0;
|
|
32
|
+
for (const [h, y] of a.entries())
|
|
33
|
+
if (u += Number.parseFloat(y), R < u) {
|
|
34
|
+
l = h + 1;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
l > ((o == null ? void 0 : o.collapsedRows) ?? 1) || (i.value[l] = (i.value[l] ?? 0) + 1, r.value = !0);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return C(() => {
|
|
41
|
+
c();
|
|
42
|
+
}), { isCalculated: r, keepFormItemIndex: v, wrapperRef: n };
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
M as useExpandable
|
|
46
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { defineComponent as ee, useSlots as oe, computed as n, createBlock as C, openBlock as p, resolveDynamicComponent as D, normalizeProps as re, guardReactiveProps as te, withCtx as g, createElementVNode as le, normalizeClass as y, createElementBlock as f, renderSlot as d, Fragment as v, renderList as M, unref as b, mergeProps as R, createSlots as se } from "vue";
|
|
2
|
+
import "../components/Slot.js";
|
|
3
|
+
import { isString as ne, mergeWithArrayOverride as ae, isFunction as pe, clnm as w } from "@dazhicheng/utils";
|
|
4
|
+
import { Form as me } from "vee-validate";
|
|
5
|
+
import "../../../tt-form-item-error-tooltip/index.js";
|
|
6
|
+
import "../../../tt-icon/index.js";
|
|
7
|
+
import "@vueuse/core";
|
|
8
|
+
import "element-plus";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import "../form/RenderContent.vue.js";
|
|
11
|
+
import { provideFormRenderProps as ie } from "./context.js";
|
|
12
|
+
import { useExpandable as ue } from "./expandable.js";
|
|
13
|
+
import { FORM_RENDER_DEFAULT_WRAPPER_CLASS as fe, getFormRootWrapperClass as de } from "./rootWrapperClass.js";
|
|
14
|
+
import { FieldRenderer as ce } from "./FormFieldContact.js";
|
|
15
|
+
import { getBaseRules as Ce, getDefaultValueInZodStack as ge } from "./helper.js";
|
|
16
|
+
import { useDesign as ye } from "@dazhicheng/hooks";
|
|
17
|
+
const De = /* @__PURE__ */ ee({
|
|
18
|
+
name: "FormRender",
|
|
19
|
+
__name: "form",
|
|
20
|
+
props: {
|
|
21
|
+
arrayToStringFields: {},
|
|
22
|
+
collapsed: { type: Boolean },
|
|
23
|
+
collapsedRows: { default: 1 },
|
|
24
|
+
collapseTriggerResize: { type: Boolean },
|
|
25
|
+
commonConfig: { default: () => ({}) },
|
|
26
|
+
compact: { type: Boolean },
|
|
27
|
+
componentBindEventMap: {},
|
|
28
|
+
componentMap: {},
|
|
29
|
+
fieldMappingTime: {},
|
|
30
|
+
form: {},
|
|
31
|
+
layout: {},
|
|
32
|
+
schema: {},
|
|
33
|
+
showCollapseButton: { type: Boolean, default: !1 },
|
|
34
|
+
wrapperClass: { default: fe },
|
|
35
|
+
globalCommonConfig: { default: () => ({}) }
|
|
36
|
+
},
|
|
37
|
+
emits: ["submit"],
|
|
38
|
+
setup(A, { expose: T, emit: W }) {
|
|
39
|
+
const r = A, F = W, z = oe(), V = n(
|
|
40
|
+
() => de({
|
|
41
|
+
layout: r.layout,
|
|
42
|
+
compact: r.compact,
|
|
43
|
+
wrapperClass: r.wrapperClass
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
ie(r);
|
|
47
|
+
const { prefixCls: P } = ye("form-render"), u = r.form;
|
|
48
|
+
function i(e) {
|
|
49
|
+
return e && e.type === "slot";
|
|
50
|
+
}
|
|
51
|
+
function Z(e) {
|
|
52
|
+
return !i(e) && !e.useArraySchema;
|
|
53
|
+
}
|
|
54
|
+
const _ = n(() => ({
|
|
55
|
+
values: (u == null ? void 0 : u.values) ?? {},
|
|
56
|
+
formActions: u
|
|
57
|
+
})), { isCalculated: q, keepFormItemIndex: h, wrapperRef: k } = ue(r), j = n(() => {
|
|
58
|
+
const e = [];
|
|
59
|
+
return (r.schema || []).forEach((a) => {
|
|
60
|
+
if (i(a)) return;
|
|
61
|
+
const { fieldName: o } = a, l = a.rules;
|
|
62
|
+
let s = "";
|
|
63
|
+
l && !ne(l) && (s = l.def.type);
|
|
64
|
+
const m = Ce(l);
|
|
65
|
+
e.push({
|
|
66
|
+
default: ge(l),
|
|
67
|
+
fieldName: o,
|
|
68
|
+
required: !["ZodNullable", "ZodOptional"].includes(s),
|
|
69
|
+
rules: m
|
|
70
|
+
});
|
|
71
|
+
}), e;
|
|
72
|
+
}), U = n(() => r.form ? "form" : me), G = n(() => r.form ? {
|
|
73
|
+
onSubmit: r.form.handleSubmit((e) => F("submit", e))
|
|
74
|
+
} : {
|
|
75
|
+
onSubmit: (e) => F("submit", e)
|
|
76
|
+
}), H = n(() => r.collapsed && q.value), J = n(() => {
|
|
77
|
+
const {
|
|
78
|
+
colon: e = !1,
|
|
79
|
+
componentProps: a = {},
|
|
80
|
+
controlClass: o = "",
|
|
81
|
+
disabled: l,
|
|
82
|
+
disabledOnChangeListener: s = !0,
|
|
83
|
+
disabledOnInputListener: m = !0,
|
|
84
|
+
emptyStateValue: I = void 0,
|
|
85
|
+
formFieldProps: B = {},
|
|
86
|
+
formItemClass: Q = "",
|
|
87
|
+
hideLabel: S = !1,
|
|
88
|
+
hideRequiredMark: E = !1,
|
|
89
|
+
labelClass: N = "",
|
|
90
|
+
labelWidth: $ = 70,
|
|
91
|
+
modelPropName: x = "",
|
|
92
|
+
wrapperClass: X = ""
|
|
93
|
+
} = ae(r.commonConfig, r.globalCommonConfig);
|
|
94
|
+
let L = 0;
|
|
95
|
+
return (r.schema || []).map((t) => {
|
|
96
|
+
if (i(t)) return t;
|
|
97
|
+
if (!Z(t))
|
|
98
|
+
return {
|
|
99
|
+
colon: e,
|
|
100
|
+
disabled: l,
|
|
101
|
+
disabledOnChangeListener: s,
|
|
102
|
+
disabledOnInputListener: m,
|
|
103
|
+
emptyStateValue: I,
|
|
104
|
+
hideLabel: S,
|
|
105
|
+
hideRequiredMark: E,
|
|
106
|
+
labelWidth: $,
|
|
107
|
+
modelPropName: x,
|
|
108
|
+
commonComponentProps: a,
|
|
109
|
+
controlClass: o,
|
|
110
|
+
formFieldProps: B,
|
|
111
|
+
labelClass: N,
|
|
112
|
+
...t
|
|
113
|
+
};
|
|
114
|
+
const O = h.value, Y = r.showCollapseButton && H.value && O ? O <= L : !1;
|
|
115
|
+
L++;
|
|
116
|
+
let c = t.formItemClass;
|
|
117
|
+
if (pe(t.formItemClass))
|
|
118
|
+
try {
|
|
119
|
+
c = t.formItemClass();
|
|
120
|
+
} catch {
|
|
121
|
+
c = "";
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
colon: e,
|
|
125
|
+
disabled: l,
|
|
126
|
+
disabledOnChangeListener: s,
|
|
127
|
+
disabledOnInputListener: m,
|
|
128
|
+
emptyStateValue: I,
|
|
129
|
+
hideLabel: S,
|
|
130
|
+
hideRequiredMark: E,
|
|
131
|
+
labelWidth: $,
|
|
132
|
+
modelPropName: x,
|
|
133
|
+
wrapperClass: X,
|
|
134
|
+
...t,
|
|
135
|
+
commonComponentProps: a,
|
|
136
|
+
componentProps: t.componentProps,
|
|
137
|
+
controlClass: w(o, t.controlClass),
|
|
138
|
+
formFieldProps: {
|
|
139
|
+
...B,
|
|
140
|
+
...t.formFieldProps
|
|
141
|
+
},
|
|
142
|
+
formItemClass: w("flex-shrink-0", { hidden: Y }, Q, c),
|
|
143
|
+
labelClass: w(N, t.labelClass)
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
}), K = n(() => Object.keys(z).filter((e) => e !== "default"));
|
|
147
|
+
return T({
|
|
148
|
+
wrapperRef: n(() => k.value)
|
|
149
|
+
}), (e, a) => (p(), C(D(U.value), re(te(G.value)), {
|
|
150
|
+
default: g(() => [
|
|
151
|
+
le("div", {
|
|
152
|
+
ref_key: "wrapperRef",
|
|
153
|
+
ref: k,
|
|
154
|
+
class: y(V.value)
|
|
155
|
+
}, [
|
|
156
|
+
(p(!0), f(v, null, M(J.value, (o, l) => (p(), f(v, {
|
|
157
|
+
key: i(o) ? `slot-${l}` : o.fieldName
|
|
158
|
+
}, [
|
|
159
|
+
i(o) ? (p(), f(v, { key: 0 }, [
|
|
160
|
+
typeof o.content == "string" ? (p(), f("div", {
|
|
161
|
+
key: 0,
|
|
162
|
+
class: y([`${b(P)}__slot`, o.wrapperClass])
|
|
163
|
+
}, [
|
|
164
|
+
d(e.$slots, o.content, R({ ref_for: !0 }, _.value))
|
|
165
|
+
], 2)) : (p(), C(D(o.content(_.value)), {
|
|
166
|
+
key: 1,
|
|
167
|
+
class: y([`${b(P)}__slot`, o.wrapperClass])
|
|
168
|
+
}, null, 8, ["class"]))
|
|
169
|
+
], 64)) : (p(), C(b(ce), {
|
|
170
|
+
key: 1,
|
|
171
|
+
"field-config": o,
|
|
172
|
+
rules: o.rules
|
|
173
|
+
}, se({
|
|
174
|
+
default: g((s) => [
|
|
175
|
+
d(e.$slots, o.fieldName, R({ ref_for: !0 }, s))
|
|
176
|
+
]),
|
|
177
|
+
_: 2
|
|
178
|
+
}, [
|
|
179
|
+
M(K.value, (s) => ({
|
|
180
|
+
name: s,
|
|
181
|
+
fn: g((m) => [
|
|
182
|
+
d(e.$slots, s, R({ ref_for: !0 }, m))
|
|
183
|
+
])
|
|
184
|
+
}))
|
|
185
|
+
]), 1032, ["field-config", "rules"]))
|
|
186
|
+
], 64))), 128)),
|
|
187
|
+
d(e.$slots, "default", { shapes: j.value })
|
|
188
|
+
], 2)
|
|
189
|
+
]),
|
|
190
|
+
_: 3
|
|
191
|
+
}, 16));
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
export {
|
|
195
|
+
De as default
|
|
196
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isObject as i, isString as f } from "@dazhicheng/utils";
|
|
2
|
+
function t(e) {
|
|
3
|
+
return !e || f(e) ? null : "innerType" in e.def ? t(e.def.innerType) : "schema" in e.def ? t(e.def.schema) : e;
|
|
4
|
+
}
|
|
5
|
+
function r(e) {
|
|
6
|
+
if (!e || f(e))
|
|
7
|
+
return;
|
|
8
|
+
const n = e;
|
|
9
|
+
if (n.def.type === "default") return n.def.defaultValue;
|
|
10
|
+
if ("innerType" in n.def)
|
|
11
|
+
return r(n.def.innerType);
|
|
12
|
+
if ("schema" in n.def)
|
|
13
|
+
return r(n.def.schema);
|
|
14
|
+
}
|
|
15
|
+
function d(e) {
|
|
16
|
+
return !e || !i(e) ? !1 : Reflect.has(e, "target") && Reflect.has(e, "stopPropagation");
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
t as getBaseRules,
|
|
20
|
+
r as getDefaultValueInZodStack,
|
|
21
|
+
d as isEventObjectLike
|
|
22
|
+
};
|