@tmagic/form 1.5.11 → 1.5.13
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/tmagic-form.js +24 -20
- package/dist/tmagic-form.umd.cjs +63 -289
- package/package.json +3 -3
- package/src/containers/Table.vue +2 -0
- package/types/index.d.ts +1372 -3037
package/dist/tmagic-form.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent,
|
|
1
|
+
import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, createElementBlock, createCommentVNode, openBlock, normalizeClass, normalizeStyle, createBlock, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, Teleport, toRefs, mergeProps, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, shallowRef, withModifiers, onBeforeMount, nextTick, resolveDirective, createSlots } from 'vue';
|
|
2
2
|
import { WarningFilled, CaretBottom, CaretRight, Delete, DocumentCopy, CaretTop, Position, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
|
|
3
3
|
import { cloneDeep, isEqual, isEmpty, debounce } from 'lodash-es';
|
|
4
4
|
import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicPopover, TMagicInputNumber, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getDesignConfig, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, tMagicMessageBox, TMagicDialog, TMagicRadioButton, TMagicRadio, TMagicRadioGroup, TMagicSelect, TMagicSwitch, TMagicTimePicker, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
|
|
@@ -83,7 +83,7 @@ const getDefaultValue = function(mForm, { defaultValue, type, filter, multiple }
|
|
|
83
83
|
return defaultValue(mForm);
|
|
84
84
|
}
|
|
85
85
|
if (defaultValue === "undefined") {
|
|
86
|
-
return
|
|
86
|
+
return void 0;
|
|
87
87
|
}
|
|
88
88
|
if (typeof defaultValue !== "undefined") {
|
|
89
89
|
return defaultValue;
|
|
@@ -742,7 +742,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
742
742
|
if (props.config.items) {
|
|
743
743
|
return props.config.labelWidth || props.labelWidth;
|
|
744
744
|
}
|
|
745
|
-
return props.config.labelWidth || props.labelWidth || (props.config.text ?
|
|
745
|
+
return props.config.labelWidth || props.labelWidth || (props.config.text ? void 0 : "0");
|
|
746
746
|
});
|
|
747
747
|
const valueChangeHandler = (value) => {
|
|
748
748
|
emit("change", value, { modifyKey: "value" });
|
|
@@ -918,7 +918,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
918
918
|
const changeOrder = (offset = 0) => emit("swap-item", props.index, props.index + offset);
|
|
919
919
|
const movable = computed(() => {
|
|
920
920
|
const { movable: movable2 } = props.config;
|
|
921
|
-
if (movable2 ===
|
|
921
|
+
if (movable2 === void 0) return true;
|
|
922
922
|
if (typeof movable2 === "function") {
|
|
923
923
|
return movable2(mForm, props.index || 0, props.model, props.groupModel);
|
|
924
924
|
}
|
|
@@ -1708,6 +1708,10 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
1708
1708
|
}
|
|
1709
1709
|
sortable = Sortable.create(tBodyEl, {
|
|
1710
1710
|
draggable: ".tmagic-design-table-row",
|
|
1711
|
+
filter: "input",
|
|
1712
|
+
// 表单组件选字操作和触发拖拽会冲突,优先保证选字操作
|
|
1713
|
+
preventOnFilter: false,
|
|
1714
|
+
// 允许选字
|
|
1711
1715
|
direction: "vertical",
|
|
1712
1716
|
onEnd: ({ newIndex, oldIndex }) => {
|
|
1713
1717
|
if (typeof newIndex === "undefined") return;
|
|
@@ -1872,7 +1876,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
1872
1876
|
}
|
|
1873
1877
|
timer = setTimeout(() => {
|
|
1874
1878
|
swapArray(index, index - 1);
|
|
1875
|
-
timer =
|
|
1879
|
+
timer = void 0;
|
|
1876
1880
|
}, 300);
|
|
1877
1881
|
};
|
|
1878
1882
|
const topHandler = (index) => {
|
|
@@ -1891,7 +1895,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
1891
1895
|
}
|
|
1892
1896
|
timer = setTimeout(() => {
|
|
1893
1897
|
swapArray(index, index + 1);
|
|
1894
|
-
timer =
|
|
1898
|
+
timer = void 0;
|
|
1895
1899
|
}, 300);
|
|
1896
1900
|
};
|
|
1897
1901
|
const bottomHandler = (index) => {
|
|
@@ -2068,7 +2072,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
2068
2072
|
label: "操作",
|
|
2069
2073
|
width: _ctx.config.operateColWidth || 100,
|
|
2070
2074
|
align: "center",
|
|
2071
|
-
fixed: _ctx.config.fixed === false ?
|
|
2075
|
+
fixed: _ctx.config.fixed === false ? void 0 : "left"
|
|
2072
2076
|
}, {
|
|
2073
2077
|
default: withCtx((scope) => [
|
|
2074
2078
|
renderSlot(_ctx.$slots, "operateCol", { scope }),
|
|
@@ -2727,7 +2731,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2727
2731
|
} else {
|
|
2728
2732
|
return props.config.activeValue;
|
|
2729
2733
|
}
|
|
2730
|
-
return
|
|
2734
|
+
return void 0;
|
|
2731
2735
|
});
|
|
2732
2736
|
const inactiveValue = computed(() => {
|
|
2733
2737
|
if (typeof props.config.inactiveValue === "undefined") {
|
|
@@ -2737,7 +2741,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2737
2741
|
} else {
|
|
2738
2742
|
return props.config.inactiveValue;
|
|
2739
2743
|
}
|
|
2740
|
-
return
|
|
2744
|
+
return void 0;
|
|
2741
2745
|
});
|
|
2742
2746
|
const changeHandler = (value) => {
|
|
2743
2747
|
emit("change", value);
|
|
@@ -2939,7 +2943,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2939
2943
|
useAddField(props.prop);
|
|
2940
2944
|
const { names } = props.config;
|
|
2941
2945
|
const value = ref([]);
|
|
2942
|
-
if (props.model !==
|
|
2946
|
+
if (props.model !== void 0) {
|
|
2943
2947
|
if (names?.length) {
|
|
2944
2948
|
watch(
|
|
2945
2949
|
[() => props.model[names[0]], () => props.model[names[1]]],
|
|
@@ -2963,7 +2967,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2963
2967
|
const format = `${props.config.dateFormat || "YYYY/MM/DD"} ${props.config.timeFormat || "HH:mm:ss"}`;
|
|
2964
2968
|
if (start !== preStart)
|
|
2965
2969
|
value.value = start.map(
|
|
2966
|
-
(item) => item ? datetimeFormatter(item, "", format) :
|
|
2970
|
+
(item) => item ? datetimeFormatter(item, "", format) : void 0
|
|
2967
2971
|
);
|
|
2968
2972
|
},
|
|
2969
2973
|
{
|
|
@@ -2980,7 +2984,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2980
2984
|
if (Array.isArray(v)) {
|
|
2981
2985
|
props.model[item] = v[index];
|
|
2982
2986
|
} else {
|
|
2983
|
-
props.model[item] =
|
|
2987
|
+
props.model[item] = void 0;
|
|
2984
2988
|
}
|
|
2985
2989
|
});
|
|
2986
2990
|
};
|
|
@@ -3140,9 +3144,9 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3140
3144
|
fieldMap.value = {};
|
|
3141
3145
|
fieldLabelMap.value = {};
|
|
3142
3146
|
fields.forEach((v) => {
|
|
3143
|
-
if (typeof v !== "object" || v.name ===
|
|
3147
|
+
if (typeof v !== "object" || v.name === void 0) return;
|
|
3144
3148
|
let oldVal = props.model?.[v.name] || "";
|
|
3145
|
-
if (!oldVal && v.defaultValue !==
|
|
3149
|
+
if (!oldVal && v.defaultValue !== void 0) {
|
|
3146
3150
|
oldVal = v.defaultValue;
|
|
3147
3151
|
emit("change", oldVal, { modifyKey: v.name });
|
|
3148
3152
|
}
|
|
@@ -4520,7 +4524,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4520
4524
|
return {
|
|
4521
4525
|
text: props.config.append,
|
|
4522
4526
|
type: "button",
|
|
4523
|
-
handler:
|
|
4527
|
+
handler: void 0
|
|
4524
4528
|
};
|
|
4525
4529
|
}
|
|
4526
4530
|
if (props.config.append && typeof props.config.append === "object") {
|
|
@@ -4577,7 +4581,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4577
4581
|
unit = $2;
|
|
4578
4582
|
});
|
|
4579
4583
|
}
|
|
4580
|
-
if (num ===
|
|
4584
|
+
if (num === void 0) {
|
|
4581
4585
|
return;
|
|
4582
4586
|
}
|
|
4583
4587
|
const ctrl = navigator.platform.match("Mac") ? $event.metaKey : $event.ctrlKey;
|
|
@@ -4629,7 +4633,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4629
4633
|
const destroyPopover = () => {
|
|
4630
4634
|
if (!instanceRef.value) return;
|
|
4631
4635
|
instanceRef.value.destroy();
|
|
4632
|
-
instanceRef.value =
|
|
4636
|
+
instanceRef.value = void 0;
|
|
4633
4637
|
};
|
|
4634
4638
|
return (_ctx, _cache) => {
|
|
4635
4639
|
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
@@ -4670,7 +4674,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4670
4674
|
}, 8, ["size"])) : createCommentVNode("v-if", true)
|
|
4671
4675
|
]),
|
|
4672
4676
|
key: "0"
|
|
4673
|
-
} :
|
|
4677
|
+
} : void 0
|
|
4674
4678
|
]), 1032, ["modelValue", "size", "placeholder", "disabled"]),
|
|
4675
4679
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
4676
4680
|
popoverVisible.value ? (openBlock(), createElementBlock(
|
|
@@ -4840,7 +4844,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
4840
4844
|
useAddField(props.prop);
|
|
4841
4845
|
const { names } = props.config;
|
|
4842
4846
|
const value = ref([]);
|
|
4843
|
-
if (props.model !==
|
|
4847
|
+
if (props.model !== void 0 && names?.length) {
|
|
4844
4848
|
watch(
|
|
4845
4849
|
[() => props.model[names[0]], () => props.model[names[1]]],
|
|
4846
4850
|
([start, end], [preStart, preEnd]) => {
|
|
@@ -4864,7 +4868,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
4864
4868
|
if (Array.isArray(v)) {
|
|
4865
4869
|
props.model[item] = v[index];
|
|
4866
4870
|
} else {
|
|
4867
|
-
props.model[item] =
|
|
4871
|
+
props.model[item] = void 0;
|
|
4868
4872
|
}
|
|
4869
4873
|
});
|
|
4870
4874
|
};
|