@tmagic/form 1.3.0-alpha.0 → 1.3.0-alpha.10

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.
Files changed (73) hide show
  1. package/dist/tmagic-form.js +913 -917
  2. package/dist/tmagic-form.js.map +1 -1
  3. package/dist/tmagic-form.umd.cjs +911 -915
  4. package/dist/tmagic-form.umd.cjs.map +1 -1
  5. package/package.json +10 -11
  6. package/src/Form.vue +14 -2
  7. package/src/FormDialog.vue +5 -1
  8. package/src/containers/Col.vue +5 -1
  9. package/src/containers/Container.vue +5 -1
  10. package/src/containers/Fieldset.vue +5 -1
  11. package/src/containers/GroupList.vue +6 -2
  12. package/src/containers/GroupListItem.vue +7 -7
  13. package/src/containers/Panel.vue +5 -1
  14. package/src/containers/Row.vue +5 -1
  15. package/src/containers/Step.vue +5 -1
  16. package/src/containers/Table.vue +6 -2
  17. package/src/containers/Tabs.vue +14 -8
  18. package/src/fields/Cascader.vue +5 -1
  19. package/src/fields/Checkbox.vue +5 -1
  20. package/src/fields/CheckboxGroup.vue +6 -2
  21. package/src/fields/ColorPicker.vue +5 -1
  22. package/src/fields/Date.vue +5 -1
  23. package/src/fields/DateTime.vue +5 -1
  24. package/src/fields/Daterange.vue +5 -1
  25. package/src/fields/Display.vue +5 -1
  26. package/src/fields/DynamicField.vue +5 -1
  27. package/src/fields/Hidden.vue +5 -1
  28. package/src/fields/Link.vue +5 -1
  29. package/src/fields/Number.vue +5 -1
  30. package/src/fields/RadioGroup.vue +5 -1
  31. package/src/fields/Select.vue +26 -18
  32. package/src/fields/SelectOptionGroups.vue +7 -3
  33. package/src/fields/SelectOptions.vue +5 -1
  34. package/src/fields/Switch.vue +5 -1
  35. package/src/fields/Text.vue +5 -1
  36. package/src/fields/Textarea.vue +5 -1
  37. package/src/fields/Time.vue +5 -1
  38. package/src/index.ts +39 -37
  39. package/src/schema.ts +4 -3
  40. package/types/Form.vue.d.ts +9 -4
  41. package/types/FormDialog.vue.d.ts +83 -121
  42. package/types/containers/Col.vue.d.ts +1 -1
  43. package/types/containers/Container.vue.d.ts +6 -3
  44. package/types/containers/Fieldset.vue.d.ts +6 -3
  45. package/types/containers/GroupList.vue.d.ts +1 -1
  46. package/types/containers/GroupListItem.vue.d.ts +1 -1
  47. package/types/containers/Panel.vue.d.ts +3 -3
  48. package/types/containers/Row.vue.d.ts +1 -1
  49. package/types/containers/Step.vue.d.ts +6 -3
  50. package/types/containers/Table.vue.d.ts +9 -6
  51. package/types/containers/Tabs.vue.d.ts +6 -3
  52. package/types/fields/Cascader.vue.d.ts +1 -1
  53. package/types/fields/Checkbox.vue.d.ts +1 -1
  54. package/types/fields/CheckboxGroup.vue.d.ts +1 -1
  55. package/types/fields/ColorPicker.vue.d.ts +1 -1
  56. package/types/fields/Date.vue.d.ts +1 -1
  57. package/types/fields/DateTime.vue.d.ts +1 -1
  58. package/types/fields/Daterange.vue.d.ts +1 -1
  59. package/types/fields/Display.vue.d.ts +2 -2
  60. package/types/fields/DynamicField.vue.d.ts +1 -10
  61. package/types/fields/Hidden.vue.d.ts +2 -2
  62. package/types/fields/Link.vue.d.ts +1 -1
  63. package/types/fields/Number.vue.d.ts +1 -1
  64. package/types/fields/RadioGroup.vue.d.ts +1 -1
  65. package/types/fields/Select.vue.d.ts +1 -1
  66. package/types/fields/SelectOptionGroups.vue.d.ts +2 -2
  67. package/types/fields/SelectOptions.vue.d.ts +2 -2
  68. package/types/fields/Switch.vue.d.ts +1 -1
  69. package/types/fields/Text.vue.d.ts +1 -1
  70. package/types/fields/Textarea.vue.d.ts +1 -1
  71. package/types/fields/Time.vue.d.ts +1 -1
  72. package/types/index.d.ts +4 -1
  73. package/types/schema.d.ts +4 -3
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.0-alpha.0",
2
+ "version": "1.3.0-alpha.10",
3
3
  "name": "@tmagic/form",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -36,28 +36,27 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@element-plus/icons-vue": "^2.0.9",
