@epic-designer/antd 1.1.4-beta.6 → 1.1.5-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.
@@ -1,8 +1,32 @@
1
1
  'use strict';
2
2
 
3
3
  const vue = require('vue');
4
+ require('epic-designer');
4
5
  const antDesignVue = require('ant-design-vue');
5
6
 
7
+ const PAGE_MANAGER_KEY = Symbol("pageManager");
8
+ function usePageManager() {
9
+ const pageManager = vue.inject(PAGE_MANAGER_KEY);
10
+ if (!pageManager) {
11
+ throw new Error("\u672A\u83B7\u53D6\u5230 pageManager \u5B9E\u4F8B");
12
+ }
13
+ return pageManager;
14
+ }
15
+
16
+ const FORM_CONTEXT_KEY = Symbol("FormContext");
17
+ const FORM_INSTANCES_KEY = Symbol("FormInstances");
18
+ function useForm(formName) {
19
+ const pageManager = usePageManager();
20
+ const formData = pageManager.setFormData({}, formName);
21
+ const formInstances = vue.inject(
22
+ FORM_INSTANCES_KEY,
23
+ vue.ref({})
24
+ );
25
+ vue.provide(FORM_CONTEXT_KEY, formData);
26
+ vue.provide("formData", formData);
27
+ return { formData, formInstances };
28
+ }
29
+
6
30
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
7
31
  ...{
8
32
  inheritAttrs: false
@@ -13,16 +37,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
13
37
  scrollToFirstError: { type: Boolean, required: false, default: false }
14
38
  },
