knt-shared 1.2.2 → 1.2.4
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/components/Form/componentMap.d.ts +7 -0
- package/dist/components/Form/componentMap.d.ts.map +1 -1
- package/dist/components/Form/useForm.d.ts +1 -4
- package/dist/components/Form/useForm.d.ts.map +1 -1
- package/dist/components/Modal/BasicModal.vue.d.ts.map +1 -1
- package/dist/components/Modal/useModal.d.ts.map +1 -1
- package/dist/components/Upload/BasicUpload.vue.d.ts.map +1 -1
- package/dist/index.cjs.js +77 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +78 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +52 -27
- package/package.json +1 -1
|
@@ -1328,4 +1328,11 @@ export declare const componentsNeedSelectPlaceholder: Set<string>;
|
|
|
1328
1328
|
* @returns placeholder 文本
|
|
1329
1329
|
*/
|
|
1330
1330
|
export declare function getPlaceholder(component: string, label: string): string;
|
|
1331
|
+
/**
|
|
1332
|
+
* 根据组件类型生成默认规则
|
|
1333
|
+
* @param component 组件类型
|
|
1334
|
+
* @param label 标签文本
|
|
1335
|
+
* @returns 规则
|
|
1336
|
+
*/
|
|
1337
|
+
export declare function getRules(component: string, label: string): any[];
|
|
1331
1338
|
//# sourceMappingURL=componentMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentMap.d.ts","sourceRoot":"","sources":["../../../src/components/Form/componentMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EACL,KAAK,EAqBN,MAAM,sBAAsB,CAAC;AAG9B;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;oBAyBzB;;uBAEG;oBACH,CAJA;;;;;;;;;;;;;;2BAsBG,CAAC;2BAGD,CAAC;;;;;;;;;;;;;;mBAmBK,CAAC;mBAMP,CAAC;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA3F91N,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,YAAY,CAAC;AAOtD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,QAEnE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAU5E;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,aAKpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B,aAO1C,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQvE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,CAQhE"}
|
|
@@ -6,10 +6,7 @@ import { FormSchema, UseFormOptions, UseFormReturn } from './types';
|
|
|
6
6
|
* @param options 表单配置选项
|
|
7
7
|
* @returns [register, formMethods]
|
|
8
8
|
*/
|
|
9
|
-
export declare function useForm(options?: UseFormOptions): [
|
|
10
|
-
(formInstance: any) => void,
|
|
11
|
-
Omit<UseFormReturn, 'register'>
|
|
12
|
-
];
|
|
9
|
+
export declare function useForm(options?: UseFormOptions): [(formInstance: any) => void, Omit<UseFormReturn, 'register'>];
|
|
13
10
|
/**
|
|
14
11
|
* 创建表单配置
|
|
15
12
|
* 用于快速创建表单 schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../src/components/Form/useForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,SAAS,CAAC;AAEzF;;;;;GAKG;AACH,wBAAgB,OAAO,
|
|
1
|
+
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../src/components/Form/useForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,SAAS,CAAC;AAEzF;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,OAAO,GAAE,cAAmB,GAC3B,CAAC,CAAC,YAAY,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAiWhE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAKpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,GAAG,UAAU,EAAE,CAEzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/BasicModal.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BasicModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/BasicModal.vue"],"names":[],"mappings":"AAkGA;AAQE,OAAO,KAAK,EAAE,eAAe,EAAc,YAAY,EAAE,MAAM,SAAS,CAAC;AAgV3E,iBAAS,cAAc;mBAmbK,GAAG;qBACD,GAAG;oBACH,GAAG;0BACG,GAAG;0BACH,GAAG;0BACH,GAAG;EAGtC;AAwBD,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAQnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AACxG,KAAK,sBAAsB,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,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"useModal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/useModal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAA0B,MAAM,SAAS,CAAC;AAE3F;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,kBAAkB,CA2F7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicUpload.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Upload/BasicUpload.vue"],"names":[],"mappings":"AA0DA;AAKE,OAAO,KAAK,EACV,gBAAgB,EAEhB,cAAc,EAEf,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"BasicUpload.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Upload/BasicUpload.vue"],"names":[],"mappings":"AA0DA;AAKE,OAAO,KAAK,EACV,gBAAgB,EAEhB,cAAc,EAEf,MAAM,SAAS,CAAC;AAkpBnB,iBAAS,cAAc;6BA6Pe,GAAG;qBACX,GAAG;iBACP,GAAG;;;QACF,GAAG;EAG7B;AAsBD,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;uBAnbO,cAAc;;uBAiBhB,cAAc,EAAE;uBAOd,cAAc;4BAOT,OAAO,CAAC,gBAAgB,CAAC;yBAO5B,cAAc,EAAE;oBAQrB,cAAc;2BAQP,cAAc;2BAWd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EA0X5C,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC;AACxD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -710,6 +710,9 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
710
710
|
},
|
|
711
711
|
emits: ["register", "update:modelValue", "change", "success", "handleSuccess", "error", "handlError", "progress", "remove", "preview", "exceed"],
|
|
712
712
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
713
|
+
vue.useCssVars((_ctx) => ({
|
|
714
|
+
"v439946ba": cardSizeValue.value
|
|
715
|
+
}));
|
|
713
716
|
const props = __props;
|
|
714
717
|
const emit = __emit;
|
|
715
718
|
const uploadRef = vue.ref();
|
|
@@ -729,6 +732,9 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
729
732
|
}
|
|
730
733
|
return false;
|
|
731
734
|
});
|
|
735
|
+
const cardSizeValue = vue.computed(() => {
|
|
736
|
+
return `${getProps.value.cardSize || 80}px`;
|
|
737
|
+
});
|
|
732
738
|
const getBindValue = vue.computed(() => {
|
|
733
739
|
const propsData = vue.unref(getProps);
|
|
734
740
|
return {
|
|
@@ -1120,8 +1126,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1120
1126
|
key: 0,
|
|
1121
1127
|
class: "upload-card-button",
|
|
1122
1128
|
style: vue.normalizeStyle({
|
|
1123
|
-
width:
|
|
1124
|
-
height:
|
|
1129
|
+
width: cardSizeValue.value,
|
|
1130
|
+
height: cardSizeValue.value
|
|
1125
1131
|
})
|
|
1126
1132
|
}, [
|
|
1127
1133
|
vue.createVNode(vue.unref(IconPlus), { size: 16 }),
|
|
@@ -1177,7 +1183,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
1177
1183
|
}
|
|
1178
1184
|
return target;
|
|
1179
1185
|
};
|
|
1180
|
-
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
1186
|
+
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-c83c45f0"]]);
|
|
1181
1187
|
const componentMap = {
|
|
1182
1188
|
Input: webVue.Input,
|
|
1183
1189
|
InputNumber: webVue.InputNumber,
|
|
@@ -1238,6 +1244,15 @@ function getPlaceholder(component, label) {
|
|
|
1238
1244
|
}
|
|
1239
1245
|
return "";
|
|
1240
1246
|
}
|
|
1247
|
+
function getRules(component, label) {
|
|
1248
|
+
if (componentsNeedPlaceholder.has(component)) {
|
|
1249
|
+
return [{ required: true, message: `请输入${label}` }];
|
|
1250
|
+
}
|
|
1251
|
+
if (componentsNeedSelectPlaceholder.has(component)) {
|
|
1252
|
+
return [{ required: true, message: `请选择${label}` }];
|
|
1253
|
+
}
|
|
1254
|
+
return [];
|
|
1255
|
+
}
|
|
1241
1256
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
1242
1257
|
...{
|
|
1243
1258
|
name: "BasicForm",
|
|
@@ -1340,12 +1355,17 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1340
1355
|
if (schema.disabled !== void 0) {
|
|
1341
1356
|
disabled = typeof schema.disabled === "boolean" ? schema.disabled : schema.disabled(formModel);
|
|
1342
1357
|
}
|
|
1358
|
+
let rules = schema.rules;
|
|
1359
|
+
if (schema.required && (!rules || rules.length === 0)) {
|
|
1360
|
+
const componentType = typeof schema.component === "string" ? schema.component : "";
|
|
1361
|
+
rules = getRules(componentType, schema.label);
|
|
1362
|
+
}
|
|
1343
1363
|
return {
|
|
1344
1364
|
field: schema.field,
|
|
1345
1365
|
label: schema.label,
|
|
1346
1366
|
labelColProps: schema.labelColProps || propsData.labelColProps,
|
|
1347
1367
|
wrapperColProps: schema.wrapperColProps || propsData.wrapperColProps,
|
|
1348
|
-
rules
|
|
1368
|
+
rules,
|
|
1349
1369
|
disabled,
|
|
1350
1370
|
help: schema.help,
|
|
1351
1371
|
extra: schema.extra,
|
|
@@ -1621,6 +1641,8 @@ function useForm(options = {}) {
|
|
|
1621
1641
|
const formModel = vue.reactive({});
|
|
1622
1642
|
const loadedRef = vue.ref(false);
|
|
1623
1643
|
const propsRef = vue.ref({});
|
|
1644
|
+
const pendingValues = vue.ref(null);
|
|
1645
|
+
let unwatchFormRef = null;
|
|
1624
1646
|
const initFormModel = () => {
|
|
1625
1647
|
var _a, _b;
|
|
1626
1648
|
const schemas = vue.unref(((_b = (_a = formRef.value) == null ? void 0 : _a.getSchema) == null ? void 0 : _b.call(_a)) || options.schemas || []);
|
|
@@ -1632,12 +1654,37 @@ function useForm(options = {}) {
|
|
|
1632
1654
|
};
|
|
1633
1655
|
const register = async (formInstance) => {
|
|
1634
1656
|
await vue.nextTick();
|
|
1657
|
+
if (unwatchFormRef) {
|
|
1658
|
+
unwatchFormRef();
|
|
1659
|
+
unwatchFormRef = null;
|
|
1660
|
+
}
|
|
1635
1661
|
formRef.value = formInstance;
|
|
1636
1662
|
loadedRef.value = true;
|
|
1637
1663
|
if (options && Object.keys(options).length > 0) {
|
|
1638
1664
|
await setProps(options);
|
|
1639
1665
|
}
|
|
1640
1666
|
initFormModel();
|
|
1667
|
+
if (formInstance.formRef) {
|
|
1668
|
+
unwatchFormRef = vue.watch(
|
|
1669
|
+
() => formInstance.formRef.value,
|
|
1670
|
+
(val) => {
|
|
1671
|
+
if (val === null) {
|
|
1672
|
+
formRef.value = null;
|
|
1673
|
+
loadedRef.value = false;
|
|
1674
|
+
if (unwatchFormRef) {
|
|
1675
|
+
unwatchFormRef();
|
|
1676
|
+
unwatchFormRef = null;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1680
|
+
{ flush: "sync" }
|
|
1681
|
+
// 同步执行,确保及时清理
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1684
|
+
if (pendingValues.value) {
|
|
1685
|
+
await setFieldsValue(pendingValues.value);
|
|
1686
|
+
pendingValues.value = null;
|
|
1687
|
+
}
|
|
1641
1688
|
};
|
|
1642
1689
|
const getForm = () => {
|
|
1643
1690
|
const form = vue.unref(formRef);
|
|
@@ -1649,7 +1696,15 @@ function useForm(options = {}) {
|
|
|
1649
1696
|
return form;
|
|
1650
1697
|
};
|
|
1651
1698
|
const getFormSafe = () => {
|
|
1652
|
-
|
|
1699
|
+
var _a;
|
|
1700
|
+
const form = vue.unref(formRef);
|
|
1701
|
+
if (!form) return null;
|
|
1702
|
+
if (((_a = form.formRef) == null ? void 0 : _a.value) === null) {
|
|
1703
|
+
formRef.value = null;
|
|
1704
|
+
loadedRef.value = false;
|
|
1705
|
+
return null;
|
|
1706
|
+
}
|
|
1707
|
+
return form;
|
|
1653
1708
|
};
|
|
1654
1709
|
const getFieldsValue = () => {
|
|
1655
1710
|
const form = getFormSafe();
|
|
@@ -1661,7 +1716,10 @@ function useForm(options = {}) {
|
|
|
1661
1716
|
};
|
|
1662
1717
|
const setFieldsValue = async (values) => {
|
|
1663
1718
|
const form = getFormSafe();
|
|
1664
|
-
if (!form)
|
|
1719
|
+
if (!form) {
|
|
1720
|
+
pendingValues.value = { ...pendingValues.value, ...values };
|
|
1721
|
+
return;
|
|
1722
|
+
}
|
|
1665
1723
|
if (form.setFieldsValue) {
|
|
1666
1724
|
await form.setFieldsValue(values);
|
|
1667
1725
|
} else {
|
|
@@ -3343,7 +3401,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3343
3401
|
footer: { type: Boolean, default: true },
|
|
3344
3402
|
titleAlign: { default: "center" },
|
|
3345
3403
|
height: {},
|
|
3346
|
-
minHeight: { default:
|
|
3404
|
+
minHeight: { default: 46 },
|
|
3347
3405
|
useWrapper: { type: Boolean, default: true },
|
|
3348
3406
|
wrapperFooterOffset: { default: 0 },
|
|
3349
3407
|
canFullscreen: { type: Boolean, default: false },
|
|
@@ -3421,10 +3479,11 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3421
3479
|
const spinStyle = vue.computed(() => {
|
|
3422
3480
|
const propsData = vue.unref(getProps);
|
|
3423
3481
|
const style = {
|
|
3424
|
-
minHeight: propsData.minHeight ? typeof propsData.minHeight === "number" ? `${propsData.minHeight}px` : propsData.minHeight : "
|
|
3425
|
-
pointerEvents: "none"
|
|
3426
|
-
// 禁用所有交互
|
|
3482
|
+
minHeight: propsData.minHeight ? typeof propsData.minHeight === "number" ? `${propsData.minHeight}px` : propsData.minHeight : "46px"
|
|
3427
3483
|
};
|
|
3484
|
+
if (propsData.loading) {
|
|
3485
|
+
style.pointerEvents = "none";
|
|
3486
|
+
}
|
|
3428
3487
|
return style;
|
|
3429
3488
|
});
|
|
3430
3489
|
const getCancelButtonProps = vue.computed(() => {
|
|
@@ -3572,10 +3631,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3572
3631
|
onCancel: handleCancel
|
|
3573
3632
|
}), vue.createSlots({
|
|
3574
3633
|
default: vue.withCtx(() => [
|
|
3575
|
-
|
|
3576
|
-
|
|
3634
|
+
vue.createVNode(_component_a_spin, {
|
|
3635
|
+
loading: getProps.value.loading,
|
|
3577
3636
|
tip: getProps.value.loadingTip,
|
|
3578
|
-
loading: true,
|
|
3579
3637
|
style: vue.normalizeStyle(spinStyle.value),
|
|
3580
3638
|
class: "w-full"
|
|
3581
3639
|
}, {
|
|
@@ -3589,15 +3647,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3589
3647
|
], 4)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true)
|
|
3590
3648
|
]),
|
|
3591
3649
|
_: 3
|
|
3592
|
-
}, 8, ["tip", "style"])
|
|
3593
|
-
getProps.value.useWrapper ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3594
|
-
key: 0,
|
|
3595
|
-
style: vue.normalizeStyle(wrapperStyle.value),
|
|
3596
|
-
class: "modal-wrapper"
|
|
3597
|
-
}, [
|
|
3598
|
-
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
3599
|
-
], 4)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true)
|
|
3600
|
-
], 64))
|
|
3650
|
+
}, 8, ["loading", "tip", "style"])
|
|
3601
3651
|
]),
|
|
3602
3652
|
_: 2
|
|
3603
3653
|
}, [
|
|
@@ -3711,7 +3761,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3711
3761
|
};
|
|
3712
3762
|
}
|
|
3713
3763
|
});
|
|
3714
|
-
const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
3764
|
+
const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-860bd3ac"]]);
|
|
3715
3765
|
function useModal(props) {
|
|
3716
3766
|
const modalRef = vue.ref(null);
|
|
3717
3767
|
const loadedRef = vue.ref(false);
|
|
@@ -3733,9 +3783,7 @@ function useModal(props) {
|
|
|
3733
3783
|
const openModal = (visible = true, data) => {
|
|
3734
3784
|
const modal = getModal();
|
|
3735
3785
|
if (!modal) return;
|
|
3736
|
-
|
|
3737
|
-
modal.setModalProps({ _data: data });
|
|
3738
|
-
}
|
|
3786
|
+
modal.setModalProps({ _data: data });
|
|
3739
3787
|
if (visible) {
|
|
3740
3788
|
modal.openModal();
|
|
3741
3789
|
} else {
|
|
@@ -3746,6 +3794,9 @@ function useModal(props) {
|
|
|
3746
3794
|
const modal = getModal();
|
|
3747
3795
|
if (!modal) return;
|
|
3748
3796
|
modal.closeModal();
|
|
3797
|
+
setTimeout(() => {
|
|
3798
|
+
modal.setModalProps({ _data: void 0 });
|
|
3799
|
+
});
|
|
3749
3800
|
};
|
|
3750
3801
|
const setModalProps = (modalProps) => {
|
|
3751
3802
|
const modal = getModal();
|