el-plus 0.0.30 → 0.0.33

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 (109) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.full.js +283 -49
  3. package/dist/index.full.min.js +1 -1
  4. package/dist/index.full.min.js.map +1 -1
  5. package/dist/index.full.min.mjs +1 -1
  6. package/dist/index.full.min.mjs.map +1 -1
  7. package/dist/index.full.mjs +280 -47
  8. package/es/components/attachment/index.d.ts +174 -0
  9. package/es/components/attachment/index.mjs +8 -0
  10. package/es/components/attachment/index.mjs.map +1 -0
  11. package/es/components/attachment/src/attachment.d.ts +23 -0
  12. package/es/components/attachment/src/attachment.mjs +31 -0
  13. package/es/components/attachment/src/attachment.mjs.map +1 -0
  14. package/es/components/attachment/src/attachment.vue.d.ts +71 -0
  15. package/es/components/attachment/src/attachment.vue.mjs +6 -0
  16. package/es/components/attachment/src/attachment.vue.mjs.map +1 -0
  17. package/es/components/attachment/src/attachment.vue2.mjs +65 -0
  18. package/es/components/attachment/src/attachment.vue2.mjs.map +1 -0
  19. package/es/components/attachment/src/use-attachment.d.ts +212 -0
  20. package/es/components/attachment/src/use-attachment.mjs +80 -0
  21. package/es/components/attachment/src/use-attachment.mjs.map +1 -0
  22. package/es/components/attachment/style/css.d.ts +2 -0
  23. package/es/components/attachment/style/css.mjs +5 -0
  24. package/es/components/attachment/style/css.mjs.map +1 -0
  25. package/es/components/attachment/style/index.d.ts +2 -0
  26. package/es/components/attachment/style/index.mjs +5 -0
  27. package/es/components/attachment/style/index.mjs.map +1 -0
  28. package/es/components/form/src/hooks/use-form-item.mjs +9 -12
  29. package/es/components/form/src/hooks/use-form-item.mjs.map +1 -1
  30. package/es/components/index.d.ts +1 -0
  31. package/es/components/index.mjs +2 -0
  32. package/es/components/index.mjs.map +1 -1
  33. package/es/components/search-list-page/index.d.ts +213 -192
  34. package/es/components/search-list-page/src/search-list-page.d.ts +1 -1
  35. package/es/components/search-list-page/src/search-list-page.vue.d.ts +54 -49
  36. package/es/components/search-list-page/src/use-search-list-page.d.ts +52 -47
  37. package/es/components/table/index.d.ts +51 -46
  38. package/es/components/table/src/table.d.ts +1 -1
  39. package/es/components/table/src/table.mjs.map +1 -1
  40. package/es/components/table/src/table.vue.d.ts +12 -11
  41. package/es/components/table/src/table.vue2.mjs +1 -2
  42. package/es/components/table/src/table.vue2.mjs.map +1 -1
  43. package/es/components/table/src/use-table.d.ts +1 -71
  44. package/es/components/table/src/use-table.mjs +7 -9
  45. package/es/components/table/src/use-table.mjs.map +1 -1
  46. package/es/components.mjs +3 -1
  47. package/es/components.mjs.map +1 -1
  48. package/es/index.mjs +2 -0
  49. package/es/index.mjs.map +1 -1
  50. package/es/package.json.mjs +1 -1
  51. package/es/utils/env.d.ts +2 -1
  52. package/es/utils/env.mjs +9 -1
  53. package/es/utils/env.mjs.map +1 -1
  54. package/es/utils/file.d.ts +2 -0
  55. package/es/utils/file.mjs +13 -3
  56. package/es/utils/file.mjs.map +1 -1
  57. package/es/utils/index.mjs +1 -1
  58. package/lib/components/attachment/index.d.ts +174 -0
  59. package/lib/components/attachment/index.js +14 -0
  60. package/lib/components/attachment/index.js.map +1 -0
  61. package/lib/components/attachment/src/attachment.d.ts +23 -0
  62. package/lib/components/attachment/src/attachment.js +33 -0
  63. package/lib/components/attachment/src/attachment.js.map +1 -0
  64. package/lib/components/attachment/src/attachment.vue.d.ts +71 -0
  65. package/lib/components/attachment/src/attachment.vue.js +10 -0
  66. package/lib/components/attachment/src/attachment.vue.js.map +1 -0
  67. package/lib/components/attachment/src/attachment.vue2.js +69 -0
  68. package/lib/components/attachment/src/attachment.vue2.js.map +1 -0
  69. package/lib/components/attachment/src/use-attachment.d.ts +212 -0
  70. package/lib/components/attachment/src/use-attachment.js +82 -0
  71. package/lib/components/attachment/src/use-attachment.js.map +1 -0
  72. package/lib/components/attachment/style/css.d.ts +2 -0
  73. package/lib/components/attachment/style/css.js +7 -0
  74. package/lib/components/attachment/style/css.js.map +1 -0
  75. package/lib/components/attachment/style/index.d.ts +2 -0
  76. package/lib/components/attachment/style/index.js +7 -0
  77. package/lib/components/attachment/style/index.js.map +1 -0
  78. package/lib/components/form/src/hooks/use-form-item.js +9 -12
  79. package/lib/components/form/src/hooks/use-form-item.js.map +1 -1
  80. package/lib/components/index.d.ts +1 -0
  81. package/lib/components/index.js +4 -0
  82. package/lib/components/index.js.map +1 -1
  83. package/lib/components/search-list-page/index.d.ts +213 -192
  84. package/lib/components/search-list-page/src/search-list-page.d.ts +1 -1
  85. package/lib/components/search-list-page/src/search-list-page.vue.d.ts +54 -49
  86. package/lib/components/search-list-page/src/use-search-list-page.d.ts +52 -47
  87. package/lib/components/table/index.d.ts +51 -46
  88. package/lib/components/table/src/table.d.ts +1 -1
  89. package/lib/components/table/src/table.js.map +1 -1
  90. package/lib/components/table/src/table.vue.d.ts +12 -11
  91. package/lib/components/table/src/table.vue2.js +1 -2
  92. package/lib/components/table/src/table.vue2.js.map +1 -1
  93. package/lib/components/table/src/use-table.d.ts +1 -71
  94. package/lib/components/table/src/use-table.js +7 -9
  95. package/lib/components/table/src/use-table.js.map +1 -1
  96. package/lib/components.js +3 -1
  97. package/lib/components.js.map +1 -1
  98. package/lib/index.js +10 -6
  99. package/lib/index.js.map +1 -1
  100. package/lib/package.json.js +1 -1
  101. package/lib/utils/env.d.ts +2 -1
  102. package/lib/utils/env.js +9 -0
  103. package/lib/utils/env.js.map +1 -1
  104. package/lib/utils/file.d.ts +2 -0
  105. package/lib/utils/file.js +13 -1
  106. package/lib/utils/file.js.map +1 -1
  107. package/lib/utils/index.js +1 -0
  108. package/lib/utils/index.js.map +1 -1
  109. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # el-plus