15
39
  setup(__props, { expose: __expose }) {
16
- var _a, _b;
40
+ var _a, _b, _c;
17
41
  const props = __props;
18
- const pageManager = vue.inject("pageManager", {});
19
42
  const form = vue.ref(null);
20
- const forms = vue.inject("forms", {});
21
- const formData = pageManager.setFormData(
22
- {},
23
- (_b = (_a = props.componentSchema) == null ? void 0 : _a.props) == null ? void 0 : _b.name
43
+ const { formData, formInstances } = useForm(
44
+ (_c = (_b = (_a = props.componentSchema) == null ? void 0 : _a.props) == null ? void 0 : _b.name) != null ? _c : "default"
24
45
  );
25
- vue.provide("formData", formData);
26
46
  function getData() {
27
47
  return formData;
28
48
  }
@@ -45,12 +65,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
45
65
  (_a2 = form.value) == null ? void 0 : _a2.resetFields();
46
66
  }
47
67
  const mountedForm = (vNode) => {
48
- var _a2, _b2, _c, _d, _e, _f, _g;
68
+ var _a2, _b2, _c2, _d, _e, _f, _g;
49
69
  form.value = (_a2 = vNode.component) == null ? void 0 : _a2.exposed;
50
- if (((_b2 = props.componentSchema) == null ? void 0 : _b2.type) === "form" && forms.value && form.value) {
51
- const name = (_g = (_f = (_d = (_c = props.componentSchema) == null ? void 0 : _c.props) == null ? void 0 : _d.name) != null ? _f : (_e = props.componentSchema) == null ? void 0 : _e.name) != null ? _g : "default";
70
+ if (((_b2 = props.componentSchema) == null ? void 0 : _b2.type) === "form" && formInstances.value && form.value) {
71
+ const name = (_g = (_f = (_d = (_c2 = props.componentSchema) == null ? void 0 : _c2.props) == null ? void 0 : _d.name) != null ? _f : (_e = props.componentSchema) == null ? void 0 : _e.name) != null ? _g : "default";
52
72
  form.value.validate = validate;
53
- forms.value[name] = form.value;
73
+ formInstances.value[name] = form.value;
54
74
  form.value.getData = getData;
55
75
  form.value.setData = setData;
56
76
  form.value.resetData = resetData;
@@ -1,6 +1,30 @@
1
- import { defineComponent, inject, ref, provide, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createElementBlock, Fragment, renderList } from 'vue';
1
+ import { inject, ref, provide, defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createElementBlock, Fragment, renderList } from 'vue';
2
+ import 'epic-designer';
2
3
  import { Form } from 'ant-design-vue';
3
4
 
5
+ const PAGE_MANAGER_KEY = Symbol("pageManager");
6
+ function usePageManager() {
7
+ const pageManager = inject(PAGE_MANAGER_KEY);
8
+ if (!pageManager) {
9
+ throw new Error("\u672A\u83B7\u53D6\u5230 pageManager \u5B9E\u4F8B");
10
+ }
11
+ return pageManager;
12
+ }
13
+
14
+ const FORM_CONTEXT_KEY = Symbol("FormContext");
15
+ const FORM_INSTANCES_KEY = Symbol("FormInstances");
16
+ function useForm(formName) {
17
+ const pageManager = usePageManager();
18
+ const formData = pageManager.setFormData({}, formName);
19
+ const formInstances = inject(
20
+ FORM_INSTANCES_KEY,
21
+ ref({})
22
+ );
23
+ provide(FORM_CONTEXT_KEY, formData);
24
+ provide("formData", formData);
25
+ return { formData, formInstances };
26
+ }
27
+
4
28
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
29
  ...{
6
30
  inheritAttrs: false
@@ -11,16 +35,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11
35
  scrollToFirstError: { type: Boolean, required: false, default: false }
12
36
  },
13
37
  setup(__props, { expose: __expose }) {
14
- var _a, _b;
38
+ var _a, _b, _c;
15
39
  const props = __props;
16
- const pageManager = inject("pageManager", {});
17
40
  const form = ref(null);
18
- const forms = inject("forms", {});
19
- const formData = pageManager.setFormData(
20
- {},
21
- (_b = (_a = props.componentSchema) == null ? void 0 : _a.props) == null ? void 0 : _b.name
41
+ const { formData, formInstances } = useForm(
42
+ (_c = (_b = (_a = props.componentSchema) == null ? void 0 : _a.props) == null ? void 0 : _b.name) != null ? _c : "default"
22
43
  );
23
- provide("formData", formData);
24
44
  function getData() {
25
45
  return formData;
26
46
  }
@@ -43,12 +63,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43
63
  (_a2 = form.value) == null ? void 0 : _a2.resetFields();
44
64
  }
45
65
  const mountedForm = (vNode) => {
46
- var _a2, _b2, _c, _d, _e, _f, _g;
66
+ var _a2, _b2, _c2, _d, _e, _f, _g;
47
67
  form.value = (_a2 = vNode.component) == null ? void 0 : _a2.exposed;
48
- if (((_b2 = props.componentSchema) == null ? void 0 : _b2.type) === "form" && forms.value && form.value) {
49
- const name = (_g = (_f = (_d = (_c = props.componentSchema) == null ? void 0 : _c.props) == null ? void 0 : _d.name) != null ? _f : (_e = props.componentSchema) == null ? void 0 : _e.name) != null ? _g : "default";
68
+ if (((_b2 = props.componentSchema) == null ? void 0 : _b2.type) === "form" && formInstances.value && form.value) {
69
+ const name = (_g = (_f = (_d = (_c2 = props.componentSchema) == null ? void 0 : _c2.props) == null ? void 0 : _d.name) != null ? _f : (_e = props.componentSchema) == null ? void 0 : _e.name) != null ? _g : "default";
50
70
  form.value.validate = validate;
51
- forms.value[name] = form.value;
71
+ formInstances.value[name] = form.value;
52
72
  form.value.getData = getData;
53
73
  form.value.setData = setData;
54
74
  form.value.resetData = resetData;
@@ -1,8 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  const vue = require('vue');
4
+ require('epic-designer');
4
5
  const antDesignVue = require('ant-design-vue');
5
6
 
7
+ const EVENT_BUS_KEY = Symbol("EventBusContext");
8
+ function useEventBus() {
9
+ const eventBus = vue.inject(EVENT_BUS_KEY, null);
10
+ return eventBus;
11
+ }
12
+
6
13
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
7
14
  __name: "input",
8
15
  props: {
@@ -16,7 +23,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
16
23
  setup(__props) {
17
24
  const props = __props;
18
25
  const formData = vue.inject("formData", {});
19
- const eventBus = vue.inject("eventBus", null);
26
+ const eventBus = useEventBus();
20
27
  const handleDataSelector = () => {
21
28
  eventBus == null ? void 0 : eventBus.emit("openDataSelector", props.componentSchema, props.options);
22
29
  };
@@ -31,27 +38,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
31
38
  });
32
39
  });
33
40
  return (_ctx, _cache) => {
34
- return vue.openBlock(), vue.createBlock(
35
- vue.unref(antDesignVue.Input),
36
- null,
37
- vue.createSlots({
38
- _: 2
39
- /* DYNAMIC */
40
- }, [
41
- props.dataSelector ? {
42
- name: "suffix",
43
- fn: vue.withCtx(() => [
44
- vue.createElementVNode("span", {
45
- onClick: handleDataSelector,
46
- class: "iconfont icon--epic icon--epic--search-rounded"
47
- })
48
- ]),
49
- key: "0"
50
- } : void 0
41
+ return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), null, {
42
+ suffix: vue.withCtx(() => [
43
+ props.dataSelector ? (vue.openBlock(), vue.createElementBlock("span", {
44
+ key: 0,
45
+ onClick: handleDataSelector,
46
+ class: "iconfont icon--epic icon--epic--search-rounded"
47
+ })) : vue.createCommentVNode("v-if", true),
48
+ vue.renderSlot(_ctx.$slots, "suffix")
51
49
  ]),
52
- 1024
53
- /* DYNAMIC_SLOTS */
54
- );
50
+ _: 3
51
+ /* FORWARDED */
52
+ });
55
53
  };
56
54
  }
57
55
  });
@@ -1,6 +1,13 @@
1
- import { defineComponent, inject, createBlock, openBlock, unref, createSlots, withCtx, createElementVNode } from 'vue';
1
+ import { inject, defineComponent, createBlock, openBlock, unref, withCtx, createElementBlock, createCommentVNode, renderSlot } from 'vue';
2
+ import 'epic-designer';
2
3
  import { Input } from 'ant-design-vue';
3
4
 
5
+ const EVENT_BUS_KEY = Symbol("EventBusContext");
6
+ function useEventBus() {
7
+ const eventBus = inject(EVENT_BUS_KEY, null);
8
+ return eventBus;
9
+ }
10
+
4
11
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
12
  __name: "input",
6
13
  props: {
@@ -14,7 +21,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
21
  setup(__props) {
15
22
  const props = __props;
16
23
  const formData = inject("formData", {});
17
- const eventBus = inject("eventBus", null);
24
+ const eventBus = useEventBus();
18
25
  const handleDataSelector = () => {
19
26
  eventBus == null ? void 0 : eventBus.emit("openDataSelector", props.componentSchema, props.options);
20
27
  };
@@ -29,27 +36,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29
36
  });
30
37
  });
31
38
  return (_ctx, _cache) => {
32
- return openBlock(), createBlock(
33
- unref(Input),
34
- null,
35
- createSlots({
36
- _: 2
37
- /* DYNAMIC */
38
- }, [
39
- props.dataSelector ? {
40
- name: "suffix",
41
- fn: withCtx(() => [
42
- createElementVNode("span", {
43
- onClick: handleDataSelector,
44
- class: "iconfont icon--epic icon--epic--search-rounded"
45
- })
46
- ]),
47
- key: "0"
48
- } : void 0
39
+ return openBlock(), createBlock(unref(Input), null, {
40
+ suffix: withCtx(() => [
41
+ props.dataSelector ? (openBlock(), createElementBlock("span", {
42
+ key: 0,
43
+ onClick: handleDataSelector,
44
+ class: "iconfont icon--epic icon--epic--search-rounded"
45
+ })) : createCommentVNode("v-if", true),
46
+ renderSlot(_ctx.$slots, "suffix")
49
47
  ]),
50
- 1024
51
- /* DYNAMIC_SLOTS */
52
- );
48
+ _: 3
49
+ /* FORWARDED */
50
+ });
53
51
  };
54
52
  }
55
53
  });
