dash-core-components 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dash_core_components/async-datepicker.js +1 -1
- package/dash_core_components/async-datepicker.js.map +1 -1
- package/dash_core_components/async-dropdown.js +1 -1
- package/dash_core_components/async-dropdown.js.map +1 -1
- package/dash_core_components/async-graph.js +1 -1
- package/dash_core_components/async-graph.js.map +1 -1
- package/dash_core_components/async-highlight.js +1 -1
- package/dash_core_components/async-highlight.js.map +1 -1
- package/dash_core_components/async-markdown.js +1 -1
- package/dash_core_components/async-markdown.js.map +1 -1
- package/dash_core_components/async-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/async-upload.js +2 -1
- package/dash_core_components/async-upload.js.map +1 -1
- package/dash_core_components/dash_core_components-shared.js +1 -1
- package/dash_core_components/dash_core_components-shared.js.map +1 -1
- package/dash_core_components/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/dash_core_components/proptypes.js +1 -0
- package/lib/components/Clipboard.react.js +100 -53
- package/lib/components/ConfirmDialog.react.js +5 -6
- package/lib/components/ConfirmDialogProvider.react.js +5 -6
- package/lib/components/Download.react.js +1 -3
- package/lib/components/Graph.react.js +15 -6
- package/lib/components/Input.tsx +2 -2
- package/lib/components/Interval.react.js +3 -4
- package/lib/components/Link.react.js +10 -13
- package/lib/components/Location.react.js +7 -11
- package/lib/components/Markdown.react.js +8 -1
- package/lib/components/Store.react.js +13 -16
- package/lib/components/css/dropdown.css +6 -0
- package/lib/components/css/sliders.css +1 -0
- package/lib/fragments/DatePickerRange.tsx +147 -148
- package/lib/fragments/DatePickerSingle.tsx +115 -116
- package/lib/fragments/Dropdown.tsx +42 -2
- package/lib/fragments/Graph.react.js +71 -47
- package/lib/fragments/Markdown.react.js +38 -27
- package/lib/fragments/Upload.react.js +202 -117
- package/lib/types.ts +7 -0
- package/lib/utils/LoadingElement.js +2 -3
- package/lib/utils/ResizeDetector.js +3 -5
- package/lib/utils/dropdownSearch.ts +32 -12
- package/lib/utils/optionRendering.tsx +3 -0
- package/package.json +2 -2
- package/dash_core_components/plotly.min.js +0 -8
|
@@ -23,9 +23,8 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
23
23
|
*/
|
|
24
24
|
// eslint-disable-next-line react/prop-types
|
|
25
25
|
function LoadingElement(_ref, ref) {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
} = _ref,
|
|
26
|
+
var _ref$elementType = _ref.elementType,
|
|
27
|
+
elementType = _ref$elementType === void 0 ? 'div' : _ref$elementType,
|
|
29
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
29
|
var ctx = window.dash_component_api.useDashContext();
|
|
31
30
|
var loading = ctx.useLoading();
|
|
@@ -11,11 +11,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
11
11
|
// Debounce 50 ms
|
|
12
12
|
var DELAY = 50;
|
|
13
13
|
var ResizeDetector = props => {
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
targets
|
|
18
|
-
} = props;
|
|
14
|
+
var onResize = props.onResize,
|
|
15
|
+
children = props.children,
|
|
16
|
+
targets = props.targets;
|
|
19
17
|
var ref = /*#__PURE__*/(0, _react.createRef)();
|
|
20
18
|
var resizeTimeout;
|
|
21
19
|
var debouncedResizeHandler = (0, _react.useCallback)(() => {
|
|
@@ -23,6 +23,7 @@ export interface SanitizedOptions {
|
|
|
23
23
|
options: DetailedOption[];
|
|
24
24
|
indexes: string[];
|
|
25
25
|
valueSet: Set<OptionValue>;
|
|
26
|
+
search: Search;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
// Single-pass sanitization via sanitizeOptions, plus detection of
|
|
@@ -55,29 +56,48 @@ export function sanitizeDropdownOptions(
|
|
|
55
56
|
indexes.push('search');
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
// Build the search index ONCE during sanitization
|
|
60
|
+
const search = new Search('value');
|
|
61
|
+
search.searchIndex = new UnorderedSearchIndex();
|
|
62
|
+
search.indexStrategy = new AllSubstringsIndexStrategy();
|
|
63
|
+
search.tokenizer = TOKENIZER;
|
|
64
|
+
|
|
65
|
+
indexes.forEach(index => {
|
|
66
|
+
search.addIndex(index);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (sanitized.length > 0) {
|
|
70
|
+
search.addDocuments(sanitized);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
options: sanitized,
|
|
75
|
+
indexes,
|
|
76
|
+
valueSet,
|
|
77
|
+
search,
|
|
78
|
+
};
|
|
59
79
|
}
|
|
60
80
|
|
|
61
81
|
export function filterOptions(
|
|
62
82
|
options: SanitizedOptions,
|
|
63
|
-
searchValue?:
|
|
83
|
+
searchValue?: DropdownProps['search_value'],
|
|
84
|
+
searchOrder?: DropdownProps['search_order']
|
|
64
85
|
): DetailedOption[] {
|
|
65
86
|
if (!searchValue) {
|
|
66
87
|
return options.options;
|
|
67
88
|
}
|
|
68
89
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
search.indexStrategy = new AllSubstringsIndexStrategy();
|
|
72
|
-
search.tokenizer = TOKENIZER;
|
|
90
|
+
const results =
|
|
91
|
+
(options.search.search(searchValue) as DetailedOption[]) || [];
|
|
73
92
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
93
|
+
// Preserve original option order
|
|
94
|
+
if (searchOrder === 'original') {
|
|
95
|
+
const resultSet = new Set(results.map(option => option.value));
|
|
77
96
|
|
|
78
|
-
|
|
79
|
-
|
|
97
|
+
return options.options.filter(option =>
|
|
98
|
+
resultSet.has(option.value)
|
|
99
|
+
);
|
|
80
100
|
}
|
|
81
101
|
|
|
82
|
-
return
|
|
102
|
+
return results;
|
|
83
103
|
}
|
|
@@ -400,6 +400,9 @@ export const OptionsList = forwardRef<OptionsListHandle, OptionsListProps>(
|
|
|
400
400
|
className="dash-options-list-virtualized"
|
|
401
401
|
onItemsRendered={handleItemsRendered}
|
|
402
402
|
itemData={itemData}
|
|
403
|
+
itemKey={(index, data) =>
|
|
404
|
+
String(data.options[index]?.value ?? index)
|
|
405
|
+
}
|
|
403
406
|
>
|
|
404
407
|
{Row}
|
|
405
408
|
</VariableSizeList>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dash-core-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Core component suite for Dash",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -126,6 +126,6 @@
|
|
|
126
126
|
"react-dom": "16 - 19"
|
|
127
127
|
},
|
|
128
128
|
"browserslist": [
|
|
129
|
-
"last
|
|
129
|
+
"last 10 years and not dead"
|
|
130
130
|
]
|
|
131
131
|
}
|