@searchspring/snap-controller 0.22.0 → 0.23.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/dist/cjs/Autocomplete/AutocompleteController.d.ts +1 -1
- package/dist/cjs/Autocomplete/AutocompleteController.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/AutocompleteController.js +24 -22
- package/dist/esm/Autocomplete/AutocompleteController.d.ts +1 -1
- package/dist/esm/Autocomplete/AutocompleteController.d.ts.map +1 -1
- package/dist/esm/Autocomplete/AutocompleteController.js +22 -21
- package/package.json +10 -10
|
@@ -21,7 +21,7 @@ export declare class AutocompleteController extends AbstractController {
|
|
|
21
21
|
reset(): void;
|
|
22
22
|
handlers: {
|
|
23
23
|
input: {
|
|
24
|
-
enterKey: (e: KeyboardEvent) => Promise<
|
|
24
|
+
enterKey: (e: KeyboardEvent) => Promise<boolean>;
|
|
25
25
|
escKey: (e: KeyboardEvent) => void;
|
|
26
26
|
focus: (e: FocusEvent) => void;
|
|
27
27
|
formSubmit: (e: any) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteController.d.ts","sourceRoot":"","sources":["../../../src/Autocomplete/AutocompleteController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAA0B,MAAM,+BAA+B,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EACX,4BAA4B,EAI5B,kBAAkB,EAElB,gBAAgB,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAG1E,eAAO,MAAM,WAAW,MAAM,CAAC;AAoB/B,aAAK,wBAAwB,GAAG;IAC/B,OAAO,EAAE;QACR,KAAK,EAAE,CAAC,CAAC,KAAA,EAAE,MAAM,K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C;IACrC,OAAO,EAAE,YAAY,CAAC;gBAG5B,MAAM,EAAE,4BAA4B,EACpC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IAmD3B,KAAK,EAAE,wBAAwB,CAO7B;IAEF,IAAI,MAAM,IAAI,wBAAwB,CA+BrC;IAEK,UAAU,CAAC,YAAY,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsChE,KAAK,IAAI,IAAI;IASb,QAAQ;;0BAEc,aAAa,KAAG,QAAQ,OAAO,CAAC;wBA6CxC,aAAa,KAAG,IAAI;uBAMrB,UAAU,KAAG,IAAI;oCAQL,QAAQ,IAAI,CAAC;uBAwCzB,aAAa,KAAG,IAAI;;;;uBA8CpB,UAAU,KAAG,IAAI;;MAS5B;IAEF,MAAM,IAAI,IAAI;IAYR,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA2D3B,cAAc,QAAa,QAAQ,IAAI,CAAC,CAsBtC;IAEF,MAAM,QAAa,QAAQ,IAAI,CAAC,CA6G9B;CACF"}
|
|
@@ -68,7 +68,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
68
68
|
exports.AutocompleteController = exports.INPUT_DELAY = void 0;
|
|
69
69
|
var deepmerge_1 = __importDefault(require("deepmerge"));
|
|
70
70
|
var snap_store_mobx_1 = require("@searchspring/snap-store-mobx");
|
|
71
|
-
var snap_toolbox_1 = require("@searchspring/snap-toolbox");
|
|
72
71
|
var AbstractController_1 = require("../Abstract/AbstractController");
|
|
73
72
|
var getParams_1 = require("../utils/getParams");
|
|
74
73
|
var INPUT_ATTRIBUTE = 'ss-autocomplete-input';
|
|
@@ -107,14 +106,15 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
107
106
|
_this.handlers = {
|
|
108
107
|
input: {
|
|
109
108
|
enterKey: function (e) { return __awaiter(_this, void 0, void 0, function () {
|
|
110
|
-
var
|
|
109
|
+
var input, actionUrl, err_1;
|
|
111
110
|
var _a, _b, _c;
|
|
112
111
|
return __generator(this, function (_d) {
|
|
113
112
|
switch (_d.label) {
|
|
114
113
|
case 0:
|
|
115
114
|
if (!(e.keyCode == KEY_ENTER)) return [3 /*break*/, 10];
|
|
116
|
-
actionUrl = (0, snap_toolbox_1.url)(this.config.action);
|
|
117
115
|
input = e.target;
|
|
116
|
+
actionUrl = this.store.services.urlManager;
|
|
117
|
+
e.preventDefault();
|
|
118
118
|
if (!((_c = (_b = (_a = this.config.globals) === null || _a === void 0 ? void 0 : _a.search) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.spellCorrection)) return [3 /*break*/, 5];
|
|
119
119
|
// wait until loading is complete before submission
|
|
120
120
|
// TODO make this better
|
|
@@ -134,12 +134,11 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
134
134
|
// use corrected query and originalQuery
|
|
135
135
|
if (this.store.search.originalQuery) {
|
|
136
136
|
input.value = this.store.search.query.string;
|
|
137
|
-
actionUrl.
|
|
137
|
+
actionUrl = actionUrl.set(PARAM_ORIGINAL_QUERY, this.store.search.originalQuery.string);
|
|
138
138
|
}
|
|
139
139
|
_d.label = 5;
|
|
140
140
|
case 5:
|
|
141
|
-
|
|
142
|
-
actionUrl.params.query[inputParam] = input.value;
|
|
141
|
+
actionUrl = actionUrl.set('query', input.value);
|
|
143
142
|
_d.label = 6;
|
|
144
143
|
case 6:
|
|
145
144
|
_d.trys.push([6, 8, , 9]);
|
|
@@ -162,8 +161,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
162
161
|
}
|
|
163
162
|
return [3 /*break*/, 9];
|
|
164
163
|
case 9:
|
|
165
|
-
|
|
166
|
-
window.location.href = newUrl;
|
|
164
|
+
window.location.href = actionUrl.href;
|
|
167
165
|
_d.label = 10;
|
|
168
166
|
case 10: return [2 /*return*/];
|
|
169
167
|
}
|
|
@@ -239,6 +237,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
239
237
|
});
|
|
240
238
|
}); },
|
|
241
239
|
keyUp: function (e) {
|
|
240
|
+
var _a, _b, _c;
|
|
242
241
|
// ignore enter and escape keys
|
|
243
242
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) == KEY_ENTER || (e === null || e === void 0 ? void 0 : e.keyCode) == KEY_ESCAPE)
|
|
244
243
|
return;
|
|
@@ -263,6 +262,9 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
263
262
|
// TODO cancel any current requests?
|
|
264
263
|
_this.store.reset();
|
|
265
264
|
_this.urlManager.reset().go();
|
|
265
|
+
if (((_a = _this.store.trending) === null || _a === void 0 ? void 0 : _a.length) && ((_c = (_b = _this.config.settings) === null || _b === void 0 ? void 0 : _b.trending) === null || _c === void 0 ? void 0 : _c.showResults)) {
|
|
266
|
+
_this.store.trending[0].preview();
|
|
267
|
+
}
|
|
266
268
|
}
|
|
267
269
|
else {
|
|
268
270
|
_this.handlers.input.timeoutDelay = setTimeout(function () {
|
|
@@ -581,8 +583,12 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
581
583
|
}
|
|
582
584
|
return [3 /*break*/, 7];
|
|
583
585
|
case 7:
|
|
584
|
-
//auto select first trending term?
|
|
585
|
-
if (
|
|
586
|
+
// auto select first trending term?
|
|
587
|
+
if (inputElement &&
|
|
588
|
+
!((_a = this.store.state) === null || _a === void 0 ? void 0 : _a.input) &&
|
|
589
|
+
((_b = this.store.trending) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
590
|
+
!((_c = this.store.terms) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
591
|
+
((_e = (_d = this.config.settings) === null || _d === void 0 ? void 0 : _d.trending) === null || _e === void 0 ? void 0 : _e.showResults)) {
|
|
586
592
|
this.store.trending[0].preview();
|
|
587
593
|
}
|
|
588
594
|
else {
|
|
@@ -607,8 +613,8 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
607
613
|
inputs === null || inputs === void 0 ? void 0 : inputs.forEach(function (input) {
|
|
608
614
|
var _a;
|
|
609
615
|
input.removeEventListener('keyup', _this.handlers.input.keyUp);
|
|
610
|
-
input.removeEventListener('
|
|
611
|
-
input.removeEventListener('
|
|
616
|
+
input.removeEventListener('keydown', _this.handlers.input.enterKey);
|
|
617
|
+
input.removeEventListener('keydown', _this.handlers.input.escKey);
|
|
612
618
|
input.removeEventListener('focus', _this.handlers.input.focus);
|
|
613
619
|
(_a = input.form) === null || _a === void 0 ? void 0 : _a.removeEventListener('submit', _this.handlers.input.formSubmit);
|
|
614
620
|
});
|
|
@@ -639,19 +645,15 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
639
645
|
input.value = _this.store.state.input;
|
|
640
646
|
}
|
|
641
647
|
input.addEventListener('focus', _this.handlers.input.focus);
|
|
642
|
-
input.addEventListener('
|
|
648
|
+
input.addEventListener('keydown', _this.handlers.input.escKey);
|
|
643
649
|
var form = input.form;
|
|
644
|
-
var formActionUrl
|
|
645
|
-
if (
|
|
646
|
-
|
|
650
|
+
var formActionUrl;
|
|
651
|
+
if (_this.config.action) {
|
|
652
|
+
formActionUrl = _this.config.action;
|
|
653
|
+
input.addEventListener('keydown', _this.handlers.input.enterKey);
|
|
647
654
|
}
|
|
648
655
|
else if (form) {
|
|
649
|
-
|
|
650
|
-
form.action = _this.config.action;
|
|
651
|
-
}
|
|
652
|
-
else {
|
|
653
|
-
formActionUrl = form.action;
|
|
654
|
-
}
|
|
656
|
+
formActionUrl = form.action;
|
|
655
657
|
form.addEventListener('submit', _this.handlers.input.formSubmit);
|
|
656
658
|
}
|
|
657
659
|
// set the root URL on urlManager
|
|
@@ -21,7 +21,7 @@ export declare class AutocompleteController extends AbstractController {
|
|
|
21
21
|
reset(): void;
|
|
22
22
|
handlers: {
|
|
23
23
|
input: {
|
|
24
|
-
enterKey: (e: KeyboardEvent) => Promise<
|
|
24
|
+
enterKey: (e: KeyboardEvent) => Promise<boolean>;
|
|
25
25
|
escKey: (e: KeyboardEvent) => void;
|
|
26
26
|
focus: (e: FocusEvent) => void;
|
|
27
27
|
formSubmit: (e: any) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteController.d.ts","sourceRoot":"","sources":["../../../src/Autocomplete/AutocompleteController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAA0B,MAAM,+BAA+B,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EACX,4BAA4B,EAI5B,kBAAkB,EAElB,gBAAgB,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAG1E,eAAO,MAAM,WAAW,MAAM,CAAC;AAoB/B,aAAK,wBAAwB,GAAG;IAC/B,OAAO,EAAE;QACR,KAAK,EAAE,CAAC,CAAC,KAAA,EAAE,MAAM,KAAA,KAAK,IAAI,CAAC;KAC3B,CAAC;CACF,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,kBAAkB;IACtD,IAAI,SAAkB;IACtB,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,4BAA4B,CAAC;IACrC,OAAO,EAAE,YAAY,CAAC;gBAG5B,MAAM,EAAE,4BAA4B,EACpC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IAmD3B,KAAK,EAAE,wBAAwB,CAO7B;IAEF,IAAI,MAAM,IAAI,wBAAwB,CA+BrC;IAEK,UAAU,CAAC,YAAY,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3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;;;uBA8CpB,UAAU,KAAG,IAAI;;MAS5B;IAEF,MAAM,IAAI,IAAI;IAYR,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA2D3B,cAAc,QAAa,QAAQ,IAAI,CAAC,CAsBtC;IAEF,MAAM,QAAa,QAAQ,IAAI,CAAC,CA6G9B;CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import deepmerge from 'deepmerge';
|
|
2
2
|
import { StorageStore, StorageType, ErrorType } from '@searchspring/snap-store-mobx';
|
|
3
|
-
import { url } from '@searchspring/snap-toolbox';
|
|
4
3
|
import { AbstractController } from '../Abstract/AbstractController';
|
|
5
4
|
import { getSearchParams } from '../utils/getParams';
|
|
6
5
|
const INPUT_ATTRIBUTE = 'ss-autocomplete-input';
|
|
@@ -38,8 +37,9 @@ export class AutocompleteController extends AbstractController {
|
|
|
38
37
|
input: {
|
|
39
38
|
enterKey: async (e) => {
|
|
40
39
|
if (e.keyCode == KEY_ENTER) {
|
|
41
|
-
const actionUrl = url(this.config.action);
|
|
42
40
|
const input = e.target;
|
|
41
|
+
let actionUrl = this.store.services.urlManager;
|
|
42
|
+
e.preventDefault();
|
|
43
43
|
// when spellCorrection is enabled
|
|
44
44
|
if (this.config.globals?.search?.query?.spellCorrection) {
|
|
45
45
|
// wait until loading is complete before submission
|
|
@@ -51,11 +51,10 @@ export class AutocompleteController extends AbstractController {
|
|
|
51
51
|
// use corrected query and originalQuery
|
|
52
52
|
if (this.store.search.originalQuery) {
|
|
53
53
|
input.value = this.store.search.query.string;
|
|
54
|
-
actionUrl.
|
|
54
|
+
actionUrl = actionUrl.set(PARAM_ORIGINAL_QUERY, this.store.search.originalQuery.string);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
actionUrl.params.query[inputParam] = input.value;
|
|
57
|
+
actionUrl = actionUrl.set('query', input.value);
|
|
59
58
|
// TODO expected spell correct behavior queryAssumption
|
|
60
59
|
try {
|
|
61
60
|
await this.eventManager.fire('beforeSubmit', {
|
|
@@ -73,8 +72,7 @@ export class AutocompleteController extends AbstractController {
|
|
|
73
72
|
console.error(err);
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
|
|
77
|
-
window.location.href = newUrl;
|
|
75
|
+
window.location.href = actionUrl.href;
|
|
78
76
|
}
|
|
79
77
|
},
|
|
80
78
|
escKey: (e) => {
|
|
@@ -151,6 +149,9 @@ export class AutocompleteController extends AbstractController {
|
|
|
151
149
|
// TODO cancel any current requests?
|
|
152
150
|
this.store.reset();
|
|
153
151
|
this.urlManager.reset().go();
|
|
152
|
+
if (this.store.trending?.length && this.config.settings?.trending?.showResults) {
|
|
153
|
+
this.store.trending[0].preview();
|
|
154
|
+
}
|
|
154
155
|
}
|
|
155
156
|
else {
|
|
156
157
|
this.handlers.input.timeoutDelay = setTimeout(() => {
|
|
@@ -388,8 +389,12 @@ export class AutocompleteController extends AbstractController {
|
|
|
388
389
|
}
|
|
389
390
|
}
|
|
390
391
|
}
|
|
391
|
-
//auto select first trending term?
|
|
392
|
-
if (
|
|
392
|
+
// auto select first trending term?
|
|
393
|
+
if (inputElement &&
|
|
394
|
+
!this.store.state?.input &&
|
|
395
|
+
this.store.trending?.length &&
|
|
396
|
+
!this.store.terms?.length &&
|
|
397
|
+
this.config.settings?.trending?.showResults) {
|
|
393
398
|
this.store.trending[0].preview();
|
|
394
399
|
}
|
|
395
400
|
else {
|
|
@@ -408,8 +413,8 @@ export class AutocompleteController extends AbstractController {
|
|
|
408
413
|
const inputs = document.querySelectorAll(`input[${INPUT_ATTRIBUTE}]`);
|
|
409
414
|
inputs?.forEach((input) => {
|
|
410
415
|
input.removeEventListener('keyup', this.handlers.input.keyUp);
|
|
411
|
-
input.removeEventListener('
|
|
412
|
-
input.removeEventListener('
|
|
416
|
+
input.removeEventListener('keydown', this.handlers.input.enterKey);
|
|
417
|
+
input.removeEventListener('keydown', this.handlers.input.escKey);
|
|
413
418
|
input.removeEventListener('focus', this.handlers.input.focus);
|
|
414
419
|
input.form?.removeEventListener('submit', this.handlers.input.formSubmit);
|
|
415
420
|
});
|
|
@@ -430,19 +435,15 @@ export class AutocompleteController extends AbstractController {
|
|
|
430
435
|
input.value = this.store.state.input;
|
|
431
436
|
}
|
|
432
437
|
input.addEventListener('focus', this.handlers.input.focus);
|
|
433
|
-
input.addEventListener('
|
|
438
|
+
input.addEventListener('keydown', this.handlers.input.escKey);
|
|
434
439
|
const form = input.form;
|
|
435
|
-
let formActionUrl
|
|
436
|
-
if (
|
|
437
|
-
|
|
440
|
+
let formActionUrl;
|
|
441
|
+
if (this.config.action) {
|
|
442
|
+
formActionUrl = this.config.action;
|
|
443
|
+
input.addEventListener('keydown', this.handlers.input.enterKey);
|
|
438
444
|
}
|
|
439
445
|
else if (form) {
|
|
440
|
-
|
|
441
|
-
form.action = this.config.action;
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
formActionUrl = form.action;
|
|
445
|
-
}
|
|
446
|
+
formActionUrl = form.action;
|
|
446
447
|
form.addEventListener('submit', this.handlers.input.formSubmit);
|
|
447
448
|
}
|
|
448
449
|
// set the root URL on urlManager
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchspring/snap-controller",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Snap Controllers",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"test:watch": "jest --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@searchspring/snap-toolbox": "^0.
|
|
23
|
+
"@searchspring/snap-toolbox": "^0.23.0",
|
|
24
24
|
"deepmerge": "^4.2.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@searchspring/snap-client": "^0.
|
|
28
|
-
"@searchspring/snap-event-manager": "^0.
|
|
29
|
-
"@searchspring/snap-logger": "^0.
|
|
30
|
-
"@searchspring/snap-profiler": "^0.
|
|
31
|
-
"@searchspring/snap-store-mobx": "^0.
|
|
32
|
-
"@searchspring/snap-tracker": "^0.
|
|
33
|
-
"@searchspring/snap-url-manager": "^0.
|
|
27
|
+
"@searchspring/snap-client": "^0.23.0",
|
|
28
|
+
"@searchspring/snap-event-manager": "^0.23.0",
|
|
29
|
+
"@searchspring/snap-logger": "^0.23.0",
|
|
30
|
+
"@searchspring/snap-profiler": "^0.23.0",
|
|
31
|
+
"@searchspring/snap-store-mobx": "^0.23.0",
|
|
32
|
+
"@searchspring/snap-tracker": "^0.23.0",
|
|
33
|
+
"@searchspring/snap-url-manager": "^0.23.0"
|
|
34
34
|
},
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"files": [
|
|
37
37
|
"dist/**/*"
|
|
38
38
|
],
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "1b80d38743b8d123b7f597d4defd81a4263f1122"
|
|
40
40
|
}
|