@kmkf-fe-packages/services-components 0.13.0-alpha.8 → 0.13.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/Input/index.d.ts +4 -4
- package/dist/esm/components/Input/index.js +32 -25
- package/dist/esm/factory.d.ts +1 -1
- package/dist/esm/service/api.d.ts +1 -0
- package/dist/esm/service/api.js +9 -0
- package/dist/esm/service/request.d.ts +17 -0
- package/dist/esm/service/request.js +56 -0
- package/package.json +2 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ComponentInterface, PickOption, ColumnConfig, Record } from
|
|
2
|
-
import React from
|
|
1
|
+
import { ComponentInterface, PickOption, ColumnConfig, Record } from '../../type';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
declare class BasicInput implements ComponentInterface {
|
|
4
4
|
name: string;
|
|
5
5
|
id: string;
|
|
6
6
|
sortField: string;
|
|
7
7
|
type: string;
|
|
8
8
|
rules: any[];
|
|
9
|
-
componentConfig: ComponentInterface[
|
|
9
|
+
componentConfig: ComponentInterface['componentConfig'];
|
|
10
10
|
isCombinationComponent: boolean;
|
|
11
11
|
formField: string;
|
|
12
12
|
canSort: boolean;
|
|
13
13
|
children: ComponentInterface[];
|
|
14
|
-
dataType: ComponentInterface[
|
|
14
|
+
dataType: ComponentInterface['dataType'];
|
|
15
15
|
templateId?: string;
|
|
16
16
|
constructor(options: PickOption);
|
|
17
17
|
renderPc: (value: any, record: Record) => React.JSX.Element;
|
|
@@ -9,13 +9,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
9
9
|
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; }
|
|
10
10
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
11
|
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); }
|
|
12
|
-
import React from
|
|
13
|
-
import { ApaasInput } from
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { ApaasInput } from '@kmkf-fe-packages/basic-components';
|
|
14
14
|
import GetFormItem from "../GetFormItem";
|
|
15
15
|
import ItemView from "../../commonComponents/ItemView";
|
|
16
|
-
import { isNull, filterFn as _filterFn } from
|
|
16
|
+
import { isNull, filterFn as _filterFn } from '@kmkf-fe-packages/kmkf-utils';
|
|
17
17
|
import { SYMBOL } from "../../constant";
|
|
18
|
-
|
|
18
|
+
import { replaceCheck } from "../../service/api";
|
|
19
19
|
var BasicInput = /*#__PURE__*/_createClass(function BasicInput(options) {
|
|
20
20
|
var _this = this,
|
|
21
21
|
_options$componentCon;
|
|
@@ -34,7 +34,7 @@ var BasicInput = /*#__PURE__*/_createClass(function BasicInput(options) {
|
|
|
34
34
|
_defineProperty(this, "templateId", void 0);
|
|
35
35
|
_defineProperty(this, "renderPc", function (value, record) {
|
|
36
36
|
var _record;
|
|
37
|
-
return /*#__PURE__*/React.createElement("span", null, (_record = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_input")]) !== null && _record !== void 0 ? _record :
|
|
37
|
+
return /*#__PURE__*/React.createElement("span", null, (_record = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_input")]) !== null && _record !== void 0 ? _record : '--');
|
|
38
38
|
});
|
|
39
39
|
_defineProperty(this, "renderLog", function (r) {
|
|
40
40
|
if (isNull(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_input")])) return null;
|
|
@@ -45,7 +45,7 @@ var BasicInput = /*#__PURE__*/_createClass(function BasicInput(options) {
|
|
|
45
45
|
});
|
|
46
46
|
_defineProperty(this, "renderExport", function (value, record) {
|
|
47
47
|
var _record2;
|
|
48
|
-
return (_record2 = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_input")]) !== null && _record2 !== void 0 ? _record2 :
|
|
48
|
+
return (_record2 = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_input")]) !== null && _record2 !== void 0 ? _record2 : '--';
|
|
49
49
|
});
|
|
50
50
|
_defineProperty(this, "renderClient", function (record) {
|
|
51
51
|
return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
|
|
@@ -76,10 +76,10 @@ var BasicInput = /*#__PURE__*/_createClass(function BasicInput(options) {
|
|
|
76
76
|
// 过滤组件id
|
|
77
77
|
name: item.name,
|
|
78
78
|
// 过滤组件名称
|
|
79
|
-
filterComponentType:
|
|
79
|
+
filterComponentType: 'Input',
|
|
80
80
|
filterFn: function filterFn(value) {
|
|
81
81
|
return function (i) {
|
|
82
|
-
return "".concat(_filterFn.filterTableListItemColumnValue(i, item.id,
|
|
82
|
+
return "".concat(_filterFn.filterTableListItemColumnValue(i, item.id, 'input')).includes(value);
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
};
|
|
@@ -108,7 +108,7 @@ var BasicInput = /*#__PURE__*/_createClass(function BasicInput(options) {
|
|
|
108
108
|
return item.test(value);
|
|
109
109
|
});
|
|
110
110
|
if (testList.length && !isTest) {
|
|
111
|
-
return Promise.reject(new Error(
|
|
111
|
+
return Promise.reject(new Error('请填写正确的格式'));
|
|
112
112
|
}
|
|
113
113
|
if ((_this$componentConfig6 = _this.componentConfig) !== null && _this$componentConfig6 !== void 0 && (_this$componentConfig7 = _this$componentConfig6.rulesOptions) !== null && _this$componentConfig7 !== void 0 && _this$componentConfig7.length) {
|
|
114
114
|
var _this$componentConfig8;
|
|
@@ -138,7 +138,7 @@ var BasicInput = /*#__PURE__*/_createClass(function BasicInput(options) {
|
|
|
138
138
|
validator: function () {
|
|
139
139
|
var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_, value) {
|
|
140
140
|
var _this$componentConfig10;
|
|
141
|
-
var params;
|
|
141
|
+
var _resultList$, params, _yield$replaceCheck, resultList;
|
|
142
142
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
143
143
|
while (1) switch (_context.prev = _context.next) {
|
|
144
144
|
case 0:
|
|
@@ -148,21 +148,28 @@ var BasicInput = /*#__PURE__*/_createClass(function BasicInput(options) {
|
|
|
148
148
|
}
|
|
149
149
|
return _context.abrupt("return", Promise.resolve());
|
|
150
150
|
case 2:
|
|
151
|
-
if ((_this$componentConfig10 = _this.componentConfig) !== null && _this$componentConfig10 !== void 0 && _this$componentConfig10.replaceWarn) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
if (!((_this$componentConfig10 = _this.componentConfig) !== null && _this$componentConfig10 !== void 0 && _this$componentConfig10.replaceWarn)) {
|
|
152
|
+
_context.next = 10;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
params = {
|
|
156
|
+
templateId: _this.templateId,
|
|
157
|
+
needCheckComponentList: [{
|
|
158
|
+
componentKey: _this.formField,
|
|
159
|
+
componentValue: value
|
|
160
|
+
}]
|
|
161
|
+
};
|
|
162
|
+
_context.next = 6;
|
|
163
|
+
return replaceCheck(params);
|
|
164
|
+
case 6:
|
|
165
|
+
_yield$replaceCheck = _context.sent;
|
|
166
|
+
resultList = _yield$replaceCheck.data.resultList;
|
|
167
|
+
if (!((resultList === null || resultList === void 0 ? void 0 : (_resultList$ = resultList[0]) === null || _resultList$ === void 0 ? void 0 : _resultList$.repeatCount) > 0)) {
|
|
168
|
+
_context.next = 10;
|
|
169
|
+
break;
|
|
164
170
|
}
|
|
165
|
-
|
|
171
|
+
return _context.abrupt("return", Promise.reject(new Error('内容已存在,不能重复提交')));
|
|
172
|
+
case 10:
|
|
166
173
|
case "end":
|
|
167
174
|
return _context.stop();
|
|
168
175
|
}
|
|
@@ -177,6 +184,6 @@ var BasicInput = /*#__PURE__*/_createClass(function BasicInput(options) {
|
|
|
177
184
|
this.isCombinationComponent = false;
|
|
178
185
|
this.canSort = true;
|
|
179
186
|
this.children = [];
|
|
180
|
-
this.dataType = options !== null && options !== void 0 && (_options$componentCon = options.componentConfig) !== null && _options$componentCon !== void 0 && _options$componentCon.isNumber ?
|
|
187
|
+
this.dataType = options !== null && options !== void 0 && (_options$componentCon = options.componentConfig) !== null && _options$componentCon !== void 0 && _options$componentCon.isNumber ? 'number' : 'string';
|
|
181
188
|
});
|
|
182
189
|
export default BasicInput;
|
package/dist/esm/factory.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JstLogistics, JstItemSelect, JstSupply, JstSendGood, BasicInput, BasicAddress, BasicCascader, BasicCheckbox, BasicDataTime, BasicSelect, BasicRadio, BasicTextArea, BasicPicture, BasicMultSelect, BasicGrade, BasicRate, BasicFile, BasicPosting, CommonDataTime, TradeId, ShopName, ErpTradeId, BuyerNick, ReceiverName, ReceiverMobile, ReceiverAddress, TradeDateTime, Logistics, ReturnLogistics, ActualPayment, ERemark, AliPay, ItemSelect, ItemId, ItemEnCode, SystemOrderNo, Ordinary, ThirdItemSelect, FlowStatusSelect, FlowMarkSelect, FlowTag, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, Handler, CompletedUser, LogisticsInterception, LogisticsTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsReturn, BsSystemOrder, BsLogistics, StatusSelect, CommonTradeId, CommonSystemOrder, CommonMultiStatus, Calculation, NodeDeadLine, HandlerDeadLine, NodeStayDuration, WlnGoods, BsPosting } from "./index";
|
|
2
2
|
import { PickOption } from "./type";
|
|
3
|
-
export declare const factory: (type: string, options: PickOption) =>
|
|
3
|
+
export declare const factory: (type: string, options: PickOption) => BsPosting | BasicCascader | FlowTag | BasicInput | BasicAddress | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | CommonDataTime | TradeId | ErpTradeId | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstLogistics | JstItemSelect | JstSendGood | JstSupply | BsSystemOrder | BsGoods | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsTrajectory | PlatForm | ShopInput | Submitter | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | CommonTradeId | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const replaceCheck: (data: any) => Promise<any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface RequestProps {
|
|
2
|
+
url: string;
|
|
3
|
+
method: string;
|
|
4
|
+
data: any;
|
|
5
|
+
headers?: any;
|
|
6
|
+
infoLevel?: 'error' | 'warning' | 'quiet';
|
|
7
|
+
options?: any;
|
|
8
|
+
}
|
|
9
|
+
export interface serverProps<T = any> {
|
|
10
|
+
data?: T;
|
|
11
|
+
result: number;
|
|
12
|
+
success: boolean;
|
|
13
|
+
traceId: string;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
declare const requestApi: ({ url, method, data, headers, infoLevel, options }: RequestProps) => Promise<serverProps>;
|
|
17
|
+
export default requestApi;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
7
|
+
/*
|
|
8
|
+
* @Description:
|
|
9
|
+
* @Author: litian
|
|
10
|
+
* @Date: 2022-09-06 09:29:34
|
|
11
|
+
* @LastEditors: litian
|
|
12
|
+
* @LastEditTime: 2022-11-24 09:11:45
|
|
13
|
+
*/
|
|
14
|
+
import { extend } from 'umi-request';
|
|
15
|
+
import { message } from 'antd';
|
|
16
|
+
var request = extend({});
|
|
17
|
+
var requestApi = function requestApi(_ref) {
|
|
18
|
+
var url = _ref.url,
|
|
19
|
+
method = _ref.method,
|
|
20
|
+
data = _ref.data,
|
|
21
|
+
_ref$headers = _ref.headers,
|
|
22
|
+
headers = _ref$headers === void 0 ? {} : _ref$headers,
|
|
23
|
+
_ref$infoLevel = _ref.infoLevel,
|
|
24
|
+
infoLevel = _ref$infoLevel === void 0 ? 'error' : _ref$infoLevel,
|
|
25
|
+
_ref$options = _ref.options,
|
|
26
|
+
options = _ref$options === void 0 ? {} : _ref$options;
|
|
27
|
+
return new Promise(function (resolve, reject) {
|
|
28
|
+
var params = _objectSpread({
|
|
29
|
+
method: method,
|
|
30
|
+
headers: headers
|
|
31
|
+
}, options);
|
|
32
|
+
if (method.toLocaleLowerCase() === 'get') {
|
|
33
|
+
params.params = data;
|
|
34
|
+
} else {
|
|
35
|
+
params.data = data;
|
|
36
|
+
}
|
|
37
|
+
request(url, params).then(function (res) {
|
|
38
|
+
if (res.result === 100 || res.success) {
|
|
39
|
+
resolve(res);
|
|
40
|
+
} else {
|
|
41
|
+
if (infoLevel === 'warning') {
|
|
42
|
+
message.warn(res.message);
|
|
43
|
+
} else if (infoLevel === 'error') {
|
|
44
|
+
message.error(res.message);
|
|
45
|
+
} else {
|
|
46
|
+
console.log(res.message);
|
|
47
|
+
}
|
|
48
|
+
reject(res);
|
|
49
|
+
}
|
|
50
|
+
}).catch(function (e) {
|
|
51
|
+
console.error('请求错误', e);
|
|
52
|
+
reject(e);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
export default requestApi;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/services-components",
|
|
3
|
-
"version": "0.13.0-alpha.
|
|
3
|
+
"version": "0.13.0-alpha.9",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"gitHooks": {
|
|
41
41
|
"pre-commit": "lint-staged"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "75fe2bdef47be6d93f33d2b61c9f20056f6bbe27"
|
|
44
44
|
}
|