@zgfe/modules-dm 1.0.2-dm.7 → 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.
@@ -8,7 +8,6 @@ interface queryPlanType {
8
8
  interface PropsType {
9
9
  isOpen: number;
10
10
  queryPlanData: queryPlanType;
11
- updateEventMetas: Function;
12
11
  }
13
12
  declare const CollectionEventList: React.FC<PropsType>;
14
13
  export default CollectionEventList;
@@ -24,9 +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
- var updateEventMetas = props.updateEventMetas;
30
29
 
31
30
  var _useState = useState(0),
32
31
  _useState2 = _slicedToArray(_useState, 2),
@@ -306,8 +305,7 @@ var CollectionEventList = function CollectionEventList(props) {
306
305
  markTypeFilter: markTypeFilter,
307
306
  isOpen: props.isOpen,
308
307
  queryPlanData: props.queryPlanData,
309
- eventAttrDataHandle: eventAttrDataHandle,
310
- updateEventMetas: updateEventMetas
308
+ eventAttrDataHandle: eventAttrDataHandle
311
309
  })), eventAttrListShow && /*#__PURE__*/React.createElement(CollectionAttributeList, {
312
310
  isOpen: props.isOpen,
313
311
  queryPlanData: props.queryPlanData,
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  interface DataCollectionProps {
3
- updateEventMetas: Function;
4
3
  }
5
4
  declare const DataCollection: React.FC<DataCollectionProps>;
6
5
  export default DataCollection;
@@ -23,9 +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
- var updateEventMetas = props.updateEventMetas;
29
28
 
30
29
  var _useState = useState(1),
31
30
  _useState2 = _slicedToArray(_useState, 2),
@@ -88,8 +87,7 @@ var DataCollection = function DataCollection(props) {
88
87
  key: "2"
89
88
  })), listTab == 1 && /*#__PURE__*/React.createElement(EventList, {
90
89
  isOpen: isOpen,
91
- queryPlanData: queryPlanData,
92
- updateEventMetas: updateEventMetas
90
+ queryPlanData: queryPlanData
93
91
  }), listTab == 2 && /*#__PURE__*/React.createElement(UserAttributeList, {
94
92
  isOpen: isOpen,
95
93
  queryPlanData: queryPlanData,
@@ -22,7 +22,6 @@ interface queryPlanType {
22
22
  }
23
23
  interface TablePlusType {
24
24
  tableHandleData: DataType[];
25
- updateEventMetas: Function;
26
25
  Refresh: Function;
27
26
  eventActiveFilter: Function;
28
27
  markTypeFilter: Function;
@@ -24,17 +24,20 @@ 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';
30
31
  var tableHandleData = props.tableHandleData,
31
32
  queryPlanData = props.queryPlanData,
32
- isOpen = props.isOpen,
33
- updateEventMetas = props.updateEventMetas;
33
+ isOpen = props.isOpen;
34
34
 
35
35
  var _useContext = useContext(BizGlobalDataContext),
36
36
  currentApp = _useContext.currentApp,
37
- isDemo = _useContext.isDemo; // 别名foucs
37
+ isDemo = _useContext.isDemo;
38
+
39
+ var _useContext2 = useContext(DmContext),
40
+ state = _useContext2.state; // 别名foucs
38
41
 
39
42
 
40
43
  var _useState = useState(''),
@@ -61,8 +64,8 @@ var TablePlus = function TablePlus(props) {
61
64
  if (res) {
62
65
  message.success('修改成功');
63
66
  props.Refresh();
64
- console.log(updateEventMetas);
65
- updateEventMetas != undefined ? updateEventMetas() : null; // 更新store
67
+ console.log(state.updateEventMetas);
68
+ state.updateEventMetas(); // 更新store
66
69
  }
67
70
  }).catch(function (err) {
68
71
  message.error('修改失败');
@@ -12,16 +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';
24
- var updateEventMetas = props.updateEventMetas;
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
+ }, []);
25
38
 
26
39
  var _useState = useState('0'),
27
40
  _useState2 = _slicedToArray(_useState, 2),
@@ -53,9 +66,7 @@ var DataManage = function DataManage(props) {
53
66
  defaultSelectedKeys: ['0'],
54
67
  onSelect: onSelect,
55
68
  items: items
56
- })), menuTab == '0' && /*#__PURE__*/React.createElement(DataCollection, {
57
- updateEventMetas: updateEventMetas
58
- }), menuTab == '1' && /*#__PURE__*/React.createElement(PlanList, null));
69
+ })), menuTab == '0' && /*#__PURE__*/React.createElement(DataCollection, null), menuTab == '1' && /*#__PURE__*/React.createElement(PlanList, null));
59
70
  };
60
71
 
61
72
  export default DataManage;
@@ -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.7",
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": "ebcb846bfe38cd43875714df057c9822d0efe735",
56
+ "gitHead": "bdee61b7b991530f7bf645fd62ae7b5e72a70385",
57
57
  "gitHooks": {
58
58
  "pre-commit": "lint-staged"
59
59
  }