fan-standard-comp 4.1.2 → 4.1.4
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/fan-standard-comp.min.css +1 -1
- package/dist/fan-standard-comp.min.js +1 -1
- package/es/CompositeTable/index.d.ts +0 -0
- package/es/CompositeTable/index.js +211 -0
- package/es/CompositeTable/index.style.d.ts +5 -0
- package/es/CompositeTable/index.style.js +27 -0
- package/es/FormComp/FieldComponent/ExtensionField.d.ts +2 -2
- package/es/FormComp/FieldComponent/ExtensionField.js +1 -1
- package/es/FormComp/FieldComponent/index.js +2 -6
- package/es/StandardContent/ContentHeader.js +17 -25
- package/es/StandardContent/SubfieldContent.js +12 -9
- package/es/StandardContent/WrapperContent.js +9 -8
- package/es/StandardContent/styles/Subfield.js +18 -5
- package/es/StandardContent/styles/Wrapper.js +13 -2
- package/es/StandardContent/styles/index.less +8 -2
- package/es/StandardFilter/index.js +52 -28
- package/es/StandardFilter/style/FilterStyle.js +3 -2
- package/es/StandardFilter/style/index.less +7 -0
- package/es/StandardForm/index.js +3 -1
- package/es/StandardTable/index.d.ts +4 -28
- package/es/StandardTable/index.js +65 -5
- package/es/StandardTable/types.d.ts +33 -0
- package/es/StandardTable/types.js +1 -0
- package/es/StandardTablePro/index.d.ts +5 -7
- package/es/StandardTablePro/index.js +246 -84
- package/es/StandardTablePro/types.d.ts +29 -0
- package/es/StandardTablePro/types.js +1 -0
- package/es/StandardTablePro/useFetchData.d.ts +0 -0
- package/es/StandardTablePro/useFetchData.js +275 -0
- package/es/StandardTablePro/utils.d.ts +3 -0
- package/es/StandardTablePro/utils.js +49 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -0
- package/es/types.d.ts +1 -0
- package/es/types.js +1 -0
- package/es/utils/ValueFormat.d.ts +1 -1
- package/es/utils/ValueFormat.js +42 -27
- package/es/utils/getParentNodes.js +1 -1
- package/es/utils/urlUtils.d.ts +6 -0
- package/es/utils/urlUtils.js +26 -0
- package/lib/CompositeTable/index.d.ts +0 -0
- package/lib/CompositeTable/index.js +212 -0
- package/lib/CompositeTable/index.style.d.ts +5 -0
- package/lib/CompositeTable/index.style.js +33 -0
- package/lib/FormComp/FieldComponent/ExtensionField.d.ts +2 -2
- package/lib/FormComp/FieldComponent/ExtensionField.js +1 -1
- package/lib/FormComp/FieldComponent/index.js +2 -6
- package/lib/StandardContent/ContentHeader.js +16 -24
- package/lib/StandardContent/SubfieldContent.js +12 -9
- package/lib/StandardContent/WrapperContent.js +9 -8
- package/lib/StandardContent/styles/Subfield.js +18 -5
- package/lib/StandardContent/styles/Wrapper.js +13 -2
- package/lib/StandardContent/styles/index.less +8 -2
- package/lib/StandardFilter/index.js +52 -28
- package/lib/StandardFilter/style/FilterStyle.js +3 -2
- package/lib/StandardFilter/style/index.less +7 -0
- package/lib/StandardForm/index.js +3 -1
- package/lib/StandardTable/index.d.ts +4 -28
- package/lib/StandardTable/index.js +64 -4
- package/lib/StandardTable/types.d.ts +33 -0
- package/lib/StandardTable/types.js +5 -0
- package/lib/StandardTablePro/index.d.ts +5 -7
- package/lib/StandardTablePro/index.js +244 -82
- package/lib/StandardTablePro/types.d.ts +29 -0
- package/lib/StandardTablePro/types.js +5 -0
- package/lib/StandardTablePro/useFetchData.d.ts +0 -0
- package/lib/StandardTablePro/useFetchData.js +276 -0
- package/lib/StandardTablePro/utils.d.ts +3 -0
- package/lib/StandardTablePro/utils.js +55 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +20 -0
- package/lib/types.d.ts +1 -0
- package/lib/types.js +16 -0
- package/lib/utils/ValueFormat.d.ts +1 -1
- package/lib/utils/ValueFormat.js +42 -29
- package/lib/utils/getParentNodes.js +1 -1
- package/lib/utils/urlUtils.d.ts +6 -0
- package/lib/utils/urlUtils.js +27 -3
- package/package.json +2 -2
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
// import {
|
|
2
|
+
// runFunction,
|
|
3
|
+
// useDebounceFn,
|
|
4
|
+
// useDeepCompareEffect,
|
|
5
|
+
// useMountMergeState,
|
|
6
|
+
// usePrevious,
|
|
7
|
+
// useRefFunction,
|
|
8
|
+
// } from '@ant-design/pro-utils';
|
|
9
|
+
// import { useEffect, useLayoutEffect, useRef } from 'react';
|
|
10
|
+
// import type { PageInfo, RequestData, UseFetchDataAction, UseFetchProps } from './typing';
|
|
11
|
+
// import { postDataPipeline } from './utils/index';
|
|
12
|
+
//
|
|
13
|
+
// /**
|
|
14
|
+
// * 组合用户的配置和默认值
|
|
15
|
+
// *
|
|
16
|
+
// * @param param0
|
|
17
|
+
// */
|
|
18
|
+
// const mergeOptionAndPageInfo = ({ pageInfo }: UseFetchProps) => {
|
|
19
|
+
// if (pageInfo) {
|
|
20
|
+
// const { current, defaultCurrent, pageSize, defaultPageSize } = pageInfo;
|
|
21
|
+
// return {
|
|
22
|
+
// current: current || defaultCurrent || 1,
|
|
23
|
+
// total: 0,
|
|
24
|
+
// pageSize: pageSize || defaultPageSize || 20,
|
|
25
|
+
// };
|
|
26
|
+
// }
|
|
27
|
+
// return { current: 1, total: 0, pageSize: 20 };
|
|
28
|
+
// };
|
|
29
|
+
//
|
|
30
|
+
// const useFetchData = <T extends RequestData<any>>(
|
|
31
|
+
// getData: undefined | ((params?: { pageSize: number; current: number }) => Promise<T>),
|
|
32
|
+
// defaultData: any[] | undefined,
|
|
33
|
+
// options: UseFetchProps,
|
|
34
|
+
// ): UseFetchDataAction => {
|
|
35
|
+
// const umountRef = useRef<boolean>(false);
|
|
36
|
+
// const { onLoad, manual, polling, onRequestError, debounceTime = 20 } = options || {};
|
|
37
|
+
//
|
|
38
|
+
// /** 是否首次加载的指示器 */
|
|
39
|
+
// const manualRequestRef = useRef<boolean>(manual);
|
|
40
|
+
//
|
|
41
|
+
// /** 轮询的setTime ID 存储 */
|
|
42
|
+
// const pollingSetTimeRef = useRef<any>();
|
|
43
|
+
// const [list, setList] = useMountMergeState<any[] | undefined>(defaultData, {
|
|
44
|
+
// value: options?.dataSource,
|
|
45
|
+
// onChange: options?.onDataSourceChange,
|
|
46
|
+
// });
|
|
47
|
+
//
|
|
48
|
+
// const [tableLoading, setTableLoading] = useMountMergeState<UseFetchDataAction['loading']>(false, {
|
|
49
|
+
// value: options?.loading,
|
|
50
|
+
// onChange: options?.onLoadingChange,
|
|
51
|
+
// });
|
|
52
|
+
//
|
|
53
|
+
// const requesting = useRef(false);
|
|
54
|
+
//
|
|
55
|
+
// const [pageInfo, setPageInfoState] = useMountMergeState<PageInfo>(
|
|
56
|
+
// () => mergeOptionAndPageInfo(options),
|
|
57
|
+
// {
|
|
58
|
+
// onChange: options?.onPageInfoChange,
|
|
59
|
+
// },
|
|
60
|
+
// );
|
|
61
|
+
// const setPageInfo = useRefFunction((changePageInfo: PageInfo) => {
|
|
62
|
+
// if (
|
|
63
|
+
// changePageInfo.current !== pageInfo.current ||
|
|
64
|
+
// changePageInfo.pageSize !== pageInfo.pageSize ||
|
|
65
|
+
// changePageInfo.total !== pageInfo.total
|
|
66
|
+
// ) {
|
|
67
|
+
// setPageInfoState(changePageInfo);
|
|
68
|
+
// }
|
|
69
|
+
// });
|
|
70
|
+
//
|
|
71
|
+
// const [pollingLoading, setPollingLoading] = useMountMergeState(false);
|
|
72
|
+
//
|
|
73
|
+
// // Batching update https://github.com/facebook/react/issues/14259
|
|
74
|
+
// const setDataAndLoading = (newData: T[], dataTotal: number) => {
|
|
75
|
+
// setList(newData);
|
|
76
|
+
//
|
|
77
|
+
// if (pageInfo?.total !== dataTotal) {
|
|
78
|
+
// setPageInfo({
|
|
79
|
+
// ...pageInfo,
|
|
80
|
+
// total: dataTotal || newData.length,
|
|
81
|
+
// });
|
|
82
|
+
// }
|
|
83
|
+
// };
|
|
84
|
+
//
|
|
85
|
+
// // pre state
|
|
86
|
+
// const prePage = usePrevious(pageInfo?.current);
|
|
87
|
+
// const prePageSize = usePrevious(pageInfo?.pageSize);
|
|
88
|
+
// const prePolling = usePrevious(polling);
|
|
89
|
+
//
|
|
90
|
+
// const { effects = [] } = options || {};
|
|
91
|
+
//
|
|
92
|
+
// /**
|
|
93
|
+
// * 不这样做会导致状态不更新
|
|
94
|
+
// *
|
|
95
|
+
// * https://github.com/ant-design/pro-components/issues/4390
|
|
96
|
+
// */
|
|
97
|
+
// const requestFinally = useRefFunction(() => {
|
|
98
|
+
// if (typeof tableLoading === 'object') {
|
|
99
|
+
// setTableLoading({ ...tableLoading, spinning: false });
|
|
100
|
+
// } else {
|
|
101
|
+
// setTableLoading(false);
|
|
102
|
+
// }
|
|
103
|
+
// setPollingLoading(false);
|
|
104
|
+
// });
|
|
105
|
+
// /** 请求数据 */
|
|
106
|
+
// const fetchList = async (isPolling: boolean) => {
|
|
107
|
+
// if ((tableLoading && typeof tableLoading === 'boolean') || requesting.current || !getData) {
|
|
108
|
+
// return [];
|
|
109
|
+
// }
|
|
110
|
+
//
|
|
111
|
+
// // 需要手动触发的首次请求
|
|
112
|
+
// if (manualRequestRef.current) {
|
|
113
|
+
// manualRequestRef.current = false;
|
|
114
|
+
// return [];
|
|
115
|
+
// }
|
|
116
|
+
// if (!isPolling) {
|
|
117
|
+
// if (typeof tableLoading === 'object') {
|
|
118
|
+
// setTableLoading({ ...tableLoading, spinning: true });
|
|
119
|
+
// } else {
|
|
120
|
+
// setTableLoading(true);
|
|
121
|
+
// }
|
|
122
|
+
// } else {
|
|
123
|
+
// setPollingLoading(true);
|
|
124
|
+
// }
|
|
125
|
+
//
|
|
126
|
+
// requesting.current = true;
|
|
127
|
+
// const { pageSize, current } = pageInfo || {};
|
|
128
|
+
// try {
|
|
129
|
+
// const pageParams =
|
|
130
|
+
// options?.pageInfo !== false
|
|
131
|
+
// ? {
|
|
132
|
+
// current,
|
|
133
|
+
// pageSize,
|
|
134
|
+
// }
|
|
135
|
+
// : undefined;
|
|
136
|
+
//
|
|
137
|
+
// const { data = [], success, total = 0, ...rest } = (await getData(pageParams)) || {};
|
|
138
|
+
// // 如果失败了,直接返回,不走剩下的逻辑了
|
|
139
|
+
// if (success === false) return [];
|
|
140
|
+
//
|
|
141
|
+
// const responseData = postDataPipeline<T[]>(
|
|
142
|
+
// data!,
|
|
143
|
+
// [options.postData].filter((item) => item) as any,
|
|
144
|
+
// );
|
|
145
|
+
// setDataAndLoading(responseData, total);
|
|
146
|
+
// onLoad?.(responseData, rest);
|
|
147
|
+
// return responseData;
|
|
148
|
+
// } catch (e) {
|
|
149
|
+
// // 如果没有传递这个方法的话,需要把错误抛出去,以免吞掉错误
|
|
150
|
+
// if (onRequestError === undefined) throw new Error(e as string);
|
|
151
|
+
// if (list === undefined) setList([]);
|
|
152
|
+
// onRequestError(e as Error);
|
|
153
|
+
// } finally {
|
|
154
|
+
// requesting.current = false;
|
|
155
|
+
// requestFinally();
|
|
156
|
+
// }
|
|
157
|
+
//
|
|
158
|
+
// return [];
|
|
159
|
+
// };
|
|
160
|
+
//
|
|
161
|
+
// const fetchListDebounce = useDebounceFn(async (isPolling: boolean) => {
|
|
162
|
+
// if (pollingSetTimeRef.current) {
|
|
163
|
+
// clearTimeout(pollingSetTimeRef.current);
|
|
164
|
+
// }
|
|
165
|
+
// const msg = await fetchList(isPolling);
|
|
166
|
+
//
|
|
167
|
+
// // 把判断要不要轮询的逻辑放到后面来这样可以保证数据是根据当前来
|
|
168
|
+
// // 放到请求前面会导致数据是上一次的
|
|
169
|
+
// const needPolling = runFunction(polling, msg);
|
|
170
|
+
//
|
|
171
|
+
// // 如果需要轮询,搞个一段时间后执行
|
|
172
|
+
// // 如果解除了挂载,删除一下
|
|
173
|
+
// if (needPolling && !umountRef.current) {
|
|
174
|
+
// pollingSetTimeRef.current = setTimeout(() => {
|
|
175
|
+
// fetchListDebounce.run(needPolling);
|
|
176
|
+
// // 这里判断最小要2000ms,不然一直loading
|
|
177
|
+
// }, Math.max(needPolling, 2000));
|
|
178
|
+
// }
|
|
179
|
+
// return msg;
|
|
180
|
+
// }, debounceTime || 10);
|
|
181
|
+
//
|
|
182
|
+
// // 如果轮询结束了,直接销毁定时器
|
|
183
|
+
// useEffect(() => {
|
|
184
|
+
// if (!polling) {
|
|
185
|
+
// clearTimeout(pollingSetTimeRef.current);
|
|
186
|
+
// }
|
|
187
|
+
// if (!prePolling && polling) {
|
|
188
|
+
// fetchListDebounce.run(true);
|
|
189
|
+
// }
|
|
190
|
+
// return () => {
|
|
191
|
+
// clearTimeout(pollingSetTimeRef.current);
|
|
192
|
+
// };
|
|
193
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
194
|
+
// }, [polling]);
|
|
195
|
+
//
|
|
196
|
+
// useLayoutEffect(() => {
|
|
197
|
+
// umountRef.current = false;
|
|
198
|
+
//
|
|
199
|
+
// return () => {
|
|
200
|
+
// umountRef.current = true;
|
|
201
|
+
// };
|
|
202
|
+
// }, []);
|
|
203
|
+
//
|
|
204
|
+
// /** PageIndex 改变的时候自动刷新 */
|
|
205
|
+
// useEffect(() => {
|
|
206
|
+
// const { current, pageSize } = pageInfo || {};
|
|
207
|
+
// // 如果上次的页码为空或者两次页码等于是没必要查询的
|
|
208
|
+
// // 如果 pageSize 发生变化是需要查询的,所以又加了 prePageSize
|
|
209
|
+
// if ((!prePage || prePage === current) && (!prePageSize || prePageSize === pageSize)) {
|
|
210
|
+
// return;
|
|
211
|
+
// }
|
|
212
|
+
//
|
|
213
|
+
// if ((options.pageInfo && list && list?.length > pageSize) || 0) {
|
|
214
|
+
// return;
|
|
215
|
+
// }
|
|
216
|
+
//
|
|
217
|
+
// // 如果 list 的长度大于 pageSize 的长度
|
|
218
|
+
// // 说明是一个假分页
|
|
219
|
+
// // (pageIndex - 1 || 1) 至少要第一页
|
|
220
|
+
// // 在第一页大于 10
|
|
221
|
+
// // 第二页也应该是大于 10
|
|
222
|
+
// if (current !== undefined && list && list.length <= pageSize) {
|
|
223
|
+
// fetchListDebounce.run(false);
|
|
224
|
+
// }
|
|
225
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
226
|
+
// }, [pageInfo?.current]);
|
|
227
|
+
//
|
|
228
|
+
// // pageSize 修改后返回第一页
|
|
229
|
+
// useEffect(() => {
|
|
230
|
+
// if (!prePageSize) {
|
|
231
|
+
// return;
|
|
232
|
+
// }
|
|
233
|
+
// fetchListDebounce.run(false);
|
|
234
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
235
|
+
// }, [pageInfo?.pageSize]);
|
|
236
|
+
//
|
|
237
|
+
// useDeepCompareEffect(() => {
|
|
238
|
+
// fetchListDebounce.run(false);
|
|
239
|
+
// if (!manual) {
|
|
240
|
+
// manualRequestRef.current = false;
|
|
241
|
+
// }
|
|
242
|
+
// return () => {
|
|
243
|
+
// fetchListDebounce.cancel();
|
|
244
|
+
// };
|
|
245
|
+
// }, [...effects, manual]);
|
|
246
|
+
//
|
|
247
|
+
// return {
|
|
248
|
+
// dataSource: list!,
|
|
249
|
+
// setDataSource: setList,
|
|
250
|
+
// loading: tableLoading,
|
|
251
|
+
// reload: async () => {
|
|
252
|
+
// await fetchListDebounce.run(false);
|
|
253
|
+
// },
|
|
254
|
+
// pageInfo,
|
|
255
|
+
// pollingLoading,
|
|
256
|
+
// reset: async () => {
|
|
257
|
+
// const { pageInfo: optionPageInfo } = options || {};
|
|
258
|
+
// const { defaultCurrent = 1, defaultPageSize = 20 } = optionPageInfo || {};
|
|
259
|
+
// const initialPageInfo = {
|
|
260
|
+
// current: defaultCurrent,
|
|
261
|
+
// total: 0,
|
|
262
|
+
// pageSize: defaultPageSize,
|
|
263
|
+
// };
|
|
264
|
+
// setPageInfo(initialPageInfo);
|
|
265
|
+
// },
|
|
266
|
+
// setPageInfo: async (info) => {
|
|
267
|
+
// setPageInfo({
|
|
268
|
+
// ...pageInfo,
|
|
269
|
+
// ...info,
|
|
270
|
+
// });
|
|
271
|
+
// },
|
|
272
|
+
// };
|
|
273
|
+
// };
|
|
274
|
+
//
|
|
275
|
+
// export default useFetchData;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
// /**
|
|
6
|
+
// * 获取用户的 action 信息
|
|
7
|
+
// *
|
|
8
|
+
// * @param actionRef
|
|
9
|
+
// * @param counter
|
|
10
|
+
// * @param onCleanSelected
|
|
11
|
+
// */
|
|
12
|
+
|
|
13
|
+
export function useActionType(ref, action
|
|
14
|
+
// props: {
|
|
15
|
+
// // fullScreen: () => void;
|
|
16
|
+
// // onCleanSelected: () => void;
|
|
17
|
+
// // resetAll: () => void;
|
|
18
|
+
// // editableUtils: UseEditableUtilType;
|
|
19
|
+
// },
|
|
20
|
+
) {
|
|
21
|
+
/** 这里生成action的映射,保证 action 总是使用的最新 只需要渲染一次即可 */
|
|
22
|
+
var userAction = {
|
|
23
|
+
// ...props.editableUtils,
|
|
24
|
+
pageInfo: action.pageInfo,
|
|
25
|
+
pagination: action.pagination,
|
|
26
|
+
dataSource: action.dataSource,
|
|
27
|
+
keywords: action.keywords,
|
|
28
|
+
reload: function () {
|
|
29
|
+
var _reload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resetPageIndex) {
|
|
30
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
31
|
+
while (1) switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
_context.next = 2;
|
|
34
|
+
return action === null || action === void 0 ? void 0 : action.reload();
|
|
35
|
+
case 2:
|
|
36
|
+
case "end":
|
|
37
|
+
return _context.stop();
|
|
38
|
+
}
|
|
39
|
+
}, _callee);
|
|
40
|
+
}));
|
|
41
|
+
function reload(_x) {
|
|
42
|
+
return _reload.apply(this, arguments);
|
|
43
|
+
}
|
|
44
|
+
return reload;
|
|
45
|
+
}()
|
|
46
|
+
};
|
|
47
|
+
// eslint-disable-next-line no-param-reassign
|
|
48
|
+
ref.current = userAction;
|
|
49
|
+
}
|
package/es/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { default as SplitterLayout } from './StandardContent/SplitterLayout';
|
|
|
8
8
|
export { default as RefactorTree } from './RefactorTree';
|
|
9
9
|
export { default as StandardPanel } from './StandardPanel';
|
|
10
10
|
export { default as StandardTable } from './StandardTable';
|
|
11
|
+
export { default as StandardTablePro } from './StandardTablePro';
|
|
11
12
|
export { default as StandardForm } from './StandardForm';
|
|
12
13
|
export { default as StepForm } from './StandardForm/StepForm';
|
|
13
14
|
export { default as TabForm } from './StandardForm/TabForm';
|
|
@@ -25,5 +26,6 @@ export * from './components';
|
|
|
25
26
|
export * from './utils';
|
|
26
27
|
export * from './data';
|
|
27
28
|
export * from './ConfigContext';
|
|
29
|
+
export * from './types';
|
|
28
30
|
export { default as ImageGallery } from './ImageGallery/index';
|
|
29
31
|
export { default as ImagePreview } from './ImageGallery/ImagePreview';
|
package/es/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { default as RefactorTree } from "./RefactorTree";
|
|
|
13
13
|
// // 通用组件
|
|
14
14
|
export { default as StandardPanel } from "./StandardPanel";
|
|
15
15
|
export { default as StandardTable } from "./StandardTable";
|
|
16
|
+
export { default as StandardTablePro } from "./StandardTablePro";
|
|
16
17
|
export { default as StandardForm } from "./StandardForm";
|
|
17
18
|
export { default as StepForm } from "./StandardForm/StepForm";
|
|
18
19
|
export { default as TabForm } from "./StandardForm/TabForm";
|
|
@@ -38,6 +39,8 @@ export * from "./utils";
|
|
|
38
39
|
export * from "./data";
|
|
39
40
|
// 上下文
|
|
40
41
|
export * from "./ConfigContext";
|
|
42
|
+
// 类型
|
|
43
|
+
export * from "./types";
|
|
41
44
|
|
|
42
45
|
// 图集
|
|
43
46
|
export { default as ImageGallery } from "./ImageGallery/index";
|
package/es/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './StandardTable/types';
|
package/es/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StandardTable/types";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const UtilValueFormat: (fieldsValue: any, formItemGroup: any) => any;
|
|
1
|
+
export declare const UtilValueFormat: (fieldsValue: any, formItemGroup: any, dateFormatter?: string) => any;
|
|
2
2
|
export declare const dateOrTimeStringToDayjs: () => void;
|
|
3
3
|
export declare const isDate: (value: any) => boolean;
|
package/es/utils/ValueFormat.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
1
7
|
// @ts-nocheck
|
|
2
8
|
import dayjs from 'dayjs';
|
|
3
9
|
/*
|
|
@@ -6,37 +12,46 @@ import dayjs from 'dayjs';
|
|
|
6
12
|
* @params {Array} formItemGroup: 表单组
|
|
7
13
|
* */
|
|
8
14
|
var dateFieldTypes = ['datePicker', 'dateTimePicker', 'rangePicker', 'rangeTimePicker', 'timePicker', 'timePickerRange'];
|
|
9
|
-
export var UtilValueFormat = function UtilValueFormat(fieldsValue, formItemGroup) {
|
|
15
|
+
export var UtilValueFormat = function UtilValueFormat(fieldsValue, formItemGroup, dateFormatter) {
|
|
10
16
|
formItemGroup && formItemGroup.forEach(function (item) {
|
|
11
17
|
var _item$protoConfig, _fieldsValue, _item$protoConfig2, _fieldsValue$, _item$protoConfig3, _fieldsValue$2, _item$protoConfig4;
|
|
12
18
|
if (!fieldsValue[item.filedName || item.fieldName]) return;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
if (dateFormatter === 'string') {
|
|
20
|
+
// 默认转换成字符串格式返回
|
|
21
|
+
switch (item.type) {
|
|
22
|
+
case 'datePicker':
|
|
23
|
+
case 'dateTimePicker':
|
|
24
|
+
case 'rangePicker':
|
|
25
|
+
case 'rangeTimePicker':
|
|
26
|
+
var pickerFormatNew;
|
|
27
|
+
if (item !== null && item !== void 0 && (_item$protoConfig = item.protoConfig) !== null && _item$protoConfig !== void 0 && _item$protoConfig.picker) {
|
|
28
|
+
switch (item.protoConfig.picker) {
|
|
29
|
+
case 'week':
|
|
30
|
+
pickerFormatNew = 'YYYY-wo';
|
|
31
|
+
break;
|
|
32
|
+
case 'month':
|
|
33
|
+
pickerFormatNew = 'MM月';
|
|
34
|
+
break;
|
|
35
|
+
case 'year':
|
|
36
|
+
pickerFormatNew = 'YYYY';
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
pickerFormatNew = item.type === 'datePicker' || item.type === 'rangePicker' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss';
|
|
32
43
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
fieldsValue[item.filedName || item.fieldName] = item.type === 'datePicker' || item.type === 'dateTimePicker' ? (_fieldsValue = fieldsValue[item.filedName || item.fieldName]) === null || _fieldsValue === void 0 ? void 0 : _fieldsValue.format((item === null || item === void 0 || (_item$protoConfig2 = item.protoConfig) === null || _item$protoConfig2 === void 0 ? void 0 : _item$protoConfig2.format) || pickerFormatNew) : [(_fieldsValue$ = fieldsValue[item.filedName || item.fieldName][0]) === null || _fieldsValue$ === void 0 ? void 0 : _fieldsValue$.format((item === null || item === void 0 || (_item$protoConfig3 = item.protoConfig) === null || _item$protoConfig3 === void 0 ? void 0 : _item$protoConfig3.format) || pickerFormatNew), (_fieldsValue$2 = fieldsValue[item.filedName || item.fieldName][1]) === null || _fieldsValue$2 === void 0 ? void 0 : _fieldsValue$2.format((item === null || item === void 0 || (_item$protoConfig4 = item.protoConfig) === null || _item$protoConfig4 === void 0 ? void 0 : _item$protoConfig4.format) || pickerFormatNew)];
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (item !== null && item !== void 0 && item.transform) {
|
|
51
|
+
var _item$transform;
|
|
52
|
+
var transValue = (item === null || item === void 0 || (_item$transform = item.transform) === null || _item$transform === void 0 ? void 0 : _item$transform.call(item, fieldsValue[item.filedName || item.fieldName])) || {};
|
|
53
|
+
fieldsValue = _objectSpread(_objectSpread({}, fieldsValue), transValue);
|
|
54
|
+
delete fieldsValue[item.filedName || item.fieldName]; // 删除转换的原参数名
|
|
40
55
|
}
|
|
41
56
|
});
|
|
42
57
|
return fieldsValue;
|
|
@@ -233,7 +233,7 @@ export var getNode = function getNode(list, key) {
|
|
|
233
233
|
// 深层过滤当前选中的节点
|
|
234
234
|
var deepFilterMatchItem = function deepFilterMatchItem(treeData, targetId) {
|
|
235
235
|
(treeData || []).some(function (item) {
|
|
236
|
-
if (
|
|
236
|
+
if (item[optionName.value] == targetId) {
|
|
237
237
|
matchCurrentItem = item;
|
|
238
238
|
return true;
|
|
239
239
|
}
|
package/es/utils/urlUtils.d.ts
CHANGED
|
@@ -16,3 +16,9 @@ export declare const isHttpUrl: (path: string) => boolean;
|
|
|
16
16
|
* 是否是完整的URL
|
|
17
17
|
* */
|
|
18
18
|
export declare const isUrl: (path: string) => boolean;
|
|
19
|
+
/***
|
|
20
|
+
* transSearchByColumn URL上带orders[xxx]=xxx相关参数值,转换成order排序数组
|
|
21
|
+
* @param searchParams url上的search参数
|
|
22
|
+
* @param transOptionName = 'orders' // 提交需要的字段名
|
|
23
|
+
*/
|
|
24
|
+
export declare const transSearchByColumn: (params?: any, transOptionName?: string) => any;
|
package/es/utils/urlUtils.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
1
7
|
// @ts-nocheck 文件忽略(添加到该文件的首行)
|
|
2
8
|
import { parse } from "qs";
|
|
3
9
|
|
|
@@ -63,4 +69,24 @@ var reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:
|
|
|
63
69
|
* */
|
|
64
70
|
export var isUrl = function isUrl(path) {
|
|
65
71
|
return reg.test(path);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/***
|
|
75
|
+
* transSearchByColumn URL上带orders[xxx]=xxx相关参数值,转换成order排序数组
|
|
76
|
+
* @param searchParams url上的search参数
|
|
77
|
+
* @param transOptionName = 'orders' // 提交需要的字段名
|
|
78
|
+
*/
|
|
79
|
+
export var transSearchByColumn = function transSearchByColumn(params) {
|
|
80
|
+
var transOptionName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'orders';
|
|
81
|
+
var paramsKeys = _objectSpread({}, params);
|
|
82
|
+
var paramOrders = params[transOptionName || 'orders'] || {};
|
|
83
|
+
var orders = [];
|
|
84
|
+
Object.keys(paramOrders).forEach(function (oItem) {
|
|
85
|
+
orders.push({
|
|
86
|
+
column: oItem,
|
|
87
|
+
asc: paramOrders[oItem] === 'descend'
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
paramsKeys[transOptionName || 'orders'] = orders;
|
|
91
|
+
return paramsKeys;
|
|
66
92
|
};
|
|
File without changes
|