@lingxiteam/ebe-utils 0.1.33 → 0.2.0
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/es/index.d.ts +1 -1
- package/es/index.js +6 -2
- package/es/node/copyStatic.js +1 -1
- package/lib/node/copyStatic.js +6 -6
- package/lib/pcpublic/src/components/pcfactory/src/ReactECharts/ReactECharts.tsx +61 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/EditComponent/index.tsx +17 -6
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +12 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +1 -0
- package/lib/public/src/components/ExpSQLServiceModal/index.tsx +2 -2
- package/package.json +2 -2
package/es/index.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export declare const init: () => Promise<void>;
|
|
|
71
71
|
export declare const fetchData: ({ appId, services, platform, baseUrl, onProgress, needTranslatePagePathToEnglish, incrementalConstruction, hasAppFileResource, hasExtendsApp, }: CodeOptions) => Promise<{
|
|
72
72
|
options: {
|
|
73
73
|
platform: string;
|
|
74
|
-
appId:
|
|
74
|
+
appId: any;
|
|
75
75
|
pageIdMapping: any;
|
|
76
76
|
compAssetList: any;
|
|
77
77
|
baseUrl: string;
|
package/es/index.js
CHANGED
|
@@ -32,11 +32,15 @@ var isArray = function isArray(arr) {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
export var clearAppInfo = function clearAppInfo(appInfo) {
|
|
35
|
-
var includes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['appId', 'appCode', 'appName', 'applicationIcon', 'updatorId', 'updatedTime'];
|
|
35
|
+
var includes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['appId', 'appCode', 'appName', 'applicationIcon', 'updatorId', 'initialAppId', 'updatedTime'];
|
|
36
36
|
return Object.keys(appInfo || {}).reduce(function (pre, key) {
|
|
37
37
|
if (includes.includes(key)) {
|
|
38
38
|
pre[key] = appInfo[key];
|
|
39
39
|
}
|
|
40
|
+
// 如果存在 initialAppId 则需要覆盖 appId
|
|
41
|
+
if (pre.initialAppId) {
|
|
42
|
+
pre.appId = pre.initialAppId;
|
|
43
|
+
}
|
|
40
44
|
return pre;
|
|
41
45
|
}, {});
|
|
42
46
|
};
|
|
@@ -748,7 +752,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
748
752
|
pageRules = _context3.sent;
|
|
749
753
|
options = {
|
|
750
754
|
platform: getPlatform(platform),
|
|
751
|
-
appId:
|
|
755
|
+
appId: appInfo.initialAppId,
|
|
752
756
|
pageIdMapping: pageIdMapping,
|
|
753
757
|
compAssetList: compAssetList || [],
|
|
754
758
|
baseUrl: baseUrl,
|
package/es/node/copyStatic.js
CHANGED
package/lib/node/copyStatic.js
CHANGED
|
@@ -32,21 +32,21 @@ __export(copyStatic_exports, {
|
|
|
32
32
|
copyStatic: () => copyStatic
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(copyStatic_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
37
|
var copyStatic = (target, output) => {
|
|
38
38
|
const copyRecursive = (source, destination) => {
|
|
39
|
-
if (
|
|
40
|
-
if (!
|
|
41
|
-
|
|
39
|
+
if (import_fs_extra.default.lstatSync(source).isDirectory()) {
|
|
40
|
+
if (!import_fs_extra.default.existsSync(destination)) {
|
|
41
|
+
import_fs_extra.default.mkdirSync(destination);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
import_fs_extra.default.readdirSync(source).forEach((file) => {
|
|
44
44
|
const sourcePath = import_path.default.join(source, file);
|
|
45
45
|
const destinationPath = import_path.default.join(destination, file);
|
|
46
46
|
copyRecursive(sourcePath, destinationPath);
|
|
47
47
|
});
|
|
48
48
|
} else {
|
|
49
|
-
|
|
49
|
+
import_fs_extra.default.copyFileSync(source, destination);
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
copyRecursive(target, output);
|
|
@@ -458,14 +458,70 @@ const ReactECharts: LingXiFC<MyReactEChartsProps> = (props, ref) => {
|
|
|
458
458
|
obj = {
|
|
459
459
|
type,
|
|
460
460
|
...obj,
|
|
461
|
-
data:
|
|
461
|
+
data:
|
|
462
|
+
datasource?.map((j: Record<string, any>) => {
|
|
463
|
+
if (
|
|
464
|
+
Object.prototype.toString.call(chartColor) ===
|
|
465
|
+
'[object Object]'
|
|
466
|
+
) {
|
|
467
|
+
if (chartColor.targetVal) {
|
|
468
|
+
const itemStyle = sandBoxSafeRun(chartColor.targetVal, {
|
|
469
|
+
charItem: j,
|
|
470
|
+
});
|
|
471
|
+
if (typeof itemStyle === 'string') {
|
|
472
|
+
return {
|
|
473
|
+
value: j[`y${i}`],
|
|
474
|
+
itemStyle: {
|
|
475
|
+
color: itemStyle,
|
|
476
|
+
},
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
if (
|
|
480
|
+
Object.prototype.toString.call(itemStyle) ===
|
|
481
|
+
'[object Object]'
|
|
482
|
+
) {
|
|
483
|
+
return {
|
|
484
|
+
value: j[`y${i}`],
|
|
485
|
+
itemStyle,
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return j[`y${i}`];
|
|
491
|
+
}) || [],
|
|
462
492
|
};
|
|
463
493
|
if (isDataMap) {
|
|
464
494
|
obj.data =
|
|
465
|
-
datasource?.map(
|
|
466
|
-
(
|
|
467
|
-
|
|
468
|
-
|
|
495
|
+
datasource?.map((j: Record<string, any>) => {
|
|
496
|
+
if (
|
|
497
|
+
Object.prototype.toString.call(chartColor) ===
|
|
498
|
+
'[object Object]'
|
|
499
|
+
) {
|
|
500
|
+
if (chartColor.targetVal) {
|
|
501
|
+
const itemStyle = sandBoxSafeRun(chartColor.targetVal, {
|
|
502
|
+
charItem: j,
|
|
503
|
+
});
|
|
504
|
+
if (typeof itemStyle === 'string') {
|
|
505
|
+
return {
|
|
506
|
+
value: j[(transferDataMap as any)[`y${i}`] || `y${i}`],
|
|
507
|
+
itemStyle: {
|
|
508
|
+
color: itemStyle,
|
|
509
|
+
},
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
if (
|
|
513
|
+
Object.prototype.toString.call(itemStyle) ===
|
|
514
|
+
'[object Object]'
|
|
515
|
+
) {
|
|
516
|
+
return {
|
|
517
|
+
value: j[(transferDataMap as any)[`y${i}`] || `y${i}`],
|
|
518
|
+
itemStyle,
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return j[(transferDataMap as any)[`y${i}`] || `y${i}`];
|
|
524
|
+
}) || [];
|
|
469
525
|
}
|
|
470
526
|
if (
|
|
471
527
|
obj.areaStyle?.showColor &&
|
|
@@ -163,6 +163,7 @@ const EditComponent: React.FC<MyEditComponent> = (props) => {
|
|
|
163
163
|
}, [format, edittype, initValue]);
|
|
164
164
|
|
|
165
165
|
const initialValueType = typeof initialValue;
|
|
166
|
+
const isNaNValue = useMemo(() => isNaN(initialValue), [initialValue]);
|
|
166
167
|
|
|
167
168
|
const validateDateCustomExpress = useMemo<any>(() => {
|
|
168
169
|
if (customExpression && customExpression.code && sandBoxSafeRun) {
|
|
@@ -230,15 +231,25 @@ const EditComponent: React.FC<MyEditComponent> = (props) => {
|
|
|
230
231
|
});
|
|
231
232
|
};
|
|
232
233
|
res = getRules(res);
|
|
234
|
+
const requiredType = rules?.[0]?.type;
|
|
233
235
|
// 添加数组类型校验
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
if (requiredType && requiredType !== initialValueType) {
|
|
237
|
+
// 数字输入框时,格式为数字型字符串视为合法类型
|
|
238
|
+
if (
|
|
239
|
+
!(
|
|
240
|
+
requiredType === 'number' &&
|
|
241
|
+
initialValueType === 'string' &&
|
|
242
|
+
!isNaNValue
|
|
243
|
+
)
|
|
244
|
+
) {
|
|
245
|
+
res.push({
|
|
246
|
+
type: requiredType,
|
|
247
|
+
message: getLocale?.('Table.dateTypeWarning'),
|
|
248
|
+
});
|
|
249
|
+
}
|
|
239
250
|
}
|
|
240
251
|
return res?.length > 0 ? res : null;
|
|
241
|
-
}, [initialValueType, rules, validateDateCustomExpress]);
|
|
252
|
+
}, [initialValueType, isNaNValue, rules, validateDateCustomExpress]);
|
|
242
253
|
|
|
243
254
|
const getDisabledDate = useCallback(
|
|
244
255
|
(current: Moment) => {
|
|
@@ -21,6 +21,7 @@ const useDataSource = (props: any) => {
|
|
|
21
21
|
setReplaceBoundDataSource,
|
|
22
22
|
outerDataSource,
|
|
23
23
|
outerDataSourceRef,
|
|
24
|
+
setCurrentPage,
|
|
24
25
|
} = props;
|
|
25
26
|
|
|
26
27
|
const [dataSource, setDataSource] = useState<any[]>([]);
|
|
@@ -155,7 +156,17 @@ const useDataSource = (props: any) => {
|
|
|
155
156
|
};
|
|
156
157
|
});
|
|
157
158
|
setDataSource(fd);
|
|
158
|
-
|
|
159
|
+
if (!hasPageChangeEvent && page && typeof setCurrentPage === 'function') {
|
|
160
|
+
// 前端分页时,数据变化重置分页
|
|
161
|
+
setCurrentPage(1);
|
|
162
|
+
}
|
|
163
|
+
}, [
|
|
164
|
+
outerDataSourceRef.current,
|
|
165
|
+
currentRowKey,
|
|
166
|
+
boundDataSource,
|
|
167
|
+
hasPageChangeEvent,
|
|
168
|
+
page,
|
|
169
|
+
]);
|
|
159
170
|
|
|
160
171
|
return {
|
|
161
172
|
outerDataSource,
|
|
@@ -228,12 +228,12 @@ const ExpSQLServiceModal = forwardRef<
|
|
|
228
228
|
|
|
229
229
|
const onCheckAllChange = (e: any) => {
|
|
230
230
|
if (e.target.checked) {
|
|
231
|
-
setSelectedKeys(curDataSource.map((item) => item.
|
|
231
|
+
setSelectedKeys(curDataSource.map((item) => item.code));
|
|
232
232
|
} else {
|
|
233
233
|
setSelectedKeys(
|
|
234
234
|
curDataSource
|
|
235
235
|
.filter((item) => item.isRequired === 'T')
|
|
236
|
-
.map((item) => item.
|
|
236
|
+
.map((item) => item.code),
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
239
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxiteam/ebe-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@babel/types": "^7.12.12",
|
|
20
20
|
"cac": "^6.7.14",
|
|
21
21
|
"fs-extra": "9.x",
|
|
22
|
-
"@lingxiteam/ebe": "0.
|
|
22
|
+
"@lingxiteam/ebe": "0.2.0"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|