knt-shared 1.4.5 → 1.4.7
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/Modal/BasicModal.vue.d.ts +28 -10
- package/dist/components/Modal/BasicModal.vue.d.ts.map +1 -1
- package/dist/components/Modal/types.d.ts +83 -35
- package/dist/components/Modal/types.d.ts.map +1 -1
- package/dist/components/Modal/useModal.d.ts.map +1 -1
- package/dist/components/Modal/useModalInner.d.ts.map +1 -1
- package/dist/components/Table/BasicTable.vue.d.ts.map +1 -1
- package/dist/components/Table/useTable.d.ts.map +1 -1
- package/dist/index.cjs.js +98 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +98 -36
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +15 -15
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -6434,8 +6434,9 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6434
6434
|
"row-index": slotProps.rowIndex,
|
|
6435
6435
|
value: vue.unref(getEditValue)(slotProps.record, col),
|
|
6436
6436
|
error: vue.unref(getValidationError)(slotProps.record, col),
|
|
6437
|
+
"edit-config": props.editConfig,
|
|
6437
6438
|
onChange: (val) => vue.unref(setEditValue)(slotProps.record, col, val)
|
|
6438
|
-
}, null, 8, ["column", "record", "row-index", "value", "error", "onChange"])) : _ctx.$slots[col.dataIndex] ? vue.renderSlot(_ctx.$slots, col.dataIndex, vue.normalizeProps(vue.mergeProps({ key: 3 }, slotProps)), void 0, true) : col.customRender ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderCustomCell(col, slotProps)), { key: 4 })) : col.format ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 5 }, [
|
|
6439
|
+
}, null, 8, ["column", "record", "row-index", "value", "error", "edit-config", "onChange"])) : _ctx.$slots[col.dataIndex] ? vue.renderSlot(_ctx.$slots, col.dataIndex, vue.normalizeProps(vue.mergeProps({ key: 3 }, slotProps)), void 0, true) : col.customRender ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderCustomCell(col, slotProps)), { key: 4 })) : col.format ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 5 }, [
|
|
6439
6440
|
vue.createTextVNode(vue.toDisplayString(col.format(
|
|
6440
6441
|
slotProps.record[col.dataIndex],
|
|
6441
6442
|
slotProps.record,
|
|
@@ -6460,7 +6461,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6460
6461
|
};
|
|
6461
6462
|
}
|
|
6462
6463
|
});
|
|
6463
|
-
const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
6464
|
+
const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-eebe4c3c"]]);
|
|
6464
6465
|
function useTable(options = {}) {
|
|
6465
6466
|
const tableRef = vue.ref(null);
|
|
6466
6467
|
const formRef = vue.ref(null);
|
|
@@ -6692,11 +6693,11 @@ function useTable(options = {}) {
|
|
|
6692
6693
|
await table.deleteRow(record);
|
|
6693
6694
|
}
|
|
6694
6695
|
};
|
|
6695
|
-
const addRow = async () => {
|
|
6696
|
+
const addRow = async (position = "bottom") => {
|
|
6696
6697
|
const table = getTable();
|
|
6697
6698
|
if (!table) return;
|
|
6698
6699
|
if (table.addRow) {
|
|
6699
|
-
await table.addRow();
|
|
6700
|
+
await table.addRow(position);
|
|
6700
6701
|
}
|
|
6701
6702
|
};
|
|
6702
6703
|
const getEditingRows = () => {
|
|
@@ -6815,7 +6816,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6815
6816
|
visible: { type: Boolean, default: false },
|
|
6816
6817
|
defaultVisible: { type: Boolean, default: false },
|
|
6817
6818
|
title: {},
|
|
6818
|
-
alignCenter: { type: Boolean },
|
|
6819
|
+
alignCenter: { type: Boolean, default: true },
|
|
6819
6820
|
unmountOnClose: { type: Boolean },
|
|
6820
6821
|
maskClosable: { type: Boolean, default: true },
|
|
6821
6822
|
hideTitle: { type: Boolean },
|
|
@@ -6830,19 +6831,22 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6830
6831
|
fullscreen: { type: Boolean },
|
|
6831
6832
|
width: { default: 520 },
|
|
6832
6833
|
top: {},
|
|
6833
|
-
renderToBody: { type: Boolean },
|
|
6834
|
+
renderToBody: { type: Boolean, default: true },
|
|
6834
6835
|
popupContainer: {},
|
|
6835
6836
|
maskStyle: {},
|
|
6836
6837
|
modalStyle: {},
|
|
6837
6838
|
modalClass: {},
|
|
6838
|
-
popupAnimationName: {},
|
|
6839
6839
|
mask: { type: Boolean, default: true },
|
|
6840
6840
|
onBeforeOk: {},
|
|
6841
6841
|
onBeforeCancel: {},
|
|
6842
|
-
escToClose: { type: Boolean },
|
|
6842
|
+
escToClose: { type: Boolean, default: true },
|
|
6843
6843
|
draggable: { type: Boolean, default: false },
|
|
6844
6844
|
footer: { type: Boolean, default: true },
|
|
6845
6845
|
titleAlign: { default: "center" },
|
|
6846
|
+
maskAnimationName: {},
|
|
6847
|
+
modalAnimationName: {},
|
|
6848
|
+
bodyClass: {},
|
|
6849
|
+
bodyStyle: { type: [Boolean, null, String, Object, Array] },
|
|
6846
6850
|
height: {},
|
|
6847
6851
|
minHeight: { default: 46 },
|
|
6848
6852
|
useWrapper: { type: Boolean, default: true },
|
|
@@ -6856,9 +6860,11 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6856
6860
|
helpMessage: {},
|
|
6857
6861
|
centered: { type: Boolean, default: false },
|
|
6858
6862
|
closeFunc: {},
|
|
6859
|
-
showFooter: { type: Boolean, default: true }
|
|
6863
|
+
showFooter: { type: Boolean, default: true },
|
|
6864
|
+
clearDataOnClose: { type: Boolean },
|
|
6865
|
+
_data: {}
|
|
6860
6866
|
},
|
|
6861
|
-
emits: ["register", "update:visible", "ok", "cancel", "visible-change"],
|
|
6867
|
+
emits: ["register", "update:visible", "ok", "cancel", "open", "close", "before-open", "before-close", "visible-change"],
|
|
6862
6868
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6863
6869
|
const props = __props;
|
|
6864
6870
|
const emit = __emit;
|
|
@@ -6873,12 +6879,23 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6873
6879
|
const getBindValue = vue.computed(() => {
|
|
6874
6880
|
const propsData = vue.unref(getProps);
|
|
6875
6881
|
return {
|
|
6882
|
+
// Arco 原生属性完全透传
|
|
6883
|
+
defaultVisible: propsData.defaultVisible,
|
|
6884
|
+
title: propsData.title,
|
|
6876
6885
|
width: fullscreenRef.value ? "100%" : propsData.width,
|
|
6877
|
-
|
|
6886
|
+
top: propsData.top,
|
|
6887
|
+
mask: propsData.mask,
|
|
6878
6888
|
maskClosable: propsData.maskClosable,
|
|
6879
6889
|
closable: propsData.closable,
|
|
6880
|
-
|
|
6890
|
+
okText: propsData.okText,
|
|
6891
|
+
cancelText: propsData.cancelText,
|
|
6892
|
+
okLoading: propsData.okLoading,
|
|
6893
|
+
okButtonProps: propsData.okButtonProps,
|
|
6894
|
+
cancelButtonProps: propsData.cancelButtonProps,
|
|
6895
|
+
fullscreen: fullscreenRef.value || propsData.fullscreen,
|
|
6881
6896
|
alignCenter: propsData.alignCenter || propsData.centered,
|
|
6897
|
+
unmountOnClose: propsData.unmountOnClose,
|
|
6898
|
+
hideCancel: propsData.hideCancel,
|
|
6882
6899
|
simple: propsData.simple,
|
|
6883
6900
|
hideTitle: propsData.hideTitle,
|
|
6884
6901
|
renderToBody: propsData.renderToBody,
|
|
@@ -6888,10 +6905,14 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6888
6905
|
modalClass: propsData.modalClass,
|
|
6889
6906
|
escToClose: propsData.escToClose,
|
|
6890
6907
|
draggable: propsData.draggable,
|
|
6891
|
-
mask: propsData.mask,
|
|
6892
|
-
top: propsData.top,
|
|
6893
6908
|
footer: propsData.footer === false ? false : void 0,
|
|
6894
|
-
titleAlign: propsData.titleAlign
|
|
6909
|
+
titleAlign: propsData.titleAlign,
|
|
6910
|
+
// v2.24.0+ 新增属性
|
|
6911
|
+
maskAnimationName: propsData.maskAnimationName,
|
|
6912
|
+
modalAnimationName: propsData.modalAnimationName,
|
|
6913
|
+
// v2.31.0+ 新增属性
|
|
6914
|
+
bodyClass: propsData.bodyClass,
|
|
6915
|
+
bodyStyle: propsData.bodyStyle
|
|
6895
6916
|
};
|
|
6896
6917
|
});
|
|
6897
6918
|
const getModalStyle = vue.computed(() => {
|
|
@@ -6947,7 +6968,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6947
6968
|
emit("update:visible", visible);
|
|
6948
6969
|
emit("visible-change", visible);
|
|
6949
6970
|
};
|
|
6950
|
-
const handleOkInternal = async () => {
|
|
6971
|
+
const handleOkInternal = async (ev) => {
|
|
6951
6972
|
const propsData = vue.unref(getProps);
|
|
6952
6973
|
if (confirmLoading.value || propsData.loading) {
|
|
6953
6974
|
return;
|
|
@@ -6964,7 +6985,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6964
6985
|
}
|
|
6965
6986
|
});
|
|
6966
6987
|
});
|
|
6967
|
-
emit("ok");
|
|
6988
|
+
emit("ok", ev);
|
|
6968
6989
|
handleVisibleChange(false);
|
|
6969
6990
|
} catch (e) {
|
|
6970
6991
|
} finally {
|
|
@@ -6977,7 +6998,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6977
6998
|
try {
|
|
6978
6999
|
const canClose = await propsData.closeFunc();
|
|
6979
7000
|
if (canClose) {
|
|
6980
|
-
emit("ok");
|
|
7001
|
+
emit("ok", ev);
|
|
6981
7002
|
handleVisibleChange(false);
|
|
6982
7003
|
}
|
|
6983
7004
|
} finally {
|
|
@@ -6985,30 +7006,25 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
6985
7006
|
}
|
|
6986
7007
|
return;
|
|
6987
7008
|
}
|
|
6988
|
-
emit("ok");
|
|
7009
|
+
emit("ok", ev);
|
|
6989
7010
|
handleVisibleChange(false);
|
|
6990
7011
|
};
|
|
6991
7012
|
const handleOk = handleOkInternal;
|
|
6992
|
-
const handleCancel = async () => {
|
|
7013
|
+
const handleCancel = async (ev) => {
|
|
6993
7014
|
const propsData = vue.unref(getProps);
|
|
6994
7015
|
if (propsData.onBeforeCancel) {
|
|
6995
7016
|
try {
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
reject(false);
|
|
7002
|
-
}
|
|
7003
|
-
});
|
|
7004
|
-
});
|
|
7005
|
-
emit("cancel");
|
|
7017
|
+
const result = propsData.onBeforeCancel();
|
|
7018
|
+
if (result === false) {
|
|
7019
|
+
return;
|
|
7020
|
+
}
|
|
7021
|
+
emit("cancel", ev);
|
|
7006
7022
|
handleVisibleChange(false);
|
|
7007
7023
|
} catch (e) {
|
|
7008
7024
|
}
|
|
7009
7025
|
return;
|
|
7010
7026
|
}
|
|
7011
|
-
emit("cancel");
|
|
7027
|
+
emit("cancel", ev);
|
|
7012
7028
|
handleVisibleChange(false);
|
|
7013
7029
|
};
|
|
7014
7030
|
const handleFullscreen = () => {
|
|
@@ -7022,6 +7038,12 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
7022
7038
|
};
|
|
7023
7039
|
const closeModal = () => {
|
|
7024
7040
|
handleVisibleChange(false);
|
|
7041
|
+
const propsData = vue.unref(getProps);
|
|
7042
|
+
if (propsData.clearDataOnClose) {
|
|
7043
|
+
setTimeout(() => {
|
|
7044
|
+
clearData();
|
|
7045
|
+
}, 300);
|
|
7046
|
+
}
|
|
7025
7047
|
};
|
|
7026
7048
|
const changeOkLoading = (loading) => {
|
|
7027
7049
|
confirmLoading.value = loading;
|
|
@@ -7033,13 +7055,19 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
7033
7055
|
const getModalProps = () => {
|
|
7034
7056
|
return { ...vue.unref(getProps), visible: visibleRef.value };
|
|
7035
7057
|
};
|
|
7058
|
+
const clearData = () => {
|
|
7059
|
+
propsRef.value = {};
|
|
7060
|
+
confirmLoading.value = false;
|
|
7061
|
+
modalLoading.value = false;
|
|
7062
|
+
};
|
|
7036
7063
|
const modalMethods = {
|
|
7037
7064
|
setModalProps,
|
|
7038
7065
|
openModal,
|
|
7039
7066
|
closeModal,
|
|
7040
7067
|
changeOkLoading,
|
|
7041
7068
|
changeLoading,
|
|
7042
|
-
getModalProps
|
|
7069
|
+
getModalProps,
|
|
7070
|
+
clearData
|
|
7043
7071
|
};
|
|
7044
7072
|
__expose(modalMethods);
|
|
7045
7073
|
vue.watch(
|
|
@@ -7071,7 +7099,11 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
7071
7099
|
visible: visibleRef.value,
|
|
7072
7100
|
"onUpdate:visible": handleVisibleChange,
|
|
7073
7101
|
onOk: vue.unref(handleOk),
|
|
7074
|
-
onCancel: handleCancel
|
|
7102
|
+
onCancel: handleCancel,
|
|
7103
|
+
onOpen: _cache[0] || (_cache[0] = ($event) => emit("open")),
|
|
7104
|
+
onClose: _cache[1] || (_cache[1] = ($event) => emit("close")),
|
|
7105
|
+
onBeforeOpen: _cache[2] || (_cache[2] = ($event) => emit("before-open")),
|
|
7106
|
+
onBeforeClose: _cache[3] || (_cache[3] = ($event) => emit("before-close"))
|
|
7075
7107
|
}), vue.createSlots({
|
|
7076
7108
|
default: vue.withCtx(() => [
|
|
7077
7109
|
vue.createVNode(_component_a_spin, {
|
|
@@ -7204,7 +7236,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
7204
7236
|
};
|
|
7205
7237
|
}
|
|
7206
7238
|
});
|
|
7207
|
-
const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
7239
|
+
const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-9c2dbbc8"]]);
|
|
7208
7240
|
function useModal(props) {
|
|
7209
7241
|
const modalRef = vue.ref(null);
|
|
7210
7242
|
const loadedRef = vue.ref(false);
|
|
@@ -7251,13 +7283,37 @@ function useModal(props) {
|
|
|
7251
7283
|
if (!modal) return false;
|
|
7252
7284
|
return modal.getModalProps().visible || false;
|
|
7253
7285
|
};
|
|
7286
|
+
const changeOkLoading = (loading) => {
|
|
7287
|
+
const modal = getModal();
|
|
7288
|
+
if (!modal) return;
|
|
7289
|
+
modal.changeOkLoading(loading);
|
|
7290
|
+
};
|
|
7291
|
+
const changeLoading = (loading) => {
|
|
7292
|
+
const modal = getModal();
|
|
7293
|
+
if (!modal) return;
|
|
7294
|
+
modal.changeLoading(loading);
|
|
7295
|
+
};
|
|
7296
|
+
const getModalProps = () => {
|
|
7297
|
+
const modal = getModal();
|
|
7298
|
+
if (!modal) return {};
|
|
7299
|
+
return modal.getModalProps();
|
|
7300
|
+
};
|
|
7301
|
+
const clearData = () => {
|
|
7302
|
+
const modal = getModal();
|
|
7303
|
+
if (!modal) return;
|
|
7304
|
+
modal.clearData();
|
|
7305
|
+
};
|
|
7254
7306
|
return [
|
|
7255
7307
|
register,
|
|
7256
7308
|
{
|
|
7257
7309
|
openModal,
|
|
7258
7310
|
closeModal,
|
|
7259
7311
|
setModalProps,
|
|
7260
|
-
getVisible
|
|
7312
|
+
getVisible,
|
|
7313
|
+
changeOkLoading,
|
|
7314
|
+
changeLoading,
|
|
7315
|
+
getModalProps,
|
|
7316
|
+
clearData
|
|
7261
7317
|
}
|
|
7262
7318
|
];
|
|
7263
7319
|
}
|
|
@@ -7317,6 +7373,11 @@ function useModalInner(callbackFn) {
|
|
|
7317
7373
|
if (!modal) return {};
|
|
7318
7374
|
return modal.getModalProps();
|
|
7319
7375
|
};
|
|
7376
|
+
const clearData = () => {
|
|
7377
|
+
const modal = getModal();
|
|
7378
|
+
if (!modal) return;
|
|
7379
|
+
modal.clearData();
|
|
7380
|
+
};
|
|
7320
7381
|
vue.onUnmounted(() => {
|
|
7321
7382
|
modalRef.value = null;
|
|
7322
7383
|
loadedRef.value = false;
|
|
@@ -7328,7 +7389,8 @@ function useModalInner(callbackFn) {
|
|
|
7328
7389
|
changeOkLoading,
|
|
7329
7390
|
changeLoading,
|
|
7330
7391
|
setModalProps,
|
|
7331
|
-
getModalProps
|
|
7392
|
+
getModalProps,
|
|
7393
|
+
clearData
|
|
7332
7394
|
}
|
|
7333
7395
|
];
|
|
7334
7396
|
}
|