@tmagic/editor 1.3.14 → 1.3.16

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 CHANGED
@@ -255,6 +255,7 @@
255
255
  }
256
256
  .m-editor-layer-panel {
257
257
  background: #ffffff;
258
+ position: relative;
258
259
  }
259
260
  .m-editor-layer-panel .m-editor-tree {
260
261
  padding-top: 48px;
@@ -359,6 +360,11 @@
359
360
  white-space: normal;
360
361
  margin: 0;
361
362
  }
363
+ .ui-component-panel .t-collapse {
364
+ margin-top: 0;
365
+ padding-top: 48px;
366
+ position: relative;
367
+ }
362
368
  .m-editor-resizer {
363
369
  border-left: 1px solid transparent;
364
370
  border-right: 1px solid transparent;
@@ -6,7 +6,7 @@ import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagi
6
6
  import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
7
7
  import * as monaco from 'monaco-editor';
8
8
  import { HookCodeType, HookType, NodeType, ActionType } from '@tmagic/schema';
9
- import { MFormBox, MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
9
+ import { MFormBox, MFormDrawer, MForm, filterFunction, createValues, MSelect } from '@tmagic/form';
10
10
  import { MagicTable } from '@tmagic/table';
11
11
  import { guid, isPage, isPageFragment, isPop, getNodePath, isNumber, toLine, getValueByKeyPath, setValueByKeyPath, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, convertToNumber, getNodes } from '@tmagic/utils';
12
12
  import Gesto from 'gesto';
@@ -365,6 +365,9 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
365
365
  title: (mForm, { model, index }) => {
366
366
  if (model.codeType === HookCodeType.DATA_SOURCE_METHOD) {
367
367
  if (Array.isArray(model.codeId)) {
368
+ if (model.codeId.length < 2) {
369
+ return index;
370
+ }
368
371
  const ds = services?.dataSourceService.getDataSourceById(model.codeId[0]);
369
372
  return `${ds?.title} / ${model.codeId[1]}`;
370
373
  }
@@ -384,14 +387,31 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
384
387
  { value: HookCodeType.CODE, text: "代码块" },
385
388
  { value: HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
386
389
  ],
387
- defaultValue: "code"
390
+ defaultValue: "code",
391
+ onChange: (mForm, v, { model }) => {
392
+ if (v === HookCodeType.DATA_SOURCE_METHOD) {
393
+ model.codeId = [];
394
+ } else {
395
+ model.codeId = "";
396
+ }
397
+ return v;
398
+ }
388
399
  },
389
400
  {
390
- type: (mForm, { model }) => model.codeType === HookCodeType.DATA_SOURCE_METHOD ? "data-source-method-select" : "code-select-col",
401
+ type: "code-select-col",
391
402
  name: "codeId",
392
403
  span: 16,
393
404
  labelWidth: 0,
394
- disabled: () => !services?.codeBlockService.getEditStatus()
405
+ display: (mForm, { model }) => model.codeType !== HookCodeType.DATA_SOURCE_METHOD,
406
+ notEditable: () => !services?.codeBlockService.getEditStatus()
407
+ },
408
+ {
409
+ type: "data-source-method-select",
410
+ name: "codeId",
411
+ span: 16,
412
+ labelWidth: 0,
413
+ display: (mForm, { model }) => model.codeType === HookCodeType.DATA_SOURCE_METHOD,
414
+ notEditable: () => !services?.dataSourceService.get("editable")
395
415
  }
396
416
  ]
397
417
  }
@@ -3412,8 +3432,10 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3412
3432
  },
3413
3433
  emits: ["change"],
3414
3434
  setup(__props, { emit: __emit }) {
3435
+ const mForm = inject("mForm");
3415
3436
  const services = inject("services");
3416
3437
  const emit = __emit;
3438
+ const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
3417
3439
  const props = __props;
3418
3440
  const getParamItemsConfig = (codeId) => {
3419
3441
  if (!codeDsl.value || !codeId)
@@ -3440,6 +3462,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3440
3462
  const selectConfig = {
3441
3463
  type: "select",
3442
3464
  name: props.name,
3465
+ disable: props.disabled,
3443
3466
  options: () => {
3444
3467
  if (codeDsl.value) {
3445
3468
  return map(codeDsl.value, (value, key) => ({
@@ -3479,7 +3502,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3479
3502
  _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$O, {
3480
3503
  key: 0,
3481
3504
  class: "icon",
3482
- icon: !_ctx.disabled ? unref(Edit) : unref(View),
3505
+ icon: !notEditable.value ? unref(Edit) : unref(View),
3483
3506
  onClick: _cache[0] || (_cache[0] = ($event) => unref(editCode)(_ctx.model[_ctx.name]))
3484
3507
  }, null, 8, ["icon"])) : createCommentVNode("", true)
3485
3508
  ]),
@@ -3495,7 +3518,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3495
3518
  key: 1,
3496
3519
  ref_key: "codeBlockEditor",
3497
3520
  ref: codeBlockEditor,
3498
- disabled: _ctx.disabled,
3521
+ disabled: notEditable.value,
3499
3522
  content: unref(codeConfig),
3500
3523
  onSubmit: unref(submitCodeBlockHandler)
3501
3524
  }, null, 8, ["disabled", "content", "onSubmit"])) : createCommentVNode("", true)
@@ -4290,15 +4313,22 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4290
4313
  },
4291
4314
  emits: ["change"],
