@kmkf-fe-packages/services-components 1.0.5 → 1.0.6-alpha.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.
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  declare type Shop = {
3
3
  auditStatus: number;
4
4
  shopId: string;
@@ -10,5 +10,5 @@ declare type ShopListProps = {
10
10
  shopList: Shop[];
11
11
  [prop: string]: any;
12
12
  };
13
- declare const ShopList: ({ disabledList, shopList, valueMapping, onChange, setShopId, ...prop }: ShopListProps) => React.JSX.Element;
13
+ declare const ShopList: ({ disabledList, shopList, valueMapping, onChange, setShopId, isShowSelectAll, ...prop }: ShopListProps) => React.JSX.Element;
14
14
  export default ShopList;
@@ -1,13 +1,18 @@
1
- var _excluded = ["disabledList", "shopList", "valueMapping", "onChange", "setShopId"];
1
+ var _excluded = ["disabledList", "shopList", "valueMapping", "onChange", "setShopId", "isShowSelectAll"];
2
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ 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); }
6
+ 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; }
7
+ 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; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3
9
  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
10
  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; }
5
- import React from 'react';
6
- import { Select } from 'antd';
11
+ import React, { useRef, useState } from "react";
12
+ import { Select, Checkbox, Divider } from "antd";
7
13
  import PlatformAvatar from "../PlatformAvatar";
8
- import { PlatData } from '@kmkf-fe-packages/kmkf-utils';
14
+ import { PlatData } from "@kmkf-fe-packages/kmkf-utils";
9
15
  var ShopList = function ShopList(_ref) {
10
- var _shopList$filter;
11
16
  var _ref$disabledList = _ref.disabledList,
12
17
  disabledList = _ref$disabledList === void 0 ? [] : _ref$disabledList,
13
18
  shopList = _ref.shopList,
@@ -15,32 +20,71 @@ var ShopList = function ShopList(_ref) {
15
20
  valueMapping = _ref$valueMapping === void 0 ? "shopId" : _ref$valueMapping,
16
21
  onChange = _ref.onChange,
17
22
  setShopId = _ref.setShopId,
23
+ _ref$isShowSelectAll = _ref.isShowSelectAll,
24
+ isShowSelectAll = _ref$isShowSelectAll === void 0 ? false : _ref$isShowSelectAll,
18
25
  prop = _objectWithoutProperties(_ref, _excluded);
19
26
  var handleChange = function handleChange(val) {
20
27
  onChange === null || onChange === void 0 ? void 0 : onChange(val);
21
28
  setShopId === null || setShopId === void 0 ? void 0 : setShopId(val);
22
29
  };
23
30
  var platDatInstance = PlatData.getInstance();
31
+ var _useState = useState(false),
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ selectAll = _useState2[0],
34
+ setSelectAll = _useState2[1];
35
+ var canSelectShopValueList = useRef([]);
36
+ if (isShowSelectAll) {
37
+ canSelectShopValueList.current = shopList.filter(function (item) {
38
+ return (item === null || item === void 0 ? void 0 : item.auditStatus) === 1 || (item === null || item === void 0 ? void 0 : item.disabled) || disabledList.includes(item === null || item === void 0 ? void 0 : item[valueMapping]);
39
+ }).map(function (item) {
40
+ return item === null || item === void 0 ? void 0 : item[valueMapping];
41
+ });
42
+ }
24
43
  return /*#__PURE__*/React.createElement(Select, _extends({
25
44
  onChange: handleChange
26
- }, prop), shopList === null || shopList === void 0 ? void 0 : (_shopList$filter = shopList.filter(function (item) {
27
- return (item === null || item === void 0 ? void 0 : item.auditStatus) === 1;
28
- })) === null || _shopList$filter === void 0 ? void 0 : _shopList$filter.map(function (item) {
29
- var _platDatInstance$getP;
30
- var plat = (_platDatInstance$getP = platDatInstance.getPlatData()) === null || _platDatInstance$getP === void 0 ? void 0 : _platDatInstance$getP.find(function (plat) {
31
- return plat.platformType === item.shopSource;
32
- });
33
- return /*#__PURE__*/React.createElement(Select.Option, {
34
- disabled: item.disabled || disabledList.includes(item === null || item === void 0 ? void 0 : item[valueMapping]),
35
- value: item === null || item === void 0 ? void 0 : item[valueMapping],
36
- key: item === null || item === void 0 ? void 0 : item[valueMapping],
37
- label: "".concat((plat === null || plat === void 0 ? void 0 : plat.platformName) || '').concat(item.shopName)
38
- }, /*#__PURE__*/React.createElement(PlatformAvatar, {
39
- styles: {
40
- marginRight: 5
41
- },
42
- type: item.shopSource
43
- }), /*#__PURE__*/React.createElement("span", null, (plat === null || plat === void 0 ? void 0 : plat.platformName) && "\u3010".concat(plat === null || plat === void 0 ? void 0 : plat.platformName, "\u3011"), item.shopName));
45
+ }, prop, {
46
+ dropdownRender: function dropdownRender() {
47
+ var _shopList$filter;
48
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isShowSelectAll && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
49
+ style: {
50
+ padding: "4px 8px 8px 12px",
51
+ cursor: "pointer"
52
+ }
53
+ }, /*#__PURE__*/React.createElement(Checkbox, {
54
+ checked: selectAll,
55
+ onChange: function onChange(e) {
56
+ if (e.target.checked) {
57
+ setSelectAll(true);
58
+ handleChange(canSelectShopValueList.current.join(","));
59
+ } else {
60
+ setSelectAll(false);
61
+ handleChange("");
62
+ }
63
+ }
64
+ }, "\u5168\u9009")), /*#__PURE__*/React.createElement(Divider, {
65
+ style: {
66
+ margin: "0"
67
+ }
68
+ })), shopList === null || shopList === void 0 ? void 0 : (_shopList$filter = shopList.filter(function (item) {
69
+ return (item === null || item === void 0 ? void 0 : item.auditStatus) === 1;
70
+ })) === null || _shopList$filter === void 0 ? void 0 : _shopList$filter.map(function (item) {
71
+ var _platDatInstance$getP;
72
+ var plat = (_platDatInstance$getP = platDatInstance.getPlatData()) === null || _platDatInstance$getP === void 0 ? void 0 : _platDatInstance$getP.find(function (plat) {
73
+ return plat.platformType === item.shopSource;
74
+ });
75
+ return /*#__PURE__*/React.createElement(Select.Option, {
76
+ disabled: item.disabled || disabledList.includes(item === null || item === void 0 ? void 0 : item[valueMapping]),
77
+ value: item === null || item === void 0 ? void 0 : item[valueMapping],
78
+ key: item === null || item === void 0 ? void 0 : item[valueMapping],
79
+ label: "".concat((plat === null || plat === void 0 ? void 0 : plat.platformName) || "").concat(item.shopName)
80
+ }, /*#__PURE__*/React.createElement(PlatformAvatar, {
81
+ styles: {
82
+ marginRight: 5
83
+ },
84
+ type: item.shopSource
85
+ }), /*#__PURE__*/React.createElement("span", null, (plat === null || plat === void 0 ? void 0 : plat.platformName) && "\u3010".concat(plat === null || plat === void 0 ? void 0 : plat.platformName, "\u3011"), item.shopName));
86
+ }));
87
+ }
44
88
  }));
