el-plus 0.0.18 → 0.0.20

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 (169) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.css +1 -1
  3. package/dist/index.full.js +327 -200
  4. package/dist/index.full.min.js +1 -1
  5. package/dist/index.full.min.js.map +1 -1
  6. package/dist/index.full.min.mjs +1 -1
  7. package/dist/index.full.min.mjs.map +1 -1
  8. package/dist/index.full.mjs +326 -200
  9. package/es/components/date-picker-range/index.d.ts +3 -3
  10. package/es/components/date-picker-range/src/date-picker-range.vue.d.ts +1 -1
  11. package/es/components/form/src/form-item-vue.d.ts +5 -2
  12. package/es/components/form/src/form-item.d.ts +2 -1
  13. package/es/components/form/src/form-item.mjs +2 -2
  14. package/es/components/form/src/form-item.mjs.map +1 -1
  15. package/es/components/form/src/hooks/use-form-item.mjs +3 -1
  16. package/es/components/form/src/hooks/use-form-item.mjs.map +1 -1
  17. package/es/components/header/index.d.ts +6 -6
  18. package/es/components/header/src/header.d.ts +1 -1
  19. package/es/components/header/src/header.mjs.map +1 -1
  20. package/es/components/header/src/header.vue.d.ts +3 -3
  21. package/es/components/header/src/use-header.mjs +4 -7
  22. package/es/components/header/src/use-header.mjs.map +1 -1
  23. package/es/components/index.d.ts +1 -0
  24. package/es/components/index.mjs +2 -0
  25. package/es/components/index.mjs.map +1 -1
  26. package/es/components/input/style/css.d.ts +1 -1
  27. package/es/components/input/style/css.mjs +1 -1
  28. package/es/components/input/style/index.d.ts +1 -1
  29. package/es/components/input/style/index.mjs +1 -1
  30. package/es/components/link/index.d.ts +118 -0
  31. package/es/components/link/index.mjs +8 -0
  32. package/es/components/link/index.mjs.map +1 -0
  33. package/es/components/link/src/link.d.ts +30 -0
  34. package/es/components/link/src/link.mjs +19 -0
  35. package/es/components/link/src/link.mjs.map +1 -0
  36. package/es/components/link/src/link.vue.d.ts +73 -0
  37. package/es/components/link/src/link.vue.mjs +6 -0
  38. package/es/components/link/src/link.vue.mjs.map +1 -0
  39. package/es/components/link/src/link.vue2.mjs +52 -0
  40. package/es/components/link/src/link.vue2.mjs.map +1 -0
  41. package/es/components/link/style/css.d.ts +2 -0
  42. package/es/components/link/style/css.mjs +5 -0
  43. package/es/components/link/style/css.mjs.map +1 -0
  44. package/es/components/link/style/index.d.ts +2 -0
  45. package/es/components/link/style/index.mjs +5 -0
  46. package/es/components/link/style/index.mjs.map +1 -0
  47. package/es/components/search-list-page/index.d.ts +51 -39
  48. package/es/components/search-list-page/src/search-list-page.d.ts +1 -4
  49. package/es/components/search-list-page/src/search-list-page.mjs +6 -9
  50. package/es/components/search-list-page/src/search-list-page.mjs.map +1 -1
  51. package/es/components/search-list-page/src/search-list-page.vue.d.ts +16 -17
  52. package/es/components/search-list-page/src/search-list-page.vue2.mjs +4 -3
  53. package/es/components/search-list-page/src/search-list-page.vue2.mjs.map +1 -1
  54. package/es/components/search-list-page/src/use-search-list-page.d.ts +15 -9
  55. package/es/components/search-list-page/src/use-search-list-page.mjs +22 -22
  56. package/es/components/search-list-page/src/use-search-list-page.mjs.map +1 -1
  57. package/es/components/table/index.d.ts +11 -6
  58. package/es/components/table/src/table.d.ts +2 -1
  59. package/es/components/table/src/table.mjs +2 -2
  60. package/es/components/table/src/table.mjs.map +1 -1
  61. package/es/components/table/src/table.vue.d.ts +4 -3
  62. package/es/components/table/src/table.vue2.mjs +4 -3
  63. package/es/components/table/src/table.vue2.mjs.map +1 -1
  64. package/es/components/table/src/use-table.d.ts +71 -12
  65. package/es/components/table/src/use-table.mjs +84 -27
  66. package/es/components/table/src/use-table.mjs.map +1 -1
  67. package/es/components.mjs +3 -1
  68. package/es/components.mjs.map +1 -1
  69. package/es/hooks/dialog/use-dialog.d.ts +2 -0
  70. package/es/hooks/dialog/use-dialog.mjs +4 -3
  71. package/es/hooks/dialog/use-dialog.mjs.map +1 -1
  72. package/es/hooks/use-navigation.d.ts +5 -0
  73. package/es/hooks/use-navigation.mjs +14 -2
  74. package/es/hooks/use-navigation.mjs.map +1 -1
  75. package/es/index.mjs +2 -0
  76. package/es/index.mjs.map +1 -1
  77. package/es/package.json.mjs +1 -1
  78. package/es/utils/file.d.ts +18 -0
  79. package/es/utils/file.mjs +133 -0
  80. package/es/utils/file.mjs.map +1 -0
  81. package/es/utils/http/core/types.d.ts +1 -0
  82. package/global.d.ts +6 -4
  83. package/lib/components/date-picker-range/index.d.ts +3 -3
  84. package/lib/components/date-picker-range/src/date-picker-range.vue.d.ts +1 -1
  85. package/lib/components/form/src/form-item-vue.d.ts +5 -2
  86. package/lib/components/form/src/form-item.d.ts +2 -1
  87. package/lib/components/form/src/form-item.js +2 -2
  88. package/lib/components/form/src/form-item.js.map +1 -1
  89. package/lib/components/form/src/hooks/use-form-item.js +3 -1
  90. package/lib/components/form/src/hooks/use-form-item.js.map +1 -1
  91. package/lib/components/header/index.d.ts +6 -6
  92. package/lib/components/header/src/header.d.ts +1 -1
  93. package/lib/components/header/src/header.js.map +1 -1
  94. package/lib/components/header/src/header.vue.d.ts +3 -3
  95. package/lib/components/header/src/use-header.js +3 -6
  96. package/lib/components/header/src/use-header.js.map +1 -1
  97. package/lib/components/index.d.ts +1 -0
  98. package/lib/components/index.js +4 -0
  99. package/lib/components/index.js.map +1 -1
  100. package/lib/components/input/style/css.d.ts +1 -1
  101. package/lib/components/input/style/css.js +1 -1
  102. package/lib/components/input/style/index.d.ts +1 -1
  103. package/lib/components/input/style/index.js +1 -1
  104. package/lib/components/link/index.d.ts +118 -0
  105. package/lib/components/link/index.js +14 -0
  106. package/lib/components/link/index.js.map +1 -0
  107. package/lib/components/link/src/link.d.ts +30 -0
  108. package/lib/components/link/src/link.js +21 -0
  109. package/lib/components/link/src/link.js.map +1 -0
  110. package/lib/components/link/src/link.vue.d.ts +73 -0
  111. package/lib/components/link/src/link.vue.js +10 -0
  112. package/lib/components/link/src/link.vue.js.map +1 -0
  113. package/lib/components/link/src/link.vue2.js +56 -0
  114. package/lib/components/link/src/link.vue2.js.map +1 -0
  115. package/lib/components/link/style/css.d.ts +2 -0
  116. package/lib/components/link/style/css.js +7 -0
  117. package/lib/components/link/style/css.js.map +1 -0
  118. package/lib/components/link/style/index.d.ts +2 -0
  119. package/lib/components/link/style/index.js +7 -0
  120. package/lib/components/link/style/index.js.map +1 -0
  121. package/lib/components/search-list-page/index.d.ts +51 -39
  122. package/lib/components/search-list-page/src/search-list-page.d.ts +1 -4
  123. package/lib/components/search-list-page/src/search-list-page.js +6 -9
  124. package/lib/components/search-list-page/src/search-list-page.js.map +1 -1
  125. package/lib/components/search-list-page/src/search-list-page.vue.d.ts +16 -17
  126. package/lib/components/search-list-page/src/search-list-page.vue2.js +3 -2
  127. package/lib/components/search-list-page/src/search-list-page.vue2.js.map +1 -1
  128. package/lib/components/search-list-page/src/use-search-list-page.d.ts +15 -9
  129. package/lib/components/search-list-page/src/use-search-list-page.js +22 -22
  130. package/lib/components/search-list-page/src/use-search-list-page.js.map +1 -1
  131. package/lib/components/table/index.d.ts +11 -6
  132. package/lib/components/table/src/table.d.ts +2 -1
  133. package/lib/components/table/src/table.js +2 -2
  134. package/lib/components/table/src/table.js.map +1 -1
  135. package/lib/components/table/src/table.vue.d.ts +4 -3
  136. package/lib/components/table/src/table.vue2.js +4 -3
  137. package/lib/components/table/src/table.vue2.js.map +1 -1
  138. package/lib/components/table/src/use-table.d.ts +71 -12
  139. package/lib/components/table/src/use-table.js +83 -26
  140. package/lib/components/table/src/use-table.js.map +1 -1
  141. package/lib/components.js +3 -1
  142. package/lib/components.js.map +1 -1
  143. package/lib/hooks/dialog/use-dialog.d.ts +2 -0
  144. package/lib/hooks/dialog/use-dialog.js +4 -3
  145. package/lib/hooks/dialog/use-dialog.js.map +1 -1
  146. package/lib/hooks/use-navigation.d.ts +5 -0
  147. package/lib/hooks/use-navigation.js +13 -1
  148. package/lib/hooks/use-navigation.js.map +1 -1
  149. package/lib/index.js +10 -6
  150. package/lib/index.js.map +1 -1
  151. package/lib/package.json.js +1 -1
  152. package/lib/utils/file.d.ts +18 -0
  153. package/lib/utils/file.js +136 -0
  154. package/lib/utils/file.js.map +1 -0
  155. package/lib/utils/http/core/types.d.ts +1 -0
  156. package/package.json +1 -1
  157. package/theme-chalk/base.css +1 -1
  158. package/theme-chalk/custom-column.css +1 -1
  159. package/theme-chalk/header.css +1 -1
  160. package/theme-chalk/index.css +1 -1
  161. package/theme-chalk/link.css +1 -0
  162. package/theme-chalk/src/base.scss +1 -0
  163. package/theme-chalk/src/common/common.scss +4 -0
  164. package/theme-chalk/src/custom-column.scss +6 -4
  165. package/theme-chalk/src/header.scss +1 -0
  166. package/theme-chalk/src/index.scss +2 -1
  167. package/theme-chalk/src/link.scss +6 -0
  168. package/theme-chalk/src/table.scss +20 -1
  169. package/theme-chalk/table.css +1 -1
