instantsearch.js 4.55.0 → 4.56.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/cjs/components/Breadcrumb/Breadcrumb.js +2 -2
- package/cjs/components/RangeInput/RangeInput.js +22 -11
- package/cjs/components/RefinementList/RefinementList.js +34 -52
- package/cjs/components/Slider/Rheostat.js +163 -249
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +22 -7
- package/cjs/lib/InstantSearch.js +2 -4
- package/cjs/lib/routers/history.js +54 -1
- package/cjs/lib/utils/render-args.js +3 -2
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/hits-per-page/hits-per-page.js +3 -1
- package/cjs/widgets/index/index.js +8 -8
- package/dist/instantsearch.development.d.ts +76 -76
- package/dist/instantsearch.development.js +345 -341
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +76 -76
- package/dist/instantsearch.production.min.d.ts +76 -76
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/es/components/Breadcrumb/Breadcrumb.js +2 -2
- package/es/components/GeoSearchControls/GeoSearchButton.d.ts +1 -1
- package/es/components/GeoSearchControls/GeoSearchControls.d.ts +3 -3
- package/es/components/GeoSearchControls/GeoSearchToggle.d.ts +1 -1
- package/es/components/Pagination/Pagination.d.ts +2 -2
- package/es/components/RangeInput/RangeInput.d.ts +7 -4
- package/es/components/RangeInput/RangeInput.js +22 -11
- package/es/components/RefinementList/RefinementList.d.ts +0 -1
- package/es/components/RefinementList/RefinementList.js +34 -52
- package/es/components/RelevantSort/RelevantSort.d.ts +1 -1
- package/es/components/Selector/Selector.d.ts +2 -2
- package/es/components/Slider/Rheostat.d.ts +23 -17
- package/es/components/Slider/Rheostat.js +163 -249
- package/es/components/Slider/Slider.d.ts +1 -1
- package/es/connectors/current-refinements/connectCurrentRefinements.d.ts +2 -2
- package/es/connectors/dynamic-widgets/connectDynamicWidgets.d.ts +2 -2
- package/es/connectors/geo-search/connectGeoSearch.d.ts +7 -7
- package/es/connectors/infinite-hits/connectInfiniteHits.js +23 -8
- package/es/connectors/menu/connectMenu.d.ts +2 -2
- package/es/connectors/pagination/connectPagination.d.ts +1 -1
- package/es/connectors/range/connectRange.d.ts +3 -3
- package/es/connectors/refinement-list/connectRefinementList.d.ts +3 -3
- package/es/connectors/relevant-sort/connectRelevantSort.d.ts +1 -1
- package/es/lib/InstantSearch.d.ts +13 -13
- package/es/lib/InstantSearch.js +3 -5
- package/es/lib/routers/history.d.ts +2 -2
- package/es/lib/routers/history.js +55 -2
- package/es/lib/utils/defer.d.ts +2 -2
- package/es/lib/utils/render-args.js +3 -2
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/types/middleware.d.ts +6 -6
- package/es/types/router.d.ts +7 -7
- package/es/types/widget.d.ts +1 -1
- package/es/widgets/dynamic-widgets/dynamic-widgets.d.ts +2 -2
- package/es/widgets/geo-search/createHTMLMarker.d.ts +1 -1
- package/es/widgets/geo-search/geo-search.d.ts +1 -1
- package/es/widgets/hits-per-page/hits-per-page.js +3 -1
- package/es/widgets/index/index.d.ts +20 -20
- package/es/widgets/index/index.js +8 -8
- package/es/widgets/panel/panel.d.ts +2 -2
- package/es/widgets/range-slider/range-slider.d.ts +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.
|
|
1
|
+
/*! InstantSearch.js 4.56.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -1446,6 +1446,18 @@
|
|
|
1446
1446
|
return isMiddleClick || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
|
|
1447
1447
|
}
|
|
1448
1448
|
|
|
1449
|
+
/**
|
|
1450
|
+
* Recurse over all child indices
|
|
1451
|
+
*/
|
|
1452
|
+
function walkIndex(indexWidget, callback) {
|
|
1453
|
+
callback(indexWidget);
|
|
1454
|
+
indexWidget.getWidgets().forEach(function (widget) {
|
|
1455
|
+
if (isIndexWidget(widget)) {
|
|
1456
|
+
walkIndex(widget, callback);
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1449
1461
|
function uniq(array) {
|
|
1450
1462
|
return array.filter(function (value, index, self) {
|
|
1451
1463
|
return self.indexOf(value) === index;
|
|
@@ -1615,13 +1627,14 @@
|
|
|
1615
1627
|
}
|
|
1616
1628
|
function createRenderArgs(instantSearchInstance, parent) {
|
|
1617
1629
|
var results = parent.getResults();
|
|
1630
|
+
var helper = parent.getHelper();
|
|
1618
1631
|
return {
|
|
1619
|
-
helper:
|
|
1632
|
+
helper: helper,
|
|
1620
1633
|
parent: parent,
|
|
1621
1634
|
instantSearchInstance: instantSearchInstance,
|
|
1622
1635
|
results: results,
|
|
1623
1636
|
scopedResults: parent.getScopedResults(),
|
|
1624
|
-
state: results._state,
|
|
1637
|
+
state: results ? results._state : helper.state,
|
|
1625
1638
|
renderState: instantSearchInstance.renderState,
|
|
1626
1639
|
templatesConfig: instantSearchInstance.templatesConfig,
|
|
1627
1640
|
createURL: parent.createURL,
|
|
@@ -3063,6 +3076,7 @@
|
|
|
3063
3076
|
});
|
|
3064
3077
|
isFirstPage = state.page === undefined || getFirstReceivedPage(state, cachedHits) === 0;
|
|
3065
3078
|
} else {
|
|
3079
|
+
var _results$disjunctiveF, _results$facets, _results$hierarchical;
|
|
3066
3080
|
var _state$page3 = state.page,
|
|
3067
3081
|
_page = _state$page3 === void 0 ? 0 : _state$page3;
|
|
3068
3082
|
if (escapeHTML && results.hits.length > 0) {
|
|
@@ -3073,7 +3087,21 @@
|
|
|
3073
3087
|
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID, {
|
|
3074
3088
|
results: results
|
|
3075
3089
|
});
|
|
3076
|
-
|
|
3090
|
+
|
|
3091
|
+
/*
|
|
3092
|
+
With dynamic widgets, facets are not included in the state before their relevant widgets are mounted. Until then, we need to bail out of writing this incomplete state representation in cache.
|
|
3093
|
+
*/
|
|
3094
|
+
var hasDynamicWidgets = false;
|
|
3095
|
+
walkIndex(instantSearchInstance.mainIndex, function (indexWidget) {
|
|
3096
|
+
if (!hasDynamicWidgets && indexWidget.getWidgets().some(function (_ref7) {
|
|
3097
|
+
var $$type = _ref7.$$type;
|
|
3098
|
+
return $$type === 'ais.dynamicWidgets';
|
|
3099
|
+
})) {
|
|
3100
|
+
hasDynamicWidgets = true;
|
|
3101
|
+
}
|
|
3102
|
+
});
|
|
3103
|
+
var hasNoFacets = !((_results$disjunctiveF = results.disjunctiveFacets) !== null && _results$disjunctiveF !== void 0 && _results$disjunctiveF.length) && !((_results$facets = results.facets) !== null && _results$facets !== void 0 && _results$facets.length) && !((_results$hierarchical = results.hierarchicalFacets) !== null && _results$hierarchical !== void 0 && _results$hierarchical.length);
|
|
3104
|
+
if (cachedHits[_page] === undefined && !results.__isArtificial && instantSearchInstance.status === 'idle' && !(hasDynamicWidgets && hasNoFacets)) {
|
|
3077
3105
|
cachedHits[_page] = transformedHits;
|
|
3078
3106
|
cache.write({
|
|
3079
3107
|
state: normalizeState(state),
|
|
@@ -3098,8 +3126,8 @@
|
|
|
3098
3126
|
widgetParams: widgetParams
|
|
3099
3127
|
};
|
|
3100
3128
|
},
|
|
3101
|
-
dispose: function dispose(
|
|
3102
|
-
var state =
|
|
3129
|
+
dispose: function dispose(_ref8) {
|
|
3130
|
+
var state = _ref8.state;
|
|
3103
3131
|
unmountFn();
|
|
3104
3132
|
var stateWithoutPage = state.setQueryParameter('page', undefined);
|
|
3105
3133
|
if (!escapeHTML) {
|
|
@@ -3109,8 +3137,8 @@
|
|
|
3109
3137
|
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, key, undefined));
|
|
3110
3138
|
}, {}));
|
|
3111
3139
|
},
|
|
3112
|
-
getWidgetUiState: function getWidgetUiState(uiState,
|
|
3113
|
-
var searchParameters =
|
|
3140
|
+
getWidgetUiState: function getWidgetUiState(uiState, _ref9) {
|
|
3141
|
+
var searchParameters = _ref9.searchParameters;
|
|
3114
3142
|
var page = searchParameters.page || 0;
|
|
3115
3143
|
if (!page) {
|
|
3116
3144
|
// return without adding `page` to uiState
|
|
@@ -3123,8 +3151,8 @@
|
|
|
3123
3151
|
page: page + 1
|
|
3124
3152
|
});
|
|
3125
3153
|
},
|
|
3126
|
-
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters,
|
|
3127
|
-
var uiState =
|
|
3154
|
+
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref10) {
|
|
3155
|
+
var uiState = _ref10.uiState;
|
|
3128
3156
|
var widgetSearchParameters = searchParameters;
|
|
3129
3157
|
if (escapeHTML) {
|
|
3130
3158
|
widgetSearchParameters = searchParameters.setQueryParameters(TAG_PLACEHOLDER);
|
|
@@ -9409,7 +9437,7 @@
|
|
|
9409
9437
|
|
|
9410
9438
|
var requestBuilder_1 = requestBuilder;
|
|
9411
9439
|
|
|
9412
|
-
var version = '3.
|
|
9440
|
+
var version = '3.13.0';
|
|
9413
9441
|
|
|
9414
9442
|
var escapeFacetValue$4 = escapeFacetValue_1.escapeFacetValue;
|
|
9415
9443
|
|
|
@@ -10675,7 +10703,9 @@
|
|
|
10675
10703
|
|
|
10676
10704
|
var derivedQueries = this.derivedHelpers.map(function(derivedHelper) {
|
|
10677
10705
|
var derivedState = derivedHelper.getModifiedState(state);
|
|
10678
|
-
var derivedStateQueries =
|
|
10706
|
+
var derivedStateQueries = derivedState.index
|
|
10707
|
+
? requestBuilder_1._getQueries(derivedState.index, derivedState)
|
|
10708
|
+
: [];
|
|
10679
10709
|
|
|
10680
10710
|
states.push({
|
|
10681
10711
|
state: derivedState,
|
|
@@ -10692,10 +10722,16 @@
|
|
|
10692
10722
|
});
|
|
10693
10723
|
|
|
10694
10724
|
var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);
|
|
10695
|
-
var queryId = this._queryId++;
|
|
10696
10725
|
|
|
10726
|
+
var queryId = this._queryId++;
|
|
10697
10727
|
this._currentNbQueries++;
|
|
10698
10728
|
|
|
10729
|
+
if (!queries.length) {
|
|
10730
|
+
return Promise.resolve({results: []}).then(
|
|
10731
|
+
this._dispatchAlgoliaResponse.bind(this, states, queryId)
|
|
10732
|
+
);
|
|
10733
|
+
}
|
|
10734
|
+
|
|
10699
10735
|
try {
|
|
10700
10736
|
this.client.search(queries)
|
|
10701
10737
|
.then(this._dispatchAlgoliaResponse.bind(this, states, queryId))
|
|
@@ -10740,6 +10776,14 @@
|
|
|
10740
10776
|
var helper = s.helper;
|
|
10741
10777
|
var specificResults = results.splice(0, queriesCount);
|
|
10742
10778
|
|
|
10779
|
+
if (!state.index) {
|
|
10780
|
+
helper.emit('result', {
|
|
10781
|
+
results: null,
|
|
10782
|
+
state: state
|
|
10783
|
+
});
|
|
10784
|
+
return;
|
|
10785
|
+
}
|
|
10786
|
+
|
|
10743
10787
|
var formattedResponse = helper.lastResults = new SearchResults_1(state, specificResults);
|
|
10744
10788
|
|
|
10745
10789
|
helper.emit('result', {
|
|
@@ -13062,6 +13106,48 @@
|
|
|
13062
13106
|
}
|
|
13063
13107
|
};
|
|
13064
13108
|
var BrowserHistory = /*#__PURE__*/function () {
|
|
13109
|
+
/**
|
|
13110
|
+
* Transforms a UI state into a title for the page.
|
|
13111
|
+
*/
|
|
13112
|
+
|
|
13113
|
+
/**
|
|
13114
|
+
* Time in milliseconds before performing a write in the history.
|
|
13115
|
+
* It prevents from adding too many entries in the history and
|
|
13116
|
+
* makes the back button more usable.
|
|
13117
|
+
*
|
|
13118
|
+
* @default 400
|
|
13119
|
+
*/
|
|
13120
|
+
|
|
13121
|
+
/**
|
|
13122
|
+
* Creates a full URL based on the route state.
|
|
13123
|
+
* The storage adaptor maps all syncable keys to the query string of the URL.
|
|
13124
|
+
*/
|
|
13125
|
+
|
|
13126
|
+
/**
|
|
13127
|
+
* Parses the URL into a route state.
|
|
13128
|
+
* It should be symmetrical to `createURL`.
|
|
13129
|
+
*/
|
|
13130
|
+
|
|
13131
|
+
/**
|
|
13132
|
+
* Returns the location to store in the history.
|
|
13133
|
+
* @default () => window.location
|
|
13134
|
+
*/
|
|
13135
|
+
|
|
13136
|
+
/**
|
|
13137
|
+
* Indicates if last action was back/forward in the browser.
|
|
13138
|
+
*/
|
|
13139
|
+
|
|
13140
|
+
/**
|
|
13141
|
+
* Indicates whether the history router is disposed or not.
|
|
13142
|
+
*/
|
|
13143
|
+
|
|
13144
|
+
/**
|
|
13145
|
+
* Indicates the window.history.length before the last call to
|
|
13146
|
+
* window.history.pushState (called in `write`).
|
|
13147
|
+
* It allows to determine if a `pushState` has been triggered elsewhere,
|
|
13148
|
+
* and thus to prevent the `write` method from calling `pushState`.
|
|
13149
|
+
*/
|
|
13150
|
+
|
|
13065
13151
|
/**
|
|
13066
13152
|
* Initializes a new storage provider that syncs the search state to the URL
|
|
13067
13153
|
* using web APIs (`window.location.pushState` and `onpopstate` event).
|
|
@@ -13085,6 +13171,7 @@
|
|
|
13085
13171
|
_defineProperty(this, "parseURL", void 0);
|
|
13086
13172
|
_defineProperty(this, "getLocation", void 0);
|
|
13087
13173
|
_defineProperty(this, "writeTimer", void 0);
|
|
13174
|
+
_defineProperty(this, "_onPopState", void 0);
|
|
13088
13175
|
_defineProperty(this, "inPopState", false);
|
|
13089
13176
|
_defineProperty(this, "isDisposed", false);
|
|
13090
13177
|
_defineProperty(this, "latestAcknowledgedHistory", 0);
|
|
@@ -13190,11 +13277,21 @@
|
|
|
13190
13277
|
}, {
|
|
13191
13278
|
key: "createURL",
|
|
13192
13279
|
value: function createURL(routeState) {
|
|
13193
|
-
|
|
13280
|
+
var url = this._createURL({
|
|
13194
13281
|
qsModule: lib$1,
|
|
13195
13282
|
routeState: routeState,
|
|
13196
13283
|
location: this.getLocation()
|
|
13197
13284
|
});
|
|
13285
|
+
{
|
|
13286
|
+
try {
|
|
13287
|
+
// We just want to check if the URL is valid.
|
|
13288
|
+
// eslint-disable-next-line no-new
|
|
13289
|
+
new URL(url);
|
|
13290
|
+
} catch (e) {
|
|
13291
|
+
_warning(false, "The URL returned by the `createURL` function is invalid.\nPlease make sure it returns an absolute URL to avoid issues, e.g: `https://algolia.com/search?query=iphone`.") ;
|
|
13292
|
+
}
|
|
13293
|
+
}
|
|
13294
|
+
return url;
|
|
13198
13295
|
}
|
|
13199
13296
|
|
|
13200
13297
|
/**
|
|
@@ -13715,7 +13812,7 @@
|
|
|
13715
13812
|
// does not have access to lastResults, which it used to in pre-federated
|
|
13716
13813
|
// search behavior.
|
|
13717
13814
|
helper.lastResults = results;
|
|
13718
|
-
lastValidSearchParameters = results._state;
|
|
13815
|
+
lastValidSearchParameters = results === null || results === void 0 ? void 0 : results._state;
|
|
13719
13816
|
});
|
|
13720
13817
|
|
|
13721
13818
|
// We compute the render state before calling `init` in a separate loop
|
|
@@ -13771,16 +13868,16 @@
|
|
|
13771
13868
|
render: function render(_ref5) {
|
|
13772
13869
|
var _this4 = this;
|
|
13773
13870
|
var instantSearchInstance = _ref5.instantSearchInstance;
|
|
13774
|
-
if (!this.getResults()) {
|
|
13775
|
-
return;
|
|
13776
|
-
}
|
|
13777
|
-
|
|
13778
13871
|
// we can't attach a listener to the error event of search, as the error
|
|
13779
13872
|
// then would no longer be thrown for global handlers.
|
|
13780
|
-
if (instantSearchInstance.status === 'error' && !instantSearchInstance.mainHelper.hasPendingRequests()) {
|
|
13873
|
+
if (instantSearchInstance.status === 'error' && !instantSearchInstance.mainHelper.hasPendingRequests() && lastValidSearchParameters) {
|
|
13781
13874
|
helper.setState(lastValidSearchParameters);
|
|
13782
13875
|
}
|
|
13783
|
-
|
|
13876
|
+
|
|
13877
|
+
// We only render index widgets if there are no results.
|
|
13878
|
+
// This makes sure `render` is never called with `results` being `null`.
|
|
13879
|
+
var widgetsToRender = this.getResults() ? localWidgets : localWidgets.filter(isIndexWidget);
|
|
13880
|
+
widgetsToRender.forEach(function (widget) {
|
|
13784
13881
|
if (widget.getRenderState) {
|
|
13785
13882
|
var renderState = widget.getRenderState(instantSearchInstance.renderState[_this4.getIndexId()] || {}, createRenderArgs(instantSearchInstance, _this4));
|
|
13786
13883
|
storeRenderState({
|
|
@@ -13790,7 +13887,7 @@
|
|
|
13790
13887
|
});
|
|
13791
13888
|
}
|
|
13792
13889
|
});
|
|
13793
|
-
|
|
13890
|
+
widgetsToRender.forEach(function (widget) {
|
|
13794
13891
|
// At this point, all the variables used below are set. Both `helper`
|
|
13795
13892
|
// and `derivedHelper` have been created at the `init` step. The attribute
|
|
13796
13893
|
// `lastResults` might be `null` though. It's possible that a stalled render
|
|
@@ -13932,7 +14029,7 @@
|
|
|
13932
14029
|
};
|
|
13933
14030
|
}
|
|
13934
14031
|
|
|
13935
|
-
var version$1 = '4.
|
|
14032
|
+
var version$1 = '4.56.0';
|
|
13936
14033
|
|
|
13937
14034
|
var withUsage$r = createDocumentationMessageGenerator({
|
|
13938
14035
|
name: 'instantsearch'
|
|
@@ -14011,7 +14108,7 @@
|
|
|
14011
14108
|
}));
|
|
14012
14109
|
_this.setMaxListeners(100);
|
|
14013
14110
|
var _options$indexName = options.indexName,
|
|
14014
|
-
indexName = _options$indexName === void 0 ?
|
|
14111
|
+
indexName = _options$indexName === void 0 ? '' : _options$indexName,
|
|
14015
14112
|
numberLocale = options.numberLocale,
|
|
14016
14113
|
_options$initialUiSta = options.initialUiState,
|
|
14017
14114
|
initialUiState = _options$initialUiSta === void 0 ? {} : _options$initialUiSta,
|
|
@@ -14028,9 +14125,6 @@
|
|
|
14028
14125
|
insightsClient = _options$insightsClie === void 0 ? null : _options$insightsClie,
|
|
14029
14126
|
_options$onStateChang = options.onStateChange,
|
|
14030
14127
|
onStateChange = _options$onStateChang === void 0 ? null : _options$onStateChang;
|
|
14031
|
-
if (indexName === null) {
|
|
14032
|
-
throw new Error(withUsage$r('The `indexName` option is required.'));
|
|
14033
|
-
}
|
|
14034
14128
|
if (searchClient === null) {
|
|
14035
14129
|
throw new Error(withUsage$r('The `searchClient` option is required.'));
|
|
14036
14130
|
}
|
|
@@ -14272,6 +14366,7 @@
|
|
|
14272
14366
|
mainHelper.search = function () {
|
|
14273
14367
|
_this3.status = 'loading';
|
|
14274
14368
|
_this3.scheduleRender(false);
|
|
14369
|
+
_warning(Boolean(_this3.indexName) || _this3.mainIndex.getWidgets().some(isIndexWidget), 'No indexName provided, nor an explicit index widget in the widgets tree. This is required to be able to display results.') ;
|
|
14275
14370
|
|
|
14276
14371
|
// This solution allows us to keep the exact same API for the users but
|
|
14277
14372
|
// under the hood, we have a different implementation. It should be
|
|
@@ -16134,10 +16229,10 @@
|
|
|
16134
16229
|
rootTagName: "a",
|
|
16135
16230
|
rootProps: {
|
|
16136
16231
|
className: cssClasses.link,
|
|
16137
|
-
href: createURL(
|
|
16232
|
+
href: createURL(null),
|
|
16138
16233
|
onClick: function onClick(event) {
|
|
16139
16234
|
event.preventDefault();
|
|
16140
|
-
refine(
|
|
16235
|
+
refine(null);
|
|
16141
16236
|
}
|
|
16142
16237
|
}
|
|
16143
16238
|
}))), items.map(function (item, idx) {
|
|
@@ -17264,49 +17359,36 @@
|
|
|
17264
17359
|
var RefinementList$1 = /*#__PURE__*/function (_Component) {
|
|
17265
17360
|
_inherits(RefinementList, _Component);
|
|
17266
17361
|
var _super = _createSuper(RefinementList);
|
|
17267
|
-
function RefinementList(
|
|
17362
|
+
function RefinementList() {
|
|
17268
17363
|
var _this;
|
|
17269
17364
|
_classCallCheck(this, RefinementList);
|
|
17270
|
-
|
|
17271
|
-
|
|
17272
|
-
_this.handleItemClick = _this.handleItemClick.bind(_assertThisInitialized(_this));
|
|
17273
|
-
return _this;
|
|
17274
|
-
}
|
|
17275
|
-
_createClass(RefinementList, [{
|
|
17276
|
-
key: "shouldComponentUpdate",
|
|
17277
|
-
value: function shouldComponentUpdate(nextProps) {
|
|
17278
|
-
var areFacetValuesDifferent = !isEqual(this.props.facetValues, nextProps.facetValues);
|
|
17279
|
-
return areFacetValuesDifferent;
|
|
17280
|
-
}
|
|
17281
|
-
}, {
|
|
17282
|
-
key: "refine",
|
|
17283
|
-
value: function refine(facetValueToRefine) {
|
|
17284
|
-
this.props.toggleRefinement(facetValueToRefine);
|
|
17365
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17366
|
+
args[_key] = arguments[_key];
|
|
17285
17367
|
}
|
|
17286
|
-
|
|
17287
|
-
|
|
17288
|
-
|
|
17368
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
17369
|
+
_defineProperty(_assertThisInitialized(_this), "searchBox", y());
|
|
17370
|
+
_defineProperty(_assertThisInitialized(_this), "_generateFacetItem", function (facetValue) {
|
|
17289
17371
|
var subItems;
|
|
17290
17372
|
if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) {
|
|
17291
|
-
var _this$props$cssClasse =
|
|
17373
|
+
var _this$props$cssClasse = _this.props.cssClasses,
|
|
17292
17374
|
root = _this$props$cssClasse.root,
|
|
17293
17375
|
cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded$k);
|
|
17294
|
-
subItems = h(RefinementList, _extends({},
|
|
17376
|
+
subItems = h(RefinementList, _extends({}, _this.props, {
|
|
17295
17377
|
// We want to keep `root` required for external usage but not for the
|
|
17296
17378
|
// sub items.
|
|
17297
17379
|
cssClasses: cssClasses,
|
|
17298
|
-
depth:
|
|
17380
|
+
depth: _this.props.depth + 1,
|
|
17299
17381
|
facetValues: facetValue.data,
|
|
17300
17382
|
showMore: false,
|
|
17301
|
-
className:
|
|
17383
|
+
className: _this.props.cssClasses.childList
|
|
17302
17384
|
}));
|
|
17303
17385
|
}
|
|
17304
|
-
var url =
|
|
17386
|
+
var url = _this.props.createURL(facetValue.value);
|
|
17305
17387
|
var templateData = _objectSpread2(_objectSpread2({}, facetValue), {}, {
|
|
17306
17388
|
url: url,
|
|
17307
|
-
attribute:
|
|
17308
|
-
cssClasses:
|
|
17309
|
-
isFromSearch:
|
|
17389
|
+
attribute: _this.props.attribute,
|
|
17390
|
+
cssClasses: _this.props.cssClasses,
|
|
17391
|
+
isFromSearch: _this.props.isFromSearch
|
|
17310
17392
|
});
|
|
17311
17393
|
var key = facetValue.value;
|
|
17312
17394
|
if (facetValue.isRefined !== undefined) {
|
|
@@ -17315,38 +17397,20 @@
|
|
|
17315
17397
|
if (facetValue.count !== undefined) {
|
|
17316
17398
|
key += "/".concat(facetValue.count);
|
|
17317
17399
|
}
|
|
17318
|
-
var refinementListItemClassName = cx(
|
|
17400
|
+
var refinementListItemClassName = cx(_this.props.cssClasses.item, facetValue.isRefined && _this.props.cssClasses.selectedItem, !facetValue.count && _this.props.cssClasses.disabledItem, Boolean(isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) && _this.props.cssClasses.parentItem);
|
|
17319
17401
|
return h(RefinementListItem, {
|
|
17320
17402
|
templateKey: "item",
|
|
17321
17403
|
key: key,
|
|
17322
17404
|
facetValueToRefine: facetValue.value,
|
|
17323
|
-
handleClick:
|
|
17405
|
+
handleClick: _this.handleItemClick,
|
|
17324
17406
|
isRefined: facetValue.isRefined,
|
|
17325
17407
|
className: refinementListItemClassName,
|
|
17326
17408
|
subItems: subItems,
|
|
17327
17409
|
templateData: templateData,
|
|
17328
|
-
templateProps:
|
|
17410
|
+
templateProps: _this.props.templateProps
|
|
17329
17411
|
});
|
|
17330
|
-
}
|
|
17331
|
-
|
|
17332
|
-
// Click events on DOM tree like LABEL > INPUT will result in two click events
|
|
17333
|
-
// instead of one.
|
|
17334
|
-
// No matter the framework, see https://www.google.com/search?q=click+label+twice
|
|
17335
|
-
//
|
|
17336
|
-
// Thus making it hard to distinguish activation from deactivation because both click events
|
|
17337
|
-
// are very close. Debounce is a solution but hacky.
|
|
17338
|
-
//
|
|
17339
|
-
// So the code here checks if the click was done on or in a LABEL. If this LABEL
|
|
17340
|
-
// has a checkbox inside, we ignore the first click event because we will get another one.
|
|
17341
|
-
//
|
|
17342
|
-
// We also check if the click was done inside a link and then e.preventDefault() because we already
|
|
17343
|
-
// handle the url
|
|
17344
|
-
//
|
|
17345
|
-
// Finally, we always stop propagation of the event to avoid multiple levels RefinementLists to fail: click
|
|
17346
|
-
// on child would click on parent also
|
|
17347
|
-
}, {
|
|
17348
|
-
key: "handleItemClick",
|
|
17349
|
-
value: function handleItemClick(_ref) {
|
|
17412
|
+
});
|
|
17413
|
+
_defineProperty(_assertThisInitialized(_this), "handleItemClick", function (_ref) {
|
|
17350
17414
|
var facetValueToRefine = _ref.facetValueToRefine,
|
|
17351
17415
|
isRefined = _ref.isRefined,
|
|
17352
17416
|
originalEvent = _ref.originalEvent;
|
|
@@ -17363,7 +17427,7 @@
|
|
|
17363
17427
|
return;
|
|
17364
17428
|
}
|
|
17365
17429
|
if (originalEvent.target.tagName === 'INPUT') {
|
|
17366
|
-
|
|
17430
|
+
_this.refine(facetValueToRefine);
|
|
17367
17431
|
return;
|
|
17368
17432
|
}
|
|
17369
17433
|
var parent = originalEvent.target;
|
|
@@ -17377,7 +17441,20 @@
|
|
|
17377
17441
|
parent = parent.parentNode;
|
|
17378
17442
|
}
|
|
17379
17443
|
originalEvent.stopPropagation();
|
|
17380
|
-
|
|
17444
|
+
_this.refine(facetValueToRefine);
|
|
17445
|
+
});
|
|
17446
|
+
return _this;
|
|
17447
|
+
}
|
|
17448
|
+
_createClass(RefinementList, [{
|
|
17449
|
+
key: "shouldComponentUpdate",
|
|
17450
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
17451
|
+
var areFacetValuesDifferent = !isEqual(this.props.facetValues, nextProps.facetValues);
|
|
17452
|
+
return areFacetValuesDifferent;
|
|
17453
|
+
}
|
|
17454
|
+
}, {
|
|
17455
|
+
key: "refine",
|
|
17456
|
+
value: function refine(facetValueToRefine) {
|
|
17457
|
+
this.props.toggleRefinement(facetValueToRefine);
|
|
17381
17458
|
}
|
|
17382
17459
|
}, {
|
|
17383
17460
|
key: "componentWillReceiveProps",
|
|
@@ -17835,7 +17912,9 @@
|
|
|
17835
17912
|
}, h(Selector, {
|
|
17836
17913
|
cssClasses: cssClasses,
|
|
17837
17914
|
currentValue: currentValue,
|
|
17838
|
-
options: items
|
|
17915
|
+
options: items
|
|
17916
|
+
// @ts-expect-error: the refine function expects a number, but setValue will call it with a string. We don't want to change the type of the refine function because it's part of the connector API.
|
|
17917
|
+
,
|
|
17839
17918
|
setValue: refine
|
|
17840
17919
|
})), containerNode);
|
|
17841
17920
|
};
|
|
@@ -19194,10 +19273,17 @@
|
|
|
19194
19273
|
});
|
|
19195
19274
|
};
|
|
19196
19275
|
|
|
19276
|
+
// Strips leading `0` from a positive number value
|
|
19277
|
+
function stripLeadingZeroFromInput(value) {
|
|
19278
|
+
return value.replace(/^(0+)\d/, function (part) {
|
|
19279
|
+
return Number(part).toString();
|
|
19280
|
+
});
|
|
19281
|
+
}
|
|
19197
19282
|
var RangeInput = /*#__PURE__*/function (_Component) {
|
|
19198
19283
|
_inherits(RangeInput, _Component);
|
|
19199
19284
|
var _super = _createSuper(RangeInput);
|
|
19200
19285
|
function RangeInput() {
|
|
19286
|
+
var _this$props$values$mi, _this$props$values$ma;
|
|
19201
19287
|
var _this;
|
|
19202
19288
|
_classCallCheck(this, RangeInput);
|
|
19203
19289
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -19205,36 +19291,40 @@
|
|
|
19205
19291
|
}
|
|
19206
19292
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
19207
19293
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
19208
|
-
min: _this.props.values.min,
|
|
19209
|
-
max: _this.props.values.max
|
|
19294
|
+
min: (_this$props$values$mi = _this.props.values.min) === null || _this$props$values$mi === void 0 ? void 0 : _this$props$values$mi.toString(),
|
|
19295
|
+
max: (_this$props$values$ma = _this.props.values.max) === null || _this$props$values$ma === void 0 ? void 0 : _this$props$values$ma.toString()
|
|
19210
19296
|
});
|
|
19211
19297
|
_defineProperty(_assertThisInitialized(_this), "onInput", function (key) {
|
|
19212
19298
|
return function (event) {
|
|
19213
19299
|
var _ref = event.currentTarget,
|
|
19214
19300
|
value = _ref.value;
|
|
19215
|
-
_this.setState(_defineProperty({}, key,
|
|
19301
|
+
_this.setState(_defineProperty({}, key, value));
|
|
19216
19302
|
};
|
|
19217
19303
|
});
|
|
19218
19304
|
_defineProperty(_assertThisInitialized(_this), "onSubmit", function (event) {
|
|
19219
19305
|
event.preventDefault();
|
|
19220
|
-
_this
|
|
19306
|
+
var _this$state = _this.state,
|
|
19307
|
+
min = _this$state.min,
|
|
19308
|
+
max = _this$state.max;
|
|
19309
|
+
_this.props.refine([min ? Number(min) : undefined, max ? Number(max) : undefined]);
|
|
19221
19310
|
});
|
|
19222
19311
|
return _this;
|
|
19223
19312
|
}
|
|
19224
19313
|
_createClass(RangeInput, [{
|
|
19225
19314
|
key: "componentWillReceiveProps",
|
|
19226
19315
|
value: function componentWillReceiveProps(nextProps) {
|
|
19316
|
+
var _nextProps$values$min, _nextProps$values$max;
|
|
19227
19317
|
this.setState({
|
|
19228
|
-
min: nextProps.values.min,
|
|
19229
|
-
max: nextProps.values.max
|
|
19318
|
+
min: (_nextProps$values$min = nextProps.values.min) === null || _nextProps$values$min === void 0 ? void 0 : _nextProps$values$min.toString(),
|
|
19319
|
+
max: (_nextProps$values$max = nextProps.values.max) === null || _nextProps$values$max === void 0 ? void 0 : _nextProps$values$max.toString()
|
|
19230
19320
|
});
|
|
19231
19321
|
}
|
|
19232
19322
|
}, {
|
|
19233
19323
|
key: "render",
|
|
19234
19324
|
value: function render() {
|
|
19235
|
-
var _this$
|
|
19236
|
-
minValue = _this$
|
|
19237
|
-
maxValue = _this$
|
|
19325
|
+
var _this$state2 = this.state,
|
|
19326
|
+
minValue = _this$state2.min,
|
|
19327
|
+
maxValue = _this$state2.max;
|
|
19238
19328
|
var _this$props = this.props,
|
|
19239
19329
|
min = _this$props.min,
|
|
19240
19330
|
max = _this$props.max,
|
|
@@ -19257,7 +19347,7 @@
|
|
|
19257
19347
|
min: min,
|
|
19258
19348
|
max: max,
|
|
19259
19349
|
step: step,
|
|
19260
|
-
value: minValue !== null && minValue !== void 0 ? minValue : '',
|
|
19350
|
+
value: stripLeadingZeroFromInput(minValue !== null && minValue !== void 0 ? minValue : ''),
|
|
19261
19351
|
onInput: this.onInput('min'),
|
|
19262
19352
|
placeholder: min === null || min === void 0 ? void 0 : min.toString(),
|
|
19263
19353
|
disabled: isDisabled
|
|
@@ -19275,7 +19365,7 @@
|
|
|
19275
19365
|
min: min,
|
|
19276
19366
|
max: max,
|
|
19277
19367
|
step: step,
|
|
19278
|
-
value: maxValue !== null && maxValue !== void 0 ? maxValue : '',
|
|
19368
|
+
value: stripLeadingZeroFromInput(maxValue !== null && maxValue !== void 0 ? maxValue : ''),
|
|
19279
19369
|
onInput: this.onInput('max'),
|
|
19280
19370
|
placeholder: max === null || max === void 0 ? void 0 : max.toString(),
|
|
19281
19371
|
disabled: isDisabled
|
|
@@ -19478,10 +19568,16 @@
|
|
|
19478
19568
|
var Rheostat = /*#__PURE__*/function (_Component) {
|
|
19479
19569
|
_inherits(Rheostat, _Component);
|
|
19480
19570
|
var _super = _createSuper(Rheostat);
|
|
19481
|
-
function Rheostat(
|
|
19571
|
+
function Rheostat() {
|
|
19482
19572
|
var _this;
|
|
19483
19573
|
_classCallCheck(this, Rheostat);
|
|
19484
|
-
|
|
19574
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19575
|
+
args[_key] = arguments[_key];
|
|
19576
|
+
}
|
|
19577
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
19578
|
+
_defineProperty(_assertThisInitialized(_this), "x", [0, 0].map(function (y) {
|
|
19579
|
+
return y;
|
|
19580
|
+
}));
|
|
19485
19581
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
19486
19582
|
className: getClassName(_this.props),
|
|
19487
19583
|
// non-null thanks to defaultProps
|
|
@@ -19496,44 +19592,14 @@
|
|
|
19496
19592
|
values: _this.props.values
|
|
19497
19593
|
});
|
|
19498
19594
|
_defineProperty(_assertThisInitialized(_this), "rheostat", y());
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
_this.getProgressStyle = _this.getProgressStyle.bind(_assertThisInitialized(_this));
|
|
19502
|
-
_this.getMinValue = _this.getMinValue.bind(_assertThisInitialized(_this));
|
|
19503
|
-
_this.getMaxValue = _this.getMaxValue.bind(_assertThisInitialized(_this));
|
|
19504
|
-
_this.getHandleDimensions = _this.getHandleDimensions.bind(_assertThisInitialized(_this));
|
|
19505
|
-
_this.getClosestSnapPoint = _this.getClosestSnapPoint.bind(_assertThisInitialized(_this));
|
|
19506
|
-
_this.getSnapPosition = _this.getSnapPosition.bind(_assertThisInitialized(_this));
|
|
19507
|
-
_this.getNextPositionForKey = _this.getNextPositionForKey.bind(_assertThisInitialized(_this));
|
|
19508
|
-
_this.getNextState = _this.getNextState.bind(_assertThisInitialized(_this));
|
|
19509
|
-
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
|
|
19510
|
-
_this.getClosestHandle = _this.getClosestHandle.bind(_assertThisInitialized(_this));
|
|
19511
|
-
_this.setStartSlide = _this.setStartSlide.bind(_assertThisInitialized(_this));
|
|
19512
|
-
_this.startMouseSlide = _this.startMouseSlide.bind(_assertThisInitialized(_this));
|
|
19513
|
-
_this.startTouchSlide = _this.startTouchSlide.bind(_assertThisInitialized(_this));
|
|
19514
|
-
_this.handleMouseSlide = _this.handleMouseSlide.bind(_assertThisInitialized(_this));
|
|
19515
|
-
_this.handleTouchSlide = _this.handleTouchSlide.bind(_assertThisInitialized(_this));
|
|
19516
|
-
_this.handleSlide = _this.handleSlide.bind(_assertThisInitialized(_this));
|
|
19517
|
-
_this.endSlide = _this.endSlide.bind(_assertThisInitialized(_this));
|
|
19518
|
-
_this.handleKeydown = _this.handleKeydown.bind(_assertThisInitialized(_this));
|
|
19519
|
-
_this.validatePosition = _this.validatePosition.bind(_assertThisInitialized(_this));
|
|
19520
|
-
_this.validateValues = _this.validateValues.bind(_assertThisInitialized(_this));
|
|
19521
|
-
_this.canMove = _this.canMove.bind(_assertThisInitialized(_this));
|
|
19522
|
-
_this.fireChangeEvent = _this.fireChangeEvent.bind(_assertThisInitialized(_this));
|
|
19523
|
-
_this.slideTo = _this.slideTo.bind(_assertThisInitialized(_this));
|
|
19524
|
-
_this.updateNewValues = _this.updateNewValues.bind(_assertThisInitialized(_this));
|
|
19525
|
-
return _this;
|
|
19526
|
-
}
|
|
19527
|
-
_createClass(Rheostat, [{
|
|
19528
|
-
key: "componentWillReceiveProps",
|
|
19529
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
19530
|
-
var _this$props = this.props,
|
|
19595
|
+
_defineProperty(_assertThisInitialized(_this), "componentWillReceiveProps", function (nextProps) {
|
|
19596
|
+
var _this$props = _this.props,
|
|
19531
19597
|
className = _this$props.className,
|
|
19532
19598
|
disabled = _this$props.disabled,
|
|
19533
19599
|
min = _this$props.min,
|
|
19534
19600
|
max = _this$props.max,
|
|
19535
19601
|
orientation = _this$props.orientation;
|
|
19536
|
-
var _this$state =
|
|
19602
|
+
var _this$state = _this.state,
|
|
19537
19603
|
values = _this$state.values,
|
|
19538
19604
|
slidingIndex = _this$state.slidingIndex;
|
|
19539
19605
|
var minMaxChanged = nextProps.min !== min || nextProps.max !== max;
|
|
@@ -19543,33 +19609,29 @@
|
|
|
19543
19609
|
var orientationChanged = nextProps.className !== className || nextProps.orientation !== orientation;
|
|
19544
19610
|
var willBeDisabled = nextProps.disabled && !disabled;
|
|
19545
19611
|
if (orientationChanged) {
|
|
19546
|
-
|
|
19612
|
+
_this.setState({
|
|
19547
19613
|
className: getClassName(nextProps)
|
|
19548
19614
|
});
|
|
19549
19615
|
}
|
|
19550
|
-
if (minMaxChanged || valuesChanged)
|
|
19616
|
+
if (minMaxChanged || valuesChanged) _this.updateNewValues(nextProps);
|
|
19551
19617
|
if (willBeDisabled && slidingIndex !== null) {
|
|
19552
|
-
|
|
19618
|
+
_this.endSlide();
|
|
19553
19619
|
}
|
|
19554
|
-
}
|
|
19555
|
-
|
|
19556
|
-
|
|
19557
|
-
value: function getPublicState() {
|
|
19558
|
-
var _this$props2 = this.props,
|
|
19620
|
+
});
|
|
19621
|
+
_defineProperty(_assertThisInitialized(_this), "getPublicState", function () {
|
|
19622
|
+
var _this$props2 = _this.props,
|
|
19559
19623
|
min = _this$props2.min,
|
|
19560
19624
|
max = _this$props2.max;
|
|
19561
|
-
var values =
|
|
19625
|
+
var values = _this.state.values;
|
|
19562
19626
|
return {
|
|
19563
19627
|
max: max,
|
|
19564
19628
|
min: min,
|
|
19565
19629
|
values: values
|
|
19566
19630
|
};
|
|
19567
|
-
}
|
|
19568
|
-
|
|
19569
|
-
key: "getSliderBoundingBox",
|
|
19570
|
-
value: function getSliderBoundingBox() {
|
|
19631
|
+
});
|
|
19632
|
+
_defineProperty(_assertThisInitialized(_this), "getSliderBoundingBox", function () {
|
|
19571
19633
|
// only gets called after render, so it will always be defined
|
|
19572
|
-
var node =
|
|
19634
|
+
var node = _this.rheostat.current;
|
|
19573
19635
|
var rect = node.getBoundingClientRect();
|
|
19574
19636
|
return {
|
|
19575
19637
|
height: rect.height || node.clientHeight,
|
|
@@ -19577,14 +19639,12 @@
|
|
|
19577
19639
|
top: rect.top,
|
|
19578
19640
|
width: rect.width || node.clientWidth
|
|
19579
19641
|
};
|
|
19580
|
-
}
|
|
19581
|
-
|
|
19582
|
-
|
|
19583
|
-
value: function getProgressStyle(idx) {
|
|
19584
|
-
var handlePos = this.state.handlePos;
|
|
19642
|
+
});
|
|
19643
|
+
_defineProperty(_assertThisInitialized(_this), "getProgressStyle", function (idx) {
|
|
19644
|
+
var handlePos = _this.state.handlePos;
|
|
19585
19645
|
var value = handlePos[idx];
|
|
19586
19646
|
if (idx === 0) {
|
|
19587
|
-
return
|
|
19647
|
+
return _this.props.orientation === 'vertical' ? {
|
|
19588
19648
|
height: "".concat(value, "%"),
|
|
19589
19649
|
top: 0
|
|
19590
19650
|
} : {
|
|
@@ -19594,63 +19654,51 @@
|
|
|
19594
19654
|
}
|
|
19595
19655
|
var prevValue = handlePos[idx - 1];
|
|
19596
19656
|
var diffValue = value - prevValue;
|
|
19597
|
-
return
|
|
19657
|
+
return _this.props.orientation === 'vertical' ? {
|
|
19598
19658
|
height: "".concat(diffValue, "%"),
|
|
19599
19659
|
top: "".concat(prevValue, "%")
|
|
19600
19660
|
} : {
|
|
19601
19661
|
left: "".concat(prevValue, "%"),
|
|
19602
19662
|
width: "".concat(diffValue, "%")
|
|
19603
19663
|
};
|
|
19604
|
-
}
|
|
19605
|
-
|
|
19606
|
-
|
|
19607
|
-
|
|
19608
|
-
|
|
19609
|
-
|
|
19610
|
-
|
|
19611
|
-
|
|
19612
|
-
value: function getMaxValue(idx) {
|
|
19613
|
-
return this.state.values[idx + 1] ? Math.min(this.props.max, this.state.values[idx + 1]) : this.props.max;
|
|
19614
|
-
}
|
|
19615
|
-
}, {
|
|
19616
|
-
key: "getHandleDimensions",
|
|
19617
|
-
value: function getHandleDimensions(ev, sliderBox) {
|
|
19664
|
+
});
|
|
19665
|
+
_defineProperty(_assertThisInitialized(_this), "getMinValue", function (idx) {
|
|
19666
|
+
return _this.state.values[idx - 1] ? Math.max(_this.props.min, _this.state.values[idx - 1]) : _this.props.min;
|
|
19667
|
+
});
|
|
19668
|
+
_defineProperty(_assertThisInitialized(_this), "getMaxValue", function (idx) {
|
|
19669
|
+
return _this.state.values[idx + 1] ? Math.min(_this.props.max, _this.state.values[idx + 1]) : _this.props.max;
|
|
19670
|
+
});
|
|
19671
|
+
_defineProperty(_assertThisInitialized(_this), "getHandleDimensions", function (ev, sliderBox) {
|
|
19618
19672
|
var handleNode = ev.currentTarget || null;
|
|
19619
19673
|
if (!handleNode) return 0;
|
|
19620
|
-
return
|
|
19621
|
-
}
|
|
19622
|
-
|
|
19623
|
-
key: "getClosestSnapPoint",
|
|
19624
|
-
value: function getClosestSnapPoint(value) {
|
|
19674
|
+
return _this.props.orientation === 'vertical' ? handleNode.clientHeight / sliderBox.height * PERCENT_FULL / 2 : handleNode.clientWidth / sliderBox.width * PERCENT_FULL / 2;
|
|
19675
|
+
});
|
|
19676
|
+
_defineProperty(_assertThisInitialized(_this), "getClosestSnapPoint", function (value) {
|
|
19625
19677
|
// non-null thanks to defaultProps
|
|
19626
|
-
if (!
|
|
19627
|
-
return
|
|
19678
|
+
if (!_this.props.snapPoints.length) return value;
|
|
19679
|
+
return _this.props.snapPoints.reduce(function (snapTo, snap) {
|
|
19628
19680
|
return Math.abs(snapTo - value) < Math.abs(snap - value) ? snapTo : snap;
|
|
19629
19681
|
});
|
|
19630
|
-
}
|
|
19631
|
-
|
|
19632
|
-
|
|
19633
|
-
|
|
19634
|
-
if (!this.props.snap) return positionPercent;
|
|
19635
|
-
var _ref = this.props,
|
|
19682
|
+
});
|
|
19683
|
+
_defineProperty(_assertThisInitialized(_this), "getSnapPosition", function (positionPercent) {
|
|
19684
|
+
if (!_this.props.snap) return positionPercent;
|
|
19685
|
+
var _ref = _this.props,
|
|
19636
19686
|
max = _ref.max,
|
|
19637
19687
|
min = _ref.min;
|
|
19638
19688
|
var value = getValue$1(positionPercent, min, max);
|
|
19639
|
-
var snapValue =
|
|
19689
|
+
var snapValue = _this.getClosestSnapPoint(value);
|
|
19640
19690
|
return getPosition(snapValue, min, max);
|
|
19641
|
-
}
|
|
19642
|
-
|
|
19643
|
-
key: "getNextPositionForKey",
|
|
19644
|
-
value: function getNextPositionForKey(idx, keyCode) {
|
|
19691
|
+
});
|
|
19692
|
+
_defineProperty(_assertThisInitialized(_this), "getNextPositionForKey", function (idx, keyCode) {
|
|
19645
19693
|
var _stepMultiplier;
|
|
19646
|
-
var _this$state2 =
|
|
19694
|
+
var _this$state2 = _this.state,
|
|
19647
19695
|
handlePos = _this$state2.handlePos,
|
|
19648
19696
|
values = _this$state2.values;
|
|
19649
|
-
var _ref2 =
|
|
19697
|
+
var _ref2 = _this.props,
|
|
19650
19698
|
max = _ref2.max,
|
|
19651
19699
|
min = _ref2.min,
|
|
19652
19700
|
snapPoints = _ref2.snapPoints;
|
|
19653
|
-
var shouldSnap =
|
|
19701
|
+
var shouldSnap = _this.props.snap;
|
|
19654
19702
|
var proposedValue = values[idx];
|
|
19655
19703
|
var proposedPercentage = handlePos[idx];
|
|
19656
19704
|
var originalPercentage = proposedPercentage;
|
|
@@ -19662,7 +19710,7 @@
|
|
|
19662
19710
|
}
|
|
19663
19711
|
var currentIndex = null;
|
|
19664
19712
|
if (shouldSnap) {
|
|
19665
|
-
currentIndex = snapPoints.indexOf(
|
|
19713
|
+
currentIndex = snapPoints.indexOf(_this.getClosestSnapPoint(values[idx]));
|
|
19666
19714
|
}
|
|
19667
19715
|
var stepMultiplier = (_stepMultiplier = {}, _defineProperty(_stepMultiplier, KEYS.LEFT, function (v) {
|
|
19668
19716
|
return v * -1;
|
|
@@ -19704,15 +19752,13 @@
|
|
|
19704
19752
|
return null;
|
|
19705
19753
|
}
|
|
19706
19754
|
return shouldSnap ? getPosition(proposedValue, min, max) : proposedPercentage;
|
|
19707
|
-
}
|
|
19708
|
-
|
|
19709
|
-
|
|
19710
|
-
|
|
19711
|
-
var handlePos = this.state.handlePos;
|
|
19712
|
-
var _ref3 = this.props,
|
|
19755
|
+
});
|
|
19756
|
+
_defineProperty(_assertThisInitialized(_this), "getNextState", function (idx, proposedPosition) {
|
|
19757
|
+
var handlePos = _this.state.handlePos;
|
|
19758
|
+
var _ref3 = _this.props,
|
|
19713
19759
|
max = _ref3.max,
|
|
19714
19760
|
min = _ref3.min;
|
|
19715
|
-
var actualPosition =
|
|
19761
|
+
var actualPosition = _this.validatePosition(idx, proposedPosition);
|
|
19716
19762
|
var nextHandlePos = handlePos.map(function (pos, index) {
|
|
19717
19763
|
return index === idx ? actualPosition : pos;
|
|
19718
19764
|
});
|
|
@@ -19722,23 +19768,19 @@
|
|
|
19722
19768
|
return getValue$1(pos, min, max);
|
|
19723
19769
|
})
|
|
19724
19770
|
};
|
|
19725
|
-
}
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
value: function getClosestHandle(positionPercent) {
|
|
19729
|
-
var handlePos = this.state.handlePos;
|
|
19771
|
+
});
|
|
19772
|
+
_defineProperty(_assertThisInitialized(_this), "getClosestHandle", function (positionPercent) {
|
|
19773
|
+
var handlePos = _this.state.handlePos;
|
|
19730
19774
|
return handlePos.reduce(function (closestIdx, _node, idx) {
|
|
19731
19775
|
var challenger = Math.abs(handlePos[idx] - positionPercent);
|
|
19732
19776
|
var current = Math.abs(handlePos[closestIdx] - positionPercent);
|
|
19733
19777
|
return challenger < current ? idx : closestIdx;
|
|
19734
19778
|
}, 0);
|
|
19735
|
-
}
|
|
19736
|
-
|
|
19737
|
-
|
|
19738
|
-
|
|
19739
|
-
|
|
19740
|
-
this.setState({
|
|
19741
|
-
handleDimensions: this.getHandleDimensions(ev, sliderBox),
|
|
19779
|
+
});
|
|
19780
|
+
_defineProperty(_assertThisInitialized(_this), "setStartSlide", function (ev, x, y) {
|
|
19781
|
+
var sliderBox = _this.getSliderBoundingBox();
|
|
19782
|
+
_this.setState({
|
|
19783
|
+
handleDimensions: _this.getHandleDimensions(ev, sliderBox),
|
|
19742
19784
|
mousePos: {
|
|
19743
19785
|
x: x,
|
|
19744
19786
|
y: y
|
|
@@ -19746,144 +19788,118 @@
|
|
|
19746
19788
|
sliderBox: sliderBox,
|
|
19747
19789
|
slidingIndex: getHandleFor(ev)
|
|
19748
19790
|
});
|
|
19749
|
-
}
|
|
19750
|
-
|
|
19751
|
-
|
|
19752
|
-
|
|
19753
|
-
|
|
19754
|
-
document.addEventListener('mousemove', this.handleMouseSlide, false);
|
|
19755
|
-
document.addEventListener('mouseup', this.endSlide, false);
|
|
19791
|
+
});
|
|
19792
|
+
_defineProperty(_assertThisInitialized(_this), "startMouseSlide", function (ev) {
|
|
19793
|
+
_this.setStartSlide(ev, ev.clientX, ev.clientY);
|
|
19794
|
+
document.addEventListener('mousemove', _this.handleMouseSlide, false);
|
|
19795
|
+
document.addEventListener('mouseup', _this.endSlide, false);
|
|
19756
19796
|
killEvent(ev);
|
|
19757
|
-
}
|
|
19758
|
-
|
|
19759
|
-
key: "startTouchSlide",
|
|
19760
|
-
value: function startTouchSlide(ev) {
|
|
19797
|
+
});
|
|
19798
|
+
_defineProperty(_assertThisInitialized(_this), "startTouchSlide", function (ev) {
|
|
19761
19799
|
if (ev.changedTouches.length > 1) return;
|
|
19762
19800
|
var touch = ev.changedTouches[0];
|
|
19763
|
-
|
|
19764
|
-
document.addEventListener('touchmove',
|
|
19765
|
-
document.addEventListener('touchend',
|
|
19766
|
-
if (
|
|
19801
|
+
_this.setStartSlide(ev, touch.clientX, touch.clientY);
|
|
19802
|
+
document.addEventListener('touchmove', _this.handleTouchSlide, false);
|
|
19803
|
+
document.addEventListener('touchend', _this.endSlide, false);
|
|
19804
|
+
if (_this.props.onSliderDragStart) _this.props.onSliderDragStart();
|
|
19767
19805
|
killEvent(ev);
|
|
19768
|
-
}
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
|
|
19772
|
-
if (this.state.slidingIndex === null) return;
|
|
19773
|
-
this.handleSlide(ev.clientX, ev.clientY);
|
|
19806
|
+
});
|
|
19807
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseSlide", function (ev) {
|
|
19808
|
+
if (_this.state.slidingIndex === null) return;
|
|
19809
|
+
_this.handleSlide(ev.clientX, ev.clientY);
|
|
19774
19810
|
killEvent(ev);
|
|
19775
|
-
}
|
|
19776
|
-
|
|
19777
|
-
|
|
19778
|
-
value: function handleTouchSlide(ev) {
|
|
19779
|
-
if (this.state.slidingIndex === null) return;
|
|
19811
|
+
});
|
|
19812
|
+
_defineProperty(_assertThisInitialized(_this), "handleTouchSlide", function (ev) {
|
|
19813
|
+
if (_this.state.slidingIndex === null) return;
|
|
19780
19814
|
if (ev.changedTouches.length > 1) {
|
|
19781
|
-
|
|
19815
|
+
_this.endSlide();
|
|
19782
19816
|
return;
|
|
19783
19817
|
}
|
|
19784
19818
|
var touch = ev.changedTouches[0];
|
|
19785
|
-
|
|
19819
|
+
_this.handleSlide(touch.clientX, touch.clientY);
|
|
19786
19820
|
killEvent(ev);
|
|
19787
|
-
}
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
value: function handleSlide(x, y) {
|
|
19791
|
-
var _this$state3 = this.state,
|
|
19821
|
+
});
|
|
19822
|
+
_defineProperty(_assertThisInitialized(_this), "handleSlide", function (x, y) {
|
|
19823
|
+
var _this$state3 = _this.state,
|
|
19792
19824
|
idx = _this$state3.slidingIndex,
|
|
19793
19825
|
sliderBox = _this$state3.sliderBox;
|
|
19794
|
-
var positionPercent =
|
|
19795
|
-
|
|
19796
|
-
if (
|
|
19826
|
+
var positionPercent = _this.props.orientation === 'vertical' ? (y - sliderBox.top) / sliderBox.height * PERCENT_FULL : (x - sliderBox.left) / sliderBox.width * PERCENT_FULL;
|
|
19827
|
+
_this.slideTo(idx, positionPercent);
|
|
19828
|
+
if (_this.canMove(idx, positionPercent)) {
|
|
19797
19829
|
// update mouse positions
|
|
19798
|
-
|
|
19830
|
+
_this.setState({
|
|
19799
19831
|
mousePos: {
|
|
19800
19832
|
x: x,
|
|
19801
19833
|
y: y
|
|
19802
19834
|
}
|
|
19803
19835
|
});
|
|
19804
|
-
if (
|
|
19836
|
+
if (_this.props.onSliderDragMove) _this.props.onSliderDragMove();
|
|
19805
19837
|
}
|
|
19806
|
-
}
|
|
19807
|
-
|
|
19808
|
-
|
|
19809
|
-
|
|
19810
|
-
var _this2 = this;
|
|
19811
|
-
var idx = this.state.slidingIndex;
|
|
19812
|
-
this.setState({
|
|
19838
|
+
});
|
|
19839
|
+
_defineProperty(_assertThisInitialized(_this), "endSlide", function () {
|
|
19840
|
+
var idx = _this.state.slidingIndex;
|
|
19841
|
+
_this.setState({
|
|
19813
19842
|
slidingIndex: null
|
|
19814
19843
|
});
|
|
19815
|
-
document.removeEventListener('mouseup',
|
|
19816
|
-
document.removeEventListener('touchend',
|
|
19817
|
-
document.removeEventListener('touchmove',
|
|
19818
|
-
document.removeEventListener('mousemove',
|
|
19819
|
-
if (
|
|
19820
|
-
if (
|
|
19821
|
-
var positionPercent =
|
|
19822
|
-
|
|
19823
|
-
return
|
|
19844
|
+
document.removeEventListener('mouseup', _this.endSlide, false);
|
|
19845
|
+
document.removeEventListener('touchend', _this.endSlide, false);
|
|
19846
|
+
document.removeEventListener('touchmove', _this.handleTouchSlide, false);
|
|
19847
|
+
document.removeEventListener('mousemove', _this.handleMouseSlide, false);
|
|
19848
|
+
if (_this.props.onSliderDragEnd) _this.props.onSliderDragEnd();
|
|
19849
|
+
if (_this.props.snap) {
|
|
19850
|
+
var positionPercent = _this.getSnapPosition(_this.state.handlePos[idx]);
|
|
19851
|
+
_this.slideTo(idx, positionPercent, function () {
|
|
19852
|
+
return _this.fireChangeEvent();
|
|
19824
19853
|
});
|
|
19825
19854
|
} else {
|
|
19826
|
-
|
|
19855
|
+
_this.fireChangeEvent();
|
|
19827
19856
|
}
|
|
19828
|
-
}
|
|
19829
|
-
|
|
19830
|
-
key: "handleClick",
|
|
19831
|
-
value: function handleClick(ev) {
|
|
19832
|
-
var _this3 = this;
|
|
19857
|
+
});
|
|
19858
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function (ev) {
|
|
19833
19859
|
if (ev.target.getAttribute('data-handle-key')) {
|
|
19834
19860
|
return;
|
|
19835
19861
|
}
|
|
19836
19862
|
|
|
19837
19863
|
// Calculate the position of the slider on the page so we can determine
|
|
19838
19864
|
// the position where you click in relativity.
|
|
19839
|
-
var sliderBox =
|
|
19840
|
-
var positionDecimal =
|
|
19865
|
+
var sliderBox = _this.getSliderBoundingBox();
|
|
19866
|
+
var positionDecimal = _this.props.orientation === 'vertical' ? (ev.clientY - sliderBox.top) / sliderBox.height : (ev.clientX - sliderBox.left) / sliderBox.width;
|
|
19841
19867
|
var positionPercent = positionDecimal * PERCENT_FULL;
|
|
19842
|
-
var handleId =
|
|
19843
|
-
var validPositionPercent =
|
|
19868
|
+
var handleId = _this.getClosestHandle(positionPercent);
|
|
19869
|
+
var validPositionPercent = _this.getSnapPosition(positionPercent);
|
|
19844
19870
|
|
|
19845
19871
|
// Move the handle there
|
|
19846
|
-
|
|
19847
|
-
return
|
|
19872
|
+
_this.slideTo(handleId, validPositionPercent, function () {
|
|
19873
|
+
return _this.fireChangeEvent();
|
|
19848
19874
|
});
|
|
19849
|
-
if (
|
|
19850
|
-
}
|
|
19851
|
-
|
|
19852
|
-
key: "handleKeydown",
|
|
19853
|
-
value: function handleKeydown(ev) {
|
|
19854
|
-
var _this4 = this;
|
|
19875
|
+
if (_this.props.onClick) _this.props.onClick();
|
|
19876
|
+
});
|
|
19877
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeydown", function (ev) {
|
|
19855
19878
|
var idx = getHandleFor(ev);
|
|
19856
19879
|
if (ev.keyCode === KEYS.ESC) {
|
|
19857
19880
|
ev.currentTarget.blur();
|
|
19858
19881
|
return;
|
|
19859
19882
|
}
|
|
19860
|
-
var proposedPercentage =
|
|
19883
|
+
var proposedPercentage = _this.getNextPositionForKey(idx, ev.keyCode);
|
|
19861
19884
|
if (proposedPercentage === null) return;
|
|
19862
|
-
if (
|
|
19863
|
-
|
|
19864
|
-
return
|
|
19885
|
+
if (_this.canMove(idx, proposedPercentage)) {
|
|
19886
|
+
_this.slideTo(idx, proposedPercentage, function () {
|
|
19887
|
+
return _this.fireChangeEvent();
|
|
19865
19888
|
});
|
|
19866
|
-
if (
|
|
19889
|
+
if (_this.props.onKeyPress) _this.props.onKeyPress();
|
|
19867
19890
|
}
|
|
19868
19891
|
killEvent(ev);
|
|
19869
|
-
}
|
|
19870
|
-
|
|
19871
|
-
|
|
19872
|
-
// does not collide with other handles too much.
|
|
19873
|
-
}, {
|
|
19874
|
-
key: "validatePosition",
|
|
19875
|
-
value: function validatePosition(idx, proposedPosition) {
|
|
19876
|
-
var _this$state4 = this.state,
|
|
19892
|
+
});
|
|
19893
|
+
_defineProperty(_assertThisInitialized(_this), "validatePosition", function (idx, proposedPosition) {
|
|
19894
|
+
var _this$state4 = _this.state,
|
|
19877
19895
|
handlePos = _this$state4.handlePos,
|
|
19878
19896
|
handleDimensions = _this$state4.handleDimensions;
|
|
19879
19897
|
return Math.max(Math.min(proposedPosition, handlePos[idx + 1] !== undefined ? handlePos[idx + 1] - handleDimensions : PERCENT_FULL // 100% is the highest value
|
|
19880
19898
|
), handlePos[idx - 1] !== undefined ? handlePos[idx - 1] + handleDimensions : PERCENT_EMPTY // 0% is the lowest value
|
|
19881
19899
|
);
|
|
19882
|
-
}
|
|
19883
|
-
|
|
19884
|
-
|
|
19885
|
-
value: function validateValues(proposedValues, props) {
|
|
19886
|
-
var _ref4 = props || this.props,
|
|
19900
|
+
});
|
|
19901
|
+
_defineProperty(_assertThisInitialized(_this), "validateValues", function (proposedValues, props) {
|
|
19902
|
+
var _ref4 = props || _this.props,
|
|
19887
19903
|
max = _ref4.max,
|
|
19888
19904
|
min = _ref4.min;
|
|
19889
19905
|
return proposedValues.map(function (value, idx, values) {
|
|
@@ -19893,11 +19909,9 @@
|
|
|
19893
19909
|
}
|
|
19894
19910
|
return realValue;
|
|
19895
19911
|
});
|
|
19896
|
-
}
|
|
19897
|
-
|
|
19898
|
-
|
|
19899
|
-
value: function canMove(idx, proposedPosition) {
|
|
19900
|
-
var _this$state5 = this.state,
|
|
19912
|
+
});
|
|
19913
|
+
_defineProperty(_assertThisInitialized(_this), "canMove", function (idx, proposedPosition) {
|
|
19914
|
+
var _this$state5 = _this.state,
|
|
19901
19915
|
handlePos = _this$state5.handlePos,
|
|
19902
19916
|
handleDimensions = _this$state5.handleDimensions;
|
|
19903
19917
|
if (proposedPosition < PERCENT_EMPTY) return false;
|
|
@@ -19907,29 +19921,21 @@
|
|
|
19907
19921
|
var prevHandlePosition = handlePos[idx - 1] !== undefined ? handlePos[idx - 1] + handleDimensions : -Infinity;
|
|
19908
19922
|
if (proposedPosition < prevHandlePosition) return false;
|
|
19909
19923
|
return true;
|
|
19910
|
-
}
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
|
|
19919
|
-
|
|
19920
|
-
var _this5 = this;
|
|
19921
|
-
var nextState = this.getNextState(idx, proposedPosition);
|
|
19922
|
-
this.setState(nextState, function () {
|
|
19923
|
-
var onValuesUpdated = _this5.props.onValuesUpdated;
|
|
19924
|
-
if (onValuesUpdated) onValuesUpdated(_this5.getPublicState());
|
|
19924
|
+
});
|
|
19925
|
+
_defineProperty(_assertThisInitialized(_this), "fireChangeEvent", function () {
|
|
19926
|
+
var onChange = _this.props.onChange;
|
|
19927
|
+
if (onChange) onChange(_this.getPublicState());
|
|
19928
|
+
});
|
|
19929
|
+
_defineProperty(_assertThisInitialized(_this), "slideTo", function (idx, proposedPosition, onAfterSet) {
|
|
19930
|
+
var nextState = _this.getNextState(idx, proposedPosition);
|
|
19931
|
+
_this.setState(nextState, function () {
|
|
19932
|
+
var onValuesUpdated = _this.props.onValuesUpdated;
|
|
19933
|
+
if (onValuesUpdated) onValuesUpdated(_this.getPublicState());
|
|
19925
19934
|
if (onAfterSet) onAfterSet();
|
|
19926
19935
|
});
|
|
19927
|
-
}
|
|
19928
|
-
|
|
19929
|
-
|
|
19930
|
-
value: function updateNewValues(nextProps) {
|
|
19931
|
-
var _this6 = this;
|
|
19932
|
-
var slidingIndex = this.state.slidingIndex;
|
|
19936
|
+
});
|
|
19937
|
+
_defineProperty(_assertThisInitialized(_this), "updateNewValues", function (nextProps) {
|
|
19938
|
+
var slidingIndex = _this.state.slidingIndex;
|
|
19933
19939
|
|
|
19934
19940
|
// Don't update while the slider is sliding
|
|
19935
19941
|
if (slidingIndex !== null) {
|
|
@@ -19938,21 +19944,18 @@
|
|
|
19938
19944
|
var max = nextProps.max,
|
|
19939
19945
|
min = nextProps.min,
|
|
19940
19946
|
values = nextProps.values;
|
|
19941
|
-
var nextValues =
|
|
19942
|
-
|
|
19947
|
+
var nextValues = _this.validateValues(values, nextProps);
|
|
19948
|
+
_this.setState({
|
|
19943
19949
|
handlePos: nextValues.map(function (value) {
|
|
19944
19950
|
return getPosition(value, min, max);
|
|
19945
19951
|
}),
|
|
19946
19952
|
values: nextValues
|
|
19947
19953
|
}, function () {
|
|
19948
|
-
return
|
|
19954
|
+
return _this.fireChangeEvent();
|
|
19949
19955
|
});
|
|
19950
|
-
}
|
|
19951
|
-
|
|
19952
|
-
|
|
19953
|
-
value: function render() {
|
|
19954
|
-
var _this7 = this;
|
|
19955
|
-
var _ref5 = this.props,
|
|
19956
|
+
});
|
|
19957
|
+
_defineProperty(_assertThisInitialized(_this), "render", function () {
|
|
19958
|
+
var _ref5 = _this.props,
|
|
19956
19959
|
children = _ref5.children,
|
|
19957
19960
|
disabled = _ref5.disabled,
|
|
19958
19961
|
Handle = _ref5.handle,
|
|
@@ -19962,14 +19965,14 @@
|
|
|
19962
19965
|
PitComponent = _ref5.pitComponent,
|
|
19963
19966
|
pitPoints = _ref5.pitPoints,
|
|
19964
19967
|
ProgressBar = _ref5.progressBar; // all required thanks to defaultProps
|
|
19965
|
-
var _this$state6 =
|
|
19968
|
+
var _this$state6 = _this.state,
|
|
19966
19969
|
className = _this$state6.className,
|
|
19967
19970
|
handlePos = _this$state6.handlePos,
|
|
19968
19971
|
values = _this$state6.values;
|
|
19969
19972
|
return h("div", {
|
|
19970
19973
|
className: className,
|
|
19971
|
-
ref:
|
|
19972
|
-
onClick: disabled ? undefined :
|
|
19974
|
+
ref: _this.rheostat,
|
|
19975
|
+
onClick: disabled ? undefined : _this.handleClick,
|
|
19973
19976
|
style: {
|
|
19974
19977
|
position: 'relative'
|
|
19975
19978
|
}
|
|
@@ -19982,17 +19985,17 @@
|
|
|
19982
19985
|
position: 'absolute'
|
|
19983
19986
|
};
|
|
19984
19987
|
return h(Handle, {
|
|
19985
|
-
"aria-valuemax":
|
|
19986
|
-
"aria-valuemin":
|
|
19988
|
+
"aria-valuemax": _this.getMaxValue(idx),
|
|
19989
|
+
"aria-valuemin": _this.getMinValue(idx),
|
|
19987
19990
|
"aria-valuenow": values[idx],
|
|
19988
19991
|
"aria-disabled": disabled,
|
|
19989
19992
|
"data-handle-key": idx,
|
|
19990
19993
|
className: "rheostat-handle",
|
|
19991
19994
|
key: "handle-".concat(idx),
|
|
19992
19995
|
onClick: killEvent,
|
|
19993
|
-
onKeyDown: disabled ? undefined :
|
|
19994
|
-
onMouseDown: disabled ? undefined :
|
|
19995
|
-
onTouchStart: disabled ? undefined :
|
|
19996
|
+
onKeyDown: disabled ? undefined : _this.handleKeydown,
|
|
19997
|
+
onMouseDown: disabled ? undefined : _this.startMouseSlide,
|
|
19998
|
+
onTouchStart: disabled ? undefined : _this.startTouchSlide,
|
|
19996
19999
|
role: "slider",
|
|
19997
20000
|
style: handleStyle,
|
|
19998
20001
|
tabIndex: 0
|
|
@@ -20004,7 +20007,7 @@
|
|
|
20004
20007
|
return h(ProgressBar, {
|
|
20005
20008
|
className: "rheostat-progress",
|
|
20006
20009
|
key: "progress-bar-".concat(idx),
|
|
20007
|
-
style:
|
|
20010
|
+
style: _this.getProgressStyle(idx)
|
|
20008
20011
|
});
|
|
20009
20012
|
}), PitComponent && pitPoints.map(function (n) {
|
|
20010
20013
|
var pos = getPosition(n, min, max);
|
|
@@ -20020,9 +20023,10 @@
|
|
|
20020
20023
|
style: pitStyle
|
|
20021
20024
|
}, n);
|
|
20022
20025
|
}), children);
|
|
20023
|
-
}
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
+
});
|
|
20027
|
+
return _this;
|
|
20028
|
+
}
|
|
20029
|
+
return _createClass(Rheostat);
|
|
20026
20030
|
}(d);
|
|
20027
20031
|
_defineProperty(Rheostat, "defaultProps", {
|
|
20028
20032
|
className: '',
|