@epic-designer/antd 1.1.5-beta.1 → 1.1.5

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.
@@ -74,10 +74,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
74
74
  const beforeUpload = () => {
75
75
  };
76
76
  const getUploadProps = vue.computed(() => {
77
- var _a;
77
+ var _a, _b;
78
78
  return {
79
79
  ...attrs,
80
- headers: (_a = epicDesigner.pluginManager.global.axiosConfig) == null ? void 0 : _a.headers,
80
+ action: (_a = epicDesigner.pluginManager.global.uploadFile) != null ? _a : attrs.action,
81
+ headers: (_b = epicDesigner.pluginManager.global.axiosConfig) == null ? void 0 : _b.headers,
81
82
  "onBefore-upload": beforeUpload,
82
83
  onChange: handleChange,
83
84
  onPreview: handlePreview,
@@ -72,10 +72,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
72
72
  const beforeUpload = () => {
73
73
  };
74
74
  const getUploadProps = computed(() => {
75
- var _a;
75
+ var _a, _b;
76
76
  return {
77
77
  ...attrs,
78
- headers: (_a = pluginManager.global.axiosConfig) == null ? void 0 : _a.headers,
78
+ action: (_a = pluginManager.global.uploadFile) != null ? _a : attrs.action,
79
+ headers: (_b = pluginManager.global.axiosConfig) == null ? void 0 : _b.headers,
79
80
  "onBefore-upload": beforeUpload,
80
81
  onChange: handleChange,
81
82
  onPreview: handlePreview,
@@ -80,11 +80,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
80
80
  const beforeUpload = () => {
81
81
  };
82
82
  const getUploadProps = vue.computed(() => {
83
- var _a;
83
+ var _a, _b;
84
84
  return {
85
85
  ...attrs,
86
86
  accept: "image/gif,image/jpeg,image/jpg,image/png,image/svg",
87
- headers: (_a = epicDesigner.pluginManager.global.axiosConfig) == null ? void 0 : _a.headers,
87
+ action: (_a = epicDesigner.pluginManager.global.uploadImage) != null ? _a : attrs.action,
88
+ headers: (_b = epicDesigner.pluginManager.global.axiosConfig) == null ? void 0 : _b.headers,
88
89
  "onBefore-upload": beforeUpload,
89
90
  onChange: handleChange,
90
91
  onPreview: handlePreview,
@@ -78,11 +78,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
78
78
  const beforeUpload = () => {
79
79
  };
80
80
  const getUploadProps = computed(() => {
81
- var _a;
81
+ var _a, _b;
82
82
  return {
83
83
  ...attrs,
84
84
  accept: "image/gif,image/jpeg,image/jpg,image/png,image/svg",
85
- headers: (_a = pluginManager.global.axiosConfig) == null ? void 0 : _a.headers,
85
+ action: (_a = pluginManager.global.uploadImage) != null ? _a : attrs.action,
86
+ headers: (_b = pluginManager.global.axiosConfig) == null ? void 0 : _b.headers,
86
87
  "onBefore-upload": beforeUpload,
87
88
  onChange: handleChange,
88
89
  onPreview: handlePreview,
package/dist/index.cjs CHANGED
@@ -2974,7 +2974,7 @@ function styleInject(css, ref) {
2974
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
- function setupAntd(pluginManager = epicDesigner.pluginManager) {
2977
+ function setupAntd(pluginManager = epicDesigner.pluginManager, config = {}) {
2978
2978
  var _a;
2979
2979
  const versionArray = antDesignVue.version.split(".");
2980
2980
  const firstNumber = Number.parseInt(versionArray[0]);
@@ -3034,9 +3034,21 @@ function setupAntd(pluginManager = epicDesigner.pluginManager) {
3034
3034
  Tabs,
3035
3035
  TabsPane
3036
3036
  ];
3037
+ const { uploadFile, uploadImage } = config;
3038
+ if (uploadImage) UploadImage.defaultSchema.props.action = uploadImage;
3039
+ if (uploadFile) UploadFile.defaultSchema.props.action = uploadFile;
3037
3040
  vue.watchEffect(() => {
3038
- UploadImage.defaultSchema.props.action = pluginManager.global.uploadImage;
3039
- UploadFile.defaultSchema.props.action = pluginManager.global.uploadFile;
3041
+ var _a2, _b;
3042
+ if (pluginManager.global.uploadImage) {
3043
+ UploadImage.config.attribute = (_a2 = UploadImage.config.attribute) == null ? void 0 : _a2.filter(
3044
+ (item) => item.field !== "props.action"
3045
+ );
3046
+ }
3047
+ if (pluginManager.global.uploadFile) {
3048
+ UploadFile.config.attribute = (_b = UploadFile.config.attribute) == null ? void 0 : _b.filter(
3049
+ (item) => item.field !== "props.action"
3050
+ );
3051
+ }
3040
3052
  });
3041
3053
  componentArray.forEach((item) => {
3042
3054
  pluginManager.component.register(item);
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { PluginManager } from 'epic-designer';
1
+ import { PluginManager, SetupConfig } from 'epic-designer';
2
2
 
3
3
  function styleInject(css, ref) {
4
4
  if ( ref === void 0 ) ref = {};
@@ -30,6 +30,6 @@ function styleInject(css, ref) {
30
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
- declare function setupAntd(pluginManager?: PluginManager): void;
33
+ declare function setupAntd(pluginManager?: PluginManager, config?: SetupConfig): void;
34
34
 
35
35
  export { setupAntd };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { PluginManager } from 'epic-designer';
1
+ import { PluginManager, SetupConfig } from 'epic-designer';
2
2
 
3
3
  function styleInject(css, ref) {
4
4
  if ( ref === void 0 ) ref = {};
@@ -30,6 +30,6 @@ function styleInject(css, ref) {
30
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
- declare function setupAntd(pluginManager?: PluginManager): void;
33
+ declare function setupAntd(pluginManager?: PluginManager, config?: SetupConfig): void;
34
34
 
35
35
  export { setupAntd };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PluginManager } from 'epic-designer';
1
+ import { PluginManager, SetupConfig } from 'epic-designer';
2
2
 
3
3
  function styleInject(css, ref) {
4
4
  if ( ref === void 0 ) ref = {};
@@ -30,6 +30,6 @@ function styleInject(css, ref) {
30
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
- declare function setupAntd(pluginManager?: PluginManager): void;
33
+ declare function setupAntd(pluginManager?: PluginManager, config?: SetupConfig): void;
34
34
 
35
35
  export { setupAntd };
package/dist/index.mjs CHANGED
@@ -2972,7 +2972,7 @@ function styleInject(css, ref) {
2972
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
- function setupAntd(pluginManager$1 = pluginManager) {
2975
+ function setupAntd(pluginManager$1 = pluginManager, config = {}) {
2976
2976
  var _a;
2977
2977
  const versionArray = version.split(".");
2978
2978
  const firstNumber = Number.parseInt(versionArray[0]);
@@ -3032,9 +3032,21 @@ function setupAntd(pluginManager$1 = pluginManager) {
3032
3032
  Tabs,
3033
3033
  TabsPane
3034
3034
  ];
3035
+ const { uploadFile, uploadImage } = config;
3036
+ if (uploadImage) UploadImage.defaultSchema.props.action = uploadImage;
3037
+ if (uploadFile) UploadFile.defaultSchema.props.action = uploadFile;
3035
3038
  watchEffect(() => {
3036
- UploadImage.defaultSchema.props.action = pluginManager$1.global.uploadImage;
3037
- UploadFile.defaultSchema.props.action = pluginManager$1.global.uploadFile;
3039
+ var _a2, _b;
3040
+ if (pluginManager$1.global.uploadImage) {
3041
+ UploadImage.config.attribute = (_a2 = UploadImage.config.attribute) == null ? void 0 : _a2.filter(
3042
+ (item) => item.field !== "props.action"
3043
+ );
3044
+ }
3045
+ if (pluginManager$1.global.uploadFile) {
3046
+ UploadFile.config.attribute = (_b = UploadFile.config.attribute) == null ? void 0 : _b.filter(
3047
+ (item) => item.field !== "props.action"
3048
+ );
3049
+ }
3038
3050
  });
3039
3051
  componentArray.forEach((item) => {
3040
3052
  pluginManager$1.component.register(item);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-designer/antd",
3
- "version": "1.1.5-beta.1",
3
+ "version": "1.1.5",
4
4
  "description": "epic-designer base antd ui",
5
5
  "private": false,
6
6
  "author": "kchengz",
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { PluginManager } from '@epic-designer/manager';
2
+ import type { SetupConfig } from '@epic-designer/types';
2
3
 
3
4
  import { watchEffect } from 'vue';
4
5
 
@@ -33,7 +34,10 @@ import UploadImage from './upload-image';
33
34
  // 引入样式
34
35
  import './index.less';
35
36
 
36
- export function setupAntd(pluginManager: PluginManager = pManager): void {
37
+ export function setupAntd(
38
+ pluginManager: PluginManager = pManager,
39
+ config: SetupConfig = {},
40
+ ): void {
37
41
  // 版本兼容处理 start
38
42
  const versionArray = version.split('.');
39
43
  // 获取版本号第一个数字
@@ -107,10 +111,26 @@ export function setupAntd(pluginManager: PluginManager = pManager): void {
107
111
  TabsPane,
108
112
  ];
109
113
 
110
- // 更新默认上传地址
114
+ const { uploadFile, uploadImage } = config;
115
+ // 若配置了图片上传地址,则覆盖上传组件的默认接口地址
116
+ if (uploadImage) UploadImage.defaultSchema.props.action = uploadImage;
117
+ // 若配置了文件上传地址,则覆盖上传组件的默认接口地址
118
+ if (uploadFile) UploadFile.defaultSchema.props.action = uploadFile;
119
+
120
+ // 更新默认上传地址相关配置
111
121
  watchEffect(() => {
112
- UploadImage.defaultSchema.props.action = pluginManager.global.uploadImage;
113
- UploadFile.defaultSchema.props.action = pluginManager.global.uploadFile;
122
+ // 当全局配置图片上传地址时,过滤该属性配置,默认使用全局配置
123
+ if (pluginManager.global.uploadImage) {
124
+ UploadImage.config.attribute = UploadImage.config.attribute?.filter(
125
+ (item) => item.field !== 'props.action',
126
+ );
127
+ }
128
+ // 当全局配置文件上传地址时,过滤该属性配置,默认使用全局配置
129
+ if (pluginManager.global.uploadFile) {
130
+ UploadFile.config.attribute = UploadFile.config.attribute?.filter(
131
+ (item) => item.field !== 'props.action',
132
+ );
133
+ }
114
134
  });
115
135
 
116
136
  componentArray.forEach((item) => {
@@ -109,6 +109,7 @@ const beforeUpload = (): void => {
109
109
 
110
110
  const getUploadProps = computed<UploadProps>(() => ({
111
111
  ...attrs,
112
+ action: pluginManager.global.uploadFile ?? attrs.action,
112
113
  headers: pluginManager.global.axiosConfig?.headers,
113
114
  'onBefore-upload': beforeUpload,
114
115
  onChange: handleChange,
@@ -116,6 +116,7 @@ const beforeUpload = (): void => {
116
116
  const getUploadProps = computed<UploadProps>(() => ({
117
117
  ...attrs,
118
118
  accept: 'image/gif,image/jpeg,image/jpg,image/png,image/svg',
119
+ action: pluginManager.global.uploadImage ?? attrs.action,
119
120
  headers: pluginManager.global.axiosConfig?.headers,
120
121
  'onBefore-upload': beforeUpload,
121
122
  onChange: handleChange,