@sentio/ui-dashboard 0.2.8 → 0.3.0
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.
- package/dist/index.css +111 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +128 -2
- package/dist/index.d.ts +128 -2
- package/dist/index.js +1678 -505
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1692 -497
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -67,6 +67,7 @@ __export(index_exports, {
|
|
|
67
67
|
ScatterIcon: () => ScatterIcon_default,
|
|
68
68
|
SystemLabels: () => SystemLabels,
|
|
69
69
|
TableIcon: () => TableIcon_default,
|
|
70
|
+
TimeSeriesChart: () => TimeSeriesChart,
|
|
70
71
|
ValueControls: () => ValueControls,
|
|
71
72
|
ValueFormatters: () => ValueFormatters,
|
|
72
73
|
ValueOptions: () => ValueOptions,
|
|
@@ -3978,10 +3979,1472 @@ var QueryValueChart = (0, import_react19.forwardRef)(
|
|
|
3978
3979
|
);
|
|
3979
3980
|
QueryValueChart.displayName = "QueryValueChart";
|
|
3980
3981
|
|
|
3982
|
+
// src/charts/TimeSeriesChart.tsx
|
|
3983
|
+
var import_react20 = require("react");
|
|
3984
|
+
var import_dayjs5 = __toESM(require("dayjs"));
|
|
3985
|
+
|
|
3986
|
+
// src/charts/series-utils.ts
|
|
3987
|
+
var import_dayjs3 = __toESM(require("dayjs"));
|
|
3988
|
+
var import_duration2 = __toESM(require("dayjs/plugin/duration"));
|
|
3989
|
+
var import_utc3 = __toESM(require("dayjs/plugin/utc"));
|
|
3990
|
+
var import_timezone3 = __toESM(require("dayjs/plugin/timezone"));
|
|
3991
|
+
var import_quarterOfYear = __toESM(require("dayjs/plugin/quarterOfYear"));
|
|
3992
|
+
var import_localizedFormat = __toESM(require("dayjs/plugin/localizedFormat"));
|
|
3993
|
+
import_dayjs3.default.extend(import_duration2.default);
|
|
3994
|
+
import_dayjs3.default.extend(import_utc3.default);
|
|
3995
|
+
import_dayjs3.default.extend(import_timezone3.default);
|
|
3996
|
+
import_dayjs3.default.extend(import_quarterOfYear.default);
|
|
3997
|
+
import_dayjs3.default.extend(import_localizedFormat.default);
|
|
3998
|
+
var TimeUnitShortNames = {
|
|
3999
|
+
s: "seconds",
|
|
4000
|
+
m: "minutes",
|
|
4001
|
+
h: "hours",
|
|
4002
|
+
d: "days",
|
|
4003
|
+
w: "weeks",
|
|
4004
|
+
M: "months",
|
|
4005
|
+
y: "years"
|
|
4006
|
+
};
|
|
4007
|
+
function dateRangeOfSeries(series) {
|
|
4008
|
+
let min = /* @__PURE__ */ new Date();
|
|
4009
|
+
let max = /* @__PURE__ */ new Date(0);
|
|
4010
|
+
for (const s of series) {
|
|
4011
|
+
if (s.data.length > 0) {
|
|
4012
|
+
const dmin = s.data[0][0] || min;
|
|
4013
|
+
const dmax = s.data[s.data.length - 1][0] || max;
|
|
4014
|
+
if (dmin < min) min = dmin;
|
|
4015
|
+
if (dmax > max) max = dmax;
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
return [min, max];
|
|
4019
|
+
}
|
|
4020
|
+
function durationToSeconds(d) {
|
|
4021
|
+
if (!d) return 0;
|
|
4022
|
+
return import_dayjs3.default.duration(Number(d.value) || 0, d.unit).asSeconds();
|
|
4023
|
+
}
|
|
4024
|
+
function parseDuration(s) {
|
|
4025
|
+
const m = s.match(/(\d+)([a-z]+)/i);
|
|
4026
|
+
if (m) {
|
|
4027
|
+
const [, value, unit] = m;
|
|
4028
|
+
return { value: parseInt(value), unit: TimeUnitShortNames[unit] };
|
|
4029
|
+
}
|
|
4030
|
+
return { value: 0, unit: "second" };
|
|
4031
|
+
}
|
|
4032
|
+
function roundInterval(diff) {
|
|
4033
|
+
switch (true) {
|
|
4034
|
+
case diff <= import_dayjs3.default.duration(15, "minute").asMilliseconds():
|
|
4035
|
+
return "10s";
|
|
4036
|
+
case diff <= import_dayjs3.default.duration(1, "day").asMilliseconds():
|
|
4037
|
+
return "1m";
|
|
4038
|
+
case diff <= import_dayjs3.default.duration(30, "day").asMilliseconds():
|
|
4039
|
+
return "1h";
|
|
4040
|
+
case diff <= import_dayjs3.default.duration(2, "years").asMilliseconds():
|
|
4041
|
+
return "1d";
|
|
4042
|
+
case diff <= import_dayjs3.default.duration(10, "years").asMilliseconds():
|
|
4043
|
+
default:
|
|
4044
|
+
return "7d";
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
function calculateStepByDate(start, end) {
|
|
4048
|
+
return parseDuration(roundInterval(end.getTime() - start.getTime()));
|
|
4049
|
+
}
|
|
4050
|
+
function shiftTimezone(time, tz) {
|
|
4051
|
+
const origin = import_dayjs3.default.isDayjs(time) ? time : (0, import_dayjs3.default)(time);
|
|
4052
|
+
if (!tz) return origin.toDate();
|
|
4053
|
+
const offset = origin.tz(tz).utcOffset() - origin.utcOffset();
|
|
4054
|
+
return origin.add(offset, "minute").toDate();
|
|
4055
|
+
}
|
|
4056
|
+
var formatTime = (time, tz, interval) => {
|
|
4057
|
+
const d = (0, import_dayjs3.default)(shiftTimezone(time, tz));
|
|
4058
|
+
switch (interval?.unit) {
|
|
4059
|
+
case "s":
|
|
4060
|
+
return d.format("HH:mm:ss");
|
|
4061
|
+
case "m":
|
|
4062
|
+
return d.format("DD HH:mm");
|
|
4063
|
+
case "h":
|
|
4064
|
+
return d.format("MM-DD HH:mm");
|
|
4065
|
+
case "d":
|
|
4066
|
+
case "w":
|
|
4067
|
+
return d.format("YYYY-MM-DD");
|
|
4068
|
+
case "M":
|
|
4069
|
+
return interval.value === 3 ? `${d.format("YYYY")}-Q${d.quarter()}` : d.format("YYYY-MMM");
|
|
4070
|
+
default:
|
|
4071
|
+
return d.format("lll");
|
|
4072
|
+
}
|
|
4073
|
+
};
|
|
4074
|
+
|
|
4075
|
+
// src/charts/time-utils.ts
|
|
4076
|
+
var import_dayjs4 = __toESM(require("dayjs"));
|
|
4077
|
+
var import_ui_core11 = require("@sentio/ui-core");
|
|
4078
|
+
function alignTime(time, step, tz, align = "start") {
|
|
4079
|
+
try {
|
|
4080
|
+
const d = (0, import_ui_core11.toDayjs)(time);
|
|
4081
|
+
const seconds = durationToSeconds(step);
|
|
4082
|
+
const tzOffset = (tz ? d.tz(tz).utcOffset() : 0) * 60;
|
|
4083
|
+
const offset = (d.unix() + tzOffset) % seconds;
|
|
4084
|
+
if (offset === 0) {
|
|
4085
|
+
return time;
|
|
4086
|
+
}
|
|
4087
|
+
return align == "start" ? d.subtract(offset, "second") : d.add(seconds - offset, "second");
|
|
4088
|
+
} catch (e) {
|
|
4089
|
+
console.error(e);
|
|
4090
|
+
return time;
|
|
4091
|
+
}
|
|
4092
|
+
}
|
|
4093
|
+
function timeBefore(time, duration2, asStart = true) {
|
|
4094
|
+
const durationValue = Number(duration2.value);
|
|
4095
|
+
if ((0, import_ui_core11.isRelativeTime)(time)) {
|
|
4096
|
+
const rt = time;
|
|
4097
|
+
if (rt.unit == null || time == import_ui_core11.now) {
|
|
4098
|
+
return {
|
|
4099
|
+
sign: -1,
|
|
4100
|
+
unit: import_ui_core11.TimeUnitShortNames[duration2.unit],
|
|
4101
|
+
value: durationValue
|
|
4102
|
+
};
|
|
4103
|
+
}
|
|
4104
|
+
if (rt.align) {
|
|
4105
|
+
const t2 = (0, import_ui_core11.toDayjs)(rt, asStart);
|
|
4106
|
+
return t2.subtract(durationValue, import_ui_core11.TimeUnitShortNames[duration2.unit]);
|
|
4107
|
+
}
|
|
4108
|
+
const t = (0, import_ui_core11.toDayjs)(time);
|
|
4109
|
+
const nt = t.subtract(durationValue, import_ui_core11.TimeUnitShortNames[duration2.unit]);
|
|
4110
|
+
const unit = "days";
|
|
4111
|
+
const value = nt.diff((0, import_dayjs4.default)(), unit);
|
|
4112
|
+
return { sign: value < 0 ? -1 : 1, unit, value: Math.abs(value) };
|
|
4113
|
+
} else {
|
|
4114
|
+
const t = (0, import_ui_core11.toDayjs)(time);
|
|
4115
|
+
return t.subtract(durationValue, import_ui_core11.TimeUnitShortNames[duration2.unit]);
|
|
4116
|
+
}
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
// src/charts/TimeSeriesChart.tsx
|
|
4120
|
+
var import_ui_core15 = require("@sentio/ui-core");
|
|
4121
|
+
|
|
4122
|
+
// src/charts/options/YaxisControls.tsx
|
|
4123
|
+
var import_lodash5 = require("lodash");
|
|
4124
|
+
var import_ui_core13 = require("@sentio/ui-core");
|
|
4125
|
+
|
|
4126
|
+
// src/charts/options/controls-ui.tsx
|
|
4127
|
+
var import_ui_core12 = require("@sentio/ui-core");
|
|
4128
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4129
|
+
var AddonLabel = ({
|
|
4130
|
+
className,
|
|
4131
|
+
children
|
|
4132
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4133
|
+
"span",
|
|
4134
|
+
{
|
|
4135
|
+
className: (0, import_ui_core12.classNames)(
|
|
4136
|
+
"sm:text-icontent border-main inline-flex items-center whitespace-nowrap bg-gray-50",
|
|
4137
|
+
className
|
|
4138
|
+
),
|
|
4139
|
+
children
|
|
4140
|
+
}
|
|
4141
|
+
);
|
|
4142
|
+
|
|
4143
|
+
// src/charts/options/YaxisControls.tsx
|
|
4144
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4145
|
+
var initialConfig = {
|
|
4146
|
+
yAxis: {
|
|
4147
|
+
min: "",
|
|
4148
|
+
max: "",
|
|
4149
|
+
scale: true,
|
|
4150
|
+
stack: ""
|
|
4151
|
+
}
|
|
4152
|
+
};
|
|
4153
|
+
function YaxisControls({
|
|
4154
|
+
yAxis,
|
|
4155
|
+
setYAxis,
|
|
4156
|
+
defaultOpen,
|
|
4157
|
+
columnSelect,
|
|
4158
|
+
supportSetName = true,
|
|
4159
|
+
supportSetMinMax = true,
|
|
4160
|
+
supportStackSeries = true,
|
|
4161
|
+
supportAlwaysShowZero = true,
|
|
4162
|
+
supportReset = true,
|
|
4163
|
+
panelTitle = "Y-Axis Controls"
|
|
4164
|
+
}) {
|
|
4165
|
+
yAxis = (0, import_lodash5.defaults)(yAxis || {}, initialConfig.yAxis);
|
|
4166
|
+
const onChangeInput = (field) => (event) => {
|
|
4167
|
+
const { value } = event.target;
|
|
4168
|
+
setYAxis({
|
|
4169
|
+
...yAxis,
|
|
4170
|
+
[field]: value || void 0,
|
|
4171
|
+
scale: field == "min" && value > "0" ? true : yAxis?.scale
|
|
4172
|
+
});
|
|
4173
|
+
};
|
|
4174
|
+
const onToggleZero = (checked) => {
|
|
4175
|
+
setYAxis({ ...yAxis, scale: !checked, min: checked ? "" : yAxis?.min });
|
|
4176
|
+
};
|
|
4177
|
+
const onClickResetYAxis = () => {
|
|
4178
|
+
setYAxis(initialConfig.yAxis);
|
|
4179
|
+
};
|
|
4180
|
+
const onToggleStack = (checked) => {
|
|
4181
|
+
setYAxis({ ...yAxis, stacked: checked ? "samesign" : "" });
|
|
4182
|
+
};
|
|
4183
|
+
const minMaxLabelCls = "inline-flex items-center border border-r-0 sm:text-icontent border-main bg-gray-50 px-2 rounded-l-md";
|
|
4184
|
+
const minMaxInputCls = "border focus:border-primary-500 rounded-r-md sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30";
|
|
4185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4186
|
+
import_ui_core13.DisclosurePanel,
|
|
4187
|
+
{
|
|
4188
|
+
title: panelTitle,
|
|
4189
|
+
defaultOpen,
|
|
4190
|
+
containerClassName: "w-full bg-default-bg",
|
|
4191
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "text-icontent flex flex-wrap gap-[10px]", children: [
|
|
4192
|
+
supportSetName && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Name" }),
|
|
4194
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4195
|
+
"input",
|
|
4196
|
+
{
|
|
4197
|
+
type: "text",
|
|
4198
|
+
className: "focus:border-primary-500 sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 w-40 rounded-r-md border",
|
|
4199
|
+
value: yAxis?.name,
|
|
4200
|
+
placeholder: "Axis Name",
|
|
4201
|
+
onChange: onChangeInput("name")
|
|
4202
|
+
}
|
|
4203
|
+
)
|
|
4204
|
+
] }),
|
|
4205
|
+
columnSelect && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "inline-flex h-8", children: [
|
|
4206
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Column" }),
|
|
4207
|
+
columnSelect
|
|
4208
|
+
] }),
|
|
4209
|
+
supportSetMinMax && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4210
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
4211
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: minMaxLabelCls, children: "Min" }),
|
|
4212
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4213
|
+
"input",
|
|
4214
|
+
{
|
|
4215
|
+
type: "text",
|
|
4216
|
+
className: minMaxInputCls,
|
|
4217
|
+
style: { width: "10em" },
|
|
4218
|
+
value: yAxis.min,
|
|
4219
|
+
placeholder: "Auto",
|
|
4220
|
+
onChange: onChangeInput("min")
|
|
4221
|
+
}
|
|
4222
|
+
)
|
|
4223
|
+
] }),
|
|
4224
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
4225
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: minMaxLabelCls, children: "Max" }),
|
|
4226
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4227
|
+
"input",
|
|
4228
|
+
{
|
|
4229
|
+
type: "text",
|
|
4230
|
+
className: minMaxInputCls,
|
|
4231
|
+
style: { width: "10em" },
|
|
4232
|
+
value: yAxis.max,
|
|
4233
|
+
placeholder: "Auto",
|
|
4234
|
+
onChange: onChangeInput("max")
|
|
4235
|
+
}
|
|
4236
|
+
)
|
|
4237
|
+
] })
|
|
4238
|
+
] }),
|
|
4239
|
+
supportStackSeries && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4240
|
+
import_ui_core13.Checkbox,
|
|
4241
|
+
{
|
|
4242
|
+
checked: !!yAxis?.stacked,
|
|
4243
|
+
onChange: onToggleStack,
|
|
4244
|
+
label: "Stack series"
|
|
4245
|
+
}
|
|
4246
|
+
),
|
|
4247
|
+
supportAlwaysShowZero && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4248
|
+
import_ui_core13.Checkbox,
|
|
4249
|
+
{
|
|
4250
|
+
checked: !yAxis.scale,
|
|
4251
|
+
onChange: onToggleZero,
|
|
4252
|
+
label: "Always show zero"
|
|
4253
|
+
}
|
|
4254
|
+
),
|
|
4255
|
+
supportReset && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui_core13.Button, { type: "button", role: "link", onClick: onClickResetYAxis, children: "Reset" })
|
|
4256
|
+
] })
|
|
4257
|
+
}
|
|
4258
|
+
);
|
|
4259
|
+
}
|
|
4260
|
+
|
|
4261
|
+
// src/charts/options/XaxisControls.tsx
|
|
4262
|
+
var import_ui_core14 = require("@sentio/ui-core");
|
|
4263
|
+
var import_lu5 = require("react-icons/lu");
|
|
4264
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4265
|
+
var TypeSelect = import_ui_core14.Select;
|
|
4266
|
+
var SortSelect = import_ui_core14.Select;
|
|
4267
|
+
var OrderSelect = import_ui_core14.Select;
|
|
4268
|
+
var sortByItems = [
|
|
4269
|
+
{ label: "Name", value: "ByName" },
|
|
4270
|
+
{ label: "Value", value: "ByValue" }
|
|
4271
|
+
];
|
|
4272
|
+
var orderItems = [
|
|
4273
|
+
{ label: "Ascendant", value: false },
|
|
4274
|
+
{ label: "Descendant", value: true }
|
|
4275
|
+
];
|
|
4276
|
+
var XAxisControls = ({
|
|
4277
|
+
xAxis,
|
|
4278
|
+
setXAxis,
|
|
4279
|
+
defaultOpen,
|
|
4280
|
+
columnSelect,
|
|
4281
|
+
columnIsNonTime,
|
|
4282
|
+
panelTitle = "X-Axis Controls",
|
|
4283
|
+
supportName = true,
|
|
4284
|
+
supportSort,
|
|
4285
|
+
supportSetType
|
|
4286
|
+
}) => {
|
|
4287
|
+
const onChangeInput = (field) => (event) => {
|
|
4288
|
+
const { value } = event.target;
|
|
4289
|
+
setXAxis({ ...xAxis, [field]: value || void 0 });
|
|
4290
|
+
};
|
|
4291
|
+
const onClickResetXAxis = () => {
|
|
4292
|
+
setXAxis(void 0);
|
|
4293
|
+
};
|
|
4294
|
+
const isXAixsNoneTime = xAxis && xAxis.column && columnIsNonTime;
|
|
4295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4296
|
+
import_ui_core14.DisclosurePanel,
|
|
4297
|
+
{
|
|
4298
|
+
title: panelTitle,
|
|
4299
|
+
defaultOpen,
|
|
4300
|
+
containerClassName: "w-full bg-default-bg",
|
|
4301
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-icontent flex flex-wrap gap-[10px]", children: [
|
|
4302
|
+
supportName && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Name" }),
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4305
|
+
"input",
|
|
4306
|
+
{
|
|
4307
|
+
type: "text",
|
|
4308
|
+
className: "sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 w-40 rounded-r-md",
|
|
4309
|
+
value: xAxis?.name,
|
|
4310
|
+
placeholder: "Axis Name",
|
|
4311
|
+
onChange: onChangeInput("name")
|
|
4312
|
+
}
|
|
4313
|
+
)
|
|
4314
|
+
] }),
|
|
4315
|
+
supportSetType && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "inline-flex h-8", children: [
|
|
4316
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2", children: [
|
|
4317
|
+
"X-Axis Type",
|
|
4318
|
+
" ",
|
|
4319
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4320
|
+
import_ui_core14.PopoverTooltip,
|
|
4321
|
+
{
|
|
4322
|
+
strategy: "fixed",
|
|
4323
|
+
hideArrow: true,
|
|
4324
|
+
placementOption: "bottom",
|
|
4325
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-text-foreground max-w-[300px] p-2", children: [
|
|
4326
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-medium", children: "Discrete axis" }),
|
|
4327
|
+
" displays",
|
|
4328
|
+
" ",
|
|
4329
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-primary-600", children: "discrete values evenly" }),
|
|
4330
|
+
", while ",
|
|
4331
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-medium", children: "Continuous axis" }),
|
|
4332
|
+
" ",
|
|
4333
|
+
"shows",
|
|
4334
|
+
" ",
|
|
4335
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-primary-600", children: "continuous time series" }),
|
|
4336
|
+
" ",
|
|
4337
|
+
"and",
|
|
4338
|
+
" ",
|
|
4339
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-primary-600", children: "auto-fills missing time points" })
|
|
4340
|
+
] }),
|
|
4341
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lu5.LuInfo, { className: "text-text-foreground-secondary h-4 w-4" })
|
|
4342
|
+
}
|
|
4343
|
+
)
|
|
4344
|
+
] }),
|
|
4345
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4346
|
+
TypeSelect,
|
|
4347
|
+
{
|
|
4348
|
+
className: "h-8 w-40",
|
|
4349
|
+
buttonClassName: "h-full border-main rounded-l-none items-center inline-flex items-center",
|
|
4350
|
+
value: xAxis?.type || "time",
|
|
4351
|
+
onChange: (val) => {
|
|
4352
|
+
setXAxis({ ...xAxis, type: val });
|
|
4353
|
+
},
|
|
4354
|
+
options: [
|
|
4355
|
+
{ label: "Continuous", value: "time" },
|
|
4356
|
+
{ label: "Discrete", value: "category" }
|
|
4357
|
+
]
|
|
4358
|
+
}
|
|
4359
|
+
)
|
|
4360
|
+
] }),
|
|
4361
|
+
columnSelect && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "inline-flex h-8", children: [
|
|
4362
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Column" }),
|
|
4363
|
+
columnSelect
|
|
4364
|
+
] }),
|
|
4365
|
+
supportSort && isXAixsNoneTime && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "inline-flex h-8", children: [
|
|
4366
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Sort By" }),
|
|
4367
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4368
|
+
SortSelect,
|
|
4369
|
+
{
|
|
4370
|
+
className: "h-8 w-20 leading-8",
|
|
4371
|
+
buttonClassName: "h-full border-main rounded-none inline-flex items-center",
|
|
4372
|
+
options: sortByItems,
|
|
4373
|
+
value: xAxis?.sort?.sortBy,
|
|
4374
|
+
onChange: (value) => {
|
|
4375
|
+
setXAxis({
|
|
4376
|
+
...xAxis,
|
|
4377
|
+
sort: { ...xAxis?.sort, sortBy: value }
|
|
4378
|
+
});
|
|
4379
|
+
},
|
|
4380
|
+
placeholder: "Sort By"
|
|
4381
|
+
}
|
|
4382
|
+
),
|
|
4383
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4384
|
+
OrderSelect,
|
|
4385
|
+
{
|
|
4386
|
+
className: "h-8 w-40 leading-8",
|
|
4387
|
+
buttonClassName: "h-full border-l-0 border-main rounded-l-none inline-flex items-center",
|
|
4388
|
+
options: orderItems,
|
|
4389
|
+
value: xAxis?.sort?.orderDesc,
|
|
4390
|
+
onChange: (value) => {
|
|
4391
|
+
setXAxis({
|
|
4392
|
+
...xAxis,
|
|
4393
|
+
sort: { ...xAxis?.sort, orderDesc: value }
|
|
4394
|
+
});
|
|
4395
|
+
},
|
|
4396
|
+
placeholder: "Sort Order"
|
|
4397
|
+
}
|
|
4398
|
+
)
|
|
4399
|
+
] }),
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4401
|
+
import_ui_core14.Button,
|
|
4402
|
+
{
|
|
4403
|
+
type: "button",
|
|
4404
|
+
role: "link",
|
|
4405
|
+
onClick: onClickResetXAxis,
|
|
4406
|
+
className: "h-8",
|
|
4407
|
+
children: "Reset"
|
|
4408
|
+
}
|
|
4409
|
+
)
|
|
4410
|
+
] })
|
|
4411
|
+
}
|
|
4412
|
+
);
|
|
4413
|
+
};
|
|
4414
|
+
|
|
4415
|
+
// src/charts/TimeSeriesChart.tsx
|
|
4416
|
+
var import_server = __toESM(require("react-dom/server"));
|
|
4417
|
+
var import_lodash6 = require("lodash");
|
|
4418
|
+
var import_react21 = require("@floating-ui/react");
|
|
4419
|
+
var import_ui_core16 = require("@sentio/ui-core");
|
|
4420
|
+
var import_lu6 = require("react-icons/lu");
|
|
4421
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4422
|
+
var NumberFormat = (o) => new Intl.NumberFormat("en-US", o);
|
|
4423
|
+
function roundByDPR(value) {
|
|
4424
|
+
const dpr = window.devicePixelRatio || 1;
|
|
4425
|
+
return Math.round(value * dpr) / dpr;
|
|
4426
|
+
}
|
|
4427
|
+
function onClickPreventDefault(e) {
|
|
4428
|
+
e.preventDefault();
|
|
4429
|
+
e.stopPropagation();
|
|
4430
|
+
}
|
|
4431
|
+
var closestNumber = (arr, needle) => {
|
|
4432
|
+
return arr?.reduce(
|
|
4433
|
+
(a, b) => Math.abs(b - needle) < Math.abs(a - needle) ? b : a
|
|
4434
|
+
);
|
|
4435
|
+
};
|
|
4436
|
+
var initialConfig2 = {
|
|
4437
|
+
xAxis: {
|
|
4438
|
+
type: "category",
|
|
4439
|
+
min: "",
|
|
4440
|
+
max: "",
|
|
4441
|
+
scale: true,
|
|
4442
|
+
name: "",
|
|
4443
|
+
column: ""
|
|
4444
|
+
},
|
|
4445
|
+
yAxis: {
|
|
4446
|
+
min: "",
|
|
4447
|
+
max: "",
|
|
4448
|
+
scale: true
|
|
4449
|
+
}
|
|
4450
|
+
};
|
|
4451
|
+
var createYAxisResult = (min, max, scale, name) => {
|
|
4452
|
+
const result = { min, max, scale };
|
|
4453
|
+
if (name) {
|
|
4454
|
+
result.name = name;
|
|
4455
|
+
}
|
|
4456
|
+
return result;
|
|
4457
|
+
};
|
|
4458
|
+
var calculateMargin = (value, isMin) => {
|
|
4459
|
+
if (isMin) {
|
|
4460
|
+
return value >= 0 ? Math.max(0, value * 0.9) : value * 1.1;
|
|
4461
|
+
} else {
|
|
4462
|
+
return value >= 0 ? value * 1.1 : value * 0.9;
|
|
4463
|
+
}
|
|
4464
|
+
};
|
|
4465
|
+
var yAxisToChartOption = (option, markLines = [], values) => {
|
|
4466
|
+
const { min, max, scale, name } = option || {};
|
|
4467
|
+
const hasValidMin = min !== void 0 && min !== "";
|
|
4468
|
+
const hasValidMax = max !== void 0 && max !== "";
|
|
4469
|
+
const optionMin = hasValidMin ? parseFloat(min) || min : void 0;
|
|
4470
|
+
const optionMax = hasValidMax ? parseFloat(max) || max : void 0;
|
|
4471
|
+
if (hasValidMin && hasValidMax) {
|
|
4472
|
+
return createYAxisResult(optionMin, optionMax, scale, name);
|
|
4473
|
+
}
|
|
4474
|
+
const lineValues = markLines.map((m) => m.value).filter(
|
|
4475
|
+
(v) => v !== void 0 && v !== 0 && v !== "0"
|
|
4476
|
+
);
|
|
4477
|
+
if (lineValues.length === 0 && !hasValidMin && !hasValidMax) {
|
|
4478
|
+
return createYAxisResult(void 0, void 0, scale, name);
|
|
4479
|
+
}
|
|
4480
|
+
const allValues = [...lineValues];
|
|
4481
|
+
if (values) {
|
|
4482
|
+
const valueSet = /* @__PURE__ */ new Set();
|
|
4483
|
+
values.forEach((series) => {
|
|
4484
|
+
series.data.forEach((point) => {
|
|
4485
|
+
const value = point[1];
|
|
4486
|
+
if ((0, import_lodash6.isNumber)(value)) {
|
|
4487
|
+
valueSet.add(value);
|
|
4488
|
+
}
|
|
4489
|
+
});
|
|
4490
|
+
});
|
|
4491
|
+
valueSet.forEach((value) => {
|
|
4492
|
+
allValues.push(value);
|
|
4493
|
+
});
|
|
4494
|
+
}
|
|
4495
|
+
let finalMin = optionMin;
|
|
4496
|
+
let finalMax = optionMax;
|
|
4497
|
+
if (allValues.length > 0) {
|
|
4498
|
+
if (!hasValidMin) {
|
|
4499
|
+
const minValue = allValues.reduce(
|
|
4500
|
+
(min2, current) => Math.min(min2, current),
|
|
4501
|
+
Infinity
|
|
4502
|
+
);
|
|
4503
|
+
finalMin = calculateMargin(minValue, true);
|
|
4504
|
+
}
|
|
4505
|
+
if (!hasValidMax) {
|
|
4506
|
+
const maxValue = allValues.reduce(
|
|
4507
|
+
(max2, current) => Math.max(max2, current),
|
|
4508
|
+
-Infinity
|
|
4509
|
+
);
|
|
4510
|
+
finalMax = calculateMargin(maxValue, false);
|
|
4511
|
+
}
|
|
4512
|
+
}
|
|
4513
|
+
return createYAxisResult(finalMin, finalMax, scale, name);
|
|
4514
|
+
};
|
|
4515
|
+
var getEventName = (name) => {
|
|
4516
|
+
let eventName = name.split("-")[0].trim();
|
|
4517
|
+
if (eventName.toLowerCase() === "all events") {
|
|
4518
|
+
eventName = void 0;
|
|
4519
|
+
}
|
|
4520
|
+
return eventName;
|
|
4521
|
+
};
|
|
4522
|
+
var DARK_AREA_FILL_OPACITY = 0.35;
|
|
4523
|
+
var applyDarkAreaOpacity = (series) => {
|
|
4524
|
+
if (series.length <= 1) {
|
|
4525
|
+
return series;
|
|
4526
|
+
}
|
|
4527
|
+
return series.map((s) => {
|
|
4528
|
+
if (!s?.areaStyle) {
|
|
4529
|
+
return s;
|
|
4530
|
+
}
|
|
4531
|
+
const existing = typeof s.areaStyle.opacity === "number" ? s.areaStyle.opacity : 0.7;
|
|
4532
|
+
return {
|
|
4533
|
+
...s,
|
|
4534
|
+
areaStyle: {
|
|
4535
|
+
...s.areaStyle,
|
|
4536
|
+
opacity: Math.min(existing, DARK_AREA_FILL_OPACITY)
|
|
4537
|
+
}
|
|
4538
|
+
};
|
|
4539
|
+
});
|
|
4540
|
+
};
|
|
4541
|
+
var fixTimeSeries = (series) => {
|
|
4542
|
+
try {
|
|
4543
|
+
if (!series?.length) {
|
|
4544
|
+
return;
|
|
4545
|
+
}
|
|
4546
|
+
const isValidDateSeries = series.every(
|
|
4547
|
+
(s) => s.data?.every((point) => {
|
|
4548
|
+
const date = point?.[0];
|
|
4549
|
+
return date instanceof Date && !isNaN(date.getTime());
|
|
4550
|
+
})
|
|
4551
|
+
);
|
|
4552
|
+
if (!isValidDateSeries || series.length < 2 || (0, import_lodash6.uniq)(series.map((s) => s.data?.length)).length === 1) {
|
|
4553
|
+
return;
|
|
4554
|
+
}
|
|
4555
|
+
const timeIndex = [];
|
|
4556
|
+
const dataIndexes = new Array(series.length).fill(0);
|
|
4557
|
+
while (dataIndexes.some((d, index) => d < (series[index]?.data?.length || 0))) {
|
|
4558
|
+
const times = dataIndexes.map((d, index) => {
|
|
4559
|
+
const date = series[index]?.data?.[d]?.[0];
|
|
4560
|
+
return date instanceof Date && !isNaN(date.getTime()) ? date.getTime() : Infinity;
|
|
4561
|
+
});
|
|
4562
|
+
const minTime = Math.min(...times);
|
|
4563
|
+
if (!isFinite(minTime)) {
|
|
4564
|
+
break;
|
|
4565
|
+
}
|
|
4566
|
+
const newDate = new Date(minTime);
|
|
4567
|
+
if (isNaN(newDate.getTime())) {
|
|
4568
|
+
break;
|
|
4569
|
+
}
|
|
4570
|
+
timeIndex.push(newDate);
|
|
4571
|
+
dataIndexes.forEach((d, index) => {
|
|
4572
|
+
const date = series[index]?.data?.[d]?.[0];
|
|
4573
|
+
if (date instanceof Date && !isNaN(date.getTime()) && date.getTime() === minTime) {
|
|
4574
|
+
dataIndexes[index]++;
|
|
4575
|
+
}
|
|
4576
|
+
});
|
|
4577
|
+
}
|
|
4578
|
+
series.forEach((s) => {
|
|
4579
|
+
if (!s?.data) return;
|
|
4580
|
+
const data = s.data;
|
|
4581
|
+
const fixedData = [];
|
|
4582
|
+
let index = 0;
|
|
4583
|
+
timeIndex.forEach((t) => {
|
|
4584
|
+
if (data[index]?.[0] instanceof Date && !isNaN(data[index][0].getTime()) && (0, import_lodash6.isEqual)(data[index][0], t)) {
|
|
4585
|
+
fixedData.push(data[index]);
|
|
4586
|
+
index++;
|
|
4587
|
+
} else {
|
|
4588
|
+
fixedData.push([t, null]);
|
|
4589
|
+
}
|
|
4590
|
+
});
|
|
4591
|
+
s.data = fixedData;
|
|
4592
|
+
});
|
|
4593
|
+
} catch (error) {
|
|
4594
|
+
console.warn("Error in fixTimeSeries:", error);
|
|
4595
|
+
}
|
|
4596
|
+
};
|
|
4597
|
+
var TimeSeriesChart = (0, import_react20.forwardRef)(
|
|
4598
|
+
(props, ref) => {
|
|
4599
|
+
const yAxisRef = (0, import_react20.useRef)(null);
|
|
4600
|
+
const {
|
|
4601
|
+
group,
|
|
4602
|
+
title,
|
|
4603
|
+
startTime,
|
|
4604
|
+
endTime,
|
|
4605
|
+
tz,
|
|
4606
|
+
minHeight,
|
|
4607
|
+
onSelectTimeRange,
|
|
4608
|
+
loading,
|
|
4609
|
+
controls,
|
|
4610
|
+
config,
|
|
4611
|
+
markAreas,
|
|
4612
|
+
markLines,
|
|
4613
|
+
onChangeConfig,
|
|
4614
|
+
style,
|
|
4615
|
+
chartType,
|
|
4616
|
+
allowClick,
|
|
4617
|
+
sourceType,
|
|
4618
|
+
getEventNameById,
|
|
4619
|
+
noLegend: _noLegend = false,
|
|
4620
|
+
onInitChart,
|
|
4621
|
+
nonXAxis,
|
|
4622
|
+
// injected
|
|
4623
|
+
series: seriesProp,
|
|
4624
|
+
compareSeries: compareSeriesProp,
|
|
4625
|
+
legend: legendProp,
|
|
4626
|
+
numberFormatter,
|
|
4627
|
+
overlay,
|
|
4628
|
+
templateVariableKeys: _templateVariableKeys,
|
|
4629
|
+
seriesToMetricLabels,
|
|
4630
|
+
eventNameMap,
|
|
4631
|
+
eventsQueryMap,
|
|
4632
|
+
onViewLogs,
|
|
4633
|
+
onViewUsers,
|
|
4634
|
+
viewLogDisabled: viewLogDisabledProp,
|
|
4635
|
+
viewUsersDisabled: viewUsersDisabledProp,
|
|
4636
|
+
returnedSeries,
|
|
4637
|
+
totalSeries
|
|
4638
|
+
} = props;
|
|
4639
|
+
void _templateVariableKeys;
|
|
4640
|
+
const seriesToMetricLabelsRef = (0, import_react20.useMemo)(
|
|
4641
|
+
() => seriesToMetricLabels ?? [],
|
|
4642
|
+
[seriesToMetricLabels]
|
|
4643
|
+
);
|
|
4644
|
+
const eventNameMapRef = (0, import_react20.useMemo)(
|
|
4645
|
+
() => eventNameMap ?? /* @__PURE__ */ new Map(),
|
|
4646
|
+
[eventNameMap]
|
|
4647
|
+
);
|
|
4648
|
+
const eventsQueryMapRef = (0, import_react20.useMemo)(
|
|
4649
|
+
() => eventsQueryMap ?? /* @__PURE__ */ new Map(),
|
|
4650
|
+
[eventsQueryMap]
|
|
4651
|
+
);
|
|
4652
|
+
const [yAxis, setYAxis] = (0, import_react20.useState)(config?.yAxis || initialConfig2.yAxis);
|
|
4653
|
+
const [xAxis, setXAxis] = (0, import_react20.useState)(config?.xAxis || initialConfig2.xAxis);
|
|
4654
|
+
const [maximumSignificantDigits, setMaximumSignificantDigits] = (0, import_react20.useState)(3);
|
|
4655
|
+
const isDarkMode = useDarkMode();
|
|
4656
|
+
const minRef = (0, import_react20.useRef)(0);
|
|
4657
|
+
const maxRef = (0, import_react20.useRef)(0);
|
|
4658
|
+
const getSymbolSize = (0, import_react20.useCallback)(
|
|
4659
|
+
(value) => {
|
|
4660
|
+
const val = value[2] || 0;
|
|
4661
|
+
return normalize(
|
|
4662
|
+
val,
|
|
4663
|
+
minRef.current,
|
|
4664
|
+
maxRef.current,
|
|
4665
|
+
config?.scatterConfig?.minSize,
|
|
4666
|
+
config?.scatterConfig?.maxSize
|
|
4667
|
+
);
|
|
4668
|
+
},
|
|
4669
|
+
[config?.scatterConfig?.minSize, config?.scatterConfig?.maxSize]
|
|
4670
|
+
);
|
|
4671
|
+
(0, import_react20.useEffect)(() => {
|
|
4672
|
+
setYAxis(config?.yAxis || initialConfig2.yAxis);
|
|
4673
|
+
}, [config]);
|
|
4674
|
+
const legend = (0, import_react20.useMemo)(() => legendProp || [], [legendProp]);
|
|
4675
|
+
const series = (0, import_react20.useMemo)(() => {
|
|
4676
|
+
const result = (seriesProp || []).map((s) => ({ ...s }));
|
|
4677
|
+
computeMarkLines(result, markLines || []);
|
|
4678
|
+
computeMarksAreas(result, markAreas || []);
|
|
4679
|
+
if (config?.yAxis?.stacked) {
|
|
4680
|
+
fixTimeSeries(result);
|
|
4681
|
+
result.forEach((s) => {
|
|
4682
|
+
if (config?.seriesConfig && config.seriesConfig.series?.[s.name]) {
|
|
4683
|
+
return;
|
|
4684
|
+
}
|
|
4685
|
+
s.stack = "Total";
|
|
4686
|
+
s.stackStrategy = config?.yAxis?.stacked;
|
|
4687
|
+
});
|
|
4688
|
+
}
|
|
4689
|
+
if (config?.lineConfig) {
|
|
4690
|
+
result.forEach((s) => {
|
|
4691
|
+
s.lineStyle = {
|
|
4692
|
+
...s.lineStyle,
|
|
4693
|
+
type: config?.lineConfig?.style?.toLowerCase() || "solid"
|
|
4694
|
+
};
|
|
4695
|
+
if (config?.lineConfig?.smooth) {
|
|
4696
|
+
s.smooth = true;
|
|
4697
|
+
}
|
|
4698
|
+
});
|
|
4699
|
+
}
|
|
4700
|
+
if (chartType === "SCATTER") {
|
|
4701
|
+
result.forEach((s) => {
|
|
4702
|
+
const min = s.data?.reduce((min2, p) => {
|
|
4703
|
+
const val = p[2] || 0;
|
|
4704
|
+
return Math.min(min2, val);
|
|
4705
|
+
}, Infinity);
|
|
4706
|
+
const max = s.data?.reduce((max2, p) => {
|
|
4707
|
+
const val = p[2] || 0;
|
|
4708
|
+
return Math.max(max2, val);
|
|
4709
|
+
}, -Infinity);
|
|
4710
|
+
minRef.current = min;
|
|
4711
|
+
maxRef.current = max;
|
|
4712
|
+
s.symbolSize = getSymbolSize;
|
|
4713
|
+
});
|
|
4714
|
+
}
|
|
4715
|
+
if (allowClick) {
|
|
4716
|
+
result.forEach((serie) => {
|
|
4717
|
+
serie.emphasis = serie.type === "bar" ? {
|
|
4718
|
+
itemStyle: {
|
|
4719
|
+
shadowColor: "rgba(0, 0, 0, 0.3)",
|
|
4720
|
+
shadowBlur: 10
|
|
4721
|
+
}
|
|
4722
|
+
} : {
|
|
4723
|
+
scale: 1.5
|
|
4724
|
+
};
|
|
4725
|
+
});
|
|
4726
|
+
}
|
|
4727
|
+
return result;
|
|
4728
|
+
}, [
|
|
4729
|
+
seriesProp,
|
|
4730
|
+
markAreas,
|
|
4731
|
+
markLines,
|
|
4732
|
+
chartType,
|
|
4733
|
+
config?.yAxis,
|
|
4734
|
+
config?.lineConfig,
|
|
4735
|
+
config?.seriesConfig,
|
|
4736
|
+
allowClick,
|
|
4737
|
+
getSymbolSize
|
|
4738
|
+
]);
|
|
4739
|
+
(0, import_react20.useEffect)(() => {
|
|
4740
|
+
setMaximumSignificantDigits(3);
|
|
4741
|
+
}, [seriesProp]);
|
|
4742
|
+
const compareSeries = (0, import_react20.useMemo)(() => {
|
|
4743
|
+
if (!compareSeriesProp?.length) {
|
|
4744
|
+
return [];
|
|
4745
|
+
}
|
|
4746
|
+
const result = compareSeriesProp.map((s) => ({ ...s }));
|
|
4747
|
+
for (const s of result) {
|
|
4748
|
+
s.lineStyle = {
|
|
4749
|
+
...s.lineStyle,
|
|
4750
|
+
type: "dashed"
|
|
4751
|
+
};
|
|
4752
|
+
s.itemStyle = {
|
|
4753
|
+
...s.itemStyle,
|
|
4754
|
+
color: "rgba(120, 120, 120, 0.3)"
|
|
4755
|
+
};
|
|
4756
|
+
s.xAxisIndex = 1;
|
|
4757
|
+
if (chartType === "SCATTER") {
|
|
4758
|
+
s.symbolSize = getSymbolSize;
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
return result;
|
|
4762
|
+
}, [compareSeriesProp, chartType, getSymbolSize]);
|
|
4763
|
+
const NF = NumberFormat({ notation: "compact", maximumSignificantDigits });
|
|
4764
|
+
const NF_LARGE = NumberFormat({ notation: "scientific" });
|
|
4765
|
+
const seriesIdToYAxisName = overlay?.seriesIdToYAxisName ?? /* @__PURE__ */ new Map();
|
|
4766
|
+
const overlaySeriesIdToFormatter = overlay?.overlaySeriesIdToFormatter ?? /* @__PURE__ */ new Map();
|
|
4767
|
+
const applyOverlaySeries = overlay?.applyOverlaySeries ?? ((options2) => options2);
|
|
4768
|
+
const setYAxisWrap = (yAxis2) => {
|
|
4769
|
+
setYAxis(yAxis2);
|
|
4770
|
+
onChangeConfig?.({ ...config, yAxis: yAxis2 });
|
|
4771
|
+
};
|
|
4772
|
+
let yAxisLabel;
|
|
4773
|
+
const [start, end] = (0, import_react20.useMemo)(() => {
|
|
4774
|
+
const [dataStart, dataEnd] = dateRangeOfSeries(series);
|
|
4775
|
+
const selectStart = startTime && (0, import_ui_core15.toDayjs)(startTime, true).toDate();
|
|
4776
|
+
const selectEnd = endTime && (0, import_ui_core15.toDayjs)(endTime, false).toDate();
|
|
4777
|
+
const selStart = selectStart ? shiftTimezone(selectStart, tz) : void 0;
|
|
4778
|
+
const selEnd = selectEnd ? shiftTimezone(selectEnd, tz) : void 0;
|
|
4779
|
+
const start2 = dataStart && selStart ? dataStart.getTime() < selStart.getTime() ? dataStart : selStart : selStart;
|
|
4780
|
+
const end2 = dataEnd && selEnd ? dataEnd.getTime() > selEnd.getTime() ? dataEnd : selEnd : selEnd;
|
|
4781
|
+
return [start2, end2];
|
|
4782
|
+
}, [series, startTime, endTime]);
|
|
4783
|
+
const xLabelFormatter = (0, import_react20.useMemo)(() => {
|
|
4784
|
+
return config?.xAxis?.type === "category" ? (value) => {
|
|
4785
|
+
const date = shiftTimezone(value, tz);
|
|
4786
|
+
let interval = config?.timeRangeOverride?.timeRange?.interval;
|
|
4787
|
+
if (!interval && start && end) {
|
|
4788
|
+
interval = calculateStepByDate(start, end);
|
|
4789
|
+
}
|
|
4790
|
+
return formatTime(date, tz, interval);
|
|
4791
|
+
} : void 0;
|
|
4792
|
+
}, [
|
|
4793
|
+
config?.xAxis?.type,
|
|
4794
|
+
config?.timeRangeOverride?.timeRange,
|
|
4795
|
+
tz,
|
|
4796
|
+
start,
|
|
4797
|
+
end
|
|
4798
|
+
]);
|
|
4799
|
+
const tooltipParmsRef = (0, import_react20.useRef)({});
|
|
4800
|
+
const getSeriesContext = (0, import_react20.useCallback)(
|
|
4801
|
+
(seriesId, seriesIndex) => {
|
|
4802
|
+
const params = tooltipParmsRef.current?.data;
|
|
4803
|
+
if (!params || !seriesToMetricLabelsRef) {
|
|
4804
|
+
return null;
|
|
4805
|
+
}
|
|
4806
|
+
let value;
|
|
4807
|
+
let idx;
|
|
4808
|
+
if (Array.isArray(params)) {
|
|
4809
|
+
const param = params.find(
|
|
4810
|
+
(p) => p.seriesId === seriesId || p.seriesIndex === seriesIndex
|
|
4811
|
+
);
|
|
4812
|
+
if (!param) return null;
|
|
4813
|
+
value = param.value;
|
|
4814
|
+
idx = param.seriesIndex;
|
|
4815
|
+
} else {
|
|
4816
|
+
value = params.value;
|
|
4817
|
+
idx = seriesIndex;
|
|
4818
|
+
}
|
|
4819
|
+
if (!value) return null;
|
|
4820
|
+
const {
|
|
4821
|
+
labels = {},
|
|
4822
|
+
name = "",
|
|
4823
|
+
id
|
|
4824
|
+
} = seriesToMetricLabelsRef[idx] || {};
|
|
4825
|
+
const isEventSeries = eventNameMapRef.has(id) || sourceType === "ANALYTICS";
|
|
4826
|
+
let eventName;
|
|
4827
|
+
if (sourceType === "ANALYTICS") {
|
|
4828
|
+
try {
|
|
4829
|
+
const _eventName = getEventNameById?.(id);
|
|
4830
|
+
eventName = _eventName == void 0 ? getEventName(name) : _eventName;
|
|
4831
|
+
} catch {
|
|
4832
|
+
}
|
|
4833
|
+
} else if (eventNameMapRef.has(id)) {
|
|
4834
|
+
eventName = eventNameMapRef.get(id) || void 0;
|
|
4835
|
+
}
|
|
4836
|
+
const query = eventsQueryMapRef.get(id);
|
|
4837
|
+
return {
|
|
4838
|
+
value,
|
|
4839
|
+
labels,
|
|
4840
|
+
name,
|
|
4841
|
+
id,
|
|
4842
|
+
isEventSeries,
|
|
4843
|
+
eventName,
|
|
4844
|
+
query
|
|
4845
|
+
};
|
|
4846
|
+
},
|
|
4847
|
+
[
|
|
4848
|
+
seriesToMetricLabelsRef,
|
|
4849
|
+
eventNameMapRef,
|
|
4850
|
+
eventsQueryMapRef,
|
|
4851
|
+
sourceType,
|
|
4852
|
+
getEventNameById
|
|
4853
|
+
]
|
|
4854
|
+
);
|
|
4855
|
+
const handleViewLogs = (0, import_react20.useCallback)(
|
|
4856
|
+
(seriesId, seriesIndex) => {
|
|
4857
|
+
const ctx = getSeriesContext(seriesId, seriesIndex);
|
|
4858
|
+
if (!ctx) return;
|
|
4859
|
+
onViewLogs?.(ctx);
|
|
4860
|
+
},
|
|
4861
|
+
[getSeriesContext, onViewLogs]
|
|
4862
|
+
);
|
|
4863
|
+
const handleViewUsers = (0, import_react20.useCallback)(
|
|
4864
|
+
(seriesId, seriesIndex) => {
|
|
4865
|
+
const ctx = getSeriesContext(seriesId, seriesIndex);
|
|
4866
|
+
if (!ctx) return;
|
|
4867
|
+
onViewUsers?.(ctx);
|
|
4868
|
+
},
|
|
4869
|
+
[getSeriesContext, onViewUsers]
|
|
4870
|
+
);
|
|
4871
|
+
const getViewLogDisabled = (0, import_react20.useCallback)(
|
|
4872
|
+
(seriesId, seriesIndex) => {
|
|
4873
|
+
const ctx = getSeriesContext(seriesId, seriesIndex);
|
|
4874
|
+
return viewLogDisabledProp?.(ctx) ?? false;
|
|
4875
|
+
},
|
|
4876
|
+
[getSeriesContext, viewLogDisabledProp]
|
|
4877
|
+
);
|
|
4878
|
+
const getViewUsersDisabled = (0, import_react20.useCallback)(
|
|
4879
|
+
(seriesId, seriesIndex) => {
|
|
4880
|
+
const ctx = getSeriesContext(seriesId, seriesIndex);
|
|
4881
|
+
return viewUsersDisabledProp?.(ctx) ?? false;
|
|
4882
|
+
},
|
|
4883
|
+
[getSeriesContext, viewUsersDisabledProp]
|
|
4884
|
+
);
|
|
4885
|
+
const tooltipFormatter = (0, import_react20.useCallback)(
|
|
4886
|
+
(params) => {
|
|
4887
|
+
const paramsArray = Array.isArray(params) ? params : [params];
|
|
4888
|
+
if (allowClick) {
|
|
4889
|
+
yAxisRef.current = paramsArray.map((param) => ({
|
|
4890
|
+
value: param.value,
|
|
4891
|
+
seriesIndex: param.seriesIndex,
|
|
4892
|
+
seriesName: param.seriesName
|
|
4893
|
+
}));
|
|
4894
|
+
}
|
|
4895
|
+
let title2 = void 0;
|
|
4896
|
+
if (nonXAxis) {
|
|
4897
|
+
const value = paramsArray?.[0]?.data?.[0];
|
|
4898
|
+
title2 = `${config?.xAxis?.column ? `${config?.xAxis?.column}:` : ""} ${value}`;
|
|
4899
|
+
} else if (xLabelFormatter) {
|
|
4900
|
+
const value = paramsArray?.[0]?.data?.[0];
|
|
4901
|
+
title2 = xLabelFormatter(value);
|
|
4902
|
+
}
|
|
4903
|
+
const annotatedParams = paramsArray.map((param) => {
|
|
4904
|
+
const yAxisName = seriesIdToYAxisName.get(param.seriesId);
|
|
4905
|
+
if (yAxisName) {
|
|
4906
|
+
return { ...param, seriesName: `${param.seriesName}(${yAxisName})` };
|
|
4907
|
+
}
|
|
4908
|
+
return param;
|
|
4909
|
+
});
|
|
4910
|
+
const parmas = {
|
|
4911
|
+
data: chartType === "SCATTER" ? params : annotatedParams,
|
|
4912
|
+
title: title2,
|
|
4913
|
+
highlightSeriesId: global.highlightSeriesId,
|
|
4914
|
+
compareTimeDuration: config?.timeRangeOverride?.compareTime?.ago,
|
|
4915
|
+
numberFormatter: (value, seriesId) => {
|
|
4916
|
+
const seriesFormatter = seriesId ? overlaySeriesIdToFormatter.get(seriesId) : void 0;
|
|
4917
|
+
if (seriesFormatter) {
|
|
4918
|
+
return seriesFormatter(value);
|
|
4919
|
+
}
|
|
4920
|
+
return numberFormatter(value);
|
|
4921
|
+
},
|
|
4922
|
+
showTotal: config?.valueConfig?.tooltipTotal,
|
|
4923
|
+
// Gate on the outward props existing (same as the original gating on the
|
|
4924
|
+
// handlers existing): no handler → button doesn't render.
|
|
4925
|
+
onViewLogs: onViewLogs ? handleViewLogs : void 0,
|
|
4926
|
+
viewLogDisabled: onViewLogs ? getViewLogDisabled : void 0,
|
|
4927
|
+
onViewUsers: onViewUsers ? handleViewUsers : void 0,
|
|
4928
|
+
viewUsersDisabled: onViewUsers ? getViewUsersDisabled : void 0,
|
|
4929
|
+
sizeTitle: config?.scatterConfig?.symbolSize
|
|
4930
|
+
};
|
|
4931
|
+
tooltipParmsRef.current = parmas;
|
|
4932
|
+
if (chartType === "SCATTER") {
|
|
4933
|
+
return import_server.default.renderToString(
|
|
4934
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4935
|
+
ScatterChartTooltip,
|
|
4936
|
+
{
|
|
4937
|
+
...parmas,
|
|
4938
|
+
onViewLogs: void 0,
|
|
4939
|
+
viewLogDisabled: void 0,
|
|
4940
|
+
onViewUsers: void 0,
|
|
4941
|
+
viewUsersDisabled: void 0,
|
|
4942
|
+
sizeTitle: config?.scatterConfig?.symbolSize
|
|
4943
|
+
}
|
|
4944
|
+
)
|
|
4945
|
+
);
|
|
4946
|
+
} else {
|
|
4947
|
+
return import_server.default.renderToString(
|
|
4948
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4949
|
+
ChartTooltip,
|
|
4950
|
+
{
|
|
4951
|
+
...parmas,
|
|
4952
|
+
onViewLogs: void 0,
|
|
4953
|
+
viewLogDisabled: void 0,
|
|
4954
|
+
onViewUsers: void 0,
|
|
4955
|
+
viewUsersDisabled: void 0
|
|
4956
|
+
}
|
|
4957
|
+
)
|
|
4958
|
+
);
|
|
4959
|
+
}
|
|
4960
|
+
},
|
|
4961
|
+
[
|
|
4962
|
+
allowClick,
|
|
4963
|
+
numberFormatter,
|
|
4964
|
+
overlaySeriesIdToFormatter,
|
|
4965
|
+
config,
|
|
4966
|
+
nonXAxis,
|
|
4967
|
+
chartType,
|
|
4968
|
+
xLabelFormatter,
|
|
4969
|
+
onViewLogs,
|
|
4970
|
+
handleViewLogs,
|
|
4971
|
+
getViewLogDisabled,
|
|
4972
|
+
onViewUsers,
|
|
4973
|
+
handleViewUsers,
|
|
4974
|
+
getViewUsersDisabled,
|
|
4975
|
+
seriesIdToYAxisName
|
|
4976
|
+
]
|
|
4977
|
+
);
|
|
4978
|
+
const [active, setActive] = (0, import_react20.useState)(false);
|
|
4979
|
+
const onSelect = (0, import_react20.useCallback)(
|
|
4980
|
+
(start2, end2) => {
|
|
4981
|
+
if (onSelectTimeRange && active) {
|
|
4982
|
+
let startTime2 = (0, import_ui_core15.fromNumber)(start2);
|
|
4983
|
+
let endTime2 = (0, import_ui_core15.fromNumber)(end2);
|
|
4984
|
+
const interval = config?.timeRangeOverride?.timeRange?.interval;
|
|
4985
|
+
if (interval) {
|
|
4986
|
+
startTime2 = alignTime(startTime2, interval, tz, "start");
|
|
4987
|
+
endTime2 = alignTime(endTime2, interval, tz, "end");
|
|
4988
|
+
}
|
|
4989
|
+
onSelectTimeRange(startTime2, endTime2);
|
|
4990
|
+
}
|
|
4991
|
+
},
|
|
4992
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4993
|
+
[onSelectTimeRange, active]
|
|
4994
|
+
);
|
|
4995
|
+
const allowBrush = (0, import_react20.useMemo)(() => {
|
|
4996
|
+
if (nonXAxis) {
|
|
4997
|
+
return false;
|
|
4998
|
+
}
|
|
4999
|
+
if (onSelectTimeRange && startTime && endTime) {
|
|
5000
|
+
const interval = config?.timeRangeOverride?.timeRange?.interval;
|
|
5001
|
+
const diff = (0, import_ui_core15.toDayjs)(endTime).diff((0, import_ui_core15.toDayjs)(startTime), "seconds");
|
|
5002
|
+
return interval ? diff > durationToSeconds(interval) : true;
|
|
5003
|
+
}
|
|
5004
|
+
return false;
|
|
5005
|
+
}, [
|
|
5006
|
+
config?.timeRangeOverride?.timeRange,
|
|
5007
|
+
startTime,
|
|
5008
|
+
endTime,
|
|
5009
|
+
onSelectTimeRange,
|
|
5010
|
+
nonXAxis
|
|
5011
|
+
]);
|
|
5012
|
+
const xAxisData = (0, import_react20.useMemo)(() => {
|
|
5013
|
+
if (nonXAxis) {
|
|
5014
|
+
return [
|
|
5015
|
+
{
|
|
5016
|
+
type: "category",
|
|
5017
|
+
axisLabel: {
|
|
5018
|
+
hideOverlap: true,
|
|
5019
|
+
fontSize: 11
|
|
5020
|
+
},
|
|
5021
|
+
name: config?.xAxis?.name
|
|
5022
|
+
}
|
|
5023
|
+
];
|
|
5024
|
+
}
|
|
5025
|
+
const ret = [
|
|
5026
|
+
{
|
|
5027
|
+
type: config?.xAxis?.type || "time",
|
|
5028
|
+
min: config?.xAxis?.type === "category" ? void 0 : start,
|
|
5029
|
+
max: config?.xAxis?.type === "category" ? void 0 : end,
|
|
5030
|
+
axisLabel: {
|
|
5031
|
+
hideOverlap: true,
|
|
5032
|
+
fontSize: 11,
|
|
5033
|
+
formatter: xLabelFormatter
|
|
5034
|
+
},
|
|
5035
|
+
axisTick: {
|
|
5036
|
+
show: false
|
|
5037
|
+
}
|
|
5038
|
+
}
|
|
5039
|
+
];
|
|
5040
|
+
if (config?.xAxis?.name) {
|
|
5041
|
+
ret[0].name = config?.xAxis?.name;
|
|
5042
|
+
}
|
|
5043
|
+
if (config?.timeRangeOverride?.compareTime?.ago) {
|
|
5044
|
+
const d = config?.timeRangeOverride?.compareTime?.ago;
|
|
5045
|
+
const compareStart = (0, import_ui_core15.toDayjs)(timeBefore((0, import_dayjs5.default)(start), d, true)).toDate();
|
|
5046
|
+
const compareEnd = (0, import_ui_core15.toDayjs)(timeBefore((0, import_dayjs5.default)(end), d, false)).toDate();
|
|
5047
|
+
ret.push({
|
|
5048
|
+
show: false,
|
|
5049
|
+
type: config?.xAxis?.type || "time",
|
|
5050
|
+
min: config?.xAxis?.type === "category" ? void 0 : compareStart,
|
|
5051
|
+
max: config?.xAxis?.type === "category" ? void 0 : compareEnd,
|
|
5052
|
+
axisLabel: {
|
|
5053
|
+
hideOverlap: true,
|
|
5054
|
+
fontSize: 11,
|
|
5055
|
+
formatter: xLabelFormatter
|
|
5056
|
+
}
|
|
5057
|
+
});
|
|
5058
|
+
}
|
|
5059
|
+
return ret;
|
|
5060
|
+
}, [
|
|
5061
|
+
config?.timeRangeOverride?.compareTime,
|
|
5062
|
+
start,
|
|
5063
|
+
end,
|
|
5064
|
+
nonXAxis,
|
|
5065
|
+
config?.xAxis,
|
|
5066
|
+
xLabelFormatter
|
|
5067
|
+
]);
|
|
5068
|
+
const options = (0, import_react20.useMemo)(() => {
|
|
5069
|
+
const primarySeries = xAxisData.length == 2 ? [...series, ...compareSeries] : series;
|
|
5070
|
+
const primaryYAxis = {
|
|
5071
|
+
type: "value",
|
|
5072
|
+
axisLabel: {
|
|
5073
|
+
formatter: function(value) {
|
|
5074
|
+
if (value == yAxisLabel && maximumSignificantDigits < 21) {
|
|
5075
|
+
setMaximumSignificantDigits(maximumSignificantDigits + 1);
|
|
5076
|
+
}
|
|
5077
|
+
yAxisLabel = value;
|
|
5078
|
+
if (value > 1e21) {
|
|
5079
|
+
return NF_LARGE.format(value);
|
|
5080
|
+
}
|
|
5081
|
+
return NF.format(value);
|
|
5082
|
+
},
|
|
5083
|
+
margin: chartType === "SCATTER" ? config?.scatterConfig?.maxSize ? config.scatterConfig.maxSize : 30 : 4
|
|
5084
|
+
},
|
|
5085
|
+
...yAxisToChartOption(
|
|
5086
|
+
yAxis,
|
|
5087
|
+
markLines,
|
|
5088
|
+
primarySeries
|
|
5089
|
+
)
|
|
5090
|
+
};
|
|
5091
|
+
const baseOptions = {
|
|
5092
|
+
title: {
|
|
5093
|
+
text: title
|
|
5094
|
+
},
|
|
5095
|
+
grid: {
|
|
5096
|
+
top: title ? 48 : 16,
|
|
5097
|
+
right: chartType === "SCATTER" ? 16 : 8,
|
|
5098
|
+
bottom: 8,
|
|
5099
|
+
left: chartType === "SCATTER" ? 20 : 12,
|
|
5100
|
+
containLabel: true
|
|
5101
|
+
},
|
|
5102
|
+
xAxis: xAxisData,
|
|
5103
|
+
dataZoom: {
|
|
5104
|
+
type: "inside",
|
|
5105
|
+
zoomLock: true
|
|
5106
|
+
},
|
|
5107
|
+
legend: {
|
|
5108
|
+
data: legend,
|
|
5109
|
+
top: -1e4,
|
|
5110
|
+
left: -1e4
|
|
5111
|
+
},
|
|
5112
|
+
brush: allowBrush ? {
|
|
5113
|
+
xAxisIndex: 0
|
|
5114
|
+
} : void 0,
|
|
5115
|
+
toolbox: {
|
|
5116
|
+
show: false
|
|
5117
|
+
},
|
|
5118
|
+
yAxis: primaryYAxis,
|
|
5119
|
+
animation: false,
|
|
5120
|
+
series: primarySeries,
|
|
5121
|
+
tooltip: {
|
|
5122
|
+
trigger: chartType === "SCATTER" ? "item" : "axis",
|
|
5123
|
+
confine: true,
|
|
5124
|
+
textStyle: {
|
|
5125
|
+
fontSize: 14,
|
|
5126
|
+
fontFamily: sansFontFamily
|
|
5127
|
+
},
|
|
5128
|
+
extraCssText: "max-width: 75%; max-height: 50vh; overflow-y: auto; padding: 10px 0; background-color: rgba(var(--text-background)); border-color: rgba(var(--border-color));",
|
|
5129
|
+
formatter: tooltipFormatter
|
|
5130
|
+
},
|
|
5131
|
+
visualMap: chartType === "SCATTER" && config?.scatterConfig?.color && sentioColors.dark[config.scatterConfig.color] ? {
|
|
5132
|
+
dimension: 2,
|
|
5133
|
+
min: minRef.current,
|
|
5134
|
+
max: maxRef.current,
|
|
5135
|
+
show: false,
|
|
5136
|
+
inRange: {
|
|
5137
|
+
color: isDarkMode ? sentioColors.dark[config.scatterConfig.color] : sentioColors.light[config.scatterConfig.color]
|
|
5138
|
+
}
|
|
5139
|
+
} : void 0
|
|
5140
|
+
};
|
|
5141
|
+
const finalOptions = applyOverlaySeries(baseOptions);
|
|
5142
|
+
if (isDarkMode && Array.isArray(finalOptions.series)) {
|
|
5143
|
+
finalOptions.series = applyDarkAreaOpacity(
|
|
5144
|
+
finalOptions.series
|
|
5145
|
+
);
|
|
5146
|
+
}
|
|
5147
|
+
return finalOptions;
|
|
5148
|
+
}, [
|
|
5149
|
+
title,
|
|
5150
|
+
xAxisData,
|
|
5151
|
+
legend,
|
|
5152
|
+
allowBrush,
|
|
5153
|
+
yAxis,
|
|
5154
|
+
series,
|
|
5155
|
+
compareSeries,
|
|
5156
|
+
applyOverlaySeries,
|
|
5157
|
+
tooltipFormatter,
|
|
5158
|
+
maximumSignificantDigits,
|
|
5159
|
+
xAxis,
|
|
5160
|
+
chartType,
|
|
5161
|
+
isDarkMode
|
|
5162
|
+
]);
|
|
5163
|
+
const {
|
|
5164
|
+
value: isOpen,
|
|
5165
|
+
setFalse: setClose,
|
|
5166
|
+
setTrue: setOpen
|
|
5167
|
+
} = (0, import_ui_core16.useBoolean)(false);
|
|
5168
|
+
const clickEventParamsRef = (0, import_react20.useRef)(null);
|
|
5169
|
+
const [selectedSeriesIndex, setSelectedSeriesIndex] = (0, import_react20.useState)(0);
|
|
5170
|
+
const chartPositionRef = (0, import_react20.useRef)(null);
|
|
5171
|
+
const { x, y, strategy, refs } = (0, import_react21.useFloating)({
|
|
5172
|
+
open: isOpen,
|
|
5173
|
+
placement: "right",
|
|
5174
|
+
middleware: [(0, import_react21.flip)(), (0, import_react21.shift)()]
|
|
5175
|
+
});
|
|
5176
|
+
const onClick = (0, import_react20.useCallback)(
|
|
5177
|
+
(params, rawParams) => {
|
|
5178
|
+
if (!params) {
|
|
5179
|
+
setClose();
|
|
5180
|
+
return;
|
|
5181
|
+
}
|
|
5182
|
+
const baseBoundingRect = chartPositionRef.current?.getBoundingClientRect();
|
|
5183
|
+
if (params.event) {
|
|
5184
|
+
const { event } = params;
|
|
5185
|
+
clickEventParamsRef.current = params;
|
|
5186
|
+
const targetBoundRect = event.target.getBoundingRect();
|
|
5187
|
+
refs.setPositionReference({
|
|
5188
|
+
getBoundingClientRect: () => {
|
|
5189
|
+
return {
|
|
5190
|
+
x: event.offsetX + (baseBoundingRect?.x ?? 0),
|
|
5191
|
+
y: event.offsetY + (baseBoundingRect?.y ?? 0),
|
|
5192
|
+
width: targetBoundRect.width,
|
|
5193
|
+
height: targetBoundRect.height,
|
|
5194
|
+
top: event.offsetY + (baseBoundingRect?.top ?? 0),
|
|
5195
|
+
right: event.offsetX + (baseBoundingRect?.right ?? 0),
|
|
5196
|
+
bottom: event.offsetY + (baseBoundingRect?.bottom ?? 0),
|
|
5197
|
+
left: event.offsetX + (baseBoundingRect?.left ?? 0)
|
|
5198
|
+
};
|
|
5199
|
+
}
|
|
5200
|
+
});
|
|
5201
|
+
} else if ((0, import_lodash6.isArray)(params)) {
|
|
5202
|
+
const targetValue = closestNumber(
|
|
5203
|
+
yAxisRef.current?.map((item) => item.value[1]),
|
|
5204
|
+
params[1]
|
|
5205
|
+
);
|
|
5206
|
+
clickEventParamsRef.current = yAxisRef.current?.find(
|
|
5207
|
+
(item) => item.value[1] === targetValue
|
|
5208
|
+
);
|
|
5209
|
+
refs.setPositionReference({
|
|
5210
|
+
getBoundingClientRect: () => {
|
|
5211
|
+
return {
|
|
5212
|
+
x: rawParams.offsetX + (baseBoundingRect?.x ?? 0),
|
|
5213
|
+
y: rawParams.offsetY + (baseBoundingRect?.y ?? 0),
|
|
5214
|
+
width: 10,
|
|
5215
|
+
height: 10,
|
|
5216
|
+
top: rawParams.offsetY + (baseBoundingRect?.top ?? 0),
|
|
5217
|
+
right: rawParams.offsetX + (baseBoundingRect?.right ?? 0),
|
|
5218
|
+
bottom: rawParams.offsetY + (baseBoundingRect?.bottom ?? 0),
|
|
5219
|
+
left: rawParams.offsetX + (baseBoundingRect?.left ?? 0)
|
|
5220
|
+
};
|
|
5221
|
+
}
|
|
5222
|
+
});
|
|
5223
|
+
}
|
|
5224
|
+
setOpen();
|
|
5225
|
+
},
|
|
5226
|
+
[refs, setClose, setOpen]
|
|
5227
|
+
);
|
|
5228
|
+
const onSeriesEvent = (0, import_react20.useCallback)((event, params) => {
|
|
5229
|
+
switch (event) {
|
|
5230
|
+
case "click":
|
|
5231
|
+
setSelectedSeriesIndex(params.seriesIndex);
|
|
5232
|
+
break;
|
|
5233
|
+
case "mouseover":
|
|
5234
|
+
;
|
|
5235
|
+
global.highlightSeriesId = params.seriesId;
|
|
5236
|
+
document.querySelectorAll(`.series_${params.seriesId}`).forEach((node) => {
|
|
5237
|
+
node.classList.add("highlighted");
|
|
5238
|
+
});
|
|
5239
|
+
break;
|
|
5240
|
+
case "mouseout":
|
|
5241
|
+
const previousSeriesId = global.highlightSeriesId;
|
|
5242
|
+
if (previousSeriesId) {
|
|
5243
|
+
document.querySelectorAll(`.series_${previousSeriesId}`).forEach((node) => {
|
|
5244
|
+
node.classList.remove("highlighted");
|
|
5245
|
+
});
|
|
5246
|
+
}
|
|
5247
|
+
;
|
|
5248
|
+
global.highlightSeriesId = "";
|
|
5249
|
+
}
|
|
5250
|
+
}, []);
|
|
5251
|
+
const onSelectSeries = (0, import_react20.useCallback)(
|
|
5252
|
+
(seriesIndex) => {
|
|
5253
|
+
clickEventParamsRef.current = {
|
|
5254
|
+
seriesIndex,
|
|
5255
|
+
seriesName: series[seriesIndex].name
|
|
5256
|
+
};
|
|
5257
|
+
if (yAxisRef.current[seriesIndex]?.value) {
|
|
5258
|
+
clickEventParamsRef.current.value = yAxisRef.current[seriesIndex].value;
|
|
5259
|
+
}
|
|
5260
|
+
setSelectedSeriesIndex(seriesIndex);
|
|
5261
|
+
},
|
|
5262
|
+
[series, setSelectedSeriesIndex]
|
|
5263
|
+
);
|
|
5264
|
+
const switchSeries = (0, import_react20.useMemo)(() => {
|
|
5265
|
+
const items = [
|
|
5266
|
+
series.map((serie, index) => ({
|
|
5267
|
+
label: serie.name || "",
|
|
5268
|
+
key: `${index}`
|
|
5269
|
+
}))
|
|
5270
|
+
];
|
|
5271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5272
|
+
import_ui_core15.PopupMenuButton,
|
|
5273
|
+
{
|
|
5274
|
+
onSelect: (d) => onSelectSeries(parseInt(d, 10)),
|
|
5275
|
+
items,
|
|
5276
|
+
buttonIcon: (open) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5277
|
+
"span",
|
|
5278
|
+
{
|
|
5279
|
+
className: (0, import_ui_core15.classNames)(
|
|
5280
|
+
"text-primary-100",
|
|
5281
|
+
"hover:bg-primary-200/80 inline-block cursor-pointer rounded-md px-1 py-0.5",
|
|
5282
|
+
open ? "bg-primary-200/80" : ""
|
|
5283
|
+
),
|
|
5284
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lu6.LuChevronDown, { className: "h-3.5 w-3.5" })
|
|
5285
|
+
}
|
|
5286
|
+
),
|
|
5287
|
+
portal: false,
|
|
5288
|
+
placement: "bottom-end",
|
|
5289
|
+
itemsClassName: "max-h-[50vh] overflow-y-auto"
|
|
5290
|
+
}
|
|
5291
|
+
);
|
|
5292
|
+
}, [series]);
|
|
5293
|
+
void switchSeries;
|
|
5294
|
+
void selectedSeriesIndex;
|
|
5295
|
+
const noLegend = (0, import_react20.useMemo)(() => {
|
|
5296
|
+
if (chartType === "SCATTER" && series.length === 1) {
|
|
5297
|
+
return true;
|
|
5298
|
+
}
|
|
5299
|
+
return _noLegend;
|
|
5300
|
+
}, [_noLegend, chartType, series?.length]);
|
|
5301
|
+
console.log("options", options);
|
|
5302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5303
|
+
"div",
|
|
5304
|
+
{
|
|
5305
|
+
className: "h-full w-full",
|
|
5306
|
+
onMouseOver: () => {
|
|
5307
|
+
setActive(true);
|
|
5308
|
+
},
|
|
5309
|
+
onMouseOut: () => {
|
|
5310
|
+
setActive(false);
|
|
5311
|
+
},
|
|
5312
|
+
children: [
|
|
5313
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5314
|
+
ReactEChartsBase,
|
|
5315
|
+
{
|
|
5316
|
+
ref,
|
|
5317
|
+
loading,
|
|
5318
|
+
group,
|
|
5319
|
+
option: options,
|
|
5320
|
+
minHeight,
|
|
5321
|
+
returnedSeries,
|
|
5322
|
+
totalSeries,
|
|
5323
|
+
onSelect,
|
|
5324
|
+
onClick: allowClick ? onClick : void 0,
|
|
5325
|
+
style,
|
|
5326
|
+
onSeriesEvent,
|
|
5327
|
+
noLegend,
|
|
5328
|
+
onInitChart
|
|
5329
|
+
}
|
|
5330
|
+
),
|
|
5331
|
+
controls && nonXAxis && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(XAxisControls, { xAxis, setXAxis, defaultOpen: true }),
|
|
5332
|
+
controls && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(YaxisControls, { yAxis, setYAxis: setYAxisWrap }),
|
|
5333
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute left-0 top-0", ref: chartPositionRef }),
|
|
5334
|
+
isOpen && allowClick && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react21.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react21.FloatingOverlay, { className: "z-50 bg-gray-100/20", onClick: setClose, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5335
|
+
"div",
|
|
5336
|
+
{
|
|
5337
|
+
ref: refs.setFloating,
|
|
5338
|
+
className: "border-border-color bg-default-bg min-w-64 absolute w-fit divide-y rounded-md border pb-2 shadow-sm",
|
|
5339
|
+
style: {
|
|
5340
|
+
position: strategy,
|
|
5341
|
+
top: 0,
|
|
5342
|
+
left: 0,
|
|
5343
|
+
transform: `translate(${roundByDPR(x || 0)}px,${roundByDPR(y || 0)}px)`
|
|
5344
|
+
},
|
|
5345
|
+
onClick: onClickPreventDefault,
|
|
5346
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-text-foreground max-h-80 max-w-[50vw] overflow-y-auto py-2 text-sm", children: chartType === "SCATTER" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ScatterChartTooltip, { ...tooltipParmsRef.current, isFixed: true }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChartTooltip, { ...tooltipParmsRef.current, isFixed: true }) })
|
|
5347
|
+
}
|
|
5348
|
+
) }) })
|
|
5349
|
+
]
|
|
5350
|
+
}
|
|
5351
|
+
);
|
|
5352
|
+
}
|
|
5353
|
+
);
|
|
5354
|
+
TimeSeriesChart.displayName = "TimeSeriesChart";
|
|
5355
|
+
function computeMarkLines(series, markLines) {
|
|
5356
|
+
if (markLines && markLines.length > 0 && series.length > 0) {
|
|
5357
|
+
series[0] = {
|
|
5358
|
+
...series[0],
|
|
5359
|
+
markLine: {
|
|
5360
|
+
symbol: [],
|
|
5361
|
+
data: markLines.map((area) => {
|
|
5362
|
+
if (area.from || area.to) {
|
|
5363
|
+
return [
|
|
5364
|
+
{
|
|
5365
|
+
name: "threshold",
|
|
5366
|
+
xAxis: area.from,
|
|
5367
|
+
yAxis: area.value ?? "min",
|
|
5368
|
+
symbol: "react",
|
|
5369
|
+
symbolSize: [20, 1],
|
|
5370
|
+
symbolOffset: [area.below ? -10 : 10, 0],
|
|
5371
|
+
label: {
|
|
5372
|
+
formatter: `${area.label}`,
|
|
5373
|
+
position: area.below ? "insideMiddleBottom" : "insideMiddleTop",
|
|
5374
|
+
color: area.color || "#ff0000"
|
|
5375
|
+
},
|
|
5376
|
+
lineStyle: {
|
|
5377
|
+
color: area.color || "#ff0000"
|
|
5378
|
+
}
|
|
5379
|
+
},
|
|
5380
|
+
{
|
|
5381
|
+
symbol: "rect",
|
|
5382
|
+
symbolSize: [20, 1],
|
|
5383
|
+
symbolOffset: [area.below ? 10 : -10, 0],
|
|
5384
|
+
xAxis: area.to ? area.to : void 0,
|
|
5385
|
+
yAxis: area.value ?? "max"
|
|
5386
|
+
}
|
|
5387
|
+
];
|
|
5388
|
+
} else {
|
|
5389
|
+
return {
|
|
5390
|
+
name: "threshold",
|
|
5391
|
+
yAxis: area.value,
|
|
5392
|
+
symbol: "react",
|
|
5393
|
+
symbolSize: [20, 1],
|
|
5394
|
+
symbolOffset: [area.below ? -10 : 10, 0],
|
|
5395
|
+
label: {
|
|
5396
|
+
formatter: `${area.label}`,
|
|
5397
|
+
position: area.below ? "insideStartBottom" : "insideStartTop",
|
|
5398
|
+
color: area.color || "#ff0000"
|
|
5399
|
+
},
|
|
5400
|
+
lineStyle: {
|
|
5401
|
+
color: area.color || "#ff0000"
|
|
5402
|
+
}
|
|
5403
|
+
};
|
|
5404
|
+
}
|
|
5405
|
+
})
|
|
5406
|
+
}
|
|
5407
|
+
};
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
function computeMarksAreas(series, markAreas) {
|
|
5411
|
+
if (markAreas && markAreas.length > 0 && series.length > 0) {
|
|
5412
|
+
series[0].markArea = {
|
|
5413
|
+
itemStyle: {
|
|
5414
|
+
color: markAreas[0].color || "rgba(255, 173, 177, 0.4)"
|
|
5415
|
+
}
|
|
5416
|
+
};
|
|
5417
|
+
series[0].markArea.data = markAreas.map((markArea) => {
|
|
5418
|
+
return [
|
|
5419
|
+
{
|
|
5420
|
+
xAxis: markArea.from ? markArea.from : void 0
|
|
5421
|
+
},
|
|
5422
|
+
{
|
|
5423
|
+
xAxis: markArea.to ? markArea.to : void 0
|
|
5424
|
+
}
|
|
5425
|
+
];
|
|
5426
|
+
});
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
var MIN_SIZE = 5;
|
|
5430
|
+
var MAX_SIZE = 30;
|
|
5431
|
+
var LEVELS = 10;
|
|
5432
|
+
function normalize(value, min, max, minSize = MIN_SIZE, maxSize = MAX_SIZE) {
|
|
5433
|
+
if (max === min) return MIN_SIZE;
|
|
5434
|
+
if (value <= min) return minSize;
|
|
5435
|
+
if (value >= max) return maxSize;
|
|
5436
|
+
const range = max - min;
|
|
5437
|
+
const levelRange = range / LEVELS;
|
|
5438
|
+
const sizeIncrement = (maxSize - minSize) / (LEVELS - 1);
|
|
5439
|
+
const level = Math.floor((value - min) / levelRange);
|
|
5440
|
+
const clampedLevel = Math.min(level, LEVELS - 1);
|
|
5441
|
+
return minSize + clampedLevel * sizeIncrement;
|
|
5442
|
+
}
|
|
5443
|
+
|
|
3981
5444
|
// src/charts/options/LineControls.tsx
|
|
3982
5445
|
var import_immer4 = require("immer");
|
|
3983
|
-
var
|
|
3984
|
-
var
|
|
5446
|
+
var import_ui_core17 = require("@sentio/ui-core");
|
|
5447
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3985
5448
|
var lineStyles = [
|
|
3986
5449
|
{ label: "Solid", value: "Solid" },
|
|
3987
5450
|
{ label: "Dotted", value: "Dotted" }
|
|
@@ -4001,14 +5464,14 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
4001
5464
|
})
|
|
4002
5465
|
);
|
|
4003
5466
|
};
|
|
4004
|
-
return /* @__PURE__ */ (0,
|
|
4005
|
-
|
|
5467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5468
|
+
import_ui_core17.DisclosurePanel,
|
|
4006
5469
|
{
|
|
4007
5470
|
title: "Line style",
|
|
4008
5471
|
containerClassName: "w-full bg-default-bg",
|
|
4009
|
-
children: /* @__PURE__ */ (0,
|
|
4010
|
-
/* @__PURE__ */ (0,
|
|
4011
|
-
|
|
5472
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5474
|
+
import_ui_core17.NewButtonGroup,
|
|
4012
5475
|
{
|
|
4013
5476
|
buttons: lineStyles,
|
|
4014
5477
|
value: config?.style || "Solid",
|
|
@@ -4016,8 +5479,8 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
4016
5479
|
small: true
|
|
4017
5480
|
}
|
|
4018
5481
|
),
|
|
4019
|
-
/* @__PURE__ */ (0,
|
|
4020
|
-
|
|
5482
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5483
|
+
import_ui_core17.Checkbox,
|
|
4021
5484
|
{
|
|
4022
5485
|
label: "Smooth Curves",
|
|
4023
5486
|
checked: config?.smooth,
|
|
@@ -4030,16 +5493,16 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
4030
5493
|
};
|
|
4031
5494
|
|
|
4032
5495
|
// src/charts/options/LabelControls.tsx
|
|
4033
|
-
var
|
|
5496
|
+
var import_react22 = require("react");
|
|
4034
5497
|
var import_immer5 = require("immer");
|
|
4035
|
-
var
|
|
4036
|
-
var
|
|
4037
|
-
var
|
|
5498
|
+
var import_ui_core18 = require("@sentio/ui-core");
|
|
5499
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5500
|
+
var initialConfig3 = {
|
|
4038
5501
|
columns: [],
|
|
4039
5502
|
alias: ""
|
|
4040
5503
|
};
|
|
4041
5504
|
var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
4042
|
-
(0,
|
|
5505
|
+
(0, import_react22.useEffect)(() => {
|
|
4043
5506
|
if (config?.columns && config.columns.length > 0 && !config.alias) {
|
|
4044
5507
|
const aliasParts = [];
|
|
4045
5508
|
config.columns.forEach((colConfig) => {
|
|
@@ -4064,36 +5527,36 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
4064
5527
|
}, [config, setConfig]);
|
|
4065
5528
|
const onAliasChanged = (alias) => {
|
|
4066
5529
|
setConfig(
|
|
4067
|
-
(0, import_immer5.produce)(config ??
|
|
5530
|
+
(0, import_immer5.produce)(config ?? initialConfig3, (draft) => {
|
|
4068
5531
|
draft.alias = alias;
|
|
4069
5532
|
})
|
|
4070
5533
|
);
|
|
4071
5534
|
};
|
|
4072
|
-
const _defaultOpen = (0,
|
|
5535
|
+
const _defaultOpen = (0, import_react22.useMemo)(() => {
|
|
4073
5536
|
if (defaultOpen) {
|
|
4074
5537
|
return true;
|
|
4075
5538
|
}
|
|
4076
5539
|
return config?.alias !== "" || config?.columns && config.columns.length > 0;
|
|
4077
5540
|
}, [config, defaultOpen]);
|
|
4078
|
-
return /* @__PURE__ */ (0,
|
|
4079
|
-
|
|
5541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5542
|
+
import_ui_core18.DisclosurePanel,
|
|
4080
5543
|
{
|
|
4081
5544
|
title: "Label Controls",
|
|
4082
5545
|
defaultOpen: _defaultOpen,
|
|
4083
5546
|
containerClassName: "w-full bg-default-bg",
|
|
4084
|
-
children: /* @__PURE__ */ (0,
|
|
4085
|
-
/* @__PURE__ */ (0,
|
|
4086
|
-
/* @__PURE__ */ (0,
|
|
5547
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5548
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
5549
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2 font-medium", children: [
|
|
4087
5550
|
"Label Alias",
|
|
4088
|
-
/* @__PURE__ */ (0,
|
|
4089
|
-
|
|
5551
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5552
|
+
import_ui_core18.HelpIcon,
|
|
4090
5553
|
{
|
|
4091
|
-
text: /* @__PURE__ */ (0,
|
|
4092
|
-
/* @__PURE__ */ (0,
|
|
4093
|
-
/* @__PURE__ */ (0,
|
|
5554
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "text-icontent text-text-foreground", children: [
|
|
5555
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: "Series name override or template." }),
|
|
5556
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
4094
5557
|
"Ex.",
|
|
4095
5558
|
" ",
|
|
4096
|
-
/* @__PURE__ */ (0,
|
|
5559
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
|
|
4097
5560
|
" ",
|
|
4098
5561
|
"will be replaced with the value of the contract label."
|
|
4099
5562
|
] })
|
|
@@ -4101,7 +5564,7 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
4101
5564
|
}
|
|
4102
5565
|
)
|
|
4103
5566
|
] }),
|
|
4104
|
-
/* @__PURE__ */ (0,
|
|
5567
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4105
5568
|
"input",
|
|
4106
5569
|
{
|
|
4107
5570
|
type: "text",
|
|
@@ -4112,13 +5575,13 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
4112
5575
|
}
|
|
4113
5576
|
)
|
|
4114
5577
|
] }),
|
|
4115
|
-
/* @__PURE__ */ (0,
|
|
4116
|
-
|
|
5578
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5579
|
+
import_ui_core18.Button,
|
|
4117
5580
|
{
|
|
4118
5581
|
type: "button",
|
|
4119
5582
|
role: "link",
|
|
4120
5583
|
onClick: () => {
|
|
4121
|
-
setConfig(
|
|
5584
|
+
setConfig(initialConfig3);
|
|
4122
5585
|
},
|
|
4123
5586
|
children: "Reset"
|
|
4124
5587
|
}
|
|
@@ -4130,9 +5593,9 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
4130
5593
|
|
|
4131
5594
|
// src/charts/options/PieChartControls.tsx
|
|
4132
5595
|
var import_immer6 = require("immer");
|
|
4133
|
-
var
|
|
4134
|
-
var
|
|
4135
|
-
var
|
|
5596
|
+
var import_lodash7 = require("lodash");
|
|
5597
|
+
var import_ui_core19 = require("@sentio/ui-core");
|
|
5598
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4136
5599
|
var defaultConfig = {
|
|
4137
5600
|
pieType: "Pie",
|
|
4138
5601
|
calculation: "LAST",
|
|
@@ -4153,7 +5616,7 @@ var PieTypeItems = [
|
|
|
4153
5616
|
{ label: "Donut", value: "Donut" }
|
|
4154
5617
|
];
|
|
4155
5618
|
function PieChartControls({ config, defaultOpen, onChange }) {
|
|
4156
|
-
config = (0,
|
|
5619
|
+
config = (0, import_lodash7.defaults)(config, defaultConfig);
|
|
4157
5620
|
function onCalculationChange(cal) {
|
|
4158
5621
|
config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.calculation = cal)));
|
|
4159
5622
|
}
|
|
@@ -4167,15 +5630,15 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4167
5630
|
})
|
|
4168
5631
|
);
|
|
4169
5632
|
}
|
|
4170
|
-
return /* @__PURE__ */ (0,
|
|
4171
|
-
|
|
5633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5634
|
+
import_ui_core19.DisclosurePanel,
|
|
4172
5635
|
{
|
|
4173
5636
|
title: "Pie Chart Options",
|
|
4174
5637
|
defaultOpen,
|
|
4175
5638
|
containerClassName: "w-full bg-default-bg",
|
|
4176
|
-
children: /* @__PURE__ */ (0,
|
|
4177
|
-
/* @__PURE__ */ (0,
|
|
4178
|
-
|
|
5639
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
5640
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5641
|
+
import_ui_core19.NewButtonGroup,
|
|
4179
5642
|
{
|
|
4180
5643
|
small: true,
|
|
4181
5644
|
buttons: PieTypeItems,
|
|
@@ -4183,22 +5646,22 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4183
5646
|
onChange: onPieTypeChange
|
|
4184
5647
|
}
|
|
4185
5648
|
) }),
|
|
4186
|
-
/* @__PURE__ */ (0,
|
|
4187
|
-
/* @__PURE__ */ (0,
|
|
4188
|
-
/* @__PURE__ */ (0,
|
|
5649
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
5650
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
|
|
5651
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4189
5652
|
"select",
|
|
4190
5653
|
{
|
|
4191
5654
|
value: config.calculation,
|
|
4192
5655
|
className: "sm:text-ilabel text-text-foreground border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
|
|
4193
5656
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
4194
5657
|
children: CalculationItems.map((d) => {
|
|
4195
|
-
return /* @__PURE__ */ (0,
|
|
5658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4196
5659
|
})
|
|
4197
5660
|
}
|
|
4198
5661
|
)
|
|
4199
5662
|
] }),
|
|
4200
|
-
/* @__PURE__ */ (0,
|
|
4201
|
-
|
|
5663
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5664
|
+
import_ui_core19.Checkbox,
|
|
4202
5665
|
{
|
|
4203
5666
|
checked: config?.showValue,
|
|
4204
5667
|
onChange: (v) => toggle("showValue", v),
|
|
@@ -4206,8 +5669,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4206
5669
|
labelClassName: "whitespace-nowrap"
|
|
4207
5670
|
}
|
|
4208
5671
|
),
|
|
4209
|
-
/* @__PURE__ */ (0,
|
|
4210
|
-
|
|
5672
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5673
|
+
import_ui_core19.Checkbox,
|
|
4211
5674
|
{
|
|
4212
5675
|
checked: config?.showPercent,
|
|
4213
5676
|
onChange: (v) => toggle("showPercent", v),
|
|
@@ -4215,8 +5678,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4215
5678
|
labelClassName: "whitespace-nowrap"
|
|
4216
5679
|
}
|
|
4217
5680
|
),
|
|
4218
|
-
/* @__PURE__ */ (0,
|
|
4219
|
-
|
|
5681
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5682
|
+
import_ui_core19.Checkbox,
|
|
4220
5683
|
{
|
|
4221
5684
|
checked: config?.absValue,
|
|
4222
5685
|
onChange: (v) => toggle("absValue", v),
|
|
@@ -4231,9 +5694,9 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4231
5694
|
|
|
4232
5695
|
// src/charts/options/BarGaugeControls.tsx
|
|
4233
5696
|
var import_immer7 = require("immer");
|
|
4234
|
-
var
|
|
4235
|
-
var
|
|
4236
|
-
var
|
|
5697
|
+
var import_lodash8 = require("lodash");
|
|
5698
|
+
var import_ui_core20 = require("@sentio/ui-core");
|
|
5699
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4237
5700
|
var defaultConfig2 = {
|
|
4238
5701
|
direction: "HORIZONTAL",
|
|
4239
5702
|
calculation: "LAST",
|
|
@@ -4254,16 +5717,16 @@ var CalculationItems2 = [
|
|
|
4254
5717
|
{ label: "Max", value: "MAX" },
|
|
4255
5718
|
{ label: "Min", value: "MIN" }
|
|
4256
5719
|
];
|
|
4257
|
-
var
|
|
5720
|
+
var sortByItems2 = [
|
|
4258
5721
|
{ label: "Name", value: "ByName" },
|
|
4259
5722
|
{ label: "Value", value: "ByValue" }
|
|
4260
5723
|
];
|
|
4261
|
-
var
|
|
5724
|
+
var orderItems2 = [
|
|
4262
5725
|
{ label: "Ascendant", value: "false" },
|
|
4263
5726
|
{ label: "Descendant", value: "true" }
|
|
4264
5727
|
];
|
|
4265
5728
|
function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
4266
|
-
config = (0,
|
|
5729
|
+
config = (0, import_lodash8.defaults)(config, defaultConfig2);
|
|
4267
5730
|
function onCalculationChange(cal) {
|
|
4268
5731
|
config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.calculation = cal)));
|
|
4269
5732
|
}
|
|
@@ -4286,62 +5749,62 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
4286
5749
|
})
|
|
4287
5750
|
);
|
|
4288
5751
|
}
|
|
4289
|
-
return /* @__PURE__ */ (0,
|
|
4290
|
-
|
|
5752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5753
|
+
import_ui_core20.DisclosurePanel,
|
|
4291
5754
|
{
|
|
4292
5755
|
title: "Bar Gauge Options",
|
|
4293
5756
|
defaultOpen,
|
|
4294
5757
|
containerClassName: "w-full bg-default-bg",
|
|
4295
|
-
children: /* @__PURE__ */ (0,
|
|
4296
|
-
/* @__PURE__ */ (0,
|
|
4297
|
-
/* @__PURE__ */ (0,
|
|
4298
|
-
/* @__PURE__ */ (0,
|
|
5758
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
5759
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
5760
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Direction" }),
|
|
5761
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4299
5762
|
"select",
|
|
4300
5763
|
{
|
|
4301
5764
|
value: config.direction,
|
|
4302
5765
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
|
|
4303
5766
|
onChange: (e) => onDirectionChange(e.target.value),
|
|
4304
5767
|
children: directionItems.map((d) => {
|
|
4305
|
-
return /* @__PURE__ */ (0,
|
|
5768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4306
5769
|
})
|
|
4307
5770
|
}
|
|
4308
5771
|
)
|
|
4309
5772
|
] }),
|
|
4310
|
-
/* @__PURE__ */ (0,
|
|
4311
|
-
/* @__PURE__ */ (0,
|
|
4312
|
-
/* @__PURE__ */ (0,
|
|
5773
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
5774
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
|
|
5775
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4313
5776
|
"select",
|
|
4314
5777
|
{
|
|
4315
5778
|
value: config.calculation,
|
|
4316
5779
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
|
|
4317
5780
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
4318
5781
|
children: CalculationItems2.map((d) => {
|
|
4319
|
-
return /* @__PURE__ */ (0,
|
|
5782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4320
5783
|
})
|
|
4321
5784
|
}
|
|
4322
5785
|
)
|
|
4323
5786
|
] }),
|
|
4324
|
-
/* @__PURE__ */ (0,
|
|
4325
|
-
/* @__PURE__ */ (0,
|
|
4326
|
-
/* @__PURE__ */ (0,
|
|
5787
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
5788
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center whitespace-nowrap rounded-l-md border border-r-0 bg-gray-50 px-3", children: "Sort by" }),
|
|
5789
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4327
5790
|
"select",
|
|
4328
5791
|
{
|
|
4329
5792
|
value: config?.sort?.sortBy,
|
|
4330
5793
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center border pl-4 pr-7",
|
|
4331
5794
|
onChange: (e) => onSortByChange(e.target.value),
|
|
4332
|
-
children:
|
|
4333
|
-
return /* @__PURE__ */ (0,
|
|
5795
|
+
children: sortByItems2.map((d) => {
|
|
5796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4334
5797
|
})
|
|
4335
5798
|
}
|
|
4336
5799
|
),
|
|
4337
|
-
/* @__PURE__ */ (0,
|
|
5800
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4338
5801
|
"select",
|
|
4339
5802
|
{
|
|
4340
5803
|
value: config?.sort?.orderDesc + "",
|
|
4341
5804
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border border-l-0 pl-4 pr-7",
|
|
4342
5805
|
onChange: (e) => onOrderChange(e.target.value === "true"),
|
|
4343
|
-
children:
|
|
4344
|
-
return /* @__PURE__ */ (0,
|
|
5806
|
+
children: orderItems2.map((d) => {
|
|
5807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: d.value + "", children: d.label }, d.label);
|
|
4345
5808
|
})
|
|
4346
5809
|
}
|
|
4347
5810
|
)
|
|
@@ -4353,30 +5816,13 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
4353
5816
|
|
|
4354
5817
|
// src/charts/options/ValueOptions.tsx
|
|
4355
5818
|
var import_immer9 = require("immer");
|
|
4356
|
-
var
|
|
4357
|
-
|
|
4358
|
-
// src/charts/options/controls-ui.tsx
|
|
4359
|
-
var import_ui_core15 = require("@sentio/ui-core");
|
|
4360
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4361
|
-
var AddonLabel = ({
|
|
4362
|
-
className,
|
|
4363
|
-
children
|
|
4364
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4365
|
-
"span",
|
|
4366
|
-
{
|
|
4367
|
-
className: (0, import_ui_core15.classNames)(
|
|
4368
|
-
"sm:text-icontent border-main inline-flex items-center whitespace-nowrap bg-gray-50",
|
|
4369
|
-
className
|
|
4370
|
-
),
|
|
4371
|
-
children
|
|
4372
|
-
}
|
|
4373
|
-
);
|
|
5819
|
+
var import_ui_core22 = require("@sentio/ui-core");
|
|
4374
5820
|
|
|
4375
5821
|
// src/charts/options/ValueStringMapping.tsx
|
|
4376
|
-
var
|
|
4377
|
-
var
|
|
5822
|
+
var import_lu7 = require("react-icons/lu");
|
|
5823
|
+
var import_ui_core21 = require("@sentio/ui-core");
|
|
4378
5824
|
var import_immer8 = require("immer");
|
|
4379
|
-
var
|
|
5825
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4380
5826
|
var operators = {
|
|
4381
5827
|
">": "greater than",
|
|
4382
5828
|
">=": "greater or equal",
|
|
@@ -4386,17 +5832,17 @@ var operators = {
|
|
|
4386
5832
|
"<=": "less or equal"
|
|
4387
5833
|
};
|
|
4388
5834
|
var renderTreeLine = (index, isLast) => {
|
|
4389
|
-
return /* @__PURE__ */ (0,
|
|
4390
|
-
/* @__PURE__ */ (0,
|
|
5835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex h-full w-full items-center", children: [
|
|
5836
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4391
5837
|
"div",
|
|
4392
5838
|
{
|
|
4393
|
-
className: (0,
|
|
5839
|
+
className: (0, import_ui_core21.classNames)(
|
|
4394
5840
|
"w-px bg-gray-300",
|
|
4395
5841
|
isLast ? "h-1/2 self-start" : index === 0 ? "h-full self-end" : "h-full"
|
|
4396
5842
|
)
|
|
4397
5843
|
}
|
|
4398
5844
|
),
|
|
4399
|
-
/* @__PURE__ */ (0,
|
|
5845
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "h-px w-3 bg-gray-300" })
|
|
4400
5846
|
] }) });
|
|
4401
5847
|
};
|
|
4402
5848
|
function ValueStringMapping({ rules, onChange }) {
|
|
@@ -4427,31 +5873,31 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4427
5873
|
})
|
|
4428
5874
|
);
|
|
4429
5875
|
}
|
|
4430
|
-
return /* @__PURE__ */ (0,
|
|
5876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex w-full flex-col rounded-md py-2", children: [
|
|
4431
5877
|
(rules || []).map((rule, index) => {
|
|
4432
5878
|
const isLast = index === (rules || []).length - 1;
|
|
4433
|
-
return /* @__PURE__ */ (0,
|
|
5879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4434
5880
|
"div",
|
|
4435
5881
|
{
|
|
4436
5882
|
className: "text-text-foreground flex h-10 items-center py-1",
|
|
4437
5883
|
children: [
|
|
4438
5884
|
renderTreeLine(index, isLast),
|
|
4439
|
-
/* @__PURE__ */ (0,
|
|
4440
|
-
/* @__PURE__ */ (0,
|
|
5885
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
|
|
5886
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4441
5887
|
"select",
|
|
4442
5888
|
{
|
|
4443
5889
|
value: rule.comparison,
|
|
4444
5890
|
onChange: (e) => changeRule(index, "comparison", e.target.value),
|
|
4445
5891
|
className: "rounded-r-0 sm:text-ilabel border-main text-text-foreground focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 inline-flex h-full items-center rounded-l-md border border-r-0 bg-gray-50 py-1 pl-4 pr-7",
|
|
4446
5892
|
children: Object.entries(operators).map(([op, display]) => {
|
|
4447
|
-
return /* @__PURE__ */ (0,
|
|
5893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("option", { value: op, children: [
|
|
4448
5894
|
"is ",
|
|
4449
5895
|
display
|
|
4450
5896
|
] }, op);
|
|
4451
5897
|
})
|
|
4452
5898
|
}
|
|
4453
5899
|
),
|
|
4454
|
-
/* @__PURE__ */ (0,
|
|
5900
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4455
5901
|
"input",
|
|
4456
5902
|
{
|
|
4457
5903
|
type: "text",
|
|
@@ -4465,8 +5911,8 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4465
5911
|
}
|
|
4466
5912
|
}
|
|
4467
5913
|
),
|
|
4468
|
-
/* @__PURE__ */ (0,
|
|
4469
|
-
/* @__PURE__ */ (0,
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
|
|
5915
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4470
5916
|
"input",
|
|
4471
5917
|
{
|
|
4472
5918
|
type: "text",
|
|
@@ -4480,15 +5926,15 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4480
5926
|
}
|
|
4481
5927
|
}
|
|
4482
5928
|
),
|
|
4483
|
-
/* @__PURE__ */ (0,
|
|
5929
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4484
5930
|
"button",
|
|
4485
5931
|
{
|
|
4486
5932
|
type: "button",
|
|
4487
5933
|
className: "mx-2",
|
|
4488
5934
|
"aria-label": "remove",
|
|
4489
5935
|
onClick: () => removeRule(index),
|
|
4490
|
-
children: /* @__PURE__ */ (0,
|
|
4491
|
-
|
|
5936
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5937
|
+
import_lu7.LuTrash2,
|
|
4492
5938
|
{
|
|
4493
5939
|
className: "icon text-text-foreground-disabled",
|
|
4494
5940
|
"aria-hidden": "true"
|
|
@@ -4501,8 +5947,8 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4501
5947
|
index
|
|
4502
5948
|
);
|
|
4503
5949
|
}),
|
|
4504
|
-
/* @__PURE__ */ (0,
|
|
4505
|
-
|
|
5950
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5951
|
+
import_ui_core21.Button,
|
|
4506
5952
|
{
|
|
4507
5953
|
type: "button",
|
|
4508
5954
|
role: "secondary",
|
|
@@ -4510,7 +5956,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4510
5956
|
"aria-label": "remove",
|
|
4511
5957
|
onClick: addRule,
|
|
4512
5958
|
children: [
|
|
4513
|
-
/* @__PURE__ */ (0,
|
|
5959
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lu7.LuPlus, { className: (0, import_ui_core21.classNames)("h-4 w-4"), "aria-hidden": "true" }),
|
|
4514
5960
|
"Add Formatting Rule"
|
|
4515
5961
|
]
|
|
4516
5962
|
}
|
|
@@ -4519,7 +5965,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4519
5965
|
}
|
|
4520
5966
|
|
|
4521
5967
|
// src/charts/options/ValueOptions.tsx
|
|
4522
|
-
var
|
|
5968
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4523
5969
|
var ValueFormatters = [
|
|
4524
5970
|
{ label: "Number", value: "NumberFormatter" },
|
|
4525
5971
|
{ label: "Date", value: "DateFormatter" },
|
|
@@ -4548,7 +5994,7 @@ var CurrencySymbols = [
|
|
|
4548
5994
|
var AddonLabel2 = ({
|
|
4549
5995
|
className,
|
|
4550
5996
|
children
|
|
4551
|
-
}) => /* @__PURE__ */ (0,
|
|
5997
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel, { className: (0, import_ui_core22.classNames)("px-3", className), children });
|
|
4552
5998
|
var ValueOptions = ({
|
|
4553
5999
|
config,
|
|
4554
6000
|
onChange,
|
|
@@ -4615,9 +6061,9 @@ var ValueOptions = ({
|
|
|
4615
6061
|
function numberAddons(style) {
|
|
4616
6062
|
switch (style) {
|
|
4617
6063
|
case "None":
|
|
4618
|
-
return /* @__PURE__ */ (0,
|
|
4619
|
-
/* @__PURE__ */ (0,
|
|
4620
|
-
/* @__PURE__ */ (0,
|
|
6064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6065
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-l-0", children: "Fraction Digits" }),
|
|
6066
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4621
6067
|
"input",
|
|
4622
6068
|
{
|
|
4623
6069
|
disabled: true,
|
|
@@ -4628,9 +6074,9 @@ var ValueOptions = ({
|
|
|
4628
6074
|
] });
|
|
4629
6075
|
case "Percent":
|
|
4630
6076
|
case "Standard":
|
|
4631
|
-
return /* @__PURE__ */ (0,
|
|
4632
|
-
/* @__PURE__ */ (0,
|
|
4633
|
-
/* @__PURE__ */ (0,
|
|
6077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6078
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-x-0", children: "Fraction Digits" }),
|
|
6079
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4634
6080
|
"input",
|
|
4635
6081
|
{
|
|
4636
6082
|
type: "number",
|
|
@@ -4644,10 +6090,10 @@ var ValueOptions = ({
|
|
|
4644
6090
|
)
|
|
4645
6091
|
] });
|
|
4646
6092
|
case "Currency":
|
|
4647
|
-
return /* @__PURE__ */ (0,
|
|
4648
|
-
/* @__PURE__ */ (0,
|
|
4649
|
-
/* @__PURE__ */ (0,
|
|
4650
|
-
|
|
6093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6094
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-r-0", children: "Symbol" }),
|
|
6095
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "w-28 ", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6096
|
+
import_ui_core22.ComboInput,
|
|
4651
6097
|
{
|
|
4652
6098
|
onChange: onChangeSymbol,
|
|
4653
6099
|
options: CurrencySymbols.map((s) => s.value),
|
|
@@ -4659,8 +6105,8 @@ var ValueOptions = ({
|
|
|
4659
6105
|
value: config?.currencySymbol
|
|
4660
6106
|
}
|
|
4661
6107
|
) }),
|
|
4662
|
-
/* @__PURE__ */ (0,
|
|
4663
|
-
/* @__PURE__ */ (0,
|
|
6108
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border", children: "Precision" }),
|
|
6109
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4664
6110
|
"input",
|
|
4665
6111
|
{
|
|
4666
6112
|
type: "number",
|
|
@@ -4675,9 +6121,9 @@ var ValueOptions = ({
|
|
|
4675
6121
|
)
|
|
4676
6122
|
] });
|
|
4677
6123
|
default:
|
|
4678
|
-
return /* @__PURE__ */ (0,
|
|
4679
|
-
/* @__PURE__ */ (0,
|
|
4680
|
-
/* @__PURE__ */ (0,
|
|
6124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6125
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-x-0", children: "Max significant digits" }),
|
|
6126
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4681
6127
|
"input",
|
|
4682
6128
|
{
|
|
4683
6129
|
type: "number",
|
|
@@ -4692,62 +6138,62 @@ var ValueOptions = ({
|
|
|
4692
6138
|
] });
|
|
4693
6139
|
}
|
|
4694
6140
|
}
|
|
4695
|
-
return /* @__PURE__ */ (0,
|
|
4696
|
-
/* @__PURE__ */ (0,
|
|
4697
|
-
/* @__PURE__ */ (0,
|
|
4698
|
-
/* @__PURE__ */ (0,
|
|
6141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6142
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex", children: [
|
|
6143
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
|
|
6144
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4699
6145
|
"select",
|
|
4700
6146
|
{
|
|
4701
6147
|
value: config.valueFormatter,
|
|
4702
|
-
className: (0,
|
|
6148
|
+
className: (0, import_ui_core22.classNames)(
|
|
4703
6149
|
"sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1.5 pl-4 pr-7 focus:ring-0",
|
|
4704
6150
|
config.valueFormatter == "StringFormatter" ? "rounded-r-md" : ""
|
|
4705
6151
|
),
|
|
4706
6152
|
onChange: (e) => onChangeFormatter(e.target.value),
|
|
4707
6153
|
children: formatters.map((d) => {
|
|
4708
|
-
return /* @__PURE__ */ (0,
|
|
6154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4709
6155
|
})
|
|
4710
6156
|
}
|
|
4711
6157
|
),
|
|
4712
|
-
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0,
|
|
4713
|
-
/* @__PURE__ */ (0,
|
|
4714
|
-
/* @__PURE__ */ (0,
|
|
6158
|
+
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6159
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-l-0 border-r-0", children: "Style" }),
|
|
6160
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4715
6161
|
"select",
|
|
4716
6162
|
{
|
|
4717
6163
|
value: config.style,
|
|
4718
6164
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1 pl-4 pr-7 focus:ring-0",
|
|
4719
6165
|
onChange: (e) => onStyleChange(e.target.value),
|
|
4720
6166
|
children: [
|
|
4721
|
-
/* @__PURE__ */ (0,
|
|
4722
|
-
/* @__PURE__ */ (0,
|
|
4723
|
-
/* @__PURE__ */ (0,
|
|
4724
|
-
/* @__PURE__ */ (0,
|
|
4725
|
-
/* @__PURE__ */ (0,
|
|
4726
|
-
/* @__PURE__ */ (0,
|
|
6167
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "None", children: "None" }),
|
|
6168
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Compact", children: "Compact" }),
|
|
6169
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Standard", children: "Standard" }),
|
|
6170
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Scientific", children: "Scientific" }),
|
|
6171
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Percent", children: "Percent" }),
|
|
6172
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Currency", children: "Currency" })
|
|
4727
6173
|
]
|
|
4728
6174
|
}
|
|
4729
6175
|
),
|
|
4730
6176
|
config.style && numberAddons(config.style)
|
|
4731
6177
|
] }),
|
|
4732
|
-
config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0,
|
|
4733
|
-
/* @__PURE__ */ (0,
|
|
4734
|
-
/* @__PURE__ */ (0,
|
|
6178
|
+
config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6179
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-l-0", children: "Date format" }),
|
|
6180
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4735
6181
|
"select",
|
|
4736
6182
|
{
|
|
4737
6183
|
value: config.dateFormat,
|
|
4738
6184
|
className: "sm:text-ilabel border-main text-text-foreground inline-flex items-center rounded-r-md border border-l-0 py-1 pl-4 pr-7",
|
|
4739
6185
|
onChange: (e) => onChangeDateFormat(e.target.value),
|
|
4740
6186
|
children: dateFormats.map((d) => {
|
|
4741
|
-
return /* @__PURE__ */ (0,
|
|
6187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4742
6188
|
})
|
|
4743
6189
|
}
|
|
4744
6190
|
)
|
|
4745
6191
|
] })
|
|
4746
6192
|
] }) }),
|
|
4747
|
-
(showPrefix || showSuffix) && /* @__PURE__ */ (0,
|
|
4748
|
-
showPrefix && /* @__PURE__ */ (0,
|
|
4749
|
-
/* @__PURE__ */ (0,
|
|
4750
|
-
/* @__PURE__ */ (0,
|
|
6193
|
+
(showPrefix || showSuffix) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "mt-2 flex items-center gap-4", children: [
|
|
6194
|
+
showPrefix && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
|
|
6195
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
|
|
6196
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4751
6197
|
"input",
|
|
4752
6198
|
{
|
|
4753
6199
|
type: "text",
|
|
@@ -4758,9 +6204,9 @@ var ValueOptions = ({
|
|
|
4758
6204
|
}
|
|
4759
6205
|
)
|
|
4760
6206
|
] }),
|
|
4761
|
-
showSuffix && /* @__PURE__ */ (0,
|
|
4762
|
-
/* @__PURE__ */ (0,
|
|
4763
|
-
/* @__PURE__ */ (0,
|
|
6207
|
+
showSuffix && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
|
|
6208
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
|
|
6209
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4764
6210
|
"input",
|
|
4765
6211
|
{
|
|
4766
6212
|
type: "text",
|
|
@@ -4772,7 +6218,7 @@ var ValueOptions = ({
|
|
|
4772
6218
|
)
|
|
4773
6219
|
] })
|
|
4774
6220
|
] }) }),
|
|
4775
|
-
config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0,
|
|
6221
|
+
config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4776
6222
|
ValueStringMapping,
|
|
4777
6223
|
{
|
|
4778
6224
|
rules: config.mappingRules || [],
|
|
@@ -4783,10 +6229,10 @@ var ValueOptions = ({
|
|
|
4783
6229
|
};
|
|
4784
6230
|
|
|
4785
6231
|
// src/charts/options/ValueControls.tsx
|
|
4786
|
-
var
|
|
4787
|
-
var
|
|
6232
|
+
var import_lodash9 = require("lodash");
|
|
6233
|
+
var import_ui_core23 = require("@sentio/ui-core");
|
|
4788
6234
|
var import_immer10 = require("immer");
|
|
4789
|
-
var
|
|
6235
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4790
6236
|
var defaultConfig4 = {
|
|
4791
6237
|
valueFormatter: "NumberFormatter",
|
|
4792
6238
|
showValueLabel: false,
|
|
@@ -4804,7 +6250,7 @@ var ValueControls = ({
|
|
|
4804
6250
|
showPrefix,
|
|
4805
6251
|
showSuffix
|
|
4806
6252
|
}) => {
|
|
4807
|
-
config = (0,
|
|
6253
|
+
config = (0, import_lodash9.defaults)(config || {}, defaultConfig4);
|
|
4808
6254
|
function toggleShowValueLabel(checked) {
|
|
4809
6255
|
config && onChange(
|
|
4810
6256
|
(0, import_immer10.produce)(config, (draft) => void (draft.showValueLabel = checked))
|
|
@@ -4813,14 +6259,14 @@ var ValueControls = ({
|
|
|
4813
6259
|
function toggleTooltipTotal(checked) {
|
|
4814
6260
|
config && onChange((0, import_immer10.produce)(config, (draft) => void (draft.tooltipTotal = checked)));
|
|
4815
6261
|
}
|
|
4816
|
-
return /* @__PURE__ */ (0,
|
|
4817
|
-
|
|
6262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6263
|
+
import_ui_core23.DisclosurePanel,
|
|
4818
6264
|
{
|
|
4819
6265
|
title: "Value Options",
|
|
4820
6266
|
defaultOpen,
|
|
4821
6267
|
containerClassName: "w-full bg-default-bg",
|
|
4822
6268
|
children: [
|
|
4823
|
-
/* @__PURE__ */ (0,
|
|
6269
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4824
6270
|
ValueOptions,
|
|
4825
6271
|
{
|
|
4826
6272
|
onChange,
|
|
@@ -4830,17 +6276,17 @@ var ValueControls = ({
|
|
|
4830
6276
|
showSuffix
|
|
4831
6277
|
}
|
|
4832
6278
|
),
|
|
4833
|
-
/* @__PURE__ */ (0,
|
|
4834
|
-
/* @__PURE__ */ (0,
|
|
4835
|
-
|
|
6279
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
6280
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6281
|
+
import_ui_core23.Checkbox,
|
|
4836
6282
|
{
|
|
4837
6283
|
checked: config?.showValueLabel,
|
|
4838
6284
|
onChange: toggleShowValueLabel,
|
|
4839
6285
|
label: "Show value label"
|
|
4840
6286
|
}
|
|
4841
6287
|
),
|
|
4842
|
-
/* @__PURE__ */ (0,
|
|
4843
|
-
|
|
6288
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6289
|
+
import_ui_core23.Checkbox,
|
|
4844
6290
|
{
|
|
4845
6291
|
checked: config?.tooltipTotal,
|
|
4846
6292
|
onChange: toggleTooltipTotal,
|
|
@@ -4853,285 +6299,11 @@ var ValueControls = ({
|
|
|
4853
6299
|
);
|
|
4854
6300
|
};
|
|
4855
6301
|
|
|
4856
|
-
// src/charts/options/YaxisControls.tsx
|
|
4857
|
-
var import_lodash8 = require("lodash");
|
|
4858
|
-
var import_ui_core19 = require("@sentio/ui-core");
|
|
4859
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4860
|
-
var initialConfig2 = {
|
|
4861
|
-
yAxis: {
|
|
4862
|
-
min: "",
|
|
4863
|
-
max: "",
|
|
4864
|
-
scale: true,
|
|
4865
|
-
stack: ""
|
|
4866
|
-
}
|
|
4867
|
-
};
|
|
4868
|
-
function YaxisControls({
|
|
4869
|
-
yAxis,
|
|
4870
|
-
setYAxis,
|
|
4871
|
-
defaultOpen,
|
|
4872
|
-
columnSelect,
|
|
4873
|
-
supportSetName = true,
|
|
4874
|
-
supportSetMinMax = true,
|
|
4875
|
-
supportStackSeries = true,
|
|
4876
|
-
supportAlwaysShowZero = true,
|
|
4877
|
-
supportReset = true,
|
|
4878
|
-
panelTitle = "Y-Axis Controls"
|
|
4879
|
-
}) {
|
|
4880
|
-
yAxis = (0, import_lodash8.defaults)(yAxis || {}, initialConfig2.yAxis);
|
|
4881
|
-
const onChangeInput = (field) => (event) => {
|
|
4882
|
-
const { value } = event.target;
|
|
4883
|
-
setYAxis({
|
|
4884
|
-
...yAxis,
|
|
4885
|
-
[field]: value || void 0,
|
|
4886
|
-
scale: field == "min" && value > "0" ? true : yAxis?.scale
|
|
4887
|
-
});
|
|
4888
|
-
};
|
|
4889
|
-
const onToggleZero = (checked) => {
|
|
4890
|
-
setYAxis({ ...yAxis, scale: !checked, min: checked ? "" : yAxis?.min });
|
|
4891
|
-
};
|
|
4892
|
-
const onClickResetYAxis = () => {
|
|
4893
|
-
setYAxis(initialConfig2.yAxis);
|
|
4894
|
-
};
|
|
4895
|
-
const onToggleStack = (checked) => {
|
|
4896
|
-
setYAxis({ ...yAxis, stacked: checked ? "samesign" : "" });
|
|
4897
|
-
};
|
|
4898
|
-
const minMaxLabelCls = "inline-flex items-center border border-r-0 sm:text-icontent border-main bg-gray-50 px-2 rounded-l-md";
|
|
4899
|
-
const minMaxInputCls = "border focus:border-primary-500 rounded-r-md sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30";
|
|
4900
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4901
|
-
import_ui_core19.DisclosurePanel,
|
|
4902
|
-
{
|
|
4903
|
-
title: panelTitle,
|
|
4904
|
-
defaultOpen,
|
|
4905
|
-
containerClassName: "w-full bg-default-bg",
|
|
4906
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-icontent flex flex-wrap gap-[10px]", children: [
|
|
4907
|
-
supportSetName && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
4908
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Name" }),
|
|
4909
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4910
|
-
"input",
|
|
4911
|
-
{
|
|
4912
|
-
type: "text",
|
|
4913
|
-
className: "focus:border-primary-500 sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 w-40 rounded-r-md border",
|
|
4914
|
-
value: yAxis?.name,
|
|
4915
|
-
placeholder: "Axis Name",
|
|
4916
|
-
onChange: onChangeInput("name")
|
|
4917
|
-
}
|
|
4918
|
-
)
|
|
4919
|
-
] }),
|
|
4920
|
-
columnSelect && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "inline-flex h-8", children: [
|
|
4921
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AddonLabel, { className: "rounded-l-md border px-2", children: "Column" }),
|
|
4922
|
-
columnSelect
|
|
4923
|
-
] }),
|
|
4924
|
-
supportSetMinMax && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
4925
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
4926
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: minMaxLabelCls, children: "Min" }),
|
|
4927
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4928
|
-
"input",
|
|
4929
|
-
{
|
|
4930
|
-
type: "text",
|
|
4931
|
-
className: minMaxInputCls,
|
|
4932
|
-
style: { width: "10em" },
|
|
4933
|
-
value: yAxis.min,
|
|
4934
|
-
placeholder: "Auto",
|
|
4935
|
-
onChange: onChangeInput("min")
|
|
4936
|
-
}
|
|
4937
|
-
)
|
|
4938
|
-
] }),
|
|
4939
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
4940
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: minMaxLabelCls, children: "Max" }),
|
|
4941
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4942
|
-
"input",
|
|
4943
|
-
{
|
|
4944
|
-
type: "text",
|
|
4945
|
-
className: minMaxInputCls,
|
|
4946
|
-
style: { width: "10em" },
|
|
4947
|
-
value: yAxis.max,
|
|
4948
|
-
placeholder: "Auto",
|
|
4949
|
-
onChange: onChangeInput("max")
|
|
4950
|
-
}
|
|
4951
|
-
)
|
|
4952
|
-
] })
|
|
4953
|
-
] }),
|
|
4954
|
-
supportStackSeries && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4955
|
-
import_ui_core19.Checkbox,
|
|
4956
|
-
{
|
|
4957
|
-
checked: !!yAxis?.stacked,
|
|
4958
|
-
onChange: onToggleStack,
|
|
4959
|
-
label: "Stack series"
|
|
4960
|
-
}
|
|
4961
|
-
),
|
|
4962
|
-
supportAlwaysShowZero && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4963
|
-
import_ui_core19.Checkbox,
|
|
4964
|
-
{
|
|
4965
|
-
checked: !yAxis.scale,
|
|
4966
|
-
onChange: onToggleZero,
|
|
4967
|
-
label: "Always show zero"
|
|
4968
|
-
}
|
|
4969
|
-
),
|
|
4970
|
-
supportReset && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_ui_core19.Button, { type: "button", role: "link", onClick: onClickResetYAxis, children: "Reset" })
|
|
4971
|
-
] })
|
|
4972
|
-
}
|
|
4973
|
-
);
|
|
4974
|
-
}
|
|
4975
|
-
|
|
4976
|
-
// src/charts/options/XaxisControls.tsx
|
|
4977
|
-
var import_ui_core20 = require("@sentio/ui-core");
|
|
4978
|
-
var import_lu6 = require("react-icons/lu");
|
|
4979
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4980
|
-
var TypeSelect = import_ui_core20.Select;
|
|
4981
|
-
var SortSelect = import_ui_core20.Select;
|
|
4982
|
-
var OrderSelect = import_ui_core20.Select;
|
|
4983
|
-
var sortByItems2 = [
|
|
4984
|
-
{ label: "Name", value: "ByName" },
|
|
4985
|
-
{ label: "Value", value: "ByValue" }
|
|
4986
|
-
];
|
|
4987
|
-
var orderItems2 = [
|
|
4988
|
-
{ label: "Ascendant", value: false },
|
|
4989
|
-
{ label: "Descendant", value: true }
|
|
4990
|
-
];
|
|
4991
|
-
var XAxisControls = ({
|
|
4992
|
-
xAxis,
|
|
4993
|
-
setXAxis,
|
|
4994
|
-
defaultOpen,
|
|
4995
|
-
columnSelect,
|
|
4996
|
-
columnIsNonTime,
|
|
4997
|
-
panelTitle = "X-Axis Controls",
|
|
4998
|
-
supportName = true,
|
|
4999
|
-
supportSort,
|
|
5000
|
-
supportSetType
|
|
5001
|
-
}) => {
|
|
5002
|
-
const onChangeInput = (field) => (event) => {
|
|
5003
|
-
const { value } = event.target;
|
|
5004
|
-
setXAxis({ ...xAxis, [field]: value || void 0 });
|
|
5005
|
-
};
|
|
5006
|
-
const onClickResetXAxis = () => {
|
|
5007
|
-
setXAxis(void 0);
|
|
5008
|
-
};
|
|
5009
|
-
const isXAixsNoneTime = xAxis && xAxis.column && columnIsNonTime;
|
|
5010
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5011
|
-
import_ui_core20.DisclosurePanel,
|
|
5012
|
-
{
|
|
5013
|
-
title: panelTitle,
|
|
5014
|
-
defaultOpen,
|
|
5015
|
-
containerClassName: "w-full bg-default-bg",
|
|
5016
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "text-icontent flex flex-wrap gap-[10px]", children: [
|
|
5017
|
-
supportName && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
5018
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Name" }),
|
|
5019
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5020
|
-
"input",
|
|
5021
|
-
{
|
|
5022
|
-
type: "text",
|
|
5023
|
-
className: "sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 w-40 rounded-r-md",
|
|
5024
|
-
value: xAxis?.name,
|
|
5025
|
-
placeholder: "Axis Name",
|
|
5026
|
-
onChange: onChangeInput("name")
|
|
5027
|
-
}
|
|
5028
|
-
)
|
|
5029
|
-
] }),
|
|
5030
|
-
supportSetType && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "inline-flex h-8", children: [
|
|
5031
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2", children: [
|
|
5032
|
-
"X-Axis Type",
|
|
5033
|
-
" ",
|
|
5034
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5035
|
-
import_ui_core20.PopoverTooltip,
|
|
5036
|
-
{
|
|
5037
|
-
strategy: "fixed",
|
|
5038
|
-
hideArrow: true,
|
|
5039
|
-
placementOption: "bottom",
|
|
5040
|
-
text: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "text-text-foreground max-w-[300px] p-2", children: [
|
|
5041
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-medium", children: "Discrete axis" }),
|
|
5042
|
-
" displays",
|
|
5043
|
-
" ",
|
|
5044
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-primary-600", children: "discrete values evenly" }),
|
|
5045
|
-
", while ",
|
|
5046
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-medium", children: "Continuous axis" }),
|
|
5047
|
-
" ",
|
|
5048
|
-
"shows",
|
|
5049
|
-
" ",
|
|
5050
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-primary-600", children: "continuous time series" }),
|
|
5051
|
-
" ",
|
|
5052
|
-
"and",
|
|
5053
|
-
" ",
|
|
5054
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-primary-600", children: "auto-fills missing time points" })
|
|
5055
|
-
] }),
|
|
5056
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lu6.LuInfo, { className: "text-text-foreground-secondary h-4 w-4" })
|
|
5057
|
-
}
|
|
5058
|
-
)
|
|
5059
|
-
] }),
|
|
5060
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5061
|
-
TypeSelect,
|
|
5062
|
-
{
|
|
5063
|
-
className: "h-8 w-40",
|
|
5064
|
-
buttonClassName: "h-full border-main rounded-l-none items-center inline-flex items-center",
|
|
5065
|
-
value: xAxis?.type || "time",
|
|
5066
|
-
onChange: (val) => {
|
|
5067
|
-
setXAxis({ ...xAxis, type: val });
|
|
5068
|
-
},
|
|
5069
|
-
options: [
|
|
5070
|
-
{ label: "Continuous", value: "time" },
|
|
5071
|
-
{ label: "Discrete", value: "category" }
|
|
5072
|
-
]
|
|
5073
|
-
}
|
|
5074
|
-
)
|
|
5075
|
-
] }),
|
|
5076
|
-
columnSelect && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "inline-flex h-8", children: [
|
|
5077
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel, { className: "rounded-l-md border px-2", children: "Column" }),
|
|
5078
|
-
columnSelect
|
|
5079
|
-
] }),
|
|
5080
|
-
supportSort && isXAixsNoneTime && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "inline-flex h-8", children: [
|
|
5081
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Sort By" }),
|
|
5082
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5083
|
-
SortSelect,
|
|
5084
|
-
{
|
|
5085
|
-
className: "h-8 w-20 leading-8",
|
|
5086
|
-
buttonClassName: "h-full border-main rounded-none inline-flex items-center",
|
|
5087
|
-
options: sortByItems2,
|
|
5088
|
-
value: xAxis?.sort?.sortBy,
|
|
5089
|
-
onChange: (value) => {
|
|
5090
|
-
setXAxis({
|
|
5091
|
-
...xAxis,
|
|
5092
|
-
sort: { ...xAxis?.sort, sortBy: value }
|
|
5093
|
-
});
|
|
5094
|
-
},
|
|
5095
|
-
placeholder: "Sort By"
|
|
5096
|
-
}
|
|
5097
|
-
),
|
|
5098
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5099
|
-
OrderSelect,
|
|
5100
|
-
{
|
|
5101
|
-
className: "h-8 w-40 leading-8",
|
|
5102
|
-
buttonClassName: "h-full border-l-0 border-main rounded-l-none inline-flex items-center",
|
|
5103
|
-
options: orderItems2,
|
|
5104
|
-
value: xAxis?.sort?.orderDesc,
|
|
5105
|
-
onChange: (value) => {
|
|
5106
|
-
setXAxis({
|
|
5107
|
-
...xAxis,
|
|
5108
|
-
sort: { ...xAxis?.sort, orderDesc: value }
|
|
5109
|
-
});
|
|
5110
|
-
},
|
|
5111
|
-
placeholder: "Sort Order"
|
|
5112
|
-
}
|
|
5113
|
-
)
|
|
5114
|
-
] }),
|
|
5115
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5116
|
-
import_ui_core20.Button,
|
|
5117
|
-
{
|
|
5118
|
-
type: "button",
|
|
5119
|
-
role: "link",
|
|
5120
|
-
onClick: onClickResetXAxis,
|
|
5121
|
-
className: "h-8",
|
|
5122
|
-
children: "Reset"
|
|
5123
|
-
}
|
|
5124
|
-
)
|
|
5125
|
-
] })
|
|
5126
|
-
}
|
|
5127
|
-
);
|
|
5128
|
-
};
|
|
5129
|
-
|
|
5130
6302
|
// src/charts/options/MarkerControls.tsx
|
|
5131
6303
|
var import_immer11 = require("immer");
|
|
5132
|
-
var
|
|
5133
|
-
var
|
|
5134
|
-
var
|
|
6304
|
+
var import_lu8 = require("react-icons/lu");
|
|
6305
|
+
var import_ui_core24 = require("@sentio/ui-core");
|
|
6306
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5135
6307
|
var labelCls = "inline-flex items-center border border-r-0 sm:text-icontent border-main bg-gray-50 px-2 rounded-l-md";
|
|
5136
6308
|
var inputCls = "border focus:border-primary-500 rounded-r-md sm:text-icontent border-main w-28 hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30";
|
|
5137
6309
|
function MarkerInput({
|
|
@@ -5148,25 +6320,25 @@ function MarkerInput({
|
|
|
5148
6320
|
})
|
|
5149
6321
|
);
|
|
5150
6322
|
};
|
|
5151
|
-
return /* @__PURE__ */ (0,
|
|
5152
|
-
/* @__PURE__ */ (0,
|
|
5153
|
-
/* @__PURE__ */ (0,
|
|
5154
|
-
/* @__PURE__ */ (0,
|
|
5155
|
-
/* @__PURE__ */ (0,
|
|
6323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-[10px]", children: [
|
|
6324
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
6325
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: labelCls, children: [
|
|
6326
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pr-2", children: label }),
|
|
6327
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
5156
6328
|
"select",
|
|
5157
6329
|
{
|
|
5158
6330
|
className: "sm:text-ilabel border-main text-text-foreground inline-flex h-full items-center border border-b-0 border-t-0 bg-gray-50 p-0 pl-4 pr-7 focus:border-transparent focus:ring-inset",
|
|
5159
6331
|
value: marker.type,
|
|
5160
6332
|
onChange: (e) => _onChange("type", e.target.value),
|
|
5161
6333
|
children: [
|
|
5162
|
-
/* @__PURE__ */ (0,
|
|
5163
|
-
/* @__PURE__ */ (0,
|
|
6334
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "LINE", children: "horizontal line" }),
|
|
6335
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "LINEX", children: "vertical line" })
|
|
5164
6336
|
]
|
|
5165
6337
|
}
|
|
5166
6338
|
),
|
|
5167
|
-
/* @__PURE__ */ (0,
|
|
6339
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pl-2", children: "at" })
|
|
5168
6340
|
] }),
|
|
5169
|
-
marker.type === "LINEX" ? /* @__PURE__ */ (0,
|
|
6341
|
+
marker.type === "LINEX" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5170
6342
|
"input",
|
|
5171
6343
|
{
|
|
5172
6344
|
className: inputCls,
|
|
@@ -5175,7 +6347,7 @@ function MarkerInput({
|
|
|
5175
6347
|
placeholder: "YYYY-MM-DD",
|
|
5176
6348
|
onChange: (e) => _onChange("valueX", e.target.value)
|
|
5177
6349
|
}
|
|
5178
|
-
) : /* @__PURE__ */ (0,
|
|
6350
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5179
6351
|
"input",
|
|
5180
6352
|
{
|
|
5181
6353
|
className: inputCls,
|
|
@@ -5185,11 +6357,11 @@ function MarkerInput({
|
|
|
5185
6357
|
}
|
|
5186
6358
|
)
|
|
5187
6359
|
] }),
|
|
5188
|
-
/* @__PURE__ */ (0,
|
|
5189
|
-
/* @__PURE__ */ (0,
|
|
5190
|
-
/* @__PURE__ */ (0,
|
|
5191
|
-
/* @__PURE__ */ (0,
|
|
5192
|
-
/* @__PURE__ */ (0,
|
|
6360
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
6361
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: labelCls, children: "Color" }),
|
|
6362
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "relative", children: [
|
|
6363
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "absolute inset-0 flex w-8 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "h-4 w-4", style: { background: marker.color } }) }),
|
|
6364
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5193
6365
|
"input",
|
|
5194
6366
|
{
|
|
5195
6367
|
className: inputCls + " pl-8",
|
|
@@ -5200,9 +6372,9 @@ function MarkerInput({
|
|
|
5200
6372
|
)
|
|
5201
6373
|
] })
|
|
5202
6374
|
] }),
|
|
5203
|
-
/* @__PURE__ */ (0,
|
|
5204
|
-
/* @__PURE__ */ (0,
|
|
5205
|
-
/* @__PURE__ */ (0,
|
|
6375
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
6376
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: labelCls, children: "Label" }),
|
|
6377
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5206
6378
|
"input",
|
|
5207
6379
|
{
|
|
5208
6380
|
className: inputCls,
|
|
@@ -5212,15 +6384,15 @@ function MarkerInput({
|
|
|
5212
6384
|
}
|
|
5213
6385
|
)
|
|
5214
6386
|
] }),
|
|
5215
|
-
/* @__PURE__ */ (0,
|
|
6387
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5216
6388
|
"button",
|
|
5217
6389
|
{
|
|
5218
6390
|
type: "button",
|
|
5219
6391
|
className: "ml-2 flex h-4 w-4 cursor-pointer items-center justify-center rounded-full bg-gray-800 hover:bg-red-600",
|
|
5220
6392
|
"aria-label": "Remove marker",
|
|
5221
6393
|
onClick: onRemove,
|
|
5222
|
-
children: /* @__PURE__ */ (0,
|
|
5223
|
-
|
|
6394
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6395
|
+
import_lu8.LuMinus,
|
|
5224
6396
|
{
|
|
5225
6397
|
className: "dark:text-default-bg h-3 w-3 text-white",
|
|
5226
6398
|
"aria-hidden": "true"
|
|
@@ -5254,14 +6426,14 @@ function MarkerControls({ markers, onChange }) {
|
|
|
5254
6426
|
})
|
|
5255
6427
|
);
|
|
5256
6428
|
};
|
|
5257
|
-
return /* @__PURE__ */ (0,
|
|
5258
|
-
|
|
6429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6430
|
+
import_ui_core24.DisclosurePanel,
|
|
5259
6431
|
{
|
|
5260
6432
|
title: "Markers",
|
|
5261
6433
|
containerClassName: "w-full bg-default-bg",
|
|
5262
6434
|
defaultOpen: true,
|
|
5263
|
-
children: /* @__PURE__ */ (0,
|
|
5264
|
-
_markers.map((marker, index) => /* @__PURE__ */ (0,
|
|
6435
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "space-y-2", children: [
|
|
6436
|
+
_markers.map((marker, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5265
6437
|
MarkerInput,
|
|
5266
6438
|
{
|
|
5267
6439
|
marker,
|
|
@@ -5271,8 +6443,8 @@ function MarkerControls({ markers, onChange }) {
|
|
|
5271
6443
|
},
|
|
5272
6444
|
index
|
|
5273
6445
|
)),
|
|
5274
|
-
/* @__PURE__ */ (0,
|
|
5275
|
-
/* @__PURE__ */ (0,
|
|
6446
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_ui_core24.Button, { type: "button", onClick: onAdd, children: [
|
|
6447
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lu8.LuPlus, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
5276
6448
|
"Add Marker"
|
|
5277
6449
|
] }) })
|
|
5278
6450
|
] })
|
|
@@ -5282,9 +6454,9 @@ function MarkerControls({ markers, onChange }) {
|
|
|
5282
6454
|
|
|
5283
6455
|
// src/charts/options/DataControls.tsx
|
|
5284
6456
|
var import_immer12 = require("immer");
|
|
5285
|
-
var
|
|
5286
|
-
var
|
|
5287
|
-
var
|
|
6457
|
+
var import_lodash10 = require("lodash");
|
|
6458
|
+
var import_ui_core25 = require("@sentio/ui-core");
|
|
6459
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5288
6460
|
var defaultConfig5 = {
|
|
5289
6461
|
seriesLimit: void 0
|
|
5290
6462
|
};
|
|
@@ -5294,7 +6466,7 @@ function DataControls({
|
|
|
5294
6466
|
chartConfig,
|
|
5295
6467
|
defaultSeriesLimit = 20
|
|
5296
6468
|
}) {
|
|
5297
|
-
const config = (0,
|
|
6469
|
+
const config = (0, import_lodash10.defaults)(chartConfig?.dataConfig, defaultConfig5);
|
|
5298
6470
|
const currentSeriesLimit = config?.seriesLimit || chartConfig?.tableConfig?.rowLimit;
|
|
5299
6471
|
function onSeriesLimitChange(e) {
|
|
5300
6472
|
const value = parseInt(e.target.value);
|
|
@@ -5312,15 +6484,15 @@ function DataControls({
|
|
|
5312
6484
|
e.preventDefault();
|
|
5313
6485
|
}
|
|
5314
6486
|
}
|
|
5315
|
-
return /* @__PURE__ */ (0,
|
|
5316
|
-
|
|
6487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6488
|
+
import_ui_core25.DisclosurePanel,
|
|
5317
6489
|
{
|
|
5318
6490
|
title: "Data Options",
|
|
5319
6491
|
defaultOpen,
|
|
5320
6492
|
containerClassName: "w-full bg-default-bg",
|
|
5321
|
-
children: /* @__PURE__ */ (0,
|
|
5322
|
-
/* @__PURE__ */ (0,
|
|
5323
|
-
/* @__PURE__ */ (0,
|
|
6493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex h-8", children: [
|
|
6494
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-3", children: "Max Series Limit" }),
|
|
6495
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5324
6496
|
"input",
|
|
5325
6497
|
{
|
|
5326
6498
|
type: "number",
|
|
@@ -5339,10 +6511,10 @@ function DataControls({
|
|
|
5339
6511
|
|
|
5340
6512
|
// src/charts/options/ScatterControls.tsx
|
|
5341
6513
|
var import_immer13 = require("immer");
|
|
5342
|
-
var
|
|
5343
|
-
var
|
|
5344
|
-
var
|
|
5345
|
-
var
|
|
6514
|
+
var import_lodash11 = require("lodash");
|
|
6515
|
+
var import_react23 = require("react");
|
|
6516
|
+
var import_ui_core26 = require("@sentio/ui-core");
|
|
6517
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5346
6518
|
var defaultConfig6 = {
|
|
5347
6519
|
minSize: 5,
|
|
5348
6520
|
maxSize: 30
|
|
@@ -5354,57 +6526,57 @@ function ScatterControls({
|
|
|
5354
6526
|
columnSelect,
|
|
5355
6527
|
colorPicker
|
|
5356
6528
|
}) {
|
|
5357
|
-
config = (0,
|
|
5358
|
-
const onSymbolSizeColumnChange = (0,
|
|
6529
|
+
config = (0, import_lodash11.defaults)(config, defaultConfig6);
|
|
6530
|
+
const onSymbolSizeColumnChange = (0, import_react23.useCallback)(
|
|
5359
6531
|
(column) => {
|
|
5360
6532
|
config && onChange((0, import_immer13.produce)(config, (draft) => void (draft.symbolSize = column)));
|
|
5361
6533
|
},
|
|
5362
6534
|
[config, onChange]
|
|
5363
6535
|
);
|
|
5364
|
-
const onSymbolColorChange = (0,
|
|
6536
|
+
const onSymbolColorChange = (0, import_react23.useCallback)(
|
|
5365
6537
|
(color) => {
|
|
5366
6538
|
config && onChange((0, import_immer13.produce)(config, (draft) => void (draft.color = color)));
|
|
5367
6539
|
},
|
|
5368
6540
|
[config, onChange]
|
|
5369
6541
|
);
|
|
5370
|
-
const onMinSizeChange = (0,
|
|
6542
|
+
const onMinSizeChange = (0, import_react23.useCallback)(
|
|
5371
6543
|
(event) => {
|
|
5372
6544
|
const value = parseInt(event.target.value) || 5;
|
|
5373
6545
|
config && onChange((0, import_immer13.produce)(config, (draft) => void (draft.minSize = value)));
|
|
5374
6546
|
},
|
|
5375
6547
|
[config, onChange]
|
|
5376
6548
|
);
|
|
5377
|
-
const onMaxSizeChange = (0,
|
|
6549
|
+
const onMaxSizeChange = (0, import_react23.useCallback)(
|
|
5378
6550
|
(event) => {
|
|
5379
6551
|
const value = parseInt(event.target.value) || 50;
|
|
5380
6552
|
config && onChange((0, import_immer13.produce)(config, (draft) => void (draft.maxSize = value)));
|
|
5381
6553
|
},
|
|
5382
6554
|
[config, onChange]
|
|
5383
6555
|
);
|
|
5384
|
-
return /* @__PURE__ */ (0,
|
|
5385
|
-
|
|
6556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6557
|
+
import_ui_core26.DisclosurePanel,
|
|
5386
6558
|
{
|
|
5387
6559
|
title: "Scatter Chart Options",
|
|
5388
6560
|
defaultOpen,
|
|
5389
6561
|
containerClassName: "w-full bg-default-bg",
|
|
5390
|
-
children: /* @__PURE__ */ (0,
|
|
5391
|
-
columnSelect && /* @__PURE__ */ (0,
|
|
5392
|
-
/* @__PURE__ */ (0,
|
|
6562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
6563
|
+
columnSelect && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
6564
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Size By Column" }),
|
|
5393
6565
|
columnSelect({
|
|
5394
6566
|
value: config.symbolSize,
|
|
5395
6567
|
onChange: onSymbolSizeColumnChange
|
|
5396
6568
|
})
|
|
5397
6569
|
] }),
|
|
5398
|
-
colorPicker && /* @__PURE__ */ (0,
|
|
5399
|
-
/* @__PURE__ */ (0,
|
|
6570
|
+
colorPicker && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Size Color Mapping" }),
|
|
5400
6572
|
colorPicker({
|
|
5401
6573
|
value: config.color,
|
|
5402
6574
|
onChange: onSymbolColorChange
|
|
5403
6575
|
})
|
|
5404
6576
|
] }),
|
|
5405
|
-
/* @__PURE__ */ (0,
|
|
5406
|
-
/* @__PURE__ */ (0,
|
|
5407
|
-
/* @__PURE__ */ (0,
|
|
6577
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
6578
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Min Size" }),
|
|
6579
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5408
6580
|
"input",
|
|
5409
6581
|
{
|
|
5410
6582
|
name: "minSize",
|
|
@@ -5417,9 +6589,9 @@ function ScatterControls({
|
|
|
5417
6589
|
}
|
|
5418
6590
|
)
|
|
5419
6591
|
] }),
|
|
5420
|
-
/* @__PURE__ */ (0,
|
|
5421
|
-
/* @__PURE__ */ (0,
|
|
5422
|
-
/* @__PURE__ */ (0,
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
6593
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Max Size" }),
|
|
6594
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5423
6595
|
"input",
|
|
5424
6596
|
{
|
|
5425
6597
|
name: "maxSize",
|
|
@@ -5475,6 +6647,7 @@ function ScatterControls({
|
|
|
5475
6647
|
ScatterIcon,
|
|
5476
6648
|
SystemLabels,
|
|
5477
6649
|
TableIcon,
|
|
6650
|
+
TimeSeriesChart,
|
|
5478
6651
|
ValueControls,
|
|
5479
6652
|
ValueFormatters,
|
|
5480
6653
|
ValueOptions,
|