@epic-designer/antd 1.1.2 → 1.1.4-beta.0

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.
@@ -40,6 +40,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
40
40
  function setData(data) {
41
41
  Object.assign(formData, data);
42
42
  }
43
+ function resetData() {
44
+ var _a2;
45
+ (_a2 = form.value) == null ? void 0 : _a2.resetFields();
46
+ }
43
47
  const mountedForm = (vNode) => {
44
48
  var _a2, _b2, _c, _d, _e, _f, _g;
45
49
  form.value = (_a2 = vNode.component) == null ? void 0 : _a2.exposed;
@@ -49,6 +53,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
49
53
  forms.value[name] = form.value;
50
54
  form.value.getData = getData;
51
55
  form.value.setData = setData;
56
+ form.value.resetData = resetData;
52
57
  return false;
53
58
  }
54
59
  };
@@ -82,6 +87,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
82
87
  __expose({
83
88
  form,
84
89
  getData,
90
+ resetData,
85
91
  setData,
86
92
  validate
87
93
  });
@@ -38,6 +38,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
38
38
  function setData(data) {
39
39
  Object.assign(formData, data);
40
40
  }
41
+ function resetData() {
42
+ var _a2;
43
+ (_a2 = form.value) == null ? void 0 : _a2.resetFields();
44
+ }
41
45
  const mountedForm = (vNode) => {
42
46
  var _a2, _b2, _c, _d, _e, _f, _g;
43
47
  form.value = (_a2 = vNode.component) == null ? void 0 : _a2.exposed;
@@ -47,6 +51,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
51
  forms.value[name] = form.value;
48
52
  form.value.getData = getData;
49
53
  form.value.setData = setData;
54
+ form.value.resetData = resetData;
50
55
  return false;
51
56
  }
52
57
  };
@@ -80,6 +85,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
80
85
  __expose({
81
86
  form,
82
87
  getData,
88
+ resetData,
83
89
  setData,
84
90
  validate
85
91
  });
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ const vue = require('vue');
4
+ const antDesignVue = require('ant-design-vue');
5
+
6
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
7
+ __name: "input-number",
8
+ setup(__props) {
9
+ return (_ctx, _cache) => {
10
+ return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.InputNumber));
11
+ };
12
+ }
13
+ });
14
+
15
+ exports.default = _sfc_main;
@@ -0,0 +1,13 @@
1
+ import { defineComponent, createBlock, openBlock, unref } from 'vue';
2
+ import { InputNumber } from 'ant-design-vue';
3
+
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "input-number",
6
+ setup(__props) {
7
+ return (_ctx, _cache) => {
8
+ return openBlock(), createBlock(unref(InputNumber));
9
+ };
10
+ }
11
+ });
12
+
13
+ export { _sfc_main as default };
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ const vue = require('vue');
4
+ const antDesignVue = require('ant-design-vue');
5
+
6
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
7
+ __name: "input",
8
+ props: {
9
+ componentSchema: { type: Object, required: true },
10
+ remoteSelector: { type: Boolean, required: true, default: false }
11
+ },
12
+ setup(__props) {
13
+ const props = __props;
14
+ const eventBus = vue.inject("eventBus");
15
+ const handleRemoteSelector = () => {
16
+ eventBus == null ? void 0 : eventBus.emit("openRemoteSelector", props.componentSchema);
17
+ };
18
+ return (_ctx, _cache) => {
19
+ return vue.openBlock(), vue.createBlock(
20
+ vue.unref(antDesignVue.Input),
21
+ null,
22
+ vue.createSlots({
23
+ _: 2
24
+ /* DYNAMIC */
25
+ }, [
26
+ props.remoteSelector ? {
27
+ name: "suffix",
28
+ fn: vue.withCtx(() => [
29
+ props.remoteSelector ? (vue.openBlock(), vue.createElementBlock("span", {
30
+ key: 0,
31
+ onClick: handleRemoteSelector,
32
+ class: "iconfont icon--epic--search-rounded icon--epic"
33
+ })) : vue.createCommentVNode("v-if", true)
34
+ ]),
35
+ key: "0"
36
+ } : void 0
37
+ ]),
38
+ 1024
39
+ /* DYNAMIC_SLOTS */
40
+ );
41
+ };
42
+ }
43
+ });
44
+
45
+ exports.default = _sfc_main;
@@ -0,0 +1,43 @@
1
+ import { defineComponent, inject, createBlock, openBlock, unref, createSlots, withCtx, createElementBlock, createCommentVNode } from 'vue';
2
+ import { Input } from 'ant-design-vue';
3
+
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "input",
6
+ props: {
7
+ componentSchema: { type: Object, required: true },
8
+ remoteSelector: { type: Boolean, required: true, default: false }
9
+ },
10
+ setup(__props) {
11
+ const props = __props;
12
+ const eventBus = inject("eventBus");
13
+ const handleRemoteSelector = () => {
14
+ eventBus == null ? void 0 : eventBus.emit("openRemoteSelector", props.componentSchema);
15
+ };
16
+ return (_ctx, _cache) => {
17
+ return openBlock(), createBlock(
18
+ unref(Input),
19
+ null,
20
+ createSlots({
21
+ _: 2
22
+ /* DYNAMIC */
23
+ }, [
24
+ props.remoteSelector ? {
25
+ name: "suffix",
26
+ fn: withCtx(() => [
27
+ props.remoteSelector ? (openBlock(), createElementBlock("span", {
28
+ key: 0,
29
+ onClick: handleRemoteSelector,
30
+ class: "iconfont icon--epic--search-rounded icon--epic"
31
+ })) : createCommentVNode("v-if", true)
32
+ ]),
33
+ key: "0"
34
+ } : void 0
35
+ ]),
36
+ 1024
37
+ /* DYNAMIC_SLOTS */
38
+ );
39
+ };
40
+ }
41
+ });
42
+
43
+ export { _sfc_main as default };
@@ -36,7 +36,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
36
36
  height: "calc(100vh - 108px)",
