vap1 0.8.7 → 0.8.8

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.
@@ -155,6 +155,7 @@ var _VTable = (0, react_1.forwardRef)(function (props) {
155
155
  var _b = (0, useTableContext_1.useTableContext)(), selectedRowKeys = _b.selectedRowKeys, initObjects = _b.initObjects, reflushPage = _b.reflushPage, setSelection = _b.setSelection;
156
156
  var _c = (0, Box_1.useBox)(), state = _c.state, root = _c.root, resize = _c.resize;
157
157
  var update = (0, hooks_1.useUpdate)();
158
+ var isFristMount = (0, hooks_1.useFirstMountState)();
158
159
  var _d = __read((0, react_1.useState)(undefined), 2), scroll = _d[0], setScroll = _d[1];
159
160
  var _e = __read((0, react_1.useState)({}), 2), columnWidths = _e[0], setColumnWidths = _e[1];
160
161
  var _f = props.model, rowKey = _f.rowKey, list = _f.list, isQuerying = _f.isQuerying, pageNo = _f.pageNo, pageSize = _f.pageSize, orderBy = _f.orderBy, query = _f.query, total = _f.total, cost = _f.cost;
@@ -181,7 +182,12 @@ var _VTable = (0, react_1.forwardRef)(function (props) {
181
182
  return;
182
183
  if (lodash_1.default.isFunction((_b = props.selectBar) === null || _b === void 0 ? void 0 : _b.onSelect)) {
183
184
  var param = (_a = props.selectBar).onSelect.apply(_a, __spreadArray([], __read(state.selected), false));
184
- query(__assign(__assign({}, (props.defaultParam || props.default)), param));
185
+ if (isFristMount) {
186
+ query(__assign(__assign({}, (props.defaultParam || props.default)), param));
187
+ }
188
+ else {
189
+ query(param, false);
190
+ }
185
191
  }
186
192
  }, [state.selected]);
187
193
  // 更新页数
@@ -1,5 +1,8 @@
1
- import type { FC } from 'react';
2
- import type { BaseTreeProps } from './index';
1
+ import React from 'react';
2
+ import type { ReactNode } from 'react';
3
+ import type { BaseTreeProps, BaseTreeRef } from './index';
4
+ import type { TreeProps } from 'antd/es/tree';
5
+ import type { PlainObject } from '../../basetype';
3
6
  import type { TreeNodeData } from '../../utils/TreeUtil';
4
7
  export type STreeData = {
5
8
  /**
@@ -19,4 +22,12 @@ export type STreeProps = BaseTreeProps & STreeData;
19
22
  * 搜索 : 支持
20
23
  * 数据 : 需要组装好后传入
21
24
  */
22
- export declare const STree: FC<STreeProps>;
25
+ export declare const STree: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("../../utils/TreeUtil").BaseTreeOpts & Pick<TreeProps, "className" | "disabled" | "defaultExpandAll"> & {
26
+ iconField?: string | ((item: any) => ReactNode);
27
+ titleField: string | import("./index").LanguageField;
28
+ titleRender?: (node: PlainObject) => ReactNode;
29
+ mustSelect?: boolean;
30
+ disabledNode?: (node: PlainObject) => boolean;
31
+ onSelect?: (key: import("../../basetype").Key, node: PlainObject, parentNode: PlainObject, crumb: PlainObject[], pos: number[]) => void;
32
+ searchValue?: string;
33
+ } & STreeData & React.RefAttributes<BaseTreeRef>>>;
@@ -87,10 +87,13 @@ var _i18n_1 = require("../_i18n");
87
87
  * 搜索 : 支持
88
88
  * 数据 : 需要组装好后传入
89
89
  */
90
- exports.STree = (0, react_1.memo)(function (props) { return react_1.default.createElement(BaseTree_1.BaseTree, __assign({}, props),
91
- react_1.default.createElement(_Stree, __assign({}, props))); }, function (p, n) { return p.searchValue == n.searchValue; });
90
+ exports.STree = (0, react_1.memo)((0, react_1.forwardRef)(function (props, ref) { return react_1.default.createElement(BaseTree_1.BaseTree, __assign({}, props),
91
+ react_1.default.createElement(_Stree, __assign({}, props, { treeRef: ref }))); }), function (p, n) { return p.searchValue == n.searchValue; });
92
92
  var _Stree = function (props) {
93
93
  var _a = (0, BaseTree_1.useBaseTree)(), baseProps = _a.baseProps, treeState = _a.treeState, onSelect = _a.onSelect, setTreeData = _a.setTreeData;
94
+ (0, react_1.useImperativeHandle)(props.treeRef, function () { return ({
95
+ getSelected: function () { return treeState.selectedNode; },
96
+ }); }, [treeState.selectedNode]);
94
97
  (0, react_1.useLayoutEffect)(function () {
95
98
  var tree = [];
96
99
  if (props.isFlat) {
@@ -123,14 +123,16 @@ export type BaseActionTreeProps = {
123
123
  */
124
124
  idForApiField?: string;
125
125
  };
126
+ export type BaseTreeRef = {
127
+ getSelected: () => PlainObject;
128
+ };
126
129
  /**
127
130
  * 说明 针对节点进行操作
128
131
  * 说明,节点信息,位置信息,可通过 onSelect 方法的第五个参数可以拿到
129
132
  */
130
- export type ActionTreeRef = {
133
+ export type ActionTreeRef = BaseTreeRef & {
131
134
  updateData: (node: PlainObject, pos: number[]) => void;
132
135
  update: (node: PlainObject, pos: number[]) => Promise<void>;
133
136
  del: (node: PlainObject, pos: number[]) => Promise<void>;
134
137
  add: (node: PlainObject, pos: number[]) => void;
135
- getSelected: () => PlainObject;
136
138
  };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"vap1","version":"0.8.7","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
1
+ {"name":"vap1","version":"0.8.8","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}