@quansitech/antd-admin 1.1.36 → 1.1.39
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/components/Column/Readonly/Cascader.js +2 -2
- package/dist/components/Column/Readonly/File.js +2 -2
- package/dist/components/Form.d.ts +1 -0
- package/dist/components/Form.js +2 -0
- package/dist/components/Form.scss +15 -0
- package/dist/components/Layout/New.js +1 -0
- package/dist/components/Table/ToolbarActions.js +1 -1
- package/dist/components/Table.js +40 -32
- package/dist/lib/helpers.d.ts +1 -2
- package/dist/lib/http.js +1 -0
- package/dist/lib/schemaHandler.js +17 -0
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ export default function (props) {
|
|
|
35
35
|
var value = props.fieldProps.value;
|
|
36
36
|
var extraData;
|
|
37
37
|
if (formContext.extraRenderValues) {
|
|
38
|
-
extraData = formContext.extraRenderValues[props.fieldProps
|
|
38
|
+
extraData = formContext.extraRenderValues[props.fieldProps['data-field']];
|
|
39
39
|
}
|
|
40
40
|
if (tableContext.extraRenderValues) {
|
|
41
41
|
var _tableContext$extraRe;
|
|
@@ -43,7 +43,7 @@ export default function (props) {
|
|
|
43
43
|
var index = tableContext.dataSource.findIndex(function (item) {
|
|
44
44
|
return item[key] === props.record[key];
|
|
45
45
|
});
|
|
46
|
-
extraData = (_tableContext$extraRe = tableContext.extraRenderValues[index]) === null || _tableContext$extraRe === void 0 ? void 0 : _tableContext$extraRe[props.fieldProps
|
|
46
|
+
extraData = (_tableContext$extraRe = tableContext.extraRenderValues[index]) === null || _tableContext$extraRe === void 0 ? void 0 : _tableContext$extraRe[props.fieldProps['data-field']];
|
|
47
47
|
}
|
|
48
48
|
if (extraData) {
|
|
49
49
|
setText(findValue(extraData.options, value).join(' / '));
|
|
@@ -23,14 +23,14 @@ export default function (props) {
|
|
|
23
23
|
var extraRenderValue = [];
|
|
24
24
|
if (formContext && formContext.extraRenderValues) {
|
|
25
25
|
var _formContext$extraRen;
|
|
26
|
-
extraRenderValue = (_formContext$extraRen = formContext.extraRenderValues[props.fieldProps
|
|
26
|
+
extraRenderValue = (_formContext$extraRen = formContext.extraRenderValues[props.fieldProps['data-field']]) !== null && _formContext$extraRen !== void 0 ? _formContext$extraRen : [];
|
|
27
27
|
} else if (tableContext && tableContext.extraRenderValues) {
|
|
28
28
|
var _tableContext$extraRe, _tableContext$extraRe2;
|
|
29
29
|
var key = tableContext.getTableProps().rowKey;
|
|
30
30
|
var index = tableContext.dataSource.findIndex(function (item) {
|
|
31
31
|
return item[key] === props.record[key];
|
|
32
32
|
});
|
|
33
|
-
extraRenderValue = (_tableContext$extraRe = (_tableContext$extraRe2 = tableContext.extraRenderValues[index]) === null || _tableContext$extraRe2 === void 0 ? void 0 : _tableContext$extraRe2[props.fieldProps
|
|
33
|
+
extraRenderValue = (_tableContext$extraRe = (_tableContext$extraRe2 = tableContext.extraRenderValues[index]) === null || _tableContext$extraRe2 === void 0 ? void 0 : _tableContext$extraRe2[props.fieldProps['data-field']]) !== null && _tableContext$extraRe !== void 0 ? _tableContext$extraRe : [];
|
|
34
34
|
}
|
|
35
35
|
setFileList(extraRenderValue.map(function (item) {
|
|
36
36
|
return {
|
|
@@ -2,6 +2,7 @@ import { ProFormColumnsType } from "@ant-design/pro-components";
|
|
|
2
2
|
import type { FormSchema } from "@ant-design/pro-form/es/components/SchemaForm/typing";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { FormActionType } from "./Form/Action/types";
|
|
5
|
+
import "./Form.scss";
|
|
5
6
|
type SubmitRequestType = {
|
|
6
7
|
url: string;
|
|
7
8
|
method?: string;
|
package/dist/components/Form.js
CHANGED
|
@@ -20,6 +20,7 @@ import customRule from "../lib/customRule";
|
|
|
20
20
|
import { ModalContext } from "./ModalContext";
|
|
21
21
|
import { TableContext } from "./TableContext";
|
|
22
22
|
import { commonHandler } from "../lib/schemaHandler";
|
|
23
|
+
import "./Form.scss";
|
|
23
24
|
export default function (props) {
|
|
24
25
|
var formRef = useRef();
|
|
25
26
|
var _useState = useState(false),
|
|
@@ -149,6 +150,7 @@ export default function (props) {
|
|
|
149
150
|
}
|
|
150
151
|
}, /*#__PURE__*/React.createElement(BetaSchemaForm, {
|
|
151
152
|
columns: columns,
|
|
153
|
+
className: 'qs-form-container',
|
|
152
154
|
colProps: props.colProps,
|
|
153
155
|
readonly: props.readonly,
|
|
154
156
|
grid: true,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.qs-form-container {
|
|
2
|
+
.qs-form-list-form_list {
|
|
3
|
+
.ant-pro-form-list-item {
|
|
4
|
+
border: 1px dashed #cccccc;
|
|
5
|
+
margin-top: 10px;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
padding: 10px;
|
|
8
|
+
|
|
9
|
+
.ant-pro-form-list-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-wrap: wrap;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -14,6 +14,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
14
14
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
16
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
// @ts-nocheck
|
|
17
18
|
import { PageContainer, ProLayout, ProProvider } from "@ant-design/pro-components";
|
|
18
19
|
import { Button, Dropdown, Menu, Space } from "antd";
|
|
19
20
|
import { LayoutContext } from "../LayoutContext";
|
|
@@ -28,7 +28,7 @@ export default function (_ref) {
|
|
|
28
28
|
props: _objectSpread({}, a)
|
|
29
29
|
};
|
|
30
30
|
}));
|
|
31
|
-
}, []);
|
|
31
|
+
}, [actions]);
|
|
32
32
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Space, {
|
|
33
33
|
wrap: true
|
|
34
34
|
}, components.map(function (c) {
|
package/dist/components/Table.js
CHANGED
|
@@ -33,7 +33,7 @@ import { TabsContext } from "./TabsContext";
|
|
|
33
33
|
export default function (props) {
|
|
34
34
|
var request = /*#__PURE__*/function () {
|
|
35
35
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params, sort, filter) {
|
|
36
|
-
var data,
|
|
36
|
+
var data, res;
|
|
37
37
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38
38
|
while (1) switch (_context.prev = _context.next) {
|
|
39
39
|
case 0:
|
|
@@ -47,26 +47,25 @@ export default function (props) {
|
|
|
47
47
|
}
|
|
48
48
|
setEditableKeys([]);
|
|
49
49
|
setEditableValues([]);
|
|
50
|
+
setSelectedRows([]);
|
|
50
51
|
if (modalContext.inModal) {
|
|
51
|
-
_context.next =
|
|
52
|
+
_context.next = 8;
|
|
52
53
|
break;
|
|
53
54
|
}
|
|
54
55
|
// 如果不在 modal 中,则使用 routerNavigateTo
|
|
55
|
-
|
|
56
|
-
if (tabsContext.inTabs) {
|
|
57
|
-
only.push('tabs');
|
|
58
|
-
}
|
|
56
|
+
|
|
59
57
|
routerNavigateTo(searchUrl, {
|
|
60
58
|
method: 'get',
|
|
61
59
|
data: data,
|
|
62
60
|
preserveScroll: true,
|
|
63
61
|
preserveState: true,
|
|
64
|
-
only: only,
|
|
65
62
|
onSuccess: function onSuccess(e) {
|
|
66
63
|
var props = e.props;
|
|
67
64
|
if (tabsContext.inTabs) {
|
|
68
65
|
props = getValueByPath(props, tabsContext.propsPath);
|
|
69
66
|
}
|
|
67
|
+
setToolActions(props.actions);
|
|
68
|
+
setColumns(props.columns);
|
|
70
69
|
setLastQuery(data);
|
|
71
70
|
setDataSource(postData(props.dataSource));
|
|
72
71
|
setExtraRenderValues(props.extraRenderValues);
|
|
@@ -77,16 +76,16 @@ export default function (props) {
|
|
|
77
76
|
}
|
|
78
77
|
});
|
|
79
78
|
return _context.abrupt("return");
|
|
80
|
-
case
|
|
81
|
-
_context.prev =
|
|
82
|
-
_context.next =
|
|
79
|
+
case 8:
|
|
80
|
+
_context.prev = 8;
|
|
81
|
+
_context.next = 11;
|
|
83
82
|
return http.get(searchUrl, {
|
|
84
83
|
params: data,
|
|
85
84
|
headers: {
|
|
86
85
|
'X-Table-Search': '1'
|
|
87
86
|
}
|
|
88
87
|
});
|
|
89
|
-
case
|
|
88
|
+
case 11:
|
|
90
89
|
res = _context.sent;
|
|
91
90
|
if (res.data.pagination) {
|
|
92
91
|
setPagination(_objectSpread(_objectSpread({}, res.data.pagination), {}, {
|
|
@@ -101,36 +100,25 @@ export default function (props) {
|
|
|
101
100
|
data: res.data.dataSource || [],
|
|
102
101
|
success: true
|
|
103
102
|
});
|
|
104
|
-
case
|
|
105
|
-
_context.prev =
|
|
103
|
+
case 16:
|
|
104
|
+
_context.prev = 16;
|
|
106
105
|
setLoading(false);
|
|
107
|
-
return _context.finish(
|
|
108
|
-
case
|
|
106
|
+
return _context.finish(16);
|
|
107
|
+
case 19:
|
|
109
108
|
case "end":
|
|
110
109
|
return _context.stop();
|
|
111
110
|
}
|
|
112
|
-
}, _callee, null, [[
|
|
111
|
+
}, _callee, null, [[8,, 16, 19]]);
|
|
113
112
|
}));
|
|
114
113
|
return function request(_x, _x2, _x3) {
|
|
115
114
|
return _ref.apply(this, arguments);
|
|
116
115
|
};
|
|
117
116
|
}();
|
|
118
|
-
var columns = useMemo(function () {
|
|
119
|
-
var _cloneDeep;
|
|
120
|
-
return (_cloneDeep = cloneDeep(props.columns)) === null || _cloneDeep === void 0 ? void 0 : _cloneDeep.map(function (c) {
|
|
121
|
-
c.key = c.dataIndex;
|
|
122
|
-
commonHandler(c);
|
|
123
|
-
if (container.schemaHandler[c.valueType]) {
|
|
124
|
-
return container.schemaHandler[c.valueType](c);
|
|
125
|
-
}
|
|
126
|
-
return c;
|
|
127
|
-
});
|
|
128
|
-
}, [props.columns]);
|
|
129
117
|
var postData = function postData(data) {
|
|
130
118
|
if (!isArray(data)) {
|
|
131
119
|
return data;
|
|
132
120
|
}
|
|
133
|
-
|
|
121
|
+
realColumns === null || realColumns === void 0 || realColumns.map(function (column) {
|
|
134
122
|
switch (column.valueType) {
|
|
135
123
|
case 'dateTime':
|
|
136
124
|
data = data.map(function (row) {
|
|
@@ -195,6 +183,25 @@ export default function (props) {
|
|
|
195
183
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
196
184
|
extraRenderValues = _useState20[0],
|
|
197
185
|
setExtraRenderValues = _useState20[1];
|
|
186
|
+
var _useState21 = useState(props.actions),
|
|
187
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
188
|
+
toolActions = _useState22[0],
|
|
189
|
+
setToolActions = _useState22[1];
|
|
190
|
+
var _useState23 = useState(props.columns),
|
|
191
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
192
|
+
columns = _useState24[0],
|
|
193
|
+
setColumns = _useState24[1];
|
|
194
|
+
var realColumns = useMemo(function () {
|
|
195
|
+
var _cloneDeep;
|
|
196
|
+
return (_cloneDeep = cloneDeep(columns)) === null || _cloneDeep === void 0 ? void 0 : _cloneDeep.map(function (c) {
|
|
197
|
+
c.key = c.dataIndex;
|
|
198
|
+
commonHandler(c);
|
|
199
|
+
if (container.schemaHandler[c.valueType]) {
|
|
200
|
+
return container.schemaHandler[c.valueType](c);
|
|
201
|
+
}
|
|
202
|
+
return c;
|
|
203
|
+
});
|
|
204
|
+
}, [columns]);
|
|
198
205
|
var modalContext = useContext(ModalContext);
|
|
199
206
|
var tabsContext = useContext(TabsContext);
|
|
200
207
|
useEffect(function () {
|
|
@@ -210,7 +217,7 @@ export default function (props) {
|
|
|
210
217
|
if (!searchUrl) {
|
|
211
218
|
var s = window.location.href;
|
|
212
219
|
s = s.replace(/page=\d+&?/, '');
|
|
213
|
-
|
|
220
|
+
realColumns.filter(function (c) {
|
|
214
221
|
return c.search !== false;
|
|
215
222
|
}).map(function (c) {
|
|
216
223
|
s = s.replace(new RegExp("".concat(c.dataIndex, "=[^&]*&?")), '');
|
|
@@ -228,6 +235,7 @@ export default function (props) {
|
|
|
228
235
|
}
|
|
229
236
|
});
|
|
230
237
|
(_formRef$current = formRef.current) === null || _formRef$current === void 0 || _formRef$current.setFieldsValue(query);
|
|
238
|
+
setLastQuery(query);
|
|
231
239
|
}
|
|
232
240
|
}
|
|
233
241
|
}, []);
|
|
@@ -255,7 +263,7 @@ export default function (props) {
|
|
|
255
263
|
}, /*#__PURE__*/React.createElement(ProTable, {
|
|
256
264
|
rowKey: props.rowKey,
|
|
257
265
|
tableClassName: 'qs-antd-table',
|
|
258
|
-
columns:
|
|
266
|
+
columns: realColumns,
|
|
259
267
|
onDataSourceChange: setDataSource,
|
|
260
268
|
dataSource: dataSource,
|
|
261
269
|
pagination: pagination,
|
|
@@ -274,7 +282,7 @@ export default function (props) {
|
|
|
274
282
|
initialValues: props.defaultSearchValue,
|
|
275
283
|
onValuesChange: function onValuesChange(changedValues, allValues) {
|
|
276
284
|
var _formRef$current2;
|
|
277
|
-
var submit =
|
|
285
|
+
var submit = realColumns.filter(function (c) {
|
|
278
286
|
if (!c.searchOnChange) {
|
|
279
287
|
return false;
|
|
280
288
|
}
|
|
@@ -330,7 +338,7 @@ export default function (props) {
|
|
|
330
338
|
toolBarRender: function toolBarRender(action) {
|
|
331
339
|
return [/*#__PURE__*/React.createElement(ToolbarActions, {
|
|
332
340
|
key: 'actions',
|
|
333
|
-
actions:
|
|
341
|
+
actions: toolActions
|
|
334
342
|
})];
|
|
335
343
|
},
|
|
336
344
|
editable: {
|
package/dist/lib/helpers.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { VisitOptions } from "@inertiajs/core/types/types";
|
|
2
|
-
import { ModalFuncProps } from "antd";
|
|
3
2
|
import { Condition, ModalOptions } from "../types";
|
|
4
3
|
export declare function replaceUrl(url: string, params: any): string;
|
|
5
4
|
export declare function replaceParams(params: Record<string, any>, data: Record<string, any>): Record<string, any>;
|
|
@@ -7,7 +6,7 @@ export declare function routerNavigateTo(url: string, config?: VisitOptions): vo
|
|
|
7
6
|
export declare function createScript(url: string): Promise<unknown>;
|
|
8
7
|
export declare function modalShow(options: ModalOptions): Promise<{
|
|
9
8
|
destroy: () => void;
|
|
10
|
-
update: (configUpdate:
|
|
9
|
+
update: (configUpdate: import("antd/es/modal/confirm").ConfigUpdate) => void;
|
|
11
10
|
}>;
|
|
12
11
|
export declare function upperFirst(str: string): string;
|
|
13
12
|
export declare function getProValueTypeMap(): any;
|
package/dist/lib/http.js
CHANGED
|
@@ -33,6 +33,7 @@ http.interceptors.response.use(function (response) {
|
|
|
33
33
|
}
|
|
34
34
|
return true;
|
|
35
35
|
};
|
|
36
|
+
// @ts-ignore
|
|
36
37
|
if ((_response$config$fetc = response.config.fetchOptions) !== null && _response$config$fetc !== void 0 && _response$config$fetc.noHandle) {
|
|
37
38
|
return response;
|
|
38
39
|
}
|
|
@@ -211,5 +211,22 @@ export var schemaHandler = {
|
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
return schema;
|
|
214
|
+
},
|
|
215
|
+
formList: function formList(schema) {
|
|
216
|
+
schema.columns = schema.columns.map(function (c) {
|
|
217
|
+
commonHandler(c);
|
|
218
|
+
if (container.schemaHandler[c.valueType]) {
|
|
219
|
+
return container.schemaHandler[c.valueType](c);
|
|
220
|
+
}
|
|
221
|
+
return c;
|
|
222
|
+
});
|
|
223
|
+
deepSet(schema, 'fieldProps.className', "qs-form-list-".concat(schema.mode));
|
|
224
|
+
switch (schema.mode) {
|
|
225
|
+
case 'form_list':
|
|
226
|
+
deepSet(schema, 'fieldProps.alwaysShowItemLabel', true);
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
console.log(schema);
|
|
230
|
+
return schema;
|
|
214
231
|
}
|
|
215
232
|
};
|