@vizzly/dashboard 0.15.0-dev-8918a59c86fe6247b4e6ab94c7292899afc191c9 → 0.15.0-dev-b45c36b267f57597301af4c568315651ecc53893
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/dashboard.esm.js
CHANGED
|
@@ -24540,6 +24540,14 @@ var asyncLoadFilterOptions = function asyncLoadFilterOptions(filter, runQueriesC
|
|
|
24540
24540
|
}();
|
|
24541
24541
|
};
|
|
24542
24542
|
|
|
24543
|
+
/**
|
|
24544
|
+
* Calculates the width of the given text by creating a temporary HTML element and measuring its offsetWidth.
|
|
24545
|
+
* @param text - The text string to measure.
|
|
24546
|
+
* @param element - The HTML element type to use for measurement (e.g., 'span').
|
|
24547
|
+
* @param styles - Optional styling properties, including fontSize and fontWeight.
|
|
24548
|
+
* @returns The calculated width of the text in pixels.
|
|
24549
|
+
* OBS: For every function call you should use useMemo to avoid infinitely re-renders (especially in Google Chrome).
|
|
24550
|
+
*/
|
|
24543
24551
|
var calculateTextWidth = function calculateTextWidth(text, element, styles) {
|
|
24544
24552
|
// Create a temporary HTML element to measure the width
|
|
24545
24553
|
|
|
@@ -24573,6 +24581,14 @@ var calculateTextWidth = function calculateTextWidth(text, element, styles) {
|
|
|
24573
24581
|
document.body.removeChild(wrapperDiv);
|
|
24574
24582
|
return textWidth;
|
|
24575
24583
|
};
|
|
24584
|
+
|
|
24585
|
+
/**
|
|
24586
|
+
* Calculates the width of a label text, ensuring a minimum width.
|
|
24587
|
+
* @param label - The text label to measure.
|
|
24588
|
+
* @param labelStyles - Optional styling properties from the theme, including fontSize and fontWeight.
|
|
24589
|
+
* @returns The calculated width in pixels, with a minimum of 124 (100 + 24 for padding).
|
|
24590
|
+
* OBS: For every function call you should use useMemo to avoid infinitely re-renders (especially in Google Chrome).
|
|
24591
|
+
*/
|
|
24576
24592
|
function calculateLabelWidth(label, labelStyles) {
|
|
24577
24593
|
var calculateLabelWidth = calculateTextWidth(label, 'span', {
|
|
24578
24594
|
fontSize: labelStyles == null ? void 0 : labelStyles.fontSize,
|
|
@@ -24582,7 +24598,7 @@ function calculateLabelWidth(label, labelStyles) {
|
|
|
24582
24598
|
}
|
|
24583
24599
|
|
|
24584
24600
|
var AdditionalSingleSelectFilter = function AdditionalSingleSelectFilter(props) {
|
|
24585
|
-
var _theme$
|
|
24601
|
+
var _theme$forms2, _props$filter$title;
|
|
24586
24602
|
var _useDashboardContext = useDashboardContext(),
|
|
24587
24603
|
runQueriesCallback = _useDashboardContext.runQueriesCallback;
|
|
24588
24604
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -24669,7 +24685,10 @@ var AdditionalSingleSelectFilter = function AdditionalSingleSelectFilter(props)
|
|
|
24669
24685
|
prevFilterRef.current = filter.optionsFilters;
|
|
24670
24686
|
}, [filter.optionsFilters]);
|
|
24671
24687
|
var label = getTitle(filter, dataSets, textOverride);
|
|
24672
|
-
var labelWidth =
|
|
24688
|
+
var labelWidth = useMemo(function () {
|
|
24689
|
+
var _theme$forms;
|
|
24690
|
+
return calculateLabelWidth(label, theme == null || (_theme$forms = theme.forms) == null ? void 0 : _theme$forms.select);
|
|
24691
|
+
}, [label, theme == null || (_theme$forms2 = theme.forms) == null ? void 0 : _theme$forms2.select]);
|
|
24673
24692
|
if (props.filter.hidden) return null;
|
|
24674
24693
|
var currentValue = function () {
|
|
24675
24694
|
if (valueAlias) {
|
|
@@ -26000,11 +26019,14 @@ var Modal = /*#__PURE__*/Object.assign(BaseModal, {
|
|
|
26000
26019
|
});
|
|
26001
26020
|
|
|
26002
26021
|
var AdvancedPicker = function AdvancedPicker(props) {
|
|
26003
|
-
var _theme$
|
|
26022
|
+
var _theme$forms2, _theme$modals;
|
|
26004
26023
|
var theme = useTheme();
|
|
26005
26024
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
26006
26025
|
featureToggles = _useDashboardBehaviou.featureToggles;
|
|
26007
|
-
var labelWidth =
|
|
26026
|
+
var labelWidth = useMemo(function () {
|
|
26027
|
+
var _theme$forms;
|
|
26028
|
+
return calculateLabelWidth(props.label, theme == null || (_theme$forms = theme.forms) == null ? void 0 : _theme$forms.select);
|
|
26029
|
+
}, [props.label, theme == null || (_theme$forms2 = theme.forms) == null ? void 0 : _theme$forms2.select]);
|
|
26008
26030
|
var inputRef = useRef(null);
|
|
26009
26031
|
var _useState = useState({}),
|
|
26010
26032
|
position = _useState[0],
|
|
@@ -29996,7 +30018,7 @@ function buildDateTimePayload(type, filter, value) {
|
|
|
29996
30018
|
}
|
|
29997
30019
|
|
|
29998
30020
|
var DateFilter$1 = function DateFilter(props) {
|
|
29999
|
-
var _theme$
|
|
30021
|
+
var _theme$forms2, _props$filter$title;
|
|
30000
30022
|
var theme = useTheme();
|
|
30001
30023
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
30002
30024
|
textOverride = _useDashboardBehaviou.textOverride,
|
|
@@ -30009,7 +30031,10 @@ var DateFilter$1 = function DateFilter(props) {
|
|
|
30009
30031
|
showClearBtn = props.showClearBtn,
|
|
30010
30032
|
type = props.type;
|
|
30011
30033
|
var label = getTitle(filter, dataSets, textOverride);
|
|
30012
|
-
var labelWidth =
|
|
30034
|
+
var labelWidth = useMemo(function () {
|
|
30035
|
+
var _theme$forms;
|
|
30036
|
+
return calculateLabelWidth(label, theme == null || (_theme$forms = theme.forms) == null ? void 0 : _theme$forms.select);
|
|
30037
|
+
}, [label, theme == null || (_theme$forms2 = theme.forms) == null ? void 0 : _theme$forms2.select]);
|
|
30013
30038
|
var isDateTimeFilter = !!(type === DATE_FILTER && 'allowTimeSelection' in filter && filter.allowTimeSelection);
|
|
30014
30039
|
if (props.filter.hidden) return null;
|
|
30015
30040
|
return jsx(View, {
|
|
@@ -30181,13 +30206,16 @@ var DisplayChips = function DisplayChips(_ref) {
|
|
|
30181
30206
|
};
|
|
30182
30207
|
|
|
30183
30208
|
var AdvancedDisplayValues = function AdvancedDisplayValues(props) {
|
|
30184
|
-
var
|
|
30209
|
+
var _theme$forms3, _theme$forms4, _props$label2, _theme$forms5, _theme$forms6;
|
|
30185
30210
|
var theme = useTheme();
|
|
30186
30211
|
var showSelect = props.pickerOpen || !props.defined;
|
|
30187
|
-
var textWidth =
|
|
30188
|
-
|
|
30189
|
-
|
|
30190
|
-
|
|
30212
|
+
var textWidth = useMemo(function () {
|
|
30213
|
+
var _props$label, _theme$forms, _theme$forms2;
|
|
30214
|
+
return calculateTextWidth((_props$label = props == null ? void 0 : props.label) != null ? _props$label : '', 'label', {
|
|
30215
|
+
fontSize: theme == null || (_theme$forms = theme.forms) == null || (_theme$forms = _theme$forms.input) == null ? void 0 : _theme$forms.fontSize,
|
|
30216
|
+
fontWeight: theme == null || (_theme$forms2 = theme.forms) == null || (_theme$forms2 = _theme$forms2.input) == null ? void 0 : _theme$forms2.fontWeight
|
|
30217
|
+
});
|
|
30218
|
+
}, [props.label, theme == null || (_theme$forms3 = theme.forms) == null || (_theme$forms3 = _theme$forms3.input) == null ? void 0 : _theme$forms3.fontSize, theme == null || (_theme$forms4 = theme.forms) == null || (_theme$forms4 = _theme$forms4.input) == null ? void 0 : _theme$forms4.fontWeight]);
|
|
30191
30219
|
var chips = getChips(props.filter, props.type, props.filter.options);
|
|
30192
30220
|
return jsx("div", {
|
|
30193
30221
|
onClick: function onClick() {
|
|
@@ -30223,7 +30251,7 @@ var AdvancedDisplayValues = function AdvancedDisplayValues(props) {
|
|
|
30223
30251
|
width: 26.5
|
|
30224
30252
|
})
|
|
30225
30253
|
}), jsx("div", {
|
|
30226
|
-
className: joinClassNames(selectControlsStyles.arrowContainer(theme == null || (_theme$
|
|
30254
|
+
className: joinClassNames(selectControlsStyles.arrowContainer(theme == null || (_theme$forms5 = theme.forms) == null ? void 0 : _theme$forms5.select, 26.5)({
|
|
30227
30255
|
subtle: 'off'
|
|
30228
30256
|
}), styles({
|
|
30229
30257
|
position: 'absolute',
|
|
@@ -30234,7 +30262,7 @@ var AdvancedDisplayValues = function AdvancedDisplayValues(props) {
|
|
|
30234
30262
|
children: jsx(ArrowButton, {
|
|
30235
30263
|
label: "open",
|
|
30236
30264
|
arrowStart: "up",
|
|
30237
|
-
styled: theme == null || (_theme$
|
|
30265
|
+
styled: theme == null || (_theme$forms6 = theme.forms) == null ? void 0 : _theme$forms6.select,
|
|
30238
30266
|
expanded: showSelect
|
|
30239
30267
|
})
|
|
30240
30268
|
})]
|
|
@@ -30525,7 +30553,7 @@ var Form = function Form(props) {
|
|
|
30525
30553
|
};
|
|
30526
30554
|
|
|
30527
30555
|
var MultiSelectFilter = function MultiSelectFilter(props) {
|
|
30528
|
-
var _theme$
|
|
30556
|
+
var _theme$forms2, _filter$value, _filter$value2, _filter$value3;
|
|
30529
30557
|
var theme = useTheme();
|
|
30530
30558
|
var prevFilterRef = useRef(undefined);
|
|
30531
30559
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -30665,7 +30693,10 @@ var MultiSelectFilter = function MultiSelectFilter(props) {
|
|
|
30665
30693
|
}
|
|
30666
30694
|
prevFilterRef.current = filter.optionsFilters;
|
|
30667
30695
|
}, [filter.optionsFilters]);
|
|
30668
|
-
var labelWidth =
|
|
30696
|
+
var labelWidth = useMemo(function () {
|
|
30697
|
+
var _theme$forms;
|
|
30698
|
+
return calculateLabelWidth(label, theme == null || (_theme$forms = theme.forms) == null ? void 0 : _theme$forms.select);
|
|
30699
|
+
}, [label, theme == null || (_theme$forms2 = theme.forms) == null ? void 0 : _theme$forms2.select]);
|
|
30669
30700
|
if (props.filter.hidden) return null;
|
|
30670
30701
|
return jsx(View, {
|
|
30671
30702
|
minWidth: labelWidth + 36,
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { VizzlyTheming } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Calculates the width of the given text by creating a temporary HTML element and measuring its offsetWidth.
|
|
5
|
+
* @param text - The text string to measure.
|
|
6
|
+
* @param element - The HTML element type to use for measurement (e.g., 'span').
|
|
7
|
+
* @param styles - Optional styling properties, including fontSize and fontWeight.
|
|
8
|
+
* @returns The calculated width of the text in pixels.
|
|
9
|
+
* OBS: For every function call you should use useMemo to avoid infinitely re-renders (especially in Google Chrome).
|
|
10
|
+
*/
|
|
3
11
|
export declare const calculateTextWidth: (text: string, element: keyof JSX.IntrinsicElements, styles?: {
|
|
4
12
|
fontSize?: CSSProperties['fontSize'];
|
|
5
13
|
fontWeight?: CSSProperties['fontWeight'];
|
|
@@ -10,4 +18,11 @@ export declare const getFontProperties: (element: HTMLElement) => {
|
|
|
10
18
|
fontSize: string;
|
|
11
19
|
letterSpacing: string;
|
|
12
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Calculates the width of a label text, ensuring a minimum width.
|
|
23
|
+
* @param label - The text label to measure.
|
|
24
|
+
* @param labelStyles - Optional styling properties from the theme, including fontSize and fontWeight.
|
|
25
|
+
* @returns The calculated width in pixels, with a minimum of 124 (100 + 24 for padding).
|
|
26
|
+
* OBS: For every function call you should use useMemo to avoid infinitely re-renders (especially in Google Chrome).
|
|
27
|
+
*/
|
|
13
28
|
export declare function calculateLabelWidth(label: string, labelStyles?: VizzlyTheming.Select): number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizzly/dashboard",
|
|
3
3
|
"author": "james@vizzly.co",
|
|
4
|
-
"version": "0.15.0-dev-
|
|
4
|
+
"version": "0.15.0-dev-b45c36b267f57597301af4c568315651ecc53893",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "./dist/dashboard/src/index.d.ts",
|
|
7
7
|
"module": "./dist/dashboard.esm.js",
|