@zgfe/modules-dm 1.0.2-dm.6 → 1.0.2-dm.8

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.
@@ -24,7 +24,8 @@ var CollectionEventList = function CollectionEventList(props) {
24
24
 
25
25
  var _useContext = useContext(BizGlobalDataContext),
26
26
  currentApp = _useContext.currentApp,
27
- isDemo = _useContext.isDemo;
27
+ isDemo = _useContext.isDemo; // const { updateEventMetas } = props;
28
+
28
29
 
29
30
  var _useState = useState(0),
30
31
  _useState2 = _slicedToArray(_useState, 2),
@@ -1,3 +1,5 @@
1
1
  import React from 'react';
2
- declare const DataCollection: React.FC;
2
+ interface DataCollectionProps {
3
+ }
4
+ declare const DataCollection: React.FC<DataCollectionProps>;
3
5
  export default DataCollection;
@@ -23,7 +23,8 @@ var DataCollection = function DataCollection(props) {
23
23
 
24
24
  var _useContext = useContext(BizGlobalDataContext),
25
25
  currentApp = _useContext.currentApp,
26
- isDemo = _useContext.isDemo;
26
+ isDemo = _useContext.isDemo; // const { updateEventMetas } = props;
27
+
27
28
 
28
29
  var _useState = useState(1),
29
30
  _useState2 = _slicedToArray(_useState, 2),
@@ -121,7 +121,7 @@
121
121
  }
122
122
  .group-box {
123
123
  display: flex;
124
- width: 500px;
124
+ width: 800px;
125
125
  line-height: 30px;
126
126
  .ant-input {
127
127
  width: 150px;
@@ -24,6 +24,7 @@ var Option = Select.Option;
24
24
  import React, { useState, useContext } from 'react';
25
25
  import './styles/index.less';
26
26
  import _ from 'lodash';
27
+ import { DmContext } from '../../store';
27
28
 
28
29
  var TablePlus = function TablePlus(props) {
29
30
  var classPrefix = 'table-plus';
@@ -33,7 +34,10 @@ var TablePlus = function TablePlus(props) {
33
34
 
34
35
  var _useContext = useContext(BizGlobalDataContext),
35
36
  currentApp = _useContext.currentApp,
36
- isDemo = _useContext.isDemo; // 别名foucs
37
+ isDemo = _useContext.isDemo;
38
+
39
+ var _useContext2 = useContext(DmContext),
40
+ state = _useContext2.state; // 别名foucs
37
41
 
38
42
 
39
43
  var _useState = useState(''),
@@ -60,6 +64,8 @@ var TablePlus = function TablePlus(props) {
60
64
  if (res) {
61
65
  message.success('修改成功');
62
66
  props.Refresh();
67
+ console.log(state.updateEventMetas);
68
+ state.updateEventMetas(); // 更新store
63
69
  }
64
70
  }).catch(function (err) {
65
71
  message.error('修改失败');
@@ -272,14 +278,16 @@ var TablePlus = function TablePlus(props) {
272
278
  if (eventGroupId != undefined) _temp = {
273
279
  eventGroupId: eventGroupId
274
280
  };
281
+ if (type != 'copy') _temp = _objectSpread(_objectSpread({}, _temp), {}, {
282
+ oldEventGroupId: data.groupId
283
+ });
275
284
  request(apis.operateGroupRelations, {
276
285
  method: 'post',
277
286
  data: _objectSpread({
278
287
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
279
288
  platform: 0,
280
289
  hasPublicAttrView: true,
281
- eventIds: groupCheckedData[data.groupId].join(','),
282
- oldEventGroupId: type == 'copy' ? null : data.groupId
290
+ eventIds: groupCheckedData[data.groupId].join(',')
283
291
  }, _temp)
284
292
  }).then(function (res) {
285
293
  message.success('成功');
@@ -1,4 +1,7 @@
1
1
  import React from 'react';
2
2
  import './styles/index.less';
3
- declare const DataManage: React.FC;
3
+ interface DataManageProps {
4
+ updateEventMetas: Function;
5
+ }
6
+ declare const DataManage: React.FC<DataManageProps>;
4
7
  export default DataManage;
@@ -12,15 +12,29 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
13
  import { IconFont } from '@zgfe/business-lib';
14
14
  import { Menu } from 'antd';
15
- import React, { useState } from 'react';
15
+ import React, { useState, useContext, useEffect } from 'react';
16
16
  import './styles/index.less'; // import EventList from './eventList';
17
17
  // import UserAttributeList from './userAttributeList';
18
18
 
19
+ import { DmContext } from '../../store';
20
+ import { ActionType } from '../../store/action';
19
21
  import PlanList from '../dataPlan';
20
22
  import DataCollection from '../dataCollection';
21
23
 
22
24
  var DataManage = function DataManage(props) {
23
25
  var classPrefix = 'data-manage';
26
+ var updateEventMetas = props.updateEventMetas; // const Context = createContext(updateEventMetas);
27
+
28
+ var _useContext = useContext(DmContext),
29
+ state = _useContext.state,
30
+ dispatch = _useContext.dispatch;
31
+
32
+ useEffect(function () {
33
+ dispatch({
34
+ type: ActionType.SET_GLOBAL,
35
+ payload: updateEventMetas
36
+ });
37
+ }, []);
24
38
 
25
39
  var _useState = useState('0'),
26
40
  _useState2 = _slicedToArray(_useState, 2),
@@ -0,0 +1,7 @@
1
+ export interface Action {
2
+ type: ActionType;
3
+ payload: any;
4
+ }
5
+ export declare enum ActionType {
6
+ SET_GLOBAL = "SET_GLOBAL"
7
+ }
@@ -0,0 +1,5 @@
1
+ export var ActionType;
2
+
3
+ (function (ActionType) {
4
+ ActionType["SET_GLOBAL"] = "SET_GLOBAL";
5
+ })(ActionType || (ActionType = {}));
@@ -0,0 +1,7 @@
1
+ import { Dispatch } from 'react';
2
+ import { State } from './state';
3
+ import { Action } from './action';
4
+ export declare const DmContext: import("react").Context<{
5
+ state: State;
6
+ dispatch: Dispatch<Action>;
7
+ }>;
@@ -0,0 +1,24 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
+ import { createContext } from 'react';
8
+ import { initState } from './state';
9
+ import { ActionType } from './action';
10
+
11
+ var DmReducer = function DmReducer(prevState, action) {
12
+ switch (action.type) {
13
+ case ActionType.SET_GLOBAL:
14
+ return _objectSpread(_objectSpread({}, prevState), action.payload);
15
+
16
+ default:
17
+ return initState;
18
+ }
19
+ };
20
+
21
+ export var DmContext = /*#__PURE__*/createContext({
22
+ state: initState,
23
+ dispatch: function dispatch() {}
24
+ });
@@ -0,0 +1,4 @@
1
+ export declare const initState: State;
2
+ export interface State {
3
+ updateEventMetas: Function;
4
+ }
@@ -0,0 +1,6 @@
1
+ export var initState = {
2
+ // 更新主应用回调
3
+ updateEventMetas: function updateEventMetas() {
4
+ console.log('更新主应用回调');
5
+ }
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-dm",
3
- "version": "1.0.2-dm.6",
3
+ "version": "1.0.2-dm.8",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "license": "ISC",
@@ -53,7 +53,7 @@
53
53
  "umi-request": "^1.4.0",
54
54
  "yorkie": "^2.0.0"
55
55
  },
56
- "gitHead": "a5df84fee76da638681affd4c57d4b27acdf91d8",
56
+ "gitHead": "bdee61b7b991530f7bf645fd62ae7b5e72a70385",
57
57
  "gitHooks": {
58
58
  "pre-commit": "lint-staged"
59
59
  }