@tmagic/form 1.4.3 → 1.4.5
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 +2 -2
- package/dist/tmagic-form.js +59 -17
- package/dist/tmagic-form.umd.cjs +59 -17
- package/package.json +13 -15
- package/src/fields/Cascader.vue +32 -7
- package/src/fields/Select.vue +17 -6
- package/src/schema.ts +4 -1
- package/types/Form.vue.d.ts +2 -1
- package/types/FormBox.vue.d.ts +15 -15
- package/types/FormDialog.vue.d.ts +15 -15
- package/types/FormDrawer.vue.d.ts +15 -15
- package/types/containers/Container.vue.d.ts +1 -1
- package/types/schema.d.ts +4 -1
package/dist/style.css
CHANGED
|
@@ -66,7 +66,7 @@ div.m-fields-link {
|
|
|
66
66
|
|
|
67
67
|
fieldset.m-fieldset {
|
|
68
68
|
position: relative;
|
|
69
|
-
border: 1px solid
|
|
69
|
+
border: 1px solid rgb(229, 229, 229);
|
|
70
70
|
margin-top: 10px;
|
|
71
71
|
margin-bottom: 10px;
|
|
72
72
|
min-inline-size: auto;
|
|
@@ -80,7 +80,7 @@ fieldset.m-fieldset legend {
|
|
|
80
80
|
border: 0;
|
|
81
81
|
top: -10px;
|
|
82
82
|
left: 20px;
|
|
83
|
-
background:
|
|
83
|
+
background: rgb(255, 255, 255);
|
|
84
84
|
width: auto;
|
|
85
85
|
padding: 0px 3px;
|
|
86
86
|
font-weight: bold;
|
package/dist/tmagic-form.js
CHANGED
|
@@ -2117,7 +2117,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
2117
2117
|
(openBlock(true), createElementBlock(Fragment, null, renderList(tabs.value, (tab, tabIndex) => {
|
|
2118
2118
|
return openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), mergeProps(
|
|
2119
2119
|
{
|
|
2120
|
-
key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex
|
|
2120
|
+
key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex,
|
|
2121
|
+
ref_for: true
|
|
2121
2122
|
},
|
|
2122
2123
|
unref(tabPaneComponent)?.props({ name: filter(tab.status) || tabIndex.toString(), lazy: tab.lazy || false }) || {}
|
|
2123
2124
|
), {
|
|
@@ -2211,6 +2212,21 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2211
2212
|
const tMagicCascader = ref();
|
|
2212
2213
|
const options = ref([]);
|
|
2213
2214
|
const remoteData = ref(null);
|
|
2215
|
+
const value = computed({
|
|
2216
|
+
get() {
|
|
2217
|
+
if (typeof props.model[props.name] === "string" && props.config.valueSeparator) {
|
|
2218
|
+
return props.model[props.name].split(props.config.valueSeparator);
|
|
2219
|
+
}
|
|
2220
|
+
return props.model[props.name];
|
|
2221
|
+
},
|
|
2222
|
+
set(value2) {
|
|
2223
|
+
let result = value2;
|
|
2224
|
+
if (props.config.valueSeparator) {
|
|
2225
|
+
result = value2.join(props.config.valueSeparator);
|
|
2226
|
+
}
|
|
2227
|
+
props.model[props.name] = result;
|
|
2228
|
+
}
|
|
2229
|
+
});
|
|
2214
2230
|
const setRemoteOptions = async function() {
|
|
2215
2231
|
const { config } = props;
|
|
2216
2232
|
const { option } = config;
|
|
@@ -2241,9 +2257,17 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2241
2257
|
}
|
|
2242
2258
|
};
|
|
2243
2259
|
if (typeof props.config.options === "function" && props.model && mForm) {
|
|
2244
|
-
watchEffect(
|
|
2245
|
-
|
|
2246
|
-
|
|
2260
|
+
watchEffect(() => {
|
|
2261
|
+
typeof props.config.options === "function" && Promise.resolve(
|
|
2262
|
+
props.config.options(mForm, {
|
|
2263
|
+
model: props.model,
|
|
2264
|
+
prop: props.prop,
|
|
2265
|
+
formValue: mForm?.values
|
|
2266
|
+
})
|
|
2267
|
+
).then((data) => {
|
|
2268
|
+
options.value = data;
|
|
2269
|
+
});
|
|
2270
|
+
});
|
|
2247
2271
|
} else if (!props.config.options?.length || props.config.remote) {
|
|
2248
2272
|
Promise.resolve(setRemoteOptions());
|
|
2249
2273
|
} else if (Array.isArray(props.config.options)) {
|
|
@@ -2251,17 +2275,17 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2251
2275
|
options.value = props.config.options;
|
|
2252
2276
|
});
|
|
2253
2277
|
}
|
|
2254
|
-
const changeHandler = (
|
|
2278
|
+
const changeHandler = () => {
|
|
2255
2279
|
if (!tMagicCascader.value)
|
|
2256
2280
|
return;
|
|
2257
2281
|
tMagicCascader.value.setQuery("");
|
|
2258
2282
|
tMagicCascader.value.setPreviousQuery(null);
|
|
2259
|
-
emit("change",
|
|
2283
|
+
emit("change", props.model[props.name]);
|
|
2260
2284
|
};
|
|
2261
2285
|
return (_ctx, _cache) => {
|
|
2262
2286
|
return openBlock(), createBlock(unref(TMagicCascader), {
|
|
2263
|
-
modelValue:
|
|
2264
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
2287
|
+
modelValue: value.value,
|
|
2288
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
2265
2289
|
ref_key: "tMagicCascader",
|
|
2266
2290
|
ref: tMagicCascader,
|
|
2267
2291
|
style: { "width": "100%" },
|
|
@@ -3756,38 +3780,56 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
3756
3780
|
}, {
|
|
3757
3781
|
default: withCtx(() => [
|
|
3758
3782
|
_ctx.config.group ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(options.value, (group, index) => {
|
|
3759
|
-
return openBlock(), createBlock(resolveDynamicComponent(unref(optionGroupComponent)?.component), mergeProps(
|
|
3760
|
-
{
|
|
3783
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(optionGroupComponent)?.component || "el-option-group"), mergeProps(
|
|
3784
|
+
{
|
|
3785
|
+
key: index,
|
|
3786
|
+
ref_for: true
|
|
3787
|
+
},
|
|
3761
3788
|
unref(optionGroupComponent)?.props({
|
|
3762
3789
|
label: group.label,
|
|
3763
3790
|
disabled: group.disabled
|
|
3764
|
-
})
|
|
3791
|
+
}) || {
|
|
3792
|
+
label: group.label,
|
|
3793
|
+
disabled: group.disabled
|
|
3794
|
+
}
|
|
3765
3795
|
), {
|
|
3766
3796
|
default: withCtx(() => [
|
|
3767
3797
|
(openBlock(true), createElementBlock(Fragment, null, renderList(group.options, (item, index2) => {
|
|
3768
|
-
return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)?.component), mergeProps(
|
|
3769
|
-
{
|
|
3798
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)?.component || "el-option"), mergeProps(
|
|
3799
|
+
{
|
|
3800
|
+
key: index2,
|
|
3801
|
+
ref_for: true
|
|
3802
|
+
},
|
|
3770
3803
|
unref(optionComponent)?.props({
|
|
3771
3804
|
label: item.label || item.text,
|
|
3772
3805
|
value: item.value,
|
|
3773
3806
|
disabled: item.disabled
|
|
3774
|
-
})
|
|
3807
|
+
}) || {
|
|
3808
|
+
label: item.label || item.text,
|
|
3809
|
+
value: item.value,
|
|
3810
|
+
disabled: item.disabled
|
|
3811
|
+
}
|
|
3775
3812
|
), null, 16);
|
|
3776
3813
|
}), 128))
|
|
3777
3814
|
]),
|
|
3778
3815
|
_: 2
|
|
3779
3816
|
}, 1040);
|
|
3780
3817
|
}), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(options.value, (option) => {
|
|
3781
|
-
return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)?.component), mergeProps(
|
|
3818
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)?.component || "el-option"), mergeProps(
|
|
3782
3819
|
{
|
|
3783
3820
|
class: "tmagic-design-option",
|
|
3784
|
-
key: _ctx.config.valueKey ? option.value[_ctx.config.valueKey] : option.value
|
|
3821
|
+
key: _ctx.config.valueKey ? option.value[_ctx.config.valueKey] : option.value,
|
|
3822
|
+
ref_for: true
|
|
3785
3823
|
},
|
|
3786
3824
|
unref(optionComponent)?.props({
|
|
3787
3825
|
label: option.text,
|
|
3788
3826
|
value: option.value,
|
|
3789
3827
|
disabled: option.disabled
|
|
3790
|
-
})
|
|
3828
|
+
}) || {
|
|
3829
|
+
label: option.text,
|
|
3830
|
+
value: option.value,
|
|
3831
|
+
disabled: option.disabled
|
|
3832
|
+
}
|
|
3791
3833
|
), null, 16);
|
|
3792
3834
|
}), 128)),
|
|
3793
3835
|
moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$2, null, 512)), [
|
package/dist/tmagic-form.umd.cjs
CHANGED
|
@@ -2116,7 +2116,8 @@
|
|
|
2116
2116
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(tabs.value, (tab, tabIndex) => {
|
|
2117
2117
|
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabPaneComponent)?.component || "el-tab-pane"), vue.mergeProps(
|
|
2118
2118
|
{
|
|
2119
|
-
key: tab[vue.unref(mForm)?.keyProp || "__key"] ?? tabIndex
|
|
2119
|
+
key: tab[vue.unref(mForm)?.keyProp || "__key"] ?? tabIndex,
|
|
2120
|
+
ref_for: true
|
|
2120
2121
|
},
|
|
2121
2122
|
vue.unref(tabPaneComponent)?.props({ name: filter(tab.status) || tabIndex.toString(), lazy: tab.lazy || false }) || {}
|
|
2122
2123
|
), {
|
|
@@ -2210,6 +2211,21 @@
|
|
|
2210
2211
|
const tMagicCascader = vue.ref();
|
|
2211
2212
|
const options = vue.ref([]);
|
|
2212
2213
|
const remoteData = vue.ref(null);
|
|
2214
|
+
const value = vue.computed({
|
|
2215
|
+
get() {
|
|
2216
|
+
if (typeof props.model[props.name] === "string" && props.config.valueSeparator) {
|
|
2217
|
+
return props.model[props.name].split(props.config.valueSeparator);
|
|
2218
|
+
}
|
|
2219
|
+
return props.model[props.name];
|
|
2220
|
+
},
|
|
2221
|
+
set(value2) {
|
|
2222
|
+
let result = value2;
|
|
2223
|
+
if (props.config.valueSeparator) {
|
|
2224
|
+
result = value2.join(props.config.valueSeparator);
|
|
2225
|
+
}
|
|
2226
|
+
props.model[props.name] = result;
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2213
2229
|
const setRemoteOptions = async function() {
|
|
2214
2230
|
const { config } = props;
|
|
2215
2231
|
const { option } = config;
|
|
@@ -2240,9 +2256,17 @@
|
|
|
2240
2256
|
}
|
|
2241
2257
|
};
|
|
2242
2258
|
if (typeof props.config.options === "function" && props.model && mForm) {
|
|
2243
|
-
vue.watchEffect(
|
|
2244
|
-
|
|
2245
|
-
|
|
2259
|
+
vue.watchEffect(() => {
|
|
2260
|
+
typeof props.config.options === "function" && Promise.resolve(
|
|
2261
|
+
props.config.options(mForm, {
|
|
2262
|
+
model: props.model,
|
|
2263
|
+
prop: props.prop,
|
|
2264
|
+
formValue: mForm?.values
|
|
2265
|
+
})
|
|
2266
|
+
).then((data) => {
|
|
2267
|
+
options.value = data;
|
|
2268
|
+
});
|
|
2269
|
+
});
|
|
2246
2270
|
} else if (!props.config.options?.length || props.config.remote) {
|
|
2247
2271
|
Promise.resolve(setRemoteOptions());
|
|
2248
2272
|
} else if (Array.isArray(props.config.options)) {
|
|
@@ -2250,17 +2274,17 @@
|
|
|
2250
2274
|
options.value = props.config.options;
|
|
2251
2275
|
});
|
|
2252
2276
|
}
|
|
2253
|
-
const changeHandler = (
|
|
2277
|
+
const changeHandler = () => {
|
|
2254
2278
|
if (!tMagicCascader.value)
|
|
2255
2279
|
return;
|
|
2256
2280
|
tMagicCascader.value.setQuery("");
|
|
2257
2281
|
tMagicCascader.value.setPreviousQuery(null);
|
|
2258
|
-
emit("change",
|
|
2282
|
+
emit("change", props.model[props.name]);
|
|
2259
2283
|
};
|
|
2260
2284
|
return (_ctx, _cache) => {
|
|
2261
2285
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCascader), {
|
|
2262
|
-
modelValue:
|
|
2263
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
2286
|
+
modelValue: value.value,
|
|
2287
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
2264
2288
|
ref_key: "tMagicCascader",
|
|
2265
2289
|
ref: tMagicCascader,
|
|
2266
2290
|
style: { "width": "100%" },
|
|
@@ -3755,38 +3779,56 @@
|
|
|
3755
3779
|
}, {
|
|
3756
3780
|
default: vue.withCtx(() => [
|
|
3757
3781
|
_ctx.config.group ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(options.value, (group, index) => {
|
|
3758
|
-
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(optionGroupComponent)?.component), vue.mergeProps(
|
|
3759
|
-
{
|
|
3782
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(optionGroupComponent)?.component || "el-option-group"), vue.mergeProps(
|
|
3783
|
+
{
|
|
3784
|
+
key: index,
|
|
3785
|
+
ref_for: true
|
|
3786
|
+
},
|
|
3760
3787
|
vue.unref(optionGroupComponent)?.props({
|
|
3761
3788
|
label: group.label,
|
|
3762
3789
|
disabled: group.disabled
|
|
3763
|
-
})
|
|
3790
|
+
}) || {
|
|
3791
|
+
label: group.label,
|
|
3792
|
+
disabled: group.disabled
|
|
3793
|
+
}
|
|
3764
3794
|
), {
|
|
3765
3795
|
default: vue.withCtx(() => [
|
|
3766
3796
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.options, (item, index2) => {
|
|
3767
|
-
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(optionComponent)?.component), vue.mergeProps(
|
|
3768
|
-
{
|
|
3797
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(optionComponent)?.component || "el-option"), vue.mergeProps(
|
|
3798
|
+
{
|
|
3799
|
+
key: index2,
|
|
3800
|
+
ref_for: true
|
|
3801
|
+
},
|
|
3769
3802
|
vue.unref(optionComponent)?.props({
|
|
3770
3803
|
label: item.label || item.text,
|
|
3771
3804
|
value: item.value,
|
|
3772
3805
|
disabled: item.disabled
|
|
3773
|
-
})
|
|
3806
|
+
}) || {
|
|
3807
|
+
label: item.label || item.text,
|
|
3808
|
+
value: item.value,
|
|
3809
|
+
disabled: item.disabled
|
|
3810
|
+
}
|
|
3774
3811
|
), null, 16);
|
|
3775
3812
|
}), 128))
|
|
3776
3813
|
]),
|
|
3777
3814
|
_: 2
|
|
3778
3815
|
}, 1040);
|
|
3779
3816
|
}), 128)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(options.value, (option) => {
|
|
3780
|
-
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(optionComponent)?.component), vue.mergeProps(
|
|
3817
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(optionComponent)?.component || "el-option"), vue.mergeProps(
|
|
3781
3818
|
{
|
|
3782
3819
|
class: "tmagic-design-option",
|
|
3783
|
-
key: _ctx.config.valueKey ? option.value[_ctx.config.valueKey] : option.value
|
|
3820
|
+
key: _ctx.config.valueKey ? option.value[_ctx.config.valueKey] : option.value,
|
|
3821
|
+
ref_for: true
|
|
3784
3822
|
},
|
|
3785
3823
|
vue.unref(optionComponent)?.props({
|
|
3786
3824
|
label: option.text,
|
|
3787
3825
|
value: option.value,
|
|
3788
3826
|
disabled: option.disabled
|
|
3789
|
-
})
|
|
3827
|
+
}) || {
|
|
3828
|
+
label: option.text,
|
|
3829
|
+
value: option.value,
|
|
3830
|
+
disabled: option.disabled
|
|
3831
|
+
}
|
|
3790
3832
|
), null, 16);
|
|
3791
3833
|
}), 128)),
|
|
3792
3834
|
moreLoadingVisible.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, null, 512)), [
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.4.
|
|
2
|
+
"version": "1.4.5",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -32,33 +32,31 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@element-plus/icons-vue": "^2.3.1",
|
|
35
|
-
"@tmagic/design": "1.4.3",
|
|
36
|
-
"@tmagic/utils": "1.4.3",
|
|
37
35
|
"lodash-es": "^4.17.21",
|
|
38
|
-
"sortablejs": "^1.
|
|
39
|
-
"vue": "^3.4.21"
|
|
36
|
+
"sortablejs": "^1.15.2"
|
|
40
37
|
},
|
|
41
38
|
"peerDependencies": {
|
|
42
|
-
"vue": "^3.4.
|
|
39
|
+
"vue": "^3.4.27",
|
|
40
|
+
"@tmagic/design": "1.4.5",
|
|
41
|
+
"@tmagic/utils": "1.4.5"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@babel/core": "^7.18.0",
|
|
46
44
|
"@types/lodash-es": "^4.17.4",
|
|
47
45
|
"@types/node": "^18.19.0",
|
|
48
|
-
"@types/sortablejs": "^1.
|
|
49
|
-
"@vitejs/plugin-vue": "^
|
|
50
|
-
"@vue/compiler-sfc": "^3.4.
|
|
51
|
-
"@vue/test-utils": "^2.4.
|
|
46
|
+
"@types/sortablejs": "^1.15.8",
|
|
47
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
48
|
+
"@vue/compiler-sfc": "^3.4.27",
|
|
49
|
+
"@vue/test-utils": "^2.4.6",
|
|
52
50
|
"rimraf": "^3.0.2",
|
|
53
|
-
"sass": "^1.
|
|
51
|
+
"sass": "^1.77.0",
|
|
54
52
|
"typescript": "^5.4.2",
|
|
55
|
-
"vite": "^5.
|
|
56
|
-
"vue-tsc": "^2.0.
|
|
53
|
+
"vite": "^5.2.11",
|
|
54
|
+
"vue-tsc": "^2.0.16"
|
|
57
55
|
},
|
|
58
56
|
"scripts": {
|
|
59
57
|
"build": "npm run build:type && vite build",
|
|
60
58
|
"build:type": "npm run clear:type && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
|
|
61
59
|
"clear:type": "rimraf ./types",
|
|
62
|
-
"type
|
|
60
|
+
"check:type": "vue-tsc --noEmit --project tsconfig.build.json"
|
|
63
61
|
}
|
|
64
62
|
}
|
package/src/fields/Cascader.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<TMagicCascader
|
|
3
|
-
v-model="
|
|
3
|
+
v-model="value"
|
|
4
4
|
ref="tMagicCascader"
|
|
5
5
|
style="width: 100%"
|
|
6
6
|
clearable
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script setup lang="ts">
|
|
23
|
-
import { inject, ref, watchEffect } from 'vue';
|
|
23
|
+
import { computed, inject, ref, watchEffect } from 'vue';
|
|
24
24
|
|
|
25
25
|
import { TMagicCascader } from '@tmagic/design';
|
|
26
26
|
|
|
@@ -47,6 +47,22 @@ const tMagicCascader = ref<InstanceType<typeof TMagicCascader>>();
|
|
|
47
47
|
const options = ref<CascaderOption[]>([]);
|
|
48
48
|
const remoteData = ref<any>(null);
|
|
49
49
|
|
|
50
|
+
const value = computed({
|
|
51
|
+
get() {
|
|
52
|
+
if (typeof props.model[props.name] === 'string' && props.config.valueSeparator) {
|
|
53
|
+
return props.model[props.name].split(props.config.valueSeparator);
|
|
54
|
+
}
|
|
55
|
+
return props.model[props.name];
|
|
56
|
+
},
|
|
57
|
+
set(value) {
|
|
58
|
+
let result = value;
|
|
59
|
+
if (props.config.valueSeparator) {
|
|
60
|
+
result = value.join(props.config.valueSeparator);
|
|
61
|
+
}
|
|
62
|
+
props.model[props.name] = result;
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
50
66
|
const setRemoteOptions = async function () {
|
|
51
67
|
const { config } = props;
|
|
52
68
|
const { option } = config;
|
|
@@ -82,9 +98,18 @@ const setRemoteOptions = async function () {
|
|
|
82
98
|
|
|
83
99
|
// 初始化
|
|
84
100
|
if (typeof props.config.options === 'function' && props.model && mForm) {
|
|
85
|
-
watchEffect(
|
|
86
|
-
|
|
87
|
-
|
|
101
|
+
watchEffect(() => {
|
|
102
|
+
typeof props.config.options === 'function' &&
|
|
103
|
+
Promise.resolve(
|
|
104
|
+
props.config.options(mForm, {
|
|
105
|
+
model: props.model,
|
|
106
|
+
prop: props.prop,
|
|
107
|
+
formValue: mForm?.values,
|
|
108
|
+
}),
|
|
109
|
+
).then((data) => {
|
|
110
|
+
options.value = data;
|
|
111
|
+
});
|
|
112
|
+
});
|
|
88
113
|
} else if (!props.config.options?.length || props.config.remote) {
|
|
89
114
|
Promise.resolve(setRemoteOptions());
|
|
90
115
|
} else if (Array.isArray(props.config.options)) {
|
|
@@ -93,10 +118,10 @@ if (typeof props.config.options === 'function' && props.model && mForm) {
|
|
|
93
118
|
});
|
|
94
119
|
}
|
|
95
120
|
|
|
96
|
-
const changeHandler = (
|
|
121
|
+
const changeHandler = () => {
|
|
97
122
|
if (!tMagicCascader.value) return;
|
|
98
123
|
tMagicCascader.value.setQuery('');
|
|
99
124
|
tMagicCascader.value.setPreviousQuery(null);
|
|
100
|
-
emit('change',
|
|
125
|
+
emit('change', props.model[props.name]);
|
|
101
126
|
};
|
|
102
127
|
</script>
|
package/src/fields/Select.vue
CHANGED
|
@@ -23,24 +23,31 @@
|
|
|
23
23
|
<component
|
|
24
24
|
v-for="(group, index) in (options as SelectGroupOption[])"
|
|
25
25
|
:key="index"
|
|
26
|
-
:is="optionGroupComponent?.component"
|
|
26
|
+
:is="optionGroupComponent?.component || 'el-option-group'"
|
|
27
27
|
v-bind="
|
|
28
28
|
optionGroupComponent?.props({
|
|
29
29
|
label: group.label,
|
|
30
30
|
disabled: group.disabled,
|
|
31
|
-
})
|
|
31
|
+
}) || {
|
|
32
|
+
label: group.label,
|
|
33
|
+
disabled: group.disabled,
|
|
34
|
+
}
|
|
32
35
|
"
|
|
33
36
|
>
|
|
34
37
|
<component
|
|
35
38
|
v-for="(item, index) in group.options"
|
|
36
|
-
:is="optionComponent?.component"
|
|
39
|
+
:is="optionComponent?.component || 'el-option'"
|
|
37
40
|
:key="index"
|
|
38
41
|
v-bind="
|
|
39
42
|
optionComponent?.props({
|
|
40
43
|
label: item.label || item.text,
|
|
41
44
|
value: item.value,
|
|
42
45
|
disabled: item.disabled,
|
|
43
|
-
})
|
|
46
|
+
}) || {
|
|
47
|
+
label: item.label || item.text,
|
|
48
|
+
value: item.value,
|
|
49
|
+
disabled: item.disabled,
|
|
50
|
+
}
|
|
44
51
|
"
|
|
45
52
|
>
|
|
46
53
|
</component>
|
|
@@ -51,13 +58,17 @@
|
|
|
51
58
|
v-for="option in (options as SelectOption[])"
|
|
52
59
|
class="tmagic-design-option"
|
|
53
60
|
:key="config.valueKey ? option.value[config.valueKey] : option.value"
|
|
54
|
-
:is="optionComponent?.component"
|
|
61
|
+
:is="optionComponent?.component || 'el-option'"
|
|
55
62
|
v-bind="
|
|
56
63
|
optionComponent?.props({
|
|
57
64
|
label: option.text,
|
|
58
65
|
value: option.value,
|
|
59
66
|
disabled: option.disabled,
|
|
60
|
-
})
|
|
67
|
+
}) || {
|
|
68
|
+
label: option.text,
|
|
69
|
+
value: option.value,
|
|
70
|
+
disabled: option.disabled,
|
|
71
|
+
}
|
|
61
72
|
"
|
|
62
73
|
>
|
|
63
74
|
</component>
|
package/src/schema.ts
CHANGED
|
@@ -539,12 +539,15 @@ export interface CascaderConfig extends FormItem, Input {
|
|
|
539
539
|
checkStrictly?: boolean;
|
|
540
540
|
/** 弹出内容的自定义类名 */
|
|
541
541
|
popperClass?: string;
|
|
542
|
+
/** 合并成字符串时的分隔符 */
|
|
543
|
+
valueSeparator?: string;
|
|
542
544
|
options?:
|
|
543
545
|
| ((
|
|
544
546
|
mForm: FormState | undefined,
|
|
545
547
|
data: {
|
|
546
548
|
model: Record<any, any>;
|
|
547
|
-
|
|
549
|
+
prop: string;
|
|
550
|
+
formValue: Record<any, any>;
|
|
548
551
|
},
|
|
549
552
|
) => CascaderOption[])
|
|
550
553
|
| CascaderOption[];
|
package/types/Form.vue.d.ts
CHANGED
|
@@ -92,12 +92,13 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
92
92
|
parentValues: Record<string, any>;
|
|
93
93
|
labelWidth: string;
|
|
94
94
|
disabled: boolean;
|
|
95
|
-
height: string;
|
|
96
95
|
stepActive: string | number;
|
|
96
|
+
height: string;
|
|
97
97
|
inline: boolean;
|
|
98
98
|
labelPosition: string;
|
|
99
99
|
}, {}>;
|
|
100
100
|
export default _default;
|
|
101
|
+
|
|
101
102
|
type __VLS_WithDefaults<P, D> = {
|
|
102
103
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
103
104
|
default: D[K];
|
package/types/FormBox.vue.d.ts
CHANGED
|
@@ -54,10 +54,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
54
54
|
type: import("vue").PropType<boolean>;
|
|
55
55
|
default: boolean;
|
|
56
56
|
};
|
|
57
|
-
height: {
|
|
58
|
-
type: import("vue").PropType<string>;
|
|
59
|
-
default: string;
|
|
60
|
-
};
|
|
61
57
|
stepActive: {
|
|
62
58
|
type: import("vue").PropType<string | number>;
|
|
63
59
|
default: number;
|
|
@@ -65,6 +61,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
65
61
|
size: {
|
|
66
62
|
type: import("vue").PropType<"large" | "default" | "small">;
|
|
67
63
|
};
|
|
64
|
+
height: {
|
|
65
|
+
type: import("vue").PropType<string>;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
68
|
inline: {
|
|
69
69
|
type: import("vue").PropType<boolean>;
|
|
70
70
|
default: boolean;
|
|
@@ -132,10 +132,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
132
132
|
type: import("vue").PropType<boolean>;
|
|
133
133
|
default: boolean;
|
|
134
134
|
};
|
|
135
|
-
height: {
|
|
136
|
-
type: import("vue").PropType<string>;
|
|
137
|
-
default: string;
|
|
138
|
-
};
|
|
139
135
|
stepActive: {
|
|
140
136
|
type: import("vue").PropType<string | number>;
|
|
141
137
|
default: number;
|
|
@@ -143,6 +139,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
143
139
|
size: {
|
|
144
140
|
type: import("vue").PropType<"large" | "default" | "small">;
|
|
145
141
|
};
|
|
142
|
+
height: {
|
|
143
|
+
type: import("vue").PropType<string>;
|
|
144
|
+
default: string;
|
|
145
|
+
};
|
|
146
146
|
inline: {
|
|
147
147
|
type: import("vue").PropType<boolean>;
|
|
148
148
|
default: boolean;
|
|
@@ -168,8 +168,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
168
168
|
parentValues: Record<string, any>;
|
|
169
169
|
labelWidth: string;
|
|
170
170
|
disabled: boolean;
|
|
171
|
-
height: string;
|
|
172
171
|
stepActive: string | number;
|
|
172
|
+
height: string;
|
|
173
173
|
inline: boolean;
|
|
174
174
|
labelPosition: string;
|
|
175
175
|
}, true, {}, {}, {
|
|
@@ -217,10 +217,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
217
217
|
type: import("vue").PropType<boolean>;
|
|
218
218
|
default: boolean;
|
|
219
219
|
};
|
|
220
|
-
height: {
|
|
221
|
-
type: import("vue").PropType<string>;
|
|
222
|
-
default: string;
|
|
223
|
-
};
|
|
224
220
|
stepActive: {
|
|
225
221
|
type: import("vue").PropType<string | number>;
|
|
226
222
|
default: number;
|
|
@@ -228,6 +224,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
228
224
|
size: {
|
|
229
225
|
type: import("vue").PropType<"large" | "default" | "small">;
|
|
230
226
|
};
|
|
227
|
+
height: {
|
|
228
|
+
type: import("vue").PropType<string>;
|
|
229
|
+
default: string;
|
|
230
|
+
};
|
|
231
231
|
inline: {
|
|
232
232
|
type: import("vue").PropType<boolean>;
|
|
233
233
|
default: boolean;
|
|
@@ -261,8 +261,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
261
261
|
parentValues: Record<string, any>;
|
|
262
262
|
labelWidth: string;
|
|
263
263
|
disabled: boolean;
|
|
264
|
-
height: string;
|
|
265
264
|
stepActive: string | number;
|
|
265
|
+
height: string;
|
|
266
266
|
inline: boolean;
|
|
267
267
|
labelPosition: string;
|
|
268
268
|
}> | undefined>;
|
|
@@ -291,8 +291,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
291
291
|
confirmText: string;
|
|
292
292
|
}>>> & {
|
|
293
293
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
294
|
-
onError?: ((...args: any[]) => any) | undefined;
|
|
295
294
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
295
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
296
296
|
}, {
|
|
297
297
|
config: FormConfig;
|
|
298
298
|
values: Object;
|
|
@@ -56,10 +56,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
56
56
|
type: import("vue").PropType<boolean>;
|
|
57
57
|
default: boolean;
|
|
58
58
|
};
|
|
59
|
-
height: {
|
|
60
|
-
type: import("vue").PropType<string>;
|
|
61
|
-
default: string;
|
|
62
|
-
};
|
|
63
59
|
stepActive: {
|
|
64
60
|
type: import("vue").PropType<string | number>;
|
|
65
61
|
default: number;
|
|
@@ -67,6 +63,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
67
63
|
size: {
|
|
68
64
|
type: import("vue").PropType<"large" | "default" | "small">;
|
|
69
65
|
};
|
|
66
|
+
height: {
|
|
67
|
+
type: import("vue").PropType<string>;
|
|
68
|
+
default: string;
|
|
69
|
+
};
|
|
70
70
|
inline: {
|
|
71
71
|
type: import("vue").PropType<boolean>;
|
|
72
72
|
default: boolean;
|
|
@@ -134,10 +134,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
134
134
|
type: import("vue").PropType<boolean>;
|
|
135
135
|
default: boolean;
|
|
136
136
|
};
|
|
137
|
-
height: {
|
|
138
|
-
type: import("vue").PropType<string>;
|
|
139
|
-
default: string;
|
|
140
|
-
};
|
|
141
137
|
stepActive: {
|
|
142
138
|
type: import("vue").PropType<string | number>;
|
|
143
139
|
default: number;
|
|
@@ -145,6 +141,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
145
141
|
size: {
|
|
146
142
|
type: import("vue").PropType<"large" | "default" | "small">;
|
|
147
143
|
};
|
|
144
|
+
height: {
|
|
145
|
+
type: import("vue").PropType<string>;
|
|
146
|
+
default: string;
|
|
147
|
+
};
|
|
148
148
|
inline: {
|
|
149
149
|
type: import("vue").PropType<boolean>;
|
|
150
150
|
default: boolean;
|
|
@@ -170,8 +170,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
170
170
|
parentValues: Record<string, any>;
|
|
171
171
|
labelWidth: string;
|
|
172
172
|
disabled: boolean;
|
|
173
|
-
height: string;
|
|
174
173
|
stepActive: string | number;
|
|
174
|
+
height: string;
|
|
175
175
|
inline: boolean;
|
|
176
176
|
labelPosition: string;
|
|
177
177
|
}, true, {}, {}, {
|
|
@@ -219,10 +219,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
219
219
|
type: import("vue").PropType<boolean>;
|
|
220
220
|
default: boolean;
|
|
221
221
|
};
|
|
222
|
-
height: {
|
|
223
|
-
type: import("vue").PropType<string>;
|
|
224
|
-
default: string;
|
|
225
|
-
};
|
|
226
222
|
stepActive: {
|
|
227
223
|
type: import("vue").PropType<string | number>;
|
|
228
224
|
default: number;
|
|
@@ -230,6 +226,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
230
226
|
size: {
|
|
231
227
|
type: import("vue").PropType<"large" | "default" | "small">;
|
|
232
228
|
};
|
|
229
|
+
height: {
|
|
230
|
+
type: import("vue").PropType<string>;
|
|
231
|
+
default: string;
|
|
232
|
+
};
|
|
233
233
|
inline: {
|
|
234
234
|
type: import("vue").PropType<boolean>;
|
|
235
235
|
default: boolean;
|
|
@@ -263,8 +263,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
263
263
|
parentValues: Record<string, any>;
|
|
264
264
|
labelWidth: string;
|
|
265
265
|
disabled: boolean;
|
|
266
|
-
height: string;
|
|
267
266
|
stepActive: string | number;
|
|
267
|
+
height: string;
|
|
268
268
|
inline: boolean;
|
|
269
269
|
labelPosition: string;
|
|
270
270
|
}> | undefined>;
|
|
@@ -299,8 +299,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
299
299
|
confirmText: string;
|
|
300
300
|
}>>> & {
|
|
301
301
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
302
|
-
onError?: ((...args: any[]) => any) | undefined;
|
|
303
302
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
303
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
304
304
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
305
305
|
}, {
|
|
306
306
|
config: FormConfig;
|
|
@@ -59,10 +59,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
59
59
|
type: import("vue").PropType<boolean>;
|
|
60
60
|
default: boolean;
|
|
61
61
|
};
|
|
62
|
-
height: {
|
|
63
|
-
type: import("vue").PropType<string>;
|
|
64
|
-
default: string;
|
|
65
|
-
};
|
|
66
62
|
stepActive: {
|
|
67
63
|
type: import("vue").PropType<string | number>;
|
|
68
64
|
default: number;
|
|
@@ -70,6 +66,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
70
66
|
size: {
|
|
71
67
|
type: import("vue").PropType<"large" | "default" | "small">;
|
|
72
68
|
};
|
|
69
|
+
height: {
|
|
70
|
+
type: import("vue").PropType<string>;
|
|
71
|
+
default: string;
|
|
72
|
+
};
|
|
73
73
|
inline: {
|
|
74
74
|
type: import("vue").PropType<boolean>;
|
|
75
75
|
default: boolean;
|
|
@@ -137,10 +137,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
137
137
|
type: import("vue").PropType<boolean>;
|
|
138
138
|
default: boolean;
|
|
139
139
|
};
|
|
140
|
-
height: {
|
|
141
|
-
type: import("vue").PropType<string>;
|
|
142
|
-
default: string;
|
|
143
|
-
};
|
|
144
140
|
stepActive: {
|
|
145
141
|
type: import("vue").PropType<string | number>;
|
|
146
142
|
default: number;
|
|
@@ -148,6 +144,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
148
144
|
size: {
|
|
149
145
|
type: import("vue").PropType<"large" | "default" | "small">;
|
|
150
146
|
};
|
|
147
|
+
height: {
|
|
148
|
+
type: import("vue").PropType<string>;
|
|
149
|
+
default: string;
|
|
150
|
+
};
|
|
151
151
|
inline: {
|
|
152
152
|
type: import("vue").PropType<boolean>;
|
|
153
153
|
default: boolean;
|
|
@@ -173,8 +173,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
173
173
|
parentValues: Record<string, any>;
|
|
174
174
|
labelWidth: string;
|
|
175
175
|
disabled: boolean;
|
|
176
|
-
height: string;
|
|
177
176
|
stepActive: string | number;
|
|
177
|
+
height: string;
|
|
178
178
|
inline: boolean;
|
|
179
179
|
labelPosition: string;
|
|
180
180
|
}, true, {}, {}, {
|
|
@@ -222,10 +222,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
222
222
|
type: import("vue").PropType<boolean>;
|
|
223
223
|
default: boolean;
|
|
224
224
|
};
|
|
225
|
-
height: {
|
|
226
|
-
type: import("vue").PropType<string>;
|
|
227
|
-
default: string;
|
|
228
|
-
};
|
|
229
225
|
stepActive: {
|
|
230
226
|
type: import("vue").PropType<string | number>;
|
|
231
227
|
default: number;
|
|
@@ -233,6 +229,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
233
229
|
size: {
|
|
234
230
|
type: import("vue").PropType<"large" | "default" | "small">;
|
|
235
231
|
};
|
|
232
|
+
height: {
|
|
233
|
+
type: import("vue").PropType<string>;
|
|
234
|
+
default: string;
|
|
235
|
+
};
|
|
236
236
|
inline: {
|
|
237
237
|
type: import("vue").PropType<boolean>;
|
|
238
238
|
default: boolean;
|
|
@@ -266,8 +266,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
266
266
|
parentValues: Record<string, any>;
|
|
267
267
|
labelWidth: string;
|
|
268
268
|
disabled: boolean;
|
|
269
|
-
height: string;
|
|
270
269
|
stepActive: string | number;
|
|
270
|
+
height: string;
|
|
271
271
|
inline: boolean;
|
|
272
272
|
labelPosition: string;
|
|
273
273
|
}> | undefined>;
|
|
@@ -307,8 +307,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
307
307
|
confirmText: string;
|
|
308
308
|
}>>> & {
|
|
309
309
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
310
|
-
onError?: ((...args: any[]) => any) | undefined;
|
|
311
310
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
311
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
312
312
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
313
313
|
onOpen?: ((...args: any[]) => any) | undefined;
|
|
314
314
|
onOpened?: ((...args: any[]) => any) | undefined;
|
|
@@ -48,9 +48,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
48
48
|
}, {
|
|
49
49
|
lastValues: FormValue;
|
|
50
50
|
isCompare: boolean;
|
|
51
|
-
size: string;
|
|
52
51
|
prop: string;
|
|
53
52
|
expandMore: boolean;
|
|
53
|
+
size: string;
|
|
54
54
|
}, {}>;
|
|
55
55
|
export default _default;
|
|
56
56
|
type __VLS_WithDefaults<P, D> = {
|
package/types/schema.d.ts
CHANGED
|
@@ -439,9 +439,12 @@ export interface CascaderConfig extends FormItem, Input {
|
|
|
439
439
|
checkStrictly?: boolean;
|
|
440
440
|
/** 弹出内容的自定义类名 */
|
|
441
441
|
popperClass?: string;
|
|
442
|
+
/** 合并成字符串时的分隔符 */
|
|
443
|
+
valueSeparator?: string;
|
|
442
444
|
options?: ((mForm: FormState | undefined, data: {
|
|
443
445
|
model: Record<any, any>;
|
|
444
|
-
|
|
446
|
+
prop: string;
|
|
447
|
+
formValue: Record<any, any>;
|
|
445
448
|
}) => CascaderOption[]) | CascaderOption[];
|
|
446
449
|
option?: {
|
|
447
450
|
url: string;
|