39
- "@tmagic/design": "1.3.0-alpha.0",
40
- "@tmagic/utils": "1.3.0-alpha.0",
39
+ "@tmagic/design": "1.3.0-alpha.10",
40
+ "@tmagic/utils": "1.3.0-alpha.10",
41
41
  "lodash-es": "^4.17.21",
42
42
  "sortablejs": "^1.14.0",
43
- "vue": "^3.2.37"
43
+ "vue": "^3.3.4"
44
44
  },
45
45
  "peerDependencies": {
46
- "vue": "^3.2.37"
46
+ "vue": "^3.3.4"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@babel/core": "^7.18.0",
50
50
  "@types/lodash-es": "^4.17.4",
51
51
  "@types/node": "^15.12.4",
52
52
  "@types/sortablejs": "^1.10.7",
53
- "@vitejs/plugin-vue": "^4.1.0",
54
- "@vue/compiler-sfc": "^3.2.37",
55
- "@vue/test-utils": "^2.0.0",
53
+ "@vitejs/plugin-vue": "^4.2.3",
54
+ "@vue/compiler-sfc": "^3.3.4",
55
+ "@vue/test-utils": "^2.3.2",
56
56
  "rimraf": "^3.0.2",
57
57
  "sass": "^1.35.1",
58
58
  "typescript": "^5.0.4",
59
- "vite": "^4.2.1",
60
- "vite-plugin-vue-setup-extend": "^0.4.0",
61
- "vue-tsc": "^1.2.0"
59
+ "vite": "^4.3.8",
60
+ "vue-tsc": "^1.6.5"
62
61
  }
63
62
  }
package/src/Form.vue CHANGED
@@ -26,7 +26,7 @@
26
26
  </TMagicForm>
27
27
  </template>
28
28
 
29
- <script setup lang="ts" name="MForm">
29
+ <script setup lang="ts">
30
30
  import { provide, reactive, ref, toRaw, watch, watchEffect } from 'vue';
31
31
  import { isEqual } from 'lodash-es';
32
32
  import cloneDeep from 'lodash-es/cloneDeep';
@@ -38,6 +38,10 @@ import { getConfig } from './utils/config';
38
38
  import { initValue } from './utils/form';
39
39
  import type { FormConfig, FormState, FormValue, ValidateError } from './schema';
40
40
 
