@zgfe/business-lib 1.1.41-attribution.10 → 1.1.41-attribution.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.
@@ -0,0 +1,8 @@
1
+ export declare const requestConfig: {
2
+ request: {
3
+ optionsWrapper(url: string, options?: any): {
4
+ url: string;
5
+ options: any;
6
+ };
7
+ };
8
+ };
@@ -0,0 +1,40 @@
1
+ import _ from 'lodash';
2
+ function setOptionWapper(url, options) {
3
+ var reqOption = _.cloneDeep(options);
4
+ if (/^\/v1|\.jsp$/.test(url)) {
5
+ if (reqOption.headers && reqOption.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
6
+ return reqOption;
7
+ }
8
+ reqOption.headers = {
9
+ 'Content-Type': 'application/x-www-form-urlencoded'
10
+ };
11
+ var transformRequest = function transformRequest(param) {
12
+ var arr = [];
13
+ for (var key in param) {
14
+ arr.push("".concat(key, "=").concat(encodeURIComponent(param[key])));
15
+ }
16
+ return arr.join('&');
17
+ };
18
+ reqOption.data = transformRequest(options.data);
19
+ }
20
+ return reqOption;
21
+ }
22
+ export var requestConfig = {
23
+ request: {
24
+ optionsWrapper: function optionsWrapper(url, options) {
25
+ var newUrl = url;
26
+ var reqOption = options;
27
+ var ajaxUrlReg = '/analysis/api/common/proxy';
28
+ if (/^\/v1|\.jsp$/.test(url)) {
29
+ if (ajaxUrlReg && !url.includes(ajaxUrlReg)) {
30
+ newUrl = ajaxUrlReg + url;
31
+ reqOption = setOptionWapper(url, options);
32
+ }
33
+ }
34
+ return {
35
+ url: newUrl,
36
+ options: reqOption
37
+ };
38
+ }
39
+ }
40
+ };
@@ -1,8 +1,12 @@
1
- import React, { useRef } from 'react';
2
- import { BizAttrConditionGroup, DemoWrapper } from '@zgfe/business-lib';
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { BizAttrConditionGroup, DemoWrapper, setGlobalConfig } from '@zgfe/business-lib';
3
3
  import { Button } from 'antd';
4
+ import { requestConfig } from './ajaxConfig';
4
5
  export default (function () {
5
6
  var groupRef = useRef(null);
7
+ useEffect(function () {
8
+ setGlobalConfig(requestConfig);
9
+ }, []);
6
10
  return /*#__PURE__*/React.createElement(DemoWrapper, {
7
11
  needMeta: true
8
12
  }, /*#__PURE__*/React.createElement("div", {
@@ -40,7 +40,8 @@ var StringList = function StringList(props) {
40
40
  timer = _useState10[0],
41
41
  setTimer = _useState10[1];
42
42
  useEffect(function () {
43
- if (props.value) {
43
+ setSearchValue('');
44
+ if (props.value && Object.keys(props.value).length > 0) {
44
45
  var data = props.value.map(function (item) {
45
46
  return {
46
47
  name: item,
@@ -53,7 +54,7 @@ var StringList = function StringList(props) {
53
54
  }
54
55
  }, [props.value]);
55
56
  useEffect(function () {
56
- fetchValues();
57
+ setSearchValue('');
57
58
  if (isFirst) {
58
59
  setIsFirst(false);
59
60
  } else {
@@ -79,7 +80,7 @@ var StringList = function StringList(props) {
79
80
  var attrData = props.attr;
80
81
  var requestData = {
81
82
  app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
82
- platform: currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform,
83
+ platform: 0,
83
84
  limit: 20,
84
85
  attr: (attrData === null || attrData === void 0 ? void 0 : attrData.id) || 0,
85
86
  dimension_sub: attrData === null || attrData === void 0 ? void 0 : attrData.dimensionSub,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.41-attribution.10",
3
+ "version": "1.1.41-attribution.11",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.12.0 || ^17.0.0",
61
61
  "yorkie": "^2.0.0"
62
62
  },
63
- "gitHead": "9ad69c40362e795f2499dae45fa807284a33bcae"
63
+ "gitHead": "14dc97f3c3e69bef27643fc50c414739365de767"
64
64
  }