@@ -1,10 +1,10 @@
1
- /*! ElPlus v0.0.18 */
1
+ /*! ElPlus v0.0.20 */
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('@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', '@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.core, global.vueRouter));
7
- })(this, (function (exports, vue, elementPlus, shared, axios, Cookies, defu, qs, elTableProps, iconsVue, mitt, 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')) :
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';
8
8
 
9
9
  function _interopNamespaceDefault(e) {
10
10
  var n = Object.create(null);
@@ -949,7 +949,9 @@
949
949
  });
950
950
  }
951
951
  if (render) {
952
- scopedSlots.default = render;
952
+ scopedSlots.default = () => {
953
+ return render(attrs["table-scope"]);
954
+ };
953
955
  }
954
956
  return {
955
957
  scopedSlots
@@ -993,8 +995,8 @@
993
995
 
994
996
  const expandFormItemProps = {
995
997
  type: {
996
- type: String
997
- // default: 'EpInput',
998
+ type: String,
999
+ default: "EpInput"
998
1000
  },
999
1001
  col: Number,
1000
1002
  render: Function,
@@ -1054,7 +1056,7 @@
1054
1056
  }
1055
1057
  });
1056
1058
 
1057
- var _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
1059
+ var _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
1058
1060
  ...{
1059
1061
  name: "EpForm",
1060
1062
  inheritAttrs: false
@@ -1152,7 +1154,7 @@
1152
1154
  }