4292
4315
  setup(__props, { emit: __emit }) {
4316
+ const mForm = inject("mForm");
4293
4317
  const services = inject("services");
4294
4318
  const emit = __emit;
4295
4319
  const dataSourceService = services?.dataSourceService;
4296
4320
  const props = __props;
4321
+ const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
4297
4322
  const dataSources = computed(() => dataSourceService?.get("dataSources"));
4298
- const getParamItemsConfig = ([dataSourceId, medthodName] = ["", ""]) => {
4323
+ const isCustomMethod = computed(() => {
4324
+ const [id, name] = props.model[props.name];
4325
+ const dataSource = dataSourceService?.getDataSourceById(id);
4326
+ return Boolean(dataSource?.methods.find((method) => method.name === name));
4327
+ });
4328
+ const getParamItemsConfig = ([dataSourceId, methodName] = ["", ""]) => {
4299
4329
  if (!dataSourceId)
4300
4330
  return [];
4301
- const paramStatements = dataSources.value?.find((item) => item.id === dataSourceId)?.methods?.find((item) => item.name === medthodName)?.params;
4331
+ const paramStatements = dataSources.value?.find((item) => item.id === dataSourceId)?.methods?.find((item) => item.name === methodName)?.params;
4302
4332
  if (!paramStatements)
4303
4333
  return [];
4304
4334
  return paramStatements.map((paramState) => ({
@@ -4332,6 +4362,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4332
4362
  type: "cascader",
4333
4363
  name: props.name,
4334
4364
  options: methodsOptions.value,
4365
+ disable: props.disabled,
4335
4366
  onChange: (formState, dataSourceMethod) => {
4336
4367
  setParamsConfig(dataSourceMethod, formState);
4337
4368
  return dataSourceMethod;
@@ -4363,10 +4394,10 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4363
4394
  model: _ctx.model,
4364
4395
  onChange: onChangeHandler
4365
4396
  }, null, 8, ["config", "model"]),
4366
- _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$O, {
4397
+ _ctx.model[_ctx.name] && isCustomMethod.value ? (openBlock(), createBlock(_sfc_main$O, {
4367
4398
  key: 0,
4368
4399
  class: "icon",
4369
- icon: !_ctx.disabled ? unref(Edit) : unref(View),
4400
+ icon: !notEditable.value ? unref(Edit) : unref(View),
4370
4401
  onClick: editCodeHandler
4371
4402
  }, null, 8, ["icon"])) : createCommentVNode("", true)
4372
4403
  ]),
@@ -4383,7 +4414,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4383
4414
  key: 1,
4384
4415
  ref_key: "codeBlockEditor",
4385
4416
  ref: codeBlockEditor,
4386
- disabled: _ctx.disabled,
4417
+ disabled: notEditable.value,
4387
4418
  content: unref(codeConfig),
4388
4419
  onSubmit: submitCodeBlockHandler
4389
4420
  }, null, 8, ["disabled", "content"])) : createCommentVNode("", true)
@@ -4796,7 +4827,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4796
4827
  type: "code-select-col",
4797
4828
  text: "代码块",
4798
4829
  name: "codeId",
4799
- disabled: () => !codeBlockService?.getEditStatus(),
4830
+ notEditable: () => !codeBlockService?.getEditStatus(),
4800
4831
  display: (mForm, { model }) => model.actionType === ActionType.CODE
4801
4832
  };
4802
4833
  return { ...defaultCodeActionConfig, ...props.config.codeActionConfig };
@@ -4806,6 +4837,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4806
4837
  type: "data-source-method-select",
4807
4838
  text: "数据源方法",
4808
4839
  name: "dataSourceMethod",
4840
+ notEditable: () => !services?.dataSourceService.get("editable"),
4809
4841
  display: (mForm, { model }) => model.actionType === ActionType.DATA_SOURCE
4810
4842
  };
4811
4843
  return { ...defaultDataSourceActionConfig, ...props.config.dataSourceActionConfig };
@@ -7512,14 +7544,15 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7512
7544
  ])
7513
7545
  ]),
7514
7546
  _: 1
7515
- })) : createCommentVNode("", true)
7547
+ })) : createCommentVNode("", true),
7548
+ renderSlot(_ctx.$slots, "data-source-panel-search")
7516
7549
  ]),
7517
7550
  createVNode(_sfc_main$i, {
7518
7551
  onEdit: editHandler,
7519
7552
  onRemove: removeHandler
7520
7553
  })
7521
7554
  ]),
7522
- _: 1
7555
+ _: 3
7523
7556
  }),
7524
7557
  createVNode(_sfc_main$j, {
7525
7558
  ref_key: "editDialog",
@@ -8796,6 +8829,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8796
8829
  ]),
8797
8830
  key: "4"
8798
8831
  } : void 0,
8832
+ config.$key === "code-block" || config.slots?.codeBlockPanelSearch ? {
8833
+ name: "code-block-panel-search",
8834
+ fn: withCtx(() => [
8835
+ config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-search", { key: 0 }) : config.slots?.codeBlockPanelSearch ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelSearch), { key: 1 })) : createCommentVNode("", true)
8836
+ ]),
8837
+ key: "5"
8838
+ } : void 0,
8799
8839
  config.$key === "layer" || config.slots?.layerNodeContent ? {
8800
8840
  name: "layer-node-content",
8801
8841
  fn: withCtx(({ data: nodeData }) => [
@@ -8807,7 +8847,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8807
8847
  data: nodeData
8808
8848
  }, null, 8, ["data"])) : createCommentVNode("", true)
8809
8849
  ]),
8810
- key: "5"
8850
+ key: "6"
8811
8851
  } : void 0,
8812
8852
  config.$key === "layer" || config.slots?.layerNodeLabel ? {
8813
8853
  name: "layer-node-label",
@@ -8820,7 +8860,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8820
8860
  data: nodeData
8821
8861
  }, null, 8, ["data"])) : createCommentVNode("", true)
8822
8862
  ]),
8823
- key: "6"
8863
+ key: "7"
8824
8864
  } : void 0,
8825
8865
  config.$key === "layer" || config.slots?.layerNodeTool ? {
8826
8866
  name: "layer-node-tool",
@@ -8833,9 +8873,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8833
8873
  data: nodeData
8834
8874
  }, null, 8, ["data"])) : createCommentVNode("", true)
8835
8875
  ]),
8836
- key: "7"
8876
+ key: "8"
8837
8877
  } : void 0,
8838
- config.$key === "data-source" || config.slots?.codeBlockPanelTool ? {
8878
+ config.$key === "data-source" || config.slots?.dataSourcePanelTool ? {
8839
8879
  name: "data-source-panel-tool",
8840
8880
  fn: withCtx(({ data }) => [
8841
8881
  config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-tool", {
@@ -8843,7 +8883,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8843
8883
  data
8844
8884
  }) : config.slots?.DataSourcePanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : createCommentVNode("", true)
8845
8885
  ]),
8846
- key: "8"
8886
+ key: "9"
8887
+ } : void 0,
8888
+ config.$key === "data-source" || config.slots?.dataSourcePanelSearch ? {
8889
+ name: "data-source-panel-search",
8890
+ fn: withCtx(() => [
8891
+ config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-search", { key: 0 }) : config.slots?.dataSourcePanelSearch ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.dataSourcePanelSearch), { key: 1 })) : createCommentVNode("", true)
8892
+ ]),
8893
+ key: "10"
8847
8894
  } : void 0
