@sentio/ui-dashboard 0.2.9 → 0.3.1
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 +102 -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 +1677 -505
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1691 -497
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -4
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,1471 @@ 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
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5302
|
+
"div",
|
|
5303
|
+
{
|
|
5304
|
+
className: "h-full w-full",
|
|
5305
|
+
onMouseOver: () => {
|
|
5306
|
+
setActive(true);
|
|
5307
|
+
},
|
|
5308
|
+
onMouseOut: () => {
|
|
5309
|
+
setActive(false);
|
|
5310
|
+
},
|
|
5311
|
+
children: [
|
|
5312
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5313
|
+
ReactEChartsBase,
|
|
5314
|
+
{
|
|
5315
|
+
ref,
|
|
5316
|
+
loading,
|
|
5317
|
+
group,
|
|
5318
|
+
option: options,
|
|
5319
|
+
minHeight,
|
|
5320
|
+
returnedSeries,
|
|
5321
|
+
totalSeries,
|
|
5322
|
+
onSelect,
|
|
5323
|
+
onClick: allowClick ? onClick : void 0,
|
|
5324
|
+
style,
|
|
5325
|
+
onSeriesEvent,
|
|
5326
|
+
noLegend,
|
|
5327
|
+
onInitChart
|
|
5328
|
+
}
|
|
5329
|
+
),
|
|
5330
|
+
controls && nonXAxis && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(XAxisControls, { xAxis, setXAxis, defaultOpen: true }),
|
|
5331
|
+
controls && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(YaxisControls, { yAxis, setYAxis: setYAxisWrap }),
|
|
5332
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute left-0 top-0", ref: chartPositionRef }),
|
|
5333
|
+
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)(
|
|
5334
|
+
"div",
|
|
5335
|
+
{
|
|
5336
|
+
ref: refs.setFloating,
|
|
5337
|
+
className: "border-border-color bg-default-bg min-w-64 absolute w-fit divide-y rounded-md border pb-2 shadow-sm",
|
|
5338
|
+
style: {
|
|
5339
|
+
position: strategy,
|
|
5340
|
+
top: 0,
|
|
5341
|
+
left: 0,
|
|
5342
|
+
transform: `translate(${roundByDPR(x || 0)}px,${roundByDPR(y || 0)}px)`
|
|
5343
|
+
},
|
|
5344
|
+
onClick: onClickPreventDefault,
|
|
5345
|
+
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 }) })
|
|
5346
|
+
}
|
|
5347
|
+
) }) })
|
|
5348
|
+
]
|
|
5349
|
+
}
|
|
5350
|
+
);
|
|
5351
|
+
}
|
|
5352
|
+
);
|
|
5353
|
+
TimeSeriesChart.displayName = "TimeSeriesChart";
|
|
5354
|
+
function computeMarkLines(series, markLines) {
|
|
5355
|
+
if (markLines && markLines.length > 0 && series.length > 0) {
|
|
5356
|
+
series[0] = {
|
|
5357
|
+
...series[0],
|
|
5358
|
+
markLine: {
|
|
5359
|
+
symbol: [],
|
|
5360
|
+
data: markLines.map((area) => {
|
|
5361
|
+
if (area.from || area.to) {
|
|
5362
|
+
return [
|
|
5363
|
+
{
|
|
5364
|
+
name: "threshold",
|
|
5365
|
+
xAxis: area.from,
|
|
5366
|
+
yAxis: area.value ?? "min",
|
|
5367
|
+
symbol: "react",
|
|
5368
|
+
symbolSize: [20, 1],
|
|
5369
|
+
symbolOffset: [area.below ? -10 : 10, 0],
|
|
5370
|
+
label: {
|
|
5371
|
+
formatter: `${area.label}`,
|
|
5372
|
+
position: area.below ? "insideMiddleBottom" : "insideMiddleTop",
|
|
5373
|
+
color: area.color || "#ff0000"
|
|
5374
|
+
},
|
|
5375
|
+
lineStyle: {
|
|
5376
|
+
color: area.color || "#ff0000"
|
|
5377
|
+
}
|
|
5378
|
+
},
|
|
5379
|
+
{
|
|
5380
|
+
symbol: "rect",
|
|
5381
|
+
symbolSize: [20, 1],
|
|
5382
|
+
symbolOffset: [area.below ? 10 : -10, 0],
|
|
5383
|
+
xAxis: area.to ? area.to : void 0,
|
|
5384
|
+
yAxis: area.value ?? "max"
|
|
5385
|
+
}
|
|
5386
|
+
];
|
|
5387
|
+
} else {
|
|
5388
|
+
return {
|
|
5389
|
+
name: "threshold",
|
|
5390
|
+
yAxis: area.value,
|
|
5391
|
+
symbol: "react",
|
|
5392
|
+
symbolSize: [20, 1],
|
|
5393
|
+
symbolOffset: [area.below ? -10 : 10, 0],
|
|
5394
|
+
label: {
|
|
5395
|
+
formatter: `${area.label}`,
|
|
5396
|
+
position: area.below ? "insideStartBottom" : "insideStartTop",
|
|
5397
|
+
color: area.color || "#ff0000"
|
|
5398
|
+
},
|
|
5399
|
+
lineStyle: {
|
|
5400
|
+
color: area.color || "#ff0000"
|
|
5401
|
+
}
|
|
5402
|
+
};
|
|
5403
|
+
}
|
|
5404
|
+
})
|
|
5405
|
+
}
|
|
5406
|
+
};
|
|
5407
|
+
}
|
|
5408
|
+
}
|
|
5409
|
+
function computeMarksAreas(series, markAreas) {
|
|
5410
|
+
if (markAreas && markAreas.length > 0 && series.length > 0) {
|
|
5411
|
+
series[0].markArea = {
|
|
5412
|
+
itemStyle: {
|
|
5413
|
+
color: markAreas[0].color || "rgba(255, 173, 177, 0.4)"
|
|
5414
|
+
}
|
|
5415
|
+
};
|
|
5416
|
+
series[0].markArea.data = markAreas.map((markArea) => {
|
|
5417
|
+
return [
|
|
5418
|
+
{
|
|
5419
|
+
xAxis: markArea.from ? markArea.from : void 0
|
|
5420
|
+
},
|
|
5421
|
+
{
|
|
5422
|
+
xAxis: markArea.to ? markArea.to : void 0
|
|
5423
|
+
}
|
|
5424
|
+
];
|
|
5425
|
+
});
|
|
5426
|
+
}
|
|
5427
|
+
}
|
|
5428
|
+
var MIN_SIZE = 5;
|
|
5429
|
+
var MAX_SIZE = 30;
|
|
5430
|
+
var LEVELS = 10;
|
|
5431
|
+
function normalize(value, min, max, minSize = MIN_SIZE, maxSize = MAX_SIZE) {
|
|
5432
|
+
if (max === min) return MIN_SIZE;
|
|
5433
|
+
if (value <= min) return minSize;
|
|
5434
|
+
if (value >= max) return maxSize;
|
|
5435
|
+
const range = max - min;
|
|
5436
|
+
const levelRange = range / LEVELS;
|
|
5437
|
+
const sizeIncrement = (maxSize - minSize) / (LEVELS - 1);
|
|
5438
|
+
const level = Math.floor((value - min) / levelRange);
|
|
5439
|
+
const clampedLevel = Math.min(level, LEVELS - 1);
|
|
5440
|
+
return minSize + clampedLevel * sizeIncrement;
|
|
5441
|
+
}
|
|
5442
|
+
|
|
3981
5443
|
// src/charts/options/LineControls.tsx
|
|
3982
5444
|
var import_immer4 = require("immer");
|
|
3983
|
-
var
|
|
3984
|
-
var
|
|
5445
|
+
var import_ui_core17 = require("@sentio/ui-core");
|
|
5446
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3985
5447
|
var lineStyles = [
|
|
3986
5448
|
{ label: "Solid", value: "Solid" },
|
|
3987
5449
|
{ label: "Dotted", value: "Dotted" }
|
|
@@ -4001,14 +5463,14 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
4001
5463
|
})
|
|
4002
5464
|
);
|
|
4003
5465
|
};
|
|
4004
|
-
return /* @__PURE__ */ (0,
|
|
4005
|
-
|
|
5466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5467
|
+
import_ui_core17.DisclosurePanel,
|
|
4006
5468
|
{
|
|
4007
5469
|
title: "Line style",
|
|
4008
5470
|
containerClassName: "w-full bg-default-bg",
|
|
4009
|
-
children: /* @__PURE__ */ (0,
|
|
4010
|
-
/* @__PURE__ */ (0,
|
|
4011
|
-
|
|
5471
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
5472
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5473
|
+
import_ui_core17.NewButtonGroup,
|
|
4012
5474
|
{
|
|
4013
5475
|
buttons: lineStyles,
|
|
4014
5476
|
value: config?.style || "Solid",
|
|
@@ -4016,8 +5478,8 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
4016
5478
|
small: true
|
|
4017
5479
|
}
|
|
4018
5480
|
),
|
|
4019
|
-
/* @__PURE__ */ (0,
|
|
4020
|
-
|
|
5481
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5482
|
+
import_ui_core17.Checkbox,
|
|
4021
5483
|
{
|
|
4022
5484
|
label: "Smooth Curves",
|
|
4023
5485
|
checked: config?.smooth,
|
|
@@ -4030,16 +5492,16 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
4030
5492
|
};
|
|
4031
5493
|
|
|
4032
5494
|
// src/charts/options/LabelControls.tsx
|
|
4033
|
-
var
|
|
5495
|
+
var import_react22 = require("react");
|
|
4034
5496
|
var import_immer5 = require("immer");
|
|
4035
|
-
var
|
|
4036
|
-
var
|
|
4037
|
-
var
|
|
5497
|
+
var import_ui_core18 = require("@sentio/ui-core");
|
|
5498
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5499
|
+
var initialConfig3 = {
|
|
4038
5500
|
columns: [],
|
|
4039
5501
|
alias: ""
|
|
4040
5502
|
};
|
|
4041
5503
|
var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
4042
|
-
(0,
|
|
5504
|
+
(0, import_react22.useEffect)(() => {
|
|
4043
5505
|
if (config?.columns && config.columns.length > 0 && !config.alias) {
|
|
4044
5506
|
const aliasParts = [];
|
|
4045
5507
|
config.columns.forEach((colConfig) => {
|
|
@@ -4064,36 +5526,36 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
4064
5526
|
}, [config, setConfig]);
|
|
4065
5527
|
const onAliasChanged = (alias) => {
|
|
4066
5528
|
setConfig(
|
|
4067
|
-
(0, import_immer5.produce)(config ??
|
|
5529
|
+
(0, import_immer5.produce)(config ?? initialConfig3, (draft) => {
|
|
4068
5530
|
draft.alias = alias;
|
|
4069
5531
|
})
|
|
4070
5532
|
);
|
|
4071
5533
|
};
|
|
4072
|
-
const _defaultOpen = (0,
|
|
5534
|
+
const _defaultOpen = (0, import_react22.useMemo)(() => {
|
|
4073
5535
|
if (defaultOpen) {
|
|
4074
5536
|
return true;
|
|
4075
5537
|
}
|
|
4076
5538
|
return config?.alias !== "" || config?.columns && config.columns.length > 0;
|
|
4077
5539
|
}, [config, defaultOpen]);
|
|
4078
|
-
return /* @__PURE__ */ (0,
|
|
4079
|
-
|
|
5540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5541
|
+
import_ui_core18.DisclosurePanel,
|
|
4080
5542
|
{
|
|
4081
5543
|
title: "Label Controls",
|
|
4082
5544
|
defaultOpen: _defaultOpen,
|
|
4083
5545
|
containerClassName: "w-full bg-default-bg",
|
|
4084
|
-
children: /* @__PURE__ */ (0,
|
|
4085
|
-
/* @__PURE__ */ (0,
|
|
4086
|
-
/* @__PURE__ */ (0,
|
|
5546
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5547
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
5548
|
+
/* @__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
5549
|
"Label Alias",
|
|
4088
|
-
/* @__PURE__ */ (0,
|
|
4089
|
-
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5551
|
+
import_ui_core18.HelpIcon,
|
|
4090
5552
|
{
|
|
4091
|
-
text: /* @__PURE__ */ (0,
|
|
4092
|
-
/* @__PURE__ */ (0,
|
|
4093
|
-
/* @__PURE__ */ (0,
|
|
5553
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "text-icontent text-text-foreground", children: [
|
|
5554
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: "Series name override or template." }),
|
|
5555
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
4094
5556
|
"Ex.",
|
|
4095
5557
|
" ",
|
|
4096
|
-
/* @__PURE__ */ (0,
|
|
5558
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
|
|
4097
5559
|
" ",
|
|
4098
5560
|
"will be replaced with the value of the contract label."
|
|
4099
5561
|
] })
|
|
@@ -4101,7 +5563,7 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
4101
5563
|
}
|
|
4102
5564
|
)
|
|
4103
5565
|
] }),
|
|
4104
|
-
/* @__PURE__ */ (0,
|
|
5566
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4105
5567
|
"input",
|
|
4106
5568
|
{
|
|
4107
5569
|
type: "text",
|
|
@@ -4112,13 +5574,13 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
4112
5574
|
}
|
|
4113
5575
|
)
|
|
4114
5576
|
] }),
|
|
4115
|
-
/* @__PURE__ */ (0,
|
|
4116
|
-
|
|
5577
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5578
|
+
import_ui_core18.Button,
|
|
4117
5579
|
{
|
|
4118
5580
|
type: "button",
|
|
4119
5581
|
role: "link",
|
|
4120
5582
|
onClick: () => {
|
|
4121
|
-
setConfig(
|
|
5583
|
+
setConfig(initialConfig3);
|
|
4122
5584
|
},
|
|
4123
5585
|
children: "Reset"
|
|
4124
5586
|
}
|
|
@@ -4130,9 +5592,9 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
4130
5592
|
|
|
4131
5593
|
// src/charts/options/PieChartControls.tsx
|
|
4132
5594
|
var import_immer6 = require("immer");
|
|
4133
|
-
var
|
|
4134
|
-
var
|
|
4135
|
-
var
|
|
5595
|
+
var import_lodash7 = require("lodash");
|
|
5596
|
+
var import_ui_core19 = require("@sentio/ui-core");
|
|
5597
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4136
5598
|
var defaultConfig = {
|
|
4137
5599
|
pieType: "Pie",
|
|
4138
5600
|
calculation: "LAST",
|
|
@@ -4153,7 +5615,7 @@ var PieTypeItems = [
|
|
|
4153
5615
|
{ label: "Donut", value: "Donut" }
|
|
4154
5616
|
];
|
|
4155
5617
|
function PieChartControls({ config, defaultOpen, onChange }) {
|
|
4156
|
-
config = (0,
|
|
5618
|
+
config = (0, import_lodash7.defaults)(config, defaultConfig);
|
|
4157
5619
|
function onCalculationChange(cal) {
|
|
4158
5620
|
config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.calculation = cal)));
|
|
4159
5621
|
}
|
|
@@ -4167,15 +5629,15 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4167
5629
|
})
|
|
4168
5630
|
);
|
|
4169
5631
|
}
|
|
4170
|
-
return /* @__PURE__ */ (0,
|
|
4171
|
-
|
|
5632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5633
|
+
import_ui_core19.DisclosurePanel,
|
|
4172
5634
|
{
|
|
4173
5635
|
title: "Pie Chart Options",
|
|
4174
5636
|
defaultOpen,
|
|
4175
5637
|
containerClassName: "w-full bg-default-bg",
|
|
4176
|
-
children: /* @__PURE__ */ (0,
|
|
4177
|
-
/* @__PURE__ */ (0,
|
|
4178
|
-
|
|
5638
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
5639
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5640
|
+
import_ui_core19.NewButtonGroup,
|
|
4179
5641
|
{
|
|
4180
5642
|
small: true,
|
|
4181
5643
|
buttons: PieTypeItems,
|
|
@@ -4183,22 +5645,22 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4183
5645
|
onChange: onPieTypeChange
|
|
4184
5646
|
}
|
|
4185
5647
|
) }),
|
|
4186
|
-
/* @__PURE__ */ (0,
|
|
4187
|
-
/* @__PURE__ */ (0,
|
|
4188
|
-
/* @__PURE__ */ (0,
|
|
5648
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
5649
|
+
/* @__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" }),
|
|
5650
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4189
5651
|
"select",
|
|
4190
5652
|
{
|
|
4191
5653
|
value: config.calculation,
|
|
4192
5654
|
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
5655
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
4194
5656
|
children: CalculationItems.map((d) => {
|
|
4195
|
-
return /* @__PURE__ */ (0,
|
|
5657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4196
5658
|
})
|
|
4197
5659
|
}
|
|
4198
5660
|
)
|
|
4199
5661
|
] }),
|
|
4200
|
-
/* @__PURE__ */ (0,
|
|
4201
|
-
|
|
5662
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5663
|
+
import_ui_core19.Checkbox,
|
|
4202
5664
|
{
|
|
4203
5665
|
checked: config?.showValue,
|
|
4204
5666
|
onChange: (v) => toggle("showValue", v),
|
|
@@ -4206,8 +5668,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4206
5668
|
labelClassName: "whitespace-nowrap"
|
|
4207
5669
|
}
|
|
4208
5670
|
),
|
|
4209
|
-
/* @__PURE__ */ (0,
|
|
4210
|
-
|
|
5671
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5672
|
+
import_ui_core19.Checkbox,
|
|
4211
5673
|
{
|
|
4212
5674
|
checked: config?.showPercent,
|
|
4213
5675
|
onChange: (v) => toggle("showPercent", v),
|
|
@@ -4215,8 +5677,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4215
5677
|
labelClassName: "whitespace-nowrap"
|
|
4216
5678
|
}
|
|
4217
5679
|
),
|
|
4218
|
-
/* @__PURE__ */ (0,
|
|
4219
|
-
|
|
5680
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5681
|
+
import_ui_core19.Checkbox,
|
|
4220
5682
|
{
|
|
4221
5683
|
checked: config?.absValue,
|
|
4222
5684
|
onChange: (v) => toggle("absValue", v),
|
|
@@ -4231,9 +5693,9 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
4231
5693
|
|
|
4232
5694
|
// src/charts/options/BarGaugeControls.tsx
|
|
4233
5695
|
var import_immer7 = require("immer");
|
|
4234
|
-
var
|
|
4235
|
-
var
|
|
4236
|
-
var
|
|
5696
|
+
var import_lodash8 = require("lodash");
|
|
5697
|
+
var import_ui_core20 = require("@sentio/ui-core");
|
|
5698
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4237
5699
|
var defaultConfig2 = {
|
|
4238
5700
|
direction: "HORIZONTAL",
|
|
4239
5701
|
calculation: "LAST",
|
|
@@ -4254,16 +5716,16 @@ var CalculationItems2 = [
|
|
|
4254
5716
|
{ label: "Max", value: "MAX" },
|
|
4255
5717
|
{ label: "Min", value: "MIN" }
|
|
4256
5718
|
];
|
|
4257
|
-
var
|
|
5719
|
+
var sortByItems2 = [
|
|
4258
5720
|
{ label: "Name", value: "ByName" },
|
|
4259
5721
|
{ label: "Value", value: "ByValue" }
|
|
4260
5722
|
];
|
|
4261
|
-
var
|
|
5723
|
+
var orderItems2 = [
|
|
4262
5724
|
{ label: "Ascendant", value: "false" },
|
|
4263
5725
|
{ label: "Descendant", value: "true" }
|
|
4264
5726
|
];
|
|
4265
5727
|
function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
4266
|
-
config = (0,
|
|
5728
|
+
config = (0, import_lodash8.defaults)(config, defaultConfig2);
|
|
4267
5729
|
function onCalculationChange(cal) {
|
|
4268
5730
|
config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.calculation = cal)));
|
|
4269
5731
|
}
|
|
@@ -4286,62 +5748,62 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
4286
5748
|
})
|
|
4287
5749
|
);
|
|
4288
5750
|
}
|
|
4289
|
-
return /* @__PURE__ */ (0,
|
|
4290
|
-
|
|
5751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5752
|
+
import_ui_core20.DisclosurePanel,
|
|
4291
5753
|
{
|
|
4292
5754
|
title: "Bar Gauge Options",
|
|
4293
5755
|
defaultOpen,
|
|
4294
5756
|
containerClassName: "w-full bg-default-bg",
|
|
4295
|
-
children: /* @__PURE__ */ (0,
|
|
4296
|
-
/* @__PURE__ */ (0,
|
|
4297
|
-
/* @__PURE__ */ (0,
|
|
4298
|
-
/* @__PURE__ */ (0,
|
|
5757
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
5758
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
5759
|
+
/* @__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" }),
|
|
5760
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4299
5761
|
"select",
|
|
4300
5762
|
{
|
|
4301
5763
|
value: config.direction,
|
|
4302
5764
|
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
5765
|
onChange: (e) => onDirectionChange(e.target.value),
|
|
4304
5766
|
children: directionItems.map((d) => {
|
|
4305
|
-
return /* @__PURE__ */ (0,
|
|
5767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4306
5768
|
})
|
|
4307
5769
|
}
|
|
4308
5770
|
)
|
|
4309
5771
|
] }),
|
|
4310
|
-
/* @__PURE__ */ (0,
|
|
4311
|
-
/* @__PURE__ */ (0,
|
|
4312
|
-
/* @__PURE__ */ (0,
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
5773
|
+
/* @__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" }),
|
|
5774
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4313
5775
|
"select",
|
|
4314
5776
|
{
|
|
4315
5777
|
value: config.calculation,
|
|
4316
5778
|
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
5779
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
4318
5780
|
children: CalculationItems2.map((d) => {
|
|
4319
|
-
return /* @__PURE__ */ (0,
|
|
5781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4320
5782
|
})
|
|
4321
5783
|
}
|
|
4322
5784
|
)
|
|
4323
5785
|
] }),
|
|
4324
|
-
/* @__PURE__ */ (0,
|
|
4325
|
-
/* @__PURE__ */ (0,
|
|
4326
|
-
/* @__PURE__ */ (0,
|
|
5786
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
5787
|
+
/* @__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" }),
|
|
5788
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4327
5789
|
"select",
|
|
4328
5790
|
{
|
|
4329
5791
|
value: config?.sort?.sortBy,
|
|
4330
5792
|
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
5793
|
onChange: (e) => onSortByChange(e.target.value),
|
|
4332
|
-
children:
|
|
4333
|
-
return /* @__PURE__ */ (0,
|
|
5794
|
+
children: sortByItems2.map((d) => {
|
|
5795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4334
5796
|
})
|
|
4335
5797
|
}
|
|
4336
5798
|
),
|
|
4337
|
-
/* @__PURE__ */ (0,
|
|
5799
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4338
5800
|
"select",
|
|
4339
5801
|
{
|
|
4340
5802
|
value: config?.sort?.orderDesc + "",
|
|
4341
5803
|
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
5804
|
onChange: (e) => onOrderChange(e.target.value === "true"),
|
|
4343
|
-
children:
|
|
4344
|
-
return /* @__PURE__ */ (0,
|
|
5805
|
+
children: orderItems2.map((d) => {
|
|
5806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: d.value + "", children: d.label }, d.label);
|
|
4345
5807
|
})
|
|
4346
5808
|
}
|
|
4347
5809
|
)
|
|
@@ -4353,30 +5815,13 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
4353
5815
|
|
|
4354
5816
|
// src/charts/options/ValueOptions.tsx
|
|
4355
5817
|
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
|
-
);
|
|
5818
|
+
var import_ui_core22 = require("@sentio/ui-core");
|
|
4374
5819
|
|
|
4375
5820
|
// src/charts/options/ValueStringMapping.tsx
|
|
4376
|
-
var
|
|
4377
|
-
var
|
|
5821
|
+
var import_lu7 = require("react-icons/lu");
|
|
5822
|
+
var import_ui_core21 = require("@sentio/ui-core");
|
|
4378
5823
|
var import_immer8 = require("immer");
|
|
4379
|
-
var
|
|
5824
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4380
5825
|
var operators = {
|
|
4381
5826
|
">": "greater than",
|
|
4382
5827
|
">=": "greater or equal",
|
|
@@ -4386,17 +5831,17 @@ var operators = {
|
|
|
4386
5831
|
"<=": "less or equal"
|
|
4387
5832
|
};
|
|
4388
5833
|
var renderTreeLine = (index, isLast) => {
|
|
4389
|
-
return /* @__PURE__ */ (0,
|
|
4390
|
-
/* @__PURE__ */ (0,
|
|
5834
|
+
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: [
|
|
5835
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4391
5836
|
"div",
|
|
4392
5837
|
{
|
|
4393
|
-
className: (0,
|
|
5838
|
+
className: (0, import_ui_core21.classNames)(
|
|
4394
5839
|
"w-px bg-gray-300",
|
|
4395
5840
|
isLast ? "h-1/2 self-start" : index === 0 ? "h-full self-end" : "h-full"
|
|
4396
5841
|
)
|
|
4397
5842
|
}
|
|
4398
5843
|
),
|
|
4399
|
-
/* @__PURE__ */ (0,
|
|
5844
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "h-px w-3 bg-gray-300" })
|
|
4400
5845
|
] }) });
|
|
4401
5846
|
};
|
|
4402
5847
|
function ValueStringMapping({ rules, onChange }) {
|
|
@@ -4427,31 +5872,31 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4427
5872
|
})
|
|
4428
5873
|
);
|
|
4429
5874
|
}
|
|
4430
|
-
return /* @__PURE__ */ (0,
|
|
5875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex w-full flex-col rounded-md py-2", children: [
|
|
4431
5876
|
(rules || []).map((rule, index) => {
|
|
4432
5877
|
const isLast = index === (rules || []).length - 1;
|
|
4433
|
-
return /* @__PURE__ */ (0,
|
|
5878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4434
5879
|
"div",
|
|
4435
5880
|
{
|
|
4436
5881
|
className: "text-text-foreground flex h-10 items-center py-1",
|
|
4437
5882
|
children: [
|
|
4438
5883
|
renderTreeLine(index, isLast),
|
|
4439
|
-
/* @__PURE__ */ (0,
|
|
4440
|
-
/* @__PURE__ */ (0,
|
|
5884
|
+
/* @__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" }),
|
|
5885
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4441
5886
|
"select",
|
|
4442
5887
|
{
|
|
4443
5888
|
value: rule.comparison,
|
|
4444
5889
|
onChange: (e) => changeRule(index, "comparison", e.target.value),
|
|
4445
5890
|
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
5891
|
children: Object.entries(operators).map(([op, display]) => {
|
|
4447
|
-
return /* @__PURE__ */ (0,
|
|
5892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("option", { value: op, children: [
|
|
4448
5893
|
"is ",
|
|
4449
5894
|
display
|
|
4450
5895
|
] }, op);
|
|
4451
5896
|
})
|
|
4452
5897
|
}
|
|
4453
5898
|
),
|
|
4454
|
-
/* @__PURE__ */ (0,
|
|
5899
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4455
5900
|
"input",
|
|
4456
5901
|
{
|
|
4457
5902
|
type: "text",
|
|
@@ -4465,8 +5910,8 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4465
5910
|
}
|
|
4466
5911
|
}
|
|
4467
5912
|
),
|
|
4468
|
-
/* @__PURE__ */ (0,
|
|
4469
|
-
/* @__PURE__ */ (0,
|
|
5913
|
+
/* @__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" }),
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4470
5915
|
"input",
|
|
4471
5916
|
{
|
|
4472
5917
|
type: "text",
|
|
@@ -4480,15 +5925,15 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4480
5925
|
}
|
|
4481
5926
|
}
|
|
4482
5927
|
),
|
|
4483
|
-
/* @__PURE__ */ (0,
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4484
5929
|
"button",
|
|
4485
5930
|
{
|
|
4486
5931
|
type: "button",
|
|
4487
5932
|
className: "mx-2",
|
|
4488
5933
|
"aria-label": "remove",
|
|
4489
5934
|
onClick: () => removeRule(index),
|
|
4490
|
-
children: /* @__PURE__ */ (0,
|
|
4491
|
-
|
|
5935
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5936
|
+
import_lu7.LuTrash2,
|
|
4492
5937
|
{
|
|
4493
5938
|
className: "icon text-text-foreground-disabled",
|
|
4494
5939
|
"aria-hidden": "true"
|
|
@@ -4501,8 +5946,8 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4501
5946
|
index
|
|
4502
5947
|
);
|
|
4503
5948
|
}),
|
|
4504
|
-
/* @__PURE__ */ (0,
|
|
4505
|
-
|
|
5949
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5950
|
+
import_ui_core21.Button,
|
|
4506
5951
|
{
|
|
4507
5952
|
type: "button",
|
|
4508
5953
|
role: "secondary",
|
|
@@ -4510,7 +5955,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4510
5955
|
"aria-label": "remove",
|
|
4511
5956
|
onClick: addRule,
|
|
4512
5957
|
children: [
|
|
4513
|
-
/* @__PURE__ */ (0,
|
|
5958
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lu7.LuPlus, { className: (0, import_ui_core21.classNames)("h-4 w-4"), "aria-hidden": "true" }),
|
|
4514
5959
|
"Add Formatting Rule"
|
|
4515
5960
|
]
|
|
4516
5961
|
}
|
|
@@ -4519,7 +5964,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
4519
5964
|
}
|
|
4520
5965
|
|
|
4521
5966
|
// src/charts/options/ValueOptions.tsx
|
|
4522
|
-
var
|
|
5967
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4523
5968
|
var ValueFormatters = [
|
|
4524
5969
|
{ label: "Number", value: "NumberFormatter" },
|
|
4525
5970
|
{ label: "Date", value: "DateFormatter" },
|
|
@@ -4548,7 +5993,7 @@ var CurrencySymbols = [
|
|
|
4548
5993
|
var AddonLabel2 = ({
|
|
4549
5994
|
className,
|
|
4550
5995
|
children
|
|
4551
|
-
}) => /* @__PURE__ */ (0,
|
|
5996
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel, { className: (0, import_ui_core22.classNames)("px-3", className), children });
|
|
4552
5997
|
var ValueOptions = ({
|
|
4553
5998
|
config,
|
|
4554
5999
|
onChange,
|
|
@@ -4615,9 +6060,9 @@ var ValueOptions = ({
|
|
|
4615
6060
|
function numberAddons(style) {
|
|
4616
6061
|
switch (style) {
|
|
4617
6062
|
case "None":
|
|
4618
|
-
return /* @__PURE__ */ (0,
|
|
4619
|
-
/* @__PURE__ */ (0,
|
|
4620
|
-
/* @__PURE__ */ (0,
|
|
6063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6064
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-l-0", children: "Fraction Digits" }),
|
|
6065
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4621
6066
|
"input",
|
|
4622
6067
|
{
|
|
4623
6068
|
disabled: true,
|
|
@@ -4628,9 +6073,9 @@ var ValueOptions = ({
|
|
|
4628
6073
|
] });
|
|
4629
6074
|
case "Percent":
|
|
4630
6075
|
case "Standard":
|
|
4631
|
-
return /* @__PURE__ */ (0,
|
|
4632
|
-
/* @__PURE__ */ (0,
|
|
4633
|
-
/* @__PURE__ */ (0,
|
|
6076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6077
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-x-0", children: "Fraction Digits" }),
|
|
6078
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4634
6079
|
"input",
|
|
4635
6080
|
{
|
|
4636
6081
|
type: "number",
|
|
@@ -4644,10 +6089,10 @@ var ValueOptions = ({
|
|
|
4644
6089
|
)
|
|
4645
6090
|
] });
|
|
4646
6091
|
case "Currency":
|
|
4647
|
-
return /* @__PURE__ */ (0,
|
|
4648
|
-
/* @__PURE__ */ (0,
|
|
4649
|
-
/* @__PURE__ */ (0,
|
|
4650
|
-
|
|
6092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6093
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-r-0", children: "Symbol" }),
|
|
6094
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "w-28 ", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6095
|
+
import_ui_core22.ComboInput,
|
|
4651
6096
|
{
|
|
4652
6097
|
onChange: onChangeSymbol,
|
|
4653
6098
|
options: CurrencySymbols.map((s) => s.value),
|
|
@@ -4659,8 +6104,8 @@ var ValueOptions = ({
|
|
|
4659
6104
|
value: config?.currencySymbol
|
|
4660
6105
|
}
|
|
4661
6106
|
) }),
|
|
4662
|
-
/* @__PURE__ */ (0,
|
|
4663
|
-
/* @__PURE__ */ (0,
|
|
6107
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border", children: "Precision" }),
|
|
6108
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4664
6109
|
"input",
|
|
4665
6110
|
{
|
|
4666
6111
|
type: "number",
|
|
@@ -4675,9 +6120,9 @@ var ValueOptions = ({
|
|
|
4675
6120
|
)
|
|
4676
6121
|
] });
|
|
4677
6122
|
default:
|
|
4678
|
-
return /* @__PURE__ */ (0,
|
|
4679
|
-
/* @__PURE__ */ (0,
|
|
4680
|
-
/* @__PURE__ */ (0,
|
|
6123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6124
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-x-0", children: "Max significant digits" }),
|
|
6125
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4681
6126
|
"input",
|
|
4682
6127
|
{
|
|
4683
6128
|
type: "number",
|
|
@@ -4692,62 +6137,62 @@ var ValueOptions = ({
|
|
|
4692
6137
|
] });
|
|
4693
6138
|
}
|
|
4694
6139
|
}
|
|
4695
|
-
return /* @__PURE__ */ (0,
|
|
4696
|
-
/* @__PURE__ */ (0,
|
|
4697
|
-
/* @__PURE__ */ (0,
|
|
4698
|
-
/* @__PURE__ */ (0,
|
|
6140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6141
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex", children: [
|
|
6142
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
|
|
6143
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4699
6144
|
"select",
|
|
4700
6145
|
{
|
|
4701
6146
|
value: config.valueFormatter,
|
|
4702
|
-
className: (0,
|
|
6147
|
+
className: (0, import_ui_core22.classNames)(
|
|
4703
6148
|
"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
6149
|
config.valueFormatter == "StringFormatter" ? "rounded-r-md" : ""
|
|
4705
6150
|
),
|
|
4706
6151
|
onChange: (e) => onChangeFormatter(e.target.value),
|
|
4707
6152
|
children: formatters.map((d) => {
|
|
4708
|
-
return /* @__PURE__ */ (0,
|
|
6153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4709
6154
|
})
|
|
4710
6155
|
}
|
|
4711
6156
|
),
|
|
4712
|
-
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0,
|
|
4713
|
-
/* @__PURE__ */ (0,
|
|
4714
|
-
/* @__PURE__ */ (0,
|
|
6157
|
+
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6158
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-l-0 border-r-0", children: "Style" }),
|
|
6159
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4715
6160
|
"select",
|
|
4716
6161
|
{
|
|
4717
6162
|
value: config.style,
|
|
4718
6163
|
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
6164
|
onChange: (e) => onStyleChange(e.target.value),
|
|
4720
6165
|
children: [
|
|
4721
|
-
/* @__PURE__ */ (0,
|
|
4722
|
-
/* @__PURE__ */ (0,
|
|
4723
|
-
/* @__PURE__ */ (0,
|
|
4724
|
-
/* @__PURE__ */ (0,
|
|
4725
|
-
/* @__PURE__ */ (0,
|
|
4726
|
-
/* @__PURE__ */ (0,
|
|
6166
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "None", children: "None" }),
|
|
6167
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Compact", children: "Compact" }),
|
|
6168
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Standard", children: "Standard" }),
|
|
6169
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Scientific", children: "Scientific" }),
|
|
6170
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Percent", children: "Percent" }),
|
|
6171
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "Currency", children: "Currency" })
|
|
4727
6172
|
]
|
|
4728
6173
|
}
|
|
4729
6174
|
),
|
|
4730
6175
|
config.style && numberAddons(config.style)
|
|
4731
6176
|
] }),
|
|
4732
|
-
config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0,
|
|
4733
|
-
/* @__PURE__ */ (0,
|
|
4734
|
-
/* @__PURE__ */ (0,
|
|
6177
|
+
config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6178
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddonLabel2, { className: "border border-l-0", children: "Date format" }),
|
|
6179
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4735
6180
|
"select",
|
|
4736
6181
|
{
|
|
4737
6182
|
value: config.dateFormat,
|
|
4738
6183
|
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
6184
|
onChange: (e) => onChangeDateFormat(e.target.value),
|
|
4740
6185
|
children: dateFormats.map((d) => {
|
|
4741
|
-
return /* @__PURE__ */ (0,
|
|
6186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
4742
6187
|
})
|
|
4743
6188
|
}
|
|
4744
6189
|
)
|
|
4745
6190
|
] })
|
|
4746
6191
|
] }) }),
|
|
4747
|
-
(showPrefix || showSuffix) && /* @__PURE__ */ (0,
|
|
4748
|
-
showPrefix && /* @__PURE__ */ (0,
|
|
4749
|
-
/* @__PURE__ */ (0,
|
|
4750
|
-
/* @__PURE__ */ (0,
|
|
6192
|
+
(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: [
|
|
6193
|
+
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: [
|
|
6194
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
|
|
6195
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4751
6196
|
"input",
|
|
4752
6197
|
{
|
|
4753
6198
|
type: "text",
|
|
@@ -4758,9 +6203,9 @@ var ValueOptions = ({
|
|
|
4758
6203
|
}
|
|
4759
6204
|
)
|
|
4760
6205
|
] }),
|
|
4761
|
-
showSuffix && /* @__PURE__ */ (0,
|
|
4762
|
-
/* @__PURE__ */ (0,
|
|
4763
|
-
/* @__PURE__ */ (0,
|
|
6206
|
+
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: [
|
|
6207
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
|
|
6208
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4764
6209
|
"input",
|
|
4765
6210
|
{
|
|
4766
6211
|
type: "text",
|
|
@@ -4772,7 +6217,7 @@ var ValueOptions = ({
|
|
|
4772
6217
|
)
|
|
4773
6218
|
] })
|
|
4774
6219
|
] }) }),
|
|
4775
|
-
config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0,
|
|
6220
|
+
config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4776
6221
|
ValueStringMapping,
|
|
4777
6222
|
{
|
|
4778
6223
|
rules: config.mappingRules || [],
|
|
@@ -4783,10 +6228,10 @@ var ValueOptions = ({
|
|
|
4783
6228
|
};
|
|
4784
6229
|
|
|
4785
6230
|
// src/charts/options/ValueControls.tsx
|
|
4786
|
-
var
|
|
4787
|
-
var
|
|
6231
|
+
var import_lodash9 = require("lodash");
|
|
6232
|
+
var import_ui_core23 = require("@sentio/ui-core");
|
|
4788
6233
|
var import_immer10 = require("immer");
|
|
4789
|
-
var
|
|
6234
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4790
6235
|
var defaultConfig4 = {
|
|
4791
6236
|
valueFormatter: "NumberFormatter",
|
|
4792
6237
|
showValueLabel: false,
|
|
@@ -4804,7 +6249,7 @@ var ValueControls = ({
|
|
|
4804
6249
|
showPrefix,
|
|
4805
6250
|
showSuffix
|
|
4806
6251
|
}) => {
|
|
4807
|
-
config = (0,
|
|
6252
|
+
config = (0, import_lodash9.defaults)(config || {}, defaultConfig4);
|
|
4808
6253
|
function toggleShowValueLabel(checked) {
|
|
4809
6254
|
config && onChange(
|
|
4810
6255
|
(0, import_immer10.produce)(config, (draft) => void (draft.showValueLabel = checked))
|
|
@@ -4813,14 +6258,14 @@ var ValueControls = ({
|
|
|
4813
6258
|
function toggleTooltipTotal(checked) {
|
|
4814
6259
|
config && onChange((0, import_immer10.produce)(config, (draft) => void (draft.tooltipTotal = checked)));
|
|
4815
6260
|
}
|
|
4816
|
-
return /* @__PURE__ */ (0,
|
|
4817
|
-
|
|
6261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6262
|
+
import_ui_core23.DisclosurePanel,
|
|
4818
6263
|
{
|
|
4819
6264
|
title: "Value Options",
|
|
4820
6265
|
defaultOpen,
|
|
4821
6266
|
containerClassName: "w-full bg-default-bg",
|
|
4822
6267
|
children: [
|
|
4823
|
-
/* @__PURE__ */ (0,
|
|
6268
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4824
6269
|
ValueOptions,
|
|
4825
6270
|
{
|
|
4826
6271
|
onChange,
|
|
@@ -4830,17 +6275,17 @@ var ValueControls = ({
|
|
|
4830
6275
|
showSuffix
|
|
4831
6276
|
}
|
|
4832
6277
|
),
|
|
4833
|
-
/* @__PURE__ */ (0,
|
|
4834
|
-
/* @__PURE__ */ (0,
|
|
4835
|
-
|
|
6278
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
6279
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6280
|
+
import_ui_core23.Checkbox,
|
|
4836
6281
|
{
|
|
4837
6282
|
checked: config?.showValueLabel,
|
|
4838
6283
|
onChange: toggleShowValueLabel,
|
|
4839
6284
|
label: "Show value label"
|
|
4840
6285
|
}
|
|
4841
6286
|
),
|
|
4842
|
-
/* @__PURE__ */ (0,
|
|
4843
|
-
|
|
6287
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6288
|
+
import_ui_core23.Checkbox,
|
|
4844
6289
|
{
|
|
4845
6290
|
checked: config?.tooltipTotal,
|
|
4846
6291
|
onChange: toggleTooltipTotal,
|
|
@@ -4853,285 +6298,11 @@ var ValueControls = ({
|
|
|
4853
6298
|
);
|
|
4854
6299
|
};
|
|
4855
6300
|
|
|
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 border-r-0 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 border-r-0 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
6301
|
// src/charts/options/MarkerControls.tsx
|
|
5131
6302
|
var import_immer11 = require("immer");
|
|
5132
|
-
var
|
|
5133
|
-
var
|
|
5134
|
-
var
|
|
6303
|
+
var import_lu8 = require("react-icons/lu");
|
|
6304
|
+
var import_ui_core24 = require("@sentio/ui-core");
|
|
6305
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5135
6306
|
var labelCls = "inline-flex items-center border border-r-0 sm:text-icontent border-main bg-gray-50 px-2 rounded-l-md";
|
|
5136
6307
|
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
6308
|
function MarkerInput({
|
|
@@ -5148,25 +6319,25 @@ function MarkerInput({
|
|
|
5148
6319
|
})
|
|
5149
6320
|
);
|
|
5150
6321
|
};
|
|
5151
|
-
return /* @__PURE__ */ (0,
|
|
5152
|
-
/* @__PURE__ */ (0,
|
|
5153
|
-
/* @__PURE__ */ (0,
|
|
5154
|
-
/* @__PURE__ */ (0,
|
|
5155
|
-
/* @__PURE__ */ (0,
|
|
6322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-[10px]", children: [
|
|
6323
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
6324
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: labelCls, children: [
|
|
6325
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pr-2", children: label }),
|
|
6326
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
5156
6327
|
"select",
|
|
5157
6328
|
{
|
|
5158
6329
|
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
6330
|
value: marker.type,
|
|
5160
6331
|
onChange: (e) => _onChange("type", e.target.value),
|
|
5161
6332
|
children: [
|
|
5162
|
-
/* @__PURE__ */ (0,
|
|
5163
|
-
/* @__PURE__ */ (0,
|
|
6333
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "LINE", children: "horizontal line" }),
|
|
6334
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "LINEX", children: "vertical line" })
|
|
5164
6335
|
]
|
|
5165
6336
|
}
|
|
5166
6337
|
),
|
|
5167
|
-
/* @__PURE__ */ (0,
|
|
6338
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pl-2", children: "at" })
|
|
5168
6339
|
] }),
|
|
5169
|
-
marker.type === "LINEX" ? /* @__PURE__ */ (0,
|
|
6340
|
+
marker.type === "LINEX" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5170
6341
|
"input",
|
|
5171
6342
|
{
|
|
5172
6343
|
className: inputCls,
|
|
@@ -5175,7 +6346,7 @@ function MarkerInput({
|
|
|
5175
6346
|
placeholder: "YYYY-MM-DD",
|
|
5176
6347
|
onChange: (e) => _onChange("valueX", e.target.value)
|
|
5177
6348
|
}
|
|
5178
|
-
) : /* @__PURE__ */ (0,
|
|
6349
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5179
6350
|
"input",
|
|
5180
6351
|
{
|
|
5181
6352
|
className: inputCls,
|
|
@@ -5185,11 +6356,11 @@ function MarkerInput({
|
|
|
5185
6356
|
}
|
|
5186
6357
|
)
|
|
5187
6358
|
] }),
|
|
5188
|
-
/* @__PURE__ */ (0,
|
|
5189
|
-
/* @__PURE__ */ (0,
|
|
5190
|
-
/* @__PURE__ */ (0,
|
|
5191
|
-
/* @__PURE__ */ (0,
|
|
5192
|
-
/* @__PURE__ */ (0,
|
|
6359
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
6360
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: labelCls, children: "Color" }),
|
|
6361
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "relative", children: [
|
|
6362
|
+
/* @__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 } }) }),
|
|
6363
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5193
6364
|
"input",
|
|
5194
6365
|
{
|
|
5195
6366
|
className: inputCls + " pl-8",
|
|
@@ -5200,9 +6371,9 @@ function MarkerInput({
|
|
|
5200
6371
|
)
|
|
5201
6372
|
] })
|
|
5202
6373
|
] }),
|
|
5203
|
-
/* @__PURE__ */ (0,
|
|
5204
|
-
/* @__PURE__ */ (0,
|
|
5205
|
-
/* @__PURE__ */ (0,
|
|
6374
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "inline-flex h-8", children: [
|
|
6375
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: labelCls, children: "Label" }),
|
|
6376
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5206
6377
|
"input",
|
|
5207
6378
|
{
|
|
5208
6379
|
className: inputCls,
|
|
@@ -5212,15 +6383,15 @@ function MarkerInput({
|
|
|
5212
6383
|
}
|
|
5213
6384
|
)
|
|
5214
6385
|
] }),
|
|
5215
|
-
/* @__PURE__ */ (0,
|
|
6386
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5216
6387
|
"button",
|
|
5217
6388
|
{
|
|
5218
6389
|
type: "button",
|
|
5219
6390
|
className: "ml-2 flex h-4 w-4 cursor-pointer items-center justify-center rounded-full bg-gray-800 hover:bg-red-600",
|
|
5220
6391
|
"aria-label": "Remove marker",
|
|
5221
6392
|
onClick: onRemove,
|
|
5222
|
-
children: /* @__PURE__ */ (0,
|
|
5223
|
-
|
|
6393
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6394
|
+
import_lu8.LuMinus,
|
|
5224
6395
|
{
|
|
5225
6396
|
className: "dark:text-default-bg h-3 w-3 text-white",
|
|
5226
6397
|
"aria-hidden": "true"
|
|
@@ -5254,14 +6425,14 @@ function MarkerControls({ markers, onChange }) {
|
|
|
5254
6425
|
})
|
|
5255
6426
|
);
|
|
5256
6427
|
};
|
|
5257
|
-
return /* @__PURE__ */ (0,
|
|
5258
|
-
|
|
6428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6429
|
+
import_ui_core24.DisclosurePanel,
|
|
5259
6430
|
{
|
|
5260
6431
|
title: "Markers",
|
|
5261
6432
|
containerClassName: "w-full bg-default-bg",
|
|
5262
6433
|
defaultOpen: true,
|
|
5263
|
-
children: /* @__PURE__ */ (0,
|
|
5264
|
-
_markers.map((marker, index) => /* @__PURE__ */ (0,
|
|
6434
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "space-y-2", children: [
|
|
6435
|
+
_markers.map((marker, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5265
6436
|
MarkerInput,
|
|
5266
6437
|
{
|
|
5267
6438
|
marker,
|
|
@@ -5271,8 +6442,8 @@ function MarkerControls({ markers, onChange }) {
|
|
|
5271
6442
|
},
|
|
5272
6443
|
index
|
|
5273
6444
|
)),
|
|
5274
|
-
/* @__PURE__ */ (0,
|
|
5275
|
-
/* @__PURE__ */ (0,
|
|
6445
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_ui_core24.Button, { type: "button", onClick: onAdd, children: [
|
|
6446
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lu8.LuPlus, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
5276
6447
|
"Add Marker"
|
|
5277
6448
|
] }) })
|
|
5278
6449
|
] })
|
|
@@ -5282,9 +6453,9 @@ function MarkerControls({ markers, onChange }) {
|
|
|
5282
6453
|
|
|
5283
6454
|
// src/charts/options/DataControls.tsx
|
|
5284
6455
|
var import_immer12 = require("immer");
|
|
5285
|
-
var
|
|
5286
|
-
var
|
|
5287
|
-
var
|
|
6456
|
+
var import_lodash10 = require("lodash");
|
|
6457
|
+
var import_ui_core25 = require("@sentio/ui-core");
|
|
6458
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5288
6459
|
var defaultConfig5 = {
|
|
5289
6460
|
seriesLimit: void 0
|
|
5290
6461
|
};
|
|
@@ -5294,7 +6465,7 @@ function DataControls({
|
|
|
5294
6465
|
chartConfig,
|
|
5295
6466
|
defaultSeriesLimit = 20
|
|
5296
6467
|
}) {
|
|
5297
|
-
const config = (0,
|
|
6468
|
+
const config = (0, import_lodash10.defaults)(chartConfig?.dataConfig, defaultConfig5);
|
|
5298
6469
|
const currentSeriesLimit = config?.seriesLimit || chartConfig?.tableConfig?.rowLimit;
|
|
5299
6470
|
function onSeriesLimitChange(e) {
|
|
5300
6471
|
const value = parseInt(e.target.value);
|
|
@@ -5312,15 +6483,15 @@ function DataControls({
|
|
|
5312
6483
|
e.preventDefault();
|
|
5313
6484
|
}
|
|
5314
6485
|
}
|
|
5315
|
-
return /* @__PURE__ */ (0,
|
|
5316
|
-
|
|
6486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6487
|
+
import_ui_core25.DisclosurePanel,
|
|
5317
6488
|
{
|
|
5318
6489
|
title: "Data Options",
|
|
5319
6490
|
defaultOpen,
|
|
5320
6491
|
containerClassName: "w-full bg-default-bg",
|
|
5321
|
-
children: /* @__PURE__ */ (0,
|
|
5322
|
-
/* @__PURE__ */ (0,
|
|
5323
|
-
/* @__PURE__ */ (0,
|
|
6492
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex h-8", children: [
|
|
6493
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-3", children: "Max Series Limit" }),
|
|
6494
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5324
6495
|
"input",
|
|
5325
6496
|
{
|
|
5326
6497
|
type: "number",
|
|
@@ -5339,10 +6510,10 @@ function DataControls({
|
|
|
5339
6510
|
|
|
5340
6511
|
// src/charts/options/ScatterControls.tsx
|
|
5341
6512
|
var import_immer13 = require("immer");
|
|
5342
|
-
var
|
|
5343
|
-
var
|
|
5344
|
-
var
|
|
5345
|
-
var
|
|
6513
|
+
var import_lodash11 = require("lodash");
|
|
6514
|
+
var import_react23 = require("react");
|
|
6515
|
+
var import_ui_core26 = require("@sentio/ui-core");
|
|
6516
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5346
6517
|
var defaultConfig6 = {
|
|
5347
6518
|
minSize: 5,
|
|
5348
6519
|
maxSize: 30
|
|
@@ -5354,57 +6525,57 @@ function ScatterControls({
|
|
|
5354
6525
|
columnSelect,
|
|
5355
6526
|
colorPicker
|
|
5356
6527
|
}) {
|
|
5357
|
-
config = (0,
|
|
5358
|
-
const onSymbolSizeColumnChange = (0,
|
|
6528
|
+
config = (0, import_lodash11.defaults)(config, defaultConfig6);
|
|
6529
|
+
const onSymbolSizeColumnChange = (0, import_react23.useCallback)(
|
|
5359
6530
|
(column) => {
|
|
5360
6531
|
config && onChange((0, import_immer13.produce)(config, (draft) => void (draft.symbolSize = column)));
|
|
5361
6532
|
},
|
|
5362
6533
|
[config, onChange]
|
|
5363
6534
|
);
|
|
5364
|
-
const onSymbolColorChange = (0,
|
|
6535
|
+
const onSymbolColorChange = (0, import_react23.useCallback)(
|
|
5365
6536
|
(color) => {
|
|
5366
6537
|
config && onChange((0, import_immer13.produce)(config, (draft) => void (draft.color = color)));
|
|
5367
6538
|
},
|
|
5368
6539
|
[config, onChange]
|
|
5369
6540
|
);
|
|
5370
|
-
const onMinSizeChange = (0,
|
|
6541
|
+
const onMinSizeChange = (0, import_react23.useCallback)(
|
|
5371
6542
|
(event) => {
|
|
5372
6543
|
const value = parseInt(event.target.value) || 5;
|
|
5373
6544
|
config && onChange((0, import_immer13.produce)(config, (draft) => void (draft.minSize = value)));
|
|
5374
6545
|
},
|
|
5375
6546
|
[config, onChange]
|
|
5376
6547
|
);
|
|
5377
|
-
const onMaxSizeChange = (0,
|
|
6548
|
+
const onMaxSizeChange = (0, import_react23.useCallback)(
|
|
5378
6549
|
(event) => {
|
|
5379
6550
|
const value = parseInt(event.target.value) || 50;
|
|
5380
6551
|
config && onChange((0, import_immer13.produce)(config, (draft) => void (draft.maxSize = value)));
|
|
5381
6552
|
},
|
|
5382
6553
|
[config, onChange]
|
|
5383
6554
|
);
|
|
5384
|
-
return /* @__PURE__ */ (0,
|
|
5385
|
-
|
|
6555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6556
|
+
import_ui_core26.DisclosurePanel,
|
|
5386
6557
|
{
|
|
5387
6558
|
title: "Scatter Chart Options",
|
|
5388
6559
|
defaultOpen,
|
|
5389
6560
|
containerClassName: "w-full bg-default-bg",
|
|
5390
|
-
children: /* @__PURE__ */ (0,
|
|
5391
|
-
columnSelect && /* @__PURE__ */ (0,
|
|
5392
|
-
/* @__PURE__ */ (0,
|
|
6561
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
6562
|
+
columnSelect && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
6563
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Size By Column" }),
|
|
5393
6564
|
columnSelect({
|
|
5394
6565
|
value: config.symbolSize,
|
|
5395
6566
|
onChange: onSymbolSizeColumnChange
|
|
5396
6567
|
})
|
|
5397
6568
|
] }),
|
|
5398
|
-
colorPicker && /* @__PURE__ */ (0,
|
|
5399
|
-
/* @__PURE__ */ (0,
|
|
6569
|
+
colorPicker && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
6570
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Size Color Mapping" }),
|
|
5400
6571
|
colorPicker({
|
|
5401
6572
|
value: config.color,
|
|
5402
6573
|
onChange: onSymbolColorChange
|
|
5403
6574
|
})
|
|
5404
6575
|
] }),
|
|
5405
|
-
/* @__PURE__ */ (0,
|
|
5406
|
-
/* @__PURE__ */ (0,
|
|
5407
|
-
/* @__PURE__ */ (0,
|
|
6576
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
6577
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Min Size" }),
|
|
6578
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5408
6579
|
"input",
|
|
5409
6580
|
{
|
|
5410
6581
|
name: "minSize",
|
|
@@ -5417,9 +6588,9 @@ function ScatterControls({
|
|
|
5417
6588
|
}
|
|
5418
6589
|
)
|
|
5419
6590
|
] }),
|
|
5420
|
-
/* @__PURE__ */ (0,
|
|
5421
|
-
/* @__PURE__ */ (0,
|
|
5422
|
-
/* @__PURE__ */ (0,
|
|
6591
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Max Size" }),
|
|
6593
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5423
6594
|
"input",
|
|
5424
6595
|
{
|
|
5425
6596
|
name: "maxSize",
|
|
@@ -5475,6 +6646,7 @@ function ScatterControls({
|
|
|
5475
6646
|
ScatterIcon,
|
|
5476
6647
|
SystemLabels,
|
|
5477
6648
|
TableIcon,
|
|
6649
|
+
TimeSeriesChart,
|
|
5478
6650
|
ValueControls,
|
|
5479
6651
|
ValueFormatters,
|
|
5480
6652
|
ValueOptions,
|