2
2
 
3
+ ## 0.0.33
4
+
5
+ ### Patch Changes
6
+
7
+ - 1
8
+
9
+ ## 0.0.32
10
+
11
+ ### Patch Changes
12
+
13
+ - 1
14
+
15
+ ## 0.0.31
16
+
17
+ ### Patch Changes
18
+
19
+ - 1
20
+
3
21
  ## 0.0.30
4
22
 
5
23
  ### Patch Changes
@@ -1,10 +1,10 @@
1
- /*! ElPlus v0.0.30 */
1
+ /*! ElPlus v0.0.33 */
2
2
 
3
3
  (function (global, factory) {
4
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus'), require('@vue/shared'), require('axios'), require('js-cookie'), require('defu'), require('qs'), require('element-plus/es/components/table/src/table/defaults'), require('@element-plus/icons-vue'), require('mitt'), require('lodash-unified'), require('@vueuse/core'), require('vue-router')) :
5
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'element-plus', '@vue/shared', 'axios', 'js-cookie', 'defu', 'qs', 'element-plus/es/components/table/src/table/defaults', '@element-plus/icons-vue', 'mitt', 'lodash-unified', '@vueuse/core', 'vue-router'], factory) :
6
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ElPlus = {}, global.Vue, global.ElementPlus, global.shared, global.axios, global.Cookies, global.defu, global.qs, global.elTableProps, global.iconsVue, global.mitt, global.lodashUnified, global.core, global.vueRouter));
7
- })(this, (function (exports, vue, elementPlus, shared, axios, Cookies, defu, qs, elTableProps, iconsVue, mitt, lodashUnified, core, vueRouter) { 'use strict';
4
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus'), require('@vue/shared'), require('axios'), require('js-cookie'), require('defu'), require('qs'), require('element-plus/es/components/table/src/table/defaults'), require('@element-plus/icons-vue'), require('mitt'), require('lodash-unified'), require('@vueuse/core'), require('vue-router'), require('js-base64')) :
5
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'element-plus', '@vue/shared', 'axios', 'js-cookie', 'defu', 'qs', 'element-plus/es/components/table/src/table/defaults', '@element-plus/icons-vue', 'mitt', 'lodash-unified', '@vueuse/core', 'vue-router', 'js-base64'], factory) :
6
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ElPlus = {}, global.Vue, global.ElementPlus, global.shared, global.axios, global.Cookies, global.defu, global.qs, global.elTableProps, global.iconsVue, global.mitt, global.lodashUnified, global.core, global.vueRouter, global.jsBase64));
7
+ })(this, (function (exports, vue, elementPlus, shared, axios, Cookies, defu, qs, elTableProps, iconsVue, mitt, lodashUnified, core, vueRouter, jsBase64) { 'use strict';
8
8
 
9
9
  function _interopNamespaceDefault(e) {
10
10
  var n = Object.create(null);
@@ -887,17 +887,10 @@
887
887
  const useFormItemSlots = (props) => {
888
888
  const attrs = vue.useAttrs();
889
889
  const {
890
- type,
891
- label,
892
890
  render,
893
- required,
894
891
  labelRender
895
892
  } = props;
896
893
  const prop = props.tableProp || props.prop;
897
- const {
898
- scopedSlots: renderScopedSlots,
899
- ...renderProps
900
- } = props.props || {};
901
894
  const events = {};
902
895
  for (const key in attrs) {
903
896
  if (key.startsWith("on")) {
@@ -912,11 +905,15 @@
912
905
  };
913
906
  const scopedSlots = {
914
907
  default: () => {
908
+ const {
909
+ scopedSlots: renderScopedSlots,
910
+ ...renderProps
911
+ } = props.props || {};
915
912
  let disabled = props.disabled;
916
913
  if (typeof props.disabled === "function") {
917
914
  disabled = props.disabled(formData);
918
915
  }
919
- return type ? vue.h(vue.resolveComponent(type), {
916
+ return props.type ? vue.h(vue.resolveComponent(props.type), {
920
917
  modelValue: formData[prop],
921
918
  "onUpdate:modelValue": (value) => {
922
919
  formData[prop] = value;
@@ -931,21 +928,21 @@
931
928
  return vue.createVNode(elementPlus.ElTooltip, {
932
929
  "placement": "top",
933
930
  "effect": "dark",
934
- "content": label,
931
+ "content": props.label,
935
932
  "disabled": !props.isShowLabel || isTipDisabled.value
936
933
  }, {
937
934
  default: () => [vue.createVNode("span", {
938
935
  "onMouseenter": checkOverflow,
939
936
  "style": "display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
940
- }, [!props.hideRequiredAsterisk && required ? vue.createVNode("span", {
937
+ }, [!props.hideRequiredAsterisk && props.required ? vue.createVNode("span", {
941
938
  "style": "color: var(--el-color-danger);"
942
- }, [vue.createTextVNode("*")]) : null, props.isShowLabel ? vue.createVNode("span", null, [label]) : ""])]
939
+ }, [vue.createTextVNode("*")]) : null, props.isShowLabel ? vue.createVNode("span", null, [props.label]) : ""])]
943
940
  });
944
941
  }
945
942
  };
946
943
  if (labelRender) {
947
944
  scopedSlots.label = () => labelRender({
948
- label
945
+ label: props.label
949
946
  });
950
947
  }
951
948
  if (render) {
@@ -1056,7 +1053,7 @@
1056
1053
  }
1057
1054
  });
1058
1055
 
1059
- var _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
1056
+ var _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
1060
1057
  ...{
1061
1058
  name: "EpForm",
1062
1059
  inheritAttrs: false
@@ -1154,7 +1151,7 @@
1154
1151
  }
1155
1152
  });
1156
1153
 
1157
- const EpForm = withInstall(_sfc_main$9);
1154
+ const EpForm = withInstall(_sfc_main$a);
1158
1155
 
1159
1156
  const { t: t$2 } = useLocale();
1160
1157
  const inputProps = {
@@ -1183,7 +1180,7 @@
1183
1180
  };
1184
1181
  const inputEmitsKeys = Object.keys(inputEmits);
1185
1182
 
1186
- var _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
1183
+ var _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
1187
1184
  ...{
1188
1185
  name: "EpInput",
1189
1186
  inheritAttrs: false
@@ -1317,7 +1314,7 @@
1317
1314
  }
1318
1315
  });
1319
1316
 
1320
- const EpInput = withInstall(_sfc_main$8);
1317
+ const EpInput = withInstall(_sfc_main$9);
1321
1318
 
1322
1319
  function _isSlot$1(s) {
1323
1320
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
@@ -1632,6 +1629,14 @@
1632
1629
  }
1633
1630
  return tag[0] ? tag[0].replace("-", "") : "production";
1634
1631
  };
1632
+ const getLocationEnv = () => {
1633
+ const urlParams = new URLSearchParams(window.location.search);
1634
+ const devProxy = urlParams.get("devProxy");
1635
+ if (devProxy) {
1636
+ return devProxy.split("-")[0].replace("/", "");
1637
+ }
1638
+ return "";
1639
+ };
1635
1640
 
1636
1641
  const { t: t$1 } = useLocale();
1637
1642
  const gotoTaskTrace = (workflowId) => {
@@ -1647,7 +1652,7 @@
1647
1652
  }
1648
1653
  };
