@tmagic/editor 1.4.2 → 1.4.3

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.
@@ -4780,12 +4780,19 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4780
4780
  };
4781
4781
  });
4782
4782
  const showDataSourceFieldSelect = ref(false);
4783
- onMounted(() => {
4784
- const value = props.model[props.name];
4785
- if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
4786
- showDataSourceFieldSelect.value = true;
4783
+ watch(
4784
+ () => props.model[props.name],
4785
+ (value) => {
4786
+ if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
4787
+ showDataSourceFieldSelect.value = true;
4788
+ } else {
4789
+ showDataSourceFieldSelect.value = false;
4790
+ }
4791
+ },
4792
+ {
4793
+ immediate: true
4787
4794
  }
4788
- });
4795
+ );
4789
4796
  const mForm = inject("mForm");
4790
4797
  const type = computed(() => {
4791
4798
  let type2 = props.config.fieldConfig?.type;
@@ -4833,7 +4840,6 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4833
4840
  (showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value ? (openBlock(), createBlock(unref(TMagicButton), {
4834
4841
  key: 0,
4835
4842
  style: { "margin-left": "5px" },
4836
- link: "",
4837
4843
  size: _ctx.size,
4838
4844
  onClick: _cache[0] || (_cache[0] = ($event) => unref(editHandler)(selectedDataSourceId.value))
4839
4845
  }, {
@@ -4845,7 +4851,6 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4845
4851
  _ctx.config.fieldConfig ? (openBlock(), createBlock(unref(TMagicButton), {
4846
4852
  key: 1,
4847
4853
  style: { "margin-left": "5px" },
4848
- link: "",
4849
4854
  type: showDataSourceFieldSelect.value ? "primary" : "default",
4850
4855
  size: _ctx.size,
4851
4856
  onClick: _cache[1] || (_cache[1] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
@@ -4785,12 +4785,19 @@
4785
4785
  };
4786
4786
  });
4787
4787
  const showDataSourceFieldSelect = vue.ref(false);
4788
- vue.onMounted(() => {
4789
- const value = props.model[props.name];
4790
- if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
4791
- showDataSourceFieldSelect.value = true;
4788
+ vue.watch(
4789
+ () => props.model[props.name],
4790
+ (value) => {
4791
+ if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
4792
+ showDataSourceFieldSelect.value = true;
4793
+ } else {
4794
+ showDataSourceFieldSelect.value = false;
4795
+ }
4796
+ },
4797
+ {
4798
+ immediate: true
4792
4799
  }
4793
- });
4800
+ );
4794
4801
  const mForm = vue.inject("mForm");
4795
4802
  const type = vue.computed(() => {
4796
4803
  let type2 = props.config.fieldConfig?.type;
@@ -4838,7 +4845,6 @@
4838
4845
  (showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4839
4846
  key: 0,
4840
4847
  style: { "margin-left": "5px" },
4841
- link: "",
4842
4848
  size: _ctx.size,
4843
4849
  onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(editHandler)(selectedDataSourceId.value))
4844
4850
  }, {
@@ -4850,7 +4856,6 @@
4850
4856
  _ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4851
4857
  key: 1,
4852
4858
  style: { "margin-left": "5px" },
4853
- link: "",
4854
4859
  type: showDataSourceFieldSelect.value ? "primary" : "default",
4855
4860
  size: _ctx.size,
4856
4861
  onClick: _cache[1] || (_cache[1] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.2",
2
+ "version": "1.4.3",
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.4.2",
46
- "@tmagic/dep": "1.4.2",
47
- "@tmagic/design": "1.4.2",
48
- "@tmagic/form": "1.4.2",
49
- "@tmagic/schema": "1.4.2",
50
- "@tmagic/stage": "1.4.2",
51
- "@tmagic/table": "1.4.2",
52
- "@tmagic/utils": "1.4.2",
45
+ "@tmagic/core": "1.4.3",
46
+ "@tmagic/dep": "1.4.3",
47
+ "@tmagic/design": "1.4.3",
48
+ "@tmagic/form": "1.4.3",
49
+ "@tmagic/schema": "1.4.3",
50
+ "@tmagic/stage": "1.4.3",
51
+ "@tmagic/table": "1.4.3",
52
+ "@tmagic/utils": "1.4.3",
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.4.21"
64
64
  },
65
65
  "peerDependencies": {
66
- "@tmagic/design": "1.4.2",
67
- "@tmagic/form": "1.4.2",
66
+ "@tmagic/design": "1.4.3",
67
+ "@tmagic/form": "1.4.3",
68
68
  "monaco-editor": "^0.47.0",
69
69
  "vue": "^3.4.21"
70
70
  },
@@ -17,7 +17,6 @@
17
17
  <TMagicButton
18
18
  v-if="(showDataSourceFieldSelect || !config.fieldConfig) && selectedDataSourceId"
19
19
  style="margin-left: 5px"
20
- link
21
20
  :size="size"
22
21
  @click="editHandler(selectedDataSourceId)"
23
22
  ><MIcon :icon="Edit"></MIcon
@@ -25,7 +24,6 @@
25
24
  <TMagicButton
26
25
  v-if="config.fieldConfig"
27
26
  style="margin-left: 5px"
28
- link
29
27
  :type="showDataSourceFieldSelect ? 'primary' : 'default'"
30
28
  :size="size"
31
29
  @click="showDataSourceFieldSelect = !showDataSourceFieldSelect"
@@ -43,7 +41,7 @@
43
41
  </template>
44
42
 
45
43
  <script setup lang="ts">
46
- import { computed, inject, onMounted, ref, resolveComponent } from 'vue';
44
+ import { computed, inject, ref, resolveComponent, watch } from 'vue';
47
45
  import { Coin, Edit } from '@element-plus/icons-vue';
48
46
 
49
47
  import { TMagicButton } from '@tmagic/design';
@@ -137,16 +135,23 @@ const cascaderConfig = computed<CascaderConfig>(() => {
137
135
 
138
136
  const showDataSourceFieldSelect = ref(false);
139
137
 
140
- onMounted(() => {
141
- const value = props.model[props.name];
142
- if (
143
- Array.isArray(value) &&
144
- typeof value[0] === 'string' &&
145
- value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)
146
- ) {
147
- showDataSourceFieldSelect.value = true;
148
- }
149
- });
138
+ watch(
139
+ () => props.model[props.name],
140
+ (value) => {
141
+ if (
142
+ Array.isArray(value) &&
143
+ typeof value[0] === 'string' &&
144
+ value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)
145
+ ) {
146
+ showDataSourceFieldSelect.value = true;
147
+ } else {
148
+ showDataSourceFieldSelect.value = false;
149
+ }
150
+ },
151
+ {
152
+ immediate: true,
153
+ },
154
+ );
150
155
 
151
156
  const mForm = inject<FormState | undefined>('mForm');
152
157