37
37
  padding: 0
38
38
  };
39
- const getprops = vue.computed(() => {
39
+ const getProps = vue.computed(() => {
40
40
  var _a, _b;
41
41
  return {
42
42
  ...props.componentSchema,
@@ -70,7 +70,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
70
70
  return (_ctx, _cache) => {
71
71
  return vue.openBlock(), vue.createBlock(
72
72
  vue.unref(antDesignVue.Modal),
73
- vue.normalizeProps(vue.guardReactiveProps(getprops.value)),
73
+ vue.normalizeProps(vue.guardReactiveProps(getProps.value)),
74
74
  {
75
75
  default: vue.withCtx(() => [
76
76
  vue.createElementVNode("div", _hoisted_1, [
@@ -34,7 +34,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
34
34
  height: "calc(100vh - 108px)",
35
35
  padding: 0
36
36
  };
37
- const getprops = computed(() => {
37
+ const getProps = computed(() => {
38
38
  var _a, _b;
39
39
  return {
40
40
  ...props.componentSchema,
@@ -68,7 +68,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
68
68
  return (_ctx, _cache) => {
69
69
  return openBlock(), createBlock(
70
70
  unref(Modal),
71
- normalizeProps(guardReactiveProps(getprops.value)),
71
+ normalizeProps(guardReactiveProps(getProps.value)),
72
72
  {
73
73
  default: withCtx(() => [
74
74
  createElementVNode("div", _hoisted_1, [
package/dist/index.cjs CHANGED
@@ -1204,7 +1204,7 @@ const FormItem = {
1204
1204
 
1205
1205
  const Input = {
1206
1206
  bindModel: "value",
1207
- component: async () => (await import('ant-design-vue')).Input,
1207
+ component: () => import('./chunks/input.cjs'),
1208
1208
  config: {
1209
1209
  action: [
1210
1210
  {
@@ -1374,7 +1374,7 @@ const Input = {
1374
1374
 
1375
1375
  const InputNumber = {
1376
1376
  bindModel: "value",
1377
- component: async () => (await import('ant-design-vue')).InputNumber,
1377
+ component: () => import('./chunks/input-number.cjs'),
1378
1378
  config: {
1379
1379
  action: [
1380
1380
  {
package/dist/index.mjs CHANGED
@@ -1202,7 +1202,7 @@ const FormItem = {
1202
1202
 
1203
1203
  const Input = {
1204
1204
  bindModel: "value",
1205
- component: async () => (await import('ant-design-vue')).Input,
1205
+ component: () => import('./chunks/input.mjs'),
1206
1206
  config: {
1207
1207
  action: [
1208
1208
  {
@@ -1372,7 +1372,7 @@ const Input = {
1372
1372
 
1373
1373
  const InputNumber = {
1374
1374
  bindModel: "value",
1375
- component: async () => (await import('ant-design-vue')).InputNumber,
1375
+ component: () => import('./chunks/input-number.mjs'),
1376
1376
  config: {
1377
1377
  action: [
1378
1378
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-designer/antd",
3
- "version": "1.1.2",
3
+ "version": "1.1.4-beta.0",
4
4
  "description": "epic-designer base antd ui",
5
5
  "private": false,
6
6
  "author": "kchengz",
@@ -7,7 +7,7 @@ const emits = defineEmits<{
7
7
  'update:modelValue': any;
8
8
  }>();
9
9
  const attrs = useAttrs();
10
- const getprops = computed(() => ({
10
+ const getProps = computed(() => ({
11
11
  ...attrs,
12
12
  'onUpdate:value': handleUpdate,
13
13
  showCheckedStrategy:
@@ -20,5 +20,5 @@ function handleUpdate(e = null): void {
20
20
  }
21
21
  </script>
22
22
  <template>
23
- <Cascader v-bind="getprops" />
23
+ <Cascader v-bind="getProps" />
24
24
  </template>
package/src/form/form.vue CHANGED
@@ -10,6 +10,8 @@ import { Form } from 'ant-design-vue';
10
10
 
11
11
  interface FormInstance extends InstanceType<typeof Form> {
12
12
  getData?: () => FormDataModel;
13
+ resetData: () => void;
14
+ resetFields: () => void;
13
15
  scrollToField: (name: string) => void;
14
16
  setData?: (data: FormDataModel) => void;
15
17
  validate: () => Promise<unknown>;
@@ -70,6 +72,13 @@ function setData(data: FormDataModel) {
70
72
  Object.assign(formData, data);
71
73
  }
72
74
 
75
+ /**
76
+ * 重置表单数据
77
+ */
78
+ function resetData() {
79
+ form.value?.resetFields();
80
+ }
81
+
73
82
  // form组件需要特殊处理
74
83
  const mountedForm = (vNode: VNode) => {
75
84
  form.value = vNode.component?.exposed as FormInstance;
@@ -84,6 +93,7 @@ const mountedForm = (vNode: VNode) => {
84
93
  forms.value[name] = form.value;
85
94
  form.value.getData = getData;
86
95
  form.value.setData = setData;
96
+ form.value.resetData = resetData;
87
97
  return false;
88
98
  }
89
99
  };
@@ -125,6 +135,7 @@ const children = computed(() => {
125
135
  defineExpose({
126
136
  form,
127
137
  getData,
138
+ resetData,
128
139
  setData,
129
140
  validate,
130
141
  });
@@ -2,7 +2,7 @@ import type { ComponentConfigModel } from '@epic-designer/types';
2
2
 
3
3
  export default {
4
4
  bindModel: 'value',
5
- component: async () => (await import('ant-design-vue')).Input,
5
+ component: () => import('./input.vue'),
6
6
  config: {
7
7
  action: [
8
8
  {
@@ -0,0 +1,35 @@
1
+ <script lang="ts" setup>
2
+ import type { ComponentSchema } from '@epic-designer/types';
3
+
4
+ import { inject } from 'vue';
5
+
6
+ import { EventBus } from '@epic-designer/hooks';
7
+ import { Input } from 'ant-design-vue';
8
+
9
+ const props = withDefaults(
10
+ defineProps<{
11
+ componentSchema: ComponentSchema;
12
+ remoteSelector: boolean;
13
+ }>(),
14
+ {
15
+ remoteSelector: false,
16
+ },
17
+ );
18
+
19
+ const eventBus = inject<EventBus>('eventBus');
20
+
21
+ const handleRemoteSelector = () => {
22
+ eventBus?.emit('openRemoteSelector', props.componentSchema);
23
+ };
24
+ </script>
25
+ <template>
26
+ <Input>
27
+ <template #suffix v-if="props.remoteSelector">
28
+ <span
29
+ v-if="props.remoteSelector"
30
+ @click="handleRemoteSelector"
31
+ class="iconfont icon--epic--search-rounded icon--epic"
32
+ ></span>
33
+ </template>
34
+ </Input>
35
+ </template>
@@ -2,7 +2,7 @@ import type { ComponentConfigModel } from '@epic-designer/types';
2
2
 
3
3
  export default {
4
4
  bindModel: 'value',
5
- component: async () => (await import('ant-design-vue')).InputNumber,
5
+ component: () => import('./input-number.vue'),
6
6
  config: {
7
7
  action: [
8
8
  {
@@ -0,0 +1,6 @@
1
+ <script lang="ts" setup>
2
+ import { InputNumber } from 'ant-design-vue';
3
+ </script>
4
+ <template>
5
+ <InputNumber />
6
+ </template>
@@ -42,7 +42,7 @@ const bodyStyle = {
42
42
  padding: 0,
43
43
  };
44
44
 
45
- const getprops = computed<Record<string, any>>(() => ({
45
+ const getProps = computed<Record<string, any>>(() => ({
46
46
  ...props.componentSchema,
47
47
  ...attrs,
48
48
  bodyStyle,
@@ -74,7 +74,7 @@ function handleClose() {
74
74
  </script>
75
75
 
76
76
  <template>
77
- <Modal v-bind="getprops">
77
+ <Modal v-bind="getProps">
78
78
  <div class="epic-modal-main epic-scoped">
79
79
  <slot>
80
80
  <slot name="edit-node">