cloud-business 0.1.124-1 → 0.1.124-11

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/cloud-business.js CHANGED
@@ -3717,6 +3717,659 @@
3717
3717
  showPage: true
3718
3718
  };
3719
3719
 
3720
+ var shuyunUtils = createCommonjsModule(function (module, exports) {
3721
+ (function () {var b={};function p(o){return (p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o})(o)}var c=function(o,t){return JSON.stringify(o)===JSON.stringify(t)};var q=function(o,t){var e=-1;return o.some(function(o,r){return c(o,t)&&(e=r),c(o,t)}),e};var u=function(o){return JSON.parse(JSON.stringify(o))};var v=function(o){var t=!0;for(var e in o)o.hasOwnProperty(e)&&(t=!1);return t};var d=function(o){return {"[object String]":"string","[object Boolean]":"boolean","[object Undefined]":"undefined","[object Number]":"number","[object Object]":"object","[object Error]":"error","[object Function]":"function","[object Date]":"date","[object Array]":"array","[object RegExp]":"regexp","[object Null]":"null","[object NodeList]":"nodeList","[object Arguments]":"arguments","[object Window]":"window","[object HTMLDocument]":"document"}[Object.prototype.toString.call(o)]||(o instanceof Element?"element":"")};var w=function(o){return "string"==typeof o?o.trim():Object.keys(o).reduce(function(t,e){var r=o[e];return "undefined"===d(r)||"null"===d(r)?t:(t[e]=r,t)},{})};var x=function(o){var t="";for(var e in o){var r=o[e];r="object"===p(r)?JSON.stringify(r):r,t="".concat(t,"&").concat(e,"=").concat(r);}return t.replace("&","")};function f(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),t.push.apply(t,o);}return t}function g(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?f(Object(t),!0).forEach(function(e){h(r,e,t[e]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e));});}return r}function h(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function y(r,e){return C(r)||B(r,e)||A(r,e)||z()}function z(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function A(r,e){if(r){if("string"==typeof r)return j(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return "Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?j(r,e):void 0}}function j(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,o=new Array(e);t<e;t++)o[t]=r[t];return o}function B(r,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var t=[],o=!0,n=!1,a=void 0;try{for(var $,s=r[Symbol.iterator]();!(o=($=s.next()).done)&&(t.push($.value),!e||t.length!==e);o=!0);}catch(i){n=!0,a=i;}finally{try{o||null==s.return||s.return();}finally{if(n)throw a}}return t}}function C(r){if(Array.isArray(r))return r}var D=function(r){return r.replace(/-\w/g,function(r){return r.split("-")[1].toUpperCase()})};var E=function(r){return r.replace(/([A-Z])/g,"-$1").toLowerCase()};var F=function(r){return r.replace(/^\?/,"").split("&").reduce(function(r,e){var t=y(e.split("="),2),o=t[0],n=t[1],a=void 0===n?"":n;return g(g({},r),{},h({},o,a))},{})};var k=function(e,t,r,n){var o={percentile:{digits:100,sign:"%"},thousands:{digits:1e3,sign:"\u2030"}}[e],s=Math.pow(10,r),$=parseInt(t*o.digits*s,10)/s;return n?Number($).toFixed(r)+o.sign:$+o.sign},G=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k("percentile",e,t,r)};var H=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k("thousands",e,t,r)};var I=function(e){var t=document.createElement("input");t.style.cssText="position:absolute;top:0;z-index: -999;",t.value=e,document.body.appendChild(t),t.select();var o=document.execCommand("copy");return t.remove(),o};var J=function(e){var t=document.createElement("div");t.style.display="inline-block",t.style.opacity="0",t.innerText=e,document.body.appendChild(t);var o=window.getComputedStyle(t).width;return document.body.removeChild(t),parseInt(o,10)};var K=function(t,e){var o=Blob.prototype,n=null;if(Object.getPrototypeOf(t)===o&&(n=t),t.data&&Object.getPrototypeOf(t.data)===o&&(n=t.data),!n||Object.getPrototypeOf(n)!==o)return !1;var r=document.createElement("a");r.addEventListener("click",function(){r.download=e,r.href=Window.URL.createObjectURL(n);});var a=document.createEvent("MouseEvents");return a.initEvent("click",!1,!1),r.dispatchEvent(a),!0};function L(t){return (L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a);}}function N(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),t}var O=function(){function t(e){switch(M(this,t),L(e)){case"number":if(13===e.toString().length)return void this.parseDate(new Date(e));this.parseStr(e.toString());break;case"string":this.parseStr(e);break;case"object":this.parseDate(e.constructor===Date?e:new Date);break;default:this.parseDate(new Date);}}return N(t,[{key:"parseStr",value:function(t){var e=t.replace(/\D/g,""),r={fullYear_str:e.substr(0,4),year_str:e.substr(2,4),month_str:e.substr(4,2),date_str:e.substr(6,2),hour_str:e.substr(8,2),minute_str:e.substr(10,2),second_str:e.substr(12,2)};if(r.fullYear_str&&r.month_str&&r.date_str){var a="".concat(r.fullYear_str,"/").concat(r.month_str,"/").concat(r.date_str," ").concat(r.hour_str||"00",":").concat(r.minute_str||"00",":").concat(r.second_str||"00");this.parseDate(new Date(a));}else this.parseDate(new Date);}},{key:"parseDate",value:function(t){this.fullYear=t.getFullYear(),this.year=parseInt(t.getFullYear().toString().substr(2,2)),this.month=t.getMonth()+1,this.date=t.getDate(),this.hour=t.getHours(),this.minute=t.getMinutes(),this.second=t.getSeconds(),this.day=t.getDay();}},{key:"format",value:function(t){return t.replace(/YYYY/i,this.fullYear).replace(/YY/i,this.year<10?"0".concat(this.year):this.year).replace(/MM/,this.month<10?"0".concat(this.month):this.month).replace(/DD/i,this.date<10?"0".concat(this.date):this.date).replace(/HH/i,this.hour<10?"0".concat(this.hour):this.hour).replace(/mm/,this.minute<10?"0".concat(this.minute):this.minute).replace(/ss/i,this.second<10?"0".concat(this.second):this.second)}}]),t}(),P=function(t){return new O(t)};var m={copyText:I,getTextWidth:J,moment:P,equal:c,index:q,clone:u,isEmpty:v,type:d,trim:w,toQueryString:x,toHump:D,toHyphen:E,toFormData:F,toPercentile:G,toThousands:H,download:K};b.default=m,b=m;{module.exports=b;}})();
3722
+ });
3723
+
3724
+ var NULL_MAP = {
3725
+ ISNULL: {
3726
+ label: '为空',
3727
+ value: 'ISNULL'
3728
+ },
3729
+ NONULL: {
3730
+ label: '不为空',
3731
+ value: 'NONULL'
3732
+ }
3733
+ };
3734
+ var TAG_NULL_MAP = {
3735
+ TAG_ISNULL: {
3736
+ label: '为空',
3737
+ value: 'TAG_ISNULL'
3738
+ },
3739
+ TAG_NONULL: {
3740
+ label: '不为空',
3741
+ value: 'TAG_NONULL'
3742
+ }
3743
+ };
3744
+ var reg = new RegExp('\'', 'g');
3745
+ var nullList = ['ISNULL', 'NONULL'];
3746
+ function queryTypeMap(moduleType, type) {
3747
+ switch (moduleType) {
3748
+ case 'SELECT':
3749
+ return {
3750
+ operator: 'EQ',
3751
+ operatorName: '等于',
3752
+ rules: 'defalut'
3753
+ };
3754
+ case 'INPUT':
3755
+ return {
3756
+ operator: type === 'SINGLE' ? 'EQ' : 'LIKE',
3757
+ operatorName: type === 'SINGLE' ? '等于' : '内容包含',
3758
+ rules: type === 'SINGLE' ? 'defalut' : 'split'
3759
+ };
3760
+ case 'SELECT_TREE':
3761
+ return {
3762
+ operator: 'EQ',
3763
+ operatorName: '等于',
3764
+ rules: 'normal'
3765
+ };
3766
+ case 'SELECT_INPUT':
3767
+ return {
3768
+ operator: 'SUB_PATTERN',
3769
+ operatorName: '符合模式(截断)',
3770
+ rules: 'sub_pattern'
3771
+ };
3772
+ case 'NUMBER':
3773
+ return {
3774
+ operator: 'BETWEEN_CLOSE',
3775
+ operatorName: '介于(闭区间)',
3776
+ rules: 'between'
3777
+ };
3778
+ case 'DATE':
3779
+ return {
3780
+ operator: type === 'DATE_M' ? 'EQ' : 'BETWEEN_CLOSE',
3781
+ operatorName: type === 'DATE_M' ? '等于' : '介于(闭区间)',
3782
+ rules: type === 'DATE_M' ? 'defalut' : 'between'
3783
+ };
3784
+ }
3785
+ return null;
3786
+ }
3787
+ function configQueryMap(data, query) {
3788
+ var obj = {};
3789
+ data.forEach(function (item) {
3790
+ if (item.groupName) {
3791
+ var optObj = {};
3792
+ if (item.moduleType !== 'NO_VALUE') {
3793
+ optObj = queryTypeMap(item.moduleType, item.type);
3794
+ } else if (query[item.itemId]) {
3795
+ var id = query[item.itemId];
3796
+ optObj.operator = TAG_NULL_MAP[id].value;
3797
+ optObj.operatorName = TAG_NULL_MAP[id].label;
3798
+ optObj.rules = 'noValue';
3799
+ }
3800
+ obj = _objectSpread2(_objectSpread2({}, obj), {}, _defineProperty({}, item.itemId, _objectSpread2({
3801
+ field: item.itemId,
3802
+ desc: item.itemName,
3803
+ tagsFlag: 'tags',
3804
+ type: item.type,
3805
+ moduleType: item.moduleType,
3806
+ dataSource: item.configs,
3807
+ status: item.status
3808
+ }, optObj)));
3809
+ } else {
3810
+ obj = _objectSpread2(_objectSpread2({}, obj), {}, _defineProperty({}, item.itemId, _objectSpread2(_objectSpread2({}, QUERY_MAP[item.itemId]), {}, {
3811
+ type: item.type,
3812
+ moduleType: item.moduleType,
3813
+ dataSource: item.configs,
3814
+ status: item.status,
3815
+ tagsFlag: null
3816
+ })));
3817
+ }
3818
+ });
3819
+ return obj;
3820
+ }
3821
+
3822
+ /**
3823
+ * 过滤对象中空属性
3824
+ * @param {*} obj
3825
+ * @returns
3826
+ */
3827
+ function filterNullValueObject(obj) {
3828
+ for (var i in obj) {
3829
+ if (obj[i] === '' || obj[i] === null || obj[i] === 'null') {
3830
+ delete obj[i];
3831
+ }
3832
+ }
3833
+ return obj;
3834
+ }
3835
+
3836
+ /**
3837
+ * 数组去重
3838
+ */
3839
+ function unique(array) {
3840
+ var keyFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (item) {
3841
+ return item;
3842
+ };
3843
+ var hash = {};
3844
+ var result = [];
3845
+ array.forEach(function (item) {
3846
+ var key = keyFn(item);
3847
+ if (key in hash) return;
3848
+ result.push(item);
3849
+ hash[key] = null;
3850
+ });
3851
+ return result;
3852
+ }
3853
+ function genPlatShopValue(platList, shopList, platShop) {
3854
+ var _platCode = platShop.platCode,
3855
+ _shopId = platShop.shopId;
3856
+ var defaultPlat = platList[0] && platList[0].platCode;
3857
+ var platCode = platList.find(function (plat) {
3858
+ return plat.platCode === _platCode;
3859
+ }) ? _platCode : defaultPlat;
3860
+ var defaultShop = (shopList.find(function (shop) {
3861
+ return shop.platCode === platCode;
3862
+ }) || {}).shopId;
3863
+ var shopId = shopList.find(function (shop) {
3864
+ return shop.shopId === _shopId;
3865
+ }) ? _shopId : defaultShop;
3866
+ return {
3867
+ shopId: shopId,
3868
+ platCode: platCode
3869
+ };
3870
+ }
3871
+
3872
+ /**
3873
+ * 全部商品tab-请求参数转化
3874
+ * @param {*} data 需要转化的数据
3875
+ * @param {*} config 配置项枚举信息
3876
+ */
3877
+ function allTabFormatting(config, data) {
3878
+ var arr = [];
3879
+ Object.keys(data).forEach(function (item) {
3880
+ if (config[item]) {
3881
+ var obj = {
3882
+ field: config[item].field,
3883
+ fieldName: config[item].desc,
3884
+ configName: item,
3885
+ tagsFlag: config[item].tagsFlag,
3886
+ operator: config[item].operator,
3887
+ operatorName: config[item].operatorName
3888
+ };
3889
+ switch (config[item].rules) {
3890
+ case 'normal':
3891
+ if (data[item]) {
3892
+ if (config[item].type === 'SINGLE') {
3893
+ obj.value = [data[item].value];
3894
+ obj.semantic = [data[item].label];
3895
+ } else {
3896
+ var ids = [];
3897
+ var names = [];
3898
+ data[item].forEach(function (str) {
3899
+ ids.push(str.id);
3900
+ names.push(str.name);
3901
+ });
3902
+ obj.semantic = names;
3903
+ obj.value = config[item].tagsFlag ? names : ids;
3904
+ }
3905
+ }
3906
+ break;
3907
+ case 'between':
3908
+ data[item].start = "".concat(data[item].start);
3909
+ data[item].end = "".concat(data[item].end);
3910
+ if (data[item].datetype) {
3911
+ obj.relative = data[item].datetype;
3912
+ }
3913
+ if (data[item].dateUnit) {
3914
+ obj.timeUnit = data[item].dateUnit;
3915
+ }
3916
+ if (data[item].start || data[item].end) {
3917
+ obj.value = [data[item].start, data[item].end];
3918
+ obj.semantic = [data[item].start, data[item].end];
3919
+ }
3920
+ break;
3921
+ case 'split':
3922
+ if (data[item]) {
3923
+ var _value = data[item].replace(reg, '\\\'');
3924
+ obj.value = _value.split(',');
3925
+ obj.semantic = data[item].split(',');
3926
+ }
3927
+ break;
3928
+ case 'sub_pattern':
3929
+ if (data[item]) {
3930
+ if (typeof data[item] === 'string') {
3931
+ var _value2 = data[item].replace(reg, '\\\'');
3932
+ obj.value = [_value2];
3933
+ var val = data[item].split(':');
3934
+ if (val.length > 1) {
3935
+ obj.semantic = ["\u622A\u53D6".concat(val[0], "\u81F3").concat(val[1], "\u4F4D\uFF0C\u5B57\u7B26\u662F").concat(val[2])];
3936
+ } else {
3937
+ obj.operatorName = '等于';
3938
+ obj.semantic = [data[item]];
3939
+ }
3940
+ }
3941
+ }
3942
+ break;
3943
+ default:
3944
+ if (data[item]) {
3945
+ if (config[item].field === 'platCode') {
3946
+ // 假如平台code标识,需要找出平台名称
3947
+ data.platList.forEach(function (val) {
3948
+ if (val.platCode === data[item]) {
3949
+ obj.semantic = [val.platName];
3950
+ obj.value = [data[item]];
3951
+ }
3952
+ });
3953
+ } else if (config[item].field === 'shopId') {
3954
+ // 假如是店铺ID标识,需要找出店铺名称
3955
+ data.shopList.forEach(function (val) {
3956
+ if (val.shopId === data[item]) {
3957
+ obj.semantic = [val.shopName];
3958
+ obj.value = [data[item]];
3959
+ }
3960
+ });
3961
+ } else if (config[item].moduleType === 'SELECT' || config[item].moduleType === 'DATE') {
3962
+ if (config[item].type === 'SINGLE') {
3963
+ var _list = config[item].dataSource.filter(function (el) {
3964
+ return el.value === data[item];
3965
+ });
3966
+ obj.semantic = [_list[0].label];
3967
+ obj.value = config[item].tagsFlag ? [_list[0].label] : [_list[0].value];
3968
+ } else if (config[item].type === 'MULTIPLE' || config[item].type === 'DATE_M') {
3969
+ var values = data[item] && data[item].map(function (el) {
3970
+ var findTemp = config[item].dataSource.find(function (innerItem) {
3971
+ return innerItem.value === el;
3972
+ });
3973
+ return (findTemp || {}).label;
3974
+ });
3975
+ obj.value = values;
3976
+ obj.semantic = values;
3977
+ } else if (config[item].moduleType === 'N0_VALUE') {
3978
+ obj.semantic = NULL_MAP[data[item]].label;
3979
+ obj.value = [data[item]];
3980
+ obj.operator = NULL_MAP[data[item]].value;
3981
+ obj.operatorName = NULL_MAP[data[item]].label;
3982
+ } else {
3983
+ obj.semantic = [data[item]];
3984
+ obj.value = [data[item]];
3985
+ }
3986
+ } else {
3987
+ obj.semantic = [data[item]];
3988
+ var _value3 = data[item].replace(reg, '\\\'');
3989
+ obj.value = [_value3];
3990
+ }
3991
+ }
3992
+ }
3993
+ arr.push(obj);
3994
+ }
3995
+ });
3996
+ /**
3997
+ *
3998
+ */
3999
+ return arr.filter(function (item) {
4000
+ return item.value && item.value.length >= 1;
4001
+ });
4002
+ }
4003
+
4004
+ /**
4005
+ * 商品选择tab窗口,根据筛选条件格式化数据
4006
+ * @param {*} data
4007
+ */
4008
+ function parsingCondition(data) {
4009
+ var arr = [];
4010
+ var list = ['shopId', 'prod.outer_id', 'sku.outer_id', 'prod.product_id', 'sku.sku_id'];
4011
+ data.forEach(function (item) {
4012
+ var obj = {
4013
+ field: '',
4014
+ fieldName: '',
4015
+ operator: '',
4016
+ operatorName: '',
4017
+ semantic: [],
4018
+ value: []
4019
+ };
4020
+ obj.tagsFlag = item.field.groupName ? 'tags' : null;
4021
+ obj.field = item.field.field;
4022
+ obj.fieldName = item.field.desc;
4023
+ obj.operator = item.operator.value;
4024
+ obj.operatorName = item.operator.label;
4025
+ if (list.includes(item.field.field)) {
4026
+ switch (item.field.field) {
4027
+ case 'shopId':
4028
+ // 上架店铺(需要解析出平台code)
4029
+ if (item.value) {
4030
+ arr.push({
4031
+ field: 'platCode',
4032
+ fieldName: '平台名称',
4033
+ operator: item.operator.value,
4034
+ operatorName: '等于',
4035
+ semantic: [item.value.plat.label],
4036
+ value: [item.value.plat.value]
4037
+ });
4038
+ obj.semantic = item.value.shops.map(function (shop) {
4039
+ return shop.label;
4040
+ });
4041
+ obj.value = item.value.shops.map(function (shop) {
4042
+ return shop.value;
4043
+ });
4044
+ }
4045
+ break;
4046
+ case 'prod.outer_id': // 商品商家编码
4047
+ case 'sku.outer_id':
4048
+ // sku商家编码
4049
+ if (item.value) {
4050
+ if (item.operator.value === 'SUB_PATTERN') {
4051
+ // 如果是截断模式
4052
+ obj.value = ["".concat(item.value.begin, ":").concat(item.value.end, ":").concat(item.value.value.replace(reg, '\\\''))];
4053
+ obj.semantic = ["\u622A\u53D6".concat(item.value.begin, "\u81F3").concat(item.value.end, "\u4F4D,\u5B57\u7B26\u662F").concat(item.value.value)];
4054
+ } else if (Array.isArray(item.value)) {
4055
+ obj.semantic = item.value.filter(function (val) {
4056
+ return val !== '';
4057
+ });
4058
+ obj.value = item.value.filter(function (val) {
4059
+ return val !== '';
4060
+ }).map(function (val) {
4061
+ return val.replace(reg, '\\\'');
4062
+ });
4063
+ } else {
4064
+ obj.semantic = [item.value];
4065
+ obj.value = [item.value.replace(reg, '\\\'')];
4066
+ }
4067
+ } else if (nullList.includes(item.operator.value)) {
4068
+ obj.value = [NULL_MAP[item.operator.value].value];
4069
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4070
+ }
4071
+ break;
4072
+ case 'prod.product_id':
4073
+ case 'sku.sku_id':
4074
+ if (item.value) {
4075
+ if (Array.isArray(item.value)) {
4076
+ obj.semantic = item.value.filter(function (val) {
4077
+ return val !== '';
4078
+ });
4079
+ obj.value = item.value.filter(function (val) {
4080
+ return val !== '';
4081
+ }).map(function (val) {
4082
+ return val.replace(reg, '\\\'');
4083
+ });
4084
+ } else {
4085
+ obj.semantic = [item.value];
4086
+ obj.value = [item.value.replace(reg, '\\\'')];
4087
+ }
4088
+ }
4089
+ break;
4090
+ }
4091
+ } else {
4092
+ switch (item.field.type) {
4093
+ case 'NO_VALUE':
4094
+ // 无值类
4095
+ obj.semantic = [item.operator.label];
4096
+ obj.value = [item.operator.value];
4097
+ break;
4098
+ case 'DATE_YMD': // 年月日
4099
+ case 'DATE_MD':
4100
+ // 月日
4101
+ if (item.value) {
4102
+ if (item.operator.value === 'BETWEEN_CLOSE' || item.operator.value === 'BETWEEN_OPEN') {
4103
+ // 假如是区间类型
4104
+ obj.value = item.value ? [item.value.start || '', item.value.end || ''] : [item.value];
4105
+ obj.semantic = item.value ? [item.value.start || '', item.value.end || ''] : [item.value];
4106
+ } else if (nullList.includes(item.operator.value)) {
4107
+ obj.value = [NULL_MAP[item.operator.value].value];
4108
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4109
+ } else {
4110
+ obj.value = item.value ? [item.value] : [''];
4111
+ obj.semantic = item.value ? [item.value] : [''];
4112
+ }
4113
+ } else if (nullList.includes(item.operator.value)) {
4114
+ obj.value = [NULL_MAP[item.operator.value].value];
4115
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4116
+ }
4117
+ break;
4118
+ case 'DATE_M':
4119
+ // 月
4120
+ if (item.value) {
4121
+ obj.value = item.value;
4122
+ obj.semantic = item.value.map(function (el) {
4123
+ var findTemp = item.field.dataSource.find(function (innerItem) {
4124
+ return Number(innerItem.value) === Number(el);
4125
+ });
4126
+ return (findTemp || {}).label;
4127
+ });
4128
+ } else if (nullList.includes(item.operator.value)) {
4129
+ obj.value = [NULL_MAP[item.operator.value].value];
4130
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4131
+ }
4132
+ break;
4133
+ case 'CATEGORY_SELECT_TREE':
4134
+ obj.field = item.field.field;
4135
+ obj.fieldName = item.field.desc;
4136
+ obj.operator = item.operator.value;
4137
+ obj.operatorName = item.operator.label;
4138
+ if (item.value) {
4139
+ var categoriesIds = [];
4140
+ var categoriesName = [];
4141
+ item.value.categories.forEach(function (str) {
4142
+ categoriesIds.push(str.id);
4143
+ categoriesName.push(str.name);
4144
+ });
4145
+ obj.semantic = categoriesName;
4146
+ obj.value = categoriesIds;
4147
+ } else if (item.operator.value === 'ISNULL') {
4148
+ obj.semantic = ['为空'];
4149
+ obj.value = ['ISNULL'];
4150
+ } else if (item.operator.value === 'NONULL') {
4151
+ obj.semantic = ['不为空'];
4152
+ obj.value = ['NONULL'];
4153
+ }
4154
+ break;
4155
+ case 'SELECT_MULTIPLE_TREE':
4156
+ // 下拉树多选
4157
+ if (item.value) {
4158
+ var ids = [];
4159
+ var names = [];
4160
+ var _list = item.value;
4161
+ _list.forEach(function (str) {
4162
+ ids.push(str.id);
4163
+ names.push(str.name);
4164
+ });
4165
+ obj.semantic = names;
4166
+ obj.value = names;
4167
+ } else if (nullList.includes(item.operator.value)) {
4168
+ obj.value = [NULL_MAP[item.operator.value].label];
4169
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4170
+ }
4171
+ break;
4172
+ case 'SELECT_TREE':
4173
+ // 下拉树单选
4174
+ if (item.value) {
4175
+ obj.semantic = [item.field.label];
4176
+ obj.value = [item.field.label];
4177
+ } else if (nullList.includes(item.operator.value)) {
4178
+ obj.value = [NULL_MAP[item.operator.value].value];
4179
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4180
+ }
4181
+ break;
4182
+ case 'MULTIPLE_SELECT':
4183
+ // 下拉多选
4184
+ if (item.value) {
4185
+ var _item$value;
4186
+ var values = (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.map(function (el) {
4187
+ var findTemp = item.field.dataSource.find(function (innerItem) {
4188
+ return innerItem.value === el;
4189
+ });
4190
+ return (findTemp || {}).label;
4191
+ });
4192
+ obj.value = values;
4193
+ obj.semantic = values;
4194
+ } else if (nullList.includes(item.operator.value)) {
4195
+ obj.value = [NULL_MAP[item.operator.value].value];
4196
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4197
+ }
4198
+ break;
4199
+ case 'SELECT':
4200
+ // 下拉单选
4201
+ if (item.value) {
4202
+ obj.value = [item.value];
4203
+ var _list2 = item.field.dataSource.filter(function (el) {
4204
+ return el.value === item.value;
4205
+ });
4206
+ obj.semantic = [_list2[0].label];
4207
+ } else if (nullList.includes(item.operator.value)) {
4208
+ obj.value = [NULL_MAP[item.operator.value].value];
4209
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4210
+ }
4211
+ break;
4212
+ case 'NUMBER_INT': // 整数
4213
+ case 'NUMBER_DECIMAL':
4214
+ // 小数
4215
+ if (item.value || item.value === 0) {
4216
+ obj.semantic = Array.isArray(item.value) ? item.value : [item.value];
4217
+ obj.value = Array.isArray(item.value) ? item.value : [item.value];
4218
+ } else if (nullList.includes(item.operator.value)) {
4219
+ obj.value = [NULL_MAP[item.operator.value].value];
4220
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4221
+ }
4222
+ break;
4223
+ case 'STRING':
4224
+ // 字符
4225
+ if (item.value) {
4226
+ if (item.operator.value === 'LIKE') {
4227
+ // 假如是like操作还需要区分出或者还是并且的关系
4228
+ obj.value = item.value.value.map(function (val) {
4229
+ return val.replace(reg, '\\\'');
4230
+ });
4231
+ obj.multiText = item.value.relation ? 'AND' : 'OR';
4232
+ obj.semantic = item.value;
4233
+ } else if (Array.isArray(item.value)) {
4234
+ obj.semantic = item.value.filter(function (val) {
4235
+ return val !== '';
4236
+ });
4237
+ obj.value = item.value.filter(function (val) {
4238
+ return val !== '';
4239
+ }).map(function (val) {
4240
+ return val.replace(reg, '\\\'');
4241
+ });
4242
+ } else {
4243
+ obj.semantic = [item.value];
4244
+ obj.value = [item.value.replace(reg, '\\\'')];
4245
+ }
4246
+ } else if (nullList.includes(item.operator.value)) {
4247
+ obj.value = [NULL_MAP[item.operator.value].value];
4248
+ obj.semantic = [NULL_MAP[item.operator.value].label];
4249
+ }
4250
+ break;
4251
+ }
4252
+ }
4253
+ arr.push(obj);
4254
+ });
4255
+ return arr;
4256
+ }
4257
+ function copyText(semantic) {
4258
+ return function copy() {
4259
+ shuyunUtils.copyText(semantic.join(','));
4260
+ cloudReact.Message.success('复制成功');
4261
+ };
4262
+ }
4263
+
4264
+ /**
4265
+ * 通用类将查询条件转化为字符串方法
4266
+ * @param {*} array
4267
+ */
4268
+ function queryConditionToString(array) {
4269
+ var PROD_PRODUCT_ID = FIELD_STACKS.PROD_PRODUCT_ID,
4270
+ PROD_OUTER_ID = FIELD_STACKS.PROD_OUTER_ID,
4271
+ SKU_SKU_ID = FIELD_STACKS.SKU_SKU_ID,
4272
+ SKU_OUTER_ID = FIELD_STACKS.SKU_OUTER_ID;
4273
+ var obj = {
4274
+ str: [],
4275
+ title: [],
4276
+ value: array
4277
+ };
4278
+ array.forEach(function (item) {
4279
+ var operator = item.operator,
4280
+ fieldName = item.fieldName,
4281
+ field = item.field,
4282
+ operatorName = item.operatorName,
4283
+ relative = item.relative,
4284
+ semantic = item.semantic,
4285
+ timeUnit = item.timeUnit;
4286
+ switch (operator) {
4287
+ case OPERATOR_STACKS.TAG_ISNULL:
4288
+ case OPERATOR_STACKS.TAG_NONULL:
4289
+ case OPERATOR_STACKS.ISNULL:
4290
+ case OPERATOR_STACKS.NONULL:
4291
+ obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName));
4292
+ obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName));
4293
+ break;
4294
+ case OPERATOR_STACKS.BETWEEN_CLOSE:
4295
+ case OPERATOR_STACKS.BETWEEN_OPEN:
4296
+ if (field === 'prod.online_time' && relative) {
4297
+ obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName, "\u8FC7\u53BB").concat(semantic[0], "-").concat(semantic[1]).concat(timeUnit ? '月' : '天'));
4298
+ obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName, "\u8FC7\u53BB").concat(semantic[0], "-").concat(semantic[1]).concat(timeUnit ? '月' : '天'));
4299
+ } else {
4300
+ obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic[0], "-").concat(semantic[1]));
4301
+ obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic[0], "-").concat(semantic[1]));
4302
+ }
4303
+ break;
4304
+ case OPERATOR_STACKS.LIKE:
4305
+ /* eslint-disable-next-line */
4306
+ var connectSymbol = {
4307
+ OR: '或',
4308
+ AND: '和'
4309
+ }[item.multiText] || ',';
4310
+ if (item.multiText) {
4311
+ var _semantic$value, _semantic$value2;
4312
+ obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic === null || semantic === void 0 ? void 0 : (_semantic$value = semantic.value) === null || _semantic$value === void 0 ? void 0 : _semantic$value.join(connectSymbol)));
4313
+ obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic === null || semantic === void 0 ? void 0 : (_semantic$value2 = semantic.value) === null || _semantic$value2 === void 0 ? void 0 : _semantic$value2.join(connectSymbol)));
4314
+ } else {
4315
+ obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic === null || semantic === void 0 ? void 0 : semantic.join(connectSymbol)));
4316
+ obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic === null || semantic === void 0 ? void 0 : semantic.join(connectSymbol)));
4317
+ }
4318
+ break;
4319
+ default:
4320
+ if ([PROD_PRODUCT_ID, PROD_OUTER_ID, SKU_SKU_ID, SKU_OUTER_ID].includes(field) && operator === OPERATOR_STACKS.EQ) {
4321
+ obj.str.push([fieldName, '=', /*#__PURE__*/React__default['default'].createElement("span", {
4322
+ key: semantic.toString(),
4323
+ onClick: copyText(item.semantic),
4324
+ style: {
4325
+ padding: '0 4px',
4326
+ cursor: 'pointer'
4327
+ }
4328
+ }, semantic.length), '个'
4329
+ // `${getSuffixNameByField(item.field)}`
4330
+ ]);
4331
+ } else {
4332
+ obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic.join(',')));
4333
+ }
4334
+ obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic.join(',')));
4335
+ break;
4336
+ }
4337
+ });
4338
+ obj.str = obj.str.reduce(function (acc, item, idx) {
4339
+ if (idx > 0) acc.push(', ');
4340
+ acc.push(item);
4341
+ return acc;
4342
+ }, []);
4343
+ return obj;
4344
+ }
4345
+
4346
+ /**
4347
+ * 计算已选商品和sku的数量
4348
+ * @param {*} Object || Array
4349
+ */
4350
+ function resultGoodsLength(obj) {
4351
+ var len = 0;
4352
+ if (Array.isArray(obj)) {
4353
+ obj.forEach(function (item) {
4354
+ if (item.rowExpandable) {
4355
+ len += item.skus.length;
4356
+ } else {
4357
+ len += 1;
4358
+ }
4359
+ });
4360
+ } else {
4361
+ Object.keys(obj).forEach(function (item) {
4362
+ if (obj[item].rowExpandable) {
4363
+ // 假如是sku展开状态则商品数量以sku数量为准
4364
+ len += obj[item].skus.length;
4365
+ } else {
4366
+ len += 1;
4367
+ }
4368
+ });
4369
+ }
4370
+ return len;
4371
+ }
4372
+
3720
4373
  var Store = /*#__PURE__*/function () {
3721
4374
  function Store() {
3722
4375
  _classCallCheck(this, Store);
@@ -3999,7 +4652,7 @@
3999
4652
  case 0:
4000
4653
  url = "".concat(server, "/product-selector/2.0/batch/import?tenant=").concat(extraQuery);
4001
4654
  _context7.next = 3;
4002
- return http.post(url, data);
4655
+ return http.post(url, filterNullValueObject(data));
4003
4656
  case 3:
4004
4657
  result = _context7.sent;
4005
4658
  if (result.data.success) {
@@ -4349,640 +5002,6 @@
4349
5002
  }();
4350
5003
  var Store$1 = new Store();
4351
5004
 
4352
- var shuyunUtils = createCommonjsModule(function (module, exports) {
4353
- (function () {var b={};function p(o){return (p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o})(o)}var c=function(o,t){return JSON.stringify(o)===JSON.stringify(t)};var q=function(o,t){var e=-1;return o.some(function(o,r){return c(o,t)&&(e=r),c(o,t)}),e};var u=function(o){return JSON.parse(JSON.stringify(o))};var v=function(o){var t=!0;for(var e in o)o.hasOwnProperty(e)&&(t=!1);return t};var d=function(o){return {"[object String]":"string","[object Boolean]":"boolean","[object Undefined]":"undefined","[object Number]":"number","[object Object]":"object","[object Error]":"error","[object Function]":"function","[object Date]":"date","[object Array]":"array","[object RegExp]":"regexp","[object Null]":"null","[object NodeList]":"nodeList","[object Arguments]":"arguments","[object Window]":"window","[object HTMLDocument]":"document"}[Object.prototype.toString.call(o)]||(o instanceof Element?"element":"")};var w=function(o){return "string"==typeof o?o.trim():Object.keys(o).reduce(function(t,e){var r=o[e];return "undefined"===d(r)||"null"===d(r)?t:(t[e]=r,t)},{})};var x=function(o){var t="";for(var e in o){var r=o[e];r="object"===p(r)?JSON.stringify(r):r,t="".concat(t,"&").concat(e,"=").concat(r);}return t.replace("&","")};function f(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),t.push.apply(t,o);}return t}function g(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?f(Object(t),!0).forEach(function(e){h(r,e,t[e]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e));});}return r}function h(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function y(r,e){return C(r)||B(r,e)||A(r,e)||z()}function z(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function A(r,e){if(r){if("string"==typeof r)return j(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return "Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?j(r,e):void 0}}function j(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,o=new Array(e);t<e;t++)o[t]=r[t];return o}function B(r,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var t=[],o=!0,n=!1,a=void 0;try{for(var $,s=r[Symbol.iterator]();!(o=($=s.next()).done)&&(t.push($.value),!e||t.length!==e);o=!0);}catch(i){n=!0,a=i;}finally{try{o||null==s.return||s.return();}finally{if(n)throw a}}return t}}function C(r){if(Array.isArray(r))return r}var D=function(r){return r.replace(/-\w/g,function(r){return r.split("-")[1].toUpperCase()})};var E=function(r){return r.replace(/([A-Z])/g,"-$1").toLowerCase()};var F=function(r){return r.replace(/^\?/,"").split("&").reduce(function(r,e){var t=y(e.split("="),2),o=t[0],n=t[1],a=void 0===n?"":n;return g(g({},r),{},h({},o,a))},{})};var k=function(e,t,r,n){var o={percentile:{digits:100,sign:"%"},thousands:{digits:1e3,sign:"\u2030"}}[e],s=Math.pow(10,r),$=parseInt(t*o.digits*s,10)/s;return n?Number($).toFixed(r)+o.sign:$+o.sign},G=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k("percentile",e,t,r)};var H=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k("thousands",e,t,r)};var I=function(e){var t=document.createElement("input");t.style.cssText="position:absolute;top:0;z-index: -999;",t.value=e,document.body.appendChild(t),t.select();var o=document.execCommand("copy");return t.remove(),o};var J=function(e){var t=document.createElement("div");t.style.display="inline-block",t.style.opacity="0",t.innerText=e,document.body.appendChild(t);var o=window.getComputedStyle(t).width;return document.body.removeChild(t),parseInt(o,10)};var K=function(t,e){var o=Blob.prototype,n=null;if(Object.getPrototypeOf(t)===o&&(n=t),t.data&&Object.getPrototypeOf(t.data)===o&&(n=t.data),!n||Object.getPrototypeOf(n)!==o)return !1;var r=document.createElement("a");r.addEventListener("click",function(){r.download=e,r.href=Window.URL.createObjectURL(n);});var a=document.createEvent("MouseEvents");return a.initEvent("click",!1,!1),r.dispatchEvent(a),!0};function L(t){return (L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a);}}function N(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),t}var O=function(){function t(e){switch(M(this,t),L(e)){case"number":if(13===e.toString().length)return void this.parseDate(new Date(e));this.parseStr(e.toString());break;case"string":this.parseStr(e);break;case"object":this.parseDate(e.constructor===Date?e:new Date);break;default:this.parseDate(new Date);}}return N(t,[{key:"parseStr",value:function(t){var e=t.replace(/\D/g,""),r={fullYear_str:e.substr(0,4),year_str:e.substr(2,4),month_str:e.substr(4,2),date_str:e.substr(6,2),hour_str:e.substr(8,2),minute_str:e.substr(10,2),second_str:e.substr(12,2)};if(r.fullYear_str&&r.month_str&&r.date_str){var a="".concat(r.fullYear_str,"/").concat(r.month_str,"/").concat(r.date_str," ").concat(r.hour_str||"00",":").concat(r.minute_str||"00",":").concat(r.second_str||"00");this.parseDate(new Date(a));}else this.parseDate(new Date);}},{key:"parseDate",value:function(t){this.fullYear=t.getFullYear(),this.year=parseInt(t.getFullYear().toString().substr(2,2)),this.month=t.getMonth()+1,this.date=t.getDate(),this.hour=t.getHours(),this.minute=t.getMinutes(),this.second=t.getSeconds(),this.day=t.getDay();}},{key:"format",value:function(t){return t.replace(/YYYY/i,this.fullYear).replace(/YY/i,this.year<10?"0".concat(this.year):this.year).replace(/MM/,this.month<10?"0".concat(this.month):this.month).replace(/DD/i,this.date<10?"0".concat(this.date):this.date).replace(/HH/i,this.hour<10?"0".concat(this.hour):this.hour).replace(/mm/,this.minute<10?"0".concat(this.minute):this.minute).replace(/ss/i,this.second<10?"0".concat(this.second):this.second)}}]),t}(),P=function(t){return new O(t)};var m={copyText:I,getTextWidth:J,moment:P,equal:c,index:q,clone:u,isEmpty:v,type:d,trim:w,toQueryString:x,toHump:D,toHyphen:E,toFormData:F,toPercentile:G,toThousands:H,download:K};b.default=m,b=m;{module.exports=b;}})();
4354
- });
4355
-
4356
- var NULL_MAP = {
4357
- ISNULL: {
4358
- label: '为空',
4359
- value: 'ISNULL'
4360
- },
4361
- NONULL: {
4362
- label: '不为空',
4363
- value: 'NONULL'
4364
- }
4365
- };
4366
- var TAG_NULL_MAP = {
4367
- TAG_ISNULL: {
4368
- label: '为空',
4369
- value: 'TAG_ISNULL'
4370
- },
4371
- TAG_NONULL: {
4372
- label: '不为空',
4373
- value: 'TAG_NONULL'
4374
- }
4375
- };
4376
- var reg = new RegExp('\'', 'g');
4377
- var nullList = ['ISNULL', 'NONULL'];
4378
- function queryTypeMap(moduleType, type) {
4379
- switch (moduleType) {
4380
- case 'SELECT':
4381
- return {
4382
- operator: 'EQ',
4383
- operatorName: '等于',
4384
- rules: 'defalut'
4385
- };
4386
- case 'INPUT':
4387
- return {
4388
- operator: type === 'SINGLE' ? 'EQ' : 'LIKE',
4389
- operatorName: type === 'SINGLE' ? '等于' : '内容包含',
4390
- rules: type === 'SINGLE' ? 'defalut' : 'split'
4391
- };
4392
- case 'SELECT_TREE':
4393
- return {
4394
- operator: 'EQ',
4395
- operatorName: '等于',
4396
- rules: 'normal'
4397
- };
4398
- case 'SELECT_INPUT':
4399
- return {
4400
- operator: 'SUB_PATTERN',
4401
- operatorName: '符合模式(截断)',
4402
- rules: 'sub_pattern'
4403
- };
4404
- case 'NUMBER':
4405
- return {
4406
- operator: 'BETWEEN_CLOSE',
4407
- operatorName: '介于(闭区间)',
4408
- rules: 'between'
4409
- };
4410
- case 'DATE':
4411
- return {
4412
- operator: type === 'DATE_M' ? 'EQ' : 'BETWEEN_CLOSE',
4413
- operatorName: type === 'DATE_M' ? '等于' : '介于(闭区间)',
4414
- rules: type === 'DATE_M' ? 'defalut' : 'between'
4415
- };
4416
- }
4417
- return null;
4418
- }
4419
- function configQueryMap(data, query) {
4420
- var obj = {};
4421
- data.forEach(function (item) {
4422
- if (item.groupName) {
4423
- var optObj = {};
4424
- if (item.moduleType !== 'NO_VALUE') {
4425
- optObj = queryTypeMap(item.moduleType, item.type);
4426
- } else if (query[item.itemId]) {
4427
- var id = query[item.itemId];
4428
- optObj.operator = TAG_NULL_MAP[id].value;
4429
- optObj.operatorName = TAG_NULL_MAP[id].label;
4430
- optObj.rules = 'noValue';
4431
- }
4432
- obj = _objectSpread2(_objectSpread2({}, obj), {}, _defineProperty({}, item.itemId, _objectSpread2({
4433
- field: item.itemId,
4434
- desc: item.itemName,
4435
- tagsFlag: 'tags',
4436
- type: item.type,
4437
- moduleType: item.moduleType,
4438
- dataSource: item.configs,
4439
- status: item.status
4440
- }, optObj)));
4441
- } else {
4442
- obj = _objectSpread2(_objectSpread2({}, obj), {}, _defineProperty({}, item.itemId, _objectSpread2(_objectSpread2({}, QUERY_MAP[item.itemId]), {}, {
4443
- type: item.type,
4444
- moduleType: item.moduleType,
4445
- dataSource: item.configs,
4446
- status: item.status,
4447
- tagsFlag: null
4448
- })));
4449
- }
4450
- });
4451
- return obj;
4452
- }
4453
-
4454
- /**
4455
- * 数组去重
4456
- */
4457
- function unique(array) {
4458
- var keyFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (item) {
4459
- return item;
4460
- };
4461
- var hash = {};
4462
- var result = [];
4463
- array.forEach(function (item) {
4464
- var key = keyFn(item);
4465
- if (key in hash) return;
4466
- result.push(item);
4467
- hash[key] = null;
4468
- });
4469
- return result;
4470
- }
4471
- function genPlatShopValue(platList, shopList, platShop) {
4472
- var _platCode = platShop.platCode,
4473
- _shopId = platShop.shopId;
4474
- var defaultPlat = platList[0] && platList[0].platCode;
4475
- var platCode = platList.find(function (plat) {
4476
- return plat.platCode === _platCode;
4477
- }) ? _platCode : defaultPlat;
4478
- var defaultShop = (shopList.find(function (shop) {
4479
- return shop.platCode === platCode;
4480
- }) || {}).shopId;
4481
- var shopId = shopList.find(function (shop) {
4482
- return shop.shopId === _shopId;
4483
- }) ? _shopId : defaultShop;
4484
- return {
4485
- shopId: shopId,
4486
- platCode: platCode
4487
- };
4488
- }
4489
-
4490
- /**
4491
- * 全部商品tab-请求参数转化
4492
- * @param {*} data 需要转化的数据
4493
- * @param {*} config 配置项枚举信息
4494
- */
4495
- function allTabFormatting(config, data) {
4496
- var arr = [];
4497
- Object.keys(data).forEach(function (item) {
4498
- if (config[item]) {
4499
- var obj = {
4500
- field: config[item].field,
4501
- fieldName: config[item].desc,
4502
- configName: item,
4503
- tagsFlag: config[item].tagsFlag,
4504
- operator: config[item].operator,
4505
- operatorName: config[item].operatorName
4506
- };
4507
- switch (config[item].rules) {
4508
- case 'normal':
4509
- if (data[item]) {
4510
- if (config[item].type === 'SINGLE') {
4511
- obj.value = [data[item].value];
4512
- obj.semantic = [data[item].label];
4513
- } else {
4514
- var ids = [];
4515
- var names = [];
4516
- data[item].forEach(function (str) {
4517
- ids.push(str.id);
4518
- names.push(str.name);
4519
- });
4520
- obj.semantic = names;
4521
- obj.value = config[item].tagsFlag ? names : ids;
4522
- }
4523
- }
4524
- break;
4525
- case 'between':
4526
- data[item].start = "".concat(data[item].start);
4527
- data[item].end = "".concat(data[item].end);
4528
- if (data[item].datetype) {
4529
- obj.relative = data[item].datetype;
4530
- }
4531
- if (data[item].dateUnit) {
4532
- obj.timeUnit = data[item].dateUnit;
4533
- }
4534
- if (data[item].start || data[item].end) {
4535
- obj.value = [data[item].start, data[item].end];
4536
- obj.semantic = [data[item].start, data[item].end];
4537
- }
4538
- break;
4539
- case 'split':
4540
- if (data[item]) {
4541
- var _value = data[item].replace(reg, '\\\'');
4542
- obj.value = _value.split(',');
4543
- obj.semantic = data[item].split(',');
4544
- }
4545
- break;
4546
- case 'sub_pattern':
4547
- if (data[item]) {
4548
- if (typeof data[item] === 'string') {
4549
- var _value2 = data[item].replace(reg, '\\\'');
4550
- obj.value = [_value2];
4551
- var val = data[item].split(':');
4552
- if (val.length > 1) {
4553
- obj.semantic = ["\u622A\u53D6".concat(val[0], "\u81F3").concat(val[1], "\u4F4D\uFF0C\u5B57\u7B26\u662F").concat(val[2])];
4554
- } else {
4555
- obj.operatorName = '等于';
4556
- obj.semantic = [data[item]];
4557
- }
4558
- }
4559
- }
4560
- break;
4561
- default:
4562
- if (data[item]) {
4563
- if (config[item].field === 'platCode') {
4564
- // 假如平台code标识,需要找出平台名称
4565
- data.platList.forEach(function (val) {
4566
- if (val.platCode === data[item]) {
4567
- obj.semantic = [val.platName];
4568
- obj.value = [data[item]];
4569
- }
4570
- });
4571
- } else if (config[item].field === 'shopId') {
4572
- // 假如是店铺ID标识,需要找出店铺名称
4573
- data.shopList.forEach(function (val) {
4574
- if (val.shopId === data[item]) {
4575
- obj.semantic = [val.shopName];
4576
- obj.value = [data[item]];
4577
- }
4578
- });
4579
- } else if (config[item].moduleType === 'SELECT' || config[item].moduleType === 'DATE') {
4580
- if (config[item].type === 'SINGLE') {
4581
- var _list = config[item].dataSource.filter(function (el) {
4582
- return el.value === data[item];
4583
- });
4584
- obj.semantic = [_list[0].label];
4585
- obj.value = config[item].tagsFlag ? [_list[0].label] : [_list[0].value];
4586
- } else if (config[item].type === 'MULTIPLE' || config[item].type === 'DATE_M') {
4587
- var values = data[item] && data[item].map(function (el) {
4588
- var findTemp = config[item].dataSource.find(function (innerItem) {
4589
- return innerItem.value === el;
4590
- });
4591
- return (findTemp || {}).label;
4592
- });
4593
- obj.value = values;
4594
- obj.semantic = values;
4595
- } else if (config[item].moduleType === 'N0_VALUE') {
4596
- obj.semantic = NULL_MAP[data[item]].label;
4597
- obj.value = [data[item]];
4598
- obj.operator = NULL_MAP[data[item]].value;
4599
- obj.operatorName = NULL_MAP[data[item]].label;
4600
- } else {
4601
- obj.semantic = [data[item]];
4602
- obj.value = [data[item]];
4603
- }
4604
- } else {
4605
- obj.semantic = [data[item]];
4606
- var _value3 = data[item].replace(reg, '\\\'');
4607
- obj.value = [_value3];
4608
- }
4609
- }
4610
- }
4611
- arr.push(obj);
4612
- }
4613
- });
4614
- /**
4615
- *
4616
- */
4617
- return arr.filter(function (item) {
4618
- return item.value && item.value.length >= 1;
4619
- });
4620
- }
4621
-
4622
- /**
4623
- * 商品选择tab窗口,根据筛选条件格式化数据
4624
- * @param {*} data
4625
- */
4626
- function parsingCondition(data) {
4627
- var arr = [];
4628
- var list = ['shopId', 'prod.outer_id', 'sku.outer_id', 'prod.product_id', 'sku.sku_id'];
4629
- data.forEach(function (item) {
4630
- var obj = {
4631
- field: '',
4632
- fieldName: '',
4633
- operator: '',
4634
- operatorName: '',
4635
- semantic: [],
4636
- value: []
4637
- };
4638
- obj.tagsFlag = item.field.groupName ? 'tags' : null;
4639
- obj.field = item.field.field;
4640
- obj.fieldName = item.field.desc;
4641
- obj.operator = item.operator.value;
4642
- obj.operatorName = item.operator.label;
4643
- if (list.includes(item.field.field)) {
4644
- switch (item.field.field) {
4645
- case 'shopId':
4646
- // 上架店铺(需要解析出平台code)
4647
- if (item.value) {
4648
- arr.push({
4649
- field: 'platCode',
4650
- fieldName: '平台名称',
4651
- operator: item.operator.value,
4652
- operatorName: '等于',
4653
- semantic: [item.value.plat.label],
4654
- value: [item.value.plat.value]
4655
- });
4656
- obj.semantic = item.value.shops.map(function (shop) {
4657
- return shop.label;
4658
- });
4659
- obj.value = item.value.shops.map(function (shop) {
4660
- return shop.value;
4661
- });
4662
- }
4663
- break;
4664
- case 'prod.outer_id': // 商品商家编码
4665
- case 'sku.outer_id':
4666
- // sku商家编码
4667
- if (item.value) {
4668
- if (item.operator.value === 'SUB_PATTERN') {
4669
- // 如果是截断模式
4670
- obj.value = ["".concat(item.value.begin, ":").concat(item.value.end, ":").concat(item.value.value.replace(reg, '\\\''))];
4671
- obj.semantic = ["\u622A\u53D6".concat(item.value.begin, "\u81F3").concat(item.value.end, "\u4F4D,\u5B57\u7B26\u662F").concat(item.value.value)];
4672
- } else if (Array.isArray(item.value)) {
4673
- obj.semantic = item.value.filter(function (val) {
4674
- return val !== '';
4675
- });
4676
- obj.value = item.value.filter(function (val) {
4677
- return val !== '';
4678
- }).map(function (val) {
4679
- return val.replace(reg, '\\\'');
4680
- });
4681
- } else {
4682
- obj.semantic = [item.value];
4683
- obj.value = [item.value.replace(reg, '\\\'')];
4684
- }
4685
- } else if (nullList.includes(item.operator.value)) {
4686
- obj.value = [NULL_MAP[item.operator.value].value];
4687
- obj.semantic = [NULL_MAP[item.operator.value].label];
4688
- }
4689
- break;
4690
- case 'prod.product_id':
4691
- case 'sku.sku_id':
4692
- if (item.value) {
4693
- if (Array.isArray(item.value)) {
4694
- obj.semantic = item.value.filter(function (val) {
4695
- return val !== '';
4696
- });
4697
- obj.value = item.value.filter(function (val) {
4698
- return val !== '';
4699
- }).map(function (val) {
4700
- return val.replace(reg, '\\\'');
4701
- });
4702
- } else {
4703
- obj.semantic = [item.value];
4704
- obj.value = [item.value.replace(reg, '\\\'')];
4705
- }
4706
- }
4707
- break;
4708
- }
4709
- } else {
4710
- switch (item.field.type) {
4711
- case 'NO_VALUE':
4712
- // 无值类
4713
- obj.semantic = [item.operator.label];
4714
- obj.value = [item.operator.value];
4715
- break;
4716
- case 'DATE_YMD': // 年月日
4717
- case 'DATE_MD':
4718
- // 月日
4719
- if (item.value) {
4720
- if (item.operator.value === 'BETWEEN_CLOSE' || item.operator.value === 'BETWEEN_OPEN') {
4721
- // 假如是区间类型
4722
- obj.value = item.value ? [item.value.start || '', item.value.end || ''] : [item.value];
4723
- obj.semantic = item.value ? [item.value.start || '', item.value.end || ''] : [item.value];
4724
- } else if (nullList.includes(item.operator.value)) {
4725
- obj.value = [NULL_MAP[item.operator.value].value];
4726
- obj.semantic = [NULL_MAP[item.operator.value].label];
4727
- } else {
4728
- obj.value = item.value ? [item.value] : [''];
4729
- obj.semantic = item.value ? [item.value] : [''];
4730
- }
4731
- } else if (nullList.includes(item.operator.value)) {
4732
- obj.value = [NULL_MAP[item.operator.value].value];
4733
- obj.semantic = [NULL_MAP[item.operator.value].label];
4734
- }
4735
- break;
4736
- case 'DATE_M':
4737
- // 月
4738
- if (item.value) {
4739
- obj.value = item.value;
4740
- obj.semantic = item.value.map(function (el) {
4741
- var findTemp = item.field.dataSource.find(function (innerItem) {
4742
- return Number(innerItem.value) === Number(el);
4743
- });
4744
- return (findTemp || {}).label;
4745
- });
4746
- } else if (nullList.includes(item.operator.value)) {
4747
- obj.value = [NULL_MAP[item.operator.value].value];
4748
- obj.semantic = [NULL_MAP[item.operator.value].label];
4749
- }
4750
- break;
4751
- case 'CATEGORY_SELECT_TREE':
4752
- obj.field = item.field.field;
4753
- obj.fieldName = item.field.desc;
4754
- obj.operator = item.operator.value;
4755
- obj.operatorName = item.operator.label;
4756
- if (item.value) {
4757
- var categoriesIds = [];
4758
- var categoriesName = [];
4759
- item.value.categories.forEach(function (str) {
4760
- categoriesIds.push(str.id);
4761
- categoriesName.push(str.name);
4762
- });
4763
- obj.semantic = categoriesName;
4764
- obj.value = categoriesIds;
4765
- } else if (item.operator.value === 'ISNULL') {
4766
- obj.semantic = ['为空'];
4767
- obj.value = ['ISNULL'];
4768
- } else if (item.operator.value === 'NONULL') {
4769
- obj.semantic = ['不为空'];
4770
- obj.value = ['NONULL'];
4771
- }
4772
- break;
4773
- case 'SELECT_MULTIPLE_TREE':
4774
- // 下拉树多选
4775
- if (item.value) {
4776
- var ids = [];
4777
- var names = [];
4778
- var _list = item.value;
4779
- _list.forEach(function (str) {
4780
- ids.push(str.id);
4781
- names.push(str.name);
4782
- });
4783
- obj.semantic = names;
4784
- obj.value = names;
4785
- } else if (nullList.includes(item.operator.value)) {
4786
- obj.value = [NULL_MAP[item.operator.value].label];
4787
- obj.semantic = [NULL_MAP[item.operator.value].label];
4788
- }
4789
- break;
4790
- case 'SELECT_TREE':
4791
- // 下拉树单选
4792
- if (item.value) {
4793
- obj.semantic = [item.field.label];
4794
- obj.value = [item.field.label];
4795
- } else if (nullList.includes(item.operator.value)) {
4796
- obj.value = [NULL_MAP[item.operator.value].value];
4797
- obj.semantic = [NULL_MAP[item.operator.value].label];
4798
- }
4799
- break;
4800
- case 'MULTIPLE_SELECT':
4801
- // 下拉多选
4802
- if (item.value) {
4803
- var _item$value;
4804
- var values = (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.map(function (el) {
4805
- var findTemp = item.field.dataSource.find(function (innerItem) {
4806
- return innerItem.value === el;
4807
- });
4808
- return (findTemp || {}).label;
4809
- });
4810
- obj.value = values;
4811
- obj.semantic = values;
4812
- } else if (nullList.includes(item.operator.value)) {
4813
- obj.value = [NULL_MAP[item.operator.value].value];
4814
- obj.semantic = [NULL_MAP[item.operator.value].label];
4815
- }
4816
- break;
4817
- case 'SELECT':
4818
- // 下拉单选
4819
- if (item.value) {
4820
- obj.value = [item.value];
4821
- var _list2 = item.field.dataSource.filter(function (el) {
4822
- return el.value === item.value;
4823
- });
4824
- obj.semantic = [_list2[0].label];
4825
- } else if (nullList.includes(item.operator.value)) {
4826
- obj.value = [NULL_MAP[item.operator.value].value];
4827
- obj.semantic = [NULL_MAP[item.operator.value].label];
4828
- }
4829
- break;
4830
- case 'NUMBER_INT': // 整数
4831
- case 'NUMBER_DECIMAL':
4832
- // 小数
4833
- if (item.value || item.value === 0) {
4834
- obj.semantic = Array.isArray(item.value) ? item.value : [item.value];
4835
- obj.value = Array.isArray(item.value) ? item.value : [item.value];
4836
- } else if (nullList.includes(item.operator.value)) {
4837
- obj.value = [NULL_MAP[item.operator.value].value];
4838
- obj.semantic = [NULL_MAP[item.operator.value].label];
4839
- }
4840
- break;
4841
- case 'STRING':
4842
- // 字符
4843
- if (item.value) {
4844
- if (item.operator.value === 'LIKE') {
4845
- // 假如是like操作还需要区分出或者还是并且的关系
4846
- obj.value = item.value.value.map(function (val) {
4847
- return val.replace(reg, '\\\'');
4848
- });
4849
- obj.multiText = item.value.relation ? 'AND' : 'OR';
4850
- obj.semantic = item.value;
4851
- } else if (Array.isArray(item.value)) {
4852
- obj.semantic = item.value.filter(function (val) {
4853
- return val !== '';
4854
- });
4855
- obj.value = item.value.filter(function (val) {
4856
- return val !== '';
4857
- }).map(function (val) {
4858
- return val.replace(reg, '\\\'');
4859
- });
4860
- } else {
4861
- obj.semantic = [item.value];
4862
- obj.value = [item.value.replace(reg, '\\\'')];
4863
- }
4864
- } else if (nullList.includes(item.operator.value)) {
4865
- obj.value = [NULL_MAP[item.operator.value].value];
4866
- obj.semantic = [NULL_MAP[item.operator.value].label];
4867
- }
4868
- break;
4869
- }
4870
- }
4871
- arr.push(obj);
4872
- });
4873
- return arr;
4874
- }
4875
- function copyText(semantic) {
4876
- return function copy() {
4877
- shuyunUtils.copyText(semantic.join(','));
4878
- cloudReact.Message.success('复制成功');
4879
- };
4880
- }
4881
-
4882
- /**
4883
- * 通用类将查询条件转化为字符串方法
4884
- * @param {*} array
4885
- */
4886
- function queryConditionToString(array) {
4887
- var PROD_PRODUCT_ID = FIELD_STACKS.PROD_PRODUCT_ID,
4888
- PROD_OUTER_ID = FIELD_STACKS.PROD_OUTER_ID,
4889
- SKU_SKU_ID = FIELD_STACKS.SKU_SKU_ID,
4890
- SKU_OUTER_ID = FIELD_STACKS.SKU_OUTER_ID;
4891
- var obj = {
4892
- str: [],
4893
- title: [],
4894
- value: array
4895
- };
4896
- array.forEach(function (item) {
4897
- var _semantic$value, _semantic$value2;
4898
- var operator = item.operator,
4899
- fieldName = item.fieldName,
4900
- field = item.field,
4901
- operatorName = item.operatorName,
4902
- relative = item.relative,
4903
- semantic = item.semantic,
4904
- timeUnit = item.timeUnit;
4905
- switch (operator) {
4906
- case OPERATOR_STACKS.TAG_ISNULL:
4907
- case OPERATOR_STACKS.TAG_NONULL:
4908
- case OPERATOR_STACKS.ISNULL:
4909
- case OPERATOR_STACKS.NONULL:
4910
- obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName));
4911
- obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName));
4912
- break;
4913
- case OPERATOR_STACKS.BETWEEN_CLOSE:
4914
- case OPERATOR_STACKS.BETWEEN_OPEN:
4915
- if (field === 'prod.online_time' && relative) {
4916
- obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName, "\u8FC7\u53BB").concat(semantic[0], "-").concat(semantic[1]).concat(timeUnit ? '月' : '天'));
4917
- obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName, "\u8FC7\u53BB").concat(semantic[0], "-").concat(semantic[1]).concat(timeUnit ? '月' : '天'));
4918
- } else {
4919
- obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic[0], "-").concat(semantic[1]));
4920
- obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic[0], "-").concat(semantic[1]));
4921
- }
4922
- break;
4923
- case OPERATOR_STACKS.LIKE:
4924
- /* eslint-disable-next-line */
4925
- var connectSymbol = {
4926
- OR: '或',
4927
- AND: '和'
4928
- }[item.multiText] || ',';
4929
- obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat((_semantic$value = semantic.value) === null || _semantic$value === void 0 ? void 0 : _semantic$value.join(connectSymbol)));
4930
- obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat((_semantic$value2 = semantic.value) === null || _semantic$value2 === void 0 ? void 0 : _semantic$value2.join(connectSymbol)));
4931
- break;
4932
- default:
4933
- if ([PROD_PRODUCT_ID, PROD_OUTER_ID, SKU_SKU_ID, SKU_OUTER_ID].includes(field) && operator === OPERATOR_STACKS.EQ) {
4934
- obj.str.push([fieldName, '=', /*#__PURE__*/React__default['default'].createElement("span", {
4935
- key: semantic.toString(),
4936
- onClick: copyText(item.semantic),
4937
- style: {
4938
- padding: '0 4px',
4939
- cursor: 'pointer'
4940
- }
4941
- }, semantic.length), '个'
4942
- // `${getSuffixNameByField(item.field)}`
4943
- ]);
4944
- } else {
4945
- obj.str.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic.join(',')));
4946
- }
4947
- obj.title.push("".concat(fieldName, "\uFF1A").concat(operatorName).concat(semantic.join(',')));
4948
- break;
4949
- }
4950
- });
4951
- obj.str = obj.str.reduce(function (acc, item, idx) {
4952
- if (idx > 0) acc.push(', ');
4953
- acc.push(item);
4954
- return acc;
4955
- }, []);
4956
- return obj;
4957
- }
4958
-
4959
- /**
4960
- * 计算已选商品和sku的数量
4961
- * @param {*} Object || Array
4962
- */
4963
- function resultGoodsLength(obj) {
4964
- var len = 0;
4965
- if (Array.isArray(obj)) {
4966
- obj.forEach(function (item) {
4967
- if (item.rowExpandable) {
4968
- len += item.skus.length;
4969
- } else {
4970
- len += 1;
4971
- }
4972
- });
4973
- } else {
4974
- Object.keys(obj).forEach(function (item) {
4975
- if (obj[item].rowExpandable) {
4976
- // 假如是sku展开状态则商品数量以sku数量为准
4977
- len += obj[item].skus.length;
4978
- } else {
4979
- len += 1;
4980
- }
4981
- });
4982
- }
4983
- return len;
4984
- }
4985
-
4986
5005
  /**
4987
5006
  * 全部商品查询条件
4988
5007
  * @param {*} platShopList 平台&店铺列表
@@ -13939,11 +13958,12 @@
13939
13958
  align: 'right',
13940
13959
  width: '160px',
13941
13960
  template: function template(checklistQuantity) {
13961
+ var reg = new RegExp(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g);
13942
13962
  return /*#__PURE__*/React__default['default'].createElement("span", {
13943
13963
  style: {
13944
13964
  paddingRight: 10
13945
13965
  }
13946
- }, +checklistQuantity >= 0 ? checklistQuantity.toString().replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, '$1,') : '--');
13966
+ }, +checklistQuantity >= 0 ? checklistQuantity.toString().replace(reg, '$1,') : '--');
13947
13967
  }
