@tmagic/form 1.2.14 → 1.2.15

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.
@@ -645,14 +645,6 @@
645
645
  emit("change", props.model);
646
646
  };
647
647
  const key = (item, index) => item[mForm?.keyProp || "__key"] ?? index;
648
- if (props.config.checkbox && name.value) {
649
- vue.watch(
650
- () => props.model[name.value]?.value,
651
- () => {
652
- emit("change", props.model);
653
- }
654
- );
655
- }
656
648
  const onAddDiffCount = () => emit("addDiffCount");
657
649
  return (_ctx, _cache) => {
658
650
  return (vue.unref(name) ? __props.model[vue.unref(name)] : __props.model) ? (vue.openBlock(), vue.createElementBlock("fieldset", {
@@ -664,7 +656,10 @@
664
656
  default: vue.withCtx(() => [
665
657
  vue.createVNode(vue.unref(design.TMagicCheckbox), {
666
658
  modelValue: __props.model[vue.unref(name)].value,
667
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[vue.unref(name)].value = $event),
659
+ "onUpdate:modelValue": [
660
+ _cache[0] || (_cache[0] = ($event) => __props.model[vue.unref(name)].value = $event),
661
+ change
662
+ ],
668
663
  prop: `${__props.prop}${__props.prop ? "." : ""}${__props.config.name}.value`,
669
664
  "true-label": 1,
670
665
  "false-label": 0
@@ -1612,7 +1607,7 @@
1612
1607
  mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
1613
1608
  };
1614
1609
  const excelHandler = (file) => {
1615
- if (!file || !file.raw) {
1610
+ if (!file?.raw) {
1616
1611
  return false;
1617
1612
  }
1618
1613
  const reader = new FileReader();
@@ -1965,7 +1960,8 @@
1965
1960
  emits: ["change", "addDiffCount"],
1966
1961
  setup(__props, { emit }) {
1967
1962
  const props = __props;
1968
- const uiComponent = design.getConfig("components").tabPane;
1963
+ const tabPaneComponent = design.getConfig("components").tabPane;
1964
+ const tabsComponent = design.getConfig("components").tabs;
1969
1965
  const getActive = (mForm2, props2, activeTabName2) => {
1970
1966
  const { config, model, prop } = props2;
1971
1967
  const { active } = config;
@@ -1997,7 +1993,7 @@
1997
1993
  throw new Error("dynamic tab 必须配置name");
1998
1994
  return props.model[props.config.name] || [];
1999
1995
  }
2000
- return props.config.items;
1996
+ return props.config.items.filter((item) => display(mForm, item.display, props));
2001
1997
  });
2002
1998
  const filter = (config) => filterFunction(mForm, config, props);
2003
1999
  vue.watchEffect(() => {
@@ -2046,7 +2042,6 @@
2046
2042
  emit("change", props.model);
2047
2043
  mForm?.$emit("field-change", props.prop, props.model[props.config.name]);
2048
2044
  };
2049
- const display$1 = (displayConfig) => display(mForm, displayConfig, props);
2050
2045
  const changeHandler = () => {
2051
2046
  emit("change", props.model);
2052
2047
  if (typeof props.config.onChange === "function") {
@@ -2062,61 +2057,62 @@
2062
2057
  emit("addDiffCount");
2063
2058
  };
2064
2059
  return (_ctx, _cache) => {
2065
- const _component_el_badge = vue.resolveComponent("el-badge");
2066
- return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTabs), {
2067
- modelValue: activeTabName.value,
2068
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
2069
- class: vue.normalizeClass(__props.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"),
2070
- type: __props.config.tabType,
2071
- editable: __props.config.editable || false,
2072
- "tab-position": __props.config.tabPosition || "top",
2073
- onTabClick: tabClickHandler,
2074
- onTabAdd,
2075
- onTabRemove
2076
- }, {
2060
+ return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabsComponent).component), vue.mergeProps(
2061
+ {
2062
+ modelValue: activeTabName.value,
2063
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event)
2064
+ },
2065
+ vue.unref(tabsComponent).props({
2066
+ type: __props.config.tabType,
2067
+ editable: __props.config.editable || false,
2068
+ tabPosition: __props.config.tabPosition || "top"
2069
+ }),
2070
+ {
2071
+ class: `tmagic-design-tabs ${__props.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"}`,
2072
+ onTabClick: tabClickHandler,
2073
+ onTabAdd,
2074
+ onTabRemove
2075
+ }
2076
+ ), {
2077
2077
  default: vue.withCtx(() => [
2078
2078
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(tabs), (tab, tabIndex) => {
2079
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
2080
- display$1(tab.display) && tabItems(tab).length ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(uiComponent).component), {
2081
- key: tab[vue.unref(mForm)?.keyProp || "__key"] ?? tabIndex,
2082
- name: filter(tab.status) || tabIndex.toString(),
2083
- lazy: tab.lazy || false
2084
- }, {
2085
- label: vue.withCtx(() => [
2086
- vue.createElementVNode("span", null, [
2087
- vue.createTextVNode(vue.toDisplayString(filter(tab.title)), 1),
2088
- vue.createVNode(_component_el_badge, {
2089
- hidden: !diffCount.value[tabIndex],
2090
- value: diffCount.value[tabIndex],
2091
- class: "diff-count-badge"
2092
- }, null, 8, ["hidden", "value"])
2093
- ])
2094
- ]),
2095
- default: vue.withCtx(() => [
2096
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(tabItems(tab), (item) => {
2097
- return vue.openBlock(), vue.createBlock(_sfc_main$v, {
2098
- key: item[vue.unref(mForm)?.keyProp || "__key"],
2099
- config: item,
2100
- disabled: __props.disabled,
2101
- model: __props.config.dynamic ? (__props.name ? __props.model[__props.name] : __props.model)[tabIndex] : tab.name ? (__props.name ? __props.model[__props.name] : __props.model)[tab.name] : __props.name ? __props.model[__props.name] : __props.model,
2102
- "last-values": vue.unref(lodashEs.isEmpty)(__props.lastValues) ? {} : __props.config.dynamic ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tabIndex] : tab.name ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tab.name] : __props.name ? __props.lastValues[__props.name] : __props.lastValues,
2103
- "is-compare": __props.isCompare,
2104
- prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
2105
- size: __props.size,
2106
- "label-width": tab.labelWidth || __props.labelWidth,
2107
- "expand-more": __props.expandMore,
2108
- onChange: changeHandler,
2109
- onAddDiffCount: ($event) => onAddDiffCount(tabIndex)
2110
- }, null, 8, ["config", "disabled", "model", "last-values", "is-compare", "prop", "size", "label-width", "expand-more", "onAddDiffCount"]);
2111
- }), 128))
2112
- ]),
2113
- _: 2
2114
- }, 1032, ["name", "lazy"])) : vue.createCommentVNode("", true)
2115
- ], 64);
2116
- }), 256))
2079
+ return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabPaneComponent).component), vue.mergeProps({
2080
+ key: tab[vue.unref(mForm)?.keyProp || "__key"] ?? tabIndex
2081
+ }, vue.unref(tabPaneComponent).props({ name: filter(tab.status) || tabIndex.toString(), lazy: tab.lazy || false })), {
2082
+ label: vue.withCtx(() => [
2083
+ vue.createElementVNode("span", null, [
2084
+ vue.createTextVNode(vue.toDisplayString(filter(tab.title)), 1),
2085
+ vue.createVNode(vue.unref(design.TMagicBadge), {
2086
+ hidden: !diffCount.value[tabIndex],
2087
+ value: diffCount.value[tabIndex],
2088
+ class: "diff-count-badge"
2089
+ }, null, 8, ["hidden", "value"])
2090
+ ])
2091
+ ]),
2092
+ default: vue.withCtx(() => [
2093
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(tabItems(tab), (item) => {
2094
+ return vue.openBlock(), vue.createBlock(_sfc_main$v, {
2095
+ key: item[vue.unref(mForm)?.keyProp || "__key"],
2096
+ config: item,
2097
+ disabled: __props.disabled,
2098
+ model: __props.config.dynamic ? (__props.name ? __props.model[__props.name] : __props.model)[tabIndex] : tab.name ? (__props.name ? __props.model[__props.name] : __props.model)[tab.name] : __props.name ? __props.model[__props.name] : __props.model,
2099
+ "last-values": vue.unref(lodashEs.isEmpty)(__props.lastValues) ? {} : __props.config.dynamic ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tabIndex] : tab.name ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tab.name] : __props.name ? __props.lastValues[__props.name] : __props.lastValues,
2100
+ "is-compare": __props.isCompare,
2101
+ prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
2102
+ size: __props.size,
2103
+ "label-width": tab.labelWidth || __props.labelWidth,
2104
+ "expand-more": __props.expandMore,
2105
+ onChange: changeHandler,
2106
+ onAddDiffCount: ($event) => onAddDiffCount(tabIndex)
2107
+ }, null, 8, ["config", "disabled", "model", "last-values", "is-compare", "prop", "size", "label-width", "expand-more", "onAddDiffCount"]);
2108
+ }), 128))
2109
+ ]),
2110
+ _: 2
2111
+ }, 1040);
2112
+ }), 128))
2117
2113
  ]),