41
+ defineOptions({
42
+ name: 'MForm',
43
+ });
44
+
41
45
  const props = withDefaults(
42
46
  defineProps<{
43
47
  /** 表单配置 */
@@ -58,6 +62,7 @@ const props = withDefaults(
58
62
  labelPosition?: string;
59
63
  keyProp?: string;
60
64
  popperClass?: string;
65
+ extendState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>;
61
66
  }>(),
62
67
  {
63
68
  config: () => [],
@@ -110,7 +115,7 @@ const formState: FormState = reactive<FormState>({
110
115
  },
111
116
  });
112
117
 
113
- watchEffect(() => {
118
+ watchEffect(async () => {
114
119
  formState.initValues = props.initValues;
115
120
  formState.lastValues = props.lastValues;
116
121
  formState.isCompare = props.isCompare;
@@ -118,6 +123,13 @@ watchEffect(() => {
118
123
  formState.keyProp = props.keyProp;
119
124
  formState.popperClass = props.popperClass;
120
125
  formState.parentValues = props.parentValues;
126
+
127
+ if (typeof props.extendState === 'function') {
128
+ const state = (await props.extendState(formState)) || {};
129
+ Object.entries(state).forEach(([key, value]) => {
130
+ formState[key] = value;
131
+ });
132
+ }
121
133
  });
122
134
 
123
135
  provide('mForm', formState);
@@ -56,7 +56,7 @@
56
56
  </TMagicDialog>
57
57
  </template>
58
58
 
59
- <script setup lang="ts" name="MFormDialog">
59
+ <script setup lang="ts">
60
60
  import { computed, ref } from 'vue';
61
61
 
62
62
  import { TMagicButton, TMagicCol, TMagicDialog, TMagicRow } from '@tmagic/design';
@@ -64,6 +64,10 @@ import { TMagicButton, TMagicCol, TMagicDialog, TMagicRow } from '@tmagic/design
64
64
  import Form from './Form.vue';
65
65
  import { FormConfig, StepConfig } from './schema';
66
66
 
67
+ defineOptions({
68
+ name: 'MFormDialog',
69
+ });
70
+
67
71
  const props = withDefaults(
68
72
  defineProps<{
69
73
  config?: FormConfig;
@@ -16,7 +16,7 @@
16
16
  </TMagicCol>
17
17
  </template>
18
18
 
19
- <script setup lang="ts" name="MFormCol">
19
+ <script setup lang="ts">
20
20
  import { computed, inject } from 'vue';
21
21
 
22
22
  import { TMagicCol } from '@tmagic/design';
@@ -26,6 +26,10 @@ import { display as displayFunction } from '../utils/form';
26
26
 
27
27
  import Container from './Container.vue';
28
28
 
29
+ defineOptions({
30
+ name: 'MFormCol',
31
+ });
32
+
29
33
  const props = defineProps<{
30
34
  model: any;
31
35
  lastValues?: any;
@@ -218,7 +218,7 @@
218
218
  </div>
219
219
  </template>
220
220
 
221
- <script setup lang="ts" name="MFormContainer">
221
+ <script setup lang="ts">
222
222
  import { computed, inject, ref, resolveComponent, watch, watchEffect } from 'vue';
223
223
  import { WarningFilled } from '@element-plus/icons-vue';
224
224
  import { isEqual } from 'lodash-es';
@@ -228,6 +228,10 @@ import { TMagicButton, TMagicFormItem, TMagicIcon, TMagicTooltip } from '@tmagic
228
228
  import { ChildConfig, ContainerCommonConfig, FormState, FormValue } from '../schema';
229
229
  import { display as displayFunction, filterFunction, getRules } from '../utils/form';
230
230
 
231
+ defineOptions({
232
+ name: 'MFormContainer',
233
+ });
234
+
231
235
  const props = withDefaults(
232
236
  defineProps<{
233
237
  /** 表单值 */
@@ -61,7 +61,7 @@
61
61
  </fieldset>
62
62
  </template>
63
63
 
64
- <script lang="ts" setup name="MFormFieldset">
64
+ <script lang="ts" setup>
65
65
  import { computed, inject } from 'vue';
66
66
 
67
67
  import { TMagicCheckbox } from '@tmagic/design';
@@ -70,6 +70,10 @@ import { FieldsetConfig, FormState } from '../schema';
70
70
 
71
71
  import Container from './Container.vue';
72
72
 
73
+ defineOptions({
74
+ name: 'MFormFieldset',
75
+ });
76
+
73
77
  const props = withDefaults(
74
78
  defineProps<{
75
79
  labelWidth?: string;
@@ -25,13 +25,13 @@
25
25
  @addDiffCount="onAddDiffCount()"
26
26
  ></MFieldsGroupListItem>
27
27
 
28
- <TMagicButton @click="addHandler" size="small" :disabled="disabled" v-if="addable">添加组</TMagicButton>
28
+ <TMagicButton @click="addHandler" size="small" :disabled="disabled" v-if="addable">新增</TMagicButton>
29
29
 
30
30
  <TMagicButton :icon="Grid" size="small" @click="toggleMode" v-if="config.enableToggleMode">切换为表格</TMagicButton>
31
31
  </div>
32
32
  </template>
33
33
 
34
- <script setup lang="ts" name="MFormGroupList">
34
+ <script setup lang="ts">
35
35
  import { computed, inject } from 'vue';
36
36
  import { Grid } from '@element-plus/icons-vue';
37
37
 
@@ -42,6 +42,10 @@ import { initValue } from '../utils/form';
42
42
 
43
43
  import MFieldsGroupListItem from './GroupListItem.vue';
44
44
 
45
+ defineOptions({
46
+ name: 'MFormGroupList',
47
+ });
48
+
45
49
  const props = defineProps<{
46
50
  model: any;
47
51
  lastValues?: any;
@@ -42,8 +42,8 @@
42
42
  </div>
43
43
  </template>
44
44
 
45
- <script setup lang="ts" name="MFormGroupListItem">
46
- import { computed, inject, ref, watchEffect } from 'vue';
45
+ <script setup lang="ts">
46
+ import { computed, inject, ref } from 'vue';
47
47
  import { CaretBottom, CaretRight, CaretTop, Delete } from '@element-plus/icons-vue';
48
48
 
49
49
  import { TMagicButton, TMagicIcon } from '@tmagic/design';
@@ -53,6 +53,10 @@ import { filterFunction } from '../utils/form';
53
53
 
54
54
  import Container from './Container.vue';
55
55
 
56
+ defineOptions({
57
+ name: 'MFormGroupListItem',
58
+ });
59
+
56
60
  const props = defineProps<{
57
61
  model: any;
58
62
  lastValues: any;
@@ -69,11 +73,7 @@ const props = defineProps<{
69
73
  const emit = defineEmits(['swap-item', 'remove-item', 'change', 'addDiffCount']);
70
74
 
71
75
  const mForm = inject<FormState | undefined>('mForm');
72
- const expand = ref(false);
73
-
74
- watchEffect(() => {
75
- expand.value = !props.index;
76
- });
76
+ const expand = ref(props.config.expandAll || !props.index);
77
77
 
78
78
  const rowConfig = computed(() => ({
79
79
  type: 'row',
@@ -57,7 +57,7 @@
57
57
  </TMagicCard>
58
58
  </template>
59
59
 
60
- <script setup lang="ts" name="MFormPanel">
60
+ <script setup lang="ts">
61
61
  import { computed, inject, ref } from 'vue';
62
62
  import { CaretBottom, CaretRight } from '@element-plus/icons-vue';
63
63
 
@@ -68,6 +68,10 @@ import { filterFunction } from '../utils/form';
68
68
 
69
69
  import Container from './Container.vue';
70
70
 
71
+ defineOptions({
72
+ name: 'MFormPanel',
73
+ });
74
+
71
75
  const props = defineProps<{
72
76
  model: any;
73
77
  lastValues?: any;
@@ -19,7 +19,7 @@
19
19
  </TMagicRow>
20
20
  </template>
21
21
 
22
- <script setup lang="ts" name="MFormRow">
22
+ <script setup lang="ts">
23
23
  import { inject } from 'vue';
24
24
 
25
25
  import { TMagicRow } from '@tmagic/design';
@@ -28,6 +28,10 @@ import { FormState, RowConfig } from '../schema';
28
28
 
29
29
  import Col from './Col.vue';
30
30
 
31
+ defineOptions({
32
+ name: 'MFormRow',
33
+ });
34
+
31
35
  const props = defineProps<{
32
36
  model: any;
33
37
  lastValues?: any;
@@ -32,7 +32,7 @@
32
32
  </div>
33
33
  </template>
34
34
 
35
- <script setup lang="ts" name="MFormStep">
35
+ <script setup lang="ts">
36
36
  import { inject, ref, watchEffect } from 'vue';
37
37
 
38
38
  import { TMagicStep, TMagicSteps } from '@tmagic/design';
@@ -41,6 +41,10 @@ import { FormState, StepConfig } from '../schema';
41
41
 
42
42
  import Container from './Container.vue';
43
43
 
44
+ defineOptions({
45
+ name: 'MFormStep',
46
+ });
47
+
44
48
  const props = withDefaults(
45
49
  defineProps<{
46
50
  model: any;
@@ -122,7 +122,7 @@
122
122
  </TMagicTooltip>
123
123
  <slot></slot>
124
124
  <TMagicButton v-if="addable" size="small" type="primary" :disabled="disabled" plain @click="newHandler()"
125
- >添加</TMagicButton
125
+ >新增一行</TMagicButton
126
126
  >
127
127
  &nbsp;
128
128
  <TMagicButton
@@ -174,7 +174,7 @@
174
174
  </div>
175
175
  </template>
176
176
 
177
- <script setup lang="ts" name="MFormTable">
177
+ <script setup lang="ts">
178
178
  import { computed, inject, onMounted, ref, toRefs, watchEffect } from 'vue';
179
179
  import { ArrowDown, ArrowUp, Delete, FullScreen, Grid } from '@element-plus/icons-vue';
180
180
  import { cloneDeep } from 'lodash-es';
@@ -197,6 +197,10 @@ import { display as displayFunc, initValue } from '../utils/form';
197
197
 
198
198
  import Container from './Container.vue';
199
199
 
200
+ defineOptions({
201
+ name: 'MFormTable',
202
+ });
203
+
200
204
  const props = withDefaults(
201
205
  defineProps<{
202
206
  model: any;
@@ -2,13 +2,13 @@
2
2
  <component
3
3
  v-model="activeTabName"
4
4
  v-bind="
5
- tabsComponent.props({
5
+ tabsComponent?.props({
6
6
  type: config.tabType,
7
7
  editable: config.editable || false,
8
8
  tabPosition: config.tabPosition || 'top',
9
- })
9
+ }) || {}
10
10
  "
11
- :is="tabsComponent.component"
11
+ :is="tabsComponent?.component || 'el-tabs'"
12
12
  :class="`tmagic-design-tabs ${config.dynamic ? 'magic-form-dynamic-tab' : 'magic-form-tab'}`"
13
13
  @tab-click="tabClickHandler"
14
14
  @tab-add="onTabAdd"
@@ -16,9 +16,11 @@
16
16
  >
17
17
  <component
18
18
  v-for="(tab, tabIndex) in tabs"
19
- :is="tabPaneComponent.component"
19
+ :is="tabPaneComponent?.component || 'el-tab-pane'"
20
20
  :key="tab[mForm?.keyProp || '__key'] ?? tabIndex"
21
- v-bind="tabPaneComponent.props({ name: filter(tab.status) || tabIndex.toString(), lazy: tab.lazy || false })"
21
+ v-bind="
22
+ tabPaneComponent?.props({ name: filter(tab.status) || tabIndex.toString(), lazy: tab.lazy || false }) || {}
23
+ "
22
24
  >
23
25
  <template #label>
24
26
  <span>
@@ -67,7 +69,7 @@
67
69
  </component>
68
70
  </template>
69
71
 
70
- <script setup lang="ts" name="MFormTabs">
72
+ <script setup lang="ts">
71
73
  import { computed, inject, ref, watchEffect } from 'vue';
72
74
  import { cloneDeep, isEmpty } from 'lodash-es';
73
75
 
@@ -78,12 +80,16 @@ import { display as displayFunc, filterFunction } from '../utils/form';
78
80
 
79
81
  import Container from './Container.vue';
80
82
 
83
+ defineOptions({
84
+ name: 'MFormTabs',
85
+ });
86
+
81
87
  type DiffCount = {
82
88
  [tabIndex: number]: number;
83
89
  };
84
90
 
85
- const tabPaneComponent = getConfig('components').tabPane;
86
- const tabsComponent = getConfig('components').tabs;
91
+ const tabPaneComponent = getConfig('components')?.tabPane;
92
+ const tabsComponent = getConfig('components')?.tabs;
87
93
 
88
94
  const getActive = (mForm: FormState | undefined, props: any, activeTabName: string) => {
89
95
  const { config, model, prop } = props;
@@ -14,7 +14,7 @@
14
14
  ></TMagicCascader>
15
15
  </template>
16
16
 
17
- <script setup lang="ts" name="MFormCascader">
17
+ <script setup lang="ts">
18
18
  import { inject, ref, watchEffect } from 'vue';
19
19
 
20
20
  import { TMagicCascader } from '@tmagic/design';
@@ -23,6 +23,10 @@ import { CascaderConfig, FormState } from '../schema';
23
23
  import { getConfig } from '../utils/config';
24
24
  import { useAddField } from '../utils/useAddField';
25
25
 
26
+ defineOptions({
27
+ name: 'MFormCascader',
28
+ });
29
+
26
30
  const props = defineProps<{
27
31
  config: CascaderConfig;
28
32
  model: any;
@@ -10,7 +10,7 @@
10
10
  >
11
11
  </template>
12
12
 
13
- <script setup lang="ts" name="MFormCheckbox">
13
+ <script setup lang="ts">
14
14
  import { computed } from 'vue';
15
15
 
16
16
  import { TMagicCheckbox } from '@tmagic/design';
@@ -18,6 +18,10 @@ import { TMagicCheckbox } from '@tmagic/design';
18
18
  import { CheckboxConfig } from '../schema';
19
19
  import { useAddField } from '../utils/useAddField';
20
20
 
21
+ defineOptions({
22
+ name: 'MFormCheckbox',
23
+ });
24
+
21
25
  const props = defineProps<{
22
26
  config: CheckboxConfig;
23
27
  model: any;
@@ -11,14 +11,18 @@
11
11
  </TMagicCheckboxGroup>
12
12
  </template>
13
13
 
14
- <script lang="ts" setup name="MFormCheckGroup">
14
+ <script lang="ts" setup>
15
15
  import { computed, inject } from 'vue';
16
16
 
17
17
  import { TMagicCheckbox, TMagicCheckboxGroup } from '@tmagic/design';
18
18
 
19
19
  import { CheckboxGroupConfig, FormState } from '../schema';
20
+ import { filterFunction } from '../utils/form';
20
21
  import { useAddField } from '../utils/useAddField';
21
- import { filterFunction } from '..';
22
+
23
+ defineOptions({
24
+ name: 'MFormCheckGroup',
25
+ });
22
26
 
23
27
  const props = defineProps<{
24
28
  config: CheckboxGroupConfig;
@@ -8,12 +8,16 @@
8
8
  ></TMagicColorPicker>
9
9
  </template>
10
10
 
11
- <script lang="ts" setup name="MFormColorPicker">
11
+ <script lang="ts" setup>
12
12
  import { TMagicColorPicker } from '@tmagic/design';
13
13
 
14
14
  import { ColorPickConfig } from '../schema';
15
15
  import { useAddField } from '../utils/useAddField';
16
16
 
17
+ defineOptions({
18
+ name: 'MFormColorPicker',
19
+ });
20
+
17
21
  const props = defineProps<{
18
22
  config: ColorPickConfig;
19
23
  model: any;
@@ -11,13 +11,17 @@
11
11
  ></TMagicDatePicker>
12
12
  </template>
13
13
 
14
- <script lang="ts" setup name="MFormDate">
14
+ <script lang="ts" setup>
15
15
  import { TMagicDatePicker } from '@tmagic/design';
16
16
  import { datetimeFormatter } from '@tmagic/utils';
17
17
 
18
18
  import { DateConfig } from '../schema';
19
19
  import { useAddField } from '../utils/useAddField';
20
20
 
21
+ defineOptions({
22
+ name: 'MFormDate',
23
+ });
24
+
21
25
  const props = defineProps<{
22
26
  config: DateConfig;
23
27
  model: any;
@@ -13,13 +13,17 @@
13
13
  ></TMagicDatePicker>
14
14
  </template>
15
15
 
16
- <script lang="ts" setup name="MFormDateTime">
16
+ <script lang="ts" setup>
17
17
  import { TMagicDatePicker } from '@tmagic/design';
18
18
  import { datetimeFormatter } from '@tmagic/utils';
19
19
 
20
20
  import { DateTimeConfig } from '../schema';
21
21
  import { useAddField } from '../utils/useAddField';
22
22
 
23
+ defineOptions({
24
+ name: 'MFormDateTime',
25
+ });
26
+
23
27
  const props = defineProps<{
24
28
  config: DateTimeConfig;
25
29
  model: any;
@@ -13,7 +13,7 @@
13
13
  ></TMagicDatePicker>
14
14
  </template>
15
15
 
16
- <script lang="ts" setup name="MFormDateRange">
16
+ <script lang="ts" setup>
17
17
  import { ref, watch } from 'vue';
18
18
 
19
19
  import { TMagicDatePicker } from '@tmagic/design';
@@ -22,6 +22,10 @@ import { datetimeFormatter } from '@tmagic/utils';
22
22
  import { DaterangeConfig } from '../schema';
23
23
  import { useAddField } from '../utils/useAddField';
24
24
 
25
+ defineOptions({
26
+ name: 'MFormDateRange',
27
+ });
28
+
25
29
  const props = defineProps<{
26
30
  config: DaterangeConfig;
27
31
  model: any;
@@ -2,10 +2,14 @@
2
2
  <span v-if="model">{{ model[name] }}</span>
3
3
  </template>
4
4
 
5
- <script setup lang="ts" name="MFormDisplay">
5
+ <script setup lang="ts">
6
6
  import { DisplayConfig } from '../schema';
7
7
  import { useAddField } from '../utils/useAddField';
8
8
 
9
+ defineOptions({
10
+ name: 'MFormDisplay',
11
+ });
12
+
9
13
  const props = defineProps<{
10
14
  config: DisplayConfig;
11
15
  model: any;
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
  </template>
14
14
 
15
- <script lang="ts" setup name="MFormDynamicField">
15
+ <script lang="ts" setup>
16
16
  /**
17
17
  * 动态表单,目前只支持input类型字段
18
18
  * inputType: 'dynamic-field',
@@ -31,6 +31,10 @@ import { DynamicFieldConfig } from '../schema';
31
31
  import { getConfig } from '../utils/config';
32
32
  import { useAddField } from '../utils/useAddField';
33
33
 
34
+ defineOptions({
35
+ name: 'MFormDynamicField',
36
+ });
37
+
34
38
  const props = defineProps<{
35
39
  config: DynamicFieldConfig;
36
40
  model: any;
@@ -2,10 +2,14 @@
2
2
  <input v-if="model" v-model="model[name]" type="hidden" />
3
3
  </template>
4
4
 
5
- <script setup lang="ts" name="MFormHidden">
5
+ <script setup lang="ts">
6
6
  import { HiddenConfig } from '../schema';
7
7
  import { useAddField } from '../utils/useAddField';
8
8
 
9
+ defineOptions({
10
+ name: 'MFormHidden',
11
+ });
12
+
9
13
  const props = defineProps<{
10
14
  config: HiddenConfig;
11
15
  model: any;
@@ -16,7 +16,7 @@
16
16
  </div>
17
17
  </template>
18
18
 
19
- <script lang="ts" setup name="MFormLink">
19
+ <script lang="ts" setup>
20
20
  import { computed, inject, ref } from 'vue';
21
21
 
22
22
  import { TMagicButton } from '@tmagic/design';
@@ -25,6 +25,10 @@ import FormDialog from '../FormDialog.vue';
25
25
  import { FormState, LinkConfig } from '../schema';
26
26
  import { useAddField } from '../utils/useAddField';
27
27
 
28
+ defineOptions({
29
+ name: 'MFormLink',
30
+ });
31
+
28
32
  const props = defineProps<{
29
33
  config: LinkConfig;
30
34
  model: any;
@@ -15,7 +15,7 @@
15
15
  ></TMagicInputNumber>
16
16
  </template>
17
17
 
18
- <script lang="ts" setup name="MFormNumber">
18
+ <script lang="ts" setup>
19
19
  import { inject } from 'vue';
20
20
 
21
21
  import { TMagicInputNumber } from '@tmagic/design';
@@ -23,6 +23,10 @@ import { TMagicInputNumber } from '@tmagic/design';
23
23
  import { FormState, NumberConfig } from '../schema';
24
24
  import { useAddField } from '../utils/useAddField';
25
25
 
26
+ defineOptions({
27
+ name: 'MFormNumber',
28
+ });
29
+
26
30
  const props = defineProps<{
27
31
  config: NumberConfig;
28
32
  model: any;
@@ -10,12 +10,16 @@
10
10
  </TMagicRadioGroup>
11
11
  </template>
12
12
 
13
- <script lang="ts" setup name="MFormRadioGroup">
13
+ <script lang="ts" setup>
14
14
  import { TMagicRadio, TMagicRadioGroup } from '@tmagic/design';
15
15
 
16
16
  import { RadioGroupConfig } from '../schema';
17
17
  import { useAddField } from '../utils/useAddField';
18
18
 
19
+ defineOptions({
20
+ name: 'MFormRadioGroup',
21
+ });
22
+
19
23
  const props = defineProps<{
20
24
  config: RadioGroupConfig;
21
25
  model: any;