13948
13968
  }, {
13949
13969
  key: 'creatorName',
@@ -14493,7 +14513,11 @@
14493
14513
  }, /*#__PURE__*/React__default['default'].createElement("div", {
14494
14514
  className: classnames("".concat(prefixCls, "-black-selector"))
14495
14515
  }, /*#__PURE__*/React__default['default'].createElement(cloudReact.Tips, {
14496
- msg: TIPS_CONFIGS[type].tips
14516
+ msg: (option === null || option === void 0 ? void 0 : option.tips) ? /*#__PURE__*/React__default['default'].createElement("span", {
14517
+ dangerouslySetInnerHTML: {
14518
+ __html: option === null || option === void 0 ? void 0 : option.tips
14519
+ }
14520
+ }) : TIPS_CONFIGS[type].tips
14497
14521
  }), /*#__PURE__*/React__default['default'].createElement(TableComponent, {
14498
14522
  onSelectedData: this.onSelectedData,
14499
14523
  showTypes: option.showTypes,
@@ -14517,7 +14541,8 @@
14517
14541
  selectedList: propTypes.array,
14518
14542
  showTypes: propTypes.array,
14519
14543
  isReadOnly: propTypes.bool,
14520
- isCheckAll: propTypes.bool
14544
+ isCheckAll: propTypes.bool,
14545
+ tips: propTypes.string
14521
14546
  }),
14522
14547
  onClose: propTypes.func,
14523
14548
  onCancel: propTypes.func,
@@ -14533,7 +14558,8 @@
14533
14558
  showTypes: TYPE_LIST_CONFIGS.black.map(function (item) {
14534
14559
  return item.value;
14535
14560
  }),
14536
- isCheckAll: true
14561
+ isCheckAll: true,
14562
+ tips: ''
14537
14563
  },