1153
1155
  });
1154
1156
 
1155
- const EpForm = withInstall(_sfc_main$8);
1157
+ const EpForm = withInstall(_sfc_main$9);
1156
1158
 
1157
1159
  const { t: t$2 } = useLocale();
1158
1160
  const inputProps = {
@@ -1181,7 +1183,7 @@
1181
1183
  };
1182
1184
  const inputEmitsKeys = Object.keys(inputEmits);
1183
1185
 
1184
- var _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1186
+ var _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
1185
1187
  ...{
1186
1188
  name: "EpInput",
1187
1189
  inheritAttrs: false
@@ -1315,7 +1317,7 @@
1315
1317
  }
1316
1318
  });
1317
1319
 
1318
- const EpInput = withInstall(_sfc_main$7);
1320
+ const EpInput = withInstall(_sfc_main$8);
1319
1321
 
1320
1322
  function _isSlot$1(s) {
1321
1323
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
@@ -1408,6 +1410,7 @@
1408
1410
  } = useLocale();
1409
1411
  const {
1410
1412
  scopedSlots = {},
1413
+ instance,
1411
1414
  render,
1412
1415
  destroyOnClose,
1413
1416
  onConfirm,
@@ -1483,10 +1486,10 @@
1483
1486
  });
1484
1487
  if (render) {
1485
1488
  const container = document.createElement("div");
1486
- const instance = vue.getCurrentInstance();
1489
+ const newInstance = instance || vue.getCurrentInstance();
1487
1490
  const vnode = vue.h(Dialog);
1488
- if (instance && instance.appContext) {
1489
- vnode.appContext = instance.appContext;
1491
+ if (newInstance && newInstance.appContext) {
1492
+ vnode.appContext = newInstance.appContext;
1490
1493
  }
1491
1494
  vue.render(vnode, container);
1492
1495
  document.body.appendChild(container);
@@ -1636,7 +1639,7 @@
1636
1639
  }
1637
1640
  };
1638
1641
 
1639
- var _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
1642
+ var _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1640
1643
  ...{
1641
1644
  name: "EpCustomColumn",
1642
1645
  inheritAttrs: false
@@ -1841,7 +1844,7 @@
1841
1844
  }
1842
1845
  });
1843
1846
 
1844
- const EpCustomColumn = withInstall(_sfc_main$6);
1847
+ const EpCustomColumn = withInstall(_sfc_main$7);
1845
1848
 
1846
1849
  const inheritTableProps = {
1847
1850
  ...elTableProps,
@@ -1915,8 +1918,8 @@
1915
1918
  type: Array,
1916
1919
  default: () => []
1917
1920
  },
1918
- // 链接列
1919
- linkProps: {
1921
+ // 格式化列
1922
+ formatColumns: {
1920
1923
  type: Array,
1921
1924
  default: () => []
1922
1925
  },
@@ -1938,6 +1941,38 @@
1938
1941
  const tableEmits = [...elementPlus.ElTable.emits, "single-selection-change"];
1939
1942
  const tableEmitsKeys = tableEmits;
1940
1943
 
1944
+ const bem$1 = createNameSpace("form-dialog");
1945
+ const useFormDialog = (options = {}) => {
1946
+ const {
1947
+ dialogProps,
1948
+ title,
1949
+ ...formProps
1950
+ } = options;
1951
+ const formRef = vue.ref();
1952
+ let formData = formProps.formData || vue.reactive({});
1953
+ return useDialog({
1954
+ class: bem$1.b(),
1955
+ width: "80%",
1956
+ title,
1957
+ render: (props) => {
1958
+ return vue.createVNode(EpForm, vue.mergeProps({
1959
+ "ref": formRef,
1960
+ "modelValue": formData,
1961
+ "onUpdate:modelValue": ($event) => formData = $event
1962
+ }, {
1963
+ col: 1,
1964
+ "label-width": "auto",
1965
+ ...formProps
1966
+ }), null);
1967
+ },
1968
+ onConfirm: async (resolve) => {
1969
+ await formRef.value.validate();
1970
+ resolve(formData);
1971
+ },
1972
+ ...dialogProps
1973
+ });
1974
+ };
1975
+
1941
1976
  const useTable$1 = (props) => {
1942
1977
  const elFormRef = vue.useTemplateRef("elFormRef");
1943
1978
  const elTableRef = vue.useTemplateRef("elTableRef");
@@ -1973,7 +2008,12 @@
1973
2008
  }
1974
2009
  });
1975
2010
  const customColumns = vue.ref([]);