45
89
  };
46
90
  export default ShopList;
@@ -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, 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, PrevSubmitter, FlowCreator, Handler, CompletedUser, LogisticsInterception, LogisticsMoreInterception, LogisticsTrajectory, LogisticsMoreTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsReturn, BsSystemOrder, BsLogistics, StatusSelect, CommonSystemOrder, CommonMultiStatus, Calculation, NodeDeadLine, HandlerDeadLine, NodeStayDuration, WlnGoods, BsPosting, MsgStatus, NodeInput, FlowWorkOrderStatus, WdtGoods, CommonInput, PaymentVoucherCode, WdtReissue } from "./index";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => AliPay | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | CommonDataTime | TradeId | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstLogistics | JstItemSelect | JstSendGood | JstSupply | BsSystemOrder | BsGoods | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | MsgStatus | WdtGoods | WdtReissue | CommonInput | PaymentVoucherCode;
3
+ export declare const factory: (type: string, options: PickOption) => AliPay | BasicCascader | BasicInput | BasicAddress | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | CommonDataTime | TradeId | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstLogistics | JstItemSelect | JstSendGood | JstSupply | BsSystemOrder | BsGoods | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | MsgStatus | WdtGoods | WdtReissue | CommonInput | PaymentVoucherCode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "1.0.5",
3
+ "version": "1.0.6-alpha.0",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -20,8 +20,8 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/basic-components": "^1.0.5",
24
- "@kmkf-fe-packages/kmkf-utils": "^1.0.5"
23
+ "@kmkf-fe-packages/basic-components": "^1.0.6-alpha.0",
24
+ "@kmkf-fe-packages/kmkf-utils": "^1.0.6-alpha.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@typescript-eslint/eslint-plugin": "^5.59.2",
@@ -37,7 +37,7 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "038fe7fe31a634868a1bd58c25a63afd0bf44033",
40
+ "gitHead": "590b13c79e758aec62e717947510e6244eb7c510",
41
41
  "gitHooks": {
42
42
  "pre-commit": "lint-staged"
43
43
  }