14538
14564
  type: 'black',
14539
14565
  // black: 黑名单 red:红名单
@@ -14734,11 +14760,12 @@
14734
14760
  align: 'right',
14735
14761
  width: 160,
14736
14762
  render: function render(checklistQuantity) {
14763
+ var reg = new RegExp(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g);
14737
14764
  return /*#__PURE__*/React__default['default'].createElement("span", {
14738
14765
  style: {
14739
14766
  paddingRight: 10
14740
14767
  }
14741
- }, +checklistQuantity >= 0 ? checklistQuantity.toString().replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, '$1,') : '--');
14768
+ }, +checklistQuantity >= 0 ? checklistQuantity.toString().replace(reg, '$1,') : '--');
14742
14769
  }
14743
14770
  }, {
14744
14771
  dataIndex: 'creatorName',
@@ -34103,7 +34130,8 @@
34103
34130
  };
34104
34131
  _this.thousandAndDecimal = function (num) {
34105
34132
  if (num) {
34106
- return parseFloat(num).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
34133
+ var reg = new RegExp(/(\d)(?=(\d{3})+\.)/g);
34134
+ return parseFloat(num).toFixed(2).replace(reg, '$1,');
34107
34135
  } else {
34108
34136
  return '0.00';
34109
34137
  }
@@ -43665,6 +43693,824 @@
43665
43693
  visible: false
43666
43694
  };
43667
43695
 