8848
8895
  ]), 1040)) : createCommentVNode("", true)
8849
8896
  ])), [
@@ -11125,9 +11172,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11125
11172
  data
11126
11173
  })
11127
11174
  ]),
11175
+ "code-block-panel-search": withCtx(() => [
11176
+ renderSlot(_ctx.$slots, "code-block-panel-search")
11177
+ ]),
11128
11178
  "data-source-panel-tool": withCtx(({ data }) => [
11129
11179
  renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
11130
11180
  ]),
11181
+ "data-source-panel-search": withCtx(() => [
11182
+ renderSlot(_ctx.$slots, "data-source-panel-search")
11183
+ ]),
11131
11184
  _: 3
11132
11185
  }, 8, ["data", "layer-content-menu", "custom-content-menu"])
11133
11186
  ])
@@ -11217,4 +11270,4 @@ const index = {
11217
11270
  }
11218
11271
  };
11219
11272
 
11220
- export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$Q as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$R as CodeSelect, _sfc_main$N as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$g as ContentMenu, _sfc_main$L as DataSourceFieldSelect, _sfc_main$M as DataSourceFields, _sfc_main$K as DataSourceInput, _sfc_main$I as DataSourceMethodSelect, _sfc_main$J as DataSourceMethods, _sfc_main$H as DataSourceMocks, _sfc_main$G as DataSourceSelect, DragType, _sfc_main$F as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$O as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$q as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$U as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };
11273
+ export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$Q as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$R as CodeSelect, _sfc_main$N as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$g as ContentMenu, _sfc_main$j as DataSourceConfigPanel, _sfc_main$L as DataSourceFieldSelect, _sfc_main$M as DataSourceFields, _sfc_main$K as DataSourceInput, _sfc_main$I as DataSourceMethodSelect, _sfc_main$J as DataSourceMethods, _sfc_main$H as DataSourceMocks, _sfc_main$G as DataSourceSelect, DragType, _sfc_main$F as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$O as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$q as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$U as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };
@@ -370,6 +370,9 @@
370
370
  title: (mForm, { model, index }) => {
371
371
  if (model.codeType === schema.HookCodeType.DATA_SOURCE_METHOD) {
372
372
  if (Array.isArray(model.codeId)) {
373
+ if (model.codeId.length < 2) {
374
+ return index;
375
+ }
373
376
  const ds = services?.dataSourceService.getDataSourceById(model.codeId[0]);
374
377
  return `${ds?.title} / ${model.codeId[1]}`;
375
378
  }
@@ -389,14 +392,31 @@
389
392
  { value: schema.HookCodeType.CODE, text: "代码块" },
390
393
  { value: schema.HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
391
394
  ],
392
- defaultValue: "code"
395
+ defaultValue: "code",
396
+ onChange: (mForm, v, { model }) => {
397
+ if (v === schema.HookCodeType.DATA_SOURCE_METHOD) {
398
+ model.codeId = [];
399
+ } else {
400
+ model.codeId = "";
401
+ }
402
+ return v;
403
+ }
393
404
  },
394
405
  {
395
- type: (mForm, { model }) => model.codeType === schema.HookCodeType.DATA_SOURCE_METHOD ? "data-source-method-select" : "code-select-col",
406
+ type: "code-select-col",
396
407
  name: "codeId",
397
408
  span: 16,
398
409
  labelWidth: 0,
399
- disabled: () => !services?.codeBlockService.getEditStatus()
410
+ display: (mForm, { model }) => model.codeType !== schema.HookCodeType.DATA_SOURCE_METHOD,
411
+ notEditable: () => !services?.codeBlockService.getEditStatus()
412
+ },
413
+ {
414
+ type: "data-source-method-select",
415
+ name: "codeId",
416
+ span: 16,
417
+ labelWidth: 0,
418
+ display: (mForm, { model }) => model.codeType === schema.HookCodeType.DATA_SOURCE_METHOD,
419
+ notEditable: () => !services?.dataSourceService.get("editable")
400
420
  }
401
421
  ]
402
422
  }
@@ -3417,8 +3437,10 @@
3417
3437
  },
3418
3438
  emits: ["change"],
3419
3439
  setup(__props, { emit: __emit }) {
3440
+ const mForm = vue.inject("mForm");
3420
3441
  const services = vue.inject("services");
3421
3442
  const emit = __emit;
3443
+ const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
3422
3444
  const props = __props;
3423
3445
  const getParamItemsConfig = (codeId) => {
3424
3446
  if (!codeDsl.value || !codeId)
@@ -3445,6 +3467,7 @@
3445
3467
  const selectConfig = {
3446
3468
  type: "select",
3447
3469
  name: props.name,
3470
+ disable: props.disabled,
3448
3471
  options: () => {
3449
3472
  if (codeDsl.value) {
3450
3473
  return lodashEs.map(codeDsl.value, (value, key) => ({
@@ -3484,7 +3507,7 @@
3484
3507
  _ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
3485
3508
  key: 0,
3486
3509
  class: "icon",
3487
- icon: !_ctx.disabled ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
3510
+ icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
3488
3511
  onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(editCode)(_ctx.model[_ctx.name]))
3489
3512
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true)
3490
3513
  ]),
@@ -3500,7 +3523,7 @@
3500
3523
  key: 1,
3501
3524
  ref_key: "codeBlockEditor",
3502
3525
  ref: codeBlockEditor,
3503
- disabled: _ctx.disabled,
3526
+ disabled: notEditable.value,
3504
3527
  content: vue.unref(codeConfig),
3505
3528
  onSubmit: vue.unref(submitCodeBlockHandler)
3506
3529
  }, null, 8, ["disabled", "content", "onSubmit"])) : vue.createCommentVNode("", true)
@@ -4295,15 +4318,22 @@
4295
4318
  },
4296
4319
  emits: ["change"],
