@zgfe/business-lib 1.2.70-hxd.27 → 1.2.70-hxd.29
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.
|
@@ -15,7 +15,6 @@ import BizGlobalDataContext from '../../context';
|
|
|
15
15
|
import BizSelect from '../../select';
|
|
16
16
|
import request from '../../utils/ajax';
|
|
17
17
|
import { OperateTypes } from '../types';
|
|
18
|
-
import { util } from '../../utils';
|
|
19
18
|
import _ from 'lodash';
|
|
20
19
|
var StringList = function StringList(props) {
|
|
21
20
|
var _props$attr;
|
|
@@ -116,20 +115,16 @@ var StringList = function StringList(props) {
|
|
|
116
115
|
});
|
|
117
116
|
} else {
|
|
118
117
|
var requestData = {
|
|
119
|
-
|
|
118
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
120
119
|
platform: 0,
|
|
121
120
|
limit: 20,
|
|
122
121
|
attr: (attrData === null || attrData === void 0 ? void 0 : attrData.id) || 0,
|
|
123
|
-
|
|
122
|
+
dimensionsub: attrData === null || attrData === void 0 ? void 0 : attrData.dimensionSub,
|
|
124
123
|
v: searchValue || ''
|
|
125
124
|
};
|
|
126
|
-
var formData = util.transformRequest(requestData);
|
|
127
125
|
request(Apis.esQuery, {
|
|
128
126
|
method: 'post',
|
|
129
|
-
data:
|
|
130
|
-
headers: {
|
|
131
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
132
|
-
}
|
|
127
|
+
data: requestData
|
|
133
128
|
}).then(function (result) {
|
|
134
129
|
setOptions(function () {
|
|
135
130
|
return result && result.sources ? result.sources.map(function (item) {
|
package/es/constants/apis.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Apis = {
|
|
2
2
|
querySceneGroup: '/zg/web/v2/scene/queryScenesOfGroup',
|
|
3
3
|
addScene: '/zg/web/v2/scene/addScene',
|
|
4
|
-
esQuery: '/data/queryEsData
|
|
4
|
+
esQuery: '/zg/web/v2/data/queryEsData',
|
|
5
5
|
addPanel: '/zg/web/v2/apppanel/addPanelElement',
|
|
6
6
|
updatePanelTarget: '/zg/web/v2/apppanel/updateElement',
|
|
7
7
|
queryPanelGroup: '/zg/web/v2/apppanel/panels',
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TargetConditionTypes } from '../types';
|
|
3
|
-
|
|
4
|
-
defaultProps?: Partial<P>;
|
|
5
|
-
};
|
|
6
|
-
declare const BizTargetDimension: FCWithDefaultProps<{
|
|
3
|
+
declare const BizTargetDimension: React.FC<{
|
|
7
4
|
value?: TargetConditionTypes.DimensionValue;
|
|
8
5
|
eventId?: number;
|
|
9
6
|
isExtend?: boolean;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -6,15 +10,16 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
6
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
11
|
import { Dropdown, Menu } from 'antd';
|
|
8
12
|
import SubMenu from 'antd/lib/menu/SubMenu';
|
|
9
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
13
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
10
14
|
import { classPrefix } from '..';
|
|
11
15
|
import BizGlobalDataContext from '../../context';
|
|
12
16
|
import SelectHandle from '../../select/handle';
|
|
13
17
|
import { normalOptions, attrOptions } from '../data/operates';
|
|
18
|
+
import { eventApi } from '../../utils';
|
|
19
|
+
import _ from 'lodash';
|
|
14
20
|
var BizTargetDimension = function BizTargetDimension(props) {
|
|
15
21
|
var _currentApp$type;
|
|
16
22
|
var _useContext = useContext(BizGlobalDataContext),
|
|
17
|
-
eventGroupList = _useContext.eventGroupList,
|
|
18
23
|
currentApp = _useContext.currentApp;
|
|
19
24
|
var _useState = useState(),
|
|
20
25
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -32,62 +37,150 @@ var BizTargetDimension = function BizTargetDimension(props) {
|
|
|
32
37
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
33
38
|
visible = _useState8[0],
|
|
34
39
|
setVisible = _useState8[1];
|
|
40
|
+
var eventAttrsCache = useRef(new Map());
|
|
41
|
+
var loadingRef = useRef(new Map());
|
|
35
42
|
useEffect(function () {
|
|
36
|
-
var _currentApp$type2
|
|
43
|
+
var _currentApp$type2;
|
|
37
44
|
var dimensionOption = props.normalOptions || normalOptions((_currentApp$type2 = currentApp === null || currentApp === void 0 ? void 0 : currentApp.type) !== null && _currentApp$type2 !== void 0 ? _currentApp$type2 : 'user');
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
dimensionOption.forEach(function (item) {
|
|
49
|
-
var _props$value2, _props$value3;
|
|
50
|
-
if (item.value === ((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.analysisIndex)) {
|
|
51
|
-
current = item;
|
|
52
|
-
}
|
|
53
|
-
if (item.children && item.label === ((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.analysisAttr)) {
|
|
54
|
-
setDimensionParent({
|
|
55
|
-
label: item.label,
|
|
56
|
-
value: item.value
|
|
57
|
-
});
|
|
58
|
-
item.children.forEach(function (child) {
|
|
59
|
-
var _props$value4;
|
|
60
|
-
if (child.value === ((_props$value4 = props.value) === null || _props$value4 === void 0 ? void 0 : _props$value4.analysisIndex)) {
|
|
61
|
-
current = child;
|
|
45
|
+
var debouncedLoadAttrs = _.debounce( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
46
|
+
var _props$value;
|
|
47
|
+
var optionsWithAttrs, current;
|
|
48
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
49
|
+
while (1) switch (_context.prev = _context.next) {
|
|
50
|
+
case 0:
|
|
51
|
+
optionsWithAttrs = dimensionOption;
|
|
52
|
+
if (!(props.eventId && props.isExtend)) {
|
|
53
|
+
_context.next = 5;
|
|
54
|
+
break;
|
|
62
55
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
value:
|
|
81
|
-
|
|
56
|
+
_context.next = 4;
|
|
57
|
+
return getAttrOption(props.eventId, dimensionOption);
|
|
58
|
+
case 4:
|
|
59
|
+
optionsWithAttrs = _context.sent;
|
|
60
|
+
case 5:
|
|
61
|
+
setOptions(optionsWithAttrs);
|
|
62
|
+
current = optionsWithAttrs[0];
|
|
63
|
+
if (!((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.analysisAttr)) setDimensionParent({
|
|
64
|
+
label: '',
|
|
65
|
+
value: ''
|
|
66
|
+
});
|
|
67
|
+
if (props.value) {
|
|
68
|
+
optionsWithAttrs.forEach(function (item) {
|
|
69
|
+
var _props$value2, _props$value3;
|
|
70
|
+
if (item.value === ((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.analysisIndex)) {
|
|
71
|
+
current = item;
|
|
72
|
+
}
|
|
73
|
+
if (item.children && item.label === ((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.analysisAttr)) {
|
|
74
|
+
setDimensionParent({
|
|
75
|
+
label: item.label,
|
|
76
|
+
value: item.value
|
|
77
|
+
});
|
|
78
|
+
item.children.forEach(function (child) {
|
|
79
|
+
var _props$value4;
|
|
80
|
+
if (child.value === ((_props$value4 = props.value) === null || _props$value4 === void 0 ? void 0 : _props$value4.analysisIndex)) {
|
|
81
|
+
current = child;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
82
85
|
});
|
|
83
86
|
}
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
setDimension(current);
|
|
88
|
+
case 10:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context.stop();
|
|
86
91
|
}
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
}, _callee);
|
|
93
|
+
})), 300);
|
|
94
|
+
debouncedLoadAttrs();
|
|
95
|
+
return function () {
|
|
96
|
+
debouncedLoadAttrs.cancel();
|
|
97
|
+
};
|
|
98
|
+
}, [props.eventId, props.value, JSON.stringify(props.normalOptions), props.isExtend]);
|
|
99
|
+
var getAttrOption = /*#__PURE__*/function () {
|
|
100
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eventId, data) {
|
|
101
|
+
var attrData, attrMap, cachedAttrs, eventAttrs;
|
|
102
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
103
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
104
|
+
case 0:
|
|
105
|
+
attrData = [];
|
|
106
|
+
attrMap = {};
|
|
107
|
+
if (!eventAttrsCache.current.has(eventId)) {
|
|
108
|
+
_context2.next = 6;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
cachedAttrs = eventAttrsCache.current.get(eventId) || [];
|
|
112
|
+
cachedAttrs === null || cachedAttrs === void 0 ? void 0 : cachedAttrs.forEach(function (attr) {
|
|
113
|
+
if (attr.type === 2 && !attr.isHidden && attr.label && !attrMap[String(attr.id)]) {
|
|
114
|
+
attrMap[String(attr.id)] = true;
|
|
115
|
+
attrData.push({
|
|
116
|
+
label: attr.label,
|
|
117
|
+
value: String(attr.id),
|
|
118
|
+
children: attrOptions
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return _context2.abrupt("return", data.concat(attrData));
|
|
123
|
+
case 6:
|
|
124
|
+
if (!loadingRef.current.get(eventId)) {
|
|
125
|
+
_context2.next = 8;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
return _context2.abrupt("return", new Promise(function (resolve) {
|
|
129
|
+
var interval = setInterval(function () {
|
|
130
|
+
if (!loadingRef.current.get(eventId) && eventAttrsCache.current.has(eventId)) {
|
|
131
|
+
clearInterval(interval);
|
|
132
|
+
resolve(getAttrOption(eventId, data));
|
|
133
|
+
}
|
|
134
|
+
}, 100);
|
|
135
|
+
}));
|
|
136
|
+
case 8:
|
|
137
|
+
_context2.prev = 8;
|
|
138
|
+
loadingRef.current.set(eventId, true);
|
|
139
|
+
_context2.next = 12;
|
|
140
|
+
return eventApi.fetchEventAttrs(eventId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId);
|
|
141
|
+
case 12:
|
|
142
|
+
_context2.t0 = _context2.sent;
|
|
143
|
+
if (_context2.t0) {
|
|
144
|
+
_context2.next = 15;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
_context2.t0 = [];
|
|
148
|
+
case 15:
|
|
149
|
+
eventAttrs = _context2.t0;
|
|
150
|
+
eventAttrsCache.current.set(eventId, eventAttrs);
|
|
151
|
+
eventAttrs.forEach(function (attr) {
|
|
152
|
+
if (attr.type === 2 && !attr.isHidden && attr.label && !attrMap[String(attr.id)]) {
|
|
153
|
+
attrMap[String(attr.id)] = true;
|
|
154
|
+
attrData.push({
|
|
155
|
+
label: attr.label,
|
|
156
|
+
value: String(attr.id),
|
|
157
|
+
children: attrOptions
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
_context2.next = 24;
|
|
162
|
+
break;
|
|
163
|
+
case 20:
|
|
164
|
+
_context2.prev = 20;
|
|
165
|
+
_context2.t1 = _context2["catch"](8);
|
|
166
|
+
console.error('Failed to fetch event attributes:', _context2.t1);
|
|
167
|
+
eventAttrsCache.current.set(eventId, []);
|
|
168
|
+
case 24:
|
|
169
|
+
_context2.prev = 24;
|
|
170
|
+
loadingRef.current.set(eventId, false);
|
|
171
|
+
return _context2.finish(24);
|
|
172
|
+
case 27:
|
|
173
|
+
return _context2.abrupt("return", data.concat(attrData));
|
|
174
|
+
case 28:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context2.stop();
|
|
177
|
+
}
|
|
178
|
+
}, _callee2, null, [[8, 20, 24, 27]]);
|
|
179
|
+
}));
|
|
180
|
+
return function getAttrOption(_x2, _x3) {
|
|
181
|
+
return _ref2.apply(this, arguments);
|
|
182
|
+
};
|
|
183
|
+
}();
|
|
91
184
|
var onChange = function onChange(data, parent) {
|
|
92
185
|
setDimension(data);
|
|
93
186
|
setDimensionParent(parent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.2.70-hxd.
|
|
3
|
+
"version": "1.2.70-hxd.29",
|
|
4
4
|
"module": "es/index.js",
|
|
5
5
|
"typings": "es/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react": "^16.12.0 || ^17.0.0",
|
|
56
56
|
"yorkie": "^2.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "6e6e3206618cca4553d4486d618e92ca98404974",
|
|
59
59
|
"gitHooks": {
|
|
60
60
|
"pre-commit": "lint-staged"
|
|
61
61
|
}
|