43696
+ /**
43697
+ * 此文件记录一些通用 & 默认配置项
43698
+ */
43699
+ var DEFAULT_TABLE_SKU_ROW = ['productName', 'productId', 'outerId', 'price', 'stock', 'onlineTime', 'status', 'platName', 'shopName', 'showCategoryName', 'showSellerCategoryName', 'skuTotal', 'sku'];
43700
+ var DEFAULT_TABLE_ROW$1 = ['productName', 'productId', 'outerId', 'price', 'stock', 'onlineTime', 'status', 'platName', 'shopName', 'showCategoryName', 'showSellerCategoryName'];
43701
+ var IS_STANDARD_CATE$1 = ['YDH', 'PDD', 'REDBOOK', 'WEIMOB', 'VIP']; // 区分哪些平台不具有标准类目
43702
+ // export const IS_STANDARD_CATE = ['TAOBAO', 'YOUZAN', 'JOS', 'SUNING', 'DOUYIN', 'OFFLINE', 'DANGDANG', 'MOGUJIE', 'WEIXIN'] // 区分哪些平台具有标准类目
43703
+ // export const IS_CUSTOM_CATE = ['YHD', 'SUNING', 'MGJ', 'OFFLINE', 'DD', 'WEIXIN', 'PDD', 'REDBOOK', 'WEIMOB', 'DOUYIN', 'VIP'] // 区分哪些平台不具有自定义类目
43704
+ var IS_CUSTOM_CATE$1 = ['TAOBAO', 'JOS', 'YOUZAN']; // 区分哪些平台有自定义类目
43705
+ var SKU_STATUS_MAP = {
43706
+ 'SY_ONLINE': '在架',
43707
+ 'SY_OFFLINE': '下架',
43708
+ 'SY_SAIL_OVER': '售罄',
43709
+ '': '不限'
43710
+ };
43711
+ var QUERY_MAP$1 = {
43712
+ // 全部商品tab窗口与查询条件枚举关系
43713
+ platCode: {
43714
+ field: 'platCode',
43715
+ // 接口对应字段
43716
+ operator: 'EQ',
43717
+ // 查询条件
43718
+ operatorName: '等于',
43719
+ desc: '平台名称',
43720
+ // 描述
43721
+ rules: 'defalut' // 对应字段解析规则
43722
+ },
43723
+
43724
+ shopId: {
43725
+ field: 'shopId',
43726
+ operator: 'EQ',
43727
+ operatorName: '等于',
43728
+ desc: '店铺名称',
43729
+ rules: 'defalut'
43730
+ },
43731
+ prod_product_id: {
43732
+ field: 'prod.product_id',
43733
+ operator: 'EQ',
43734
+ operatorName: '等于',
43735
+ desc: '商品ID',
43736
+ rules: 'defalut'
43737
+ },
43738
+ prod_product_name: {
43739
+ field: 'prod.product_name',
43740
+ operator: 'LIKE',
43741
+ operatorName: '内容包含',
43742
+ desc: '商品名称',
43743
+ rules: 'split'
43744
+ },
43745
+ prod_category_tree: {
43746
+ field: 'prod.category_id',
43747
+ operator: 'EQ',
43748
+ operatorName: '等于',
43749
+ desc: '标准类目',
43750
+ rules: 'normal'
43751
+ },
43752
+ prod_seller_tree: {
43753
+ field: 'prod.seller_cid',
43754
+ operator: 'EQ',
43755
+ operatorName: '等于',
43756
+ desc: '自定义类目',
43757
+ rules: 'normal'
43758
+ },
43759
+ prod_status: {
43760
+ field: 'prod.status',
43761
+ operator: 'EQ',
43762
+ operatorName: '等于',
43763
+ desc: '商品状态',
43764
+ rules: 'defalut'
43765
+ },
43766
+ prod_stock: {
43767
+ field: 'prod.stock',
43768
+ operator: 'BETWEEN_CLOSE',
43769
+ operatorName: '介于(闭区间)',
43770
+ desc: '库存',
43771
+ rules: 'between'
43772
+ },
43773
+ prod_outer_id: {
43774
+ field: 'prod.outer_id',
43775
+ operator: 'SUB_PATTERN',
43776
+ operatorName: '符合模式(截断)',
43777
+ desc: '商品商家编码',
43778
+ rules: 'sub_pattern'
43779
+ },
43780
+ prod_price: {
43781
+ field: 'prod.price',
43782
+ operator: 'BETWEEN_CLOSE',
43783
+ operatorName: '介于(闭区间)',
43784
+ desc: '价格',
43785
+ rules: 'between'
43786
+ },
43787
+ prod_online_time: {
43788
+ field: 'prod.online_time',
43789
+ operator: 'BETWEEN_CLOSE',
43790
+ operatorName: '介于(闭区间)',
43791
+ desc: '上架时间',
43792
+ rules: 'between'
43793
+ },
43794
+ sku_flag: {
43795
+ field: 'sku_flag',
43796
+ operator: 'EQ',
43797
+ operatorName: '等于',
43798
+ desc: '是否有SKU',
43799
+ rules: 'default'
43800
+ },
43801
+ sku_sku_id: {
43802
+ field: 'sku.sku_id',
43803
+ operator: 'EQ',
43804
+ operatorName: '等于',
43805
+ desc: 'SKU ID',
43806
+ rules: 'default'
43807
+ },
43808
+ sku_outer_id: {
43809
+ field: 'sku.outer_id',
43810
+ operator: 'SUB_PATTERN',
43811
+ operatorName: '符合模式(截断)',
43812
+ desc: 'SKU商家编码',
43813
+ rules: 'sub_pattern'
43814
+ },
43815
+ sku_specification: {
43816
+ field: 'sku.specification',
43817
+ operator: 'LIKE',
43818
+ operatorName: '内容包含',
43819
+ desc: 'SKU名称',
43820
+ rules: 'default'
43821
+ }
43822
+ };
43823
+ var SELECTED_TAB_GOODS_TYPE$1 = [
43824
+ // 已选择商品tab窗口,下拉选择配置
43825
+ {
43826
+ labelKey: '商品标题',
43827
+ valueKey: 'productName',
43828
+ isSku: false
43829
+ }, {
43830
+ labelKey: '商品ID',
43831
+ valueKey: 'productId',
43832
+ isSku: false
43833
+ }, {
43834
+ labelKey: '商品商家编码',
43835
+ valueKey: 'outerId',
43836
+ isSku: false
43837
+ }, {
43838
+ labelKey: 'SKU ID',
43839
+ valueKey: 'skuId',
43840
+ isSku: true
43841
+ }, {
43842
+ labelKey: 'SKU商家编码',
43843
+ valueKey: 'outerSkuId',
43844
+ isSku: true
43845
+ }, {
43846
+ labelKey: 'SKU名称',
43847
+ valueKey: 'skuDetail',
43848
+ isSku: true
43849
+ }];
43850
+ var FIELD_STACKS$1 = {
43851
+ SHOP_ID: 'shopId',
43852
+ // 上架店铺
43853
+ PLAT_CODE: 'platCode',
43854
+ // 平台
43855
+ PROD_PRICE: 'prod.price',
43856
+ // 价格
43857
+ PROD_STOCK: 'prod.stock',
43858
+ // 库存
43859
+ PROD_STATUS: 'prod.status',
43860
+ // 商品状态
43861
+ PROD_OUTER_ID: 'prod.outer_id',
43862
+ // 商品商家编码
43863
+ PROD_SELLER_ID: 'prod.seller_cid',
43864
+ // 自定义类目
43865
+ PROD_PRODUCT_ID: 'prod.product_id',
43866
+ // 商品ID
43867
+ PROD_CATEGORY_ID: 'prod.category_id',
43868
+ // 标准类目
43869
+ PROD_ONLINE_TIME: 'prod.online_time',
43870
+ // 上架时间
43871
+ PROD_PRODUCT_NAME: 'prod.product_name',
43872
+ // 商品名称
43873
+
43874
+ SKU_FLAG: 'sku_flag',
43875
+ // 是否有SKU
43876
+ SKU_PRICE: 'sku.price',
43877
+ // SKU属性 > SKU价格
43878
+ SKU_STOCK: 'sku.stock',
43879
+ // SKU属性 > SKU库存
43880
+ SKU_SKU_ID: 'sku.sku_id',
43881
+ // SKU属性 > SKU ID
43882
+ SKU_STATUS: 'sku.status',
43883
+ // SKU属性 > SKU在架状态
43884
+ SKU_OUTER_ID: 'sku.outer_id',
43885
+ // SKU属性 > SKU 商家编码
43886
+ SKU_SPECIFICATION: 'sku.specification' // SKU属性 > SKU名称
43887
+ };
43888
+
43889
+ var OPERATOR_STACKS$1 = {
43890
+ EQ: 'EQ',
43891
+ LT: 'LT',
43892
+ GT: 'GT',
43893
+ LIKE: 'LIKE',
43894
+ END_LIKE: 'END_LIKE',
43895
+ BEGIN_LIKE: 'BEGIN_LIKE',
43896
+ SUB_PATTERN: 'SUB_PATTERN',
43897
+ BETWEEN_OPEN: 'BETWEEN_OPEN',
43898
+ BETWEEN_CLOSE: 'BETWEEN_CLOSE',
43899
+ ISNULL: 'ISNULL',
43900
+ NONULL: 'NONULL',
43901
+ NOT_EQ: 'NOT_EQ',
43902
+ TAG_ISNULL: 'TAG_ISNULL',
43903
+ TAG_NONULL: 'TAG_NONULL',
43904
+ BETWEEN_RELATIVE: 'BETWEEN_RELATIVE'
43905
+ };
43906
+
43907
+ var NULL_MAP$1 = {
43908
+ ISNULL: {
43909
+ label: '为空',
43910
+ value: 'ISNULL'
43911
+ },
43912
+ NONULL: {
43913
+ label: '不为空',
43914
+ value: 'NONULL'
43915
+ }
43916
+ };
43917
+ var TAG_NULL_MAP$1 = {
43918
+ TAG_ISNULL: {
43919
+ label: '为空',
43920
+ value: 'TAG_ISNULL'
43921
+ },
43922
+ TAG_NONULL: {
43923
+ label: '不为空',
43924
+ value: 'TAG_NONULL'
43925
+ }
43926
+ };
43927
+ var reg$1 = new RegExp('\'', 'g');
43928
+ var nullList$1 = ['ISNULL', 'NONULL'];
43929
+ function queryTypeMap$1(moduleType, type) {
43930
+ switch (moduleType) {
43931
+ case 'SELECT':
43932
+ return {
43933
+ operator: 'EQ',
43934
+ operatorName: '等于',
43935
+ rules: 'defalut'
43936
+ };
43937
+ case 'INPUT':
43938
+ return {
43939
+ operator: type === 'SINGLE' ? 'EQ' : 'LIKE',
43940
+ operatorName: type === 'SINGLE' ? '等于' : '内容包含',
43941
+ rules: type === 'SINGLE' ? 'defalut' : 'split'
43942
+ };
43943
+ case 'SELECT_TREE':
43944
+ return {
43945
+ operator: 'EQ',
43946
+ operatorName: '等于',
43947
+ rules: 'normal'
43948
+ };
43949
+ case 'SELECT_INPUT':
43950
+ return {
43951
+ operator: 'SUB_PATTERN',
43952
+ operatorName: '符合模式(截断)',
43953
+ rules: 'sub_pattern'
43954
+ };
43955
+ case 'NUMBER':
43956
+ return {
43957
+ operator: 'BETWEEN_CLOSE',
43958
+ operatorName: '介于(闭区间)',
43959
+ rules: 'between'
43960
+ };
43961
+ case 'DATE':
43962
+ return {
43963
+ operator: type === 'DATE_M' ? 'EQ' : 'BETWEEN_CLOSE',
43964
+ operatorName: type === 'DATE_M' ? '等于' : '介于(闭区间)',
43965
+ rules: type === 'DATE_M' ? 'defalut' : 'between'
43966
+ };
43967
+ }
43968
+ return null;
43969
+ }
43970
+ function configQueryMap$1(data, query) {
43971
+ var obj = {};
43972
+ data.forEach(function (item) {
43973
+ if (!item.groupName || item.groupName === '商品基本属性' || item.groupName === '商品 SKU 属性') {
43974
+ obj = _objectSpread2(_objectSpread2({}, obj), {}, _defineProperty({}, item.itemId, _objectSpread2(_objectSpread2({}, QUERY_MAP$1[item.itemId]), {}, {
43975
+ type: item.type,
43976
+ moduleType: item.moduleType,
43977
+ dataSource: item.configs,
43978
+ newStatus: item.newStatus,
43979
+ // status: item.newStatus,
43980
+ tagsFlag: null
43981
+ })));
43982
+ } else {
43983
+ var optObj = {};
43984
+ if (item.moduleType !== 'NO_VALUE') {
43985
+ optObj = queryTypeMap$1(item.moduleType, item.type);
43986
+ } else if (query[item.itemId]) {
43987
+ var id = query[item.itemId];
43988
+ optObj.operator = TAG_NULL_MAP$1[id].value;
43989
+ optObj.operatorName = TAG_NULL_MAP$1[id].label;
43990
+ optObj.rules = 'noValue';
43991
+ }
43992
+ obj = _objectSpread2(_objectSpread2({}, obj), {}, _defineProperty({}, item.itemId, _objectSpread2({
43993
+ field: item.itemId,
43994
+ desc: item.itemName,
43995
+ tagsFlag: 'tags',
43996
+ type: item.type,
43997
+ moduleType: item.moduleType,
43998
+ dataSource: item.configs,
43999
+ newStatus: item.newStatus
44000
+ }, optObj)));
44001
+ }
44002
+ });
44003
+ return obj;
44004
+ }
44005
+
44006
+ /**
44007
+ * 数组去重
44008
+ */
44009
+ function unique$1(array) {
44010
+ var keyFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (item) {
44011
+ return item;
44012
+ };
44013
+ var hash = {};
44014
+ var result = [];
44015
+ array.forEach(function (item) {
44016
+ var key = keyFn(item);
44017
+ if (key in hash) return;
44018
+ result.push(item);
44019
+ hash[key] = null;
44020
+ });
44021
+ return result;
44022
+ }
44023
+ function genPlatShopValue$1(platList, shopList, platShop) {
44024
+ var _platCode = platShop.platCode,
44025
+ _shopId = platShop.shopId;
44026
+ var defaultPlat = platList[0] && platList[0].platCode;
44027
+ var platCode = platList.find(function (plat) {
44028
+ return plat.platCode === _platCode;
44029
+ }) ? _platCode : defaultPlat;
44030
+ var defaultShop = (shopList.find(function (shop) {
44031
+ return shop.platCode === platCode;
44032
+ }) || {}).shopId;
44033
+ var shopId = shopList.find(function (shop) {
44034
+ return shop.shopId === _shopId;
44035
+ }) ? _shopId : defaultShop;
44036
+ return {
44037
+ shopId: shopId,
44038
+ platCode: platCode
44039
+ };
44040
+ }
44041
+
44042
+ /**
44043
+ * 全部商品tab-请求参数转化
44044
+ * @param {*} data 需要转化的数据
44045
+ * @param {*} config 配置项枚举信息
44046
+ */
44047
+ function allTabFormatting$1(config, data) {
44048
+ var arr = [];
44049
+ Object.keys(data).forEach(function (item) {
44050
+ if (config[item]) {
44051
+ var obj = {
44052
+ field: config[item].field,
44053
+ fieldName: config[item].desc,
44054
+ configName: item,
44055
+ tagsFlag: config[item].tagsFlag,
44056
+ operator: config[item].operator,
44057
+ operatorName: config[item].operatorName
44058
+ };
44059
+ switch (config[item].rules) {
44060
+ case 'normal':
44061
+ if (data[item]) {
44062
+ if (config[item].type === 'SINGLE') {
44063
+ obj.value = [data[item].value];
44064
+ obj.semantic = [data[item].label];
44065
+ } else {
44066
+ var ids = [];
44067
+ var names = [];
44068
+ data[item].forEach(function (str) {
44069
+ ids.push(str.id);
44070
+ names.push(str.name);
44071
+ });
44072
+ obj.semantic = names;
44073
+ obj.value = config[item].tagsFlag ? names : ids;
44074
+ }
44075
+ }
44076
+ break;
44077
+ case 'between':
44078
+ data[item].start = "".concat(data[item].start);
44079
+ data[item].end = "".concat(data[item].end);
44080
+ if (data[item].datetype) {
44081
+ obj.relative = data[item].datetype;
44082
+ }
44083
+ if (data[item].dateUnit) {
44084
+ obj.timeUnit = data[item].dateUnit;
44085
+ }
44086
+ if (data[item].start || data[item].end) {
44087
+ obj.value = [data[item].start, data[item].end];
44088
+ obj.semantic = [data[item].start, data[item].end];
44089
+ }
44090
+ break;
44091
+ case 'split':
44092
+ if (data[item]) {
44093
+ var _value = data[item].replace(reg$1, '\\\'');
44094
+ obj.value = _value.split(',');
44095
+ obj.semantic = data[item].split(',');
44096
+ }
44097
+ break;
44098
+ case 'sub_pattern':
44099
+ if (data[item]) {
44100
+ if (typeof data[item] === 'string') {
44101
+ var _value2 = data[item].replace(reg$1, '\\\'');
44102
+ obj.value = [_value2];
44103
+ var val = data[item].split(':');
44104
+ if (val.length > 1) {
44105
+ obj.semantic = ["\u622A\u53D6".concat(val[0], "\u81F3").concat(val[1], "\u4F4D\uFF0C\u5B57\u7B26\u662F").concat(val[2])];
44106
+ } else {
44107
+ obj.operatorName = '等于';
44108
+ obj.semantic = [data[item]];
44109
+ }
44110
+ }
44111
+ }
44112
+ break;
44113
+ default:
44114
+ if (data[item]) {
44115
+ if (config[item].field === 'platCode') {
44116
+ // 假如平台code标识,需要找出平台名称
44117
+ data.platList.forEach(function (val) {
44118
+ if (val.platCode === data[item]) {
44119
+ obj.semantic = [val.platName];
44120
+ obj.value = [data[item]];
44121
+ }
44122
+ });
44123
+ } else if (config[item].field === 'shopId') {
44124
+ // 假如是店铺ID标识,需要找出店铺名称
44125
+ data.shopList.forEach(function (val) {
44126
+ if (val.shopId === data[item]) {
44127
+ obj.semantic = [val.shopName];
44128
+ obj.value = [data[item]];
44129
+ }
44130
+ });
44131
+ } else if (config[item].moduleType === 'SELECT' || config[item].moduleType === 'DATE') {
44132
+ if (config[item].type === 'SINGLE') {
44133
+ var _list = config[item].dataSource.filter(function (el) {
44134
+ return el.value === data[item];
44135
+ });
44136
+ obj.semantic = [_list[0].label];
44137
+ obj.value = config[item].tagsFlag ? [_list[0].label] : [_list[0].value];
44138
+ } else if (config[item].type === 'MULTIPLE' || config[item].type === 'DATE_M') {
44139
+ var values = data[item] && data[item].map(function (el) {
44140
+ var findTemp = config[item].dataSource.find(function (innerItem) {
44141
+ return innerItem.value === el;
44142
+ });
44143
+ return (findTemp || {}).label;
44144
+ });
44145
+ obj.value = values;
44146
+ obj.semantic = values;
44147
+ } else if (config[item].moduleType === 'N0_VALUE') {
44148
+ obj.semantic = NULL_MAP$1[data[item]].label;
44149
+ obj.value = [data[item]];
44150
+ obj.operator = NULL_MAP$1[data[item]].value;
44151
+ obj.operatorName = NULL_MAP$1[data[item]].label;
44152
+ } else {
44153
+ obj.semantic = [data[item]];
44154
+ obj.value = [data[item]];
44155
+ }
44156
+ } else {
44157
+ obj.semantic = [data[item]];
44158
+ var _value3 = data[item].replace(reg$1, '\\\'');
44159
+ obj.value = [_value3];
44160
+ }
44161
+ }
44162
+ }
44163
+ arr.push(obj);
44164
+ }
44165
+ });
44166
+ /**
44167
+ *
44168
+ */
44169
+ return arr.filter(function (item) {
44170
+ return item.value && item.value.length >= 1;
44171
+ });
44172
+ }
44173
+
44174
+ /**
44175
+ * 过滤对象中空属性
44176
+ * @param {*} obj
44177
+ * @returns
44178
+ */
44179
+ function filterNullValueObject$1(obj) {
44180
+ for (var i in obj) {
44181
+ if (obj[i] === '' || obj[i] === null || obj[i] === 'null') {
44182
+ delete obj[i];
44183
+ }
44184
+ }
44185
+ return obj;
44186
+ }
44187
+
44188
+ /**
44189
+ * 商品选择tab窗口,根据筛选条件格式化数据
44190
+ * @param {*} data
44191
+ */
44192
+ function parsingNewCondition(data) {
44193
+ var arr = [];
44194
+ var list = ['shopId', 'prod.outer_id', 'sku.outer_id', 'prod.product_id', 'sku.sku_id', 'prod.online_time', 'prod.status'];
44195
+ data.forEach(function (item) {
44196
+ var obj = {
44197
+ field: '',
44198
+ fieldName: '',
44199
+ operator: '',
44200
+ operatorName: '',
44201
+ semantic: [],
44202
+ value: []
44203
+ };
44204
+ obj.tagsFlag = item.field.groupName ? 'tags' : null;
44205
+ obj.field = item.field.field;
44206
+ obj.fieldName = item.field.desc;
44207
+ obj.operator = item.operator.value;
44208
+ obj.operatorName = item.operator.label;
44209
+ if (list.includes(item.field.field)) {
44210
+ switch (item.field.field) {
44211
+ case 'shopId':
44212
+ // 上架店铺(需要解析出平台code)
44213
+ if (item.value) {
44214
+ arr.push({
44215
+ field: 'platCode',
44216
+ fieldName: '平台名称',
44217
+ operator: item.operator.value,
44218
+ operatorName: '等于',
44219
+ semantic: [item.value.plat.label],
44220
+ value: [item.value.plat.value]
44221
+ });
44222
+ obj.semantic = item.value.shops.map(function (shop) {
44223
+ return shop.label;
44224
+ });
44225
+ obj.value = item.value.shops.map(function (shop) {
44226
+ return shop.value;
44227
+ });
44228
+ }
44229
+ break;
44230
+ case 'prod.outer_id': // 商品商家编码
44231
+ case 'sku.outer_id':
44232
+ // sku商家编码
44233
+ if (item.value) {
44234
+ if (item.operator.value === 'SUB_PATTERN') {
44235
+ // 如果是截断模式
44236
+ obj.value = ["".concat(item.value.begin, ":").concat(item.value.end, ":").concat(item.value.value.replace(reg$1, '\\\''))];
44237
+ obj.semantic = ["\u622A\u53D6".concat(item.value.begin, "\u81F3").concat(item.value.end, "\u4F4D,\u5B57\u7B26\u662F").concat(item.value.value)];
44238
+ } else if (Array.isArray(item.value)) {
44239
+ obj.semantic = item.value.filter(function (val) {
44240
+ return val !== '';
44241
+ });
44242
+ obj.value = item.value.filter(function (val) {
44243
+ return val !== '';
44244
+ }).map(function (val) {
44245
+ return val.replace(reg$1, '\\\'');
44246
+ });
44247
+ } else {
44248
+ obj.semantic = [item.value];
44249
+ obj.value = [item.value.replace(reg$1, '\\\'')];
44250
+ }
44251
+ } else if (nullList$1.includes(item.operator.value)) {
44252
+ obj.value = [NULL_MAP$1[item.operator.value].value];
44253
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44254
+ }
44255
+ break;
44256
+ case 'prod.product_id':
44257
+ case 'sku.sku_id':
44258
+ if (item.value) {
44259
+ if (Array.isArray(item.value)) {
44260
+ obj.semantic = item.value.filter(function (val) {
44261
+ return val !== '';
44262
+ });
44263
+ obj.value = item.value.filter(function (val) {
44264
+ return val !== '';
44265
+ }).map(function (val) {
44266
+ return val.replace(reg$1, '\\\'');
44267
+ });
44268
+ } else {
44269
+ obj.semantic = [item.value];
44270
+ obj.value = [item.value.replace(reg$1, '\\\'')];
44271
+ }
44272
+ }
44273
+ break;
44274
+ case 'prod.online_time':
44275
+ if (item.operator.value === 'BETWEEN_RELATIVE') {
44276
+ obj.relative = 'relative';
44277
+ obj.operator = 'BETWEEN_CLOSE';
44278
+ obj.operatorName = '介于(闭区间)';
44279
+ if (item.value) {
44280
+ if (item.value.value) {
44281
+ obj.value = item.value.value;
44282
+ obj.semantic = item.value.value;
44283
+ }
44284
+ if (item.value.timeUnit) {
44285
+ obj.timeUnit = item.value.timeUnit;
44286
+ }
44287
+ }
44288
+ }
44289
+ break;
44290
+ case 'prod.status':
44291
+ obj.value = item.value;
44292
+ var values = item.value.map(function (el) {
44293
+ var findTemp = item.field.dataSource.find(function (innerItem) {
44294
+ return innerItem.value === el;
44295
+ });
44296
+ return (findTemp || {
44297
+ label: el
44298
+ }).label;
44299
+ });
44300
+ obj.semantic = values;
44301
+ break;
44302
+ }
44303
+ } else {
44304
+ switch (item.field.type) {
44305
+ case 'NO_VALUE':
44306
+ // 无值类
44307
+ obj.semantic = [item.operator.label];
44308
+ obj.value = [item.operator.value];
44309
+ break;
44310
+ case 'DATE_YMD': // 年月日
44311
+ case 'DATE_MD':
44312
+ // 月日
44313
+ if (item.value) {
44314
+ if (item.operator.value === 'BETWEEN_CLOSE' || item.operator.value === 'BETWEEN_OPEN') {
44315
+ // 假如是区间类型
44316
+ obj.value = item.value ? [item.value.start || '', item.value.end || ''] : [item.value];
44317
+ obj.semantic = item.value ? [item.value.start || '', item.value.end || ''] : [item.value];
44318
+ } else if (nullList$1.includes(item.operator.value)) {
44319
+ obj.value = [NULL_MAP$1[item.operator.value].value];
44320
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44321
+ } else {
44322
+ obj.value = item.value ? [item.value] : [''];
44323
+ obj.semantic = item.value ? [item.value] : [''];
44324
+ }
44325
+ } else if (nullList$1.includes(item.operator.value)) {
44326
+ obj.value = [NULL_MAP$1[item.operator.value].value];
44327
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44328
+ }
44329
+ break;
44330
+ case 'DATE_M':
44331
+ // 月
44332
+ if (item.value) {
44333
+ obj.value = item.value;
44334
+ obj.semantic = item.value.map(function (el) {
44335
+ var findTemp = item.field.dataSource.find(function (innerItem) {
44336
+ return Number(innerItem.value) === Number(el);
44337
+ });
44338
+ return (findTemp || {
44339
+ label: el
44340
+ }).label;
44341
+ });
44342
+ } else if (nullList$1.includes(item.operator.value)) {
44343
+ obj.value = [NULL_MAP$1[item.operator.value].value];
44344
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44345
+ }
44346
+ break;
44347
+ case 'CATEGORY_SELECT_TREE':
44348
+ obj.field = item.field.field;
44349
+ obj.fieldName = item.field.desc;
44350
+ obj.operator = item.operator.value;
44351
+ obj.operatorName = item.operator.label;
44352
+ if (item.value) {
44353
+ var categoriesIds = [];
44354
+ var categoriesName = [];
44355
+ item.value.categories.forEach(function (str) {
44356
+ categoriesIds.push(str.id);
44357
+ categoriesName.push(str.name);
44358
+ });
44359
+ obj.semantic = categoriesName;
44360
+ obj.value = categoriesIds;
44361
+ } else if (item.operator.value === 'ISNULL') {
44362
+ obj.semantic = ['为空'];
44363
+ obj.value = ['ISNULL'];
44364
+ } else if (item.operator.value === 'NONULL') {
44365
+ obj.semantic = ['不为空'];
44366
+ obj.value = ['NONULL'];
44367
+ }
44368
+ break;
44369
+ case 'SELECT_MULTIPLE_TREE':
44370
+ // 下拉树多选
44371
+ if (item.value) {
44372
+ var ids = [];
44373
+ var names = [];
44374
+ var _list = item.value;
44375
+ _list.forEach(function (str) {
44376
+ ids.push(str.id);
44377
+ names.push(str.name);
44378
+ });
44379
+ obj.semantic = names;
44380
+ obj.value = names;
44381
+ } else if (nullList$1.includes(item.operator.value)) {
44382
+ obj.value = [NULL_MAP$1[item.operator.value].label];
44383
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44384
+ }
44385
+ break;
44386
+ case 'SELECT_TREE':
44387
+ // 下拉树单选
44388
+ if (item.value) {
44389
+ obj.semantic = [item.field.label];
44390
+ obj.value = [item.field.label];
44391
+ } else if (nullList$1.includes(item.operator.value)) {
44392
+ obj.value = [NULL_MAP$1[item.operator.value].value];
44393
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44394
+ }
44395
+ break;
44396
+ case 'MULTIPLE_SELECT':
44397
+ // 下拉多选
44398
+ if (item.value) {
44399
+ var _item$value;
44400
+ var _values = (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.map(function (el) {
44401
+ var findTemp = item.field.dataSource.find(function (innerItem) {
44402
+ return innerItem.value === el;
44403
+ });
44404
+ return (findTemp || {
44405
+ label: el
44406
+ }).label;
44407
+ });
44408
+ obj.value = _values;
44409
+ obj.semantic = _values;
44410
+ } else if (nullList$1.includes(item.operator.value)) {
44411
+ obj.value = [NULL_MAP$1[item.operator.value].value];
44412
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44413
+ }
44414
+ break;
44415
+ case 'SELECT':
44416
+ // 下拉单选
44417
+ if (item.value !== undefined) {
44418
+ obj.value = [item.value];
44419
+ var _list3 = item.field.dataSource.filter(function (el) {
44420
+ return el.value === item.value;
44421
+ });
44422
+ obj.semantic = [_list3[0].label];
44423
+ } else if (nullList$1.includes(item.operator.value)) {
44424
+ obj.value = [NULL_MAP$1[item.operator.value].value];
44425
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44426
+ }
44427
+ break;
44428
+ case 'NUMBER_INT': // 整数
44429
+ case 'NUMBER_DECIMAL':
44430
+ // 小数
44431
+ if (item.value || item.value === 0) {
44432
+ obj.semantic = Array.isArray(item.value) ? item.value : [item.value];
44433
+ obj.value = Array.isArray(item.value) ? item.value : [item.value];
44434
+ } else if (nullList$1.includes(item.operator.value)) {
44435
+ obj.value = [NULL_MAP$1[item.operator.value].value];
44436
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44437
+ }
44438
+ break;
44439
+ case 'STRING':
44440
+ // 字符
44441
+ if (item.value) {
44442
+ if (item.operator.value === 'LIKE') {
44443
+ // 假如是like操作还需要区分出或者还是并且的关系
44444
+ obj.value = item.value.value.map(function (val) {
44445
+ return val.replace(reg$1, '\\\'');
44446
+ });
44447
+ obj.multiText = item.value.relation ? 'AND' : 'OR';
44448
+ obj.semantic = item.value;
44449
+ } else if (Array.isArray(item.value)) {
44450
+ obj.semantic = item.value.filter(function (val) {
44451
+ return val !== '';
44452
+ });
44453
+ obj.value = item.value.filter(function (val) {
44454
+ return val !== '';
44455
+ }).map(function (val) {
44456
+ return val.replace(reg$1, '\\\'');
44457
+ });
44458
+ } else {
44459
+ obj.semantic = [item.value];
44460
+ obj.value = [item.value.replace(reg$1, '\\\'')];
44461
+ }
44462
+ } else if (nullList$1.includes(item.operator.value)) {
44463
+ obj.value = [NULL_MAP$1[item.operator.value].value];
44464
+ obj.semantic = [NULL_MAP$1[item.operator.value].label];
44465
+ }
44466
+ break;
44467
+ }
44468
+ }
44469
+ arr.push(obj);
44470
+ });
44471
+ return arr;
44472
+ }
44473
+ function queryConditionToStringNew(array) {
44474
+ var obj = {
44475
+ str: [],
44476
+ title: [],
44477
+ value: parsingNewCondition(array).filter(function (item) {
44478
+ return item.value.length || item.operator === "ISNULL" || item.operator === "NONULL";
44479
+ })
44480
+ };
44481
+ return obj;
44482
+ }
44483
+
44484
+ /**
44485
+ * 计算已选商品和sku的数量
44486
+ * @param {*} Object || Array
44487
+ */
44488
+ function resultGoodsLength$1(obj) {
44489
+ // TODO SELECT
44490
+ var len = 0;
44491
+ if (Array.isArray(obj)) {
44492
+ if (obj.length) {
44493
+ obj.forEach(function (item) {
44494
+ if (item.rowExpandable) {
44495
+ len += item.skus.length;
44496
+ } else {
44497
+ len += 1;
44498
+ }
44499
+ });
44500
+ }
44501
+ } else {
44502
+ Object.keys(obj).forEach(function (item) {
44503
+ if (obj[item].rowExpandable) {
44504
+ // 假如是sku展开状态则商品数量以sku数量为准
44505
+ len += obj[item].skus.length;
44506
+ } else {
44507
+ len += 1;
44508
+ }
44509
+ });
44510
+ }
44511
+ return len;
44512
+ }
44513
+
43668
44514
  var skuConditionQueryList = ['sku.sku_id', 'sku.outer_id', 'sku.specification', 'sku.status', 'sku.price', 'sku.stock'];
43669
44515
  var Store$f = /*#__PURE__*/function () {
43670
44516
  function Store() {
@@ -44157,7 +45003,7 @@
44157
45003
  case 0:
44158
45004
  url = "".concat(server, "/product-selector/2.0/batch/import?tenant=").concat(extraQuery);
44159
45005
  _context10.next = 3;
44160
- return http.post(url, data);
45006
+ return http.post(url, filterNullValueObject$1(data));
44161
45007
  case 3:
44162
45008
  result = _context10.sent;
44163
45009
  if (result.data.success) {
@@ -44653,7 +45499,7 @@
44653
45499
  });
44654
45500
  setGlobalSelect(_objectSpread2({}, selectObj));
44655
45501
  } else {
44656
- setGlobalSelect({});
45502
+ setGlobalSelect(_objectSpread2({}, originSelectObj));
44657
45503
  }
44658
45504
  };