1649
1654
 
1650
- var _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1655
+ var _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
1651
1656
  ...{
1652
1657
  name: "EpCustomColumn",
1653
1658
  inheritAttrs: false
@@ -1852,7 +1857,7 @@
1852
1857
  }
1853
1858
  });
1854
1859
 
1855
- const EpCustomColumn = withInstall(_sfc_main$7);
1860
+ const EpCustomColumn = withInstall(_sfc_main$8);
1856
1861
 
1857
1862
  const inheritTableProps = {
1858
1863
  ...elTableProps,
@@ -2137,6 +2142,7 @@
2137
2142
  const useTableColumn = (props, tableData, customColumns) => {
2138
2143
  const instance = vue.getCurrentInstance();
2139
2144
  const columnProps = (column) => {
2145
+ column.props = column.props || {};
2140
2146
  const attrs = {
2141
2147
  "show-overflow-tooltip": true,
2142
2148
  align: column.align || props.align,
@@ -2216,16 +2222,11 @@
2216
2222
  const columnList = vue.computed(() => {
2217
2223
  const columns = props.customColumnModule ? customColumns.value : props.columns;
2218
2224
  return columns.map((column) => {
2219
- let newColumn = {
2220
- ...column
2221
- };
2225
+ const newColumn = columnProps(column);
2222
2226
  if (props.formatColumns.length) {
2223
2227
  const formatColumn = props.formatColumns.find((item) => item.prop === column.prop);
2224
2228
  if (formatColumn) {
2225
- newColumn = {
2226
- ...newColumn,
2227
- ...formatColumn
2228
- };
2229
+ lodashUnified.merge(newColumn, formatColumn);
2229
2230
  }
2230
2231
  }
2231
2232
  return newColumn;
@@ -2239,7 +2240,6 @@
2239
2240
  });
2240
2241
  });
2241
2242
  return {
2242
- columnProps,
2243
2243
  columnList
2244
2244
  };
2245
2245
  };
@@ -2269,6 +2269,9 @@
2269
2269
  const disabledOption = item.props.disabledOption;
2270
2270
  item.props.disabledOption = (...args) => disabledOption(...args, scope);
2271
2271
  }
2272
+ if ("desc" in item.props && typeof item.props.desc === "function") {
2273
+ item.props.desc = item.props.desc(scope);
2274
+ }
2272
2275
  }
2273
2276
  if (item.type === "EpButtons" && item.props) {
2274
2277
  item.props.list.forEach((btnItem) => {
@@ -2314,7 +2317,7 @@
2314
2317
  };
2315
2318
  };
2316
2319
 
2317
- var _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
2320
+ var _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
2318
2321
  ...{
2319
2322
  name: "EpTable",
2320
2323
  inheritAttrs: false
@@ -2359,7 +2362,6 @@
2359
2362
  customColumns
2360
2363
  } = useTable$1(props);
2361
2364
  const {
2362
- columnProps,
2363
2365
  columnList
2364
2366
  } = useTableColumn(props, data, customColumns);
2365
2367
  const {
@@ -2461,7 +2463,7 @@
2461
2463
  key: index
2462
2464
  }, {
2463
2465
  ref_for: true
2464
- }, vue.unref(columnProps)(item)), {
2466
+ }, item), {
2465
2467
  default: vue.withCtx((scope) => [item.type || item.render ? (vue.openBlock(), vue.createBlock(vue.unref(EpFormItem), vue.mergeProps({
2466
2468
  key: 0,
2467
2469
  "form-data": scope.row,
@@ -2500,7 +2502,7 @@
2500
2502
  }
2501
2503
  });
2502
2504
 
2503
- const EpTable = withInstall(_sfc_main$6);
2505
+ const EpTable = withInstall(_sfc_main$7);
2504
2506
 
2505
2507
  const searchListPageProps = {
2506
2508
  ...apiProps,
@@ -2751,7 +2753,7 @@
2751
2753
  };
2752
2754
  };
2753
2755
 
2754
- var _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2756
+ var _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
2755
2757
  ...{ name: "EpSearchListPage" },
2756
2758
  __name: "search-list-page",
2757
2759
  props: searchListPageProps,
@@ -2804,7 +2806,7 @@
2804
2806
  }
2805
2807
  });