2011
+ const attrs = vue.useAttrs();
1976
2012
  const search = async (init = false, isPagination = false) => {
2013
+ const beforeSearch = attrs["before-search"];
2014
+ if (typeof beforeSearch === "function") {
2015
+ await beforeSearch?.();
2016
+ }
1977
2017
  if (init) {
1978
2018
  pagination.pageNo = 1;
1979
2019
  }
@@ -2007,6 +2047,7 @@
2007
2047
  if (props.customColumnModule) {
2008
2048
  loading.value = true;
2009
2049
  const columns = await bus.once("loadedCustomColumn");
2050
+ loading.value = false;
2010
2051
  customColumns.value = columns;
2011
2052
  bus.on("loadedCustomColumn", (columns2) => {
2012
2053
  customColumns.value = columns2;
@@ -2078,6 +2119,7 @@
2078
2119
  };
2079
2120
  };
2080
2121
  const useTableColumn = (props, tableData, customColumns) => {
2122
+ const instance = vue.getCurrentInstance();
2081
2123
  const columnProps = (column) => {
2082
2124
  const attrs = {
2083
2125
  "show-overflow-tooltip": true,
@@ -2090,16 +2132,50 @@
2090
2132
  if (typeof column.required === "function") {
2091
2133
  required = column.required();
2092
2134
  }
2093
- if (required) {
2094
- attrs["renderHeader"] = (data) => {
2095
- const {
2096
- column: column2
2097
- } = data;
2098
- return vue.createVNode("span", null, [vue.createVNode("span", {
2099
- "style": "color:var(--el-color-danger)"
2100
- }, [vue.createTextVNode(" * ")]), column2.label]);
2101
- };
2102
- }
2135
+ const editable = column.editable;
2136
+ attrs["renderHeader"] = () => {
2137
+ return vue.createVNode("span", null, [required ? vue.createVNode("span", {
2138
+ "style": "color:var(--el-color-danger)"
2139
+ }, [vue.createTextVNode(" * ")]) : "", vue.createVNode("span", {
2140
+ "class": {
2141
+ "is-edit": editable
2142
+ },
2143
+ "onClick": editable ? async () => {
2144
+ const cloneColumn = {
2145
+ ...column
2146
+ };
2147
+ delete cloneColumn.editable;
2148
+ const rawRender = cloneColumn.render;
2149
+ const formData = vue.reactive({});
2150
+ if (rawRender) {
2151
+ cloneColumn.render = () => {
2152
+ return rawRender({
2153
+ row: formData
2154
+ });
2155
+ };
2156
+ }
2157
+ const formDialog = useFormDialog({
2158
+ title: cloneColumn.label,
2159
+ dialogProps: {
2160
+ destroyOnClose: true,
2161
+ instance
2162
+ },
2163
+ formItemList: [cloneColumn],
2164
+ formData
2165
+ // formData: reactive({}),
2166
+ });
2167
+ const data = await formDialog.open();
2168
+ (tableData.value || []).forEach((item) => {
2169
+ item[column.prop] = data[column.prop];
2170
+ });
2171
+ if (typeof editable === "function") {
2172
+ editable(vue.toRaw(data));
2173
+ }
2174
+ } : void 0
2175
+ }, [column.label, editable ? vue.createVNode(elementPlus.ElIcon, null, {
2176
+ default: () => [vue.createVNode(iconsVue.EditPen, null, null)]
2177
+ }) : ""])]);
2178
+ };
2103
2179
  }
2104
2180
  if (column.filter) {
2105
2181
  const arr = tableData.value.map((item) => item[column.prop]);
@@ -2113,29 +2189,31 @@
2113
2189
  return row[column.prop] === value;
2114
2190
  };
2115
2191
  }
2192
+ if (column.type === "EpLink") {
2193
+ attrs.className = "table-column-link";
2194
+ }
2116
2195
  return {
2117
2196
  ...attrs,
2118
2197
  ...prepareProps(column)
2119
2198
  };
2120
2199
  };
2121
2200
  const columnList = vue.computed(() => {
2122
- let columns = props.columns;
2123
- if (props.customColumnModule) {
2124
- columns = customColumns.value;
2125
- }
2126
- return columns.filter((column) => {
2127
- if (props.linkProps.length) {
2128
- const linkColumn = props.linkProps.find((item) => item.prop === column.prop);
2129
- if (linkColumn) {
2130
- column.type = "EpButtons";
2131
- column.className = "table-column-link";
2132
- column.props = {
2133
- list: [linkColumn],
2134
- type: "text",
2135
- ...column.props
2201
+ const columns = props.customColumnModule ? customColumns.value : props.columns;
2202
+ return columns.map((column) => {
2203
+ let newColumn = {
2204
+ ...column
2205
+ };
2206
+ if (props.formatColumns.length) {
2207
+ const formatColumn = props.formatColumns.find((item) => item.prop === column.prop);
2208
+ if (formatColumn) {
2209
+ newColumn = {
2210
+ ...newColumn,
2211
+ ...formatColumn
2136
2212
  };
2137
2213
  }
2138
2214
  }
2215
+ return newColumn;
2216
+ }).filter((column) => {
2139
2217
  if ("show" in column) {
2140
2218
  return typeof column.show === "function" ? column.show(column) : column.show;
2141
2219
  } else if ("hide" in column) {
@@ -2150,7 +2228,8 @@
2150
2228
  };
2151
2229
  };
2152
2230
  const useTableFormItem = (props) => {
2153
- const formItemProps = (scope, item) => {
2231
+ const formItemProps = (scope, rawItem) => {
2232
+ const item = lodashUnified.cloneDeep(rawItem);
2154
2233
  let required = item.required;
2155
2234
  if (typeof required === "function") {
2156
2235
  required = required();
@@ -2185,10 +2264,19 @@
2185
2264
  }
2186
2265
  });
2187
2266
  }
2267
+ if (item.type === "EpLink") {
2268
+ (item.props ? item.props : item.props = {}).content = item.props.content || scope.row[item.prop];
2269
+ }
2188
2270
  for (const key in item) {
2189
2271
  if (key.startsWith("on") && typeof item[key] === "function") {
2190
2272
  const fn = item[key];
2191
- item[key] = (...args) => fn(...args, scope);
2273
+ item[key] = (...args) => {
2274
+ let event;
2275
+ if (args[0] instanceof Event) {
2276
+ event = args.shift();
2277
+ }
2278
+ return fn(...args, scope, event);
2279
+ };
2192
2280
  }
2193
2281
  }
2194
2282
  return {
@@ -2210,7 +2298,7 @@
2210
2298
  };
2211
2299
  };
2212
2300
 
2213
- var _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2301
+ var _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
2214
2302
  ...{
2215
2303
  name: "EpTable",
2216
2304
  inheritAttrs: false
@@ -2358,12 +2446,13 @@
2358
2446
  }, {
2359
2447
  ref_for: true
2360
2448
  }, vue.unref(columnProps)(item)), {
2361
- default: vue.withCtx((scope) => [item.type ? (vue.openBlock(), vue.createBlock(vue.unref(EpFormItem), vue.mergeProps({
2449
+ default: vue.withCtx((scope) => [item.type || item.render ? (vue.openBlock(), vue.createBlock(vue.unref(EpFormItem), vue.mergeProps({
2362
2450
  key: 0,
2363
- "form-data": scope.row
2451
+ "form-data": scope.row,
2452
+ "table-scope": scope
2364
2453
  }, {
2365
2454
  ref_for: true
2366
- }, vue.unref(formItemProps)(scope, item)), null, 16, ["form-data"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
2455
+ }, vue.unref(formItemProps)(scope, item)), null, 16, ["form-data", "table-scope"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
2367
2456
  key: 1
2368
2457
  }, [vue.createTextVNode(vue.toDisplayString(scope.row[item.prop]), 1)], 64))]),
2369
2458
  _: 2
@@ -2395,7 +2484,7 @@
2395
2484
  }
2396
2485
  });
2397
2486
 
2398
- const EpTable = withInstall(_sfc_main$5);
2487
+ const EpTable = withInstall(_sfc_main$6);
2399
2488
 
2400
2489
  const searchListPageProps = {
2401
2490
  ...apiProps,
@@ -2429,9 +2518,9 @@
2429
2518
  actionButtons: {
2430
2519
  ...tableProps.actionButtons
2431
2520
  },
2432
- // 链接列
2433
- linkProps: {
2434
- ...tableProps.linkProps
2521
+ // 格式化列
2522
+ formatColumns: {
2523
+ ...tableProps.formatColumns
2435
2524
  },
2436
2525
  showSelectionCol: Boolean,
2437
2526
  showSingleSelectionCol: Boolean,
@@ -2441,12 +2530,9 @@
2441
2530
  },
2442
2531
  add: Function,
2443
2532
  // 新增
2444
- templateDownloadApi: String,
2445
- // 模板下载
2446
- importApi: String,
2447
- // 导入
2448
- exportApi: String,
2449
- // 导出
2533
+ // templateDownloadApi: String, // 模板下载
2534
+ // importApi: String, // 导入
2535
+ // exportApi: String, // 导出
2450
2536
  // 表格额外距离
2451
2537
  offsetTop: {
2452
2538
  type: Number,
@@ -2486,7 +2572,8 @@
2486
2572
  search,
2487
2573
  reset,
2488
2574
  tableRef,
2489
- formRef
2575
+ formRef,
2576
+ beforeSearch: validate
2490
2577
  };
2491
2578
  };
2492
2579
  const useTable = (props, config) => {
@@ -2503,7 +2590,7 @@
2503
2590
  showSelectionCol: props.showSelectionCol,
2504
2591
  showSingleSelectionCol: props.showSingleSelectionCol,
2505
2592
  actionButtons: props.actionButtons,
2506
- linkProps: props.linkProps,
2593
+ formatColumns: props.formatColumns,
2507
2594
  api: props.api,
2508
2595
  reqData: props.formData,
2509
2596
  customColumnModule: props.customColumnModule,
@@ -2576,25 +2663,25 @@
2576
2663
  onClick: () => {
2577
2664
  props.add?.();
2578
2665
  }
2579
- },
2580
- {
2581
- name: t("ep.searchListPage.templateDownload"),
2582
- prop: "templateDownload",
2583
- permission: props.name ? `${props.name}:TEMPLATEDOWNLOAD` : "",
2584
- show: !!props.templateDownloadApi
2585
- },
2586
- {
2587
- name: t("ep.searchListPage.import"),
2588
- prop: "import",
2589
- permission: props.name ? `${props.name}:IMPORT` : "",
2590
- show: !!props.importApi
2591
- },
2592
- {
2593
- name: t("ep.searchListPage.export"),
2594
- prop: "export",
2595
- permission: props.name ? `${props.name}:EXPORT` : "",
2596
- show: !!props.exportApi
2597
2666
  }
2667
+ // {
2668
+ // name: t('ep.searchListPage.templateDownload'),
2669
+ // prop: 'templateDownload',
2670
+ // permission: props.name ? `${props.name}:TEMPLATEDOWNLOAD` : '',
2671
+ // show: !!props.templateDownloadApi,
2672
+ // },
2673
+ // {
2674
+ // name: t('ep.searchListPage.import'),
2675
+ // prop: 'import',
2676
+ // permission: props.name ? `${props.name}:IMPORT` : '',
2677
+ // show: !!props.importApi,
2678
+ // },
2679
+ // {
2680
+ // name: t('ep.searchListPage.export'),
2681
+ // prop: 'export',
2682
+ // permission: props.name ? `${props.name}:EXPORT` : '',
2683
+ // show: !!props.exportApi,
2684
+ // },
2598
2685
  ];
2599
2686
  const list = mergeListByKey(defaultButtons, props.leftButtons);
2600
2687
  if (props.customColumnModule) {
@@ -2623,12 +2710,11 @@
2623
2710
  };
2624
2711
  });
2625
2712
  const search = async (isInitSearch = false) => {
2626
- await validate();
2627
2713
  tableRef.value.search(isInitSearch);
2628
2714
  };
2629
2715
  const reset = async () => {
2630
2716
  resetFields();
2631
- search();
2717
+ search(true);
2632
2718
  };
2633
2719
  const searchButtons = [
2634
2720
  {
@@ -2649,7 +2735,7 @@
2649
2735
  };
2650
2736
  };
2651
2737
 
2652
- var _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
2738
+ var _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2653
2739
  ...{ name: "EpSearchListPage" },
2654
2740
  __name: "search-list-page",
2655
2741
  props: searchListPageProps,
@@ -2664,7 +2750,8 @@
2664
2750
  reset,
2665
2751
  tableRef,
2666
2752
  formRef,
2667
- tableProps
2753
+ tableProps,
2754
+ beforeSearch
2668
2755
  } = useSearchListPage(props);
2669
2756
  __expose({
2670
2757
  search,
@@ -2695,13 +2782,13 @@
2695
2782
  ], 2)
2696
2783
  ]),
2697
2784
  vue.renderSlot(_ctx.$slots, "tableBefore"),
2698
- vue.createVNode(vue.unref(EpTable), vue.normalizeProps(vue.guardReactiveProps(vue.unref(tableProps))), null, 16)
2785
+ vue.createVNode(vue.unref(EpTable), vue.mergeProps(vue.unref(tableProps), { "before-search": vue.unref(beforeSearch) }), null, 16, ["before-search"])
2699
2786
  ], 6);
2700
2787
  };
2701
2788
  }
2702
2789
  });