@@ -3,7 +3,7 @@
3
3
  const vue = require('vue');
4
4
  const antDesignVue = require('ant-design-vue');
5
5
 
6
- const _hoisted_1 = { class: "epic-modal-main epic-scoped" };
6
+ const _hoisted_1 = { class: "epic-modal-main ep-scoped" };
7
7
  const _hoisted_2 = {
8
8
  key: 0,
9
9
  class: "epic-modal-footer"
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, useAttrs, computed, createBlock, openBlock, unref, normalizeProps, guardReactiveProps, withCtx, createElementVNode, createElementBlock, createCommentVNode, renderSlot, Fragment, renderList, createVNode, createTextVNode, toDisplayString } from 'vue';
2
2
  import { version, Modal, Space, Button } from 'ant-design-vue';
3
3
 
4
- const _hoisted_1 = { class: "epic-modal-main epic-scoped" };
4
+ const _hoisted_1 = { class: "epic-modal-main ep-scoped" };
5
5
  const _hoisted_2 = {
6
6
  key: 0,
7
7
  class: "epic-modal-footer"
@@ -1,8 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  const vue = require('vue');
4
+ require('epic-designer');
4
5
  const antDesignVue = require('ant-design-vue');
5
6
 
7
+ const NODE_ATTRS_KEY = Symbol("nodeAttrs");
8
+ function useNodeAttrs() {
9
+ const nodeAttrs = vue.inject(NODE_ATTRS_KEY, {});
10
+ return nodeAttrs;
11
+ }
12
+
6
13
  const tabPane = vue.defineComponent({
7
14
  props: {
8
15
  componentSchema: {
@@ -12,7 +19,7 @@ const tabPane = vue.defineComponent({
12
19
  }
13
20
  },
14
21
  setup(props, { slots }) {
15
- const nodeAttrs = vue.inject("nodeAttrs", {});
22
+ const nodeAttrs = useNodeAttrs();
16
23
  return () => {
17
24
  var _a;
18
25
  const componentSchema = {
@@ -1,6 +1,13 @@
1
- import { defineComponent, inject, h, renderSlot } from 'vue';
1
+ import { inject, defineComponent, h, renderSlot } from 'vue';
2
+ import 'epic-designer';
2
3
  import { TabPane } from 'ant-design-vue';
3
4
 
5
+ const NODE_ATTRS_KEY = Symbol("nodeAttrs");
6
+ function useNodeAttrs() {
7
+ const nodeAttrs = inject(NODE_ATTRS_KEY, {});
8
+ return nodeAttrs;
9
+ }
10
+
4
11
  const tabPane = defineComponent({
5
12
  props: {
6
13
  componentSchema: {
@@ -10,7 +17,7 @@ const tabPane = defineComponent({
10
17
  }
11
18
  },
12
19
  setup(props, { slots }) {
13
- const nodeAttrs = inject("nodeAttrs", {});
20
+ const nodeAttrs = useNodeAttrs();
14
21
  return () => {
15
22
  var _a;
16
23
  const componentSchema = {
package/dist/index.cjs CHANGED
@@ -2971,7 +2971,7 @@ function styleInject(css, ref) {
2971
2971
  }
2972
2972
  }
2973
2973
 
2974
- var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.epic-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.epic-input-size .ant-select:hover {\n border: none !important;\n box-shadow: none !important;\n}\n";
2974
+ var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.ep-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.ep-input-size .ant-select-selector {\n border: none !important;\n box-shadow: none !important;\n padding: 0 4px !important;\n}\n";
2975
2975
  styleInject(css_248z);
2976
2976
 
2977
2977
  function setupAntd(pluginManager = epicDesigner.pluginManager) {
package/dist/index.d.cts CHANGED
@@ -27,7 +27,7 @@ function styleInject(css, ref) {
27
27
  }
28
28
  }
29
29
 
30
- var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.epic-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.epic-input-size .ant-select:hover {\n border: none !important;\n box-shadow: none !important;\n}\n";
30
+ var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.ep-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.ep-input-size .ant-select-selector {\n border: none !important;\n box-shadow: none !important;\n padding: 0 4px !important;\n}\n";
31
31
  styleInject(css_248z);
32
32
 
33
33
  declare function setupAntd(pluginManager?: PluginManager): void;
package/dist/index.d.mts CHANGED
@@ -27,7 +27,7 @@ function styleInject(css, ref) {
27
27
  }
28
28
  }
29
29
 
30
- var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.epic-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.epic-input-size .ant-select:hover {\n border: none !important;\n box-shadow: none !important;\n}\n";
30
+ var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.ep-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.ep-input-size .ant-select-selector {\n border: none !important;\n box-shadow: none !important;\n padding: 0 4px !important;\n}\n";
31
31
  styleInject(css_248z);
32
32
 
33
33
  declare function setupAntd(pluginManager?: PluginManager): void;
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ function styleInject(css, ref) {
27
27
  }
28
28
  }
29
29
 
30
- var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.epic-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.epic-input-size .ant-select:hover {\n border: none !important;\n box-shadow: none !important;\n}\n";
30
+ var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.ep-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.ep-input-size .ant-select-selector {\n border: none !important;\n box-shadow: none !important;\n padding: 0 4px !important;\n}\n";
31
31
  styleInject(css_248z);
32
32
 
33
33
  declare function setupAntd(pluginManager?: PluginManager): void;
package/dist/index.mjs CHANGED
@@ -2969,7 +2969,7 @@ function styleInject(css, ref) {
2969
2969
  }
2970
2970
  }
2971
2971
 
2972
- var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.epic-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.epic-input-size .ant-select:hover {\n border: none !important;\n box-shadow: none !important;\n}\n";
2972
+ var css_248z = ".epic-designer-main .ant-input-number {\n width: 100%;\n}\n.epic-designer-main .ant-collapse-content > .ant-collapse-content-box {\n padding: 8px;\n}\n.epic-designer-main .ant-select {\n width: 100%;\n}\n.epic-designer-main .epic-upload-image .avatar-uploader > .ant-upload {\n width: 128px;\n height: 128px;\n}\n.ep-input-size.ant-input-affix-wrapper {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n}\n.ep-input-size .ant-select-selector {\n border: none !important;\n box-shadow: none !important;\n padding: 0 4px !important;\n}\n";
2973
2973
  styleInject(css_248z);
2974
2974
 
2975
2975
  function setupAntd(pluginManager$1 = pluginManager) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-designer/antd",
3
- "version": "1.1.4-beta.6",
3
+ "version": "1.1.5-beta.0",
4
4
  "description": "epic-designer base antd ui",
5
5
  "private": false,
6
6
  "author": "kchengz",
package/src/form/form.vue CHANGED
@@ -1,11 +1,11 @@
1
1
  <script lang="ts" setup>
2
- import type { PageManager } from '@epic-designer/manager';
3
2
  import type { ComponentSchema, FormDataModel } from '@epic-designer/types';
4
3
 
5
4
  import type { VNode } from 'vue';
6
5
 
7
- import { computed, inject, provide, ref } from 'vue';
6
+ import { computed, ref } from 'vue';
8
7
 
8
+ import { useForm } from '@epic-designer/hooks';
9
9
  import { Form } from 'ant-design-vue';
10
10
 
11
11
  interface FormInstance extends InstanceType<typeof Form> {
@@ -33,14 +33,10 @@ const props = withDefaults(
33
33
  },
34
34
  );
35
35
 
36
- const pageManager = inject<PageManager>('pageManager', {} as PageManager);
37
36
  const form = ref<FormInstance | null>(null);
38
- const forms = inject<{ [name: string]: any }>('forms', {});
39
- const formData = pageManager.setFormData(
40
- {},
41
- props.componentSchema?.props?.name,
37
+ const { formData, formInstances } = useForm(
38
+ props.componentSchema?.props?.name ?? 'default',
42
39
  );
43
- provide('formData', formData);
44
40
 
45
41
  /**
46
42
  * 获取表单数据
@@ -83,14 +79,18 @@ function resetData() {
83
79
  const mountedForm = (vNode: VNode) => {
84
80
  form.value = vNode.component?.exposed as FormInstance;
85
81
 
86
- if (props.componentSchema?.type === 'form' && forms.value && form.value) {
82
+ if (
83
+ props.componentSchema?.type === 'form' &&
84
+ formInstances.value &&
85
+ form.value
86
+ ) {
87
87
  const name =
88
88
  props.componentSchema?.props?.name ??
89
89
  props.componentSchema?.name ??
90
90
  ('default' as string);
91
91
 
92
92
  form.value.validate = validate;
93
- forms.value[name] = form.value;
93
+ formInstances.value[name] = form.value;
94
94
  form.value.getData = getData;
95
95
  form.value.setData = setData;
96
96
  form.value.resetData = resetData;
package/src/index.less CHANGED
@@ -19,15 +19,17 @@
19
19
  }
20
20
  }
21
21
 
22
- // 适配epic-input-size样式
23
- .epic-input-size {
22
+ // 适配ep-input-size样式
23
+ .ep-input-size {
24
24
  &.ant-input-affix-wrapper {
25
25
  padding-top: 0;
26
26
  padding-right: 0;
27
27
  padding-bottom: 0;
28
28
  }
29
- .ant-select:hover {
29
+
30
+ .ant-select-selector{
30
31
  border: none !important;
31
32
  box-shadow: none !important;
33
+ padding: 0 4px !important;
32
34
  }
33
35
  }
@@ -3,7 +3,7 @@ import type { ComponentSchema } from '@epic-designer/types';
3
3
 
4
4
  import { inject } from 'vue';
5
5
 
6
- import { EventBus } from '@epic-designer/hooks';
6
+ import { useEventBus } from '@epic-designer/hooks';
7
7
  import { Input } from 'ant-design-vue';
8
8
 
9
9
  const props = withDefaults(
@@ -23,7 +23,7 @@ const props = withDefaults(
23
23
  );
24
24
 
25
25
  const formData = inject<Record<string, any>>('formData', {});
26
- const eventBus = inject<EventBus | null>('eventBus', null);
26
+ const eventBus = useEventBus();
27
27
 
28
28
  const handleDataSelector = () => {
29
29
  eventBus?.emit('openDataSelector', props.componentSchema, props.options);
@@ -42,11 +42,13 @@ eventBus?.on('dataSelector:selected', (data) => {
42
42
  </script>
43
43
  <template>
44
44
  <Input>
45
- <template #suffix v-if="props.dataSelector">
45
+ <template #suffix>
46
46
  <span
47
+ v-if="props.dataSelector"
47
48
  @click="handleDataSelector"
48
49
  class="iconfont icon--epic icon--epic--search-rounded"
49
50
  ></span>
51
+ <slot name="suffix"></slot>
50
52
  </template>
51
53
  </Input>
52
54
  </template>
@@ -1,6 +1,6 @@
1
- <script lang="ts" setup>
2
- import { InputNumber } from 'ant-design-vue';
3
- </script>
4
- <template>
5
- <InputNumber />
6
- </template>
1
+ <script lang="ts" setup>
2
+ import { InputNumber } from 'ant-design-vue';
3
+ </script>
4
+ <template>
5
+ <InputNumber />
6
+ </template>
@@ -77,7 +77,7 @@ function handleClose() {
77
77
 
78
78
  <template>
79
79
  <Modal v-bind="getProps">
80
- <div class="epic-modal-main epic-scoped">
80
+ <div class="epic-modal-main ep-scoped">
81
81
  <slot>
82
82
  <slot name="edit-node">
83
83
  <slot
@@ -2,8 +2,9 @@ import type { ComponentSchema } from '@epic-designer/types';
2
2
 
3
3
  import type { PropType } from 'vue';
4
4
 
5
- import { defineComponent, h, inject, renderSlot } from 'vue';
5
+ import { defineComponent, h, renderSlot } from 'vue';
6
6
 
7
+ import { useNodeAttrs } from '@epic-designer/hooks';
7
8
  import { TabPane } from 'ant-design-vue';
8
9
 
9
10
  export default defineComponent({
@@ -15,7 +16,7 @@ export default defineComponent({
15
16
  },
16
17
  },
17
18
  setup(props, { slots }) {
18
- const nodeAttrs = inject('nodeAttrs', {});
19
+ const nodeAttrs = useNodeAttrs();
19
20
 
20
21
  return () => {
21
22
  const componentSchema = {