@tmagic/form 1.0.0-beta.1 → 1.0.0-beta.2
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.es.js +19 -17
- package/dist/tmagic-form.es.js.map +1 -1
- package/dist/tmagic-form.umd.js +17 -15
- 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 +5 -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 +6 -6
- package/src/Form.vue +33 -29
- package/src/FormDialog.vue +3 -0
- package/src/containers/Tabs.vue +4 -0
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';
|
|
2
|
+
import { cloneDeep, isEqual } from 'lodash-es';
|
|
3
3
|
import { CaretRight, CaretBottom, Delete, ArrowDown, ArrowUp } from '@element-plus/icons';
|
|
4
|
-
import { ElMessage
|
|
4
|
+
import { ElMessage } from 'element-plus';
|
|
5
5
|
import Sortable from 'sortablejs';
|
|
6
6
|
import { asyncLoadJs, sleep, datetimeFormatter } from '@tmagic/utils';
|
|
7
7
|
|
|
@@ -1815,6 +1815,7 @@ const getActive = (mForm, props, activeTabName) => {
|
|
|
1815
1815
|
};
|
|
1816
1816
|
const tabClickHandler = (mForm, tab, props) => {
|
|
1817
1817
|
const { config, model, prop } = props;
|
|
1818
|
+
tab.name = tab.paneName;
|
|
1818
1819
|
if (typeof config.onTabClick === "function") {
|
|
1819
1820
|
config.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop });
|
|
1820
1821
|
}
|
|
@@ -3355,7 +3356,6 @@ var Time = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]])
|
|
|
3355
3356
|
|
|
3356
3357
|
const _sfc_main$1 = defineComponent({
|
|
3357
3358
|
name: "m-form",
|
|
3358
|
-
components: { ElForm, MContainer: Container },
|
|
3359
3359
|
props: {
|
|
3360
3360
|
initValues: {
|
|
3361
3361
|
type: Object,
|
|
@@ -3388,8 +3388,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
3388
3388
|
default: () => 1
|
|
3389
3389
|
},
|
|
3390
3390
|
size: {
|
|
3391
|
-
type: String
|
|
3392
|
-
default: "small"
|
|
3391
|
+
type: String
|
|
3393
3392
|
},
|
|
3394
3393
|
inline: {
|
|
3395
3394
|
type: Boolean,
|
|
@@ -3432,8 +3431,10 @@ const _sfc_main$1 = defineComponent({
|
|
|
3432
3431
|
}
|
|
3433
3432
|
});
|
|
3434
3433
|
provide("mForm", formState);
|
|
3435
|
-
|
|
3436
|
-
|
|
3434
|
+
watch([() => props.config, () => props.initValues], ([config], [preConfig]) => {
|
|
3435
|
+
if (!isEqual(toRaw(config), toRaw(preConfig))) {
|
|
3436
|
+
initialized.value = false;
|
|
3437
|
+
}
|
|
3437
3438
|
initValue(formState, {
|
|
3438
3439
|
initValues: props.initValues,
|
|
3439
3440
|
config: props.config
|
|
@@ -3441,7 +3442,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
3441
3442
|
values.value = value;
|
|
3442
3443
|
initialized.value = true;
|
|
3443
3444
|
});
|
|
3444
|
-
});
|
|
3445
|
+
}, { immediate: true });
|
|
3445
3446
|
return {
|
|
3446
3447
|
initialized,
|
|
3447
3448
|
values,
|
|
@@ -3474,10 +3475,9 @@ const _sfc_main$1 = defineComponent({
|
|
|
3474
3475
|
}
|
|
3475
3476
|
});
|
|
3476
3477
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3477
|
-
const
|
|
3478
|
-
const
|
|
3479
|
-
return
|
|
3480
|
-
key: 0,
|
|
3478
|
+
const _component_m_form_container = resolveComponent("m-form-container");
|
|
3479
|
+
const _component_el_form = resolveComponent("el-form");
|
|
3480
|
+
return openBlock(), createBlock(_component_el_form, {
|
|
3481
3481
|
class: "m-form",
|
|
3482
3482
|
ref: "elForm",
|
|
3483
3483
|
model: _ctx.values,
|
|
@@ -3488,8 +3488,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3488
3488
|
"label-position": _ctx.labelPosition
|
|
3489
3489
|
}, {
|
|
3490
3490
|
default: withCtx(() => [
|
|
3491
|
-
(openBlock(true), createElementBlock(Fragment,
|
|
3492
|
-
return openBlock(), createBlock(
|
|
3491
|
+
_ctx.initialized && Array.isArray(_ctx.config) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.config, (item, index) => {
|
|
3492
|
+
return openBlock(), createBlock(_component_m_form_container, {
|
|
3493
3493
|
key: item[_ctx.keyProp] ?? index,
|
|
3494
3494
|
config: item,
|
|
3495
3495
|
model: _ctx.values,
|
|
@@ -3498,10 +3498,10 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3498
3498
|
size: _ctx.size,
|
|
3499
3499
|
onChange: _ctx.changeHandler
|
|
3500
3500
|
}, null, 8, ["config", "model", "label-width", "step-active", "size", "onChange"]);
|
|
3501
|
-
}), 128))
|
|
3501
|
+
}), 128)) : createCommentVNode("", true)
|
|
3502
3502
|
]),
|
|
3503
3503
|
_: 1
|
|
3504
|
-
}, 8, ["model", "label-width", "disabled", "style", "inline", "label-position"])
|
|
3504
|
+
}, 8, ["model", "label-width", "disabled", "style", "inline", "label-position"]);
|
|
3505
3505
|
}
|
|
3506
3506
|
var Form = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
3507
3507
|
|
|
@@ -3521,6 +3521,7 @@ const _sfc_main = defineComponent({
|
|
|
3521
3521
|
default: () => []
|
|
3522
3522
|
},
|
|
3523
3523
|
labelWidth: [Number, String],
|
|
3524
|
+
size: String,
|
|
3524
3525
|
confirmText: {
|
|
3525
3526
|
type: String,
|
|
3526
3527
|
default: "\u786E\u5B9A"
|
|
@@ -3691,11 +3692,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3691
3692
|
modelValue: _ctx.stepActive,
|
|
3692
3693
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.stepActive = $event),
|
|
3693
3694
|
ref: "form",
|
|
3695
|
+
size: _ctx.size,
|
|
3694
3696
|
config: _ctx.config,
|
|
3695
3697
|
"init-values": _ctx.values,
|
|
3696
3698
|
"label-width": _ctx.labelWidth,
|
|
3697
3699
|
onChange: _ctx.changeHandler
|
|
3698
|
-
}, null, 8, ["modelValue", "config", "init-values", "label-width", "onChange"]),
|
|
3700
|
+
}, null, 8, ["modelValue", "size", "config", "init-values", "label-width", "onChange"]),
|
|
3699
3701
|
renderSlot(_ctx.$slots, "default")
|
|
3700
3702
|
], 4)
|
|
3701
3703
|
]),
|