dash-core-components 4.1.0 → 4.3.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 +220 -126
- package/lib/components/ConfirmDialog.react.js +62 -35
- package/lib/components/ConfirmDialogProvider.react.js +45 -22
- package/lib/components/Download.react.js +46 -24
- package/lib/components/Geolocation.react.js +92 -64
- package/lib/components/Graph.react.js +112 -75
- package/lib/components/Input.tsx +2 -2
- package/lib/components/Interval.react.js +88 -57
- package/lib/components/Link.react.js +16 -18
- package/lib/components/Location.react.js +127 -101
- package/lib/components/Markdown.react.js +43 -15
- package/lib/components/Store.react.js +177 -131
- package/lib/components/Upload.react.js +28 -8
- 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.privateprops.js +9 -3
- package/lib/fragments/Graph.react.js +418 -322
- package/lib/fragments/Markdown.react.js +163 -112
- package/lib/fragments/Math.react.js +49 -24
- package/lib/fragments/Upload.react.js +344 -220
- package/lib/types.ts +7 -0
- package/lib/utils/LazyLoader/graph.js +3 -2
- package/lib/utils/LazyLoader/hljs.js +5 -2
- package/lib/utils/LazyLoader/markdown.js +3 -2
- package/lib/utils/LazyLoader/mathjax.js +5 -2
- package/lib/utils/LazyLoader/plotly.js +6 -7
- package/lib/utils/LazyLoader/upload.js +3 -2
- package/lib/utils/LoadingElement.js +5 -5
- package/lib/utils/MarkdownHighlighter.js +6 -5
- package/lib/utils/ResizeDetector.js +17 -14
- package/lib/utils/dropdownSearch.ts +32 -12
- package/lib/utils/optionRendering.tsx +3 -0
- package/package.json +3 -3
|
@@ -4,5 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default =
|
|
8
|
-
|
|
7
|
+
var _default = exports.default = function _default(mathjax) {
|
|
8
|
+
return Promise.resolve(window.MathJax || (mathjax === false ? undefined : import(/* webpackChunkName: "mathjax" */'../mathjax').then(function () {
|
|
9
|
+
return window.MathJax;
|
|
10
|
+
})));
|
|
11
|
+
};
|
|
@@ -4,26 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default = ()
|
|
8
|
-
return Promise.resolve(window.Plotly || new Promise((resolve, reject)
|
|
7
|
+
var _default = exports.default = function _default() {
|
|
8
|
+
return Promise.resolve(window.Plotly || new Promise(function (resolve, reject) {
|
|
9
9
|
/* eslint-disable prefer-const */
|
|
10
10
|
var timeoutId;
|
|
11
11
|
var element = document.createElement('script');
|
|
12
12
|
element.src = window._dashPlotlyJSURL;
|
|
13
13
|
element.async = true;
|
|
14
|
-
element.onload = ()
|
|
14
|
+
element.onload = function () {
|
|
15
15
|
clearTimeout(timeoutId);
|
|
16
16
|
resolve();
|
|
17
17
|
};
|
|
18
|
-
element.onerror = error
|
|
18
|
+
element.onerror = function (error) {
|
|
19
19
|
clearTimeout(timeoutId);
|
|
20
20
|
reject(error);
|
|
21
21
|
};
|
|
22
|
-
timeoutId = setTimeout(()
|
|
22
|
+
timeoutId = setTimeout(function () {
|
|
23
23
|
element.src = '';
|
|
24
24
|
reject(new Error("plotly.js did not load after 30 seconds"));
|
|
25
25
|
}, 3 * 10 * 1000);
|
|
26
26
|
document.querySelector('body').appendChild(element);
|
|
27
27
|
}));
|
|
28
|
-
};
|
|
29
|
-
exports.default = _default;
|
|
28
|
+
};
|
|
@@ -4,5 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default =
|
|
8
|
-
|
|
7
|
+
var _default = exports.default = function _default() {
|
|
8
|
+
return import(/* webpackChunkName: "upload" */'../../fragments/Upload.react');
|
|
9
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -10,8 +11,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
10
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
13
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
14
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
16
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
16
17
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
17
18
|
/**
|
|
@@ -23,9 +24,8 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
23
24
|
*/
|
|
24
25
|
// eslint-disable-next-line react/prop-types
|
|
25
26
|
function LoadingElement(_ref, ref) {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
} = _ref,
|
|
27
|
+
var _ref$elementType = _ref.elementType,
|
|
28
|
+
elementType = _ref$elementType === void 0 ? 'div' : _ref$elementType,
|
|
29
29
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
30
|
var ctx = window.dash_component_api.useDashContext();
|
|
31
31
|
var loading = ctx.useLoading();
|
|
@@ -8,14 +8,15 @@ var _hljs = _interopRequireDefault(require("./LazyLoader/hljs"));
|
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
var MarkdownHighlighter = {
|
|
10
10
|
loadhljs: function loadhljs() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
var _this = this;
|
|
12
|
+
return (0, _hljs.default)().then(function (hljs) {
|
|
13
|
+
_this.hljs = hljs;
|
|
14
|
+
_this.hljsResolve();
|
|
15
|
+
_this.isReady = true;
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
|
-
var isReady = new Promise(resolve
|
|
19
|
+
var isReady = new Promise(function (resolve) {
|
|
19
20
|
MarkdownHighlighter.hljsResolve = resolve;
|
|
20
21
|
});
|
|
21
22
|
MarkdownHighlighter.isReady = isReady;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -7,33 +8,35 @@ exports.default = void 0;
|
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" !=
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
12
|
// Debounce 50 ms
|
|
12
13
|
var DELAY = 50;
|
|
13
|
-
var ResizeDetector = props
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
targets
|
|
18
|
-
} = props;
|
|
14
|
+
var ResizeDetector = function ResizeDetector(props) {
|
|
15
|
+
var onResize = props.onResize,
|
|
16
|
+
children = props.children,
|
|
17
|
+
targets = props.targets;
|
|
19
18
|
var ref = /*#__PURE__*/(0, _react.createRef)();
|
|
20
19
|
var resizeTimeout;
|
|
21
|
-
var debouncedResizeHandler = (0, _react.useCallback)(()
|
|
20
|
+
var debouncedResizeHandler = (0, _react.useCallback)(function () {
|
|
22
21
|
if (resizeTimeout) {
|
|
23
22
|
clearTimeout(resizeTimeout);
|
|
24
23
|
}
|
|
25
|
-
resizeTimeout = setTimeout(()
|
|
24
|
+
resizeTimeout = setTimeout(function () {
|
|
26
25
|
onResize(true); // Force on resize.
|
|
27
26
|
}, DELAY);
|
|
28
27
|
}, [onResize]);
|
|
29
|
-
var observer = (0, _react.useMemo)(
|
|
30
|
-
|
|
28
|
+
var observer = (0, _react.useMemo)(function () {
|
|
29
|
+
return new ResizeObserver(debouncedResizeHandler);
|
|
30
|
+
}, [onResize]);
|
|
31
|
+
(0, _react.useEffect)(function () {
|
|
31
32
|
if (!ref.current) {
|
|
32
|
-
return ()
|
|
33
|
+
return function () {};
|
|
33
34
|
}
|
|
34
|
-
targets.forEach(
|
|
35
|
+
targets.forEach(function (target) {
|
|
36
|
+
return observer.observe(target.current);
|
|
37
|
+
});
|
|
35
38
|
observer.observe(ref.current);
|
|
36
|
-
return ()
|
|
39
|
+
return function () {
|
|
37
40
|
observer.disconnect();
|
|
38
41
|
};
|
|
39
42
|
}, [ref.current]);
|
|
@@ -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.3.0",
|
|
4
4
|
"description": "Core component suite for Dash",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build:js": "webpack --mode production",
|
|
28
28
|
"build:backends": "dash-generate-components ./src/components dash_core_components -p package-info.json && cp dash_core_components_base/** dash_core_components/ && dash-generate-components ./src/components dash_core_components -p package-info.json -k RangeSlider,Slider,Dropdown,RadioItems,Checklist,DatePickerSingle,DatePickerRange,Input,Link --r-prefix 'dcc' --r-suggests 'dash,dashHtmlComponents,jsonlite,plotly' --jl-prefix 'dcc' && black dash_core_components",
|
|
29
29
|
"build": "run-s prepublishOnly build:js build:backends",
|
|
30
|
-
"postbuild": "es-check
|
|
30
|
+
"postbuild": "es-check es2017 dash_core_components/*.js",
|
|
31
31
|
"build:watch": "watch 'npm run build' src",
|
|
32
32
|
"format": "run-s private::format.*",
|
|
33
33
|
"lint": "run-s private::lint.*"
|
|
@@ -126,6 +126,6 @@
|
|
|
126
126
|
"react-dom": "16 - 19"
|
|
127
127
|
},
|
|
128
128
|
"browserslist": [
|
|
129
|
-
"last
|
|
129
|
+
"last 11 years and not dead"
|
|
130
130
|
]
|
|
131
131
|
}
|