2703
2790
 
2704
- const EpSearchListPage = withInstall(_sfc_main$4);
2791
+ const EpSearchListPage = withInstall(_sfc_main$5);
2705
2792
 
2706
2793
  const inheritSelectProps = {
2707
2794
  ...elementPlus.selectProps,
@@ -2827,7 +2914,7 @@
2827
2914
  };
2828
2915
  }
2829
2916
 
2830
- var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2917
+ var _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
2831
2918
  ...{
2832
2919
  name: "EpSelect",
2833
2920
  inheritAttrs: false
@@ -2906,7 +2993,7 @@
2906
2993
  }
2907
2994
  });
2908
2995
 
2909
- const EpSelect = withInstall(_sfc_main$3);
2996
+ const EpSelect = withInstall(_sfc_main$4);
2910
2997
 
2911
2998
  const titleProps = {
2912
2999
  // 右侧按钮
@@ -2962,7 +3049,7 @@
2962
3049
  };
2963
3050
  };
2964
3051
 
2965
- var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3052
+ var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2966
3053
  ...{
2967
3054
  name: "EpTitle",
2968
3055
  inheritAttrs: false
@@ -3025,7 +3112,7 @@
3025
3112
  }
3026
3113
  });
3027
3114
 
3028
- const EpTitle = withInstall(_sfc_main$2);
3115
+ const EpTitle = withInstall(_sfc_main$3);
3029
3116
 