4297
4320
  setup(__props, { emit: __emit }) {
4321
+ const mForm = vue.inject("mForm");
4298
4322
  const services = vue.inject("services");
4299
4323
  const emit = __emit;
4300
4324
  const dataSourceService = services?.dataSourceService;
4301
4325
  const props = __props;
4326
+ const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
4302
4327
  const dataSources = vue.computed(() => dataSourceService?.get("dataSources"));
4303
- const getParamItemsConfig = ([dataSourceId, medthodName] = ["", ""]) => {
4328
+ const isCustomMethod = vue.computed(() => {
4329
+ const [id, name] = props.model[props.name];
4330
+ const dataSource = dataSourceService?.getDataSourceById(id);
4331
+ return Boolean(dataSource?.methods.find((method) => method.name === name));
4332
+ });
4333
+ const getParamItemsConfig = ([dataSourceId, methodName] = ["", ""]) => {
4304
4334
  if (!dataSourceId)
4305
4335
  return [];
4306
- const paramStatements = dataSources.value?.find((item) => item.id === dataSourceId)?.methods?.find((item) => item.name === medthodName)?.params;
4336
+ const paramStatements = dataSources.value?.find((item) => item.id === dataSourceId)?.methods?.find((item) => item.name === methodName)?.params;
4307
4337
  if (!paramStatements)
4308
4338
  return [];
4309
4339
  return paramStatements.map((paramState) => ({
@@ -4337,6 +4367,7 @@
4337
4367
  type: "cascader",
4338
4368
  name: props.name,
4339
4369
  options: methodsOptions.value,
4370
+ disable: props.disabled,
4340
4371
  onChange: (formState, dataSourceMethod) => {
4341
4372
  setParamsConfig(dataSourceMethod, formState);
4342
4373
  return dataSourceMethod;
@@ -4368,10 +4399,10 @@
4368
4399
  model: _ctx.model,
4369
4400
  onChange: onChangeHandler
4370
4401
  }, null, 8, ["config", "model"]),
4371
- _ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
4402
+ _ctx.model[_ctx.name] && isCustomMethod.value ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
4372
4403
  key: 0,
4373
4404
  class: "icon",
4374
- icon: !_ctx.disabled ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
4405
+ icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
4375
4406
  onClick: editCodeHandler
4376
4407
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true)
4377
4408
  ]),
@@ -4388,7 +4419,7 @@
4388
4419
  key: 1,
4389
4420
  ref_key: "codeBlockEditor",
4390
4421
  ref: codeBlockEditor,
4391
- disabled: _ctx.disabled,
4422
+ disabled: notEditable.value,
4392
4423
  content: vue.unref(codeConfig),
4393
4424
  onSubmit: submitCodeBlockHandler
4394
4425
  }, null, 8, ["disabled", "content"])) : vue.createCommentVNode("", true)
@@ -4801,7 +4832,7 @@
4801
4832
  type: "code-select-col",
4802
4833
  text: "代码块",
4803
4834
  name: "codeId",
4804
- disabled: () => !codeBlockService?.getEditStatus(),
4835
+ notEditable: () => !codeBlockService?.getEditStatus(),
4805
4836
  display: (mForm, { model }) => model.actionType === schema.ActionType.CODE
4806
4837
  };
4807
4838
  return { ...defaultCodeActionConfig, ...props.config.codeActionConfig };
@@ -4811,6 +4842,7 @@
4811
4842
  type: "data-source-method-select",
4812
4843
  text: "数据源方法",
4813
4844
  name: "dataSourceMethod",
4845
+ notEditable: () => !services?.dataSourceService.get("editable"),
4814
4846
  display: (mForm, { model }) => model.actionType === schema.ActionType.DATA_SOURCE
4815
4847
  };
4816
4848
  return { ...defaultDataSourceActionConfig, ...props.config.dataSourceActionConfig };
@@ -7517,14 +7549,15 @@
7517
7549
  ])
7518
7550
  ]),
7519
7551
  _: 1
7520
- })) : vue.createCommentVNode("", true)
7552
+ })) : vue.createCommentVNode("", true),
7553
+ vue.renderSlot(_ctx.$slots, "data-source-panel-search")
7521
7554
  ]),
7522
7555
  vue.createVNode(_sfc_main$i, {
7523
7556
  onEdit: editHandler,
7524
7557
  onRemove: removeHandler
7525
7558
  })
7526
7559
  ]),
7527
- _: 1
7560
+ _: 3
7528
7561
  }),
7529
7562
  vue.createVNode(_sfc_main$j, {
7530
7563
  ref_key: "editDialog",
@@ -8801,6 +8834,13 @@
8801
8834
  ]),
8802
8835
  key: "4"
8803
8836
  } : void 0,
8837
+ config.$key === "code-block" || config.slots?.codeBlockPanelSearch ? {
8838
+ name: "code-block-panel-search",
8839
+ fn: vue.withCtx(() => [
8840
+ config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-search", { key: 0 }) : config.slots?.codeBlockPanelSearch ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelSearch), { key: 1 })) : vue.createCommentVNode("", true)
8841
+ ]),
8842
+ key: "5"
8843
+ } : void 0,
8804
8844
  config.$key === "layer" || config.slots?.layerNodeContent ? {
8805
8845
  name: "layer-node-content",
8806
8846
  fn: vue.withCtx(({ data: nodeData }) => [
@@ -8812,7 +8852,7 @@
8812
8852
  data: nodeData
8813
8853
  }, null, 8, ["data"])) : vue.createCommentVNode("", true)
8814
8854
  ]),
8815
- key: "5"
8855
+ key: "6"
8816
8856
  } : void 0,
8817
8857
  config.$key === "layer" || config.slots?.layerNodeLabel ? {
8818
8858
  name: "layer-node-label",
@@ -8825,7 +8865,7 @@
8825
8865
  data: nodeData
8826
8866
  }, null, 8, ["data"])) : vue.createCommentVNode("", true)
8827
8867
  ]),
8828
- key: "6"
8868
+ key: "7"
8829
8869
  } : void 0,
8830
8870
  config.$key === "layer" || config.slots?.layerNodeTool ? {
8831
8871
  name: "layer-node-tool",
@@ -8838,9 +8878,9 @@
8838
8878
  data: nodeData
8839
8879
  }, null, 8, ["data"])) : vue.createCommentVNode("", true)
8840
8880
  ]),
8841
- key: "7"
8881
+ key: "8"
8842
8882
  } : void 0,
