@miso.ai/client-sdk-ui 1.11.6-beta.0 → 1.11.6-beta.1
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/actor/data.js +5 -7
- package/dist/cjs/actor/feedback.js +1 -2
- package/dist/cjs/actor/filters.js +20 -21
- package/dist/cjs/actor/hub.js +34 -8
- package/dist/cjs/actor/index.js +1 -2
- package/dist/cjs/actor/interactions.js +5 -7
- package/dist/cjs/actor/sessions.js +1 -2
- package/dist/cjs/actor/tracker.js +9 -12
- package/dist/cjs/actor/view.js +11 -20
- package/dist/cjs/actor/views.js +16 -21
- package/dist/cjs/affiliation/index.js +1 -2
- package/dist/cjs/combo/ask/elements.js +3 -4
- package/dist/cjs/combo/ask/index.js +1 -2
- package/dist/cjs/combo/ask/options.js +2 -6
- package/dist/cjs/defaults/ask/controls.js +1 -2
- package/dist/cjs/defaults/ask/index.js +1 -2
- package/dist/cjs/defaults/ask/templates.js +3 -6
- package/dist/cjs/defaults/common/templates.js +30 -41
- package/dist/cjs/defaults/hybrid-search/answer-box.js +9 -11
- package/dist/cjs/defaults/hybrid-search/controls.js +1 -2
- package/dist/cjs/defaults/hybrid-search/index.js +1 -2
- package/dist/cjs/defaults/hybrid-search/templates.js +2 -4
- package/dist/cjs/defaults/index.js +1 -2
- package/dist/cjs/element/container/miso-explore.js +7 -7
- package/dist/cjs/element/container/miso-hybrid-search.js +3 -3
- package/dist/cjs/element/container/miso-recommendation.js +3 -38
- package/dist/cjs/element/container/miso-search.js +3 -3
- package/dist/cjs/element/container/miso-unit.js +52 -0
- package/dist/cjs/element/index.js +1 -2
- package/dist/cjs/element/role/miso-component.js +3 -4
- package/dist/cjs/element/utils.js +6 -9
- package/dist/cjs/layout/affiliation/affiliation.js +4 -6
- package/dist/cjs/layout/banner/banner.js +1 -2
- package/dist/cjs/layout/button/more-button.js +1 -2
- package/dist/cjs/layout/container/container.js +7 -12
- package/dist/cjs/layout/error/error.js +1 -2
- package/dist/cjs/layout/input/facets.js +28 -41
- package/dist/cjs/layout/input/option-list.js +1 -2
- package/dist/cjs/layout/input/search-box.js +30 -39
- package/dist/cjs/layout/input/select.js +1 -2
- package/dist/cjs/layout/list/cards.js +1 -2
- package/dist/cjs/layout/list/carousel.js +1 -2
- package/dist/cjs/layout/list/collection.js +12 -16
- package/dist/cjs/layout/list/gallery.js +18 -26
- package/dist/cjs/layout/list/list.js +1 -2
- package/dist/cjs/layout/mixin/swipeable.js +3 -4
- package/dist/cjs/layout/mixin/trackable.js +3 -6
- package/dist/cjs/layout/progressive.js +1 -2
- package/dist/cjs/layout/radio/feedback.js +6 -8
- package/dist/cjs/layout/radio/radio.js +5 -6
- package/dist/cjs/layout/raf.js +6 -10
- package/dist/cjs/layout/template.js +7 -10
- package/dist/cjs/layout/templates.js +51 -71
- package/dist/cjs/layout/text/text.js +6 -8
- package/dist/cjs/layout/text/typewriter/index.js +14 -18
- package/dist/cjs/layout/text/typewriter/plaintext.js +8 -10
- package/dist/cjs/layout/text/typewriter/utils.js +12 -15
- package/dist/cjs/plugin.js +13 -3
- package/dist/cjs/source.js +6 -7
- package/dist/cjs/util/dom.js +1 -2
- package/dist/cjs/util/proxy.js +3 -4
- package/dist/cjs/util/trackers.js +1 -3
- package/dist/cjs/util/viewables.js +1 -2
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/workflow/answer-based.js +17 -24
- package/dist/cjs/workflow/ask.js +1 -2
- package/dist/cjs/workflow/asks.js +4 -6
- package/dist/cjs/workflow/autocomplete.js +3 -4
- package/dist/cjs/workflow/base.js +56 -54
- package/dist/cjs/workflow/explore.js +18 -22
- package/dist/cjs/workflow/explores.js +18 -0
- package/dist/cjs/workflow/hybrid-search-answer.js +4 -3
- package/dist/cjs/workflow/index.js +3 -3
- package/dist/cjs/workflow/options/api.js +2 -6
- package/dist/cjs/workflow/options/auto-query.js +2 -4
- package/dist/cjs/workflow/options/configurable.js +2 -6
- package/dist/cjs/workflow/options/data-processor.js +1 -4
- package/dist/cjs/workflow/options/filters.js +1 -4
- package/dist/cjs/workflow/options/interactions.js +1 -4
- package/dist/cjs/workflow/options/layouts.js +2 -6
- package/dist/cjs/workflow/options/options.js +5 -8
- package/dist/cjs/workflow/options/pagination.js +1 -4
- package/dist/cjs/workflow/options/roles.js +1 -3
- package/dist/cjs/workflow/options/trackers.js +6 -16
- package/dist/cjs/workflow/processors.js +16 -22
- package/dist/cjs/workflow/recommendation.js +9 -52
- package/dist/cjs/workflow/recommendations.js +3 -23
- package/dist/cjs/workflow/search-based.js +12 -8
- package/dist/cjs/workflow/search.js +1 -5
- package/dist/cjs/workflow/unit.js +58 -0
- package/dist/cjs/workflow/units.js +37 -0
- package/dist/cjs/workflow/use-link.js +3 -6
- package/package.json +2 -2
- package/src/actor/filters.js +4 -2
- package/src/actor/hub.js +26 -5
- package/src/element/container/miso-explore.js +8 -8
- package/src/element/container/miso-hybrid-search.js +4 -4
- package/src/element/container/miso-recommendation.js +3 -45
- package/src/element/container/miso-search.js +4 -4
- package/src/element/container/miso-unit.js +55 -0
- package/src/layout/radio/radio.js +1 -0
- package/src/layout/templates.js +3 -2
- package/src/plugin.js +15 -2
- package/src/version.js +1 -1
- package/src/workflow/autocomplete.js +1 -0
- package/src/workflow/base.js +33 -23
- package/src/workflow/explore.js +13 -12
- package/src/workflow/explores.js +14 -0
- package/src/workflow/hybrid-search-answer.js +1 -1
- package/src/workflow/index.js +1 -1
- package/src/workflow/processors.js +2 -2
- package/src/workflow/recommendation.js +9 -47
- package/src/workflow/recommendations.js +3 -23
- package/src/workflow/search-based.js +4 -0
- package/src/workflow/unit.js +52 -0
- package/src/workflow/units.js +37 -0
|
@@ -12,12 +12,11 @@ const CLASS_OPEN = 'answer-box-open';
|
|
|
12
12
|
const CLASS_SHOWN = 'answer-box-shown';
|
|
13
13
|
const TOGGLE_BUTTON_SELECTOR = '[data-role="answer-box-toggle"]';
|
|
14
14
|
class AnswerBox {
|
|
15
|
-
constructor(client, element
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
15
|
+
constructor(client, element, {
|
|
16
|
+
classPrefix = _constants.CLASS_PREFIX,
|
|
17
|
+
phrases = {},
|
|
18
|
+
hideWhenUnanswerable = true
|
|
19
|
+
} = {}) {
|
|
21
20
|
this._client = client;
|
|
22
21
|
this._workflow = client.ui.hybridSearch;
|
|
23
22
|
this._element = element;
|
|
@@ -50,11 +49,10 @@ class AnswerBox {
|
|
|
50
49
|
// cling to data rather than view, as we may miss view event when tab is inactive due to raf
|
|
51
50
|
workflow._answer._hub.on(_index.fields.data(), () => this._syncWofkflowStatus())];
|
|
52
51
|
}
|
|
53
|
-
_handleClick(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = _ref;
|
|
52
|
+
_handleClick({
|
|
53
|
+
target,
|
|
54
|
+
button
|
|
55
|
+
}) {
|
|
58
56
|
// only left click
|
|
59
57
|
if (button !== 0) {
|
|
60
58
|
return;
|
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.wireAnswerBox = wireAnswerBox;
|
|
7
7
|
var _answerBox = _interopRequireDefault(require("./answer-box.js"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
function wireAnswerBox(client, element) {
|
|
10
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
9
|
+
function wireAnswerBox(client, element, options = {}) {
|
|
11
10
|
if (!client) {
|
|
12
11
|
throw new Error('client is required');
|
|
13
12
|
}
|
|
@@ -24,8 +24,7 @@ Object.keys(_controls).forEach(function (key) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
function
|
|
28
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (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 (const 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); }
|
|
29
28
|
const constants = exports.constants = Object.freeze(_constants);
|
|
30
29
|
const phrases = exports.phrases = Object.freeze(_phrases);
|
|
31
30
|
const templates = exports.templates = Object.freeze(_templates);
|
|
@@ -10,8 +10,7 @@ var _commons = require("@miso.ai/commons");
|
|
|
10
10
|
var CONSTANTS = _interopRequireWildcard(require("./constants.js"));
|
|
11
11
|
var DEFAULT_PHRASES = _interopRequireWildcard(require("./phrases.js"));
|
|
12
12
|
var _templates = require("../common/templates.js");
|
|
13
|
-
function
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (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 (const 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); }
|
|
15
14
|
class Sections extends _templates.Sections {
|
|
16
15
|
constructor() {
|
|
17
16
|
super({
|
|
@@ -135,8 +134,7 @@ const helpers = exports.helpers = (0, _commons.externalize)(new _templates.Helpe
|
|
|
135
134
|
const sections = exports.sections = (0, _commons.externalize)(new Sections({
|
|
136
135
|
helpers
|
|
137
136
|
}));
|
|
138
|
-
function root() {
|
|
139
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
137
|
+
function root(options = {}) {
|
|
140
138
|
const {
|
|
141
139
|
normalizeOptions,
|
|
142
140
|
section,
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.hybridSearch = exports.ask = void 0;
|
|
7
7
|
var _ask = _interopRequireWildcard(require("./ask/index.js"));
|
|
8
8
|
var _hybridSearch = _interopRequireWildcard(require("./hybrid-search/index.js"));
|
|
9
|
-
function
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (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 (const 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
10
|
const ask = exports.ask = Object.freeze(_ask);
|
|
12
11
|
const hybridSearch = exports.hybridSearch = Object.freeze(_hybridSearch);
|
|
@@ -4,18 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _misoUnit = _interopRequireDefault(require("./miso-unit.js"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const TAG_NAME = 'miso-explore';
|
|
10
|
-
class MisoExploreElement extends
|
|
11
|
-
static get observedAttributes() {
|
|
12
|
-
return _misoContainer.default.observedAttributes;
|
|
13
|
-
}
|
|
10
|
+
class MisoExploreElement extends _misoUnit.default {
|
|
14
11
|
static get tagName() {
|
|
15
12
|
return TAG_NAME;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
|
-
return
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return _misoUnit.default.observedAttributes;
|
|
16
|
+
}
|
|
17
|
+
_getWorkflowByUnitId(client, unitId) {
|
|
18
|
+
return client.ui.explores.get(unitId);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.default = MisoExploreElement;
|
|
@@ -8,12 +8,12 @@ var _misoContainer = _interopRequireDefault(require("./miso-container.js"));
|
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const TAG_NAME = 'miso-hybrid-search';
|
|
10
10
|
class MisoHybridSearchElement extends _misoContainer.default {
|
|
11
|
-
static get observedAttributes() {
|
|
12
|
-
return _misoContainer.default.observedAttributes;
|
|
13
|
-
}
|
|
14
11
|
static get tagName() {
|
|
15
12
|
return TAG_NAME;
|
|
16
13
|
}
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return _misoContainer.default.observedAttributes;
|
|
16
|
+
}
|
|
17
17
|
_getWorkflow(client) {
|
|
18
18
|
return client.ui.hybridSearch;
|
|
19
19
|
}
|
|
@@ -4,53 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _misoUnit = _interopRequireDefault(require("./miso-unit.js"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const TAG_NAME = 'miso-recommendation';
|
|
10
|
-
|
|
11
|
-
const OBSERVED_ATTRIBUTES = Object.freeze([..._misoContainer.default.observedAttributes, ATTR_UNIT_ID]);
|
|
12
|
-
class MisoRecommendationElement extends _misoContainer.default {
|
|
10
|
+
class MisoRecommendationElement extends _misoUnit.default {
|
|
13
11
|
static get tagName() {
|
|
14
12
|
return TAG_NAME;
|
|
15
13
|
}
|
|
16
14
|
static get observedAttributes() {
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
_getWorkflow(client) {
|
|
20
|
-
return this._getWorkflowByUnitId(client, this.unitId);
|
|
15
|
+
return _misoUnit.default.observedAttributes;
|
|
21
16
|
}
|
|
22
17
|
_getWorkflowByUnitId(client, unitId) {
|
|
23
18
|
return client.ui.recommendations.get(unitId);
|
|
24
19
|
}
|
|
25
|
-
|
|
26
|
-
// properties //
|
|
27
|
-
get unitId() {
|
|
28
|
-
return this.getAttribute(ATTR_UNIT_ID) || undefined;
|
|
29
|
-
}
|
|
30
|
-
set unitId(value) {
|
|
31
|
-
value = value && `${value}`;
|
|
32
|
-
if (value) {
|
|
33
|
-
this.setAttribute(ATTR_UNIT_ID, value);
|
|
34
|
-
} else {
|
|
35
|
-
this.removeAttribute(ATTR_UNIT_ID);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// lifecycle //
|
|
40
|
-
attributeChangedCallback(attr, oldValue, newValue) {
|
|
41
|
-
switch (attr) {
|
|
42
|
-
case ATTR_UNIT_ID:
|
|
43
|
-
this._handleUnitIdUpdate(oldValue, newValue);
|
|
44
|
-
break;
|
|
45
|
-
default:
|
|
46
|
-
super.attributeChangedCallback(attr, oldValue, newValue);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
_handleUnitIdUpdate(oldUnitId, newUnitId) {
|
|
50
|
-
if (oldUnitId === newUnitId || !this._client) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
this._setWorkflow(this._getWorkflowByUnitId(this._client, newUnitId));
|
|
54
|
-
}
|
|
55
20
|
}
|
|
56
21
|
exports.default = MisoRecommendationElement;
|
|
@@ -8,12 +8,12 @@ var _misoContainer = _interopRequireDefault(require("./miso-container.js"));
|
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const TAG_NAME = 'miso-search';
|
|
10
10
|
class MisoSearchElement extends _misoContainer.default {
|
|
11
|
-
static get observedAttributes() {
|
|
12
|
-
return _misoContainer.default.observedAttributes;
|
|
13
|
-
}
|
|
14
11
|
static get tagName() {
|
|
15
12
|
return TAG_NAME;
|
|
16
13
|
}
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return _misoContainer.default.observedAttributes;
|
|
16
|
+
}
|
|
17
17
|
_getWorkflow(client) {
|
|
18
18
|
return client.ui.search;
|
|
19
19
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _misoContainer = _interopRequireDefault(require("./miso-container.js"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const ATTR_UNIT_ID = 'unit-id';
|
|
10
|
+
const OBSERVED_ATTRIBUTES = Object.freeze([..._misoContainer.default.observedAttributes, ATTR_UNIT_ID]);
|
|
11
|
+
class MisoUnitElement extends _misoContainer.default {
|
|
12
|
+
static get observedAttributes() {
|
|
13
|
+
return OBSERVED_ATTRIBUTES;
|
|
14
|
+
}
|
|
15
|
+
_getWorkflow(client) {
|
|
16
|
+
return this._getWorkflowByUnitId(client, this.unitId);
|
|
17
|
+
}
|
|
18
|
+
_getWorkflowByUnitId(client, unitId) {
|
|
19
|
+
throw new Error('Not implemented');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// properties //
|
|
23
|
+
get unitId() {
|
|
24
|
+
return this.getAttribute(ATTR_UNIT_ID) || undefined;
|
|
25
|
+
}
|
|
26
|
+
set unitId(value) {
|
|
27
|
+
value = value && `${value}`;
|
|
28
|
+
if (value) {
|
|
29
|
+
this.setAttribute(ATTR_UNIT_ID, value);
|
|
30
|
+
} else {
|
|
31
|
+
this.removeAttribute(ATTR_UNIT_ID);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// lifecycle //
|
|
36
|
+
attributeChangedCallback(attr, oldValue, newValue) {
|
|
37
|
+
switch (attr) {
|
|
38
|
+
case ATTR_UNIT_ID:
|
|
39
|
+
this._handleUnitIdUpdate(oldValue, newValue);
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
super.attributeChangedCallback(attr, oldValue, newValue);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
_handleUnitIdUpdate(oldUnitId, newUnitId) {
|
|
46
|
+
if (oldUnitId === newUnitId || !this._client) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this._setWorkflow(this._getWorkflowByUnitId(this._client, newUnitId));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = MisoUnitElement;
|
|
@@ -18,5 +18,4 @@ var combos = _interopRequireWildcard(require("./combo/index.js"));
|
|
|
18
18
|
exports.combos = combos;
|
|
19
19
|
var _misoBanner = _interopRequireDefault(require("./miso-banner.js"));
|
|
20
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
-
function
|
|
22
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (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 (const 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); }
|
|
@@ -15,10 +15,9 @@ class MisoComponentElement extends HTMLElement {
|
|
|
15
15
|
static get observedAttributes() {
|
|
16
16
|
return OBSERVED_ATTRIBUTES;
|
|
17
17
|
}
|
|
18
|
-
constructor(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
|
+
constructor({
|
|
19
|
+
role
|
|
20
|
+
} = {}) {
|
|
22
21
|
super();
|
|
23
22
|
if (role) {
|
|
24
23
|
Object.defineProperty(this, '_role', {
|
|
@@ -38,19 +38,16 @@ function getContainer(element) {
|
|
|
38
38
|
function timeout(duration) {
|
|
39
39
|
return new Promise(resolve => setTimeout(resolve, duration));
|
|
40
40
|
}
|
|
41
|
-
function applyCoerce(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} = _ref;
|
|
41
|
+
function applyCoerce({
|
|
42
|
+
type,
|
|
43
|
+
coerce,
|
|
44
|
+
defaultValue
|
|
45
|
+
}, str) {
|
|
47
46
|
coerce = getCoerceFunction(type, coerce);
|
|
48
47
|
const value = coerce(str);
|
|
49
48
|
return (value === undefined || value === null) && defaultValue !== undefined ? defaultValue : value;
|
|
50
49
|
}
|
|
51
|
-
function getCoerceFunction() {
|
|
52
|
-
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
53
|
-
let coerce = arguments.length > 1 ? arguments[1] : undefined;
|
|
50
|
+
function getCoerceFunction(type = 'default', coerce) {
|
|
54
51
|
if (typeof coerce === 'function') {
|
|
55
52
|
return coerce;
|
|
56
53
|
}
|
|
@@ -178,8 +178,7 @@ class AffiliationLayout extends _collection.default {
|
|
|
178
178
|
static get defaultClassName() {
|
|
179
179
|
return DEFAULT_CLASSNAME;
|
|
180
180
|
}
|
|
181
|
-
constructor() {
|
|
182
|
-
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
181
|
+
constructor(_ref = {}) {
|
|
183
182
|
let {
|
|
184
183
|
className = DEFAULT_CLASSNAME,
|
|
185
184
|
templates
|
|
@@ -280,10 +279,9 @@ class AffiliationLayout extends _collection.default {
|
|
|
280
279
|
oldElement && this._viewable.unobserve(oldElement);
|
|
281
280
|
newElement && this._viewable.observe(newElement);
|
|
282
281
|
}
|
|
283
|
-
_syncItemCount(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
282
|
+
_syncItemCount({
|
|
283
|
+
state
|
|
284
|
+
} = {}) {
|
|
287
285
|
const items = this._getItems(state);
|
|
288
286
|
const itemCount = this._itemCount = items ? items.length : undefined;
|
|
289
287
|
if (itemCount === this._displayedCount) {
|
|
@@ -32,8 +32,7 @@ class BannerLayout extends _template.default {
|
|
|
32
32
|
static get defaultTemplates() {
|
|
33
33
|
return DEFAULT_TEMPLATES;
|
|
34
34
|
}
|
|
35
|
-
constructor() {
|
|
36
|
-
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35
|
+
constructor(_ref = {}) {
|
|
37
36
|
let {
|
|
38
37
|
className = DEFAULT_CLASSNAME,
|
|
39
38
|
templates
|
|
@@ -43,8 +43,7 @@ class MoreButtonLayout extends _template.default {
|
|
|
43
43
|
static get defaultClassName() {
|
|
44
44
|
return DEFAULT_CLASSNAME;
|
|
45
45
|
}
|
|
46
|
-
constructor() {
|
|
47
|
-
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
46
|
+
constructor(_ref = {}) {
|
|
48
47
|
let {
|
|
49
48
|
className = DEFAULT_CLASSNAME,
|
|
50
49
|
templates
|
|
@@ -16,8 +16,7 @@ class ContainerLayout extends _raf.default {
|
|
|
16
16
|
static get type() {
|
|
17
17
|
return TYPE;
|
|
18
18
|
}
|
|
19
|
-
constructor() {
|
|
20
|
-
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
19
|
+
constructor(_ref = {}) {
|
|
21
20
|
let {
|
|
22
21
|
logo = 'auto'
|
|
23
22
|
} = _ref,
|
|
@@ -61,17 +60,13 @@ class ContainerLayout extends _raf.default {
|
|
|
61
60
|
} = element;
|
|
62
61
|
const logo = localLogo !== undefined && localLogo !== 'auto' ? localLogo : globalLogo;
|
|
63
62
|
// logo === 'auto': only add banner when a component of main role (like producs, answer) is present
|
|
64
|
-
return logo === 'auto' ? element.components.some(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} = _ref2;
|
|
68
|
-
return isMainRole(role);
|
|
69
|
-
}) : !!logo;
|
|
63
|
+
return logo === 'auto' ? element.components.some(({
|
|
64
|
+
role
|
|
65
|
+
}) => isMainRole(role)) : !!logo;
|
|
70
66
|
}
|
|
71
|
-
_syncStatus(element,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} = _ref3;
|
|
67
|
+
_syncStatus(element, {
|
|
68
|
+
state
|
|
69
|
+
}) {
|
|
75
70
|
if (!element) {
|
|
76
71
|
return;
|
|
77
72
|
}
|
|
@@ -38,8 +38,7 @@ class ErrorLayout extends _template.default {
|
|
|
38
38
|
static get defaultTemplates() {
|
|
39
39
|
return DEFAULT_TEMPLATES;
|
|
40
40
|
}
|
|
41
|
-
constructor() {
|
|
42
|
-
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
41
|
+
constructor(_ref = {}) {
|
|
43
42
|
let {
|
|
44
43
|
className = DEFAULT_CLASSNAME,
|
|
45
44
|
templates
|
|
@@ -53,33 +53,28 @@ function header(layout, facet, state) {
|
|
|
53
53
|
} = layout;
|
|
54
54
|
return `<div class="${facetClassName}__header">${templates.title(layout, facet, state)}</div>`;
|
|
55
55
|
}
|
|
56
|
-
function title(layout,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} = _ref;
|
|
56
|
+
function title(layout, {
|
|
57
|
+
field
|
|
58
|
+
}) {
|
|
60
59
|
if (field.startsWith(CUSTOM_ATTRIBUTES_PREFIX)) {
|
|
61
60
|
field = field.substring(CUSTOM_ATTRIBUTES_PREFIX.length);
|
|
62
61
|
}
|
|
63
62
|
// TODO: to words
|
|
64
63
|
return (0, _commons.escapeHtml)(field);
|
|
65
64
|
}
|
|
66
|
-
function options(layout,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
} = _ref2;
|
|
65
|
+
function options(layout, {
|
|
66
|
+
field,
|
|
67
|
+
entries
|
|
68
|
+
}, state) {
|
|
71
69
|
const {
|
|
72
70
|
facetClassName = DEDAULT_FACET_CLASSNAME,
|
|
73
71
|
templates
|
|
74
72
|
} = layout;
|
|
75
|
-
return `<ul class="${facetClassName}__options" data-role="options">${entries.map(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
count
|
|
81
|
-
}, state);
|
|
82
|
-
}).join('')}</ul>`;
|
|
73
|
+
return `<ul class="${facetClassName}__options" data-role="options">${entries.map(([value, count]) => templates.option(layout, {
|
|
74
|
+
field,
|
|
75
|
+
value,
|
|
76
|
+
count
|
|
77
|
+
}, state)).join('')}</ul>`;
|
|
83
78
|
}
|
|
84
79
|
function option(layout, entry, state) {
|
|
85
80
|
const {
|
|
@@ -92,16 +87,14 @@ function option(layout, entry, state) {
|
|
|
92
87
|
<span class="${facetClassName}__count">${templates.count(layout, entry, state)}</span>
|
|
93
88
|
</li>`;
|
|
94
89
|
}
|
|
95
|
-
function value(layout,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} = _ref4;
|
|
90
|
+
function value(layout, {
|
|
91
|
+
value
|
|
92
|
+
}, state) {
|
|
99
93
|
return (0, _commons.escapeHtml)(value);
|
|
100
94
|
}
|
|
101
|
-
function count(layout,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} = _ref5;
|
|
95
|
+
function count(layout, {
|
|
96
|
+
count
|
|
97
|
+
}, state) {
|
|
105
98
|
return layout.templates.helpers.formatNumber(count);
|
|
106
99
|
}
|
|
107
100
|
const DEFAULT_TEMPLATES = Object.freeze({
|
|
@@ -135,13 +128,12 @@ class FacetsLayout extends _template.default {
|
|
|
135
128
|
static get defaultClassName() {
|
|
136
129
|
return DEFAULT_CLASSNAME;
|
|
137
130
|
}
|
|
138
|
-
constructor() {
|
|
139
|
-
let _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
131
|
+
constructor(_ref = {}) {
|
|
140
132
|
let {
|
|
141
133
|
className = DEFAULT_CLASSNAME,
|
|
142
134
|
templates
|
|
143
|
-
} =
|
|
144
|
-
options = _objectWithoutPropertiesLoose(
|
|
135
|
+
} = _ref,
|
|
136
|
+
options = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
145
137
|
super(Object.assign({
|
|
146
138
|
className,
|
|
147
139
|
templates: Object.assign({}, DEFAULT_TEMPLATES, templates)
|
|
@@ -177,10 +169,9 @@ class FacetsLayout extends _template.default {
|
|
|
177
169
|
this._setSelected(element, selectedValues[field] && selectedValues[field].has(value));
|
|
178
170
|
}
|
|
179
171
|
}
|
|
180
|
-
_updateSelections(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
} = _ref7;
|
|
172
|
+
_updateSelections({
|
|
173
|
+
updates
|
|
174
|
+
}) {
|
|
184
175
|
const selectedValues = getSelectedValues(updates.facets);
|
|
185
176
|
for (const {
|
|
186
177
|
value: {
|
|
@@ -239,20 +230,16 @@ class FacetsLayout extends _template.default {
|
|
|
239
230
|
_clearBindings() {
|
|
240
231
|
this._bindings.clear();
|
|
241
232
|
}
|
|
242
|
-
_getItems(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
233
|
+
_getItems({
|
|
234
|
+
value
|
|
235
|
+
} = {}) {
|
|
246
236
|
const {
|
|
247
237
|
facet_fields = {}
|
|
248
238
|
} = value || {};
|
|
249
239
|
const items = {};
|
|
250
240
|
for (const field in facet_fields) {
|
|
251
241
|
// the key needs to be matched against data-field attribute
|
|
252
|
-
items[(0, _commons.escapeHtml)(field)] = facet_fields[field].map(
|
|
253
|
-
let [value] = _ref8;
|
|
254
|
-
return value;
|
|
255
|
-
});
|
|
242
|
+
items[(0, _commons.escapeHtml)(field)] = facet_fields[field].map(([value]) => value);
|
|
256
243
|
}
|
|
257
244
|
return items;
|
|
258
245
|
}
|
|
@@ -63,8 +63,7 @@ class OptionListLayout extends _template.default {
|
|
|
63
63
|
static get defaultClassName() {
|
|
64
64
|
return DEFAULT_CLASSNAME;
|
|
65
65
|
}
|
|
66
|
-
constructor() {
|
|
67
|
-
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
66
|
+
constructor(_ref = {}) {
|
|
68
67
|
let {
|
|
69
68
|
className = DEFAULT_CLASSNAME,
|
|
70
69
|
templates
|
|
@@ -84,17 +84,15 @@ function products(layout, items) {
|
|
|
84
84
|
} = layout;
|
|
85
85
|
return templates.completionList(layout, 'product', items);
|
|
86
86
|
}
|
|
87
|
-
function query(layout
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
87
|
+
function query(layout, {
|
|
88
|
+
text,
|
|
89
|
+
text_with_inverted_markups
|
|
90
|
+
} = {}) {
|
|
92
91
|
return text_with_inverted_markups || (0, _commons.escapeHtml)(text);
|
|
93
92
|
}
|
|
94
|
-
function product(layout,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
} = _ref;
|
|
93
|
+
function product(layout, {
|
|
94
|
+
product
|
|
95
|
+
}) {
|
|
98
96
|
const {
|
|
99
97
|
templates
|
|
100
98
|
} = layout;
|
|
@@ -149,14 +147,13 @@ class SearchBoxLayout extends _template.default {
|
|
|
149
147
|
static get defaultClassName() {
|
|
150
148
|
return DEFAULT_CLASSNAME;
|
|
151
149
|
}
|
|
152
|
-
constructor() {
|
|
153
|
-
let _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
150
|
+
constructor(_ref = {}) {
|
|
154
151
|
let {
|
|
155
152
|
className = DEFAULT_CLASSNAME,
|
|
156
153
|
templates,
|
|
157
154
|
autocomplete
|
|
158
|
-
} =
|
|
159
|
-
options = _objectWithoutPropertiesLoose(
|
|
155
|
+
} = _ref,
|
|
156
|
+
options = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
160
157
|
super(Object.assign({
|
|
161
158
|
className,
|
|
162
159
|
templates: Object.assign({}, DEFAULT_TEMPLATES, templates)
|
|
@@ -199,10 +196,9 @@ class SearchBoxLayout extends _template.default {
|
|
|
199
196
|
this._valueRequested = value;
|
|
200
197
|
}
|
|
201
198
|
}
|
|
202
|
-
_preprocess(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
} = _ref3;
|
|
199
|
+
_preprocess({
|
|
200
|
+
state
|
|
201
|
+
}) {
|
|
206
202
|
state = super._preprocess({
|
|
207
203
|
state
|
|
208
204
|
});
|
|
@@ -221,14 +217,12 @@ class SearchBoxLayout extends _template.default {
|
|
|
221
217
|
this._fullfillFocusRequest(element);
|
|
222
218
|
this._fullfillValueRequest(element);
|
|
223
219
|
}
|
|
224
|
-
_updateCompletions(element,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
writeToState
|
|
231
|
-
} = _ref5;
|
|
220
|
+
_updateCompletions(element, {
|
|
221
|
+
state,
|
|
222
|
+
rendered
|
|
223
|
+
}, {
|
|
224
|
+
writeToState
|
|
225
|
+
}) {
|
|
232
226
|
if (!state.completions) {
|
|
233
227
|
return;
|
|
234
228
|
}
|
|
@@ -303,10 +297,9 @@ class SearchBoxLayout extends _template.default {
|
|
|
303
297
|
value
|
|
304
298
|
}));
|
|
305
299
|
}
|
|
306
|
-
_handleFocusIn(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
} = _ref6;
|
|
300
|
+
_handleFocusIn({
|
|
301
|
+
target
|
|
302
|
+
}) {
|
|
310
303
|
if (!this._element) {
|
|
311
304
|
return;
|
|
312
305
|
}
|
|
@@ -315,10 +308,9 @@ class SearchBoxLayout extends _template.default {
|
|
|
315
308
|
this.open();
|
|
316
309
|
}
|
|
317
310
|
}
|
|
318
|
-
_handleFocusOut(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
} = _ref7;
|
|
311
|
+
_handleFocusOut({
|
|
312
|
+
relatedTarget
|
|
313
|
+
}) {
|
|
322
314
|
if (!this._element) {
|
|
323
315
|
return;
|
|
324
316
|
}
|
|
@@ -326,12 +318,11 @@ class SearchBoxLayout extends _template.default {
|
|
|
326
318
|
this.close();
|
|
327
319
|
}
|
|
328
320
|
}
|
|
329
|
-
_handleKeyDown(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
} = _ref8;
|
|
321
|
+
_handleKeyDown({
|
|
322
|
+
key,
|
|
323
|
+
target,
|
|
324
|
+
isComposing
|
|
325
|
+
}) {
|
|
335
326
|
if (!isComposing && key === 'Enter' && target.matches('[data-role="input"]')) {
|
|
336
327
|
this._submit(target.value);
|
|
337
328
|
target.blur();
|