3030
3117
  const headerProps = {
3031
3118
  // 页面模式
@@ -3052,6 +3139,81 @@
3052
3139
  };
3053
3140
  const headerEmits = {};
3054
3141
 
3142
+ const useNavigation = () => {
3143
+ const router = vueRouter.useRouter();
3144
+ const $goto = (r) => {
3145
+ const item = {
3146
+ id: Date.now(),
3147
+ name: "",
3148
+ url: ""
3149
+ };
3150
+ const openTab = window.parent.openMenuSelect;
3151
+ if (r.url) {
3152
+ item.url = r.url;
3153
+ item.name = r.name;
3154
+ if (openTab) {
3155
+ openTab(item);
3156
+ } else {
3157
+ window.open(item.url);
3158
+ }
3159
+ return;
3160
+ }
3161
+ const routes = router.getRoutes() || [];
3162
+ const projectRootPath = window.location.pathname;
3163
+ const findRoute = (routes2, distRoute) => {
3164
+ let queen = [...routes2];
3165
+ while (queen.length) {
3166
+ const first = queen.shift();
3167
+ if (first.children) {
3168
+ queen = queen.concat(first.children);
3169
+ }
3170
+ if (first.name == distRoute.name) {
3171
+ return first;
3172
+ }
3173
+ }
3174
+ };
3175
+ const route = findRoute(routes, r);
3176
+ if (route) {
3177
+ item.id = r.id || item.id;
3178
+ item.name = r.title || (window.$hxt ? window.$hxt(route.meta.title) : route.meta.title);
3179
+ item.url = `${projectRootPath}#${route.path}${qs__namespace.stringify(r.query, { encode: false })}`;
3180
+ if (openTab) {
3181
+ openTab(item);
3182
+ } else {
3183
+ router.push(r);
3184
+ }
3185
+ } else {
3186
+ console.error("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u7684\u8DEF\u7531");
3187
+ }
3188
+ };
3189
+ const $closeTag = () => {
3190
+ if (!window.parent.selectedRouterTags) {
3191
+ return;
3192
+ }
3193
+ const currentRouterTagIndex = window.parent.currentRouterTagIndex;
3194
+ const preIndex = window.parent.currentRouterTagIndex - 1;
3195
+ const currentTag = window.parent.selectedRouterTags[currentRouterTagIndex];
3196
+ const preTag = window.parent.selectedRouterTags[preIndex];
3197
+ window.parent?.closeTag?.(currentTag);
3198
+ window.parent?.openMenuSelect?.(preTag);
3199
+ };
3200
+ const mode = vue.computed(() => {
3201
+ const { query } = vueRouter.useRoute();
3202
+ return query.mode;
3203
+ });
3204
+ const isBrowse = vue.computed(() => mode.value === "browse");
3205
+ const isEdit = vue.computed(() => mode.value === "edit");
3206
+ const isAdd = vue.computed(() => mode.value === "add");
3207
+ return {
3208
+ $goto,
3209
+ $closeTag,
3210
+ mode,
3211
+ isBrowse,
3212
+ isEdit,
3213
+ isAdd
3214
+ };
3215
+ };
3216
+
3055
3217
  const useHeader = (props, emit) => {
3056
3218
  const router = vueRouter.useRouter();
3057
3219
  const isShowBack = vue.computed(() => {
@@ -3073,13 +3235,9 @@
3073
3235
  };
3074
3236
  const useButtons = (props, emit) => {
3075
3237
  const { t } = useLocale();
3238
+ const { mode: defaultMode } = useNavigation();
3076
3239
  const mode = vue.computed(() => {
3077
- const { query } = vueRouter.useRoute();
3078
- let mode2 = props.mode;
3079
- if (query.mode) {
3080
- mode2 = query.mode;
3081
- }
3082
- return mode2;
3240
+ return props.mode || defaultMode;
3083
3241
  });
3084
3242
  let defaultButtons = [
3085
3243
  {
@@ -3136,7 +3294,7 @@
3136
3294
  };
3137
3295
  };
3138
3296
 
3139
- var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3297
+ var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3140
3298
  ...{
3141
3299
  name: "EpHeader",
3142
3300
  inheritAttrs: false
@@ -3169,7 +3327,7 @@
3169
3327
  }
3170
3328
  });
3171
3329
 
3172
- const EpHeader = withInstall(_sfc_main$1);
3330
+ const EpHeader = withInstall(_sfc_main$2);
3173
3331
 
3174
3332
  const { t } = useLocale();
3175
3333
  const datePickerRangeProps = {
@@ -3239,7 +3397,7 @@
3239
3397
  };
3240
3398
  const datePickerRangeEmits = {};
3241
3399
 
3242
- var _sfc_main = /* @__PURE__ */ vue.defineComponent({
3400
+ var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3243
3401
  ...{
3244
3402
  name: "EpDatePickerRange",
3245
3403
  inheritAttrs: false
@@ -3295,7 +3453,69 @@
3295
3453
  }
3296
3454
  });
3297
3455
 
3298
- const EpDatePickerRange = withInstall(_sfc_main);
3456
+ const EpDatePickerRange = withInstall(_sfc_main$1);
3457
+
3458
+ const linkProps = {
3459
+ ...elementPlus.linkProps,
3460
+ content: {
3461
+ type: String
3462
+ },
3463
+ type: {
3464
+ ...elementPlus.linkProps.type,
3465
+ default: "primary"
3466
+ },
3467
+ underline: {
3468
+ ...elementPlus.linkProps.underline,
3469
+ default: "never"
3470
+ }
3471
+ };
3472
+
3473
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
3474
+ ...{
3475
+ name: "EpLink",
3476
+ inheritAttrs: false
3477
+ },
3478
+ __name: "link",
3479
+ props: linkProps,
3480
+ setup(__props) {
3481
+ const bem = createNameSpace("link");
3482
+ const props = __props;
3483
+ const attrs = vue.useAttrs();
3484
+ const slots = vue.computed(() => {
3485
+ return Object.keys(vue.useSlots());
3486
+ });
3487
+ return (_ctx, _cache) => {
3488
+ const _component_el_link = vue.resolveComponent("el-link");
3489
+ return vue.openBlock(), vue.createBlock(_component_el_link, vue.mergeProps({
3490
+ class: `${vue.unref(bem).b()} ${vue.unref(prepareClassNames)()}`,
3491
+ style: {
3492
+ ...vue.unref(prepareStyles)()
3493
+ }
3494
+ }, {
3495
+ ...props,
3496
+ ...vue.unref(attrs)
3497
+ }), vue.createSlots({
3498
+ default: vue.withCtx(() => [
3499
+ _ctx.content ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3500
+ vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
3501
+ ], 64)) : vue.createCommentVNode("", true)
3502
+ ]),
3503
+ _: 2
3504
+ }, [
3505
+ vue.renderList(slots.value, (name) => {
3506
+ return {
3507
+ name,
3508
+ fn: vue.withCtx((scope) => [
3509
+ vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(scope)))
3510
+ ])
3511
+ };
3512
+ })
3513
+ ]), 1040, ["class", "style"]);
3514
+ };
3515
+ }
3516
+ });
3517
+
3518
+ const EpLink = withInstall(_sfc_main);
3299
3519
 