44659
45505
 
@@ -44803,217 +45649,6 @@
44803
45649
  return React.useContext(Context$4);
44804
45650
  }
44805
45651
 
44806
- /**
44807
- * 此文件记录一些通用 & 默认配置项
44808
- */
44809
- var DEFAULT_TABLE_SKU_ROW = ['productName', 'productId', 'outerId', 'price', 'stock', 'onlineTime', 'status', 'platName', 'shopName', 'showCategoryName', 'showSellerCategoryName', 'skuTotal', 'sku'];
44810
- var DEFAULT_TABLE_ROW$1 = ['productName', 'productId', 'outerId', 'price', 'stock', 'onlineTime', 'status', 'platName', 'shopName', 'showCategoryName', 'showSellerCategoryName'];
44811
- var IS_STANDARD_CATE$1 = ['YDH', 'PDD', 'REDBOOK', 'WEIMOB', 'VIP']; // 区分哪些平台不具有标准类目
44812
- // export const IS_STANDARD_CATE = ['TAOBAO', 'YOUZAN', 'JOS', 'SUNING', 'DOUYIN', 'OFFLINE', 'DANGDANG', 'MOGUJIE', 'WEIXIN'] // 区分哪些平台具有标准类目
44813
- // export const IS_CUSTOM_CATE = ['YHD', 'SUNING', 'MGJ', 'OFFLINE', 'DD', 'WEIXIN', 'PDD', 'REDBOOK', 'WEIMOB', 'DOUYIN', 'VIP'] // 区分哪些平台不具有自定义类目
44814
- var IS_CUSTOM_CATE$1 = ['TAOBAO', 'JOS', 'YOUZAN']; // 区分哪些平台有自定义类目
44815
- var SKU_STATUS_MAP = {
44816
- 'SY_ONLINE': '在架',
44817
- 'SY_OFFLINE': '下架',
44818
- 'SY_SAIL_OVER': '售罄',
44819
- '': '不限'
44820
- };
44821
- var QUERY_MAP$1 = {
44822
- // 全部商品tab窗口与查询条件枚举关系
44823
- platCode: {
44824
- field: 'platCode',
44825
- // 接口对应字段
44826
- operator: 'EQ',
44827
- // 查询条件
44828
- operatorName: '等于',
44829
- desc: '平台名称',
44830
- // 描述
44831
- rules: 'defalut' // 对应字段解析规则
44832
- },
44833
-
44834
- shopId: {
44835
- field: 'shopId',
44836
- operator: 'EQ',
44837
- operatorName: '等于',
44838
- desc: '店铺名称',
44839
- rules: 'defalut'
44840
- },
44841
- prod_product_id: {
44842
- field: 'prod.product_id',
44843
- operator: 'EQ',
44844
- operatorName: '等于',
44845
- desc: '商品ID',
44846
- rules: 'defalut'
44847
- },
44848
- prod_product_name: {
44849
- field: 'prod.product_name',
44850
- operator: 'LIKE',
44851
- operatorName: '内容包含',
44852
- desc: '商品名称',
44853
- rules: 'split'
44854
- },
44855
- prod_category_tree: {
44856
- field: 'prod.category_id',
44857
- operator: 'EQ',
44858
- operatorName: '等于',
44859
- desc: '标准类目',
44860
- rules: 'normal'
44861
- },
44862
- prod_seller_tree: {
44863
- field: 'prod.seller_cid',
44864
- operator: 'EQ',
44865
- operatorName: '等于',
44866
- desc: '自定义类目',
44867
- rules: 'normal'
44868
- },
44869
- prod_status: {
44870
- field: 'prod.status',
44871
- operator: 'EQ',
44872
- operatorName: '等于',
44873
- desc: '商品状态',
44874
- rules: 'defalut'
44875
- },
44876
- prod_stock: {
44877
- field: 'prod.stock',
44878
- operator: 'BETWEEN_CLOSE',
44879
- operatorName: '介于(闭区间)',
44880
- desc: '库存',
44881
- rules: 'between'
44882
- },
44883
- prod_outer_id: {
44884
- field: 'prod.outer_id',
44885
- operator: 'SUB_PATTERN',
44886
- operatorName: '符合模式(截断)',
44887
- desc: '商品商家编码',
44888
- rules: 'sub_pattern'
44889
- },
44890
- prod_price: {
44891
- field: 'prod.price',
44892
- operator: 'BETWEEN_CLOSE',
44893
- operatorName: '介于(闭区间)',
44894
- desc: '价格',
44895
- rules: 'between'
44896
- },
44897
- prod_online_time: {
44898
- field: 'prod.online_time',
44899
- operator: 'BETWEEN_CLOSE',
44900
- operatorName: '介于(闭区间)',
44901
- desc: '上架时间',
44902
- rules: 'between'
44903
- },
44904
- sku_flag: {
44905
- field: 'sku_flag',
44906
- operator: 'EQ',
44907
- operatorName: '等于',
44908
- desc: '是否有SKU',
44909
- rules: 'default'
44910
- },
44911
- sku_sku_id: {
44912
- field: 'sku.sku_id',
44913
- operator: 'EQ',
44914
- operatorName: '等于',
44915
- desc: 'SKU ID',
44916
- rules: 'default'
44917
- },
44918
- sku_outer_id: {
44919
- field: 'sku.outer_id',
44920
- operator: 'SUB_PATTERN',
44921
- operatorName: '符合模式(截断)',
44922
- desc: 'SKU商家编码',
44923
- rules: 'sub_pattern'
44924
- },
44925
- sku_specification: {
44926
- field: 'sku.specification',
44927
- operator: 'LIKE',
44928
- operatorName: '内容包含',
44929
- desc: 'SKU名称',
44930
- rules: 'default'
44931
- }
44932
- };
44933
- var SELECTED_TAB_GOODS_TYPE$1 = [
44934
- // 已选择商品tab窗口,下拉选择配置
44935
- {
44936
- labelKey: '商品标题',
44937
- valueKey: 'productName',
44938
- isSku: false
44939
- }, {
44940
- labelKey: '商品ID',
44941
- valueKey: 'productId',
44942
- isSku: false
44943
- }, {
44944
- labelKey: '商品商家编码',
44945
- valueKey: 'outerId',
44946
- isSku: false
44947
- }, {
44948
- labelKey: 'SKU ID',
44949
- valueKey: 'skuId',
44950
- isSku: true
44951
- }, {
44952
- labelKey: 'SKU商家编码',
44953
- valueKey: 'outerSkuId',
44954
- isSku: true
44955
- }, {
44956
- labelKey: 'SKU名称',
44957
- valueKey: 'skuDetail',
44958
- isSku: true
44959
- }];
44960
- var FIELD_STACKS$1 = {
44961
- SHOP_ID: 'shopId',
44962
- // 上架店铺
44963
- PLAT_CODE: 'platCode',
44964
- // 平台
44965
- PROD_PRICE: 'prod.price',
44966
- // 价格
44967
- PROD_STOCK: 'prod.stock',
44968
- // 库存
44969
- PROD_STATUS: 'prod.status',
44970
- // 商品状态
44971
- PROD_OUTER_ID: 'prod.outer_id',
44972
- // 商品商家编码
44973
- PROD_SELLER_ID: 'prod.seller_cid',
44974
- // 自定义类目
44975
- PROD_PRODUCT_ID: 'prod.product_id',
44976
- // 商品ID
44977
- PROD_CATEGORY_ID: 'prod.category_id',
44978
- // 标准类目
44979
- PROD_ONLINE_TIME: 'prod.online_time',
44980
- // 上架时间
44981
- PROD_PRODUCT_NAME: 'prod.product_name',
44982
- // 商品名称
44983
-
44984
- SKU_FLAG: 'sku_flag',
44985
- // 是否有SKU
44986
- SKU_PRICE: 'sku.price',
44987
- // SKU属性 > SKU价格
44988
- SKU_STOCK: 'sku.stock',
44989
- // SKU属性 > SKU库存
44990
- SKU_SKU_ID: 'sku.sku_id',
44991
- // SKU属性 > SKU ID
44992
- SKU_STATUS: 'sku.status',
44993
- // SKU属性 > SKU在架状态
44994
- SKU_OUTER_ID: 'sku.outer_id',
44995
- // SKU属性 > SKU 商家编码
44996
- SKU_SPECIFICATION: 'sku.specification' // SKU属性 > SKU名称
44997
- };
44998
-
44999
- var OPERATOR_STACKS$1 = {
45000
- EQ: 'EQ',
45001
- LT: 'LT',
45002
- GT: 'GT',
45003
- LIKE: 'LIKE',
45004
- END_LIKE: 'END_LIKE',
45005
- BEGIN_LIKE: 'BEGIN_LIKE',
45006
- SUB_PATTERN: 'SUB_PATTERN',
45007
- BETWEEN_OPEN: 'BETWEEN_OPEN',
45008
- BETWEEN_CLOSE: 'BETWEEN_CLOSE',
45009
- ISNULL: 'ISNULL',
45010
- NONULL: 'NONULL',
45011
- NOT_EQ: 'NOT_EQ',
45012
- TAG_ISNULL: 'TAG_ISNULL',
45013
- TAG_NONULL: 'TAG_NONULL',
45014
- BETWEEN_RELATIVE: 'BETWEEN_RELATIVE'
45015
- };
45016
-
45017
45652
  function WidgetBox$1(_ref) {
45018
45653
  var _ref$help = _ref.help,
45019
45654
  help = _ref$help === void 0 ? '' : _ref$help,
@@ -50107,599 +50742,6 @@
50107
50742
  return data;
50108
50743
  }
50109
50744
 
