@quillsql/react 2.15.16 → 2.15.17
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.cjs +326 -167
- package/dist/index.js +356 -184
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -646,9 +646,12 @@ var formatPercent = (value) => {
|
|
|
646
646
|
return formatterPercent.format(Number(value));
|
|
647
647
|
};
|
|
648
648
|
var _getUTCDateHelper = (value, fmt) => {
|
|
649
|
+
if (value === null || value === void 0) {
|
|
650
|
+
return "-";
|
|
651
|
+
}
|
|
649
652
|
const parsedDate = (0, import_date_fns.parse)(value, fmt, /* @__PURE__ */ new Date());
|
|
650
653
|
const utcDate = (0, import_date_fns.isValid)(parsedDate) ? (0, import_date_fns_tz.utcToZonedTime)(parsedDate, "UTC") : (0, import_date_fns_tz.utcToZonedTime)(new Date(value), "UTC");
|
|
651
|
-
if (!(0, import_date_fns.isValid)(utcDate)) return
|
|
654
|
+
if (!(0, import_date_fns.isValid)(utcDate)) return "-";
|
|
652
655
|
return (0, import_date_fns.format)(utcDate, fmt);
|
|
653
656
|
};
|
|
654
657
|
var format_YYYY = (value) => _getUTCDateHelper(value, "yyyy");
|
|
@@ -659,8 +662,11 @@ var format_MMM_dd_yyyy = (value) => {
|
|
|
659
662
|
return _getUTCDateHelper(value, "dd MMM yyyy");
|
|
660
663
|
};
|
|
661
664
|
var format_MMM_d_MMM_d = (value, dateRange, databaseType) => {
|
|
665
|
+
if (value === null || value === void 0) {
|
|
666
|
+
return "-";
|
|
667
|
+
}
|
|
662
668
|
const utcDate = (0, import_date_fns.parseISO)(value.split("T")[0]);
|
|
663
|
-
if (!(0, import_date_fns.isValid)(utcDate)) return "
|
|
669
|
+
if (!(0, import_date_fns.isValid)(utcDate)) return "-";
|
|
664
670
|
let weekStartsOn = 1;
|
|
665
671
|
if (databaseType && ["mssql"].includes(databaseType)) {
|
|
666
672
|
weekStartsOn = 0;
|
|
@@ -691,15 +697,21 @@ var format_MMM_d_MMM_d = (value, dateRange, databaseType) => {
|
|
|
691
697
|
}
|
|
692
698
|
};
|
|
693
699
|
var format_MMM_dd_hh_mm_ap_pm = (value) => {
|
|
700
|
+
if (value === null || value === void 0) {
|
|
701
|
+
return "-";
|
|
702
|
+
}
|
|
694
703
|
const utcDate = (0, import_date_fns_tz.utcToZonedTime)(new Date(value), "UTC");
|
|
695
|
-
if (!(0, import_date_fns.isValid)(utcDate)) return "
|
|
704
|
+
if (!(0, import_date_fns.isValid)(utcDate)) return "-";
|
|
696
705
|
const formatStr = utcDate.getMinutes() === 0 ? "MMM do h a" : "MMM do h:mm a";
|
|
697
706
|
const res = (0, import_date_fns.format)(utcDate, formatStr);
|
|
698
707
|
return res.slice(0, -2) + res.slice(-2).toLowerCase();
|
|
699
708
|
};
|
|
700
709
|
var format_wo_yyyy = (value) => {
|
|
710
|
+
if (value === null || value === void 0) {
|
|
711
|
+
return "-";
|
|
712
|
+
}
|
|
701
713
|
const utcDate = (0, import_date_fns_tz.utcToZonedTime)(new Date(value), "UTC");
|
|
702
|
-
if (!(0, import_date_fns.isValid)(utcDate)) return "
|
|
714
|
+
if (!(0, import_date_fns.isValid)(utcDate)) return "-";
|
|
703
715
|
return `${(0, import_date_fns.getWeek)(utcDate)},${utcDate.getFullYear()}`;
|
|
704
716
|
};
|
|
705
717
|
function parseNumber(value) {
|
|
@@ -28356,7 +28368,7 @@ var ChartTooltipPrimary = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.js
|
|
|
28356
28368
|
paddingTop: 2,
|
|
28357
28369
|
paddingBottom: 2
|
|
28358
28370
|
},
|
|
28359
|
-
children: !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns10.format)(new Date(props.label), "MMM yyyy") : props.label
|
|
28371
|
+
children: props.label && !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : props.label && !isNaN(new Date(props.label)) ? (0, import_date_fns10.format)(new Date(props.label), "MMM yyyy") : props.label || "-"
|
|
28360
28372
|
}
|
|
28361
28373
|
)
|
|
28362
28374
|
}
|
|
@@ -28405,9 +28417,9 @@ function reformatComparisonPayload(props, primaryLabel, comparisonLabel) {
|
|
|
28405
28417
|
const nameKey = isComparison ? `comparison_${props.xAxisField}` : props.xAxisField;
|
|
28406
28418
|
const days = LABEL_TO_DAYS[primaryLabel] ?? 0;
|
|
28407
28419
|
const primaryDate = item.payload[props.xAxisField] ?? 0;
|
|
28408
|
-
const compDate = (0, import_date_fns10.subDays)(new Date(primaryDate), days + 1);
|
|
28420
|
+
const compDate = primaryDate ? (0, import_date_fns10.subDays)(new Date(primaryDate), days + 1) : /* @__PURE__ */ new Date();
|
|
28409
28421
|
const date = item.payload[nameKey] ?? (0, import_date_fns10.format)(compDate, props.xAxisFormat);
|
|
28410
|
-
const name2 = props.dateFormatter(date);
|
|
28422
|
+
const name2 = props.dateFormatter ? props.dateFormatter(date) : date;
|
|
28411
28423
|
const color2 = item.color;
|
|
28412
28424
|
const value = props.valueFormatter(item.value, item.name);
|
|
28413
28425
|
if (!columnsByKey[""]) {
|
|
@@ -28439,7 +28451,7 @@ function reformatComparisonPayload(props, primaryLabel, comparisonLabel) {
|
|
|
28439
28451
|
return columnsByKey;
|
|
28440
28452
|
}
|
|
28441
28453
|
function getTooltipLabel(props, altTooltipLabel, isDateXAxis) {
|
|
28442
|
-
return props.payload.length <= 2 && altTooltipLabel && isDateXAxis ? !isNaN(new Date(altTooltipLabel)) && props.dateFormatter ? props.dateFormatter(altTooltipLabel) : !isNaN(new Date(altTooltipLabel)) ? (0, import_date_fns10.format)(new Date(altTooltipLabel), "MMM yyyy") : altTooltipLabel : !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns10.format)(new Date(props.label), "MMM yyyy") : props.label;
|
|
28454
|
+
return props.payload.length <= 2 && altTooltipLabel && isDateXAxis ? altTooltipLabel && !isNaN(new Date(altTooltipLabel)) && props.dateFormatter ? props.dateFormatter(altTooltipLabel) : altTooltipLabel && !isNaN(new Date(altTooltipLabel)) ? (0, import_date_fns10.format)(new Date(altTooltipLabel), "MMM yyyy") : altTooltipLabel || "-" : props.label && !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : props.label && !isNaN(new Date(props.label)) ? (0, import_date_fns10.format)(new Date(props.label), "MMM yyyy") : props.label || "-";
|
|
28443
28455
|
}
|
|
28444
28456
|
function ChartTooltipComparison(props) {
|
|
28445
28457
|
const isDateXAxis = isDateFormat(props.xAxisFormat);
|
|
@@ -38940,6 +38952,9 @@ var import_react46 = __toESM(require("@monaco-editor/react"), 1);
|
|
|
38940
38952
|
|
|
38941
38953
|
// src/ChartBuilder.tsx
|
|
38942
38954
|
var import_react43 = require("react");
|
|
38955
|
+
var import_core = require("@dnd-kit/core");
|
|
38956
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
38957
|
+
var import_utilities = require("@dnd-kit/utilities");
|
|
38943
38958
|
|
|
38944
38959
|
// src/internals/ReportBuilder/PivotModal.tsx
|
|
38945
38960
|
var import_react40 = require("react");
|
|
@@ -42182,6 +42197,173 @@ var CHART_TO_LABELS = {
|
|
|
42182
42197
|
"World map": { xAxisLabel: "Country", yAxisLabel: "Value" },
|
|
42183
42198
|
gauge: { xAxisLabel: "Value" }
|
|
42184
42199
|
};
|
|
42200
|
+
function SortableColumnItem({
|
|
42201
|
+
column,
|
|
42202
|
+
index,
|
|
42203
|
+
rows,
|
|
42204
|
+
columns,
|
|
42205
|
+
handleChange,
|
|
42206
|
+
deleteRef,
|
|
42207
|
+
deleteButtonMargin,
|
|
42208
|
+
handleRemoveField,
|
|
42209
|
+
SelectComponent,
|
|
42210
|
+
TextInputComponent,
|
|
42211
|
+
DeleteButtonComponent
|
|
42212
|
+
}) {
|
|
42213
|
+
const { attributes, listeners, setNodeRef, transform, transition: transition2 } = (0, import_sortable.useSortable)({ id: column.field });
|
|
42214
|
+
const style2 = {
|
|
42215
|
+
transform: import_utilities.CSS.Transform.toString(transform),
|
|
42216
|
+
transition: transition2
|
|
42217
|
+
};
|
|
42218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { style: style2, ref: setNodeRef, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
42219
|
+
"div",
|
|
42220
|
+
{
|
|
42221
|
+
style: {
|
|
42222
|
+
display: "flex",
|
|
42223
|
+
alignItems: "center",
|
|
42224
|
+
gap: 4
|
|
42225
|
+
},
|
|
42226
|
+
children: [
|
|
42227
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
42228
|
+
"div",
|
|
42229
|
+
{
|
|
42230
|
+
style: {
|
|
42231
|
+
cursor: "grab",
|
|
42232
|
+
display: "flex",
|
|
42233
|
+
gap: 2,
|
|
42234
|
+
flexDirection: "row",
|
|
42235
|
+
paddingTop: 8,
|
|
42236
|
+
paddingBottom: 8,
|
|
42237
|
+
paddingLeft: 8,
|
|
42238
|
+
paddingRight: 8,
|
|
42239
|
+
borderRadius: 4
|
|
42240
|
+
},
|
|
42241
|
+
className: "handle",
|
|
42242
|
+
...attributes,
|
|
42243
|
+
...listeners,
|
|
42244
|
+
children: [
|
|
42245
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("style", { children: `.handle{background:white;} .handle:hover{background:rgba(0,0,0,0.03);}` }),
|
|
42246
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { style: { display: "flex", gap: 2, flexDirection: "column" }, children: [
|
|
42247
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42248
|
+
"div",
|
|
42249
|
+
{
|
|
42250
|
+
style: {
|
|
42251
|
+
width: 3,
|
|
42252
|
+
height: 3,
|
|
42253
|
+
borderRadius: 3,
|
|
42254
|
+
background: "#9CA0A7"
|
|
42255
|
+
}
|
|
42256
|
+
}
|
|
42257
|
+
),
|
|
42258
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42259
|
+
"div",
|
|
42260
|
+
{
|
|
42261
|
+
style: {
|
|
42262
|
+
width: 3,
|
|
42263
|
+
height: 3,
|
|
42264
|
+
borderRadius: 3,
|
|
42265
|
+
background: "#9CA0A7"
|
|
42266
|
+
}
|
|
42267
|
+
}
|
|
42268
|
+
),
|
|
42269
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42270
|
+
"div",
|
|
42271
|
+
{
|
|
42272
|
+
style: {
|
|
42273
|
+
width: 3,
|
|
42274
|
+
height: 3,
|
|
42275
|
+
borderRadius: 3,
|
|
42276
|
+
background: "#9CA0A7"
|
|
42277
|
+
}
|
|
42278
|
+
}
|
|
42279
|
+
)
|
|
42280
|
+
] }),
|
|
42281
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { style: { display: "flex", gap: 2, flexDirection: "column" }, children: [
|
|
42282
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42283
|
+
"div",
|
|
42284
|
+
{
|
|
42285
|
+
style: {
|
|
42286
|
+
width: 3,
|
|
42287
|
+
height: 3,
|
|
42288
|
+
borderRadius: 3,
|
|
42289
|
+
background: "#9CA0A7"
|
|
42290
|
+
}
|
|
42291
|
+
}
|
|
42292
|
+
),
|
|
42293
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42294
|
+
"div",
|
|
42295
|
+
{
|
|
42296
|
+
style: {
|
|
42297
|
+
width: 3,
|
|
42298
|
+
height: 3,
|
|
42299
|
+
borderRadius: 3,
|
|
42300
|
+
background: "#9CA0A7"
|
|
42301
|
+
}
|
|
42302
|
+
}
|
|
42303
|
+
),
|
|
42304
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42305
|
+
"div",
|
|
42306
|
+
{
|
|
42307
|
+
style: {
|
|
42308
|
+
width: 3,
|
|
42309
|
+
height: 3,
|
|
42310
|
+
borderRadius: 3,
|
|
42311
|
+
background: "#9CA0A7"
|
|
42312
|
+
}
|
|
42313
|
+
}
|
|
42314
|
+
)
|
|
42315
|
+
] })
|
|
42316
|
+
]
|
|
42317
|
+
}
|
|
42318
|
+
),
|
|
42319
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { style: { flex: 1, display: "flex", gap: 12 }, children: [
|
|
42320
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42321
|
+
SelectComponent,
|
|
42322
|
+
{
|
|
42323
|
+
value: column.field,
|
|
42324
|
+
onChange: (e) => handleChange(e.target.value, "columns.field", index),
|
|
42325
|
+
options: rows[0] ? Object.keys(rows[0]).map((elem) => ({
|
|
42326
|
+
label: elem,
|
|
42327
|
+
value: elem
|
|
42328
|
+
})) : columns.map((elem) => ({
|
|
42329
|
+
label: elem.field,
|
|
42330
|
+
value: elem.field
|
|
42331
|
+
})),
|
|
42332
|
+
width: 200,
|
|
42333
|
+
hideEmptyOption: true
|
|
42334
|
+
}
|
|
42335
|
+
),
|
|
42336
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42337
|
+
TextInputComponent,
|
|
42338
|
+
{
|
|
42339
|
+
id: `chart-builder-column-label-${index}`,
|
|
42340
|
+
width: 200,
|
|
42341
|
+
value: column.label,
|
|
42342
|
+
placeholder: "Column Label",
|
|
42343
|
+
onChange: (e) => handleChange(e.target.value, "columns.label", index)
|
|
42344
|
+
}
|
|
42345
|
+
),
|
|
42346
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42347
|
+
SelectComponent,
|
|
42348
|
+
{
|
|
42349
|
+
value: column.format,
|
|
42350
|
+
onChange: (e) => handleChange(e.target.value, "columns.format", index),
|
|
42351
|
+
options: ALL_FORMAT_OPTIONS,
|
|
42352
|
+
width: 200,
|
|
42353
|
+
hideEmptyOption: true
|
|
42354
|
+
}
|
|
42355
|
+
),
|
|
42356
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { ref: deleteRef, style: { marginLeft: deleteButtonMargin }, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
42357
|
+
DeleteButtonComponent,
|
|
42358
|
+
{
|
|
42359
|
+
onClick: () => handleRemoveField("columns", index)
|
|
42360
|
+
}
|
|
42361
|
+
) })
|
|
42362
|
+
] })
|
|
42363
|
+
]
|
|
42364
|
+
}
|
|
42365
|
+
) });
|
|
42366
|
+
}
|
|
42185
42367
|
function getPivotMetricOptions(pivot, selectedPivotTable, chartType) {
|
|
42186
42368
|
if (["metric", "gauge"].includes(chartType) && selectedPivotTable) {
|
|
42187
42369
|
return selectedPivotTable.columns.map((elem) => ({
|
|
@@ -43647,6 +43829,26 @@ function ChartBuilder({
|
|
|
43647
43829
|
);
|
|
43648
43830
|
setFormData({ ...formData, [fieldName]: updatedArray });
|
|
43649
43831
|
};
|
|
43832
|
+
const columnDragSensors = (0, import_core.useSensors)(
|
|
43833
|
+
(0, import_core.useSensor)(import_core.PointerSensor),
|
|
43834
|
+
(0, import_core.useSensor)(import_core.KeyboardSensor, {
|
|
43835
|
+
coordinateGetter: import_sortable.sortableKeyboardCoordinates
|
|
43836
|
+
})
|
|
43837
|
+
);
|
|
43838
|
+
const handleColumnDragEnd = (event) => {
|
|
43839
|
+
const { active, over } = event;
|
|
43840
|
+
if (!active || !over) return;
|
|
43841
|
+
if (active.id !== over.id) {
|
|
43842
|
+
const oldIndex = formData.columns.findIndex(
|
|
43843
|
+
(col) => col.field === active.id
|
|
43844
|
+
);
|
|
43845
|
+
const newIndex = formData.columns.findIndex(
|
|
43846
|
+
(col) => col.field === over.id
|
|
43847
|
+
);
|
|
43848
|
+
const newColumns = (0, import_sortable.arrayMove)(formData.columns, oldIndex, newIndex);
|
|
43849
|
+
setFormData({ ...formData, columns: newColumns });
|
|
43850
|
+
}
|
|
43851
|
+
};
|
|
43650
43852
|
const handleSubmit = (event) => {
|
|
43651
43853
|
event.preventDefault();
|
|
43652
43854
|
};
|
|
@@ -44555,141 +44757,98 @@ function ChartBuilder({
|
|
|
44555
44757
|
formData.pivot && selectedPivotTable && selectedPivotTable.columns && formData.chartType === "table" ? (
|
|
44556
44758
|
// THIS CASE IF FOR PIVOT TABLES ONLY
|
|
44557
44759
|
selectedPivotTable.columns.map(
|
|
44558
|
-
(column, index) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
44559
|
-
|
|
44560
|
-
|
|
44561
|
-
|
|
44562
|
-
|
|
44563
|
-
|
|
44564
|
-
|
|
44565
|
-
|
|
44566
|
-
|
|
44567
|
-
e.target.value,
|
|
44568
|
-
"pivot.field",
|
|
44569
|
-
index
|
|
44570
|
-
),
|
|
44571
|
-
options: selectedPivotTable.columns.map(
|
|
44572
|
-
(elem) => ({
|
|
44573
|
-
label: elem.field,
|
|
44574
|
-
value: elem.field
|
|
44575
|
-
})
|
|
44576
|
-
),
|
|
44577
|
-
disabled: index === 0,
|
|
44578
|
-
width: 200,
|
|
44579
|
-
hideEmptyOption: true
|
|
44580
|
-
}
|
|
44760
|
+
(column, index) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(ChartBuilderInputRowContainer, { children: [
|
|
44761
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
44762
|
+
SelectComponent,
|
|
44763
|
+
{
|
|
44764
|
+
value: column.field,
|
|
44765
|
+
onChange: (e) => handleChange(
|
|
44766
|
+
e.target.value,
|
|
44767
|
+
"pivot.field",
|
|
44768
|
+
index
|
|
44581
44769
|
),
|
|
44582
|
-
|
|
44583
|
-
|
|
44584
|
-
|
|
44585
|
-
|
|
44586
|
-
|
|
44587
|
-
value: column.label,
|
|
44588
|
-
placeholder: "Column Label",
|
|
44589
|
-
onChange: (e) => handleChange(
|
|
44590
|
-
e.target.value,
|
|
44591
|
-
"pivot.label",
|
|
44592
|
-
index
|
|
44593
|
-
)
|
|
44594
|
-
}
|
|
44770
|
+
options: selectedPivotTable.columns.map(
|
|
44771
|
+
(elem) => ({
|
|
44772
|
+
label: elem.field,
|
|
44773
|
+
value: elem.field
|
|
44774
|
+
})
|
|
44595
44775
|
),
|
|
44596
|
-
|
|
44597
|
-
|
|
44598
|
-
|
|
44599
|
-
|
|
44600
|
-
|
|
44601
|
-
|
|
44602
|
-
|
|
44603
|
-
|
|
44604
|
-
|
|
44605
|
-
|
|
44606
|
-
|
|
44607
|
-
|
|
44608
|
-
|
|
44609
|
-
|
|
44610
|
-
|
|
44611
|
-
|
|
44612
|
-
{ label: "string", value: "string" }
|
|
44613
|
-
],
|
|
44614
|
-
width: 200,
|
|
44615
|
-
hideEmptyOption: true
|
|
44616
|
-
}
|
|
44776
|
+
disabled: index === 0,
|
|
44777
|
+
width: 200,
|
|
44778
|
+
hideEmptyOption: true
|
|
44779
|
+
}
|
|
44780
|
+
),
|
|
44781
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
44782
|
+
TextInputComponent,
|
|
44783
|
+
{
|
|
44784
|
+
id: `chart-builder-column-label-${index}`,
|
|
44785
|
+
width: 200,
|
|
44786
|
+
value: column.label,
|
|
44787
|
+
placeholder: "Column Label",
|
|
44788
|
+
onChange: (e) => handleChange(
|
|
44789
|
+
e.target.value,
|
|
44790
|
+
"pivot.label",
|
|
44791
|
+
index
|
|
44617
44792
|
)
|
|
44618
|
-
|
|
44619
|
-
|
|
44620
|
-
|
|
44621
|
-
|
|
44793
|
+
}
|
|
44794
|
+
),
|
|
44795
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
44796
|
+
SelectComponent,
|
|
44797
|
+
{
|
|
44798
|
+
value: (
|
|
44799
|
+
// The first index use rowField for the rest of them use value fields
|
|
44800
|
+
column.format
|
|
44801
|
+
),
|
|
44802
|
+
onChange: (e) => handleChange(
|
|
44803
|
+
e.target.value,
|
|
44804
|
+
"pivot.format",
|
|
44805
|
+
index
|
|
44806
|
+
),
|
|
44807
|
+
options: formData.pivot && index === 0 && selectedPivotTable?.columns.length > 1 ? isDateField(
|
|
44808
|
+
formData.pivot.rowFieldType || ""
|
|
44809
|
+
) ? [{ label: "date", value: "string" }] : [{ label: "string", value: "string" }] : [
|
|
44810
|
+
...NUMBER_OPTIONS,
|
|
44811
|
+
{ label: "string", value: "string" }
|
|
44812
|
+
],
|
|
44813
|
+
width: 200,
|
|
44814
|
+
hideEmptyOption: true
|
|
44815
|
+
}
|
|
44816
|
+
)
|
|
44817
|
+
] }, "column" + index)
|
|
44622
44818
|
)
|
|
44623
|
-
) :
|
|
44624
|
-
|
|
44625
|
-
|
|
44626
|
-
|
|
44627
|
-
|
|
44628
|
-
|
|
44629
|
-
|
|
44630
|
-
|
|
44631
|
-
|
|
44632
|
-
|
|
44633
|
-
|
|
44634
|
-
|
|
44635
|
-
|
|
44636
|
-
|
|
44637
|
-
|
|
44638
|
-
|
|
44639
|
-
|
|
44640
|
-
|
|
44641
|
-
|
|
44642
|
-
|
|
44643
|
-
|
|
44644
|
-
|
|
44645
|
-
|
|
44646
|
-
|
|
44647
|
-
|
|
44648
|
-
|
|
44649
|
-
|
|
44650
|
-
|
|
44651
|
-
|
|
44652
|
-
width: 200,
|
|
44653
|
-
value: column.label,
|
|
44654
|
-
placeholder: "Column Label",
|
|
44655
|
-
onChange: (e) => handleChange(
|
|
44656
|
-
e.target.value,
|
|
44657
|
-
"columns.label",
|
|
44658
|
-
index
|
|
44659
|
-
)
|
|
44660
|
-
}
|
|
44661
|
-
),
|
|
44662
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
44663
|
-
SelectComponent,
|
|
44664
|
-
{
|
|
44665
|
-
value: column.format,
|
|
44666
|
-
onChange: (e) => handleChange(
|
|
44667
|
-
e.target.value,
|
|
44668
|
-
"columns.format",
|
|
44669
|
-
index
|
|
44670
|
-
),
|
|
44671
|
-
options: ALL_FORMAT_OPTIONS,
|
|
44672
|
-
width: 200,
|
|
44673
|
-
hideEmptyOption: true
|
|
44674
|
-
}
|
|
44675
|
-
),
|
|
44676
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
44677
|
-
"div",
|
|
44678
|
-
{
|
|
44679
|
-
ref: deleteRef,
|
|
44680
|
-
style: { marginLeft: deleteButtonMargin },
|
|
44681
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
44682
|
-
DeleteButtonComponent,
|
|
44683
|
-
{
|
|
44684
|
-
onClick: () => handleRemoveField("columns", index)
|
|
44685
|
-
}
|
|
44686
|
-
)
|
|
44687
|
-
}
|
|
44819
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
44820
|
+
import_core.DndContext,
|
|
44821
|
+
{
|
|
44822
|
+
sensors: columnDragSensors,
|
|
44823
|
+
collisionDetection: import_core.closestCenter,
|
|
44824
|
+
onDragEnd: handleColumnDragEnd,
|
|
44825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
44826
|
+
import_sortable.SortableContext,
|
|
44827
|
+
{
|
|
44828
|
+
items: formData.columns.map((col) => col.field),
|
|
44829
|
+
strategy: import_sortable.verticalListSortingStrategy,
|
|
44830
|
+
children: formData.columns.map(
|
|
44831
|
+
(column, index) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
44832
|
+
SortableColumnItem,
|
|
44833
|
+
{
|
|
44834
|
+
column,
|
|
44835
|
+
index,
|
|
44836
|
+
rows,
|
|
44837
|
+
columns,
|
|
44838
|
+
handleChange,
|
|
44839
|
+
deleteRef,
|
|
44840
|
+
deleteButtonMargin,
|
|
44841
|
+
handleRemoveField,
|
|
44842
|
+
SelectComponent,
|
|
44843
|
+
TextInputComponent,
|
|
44844
|
+
DeleteButtonComponent
|
|
44845
|
+
},
|
|
44846
|
+
column.field
|
|
44847
|
+
)
|
|
44688
44848
|
)
|
|
44689
|
-
|
|
44690
|
-
|
|
44691
|
-
|
|
44692
|
-
)
|
|
44849
|
+
}
|
|
44850
|
+
)
|
|
44851
|
+
}
|
|
44693
44852
|
),
|
|
44694
44853
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: !// hide when pivoted and chartType === 'table'
|
|
44695
44854
|
(formData.pivot && selectedPivotTable && selectedPivotTable.columns && formData.chartType === "table") && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
@@ -48858,9 +49017,9 @@ var useReportBuilder = ({
|
|
|
48858
49017
|
|
|
48859
49018
|
// src/components/ReportBuilder/AddColumnModal.tsx
|
|
48860
49019
|
var import_react48 = require("react");
|
|
48861
|
-
var
|
|
48862
|
-
var
|
|
48863
|
-
var
|
|
49020
|
+
var import_core2 = require("@dnd-kit/core");
|
|
49021
|
+
var import_sortable2 = require("@dnd-kit/sortable");
|
|
49022
|
+
var import_utilities2 = require("@dnd-kit/utilities");
|
|
48864
49023
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
48865
49024
|
function AddColumnModal({
|
|
48866
49025
|
onSave,
|
|
@@ -48929,10 +49088,10 @@ function AddColumnModal({
|
|
|
48929
49088
|
setTimeout(() => setInitialLoad(false), 200);
|
|
48930
49089
|
}
|
|
48931
49090
|
}, [schemaLoading]);
|
|
48932
|
-
const sensors = (0,
|
|
48933
|
-
(0,
|
|
48934
|
-
(0,
|
|
48935
|
-
coordinateGetter:
|
|
49091
|
+
const sensors = (0, import_core2.useSensors)(
|
|
49092
|
+
(0, import_core2.useSensor)(import_core2.PointerSensor),
|
|
49093
|
+
(0, import_core2.useSensor)(import_core2.KeyboardSensor, {
|
|
49094
|
+
coordinateGetter: import_sortable2.sortableKeyboardCoordinates
|
|
48936
49095
|
})
|
|
48937
49096
|
);
|
|
48938
49097
|
function handleDragEnd(event) {
|
|
@@ -48942,7 +49101,7 @@ function AddColumnModal({
|
|
|
48942
49101
|
setOrderedColumnNames((orderedColumnNames2) => {
|
|
48943
49102
|
const oldIndex = orderedColumnNames2.indexOf(active.id);
|
|
48944
49103
|
const newIndex = orderedColumnNames2.indexOf(over.id);
|
|
48945
|
-
return (0,
|
|
49104
|
+
return (0, import_sortable2.arrayMove)(orderedColumnNames2, oldIndex, newIndex);
|
|
48946
49105
|
});
|
|
48947
49106
|
}
|
|
48948
49107
|
}
|
|
@@ -48986,16 +49145,16 @@ function AddColumnModal({
|
|
|
48986
49145
|
}
|
|
48987
49146
|
),
|
|
48988
49147
|
schemaLoading || initialLoad ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(LoadingComponent, {}) : schema.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
48989
|
-
|
|
49148
|
+
import_core2.DndContext,
|
|
48990
49149
|
{
|
|
48991
49150
|
sensors,
|
|
48992
|
-
collisionDetection:
|
|
49151
|
+
collisionDetection: import_core2.closestCenter,
|
|
48993
49152
|
onDragEnd: handleDragEnd,
|
|
48994
49153
|
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
48995
|
-
|
|
49154
|
+
import_sortable2.SortableContext,
|
|
48996
49155
|
{
|
|
48997
49156
|
items: orderedColumnNames,
|
|
48998
|
-
strategy:
|
|
49157
|
+
strategy: import_sortable2.verticalListSortingStrategy,
|
|
48999
49158
|
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
49000
49159
|
"div",
|
|
49001
49160
|
{
|
|
@@ -49203,9 +49362,9 @@ var SortableItem = ({
|
|
|
49203
49362
|
selectedColumns,
|
|
49204
49363
|
SelectColumn
|
|
49205
49364
|
}) => {
|
|
49206
|
-
const { attributes, listeners, setNodeRef, transform, transition: transition2 } = (0,
|
|
49365
|
+
const { attributes, listeners, setNodeRef, transform, transition: transition2 } = (0, import_sortable2.useSortable)({ id: id2 });
|
|
49207
49366
|
const style2 = {
|
|
49208
|
-
transform:
|
|
49367
|
+
transform: import_utilities2.CSS.Transform.toString(transform),
|
|
49209
49368
|
transition: transition2
|
|
49210
49369
|
};
|
|
49211
49370
|
const handleSelect = () => {
|
|
@@ -49234,11 +49393,11 @@ var SortableItem = ({
|
|
|
49234
49393
|
};
|
|
49235
49394
|
|
|
49236
49395
|
// src/components/ReportBuilder/DraggableColumns.tsx
|
|
49237
|
-
var
|
|
49396
|
+
var import_core3 = require("@dnd-kit/core");
|
|
49238
49397
|
|
|
49239
49398
|
// src/components/ReportBuilder/DraggableItem.tsx
|
|
49240
|
-
var
|
|
49241
|
-
var
|
|
49399
|
+
var import_sortable3 = require("@dnd-kit/sortable");
|
|
49400
|
+
var import_utilities3 = require("@dnd-kit/utilities");
|
|
49242
49401
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
49243
49402
|
function DraggableItem({
|
|
49244
49403
|
id: id2,
|
|
@@ -49247,9 +49406,9 @@ function DraggableItem({
|
|
|
49247
49406
|
DraggableColumnComponent,
|
|
49248
49407
|
loading
|
|
49249
49408
|
}) {
|
|
49250
|
-
const { attributes, listeners, setNodeRef, transform, transition: transition2 } = (0,
|
|
49409
|
+
const { attributes, listeners, setNodeRef, transform, transition: transition2 } = (0, import_sortable3.useSortable)({ id: id2 });
|
|
49251
49410
|
const style2 = {
|
|
49252
|
-
transform:
|
|
49411
|
+
transform: import_utilities3.CSS.Transform.toString(transform),
|
|
49253
49412
|
transition: transition2
|
|
49254
49413
|
};
|
|
49255
49414
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { style: { ...style2 }, ref: setNodeRef, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
@@ -49274,7 +49433,7 @@ function DraggableItem({
|
|
|
49274
49433
|
}
|
|
49275
49434
|
|
|
49276
49435
|
// src/components/ReportBuilder/DraggableColumns.tsx
|
|
49277
|
-
var
|
|
49436
|
+
var import_sortable4 = require("@dnd-kit/sortable");
|
|
49278
49437
|
var import_react49 = require("react");
|
|
49279
49438
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
49280
49439
|
function DraggableColumns({
|
|
@@ -49283,10 +49442,10 @@ function DraggableColumns({
|
|
|
49283
49442
|
DraggableColumnComponent,
|
|
49284
49443
|
loading
|
|
49285
49444
|
}) {
|
|
49286
|
-
const sensors = (0,
|
|
49287
|
-
(0,
|
|
49288
|
-
(0,
|
|
49289
|
-
coordinateGetter:
|
|
49445
|
+
const sensors = (0, import_core3.useSensors)(
|
|
49446
|
+
(0, import_core3.useSensor)(import_core3.PointerSensor),
|
|
49447
|
+
(0, import_core3.useSensor)(import_core3.KeyboardSensor, {
|
|
49448
|
+
coordinateGetter: import_sortable4.sortableKeyboardCoordinates
|
|
49290
49449
|
})
|
|
49291
49450
|
);
|
|
49292
49451
|
const columnNames = (0, import_react49.useMemo)(() => {
|
|
@@ -49303,7 +49462,7 @@ function DraggableColumns({
|
|
|
49303
49462
|
if (active.id !== over.id) {
|
|
49304
49463
|
const oldIndex = columnNames.findIndex((c) => c.endsWith(active.id));
|
|
49305
49464
|
const newIndex = columnNames.findIndex((c) => c.endsWith(over.id));
|
|
49306
|
-
const newOrder = (0,
|
|
49465
|
+
const newOrder = (0, import_sortable4.arrayMove)(columnNames, oldIndex, newIndex);
|
|
49307
49466
|
const orderToColumns = newOrder.map((name2) => {
|
|
49308
49467
|
const [table, field] = name2.split(".");
|
|
49309
49468
|
return columns.find(
|
|
@@ -49320,16 +49479,16 @@ function DraggableColumns({
|
|
|
49320
49479
|
onColumnOrderChange(newColumns);
|
|
49321
49480
|
}
|
|
49322
49481
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
49323
|
-
|
|
49482
|
+
import_core3.DndContext,
|
|
49324
49483
|
{
|
|
49325
49484
|
sensors,
|
|
49326
|
-
collisionDetection:
|
|
49485
|
+
collisionDetection: import_core3.closestCenter,
|
|
49327
49486
|
onDragEnd: handleDragEnd,
|
|
49328
49487
|
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
49329
|
-
|
|
49488
|
+
import_sortable4.SortableContext,
|
|
49330
49489
|
{
|
|
49331
49490
|
items: columnNames,
|
|
49332
|
-
strategy:
|
|
49491
|
+
strategy: import_sortable4.verticalListSortingStrategy,
|
|
49333
49492
|
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
49334
49493
|
"div",
|
|
49335
49494
|
{
|