@tmagic/editor 1.2.0-beta.16 → 1.2.0-beta.18

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.
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch, inject, createElementBlock, createVNode, ref, withCtx, withModifiers, createCommentVNode, createTextVNode, toDisplayString, onMounted, onUnmounted, renderSlot, Fragment, createElementVNode, normalizeClass, resolveDynamicComponent, toRaw, createSlots, renderList, normalizeProps, mergeProps, markRaw, getCurrentInstance, watchEffect, provide, withDirectives, Teleport, vShow, nextTick, toHandlers } from 'vue';
2
2
  import serialize from 'serialize-javascript';
3
3
  import { isEmpty, map, throttle, pick, omit, keys, cloneDeep, forIn, mergeWith, uniq, isObject } from 'lodash-es';
4
+ import { createValues, MForm } from '@tmagic/form';
4
5
  import { HookType, NodeType } from '@tmagic/schema';
5
6
  import { Delete, Close, Edit, Plus, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, View, Link, Search, Files, CopyDocument, Coin, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Top, Bottom } from '@element-plus/icons-vue';
6
7
  import { TMagicButton, TMagicTooltip, TMagicIcon, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, tMagicMessageBox, TMagicCard, TMagicInput, TMagicDialog, TMagicTree, TMagicCollapse, TMagicCollapseItem, getConfig as getConfig$1, TMagicTabs, TMagicPopover } from '@tmagic/design';
@@ -10,7 +11,6 @@ import Gesto from 'gesto';
10
11
  import { isPop, getNodePath, isNumber, isPage, toLine, datetimeFormatter, removeClassNameByClassName } from '@tmagic/utils';
11
12
  import { EventEmitter } from 'events';
12
13
  import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
13
- import { MForm } from '@tmagic/form';
14
14
  import KeyController from 'keycon';
15
15
 
16
16
  const __default__$t = defineComponent({
@@ -136,6 +136,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
136
136
  setup(__props, { emit }) {
137
137
  const props = __props;
138
138
  const services = inject("services");
139
+ const mForm = inject("mForm");
139
140
  const codeDsl = computed(() => services?.codeBlockService.getCodeDslSync());
140
141
  const tableConfig = computed(() => {
141
142
  const defaultConfig = {
@@ -166,7 +167,15 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
166
167
  name: "params",
167
168
  label: "\u53C2\u6570",
168
169
  defaultValue: {},
169
- itemsFunction: (row) => getParamsConfig(row.codeId)
170
+ itemsFunction: (row) => {
171
+ const paramsConfig = getParamsConfig(row.codeId);
172
+ if (!row.params)
173
+ row.params = {};
174
+ if (isEmpty(row.params)) {
175
+ createValues(mForm, paramsConfig, {}, row.params);
176
+ }
177
+ return paramsConfig;
178
+ }
170
179
  }
171
180
  ]
172
181
  };
@@ -3146,17 +3155,16 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3146
3155
  return (_ctx, _cache) => {
3147
3156
  return openBlock(), createElementBlock("div", _hoisted_1$a, [
3148
3157
  renderSlot(_ctx.$slots, "props-panel-header"),
3149
- (openBlock(), createBlock(unref(MForm), {
3158
+ createVNode(unref(MForm), {
3150
3159
  ref_key: "configForm",
3151
3160
  ref: configForm,
3152
- key: unref(node)?.type,
3153
3161
  class: normalizeClass(`m-editor-props-panel ${unref(propsPanelSize)}`),
3154
3162
  "popper-class": `m-editor-props-panel-popper ${unref(propsPanelSize)}`,
3155
3163
  size: unref(propsPanelSize),
3156
3164
  "init-values": values.value,
3157
3165
  config: curFormConfig.value,
3158
3166
  onChange: submit
3159
- }, null, 8, ["class", "popper-class", "size", "init-values", "config"]))
3167
+ }, null, 8, ["class", "popper-class", "size", "init-values", "config"])
3160
3168
  ]);
3161
3169
  };
3162
3170
  }