2806
2808
 
2807
- const EpSearchListPage = withInstall(_sfc_main$5);
2809
+ const EpSearchListPage = withInstall(_sfc_main$6);
2808
2810
 
2809
2811
  const inheritSelectProps = {
2810
2812
  ...elementPlus.selectProps,
@@ -2930,7 +2932,7 @@
2930
2932
  };
2931
2933
  }
2932
2934
 
2933
- var _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
2935
+ var _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2934
2936
  ...{
2935
2937
  name: "EpSelect",
2936
2938
  inheritAttrs: false
@@ -3009,7 +3011,7 @@
3009
3011
  }
3010
3012
  });
3011
3013
 
3012
- const EpSelect = withInstall(_sfc_main$4);
3014
+ const EpSelect = withInstall(_sfc_main$5);
3013
3015
 
3014
3016
  const titleProps = {
3015
3017
  // 右侧按钮
@@ -3068,7 +3070,7 @@
3068
3070
  };
3069
3071
  };
3070
3072
 
3071
- var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
3073
+ var _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
3072
3074
  ...{
3073
3075
  name: "EpTitle",
3074
3076
  inheritAttrs: false
@@ -3132,7 +3134,7 @@
3132
3134
  }
3133
3135
  });
3134
3136
 
3135
- const EpTitle = withInstall(_sfc_main$3);
3137
+ const EpTitle = withInstall(_sfc_main$4);
3136
3138
 
