@tmagic/form 1.1.5 → 1.2.0-beta.1
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/style.css +4 -0
- package/dist/tmagic-form.mjs +45 -49
- package/dist/tmagic-form.mjs.map +1 -1
- package/dist/tmagic-form.umd.js +44 -48
- package/dist/tmagic-form.umd.js.map +1 -1
- package/package.json +4 -4
- package/src/containers/GroupList.vue +3 -3
- package/src/containers/Table.vue +18 -22
- package/src/fields/Select.vue +18 -29
- package/src/index.ts +1 -1
- package/src/schema.ts +11 -0
- package/src/theme/table.scss +5 -0
- package/types/containers/GroupList.vue.d.ts +1 -0
- package/types/containers/Table.vue.d.ts +9 -0
- package/types/schema.d.ts +11 -0
package/dist/style.css
CHANGED
package/dist/tmagic-form.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, watch, unref, withDirectives, vShow, renderSlot, onMounted, toRefs, getCurrentInstance, reactive, onBeforeUnmount, vModelText, onBeforeMount, resolveDirective, createSlots, withModifiers, provide, Teleport } from 'vue';
|
|
2
|
-
import { WarningFilled, CaretBottom, CaretRight, CaretTop, Delete, ArrowDown, ArrowUp, FullScreen
|
|
2
|
+
import { WarningFilled, CaretBottom, CaretRight, CaretTop, Delete, Grid, ArrowDown, ArrowUp, FullScreen } from '@element-plus/icons-vue';
|
|
3
3
|
import { cloneDeep, isEqual } from 'lodash-es';
|
|
4
4
|
import { ElMessage } from 'element-plus';
|
|
5
5
|
import Sortable from 'sortablejs';
|
|
@@ -848,6 +848,7 @@ const _sfc_main$r = defineComponent({
|
|
|
848
848
|
}));
|
|
849
849
|
};
|
|
850
850
|
return {
|
|
851
|
+
Grid,
|
|
851
852
|
addable,
|
|
852
853
|
toggleMode,
|
|
853
854
|
removeHandler,
|
|
@@ -906,7 +907,7 @@ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
906
907
|
}, 8, ["onClick"])) : createCommentVNode("", true),
|
|
907
908
|
_ctx.config.enableToggleMode ? (openBlock(), createBlock(_component_el_button, {
|
|
908
909
|
key: 4,
|
|
909
|
-
icon:
|
|
910
|
+
icon: _ctx.Grid,
|
|
910
911
|
size: "small",
|
|
911
912
|
onClick: _ctx.toggleMode
|
|
912
913
|
}, {
|
|
@@ -914,7 +915,7 @@ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
914
915
|
_hoisted_7$1
|
|
915
916
|
]),
|
|
916
917
|
_: 1
|
|
917
|
-
}, 8, ["onClick"])) : createCommentVNode("", true)
|
|
918
|
+
}, 8, ["icon", "onClick"])) : createCommentVNode("", true)
|
|
918
919
|
]);
|
|
919
920
|
}
|
|
920
921
|
const GroupList = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$m]]);
|
|
@@ -1217,10 +1218,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1217
1218
|
}
|
|
1218
1219
|
const MStep = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$i]]);
|
|
1219
1220
|
|
|
1220
|
-
let loadedAMapJS = false;
|
|
1221
|
-
let firstLoadingAMapJS = true;
|
|
1222
1221
|
const _sfc_main$m = defineComponent({
|
|
1223
|
-
name: "m-form-table",
|
|
1224
1222
|
props: {
|
|
1225
1223
|
name: {
|
|
1226
1224
|
type: String,
|
|
@@ -1257,9 +1255,14 @@ const _sfc_main$m = defineComponent({
|
|
|
1257
1255
|
enableToggleMode: {
|
|
1258
1256
|
type: Boolean,
|
|
1259
1257
|
default: true
|
|
1258
|
+
},
|
|
1259
|
+
showIndex: {
|
|
1260
|
+
type: Boolean,
|
|
1261
|
+
default: true
|
|
1260
1262
|
}
|
|
1261
1263
|
},
|
|
1262
1264
|
emits: ["change", "select"],
|
|
1265
|
+
components: { Delete },
|
|
1263
1266
|
setup(props, { emit }) {
|
|
1264
1267
|
let timer = null;
|
|
1265
1268
|
const mForm = inject("mForm");
|
|
@@ -1374,17 +1377,14 @@ const _sfc_main$m = defineComponent({
|
|
|
1374
1377
|
props.model[modelName.value].push(inputs);
|
|
1375
1378
|
emit("change", props.model[modelName.value]);
|
|
1376
1379
|
};
|
|
1377
|
-
if (!
|
|
1378
|
-
|
|
1379
|
-
asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js").then(() => {
|
|
1380
|
-
loadedAMapJS = true;
|
|
1381
|
-
}).catch(() => {
|
|
1382
|
-
firstLoadingAMapJS = true;
|
|
1383
|
-
});
|
|
1380
|
+
if (!globalThis.XLSX) {
|
|
1381
|
+
asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js");
|
|
1384
1382
|
}
|
|
1385
1383
|
onMounted(() => {
|
|
1386
1384
|
if (props.config.defautSort) {
|
|
1387
1385
|
sortChange(props.config.defautSort);
|
|
1386
|
+
} else if (props.config.defaultSort) {
|
|
1387
|
+
sortChange(props.config.defaultSort);
|
|
1388
1388
|
}
|
|
1389
1389
|
if (props.sort && props.sortKey) {
|
|
1390
1390
|
props.model[modelName.value].sort((a, b) => b[props.sortKey] - a[props.sortKey]);
|
|
@@ -1612,6 +1612,8 @@ const _hoisted_10 = {
|
|
|
1612
1612
|
};
|
|
1613
1613
|
function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1614
1614
|
const _component_el_table_column = resolveComponent("el-table-column");
|
|
1615
|
+
const _component_Delete = resolveComponent("Delete");
|
|
1616
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
1615
1617
|
const _component_el_button = resolveComponent("el-button");
|
|
1616
1618
|
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
1617
1619
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
@@ -1662,16 +1664,20 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1662
1664
|
})) : createCommentVNode("", true),
|
|
1663
1665
|
createVNode(_component_el_table_column, {
|
|
1664
1666
|
label: "\u64CD\u4F5C",
|
|
1665
|
-
width: "
|
|
1667
|
+
width: "55",
|
|
1668
|
+
align: "center",
|
|
1666
1669
|
fixed: _ctx.config.fixed === false ? void 0 : "left"
|
|
1667
1670
|
}, {
|
|
1668
1671
|
default: withCtx((scope) => [
|
|
1669
|
-
withDirectives(createVNode(
|
|
1670
|
-
|
|
1671
|
-
text: "",
|
|
1672
|
-
icon: _ctx.Delete,
|
|
1672
|
+
withDirectives(createVNode(_component_el_icon, {
|
|
1673
|
+
class: "m-table-delete-icon",
|
|
1673
1674
|
onClick: ($event) => _ctx.removeHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)
|
|
1674
|
-
},
|
|
1675
|
+
}, {
|
|
1676
|
+
default: withCtx(() => [
|
|
1677
|
+
createVNode(_component_Delete)
|
|
1678
|
+
]),
|
|
1679
|
+
_: 2
|
|
1680
|
+
}, 1032, ["onClick"]), [
|
|
1675
1681
|
[vShow, _ctx.showDelete(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)]
|
|
1676
1682
|
])
|
|
1677
1683
|
]),
|
|
@@ -1729,7 +1735,8 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1729
1735
|
type: "selection",
|
|
1730
1736
|
width: "45"
|
|
1731
1737
|
})) : createCommentVNode("", true),
|
|
1732
|
-
|
|
1738
|
+
_ctx.showIndex && _ctx.config.showIndex ? (openBlock(), createBlock(_component_el_table_column, {
|
|
1739
|
+
key: 3,
|
|
1733
1740
|
width: "60",
|
|
1734
1741
|
label: "\u5E8F\u53F7"
|
|
1735
1742
|
}, {
|
|
@@ -1737,7 +1744,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1737
1744
|
createTextVNode(toDisplayString(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize), 1)
|
|
1738
1745
|
]),
|
|
1739
1746
|
_: 1
|
|
1740
|
-
}),
|
|
1747
|
+
})) : createCommentVNode("", true),
|
|
1741
1748
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (column, index) => {
|
|
1742
1749
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
1743
1750
|
column.type !== "hidden" && _ctx.display(column.display) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
@@ -3106,34 +3113,23 @@ const _sfc_main$6 = defineComponent({
|
|
|
3106
3113
|
return options2;
|
|
3107
3114
|
};
|
|
3108
3115
|
if (typeof props.config.options === "function") {
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
props.
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
});
|
|
3123
|
-
},
|
|
3124
|
-
{
|
|
3125
|
-
deep: true,
|
|
3126
|
-
immediate: true
|
|
3127
|
-
}
|
|
3128
|
-
);
|
|
3116
|
+
watchEffect(() => {
|
|
3117
|
+
typeof props.config.options === "function" && Promise.resolve(
|
|
3118
|
+
props.config.options(mForm, {
|
|
3119
|
+
model: props.model,
|
|
3120
|
+
prop: props.prop,
|
|
3121
|
+
formValues: mForm?.values,
|
|
3122
|
+
formValue: mForm?.values,
|
|
3123
|
+
config: props.config
|
|
3124
|
+
})
|
|
3125
|
+
).then((data) => {
|
|
3126
|
+
options.value = data;
|
|
3127
|
+
});
|
|
3128
|
+
});
|
|
3129
3129
|
} else if (Array.isArray(props.config.options)) {
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
options.value = props.config.options;
|
|
3134
|
-
},
|
|
3135
|
-
{ immediate: true }
|
|
3136
|
-
);
|
|
3130
|
+
watchEffect(() => {
|
|
3131
|
+
options.value = props.config.options;
|
|
3132
|
+
});
|
|
3137
3133
|
} else if (props.config.option) {
|
|
3138
3134
|
onBeforeMount(() => {
|
|
3139
3135
|
if (!props.model)
|
|
@@ -3904,7 +3900,7 @@ const install = (app, opt) => {
|
|
|
3904
3900
|
app.component(Panel.name, Panel);
|
|
3905
3901
|
app.component(Row.name, Row);
|
|
3906
3902
|
app.component(MStep.name, MStep);
|
|
3907
|
-
app.component(
|
|
3903
|
+
app.component("m-form-table", Table);
|
|
3908
3904
|
app.component(Tabs.name, Tabs);
|
|
3909
3905
|
app.component(Text.name, Text);
|
|
3910
3906
|
app.component(Number$1.name, Number$1);
|