3300
3520
  var components = [
3301
3521
  EpButtons,
@@ -3307,10 +3527,11 @@
3307
3527
  EpTitle,
3308
3528
  EpHeader,
3309
3529
  EpDatePickerRange,
3310
- EpCustomColumn
3530
+ EpCustomColumn,
3531
+ EpLink
3311
3532
  ];
3312
3533
 
3313
- var version = "0.0.18";
3534
+ var version = "0.0.20";
3314
3535
 
3315
3536
  var globalProperties = {
3316
3537
  install(app) {
@@ -3323,7 +3544,7 @@
3323
3544
  globalProperties: globalProperties
3324
3545
  });
3325
3546
 
3326
- const bem$1 = createNameSpace("choose-dialog");
3547
+ const bem = createNameSpace("choose-dialog");
3327
3548
  const useChooseDialog = (options = {}) => {
3328
3549
  const {
3329
3550
  t
@@ -3340,12 +3561,12 @@
3340
3561
  if (!showSingleSelectionCol) {
3341
3562
  scopedSlots.footerPrepend = () => {
3342
3563
  return vue.createVNode("span", {
3343
- "class": bem$1.e("selected-count")
3564
+ "class": bem.e("selected-count")
3344
3565
  }, [t("ep.chooseDialog.selected"), selections.length, t("ep.chooseDialog.unit")]);
3345
3566
  };
3346
3567
  }
3347
3568
  return useDialog({
3348
- class: bem$1.b(),
3569
+ class: bem.b(),
3349
3570
  width: "80%",
3350
3571
  showFooter: !showSingleSelectionCol,
3351
3572
  scopedSlots,
@@ -3382,102 +3603,6 @@
3382
3603
  });
3383
3604
  };
3384
3605
 
3385
- const bem = createNameSpace("form-dialog");
3386
- const useFormDialog = (options = {}) => {
3387
- const {
3388
- dialogProps,
3389
- title,
3390
- ...formProps
3391
- } = options;
3392
- const formRef = vue.ref();
3393
- let formData = formProps.formData || vue.reactive({});
3394
- return useDialog({
3395
- class: bem.b(),
3396
- width: "80%",
3397
- title,
3398
- render: (props) => {
3399
- return vue.createVNode(EpForm, vue.mergeProps({
3400
- "ref": formRef,
3401
- "modelValue": formData,
3402
- "onUpdate:modelValue": ($event) => formData = $event
3403
- }, {
3404
- col: 1,
3405
- "label-width": "auto",
3406
- ...formProps
3407
- }), null);
3408
- },
3409
- onConfirm: async (resolve) => {
3410
- await formRef.value.validate();
3411
- resolve(formData);
3412
- },
3413
- ...dialogProps
3414
- });
3415
- };
3416
-
3417
- const useNavigation = () => {
3418
- const router = vueRouter.useRouter();
3419
- const $goto = (r) => {
3420
- const item = {
3421
- id: Date.now(),
3422
- name: "",
3423
- url: ""
3424
- };
3425
- const openTab = window.parent.openMenuSelect;
3426
- if (r.url) {
3427
- item.url = r.url;
3428
- item.name = r.name;
3429
- if (openTab) {
3430
- openTab(item);
3431
- } else {
3432
- window.open(item.url);
3433
- }
3434
- return;
3435
- }
3436
- const routes = router.getRoutes() || [];
3437
- const projectRootPath = window.location.pathname;
3438
- const findRoute = (routes2, distRoute) => {
3439
- let queen = [...routes2];
3440
- while (queen.length) {
3441
- const first = queen.shift();
3442
- if (first.children) {
3443
- queen = queen.concat(first.children);
3444
- }
3445
- if (first.name == distRoute.name) {
3446
- return first;
3447
- }
3448
- }
3449
- };
3450
- const route = findRoute(routes, r);
3451
- if (route) {
3452
- item.id = r.id || item.id;
3453
- item.name = r.title || (window.$hxt ? window.$hxt(route.meta.title) : route.meta.title);
3454
- item.url = `${projectRootPath}#${route.path}${qs__namespace.stringify(r.query, { encode: false })}`;
3455
- if (openTab) {
3456
- openTab(item);
3457
- } else {
3458
- router.push(r);
3459
- }
3460
- } else {
3461
- console.error("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u7684\u8DEF\u7531");
3462
- }
3463
- };
3464
- const $closeTag = () => {
3465
- if (!window.parent.selectedRouterTags) {
3466
- return;
3467
- }
3468
- const currentRouterTagIndex = window.parent.currentRouterTagIndex;
3469
- const preIndex = window.parent.currentRouterTagIndex - 1;
3470
- const currentTag = window.parent.selectedRouterTags[currentRouterTagIndex];
3471
- const preTag = window.parent.selectedRouterTags[preIndex];
3472
- window.parent?.closeTag?.(currentTag);
3473
- window.parent?.openMenuSelect?.(preTag);
3474
- };
3475
- return {
3476
- $goto,
3477
- $closeTag
3478
- };
3479
- };
3480
-
3481
3606
  const INSTALLED_KEY = /* @__PURE__ */ Symbol("INSTALLED_KEY");
3482
3607
  const install = (app, options) => {
3483
3608
  if (app[INSTALLED_KEY]) return;
@@ -3497,6 +3622,7 @@
3497
3622
  exports.EpFormItem = EpFormItem;
3498
3623
  exports.EpHeader = EpHeader;
3499
3624
  exports.EpInput = EpInput;
3625
+ exports.EpLink = EpLink;
3500
3626
  exports.EpSearchListPage = EpSearchListPage;
3501
3627
  exports.EpSelect = EpSelect;
3502
3628
  exports.EpTable = EpTable;
@@ -3522,6 +3648,7 @@
3522
3648
  exports.inputEmitsKeys = inputEmitsKeys;
3523
3649
  exports.inputProps = inputProps;
3524
3650
  exports.install = install;
3651
+ exports.linkProps = linkProps;
3525
3652
  exports.searchListPageProps = searchListPageProps;
3526
3653
  exports.selectEmits = selectEmits;
3527
3654
  exports.selectEmitsKeys = selectEmitsKeys;