8843
- config.$key === "data-source" || config.slots?.codeBlockPanelTool ? {
8883
+ config.$key === "data-source" || config.slots?.dataSourcePanelTool ? {
8844
8884
  name: "data-source-panel-tool",
8845
8885
  fn: vue.withCtx(({ data }) => [
8846
8886
  config.$key === "data-source" ? vue.renderSlot(_ctx.$slots, "data-source-panel-tool", {
@@ -8848,7 +8888,14 @@
8848
8888
  data
8849
8889
  }) : config.slots?.DataSourcePanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : vue.createCommentVNode("", true)
8850
8890
  ]),
8851
- key: "8"
8891
+ key: "9"
8892
+ } : void 0,
8893
+ config.$key === "data-source" || config.slots?.dataSourcePanelSearch ? {
8894
+ name: "data-source-panel-search",
8895
+ fn: vue.withCtx(() => [
8896
+ config.$key === "data-source" ? vue.renderSlot(_ctx.$slots, "data-source-panel-search", { key: 0 }) : config.slots?.dataSourcePanelSearch ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.dataSourcePanelSearch), { key: 1 })) : vue.createCommentVNode("", true)
8897
+ ]),
8898
+ key: "10"
8852
8899
  } : void 0
8853
8900
  ]), 1040)) : vue.createCommentVNode("", true)
8854
8901
  ])), [
@@ -11130,9 +11177,15 @@
11130
11177
  data
11131
11178
  })
11132
11179
  ]),
11180
+ "code-block-panel-search": vue.withCtx(() => [
11181
+ vue.renderSlot(_ctx.$slots, "code-block-panel-search")
11182
+ ]),
11133
11183
  "data-source-panel-tool": vue.withCtx(({ data }) => [
11134
11184
  vue.renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
11135
11185
  ]),
11186
+ "data-source-panel-search": vue.withCtx(() => [
11187
+ vue.renderSlot(_ctx.$slots, "data-source-panel-search")
11188
+ ]),
11136
11189
  _: 3
11137
11190
  }, 8, ["data", "layer-content-menu", "custom-content-menu"])
11138
11191
  ])
@@ -11237,6 +11290,7 @@
11237
11290
  exports.ColumnLayout = ColumnLayout;
11238
11291
  exports.ComponentListPanel = _sfc_main$b;
11239
11292
  exports.ContentMenu = _sfc_main$g;
11293
+ exports.DataSourceConfigPanel = _sfc_main$j;
11240
11294
  exports.DataSourceFieldSelect = _sfc_main$L;
11241
11295
  exports.DataSourceFields = _sfc_main$M;
11242
11296
  exports.DataSourceInput = _sfc_main$K;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.14",
2
+ "version": "1.3.16",
3
3
  "name": "@tmagic/editor",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -42,14 +42,14 @@
42
42
  "dependencies": {
43
43
  "@babel/core": "^7.18.0",
44
44
  "@element-plus/icons-vue": "^2.3.1",
45
- "@tmagic/core": "1.3.14",
46
- "@tmagic/dep": "1.3.14",
47
- "@tmagic/design": "1.3.14",
48
- "@tmagic/form": "1.3.14",
49
- "@tmagic/schema": "1.3.14",
50
- "@tmagic/stage": "1.3.14",
51
- "@tmagic/table": "1.3.14",
52
- "@tmagic/utils": "1.3.14",
45
+ "@tmagic/core": "1.3.16",
46
+ "@tmagic/dep": "1.3.16",
47
+ "@tmagic/design": "1.3.16",
48
+ "@tmagic/form": "1.3.16",
49
+ "@tmagic/schema": "1.3.16",
50
+ "@tmagic/stage": "1.3.16",
51
+ "@tmagic/table": "1.3.16",
52
+ "@tmagic/utils": "1.3.16",
53
53
  "buffer": "^6.0.3",
54
54
  "color": "^3.1.3",
55
55
  "emmet-monaco-es": "^5.3.0",
@@ -63,8 +63,8 @@
63
63
  "vue": "^3.3.8"
64
64
  },
65
65
  "peerDependencies": {
66
- "@tmagic/design": "1.3.14",
67
- "@tmagic/form": "1.3.14",
66
+ "@tmagic/design": "1.3.16",
67
+ "@tmagic/form": "1.3.16",
68
68
  "monaco-editor": "^0.41.0",
69
69
  "vue": "^3.3.8"
70
70
  },
package/src/Editor.vue CHANGED
@@ -49,9 +49,17 @@
49
49
  <slot name="code-block-panel-tool" :id="id" :data="data"></slot>
50
50
  </template>
51
51
 
52
+ <template #code-block-panel-search>
53
+ <slot name="code-block-panel-search"></slot>
54
+ </template>
55
+
52
56
  <template #data-source-panel-tool="{ data }">
53
57
  <slot name="data-source-panel-tool" :data="data"></slot>
54
58
  </template>
59
+
60
+ <template #data-source-panel-search>
61
+ <slot name="data-source-panel-search"></slot>
62
+ </template>
55
63
  </Sidebar>
56
64
  </slot>
57
65
  </template>
