@tmagic/form 1.0.0-beta.1 → 1.0.0-beta.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/style.css +0 -1
- package/dist/tmagic-form.es.js +29 -25
- package/dist/tmagic-form.es.js.map +1 -1
- package/dist/tmagic-form.umd.js +26 -22
- package/dist/tmagic-form.umd.js.map +1 -1
- package/dist/types/src/Form.vue.d.ts +10 -13
- package/dist/types/src/FormDialog.vue.d.ts +23 -26
- package/dist/types/src/containers/Container.vue.d.ts +1 -1
- package/dist/types/src/containers/Fieldset.vue.d.ts +1 -1
- package/dist/types/src/containers/GroupList.vue.d.ts +1 -1
- package/dist/types/src/containers/GroupListItem.vue.d.ts +1 -1
- package/dist/types/src/containers/Panel.vue.d.ts +1 -1
- package/dist/types/src/containers/Row.vue.d.ts +1 -1
- package/dist/types/src/containers/Step.vue.d.ts +1 -1
- package/dist/types/src/containers/Table.vue.d.ts +7 -5
- package/dist/types/src/containers/Tabs.vue.d.ts +2 -2
- package/dist/types/src/fields/Cascader.vue.d.ts +16 -16
- package/dist/types/src/fields/Checkbox.vue.d.ts +2 -2
- package/dist/types/src/fields/CheckboxGroup.vue.d.ts +2 -2
- package/dist/types/src/fields/Date.vue.d.ts +2 -2
- package/dist/types/src/fields/DateTime.vue.d.ts +2 -2
- package/dist/types/src/fields/Daterange.vue.d.ts +2 -2
- package/dist/types/src/fields/DynamicField.vue.d.ts +2 -2
- package/dist/types/src/fields/Link.vue.d.ts +47 -54
- package/dist/types/src/fields/Number.vue.d.ts +2 -2
- package/dist/types/src/fields/RadioGroup.vue.d.ts +2 -2
- package/dist/types/src/fields/Select.vue.d.ts +12 -12
- package/dist/types/src/fields/Switch.vue.d.ts +2 -2
- package/dist/types/src/fields/Text.vue.d.ts +2 -2
- package/dist/types/src/fields/Textarea.vue.d.ts +2 -2
- package/dist/types/src/fields/Time.vue.d.ts +2 -2
- package/package.json +7 -6
- package/src/Form.vue +33 -29
- package/src/FormDialog.vue +3 -0
- package/src/containers/Table.vue +8 -6
- package/src/containers/Tabs.vue +4 -0
- package/src/theme/table.scss +0 -1
package/dist/style.css
CHANGED
package/dist/tmagic-form.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, toRefs, getCurrentInstance, watch, unref, reactive, onBeforeUnmount, vModelText, onBeforeMount, resolveDirective, createSlots, provide } from 'vue';
|
|
2
|
-
import { cloneDeep } from 'lodash-es';
|
|
3
|
-
import { CaretRight, CaretBottom, Delete, ArrowDown, ArrowUp } from '@element-plus/icons';
|
|
4
|
-
import { ElMessage
|
|
2
|
+
import { cloneDeep, isEqual } from 'lodash-es';
|
|
3
|
+
import { CaretRight, CaretBottom, Delete, ArrowDown, ArrowUp, FullScreen, Grid } from '@element-plus/icons';
|
|
4
|
+
import { ElMessage } from 'element-plus';
|
|
5
5
|
import Sortable from 'sortablejs';
|
|
6
6
|
import { asyncLoadJs, sleep, datetimeFormatter } from '@tmagic/utils';
|
|
7
7
|
|
|
@@ -1359,6 +1359,8 @@ const _sfc_main$l = defineComponent({
|
|
|
1359
1359
|
ArrowDown,
|
|
1360
1360
|
ArrowUp,
|
|
1361
1361
|
Delete,
|
|
1362
|
+
FullScreen,
|
|
1363
|
+
Grid,
|
|
1362
1364
|
data: computed(() => props.model[modelName.value].filter((item, index) => index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value)),
|
|
1363
1365
|
addable: computed(() => {
|
|
1364
1366
|
if (!props.model[modelName.value].length) {
|
|
@@ -1607,7 +1609,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1607
1609
|
})) : createCommentVNode("", true),
|
|
1608
1610
|
createVNode(_component_el_table_column, {
|
|
1609
1611
|
label: "\u64CD\u4F5C",
|
|
1610
|
-
width: "
|
|
1612
|
+
width: "60",
|
|
1611
1613
|
fixed: _ctx.config.fixed === false ? void 0 : "left"
|
|
1612
1614
|
}, {
|
|
1613
1615
|
default: withCtx((scope) => [
|
|
@@ -1625,7 +1627,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1625
1627
|
_ctx.sort && _ctx.model[_ctx.modelName] && _ctx.model[_ctx.modelName].length > 1 ? (openBlock(), createBlock(_component_el_table_column, {
|
|
1626
1628
|
key: 1,
|
|
1627
1629
|
label: "\u6392\u5E8F",
|
|
1628
|
-
width: "
|
|
1630
|
+
width: "60"
|
|
1629
1631
|
}, {
|
|
1630
1632
|
default: withCtx((scope) => [
|
|
1631
1633
|
scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1 !== 0 ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
@@ -1673,7 +1675,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1673
1675
|
width: "45"
|
|
1674
1676
|
})) : createCommentVNode("", true),
|
|
1675
1677
|
createVNode(_component_el_table_column, {
|
|
1676
|
-
width: "
|
|
1678
|
+
width: "60",
|
|
1677
1679
|
label: "\u5E8F\u53F7"
|
|
1678
1680
|
}, {
|
|
1679
1681
|
default: withCtx((scope) => [
|
|
@@ -1730,7 +1732,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1730
1732
|
_hoisted_5,
|
|
1731
1733
|
_ctx.enableToggleMode && !_ctx.isFullscreen ? (openBlock(), createBlock(_component_el_button, {
|
|
1732
1734
|
key: 1,
|
|
1733
|
-
icon:
|
|
1735
|
+
icon: _ctx.Grid,
|
|
1734
1736
|
size: "small",
|
|
1735
1737
|
onClick: _ctx.toggleMode
|
|
1736
1738
|
}, {
|
|
@@ -1738,10 +1740,10 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1738
1740
|
_hoisted_6
|
|
1739
1741
|
]),
|
|
1740
1742
|
_: 1
|
|
1741
|
-
}, 8, ["onClick"])) : createCommentVNode("", true),
|
|
1743
|
+
}, 8, ["icon", "onClick"])) : createCommentVNode("", true),
|
|
1742
1744
|
_ctx.config.enableFullscreen !== false ? (openBlock(), createBlock(_component_el_button, {
|
|
1743
1745
|
key: 2,
|
|
1744
|
-
icon:
|
|
1746
|
+
icon: _ctx.FullScreen,
|
|
1745
1747
|
size: "small",
|
|
1746
1748
|
onClick: _ctx.toggleFullscreen
|
|
1747
1749
|
}, {
|
|
@@ -1749,7 +1751,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1749
1751
|
createTextVNode(toDisplayString(_ctx.isFullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F\u7F16\u8F91"), 1)
|
|
1750
1752
|
]),
|
|
1751
1753
|
_: 1
|
|
1752
|
-
}, 8, ["onClick"])) : createCommentVNode("", true),
|
|
1754
|
+
}, 8, ["icon", "onClick"])) : createCommentVNode("", true),
|
|
1753
1755
|
_ctx.importable ? (openBlock(), createBlock(_component_el_upload, {
|
|
1754
1756
|
key: 3,
|
|
1755
1757
|
ref: "excelBtn",
|
|
@@ -1815,6 +1817,7 @@ const getActive = (mForm, props, activeTabName) => {
|
|
|
1815
1817
|
};
|
|
1816
1818
|
const tabClickHandler = (mForm, tab, props) => {
|
|
1817
1819
|
const { config, model, prop } = props;
|
|
1820
|
+
tab.name = tab.paneName;
|
|
1818
1821
|
if (typeof config.onTabClick === "function") {
|
|
1819
1822
|
config.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop });
|
|
1820
1823
|
}
|
|
@@ -3355,7 +3358,6 @@ var Time = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]])
|
|
|
3355
3358
|
|
|
3356
3359
|
const _sfc_main$1 = defineComponent({
|
|
3357
3360
|
name: "m-form",
|
|
3358
|
-
components: { ElForm, MContainer: Container },
|
|
3359
3361
|
props: {
|
|
3360
3362
|
initValues: {
|
|
3361
3363
|
type: Object,
|
|
@@ -3388,8 +3390,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
3388
3390
|
default: () => 1
|
|
3389
3391
|
},
|
|
3390
3392
|
size: {
|
|
3391
|
-
type: String
|
|
3392
|
-
default: "small"
|
|
3393
|
+
type: String
|
|
3393
3394
|
},
|
|
3394
3395
|
inline: {
|
|
3395
3396
|
type: Boolean,
|
|
@@ -3432,8 +3433,10 @@ const _sfc_main$1 = defineComponent({
|
|
|
3432
3433
|
}
|
|
3433
3434
|
});
|
|
3434
3435
|
provide("mForm", formState);
|
|
3435
|
-
|
|
3436
|
-
|
|
3436
|
+
watch([() => props.config, () => props.initValues], ([config], [preConfig]) => {
|
|
3437
|
+
if (!isEqual(toRaw(config), toRaw(preConfig))) {
|
|
3438
|
+
initialized.value = false;
|
|
3439
|
+
}
|
|
3437
3440
|
initValue(formState, {
|
|
3438
3441
|
initValues: props.initValues,
|
|
3439
3442
|
config: props.config
|
|
@@ -3441,7 +3444,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
3441
3444
|
values.value = value;
|
|
3442
3445
|
initialized.value = true;
|
|
3443
3446
|
});
|
|
3444
|
-
});
|
|
3447
|
+
}, { immediate: true });
|
|
3445
3448
|
return {
|
|
3446
3449
|
initialized,
|
|
3447
3450
|
values,
|
|
@@ -3474,10 +3477,9 @@ const _sfc_main$1 = defineComponent({
|
|
|
3474
3477
|
}
|
|
3475
3478
|
});
|
|
3476
3479
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3477
|
-
const
|
|
3478
|
-
const
|
|
3479
|
-
return
|
|
3480
|
-
key: 0,
|
|
3480
|
+
const _component_m_form_container = resolveComponent("m-form-container");
|
|
3481
|
+
const _component_el_form = resolveComponent("el-form");
|
|
3482
|
+
return openBlock(), createBlock(_component_el_form, {
|
|
3481
3483
|
class: "m-form",
|
|
3482
3484
|
ref: "elForm",
|
|
3483
3485
|
model: _ctx.values,
|
|
@@ -3488,8 +3490,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3488
3490
|
"label-position": _ctx.labelPosition
|
|
3489
3491
|
}, {
|
|
3490
3492
|
default: withCtx(() => [
|
|
3491
|
-
(openBlock(true), createElementBlock(Fragment,
|
|
3492
|
-
return openBlock(), createBlock(
|
|
3493
|
+
_ctx.initialized && Array.isArray(_ctx.config) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.config, (item, index) => {
|
|
3494
|
+
return openBlock(), createBlock(_component_m_form_container, {
|
|
3493
3495
|
key: item[_ctx.keyProp] ?? index,
|
|
3494
3496
|
config: item,
|
|
3495
3497
|
model: _ctx.values,
|
|
@@ -3498,10 +3500,10 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3498
3500
|
size: _ctx.size,
|
|
3499
3501
|
onChange: _ctx.changeHandler
|
|
3500
3502
|
}, null, 8, ["config", "model", "label-width", "step-active", "size", "onChange"]);
|
|
3501
|
-
}), 128))
|
|
3503
|
+
}), 128)) : createCommentVNode("", true)
|
|
3502
3504
|
]),
|
|
3503
3505
|
_: 1
|
|
3504
|
-
}, 8, ["model", "label-width", "disabled", "style", "inline", "label-position"])
|
|
3506
|
+
}, 8, ["model", "label-width", "disabled", "style", "inline", "label-position"]);
|
|
3505
3507
|
}
|
|
3506
3508
|
var Form = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
3507
3509
|
|
|
@@ -3521,6 +3523,7 @@ const _sfc_main = defineComponent({
|
|
|
3521
3523
|
default: () => []
|
|
3522
3524
|
},
|
|
3523
3525
|
labelWidth: [Number, String],
|
|
3526
|
+
size: String,
|
|
3524
3527
|
confirmText: {
|
|
3525
3528
|
type: String,
|
|
3526
3529
|
default: "\u786E\u5B9A"
|
|
@@ -3691,11 +3694,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3691
3694
|
modelValue: _ctx.stepActive,
|
|
3692
3695
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.stepActive = $event),
|
|
3693
3696
|
ref: "form",
|
|
3697
|
+
size: _ctx.size,
|
|
3694
3698
|
config: _ctx.config,
|
|
3695
3699
|
"init-values": _ctx.values,
|
|
3696
3700
|
"label-width": _ctx.labelWidth,
|
|
3697
3701
|
onChange: _ctx.changeHandler
|
|
3698
|
-
}, null, 8, ["modelValue", "config", "init-values", "label-width", "onChange"]),
|
|
3702
|
+
}, null, 8, ["modelValue", "size", "config", "init-values", "label-width", "onChange"]),
|
|
3699
3703
|
renderSlot(_ctx.$slots, "default")
|
|
3700
3704
|
], 4)
|
|
3701
3705
|
]),
|