el-plus 0.0.82 → 0.0.83
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/CHANGELOG.md +6 -0
- package/dist/index.css +1 -1
- package/dist/index.full.js +61 -12
- package/dist/index.full.min.js +4 -4
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +4 -4
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +62 -13
- package/es/components/attachment/src/attachment.vue2.mjs +12 -2
- package/es/components/attachment/src/attachment.vue2.mjs.map +1 -1
- package/es/components/form/index.d.ts +3 -0
- package/es/components/form/src/form-item-vue.mjs +1 -1
- package/es/components/form/src/form-item-vue.mjs.map +1 -1
- package/es/components/form/src/form.vue.d.ts +1 -0
- package/es/components/form/src/form.vue2.mjs +14 -3
- package/es/components/form/src/form.vue2.mjs.map +1 -1
- package/es/components/form/src/hooks/use-form-item.d.ts +1 -1
- package/es/components/form/src/hooks/use-form-item.mjs +7 -2
- package/es/components/form/src/hooks/use-form-item.mjs.map +1 -1
- package/es/components/form/src/hooks/use-form.d.ts +2 -0
- package/es/components/form/src/hooks/use-form.mjs +16 -2
- package/es/components/form/src/hooks/use-form.mjs.map +1 -1
- package/es/components/search-list-page/index.d.ts +18 -6
- package/es/components/search-list-page/src/search-list-page.vue.d.ts +6 -2
- package/es/components/search-list-page/src/use-search-list-page.d.ts +6 -2
- package/es/components/table/index.d.ts +3 -0
- package/es/components/table/src/table.vue.d.ts +1 -0
- package/es/components/table/src/table.vue2.mjs +2 -0
- package/es/components/table/src/table.vue2.mjs.map +1 -1
- package/es/components/table/src/use-table.d.ts +1 -0
- package/es/components/table/src/use-table.mjs +4 -0
- package/es/components/table/src/use-table.mjs.map +1 -1
- package/es/hooks/dialog/use-dialog.d.ts +1 -0
- package/es/hooks/dialog/use-dialog.mjs +3 -0
- package/es/hooks/dialog/use-dialog.mjs.map +1 -1
- package/es/hooks/use-template-promise.d.ts +1 -0
- package/es/hooks/use-template-promise.mjs +1 -1
- package/es/hooks/use-template-promise.mjs.map +1 -1
- package/es/package.json.mjs +1 -1
- package/lib/components/attachment/src/attachment.vue2.js +12 -2
- package/lib/components/attachment/src/attachment.vue2.js.map +1 -1
- package/lib/components/form/index.d.ts +3 -0
- package/lib/components/form/src/form-item-vue.js +1 -1
- package/lib/components/form/src/form-item-vue.js.map +1 -1
- package/lib/components/form/src/form.vue.d.ts +1 -0
- package/lib/components/form/src/form.vue2.js +14 -3
- package/lib/components/form/src/form.vue2.js.map +1 -1
- package/lib/components/form/src/hooks/use-form-item.d.ts +1 -1
- package/lib/components/form/src/hooks/use-form-item.js +7 -2
- package/lib/components/form/src/hooks/use-form-item.js.map +1 -1
- package/lib/components/form/src/hooks/use-form.d.ts +2 -0
- package/lib/components/form/src/hooks/use-form.js +15 -1
- package/lib/components/form/src/hooks/use-form.js.map +1 -1
- package/lib/components/search-list-page/index.d.ts +18 -6
- package/lib/components/search-list-page/src/search-list-page.vue.d.ts +6 -2
- package/lib/components/search-list-page/src/use-search-list-page.d.ts +6 -2
- package/lib/components/table/index.d.ts +3 -0
- package/lib/components/table/src/table.vue.d.ts +1 -0
- package/lib/components/table/src/table.vue2.js +2 -0
- package/lib/components/table/src/table.vue2.js.map +1 -1
- package/lib/components/table/src/use-table.d.ts +1 -0
- package/lib/components/table/src/use-table.js +4 -0
- package/lib/components/table/src/use-table.js.map +1 -1
- package/lib/hooks/dialog/use-dialog.d.ts +1 -0
- package/lib/hooks/dialog/use-dialog.js +3 -0
- package/lib/hooks/dialog/use-dialog.js.map +1 -1
- package/lib/hooks/use-template-promise.d.ts +1 -0
- package/lib/hooks/use-template-promise.js +1 -1
- package/lib/hooks/use-template-promise.js.map +1 -1
- package/lib/package.json.js +1 -1
- package/package.json +1 -1
- package/theme-chalk/attachment.css +1 -1
- package/theme-chalk/header.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/attachment.scss +3 -0
- package/theme-chalk/src/header.scss +1 -1
- package/theme-chalk/src/table.scss +1 -0
- package/theme-chalk/src/title.scss +41 -43
- package/theme-chalk/table.css +1 -1
- package/theme-chalk/title.css +1 -1
package/dist/index.full.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! ElPlus v0.0.
|
|
1
|
+
/*! ElPlus v0.0.83 */
|
|
2
2
|
|
|
3
|
-
import { useAttrs, getCurrentInstance, inject, provide, ref, nextTick, defineComponent, computed, createVNode, Fragment, withDirectives, resolveComponent, mergeProps, resolveDirective, useTemplateRef, createTextVNode, h, mergeModels, useModel, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createCommentVNode, withCtx, renderSlot, renderList, createBlock, vShow, toDisplayString,
|
|
3
|
+
import { useAttrs, getCurrentInstance, inject, provide, ref, nextTick, defineComponent, computed, createVNode, Fragment, withDirectives, resolveComponent, mergeProps, resolveDirective, useTemplateRef, reactive, onBeforeUpdate, createTextVNode, h, mergeModels, useModel, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createCommentVNode, withCtx, renderSlot, renderList, createBlock, vShow, toDisplayString, useSlots, watch, onMounted, createSlots, normalizeProps, guardReactiveProps, markRaw, Transition, shallowReactive, isVNode, render, createElementVNode, toRaw } from 'vue';
|
|
4
4
|
import { buttonProps, useLocale as useLocale$1, ElLoading, ElMessage, ElMessageBox, formProps as formProps$1, formEmits as formEmits$1, ElTooltip, formItemProps as formItemProps$1, ElFormItem, ElForm, ElRow, ElCol, inputProps as inputProps$1, inputEmits as inputEmits$1, configProviderContextKey, ElConfigProvider, ElDialog, ElButton, ElTable, ElIcon, selectProps as selectProps$1, selectEmits as selectEmits$1, ElPageHeader, datePickerProps, linkProps as linkProps$1, ElSkeleton } from 'element-plus';
|
|
5
5
|
import { isFunction } from '@vue/shared';
|
|
6
6
|
import axios from 'axios';
|
|
@@ -806,16 +806,30 @@ const useForm$1 = (props) => {
|
|
|
806
806
|
const clearValidate = (props2) => {
|
|
807
807
|
return elFormRef.value.clearValidate(props2);
|
|
808
808
|
};
|
|
809
|
+
const formItemRenderRefs = reactive(/* @__PURE__ */ new Map());
|
|
810
|
+
onBeforeUpdate(() => {
|
|
811
|
+
formItemRenderRefs.clear();
|
|
812
|
+
});
|
|
813
|
+
const getFormItemRenderRef = (refName) => {
|
|
814
|
+
return formItemRenderRefs.get(refName);
|
|
815
|
+
};
|
|
816
|
+
const registerFormItemRenderRef = (refName, ref2) => {
|
|
817
|
+
if (refName && ref2) {
|
|
818
|
+
formItemRenderRefs.set(refName, ref2);
|
|
819
|
+
}
|
|
820
|
+
};
|
|
809
821
|
return {
|
|
810
822
|
filterFormItemList,
|
|
811
823
|
elFormRef,
|
|
812
824
|
validate,
|
|
813
825
|
resetFields,
|
|
814
|
-
clearValidate
|
|
826
|
+
clearValidate,
|
|
827
|
+
getFormItemRenderRef,
|
|
828
|
+
registerFormItemRenderRef
|
|
815
829
|
};
|
|
816
830
|
};
|
|
817
831
|
|
|
818
|
-
const useFormItemSlots = (props) => {
|
|
832
|
+
const useFormItemSlots = (props, emit) => {
|
|
819
833
|
const attrs = useAttrs();
|
|
820
834
|
const {
|
|
821
835
|
render,
|
|
@@ -856,7 +870,12 @@ const useFormItemSlots = (props) => {
|
|
|
856
870
|
disabled,
|
|
857
871
|
clearable: true,
|
|
858
872
|
...renderProps,
|
|
859
|
-
...events
|
|
873
|
+
...events,
|
|
874
|
+
ref: (el) => {
|
|
875
|
+
if (el) {
|
|
876
|
+
emit("registerFormItemRenderRef", el);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
860
879
|
}, renderScopedSlots) : formData[prop];
|
|
861
880
|
},
|
|
862
881
|
label: () => {
|
|
@@ -966,7 +985,7 @@ var EpFormItem = /* @__PURE__ */ defineComponent({
|
|
|
966
985
|
const attrs = useAttrs();
|
|
967
986
|
const {
|
|
968
987
|
scopedSlots
|
|
969
|
-
} = useFormItemSlots(props);
|
|
988
|
+
} = useFormItemSlots(props, emit);
|
|
970
989
|
const {
|
|
971
990
|
rules
|
|
972
991
|
} = useFormItemRules(props);
|
|
@@ -1016,7 +1035,15 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1016
1035
|
};
|
|
1017
1036
|
});
|
|
1018
1037
|
const formData = useModel(__props, "modelValue");
|
|
1019
|
-
const {
|
|
1038
|
+
const {
|
|
1039
|
+
filterFormItemList,
|
|
1040
|
+
elFormRef,
|
|
1041
|
+
validate,
|
|
1042
|
+
resetFields,
|
|
1043
|
+
clearValidate,
|
|
1044
|
+
getFormItemRenderRef,
|
|
1045
|
+
registerFormItemRenderRef
|
|
1046
|
+
} = useForm$1(props);
|
|
1020
1047
|
const { open, toggleStatus, isShowFoldBtn, isShowFormItem } = useCollapse(
|
|
1021
1048
|
{
|
|
1022
1049
|
filterFormItemList,
|
|
@@ -1029,7 +1056,8 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1029
1056
|
elFormRef,
|
|
1030
1057
|
validate,
|
|
1031
1058
|
resetFields,
|
|
1032
|
-
clearValidate
|
|
1059
|
+
clearValidate,
|
|
1060
|
+
getFormItemRenderRef
|
|
1033
1061
|
});
|
|
1034
1062
|
return (_ctx, _cache) => {
|
|
1035
1063
|
return openBlock(), createElementBlock("div", {
|
|
@@ -1062,7 +1090,9 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1062
1090
|
createVNode(unref(EpFormItem), mergeProps({
|
|
1063
1091
|
"form-data": formData.value,
|
|
1064
1092
|
"form-label-width": _ctx.labelWidth
|
|
1065
|
-
}, { ref_for: true }, item
|
|
1093
|
+
}, { ref_for: true }, item, {
|
|
1094
|
+
onRegisterFormItemRenderRef: (ref2) => unref(registerFormItemRenderRef)(item.props?.ref, ref2)
|
|
1095
|
+
}), null, 16, ["form-data", "form-label-width", "onRegisterFormItemRenderRef"])
|
|
1066
1096
|
]),
|
|
1067
1097
|
_: 2
|
|
1068
1098
|
}, 1032, ["class", "span"])), [
|
|
@@ -1320,7 +1350,7 @@ const useTemplatePromise = (options = {}) => {
|
|
|
1320
1350
|
const renderList = () => instances.value.map((props) => {
|
|
1321
1351
|
return withDirectives(h("div", {
|
|
1322
1352
|
// key: props.key,
|
|
1323
|
-
class:
|
|
1353
|
+
class: `ep-template-promise is-init ${options.class || ""}`
|
|
1324
1354
|
}, render ? render(props, ctx) : slots.default?.(props)), [[vShow, props.isVisible]]);
|
|
1325
1355
|
});
|
|
1326
1356
|
if (transition) return () => {
|
|
@@ -1352,10 +1382,12 @@ const useDialog = (options = {}) => {
|
|
|
1352
1382
|
onBeforeCancel,
|
|
1353
1383
|
cancelText,
|
|
1354
1384
|
showFooter = true,
|
|
1385
|
+
templatePromiseClass,
|
|
1355
1386
|
...dialogProps
|
|
1356
1387
|
} = options;
|
|
1357
1388
|
const Dialog = useTemplatePromise({
|
|
1358
1389
|
destroy: destroyOnClose,
|
|
1390
|
+
class: templatePromiseClass,
|
|
1359
1391
|
render: (promiseOptions, ctx) => {
|
|
1360
1392
|
for (const key in scopedSlots) {
|
|
1361
1393
|
scopedSlots[key] = scopedSlots[key].bind(null, promiseOptions);
|
|
@@ -1389,6 +1421,7 @@ const useDialog = (options = {}) => {
|
|
|
1389
1421
|
}), scopedSlots.footerInner?.(promiseOptions), createVNode(ElButton, {
|
|
1390
1422
|
"type": "primary",
|
|
1391
1423
|
"onClick": async () => {
|
|
1424
|
+
console.log(111);
|
|
1392
1425
|
if (onBeforeConfirm) {
|
|
1393
1426
|
await onBeforeConfirm(resolve);
|
|
1394
1427
|
}
|
|
@@ -2094,6 +2127,9 @@ const useTable$1 = (props) => {
|
|
|
2094
2127
|
const clearValidate = (props2) => {
|
|
2095
2128
|
return elFormRef.value.clearValidate(props2);
|
|
2096
2129
|
};
|
|
2130
|
+
const getSelectionRows = () => {
|
|
2131
|
+
return elTableRef.value.getSelectionRows();
|
|
2132
|
+
};
|
|
2097
2133
|
const formatActionButtons = (list, scope) => {
|
|
2098
2134
|
return list.map((item) => {
|
|
2099
2135
|
if (item.onClick) {
|
|
@@ -2115,6 +2151,7 @@ const useTable$1 = (props) => {
|
|
|
2115
2151
|
clearSelection,
|
|
2116
2152
|
resetFields,
|
|
2117
2153
|
clearValidate,
|
|
2154
|
+
getSelectionRows,
|
|
2118
2155
|
elFormRef,
|
|
2119
2156
|
elTableRef,
|
|
2120
2157
|
formatActionButtons,
|
|
@@ -2370,6 +2407,7 @@ var _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
2370
2407
|
resetFields,
|
|
2371
2408
|
clearValidate,
|
|
2372
2409
|
clearSelection,
|
|
2410
|
+
getSelectionRows,
|
|
2373
2411
|
loading,
|
|
2374
2412
|
search,
|
|
2375
2413
|
elFormRef,
|
|
@@ -2391,6 +2429,7 @@ var _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
2391
2429
|
resetFields,
|
|
2392
2430
|
clearValidate,
|
|
2393
2431
|
clearSelection,
|
|
2432
|
+
getSelectionRows,
|
|
2394
2433
|
search,
|
|
2395
2434
|
openCustomColumnDialog: () => {
|
|
2396
2435
|
customColumnRef.value?.open();
|
|
@@ -3712,11 +3751,20 @@ var _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3712
3751
|
const bem = createNameSpace("attachment");
|
|
3713
3752
|
const props = __props;
|
|
3714
3753
|
const modelValue = useModel(__props, "modelValue");
|
|
3715
|
-
const {
|
|
3754
|
+
const {
|
|
3755
|
+
columns,
|
|
3756
|
+
actionButtons,
|
|
3757
|
+
addAttachment,
|
|
3758
|
+
isNormalOpen,
|
|
3759
|
+
permission,
|
|
3760
|
+
onConfirm,
|
|
3761
|
+
onCancel,
|
|
3762
|
+
mode
|
|
3763
|
+
} = useAttachment(props, {
|
|
3716
3764
|
data: modelValue
|
|
3717
3765
|
});
|
|
3718
3766
|
const AttachmentDialog = useDialog({
|
|
3719
|
-
width: 850,
|
|
3767
|
+
width: isNormalOpen ? "" : 850,
|
|
3720
3768
|
center: true,
|
|
3721
3769
|
title: isNormalOpen ? "" : t("ep.attachment.manageAttachment"),
|
|
3722
3770
|
modal: !isNormalOpen,
|
|
@@ -3727,6 +3775,7 @@ var _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3727
3775
|
"dialog",
|
|
3728
3776
|
props.openType === "normal" ? props.openType : ""
|
|
3729
3777
|
),
|
|
3778
|
+
templatePromiseClass: bem.e("promise"),
|
|
3730
3779
|
onConfirm: async (resolve) => {
|
|
3731
3780
|
onConfirm(resolve);
|
|
3732
3781
|
},
|
|
@@ -4296,7 +4345,7 @@ var components = [
|
|
|
4296
4345
|
EpUniVue
|
|
4297
4346
|
];
|
|
4298
4347
|
|
|
4299
|
-
var version = "0.0.
|
|
4348
|
+
var version = "0.0.83";
|
|
4300
4349
|
|
|
4301
4350
|
var globalProperties = {
|
|
4302
4351
|
install(app) {
|
|
@@ -25,11 +25,20 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
25
25
|
const bem = createNameSpace("attachment");
|
|
26
26
|
const props = __props;
|
|
27
27
|
const modelValue = useModel(__props, "modelValue");
|
|
28
|
-
const {
|
|
28
|
+
const {
|
|
29
|
+
columns,
|
|
30
|
+
actionButtons,
|
|
31
|
+
addAttachment,
|
|
32
|
+
isNormalOpen,
|
|
33
|
+
permission,
|
|
34
|
+
onConfirm,
|
|
35
|
+
onCancel,
|
|
36
|
+
mode
|
|
37
|
+
} = useAttachment(props, {
|
|
29
38
|
data: modelValue
|
|
30
39
|
});
|
|
31
40
|
const AttachmentDialog = useDialog({
|
|
32
|
-
width: 850,
|
|
41
|
+
width: isNormalOpen ? "" : 850,
|
|
33
42
|
center: true,
|
|
34
43
|
title: isNormalOpen ? "" : t("ep.attachment.manageAttachment"),
|
|
35
44
|
modal: !isNormalOpen,
|
|
@@ -40,6 +49,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40
49
|
"dialog",
|
|
41
50
|
props.openType === "normal" ? props.openType : ""
|
|
42
51
|
),
|
|
52
|
+
templatePromiseClass: bem.e("promise"),
|
|
43
53
|
onConfirm: async (resolve) => {
|
|
44
54
|
onConfirm(resolve);
|
|
45
55
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.vue2.mjs","sources":["../../../../../../packages/components/attachment/src/attachment.vue"],"sourcesContent":["<template>\n <ElButton\n v-if=\"props.isShowOpenDialogButton\"\n type=\"primary\"\n plain\n size=\"small\"\n :class=\"bem.e('handler')\"\n @click=\"open\"\n v-permission=\"permission\"\n >\n {{ t('ep.attachment.manageAttachment') }}({{ modelValue?.length || 0 }})\n </ElButton>\n <AttachmentDialog>\n <div style=\"margin-bottom: 10px; text-align: right\">\n <EpButtons\n v-if=\"props.openType === 'dialog' && mode !== 'browse'\"\n type=\"primary\"\n :list=\"[\n {\n name: t('ep.attachment.addAttachment'),\n type: 'primary',\n onClick: addAttachment,\n },\n ]\"\n />\n </div>\n\n <EpTable\n ref=\"tableRef\"\n :class=\"`${bem.b()} ${prepareClassNames()}`\"\n :style=\"{\n ...prepareStyles(),\n }\"\n :columns=\"columns\"\n :action-buttons=\"actionButtons\"\n
|
|
1
|
+
{"version":3,"file":"attachment.vue2.mjs","sources":["../../../../../../packages/components/attachment/src/attachment.vue"],"sourcesContent":["<template>\n <ElButton\n v-if=\"props.isShowOpenDialogButton\"\n type=\"primary\"\n plain\n size=\"small\"\n :class=\"bem.e('handler')\"\n @click=\"open\"\n v-permission=\"permission\"\n >\n {{ t('ep.attachment.manageAttachment') }}({{ modelValue?.length || 0 }})\n </ElButton>\n <AttachmentDialog>\n <div style=\"margin-bottom: 10px; text-align: right\">\n <EpButtons\n v-if=\"props.openType === 'dialog' && mode !== 'browse'\"\n type=\"primary\"\n :list=\"[\n {\n name: t('ep.attachment.addAttachment'),\n type: 'primary',\n onClick: addAttachment,\n },\n ]\"\n />\n </div>\n\n <EpTable\n ref=\"tableRef\"\n :class=\"`${bem.b()} ${prepareClassNames()}`\"\n :style=\"{\n ...prepareStyles(),\n }\"\n :columns=\"columns\"\n :action-buttons=\"actionButtons\"\n actionColWidth=\"110\"\n :data=\"modelValue\"\n v-bind=\"props\"\n >\n </EpTable>\n </AttachmentDialog>\n</template>\n<script setup lang=\"ts\">\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { prepareClassNames, prepareStyles } from '@el-plus/utils/props'\nimport { attachmentProps } from './attachment'\nimport EpTable from '@el-plus/components/table'\nimport { useAttachment } from './use-attachment'\nimport type { TableProps } from '@el-plus/components/table'\nimport { useDialog } from '@el-plus/hooks/dialog/use-dialog'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nimport { ElButton } from 'element-plus'\nimport { vPermission } from '@el-plus/directives'\n\nconst { t } = useLocale()\ndefineOptions({\n name: 'EpAttachment',\n inheritAttrs: false,\n})\nconst bem = createNameSpace('attachment')\nconst props = defineProps(attachmentProps)\nconst modelValue = defineModel<TableProps['data']>()\nconst {\n columns,\n actionButtons,\n addAttachment,\n isNormalOpen,\n permission,\n onConfirm,\n onCancel,\n mode,\n} = useAttachment(props, {\n data: modelValue,\n})\nconst AttachmentDialog = useDialog({\n width: isNormalOpen ? '' : 850,\n center: true,\n title: isNormalOpen ? '' : t('ep.attachment.manageAttachment'),\n modal: !isNormalOpen,\n showClose: !isNormalOpen,\n showFooter: !isNormalOpen,\n transition: isNormalOpen ? '' : 'dialog-fade',\n modalClass: bem.em(\n 'dialog',\n props.openType === 'normal' ? props.openType : '',\n ),\n templatePromiseClass: bem.e('promise'),\n onConfirm: async (resolve) => {\n onConfirm(resolve)\n },\n onCancel: (resolve) => {\n onCancel(resolve)\n },\n})\nconst open = AttachmentDialog.open\nif (isNormalOpen) {\n open()\n}\ndefineExpose({\n open,\n})\n</script>\n"],"names":["_useModel","_createBlock","_unref","_normalizeClass","_createTextVNode","_toDisplayString","_createVNode","_createElementVNode","_mergeProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsDA,IAAA,MAAM,EAAE,CAAA,EAAE,GAAI,SAAA,EAAU;AAKxB,IAAA,MAAM,GAAA,GAAM,gBAAgB,Y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,OAAA,EAASA,MAAA,OAAA,CAAA;AAAA,cACT,gBAAA,EAAgBA,MAAA,aAAA,CAAA;AAAA,cACjB,cAAA,EAAe,KAAA;AAAA,cACd,MAAM,UAAA,CAAA;AAAA,eACC,KAAK,CAAA,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAAA;;;;;;;;;;"}
|
|
@@ -68,6 +68,7 @@ export declare const EpForm: {
|
|
|
68
68
|
validate: () => import("element-plus").FormValidationResult;
|
|
69
69
|
resetFields: (props: import("element-plus").FormItemProp) => void;
|
|
70
70
|
clearValidate: (props: import("element-plus").FormItemProp) => void;
|
|
71
|
+
getFormItemRenderRef: (refName: string) => any;
|
|
71
72
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
72
73
|
toggleStatus: (status: boolean) => void;
|
|
73
74
|
validate: (prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => void;
|
|
@@ -165,6 +166,7 @@ export declare const EpForm: {
|
|
|
165
166
|
validate: () => import("element-plus").FormValidationResult;
|
|
166
167
|
resetFields: (props: import("element-plus").FormItemProp) => void;
|
|
167
168
|
clearValidate: (props: import("element-plus").FormItemProp) => void;
|
|
169
|
+
getFormItemRenderRef: (refName: string) => any;
|
|
168
170
|
}, {}, {}, {}, {
|
|
169
171
|
col: number;
|
|
170
172
|
size: import("element-plus/es/utils/index.js").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown>;
|
|
@@ -255,6 +257,7 @@ export declare const EpForm: {
|
|
|
255
257
|
validate: () => import("element-plus").FormValidationResult;
|
|
256
258
|
resetFields: (props: import("element-plus").FormItemProp) => void;
|
|
257
259
|
clearValidate: (props: import("element-plus").FormItemProp) => void;
|
|
260
|
+
getFormItemRenderRef: (refName: string) => any;
|
|
258
261
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
259
262
|
toggleStatus: (status: boolean) => void;
|
|
260
263
|
validate: (prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-item-vue.mjs","sources":["../../../../../../packages/components/form/src/form-item-vue.tsx"],"sourcesContent":["import { defineComponent, useAttrs } from 'vue'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { useFormItemRules, useFormItemSlots } from './hooks/use-form-item'\nimport { ElFormItem } from 'element-plus'\n\nimport { formItemProps, expandFormItemPropsKeys } from './form-item'\nimport {\n prepareProps,\n prepareEvents,\n prepareClassNames,\n prepareStyles,\n} from '@el-plus/utils/props'\nconst bem = createNameSpace('form-item')\nexport default defineComponent({\n name: 'EpFormItem',\n inheritAttrs: false,\n props: formItemProps,\n setup(props, { emit }) {\n // const {} = useFormItem(props)\n const attrs = useAttrs()\n const { scopedSlots } = useFormItemSlots(props)\n const { rules } = useFormItemRules(props)\n const { props: childProps, disabled, ...formItemProps } = props // eslint-disable-line\n return () => {\n return (\n <ElFormItem\n class={[\n bem.b(),\n bem.is('hide-label', !props.isShowLabel),\n prepareClassNames(),\n ]}\n style={prepareStyles()}\n v-slots={scopedSlots}\n {...{\n ...prepareProps(formItemProps, [...expandFormItemPropsKeys]),\n rules,\n 'label-width': attrs['form-label-width'],\n }}\n // scopedSlots={scopedSlots}\n // label={label}\n // prop={prop}\n // rules={mergeRules}\n // {...{ props: formItemProps }}\n />\n )\n }\n },\n})\n"],"names":["bem","createNameSpace","name","inheritAttrs","props","formItemProps","setup","emit","attrs","useAttrs","scopedSlots","useFormItemSlots","rules","useFormItemRules","childProps","disabled","_createVNode","ElFormItem","_mergeProps","b","is","isShowLabel","prepareClassNames","prepareStyles","prepareProps","expandFormItemPropsKeys"],"mappings":";;;;;;;AAYA,MAAMA,GAAAA,GAAMC,gBAAgB,WAAW,CAAA;AACvC,iDAA+B;AAAA,EAC7BC,IAAAA,EAAM,YAAA;AAAA,EACNC,YAAAA,EAAc,KAAA;AAAA,EACdC,KAAAA,EAAOC,aAAAA;AAAAA,EACPC,MAAMF,KAAAA,EAAO;AAAA,IAAEG;AAAAA,GAAK,EAAG;AAErB,IAAA,MAAMC,QAAQC,QAAAA,EAAS;AACvB,IAAA,MAAM;AAAA,MAAEC;AAAAA,KAAY,GAAIC,
|
|
1
|
+
{"version":3,"file":"form-item-vue.mjs","sources":["../../../../../../packages/components/form/src/form-item-vue.tsx"],"sourcesContent":["import { defineComponent, useAttrs } from 'vue'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { useFormItemRules, useFormItemSlots } from './hooks/use-form-item'\nimport { ElFormItem } from 'element-plus'\n\nimport { formItemProps, expandFormItemPropsKeys } from './form-item'\nimport {\n prepareProps,\n prepareEvents,\n prepareClassNames,\n prepareStyles,\n} from '@el-plus/utils/props'\nconst bem = createNameSpace('form-item')\nexport default defineComponent({\n name: 'EpFormItem',\n inheritAttrs: false,\n props: formItemProps,\n setup(props, { emit }) {\n // const {} = useFormItem(props)\n const attrs = useAttrs()\n const { scopedSlots } = useFormItemSlots(props,emit)\n const { rules } = useFormItemRules(props)\n const { props: childProps, disabled, ...formItemProps } = props // eslint-disable-line\n return () => {\n return (\n <ElFormItem\n class={[\n bem.b(),\n bem.is('hide-label', !props.isShowLabel),\n prepareClassNames(),\n ]}\n style={prepareStyles()}\n v-slots={scopedSlots}\n {...{\n ...prepareProps(formItemProps, [...expandFormItemPropsKeys]),\n rules,\n 'label-width': attrs['form-label-width'],\n }}\n // scopedSlots={scopedSlots}\n // label={label}\n // prop={prop}\n // rules={mergeRules}\n // {...{ props: formItemProps }}\n />\n )\n }\n },\n})\n"],"names":["bem","createNameSpace","name","inheritAttrs","props","formItemProps","setup","emit","attrs","useAttrs","scopedSlots","useFormItemSlots","rules","useFormItemRules","childProps","disabled","_createVNode","ElFormItem","_mergeProps","b","is","isShowLabel","prepareClassNames","prepareStyles","prepareProps","expandFormItemPropsKeys"],"mappings":";;;;;;;AAYA,MAAMA,GAAAA,GAAMC,gBAAgB,WAAW,CAAA;AACvC,iDAA+B;AAAA,EAC7BC,IAAAA,EAAM,YAAA;AAAA,EACNC,YAAAA,EAAc,KAAA;AAAA,EACdC,KAAAA,EAAOC,aAAAA;AAAAA,EACPC,MAAMF,KAAAA,EAAO;AAAA,IAAEG;AAAAA,GAAK,EAAG;AAErB,IAAA,MAAMC,QAAQC,QAAAA,EAAS;AACvB,IAAA,MAAM;AAAA,MAAEC;AAAAA,KAAY,GAAIC,gBAAAA,CAAiBP,KAAAA,EAAMG,IAAI,CAAA;AACnD,IAAA,MAAM;AAAA,MAAEK;AAAAA,KAAM,GAAIC,iBAAiBT,KAAK,CAAA;AACxC,IAAA,MAAM;AAAA,MAAEA,KAAAA,EAAOU,UAAAA;AAAAA,MAAYC,QAAAA;AAAAA,MAAU,GAAGV;AAAAA,KAAc,GAAID,KAAAA;AAC1D,IAAA,OAAO,MAAM;AACX,MAAA,OAAAY,WAAAA,CAAAC,YAAAC,UAAAA,CAAA;AAAA,QAAA,OAAA,EAEW,CACLlB,GAAAA,CAAImB,CAAAA,EAAE,EACNnB,GAAAA,CAAIoB,EAAAA,CAAG,YAAA,EAAc,CAAChB,KAAAA,CAAMiB,WAAW,CAAA,EACvCC,mBAAmB,CAAA;AAAA,QACpB,SACMC,aAAAA;AAAc,OAAC,EAAA;AAAA,QAGpB,GAAGC,YAAAA,CAAanB,cAAAA,EAAe,CAAC,GAAGoB,uBAAuB,CAAC,CAAA;AAAA,QAC3Db,KAAAA;AAAAA,QACA,aAAA,EAAeJ,MAAM,kBAAkB;AAAA,OAAC,GAJjCE,WAAW,CAAA;AAAA,IAa1B,CAAA;AAAA,EACF;AACF,CAAC,CAAA;;;;"}
|
|
@@ -65,6 +65,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
65
65
|
validate: () => import("element-plus").FormValidationResult;
|
|
66
66
|
resetFields: (props: import("element-plus").FormItemProp) => void;
|
|
67
67
|
clearValidate: (props: import("element-plus").FormItemProp) => void;
|
|
68
|
+
getFormItemRenderRef: (refName: string) => any;
|
|
68
69
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
69
70
|
toggleStatus: (status: boolean) => void;
|
|
70
71
|
validate: (prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => void;
|
|
@@ -35,7 +35,15 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
37
|
const formData = useModel(__props, "modelValue");
|
|
38
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
filterFormItemList,
|
|
40
|
+
elFormRef,
|
|
41
|
+
validate,
|
|
42
|
+
resetFields,
|
|
43
|
+
clearValidate,
|
|
44
|
+
getFormItemRenderRef,
|
|
45
|
+
registerFormItemRenderRef
|
|
46
|
+
} = useForm(props);
|
|
39
47
|
const { open, toggleStatus, isShowFoldBtn, isShowFormItem } = useCollapse(
|
|
40
48
|
{
|
|
41
49
|
filterFormItemList,
|
|
@@ -48,7 +56,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
48
56
|
elFormRef,
|
|
49
57
|
validate,
|
|
50
58
|
resetFields,
|
|
51
|
-
clearValidate
|
|
59
|
+
clearValidate,
|
|
60
|
+
getFormItemRenderRef
|
|
52
61
|
});
|
|
53
62
|
return (_ctx, _cache) => {
|
|
54
63
|
return openBlock(), createElementBlock("div", {
|
|
@@ -81,7 +90,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
81
90
|
createVNode(unref(EpFormItem), mergeProps({
|
|
82
91
|
"form-data": formData.value,
|
|
83
92
|
"form-label-width": _ctx.labelWidth
|
|
84
|
-
}, { ref_for: true }, item
|
|
93
|
+
}, { ref_for: true }, item, {
|
|
94
|
+
onRegisterFormItemRenderRef: (ref2) => unref(registerFormItemRenderRef)(item.props?.ref, ref2)
|
|
95
|
+
}), null, 16, ["form-data", "form-label-width", "onRegisterFormItemRenderRef"])
|
|
85
96
|
]),
|
|
86
97
|
_: 2
|
|
87
98
|
}, 1032, ["class", "span"])), [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.vue2.mjs","sources":["../../../../../../packages/components/form/src/form.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n bem.b(),\n prepareClassNames(),\n bem.is('open', open),\n bem.is('fold', isShowFoldBtn),\n ]\"\n :style=\"{\n ...prepareStyles(),\n }\"\n >\n <el-form ref=\"elFormRef\" :model=\"formData\" v-bind=\"customAttrs\">\n <slot>\n <el-row>\n <el-col\n v-for=\"(item, index) in filterFormItemList\"\n v-show=\"isShowFormItem(index)\"\n :key=\"item.prop || index\"\n :class=\"bem.e('col')\"\n :span=\"item.col || 24 / col\"\n >\n <FormItem\n :form-data=\"formData\"\n :form-label-width=\"labelWidth\"\n v-bind=\"item\"\n />\n </el-col>\n </el-row>\n </slot>\n </el-form>\n <div v-if=\"isShowFoldBtn\" :class=\"bem.e('fold')\" @click=\"toggleStatus\">\n {{ open ? t('ep.form.collapse') : t('ep.form.more') }}\n </div>\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { computed, reactive, ref, useTemplateRef } from 'vue'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport {\n formProps,\n formEmits,\n formEmitsKeys,\n expandFormPropsKeys,\n} from './form'\nimport type { FormEmits } from './form'\nimport {\n prepareProps,\n prepareEvents,\n prepareClassNames,\n prepareStyles,\n} from '@el-plus/utils/props'\nimport { ElForm, ElRow, ElCol } from 'element-plus'\nimport { useCollapse, useForm } from './hooks/use-form'\nimport FormItem from './form-item-vue'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nconst { t } = useLocale()\ndefineOptions({\n name: 'EpForm',\n inheritAttrs: false,\n})\nconst bem = createNameSpace('form')\nconst props = defineProps(formProps)\nconst emit = defineEmits(formEmits)\nconst customAttrs = computed(() => {\n return {\n ...prepareProps(props, ['modelValue', 'model', ...expandFormPropsKeys]),\n hideRequiredAsterisk: true, // 隐藏必填星号, 使用自己的*\n scrollToError: true,\n ...prepareEvents<FormEmits>(emit, formEmitsKeys),\n }\n})\nconst formData = defineModel<Record<string, unknown>>({\n default: () => reactive({}),\n})\n\nconst {
|
|
1
|
+
{"version":3,"file":"form.vue2.mjs","sources":["../../../../../../packages/components/form/src/form.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n bem.b(),\n prepareClassNames(),\n bem.is('open', open),\n bem.is('fold', isShowFoldBtn),\n ]\"\n :style=\"{\n ...prepareStyles(),\n }\"\n >\n <el-form ref=\"elFormRef\" :model=\"formData\" v-bind=\"customAttrs\">\n <slot>\n <el-row>\n <el-col\n v-for=\"(item, index) in filterFormItemList\"\n v-show=\"isShowFormItem(index)\"\n :key=\"item.prop || index\"\n :class=\"bem.e('col')\"\n :span=\"item.col || 24 / col\"\n >\n <FormItem\n :form-data=\"formData\"\n :form-label-width=\"labelWidth\"\n v-bind=\"item\"\n @registerFormItemRenderRef=\"\n (ref) => registerFormItemRenderRef(item.props?.ref, ref)\n \"\n />\n </el-col>\n </el-row>\n </slot>\n </el-form>\n <div v-if=\"isShowFoldBtn\" :class=\"bem.e('fold')\" @click=\"toggleStatus\">\n {{ open ? t('ep.form.collapse') : t('ep.form.more') }}\n </div>\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { computed, reactive, ref, useTemplateRef } from 'vue'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport {\n formProps,\n formEmits,\n formEmitsKeys,\n expandFormPropsKeys,\n} from './form'\nimport type { FormEmits } from './form'\nimport {\n prepareProps,\n prepareEvents,\n prepareClassNames,\n prepareStyles,\n} from '@el-plus/utils/props'\nimport { ElForm, ElRow, ElCol } from 'element-plus'\nimport { useCollapse, useForm } from './hooks/use-form'\nimport FormItem from './form-item-vue'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nconst { t } = useLocale()\ndefineOptions({\n name: 'EpForm',\n inheritAttrs: false,\n})\nconst bem = createNameSpace('form')\nconst props = defineProps(formProps)\nconst emit = defineEmits(formEmits)\nconst customAttrs = computed(() => {\n return {\n ...prepareProps(props, ['modelValue', 'model', ...expandFormPropsKeys]),\n hideRequiredAsterisk: true, // 隐藏必填星号, 使用自己的*\n scrollToError: true,\n ...prepareEvents<FormEmits>(emit, formEmitsKeys),\n }\n})\nconst formData = defineModel<Record<string, unknown>>({\n default: () => reactive({}),\n})\n\nconst {\n filterFormItemList,\n elFormRef,\n validate,\n resetFields,\n clearValidate,\n getFormItemRenderRef,\n registerFormItemRenderRef,\n} = useForm(props)\n\nconst { open, toggleStatus, isShowFoldBtn, isShowFormItem } = useCollapse(\n {\n filterFormItemList,\n isShowFold: props.isShowFold,\n showFieldCount: props.showFieldCount,\n },\n emit,\n)\n\ndefineExpose({\n elFormRef,\n validate,\n resetFields,\n clearValidate,\n getFormItemRenderRef\n})\n</script>\n"],"names":["_useModel","_createElementBlock","_normalizeClass","_unref","_normalizeStyle","_createVNode","_mergeProps","_renderSlot","_openBlock","_Fragment","_renderList","_createBlock","col","labelWidth","ref","_vShow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAA,MAAM,EAAE,CAAA,EAAE,GAAI,SAAA,EAAU;AAKxB,IAAA,MAAM,GAAA,GAAM,gBAAgB,MAAM,CAAA;AAClC,IAAA,MAAM,KAAA,GAAQ,OAAA;AACd,IAAA,MAAM,IAAA,GAAO,MAAA;AACb,IAAA,MAAM,WAAA,GAAc,SAAS,MAAM;AACjC,MAAA,OAAO;AAAA,QACL,GAAG,aAAa,KAAA,EAAO,CAAC,cAAc,OAAA,EAAS,GAAG,mBAAmB,CAAC,CAAA;AAAA,QACtE,oBAAA,EAAsB,IAAA;AAAA;AAAA,QACtB,aAAA,EAAe,IAAA;AAAA,QACf,GAAG,aAAA,CAAyB,IAAA,EAAM,aAAa;AAAA,OACjD;AAAA,IACF,CAAC,CAAA;AACD,IAAA,MAAM,QAAA,GAAWA,QAAA,CAAoC,OAAA,EAAA,YAEpD,CAA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ormItemProps } from '../form-item';
|
|
2
2
|
import type { FormItemRule } from 'element-plus';
|
|
3
3
|
export declare const useFormItem: () => {};
|
|
4
|
-
export declare const useFormItemSlots: (props: FormItemProps) => {
|
|
4
|
+
export declare const useFormItemSlots: (props: FormItemProps, emit: any) => {
|
|
5
5
|
scopedSlots: {
|
|
6
6
|
default: () => unknown;
|
|
7
7
|
label: () => import("vue/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { useLocale } from '../../../../hooks/use-locale.mjs';
|
|
|
5
5
|
const useFormItem = () => {
|
|
6
6
|
return {};
|
|
7
7
|
};
|
|
8
|
-
const useFormItemSlots = (props) => {
|
|
8
|
+
const useFormItemSlots = (props, emit) => {
|
|
9
9
|
const attrs = useAttrs();
|
|
10
10
|
const {
|
|
11
11
|
render,
|
|
@@ -46,7 +46,12 @@ const useFormItemSlots = (props) => {
|
|
|
46
46
|
disabled,
|
|
47
47
|
clearable: true,
|
|
48
48
|
...renderProps,
|
|
49
|
-
...events
|
|
49
|
+
...events,
|
|
50
|
+
ref: (el) => {
|
|
51
|
+
if (el) {
|
|
52
|
+
emit("registerFormItemRenderRef", el);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
50
55
|
}, renderScopedSlots) : formData[prop];
|
|
51
56
|
},
|
|
52
57
|
label: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form-item.mjs","sources":["../../../../../../../packages/components/form/src/hooks/use-form-item.tsx"],"sourcesContent":["import { h, resolveComponent, useAttrs, ref } from 'vue'\nimport type { FormItemProps } from '../form-item'\nimport type { FormItemRule } from 'element-plus'\nimport { ElTooltip } from 'element-plus'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nexport const useFormItem = () => {\n return {}\n}\nexport const useFormItemSlots = (props: FormItemProps) => {\n const attrs = useAttrs()\n const { render, labelRender } = props\n const prop = props.tableProp || props.prop\n const events: Record<string, (...args: any[]) => void> = {}\n for (const key in attrs) {\n if (key.startsWith('on')) {\n // 包装事件处理函数,确保在事件触发时使用最新的 scope\n // fix: table筛选后,点击事件触发时,scope.row仍为筛选前的行数据\n events[key] = (...args: any[]) => {\n const tableScope = attrs['table-scope']\n const eventFn = attrs[key] as (...args: any[]) => void\n return eventFn(...args, tableScope)\n }\n }\n }\n const isTipDisabled = ref(true) // 默认禁用提示\n const checkOverflow = (e: MouseEvent) => {\n const el = e.currentTarget as HTMLElement\n isTipDisabled.value = el.scrollWidth <= el.clientWidth\n }\n const scopedSlots = {\n default: () => {\n const formData = attrs['form-data'] as Record<string, unknown>\n const { scopedSlots: renderScopedSlots, ...renderProps } =\n props.props || {}\n let disabled = props.disabled\n if (typeof props.disabled === 'function') {\n disabled = props.disabled(formData)\n }\n return props.type\n ? h(\n resolveComponent(props.type),\n {\n modelValue: formData[prop as string],\n 'onUpdate:modelValue': (value: unknown) => {\n formData[prop as string] = value\n },\n disabled,\n clearable: true,\n ...renderProps,\n ...events,\n },\n renderScopedSlots,\n )\n : formData[prop as string]\n },\n label: () => {\n return (\n <ElTooltip\n placement=\"top\"\n effect=\"dark\"\n content={props.label}\n disabled={!props.isShowLabel || isTipDisabled.value}\n >\n <span\n onMouseenter={checkOverflow}\n style=\"display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\"\n >\n {!props.hideRequiredAsterisk && props.required ? (\n <span style=\"color: var(--el-color-danger);\">*</span>\n ) : null}\n {props.isShowLabel ? <span>{props.label}</span> : ''}\n </span>\n </ElTooltip>\n )\n },\n }\n\n if (labelRender) {\n scopedSlots.label = () => labelRender({ label: props.label })\n }\n if (render) {\n scopedSlots.default = () => {\n return render(attrs['table-scope'])\n }\n }\n return {\n scopedSlots,\n }\n}\nexport const useFormItemRules = (props: FormItemProps) => {\n const { t } = useLocale()\n const { required, rules, label } = props\n let mergeRules: FormItemRule[] = []\n if (required) {\n const requiredDefault = { required: true }\n mergeRules.push(requiredDefault)\n }\n if (rules) {\n if (Array.isArray(rules)) {\n mergeRules = mergeRules.concat(rules)\n }\n\n if (Object.prototype.toString.call(rules) === '[object Object]') {\n mergeRules.push(rules as FormItemRule)\n }\n }\n\n if (mergeRules) {\n mergeRules.forEach((r) => {\n if (r.required && typeof r.message === 'undefined') {\n r.message = `${label || ''}${t('ep.formItem.required')}`\n }\n })\n }\n return { rules: mergeRules }\n}\n"],"names":["useFormItem","useFormItemSlots","props","attrs","useAttrs","render","labelRender","prop","tableProp","events","key","startsWith","args","tableScope","eventFn","isTipDisabled","ref","checkOverflow","e","el","currentTarget","value","scrollWidth","clientWidth","scopedSlots","default","formData","renderScopedSlots","renderProps","disabled","type","h","resolveComponent","modelValue","clearable","label","_createVNode","ElTooltip","isShowLabel","hideRequiredAsterisk","required","_createTextVNode","useFormItemRules","t","useLocale","rules","mergeRules","requiredDefault","push","Array","isArray","concat","Object","prototype","toString","call","forEach","r","message"],"mappings":";;;;AAKO,MAAMA,cAAcA,MAAM;AAC/B,EAAA,OAAO,EAAC;AACV;AACO,MAAMC,
|
|
1
|
+
{"version":3,"file":"use-form-item.mjs","sources":["../../../../../../../packages/components/form/src/hooks/use-form-item.tsx"],"sourcesContent":["import { h, resolveComponent, useAttrs, ref } from 'vue'\nimport type { FormItemProps } from '../form-item'\nimport type { FormItemRule } from 'element-plus'\nimport { ElTooltip } from 'element-plus'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nexport const useFormItem = () => {\n return {}\n}\nexport const useFormItemSlots = (props: FormItemProps,emit) => {\n const attrs = useAttrs()\n const { render, labelRender } = props\n const prop = props.tableProp || props.prop\n const events: Record<string, (...args: any[]) => void> = {}\n for (const key in attrs) {\n if (key.startsWith('on')) {\n // 包装事件处理函数,确保在事件触发时使用最新的 scope\n // fix: table筛选后,点击事件触发时,scope.row仍为筛选前的行数据\n events[key] = (...args: any[]) => {\n const tableScope = attrs['table-scope']\n const eventFn = attrs[key] as (...args: any[]) => void\n return eventFn(...args, tableScope)\n }\n }\n }\n const isTipDisabled = ref(true) // 默认禁用提示\n const checkOverflow = (e: MouseEvent) => {\n const el = e.currentTarget as HTMLElement\n isTipDisabled.value = el.scrollWidth <= el.clientWidth\n }\n const scopedSlots = {\n default: () => {\n const formData = attrs['form-data'] as Record<string, unknown>\n const { scopedSlots: renderScopedSlots, ...renderProps } =\n props.props || {}\n let disabled = props.disabled\n if (typeof props.disabled === 'function') {\n disabled = props.disabled(formData)\n }\n return props.type\n ? h(\n resolveComponent(props.type),\n {\n modelValue: formData[prop as string],\n 'onUpdate:modelValue': (value: unknown) => {\n formData[prop as string] = value\n },\n disabled,\n clearable: true,\n ...renderProps,\n ...events,\n ref: (el: any) => {\n if (el) {\n emit('registerFormItemRenderRef', el)\n }\n },\n },\n renderScopedSlots,\n )\n : formData[prop as string]\n },\n label: () => {\n return (\n <ElTooltip\n placement=\"top\"\n effect=\"dark\"\n content={props.label}\n disabled={!props.isShowLabel || isTipDisabled.value}\n >\n <span\n onMouseenter={checkOverflow}\n style=\"display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\"\n >\n {!props.hideRequiredAsterisk && props.required ? (\n <span style=\"color: var(--el-color-danger);\">*</span>\n ) : null}\n {props.isShowLabel ? <span>{props.label}</span> : ''}\n </span>\n </ElTooltip>\n )\n },\n }\n\n if (labelRender) {\n scopedSlots.label = () => labelRender({ label: props.label })\n }\n if (render) {\n scopedSlots.default = () => {\n return render(attrs['table-scope'])\n }\n }\n return {\n scopedSlots,\n }\n}\nexport const useFormItemRules = (props: FormItemProps) => {\n const { t } = useLocale()\n const { required, rules, label } = props\n let mergeRules: FormItemRule[] = []\n if (required) {\n const requiredDefault = { required: true }\n mergeRules.push(requiredDefault)\n }\n if (rules) {\n if (Array.isArray(rules)) {\n mergeRules = mergeRules.concat(rules)\n }\n\n if (Object.prototype.toString.call(rules) === '[object Object]') {\n mergeRules.push(rules as FormItemRule)\n }\n }\n\n if (mergeRules) {\n mergeRules.forEach((r) => {\n if (r.required && typeof r.message === 'undefined') {\n r.message = `${label || ''}${t('ep.formItem.required')}`\n }\n })\n }\n return { rules: mergeRules }\n}\n"],"names":["useFormItem","useFormItemSlots","props","emit","attrs","useAttrs","render","labelRender","prop","tableProp","events","key","startsWith","args","tableScope","eventFn","isTipDisabled","ref","checkOverflow","e","el","currentTarget","value","scrollWidth","clientWidth","scopedSlots","default","formData","renderScopedSlots","renderProps","disabled","type","h","resolveComponent","modelValue","clearable","label","_createVNode","ElTooltip","isShowLabel","hideRequiredAsterisk","required","_createTextVNode","useFormItemRules","t","useLocale","rules","mergeRules","requiredDefault","push","Array","isArray","concat","Object","prototype","toString","call","forEach","r","message"],"mappings":";;;;AAKO,MAAMA,cAAcA,MAAM;AAC/B,EAAA,OAAO,EAAC;AACV;AACO,MAAMC,gBAAAA,GAAmBA,CAACC,KAAAA,EAAqBC,IAAAA,KAAS;AAC7D,EAAA,MAAMC,QAAQC,QAAAA,EAAS;AACvB,EAAA,MAAM;AAAA,IAAEC,MAAAA;AAAAA,IAAQC;AAAAA,GAAY,GAAIL,KAAAA;AAChC,EAAA,MAAMM,IAAAA,GAAON,KAAAA,CAAMO,SAAAA,IAAaP,KAAAA,CAAMM,IAAAA;AACtC,EAAA,MAAME,SAAmD,EAAC;AAC1D,EAAA,KAAA,MAAWC,OAAOP,KAAAA,EAAO;AACvB,IAAA,IAAIO,GAAAA,CAAIC,UAAAA,CAAW,IAAI,CAAA,EAAG;AAGxBF,MAAAA,MAAAA,CAAOC,GAAG,CAAA,GAAI,CAAA,GAAIE,IAAAA,KAAgB;AAChC,QAAA,MAAMC,UAAAA,GAAaV,MAAM,aAAa,CAAA;AACtC,QAAA,MAAMW,OAAAA,GAAUX,MAAMO,GAAG,CAAA;AACzB,QAAA,OAAOI,OAAAA,CAAQ,GAAGF,IAAAA,EAAMC,UAAU,CAAA;AAAA,MACpC,CAAA;AAAA,IACF;AAAA,EACF;AACA,EAAA,MAAME,aAAAA,GAAgBC,IAAI,IAAI,CAAA;AAC9B,EAAA,MAAMC,gBAAiBC,CAAAA,CAAAA,KAAkB;AACvC,IAAA,MAAMC,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QAAAA;AAAAA,IAAUK,KAAAA;AAAAA,IAAOV;AAAAA,GAAM,GAAIlC,KAAAA;AACnC,EAAA,IAAI6C,aAA6B,EAAA;AACjC,EAAA,IAAIN,QAAAA,EAAU;AACZ,IAAA,MAAMO,eAAAA,GAAkB;AAAA,MAAEP,QAAAA,EAAU;AAAA,KAAK;AACzCM,IAAAA,UAAAA,CAAWE,KAAKD,eAAe,CAAA;AAAA,EACjC;AACA,EAAA,IAAIF,KAAAA,EAAO;AACT,IAAA,IAAII,KAAAA,CAAMC,OAAAA,CAAQL,KAAK,CAAA,EAAG;AACxBC,MAAAA,UAAAA,GAAaA,UAAAA,CAAWK,OAAON,KAAK,CAAA;AAAA,IACtC;AAEA,IAAA,IAAIO,OAAOC,SAAAA,CAAUC,QAAAA,CAASC,IAAAA,CAAKV,KAAK,MAAM,iBAAA,EAAmB;AAC/DC,MAAAA,UAAAA,CAAWE,KAAKH,KAAqB,CAAA;AAAA,IACvC;AAAA,EACF;AAEA,EAAA,IAAIC,UAAAA,EAAY;AACdA,IAAAA,UAAAA,CAAWU,QAASC,CAAAA,CAAAA,KAAM;AACxB,MAAA,IAAIA,CAAAA,CAAEjB,QAAAA,IAAY,OAAOiB,CAAAA,CAAEC,YAAY,WAAA,EAAa;AAClDD,QAAAA,CAAAA,CAAEC,UAAU,CAAA,EAAGvB,KAAAA,IAAS,EAAE,CAAA,EAAGQ,CAAAA,CAAE,sBAAsB,CAAC,CAAA,CAAA;AAAA,MACxD;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AACA,EAAA,OAAO;AAAA,IAAEE,KAAAA,EAAOC;AAAAA,GAAW;AAC7B;;;;"}
|
|
@@ -21,5 +21,7 @@ export declare const useForm: (props: FormProps) => {
|
|
|
21
21
|
validate: () => import("element-plus").FormValidationResult;
|
|
22
22
|
resetFields: (props: FormItemProp) => void;
|
|
23
23
|
clearValidate: (props: FormItemProp) => void;
|
|
24
|
+
getFormItemRenderRef: (refName: string) => any;
|
|
25
|
+
registerFormItemRenderRef: (refName: string, ref: any) => void;
|
|
24
26
|
};
|
|
25
27
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useTemplateRef, computed, ref } from 'vue';
|
|
1
|
+
import { useTemplateRef, computed, reactive, onBeforeUpdate, ref } from 'vue';
|
|
2
2
|
|
|
3
3
|
const useCollapse = ({ isShowFold, showFieldCount, filterFormItemList }, emit) => {
|
|
4
4
|
const open = ref(false);
|
|
@@ -40,12 +40,26 @@ const useForm = (props) => {
|
|
|
40
40
|
const clearValidate = (props2) => {
|
|
41
41
|
return elFormRef.value.clearValidate(props2);
|
|
42
42
|
};
|
|
43
|
+
const formItemRenderRefs = reactive(/* @__PURE__ */ new Map());
|
|
44
|
+
onBeforeUpdate(() => {
|
|
45
|
+
formItemRenderRefs.clear();
|
|
46
|
+
});
|
|
47
|
+
const getFormItemRenderRef = (refName) => {
|
|
48
|
+
return formItemRenderRefs.get(refName);
|
|
49
|
+
};
|
|
50
|
+
const registerFormItemRenderRef = (refName, ref2) => {
|
|
51
|
+
if (refName && ref2) {
|
|
52
|
+
formItemRenderRefs.set(refName, ref2);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
43
55
|
return {
|
|
44
56
|
filterFormItemList,
|
|
45
57
|
elFormRef,
|
|
46
58
|
validate,
|
|
47
59
|
resetFields,
|
|
48
|
-
clearValidate
|
|
60
|
+
clearValidate,
|
|
61
|
+
getFormItemRenderRef,
|
|
62
|
+
registerFormItemRenderRef
|
|
49
63
|
};
|
|
50
64
|
};
|
|
51
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.mjs","sources":["../../../../../../../packages/components/form/src/hooks/use-form.ts"],"sourcesContent":["import { ref, computed, useTemplateRef, type SetupContext } from 'vue'\nimport type { FormItemProps } from '../form-item'\nimport type { FormProps, FormEmits } from '../form'\nimport type { FormInstance, FormItemProp } from 'element-plus'\n\ninterface UseCollapseParams {\n isShowFold: boolean\n showFieldCount: number\n filterFormItemList: { value: FormItemProps[] }\n}\nexport const useCollapse = (\n { isShowFold, showFieldCount, filterFormItemList }: UseCollapseParams,\n emit: SetupContext<FormEmits>['emit'],\n) => {\n const open = ref(false)\n const toggleStatus = () => {\n open.value = !open.value\n emit('toggleStatus', open.value)\n }\n // 是否显示折叠按钮\n const isShowFoldBtn = computed(() => {\n return isShowFold && filterFormItemList.value.length > showFieldCount\n })\n // 展开收起隐藏formItem逻辑\n const isShowFormItem = (index: number) => {\n return index < showFieldCount || open.value || !isShowFoldBtn.value\n }\n return {\n open,\n toggleStatus,\n isShowFoldBtn,\n isShowFormItem,\n }\n}\n\nexport const useForm = (props: FormProps) => {\n const elFormRef = useTemplateRef<FormInstance>('elFormRef')\n const filterFormItemList = computed(() => {\n return (props.formItemList || []).filter((item: FormItemProps) => {\n if ('show' in item) {\n return typeof item.show === 'function' ? item.show(item) : item.show\n } else if ('hide' in item) {\n return typeof item.hide === 'function' ? !item.hide(item) : !item.hide\n }\n return true\n })\n })\n // 校验\n const validate = () => {\n return elFormRef.value!.validate()\n }\n // 重置校验\n const resetFields = (props: FormItemProp) => {\n return elFormRef.value!.resetFields(props)\n }\n // 清理某个字段的表单验证信息\n const clearValidate = (props: FormItemProp) => {\n return elFormRef.value!.clearValidate(props)\n }\n\n return {\n filterFormItemList,\n elFormRef,\n validate,\n resetFields,\n clearValidate,\n }\n}\n"],"names":["props"],"mappings":";;AAUO,MAAM,cAAc,CACzB,EAAE,YAAY,cAAA,EAAgB,kBAAA,IAC9B,IAAA,KACG;AACH,EAAA,MAAM,IAAA,GAAO,IAAI,KAAK,CAAA;AACtB,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,IAAA,CAAK,KAAA,GAAQ,CAAC,IAAA,CAAK,KAAA;AACnB,IAAA,IAAA,CAAK,cAAA,EAAgB,KAAK,KAAK,CAAA;AAAA,EACjC,CAAA;AAEA,EAAA,MAAM,aAAA,GAAgB,SAAS,MAAM;AACnC,IAAA,OAAO,UAAA,IAAc,kB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,IAAA,OAAO,SAAA,CAAU,KAAA,CAAO,aAAA,CAAcA,MAAK,CAAA;AAAA,EAC7C,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,kBAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"use-form.mjs","sources":["../../../../../../../packages/components/form/src/hooks/use-form.ts"],"sourcesContent":["import { ref, reactive, computed, useTemplateRef, type SetupContext, onBeforeUpdate } from 'vue'\nimport type { FormItemProps } from '../form-item'\nimport type { FormProps, FormEmits } from '../form'\nimport type { FormInstance, FormItemProp } from 'element-plus'\n\ninterface UseCollapseParams {\n isShowFold: boolean\n showFieldCount: number\n filterFormItemList: { value: FormItemProps[] }\n}\nexport const useCollapse = (\n { isShowFold, showFieldCount, filterFormItemList }: UseCollapseParams,\n emit: SetupContext<FormEmits>['emit'],\n) => {\n const open = ref(false)\n const toggleStatus = () => {\n open.value = !open.value\n emit('toggleStatus', open.value)\n }\n // 是否显示折叠按钮\n const isShowFoldBtn = computed(() => {\n return isShowFold && filterFormItemList.value.length > showFieldCount\n })\n // 展开收起隐藏formItem逻辑\n const isShowFormItem = (index: number) => {\n return index < showFieldCount || open.value || !isShowFoldBtn.value\n }\n return {\n open,\n toggleStatus,\n isShowFoldBtn,\n isShowFormItem,\n }\n}\n\nexport const useForm = (props: FormProps) => {\n const elFormRef = useTemplateRef<FormInstance>('elFormRef')\n const filterFormItemList = computed(() => {\n return (props.formItemList || []).filter((item: FormItemProps) => {\n if ('show' in item) {\n return typeof item.show === 'function' ? item.show(item) : item.show\n } else if ('hide' in item) {\n return typeof item.hide === 'function' ? !item.hide(item) : !item.hide\n }\n return true\n })\n })\n // 校验\n const validate = () => {\n return elFormRef.value!.validate()\n }\n // 重置校验\n const resetFields = (props: FormItemProp) => {\n return elFormRef.value!.resetFields(props)\n }\n // 清理某个字段的表单验证信息\n const clearValidate = (props: FormItemProp) => {\n return elFormRef.value!.clearValidate(props)\n }\n // 存储form-item的ref\n const formItemRenderRefs = reactive(new Map())\n // 每次更新前清空,防止内存泄漏或引用过时\n onBeforeUpdate(() => {\n formItemRenderRefs.clear();\n });\n // 获取form-item渲染render的ref\n const getFormItemRenderRef = (refName: string) => {\n return formItemRenderRefs.get(refName)\n }\n // 注册form-item的ref\n const registerFormItemRenderRef = (refName: string, ref: any) => {\n if (refName && ref) {\n formItemRenderRefs.set(refName, ref)\n }\n }\n\n return {\n filterFormItemList,\n elFormRef,\n validate,\n resetFields,\n clearValidate,\n getFormItemRenderRef,\n registerFormItemRenderRef,\n }\n}\n"],"names":["props","ref"],"mappings":";;AAUO,MAAM,cAAc,CACzB,EAAE,YAAY,cAAA,EAAgB,kBAAA,IAC9B,IAAA,KACG;AACH,EAAA,MAAM,IAAA,GAAO,IAAI,KAAK,CAAA;AACtB,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,IAAA,CAAK,KAAA,GAAQ,CAAC,IAAA,CAAK,KAAA;AACnB,IAAA,IAAA,CAAK,cAAA,EAAgB,KAAK,KAAK,CAAA;AAAA,EACjC,CAAA;AAEA,EAAA,MAAM,aAAA,GAAgB,SAAS,MAAM;AACnC,IAAA,OAAO,UAAA,IAAc,kBAAA,CAAmB,KAAA,CAAM,MAAA,GAAS,cAAA;AAAA,EACzD,CAAC,CAAA;AAED,EAAA,MAAM,cAAA,GAAiB,CAAC,KAAA,KAAkB;AACxC,IAAA,OAAO,KAAA,GAAQ,cAAA,IAAkB,IAAA,CAAK,KAAA,IAAS,CAAC,aAAA,CAAc,KAAA;AAAA,EAChE,CAAA;AACA,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACF;AACF;AAEO,MAAM,OAAA,GAAU,CAAC,KAAA,KAAqB;AAC3C,EAAA,MAAM,SAAA,GAAY,eAA6B,WAAW,CAAA;AAC1D,EAAA,MAAM,kBAAA,GAAqB,SAAS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