@perses-dev/table-plugin 0.13.0 → 0.14.0-beta.2
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/__mf/js/{Table.73b9cec1.js → Table.cede74c3.js} +3 -3
- package/__mf/js/async/1186.76f7a9c4.js +2 -0
- package/__mf/js/async/1522.f490bae9.js +22 -0
- package/__mf/js/async/1616.e459f6f7.js +1 -0
- package/__mf/js/async/2035.e9f08b1d.js +1 -0
- package/__mf/js/async/2043.ddbebd72.js +2 -0
- package/__mf/js/async/2251.2ab11c45.js +7 -0
- package/__mf/js/async/{1589.124ce93d.js.LICENSE.txt → 2251.2ab11c45.js.LICENSE.txt} +41 -1
- package/__mf/js/async/2465.b442bc56.js +1 -0
- package/__mf/js/async/2650.b874a7cd.js +3 -0
- package/__mf/js/async/392.3b464b91.js +2 -0
- package/__mf/js/async/3923.7b9985ff.js +1 -0
- package/__mf/js/async/4077.dfd731dd.js +1 -0
- package/__mf/js/async/4121.ed15fe74.js +2 -0
- package/__mf/js/async/4496.487e4f10.js +1 -0
- package/__mf/js/async/5002.fc50985b.js +1 -0
- package/__mf/js/async/5054.a0d861ae.js +1 -0
- package/__mf/js/async/5071.1e325f38.js +1 -0
- package/__mf/js/async/5153.8a046a40.js +1 -0
- package/__mf/js/async/5587.c9c77660.js +1 -0
- package/__mf/js/async/{868.507e984c.js → 5741.ef0c5df4.js} +6 -6
- package/__mf/js/async/6274.db89316a.js +2 -0
- package/__mf/js/async/7192.7e6af5a2.js +1 -0
- package/__mf/js/async/7534.63c81960.js +1 -0
- package/__mf/js/async/7862.cbf7b286.js +2 -0
- package/__mf/js/async/7968.f91456c8.js +1 -0
- package/__mf/js/async/7978.4553ce86.js +1 -0
- package/__mf/js/async/8356.d5d8a6a3.js +1 -0
- package/__mf/js/async/8470.f35cd609.js +2 -0
- package/__mf/js/async/873.fc45c2c6.js +1 -0
- package/__mf/js/async/8985.6cc7edf9.js +37 -0
- package/__mf/js/async/9148.1ff77cf0.js +1 -0
- package/__mf/js/async/9207.ca6ac0b2.js +1 -0
- package/__mf/js/async/9235.78a103e9.js +1 -0
- package/__mf/js/async/9321.ddbe25a2.js +1 -0
- package/__mf/js/async/941.96941f4e.js +2 -0
- package/__mf/js/async/9588.039ce076.js +1 -0
- package/__mf/js/async/__federation_expose_Table.e7708af8.js +1 -0
- package/__mf/js/async/lib-router.e968bcc8.js +2 -0
- package/__mf/js/{main.7b15c841.js → main.7815ee7c.js} +2 -2
- package/lib/Table.d.ts +3 -3
- package/lib/Table.d.ts.map +1 -1
- package/lib/Table.js +4 -4
- package/lib/Table.js.map +1 -1
- package/lib/TableExportAction.d.ts +3 -3
- package/lib/TableExportAction.d.ts.map +1 -1
- package/lib/TableExportAction.js +6 -6
- package/lib/TableExportAction.js.map +1 -1
- package/lib/bootstrap.js +2 -2
- package/lib/components/CellsEditor/CellsEditor.d.ts +2 -2
- package/lib/components/CellsEditor/CellsEditor.d.ts.map +1 -1
- package/lib/components/CellsEditor/CellsEditor.js +1 -1
- package/lib/components/CellsEditor/CellsEditor.js.map +1 -1
- package/lib/components/CellsEditor/index.js +1 -1
- package/lib/components/CellsEditor/index.js.map +1 -1
- package/lib/components/ColumnsEditor/ColumnEditor.d.ts +5 -4
- package/lib/components/ColumnsEditor/ColumnEditor.d.ts.map +1 -1
- package/lib/components/ColumnsEditor/ColumnEditor.js +29 -15
- package/lib/components/ColumnsEditor/ColumnEditor.js.map +1 -1
- package/lib/components/ColumnsEditor/ColumnEditorContainer.d.ts +3 -3
- package/lib/components/ColumnsEditor/ColumnEditorContainer.d.ts.map +1 -1
- package/lib/components/ColumnsEditor/ColumnEditorContainer.js +11 -10
- package/lib/components/ColumnsEditor/ColumnEditorContainer.js.map +1 -1
- package/lib/components/ColumnsEditor/ColumnsEditor.d.ts +4 -3
- package/lib/components/ColumnsEditor/ColumnsEditor.d.ts.map +1 -1
- package/lib/components/ColumnsEditor/ColumnsEditor.js +7 -6
- package/lib/components/ColumnsEditor/ColumnsEditor.js.map +1 -1
- package/lib/components/ColumnsEditor/DataLinkEditorDialog.d.ts +2 -2
- package/lib/components/ColumnsEditor/DataLinkEditorDialog.d.ts.map +1 -1
- package/lib/components/ColumnsEditor/DataLinkEditorDialog.js +4 -4
- package/lib/components/ColumnsEditor/DataLinkEditorDialog.js.map +1 -1
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts +2 -2
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts.map +1 -1
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +4 -4
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js.map +1 -1
- package/lib/components/ColumnsEditor/index.js +3 -3
- package/lib/components/ColumnsEditor/index.js.map +1 -1
- package/lib/components/ConditionalPanel.d.ts +3 -3
- package/lib/components/ConditionalPanel.d.ts.map +1 -1
- package/lib/components/ConditionalPanel.js +7 -7
- package/lib/components/ConditionalPanel.js.map +1 -1
- package/lib/components/EmbeddedPanel.d.ts +3 -3
- package/lib/components/EmbeddedPanel.d.ts.map +1 -1
- package/lib/components/EmbeddedPanel.js +4 -4
- package/lib/components/EmbeddedPanel.js.map +1 -1
- package/lib/components/TableCellsEditor.d.ts +3 -3
- package/lib/components/TableCellsEditor.d.ts.map +1 -1
- package/lib/components/TableCellsEditor.js +1 -1
- package/lib/components/TableCellsEditor.js.map +1 -1
- package/lib/components/TableColumnsEditor.d.ts +3 -3
- package/lib/components/TableColumnsEditor.d.ts.map +1 -1
- package/lib/components/TableColumnsEditor.js +3 -2
- package/lib/components/TableColumnsEditor.js.map +1 -1
- package/lib/components/TableItemSelectionActionsEditor.d.ts +2 -2
- package/lib/components/TableItemSelectionActionsEditor.d.ts.map +1 -1
- package/lib/components/TableItemSelectionActionsEditor.js +2 -2
- package/lib/components/TableItemSelectionActionsEditor.js.map +1 -1
- package/lib/components/TablePanel.d.ts +4 -4
- package/lib/components/TablePanel.d.ts.map +1 -1
- package/lib/components/TablePanel.js +196 -99
- package/lib/components/TablePanel.js.map +1 -1
- package/lib/components/TableSettingsEditor.d.ts +2 -2
- package/lib/components/TableSettingsEditor.d.ts.map +1 -1
- package/lib/components/TableSettingsEditor.js +16 -2
- package/lib/components/TableSettingsEditor.js.map +1 -1
- package/lib/components/TableTransformsEditor.d.ts +2 -2
- package/lib/components/TableTransformsEditor.d.ts.map +1 -1
- package/lib/components/TableTransformsEditor.js +2 -2
- package/lib/components/TableTransformsEditor.js.map +1 -1
- package/lib/components/index.js +9 -9
- package/lib/components/index.js.map +1 -1
- package/lib/getPluginModule.d.ts +1 -1
- package/lib/getPluginModule.d.ts.map +1 -1
- package/lib/getPluginModule.js +3 -1
- package/lib/getPluginModule.js.map +1 -1
- package/lib/index-federation.js +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/models/index.js +2 -2
- package/lib/models/index.js.map +1 -1
- package/lib/models/model.d.ts +1 -1
- package/lib/models/model.d.ts.map +1 -1
- package/lib/models/model.js.map +1 -1
- package/lib/models/table-model.d.ts +4 -3
- package/lib/models/table-model.d.ts.map +1 -1
- package/lib/models/table-model.js +2 -2
- package/lib/models/table-model.js.map +1 -1
- package/lib/setup-tests.d.ts +1 -1
- package/lib/setup-tests.d.ts.map +1 -1
- package/lib/setup-tests.js +8 -2
- package/lib/setup-tests.js.map +1 -1
- package/lib/table-data-utils.d.ts +3 -3
- package/lib/table-data-utils.d.ts.map +1 -1
- package/lib/table-data-utils.js.map +1 -1
- package/lib/test/mock-query-results.d.ts +1 -1
- package/lib/test/mock-query-results.d.ts.map +1 -1
- package/lib/test/mock-query-results.js.map +1 -1
- package/mf-manifest.json +48 -46
- package/mf-stats.json +52 -47
- package/package.json +11 -11
- package/__mf/js/async/1432.4e515509.js +0 -1
- package/__mf/js/async/1589.124ce93d.js +0 -2
- package/__mf/js/async/1616.4828085d.js +0 -1
- package/__mf/js/async/2043.1f09864b.js +0 -2
- package/__mf/js/async/2082.231e8397.js +0 -1
- package/__mf/js/async/2842.a52597e6.js +0 -1
- package/__mf/js/async/392.b6035b41.js +0 -2
- package/__mf/js/async/3981.52e94742.js +0 -3
- package/__mf/js/async/4014.cf88a118.js +0 -7
- package/__mf/js/async/4014.cf88a118.js.LICENSE.txt +0 -39
- package/__mf/js/async/4121.e7df36d6.js +0 -2
- package/__mf/js/async/5002.3eb39a8c.js +0 -1
- package/__mf/js/async/5021.c663603d.js +0 -1
- package/__mf/js/async/5071.839a8f1a.js +0 -1
- package/__mf/js/async/5481.6496fac9.js +0 -2
- package/__mf/js/async/5587.a8a428db.js +0 -1
- package/__mf/js/async/6274.8edae86d.js +0 -2
- package/__mf/js/async/629.8cff215d.js +0 -1
- package/__mf/js/async/6811.9d4b123a.js +0 -38
- package/__mf/js/async/7177.e0e5ba2f.js +0 -1
- package/__mf/js/async/7192.692181c8.js +0 -1
- package/__mf/js/async/7413.c9310b8a.js +0 -1
- package/__mf/js/async/7968.3a9a982e.js +0 -1
- package/__mf/js/async/7978.116e4d81.js +0 -1
- package/__mf/js/async/7984.a8edc213.js +0 -22
- package/__mf/js/async/8356.152d5686.js +0 -1
- package/__mf/js/async/8470.b9762117.js +0 -2
- package/__mf/js/async/873.264fedc9.js +0 -1
- package/__mf/js/async/9051.c4deebd7.js +0 -1
- package/__mf/js/async/9235.c67cdb1d.js +0 -1
- package/__mf/js/async/941.cc458a98.js +0 -2
- package/__mf/js/async/9588.d23e2ed3.js +0 -1
- package/__mf/js/async/9701.9c4cea02.js +0 -1
- package/__mf/js/async/__federation_expose_Table.5d0cfb46.js +0 -1
- package/__mf/js/async/lib-router.3493bbf9.js +0 -2
- package/lib/cjs/Table.js +0 -62
- package/lib/cjs/TableExportAction.js +0 -180
- package/lib/cjs/bootstrap.js +0 -26
- package/lib/cjs/components/CellsEditor/CellsEditor.js +0 -30
- package/lib/cjs/components/CellsEditor/index.js +0 -30
- package/lib/cjs/components/ColumnsEditor/ColumnEditor.js +0 -289
- package/lib/cjs/components/ColumnsEditor/ColumnEditorContainer.js +0 -152
- package/lib/cjs/components/ColumnsEditor/ColumnsEditor.js +0 -108
- package/lib/cjs/components/ColumnsEditor/DataLinkEditorDialog.js +0 -139
- package/lib/cjs/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +0 -124
- package/lib/cjs/components/ColumnsEditor/index.js +0 -32
- package/lib/cjs/components/ConditionalPanel.js +0 -367
- package/lib/cjs/components/EmbeddedPanel.js +0 -52
- package/lib/cjs/components/TableCellsEditor.js +0 -36
- package/lib/cjs/components/TableColumnsEditor.js +0 -36
- package/lib/cjs/components/TableItemSelectionActionsEditor.js +0 -44
- package/lib/cjs/components/TablePanel.js +0 -845
- package/lib/cjs/components/TableSettingsEditor.js +0 -144
- package/lib/cjs/components/TableTransformsEditor.js +0 -36
- package/lib/cjs/components/index.js +0 -38
- package/lib/cjs/env.d.js +0 -14
- package/lib/cjs/getPluginModule.js +0 -39
- package/lib/cjs/index-federation.js +0 -55
- package/lib/cjs/index.js +0 -39
- package/lib/cjs/models/index.js +0 -31
- package/lib/cjs/models/model.js +0 -16
- package/lib/cjs/models/table-model.js +0 -278
- package/lib/cjs/setup-tests.js +0 -19
- package/lib/cjs/table-data-utils.js +0 -84
- package/lib/cjs/test/mock-query-results.js +0 -524
- /package/__mf/css/async/{4014.85c2cbf6.css → 2251.85c2cbf6.css} +0 -0
- /package/__mf/js/async/{7984.a8edc213.js.LICENSE.txt → 1522.f490bae9.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2043.1f09864b.js.LICENSE.txt → 2043.ddbebd72.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.b6035b41.js.LICENSE.txt → 392.3b464b91.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4121.e7df36d6.js.LICENSE.txt → 4121.ed15fe74.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{868.507e984c.js.LICENSE.txt → 5741.ef0c5df4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6274.8edae86d.js.LICENSE.txt → 6274.db89316a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5481.6496fac9.js.LICENSE.txt → 7862.cbf7b286.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8470.b9762117.js.LICENSE.txt → 8470.f35cd609.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.cc458a98.js.LICENSE.txt → 941.96941f4e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.3493bbf9.js.LICENSE.txt → lib-router.e968bcc8.js.LICENSE.txt} +0 -0
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
function _export(target, all) {
|
|
18
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
get createInitialTableOptions () {
|
|
25
|
-
return createInitialTableOptions;
|
|
26
|
-
},
|
|
27
|
-
get evaluateCondition () {
|
|
28
|
-
return evaluateCondition;
|
|
29
|
-
},
|
|
30
|
-
get evaluateConditionalFormatting () {
|
|
31
|
-
return evaluateConditionalFormatting;
|
|
32
|
-
},
|
|
33
|
-
get formatCellDisplay () {
|
|
34
|
-
return formatCellDisplay;
|
|
35
|
-
},
|
|
36
|
-
get renderConditionEditor () {
|
|
37
|
-
return renderConditionEditor;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
41
|
-
const _material = require("@mui/material");
|
|
42
|
-
function _interop_require_default(obj) {
|
|
43
|
-
return obj && obj.__esModule ? obj : {
|
|
44
|
-
default: obj
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function createInitialTableOptions() {
|
|
48
|
-
return {
|
|
49
|
-
density: 'standard',
|
|
50
|
-
enableFiltering: true
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function parseRangeBound(rawValue) {
|
|
54
|
-
const trimmed = rawValue.trim();
|
|
55
|
-
if (trimmed === '') {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
const parsed = Number(trimmed);
|
|
59
|
-
return Number.isNaN(parsed) ? undefined : parsed;
|
|
60
|
-
}
|
|
61
|
-
function formatCellDisplay(value, setting, defaultText) {
|
|
62
|
-
const baseText = setting.text || defaultText || String(value);
|
|
63
|
-
const displayText = `${setting.prefix ?? ''}${baseText}${setting.suffix ?? ''}`;
|
|
64
|
-
return {
|
|
65
|
-
text: displayText,
|
|
66
|
-
textColor: setting.textColor,
|
|
67
|
-
backgroundColor: setting.backgroundColor
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
function evaluateCondition(condition, value) {
|
|
71
|
-
switch(condition.kind){
|
|
72
|
-
case 'Value':
|
|
73
|
-
return condition.spec?.value === String(value);
|
|
74
|
-
case 'Range':
|
|
75
|
-
{
|
|
76
|
-
if (Number.isNaN(Number(value))) return false;
|
|
77
|
-
const numericValue = Number(value);
|
|
78
|
-
// Both min and max defined
|
|
79
|
-
if (condition.spec?.min !== undefined && condition.spec?.max !== undefined) {
|
|
80
|
-
return numericValue >= +condition.spec.min && numericValue <= +condition.spec.max;
|
|
81
|
-
}
|
|
82
|
-
// Only min defined
|
|
83
|
-
if (condition.spec?.min !== undefined) {
|
|
84
|
-
return numericValue >= +condition.spec.min;
|
|
85
|
-
}
|
|
86
|
-
// Only max defined
|
|
87
|
-
if (condition.spec?.max !== undefined) {
|
|
88
|
-
return numericValue <= +condition.spec.max;
|
|
89
|
-
}
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
case 'Regex':
|
|
93
|
-
if (!condition.spec?.expr) return false;
|
|
94
|
-
try {
|
|
95
|
-
const regex = new RegExp(condition.spec.expr);
|
|
96
|
-
return regex.test(String(value));
|
|
97
|
-
} catch {
|
|
98
|
-
return false; // Invalid regex
|
|
99
|
-
}
|
|
100
|
-
case 'Misc':
|
|
101
|
-
switch(condition.spec?.value){
|
|
102
|
-
case 'empty':
|
|
103
|
-
return value === '';
|
|
104
|
-
case 'null':
|
|
105
|
-
return value === null || value === undefined;
|
|
106
|
-
case 'NaN':
|
|
107
|
-
return Number.isNaN(value);
|
|
108
|
-
case 'true':
|
|
109
|
-
return value === true;
|
|
110
|
-
case 'false':
|
|
111
|
-
return value === false;
|
|
112
|
-
default:
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
default:
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function evaluateConditionalFormatting(value, settings) {
|
|
120
|
-
for (const setting of settings){
|
|
121
|
-
if (evaluateCondition(setting.condition, value)) {
|
|
122
|
-
// Handle special default text cases
|
|
123
|
-
let defaultText;
|
|
124
|
-
if (setting.condition.kind === 'Misc') {
|
|
125
|
-
switch(setting.condition.spec?.value){
|
|
126
|
-
case 'null':
|
|
127
|
-
defaultText = 'null';
|
|
128
|
-
break;
|
|
129
|
-
case 'NaN':
|
|
130
|
-
defaultText = 'NaN';
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return formatCellDisplay(value, setting, defaultText);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return undefined; // No conditions matched
|
|
138
|
-
}
|
|
139
|
-
function renderConditionEditor(condition, onChange, size = 'small') {
|
|
140
|
-
if (condition.kind === 'Value') {
|
|
141
|
-
return _react.default.createElement(_material.TextField, {
|
|
142
|
-
label: 'Value',
|
|
143
|
-
placeholder: 'Exact value',
|
|
144
|
-
value: condition.spec?.value ?? '',
|
|
145
|
-
onChange: (e)=>onChange({
|
|
146
|
-
...condition,
|
|
147
|
-
spec: {
|
|
148
|
-
value: e.target.value
|
|
149
|
-
}
|
|
150
|
-
}),
|
|
151
|
-
fullWidth: true,
|
|
152
|
-
size: size
|
|
153
|
-
});
|
|
154
|
-
} else if (condition.kind === 'Range') {
|
|
155
|
-
return _react.default.createElement(_material.Stack, {
|
|
156
|
-
gap: 1,
|
|
157
|
-
direction: 'row'
|
|
158
|
-
}, [
|
|
159
|
-
_react.default.createElement(_material.TextField, {
|
|
160
|
-
key: 'min',
|
|
161
|
-
label: 'From',
|
|
162
|
-
placeholder: 'Start of range',
|
|
163
|
-
value: condition.spec?.min ?? '',
|
|
164
|
-
onChange: (e)=>{
|
|
165
|
-
const nextMin = parseRangeBound(e.target.value);
|
|
166
|
-
onChange({
|
|
167
|
-
...condition,
|
|
168
|
-
spec: {
|
|
169
|
-
...condition.spec,
|
|
170
|
-
min: nextMin
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
},
|
|
174
|
-
type: 'number',
|
|
175
|
-
slotProps: {
|
|
176
|
-
htmlInput: {
|
|
177
|
-
step: 'any'
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
fullWidth: true,
|
|
181
|
-
size: size
|
|
182
|
-
}),
|
|
183
|
-
_react.default.createElement(_material.TextField, {
|
|
184
|
-
key: 'max',
|
|
185
|
-
label: 'To',
|
|
186
|
-
placeholder: 'End of range (inclusive)',
|
|
187
|
-
value: condition.spec?.max ?? '',
|
|
188
|
-
onChange: (e)=>{
|
|
189
|
-
const nextMax = parseRangeBound(e.target.value);
|
|
190
|
-
onChange({
|
|
191
|
-
...condition,
|
|
192
|
-
spec: {
|
|
193
|
-
...condition.spec,
|
|
194
|
-
max: nextMax
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
},
|
|
198
|
-
type: 'number',
|
|
199
|
-
slotProps: {
|
|
200
|
-
htmlInput: {
|
|
201
|
-
step: 'any'
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
fullWidth: true,
|
|
205
|
-
size: size
|
|
206
|
-
})
|
|
207
|
-
]);
|
|
208
|
-
} else if (condition.kind === 'Regex') {
|
|
209
|
-
return _react.default.createElement(_material.TextField, {
|
|
210
|
-
label: 'Regular Expression',
|
|
211
|
-
placeholder: 'JavaScript regular expression',
|
|
212
|
-
value: condition.spec?.expr ?? '',
|
|
213
|
-
onChange: (e)=>onChange({
|
|
214
|
-
...condition,
|
|
215
|
-
spec: {
|
|
216
|
-
expr: e.target.value
|
|
217
|
-
}
|
|
218
|
-
}),
|
|
219
|
-
fullWidth: true,
|
|
220
|
-
size: size
|
|
221
|
-
});
|
|
222
|
-
} else if (condition.kind === 'Misc') {
|
|
223
|
-
const options = [
|
|
224
|
-
{
|
|
225
|
-
value: 'empty',
|
|
226
|
-
label: 'Empty',
|
|
227
|
-
caption: 'Matches empty string'
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
value: 'null',
|
|
231
|
-
label: 'Null',
|
|
232
|
-
caption: 'Matches null or undefined'
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
value: 'NaN',
|
|
236
|
-
label: 'NaN',
|
|
237
|
-
caption: 'Matches Not a Number value'
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
value: 'true',
|
|
241
|
-
label: 'True',
|
|
242
|
-
caption: 'Matches true boolean'
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
value: 'false',
|
|
246
|
-
label: 'False',
|
|
247
|
-
caption: 'Matches false boolean'
|
|
248
|
-
}
|
|
249
|
-
];
|
|
250
|
-
return _react.default.createElement(_material.TextField, {
|
|
251
|
-
select: true,
|
|
252
|
-
label: 'Value',
|
|
253
|
-
value: condition.spec?.value ?? '',
|
|
254
|
-
onChange: (e)=>onChange({
|
|
255
|
-
...condition,
|
|
256
|
-
spec: {
|
|
257
|
-
value: e.target.value
|
|
258
|
-
}
|
|
259
|
-
}),
|
|
260
|
-
fullWidth: true,
|
|
261
|
-
size: size
|
|
262
|
-
}, options.map((option)=>_react.default.createElement(_material.MenuItem, {
|
|
263
|
-
key: option.value,
|
|
264
|
-
value: option.value
|
|
265
|
-
}, _react.default.createElement(_material.Stack, {
|
|
266
|
-
key: 'stack'
|
|
267
|
-
}, [
|
|
268
|
-
_react.default.createElement(_material.Typography, {
|
|
269
|
-
key: 'title'
|
|
270
|
-
}, option.label),
|
|
271
|
-
_react.default.createElement(_material.Typography, {
|
|
272
|
-
key: 'caption',
|
|
273
|
-
variant: 'caption'
|
|
274
|
-
}, option.caption)
|
|
275
|
-
]))));
|
|
276
|
-
}
|
|
277
|
-
return null;
|
|
278
|
-
}
|
package/lib/cjs/setup-tests.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
require("@testing-library/jest-dom");
|
|
18
|
-
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
19
|
-
jest.mock('echarts/core');
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
function _export(target, all) {
|
|
18
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
get buildRawTableData () {
|
|
25
|
-
return buildRawTableData;
|
|
26
|
-
},
|
|
27
|
-
get getTablePanelQueryMode () {
|
|
28
|
-
return getTablePanelQueryMode;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
function getTablePanelQueryMode(spec) {
|
|
32
|
-
return (spec.columnSettings ?? []).some((c)=>c.plugin) ? 'range' : 'instant';
|
|
33
|
-
}
|
|
34
|
-
function buildRawTableData(queryResults, spec, options = {}) {
|
|
35
|
-
const { forExport = false } = options;
|
|
36
|
-
const queryMode = getTablePanelQueryMode(spec);
|
|
37
|
-
return queryResults.flatMap((data, queryIndex)=>(data.data?.series ?? []).map((ts)=>({
|
|
38
|
-
data,
|
|
39
|
-
ts,
|
|
40
|
-
queryIndex
|
|
41
|
-
}))).map(({ data, ts, queryIndex })=>{
|
|
42
|
-
// Pick the last (most recent) data point. For range responses the last
|
|
43
|
-
// value covers the window ending at the selected time range's end.
|
|
44
|
-
const lastPoint = ts.values[ts.values.length - 1];
|
|
45
|
-
if (lastPoint === undefined) {
|
|
46
|
-
return {
|
|
47
|
-
...ts.labels
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
// If there are multiple queries, add query index to value key and label keys to avoid conflicts
|
|
51
|
-
const valueColumnName = queryResults.length === 1 ? 'value' : `value #${queryIndex + 1}`;
|
|
52
|
-
const labels = queryResults.length === 1 ? ts.labels : Object.entries(ts.labels ?? {}).reduce((acc, [key, value])=>{
|
|
53
|
-
if (key) acc[`${key} #${queryIndex + 1}`] = value;
|
|
54
|
-
return acc;
|
|
55
|
-
}, {});
|
|
56
|
-
// For export: always use raw scalar values
|
|
57
|
-
// For rendering: plugin columns get embedded PanelData objects
|
|
58
|
-
let columnValue;
|
|
59
|
-
if (forExport) {
|
|
60
|
-
columnValue = lastPoint[1];
|
|
61
|
-
} else {
|
|
62
|
-
const hasPlugin = (spec.columnSettings ?? []).find((x)=>x.name === valueColumnName)?.plugin;
|
|
63
|
-
columnValue = hasPlugin ? {
|
|
64
|
-
...data,
|
|
65
|
-
data: {
|
|
66
|
-
...data.data,
|
|
67
|
-
series: data.data.series.filter((s)=>s === ts)
|
|
68
|
-
}
|
|
69
|
-
} : lastPoint[1];
|
|
70
|
-
}
|
|
71
|
-
if (queryMode === 'instant') {
|
|
72
|
-
return {
|
|
73
|
-
timestamp: lastPoint[0],
|
|
74
|
-
[valueColumnName]: columnValue,
|
|
75
|
-
...labels
|
|
76
|
-
};
|
|
77
|
-
} else {
|
|
78
|
-
return {
|
|
79
|
-
[valueColumnName]: columnValue,
|
|
80
|
-
...labels
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|