@kmkf-fe-packages/services-components 2.2.12 → 2.3.0-rc.1
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/esm/components/File/index.d.ts +6 -6
- package/dist/esm/components/File/index.js +9 -9
- package/dist/esm/components/SubForm/children/HeaderChildFile.d.ts +30 -0
- package/dist/esm/components/SubForm/children/HeaderChildFile.js +117 -0
- package/dist/esm/components/SubForm/children/HeaderChildPic.d.ts +30 -0
- package/dist/esm/components/SubForm/children/HeaderChildPic.js +116 -0
- package/dist/esm/components/SubForm/index.js +86 -6
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentInterface, PickOption, Record } from
|
|
2
|
-
import React from
|
|
1
|
+
import { ComponentInterface, PickOption, Record } from '../../type';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
declare class BasicFile implements ComponentInterface {
|
|
4
4
|
name: string;
|
|
5
5
|
id: string;
|
|
@@ -7,14 +7,14 @@ declare class BasicFile implements ComponentInterface {
|
|
|
7
7
|
formField: string;
|
|
8
8
|
type: string;
|
|
9
9
|
rules: any[];
|
|
10
|
-
componentConfig: ComponentInterface[
|
|
10
|
+
componentConfig: ComponentInterface['componentConfig'];
|
|
11
11
|
isCombinationComponent: boolean;
|
|
12
12
|
canSort: boolean;
|
|
13
13
|
children: ComponentInterface[];
|
|
14
|
-
effects: ComponentInterface[
|
|
15
|
-
dataType: ComponentInterface[
|
|
14
|
+
effects: ComponentInterface['effects'];
|
|
15
|
+
dataType: ComponentInterface['dataType'];
|
|
16
16
|
exampleValue?: string;
|
|
17
|
-
standardDateType: ComponentInterface[
|
|
17
|
+
standardDateType: ComponentInterface['standardDateType'];
|
|
18
18
|
constructor(options: PickOption);
|
|
19
19
|
renderPc: (value: any, record: Record) => any;
|
|
20
20
|
renderLog: (r: Record) => any;
|
|
@@ -12,11 +12,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
12
12
|
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; }
|
|
13
13
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
14
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
-
import React from
|
|
16
|
-
import { ApaasUploadFile } from
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import { ApaasUploadFile } from '@kmkf-fe-packages/basic-components';
|
|
17
17
|
import GetFormItem from "../GetFormItem";
|
|
18
18
|
import ItemView from "../../commonComponents/ItemView";
|
|
19
|
-
import { isNull } from
|
|
19
|
+
import { isNull } from '@kmkf-fe-packages/kmkf-utils';
|
|
20
20
|
import { FileRender } from "../Common";
|
|
21
21
|
import { PlatForm } from "../../type";
|
|
22
22
|
var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
|
|
@@ -46,7 +46,7 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
|
|
|
46
46
|
href: file.url,
|
|
47
47
|
target: "_blank",
|
|
48
48
|
style: {
|
|
49
|
-
display:
|
|
49
|
+
display: 'block'
|
|
50
50
|
}
|
|
51
51
|
}, file.name);
|
|
52
52
|
});
|
|
@@ -60,7 +60,7 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
|
|
|
60
60
|
});
|
|
61
61
|
_defineProperty(this, "renderClient", function (record) {
|
|
62
62
|
var _this$effects;
|
|
63
|
-
var _this$id$split = _this.id.split(
|
|
63
|
+
var _this$id$split = _this.id.split('_'),
|
|
64
64
|
_this$id$split2 = _slicedToArray(_this$id$split, 1),
|
|
65
65
|
id = _this$id$split2[0];
|
|
66
66
|
var canDownload = ![PlatForm.KS, PlatForm.FXG].includes((_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.env);
|
|
@@ -83,7 +83,7 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
|
|
|
83
83
|
hidden: p === null || p === void 0 ? void 0 : p.hidden,
|
|
84
84
|
display: p === null || p === void 0 ? void 0 : p.display,
|
|
85
85
|
required: (_this$componentConfig = (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.required) !== null && _this$componentConfig !== void 0 ? _this$componentConfig : false,
|
|
86
|
-
tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip :
|
|
86
|
+
tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip : '',
|
|
87
87
|
component: /*#__PURE__*/React.createElement(ApaasUploadFile, _extends({}, _this.componentConfig, {
|
|
88
88
|
uniqueKey: _this.id,
|
|
89
89
|
platform: p === null || p === void 0 ? void 0 : p.platform,
|
|
@@ -97,7 +97,7 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
|
|
|
97
97
|
prv.push(next.url);
|
|
98
98
|
return prv;
|
|
99
99
|
}, []);
|
|
100
|
-
return textArr === null || textArr === void 0 ? void 0 : textArr.join(
|
|
100
|
+
return textArr === null || textArr === void 0 ? void 0 : textArr.join(',');
|
|
101
101
|
});
|
|
102
102
|
_defineProperty(this, "filterConfig", function () {
|
|
103
103
|
return [];
|
|
@@ -112,9 +112,9 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
|
|
|
112
112
|
this.isCombinationComponent = false;
|
|
113
113
|
this.canSort = false;
|
|
114
114
|
this.children = [];
|
|
115
|
-
this.dataType =
|
|
115
|
+
this.dataType = 'array';
|
|
116
116
|
this.effects = options.effects;
|
|
117
117
|
this.exampleValue = '[{"name":"c.jpeg","url":"https://kefu.kuaimai.com/pic/c.jpeg"}]';
|
|
118
|
-
this.standardDateType =
|
|
118
|
+
this.standardDateType = 'Array';
|
|
119
119
|
});
|
|
120
120
|
export default BasicFile;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ComponentInterface, PickOption, ALignType, Record } from '../../../type';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare class HeaderChildFile implements ComponentInterface {
|
|
4
|
+
name: string;
|
|
5
|
+
id: string;
|
|
6
|
+
sortField: string;
|
|
7
|
+
type: string;
|
|
8
|
+
componentConfig: ComponentInterface['componentConfig'];
|
|
9
|
+
align: ALignType;
|
|
10
|
+
width: number;
|
|
11
|
+
isCombinationComponent: boolean;
|
|
12
|
+
formField: string;
|
|
13
|
+
canSort: boolean;
|
|
14
|
+
children: ComponentInterface[];
|
|
15
|
+
dataType: ComponentInterface['dataType'];
|
|
16
|
+
parentName?: string;
|
|
17
|
+
transformValue: (val: any, record?: any, parentName?: string) => any;
|
|
18
|
+
export: (val: any, record?: any, parentName?: string) => any;
|
|
19
|
+
constructor(options: PickOption);
|
|
20
|
+
getParentId: () => string;
|
|
21
|
+
renderClient: (record: any) => React.JSX.Element | null;
|
|
22
|
+
renderPc: (value: unknown, record: Record) => any;
|
|
23
|
+
renderLog: (r: Record) => any;
|
|
24
|
+
getComponentValue: (r: Record) => any;
|
|
25
|
+
getComponentExport: (r: Record) => any;
|
|
26
|
+
renderExport: (value: string, record: Record) => any;
|
|
27
|
+
editRender: () => null;
|
|
28
|
+
filterConfig: () => never[];
|
|
29
|
+
}
|
|
30
|
+
export default HeaderChildFile;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import ItemView from "../../../commonComponents/ItemView";
|
|
16
|
+
import { isNull } from '@kmkf-fe-packages/kmkf-utils';
|
|
17
|
+
var HeaderChildFile = /*#__PURE__*/_createClass(function HeaderChildFile(options) {
|
|
18
|
+
var _this = this;
|
|
19
|
+
_classCallCheck(this, HeaderChildFile);
|
|
20
|
+
_defineProperty(this, "name", void 0);
|
|
21
|
+
_defineProperty(this, "id", void 0);
|
|
22
|
+
_defineProperty(this, "sortField", void 0);
|
|
23
|
+
_defineProperty(this, "type", void 0);
|
|
24
|
+
_defineProperty(this, "componentConfig", void 0);
|
|
25
|
+
_defineProperty(this, "align", void 0);
|
|
26
|
+
_defineProperty(this, "width", void 0);
|
|
27
|
+
_defineProperty(this, "isCombinationComponent", void 0);
|
|
28
|
+
_defineProperty(this, "formField", void 0);
|
|
29
|
+
_defineProperty(this, "canSort", void 0);
|
|
30
|
+
_defineProperty(this, "children", void 0);
|
|
31
|
+
_defineProperty(this, "dataType", void 0);
|
|
32
|
+
_defineProperty(this, "parentName", void 0);
|
|
33
|
+
_defineProperty(this, "transformValue", function (val) {
|
|
34
|
+
return val;
|
|
35
|
+
});
|
|
36
|
+
_defineProperty(this, "export", function (val) {
|
|
37
|
+
return val;
|
|
38
|
+
});
|
|
39
|
+
_defineProperty(this, "getParentId", function () {
|
|
40
|
+
var _this$id$split = _this.id.split('_'),
|
|
41
|
+
_this$id$split2 = _slicedToArray(_this$id$split, 3),
|
|
42
|
+
key = _this$id$split2[0],
|
|
43
|
+
name = _this$id$split2[1],
|
|
44
|
+
code = _this$id$split2[2];
|
|
45
|
+
return "".concat(key, "_").concat(name);
|
|
46
|
+
});
|
|
47
|
+
_defineProperty(this, "renderClient", function (record) {
|
|
48
|
+
return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
|
|
49
|
+
id: _this.id,
|
|
50
|
+
label: _this.name,
|
|
51
|
+
value: _this.getComponentValue(record)
|
|
52
|
+
}) : null;
|
|
53
|
+
});
|
|
54
|
+
_defineProperty(this, "renderPc", function (value, record) {
|
|
55
|
+
var fileList = _this.getComponentValue(record);
|
|
56
|
+
if (!fileList.length) {
|
|
57
|
+
return /*#__PURE__*/React.createElement("span", null, "--");
|
|
58
|
+
}
|
|
59
|
+
return fileList === null || fileList === void 0 ? void 0 : fileList.map(function (file) {
|
|
60
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
61
|
+
href: file.url,
|
|
62
|
+
onClick: function onClick(e) {
|
|
63
|
+
return e.stopPropagation();
|
|
64
|
+
},
|
|
65
|
+
target: "_blank",
|
|
66
|
+
style: {
|
|
67
|
+
display: 'block'
|
|
68
|
+
}
|
|
69
|
+
}, file.name);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
_defineProperty(this, "renderLog", function (r) {
|
|
73
|
+
var id = _this.getParentId();
|
|
74
|
+
if (isNull(r === null || r === void 0 ? void 0 : r[id])) return null;
|
|
75
|
+
return _this.renderPc(undefined, r);
|
|
76
|
+
});
|
|
77
|
+
_defineProperty(this, "getComponentValue", function (r) {
|
|
78
|
+
return (r === null || r === void 0 ? void 0 : r[_this.id]) || [];
|
|
79
|
+
});
|
|
80
|
+
_defineProperty(this, "getComponentExport", function (r) {
|
|
81
|
+
return _this.export(r === null || r === void 0 ? void 0 : r[_this.id], r, _this.parentName);
|
|
82
|
+
});
|
|
83
|
+
_defineProperty(this, "renderExport", function (value, record) {
|
|
84
|
+
var fileList = _this.getComponentValue(record) || [];
|
|
85
|
+
return fileList === null || fileList === void 0 ? void 0 : fileList.map(function (file) {
|
|
86
|
+
return file.url;
|
|
87
|
+
}).join(',');
|
|
88
|
+
});
|
|
89
|
+
_defineProperty(this, "editRender", function () {
|
|
90
|
+
return null;
|
|
91
|
+
});
|
|
92
|
+
_defineProperty(this, "filterConfig", function () {
|
|
93
|
+
return [];
|
|
94
|
+
});
|
|
95
|
+
this.name = options.name;
|
|
96
|
+
this.id = options.id;
|
|
97
|
+
this.sortField = options.id;
|
|
98
|
+
this.formField = options.id;
|
|
99
|
+
this.type = options.type;
|
|
100
|
+
if (options.parentName) {
|
|
101
|
+
this.parentName = options.parentName;
|
|
102
|
+
}
|
|
103
|
+
this.componentConfig = options.componentConfig;
|
|
104
|
+
this.align = 'left';
|
|
105
|
+
this.width = (options === null || options === void 0 ? void 0 : options.width) || 100;
|
|
106
|
+
this.isCombinationComponent = false;
|
|
107
|
+
this.canSort = false;
|
|
108
|
+
this.dataType = 'string';
|
|
109
|
+
this.children = [];
|
|
110
|
+
if (options.transformValue) {
|
|
111
|
+
this.transformValue = options.transformValue;
|
|
112
|
+
}
|
|
113
|
+
if (options.renderExport) {
|
|
114
|
+
this.export = options.renderExport;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
export default HeaderChildFile;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ComponentInterface, PickOption, ALignType, Record } from "../../../type";
|
|
2
|
+
import React from "react";
|
|
3
|
+
declare class HeaderChildPic implements ComponentInterface {
|
|
4
|
+
name: string;
|
|
5
|
+
id: string;
|
|
6
|
+
sortField: string;
|
|
7
|
+
type: string;
|
|
8
|
+
componentConfig: ComponentInterface["componentConfig"];
|
|
9
|
+
align: ALignType;
|
|
10
|
+
width: number;
|
|
11
|
+
isCombinationComponent: boolean;
|
|
12
|
+
formField: string;
|
|
13
|
+
canSort: boolean;
|
|
14
|
+
children: ComponentInterface[];
|
|
15
|
+
dataType: ComponentInterface["dataType"];
|
|
16
|
+
parentName?: string;
|
|
17
|
+
transformValue: (val: any, record?: any, parentName?: string) => any;
|
|
18
|
+
export: (val: any, record?: any, parentName?: string) => any;
|
|
19
|
+
constructor(options: PickOption);
|
|
20
|
+
getParentId: () => string;
|
|
21
|
+
renderClient: (record: any) => React.JSX.Element | null;
|
|
22
|
+
renderPc: (value: unknown, record: Record) => any;
|
|
23
|
+
renderLog: (r: Record) => any;
|
|
24
|
+
getComponentValue: (r: Record) => any;
|
|
25
|
+
getComponentExport: (r: Record) => any;
|
|
26
|
+
renderExport: (value: string, record: Record) => any;
|
|
27
|
+
editRender: () => null;
|
|
28
|
+
filterConfig: () => never[];
|
|
29
|
+
}
|
|
30
|
+
export default HeaderChildPic;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
import React from "react";
|
|
15
|
+
import { Image } from "antd";
|
|
16
|
+
import ItemView from "../../../commonComponents/ItemView";
|
|
17
|
+
import { isNull } from "@kmkf-fe-packages/kmkf-utils";
|
|
18
|
+
var HeaderChildPic = /*#__PURE__*/_createClass(function HeaderChildPic(options) {
|
|
19
|
+
var _this = this;
|
|
20
|
+
_classCallCheck(this, HeaderChildPic);
|
|
21
|
+
_defineProperty(this, "name", void 0);
|
|
22
|
+
_defineProperty(this, "id", void 0);
|
|
23
|
+
_defineProperty(this, "sortField", void 0);
|
|
24
|
+
_defineProperty(this, "type", void 0);
|
|
25
|
+
_defineProperty(this, "componentConfig", void 0);
|
|
26
|
+
_defineProperty(this, "align", void 0);
|
|
27
|
+
_defineProperty(this, "width", void 0);
|
|
28
|
+
_defineProperty(this, "isCombinationComponent", void 0);
|
|
29
|
+
_defineProperty(this, "formField", void 0);
|
|
30
|
+
_defineProperty(this, "canSort", void 0);
|
|
31
|
+
_defineProperty(this, "children", void 0);
|
|
32
|
+
_defineProperty(this, "dataType", void 0);
|
|
33
|
+
_defineProperty(this, "parentName", void 0);
|
|
34
|
+
_defineProperty(this, "transformValue", function (val) {
|
|
35
|
+
return val;
|
|
36
|
+
});
|
|
37
|
+
_defineProperty(this, "export", function (val) {
|
|
38
|
+
return val;
|
|
39
|
+
});
|
|
40
|
+
_defineProperty(this, "getParentId", function () {
|
|
41
|
+
var _this$id$split = _this.id.split("_"),
|
|
42
|
+
_this$id$split2 = _slicedToArray(_this$id$split, 3),
|
|
43
|
+
key = _this$id$split2[0],
|
|
44
|
+
name = _this$id$split2[1],
|
|
45
|
+
code = _this$id$split2[2];
|
|
46
|
+
return "".concat(key, "_").concat(name);
|
|
47
|
+
});
|
|
48
|
+
_defineProperty(this, "renderClient", function (record) {
|
|
49
|
+
return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
|
|
50
|
+
id: _this.id,
|
|
51
|
+
label: _this.name,
|
|
52
|
+
value: _this.getComponentValue(record)
|
|
53
|
+
}) : null;
|
|
54
|
+
});
|
|
55
|
+
_defineProperty(this, "renderPc", function (value, record) {
|
|
56
|
+
var picList = _this.getComponentValue(record);
|
|
57
|
+
if (!picList.length) {
|
|
58
|
+
return /*#__PURE__*/React.createElement("span", null, "--");
|
|
59
|
+
}
|
|
60
|
+
return picList.map(function (t) {
|
|
61
|
+
return /*#__PURE__*/React.createElement(Image, {
|
|
62
|
+
width: 30,
|
|
63
|
+
src: t,
|
|
64
|
+
onClick: function onClick(e) {
|
|
65
|
+
return e.stopPropagation();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
_defineProperty(this, "renderLog", function (r) {
|
|
71
|
+
var id = _this.getParentId();
|
|
72
|
+
if (isNull(r === null || r === void 0 ? void 0 : r[id])) return null;
|
|
73
|
+
return _this.renderPc(undefined, r);
|
|
74
|
+
});
|
|
75
|
+
_defineProperty(this, "getComponentValue", function (r) {
|
|
76
|
+
var picList = (r === null || r === void 0 ? void 0 : r[_this.id]) || [];
|
|
77
|
+
return picList === null || picList === void 0 ? void 0 : picList.map(function (url) {
|
|
78
|
+
return url.startsWith("http") ? url : url.startsWith("/") ? "https://kefu.kuaimai.com".concat(url) : "https://kefu.kuaimai.com/".concat(url);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
_defineProperty(this, "getComponentExport", function (r) {
|
|
82
|
+
return _this.export(r === null || r === void 0 ? void 0 : r[_this.id], r, _this.parentName);
|
|
83
|
+
});
|
|
84
|
+
_defineProperty(this, "renderExport", function (value, record) {
|
|
85
|
+
var picList = _this.getComponentValue(record);
|
|
86
|
+
return picList.join(",");
|
|
87
|
+
});
|
|
88
|
+
_defineProperty(this, "editRender", function () {
|
|
89
|
+
return null;
|
|
90
|
+
});
|
|
91
|
+
_defineProperty(this, "filterConfig", function () {
|
|
92
|
+
return [];
|
|
93
|
+
});
|
|
94
|
+
this.name = options.name;
|
|
95
|
+
this.id = options.id;
|
|
96
|
+
this.sortField = options.id;
|
|
97
|
+
this.formField = options.id;
|
|
98
|
+
this.type = options.type;
|
|
99
|
+
if (options.parentName) {
|
|
100
|
+
this.parentName = options.parentName;
|
|
101
|
+
}
|
|
102
|
+
this.componentConfig = options.componentConfig;
|
|
103
|
+
this.align = "left";
|
|
104
|
+
this.width = (options === null || options === void 0 ? void 0 : options.width) || 100;
|
|
105
|
+
this.isCombinationComponent = false;
|
|
106
|
+
this.canSort = false;
|
|
107
|
+
this.dataType = "string";
|
|
108
|
+
this.children = [];
|
|
109
|
+
if (options.transformValue) {
|
|
110
|
+
this.transformValue = options.transformValue;
|
|
111
|
+
}
|
|
112
|
+
if (options.renderExport) {
|
|
113
|
+
this.export = options.renderExport;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
export default HeaderChildPic;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
var _excluded = ["component"];
|
|
1
2
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
2
5
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
6
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
7
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -16,13 +19,82 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
16
19
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
20
|
import React from "react";
|
|
18
21
|
import { Table } from "antd";
|
|
19
|
-
import { SubForm as SubFormComponent } from "@kmkf-fe-packages/basic-components";
|
|
20
|
-
import BsHeaderChild from "../BS/common
|
|
22
|
+
import { SubForm as SubFormComponent, renderMap } from "@kmkf-fe-packages/basic-components";
|
|
23
|
+
import { BsHeaderChild } from "../BS/common";
|
|
24
|
+
import HeaderChildFile from "./children/HeaderChildFile";
|
|
25
|
+
import HeaderChildPic from "./children/HeaderChildPic";
|
|
21
26
|
import GetFormItem from "../GetFormItem";
|
|
22
27
|
import ItemView from "../../commonComponents/ItemView";
|
|
23
28
|
import { isNull } from "@kmkf-fe-packages/kmkf-utils";
|
|
24
|
-
import { difference } from
|
|
29
|
+
import { difference } from "lodash";
|
|
25
30
|
import { SYMBOL } from "../../constant";
|
|
31
|
+
var ChildrenMap = {
|
|
32
|
+
INPUT: {
|
|
33
|
+
component: BsHeaderChild
|
|
34
|
+
},
|
|
35
|
+
TEXTAREA: {
|
|
36
|
+
component: BsHeaderChild
|
|
37
|
+
},
|
|
38
|
+
SELECT: {
|
|
39
|
+
component: BsHeaderChild
|
|
40
|
+
},
|
|
41
|
+
RADIO: {
|
|
42
|
+
component: BsHeaderChild
|
|
43
|
+
// transformValue: (value: any) => {
|
|
44
|
+
// if (!value?.value) return null;
|
|
45
|
+
// return `${value?.value}
|
|
46
|
+
// ${
|
|
47
|
+
// value?.value &&
|
|
48
|
+
// typeof value.value === "string" &&
|
|
49
|
+
// value?.value?.indexOf("其他") > -1 &&
|
|
50
|
+
// value?.other
|
|
51
|
+
// ? `(${value?.other})`
|
|
52
|
+
// : ""
|
|
53
|
+
// }`;
|
|
54
|
+
// },
|
|
55
|
+
// renderExport: (value: any) => {
|
|
56
|
+
// if (!value?.value) return null;
|
|
57
|
+
// return `${value?.value}
|
|
58
|
+
// ${
|
|
59
|
+
// value?.value &&
|
|
60
|
+
// typeof value.value === "string" &&
|
|
61
|
+
// value?.value?.indexOf("其他") > -1 &&
|
|
62
|
+
// value?.other
|
|
63
|
+
// ? `(${value?.other})`
|
|
64
|
+
// : ""
|
|
65
|
+
// }`;
|
|
66
|
+
// },
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
CHECKBOX: {
|
|
70
|
+
component: BsHeaderChild,
|
|
71
|
+
transformValue: function transformValue(value) {
|
|
72
|
+
if (!(value !== null && value !== void 0 && value.length)) return null;
|
|
73
|
+
return value === null || value === void 0 ? void 0 : value.join(",");
|
|
74
|
+
},
|
|
75
|
+
renderExport: function renderExport(value) {
|
|
76
|
+
if (!(value !== null && value !== void 0 && value.length)) return null;
|
|
77
|
+
return value === null || value === void 0 ? void 0 : value.join(",");
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
BASIC_MULT_SELECT: {
|
|
81
|
+
component: BsHeaderChild,
|
|
82
|
+
transformValue: function transformValue(value) {
|
|
83
|
+
if (!(value !== null && value !== void 0 && value.length)) return null;
|
|
84
|
+
return value === null || value === void 0 ? void 0 : value.join(",");
|
|
85
|
+
},
|
|
86
|
+
renderExport: function renderExport(value) {
|
|
87
|
+
if (!(value !== null && value !== void 0 && value.length)) return null;
|
|
88
|
+
return value === null || value === void 0 ? void 0 : value.join(",");
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
PICTURE: {
|
|
92
|
+
component: HeaderChildPic
|
|
93
|
+
},
|
|
94
|
+
FILE: {
|
|
95
|
+
component: HeaderChildFile
|
|
96
|
+
}
|
|
97
|
+
};
|
|
26
98
|
var SubForm = /*#__PURE__*/_createClass(function SubForm(options) {
|
|
27
99
|
var _this = this;
|
|
28
100
|
_classCallCheck(this, SubForm);
|
|
@@ -80,7 +152,12 @@ var SubForm = /*#__PURE__*/_createClass(function SubForm(options) {
|
|
|
80
152
|
ellipsis: true,
|
|
81
153
|
width: item.width,
|
|
82
154
|
render: function render(val) {
|
|
83
|
-
return /*#__PURE__*/React.createElement("
|
|
155
|
+
return renderMap[item.workOrderComponentType] ? /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
style: {
|
|
157
|
+
width: "100%",
|
|
158
|
+
overflow: "auto"
|
|
159
|
+
}
|
|
160
|
+
}, renderMap[item.workOrderComponentType](val)) : /*#__PURE__*/React.createElement("span", null, val);
|
|
84
161
|
}
|
|
85
162
|
};
|
|
86
163
|
})) || []));
|
|
@@ -191,10 +268,13 @@ var SubForm = /*#__PURE__*/_createClass(function SubForm(options) {
|
|
|
191
268
|
this.isCombinationComponent = true;
|
|
192
269
|
this.canSort = false;
|
|
193
270
|
this.children = (this.getNewTableHeader() || []).map(function (item) {
|
|
194
|
-
|
|
271
|
+
var _ChildrenMap$item$wor = ChildrenMap[item.workOrderComponentType],
|
|
272
|
+
component = _ChildrenMap$item$wor.component,
|
|
273
|
+
other = _objectWithoutProperties(_ChildrenMap$item$wor, _excluded);
|
|
274
|
+
return new component(_objectSpread(_objectSpread({}, options), {}, {
|
|
195
275
|
name: item.name,
|
|
196
276
|
id: "".concat(options.id, "_productList_").concat(item.key)
|
|
197
|
-
}));
|
|
277
|
+
}, other));
|
|
198
278
|
});
|
|
199
279
|
this.dataType = "object";
|
|
200
280
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/services-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-rc.1",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@kmkf-fe-packages/basic-components": "2.
|
|
25
|
-
"@kmkf-fe-packages/kmkf-utils": "2.
|
|
24
|
+
"@kmkf-fe-packages/basic-components": "2.3.0-rc.1",
|
|
25
|
+
"@kmkf-fe-packages/kmkf-utils": "2.3.0-rc.1",
|
|
26
26
|
"b64-to-blob": "^1.2.19",
|
|
27
27
|
"html2canvas": "^1.4.1",
|
|
28
28
|
"react-pdf-js": "^5.1.0"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "cefb61a2220d807338d9e0741f6e4470dc775ddf",
|
|
45
45
|
"gitHooks": {
|
|
46
46
|
"pre-commit": "lint-staged"
|
|
47
47
|
}
|