ztxkui 2.0.4 → 2.0.9
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/App.js +16 -1
- package/dist/components/EnhanceSelect/index.d.ts +5 -1
- package/dist/components/EnhanceSelect/index.js +29 -18
- package/dist/components/Table/table.js +1 -1
- package/dist/components/business/GridList/item.d.ts +2 -0
- package/dist/components/business/GridList/item.js +4 -4
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -35,6 +35,7 @@ import SearchContainer from './components/business/SearchContainer';
|
|
|
35
35
|
import Upload from './components/Upload';
|
|
36
36
|
import Form from './components/Form';
|
|
37
37
|
import TransList from './components/business/List';
|
|
38
|
+
import GridList from 'components/business/GridList';
|
|
38
39
|
import './styles/index.scss';
|
|
39
40
|
var RangePicker = DatePicker.RangePicker;
|
|
40
41
|
var Item = Form.Item;
|
|
@@ -1370,6 +1371,18 @@ function App() {
|
|
|
1370
1371
|
}
|
|
1371
1372
|
}, []);
|
|
1372
1373
|
return (React.createElement("div", { className: "App", style: { padding: '10px' } },
|
|
1374
|
+
React.createElement("div", { style: { padding: '10px', width: '60%' } },
|
|
1375
|
+
React.createElement(GridList, null,
|
|
1376
|
+
React.createElement(GridList.Item, { span: 8, title: "\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D" }, "\u59D3\u540D"),
|
|
1377
|
+
React.createElement(GridList.Item, { span: 8, title: "\u59D3\u540D" }, "\u59D3\u540D"),
|
|
1378
|
+
React.createElement(GridList.Item, { span: 8, title: "\u59D3\u540D" }, "\u59D3\u540D")),
|
|
1379
|
+
React.createElement(GridList, null,
|
|
1380
|
+
React.createElement(GridList.Item, { span: 12, titleSpan: 8, title: "\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D" }, "\u59D3\u540D"),
|
|
1381
|
+
React.createElement(GridList.Item, { span: 12, titleSpan: 8, title: "\u59D3\u540D" }, "\u59D3\u540D")),
|
|
1382
|
+
React.createElement(GridList, null,
|
|
1383
|
+
React.createElement(GridList.Item, { span: 24, title: "\u59D3\u540D", titleSpan: 8 }, "\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D")),
|
|
1384
|
+
React.createElement(GridList, null,
|
|
1385
|
+
React.createElement(GridList.Item, { span: 24, title: "\u59D3\u540D", titleSpan: 12 }, "\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3\u540D\u59D3"))),
|
|
1373
1386
|
React.createElement(DetailList, { records: inspectionDetail, labelWidth: 10, labelAlign: "left", apiBaseUrl: "http://192.168.0.83:8888", fileBaseUrl: "http://192.168.0.83:88",
|
|
1374
1387
|
// downloadBtnDisable={true}
|
|
1375
1388
|
hasManOrDate: true, hasSignArea: true, isDark: true }),
|
|
@@ -1498,7 +1511,9 @@ function App() {
|
|
|
1498
1511
|
dataSource: dataSource, rowKey: "id", showColumnDynamic: true,
|
|
1499
1512
|
// onAddAndDelHandle={onAddAndDelHandle}
|
|
1500
1513
|
// onMoveRow={onMoveRowHandle}
|
|
1501
|
-
summaryConfig: summaryConfig, summaryFixed: true,
|
|
1514
|
+
summaryConfig: summaryConfig, summaryFixed: true,
|
|
1515
|
+
// scroll={{ y: 200 }}
|
|
1516
|
+
onEditableSave: onEditableSaveHandle, rowSelection: rowSelection })))),
|
|
1502
1517
|
React.createElement("br", null),
|
|
1503
1518
|
React.createElement("br", null),
|
|
1504
1519
|
React.createElement("br", null),
|
|
@@ -79,6 +79,10 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
|
|
|
79
79
|
* 远程搜索主键Key值
|
|
80
80
|
*/
|
|
81
81
|
remoteSearchDataKey?: string;
|
|
82
|
+
/**
|
|
83
|
+
* 是否启用远程搜索主键Key值
|
|
84
|
+
*/
|
|
85
|
+
isRemoteSearchDataKey?: boolean;
|
|
82
86
|
/**
|
|
83
87
|
* 接口数据格式转换
|
|
84
88
|
*/
|
|
@@ -99,6 +103,6 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
|
|
|
99
103
|
* { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
|
|
100
104
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
101
105
|
*/
|
|
102
|
-
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, transformData, joinKey, joinStr, ...restProps }: IProps<VT>): JSX.Element;
|
|
106
|
+
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, ...restProps }: IProps<VT>): JSX.Element;
|
|
103
107
|
declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
|
|
104
108
|
export default _default;
|
|
@@ -71,14 +71,15 @@ function getData(request, options) {
|
|
|
71
71
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
72
72
|
*/
|
|
73
73
|
function EnhanceSelect(_a) {
|
|
74
|
-
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.dataKey, dataKey = _c === void 0 ? 'id' : _c, componentKey = _a.componentKey, _d = _a.titleKey, titleKey = _d === void 0 ? 'name' : _d, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, transformData = _a.transformData, joinKey = _a.joinKey,
|
|
74
|
+
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.dataKey, dataKey = _c === void 0 ? 'id' : _c, componentKey = _a.componentKey, _d = _a.titleKey, titleKey = _d === void 0 ? 'name' : _d, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _e = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _e === void 0 ? true : _e, transformData = _a.transformData, joinKey = _a.joinKey, _f = _a.joinStr, joinStr = _f === void 0 ? '-' : _f, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr"]);
|
|
75
75
|
// 下拉数据源
|
|
76
|
-
var
|
|
76
|
+
var _g = useFetchState([]), selectList = _g[0], setSelectList = _g[1];
|
|
77
77
|
// 多选时,自己需要合并的数据
|
|
78
|
-
var
|
|
79
|
-
var
|
|
78
|
+
var _h = useFetchState([]), multipleList = _h[0], setMultipleList = _h[1];
|
|
79
|
+
var _j = useFetchState(false), loading = _j[0], setLoading = _j[1];
|
|
80
80
|
var fetchId = useRef(0); // 请求Id,每次请求都会加1
|
|
81
|
-
|
|
81
|
+
// 是否使用过远程搜索主键key
|
|
82
|
+
var _k = useFetchState(false), firstLoading = _k[0], setFirstLoading = _k[1];
|
|
82
83
|
// 如果selectList 发生改变,那么触发onCompleted事件
|
|
83
84
|
useEffect(function () {
|
|
84
85
|
if (Array.isArray(selectList) && onCompleted) {
|
|
@@ -183,9 +184,9 @@ function EnhanceSelect(_a) {
|
|
|
183
184
|
]);
|
|
184
185
|
var searchHandle = function (value) {
|
|
185
186
|
// 当value有值时才进行搜索
|
|
186
|
-
if (value) {
|
|
187
|
-
|
|
188
|
-
}
|
|
187
|
+
// if (value) {
|
|
188
|
+
getRemoteDataHandle(value, '');
|
|
189
|
+
// }
|
|
189
190
|
};
|
|
190
191
|
var onSearchHandle = debounce(searchHandle, 300);
|
|
191
192
|
// 1、如果传入list的话,那么直接使用list数据
|
|
@@ -241,17 +242,26 @@ function EnhanceSelect(_a) {
|
|
|
241
242
|
if (!url || !remoteSearch) {
|
|
242
243
|
return;
|
|
243
244
|
}
|
|
245
|
+
debugger;
|
|
244
246
|
// console.log('TEST: 远程搜索');
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
247
|
+
// 如果初始化请求已经做过了,那么这个副作用直接返回
|
|
248
|
+
if (firstLoading) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
// 这种情况不需要启用远程搜索key值
|
|
252
|
+
if (!isRemoteSearchDataKey) {
|
|
253
|
+
getRemoteDataHandle('', '');
|
|
254
|
+
setFirstLoading(true);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (!restProps.value) {
|
|
258
|
+
getRemoteDataHandle('', '');
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
if (typeof restProps.value === 'string' ||
|
|
262
|
+
Array.isArray(restProps.value)) {
|
|
263
|
+
setFirstLoading(true);
|
|
264
|
+
getRemoteDataHandle('', restProps.value);
|
|
255
265
|
}
|
|
256
266
|
}
|
|
257
267
|
}, [
|
|
@@ -260,6 +270,7 @@ function EnhanceSelect(_a) {
|
|
|
260
270
|
getRemoteDataHandle,
|
|
261
271
|
restProps.value,
|
|
262
272
|
firstLoading,
|
|
273
|
+
isRemoteSearchDataKey,
|
|
263
274
|
setFirstLoading,
|
|
264
275
|
]);
|
|
265
276
|
// 数据合并
|
|
@@ -38,7 +38,7 @@ import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
|
38
38
|
import { DndProvider } from 'react-dnd';
|
|
39
39
|
/**默认scroll配置 */
|
|
40
40
|
// const _scroll = { y: 500, x: 1000 };
|
|
41
|
-
var _scroll = { x: 1000 };
|
|
41
|
+
var _scroll = { x: 1000, y: 500 };
|
|
42
42
|
/**
|
|
43
43
|
* @description 定义可拖拽行
|
|
44
44
|
* 定义可编辑列
|
|
@@ -24,12 +24,12 @@ import React from 'react';
|
|
|
24
24
|
import { Col } from 'antd';
|
|
25
25
|
import classNames from 'classnames';
|
|
26
26
|
var Item = function (_a) {
|
|
27
|
-
var children = _a.children, className = _a.className, title = _a.title, colon = _a.colon, restProps = __rest(_a, ["children", "className", "title", "colon"]);
|
|
27
|
+
var children = _a.children, className = _a.className, title = _a.title, colon = _a.colon, span = _a.span, titleSpan = _a.titleSpan, restProps = __rest(_a, ["children", "className", "title", "colon", "span", "titleSpan"]);
|
|
28
28
|
var classes = classNames('zt-grid-item', className);
|
|
29
|
-
return (React.createElement(Col, __assign({ className: classes }, restProps),
|
|
30
|
-
React.createElement("span", { className: "zt-grid-item--title" },
|
|
29
|
+
return (React.createElement(Col, __assign({ className: classes, span: span }, restProps),
|
|
30
|
+
React.createElement("span", { className: "zt-grid-item--title", style: titleSpan ? { width: (titleSpan / span) * 38 + "%" } : {} },
|
|
31
31
|
title,
|
|
32
32
|
colon && ':'),
|
|
33
|
-
React.createElement("span", { className: "zt-grid-item--text" }, children)));
|
|
33
|
+
React.createElement("span", { className: "zt-grid-item--text", style: titleSpan ? { width: 100 - (titleSpan / span) * 38 + "%" } : {} }, children)));
|
|
34
34
|
};
|
|
35
35
|
export default Item;
|