50110
- var NULL_MAP$1 = {
50111
- ISNULL: {
50112
- label: '为空',
50113
- value: 'ISNULL'
50114
- },
50115
- NONULL: {
50116
- label: '不为空',
50117
- value: 'NONULL'
50118
- }
50119
- };
50120
- var TAG_NULL_MAP$1 = {
50121
- TAG_ISNULL: {
50122
- label: '为空',
50123
- value: 'TAG_ISNULL'
50124
- },
50125
- TAG_NONULL: {
50126
- label: '不为空',
50127
- value: 'TAG_NONULL'
50128
- }
50129
- };
50130
- var reg$1 = new RegExp('\'', 'g');
50131
- var nullList$1 = ['ISNULL', 'NONULL'];
50132
- function queryTypeMap$1(moduleType, type) {
50133
- switch (moduleType) {
50134
- case 'SELECT':
50135
- return {
50136
- operator: 'EQ',
50137
- operatorName: '等于',
50138
- rules: 'defalut'
50139
- };
50140
- case 'INPUT':
50141
- return {
50142
- operator: type === 'SINGLE' ? 'EQ' : 'LIKE',
50143
- operatorName: type === 'SINGLE' ? '等于' : '内容包含',
50144
- rules: type === 'SINGLE' ? 'defalut' : 'split'
50145
- };
50146
- case 'SELECT_TREE':
50147
- return {
50148
- operator: 'EQ',
50149
- operatorName: '等于',
50150
- rules: 'normal'
50151
- };
50152
- case 'SELECT_INPUT':
50153
- return {
50154
- operator: 'SUB_PATTERN',
50155
- operatorName: '符合模式(截断)',
50156
- rules: 'sub_pattern'
50157
- };
50158
- case 'NUMBER':
50159
- return {
50160
- operator: 'BETWEEN_CLOSE',
50161
- operatorName: '介于(闭区间)',
50162
- rules: 'between'
50163
- };
50164
- case 'DATE':
50165
- return {
50166
- operator: type === 'DATE_M' ? 'EQ' : 'BETWEEN_CLOSE',
50167
- operatorName: type === 'DATE_M' ? '等于' : '介于(闭区间)',
50168
- rules: type === 'DATE_M' ? 'defalut' : 'between'
50169
- };
50170
- }
50171
- return null;
50172
- }
50173
- function configQueryMap$1(data, query) {
50174
- var obj = {};
50175
- data.forEach(function (item) {
50176
- if (!item.groupName || item.groupName === '商品基本属性' || item.groupName === '商品 SKU 属性') {
50177
- obj = _objectSpread2(_objectSpread2({}, obj), {}, _defineProperty({}, item.itemId, _objectSpread2(_objectSpread2({}, QUERY_MAP$1[item.itemId]), {}, {
50178
- type: item.type,
50179
- moduleType: item.moduleType,
50180
- dataSource: item.configs,
50181
- newStatus: item.newStatus,
50182
- // status: item.newStatus,
50183
- tagsFlag: null
50184
- })));
50185
- } else {
50186
- var optObj = {};
50187
- if (item.moduleType !== 'NO_VALUE') {
50188
- optObj = queryTypeMap$1(item.moduleType, item.type);
50189
- } else if (query[item.itemId]) {
50190
- var id = query[item.itemId];
50191
- optObj.operator = TAG_NULL_MAP$1[id].value;
50192
- optObj.operatorName = TAG_NULL_MAP$1[id].label;
50193
- optObj.rules = 'noValue';
50194
- }
50195
- obj = _objectSpread2(_objectSpread2({}, obj), {}, _defineProperty({}, item.itemId, _objectSpread2({
50196
- field: item.itemId,
50197
- desc: item.itemName,
50198
- tagsFlag: 'tags',
50199
- type: item.type,
50200
- moduleType: item.moduleType,
50201
- dataSource: item.configs,
50202
- newStatus: item.newStatus
50203
- }, optObj)));
50204
- }
50205
- });
50206
- return obj;
50207
- }
50208
-
50209
- /**
50210
- * 数组去重
50211
- */
50212
- function unique$1(array) {
50213
- var keyFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (item) {
50214
- return item;
50215
- };
50216
- var hash = {};
50217
- var result = [];
50218
- array.forEach(function (item) {
50219
- var key = keyFn(item);
50220
- if (key in hash) return;
50221
- result.push(item);
50222
- hash[key] = null;
50223
- });
50224
- return result;
50225
- }
50226
- function genPlatShopValue$1(platList, shopList, platShop) {
50227
- var _platCode = platShop.platCode,
50228
- _shopId = platShop.shopId;
50229
- var defaultPlat = platList[0] && platList[0].platCode;
50230
- var platCode = platList.find(function (plat) {
50231
- return plat.platCode === _platCode;
50232
- }) ? _platCode : defaultPlat;
50233
- var defaultShop = (shopList.find(function (shop) {
50234
- return shop.platCode === platCode;
50235
- }) || {}).shopId;
50236
- var shopId = shopList.find(function (shop) {
50237
- return shop.shopId === _shopId;
50238
- }) ? _shopId : defaultShop;
50239
- return {
50240
- shopId: shopId,
50241
- platCode: platCode
50242
- };
50243
- }
50244
-
50245
- /**
50246
- * 全部商品tab-请求参数转化
50247
- * @param {*} data 需要转化的数据
50248
- * @param {*} config 配置项枚举信息
50249
- */
50250
- function allTabFormatting$1(config, data) {
50251
- var arr = [];
50252
- Object.keys(data).forEach(function (item) {
50253
- if (config[item]) {
50254
- var obj = {
50255
- field: config[item].field,
50256
- fieldName: config[item].desc,
50257
- configName: item,
50258
- tagsFlag: config[item].tagsFlag,
50259
- operator: config[item].operator,
50260
- operatorName: config[item].operatorName
50261
- };
50262
- switch (config[item].rules) {
50263
- case 'normal':
50264
- if (data[item]) {
50265
- if (config[item].type === 'SINGLE') {
50266
- obj.value = [data[item].value];
50267
- obj.semantic = [data[item].label];
50268
- } else {
50269
- var ids = [];
50270
- var names = [];
50271
- data[item].forEach(function (str) {
50272
- ids.push(str.id);
50273
- names.push(str.name);
50274
- });
50275
- obj.semantic = names;
50276
- obj.value = config[item].tagsFlag ? names : ids;
50277
- }
50278
- }
50279
- break;
50280
- case 'between':
50281
- data[item].start = "".concat(data[item].start);
50282
- data[item].end = "".concat(data[item].end);
50283
- if (data[item].datetype) {
50284
- obj.relative = data[item].datetype;
50285
- }
50286
- if (data[item].dateUnit) {
50287
- obj.timeUnit = data[item].dateUnit;
50288
- }
50289
- if (data[item].start || data[item].end) {
50290
- obj.value = [data[item].start, data[item].end];
50291
- obj.semantic = [data[item].start, data[item].end];
50292
- }
50293
- break;
50294
- case 'split':
50295
- if (data[item]) {
50296
- var _value = data[item].replace(reg$1, '\\\'');
50297
- obj.value = _value.split(',');
50298
- obj.semantic = data[item].split(',');
50299
- }
50300
- break;
50301
- case 'sub_pattern':
50302
- if (data[item]) {
50303
- if (typeof data[item] === 'string') {
50304
- var _value2 = data[item].replace(reg$1, '\\\'');
50305
- obj.value = [_value2];
50306
- var val = data[item].split(':');
50307
- if (val.length > 1) {
50308
- obj.semantic = ["\u622A\u53D6".concat(val[0], "\u81F3").concat(val[1], "\u4F4D\uFF0C\u5B57\u7B26\u662F").concat(val[2])];
50309
- } else {
50310
- obj.operatorName = '等于';
50311
- obj.semantic = [data[item]];
50312
- }
50313
- }
50314
- }
50315
- break;
50316
- default:
50317
- if (data[item]) {
50318
- if (config[item].field === 'platCode') {
50319
- // 假如平台code标识,需要找出平台名称
50320
- data.platList.forEach(function (val) {
50321
- if (val.platCode === data[item]) {
50322
- obj.semantic = [val.platName];
50323
- obj.value = [data[item]];
50324
- }
50325
- });
50326
- } else if (config[item].field === 'shopId') {
50327
- // 假如是店铺ID标识,需要找出店铺名称
50328
- data.shopList.forEach(function (val) {
50329
- if (val.shopId === data[item]) {
50330
- obj.semantic = [val.shopName];
50331
- obj.value = [data[item]];
50332
- }
50333
- });
50334
- } else if (config[item].moduleType === 'SELECT' || config[item].moduleType === 'DATE') {
50335
- if (config[item].type === 'SINGLE') {
50336
- var _list = config[item].dataSource.filter(function (el) {
50337
- return el.value === data[item];
50338
- });
50339
- obj.semantic = [_list[0].label];
50340
- obj.value = config[item].tagsFlag ? [_list[0].label] : [_list[0].value];
50341
- } else if (config[item].type === 'MULTIPLE' || config[item].type === 'DATE_M') {
50342
- var values = data[item] && data[item].map(function (el) {
50343
- var findTemp = config[item].dataSource.find(function (innerItem) {
50344
- return innerItem.value === el;
50345
- });
50346
- return (findTemp || {}).label;
50347
- });
50348
- obj.value = values;
50349
- obj.semantic = values;
50350
- } else if (config[item].moduleType === 'N0_VALUE') {
50351
- obj.semantic = NULL_MAP$1[data[item]].label;
50352
- obj.value = [data[item]];
50353
- obj.operator = NULL_MAP$1[data[item]].value;
50354
- obj.operatorName = NULL_MAP$1[data[item]].label;
50355
- } else {
50356
- obj.semantic = [data[item]];
50357
- obj.value = [data[item]];
50358
- }
50359
- } else {
50360
- obj.semantic = [data[item]];
50361
- var _value3 = data[item].replace(reg$1, '\\\'');
50362
- obj.value = [_value3];
50363
- }
50364
- }
50365
- }
50366
- arr.push(obj);
50367
- }
50368
- });
50369
- /**
50370
- *
50371
- */
50372
- return arr.filter(function (item) {
50373
- return item.value && item.value.length >= 1;
50374
- });
50375
- }
50376
-
50377
- /**
50378
- * 商品选择tab窗口,根据筛选条件格式化数据
50379
- * @param {*} data
50380
- */
50381
- function parsingNewCondition(data) {
50382
- var arr = [];
50383
- var list = ['shopId', 'prod.outer_id', 'sku.outer_id', 'prod.product_id', 'sku.sku_id', 'prod.online_time', 'prod.status'];
50384
- data.forEach(function (item) {
50385
- var obj = {
50386
- field: '',
50387
- fieldName: '',
50388
- operator: '',
50389
- operatorName: '',
50390
- semantic: [],
50391
- value: []
50392
- };
50393
- obj.tagsFlag = item.field.groupName ? 'tags' : null;
50394
- obj.field = item.field.field;
50395
- obj.fieldName = item.field.desc;
50396
- obj.operator = item.operator.value;
50397
- obj.operatorName = item.operator.label;
50398
- if (list.includes(item.field.field)) {
50399
- switch (item.field.field) {
50400
- case 'shopId':
50401
- // 上架店铺(需要解析出平台code)
50402
- if (item.value) {
50403
- arr.push({
50404
- field: 'platCode',
50405
- fieldName: '平台名称',
50406
- operator: item.operator.value,
50407
- operatorName: '等于',
50408
- semantic: [item.value.plat.label],
50409
- value: [item.value.plat.value]
50410
- });
50411
- obj.semantic = item.value.shops.map(function (shop) {
50412
- return shop.label;
50413
- });
50414
- obj.value = item.value.shops.map(function (shop) {
50415
- return shop.value;
50416
- });
50417
- }
50418
- break;
50419
- case 'prod.outer_id': // 商品商家编码
50420
- case 'sku.outer_id':
50421
- // sku商家编码
50422
- if (item.value) {
50423
- if (item.operator.value === 'SUB_PATTERN') {
50424
- // 如果是截断模式
50425
- obj.value = ["".concat(item.value.begin, ":").concat(item.value.end, ":").concat(item.value.value.replace(reg$1, '\\\''))];
50426
- obj.semantic = ["\u622A\u53D6".concat(item.value.begin, "\u81F3").concat(item.value.end, "\u4F4D,\u5B57\u7B26\u662F").concat(item.value.value)];
50427
- } else if (Array.isArray(item.value)) {
50428
- obj.semantic = item.value.filter(function (val) {
50429
- return val !== '';
50430
- });
50431
- obj.value = item.value.filter(function (val) {
50432
- return val !== '';
50433
- }).map(function (val) {
50434
- return val.replace(reg$1, '\\\'');
50435
- });
50436
- } else {
50437
- obj.semantic = [item.value];
50438
- obj.value = [item.value.replace(reg$1, '\\\'')];
50439
- }
50440
- } else if (nullList$1.includes(item.operator.value)) {
50441
- obj.value = [NULL_MAP$1[item.operator.value].value];
50442
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50443
- }
50444
- break;
50445
- case 'prod.product_id':
50446
- case 'sku.sku_id':
50447
- if (item.value) {
50448
- if (Array.isArray(item.value)) {
50449
- obj.semantic = item.value.filter(function (val) {
50450
- return val !== '';
50451
- });
50452
- obj.value = item.value.filter(function (val) {
50453
- return val !== '';
50454
- }).map(function (val) {
50455
- return val.replace(reg$1, '\\\'');
50456
- });
50457
- } else {
50458
- obj.semantic = [item.value];
50459
- obj.value = [item.value.replace(reg$1, '\\\'')];
50460
- }
50461
- }
50462
- break;
50463
- case 'prod.online_time':
50464
- if (item.operator.value === 'BETWEEN_RELATIVE') {
50465
- obj.relative = 'relative';
50466
- obj.operator = 'BETWEEN_CLOSE';
50467
- obj.operatorName = '介于(闭区间)';
50468
- if (item.value) {
50469
- if (item.value.value) {
50470
- obj.value = item.value.value;
50471
- obj.semantic = item.value.value;
50472
- }
50473
- if (item.value.timeUnit) {
50474
- obj.timeUnit = item.value.timeUnit;
50475
- }
50476
- }
50477
- }
50478
- break;
50479
- case 'prod.status':
50480
- obj.value = item.value;
50481
- var values = item.value.map(function (el) {
50482
- var findTemp = item.field.dataSource.find(function (innerItem) {
50483
- return innerItem.value === el;
50484
- });
50485
- return (findTemp || {
50486
- label: el
50487
- }).label;
50488
- });
50489
- obj.semantic = values;
50490
- break;
50491
- }
50492
- } else {
50493
- switch (item.field.type) {
50494
- case 'NO_VALUE':
50495
- // 无值类
50496
- obj.semantic = [item.operator.label];
50497
- obj.value = [item.operator.value];
50498
- break;
50499
- case 'DATE_YMD': // 年月日
50500
- case 'DATE_MD':
50501
- // 月日
50502
- if (item.value) {
50503
- if (item.operator.value === 'BETWEEN_CLOSE' || item.operator.value === 'BETWEEN_OPEN') {
50504
- // 假如是区间类型
50505
- obj.value = item.value ? [item.value.start || '', item.value.end || ''] : [item.value];
50506
- obj.semantic = item.value ? [item.value.start || '', item.value.end || ''] : [item.value];
50507
- } else if (nullList$1.includes(item.operator.value)) {
50508
- obj.value = [NULL_MAP$1[item.operator.value].value];
50509
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50510
- } else {
50511
- obj.value = item.value ? [item.value] : [''];
50512
- obj.semantic = item.value ? [item.value] : [''];
50513
- }
50514
- } else if (nullList$1.includes(item.operator.value)) {
50515
- obj.value = [NULL_MAP$1[item.operator.value].value];
50516
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50517
- }
50518
- break;
50519
- case 'DATE_M':
50520
- // 月
50521
- if (item.value) {
50522
- obj.value = item.value;
50523
- obj.semantic = item.value.map(function (el) {
50524
- var findTemp = item.field.dataSource.find(function (innerItem) {
50525
- return Number(innerItem.value) === Number(el);
50526
- });
50527
- return (findTemp || {
50528
- label: el
50529
- }).label;
50530
- });
50531
- } else if (nullList$1.includes(item.operator.value)) {
50532
- obj.value = [NULL_MAP$1[item.operator.value].value];
50533
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50534
- }
50535
- break;
50536
- case 'CATEGORY_SELECT_TREE':
50537
- obj.field = item.field.field;
50538
- obj.fieldName = item.field.desc;
50539
- obj.operator = item.operator.value;
50540
- obj.operatorName = item.operator.label;
50541
- if (item.value) {
50542
- var categoriesIds = [];
50543
- var categoriesName = [];
50544
- item.value.categories.forEach(function (str) {
50545
- categoriesIds.push(str.id);
50546
- categoriesName.push(str.name);
50547
- });
50548
- obj.semantic = categoriesName;
50549
- obj.value = categoriesIds;
50550
- } else if (item.operator.value === 'ISNULL') {
50551
- obj.semantic = ['为空'];
50552
- obj.value = ['ISNULL'];
50553
- } else if (item.operator.value === 'NONULL') {
50554
- obj.semantic = ['不为空'];
50555
- obj.value = ['NONULL'];
50556
- }
50557
- break;
50558
- case 'SELECT_MULTIPLE_TREE':
50559
- // 下拉树多选
50560
- if (item.value) {
50561
- var ids = [];
50562
- var names = [];
50563
- var _list = item.value;
50564
- _list.forEach(function (str) {
50565
- ids.push(str.id);
50566
- names.push(str.name);
50567
- });
50568
- obj.semantic = names;
50569
- obj.value = names;
50570
- } else if (nullList$1.includes(item.operator.value)) {
50571
- obj.value = [NULL_MAP$1[item.operator.value].label];
50572
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50573
- }
50574
- break;
50575
- case 'SELECT_TREE':
50576
- // 下拉树单选
50577
- if (item.value) {
50578
- obj.semantic = [item.field.label];
50579
- obj.value = [item.field.label];
50580
- } else if (nullList$1.includes(item.operator.value)) {
50581
- obj.value = [NULL_MAP$1[item.operator.value].value];
50582
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50583
- }
50584
- break;
50585
- case 'MULTIPLE_SELECT':
50586
- // 下拉多选
50587
- if (item.value) {
50588
- var _item$value;
50589
- var _values = (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.map(function (el) {
50590
- var findTemp = item.field.dataSource.find(function (innerItem) {
50591
- return innerItem.value === el;
50592
- });
50593
- return (findTemp || {
50594
- label: el
50595
- }).label;
50596
- });
50597
- obj.value = _values;
50598
- obj.semantic = _values;
50599
- } else if (nullList$1.includes(item.operator.value)) {
50600
- obj.value = [NULL_MAP$1[item.operator.value].value];
50601
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50602
- }
50603
- break;
50604
- case 'SELECT':
50605
- // 下拉单选
50606
- if (item.value !== undefined) {
50607
- obj.value = [item.value];
50608
- var _list3 = item.field.dataSource.filter(function (el) {
50609
- return el.value === item.value;
50610
- });
50611
- obj.semantic = [_list3[0].label];
50612
- } else if (nullList$1.includes(item.operator.value)) {
50613
- obj.value = [NULL_MAP$1[item.operator.value].value];
50614
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50615
- }
50616
- break;
50617
- case 'NUMBER_INT': // 整数
50618
- case 'NUMBER_DECIMAL':
50619
- // 小数
50620
- if (item.value || item.value === 0) {
50621
- obj.semantic = Array.isArray(item.value) ? item.value : [item.value];
50622
- obj.value = Array.isArray(item.value) ? item.value : [item.value];
50623
- } else if (nullList$1.includes(item.operator.value)) {
50624
- obj.value = [NULL_MAP$1[item.operator.value].value];
50625
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50626
- }
50627
- break;
50628
- case 'STRING':
50629
- // 字符
50630
- if (item.value) {
50631
- if (item.operator.value === 'LIKE') {
50632
- // 假如是like操作还需要区分出或者还是并且的关系
50633
- obj.value = item.value.value.map(function (val) {
50634
- return val.replace(reg$1, '\\\'');
50635
- });
50636
- obj.multiText = item.value.relation ? 'AND' : 'OR';
50637
- obj.semantic = item.value;
50638
- } else if (Array.isArray(item.value)) {
50639
- obj.semantic = item.value.filter(function (val) {
50640
- return val !== '';
50641
- });
50642
- obj.value = item.value.filter(function (val) {
50643
- return val !== '';
50644
- }).map(function (val) {
50645
- return val.replace(reg$1, '\\\'');
50646
- });
50647
- } else {
50648
- obj.semantic = [item.value];
50649
- obj.value = [item.value.replace(reg$1, '\\\'')];
50650
- }
50651
- } else if (nullList$1.includes(item.operator.value)) {
50652
- obj.value = [NULL_MAP$1[item.operator.value].value];
50653
- obj.semantic = [NULL_MAP$1[item.operator.value].label];
50654
- }
50655
- break;
50656
- }
50657
- }
50658
- arr.push(obj);
50659
- });
50660
- return arr;
50661
- }
50662
- function queryConditionToStringNew(array) {
50663
- var obj = {
50664
- str: [],
50665
- title: [],
50666
- value: parsingNewCondition(array).filter(function (item) {
50667
- return item.value.length || item.operator === "ISNULL" || item.operator === "NONULL";
50668
- })
50669
- };
50670
- return obj;
50671
- }
50672
-
50673
- /**
50674
- * 计算已选商品和sku的数量
50675
- * @param {*} Object || Array
50676
- */
50677
- function resultGoodsLength$1(obj) {
50678
- // TODO SELECT
50679
- var len = 0;
50680
- if (Array.isArray(obj)) {
50681
- if (obj.length) {
50682
- obj.forEach(function (item) {
50683
- if (item.rowExpandable) {
50684
- len += item.skus.length;
50685
- } else {
50686
- len += 1;
50687
- }
50688
- });
50689
- }
50690
- } else {
50691
- Object.keys(obj).forEach(function (item) {
50692
- if (obj[item].rowExpandable) {
50693
- // 假如是sku展开状态则商品数量以sku数量为准
50694
- len += obj[item].skus.length;
50695
- } else {
50696
- len += 1;
50697
- }
50698
- });
50699
- }
50700
- return len;
50701
- }
50702
-
50703
50745
  // 动态条件
50704
50746
  function DynamicCondition(props) {
50705
50747
  var _useState = React.useState([]),
@@ -50846,7 +50888,7 @@
50846
50888
  return /*#__PURE__*/React__default['default'].createElement("div", {
50847
50889
  className: "".concat(prefixCls, "-rule-group")
50848
50890
  }, /*#__PURE__*/React__default['default'].createElement("div", {
50849
- className: "".concat(prefixCls, "-rule-group-title-new")
50891
+ className: "".concat(prefixCls, "-rule-group-title")
50850
50892
  }, /*#__PURE__*/React__default['default'].createElement("span", {
50851
50893
  style: {
50852
50894
  display: 'flex'
@@ -50872,7 +50914,7 @@
50872
50914
  currentRule: props.currentRule,
50873
50915
  setCurrentRule: props.setDynamicCondition
50874
50916
  }, /*#__PURE__*/React__default['default'].createElement("div", {
50875
- className: "condition-tab-wrap goods-table-wrap"
50917
+ className: "edit-condition ".concat(prefixCls, "-goods-selector-new-goods-table-wrap")
50876
50918
  }, /*#__PURE__*/React__default['default'].createElement(Conditions$1.Form, null))) : /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Loading, null));
50877
50919
  }
50878
50920
 
@@ -51136,7 +51178,7 @@
51136
51178
  maxWidth: "570px"
51137
51179
  }
51138
51180
  }, /*#__PURE__*/React__default['default'].createElement("div", {
51139
- className: "".concat(prefixCls, "-goods-selector-pro-create-history-new")
51181
+ className: "".concat(prefixCls, "-goods-selector-new-create-condition")
51140
51182
  }, /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Tips, {
51141
51183
  icon: "info-circle1",
51142
51184
  msg: "<div><div>1. \u53EF\u521B\u5EFA\u548C\u4FDD\u5B58\u6700\u8FD1\u768430\u4E2A\u5546\u54C1\u67E5\u8BE2\u6761\u4EF6\uFF1B\u8D85\u8FC730\u4E2A\u65F6\uFF0C\u7CFB\u7EDF\u5C06\u6309\u4ECE\u65E9\u53CA\u665A\u89C4\u5219\u5220\u9664\u3002</div><div>2. \u4FDD\u5B58\u6210\u529F\u540E\uFF0C\u53EF\u70B9\u51FB\u3010\u5E38\u7528\u67E5\u8BE2\u6761\u4EF6\u3011\u627E\u5230\u4FDD\u5B58\u8FC7\u7684\u67E5\u8BE2\u6761\u4EF6\u3002</div></div>",
@@ -51577,6 +51619,7 @@
51577
51619
  };
51578
51620
  }();
51579
51621
  var handleMatch = function handleMatch() {
51622
+ var _batchResult$data, _batchResult$data$dat;
51580
51623
  if (!isMatch) {
51581
51624
  cloudReactV2.Message.error('请先进行匹配');
51582
51625
  return;
@@ -51588,7 +51631,7 @@
51588
51631
  }
51589
51632
  var addNum = props.limit - resultGoodsLength$1(ctxValue.globalSelect);
51590
51633
  // TODO 去重
51591
- var addList = batchResult.data.data.slice(0, addNum);
51634
+ var addList = ((_batchResult$data = batchResult.data) === null || _batchResult$data === void 0 ? void 0 : (_batchResult$data$dat = _batchResult$data.data) === null || _batchResult$data$dat === void 0 ? void 0 : _batchResult$data$dat.length) ? batchResult.data.data.slice(0, addNum) : [];
51592
51635
  ctxValue.setAllGlobalSelect(addList, ctxValue.globalSelect, true);
51593
51636
  if (!isSupportAllPlatShop) {
51594
51637
  ctxValue.setAllGlobalSearch(addList);
@@ -51607,7 +51650,7 @@
51607
51650
  initData();
51608
51651
  };
51609
51652
  var footer = /*#__PURE__*/React__default['default'].createElement("div", {
51610
- className: "goods-selector-pro-node-new-footer"
51653
+ className: "".concat(prefixCls, "-goods-selector-new-footer")
51611
51654
  }, !props.readonly ? /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Button, {
51612
51655
  className: "cancel",
51613
51656
  onClick: closePop
@@ -52690,7 +52733,7 @@
52690
52733
  }
52691
52734
  }), "\u53EF\u5C06\u5E38\u7528\u7684\u67E5\u8BE2\u6761\u4EF6\u8BBE\u4E3A\u9ED8\u8BA4\uFF0C\u9ED8\u8BA4\u7684\u67E5\u8BE2\u6761\u4EF6\u5C06\u88AB\u56FA\u5B9A\u5728\u5546\u54C1\u641C\u7D22\u6761\u4EF6\u7684\u754C\u9762\u4E0A\u3002");