3137
3139
  const headerProps = {
3138
3140
  // 页面模式
@@ -3313,7 +3315,7 @@
3313
3315
  };
3314
3316
  };
3315
3317
 
3316
- var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3318
+ var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
3317
3319
  ...{
3318
3320
  name: "EpHeader",
3319
3321
  inheritAttrs: false
@@ -3346,7 +3348,7 @@
3346
3348
  }
3347
3349
  });
3348
3350
 
3349
- const EpHeader = withInstall(_sfc_main$2);
3351
+ const EpHeader = withInstall(_sfc_main$3);
3350
3352
 
3351
3353
  const { t } = useLocale();
3352
3354
  const datePickerRangeProps = {
@@ -3416,7 +3418,7 @@
3416
3418
  };
3417
3419
  const datePickerRangeEmits = {};
3418
3420
 
3419
- var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3421
+ var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3420
3422
  ...{
3421
3423
  name: "EpDatePickerRange",
3422
3424
  inheritAttrs: false
@@ -3472,7 +3474,7 @@
3472
3474
  }
3473
3475
  });
3474
3476
 
3475
- const EpDatePickerRange = withInstall(_sfc_main$1);
3477
+ const EpDatePickerRange = withInstall(_sfc_main$2);
3476
3478
 
3477
3479
  const linkProps = {
3478
3480
  ...elementPlus.linkProps,
@@ -3489,7 +3491,7 @@
3489
3491
  }