@@ -42,6 +42,10 @@ const codeConfig = computed(() => ({
42
42
  title: (mForm: FormState, { model, index }: any) => {
43
43
  if (model.codeType === HookCodeType.DATA_SOURCE_METHOD) {
44
44
  if (Array.isArray(model.codeId)) {
45
+ if (model.codeId.length < 2) {
46
+ return index;
47
+ }
48
+
45
49
  const ds = services?.dataSourceService.getDataSourceById(model.codeId[0]);
46
50
  return `${ds?.title} / ${model.codeId[1]}`;
47
51
  }
@@ -63,14 +67,31 @@ const codeConfig = computed(() => ({
63
67
  { value: HookCodeType.DATA_SOURCE_METHOD, text: '数据源方法' },
64
68
  ],
65
69
  defaultValue: 'code',
70
+ onChange: (mForm: FormState, v: HookCodeType, { model }: any) => {
71
+ if (v === HookCodeType.DATA_SOURCE_METHOD) {
72
+ model.codeId = [];
73
+ } else {
74
+ model.codeId = '';
75
+ }
76
+
77
+ return v;
78
+ },
79
+ },
80
+ {
81
+ type: 'code-select-col',
82
+ name: 'codeId',
83
+ span: 16,
84
+ labelWidth: 0,
85
+ display: (mForm: FormState, { model }: any) => model.codeType !== HookCodeType.DATA_SOURCE_METHOD,
86
+ notEditable: () => !services?.codeBlockService.getEditStatus(),
66
87
  },
67
88
  {
68
- type: (mForm: FormState, { model }: any) =>
69
- model.codeType === HookCodeType.DATA_SOURCE_METHOD ? 'data-source-method-select' : 'code-select-col',
89
+ type: 'data-source-method-select',
70
90
  name: 'codeId',
71
91
  span: 16,
72
92
  labelWidth: 0,
73
- disabled: () => !services?.codeBlockService.getEditStatus(),
93
+ display: (mForm: FormState, { model }: any) => model.codeType === HookCodeType.DATA_SOURCE_METHOD,
94
+ notEditable: () => !services?.dataSourceService.get('editable'),
74
95
  },
75
96
  ],
76
97
  },
@@ -10,7 +10,7 @@
10
10
  @change="onParamsChangeHandler"
11
11
  ></m-form-container>
12
12
  <!-- 查看/编辑按钮 -->
13
- <Icon v-if="model[name]" class="icon" :icon="!disabled ? Edit : View" @click="editCode(model[name])"></Icon>
13
+ <Icon v-if="model[name]" class="icon" :icon="!notEditable ? Edit : View" @click="editCode(model[name])"></Icon>
14
14
  </div>
15
15
 
16
16
  <!-- 参数填写框 -->
@@ -27,7 +27,7 @@
27
27
  <CodeBlockEditor
28
28
  ref="codeBlockEditor"
29
29
  v-if="codeConfig"
30
- :disabled="disabled"
30
+ :disabled="notEditable"
31
31
  :content="codeConfig"
32
32
  @submit="submitCodeBlockHandler"
33
33
  ></CodeBlockEditor>
@@ -39,7 +39,7 @@ import { computed, inject, ref, watch } from 'vue';
39
39
  import { Edit, View } from '@element-plus/icons-vue';
40
40
  import { isEmpty, map } from 'lodash-es';
41
41
 
42
- import { createValues, FieldProps } from '@tmagic/form';
42
+ import { createValues, type FieldProps, filterFunction, type FormState } from '@tmagic/form';
43
43
  import type { Id } from '@tmagic/schema';
44
44
 
45
45
  import CodeBlockEditor from '@editor/components/CodeBlockEditor.vue';
@@ -52,9 +52,11 @@ defineOptions({
52
52
  name: 'MEditorCodeSelectCol',
53
53
  });
54
54
 
55
+ const mForm = inject<FormState | undefined>('mForm');
55
56
  const services = inject<Services>('services');
56
57
  const emit = defineEmits(['change']);
57
58
 
59
+ const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
58
60
  const props = withDefaults(defineProps<FieldProps<CodeSelectColConfig>>(), {
59
61
  disabled: false,
60
62
  });
@@ -92,6 +94,7 @@ watch(
92
94
  const selectConfig = {
93
95
  type: 'select',
94
96
  name: props.name,
97
+ disable: props.disabled,
95
98
  options: () => {
96
99
  if (codeDsl.value) {
97
100
  return map(codeDsl.value, (value, key) => ({
@@ -7,7 +7,12 @@
7
7
  :model="model"
8
8
  @change="onChangeHandler"
9
9
  ></m-form-container>
10
- <Icon v-if="model[name]" class="icon" :icon="!disabled ? Edit : View" @click="editCodeHandler"></Icon>
10
+ <Icon
11
+ v-if="model[name] && isCustomMethod"
12
+ class="icon"
13
+ :icon="!notEditable ? Edit : View"
14
+ @click="editCodeHandler"
15
+ ></Icon>
11
16
  </div>
12
17
 
13
18
  <CodeParams
@@ -23,7 +28,7 @@
23
28
  <CodeBlockEditor
24
29
  ref="codeBlockEditor"
25
30
  v-if="codeConfig"
26
- :disabled="disabled"
31
+ :disabled="notEditable"
27
32
  :content="codeConfig"
28
33
  @submit="submitCodeBlockHandler"
29
34
  ></CodeBlockEditor>
@@ -34,7 +39,7 @@
34
39
  import { computed, inject, ref } from 'vue';
35
40
  import { Edit, View } from '@element-plus/icons-vue';
36
41
 
37
- import { createValues, FieldProps } from '@tmagic/form';
42
+ import { createValues, type FieldProps, filterFunction, type FormState } from '@tmagic/form';
38
43
  import type { CodeBlockContent, Id } from '@tmagic/schema';
39
44
 
40
45
  import CodeBlockEditor from '@editor/components/CodeBlockEditor.vue';
@@ -47,6 +52,7 @@ defineOptions({
47
52
  name: 'MEditorDataSourceMethodSelect',
48
53
  });
49
54
 
55
+ const mForm = inject<FormState | undefined>('mForm');
50
56
  const services = inject<Services>('services');
51
57
  const emit = defineEmits(['change']);
52
58
 
@@ -56,14 +62,24 @@ const props = withDefaults(defineProps<FieldProps<DataSourceMethodSelectConfig>>
56
62
  disabled: false,
57
63
  });
58
64
 
65
+ const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
66
+
59
67
  const dataSources = computed(() => dataSourceService?.get('dataSources'));
60
68
 
61
- const getParamItemsConfig = ([dataSourceId, medthodName]: [Id, string] = ['', '']): CodeParamStatement[] => {
69
+ const isCustomMethod = computed(() => {
70
+ const [id, name] = props.model[props.name];
71
+
72
+ const dataSource = dataSourceService?.getDataSourceById(id);
73
+
74
+ return Boolean(dataSource?.methods.find((method) => method.name === name));
75
+ });
76
+
77
+ const getParamItemsConfig = ([dataSourceId, methodName]: [Id, string] = ['', '']): CodeParamStatement[] => {
62
78
  if (!dataSourceId) return [];
63
79
 
64
80
  const paramStatements = dataSources.value
65
81
  ?.find((item) => item.id === dataSourceId)
66
- ?.methods?.find((item) => item.name === medthodName)?.params;
82
+ ?.methods?.find((item) => item.name === methodName)?.params;
67
83
 
68
84
  if (!paramStatements) return [];
69
85
 
@@ -107,6 +123,7 @@ const cascaderConfig = computed(() => ({
107
123
  type: 'cascader',
108
124
  name: props.name,
109
125
  options: methodsOptions.value,
126
+ disable: props.disabled,
110
127
  onChange: (formState: any, dataSourceMethod: [Id, string]) => {
111
128
  setParamsConfig(dataSourceMethod, formState);
112
129
 
@@ -171,7 +171,7 @@ const codeActionConfig = computed(() => {
171
171
  type: 'code-select-col',
172
172
  text: '代码块',
173
173
  name: 'codeId',
174
- disabled: () => !codeBlockService?.getEditStatus(),
174
+ notEditable: () => !codeBlockService?.getEditStatus(),
175
175
  display: (mForm, { model }) => model.actionType === ActionType.CODE,
176
176
  };
177
177
  return { ...defaultCodeActionConfig, ...props.config.codeActionConfig };
@@ -183,6 +183,7 @@ const dataSourceActionConfig = computed(() => {
183
183
  type: 'data-source-method-select',
184
184
  text: '数据源方法',
185
185
  name: 'dataSourceMethod',
186
+ notEditable: () => !services?.dataSourceService.get('editable'),
186
187
  display: (mForm, { model }) => model.actionType === ActionType.DATA_SOURCE,
187
188
  };
188
189
  return { ...defaultDataSourceActionConfig, ...props.config.dataSourceActionConfig };
package/src/index.ts CHANGED
@@ -73,6 +73,7 @@ export { default as EventSelect } from './fields/EventSelect.vue';
73
73
  export { default as KeyValue } from './fields/KeyValue.vue';
74
74
  export { default as CodeBlockList } from './layouts/sidebar/code-block/CodeBlockList.vue';
75
75
  export { default as CodeBlockListPanel } from './layouts/sidebar/code-block/CodeBlockListPanel.vue';
76
+ export { default as DataSourceConfigPanel } from './layouts/sidebar/data-source/DataSourceConfigPanel.vue';
76
77
  export { default as PropsPanel } from './layouts/PropsPanel.vue';
77
78
  export { default as ToolButton } from './components/ToolButton.vue';
78
79
  export { default as ContentMenu } from './components/ContentMenu.vue';
@@ -66,6 +66,11 @@
66
66
  <component v-else-if="config.slots?.codeBlockPanelTool" :is="config.slots.codeBlockPanelTool" />
67
67
  </template>
68
68
 
69
+ <template #code-block-panel-search v-if="config.$key === 'code-block' || config.slots?.codeBlockPanelSearch">
70
+ <slot v-if="config.$key === 'code-block'" name="code-block-panel-search"></slot>
71
+ <component v-else-if="config.slots?.codeBlockPanelSearch" :is="config.slots.codeBlockPanelSearch" />
72
+ </template>
73
+
69
74
  <template
70
75
  #layer-node-content="{ data: nodeData }"
71
76
  v-if="config.$key === 'layer' || config.slots?.layerNodeContent"
@@ -86,11 +91,16 @@
86
91
 
87
92
  <template
88
93
  #data-source-panel-tool="{ data }"
89
- v-if="config.$key === 'data-source' || config.slots?.codeBlockPanelTool"
94
+ v-if="config.$key === 'data-source' || config.slots?.dataSourcePanelTool"
90
95
  >
91
96
  <slot v-if="config.$key === 'data-source'" name="data-source-panel-tool" :data="data"></slot>
92
97
  <component v-else-if="config.slots?.DataSourcePanelTool" :is="config.slots.DataSourcePanelTool" />
93
98
  </template>
99
+
100
+ <template #data-source-panel-search v-if="config.$key === 'data-source' || config.slots?.dataSourcePanelSearch">
101
+ <slot v-if="config.$key === 'data-source'" name="data-source-panel-search"></slot>
102
+ <component v-else-if="config.slots?.dataSourcePanelSearch" :is="config.slots.dataSourcePanelSearch" />
103
+ </template>
94
104
  </component>
95
105
  </div>
96
106
  </div>
@@ -20,11 +20,14 @@
20
20
  ></ToolButton>
21
21
  </div>
22
22
  </TMagicPopover>
23
+
24
+ <slot name="data-source-panel-search"></slot>
23
25
  </div>
24
26
 
25
27
  <!-- 数据源列表 -->
26
28
  <DataSourceList @edit="editHandler" @remove="removeHandler"></DataSourceList>
27
29
  </TMagicScrollbar>
30
+
28
31
  <DataSourceConfigPanel
29
32
  ref="editDialog"
30
33
  :disabled="!editable"
@@ -1,88 +1,96 @@
1
- .ui-component-panel.tmagic-design-collapse {
2
- height: 100%;
3
- border-top: 0 !important;
4
- margin-top: 48px;
5
- background-color: $--sidebar-content-background-color;
1
+ .ui-component-panel {
2
+ &.tmagic-design-collapse {
3
+ height: 100%;
4
+ border-top: 0 !important;
5
+ margin-top: 48px;
6
+ background-color: $--sidebar-content-background-color;
6
7
 
7
- .tmagic-design-collapse-item {
8
- > div:first-of-type {
9
- border-bottom: 1px solid $--border-color;
10
- margin-bottom: 10px;
8
+ .tmagic-design-collapse-item {
9
+ > div:first-of-type {
10
+ border-bottom: 1px solid $--border-color;
11
+ margin-bottom: 10px;
12
+ }
11
13
  }
12
- }
13
14
 
14
- .el-collapse-item__header,
15
- .t-collapse-panel__header {
16
- background: $--sidebar-content-background-color;
17
- color: $--font-color;
18
- height: 25px;
19
- line-height: 25px;
20
- padding-left: 10px;
21
- font-size: 12px;
15
+ .el-collapse-item__header,
16
+ .t-collapse-panel__header {
17
+ background: $--sidebar-content-background-color;
18
+ color: $--font-color;
19
+ height: 25px;
20
+ line-height: 25px;
21
+ padding-left: 10px;
22
+ font-size: 12px;
22
23
 
23
- i {
24
- margin-right: 5px;
25
- font-size: 14px;
24
+ i {
25
+ margin-right: 5px;
26
+ font-size: 14px;
27
+ }
26
28
  }
27
- }
28
-
29
- .el-collapse-item__wrap,
30
- .t-collapse-panel__body {
31
- background: $--sidebar-content-background-color;
32
- border-bottom: 0;
33
29
 
34
- .el-collapse-item__content,
35
- .t-collapse-panel__content {
36
- padding: 10px;
37
- display: flex;
38
- flex-wrap: wrap;
39
- }
30
+ .el-collapse-item__wrap,
31
+ .t-collapse-panel__body {
32
+ background: $--sidebar-content-background-color;
33
+ border-bottom: 0;
40
34
 
41
- .component-item {
42
- display: flex;
43
- overflow: hidden;
44
- text-overflow: ellipsis;
45
- margin: 5px 10px;
46
- box-sizing: border-box;
47
- color: $--font-color;
48
- flex-direction: column;
49
- width: 42px;
50
- cursor: pointer;
35
+ .el-collapse-item__content,
36
+ .t-collapse-panel__content {
37
+ padding: 10px;
38
+ display: flex;
39
+ flex-wrap: wrap;
40
+ }
51
41
 
52
- i {
53
- font-size: 20px;
54
- background: #fff;
55
- height: 40px;
56
- width: 40px;
57
- line-height: 40px;
58
- border-radius: 5px;
59
- color: #909090;
60
- border: 1px solid $--border-color;
42
+ .component-item {
61
43
  display: flex;
62
- justify-content: space-evenly;
63
- align-items: center;
64
- margin-bottom: 5px;
44
+ overflow: hidden;
45
+ text-overflow: ellipsis;
46
+ margin: 5px 10px;
47
+ box-sizing: border-box;
48
+ color: $--font-color;
49
+ flex-direction: column;
50
+ width: 42px;
51
+ cursor: pointer;
52
+
53
+ i {
54
+ font-size: 20px;
55
+ background: #fff;
56
+ height: 40px;
57
+ width: 40px;
58
+ line-height: 40px;
59
+ border-radius: 5px;
60
+ color: #909090;
61
+ border: 1px solid $--border-color;
62
+ display: flex;
63
+ justify-content: space-evenly;
64
+ align-items: center;
65
+ margin-bottom: 5px;
65
66
 
66
- &:hover {
67
- background: #2882e0;
68
- color: #fff;
69
- border-color: #4e8be1;
67
+ &:hover {
68
+ background: #2882e0;
69
+ color: #fff;
70
+ border-color: #4e8be1;
71
+ }
70
72
  }
71
- }
72
73
 
73
- span {
74
- font-size: 12px;
75
- text-align: center;
76
- }
74
+ span {
75
+ font-size: 12px;
76
+ text-align: center;
77
+ }
77
78
 
78
- .el-tooltip {
79
- width: 50px;
80
- height: 30px;
81
- line-height: 15px;
82
- display: block;
83
- white-space: normal;
84
- margin: 0;
79
+ .el-tooltip {
80
+ width: 50px;
81
+ height: 30px;
82
+ line-height: 15px;
83
+ display: block;
84
+ white-space: normal;
85
+ margin: 0;
86
+ }
85
87
  }
86
88
  }
87
89
  }
90
+
91
+ .t-collapse {
92
+ margin-top: 0;
93
+ padding-top: 48px;
94
+ position: relative;
95
+ }
88
96
  }
@@ -1,5 +1,6 @@
1
1
  .m-editor-layer-panel {
2
2
  background: $--sidebar-content-background-color;
3
+ position: relative;
3
4
 
4
5
  .m-editor-tree {
5
6
  padding-top: 48px;
package/src/type.ts CHANGED
@@ -81,6 +81,7 @@ export interface CodeBlockListSlots {
81
81
 
82
82
  export interface DataSourceListSlots {
83
83
  'data-source-panel-tool'(props: { data: any }): any;
84
+ 'data-source-panel-search'(props: {}): any;
84
85
  }
85
86
 
86
87
  export interface LayerNodeSlots {
@@ -600,6 +601,7 @@ export interface CodeSelectColConfig {
600
601
  text: string;
601
602
  labelWidth?: number | string;
602
603
  disabled?: boolean | FilterFunction;
604
+ notEditable?: boolean | FilterFunction;
603
605
  display?: boolean | FilterFunction;
604
606
  }
605
607
 
@@ -618,6 +620,7 @@ export interface DataSourceMethodSelectConfig {
618
620
  text: string;
619
621
  labelWidth?: number | string;
620
622
  disabled?: boolean | FilterFunction;
623
+ notEditable?: boolean | FilterFunction;
621
624
  display?: boolean | FilterFunction;
622
625
  }
623
626
 
@@ -1,4 +1,4 @@
1
- import { FieldProps } from '@tmagic/form';
1
+ import { type FieldProps } from '@tmagic/form';
2
2
  import type { CodeSelectColConfig } from '../type';
3
3
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<CodeSelectColConfig>>, {
4
4
  disabled: boolean;
@@ -1,4 +1,4 @@
1
- import { FieldProps } from '@tmagic/form';
1
+ import { type FieldProps } from '@tmagic/form';
2
2
  import type { DataSourceMethodSelectConfig } from '../type';
3
3
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<DataSourceMethodSelectConfig>>, {
4
4
  disabled: boolean;
package/types/index.d.ts CHANGED
@@ -34,6 +34,7 @@ export { default as EventSelect } from './fields/EventSelect.vue';
34
34
  export { default as KeyValue } from './fields/KeyValue.vue';
35
35
  export { default as CodeBlockList } from './layouts/sidebar/code-block/CodeBlockList.vue';
36
36
  export { default as CodeBlockListPanel } from './layouts/sidebar/code-block/CodeBlockListPanel.vue';
37
+ export { default as DataSourceConfigPanel } from './layouts/sidebar/data-source/DataSourceConfigPanel.vue';
37
38
  export { default as PropsPanel } from './layouts/PropsPanel.vue';
38
39
  export { default as ToolButton } from './components/ToolButton.vue';
39
40
  export { default as ContentMenu } from './components/ContentMenu.vue';
package/types/type.d.ts CHANGED
@@ -59,6 +59,7 @@ export interface DataSourceListSlots {
59
59
  'data-source-panel-tool'(props: {
60
60
  data: any;
61
61
  }): any;
62
+ 'data-source-panel-search'(props: {}): any;
62
63
  }
63
64
  export interface LayerNodeSlots {
64
65
  'layer-node-content'(props: {
@@ -511,6 +512,7 @@ export interface CodeSelectColConfig {
511
512
  text: string;
512
513
  labelWidth?: number | string;
513
514
  disabled?: boolean | FilterFunction;
515
+ notEditable?: boolean | FilterFunction;
514
516
  display?: boolean | FilterFunction;
515
517
  }
516
518
  export interface PageFragmentSelectConfig {
@@ -527,6 +529,7 @@ export interface DataSourceMethodSelectConfig {
527
529
  text: string;
528
530
  labelWidth?: number | string;
529
531
  disabled?: boolean | FilterFunction;
532
+ notEditable?: boolean | FilterFunction;
530
533
  display?: boolean | FilterFunction;
531
534
  }
532
535
  export interface DataSourceFieldSelectConfig {