52692
52735
  return /*#__PURE__*/React__default['default'].createElement("div", {
52693
- className: "newCloud-add-condition"
52736
+ className: "add-condition-new"
52694
52737
  }, /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Tips, {
52695
52738
  msg: tipNode
52696
52739
  }), /*#__PURE__*/React__default['default'].createElement("div", {
@@ -53785,7 +53828,7 @@
53785
53828
  // const hiddenDisplayQuery = usedQuery.slice(6);
53786
53829
 
53787
53830
  var footer = /*#__PURE__*/React__default['default'].createElement("div", {
53788
- className: "goods-selector-pro-node-new-footer"
53831
+ className: "".concat(prefixCls, "-goods-selector-new-footer")
53789
53832
  }, !props.readonly ? /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Button, {
53790
53833
  className: "cancel",
53791
53834
  onClick: handleClose
@@ -53798,7 +53841,7 @@
53798
53841
  onClick: handleOk
53799
53842
  }, "\u786E\u5B9A"));
53800
53843
  return /*#__PURE__*/React__default['default'].createElement("div", {
53801
- className: "goods-selector-pro-form-new"
53844
+ className: "".concat(prefixCls, "-goods-selector-new-goods-form")
53802
53845
  }, dropDown && usedQuery.length ? usedQuery.map(function (item) {
53803
53846
  var itemId = item.itemId,
53804
53847
  itemName = item.itemName,
@@ -54565,7 +54608,7 @@
54565
54608
  // const tableList = Object.values(ctxValue.globalTableList);
54566
54609
  // ctxValue.setSkuToggleStatus(tableList, ctxValue.globalTableList, false);
54567
54610
  // ctxValue.setIsExpandAll(false);
54568
- ctxValue.setAllGlobalSelect([], ctxValue.globalSelect, false);
54611
+ ctxValue.setAllGlobalSelect([], [], false);
54569
54612
  resultGoodsLength$1([]);
54570
54613
  setTimeout(function () {
54571
54614
  setLoading(false);
@@ -54632,7 +54675,7 @@
54632
54675
  setColumns(ctxValue.globalSelectColumn);
54633
54676
  }, [ctxValue.globalSelectColumn]);
54634
54677
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
54635
- className: "newCloud-goods-table-wrap"
54678
+ className: "".concat(prefixCls, "-goods-selector-new-goods-table-wrap")
54636
54679
  }, allQuery.length ? /*#__PURE__*/React__default['default'].createElement(GoodsForm$1, {
54637
54680
  platShop: platShop,
54638
54681
  platShopList: platShopList,
@@ -54948,7 +54991,7 @@
54948
54991
  setColumns(ctxValue.globalSelectColumn);
54949
54992
  }, [ctxValue.globalSelectColumn]);
54950
54993
  return /*#__PURE__*/React__default['default'].createElement("div", {
54951
- className: "cloud-select-tab-wrap-new newCloud-goods-table-wrap"
54994
+ className: "".concat(prefixCls, "-goods-selector-new-selected-tab ").concat(prefixCls, "-goods-selector-new-goods-table-wrap")
54952
54995
  }, /*#__PURE__*/React__default['default'].createElement("div", {
54953
54996
  className: "justify-between"
54954
54997
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -55131,18 +55174,9 @@
55131
55174
  }();
55132
55175
  var onClose = function onClose() {
55133
55176
  props.onClose(globalSelect);
55134
- // setCurrentPageNum(1),
55135
- // setCurrentPageSize(10)
55136
55177
  };
55137
-
55138
- // const footer = <>
55139
- // {!props.readonly ? <Button style={{ marginRight: 16 }} className="cancel-btn" onClick={onCancel}>取消</Button> : null}
55140
- // <Button type="primary" onClick={onOk}>确定</Button>
55141
-
55142
- // </>;
55143
-
55144
55178
  var footer = /*#__PURE__*/React__default['default'].createElement("div", {
55145
- className: "goods-selector-pro-node-new-footer"
55179
+ className: "".concat(prefixCls, "-goods-selector-new-footer")
55146
55180
  }, !props.readonly ? /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Button, {
55147
55181
  className: "cancel",
55148
55182
  onClick: onCancel
@@ -55165,7 +55199,7 @@
55165
55199
  }, /*#__PURE__*/React__default['default'].createElement(GoodsProvider$1, {
55166
55200
  value: props.ctxContext
55167
55201
  }, /*#__PURE__*/React__default['default'].createElement("div", {
55168
- className: "".concat(prefixCls, "-goods-selector-pro-container-new"),
55202
+ className: "".concat(prefixCls, "-goods-selector-new-goods-modal"),
55169
55203
  style: {
55170
55204
  position: 'relative'
55171
55205
  }
@@ -55178,7 +55212,7 @@
55178
55212
  })
55179
55213
  }) : null, /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Tabs, {
55180
55214
  defaultActiveKey: "all",
55181
- className: "".concat(prefixCls, "-goods-selector-pro-new"),
55215
+ className: "".concat(prefixCls, "-goods-selector-new-goods-modal-tabs"),
55182
55216
  activeKey: nowActive,
55183
55217
  mode: "remain",
55184
55218
  type: "line",
@@ -55186,7 +55220,7 @@
55186
55220
  }, tabList.includes('all') && !readonly && /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Tabs.Panel, {
55187
55221
  tab: "\u5168\u90E8\u5546\u54C1",
55188
55222
  key: "all",
55189
- className: "".concat(prefixCls, "-goods-selector-pro-new-panel")
55223
+ className: "".concat(prefixCls, "-goods-selector-new-goods-modal-tabs-panel")
55190
55224
  }, /*#__PURE__*/React__default['default'].createElement(AllGoods$1, _extends({
55191
55225
  tabActive: nowActive
55192
55226
  }, props, {
@@ -55195,7 +55229,7 @@
55195
55229
  }))), tabList.includes('selected') && /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Tabs.Panel, {
55196
55230
  tab: "\u5DF2\u9009\u5546\u54C1",
55197
55231
  key: "selected",
55198
- className: "".concat(prefixCls, "-goods-selector-pro-new-panel")
55232
+ className: "".concat(prefixCls, "-goods-selector-new-goods-modal-tabs-panel")
55199
55233
  }, /*#__PURE__*/React__default['default'].createElement(SelectGoods$2, {
55200
55234
  server: server,
55201
55235
  extraQuery: extraQuery,
@@ -55455,7 +55489,7 @@
55455
55489
  return /*#__PURE__*/React__default['default'].createElement("div", {
55456
55490
  className: "".concat(prefixCls, "-rule-group")
55457
55491
  }, /*#__PURE__*/React__default['default'].createElement("div", {
55458
- className: "".concat(prefixCls, "-rule-group-title-new")
55492
+ className: "".concat(prefixCls, "-rule-group-title")
55459
55493
  }, /*#__PURE__*/React__default['default'].createElement("span", {
55460
55494
  style: {
55461
55495
  display: 'flex'
@@ -56254,9 +56288,9 @@
56254
56288
  supportSku: props.supportSku,
56255
56289
  showPage: showPage
56256
56290
  })))), tabList.includes('find') ? /*#__PURE__*/React__default['default'].createElement("div", {
56257
- className: "".concat(prefixCls, "-goods-selector-pro-container")
56291
+ className: "".concat(prefixCls, "-goods-selector-new-goods-modal")
56258
56292
  }, /*#__PURE__*/React__default['default'].createElement("div", {
56259
- className: "".concat(prefixCls, "-good-rules-container")
56293
+ className: "".concat(prefixCls, "-goods-selector-new-rules-container")
56260
56294
  }, !props.supportConditionsOnlyGoods && /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Tips, {
56261
56295
  icon: "info-circle1",
56262
56296
  msg: "\u540C\u65F6\u4FDD\u5B58\u5546\u54C1\u67E5\u8BE2\u548C\u6761\u4EF6\u67E5\u8BE2\uFF0C\u67E5\u8BE2\u7ED3\u679C\u4E3A\u4E24\u8005\u7684\u5E76\u96C6\u3002",
@@ -56361,7 +56395,7 @@
56361
56395
  renameData: renameData,
56362
56396
  ctxValue: ctxValue
56363
56397
  }))) : /*#__PURE__*/React__default['default'].createElement("div", {
56364
- className: "".concat(prefixCls, "-goods-selector-pro-container-new"),
56398
+ className: "".concat(prefixCls, "-goods-selector-new-goods-modal"),
56365
56399
  style: {
56366
56400
  position: 'relative'
56367
56401
  }
@@ -56374,7 +56408,7 @@
56374
56408
  })
56375
56409
  }) : null, /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Tabs, {
56376
56410
  defaultActiveKey: "1",
56377
- className: "".concat(prefixCls, "-goods-selector-pro-new"),
56411
+ className: "".concat(prefixCls, "-goods-selector-new-goods-modal-tabs"),
56378
56412
  activeKey: nowActive,
56379
56413
  mode: "remain",
56380
56414
  type: "line",
@@ -56382,7 +56416,7 @@
56382
56416
  }, tabList.includes('all') && !props.readonly && /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Tabs.Panel, {
56383
56417
  tab: "\u5168\u90E8\u5546\u54C1",
56384
56418
  key: "all",
56385
- className: "".concat(prefixCls, "-goods-selector-pro-new-panel")
56419
+ className: "".concat(prefixCls, "-goods-selector-new-goods-modal-tab-panel")
56386
56420
  }, /*#__PURE__*/React__default['default'].createElement(AllGoods$1, _extends({}, props, {
56387
56421
  tabActive: nowActive,
56388
56422
  changeCondition: changeCondition,
@@ -56390,7 +56424,7 @@
56390
56424
  }))), tabList.includes('selected') && /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Tabs.Panel, {
56391
56425
  tab: "\u5DF2\u9009\u5546\u54C1",
56392
56426
  key: "selected",
56393
- className: "".concat(prefixCls, "-goods-selector-pro-new-panel")
56427
+ className: "".concat(prefixCls, "-goods-selector-new-goods-modal-tabs-panel")
56394
56428
  }, /*#__PURE__*/React__default['default'].createElement(SelectGoods$2, {
56395
56429
  server: server,
56396
56430
  extraQuery: extraQuery,
@@ -56591,7 +56625,7 @@
56591
56625
  setModalVisible(visible);
56592
56626
  }, [visible]);
56593
56627
  var footer = /*#__PURE__*/React__default['default'].createElement("div", {
56594
- className: "goods-selector-pro-node-new-footer"
56628
+ className: "".concat(prefixCls, "-goods-selector-new-footer")
56595
56629
  }, /*#__PURE__*/React__default['default'].createElement(cloudReactV2.Button, {
56596
56630
  className: "cancel",
56597
56631
  onClick: onCancel
@@ -56676,7 +56710,7 @@
56676
56710
  onClose: onClose
56677
56711
  // onCancel={onCancel}
56678
56712
  ,
56679
- className: "goods-selector-pro-node-new"
56713
+ className: "".concat(prefixCls, "-goods-selector-new")
56680
56714
  }, visible && rulesVisible && /*#__PURE__*/React__default['default'].createElement(Rules, _extends({
56681
56715
  modalRef: modalRef,
56682
56716
  forwardRef: ref
@@ -111425,9 +111459,18 @@
111425
111459
  };
111426
111460
  _this.handleInsertKeywordAndText = function (content, keyword) {
111427
111461
  var _ref2;
111428
- var arr = (_ref2 = []).concat.apply(_ref2, _toConsumableArray(content.split(/(?=œœ_)/).map(function (item) {
111429
- return item.split(/(?<=_œœ)/);
111430
- })));
111462
+ var reg1 = new RegExp(/(?=œœ_)/);
111463
+ // 将 变量文本字符串 拆分成 变量 和 文本
111464
+ // => 将 "文本1œœ_[bianliang]变量_œœ文本2œœ_[taoba]订单短[2323]_œœœœ_[taobao]XMTB_œœ"
111465
+ // => 转换成 ['文本1', 'œœ_[bianliang]变量_œœ', '文本2', 'œœ_[taoba]订单短[2323]_œœ', 'œœ_[taobao]XMTB_œœ']
111466
+ var arr = (_ref2 = []).concat.apply(_ref2, _toConsumableArray(content.split(reg1).map(function (item) {
111467
+ return item.split(/_œœ/);
111468
+ }))).map(function (item) {
111469
+ if (item.includes('œœ_')) {
111470
+ return "".concat(item, "_\u0153\u0153");
111471
+ }
111472
+ return item;
111473
+ }).filter(Boolean);
111431
111474
  arr.forEach(function (item) {
111432
111475
  if (item.includes('œœ_[')) {
111433
111476
  var type = item.match(/œœ_\[.*?]/g)[0].replace(/œœ_\[|]/g, '');
@@ -112384,7 +112427,8 @@
112384
112427
  _this.originalPreviewText = [];
112385
112428
  _this.originalTotalChars = 0;
112386
112429
  _this.getPureEditorText = function (editorText) {
112387
- return editorText.replace(/\(.*?\)(?=_œœ)/g, '');
112430
+ var reg = new RegExp(/\(.*?\)(?=_œœ)/g);
112431
+ return editorText.replace(reg, '');
112388
112432
  };
112389
112433
  _this.getPureText = function (editorText) {
112390
112434
  return editorText.replace(/œœ_.*?_œœ|þ_enter_þ/g, '');
@@ -114767,7 +114811,7 @@
114767
114811
  var key = "atom" + ++keyCount;
114768
114812
  var config = {
114769
114813
  toString: function toString() {
114770
- return key;
114814
+ return this.debugLabel ? key + ':' + this.debugLabel : key;
114771
114815
  }
114772
114816
  };
114773
114817
  if (typeof read === 'function') {
@@ -114797,7 +114841,7 @@
114797
114841
  function _createForOfIteratorHelperLoose(r, e) {
114798
114842
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
114799
114843
  if (t) return (t = t.call(r)).next.bind(t);
114800
- if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e ) {
114844
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e) {
114801
114845
  t && (r = t);
114802
114846
  var o = 0;
114803
114847
  return function () {
@@ -114828,240 +114872,237 @@
114828
114872
  var isActuallyWritableAtom = function isActuallyWritableAtom(atom) {
114829
114873
  return !!atom.write;
114830
114874
  };
114831
- var cancelPromiseMap = new WeakMap();
114832
- var registerCancelPromise = function registerCancelPromise(promise, cancel) {
114833
- cancelPromiseMap.set(promise, cancel);
114834
- promise.catch(function () {}).finally(function () {
114835
- return cancelPromiseMap.delete(promise);
114836
- });
114837
- };
114838
- var cancelPromise = function cancelPromise(promise, next) {
114839
- var cancel = cancelPromiseMap.get(promise);
114840
- if (cancel) {
114841
- cancelPromiseMap.delete(promise);
114842
- cancel(next);
114875
+ var CONTINUE_PROMISE = Symbol( 'CONTINUE_PROMISE' );
114876
+ var PENDING = 'pending';
114877
+ var FULFILLED = 'fulfilled';
114878
+ var REJECTED = 'rejected';
114879
+ var isContinuablePromise = function isContinuablePromise(promise) {
114880
+ return typeof promise === 'object' && promise !== null && CONTINUE_PROMISE in promise;
114881
+ };
114882
+ var continuablePromiseMap = new WeakMap();
114883
+ var createContinuablePromise = function createContinuablePromise(promise, abort, complete) {
114884
+ if (!continuablePromiseMap.has(promise)) {
114885
+ var continuePromise;
114886
+ var p = new Promise(function (resolve, reject) {
114887
+ var curr = promise;
114888
+ var onFulfilled = function onFulfilled(me) {
114889
+ return function (v) {
114890
+ if (curr === me) {
114891
+ p.status = FULFILLED;
114892
+ p.value = v;
114893
+ resolve(v);
114894
+ complete();
114895
+ }
114896
+ };
114897
+ };
114898
+ var onRejected = function onRejected(me) {
114899
+ return function (e) {
114900
+ if (curr === me) {
114901
+ p.status = REJECTED;
114902
+ p.reason = e;
114903
+ reject(e);
114904
+ complete();
114905
+ }
114906
+ };
114907
+ };
114908
+ promise.then(onFulfilled(promise), onRejected(promise));
114909
+ continuePromise = function continuePromise(nextPromise, nextAbort) {
114910
+ if (nextPromise) {
114911
+ continuablePromiseMap.set(nextPromise, p);
114912
+ curr = nextPromise;
114913
+ nextPromise.then(onFulfilled(nextPromise), onRejected(nextPromise));
114914
+ abort();
114915
+ abort = nextAbort;
114916
+ }
114917
+ };
114918
+ });
114919
+ p.status = PENDING;
114920
+ p[CONTINUE_PROMISE] = continuePromise;
114921
+ continuablePromiseMap.set(promise, p);
114843
114922
  }
114844
- };
114845
- var resolvePromise = function resolvePromise(promise, value) {
114846
- promise.status = 'fulfilled';
114847
- promise.value = value;
114848
- };
114849
- var rejectPromise = function rejectPromise(promise, e) {
114850
- promise.status = 'rejected';
114851
- promise.reason = e;
114923
+ return continuablePromiseMap.get(promise);
114852
114924
  };
114853
114925
  var isPromiseLike = function isPromiseLike(x) {
114854
114926
  return typeof (x == null ? void 0 : x.then) === 'function';
114855
114927
  };
114856
- var isEqualAtomValue = function isEqualAtomValue(a, b) {
114857
- return !!a && 'v' in a && 'v' in b && Object.is(a.v, b.v);
114858
- };
114859
- var isEqualAtomError = function isEqualAtomError(a, b) {
114860
- return !!a && 'e' in a && 'e' in b && Object.is(a.e, b.e);
114861
- };
114862
- var hasPromiseAtomValue = function hasPromiseAtomValue(a) {
114863
- return !!a && 'v' in a && a.v instanceof Promise;
114864
- };
114865
- var isEqualPromiseAtomValue = function isEqualPromiseAtomValue(a, b) {
114866
- return 'v' in a && 'v' in b && a.v.orig && a.v.orig === b.v.orig;
114928
+ var isAtomStateInitialized = function isAtomStateInitialized(atomState) {
114929
+ return 'v' in atomState || 'e' in atomState;
114867
114930
  };
114868
114931
  var returnAtomValue = function returnAtomValue(atomState) {
114869
114932
  if ('e' in atomState) {
114870
114933
  throw atomState.e;
114871
114934
  }
114935
+ if ( !('v' in atomState)) {
114936
+ throw new Error('[Bug] atom state is not initialized');
114937
+ }
114872
114938
  return atomState.v;
114873
114939
  };
114874
- var createStore$1$1 = function createStore() {
114940
+ var getPendingContinuablePromise = function getPendingContinuablePromise(atomState) {
114941
+ var value = atomState.v;
114942
+ if (isContinuablePromise(value) && value.status === PENDING) {
114943
+ return value;
114944
+ }
114945
+ return null;
114946
+ };
114947
+ var addPendingContinuablePromiseToDependency = function addPendingContinuablePromiseToDependency(atom, promise, dependencyAtomState) {
114948
+ if (!dependencyAtomState.p.has(atom)) {
114949
+ dependencyAtomState.p.add(atom);
114950
+ promise.then(function () {
114951
+ dependencyAtomState.p.delete(atom);
114952
+ }, function () {
114953
+ dependencyAtomState.p.delete(atom);
114954
+ });
114955
+ }
114956
+ };
114957
+ var createPending = function createPending() {
114958
+ return [new Map(), new Map(), new Set()];
114959
+ };
114960
+ var addPendingAtom = function addPendingAtom(pending, atom, atomState) {
114961
+ if (!pending[0].has(atom)) {
114962
+ pending[0].set(atom, new Set());
114963
+ }
114964
+ pending[1].set(atom, atomState);
114965
+ };
114966
+ var addPendingDependent = function addPendingDependent(pending, atom, dependent) {
114967
+ var dependents = pending[0].get(atom);
114968
+ if (dependents) {
114969
+ dependents.add(dependent);
114970
+ }
114971
+ };
114972
+ var getPendingDependents = function getPendingDependents(pending, atom) {
114973
+ return pending[0].get(atom);
114974
+ };
114975
+ var addPendingFunction = function addPendingFunction(pending, fn) {
114976
+ pending[2].add(fn);
114977
+ };
114978
+ var flushPending = function flushPending(pending) {
114979
+ while (pending[1].size || pending[2].size) {
114980
+ pending[0].clear();
114981
+ var _atomStates = new Set(pending[1].values());
114982
+ pending[1].clear();
114983
+ var _functions = new Set(pending[2]);
114984
+ pending[2].clear();
114985
+ _atomStates.forEach(function (atomState) {
114986
+ var _atomState$m;
114987
+ return (_atomState$m = atomState.m) == null ? void 0 : _atomState$m.l.forEach(function (l) {
114988
+ return l();
114989
+ });
114990
+ });
114991
+ _functions.forEach(function (fn) {
114992
+ return fn();
114993
+ });
114994
+ }
114995
+ };
114996
+ var createStore$2 = function createStore() {
114875
114997
  var atomStateMap = new WeakMap();
114876
- var mountedMap = new WeakMap();
114877
- var pendingStack = [];
114878
- var pendingMap = new WeakMap();
114879
- var devListenersRev2;
114880
- var mountedAtoms;
114998
+ var debugMountedAtoms;
114881
114999
  {
114882
- devListenersRev2 = new Set();
114883
- mountedAtoms = new Set();
115000
+ debugMountedAtoms = new Set();
114884
115001
  }
114885
115002
  var getAtomState = function getAtomState(atom) {
114886
- return atomStateMap.get(atom);
114887
- };
114888
- var addPendingDependent = function addPendingDependent(atom, atomState) {
114889
- atomState.d.forEach(function (_, a) {
114890
- if (!pendingMap.has(a)) {
114891
- var aState = getAtomState(a);
114892
- pendingMap.set(a, [aState, new Set()]);
114893
- if (aState) {
114894
- addPendingDependent(a, aState);
114895
- }
114896
- }
114897
- pendingMap.get(a)[1].add(atom);
114898
- });
114899
- };
114900
- var setAtomState = function setAtomState(atom, atomState) {
114901
- var _pendingStack;
114902
- {
114903
- Object.freeze(atomState);
114904
- }
114905
- var prevAtomState = getAtomState(atom);
114906
- atomStateMap.set(atom, atomState);
114907
- (_pendingStack = pendingStack[pendingStack.length - 1]) == null || _pendingStack.add(atom);
114908
- if (!pendingMap.has(atom)) {
114909
- pendingMap.set(atom, [prevAtomState, new Set()]);
114910
- addPendingDependent(atom, atomState);
114911
- }
114912
- if (hasPromiseAtomValue(prevAtomState)) {
114913
- var _next = 'v' in atomState ? atomState.v instanceof Promise ? atomState.v : Promise.resolve(atomState.v) : Promise.reject(atomState.e);
114914
- if (prevAtomState.v !== _next) {
114915
- cancelPromise(prevAtomState.v, _next);
114916
- }
114917
- }
114918
- };
114919
- var updateDependencies = function updateDependencies(atom, nextAtomState, nextDependencies, keepPreviousDependencies) {
114920
- var dependencies = new Map(keepPreviousDependencies ? nextAtomState.d : null);
114921
- var changed = false;
114922
- nextDependencies.forEach(function (aState, a) {
114923
- if (!aState && isSelfAtom(atom, a)) {
114924
- aState = nextAtomState;
114925
- }
114926
- if (aState) {
114927
- dependencies.set(a, aState);
114928
- if (nextAtomState.d.get(a) !== aState) {
114929
- changed = true;
114930
- }
114931
- } else {
114932
- console.warn('[Bug] atom state not found');
114933
- }
114934
- });
114935
- if (changed || nextAtomState.d.size !== dependencies.size) {
114936
- nextAtomState.d = dependencies;
115003
+ var atomState = atomStateMap.get(atom);
115004
+ if (!atomState) {
115005
+ atomState = {
115006
+ d: new Map(),
115007
+ p: new Set(),
115008
+ n: 0
115009
+ };
115010
+ atomStateMap.set(atom, atomState);
114937
115011
  }
115012
+ return atomState;
114938
115013
  };
114939
- var setAtomValue = function setAtomValue(atom, value, nextDependencies, keepPreviousDependencies) {
114940
- var prevAtomState = getAtomState(atom);
114941
- var nextAtomState = {
114942
- d: (prevAtomState == null ? void 0 : prevAtomState.d) || new Map(),
114943
- v: value
114944
- };
114945
- if (nextDependencies) {
114946
- updateDependencies(atom, nextAtomState, nextDependencies, keepPreviousDependencies);
114947
- }
114948
- if (isEqualAtomValue(prevAtomState, nextAtomState) && prevAtomState.d === nextAtomState.d) {
114949
- return prevAtomState;
115014
+ var setAtomStateValueOrPromise = function setAtomStateValueOrPromise(atom, atomState, valueOrPromise, abortPromise, completePromise) {
115015
+ if (abortPromise === void 0) {
115016
+ abortPromise = function abortPromise() {};
114950
115017
  }
114951
- if (hasPromiseAtomValue(prevAtomState) && hasPromiseAtomValue(nextAtomState) && isEqualPromiseAtomValue(prevAtomState, nextAtomState)) {
114952
- if (prevAtomState.d === nextAtomState.d) {
114953
- return prevAtomState;
114954
- } else {
114955
- nextAtomState.v = prevAtomState.v;
114956
- }
115018
+ if (completePromise === void 0) {
115019
+ completePromise = function completePromise() {};
114957
115020
  }
114958
- setAtomState(atom, nextAtomState);
114959
- return nextAtomState;
114960
- };
114961
- var setAtomValueOrPromise = function setAtomValueOrPromise(atom, valueOrPromise, nextDependencies, abortPromise) {
115021
+ var hasPrevValue = 'v' in atomState;
115022
+ var prevValue = atomState.v;
115023
+ var pendingPromise = getPendingContinuablePromise(atomState);
114962
115024
  if (isPromiseLike(valueOrPromise)) {
114963
- var continuePromise;
114964
- var updatePromiseDependencies = function updatePromiseDependencies() {
114965
- var prevAtomState = getAtomState(atom);
114966
- if (!hasPromiseAtomValue(prevAtomState) || prevAtomState.v !== promise) {
114967
- return;
114968
- }
114969
- var nextAtomState = setAtomValue(atom, promise, nextDependencies);
114970
- if (mountedMap.has(atom) && prevAtomState.d !== nextAtomState.d) {
114971
- mountDependencies(atom, nextAtomState, prevAtomState.d);
115025
+ if (pendingPromise) {
115026
+ if (pendingPromise !== valueOrPromise) {
115027
+ pendingPromise[CONTINUE_PROMISE](valueOrPromise, abortPromise);
115028
+ ++atomState.n;
114972
115029
  }
114973
- };
114974
- var promise = new Promise(function (resolve, reject) {
114975
- var settled = false;
114976
- valueOrPromise.then(function (v) {
114977
- if (!settled) {
114978
- settled = true;
114979
- resolvePromise(promise, v);
114980
- resolve(v);
114981
- updatePromiseDependencies();
114982
- }
114983
- }, function (e) {
114984
- if (!settled) {
114985
- settled = true;
114986
- rejectPromise(promise, e);
114987
- reject(e);
114988
- updatePromiseDependencies();
114989
- }
114990
- });
114991
- continuePromise = function continuePromise(next) {
114992
- if (!settled) {
114993
- settled = true;
114994
- next.then(function (v) {
114995
- return resolvePromise(promise, v);
114996
- }, function (e) {
114997
- return rejectPromise(promise, e);
114998
- });
114999
- resolve(next);
115030
+ } else {
115031
+ var continuablePromise = createContinuablePromise(valueOrPromise, abortPromise, completePromise);
115032
+ if (continuablePromise.status === PENDING) {
115033
+ for (var _iterator = _createForOfIteratorHelperLoose(atomState.d.keys()), _step; !(_step = _iterator()).done;) {
115034
+ var a = _step.value;
115035
+ var aState = getAtomState(a);
115036
+ addPendingContinuablePromiseToDependency(atom, continuablePromise, aState);
115000
115037
  }
115001
- };
115002
- });
115003
- promise.orig = valueOrPromise;
115004
- promise.status = 'pending';
115005
- registerCancelPromise(promise, function (next) {
115006
- if (next) {
115007
- continuePromise(next);
115008
- abortPromise == null || abortPromise();
115009
115038
  }
115010
- });
115011
- return setAtomValue(atom, promise, nextDependencies, true);
115039
+ atomState.v = continuablePromise;
115040
+ delete atomState.e;
115041
+ }
115042
+ } else {
115043
+ if (pendingPromise) {
115044
+ pendingPromise[CONTINUE_PROMISE](Promise.resolve(valueOrPromise), abortPromise);
115045
+ }
115046
+ atomState.v = valueOrPromise;
115047
+ delete atomState.e;
115048
+ }
115049
+ if (!hasPrevValue || !Object.is(prevValue, atomState.v)) {
115050
+ ++atomState.n;
115012
115051
  }
115013
- return setAtomValue(atom, valueOrPromise, nextDependencies);
115014
115052
  };
115015
- var setAtomError = function setAtomError(atom, error, nextDependencies) {
115016
- var prevAtomState = getAtomState(atom);
115017
- var nextAtomState = {
115018
- d: (prevAtomState == null ? void 0 : prevAtomState.d) || new Map(),
115019
- e: error
115020
- };
115021
- if (nextDependencies) {
115022
- updateDependencies(atom, nextAtomState, nextDependencies);
115053
+ var addDependency = function addDependency(pending, atom, a, aState) {
115054
+ var _aState$m;
115055
+ if ( a === atom) {
115056
+ throw new Error('[Bug] atom cannot depend on itself');
115023
115057
  }
115024
- if (isEqualAtomError(prevAtomState, nextAtomState) && prevAtomState.d === nextAtomState.d) {
115025
- return prevAtomState;
115058
+ var atomState = getAtomState(atom);
115059
+ atomState.d.set(a, aState.n);
115060
+ var continuablePromise = getPendingContinuablePromise(atomState);
115061
+ if (continuablePromise) {
115062
+ addPendingContinuablePromiseToDependency(atom, continuablePromise, aState);
115063
+ }
115064
+ (_aState$m = aState.m) == null || _aState$m.t.add(atom);
115065
+ if (pending) {
115066
+ addPendingDependent(pending, a, atom);
115026
115067
  }
115027
- setAtomState(atom, nextAtomState);
115028
- return nextAtomState;
115029
115068
  };
115030
- var readAtomState = function readAtomState(atom, force) {
115069
+ var readAtomState = function readAtomState(pending, atom, force) {
115031
115070
  var atomState = getAtomState(atom);
115032
- if (!(force != null && force(atom)) && atomState) {
115033
- if (mountedMap.has(atom)) {
115071
+ if (!(force != null && force(atom)) && isAtomStateInitialized(atomState)) {
115072
+ if (atomState.m) {
115034
115073
  return atomState;
115035
115074
  }
115036
115075
  if (Array.from(atomState.d).every(function (_ref) {
115037
115076
  var a = _ref[0],
115038
- s = _ref[1];
115039
- if (a === atom) {
115040
- return true;
115041
- }
115042
- var aState = readAtomState(a, force);
115043
- return aState === s || isEqualAtomValue(aState, s);
115077
+ n = _ref[1];
115078
+ return readAtomState(pending, a, force).n === n;
115044
115079
  })) {
115045
115080
  return atomState;
115046
115081
  }
115047
115082
  }
115048
- var nextDependencies = new Map();
115083
+ atomState.d.clear();
115049
115084
  var isSync = true;
115050
115085
  var getter = function getter(a) {
115051
115086
  if (isSelfAtom(atom, a)) {
115052
115087
  var _aState = getAtomState(a);
115053
- if (_aState) {
115054
- nextDependencies.set(a, _aState);
115055
- return returnAtomValue(_aState);
115056
- }
115057
- if (hasInitialValue(a)) {
115058
- nextDependencies.set(a, undefined);
115059
- return a.init;
115088
+ if (!isAtomStateInitialized(_aState)) {
115089
+ if (hasInitialValue(a)) {
115090
+ setAtomStateValueOrPromise(a, _aState, a.init);
115091
+ } else {
115092
+ throw new Error('no atom init');
115093
+ }
115060
115094
  }
115061
- throw new Error('no atom init');
115095
+ return returnAtomValue(_aState);
115096
+ }
115097
+ var aState = readAtomState(pending, a, force);
115098
+ if (isSync) {
115099
+ addDependency(pending, atom, a, aState);
115100
+ } else {
115101
+ var _pending = createPending();
115102
+ addDependency(_pending, atom, a, aState);
115103
+ mountDependencies(_pending, atom, atomState);
115104
+ flushPending(_pending);
115062
115105
  }
115063
- var aState = readAtomState(a, force);
115064
- nextDependencies.set(a, aState);
115065
115106
  return returnAtomValue(aState);
115066
115107
  };
115067
115108
  var controller;
@@ -115095,37 +115136,52 @@
115095
115136
  };
115096
115137
  try {
115097
115138
  var valueOrPromise = atom.read(getter, options);
115098
- return setAtomValueOrPromise(atom, valueOrPromise, nextDependencies, function () {
115139
+ setAtomStateValueOrPromise(atom, atomState, valueOrPromise, function () {
115099
115140
  var _controller;
115100
115141
  return (_controller = controller) == null ? void 0 : _controller.abort();
115142
+ }, function () {
115143
+ if (atomState.m) {
115144
+ var _pending2 = createPending();
115145
+ mountDependencies(_pending2, atom, atomState);
115146
+ flushPending(_pending2);
115147
+ }
115101
115148
  });
115149
+ return atomState;
115102
115150
  } catch (error) {
115103
- return setAtomError(atom, error, nextDependencies);
115151
+ delete atomState.v;
115152
+ atomState.e = error;
115153
+ ++atomState.n;
115154
+ return atomState;
115104
115155
  } finally {
115105
115156
  isSync = false;
115106
115157
  }
115107
115158
  };
115108
115159
  var readAtom = function readAtom(atom) {
115109
- return returnAtomValue(readAtomState(atom));
115160
+ return returnAtomValue(readAtomState(undefined, atom));
115110
115161
  };
115111
- var recomputeDependents = function recomputeDependents(atom) {
115162
+ var recomputeDependents = function recomputeDependents(pending, atom) {
115112
115163
  var getDependents = function getDependents(a) {
115113
- var _mountedMap$get, _pendingMap$get;
115114
- var dependents = new Set((_mountedMap$get = mountedMap.get(a)) == null ? void 0 : _mountedMap$get.t);
115115
- (_pendingMap$get = pendingMap.get(a)) == null || _pendingMap$get[1].forEach(function (dependent) {
115164
+ var _aState$m2, _getPendingDependents;
115165
+ var aState = getAtomState(a);
115166
+ var dependents = new Set((_aState$m2 = aState.m) == null ? void 0 : _aState$m2.t);
115167
+ for (var _iterator2 = _createForOfIteratorHelperLoose(aState.p), _step2; !(_step2 = _iterator2()).done;) {
115168
+ var atomWithPendingContinuablePromise = _step2.value;
115169
+ dependents.add(atomWithPendingContinuablePromise);
115170
+ }
115171
+ (_getPendingDependents = getPendingDependents(pending, a)) == null || _getPendingDependents.forEach(function (dependent) {
115116
115172
  dependents.add(dependent);
115117
115173
  });
115118
115174
  return dependents;
115119
115175
  };
115120
- var topsortedAtoms = new Array();
115176
+ var topsortedAtoms = [];
115121
115177
  var markedAtoms = new Set();
115122
115178
  var visit = function visit(n) {
115123
115179
  if (markedAtoms.has(n)) {
115124
115180
  return;
115125
115181
  }
115126
115182
  markedAtoms.add(n);
115127
- for (var _iterator = _createForOfIteratorHelperLoose(getDependents(n)), _step; !(_step = _iterator()).done;) {
115128
- var m = _step.value;
115183
+ for (var _iterator3 = _createForOfIteratorHelperLoose(getDependents(n)), _step3; !(_step3 = _iterator3()).done;) {
115184
+ var m = _step3.value;
115129
115185
  if (n !== m) {
115130
115186
  visit(m);
115131
115187
  }
@@ -115139,37 +115195,32 @@
115139
115195
  };
115140
115196
  for (var i = topsortedAtoms.length - 1; i >= 0; --i) {
115141
115197
  var a = topsortedAtoms[i];
115142
- var _prevAtomState = getAtomState(a);
115143
- if (!_prevAtomState) {
115144
- continue;
115145
- }
115198
+ var aState = getAtomState(a);
115199
+ var prevEpochNumber = aState.n;
115146
115200
  var hasChangedDeps = false;
115147
- for (var _iterator2 = _createForOfIteratorHelperLoose(_prevAtomState.d.keys()), _step2; !(_step2 = _iterator2()).done;) {
115148
- var dep = _step2.value;
115201
+ for (var _iterator4 = _createForOfIteratorHelperLoose(aState.d.keys()), _step4; !(_step4 = _iterator4()).done;) {
115202
+ var dep = _step4.value;
115149
115203
  if (dep !== a && changedAtoms.has(dep)) {
115150
115204
  hasChangedDeps = true;
115151
115205
  break;
115152
115206
  }
115153
115207
  }
115154
115208
  if (hasChangedDeps) {
115155
- var nextAtomState = readAtomState(a, isMarked);
115156
- addPendingDependent(a, nextAtomState);
115157
- if (!isEqualAtomValue(_prevAtomState, nextAtomState)) {
115209
+ readAtomState(pending, a, isMarked);
115210
+ mountDependencies(pending, a, aState);
115211
+ if (prevEpochNumber !== aState.n) {
115212
+ addPendingAtom(pending, a, aState);
115158
115213
  changedAtoms.add(a);
115159
115214
  }
115160
115215
  }
115161
115216
  markedAtoms.delete(a);
115162
115217
  }
115163
115218
  };
115164
- var writeAtomState = function writeAtomState(atom) {
115219
+ var writeAtomState = function writeAtomState(pending, atom) {
115165
115220
  var getter = function getter(a) {
115166
- return returnAtomValue(readAtomState(a));
115221
+ return returnAtomValue(readAtomState(pending, a));
115167
115222
  };
115168
115223
  var setter = function setter(a) {
115169
- var isSync = pendingStack.length > 0;
115170
- if (!isSync) {
115171
- pendingStack.push(new Set([a]));
115172
- }
115173
115224
  var r;
115174
115225
  for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
115175
115226
  args[_key3 - 1] = arguments[_key3];
@@ -115178,277 +115229,177 @@
115178
115229
  if (!hasInitialValue(a)) {
115179
115230
  throw new Error('atom not writable');
115180
115231
  }
115181
- var _prevAtomState2 = getAtomState(a);
115182
- var nextAtomState = setAtomValueOrPromise(a, args[0]);
115183
- if (!isEqualAtomValue(_prevAtomState2, nextAtomState)) {
115184
- recomputeDependents(a);
115232
+ var aState = getAtomState(a);
115233
+ var hasPrevValue = 'v' in aState;
115234
+ var prevValue = aState.v;
115235
+ var v = args[0];
115236
+ setAtomStateValueOrPromise(a, aState, v);
115237
+ mountDependencies(pending, a, aState);
115238
+ if (!hasPrevValue || !Object.is(prevValue, aState.v)) {
115239
+ addPendingAtom(pending, a, aState);
115240
+ recomputeDependents(pending, a);
115185
115241
  }
115186
115242
  } else {
115187
- r = writeAtomState.apply(void 0, [a].concat(args));
115188
- }
115189
- if (!isSync) {
115190
- var flushed = flushPending(pendingStack.pop());
115191
- {
115192
- devListenersRev2.forEach(function (l) {
115193
- return l({
115194
- type: 'async-write',
115195
- flushed: flushed
115196
- });
115197
- });
115198
- }
115243
+ r = writeAtomState.apply(void 0, [pending, a].concat(args));
115199
115244
  }
115245
+ flushPending(pending);
115200
115246
  return r;
115201
115247
  };
115202
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
115203
- args[_key2 - 1] = arguments[_key2];
115248
+ for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
115249
+ args[_key2 - 2] = arguments[_key2];
115204
115250
  }
115205
115251
  var result = atom.write.apply(atom, [getter, setter].concat(args));
115206
115252
  return result;
115207
115253
  };
115208
115254
  var writeAtom = function writeAtom(atom) {
115209
- pendingStack.push(new Set([atom]));
115255
+ var pending = createPending();
115210
115256
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
115211
115257
  args[_key4 - 1] = arguments[_key4];
115212
115258
  }
115213
- var result = writeAtomState.apply(void 0, [atom].concat(args));
115214
- var flushed = flushPending(pendingStack.pop());
115215
- {
115216
- devListenersRev2.forEach(function (l) {
115217
- return l({
115218
- type: 'write',
115219
- flushed: flushed
115220
- });
115221
- });
115222
- }
115259
+ var result = writeAtomState.apply(void 0, [pending, atom].concat(args));
115260
+ flushPending(pending);
115223
115261
  return result;
115224
115262
  };
115225
- var mountAtom = function mountAtom(atom, initialDependent, onMountQueue) {
115226
- var _getAtomState;
115227
- var existingMount = mountedMap.get(atom);
115228
- if (existingMount) {
115229
- if (initialDependent) {
115230
- existingMount.t.add(initialDependent);
115231
- }
115232
- return existingMount;
115233
- }
115234
- var queue = onMountQueue || [];
115235
- (_getAtomState = getAtomState(atom)) == null || _getAtomState.d.forEach(function (_, a) {
115236
- if (a !== atom) {
115237
- mountAtom(a, atom, queue);
115263
+ var mountDependencies = function mountDependencies(pending, atom, atomState) {
115264
+ if (atomState.m && !getPendingContinuablePromise(atomState)) {
115265
+ for (var _iterator5 = _createForOfIteratorHelperLoose(atomState.d.keys()), _step5; !(_step5 = _iterator5()).done;) {
115266
+ var a = _step5.value;
115267
+ if (!atomState.m.d.has(a)) {
115268
+ var aMounted = mountAtom(pending, a);
115269
+ aMounted.t.add(atom);
115270
+ atomState.m.d.add(a);
115271
+ }
115238
115272
  }
115239
- });
115240
- readAtomState(atom);
115241
- var mounted = {
115242
- t: new Set(initialDependent && [initialDependent]),
115243
- l: new Set()
115244
- };
115245
- mountedMap.set(atom, mounted);
115246
- {
115247
- mountedAtoms.add(atom);
115248
- }
115249
- if (isActuallyWritableAtom(atom) && atom.onMount) {
115250
- var onMount = atom.onMount;
115251
- queue.push(function () {
115252
- var onUnmount = onMount(function () {
115253
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
115254
- args[_key5] = arguments[_key5];
115255
- }
115256
- return writeAtom.apply(void 0, [atom].concat(args));
115257
- });
115258
- if (onUnmount) {
115259
- mounted.u = onUnmount;
115273
+ for (var _iterator6 = _createForOfIteratorHelperLoose(atomState.m.d || []), _step6; !(_step6 = _iterator6()).done;) {
115274
+ var _a = _step6.value;
115275
+ if (!atomState.d.has(_a)) {
115276
+ atomState.m.d.delete(_a);
115277
+ var _aMounted = unmountAtom(pending, _a);
115278
+ _aMounted == null || _aMounted.t.delete(atom);
115260
115279
  }
115261
- });
115262
- }
115263
- if (!onMountQueue) {
115264
- queue.forEach(function (f) {
115265
- return f();
115266
- });
115280
+ }
115267
115281
  }
115268
- return mounted;
115269
115282
  };
115270
- var canUnmountAtom = function canUnmountAtom(atom, mounted) {
115271
- return !mounted.l.size && (!mounted.t.size || mounted.t.size === 1 && mounted.t.has(atom));
115272
- };
115273
- var tryUnmountAtom = function tryUnmountAtom(atom, mounted) {
115274
- if (!canUnmountAtom(atom, mounted)) {
115275
- return;
115276
- }
115277
- var onUnmount = mounted.u;
115278
- if (onUnmount) {
115279
- onUnmount();
115280
- }
115281
- mountedMap.delete(atom);
115282
- {
115283
- mountedAtoms.delete(atom);
115284
- }
115283
+ var mountAtom = function mountAtom(pending, atom) {
115285
115284
  var atomState = getAtomState(atom);
115286
- if (atomState) {
115287
- if (hasPromiseAtomValue(atomState)) {
115288
- cancelPromise(atomState.v);
115289
- }
115290
- atomState.d.forEach(function (_, a) {
115291
- if (a !== atom) {
115292
- var mountedDep = mountedMap.get(a);
115293
- if (mountedDep) {
115294
- mountedDep.t.delete(atom);
115295
- tryUnmountAtom(a, mountedDep);
115285
+ if (!atomState.m) {
115286
+ readAtomState(pending, atom);
115287
+ for (var _iterator7 = _createForOfIteratorHelperLoose(atomState.d.keys()), _step7; !(_step7 = _iterator7()).done;) {
115288
+ var a = _step7.value;
115289
+ var aMounted = mountAtom(pending, a);
115290
+ aMounted.t.add(atom);
115291
+ }
115292
+ atomState.m = {
115293
+ l: new Set(),
115294
+ d: new Set(atomState.d.keys()),
115295
+ t: new Set()
115296
+ };
115297
+ {
115298
+ debugMountedAtoms.add(atom);
115299
+ }
115300
+ if (isActuallyWritableAtom(atom) && atom.onMount) {
115301
+ var mounted = atomState.m;
115302
+ var onMount = atom.onMount;
115303
+ addPendingFunction(pending, function () {
115304
+ var onUnmount = onMount(function () {
115305
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
115306
+ args[_key5] = arguments[_key5];
115307
+ }
115308
+ return writeAtomState.apply(void 0, [pending, atom].concat(args));
115309
+ });
115310
+ if (onUnmount) {
115311
+ mounted.u = onUnmount;
115296
115312
  }
115297
- }
115298
- });
115299
- } else {
115300
- console.warn('[Bug] could not find atom state to unmount', atom);
115313
+ });
115314
+ }
115301
115315
  }
115316
+ return atomState.m;
115302
115317
  };
115303
- var mountDependencies = function mountDependencies(atom, atomState, prevDependencies) {
115304
- var depSet = new Set(atomState.d.keys());
115305
- var maybeUnmountAtomSet = new Set();
115306
- prevDependencies == null || prevDependencies.forEach(function (_, a) {
115307
- if (depSet.has(a)) {
115308
- depSet.delete(a);
115309
- return;
115310
- }
115311
- maybeUnmountAtomSet.add(a);
115312
- var mounted = mountedMap.get(a);
115313
- if (mounted) {
115314
- mounted.t.delete(atom);
115315
- }
115316
- });
115317
- depSet.forEach(function (a) {
115318
- mountAtom(a, atom);
115319
- });
115320
- maybeUnmountAtomSet.forEach(function (a) {
115321
- var mounted = mountedMap.get(a);
115322
- if (mounted) {
115323
- tryUnmountAtom(a, mounted);
115318
+ var unmountAtom = function unmountAtom(pending, atom) {
115319
+ var atomState = getAtomState(atom);
115320
+ if (atomState.m && !atomState.m.l.size && !Array.from(atomState.m.t).some(function (a) {
115321
+ var _getAtomState$m;
115322
+ return (_getAtomState$m = getAtomState(a).m) == null ? void 0 : _getAtomState$m.d.has(atom);
115323
+ })) {
115324
+ var onUnmount = atomState.m.u;
115325
+ if (onUnmount) {
115326
+ addPendingFunction(pending, onUnmount);
115324
115327
  }
115325
- });
115326
- };
115327
- var flushPending = function flushPending(pendingAtoms) {
115328
- var flushed;
115329
- {
115330
- flushed = new Set();
115331
- }
115332
- var pending = [];
115333
- var collectPending = function collectPending(pendingAtom) {
115334
- var _getAtomState2;
115335
- if (!pendingMap.has(pendingAtom)) {
115336
- return;
115328
+ delete atomState.m;
115329
+ {
115330
+ debugMountedAtoms.delete(atom);
115337
115331
  }
115338
- var _ref2 = pendingMap.get(pendingAtom),
115339
- prevAtomState = _ref2[0],
115340
- dependents = _ref2[1];
115341
- pendingMap.delete(pendingAtom);
115342
- pending.push([pendingAtom, prevAtomState]);
115343
- dependents.forEach(collectPending);
115344
- (_getAtomState2 = getAtomState(pendingAtom)) == null || _getAtomState2.d.forEach(function (_, a) {
115345
- return collectPending(a);
115346
- });
115347
- };
115348
- pendingAtoms.forEach(collectPending);
115349
- pending.forEach(function (_ref3) {
115350
- var atom = _ref3[0],
115351
- prevAtomState = _ref3[1];
115352
- var atomState = getAtomState(atom);
115353
- if (!atomState) {
115354
- {
115355
- console.warn('[Bug] no atom state to flush');
115356
- }
115357
- return;
115332
+ for (var _iterator8 = _createForOfIteratorHelperLoose(atomState.d.keys()), _step8; !(_step8 = _iterator8()).done;) {
115333
+ var a = _step8.value;
115334
+ var aMounted = unmountAtom(pending, a);
115335
+ aMounted == null || aMounted.t.delete(atom);
115358
115336
  }
115359
- if (atomState !== prevAtomState) {
115360
- var mounted = mountedMap.get(atom);
115361
- if (mounted && atomState.d !== (prevAtomState == null ? void 0 : prevAtomState.d)) {
115362
- mountDependencies(atom, atomState, prevAtomState == null ? void 0 : prevAtomState.d);
115363
- }
115364
- if (mounted && !(!hasPromiseAtomValue(prevAtomState) && (isEqualAtomValue(prevAtomState, atomState) || isEqualAtomError(prevAtomState, atomState)))) {
115365
- mounted.l.forEach(function (listener) {
115366
- return listener();
115367
- });
115368
- {
115369
- flushed.add(atom);
115370
- }
115371
- }
115337
+ var pendingPromise = getPendingContinuablePromise(atomState);
115338
+ if (pendingPromise) {
115339
+ pendingPromise[CONTINUE_PROMISE](undefined, function () {});
115372
115340
  }
115373
- });
115374
- {
115375
- return flushed;
115341
+ return undefined;
115376
115342
  }
115343
+ return atomState.m;
115377
115344
  };
115378
115345
  var subscribeAtom = function subscribeAtom(atom, listener) {
115379
- var mounted = mountAtom(atom);
115380
- var flushed = flushPending([atom]);
115346
+ var pending = createPending();
115347
+ var mounted = mountAtom(pending, atom);
115348
+ flushPending(pending);
115381
115349
  var listeners = mounted.l;
115382
115350
  listeners.add(listener);
115383
- {
115384
- devListenersRev2.forEach(function (l) {
115385
- return l({
115386
- type: 'sub',
115387
- flushed: flushed
115388
- });
115389
- });
115390
- }
115391
115351
  return function () {
115392
115352
  listeners.delete(listener);
115393
- tryUnmountAtom(atom, mounted);
115394
- {
115395
- devListenersRev2.forEach(function (l) {
115396
- return l({
115397
- type: 'unsub'
115398
- });
115399
- });
115400
- }
115353
+ var pending = createPending();
115354
+ unmountAtom(pending, atom);
115355
+ flushPending(pending);
115401
115356
  };
115402
115357
  };
115358
+ var store = {
115359
+ get: readAtom,
115360
+ set: writeAtom,
115361
+ sub: subscribeAtom
115362
+ };
115403
115363
  {
115404
- return {
115405
- get: readAtom,
115406
- set: writeAtom,
115407
- sub: subscribeAtom,
115408
- dev_subscribe_store: function dev_subscribe_store(l) {
115409
- devListenersRev2.add(l);
115410
- return function () {
115411
- devListenersRev2.delete(l);
115412
- };
115413
- },
115414
- dev_get_mounted_atoms: function dev_get_mounted_atoms() {
115415
- return mountedAtoms.values();
115364
+ var devStore = {
115365
+ dev4_get_internal_weak_map: function dev4_get_internal_weak_map() {
115366
+ return atomStateMap;
115416
115367
  },
115417
- dev_get_atom_state: function dev_get_atom_state(a) {
115418
- return atomStateMap.get(a);
115368
+ dev4_get_mounted_atoms: function dev4_get_mounted_atoms() {
115369
+ return debugMountedAtoms;
115419
115370
  },
115420
- dev_get_mounted: function dev_get_mounted(a) {
115421
- return mountedMap.get(a);
115422
- },
115423
- dev_restore_atoms: function dev_restore_atoms(values) {
115424
- pendingStack.push(new Set());
115425
- for (var _iterator3 = _createForOfIteratorHelperLoose(values), _step3; !(_step3 = _iterator3()).done;) {
115426
- var _step3$value = _step3.value,
115427
- atom = _step3$value[0],
115428
- valueOrPromise = _step3$value[1];
115371
+ dev4_restore_atoms: function dev4_restore_atoms(values) {
115372
+ var pending = createPending();
115373
+ for (var _iterator9 = _createForOfIteratorHelperLoose(values), _step9; !(_step9 = _iterator9()).done;) {
115374
+ var _step9$value = _step9.value,
115375
+ atom = _step9$value[0],
115376
+ value = _step9$value[1];
115429
115377
  if (hasInitialValue(atom)) {
115430
- setAtomValueOrPromise(atom, valueOrPromise);
115431
- recomputeDependents(atom);
115378
+ var atomState = getAtomState(atom);
115379
+ var hasPrevValue = 'v' in atomState;
115380
+ var prevValue = atomState.v;
115381
+ setAtomStateValueOrPromise(atom, atomState, value);
115382
+ mountDependencies(pending, atom, atomState);
115383
+ if (!hasPrevValue || !Object.is(prevValue, atomState.v)) {
115384
+ addPendingAtom(pending, atom, atomState);
115385
+ recomputeDependents(pending, atom);
115386
+ }
115432
115387
  }
115433
115388
  }
115434
- var flushed = flushPending(pendingStack.pop());
115435
- devListenersRev2.forEach(function (l) {
115436
- return l({
115437
- type: 'restore',
115438
- flushed: flushed
115439
- });
115440
- });
115389
+ flushPending(pending);
115441
115390
  }
115442
115391
  };
115392
+ Object.assign(store, devStore);
115443
115393
  }
115394
+ return store;
115444
115395
  };
115445
115396
  var defaultStore;
115446
- var getDefaultStore$1 = function getDefaultStore() {
115397
+ var getDefaultStore = function getDefaultStore() {
115447
115398
  if (!defaultStore) {
115448
- defaultStore = createStore$1$1();
115399
+ defaultStore = createStore$2();
115449
115400
  {
115450
- var _ref4;
115451
- (_ref4 = globalThis).__JOTAI_DEFAULT_STORE__ || (_ref4.__JOTAI_DEFAULT_STORE__ = defaultStore);
115401
+ var _ref2;
115402
+ (_ref2 = globalThis).__JOTAI_DEFAULT_STORE__ || (_ref2.__JOTAI_DEFAULT_STORE__ = defaultStore);
115452
115403
  if (globalThis.__JOTAI_DEFAULT_STORE__ !== defaultStore) {
115453
115404
  console.warn('Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044');
115454
115405
  }
@@ -115457,9 +115408,6 @@
115457
115408
  return defaultStore;
115458
115409
  };
115459
115410
 
115460
- var createStore$2 = createStore$1$1;
115461
- var getDefaultStore = getDefaultStore$1;
115462
-
115463
115411
  var atom_1 = atom;
115464
115412
  var createStore_1 = createStore$2;
115465
115413
  var getDefaultStore_1 = getDefaultStore;
@@ -115623,7 +115571,7 @@
115623
115571
  function _createForOfIteratorHelperLoose$1(r, e) {
115624
115572
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
115625
115573
  if (t) return (t = t.call(r)).next.bind(t);
115626
- if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e ) {
115574
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e) {
115627
115575
  t && (r = t);
115628
115576
  var o = 0;
115629
115577
  return function () {
@@ -116513,7 +116461,7 @@
116513
116461
  function _createForOfIteratorHelperLoose$2(r, e) {
116514
116462
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
116515
116463
  if (t) return (t = t.call(r)).next.bind(t);
116516
- if (Array.isArray(r) || (t = _unsupportedIterableToArray$4(r)) || e ) {
116464
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray$4(r)) || e) {
116517
116465
  t && (r = t);
116518
116466
  var o = 0;
116519
116467
  return function () {
@@ -146405,7 +146353,7 @@
146405
146353
  }
146406
146354
  // 检验当前运行环境
146407
146355
  if (typeof window === 'undefined') {
146408
- console.warn('cloud-business@0.1.124-1 仅支持在浏览器环境进行使用!');
146356
+ console.warn('cloud-business@0.1.124-11 仅支持在浏览器环境进行使用!');
146409
146357
  }
146410
146358
  var bodys = document.getElementsByTagName('body')[0];
146411
146359
  var colors = [1, 2, 3, 4, 5, 6, 7];
@@ -146415,7 +146363,7 @@
146415
146363
  bodys.style.setProperty("--shuyunBlue".concat(i$2 + 1), color);
146416
146364
  }
146417
146365
  }
146418
- var version = '0.1.124-1';
146366
+ var version = '0.1.124-11';
146419
146367
 
146420
146368
  exports.AreaSelector = AreaSelector;
146421
146369
  exports.AreaSelectorNew = AreaSelector$1;