@titaui/pc 1.12.76 → 1.12.77
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,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var echarts = _interopRequireWildcard(require("echarts/core"));
|
|
13
|
+
|
|
14
|
+
var _useChart2 = require("./useChart");
|
|
15
|
+
|
|
16
|
+
var _getLocale = require("../../utils/getLocale");
|
|
17
|
+
|
|
18
|
+
var _platform = require("../../utils/platform");
|
|
19
|
+
|
|
20
|
+
require("./index.css");
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
+
|
|
28
|
+
var Chart = function Chart(props) {
|
|
29
|
+
var _props$seriesData = props.seriesData,
|
|
30
|
+
series = _props$seriesData.series,
|
|
31
|
+
yAxis = _props$seriesData.yAxis,
|
|
32
|
+
colors = _props$seriesData.colors,
|
|
33
|
+
_props$renderTooltip = props.renderTooltip,
|
|
34
|
+
renderTooltip = _props$renderTooltip === void 0 ? function () {
|
|
35
|
+
return '';
|
|
36
|
+
} : _props$renderTooltip,
|
|
37
|
+
_props$tooltipTrigger = props.tooltipTrigger,
|
|
38
|
+
tooltipTrigger = _props$tooltipTrigger === void 0 ? 'item' : _props$tooltipTrigger;
|
|
39
|
+
var isWeixin = (0, _platform.isPlatform)('wx');
|
|
40
|
+
|
|
41
|
+
var _useChart = (0, _useChart2.useChart)({
|
|
42
|
+
seriesData: props.seriesData,
|
|
43
|
+
applyOptions: function applyOptions(data) {
|
|
44
|
+
if (!(data && data.series) || !(data && data.series)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var _series = data.series || [];
|
|
49
|
+
|
|
50
|
+
var _seriesCount = _series.length;
|
|
51
|
+
var totalTimesIndex = _seriesCount - 1;
|
|
52
|
+
var totalTimesData = _series[totalTimesIndex].data;
|
|
53
|
+
var MaxSeriesData = JSON.parse(JSON.stringify(totalTimesData)).sort(function (a, b) {
|
|
54
|
+
return b - a;
|
|
55
|
+
})[0];
|
|
56
|
+
var grid = {
|
|
57
|
+
top: 26,
|
|
58
|
+
// left: 120,
|
|
59
|
+
// right: 10,
|
|
60
|
+
bottom: 14,
|
|
61
|
+
containLabel: false
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (isWeixin) {
|
|
65
|
+
grid['left'] = '3%';
|
|
66
|
+
grid.containLabel = true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var options = {
|
|
70
|
+
color: colors.map(function (color) {
|
|
71
|
+
return color ? color.colorGradualChange : ['#9FBFFF', '#2879ff'];
|
|
72
|
+
}),
|
|
73
|
+
tooltip: {
|
|
74
|
+
padding: [12, 16],
|
|
75
|
+
trigger: tooltipTrigger,
|
|
76
|
+
axisPointer: {
|
|
77
|
+
type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
|
|
78
|
+
|
|
79
|
+
},
|
|
80
|
+
backgroundColor: '#FFFFFF',
|
|
81
|
+
borderRadius: 8,
|
|
82
|
+
textStyle: {
|
|
83
|
+
fontSize: 14,
|
|
84
|
+
lineHeight: 22,
|
|
85
|
+
color: '#6F7886'
|
|
86
|
+
},
|
|
87
|
+
confine: true,
|
|
88
|
+
extraCssText: 'box-shadow: 0px 4px 12px 0px rgba(127, 145, 180, 0.2);',
|
|
89
|
+
formatter: function formatter(params) {
|
|
90
|
+
return renderTooltip(params);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
legend: {
|
|
94
|
+
show: false
|
|
95
|
+
},
|
|
96
|
+
grid: grid,
|
|
97
|
+
xAxis: {
|
|
98
|
+
show: false,
|
|
99
|
+
type: 'value'
|
|
100
|
+
},
|
|
101
|
+
yAxis: {
|
|
102
|
+
type: 'category',
|
|
103
|
+
data: isWeixin ? yAxis : yAxis.map(function (d) {
|
|
104
|
+
return {
|
|
105
|
+
value: d,
|
|
106
|
+
textStyle: {
|
|
107
|
+
width: 100,
|
|
108
|
+
// height: 40,
|
|
109
|
+
// lineHeight: 14,
|
|
110
|
+
align: 'right',
|
|
111
|
+
overflow: 'truncate' // lineOverflow: 'truncate',
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}),
|
|
116
|
+
inverse: true,
|
|
117
|
+
offset: 0,
|
|
118
|
+
axisLine: {
|
|
119
|
+
show: false
|
|
120
|
+
},
|
|
121
|
+
axisTick: {
|
|
122
|
+
show: false
|
|
123
|
+
},
|
|
124
|
+
axisLabel: {
|
|
125
|
+
show: true // formatter: (value, index) => {
|
|
126
|
+
// return value.length > 10 ? value.substr(0, 10) + '...' : value;
|
|
127
|
+
// },
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
series: _series.map(function (s, index) {
|
|
132
|
+
var nodeLine = index != totalTimesIndex;
|
|
133
|
+
var data = JSON.parse(JSON.stringify(s.data || []));
|
|
134
|
+
data = data.map(function (d, dIndex) {
|
|
135
|
+
var total = totalTimesData[dIndex];
|
|
136
|
+
if (!total) return 0;
|
|
137
|
+
var value = d / total * MaxSeriesData;
|
|
138
|
+
return value;
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
if (nodeLine) {
|
|
142
|
+
return {
|
|
143
|
+
name: s.name,
|
|
144
|
+
type: 'bar',
|
|
145
|
+
stack: 'total',
|
|
146
|
+
clip: true,
|
|
147
|
+
label: {
|
|
148
|
+
show: true,
|
|
149
|
+
align: 'center',
|
|
150
|
+
fontSize: 14,
|
|
151
|
+
lineHeight: 22,
|
|
152
|
+
color: '#ffffff',
|
|
153
|
+
overflow: 'break',
|
|
154
|
+
formatter: function formatter(params) {
|
|
155
|
+
var dataIndex = params.dataIndex,
|
|
156
|
+
seriesIndex = params.seriesIndex;
|
|
157
|
+
var total = totalTimesData[dataIndex];
|
|
158
|
+
var data = _series[seriesIndex].data[dataIndex];
|
|
159
|
+
if (total == 0 || data == 0) return '';
|
|
160
|
+
var label = Number((data / total * 100).toFixed(2)) + (0, _getLocale.getLocale)('OKR_MyO_Pop_Upd_Percentage');
|
|
161
|
+
return label;
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
barWidth: 40,
|
|
165
|
+
barMaxWidth: 40,
|
|
166
|
+
barMinWidth: 40,
|
|
167
|
+
barMinHeight: 0,
|
|
168
|
+
barGap: '50%',
|
|
169
|
+
emphasis: {
|
|
170
|
+
focus: 'series',
|
|
171
|
+
blurScope: 'coordinateSystem'
|
|
172
|
+
},
|
|
173
|
+
data: data,
|
|
174
|
+
itemStyle: {
|
|
175
|
+
color: function color(option) {
|
|
176
|
+
return new echarts.graphic.LinearGradient(0, 0, 1, 1, [{
|
|
177
|
+
offset: 0,
|
|
178
|
+
color: option.color[0]
|
|
179
|
+
}, {
|
|
180
|
+
offset: 1,
|
|
181
|
+
color: option.color[1]
|
|
182
|
+
}]);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
} else {
|
|
187
|
+
return {
|
|
188
|
+
name: s.name,
|
|
189
|
+
type: 'line',
|
|
190
|
+
// stack: 'total',
|
|
191
|
+
symbolSize: 0,
|
|
192
|
+
lineStyle: {
|
|
193
|
+
opacity: 0
|
|
194
|
+
},
|
|
195
|
+
hoverAnimation: false,
|
|
196
|
+
label: {
|
|
197
|
+
show: true,
|
|
198
|
+
align: 'left',
|
|
199
|
+
position: 'insideLeft',
|
|
200
|
+
offset: [10, 0],
|
|
201
|
+
fontSize: 14,
|
|
202
|
+
lineHeight: 22,
|
|
203
|
+
color: '#3f4755',
|
|
204
|
+
formatter: function formatter(params) {
|
|
205
|
+
var dataIndex = params.dataIndex,
|
|
206
|
+
seriesIndex = params.seriesIndex;
|
|
207
|
+
var data = _series[seriesIndex].data[dataIndex];
|
|
208
|
+
return data;
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
emphasis: {
|
|
212
|
+
focus: 'self'
|
|
213
|
+
},
|
|
214
|
+
itemStyle: {
|
|
215
|
+
color: 'transparent'
|
|
216
|
+
},
|
|
217
|
+
data: data
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
};
|
|
222
|
+
return options;
|
|
223
|
+
}
|
|
224
|
+
}),
|
|
225
|
+
ref = _useChart.ref;
|
|
226
|
+
|
|
227
|
+
var tooltipHeight = (series.length + 1) * 40;
|
|
228
|
+
var yAxisHeight = yAxis.length * 80;
|
|
229
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
230
|
+
className: "chart-container scrollbar-size-sm",
|
|
231
|
+
style: {
|
|
232
|
+
height: Math.max(tooltipHeight, yAxisHeight)
|
|
233
|
+
}
|
|
234
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
235
|
+
ref: ref,
|
|
236
|
+
style: {
|
|
237
|
+
height: yAxisHeight,
|
|
238
|
+
minHeight: 100
|
|
239
|
+
}
|
|
240
|
+
}));
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
var _default = Chart;
|
|
244
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getOpenId = void 0;
|
|
9
|
+
exports.getWWopenData = getWWopenData;
|
|
10
|
+
exports.parseWxData = void 0;
|
|
11
|
+
|
|
12
|
+
var _bsGlobal = require("../../utils/bs-global");
|
|
13
|
+
|
|
14
|
+
var _platform = require("../../utils/platform");
|
|
15
|
+
|
|
16
|
+
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, $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 generator._invoke = function (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); } }; }(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; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return 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, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), 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 (object) { var 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; }
|
|
17
|
+
|
|
18
|
+
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); } }
|
|
19
|
+
|
|
20
|
+
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); }); }; }
|
|
21
|
+
|
|
22
|
+
function getWWopenData() {
|
|
23
|
+
return window.WWOpenData;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 获取openId
|
|
27
|
+
* @param {number} id 人员id
|
|
28
|
+
* @param {string} type openData类型
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
var getOpenId = function getOpenId(id, type) {
|
|
33
|
+
var openIds;
|
|
34
|
+
|
|
35
|
+
if (type == 'userName') {
|
|
36
|
+
openIds = (0, _bsGlobal.getBSGlobal)('openIds');
|
|
37
|
+
} else if (type == 'departmentName') {
|
|
38
|
+
openIds = (0, _bsGlobal.getBSGlobal)('openDepartmentIds');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return openIds && openIds[id];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.getOpenId = getOpenId;
|
|
45
|
+
|
|
46
|
+
var parseWxData = /*#__PURE__*/function () {
|
|
47
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(datas, type) {
|
|
48
|
+
var WWopenData, anaData, invalidId, res, wxIndexs, result;
|
|
49
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
50
|
+
while (1) {
|
|
51
|
+
switch (_context.prev = _context.next) {
|
|
52
|
+
case 0:
|
|
53
|
+
WWopenData = getWWopenData();
|
|
54
|
+
anaData = datas.map(function (d) {
|
|
55
|
+
var idStr = d.split('[!@#')[1];
|
|
56
|
+
idStr = idStr ? idStr.substring(0, idStr.length - 1) : idStr;
|
|
57
|
+
|
|
58
|
+
if ((0, _platform.isPlatform)('wx')) {
|
|
59
|
+
idStr = getOpenId(idStr, type);
|
|
60
|
+
} else {
|
|
61
|
+
idStr = undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
name: d.replace(/\[!@#\S+?\]/, ''),
|
|
66
|
+
id: idStr
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
invalidId = anaData.every(function (d) {
|
|
70
|
+
return !d.id;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (!((0, _platform.isPlatform)('wx') && !invalidId)) {
|
|
74
|
+
_context.next = 14;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
res = [];
|
|
79
|
+
wxIndexs = [];
|
|
80
|
+
anaData.forEach(function (d, index) {
|
|
81
|
+
d.id == undefined ? res[index] = d.name : wxIndexs.push(index);
|
|
82
|
+
});
|
|
83
|
+
_context.next = 9;
|
|
84
|
+
return new Promise(function (resolve, reject) {
|
|
85
|
+
WWopenData && WWopenData.prefetch({
|
|
86
|
+
items: anaData.filter(function (d) {
|
|
87
|
+
return d.id != undefined;
|
|
88
|
+
}).map(function (d) {
|
|
89
|
+
return {
|
|
90
|
+
type: type,
|
|
91
|
+
id: d.id
|
|
92
|
+
};
|
|
93
|
+
})
|
|
94
|
+
}, function (err, data) {
|
|
95
|
+
if (err) {
|
|
96
|
+
return reject(err);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
data.items = (data.items || []).map(function (d, index) {
|
|
100
|
+
return d.data == undefined ? {
|
|
101
|
+
data: anaData[index].name
|
|
102
|
+
} : d;
|
|
103
|
+
});
|
|
104
|
+
resolve(data);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
case 9:
|
|
109
|
+
result = _context.sent;
|
|
110
|
+
|
|
111
|
+
if (result) {
|
|
112
|
+
result.items.forEach(function (item, index) {
|
|
113
|
+
res[wxIndexs[index]] = item.data;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return _context.abrupt("return", res);
|
|
118
|
+
|
|
119
|
+
case 14:
|
|
120
|
+
return _context.abrupt("return", anaData.map(function (d) {
|
|
121
|
+
return d.name;
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
case 15:
|
|
125
|
+
case "end":
|
|
126
|
+
return _context.stop();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, _callee);
|
|
130
|
+
}));
|
|
131
|
+
|
|
132
|
+
return function parseWxData(_x, _x2) {
|
|
133
|
+
return _ref.apply(this, arguments);
|
|
134
|
+
};
|
|
135
|
+
}();
|
|
136
|
+
|
|
137
|
+
exports.parseWxData = parseWxData;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useChart = useChart;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var echarts = _interopRequireWildcard(require("echarts/core"));
|
|
13
|
+
|
|
14
|
+
var _components = require("echarts/components");
|
|
15
|
+
|
|
16
|
+
var _charts = require("echarts/charts");
|
|
17
|
+
|
|
18
|
+
var _renderers = require("echarts/renderers");
|
|
19
|
+
|
|
20
|
+
var _until = require("./until");
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
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."); }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
33
|
+
|
|
34
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
35
|
+
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
38
|
+
echarts.use([_components.TooltipComponent, _components.GridComponent, _components.LegendComponent, _charts.BarChart, _charts.LineChart, _renderers.CanvasRenderer]);
|
|
39
|
+
|
|
40
|
+
function useChart(_ref) {
|
|
41
|
+
var seriesData = _ref.seriesData,
|
|
42
|
+
applyOptions = _ref.applyOptions,
|
|
43
|
+
options = _ref.options;
|
|
44
|
+
var ref = (0, _react.useRef)();
|
|
45
|
+
var charRef = (0, _react.useRef)({});
|
|
46
|
+
|
|
47
|
+
var _useState = (0, _react.useState)(),
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
data = _useState2[0],
|
|
50
|
+
setData = _useState2[1];
|
|
51
|
+
|
|
52
|
+
(0, _react.useEffect)(function () {
|
|
53
|
+
var _seriesData = JSON.parse(JSON.stringify(seriesData));
|
|
54
|
+
|
|
55
|
+
setTimeout(function () {
|
|
56
|
+
if (!charRef.current || !ref.current) return;
|
|
57
|
+
|
|
58
|
+
if (!(_seriesData && _seriesData.series)) {
|
|
59
|
+
charRef.current && charRef.current.chart && charRef.current.chart.dispose();
|
|
60
|
+
charRef.current.chart = undefined;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!charRef.current.chart) {
|
|
65
|
+
charRef.current.chart = echarts.init(ref.current);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (_seriesData.yAxis && _seriesData.yAxis.type == 2) {
|
|
69
|
+
(0, _until.parseWxData)(_seriesData.yAxis.data, 'departmentName').then(function (datas) {
|
|
70
|
+
_seriesData.yAxis && (_seriesData.yAxis.data = datas);
|
|
71
|
+
setData(_seriesData);
|
|
72
|
+
setTimeout(function () {
|
|
73
|
+
var options = applyOptions(_seriesData);
|
|
74
|
+
charRef.current && charRef.current.chart && charRef.current.chart.resize();
|
|
75
|
+
charRef.current && charRef.current.chart && charRef.current.chart.setOption(options);
|
|
76
|
+
}, 0);
|
|
77
|
+
});
|
|
78
|
+
} else {
|
|
79
|
+
var _options = applyOptions(_seriesData);
|
|
80
|
+
|
|
81
|
+
charRef.current && charRef.current.chart && charRef.current.chart.resize();
|
|
82
|
+
charRef.current && charRef.current.chart && charRef.current.chart.setOption(_options);
|
|
83
|
+
}
|
|
84
|
+
}, 0);
|
|
85
|
+
setData(_seriesData);
|
|
86
|
+
}, []);
|
|
87
|
+
return {
|
|
88
|
+
ref: ref,
|
|
89
|
+
data: data,
|
|
90
|
+
charRef: charRef
|
|
91
|
+
};
|
|
92
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -387,6 +387,12 @@ Object.defineProperty(exports, "PayPage", {
|
|
|
387
387
|
return _pay["default"];
|
|
388
388
|
}
|
|
389
389
|
});
|
|
390
|
+
Object.defineProperty(exports, "PercentLineChart", {
|
|
391
|
+
enumerable: true,
|
|
392
|
+
get: function get() {
|
|
393
|
+
return _percentLineChart["default"];
|
|
394
|
+
}
|
|
395
|
+
});
|
|
390
396
|
Object.defineProperty(exports, "PeriodSelector", {
|
|
391
397
|
enumerable: true,
|
|
392
398
|
get: function get() {
|
|
@@ -828,6 +834,8 @@ var _pointDemo = _interopRequireDefault(require("./components/point-demo"));
|
|
|
828
834
|
|
|
829
835
|
var _personalInfo = _interopRequireDefault(require("./pages/personal-info"));
|
|
830
836
|
|
|
837
|
+
var _percentLineChart = _interopRequireDefault(require("./components/percent-line-chart"));
|
|
838
|
+
|
|
831
839
|
var _rangePickerPop = _interopRequireDefault(require("./components/range-picker-pop"));
|
|
832
840
|
|
|
833
841
|
var _radio = _interopRequireDefault(require("./components/radio"));
|