2118
2114
  _: 1
2119
- }, 8, ["modelValue", "class", "type", "editable", "tab-position"]);
2115
+ }, 16, ["modelValue", "class"]);
2120
2116
  };
2121
2117
  }
2122
2118
  });
@@ -3644,8 +3640,8 @@
3644
3640
  class: "m-select",
3645
3641
  ref_key: "tMagicSelect",
3646
3642
  ref: tMagicSelect,
3647
- clearable: "",
3648
- filterable: "",
3643
+ clearable: typeof __props.config.clearable !== "undefined" ? __props.config.clearable : true,
3644
+ filterable: typeof __props.config.filterable !== "undefined" ? __props.config.filterable : true,
3649
3645
  "popper-class": `m-select-popper ${vue.unref(popperClass)}`,
3650
3646
  size: __props.size,
3651
3647
  remote: remote.value,
@@ -3671,7 +3667,7 @@
3671
3667
  ]) : vue.createCommentVNode("", true)
3672
3668
  ]),
3673
3669
  _: 1
3674
- }, 8, ["modelValue", "popper-class", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method"])), [
3670
+ }, 8, ["modelValue", "clearable", "filterable", "popper-class", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method"])), [
3675
3671
  [_directive_loading, loading.value]
3676
3672
  ]) : vue.createCommentVNode("", true);
3677
3673
  };
@@ -3824,7 +3820,6 @@
3824
3820
  emit("change", props.model[props.name]);
3825
3821
  };
3826
3822
  return (_ctx, _cache) => {
3827
- const _component_el_button = vue.resolveComponent("el-button");
3828
3823
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInput), {
3829
3824
  modelValue: __props.model[__props.name],
3830
3825
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
@@ -3840,7 +3835,7 @@
3840
3835
  name: "append",
3841
3836
  fn: vue.withCtx(() => [
3842
3837
  typeof __props.config.append === "string" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, vue.toDisplayString(__props.config.append), 1)) : vue.createCommentVNode("", true),
3843
- typeof __props.config.append === "object" && __props.config.append.type === "button" ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3838
+ typeof __props.config.append === "object" && __props.config.append.type === "button" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
3844
3839
  key: 1,
3845
3840
  style: { "color": "#409eff" },
3846
3841
  size: __props.size,