3490
3492
  };
3491
3493
 
3492
- var _sfc_main = /* @__PURE__ */ vue.defineComponent({
3494
+ var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3493
3495
  ...{
3494
3496
  name: "EpLink",
3495
3497
  inheritAttrs: false
@@ -3534,7 +3536,236 @@
3534
3536
  }
3535
3537
  });
3536
3538
 
3537
- const EpLink = withInstall(_sfc_main);
3539
+ const EpLink = withInstall(_sfc_main$1);
3540
+
3541
+ const attachmentProps = {
3542
+ // 格式化列
3543
+ formatColumns: {
3544
+ ...tableProps.formatColumns
3545
+ },
3546
+ // 页面模式
3547
+ mode: {
3548
+ ...headerProps.mode
3549
+ },
3550
+ // 展示模式
3551
+ openType: {
3552
+ type: String,
3553
+ default: "dialog"
3554
+ },
3555
+ // 是否需要类型
3556
+ isType: {
3557
+ type: Boolean,
3558
+ default: true
3559
+ },
3560
+ // 是否需要备注
3561
+ isNote: {
3562
+ type: Boolean,
3563
+ default: false
3564
+ }
3565
+ };
3566
+
3567
+ const getFullUrl = (filePath) => {
3568
+ return filePath.indexOf("hongxinshop.com") > -1 ? filePath : `${window.location.protocol}${getEnv() === "local" ? `//${getLocationEnv()}-hxjf.hongxinshop.com` : ""}/image/${filePath}`;
3569
+ };
3570
+ const downloadSrc = ({
3571
+ src,
3572
+ fileName,
3573
+ blob
3574
+ }) => {
3575
+ if (src) {
3576
+ fileName = fileName || src.split("/")[src.split("/").length - 1];
3577
+ const a = document.createElement("a");
3578
+ a.style.display = "none";
3579
+ document.body.appendChild(a);
3580
+ const event = new MouseEvent("click");
3581
+ a.download = fileName;
3582
+ a.href = blob ? src : getFullUrl(src);
3583
+ a.target = "_blank";
3584
+ a.dispatchEvent(event);
3585
+ document.body.removeChild(a);
3586
+ }
3587
+ };
3588
+ async function downloadFile({
3589
+ api = "",
3590
+ blob,
3591
+ data = {},
3592
+ src,
3593
+ fileName = "",
3594
+ config = {}
3595
+ }) {
3596
+ if (src) {
3597
+ downloadSrc({ src, fileName });
3598
+ return;
3599
+ }
3600
+ http.request(api, {
3601
+ method: config.method || "post",
3602
+ data,
3603
+ loading: true,
3604
+ responseType: blob ? "blob" : void 0,
3605
+ responseReturn: "raw",
3606
+ ...config
3607
+ }).then((res) => {
3608
+ const { headers } = res;
3609
+ if (!res.data.success) {
3610
+ return elementPlus.ElMessage.error(res.data.msg);
3611
+ }
3612
+ const data2 = res.data?.data || res.data?.data?.url || "";
3613
+ const lowerHeaders = {};
3614
+ for (const key in headers) {
3615
+ lowerHeaders[key.toLowerCase()] = headers[key];
3616
+ }
3617
+ let src2 = "";
3618
+ if (blob) {
3619
+ const contentDisposition = lowerHeaders["content-disposition"] || "";
3620
+ fileName = fileName || decodeURIComponent(contentDisposition.split("filename=")[1]);
3621
+ const blob2 = new Blob([data2], {
3622
+ type: headers["content-type"]
3623
+ });
3624
+ src2 = window.URL.createObjectURL(blob2);
3625
+ setTimeout(() => window.URL.revokeObjectURL(src2), 100);
3626
+ } else {
3627
+ src2 = data2;
3628
+ }
3629
+ downloadSrc({ src: src2, fileName, blob });
3630
+ });
3631
+ }
3632
+ const previewFile = (url) => {
3633
+ url = getFullUrl(url);
3634
+ const origin = getFullUrl("").replace("/image/", "");
3635
+ const previewUrl = `${origin}/kfv/onlinePreview?url=${jsBase64.encode(url)}`;
3636
+ window.open(previewUrl, "_blank");
3637
+ };
3638
+
3639
+ const useAttachment = (props, { data }) => {
3640
+ const { mode: defaultMode } = useNavigation();
3641
+ const mode = vue.computed(() => {
3642
+ return props.mode || defaultMode.value;
3643
+ });
3644
+ const columns = vue.ref([
3645
+ {
3646
+ type: "EpButtons",
3647
+ label: "\u64CD\u4F5C",
3648
+ width: "120px",
3649
+ props: {
3650
+ type: "text",
3651
+ list: [
3652
+ {
3653
+ name: "\u4E0B\u8F7D",
3654
+ onClick({ row }) {
3655
+ downloadFile({
3656
+ src: row.filePath,
3657
+ fileName: row.originalFilename || row.originalFileName
3658
+ });
3659
+ }
3660
+ },
3661
+ {
3662
+ name: "\u5220\u9664",
3663
+ disabled: () => {
3664
+ return mode.value === "browse";
3665
+ },
3666
+ onClick: ({ $index }) => {
3667
+ data.value.splice($index, 1);
3668
+ }
3669
+ }
3670
+ ]
3671
+ }
3672
+ },
3673
+ {
3674
+ label: "\u9644\u4EF6\u7C7B\u578B",
3675
+ prop: "type",
3676
+ type: "EpSelect",
3677
+ required: true,
3678
+ show: () => props.isType,
3679
+ props: {
3680
+ desc: ({ row }) => {
3681
+ return row.typeDesc;
3682
+ }
3683
+ }
3684
+ },
3685
+ {
3686
+ label: "\u6587\u4EF6\u540D\u79F0",
3687
+ prop: "originalFilename",
3688
+ type: "EpLink",
3689
+ onClick({ row }) {
3690
+ previewFile(row.filePath);
3691
+ }
3692
+ },
3693
+ {
3694
+ label: "\u521B\u5EFA\u4EBA",
3695
+ prop: "createBy"
3696
+ },
3697
+ {
3698
+ label: "\u521B\u5EFA\u65F6\u95F4",
3699
+ prop: "createTime"
3700
+ },
3701
+ {
3702
+ label: "\u8BF4\u660E",
3703
+ prop: "note",
3704
+ type: "EpInput",
3705
+ show: () => props.isNote
3706
+ }
3707
+ ]);
3708
+ return {
3709
+ columns
3710
+ };
3711
+ };
3712
+
3713
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
3714
+ ...{
3715
+ name: "EpAttachment",
3716
+ inheritAttrs: false
3717
+ },
3718
+ __name: "attachment",
3719
+ props: /* @__PURE__ */ vue.mergeModels(attachmentProps, {
3720
+ "modelValue": {},
3721
+ "modelModifiers": {}
3722
+ }),
3723
+ emits: ["update:modelValue"],
3724
+ setup(__props) {
3725
+ const bem = createNameSpace("attachment");
3726
+ const props = __props;
3727
+ const modelValue = vue.useModel(__props, "modelValue");
3728
+ const AttachmentDialog = useDialog({
3729
+ class: bem.em("dialog", props.openType === "normal" ? props.openType : ""),
3730
+ width: 850,
3731
+ center: true,
3732
+ title: "\u9644\u4EF6\u7BA1\u7406",
3733
+ onConfirm: async (resolve) => {
3734
+ }
3735
+ });
3736
+ const { columns } = useAttachment(props, {
3737
+ data: modelValue
3738
+ });
3739
+ return (_ctx, _cache) => {
3740
+ const _component_el_button = vue.resolveComponent("el-button");
3741
+ return vue.openBlock(), vue.createBlock(vue.unref(AttachmentDialog), null, {
3742
+ default: vue.withCtx(() => [
3743
+ _ctx.openType === "dialog" ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3744
+ key: 0,
3745
+ type: "primary",
3746
+ size: "default"
3747
+ }, {
3748
+ default: vue.withCtx(() => [
3749
+ vue.createTextVNode("\u6DFB\u52A0\u9644\u4EF6")
3750
+ ]),
3751
+ _: 1
3752
+ })) : vue.createCommentVNode("", true),
3753
+ vue.createVNode(vue.unref(EpTable), vue.mergeProps({
3754
+ class: `${vue.unref(bem).b()} ${vue.unref(prepareClassNames)()}`,
3755
+ style: {
3756
+ ...vue.unref(prepareStyles)()
3757
+ },
3758
+ columns: vue.unref(columns),
3759
+ data: modelValue.value
3760
+ }, props), null, 16, ["class", "style", "columns", "data"])
3761
+ ]),
3762
+ _: 1
3763
+ });
3764
+ };
3765
+ }
3766
+ });
3767
+
3768
+ const EpAttachment = withInstall(_sfc_main);
3538
3769
 
