@kmkf-fe-packages/services-components 0.8.17-alpha.17 → 0.8.17-alpha.18

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.
@@ -0,0 +1,31 @@
1
+ import { ComponentInterface, PickOption, ColumnConfig, Record } from "../../type";
2
+ import React from "react";
3
+ declare class Calculation implements ComponentInterface {
4
+ name: string;
5
+ id: string;
6
+ sortField: string;
7
+ type: string;
8
+ rules: any[];
9
+ componentConfig: ComponentInterface["componentConfig"];
10
+ isCombinationComponent: boolean;
11
+ formField: string;
12
+ canSort: boolean;
13
+ children: ComponentInterface[];
14
+ dataType: ComponentInterface["dataType"];
15
+ constructor(options: PickOption);
16
+ renderPc: (value: any, record: Record) => React.JSX.Element;
17
+ renderLog: (r: Record) => React.JSX.Element | null;
18
+ getComponentValue: (r: Record) => any;
19
+ renderExport: (value: any, record: Record) => any;
20
+ renderClient: (record: Record) => React.JSX.Element | null;
21
+ editRender: (p: any) => React.JSX.Element;
22
+ filterConfig: (item: ColumnConfig) => {
23
+ searchDefaultConditions: "like";
24
+ type: string;
25
+ id: string;
26
+ name: string;
27
+ filterComponentType: "Input";
28
+ filterFn: (value: string) => (i: Record) => boolean;
29
+ };
30
+ }
31
+ export default Calculation;
@@ -0,0 +1,108 @@
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 _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
+ 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); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ 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; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
+ 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); }
9
+ import React from "react";
10
+ import { ApaasInput } from "@kmkf-fe-packages/basic-components";
11
+ import GetFormItem from "../GetFormItem";
12
+ import ItemView from "../../commonComponents/ItemView";
13
+ import { isNull, filterFn as _filterFn } from "@kmkf-fe-packages/kmkf-utils";
14
+ import { SYMBOL } from "../../constant";
15
+ var CalculationInput = function CalculationInput(props) {
16
+ return /*#__PURE__*/React.createElement("span", {
17
+ style: {
18
+ display: 'flex',
19
+ alignItems: 'center'
20
+ }
21
+ }, /*#__PURE__*/React.createElement(ApaasInput, props), /*#__PURE__*/React.createElement("span", {
22
+ style: {
23
+ marginLeft: '4px'
24
+ }
25
+ }, props === null || props === void 0 ? void 0 : props.unit));
26
+ };
27
+ var Calculation = /*#__PURE__*/_createClass(function Calculation(options) {
28
+ var _this = this;
29
+ _classCallCheck(this, Calculation);
30
+ _defineProperty(this, "name", void 0);
31
+ _defineProperty(this, "id", void 0);
32
+ _defineProperty(this, "sortField", void 0);
33
+ _defineProperty(this, "type", void 0);
34
+ _defineProperty(this, "rules", void 0);
35
+ _defineProperty(this, "componentConfig", void 0);
36
+ _defineProperty(this, "isCombinationComponent", void 0);
37
+ _defineProperty(this, "formField", void 0);
38
+ _defineProperty(this, "canSort", void 0);
39
+ _defineProperty(this, "children", void 0);
40
+ _defineProperty(this, "dataType", void 0);
41
+ _defineProperty(this, "renderPc", function (value, record) {
42
+ var _record;
43
+ return /*#__PURE__*/React.createElement("span", null, (_record = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_calculation")]) !== null && _record !== void 0 ? _record : "--");
44
+ });
45
+ _defineProperty(this, "renderLog", function (r) {
46
+ if (isNull(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_calculation")])) return null;
47
+ return _this.renderPc(undefined, r);
48
+ });
49
+ _defineProperty(this, "getComponentValue", function (r) {
50
+ return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_calculation")];
51
+ });
52
+ _defineProperty(this, "renderExport", function (value, record) {
53
+ var _record2;
54
+ return (_record2 = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_calculation")]) !== null && _record2 !== void 0 ? _record2 : "--";
55
+ });
56
+ _defineProperty(this, "renderClient", function (record) {
57
+ return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
58
+ id: _this.id,
59
+ label: _this.name,
60
+ value: record === null || record === void 0 ? void 0 : record[_this.id]
61
+ }) : null;
62
+ });
63
+ _defineProperty(this, "editRender", function (p) {
64
+ var _this$componentConfig, _this$componentConfig2, _this$componentConfig3;
65
+ return /*#__PURE__*/React.createElement(GetFormItem, {
66
+ title: _this.name,
67
+ name: _this.id,
68
+ rules: _this.rules,
69
+ hidden: p === null || p === void 0 ? void 0 : p.hidden,
70
+ required: false,
71
+ style: {
72
+ display: (_this$componentConfig = _this.componentConfig) !== null && _this$componentConfig !== void 0 && (_this$componentConfig2 = _this$componentConfig.config) !== null && _this$componentConfig2 !== void 0 && _this$componentConfig2.display ? 'unset' : 'none'
73
+ } // TODO: 样式隐藏
74
+ ,
75
+ component: /*#__PURE__*/React.createElement(CalculationInput, _extends({
76
+ disabled: true
77
+ }, (_this$componentConfig3 = _this.componentConfig) === null || _this$componentConfig3 === void 0 ? void 0 : _this$componentConfig3.config))
78
+ });
79
+ });
80
+ _defineProperty(this, "filterConfig", function (item) {
81
+ return {
82
+ searchDefaultConditions: SYMBOL.like,
83
+ type: item.type,
84
+ id: "".concat(item.id, "_calculation"),
85
+ // 过滤组件id
86
+ name: item.name,
87
+ // 过滤组件名称
88
+ filterComponentType: "Input",
89
+ filterFn: function filterFn(value) {
90
+ return function (i) {
91
+ return "".concat(_filterFn.filterTableListItemColumnValue(i, item.id, "calculation")).includes(value);
92
+ };
93
+ }
94
+ };
95
+ });
96
+ this.name = options.name;
97
+ this.id = options.id;
98
+ this.sortField = "".concat(options.id, "_calculation");
99
+ this.formField = "".concat(options.id, "_calculation");
100
+ this.type = options.type;
101
+ this.componentConfig = options.componentConfig;
102
+ this.rules = [];
103
+ this.isCombinationComponent = false;
104
+ this.canSort = true;
105
+ this.children = [];
106
+ this.dataType = "number";
107
+ });
108
+ export default Calculation;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { CSSProperties } from "react";
2
2
  declare type GetFormItemProps = {
3
3
  rules: any[];
4
4
  required: boolean;
@@ -6,6 +6,8 @@ declare type GetFormItemProps = {
6
6
  name: string;
7
7
  component: JSX.Element | null;
8
8
  hidden?: boolean;
9
+ style?: CSSProperties | undefined;
10
+ [prop: string]: any;
9
11
  };
10
- declare const GetFormItem: ({ rules, required, title, component, name, hidden }: GetFormItemProps) => React.JSX.Element | null;
12
+ declare const GetFormItem: ({ rules, required, title, component, name, hidden, style, }: GetFormItemProps) => React.JSX.Element | null;
11
13
  export default GetFormItem;
@@ -1,3 +1,9 @@
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); }
1
7
  import React from "react";
2
8
  import { Form } from "antd";
3
9
  var GetFormItem = function GetFormItem(_ref) {
@@ -7,7 +13,8 @@ var GetFormItem = function GetFormItem(_ref) {
7
13
  component = _ref.component,
8
14
  name = _ref.name,
9
15
  _ref$hidden = _ref.hidden,
10
- hidden = _ref$hidden === void 0 ? false : _ref$hidden;
16
+ hidden = _ref$hidden === void 0 ? false : _ref$hidden,
17
+ style = _ref.style;
11
18
  var newRules = rules;
12
19
  if (required) {
13
20
  newRules = rules.concat({
@@ -19,9 +26,9 @@ var GetFormItem = function GetFormItem(_ref) {
19
26
  if (hidden) return null;
20
27
  return /*#__PURE__*/React.createElement("div", {
21
28
  className: "form-item--wrap",
22
- style: {
29
+ style: _objectSpread({
23
30
  position: "relative"
24
- }
31
+ }, style)
25
32
  }, /*#__PURE__*/React.createElement(Form.Item, {
26
33
  name: name,
27
34
  label: title,
@@ -1,3 +1,3 @@
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, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, Handler, CompletedUser, LogisticsInterception, LogisticsTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsSystemOrder, StatusSelect, CommonTradeId } from "./index";
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, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, Handler, CompletedUser, LogisticsInterception, LogisticsTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsSystemOrder, StatusSelect, CommonTradeId, Calculation } from "./index";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => BsExchange | BsGoods | BsReissue | BsSystemOrder | CommonTradeId | BasicRadio | BasicSelect | ShopInput | StatusSelect | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | 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 | FlowStatusSelect | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsTrajectory | PlatForm | Submitter | Handler | CompletedUser | FlowWorkOrderId;
3
+ export declare const factory: (type: string, options: PickOption) => Calculation | BasicInput | BasicAddress | BasicCascader | 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 | FlowStatusSelect | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsTrajectory | PlatForm | ShopInput | Submitter | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | CommonTradeId;
@@ -1,4 +1,4 @@
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, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, Handler, CompletedUser, LogisticsInterception, LogisticsTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsSystemOrder, StatusSelect, CommonTradeId } from "./index";
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, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, Handler, CompletedUser, LogisticsInterception, LogisticsTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsSystemOrder, StatusSelect, CommonTradeId, Calculation } from "./index";
2
2
  export var factory = function factory(type, options) {
3
3
  var _options$componentCon;
4
4
  switch (type) {
@@ -138,6 +138,8 @@ export var factory = function factory(type, options) {
138
138
  case "EXCHANGE_TRADE_ID":
139
139
  case "RETURN_GOODS_TRADE_ID":
140
140
  return new CommonTradeId(options);
141
+ case "NUMERICAL_CALCULATION":
142
+ return new Calculation(options);
141
143
  default:
142
144
  return new BasicInput(options);
143
145
  }
@@ -54,6 +54,7 @@ export { default as CompletedUser } from "./components/CompletedUser";
54
54
  export { default as FlowWorkOrderId } from "./components/FlowWorkOrderId";
55
55
  export { default as StatusSelect } from "./components/StatusSelect";
56
56
  export { default as CommonTradeId } from "./components/CommonTradeId";
57
+ export { default as Calculation } from "./components/Calculation";
57
58
  export { factory } from "./factory";
58
59
  export { default as PlatformAvatar } from "./commonComponents/PlatformAvatar";
59
60
  export { default as PlatBuyer } from "./commonComponents/PlatBuyer";
package/dist/esm/index.js CHANGED
@@ -54,6 +54,7 @@ export { default as CompletedUser } from "./components/CompletedUser";
54
54
  export { default as FlowWorkOrderId } from "./components/FlowWorkOrderId";
55
55
  export { default as StatusSelect } from "./components/StatusSelect";
56
56
  export { default as CommonTradeId } from "./components/CommonTradeId";
57
+ export { default as Calculation } from "./components/Calculation";
57
58
  export { factory } from "./factory";
58
59
  export { default as PlatformAvatar } from "./commonComponents/PlatformAvatar";
59
60
  export { default as PlatBuyer } from "./commonComponents/PlatBuyer";
@@ -147,6 +147,7 @@ export interface ComponentInterface {
147
147
  showHeader?: string[];
148
148
  reasonList?: any[];
149
149
  disabled?: boolean;
150
+ config?: any;
150
151
  };
151
152
  effects?: {
152
153
  queryWorkOrderDetail?: (r: Record) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "0.8.17-alpha.17",
3
+ "version": "0.8.17-alpha.18",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -26,8 +26,8 @@
26
26
  "father": "^4.1.7"
27
27
  },
28
28
  "dependencies": {
29
- "@kmkf-fe-packages/basic-components": "^0.8.17-alpha.14",
30
- "@kmkf-fe-packages/kmkf-utils": "^0.8.17-alpha.14"
29
+ "@kmkf-fe-packages/basic-components": "^0.8.17-alpha.18",
30
+ "@kmkf-fe-packages/kmkf-utils": "^0.8.17-alpha.18"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@ant-design/icons": "^4.7.0",
@@ -40,5 +40,5 @@
40
40
  "gitHooks": {
41
41
  "pre-commit": "lint-staged"
42
42
  },
43
- "gitHead": "96b9371cf317fee5e3e93201bba4fc1d0d6ae03f"
43
+ "gitHead": "10d16627ff71ccf8e2a75ba12dd3ff061a9e7e84"
44
44
  }