@vue-start/pro 0.4.0 → 0.4.3

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.
package/dist/index.js CHANGED
@@ -993,6 +993,7 @@ var proCurdProps = function proCurdProps() {
993
993
  };
994
994
  };
995
995
 
996
+ var CurdMethods = ["sendCurdEvent", "refreshList", "sendEvent", "sendRequest"];
996
997
  var Curd = vue.defineComponent({
997
998
  props: _objectSpread2({}, proCurdProps()),
998
999
  setup: function setup(props, _ref) {
@@ -1172,7 +1173,6 @@ var Curd = vue.defineComponent({
1172
1173
  });
1173
1174
  expose({
1174
1175
  sendCurdEvent: sendCurdEvent,
1175
- getOperate: getOperate,
1176
1176
  refreshList: handleSearch
1177
1177
  });
1178
1178
  return function () {
@@ -1254,8 +1254,30 @@ var ProCurd = vue.defineComponent({
1254
1254
  });
1255
1255
  var moduleKeys = lodash.keys(lodash.omit(ProModule.props, "state", "requests"));
1256
1256
  expose({
1257
- moduleRef: moduleRef,
1258
- curdRef: curdRef
1257
+ sendCurdEvent: function sendCurdEvent(event) {
1258
+ var _curdRef$value;
1259
+
1260
+ (_curdRef$value = curdRef.value) === null || _curdRef$value === void 0 ? void 0 : _curdRef$value.sendCurdEvent(event);
1261
+ },
1262
+ refreshList: function refreshList(extra) {
1263
+ var _curdRef$value2;
1264
+
1265
+ (_curdRef$value2 = curdRef.value) === null || _curdRef$value2 === void 0 ? void 0 : _curdRef$value2.refreshList(extra);
1266
+ },
1267
+ sendEvent: function sendEvent(action) {
1268
+ var _moduleRef$value;
1269
+
1270
+ (_moduleRef$value = moduleRef.value) === null || _moduleRef$value === void 0 ? void 0 : _moduleRef$value.sendEvent(action);
1271
+ },
1272
+ sendRequest: function sendRequest(requestNameOrAction) {
1273
+ var _moduleRef$value2;
1274
+
1275
+ for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1276
+ params[_key - 1] = arguments[_key];
1277
+ }
1278
+
1279
+ (_moduleRef$value2 = moduleRef.value) === null || _moduleRef$value2 === void 0 ? void 0 : _moduleRef$value2.sendEvent.apply(_moduleRef$value2, [requestNameOrAction].concat(params));
1280
+ }
1259
1281
  });
1260
1282
  return function () {
1261
1283
  return vue.createVNode(ProModule, vue.mergeProps({
@@ -1284,8 +1306,8 @@ var modalCurdProps = function modalCurdProps() {
1284
1306
  };
1285
1307
  };
1286
1308
 
1287
- /**
1288
- * 事件处理
1309
+ /**
1310
+ * 事件处理
1289
1311
  */
1290
1312
  var ModalCurd = vue.defineComponent({
1291
1313
  props: _objectSpread2({}, modalCurdProps()),
@@ -1441,7 +1463,10 @@ var ModalCurd = vue.defineComponent({
1441
1463
  var ProModalCurd = vue.defineComponent({
1442
1464
  props: _objectSpread2(_objectSpread2({}, ProCurd.props), ModalCurd.props),
1443
1465
  setup: function setup(props, _ref4) {
1444
- var slots = _ref4.slots;
1466
+ var slots = _ref4.slots,
1467
+ expose = _ref4.expose;
1468
+ var curdRef = vue.ref();
1469
+ expose(createExpose(CurdMethods, curdRef));
1445
1470
  var invalidKeys = lodash.keys(ModalCurd.props);
1446
1471
  return function () {
1447
1472
  var _slots$default;
@@ -1613,12 +1638,17 @@ var PageCurd = vue.defineComponent({
1613
1638
  var ProPageCurd = vue.defineComponent({
1614
1639
  props: _objectSpread2(_objectSpread2({}, ProCurd.props), PageCurd.props),
1615
1640
  setup: function setup(props, _ref4) {
1616
- var slots = _ref4.slots;
1641
+ var slots = _ref4.slots,
1642
+ expose = _ref4.expose;
1643
+ var curdRef = vue.ref();
1644
+ expose(createExpose(CurdMethods, curdRef));
1617
1645
  var invalidKeys = lodash.keys(PageCurd.props);
1618
1646
  return function () {
1619
1647
  var _slots$default;
1620
1648
 
1621
- return vue.createVNode(ProCurd, lodash.omit(props, invalidKeys), {
1649
+ return vue.createVNode(ProCurd, vue.mergeProps({
1650
+ "ref": curdRef
1651
+ }, lodash.omit(props, invalidKeys)), {
1622
1652
  "default": function _default() {
1623
1653
  return [vue.createVNode(PageCurd, lodash.pick(props, invalidKeys), null), (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
1624
1654
  }
@@ -1637,6 +1667,10 @@ var createCurdDesc = function createCurdDesc(Descriptions, DescriptionsItem) {
1637
1667
  //重写Item content
1638
1668
  renderItem: {
1639
1669
  type: Function
1670
+ },
1671
+ //标记名称
1672
+ signName: {
1673
+ type: String
1640
1674
  }
1641
1675
  }),
1642
1676
  setup: function setup(props, _ref) {
@@ -1645,10 +1679,12 @@ var createCurdDesc = function createCurdDesc(Descriptions, DescriptionsItem) {
1645
1679
  var _useProCurd = useProCurd(),
1646
1680
  getItemVNode = _useProCurd.getItemVNode,
1647
1681
  curdState = _useProCurd.curdState,
1648
- descColumns = _useProCurd.descColumns;
1682
+ descColumns = _useProCurd.descColumns,
1683
+ getSignColumns = _useProCurd.getSignColumns;
1649
1684
 
1650
1685
  var descVNodes = vue.computed(function () {
1651
- return lodash.map(descColumns.value, function (item) {
1686
+ var columns = props.signName ? getSignColumns(props.signName) : descColumns.value;
1687
+ return lodash.map(columns, function (item) {
1652
1688
  var _slot;
1653
1689
 
1654
1690
  var _props$renderItem;
@@ -1685,6 +1721,10 @@ var createCurdDesc = function createCurdDesc(Descriptions, DescriptionsItem) {
1685
1721
 
1686
1722
  var proCurdAddOrEditProps = function proCurdAddOrEditProps() {
1687
1723
  return {
1724
+ //标记名称
1725
+ signName: {
1726
+ type: String
1727
+ },
1688
1728
  //是否使用operate bar
1689
1729
  operateBar: {
1690
1730
  type: Boolean,
@@ -1714,22 +1754,38 @@ var proCurdAddOrEditProps = function proCurdAddOrEditProps() {
1714
1754
  };
1715
1755
  };
1716
1756
 
1717
- var createCurdForm = function createCurdForm(Form, Button, convertFormProps) {
1757
+ var createCurdForm = function createCurdForm(Form, Button, convertFormProps, formMethods) {
1718
1758
  return vue.defineComponent({
1759
+ inheritAttrs: false,
1719
1760
  props: _objectSpread2(_objectSpread2({}, Form.props), proCurdAddOrEditProps()),
1720
1761
  setup: function setup(props, _ref) {
1721
- var slots = _ref.slots;
1762
+ var slots = _ref.slots,
1763
+ attrs = _ref.attrs,
1764
+ expose = _ref.expose;
1722
1765
 
1723
1766
  var _useProCurd = useProCurd(),
1724
1767
  elementMap = _useProCurd.elementMap,
1725
1768
  formElementMap = _useProCurd.formElementMap,
1726
1769
  curdState = _useProCurd.curdState,
1727
1770
  formColumns = _useProCurd.formColumns,
1771
+ getSignColumns = _useProCurd.getSignColumns,
1728
1772
  sendCurdEvent = _useProCurd.sendCurdEvent;
1729
1773
 
1730
1774
  var formRef = vue.ref();
1775
+ var columns = vue.computed(function () {
1776
+ if (props.signName) {
1777
+ return getSignColumns(props.signName);
1778
+ }
1779
+
1780
+ return formColumns.value;
1781
+ });
1782
+
1783
+ var handleFinish = function handleFinish(values, originValues) {
1784
+ if (attrs.onFinish) {
1785
+ attrs.onFinish(values, originValues);
1786
+ return;
1787
+ }
1731
1788
 
1732
- var handleFinish = function handleFinish(values) {
1733
1789
  if (curdState.mode === exports.CurdCurrentMode.EDIT) {
1734
1790
  //edit
1735
1791
  sendCurdEvent({
@@ -1761,15 +1817,16 @@ var createCurdForm = function createCurdForm(Form, Button, convertFormProps) {
1761
1817
  (_formRef$value2 = formRef.value) === null || _formRef$value2 === void 0 ? void 0 : _formRef$value2.submit();
1762
1818
  };
1763
1819
 
1820
+ expose(createExpose(formMethods, formRef));
1764
1821
  return function () {
1765
1822
  var _slots$divide, _slots$operateStart, _slots$operateCenter, _slots$operateEnd, _slots$default;
1766
1823
 
1767
1824
  return vue.createVNode(Form, vue.mergeProps({
1768
1825
  "ref": formRef
1769
- }, props, {
1826
+ }, lodash.omit(attrs, "onFinish"), props, {
1770
1827
  "elementMap": props.elementMap || elementMap,
1771
1828
  "formElementMap": props.formElementMap || formElementMap,
1772
- "columns": formColumns.value,
1829
+ "columns": columns.value,
1773
1830
  "model": curdState.detailData,
1774
1831
  "readonly": curdState.mode === exports.CurdCurrentMode.DETAIL,
1775
1832
  "onFinish": handleFinish
@@ -1803,8 +1860,8 @@ var createCurdForm = function createCurdForm(Form, Button, convertFormProps) {
1803
1860
 
1804
1861
  var proCurdListProps = function proCurdListProps() {
1805
1862
  return {
1806
- /**
1807
- * extra 是否放到SearchForm中
1863
+ /**
1864
+ * extra 是否放到SearchForm中
1808
1865
  */
1809
1866
  extraInSearch: {
1810
1867
  type: Boolean,
@@ -1907,9 +1964,29 @@ var createCurdList = function createCurdList(SearchForm, Table) {
1907
1964
  };
1908
1965
 
1909
1966
  return function () {
1910
- var _props$searchProps, _slots$divide, _curdState$listData, _slots$divide2, _slots$footerStart, _slots$pagination, _curdState$listData2, _slots$footerEnd;
1967
+ var _curdState$listData, _props$searchProps, _slots$divide, _slots$divide2, _slots$footerStart, _slots$pagination, _curdState$listData2, _slots$footerEnd;
1911
1968
 
1912
1969
  var tableProps = props.tableProps;
1970
+
1971
+ var rewriteTableProps = _objectSpread2(_objectSpread2({
1972
+ elementMap: elementMap
1973
+ }, lodash.omit(tableProps, "slots", "operate")), {}, {
1974
+ operate: lodash.mergeWith({
1975
+ items: tableOperateItems
1976
+ }, tableProps === null || tableProps === void 0 ? void 0 : tableProps.operate, function (objValue, srcValue) {
1977
+ if (lodash.isArray(objValue) && lodash.isArray(srcValue)) {
1978
+ return lodash.concat(objValue, convertOperateItems(srcValue));
1979
+ }
1980
+ }),
1981
+ paginationState: {
1982
+ page: pageState.page,
1983
+ pageSize: pageState.pageSize
1984
+ },
1985
+ columns: tableColumns.value,
1986
+ loading: curdState.listLoading,
1987
+ dataSource: (_curdState$listData = curdState.listData) === null || _curdState$listData === void 0 ? void 0 : _curdState$listData.dataSource
1988
+ });
1989
+
1913
1990
  var extra = slots.extra ? vue.createVNode("div", {
1914
1991
  "class": "pro-curd-list-extra"
1915
1992
  }, [slots.extra()]) : null;
@@ -1922,24 +1999,7 @@ var createCurdList = function createCurdList(SearchForm, Table) {
1922
1999
  "default": function _default() {
1923
2000
  return [props.extraInSearch && extra];
1924
2001
  }
1925
- }, (_props$searchProps = props.searchProps) === null || _props$searchProps === void 0 ? void 0 : _props$searchProps.slots)), (_slots$divide = slots.divide) === null || _slots$divide === void 0 ? void 0 : _slots$divide.call(slots), !props.extraInSearch && extra, slots.table ? slots.table() : vue.createVNode(Table, vue.mergeProps({
1926
- "elementMap": elementMap
1927
- }, lodash.omit(tableProps, "slots", "operate"), {
1928
- "operate": lodash.mergeWith({
1929
- items: tableOperateItems
1930
- }, tableProps === null || tableProps === void 0 ? void 0 : tableProps.operate, function (objValue, srcValue) {
1931
- if (lodash.isArray(objValue) && lodash.isArray(srcValue)) {
1932
- return lodash.concat(objValue, convertOperateItems(srcValue));
1933
- }
1934
- }),
1935
- "paginationState": {
1936
- page: pageState.page,
1937
- pageSize: pageState.pageSize
1938
- },
1939
- "columns": tableColumns.value,
1940
- "loading": curdState.listLoading,
1941
- "dataSource": (_curdState$listData = curdState.listData) === null || _curdState$listData === void 0 ? void 0 : _curdState$listData.dataSource
1942
- }), tableProps === null || tableProps === void 0 ? void 0 : tableProps.slots), (_slots$divide2 = slots.divide2) === null || _slots$divide2 === void 0 ? void 0 : _slots$divide2.call(slots), vue.createVNode("div", {
2002
+ }, (_props$searchProps = props.searchProps) === null || _props$searchProps === void 0 ? void 0 : _props$searchProps.slots)), (_slots$divide = slots.divide) === null || _slots$divide === void 0 ? void 0 : _slots$divide.call(slots), !props.extraInSearch && extra, slots.table ? slots.table(rewriteTableProps) : vue.createVNode(Table, rewriteTableProps, tableProps === null || tableProps === void 0 ? void 0 : tableProps.slots), (_slots$divide2 = slots.divide2) === null || _slots$divide2 === void 0 ? void 0 : _slots$divide2.call(slots), vue.createVNode("div", {
1943
2003
  "class": "pro-curd-list-footer"
1944
2004
  }, [(_slots$footerStart = slots.footerStart) === null || _slots$footerStart === void 0 ? void 0 : _slots$footerStart.call(slots), (_slots$pagination = slots.pagination) === null || _slots$pagination === void 0 ? void 0 : _slots$pagination.call(slots, pageState, (_curdState$listData2 = curdState.listData) === null || _curdState$listData2 === void 0 ? void 0 : _curdState$listData2.total, handleSearch), (_slots$footerEnd = slots.footerEnd) === null || _slots$footerEnd === void 0 ? void 0 : _slots$footerEnd.call(slots)])]);
1945
2005
  };
@@ -1947,6 +2007,114 @@ var createCurdList = function createCurdList(SearchForm, Table) {
1947
2007
  });
1948
2008
  };
1949
2009
 
2010
+ /**
2011
+ * ProFormList ctx
2012
+ */
2013
+
2014
+ var ProFormListKey = Symbol("pro-form-list");
2015
+ var useProFormList = function useProFormList() {
2016
+ return vue.inject(ProFormListKey);
2017
+ };
2018
+ var provideProFormList = function provideProFormList(ctx) {
2019
+ vue.provide(ProFormListKey, ctx);
2020
+ };
2021
+ var FormListProvider = vue.defineComponent({
2022
+ props: {
2023
+ pathList: {
2024
+ type: Array
2025
+ }
2026
+ },
2027
+ setup: function setup(props, _ref) {
2028
+ var slots = _ref.slots;
2029
+ provideProFormList({
2030
+ pathList: props.pathList
2031
+ });
2032
+ return function () {
2033
+ var _slots$default;
2034
+
2035
+ return (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
2036
+ };
2037
+ }
2038
+ });
2039
+
2040
+ var createFormList = function createFormList(FormItem) {
2041
+ return vue.defineComponent({
2042
+ props: _objectSpread2(_objectSpread2({}, FormItem.props), {}, {
2043
+ //每行默认id
2044
+ rowKey: {
2045
+ type: String,
2046
+ "default": "id"
2047
+ }
2048
+ }),
2049
+ setup: function setup(props, _ref2) {
2050
+ var slots = _ref2.slots;
2051
+
2052
+ var _useProForm = useProForm(),
2053
+ formState = _useProForm.formState,
2054
+ readonly = _useProForm.readonly;
2055
+
2056
+ var formListCtx = useProFormList();
2057
+ var nameList = convertPathToList(props.name);
2058
+ var path = formListCtx !== null && formListCtx !== void 0 && formListCtx.pathList ? [].concat(_toConsumableArray(formListCtx.pathList), _toConsumableArray(nameList)) : nameList;
2059
+
2060
+ var handleAdd = function handleAdd() {
2061
+ var targetList = lodash.get(formState, path);
2062
+
2063
+ if (!lodash.isArray(targetList)) {
2064
+ targetList = [];
2065
+ }
2066
+
2067
+ targetList.push(_defineProperty({}, props.rowKey, new Date().valueOf()));
2068
+ lodash.set(formState, path, targetList);
2069
+ };
2070
+
2071
+ var handleRemove = function handleRemove(index) {
2072
+ var targetList = lodash.get(formState, path);
2073
+
2074
+ if (lodash.size(targetList) <= 0) {
2075
+ return;
2076
+ }
2077
+
2078
+ targetList.splice(index, 1);
2079
+ };
2080
+
2081
+ return function () {
2082
+ var _slots$add;
2083
+
2084
+ return vue.createVNode(FormItem, lodash.omit(props, "rowKey"), {
2085
+ "default": function _default() {
2086
+ return [lodash.map(lodash.get(formState, path), function (item, index) {
2087
+ var _slots$default2, _slots$itemAdd, _slots$itemMinus;
2088
+
2089
+ return vue.createVNode(FormListProvider, {
2090
+ "key": item[props.rowKey] || index,
2091
+ "pathList": [].concat(_toConsumableArray(path), [index])
2092
+ }, {
2093
+ "default": function _default() {
2094
+ return [vue.createVNode("div", {
2095
+ "class": "pro-form-list-item"
2096
+ }, [(_slots$default2 = slots["default"]) === null || _slots$default2 === void 0 ? void 0 : _slots$default2.call(slots), !readonly.value && vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
2097
+ "class": "pro-form-list-item-add",
2098
+ "onClick": handleAdd
2099
+ }, [(_slots$itemAdd = slots.itemAdd) === null || _slots$itemAdd === void 0 ? void 0 : _slots$itemAdd.call(slots)]), vue.createVNode("div", {
2100
+ "class": "pro-form-list-item-minus",
2101
+ "onClick": function onClick() {
2102
+ return handleRemove(index);
2103
+ }
2104
+ }, [(_slots$itemMinus = slots.itemMinus) === null || _slots$itemMinus === void 0 ? void 0 : _slots$itemMinus.call(slots)])])])];
2105
+ }
2106
+ });
2107
+ }), !readonly.value && vue.createVNode("div", {
2108
+ "class": "pro-form-list-add",
2109
+ "onClick": handleAdd
2110
+ }, [(_slots$add = slots.add) === null || _slots$add === void 0 ? void 0 : _slots$add.call(slots)])];
2111
+ }
2112
+ });
2113
+ };
2114
+ }
2115
+ });
2116
+ };
2117
+
1950
2118
  var ProFormKey = Symbol("pro-form");
1951
2119
  var useProForm = function useProForm() {
1952
2120
  return vue.inject(ProFormKey);
@@ -1958,24 +2126,24 @@ var provideProForm = function provideProForm(ctx) {
1958
2126
 
1959
2127
  var proFormProps = function proFormProps() {
1960
2128
  return {
1961
- /**
1962
- * 同 antd 或 element form中的model
2129
+ /**
2130
+ * 同 antd 或 element form中的model
1963
2131
  */
1964
2132
  model: {
1965
2133
  type: Object
1966
2134
  },
1967
2135
 
1968
- /**
1969
- * 子组件是否只读样式
2136
+ /**
2137
+ * 子组件是否只读样式
1970
2138
  */
1971
2139
  readonly: {
1972
2140
  type: Boolean,
1973
2141
  "default": undefined
1974
2142
  },
1975
2143
 
1976
- /**
1977
- * FormComponent 根据此项来确定组件是否显示
1978
- * rules 根据rules中方法生成showState对象
2144
+ /**
2145
+ * FormComponent 根据此项来确定组件是否显示
2146
+ * rules 根据rules中方法生成showState对象
1979
2147
  */
1980
2148
  showState: {
1981
2149
  type: Object
@@ -1984,8 +2152,8 @@ var proFormProps = function proFormProps() {
1984
2152
  type: Object
1985
2153
  },
1986
2154
 
1987
- /**
1988
- * 是否只读
2155
+ /**
2156
+ * 是否只读
1989
2157
  */
1990
2158
  readonlyState: {
1991
2159
  type: Object
@@ -1994,8 +2162,8 @@ var proFormProps = function proFormProps() {
1994
2162
  type: Object
1995
2163
  },
1996
2164
 
1997
- /**
1998
- * 是否disabled
2165
+ /**
2166
+ * 是否disabled
1999
2167
  */
2000
2168
  disableState: {
2001
2169
  type: Object
@@ -2004,8 +2172,8 @@ var proFormProps = function proFormProps() {
2004
2172
  type: Object
2005
2173
  },
2006
2174
 
2007
- /**
2008
- *
2175
+ /**
2176
+ *
2009
2177
  */
2010
2178
  columns: {
2011
2179
  type: Array
@@ -2014,30 +2182,30 @@ var proFormProps = function proFormProps() {
2014
2182
  type: Object
2015
2183
  },
2016
2184
 
2017
- /**
2018
- * 展示控件集合,readonly模式下使用这些组件渲染
2185
+ /**
2186
+ * 展示控件集合,readonly模式下使用这些组件渲染
2019
2187
  */
2020
2188
  elementMap: {
2021
2189
  type: Object
2022
2190
  },
2023
2191
 
2024
- /**
2025
- * 录入控件集合
2192
+ /**
2193
+ * 录入控件集合
2026
2194
  */
2027
2195
  formElementMap: {
2028
2196
  type: Object
2029
2197
  },
2030
2198
 
2031
- /**
2032
- * 是否启用rules验证
2199
+ /**
2200
+ * 是否启用rules验证
2033
2201
  */
2034
2202
  needRules: {
2035
2203
  type: Boolean,
2036
2204
  "default": true
2037
2205
  },
2038
2206
 
2039
- /**
2040
- * provide传递
2207
+ /**
2208
+ * provide传递
2041
2209
  */
2042
2210
  provideExtra: {
2043
2211
  type: Object
@@ -2045,7 +2213,7 @@ var proFormProps = function proFormProps() {
2045
2213
  };
2046
2214
  };
2047
2215
 
2048
- var createForm = function createForm(Form, Grid) {
2216
+ var createForm = function createForm(Form, Grid, formMethods) {
2049
2217
  return vue.defineComponent({
2050
2218
  inheritAttrs: false,
2051
2219
  props: _objectSpread2(_objectSpread2(_objectSpread2({}, Form.props), proFormProps()), lodash.omit(Grid.props, "items")),
@@ -2097,22 +2265,7 @@ var createForm = function createForm(Form, Grid) {
2097
2265
  };
2098
2266
 
2099
2267
  var formRef = vue.ref();
2100
- expose({
2101
- submit: function submit() {
2102
- var _formRef$value;
2103
-
2104
- (_formRef$value = formRef.value) === null || _formRef$value === void 0 ? void 0 : _formRef$value.submit();
2105
- },
2106
- resetFields: function resetFields() {
2107
- var _formRef$value2;
2108
-
2109
- for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
2110
- params[_key] = arguments[_key];
2111
- }
2112
-
2113
- (_formRef$value2 = formRef.value) === null || _formRef$value2 === void 0 ? void 0 : _formRef$value2.resetFields.apply(_formRef$value2, params);
2114
- }
2115
- });
2268
+ expose(createExpose(formMethods, formRef));
2116
2269
  provideProForm(_objectSpread2({
2117
2270
  formState: formState,
2118
2271
  showState: showState,
@@ -2127,7 +2280,9 @@ var createForm = function createForm(Form, Grid) {
2127
2280
  columns: columns,
2128
2281
  //
2129
2282
  formRef: formRef
2130
- }, props.provideExtra));
2283
+ }, props.provideExtra)); //为了不warning ...
2284
+
2285
+ provideProFormList({});
2131
2286
  var invalidKeys = lodash.keys(proFormProps());
2132
2287
  var gridKeys = lodash.keys(lodash.omit(Grid.props, "items"));
2133
2288
  return function () {
@@ -2169,40 +2324,39 @@ exports.SearchMode = void 0;
2169
2324
 
2170
2325
  var proSearchFormProps = function proSearchFormProps() {
2171
2326
  return {
2172
- /**
2173
- * 需要监听的对象
2327
+ /**
2328
+ * 需要监听的对象
2174
2329
  */
2175
2330
  model: {
2176
- type: Object,
2177
- required: true
2331
+ type: Object
2178
2332
  },
2179
2333
 
2180
- /**
2181
- * 初始化触发 onFinish
2334
+ /**
2335
+ * 初始化触发 onFinish
2182
2336
  */
2183
2337
  initEmit: {
2184
2338
  type: Boolean,
2185
2339
  "default": true
2186
2340
  },
2187
2341
 
2188
- /**
2189
- * 模式 自动触发或者手动触发 onFinish
2342
+ /**
2343
+ * 模式 自动触发或者手动触发 onFinish
2190
2344
  */
2191
2345
  searchMode: {
2192
2346
  type: String,
2193
2347
  "default": exports.SearchMode.AUTO
2194
2348
  },
2195
2349
 
2196
- /**
2197
- * 配置 同ProForm中的columns
2198
- * 可以根据column中valueType计算出默认的debounceKeys
2350
+ /**
2351
+ * 配置 同ProForm中的columns
2352
+ * 可以根据column中valueType计算出默认的debounceKeys
2199
2353
  */
2200
2354
  columns: {
2201
2355
  type: Array
2202
2356
  },
2203
2357
 
2204
- /**
2205
- * 需要debounce处理的字段
2358
+ /**
2359
+ * 需要debounce处理的字段
2206
2360
  */
2207
2361
  debounceKeys: {
2208
2362
  type: Array
@@ -2219,15 +2373,16 @@ var proSearchFormProps = function proSearchFormProps() {
2219
2373
  };
2220
2374
  };
2221
2375
 
2222
- /**
2223
- * 该组件只是个模式,最终返回null,不做任何渲染,应配合着ProForm的包装类一起使用
2224
- * 针对传入的model(监听对象)做相应的finish(回调)处理
2376
+ /**
2377
+ * 该组件只是个模式,最终返回null,不做任何渲染,应配合着ProForm的包装类一起使用
2378
+ * 针对传入的model(监听对象)做相应的finish(回调)处理
2225
2379
  */
2226
- var createSearchForm = function createSearchForm(Form, Props) {
2380
+ var createSearchForm = function createSearchForm(Form, Props, formMethods) {
2227
2381
  return vue.defineComponent({
2228
2382
  props: _objectSpread2(_objectSpread2(_objectSpread2({}, Form.props), Props), proSearchFormProps()),
2229
2383
  setup: function setup(props, _ref) {
2230
- var slots = _ref.slots;
2384
+ var slots = _ref.slots,
2385
+ expose = _ref.expose;
2231
2386
  var formState = props.model || vue.reactive({});
2232
2387
  var valueTypeSet = new Set(props.debounceTypes); //根据column valueType 算出默认需要debounce处理的属性集合
2233
2388
 
@@ -2239,6 +2394,7 @@ var createSearchForm = function createSearchForm(Form, Props) {
2239
2394
  return getColumnFormItemName(column);
2240
2395
  });
2241
2396
  var formRef = vue.ref();
2397
+ expose(createExpose(formMethods, formRef));
2242
2398
 
2243
2399
  var handleFinish = function handleFinish() {
2244
2400
  var _formRef$value;
@@ -2292,116 +2448,6 @@ var createSearchForm = function createSearchForm(Form, Props) {
2292
2448
  });
2293
2449
  };
2294
2450
 
2295
- /**
2296
- * ProFormList ctx
2297
- */
2298
-
2299
- var ProFormListKey = Symbol("pro-form-list");
2300
- var useProFormList = function useProFormList() {
2301
- return vue.inject(ProFormListKey);
2302
- };
2303
-
2304
- var provideProFormList = function provideProFormList(ctx) {
2305
- vue.provide(ProFormListKey, ctx);
2306
- };
2307
-
2308
- var FormListProvider = vue.defineComponent({
2309
- props: {
2310
- pathList: {
2311
- type: Array
2312
- }
2313
- },
2314
- setup: function setup(props, _ref) {
2315
- var slots = _ref.slots;
2316
- provideProFormList({
2317
- pathList: props.pathList
2318
- });
2319
- return function () {
2320
- var _slots$default;
2321
-
2322
- return (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
2323
- };
2324
- }
2325
- });
2326
-
2327
- var createFormList = function createFormList(FormItem) {
2328
- return vue.defineComponent({
2329
- props: _objectSpread2(_objectSpread2({}, FormItem.props), {}, {
2330
- //每行默认id
2331
- rowKey: {
2332
- type: String,
2333
- "default": "id"
2334
- }
2335
- }),
2336
- setup: function setup(props, _ref2) {
2337
- var slots = _ref2.slots;
2338
-
2339
- var _useProForm = useProForm(),
2340
- formState = _useProForm.formState,
2341
- readonly = _useProForm.readonly;
2342
-
2343
- var formListCtx = useProFormList();
2344
- var nameList = convertPathToList(props.name);
2345
- var path = formListCtx !== null && formListCtx !== void 0 && formListCtx.pathList ? [].concat(_toConsumableArray(formListCtx.pathList), _toConsumableArray(nameList)) : nameList;
2346
-
2347
- var handleAdd = function handleAdd() {
2348
- var targetList = lodash.get(formState, path);
2349
-
2350
- if (!lodash.isArray(targetList)) {
2351
- targetList = [];
2352
- }
2353
-
2354
- targetList.push(_defineProperty({}, props.rowKey, new Date().valueOf()));
2355
- lodash.set(formState, path, targetList);
2356
- };
2357
-
2358
- var handleRemove = function handleRemove(index) {
2359
- var targetList = lodash.get(formState, path);
2360
-
2361
- if (lodash.size(targetList) <= 0) {
2362
- return;
2363
- }
2364
-
2365
- targetList.splice(index, 1);
2366
- };
2367
-
2368
- return function () {
2369
- var _slots$add;
2370
-
2371
- return vue.createVNode(FormItem, lodash.omit(props, "rowKey"), {
2372
- "default": function _default() {
2373
- return [lodash.map(lodash.get(formState, path), function (item, index) {
2374
- var _slots$default2, _slots$itemAdd, _slots$itemMinus;
2375
-
2376
- return vue.createVNode(FormListProvider, {
2377
- "key": item[props.rowKey] || index,
2378
- "pathList": [].concat(_toConsumableArray(path), [index])
2379
- }, {
2380
- "default": function _default() {
2381
- return [vue.createVNode("div", {
2382
- "class": "pro-form-list-item"
2383
- }, [(_slots$default2 = slots["default"]) === null || _slots$default2 === void 0 ? void 0 : _slots$default2.call(slots), !readonly.value && vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
2384
- "class": "pro-form-list-item-add",
2385
- "onClick": handleAdd
2386
- }, [(_slots$itemAdd = slots.itemAdd) === null || _slots$itemAdd === void 0 ? void 0 : _slots$itemAdd.call(slots)]), vue.createVNode("div", {
2387
- "class": "pro-form-list-item-minus",
2388
- "onClick": function onClick() {
2389
- return handleRemove(index);
2390
- }
2391
- }, [(_slots$itemMinus = slots.itemMinus) === null || _slots$itemMinus === void 0 ? void 0 : _slots$itemMinus.call(slots)])])])];
2392
- }
2393
- });
2394
- }), !readonly.value && vue.createVNode("div", {
2395
- "class": "pro-form-list-add",
2396
- "onClick": handleAdd
2397
- }, [(_slots$add = slots.add) === null || _slots$add === void 0 ? void 0 : _slots$add.call(slots)])];
2398
- }
2399
- });
2400
- };
2401
- }
2402
- });
2403
- };
2404
-
2405
2451
  var proFormItemProps = function proFormItemProps() {
2406
2452
  return {
2407
2453
  readonly: {
@@ -2505,8 +2551,8 @@ var proTableProps = function proTableProps() {
2505
2551
  type: String
2506
2552
  },
2507
2553
 
2508
- /**
2509
- * 公共column,会merge到columns item中
2554
+ /**
2555
+ * 公共column,会merge到columns item中
2510
2556
  */
2511
2557
  column: {
2512
2558
  type: Object
@@ -2519,29 +2565,29 @@ var proTableProps = function proTableProps() {
2519
2565
  type: Object
2520
2566
  },
2521
2567
 
2522
- /**
2523
- * 展示控件集合,readonly模式下使用这些组件渲染
2568
+ /**
2569
+ * 展示控件集合,readonly模式下使用这些组件渲染
2524
2570
  */
2525
2571
  elementMap: {
2526
2572
  type: Object
2527
2573
  },
2528
2574
 
2529
- /**
2530
- * 序号
2575
+ /**
2576
+ * 序号
2531
2577
  */
2532
2578
  serialNumber: {
2533
2579
  type: Boolean
2534
2580
  },
2535
2581
 
2536
- /**
2537
- * 分页
2582
+ /**
2583
+ * 分页
2538
2584
  */
2539
2585
  paginationState: {
2540
2586
  type: Object
2541
2587
  },
2542
2588
 
2543
- /**
2544
- * provide传递
2589
+ /**
2590
+ * provide传递
2545
2591
  */
2546
2592
  provideExtra: {
2547
2593
  type: Object
@@ -2549,11 +2595,12 @@ var proTableProps = function proTableProps() {
2549
2595
  };
2550
2596
  };
2551
2597
 
2552
- var createTable = function createTable(Table, Props) {
2598
+ var createTable = function createTable(Table, Props, tableMethods) {
2553
2599
  return vue.defineComponent({
2554
2600
  props: _objectSpread2(_objectSpread2(_objectSpread2({}, Table.props), Props), proTableProps()),
2555
2601
  setup: function setup(props, _ref) {
2556
- var slots = _ref.slots;
2602
+ var slots = _ref.slots,
2603
+ expose = _ref.expose;
2557
2604
 
2558
2605
  var createNumberColumn = function createNumberColumn() {
2559
2606
  return _objectSpread2(_objectSpread2({
@@ -2668,6 +2715,7 @@ var createTable = function createTable(Table, Props) {
2668
2715
  columns: columns,
2669
2716
  tableRef: tableRef
2670
2717
  }, props.provideExtra));
2718
+ expose(createExpose(tableMethods || [], tableRef));
2671
2719
  var invalidKeys = lodash.keys(proTableProps());
2672
2720
  return function () {
2673
2721
  return vue.createVNode(Table, vue.mergeProps({
@@ -2680,6 +2728,7 @@ var createTable = function createTable(Table, Props) {
2680
2728
  });
2681
2729
  };
2682
2730
 
2731
+ exports.CurdMethods = CurdMethods;
2683
2732
  exports.ProCurd = ProCurd;
2684
2733
  exports.ProModalCurd = ProModalCurd;
2685
2734
  exports.ProModule = ProModule;
@@ -2709,6 +2758,7 @@ exports.getItemEl = getItemEl;
2709
2758
  exports.getValidValues = getValidValues;
2710
2759
  exports.mergeStateToList = mergeStateToList;
2711
2760
  exports.provideProCurd = provideProCurd;
2761
+ exports.provideProFormList = provideProFormList;
2712
2762
  exports.provideProModule = provideProModule;
2713
2763
  exports.renderElement = renderElement;
2714
2764
  exports.renderElements = renderElements;