3539
3770
  var components = [
3540
3771
  EpButtons,
@@ -3547,10 +3778,11 @@
3547
3778
  EpHeader,
3548
3779
  EpDatePickerRange,
3549
3780
  EpCustomColumn,
3550
- EpLink
3781
+ EpLink,
3782
+ EpAttachment
3551
3783
  ];
3552
3784
 
3553
- var version = "0.0.30";
3785
+ var version = "0.0.33";
3554
3786
 
3555
3787
  var globalProperties = {
3556
3788
  install(app) {
@@ -3634,6 +3866,7 @@
3634
3866
  version
3635
3867
  };
3636
3868
 
3869
+ exports.EpAttachment = EpAttachment;
3637
3870
  exports.EpButtons = EpButtons;
3638
3871
  exports.EpCustomColumn = EpCustomColumn;
3639
3872
  exports.EpDatePickerRange = EpDatePickerRange;
@@ -3646,6 +3879,7 @@
3646
3879
  exports.EpSelect = EpSelect;
3647
3880
  exports.EpTable = EpTable;
3648
3881
  exports.EpTitle = EpTitle;
3882
+ exports.attachmentProps = attachmentProps;
3649
3883
  exports.buttonsProps = buttonsProps;
3650
3884
  exports.customColumnEmits = customColumnEmits;
3651
3885
  exports.customColumnProps = customColumnProps;