lwc 2.12.1 → 2.13.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/engine-dom/esm/es2017/engine-dom.js +5 -12
- package/dist/engine-dom/iife/es2017/engine-dom.js +5 -12
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +4 -11
- package/dist/engine-dom/iife/es5/engine-dom.js +5741 -7303
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +4542 -5843
- package/dist/engine-dom/umd/es2017/engine-dom.js +5 -12
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +4 -11
- package/dist/engine-dom/umd/es5/engine-dom.js +5741 -7303
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +4542 -5843
- package/dist/engine-server/commonjs/es2017/engine-server.js +5 -12
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +5 -12
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +13 -10
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3594 -4568
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +1 -10
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3470 -4413
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +13 -10
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3594 -4568
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +1 -10
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3470 -4413
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +258 -243
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +258 -243
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +258 -243
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +258 -243
- package/package.json +7 -7
|
@@ -4,286 +4,301 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.WireService = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function
|
|
28
|
-
|
|
7
|
+
function _assertThisInitialized(self) {
|
|
8
|
+
if (self === void 0) {
|
|
9
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
10
|
+
}
|
|
11
|
+
return self;
|
|
12
|
+
}
|
|
13
|
+
function _classCallCheck(instance, Constructor) {
|
|
14
|
+
if (!(instance instanceof Constructor)) {
|
|
15
|
+
throw new TypeError("Cannot call a class as a function");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function _defineProperties(target, props) {
|
|
19
|
+
for(var i = 0; i < props.length; i++){
|
|
20
|
+
var descriptor = props[i];
|
|
21
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
22
|
+
descriptor.configurable = true;
|
|
23
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
24
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
28
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
29
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
30
|
+
return Constructor;
|
|
31
|
+
}
|
|
32
|
+
function _getPrototypeOf(o) {
|
|
33
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
34
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
35
|
+
};
|
|
36
|
+
return _getPrototypeOf(o);
|
|
37
|
+
}
|
|
38
|
+
function _inherits(subClass, superClass) {
|
|
39
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
40
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
41
|
+
}
|
|
42
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
43
|
+
constructor: {
|
|
44
|
+
value: subClass,
|
|
45
|
+
writable: true,
|
|
46
|
+
configurable: true
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
50
|
+
}
|
|
51
|
+
function _instanceof(left, right) {
|
|
52
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
53
|
+
return !!right[Symbol.hasInstance](left);
|
|
54
|
+
} else {
|
|
55
|
+
return left instanceof right;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function _possibleConstructorReturn(self, call) {
|
|
59
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
60
|
+
return call;
|
|
61
|
+
}
|
|
62
|
+
return _assertThisInitialized(self);
|
|
63
|
+
}
|
|
64
|
+
function _setPrototypeOf(o, p) {
|
|
65
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
66
|
+
o.__proto__ = p;
|
|
67
|
+
return o;
|
|
68
|
+
};
|
|
69
|
+
return _setPrototypeOf(o, p);
|
|
70
|
+
}
|
|
71
|
+
var _typeof = function(obj) {
|
|
72
|
+
"@swc/helpers - typeof";
|
|
73
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
74
|
+
};
|
|
75
|
+
function _isNativeReflectConstruct() {
|
|
76
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
77
|
+
if (Reflect.construct.sham) return false;
|
|
78
|
+
if (typeof Proxy === "function") return true;
|
|
79
|
+
try {
|
|
80
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
81
|
+
return true;
|
|
82
|
+
} catch (e) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function _createSuper(Derived) {
|
|
87
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
88
|
+
return function _createSuperInternal() {
|
|
89
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
90
|
+
if (hasNativeReflectConstruct) {
|
|
91
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
92
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
93
|
+
} else {
|
|
94
|
+
result = Super.apply(this, arguments);
|
|
95
|
+
}
|
|
96
|
+
return _possibleConstructorReturn(this, result);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
29
99
|
/**
|
|
30
100
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
101
|
+
*/ /**
|
|
34
102
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
return obj === undefined;
|
|
103
|
+
*/ function isUndefined(obj) {
|
|
104
|
+
return obj === undefined;
|
|
38
105
|
}
|
|
39
|
-
/** version: 2.
|
|
40
|
-
|
|
41
|
-
/*
|
|
106
|
+
/** version: 2.13.0 */ /*
|
|
42
107
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
43
108
|
* All rights reserved.
|
|
44
109
|
* SPDX-License-Identifier: MIT
|
|
45
110
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var ValueChangedEventType = 'ValueChangedEvent';
|
|
111
|
+
*/ var ValueChangedEventType = "ValueChangedEvent";
|
|
50
112
|
/**
|
|
51
113
|
* Event fired by wire adapters to emit a new value.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.type = ValueChangedEventType;
|
|
58
|
-
this.value = value;
|
|
59
|
-
});
|
|
114
|
+
*/ var ValueChangedEvent = function ValueChangedEvent(value) {
|
|
115
|
+
_classCallCheck(this, ValueChangedEvent);
|
|
116
|
+
this.type = ValueChangedEventType;
|
|
117
|
+
this.value = value;
|
|
118
|
+
};
|
|
60
119
|
/*
|
|
61
120
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
62
121
|
* All rights reserved.
|
|
63
122
|
* SPDX-License-Identifier: MIT
|
|
64
123
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var
|
|
69
|
-
defineProperty = Object.defineProperty,
|
|
70
|
-
isExtensible = Object.isExtensible; // This value needs to be in sync with wiring.ts from @lwc/engine-core
|
|
71
|
-
|
|
72
|
-
var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
73
|
-
var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
124
|
+
*/ var freeze = Object.freeze, defineProperty = Object.defineProperty, isExtensible = Object.isExtensible;
|
|
125
|
+
// This value needs to be in sync with wiring.ts from @lwc/engine-core
|
|
126
|
+
var DeprecatedWiredElementHost = "$$DeprecatedWiredElementHostKey$$";
|
|
127
|
+
var DeprecatedWiredParamsMeta = "$$DeprecatedWiredParamsMetaKey$$";
|
|
74
128
|
/**
|
|
75
129
|
* Registers a wire adapter factory for Lightning Platform.
|
|
76
130
|
* @deprecated
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (adapterId == null || !isExtensible(adapterId)) {
|
|
81
|
-
throw new TypeError('adapter id must be extensible');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (typeof adapterEventTargetCallback !== 'function') {
|
|
85
|
-
throw new TypeError('adapter factory must be a callable');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if ('adapter' in adapterId) {
|
|
89
|
-
throw new TypeError('adapter id is already associated to an adapter factory');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var AdapterClass = /*#__PURE__*/function (_LegacyWireAdapterBri) {
|
|
93
|
-
_inherits(AdapterClass, _LegacyWireAdapterBri);
|
|
94
|
-
|
|
95
|
-
var _super = _createSuper(AdapterClass);
|
|
96
|
-
|
|
97
|
-
function AdapterClass(dataCallback) {
|
|
98
|
-
var _this;
|
|
99
|
-
|
|
100
|
-
_classCallCheck(this, AdapterClass);
|
|
101
|
-
|
|
102
|
-
_this = _super.call(this, dataCallback);
|
|
103
|
-
adapterEventTargetCallback(_this.eventTarget);
|
|
104
|
-
return _this;
|
|
131
|
+
*/ function register(adapterId, adapterEventTargetCallback) {
|
|
132
|
+
if (adapterId == null || !isExtensible(adapterId)) {
|
|
133
|
+
throw new TypeError("adapter id must be extensible");
|
|
105
134
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
135
|
+
if (typeof adapterEventTargetCallback !== "function") {
|
|
136
|
+
throw new TypeError("adapter factory must be a callable");
|
|
137
|
+
}
|
|
138
|
+
if ("adapter" in adapterId) {
|
|
139
|
+
throw new TypeError("adapter id is already associated to an adapter factory");
|
|
140
|
+
}
|
|
141
|
+
var AdapterClass = /*#__PURE__*/ function(LegacyWireAdapterBridge1) {
|
|
142
|
+
_inherits(_class, LegacyWireAdapterBridge1);
|
|
143
|
+
var _super = _createSuper(_class);
|
|
144
|
+
function _class(dataCallback) {
|
|
145
|
+
_classCallCheck(this, _class);
|
|
146
|
+
var _this;
|
|
147
|
+
_this = _super.call(this, dataCallback);
|
|
148
|
+
adapterEventTargetCallback(_this.eventTarget);
|
|
149
|
+
return _this;
|
|
150
|
+
}
|
|
151
|
+
return _class;
|
|
152
|
+
}(LegacyWireAdapterBridge);
|
|
153
|
+
freeze(AdapterClass);
|
|
154
|
+
freeze(AdapterClass.prototype);
|
|
155
|
+
defineProperty(adapterId, "adapter", {
|
|
156
|
+
writable: false,
|
|
157
|
+
configurable: false,
|
|
158
|
+
value: AdapterClass
|
|
159
|
+
});
|
|
117
160
|
}
|
|
118
161
|
/**
|
|
119
162
|
* Registers the wire service. noop
|
|
120
163
|
* @deprecated
|
|
121
|
-
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
ArrayIndexOf = _Array$prototype.indexOf; // wire event target life cycle connectedCallback hook event type
|
|
130
|
-
|
|
131
|
-
var CONNECT = 'connect'; // wire event target life cycle disconnectedCallback hook event type
|
|
132
|
-
|
|
133
|
-
var DISCONNECT = 'disconnect'; // wire event target life cycle config changed hook event type
|
|
134
|
-
|
|
135
|
-
var CONFIG = 'config';
|
|
136
|
-
|
|
164
|
+
*/ function registerWireService() {}
|
|
165
|
+
var _prototype = Array.prototype, forEach = _prototype.forEach, ArraySplice = _prototype.splice, ArrayIndexOf = _prototype.indexOf;
|
|
166
|
+
// wire event target life cycle connectedCallback hook event type
|
|
167
|
+
var CONNECT = "connect";
|
|
168
|
+
// wire event target life cycle disconnectedCallback hook event type
|
|
169
|
+
var DISCONNECT = "disconnect";
|
|
170
|
+
// wire event target life cycle config changed hook event type
|
|
171
|
+
var CONFIG = "config";
|
|
137
172
|
function removeListener(listeners, toRemove) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
173
|
+
var idx = ArrayIndexOf.call(listeners, toRemove);
|
|
174
|
+
if (idx > -1) {
|
|
175
|
+
ArraySplice.call(listeners, idx, 1);
|
|
176
|
+
}
|
|
143
177
|
}
|
|
144
|
-
|
|
145
178
|
function isEmptyConfig(config) {
|
|
146
|
-
|
|
179
|
+
return Object.keys(config).length === 0;
|
|
147
180
|
}
|
|
148
|
-
|
|
149
181
|
function isValidConfig(config, params) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
182
|
+
// The config is valid if there is no params, or if exist a param for which config[param] !== undefined.
|
|
183
|
+
return params.length === 0 || params.some(function(param) {
|
|
184
|
+
return !isUndefined(config[param]);
|
|
185
|
+
});
|
|
154
186
|
}
|
|
155
|
-
|
|
156
187
|
function isDifferentConfig(newConfig, oldConfig, params) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
188
|
+
return params.some(function(param) {
|
|
189
|
+
return newConfig[param] !== oldConfig[param];
|
|
190
|
+
});
|
|
160
191
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
192
|
+
var LegacyWireAdapterBridge = /*#__PURE__*/ function() {
|
|
193
|
+
function LegacyWireAdapterBridge(callback) {
|
|
194
|
+
var _this = this;
|
|
195
|
+
_classCallCheck(this, LegacyWireAdapterBridge);
|
|
196
|
+
this.connecting = [];
|
|
197
|
+
this.disconnecting = [];
|
|
198
|
+
this.configuring = [];
|
|
199
|
+
this.isFirstUpdate = true;
|
|
200
|
+
this.callback = callback;
|
|
201
|
+
this.wiredElementHost = callback[DeprecatedWiredElementHost];
|
|
202
|
+
this.dynamicParamsNames = callback[DeprecatedWiredParamsMeta];
|
|
203
|
+
this.eventTarget = {
|
|
204
|
+
addEventListener: function(type, listener) {
|
|
205
|
+
switch(type){
|
|
206
|
+
case CONNECT:
|
|
207
|
+
{
|
|
208
|
+
_this.connecting.push(listener);
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
case DISCONNECT:
|
|
212
|
+
{
|
|
213
|
+
_this.disconnecting.push(listener);
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
case CONFIG:
|
|
217
|
+
{
|
|
218
|
+
_this.configuring.push(listener);
|
|
219
|
+
if (_this.currentConfig !== undefined) {
|
|
220
|
+
listener.call(undefined, _this.currentConfig);
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
default:
|
|
225
|
+
throw new Error("Invalid event type ".concat(type, "."));
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
removeEventListener: function(type, listener) {
|
|
229
|
+
switch(type){
|
|
230
|
+
case CONNECT:
|
|
231
|
+
{
|
|
232
|
+
removeListener(_this.connecting, listener);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
case DISCONNECT:
|
|
236
|
+
{
|
|
237
|
+
removeListener(_this.disconnecting, listener);
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
case CONFIG:
|
|
241
|
+
{
|
|
242
|
+
removeListener(_this.configuring, listener);
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
default:
|
|
246
|
+
throw new Error("Invalid event type ".concat(type, "."));
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
dispatchEvent: function(evt) {
|
|
250
|
+
if (_instanceof(evt, ValueChangedEvent)) {
|
|
251
|
+
var value = evt.value;
|
|
252
|
+
_this.callback(value);
|
|
253
|
+
} else if (evt.type === "wirecontextevent") {
|
|
254
|
+
// TODO [#1357]: remove this branch
|
|
255
|
+
return _this.wiredElementHost.dispatchEvent(evt);
|
|
256
|
+
} else {
|
|
257
|
+
throw new Error("Invalid event type ".concat(evt.type, "."));
|
|
258
|
+
}
|
|
259
|
+
return false; // canceling signal since we don't want this to propagate
|
|
190
260
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
removeListener(_this2.connecting, listener);
|
|
212
|
-
break;
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
_createClass(LegacyWireAdapterBridge, [
|
|
264
|
+
{
|
|
265
|
+
key: "update",
|
|
266
|
+
value: function update(config) {
|
|
267
|
+
if (this.isFirstUpdate) {
|
|
268
|
+
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
269
|
+
// the config on the wire adapter should not be called until one of them changes.
|
|
270
|
+
this.isFirstUpdate = false;
|
|
271
|
+
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (isUndefined(this.currentConfig) || isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {
|
|
276
|
+
this.currentConfig = config;
|
|
277
|
+
forEach.call(this.configuring, function(listener) {
|
|
278
|
+
listener.call(undefined, config);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
213
281
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
key: "connect",
|
|
285
|
+
value: function connect() {
|
|
286
|
+
forEach.call(this.connecting, function(listener) {
|
|
287
|
+
return listener.call(undefined);
|
|
288
|
+
});
|
|
219
289
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
key: "disconnect",
|
|
293
|
+
value: function disconnect() {
|
|
294
|
+
forEach.call(this.disconnecting, function(listener) {
|
|
295
|
+
return listener.call(undefined);
|
|
296
|
+
});
|
|
225
297
|
}
|
|
226
|
-
|
|
227
|
-
default:
|
|
228
|
-
throw new Error("Invalid event type ".concat(type, "."));
|
|
229
298
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (evt instanceof ValueChangedEvent) {
|
|
233
|
-
var value = evt.value;
|
|
234
|
-
|
|
235
|
-
_this2.callback(value);
|
|
236
|
-
} else if (evt.type === 'wirecontextevent') {
|
|
237
|
-
// TODO [#1357]: remove this branch
|
|
238
|
-
return _this2.wiredElementHost.dispatchEvent(evt);
|
|
239
|
-
} else {
|
|
240
|
-
throw new Error("Invalid event type ".concat(evt.type, "."));
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return false; // canceling signal since we don't want this to propagate
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
_createClass(LegacyWireAdapterBridge, [{
|
|
249
|
-
key: "update",
|
|
250
|
-
value: function update(config) {
|
|
251
|
-
if (this.isFirstUpdate) {
|
|
252
|
-
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
253
|
-
// the config on the wire adapter should not be called until one of them changes.
|
|
254
|
-
this.isFirstUpdate = false;
|
|
255
|
-
|
|
256
|
-
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (isUndefined(this.currentConfig) || isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {
|
|
262
|
-
this.currentConfig = config;
|
|
263
|
-
forEach.call(this.configuring, function (listener) {
|
|
264
|
-
listener.call(undefined, config);
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}, {
|
|
269
|
-
key: "connect",
|
|
270
|
-
value: function connect() {
|
|
271
|
-
forEach.call(this.connecting, function (listener) {
|
|
272
|
-
return listener.call(undefined);
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
}, {
|
|
276
|
-
key: "disconnect",
|
|
277
|
-
value: function disconnect() {
|
|
278
|
-
forEach.call(this.disconnecting, function (listener) {
|
|
279
|
-
return listener.call(undefined);
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
}]);
|
|
283
|
-
|
|
284
|
-
return LegacyWireAdapterBridge;
|
|
299
|
+
]);
|
|
300
|
+
return LegacyWireAdapterBridge;
|
|
285
301
|
}();
|
|
286
|
-
/** version: 2.12.1 */
|
|
287
302
|
|
|
288
303
|
exports.ValueChangedEvent = ValueChangedEvent;
|
|
289
304
|
exports.register = register;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(
|
|
1
|
+
!function(b,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a((b="undefined"!=typeof globalThis?globalThis:b||self).WireService={})}(this,function(a){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(d,c){for(var b=0;b<c.length;b++){var a=c[b];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(d,a.key,a)}}function f(a){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}function g(a,b){return(g=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function h(a){return void 0===a}var c=function a(b){d(this,a),this.type="ValueChangedEvent",this.value=b},i=Object.freeze,j=Object.defineProperty,k=Object.isExtensible,b=Array.prototype,l=b.forEach,m=b.splice,n=b.indexOf,o="connect",p="disconnect",q="config";function r(a,c){var b=n.call(a,c);b> -1&&m.call(a,b,1)}var s=function(){var a,b,f;function g(a){var b=this;d(this,g),this.connecting=[],this.disconnecting=[],this.configuring=[],this.isFirstUpdate=!0,this.callback=a,this.wiredElementHost=a.$$DeprecatedWiredElementHostKey$$,this.dynamicParamsNames=a.$$DeprecatedWiredParamsMetaKey$$,this.eventTarget={addEventListener:function(c,a){switch(c){case o:b.connecting.push(a);break;case p:b.disconnecting.push(a);break;case q:b.configuring.push(a),void 0!==b.currentConfig&&a.call(void 0,b.currentConfig);break;default:throw new Error("Invalid event type ".concat(c,"."))}},removeEventListener:function(c,a){switch(c){case o:r(b.connecting,a);break;case p:r(b.disconnecting,a);break;case q:r(b.configuring,a);break;default:throw new Error("Invalid event type ".concat(c,"."))}},dispatchEvent:function(a){var e,d;if(e=a,null!=(d=c)&&"undefined"!=typeof Symbol&&d[Symbol.hasInstance]?!!d[Symbol.hasInstance](e):e instanceof d){var f=a.value;b.callback(f)}else if("wirecontextevent"===a.type)return b.wiredElementHost.dispatchEvent(a);else throw new Error("Invalid event type ".concat(a.type,"."));return!1}}}return a=g,b=[{key:"update",value:function(a){var b,d,c,e,f;(!this.isFirstUpdate||(this.isFirstUpdate=!1,b=a,0===Object.keys(b).length||(d=a,0===(c=this.dynamicParamsNames).length||c.some(function(a){return!h(d[a])}))))&&(h(this.currentConfig)||(e=a,f=this.currentConfig,(0,this.dynamicParamsNames).some(function(a){return e[a]!==f[a]})))&&(this.currentConfig=a,l.call(this.configuring,function(b){b.call(void 0,a)}))}},{key:"connect",value:function(){l.call(this.connecting,function(a){return a.call(void 0)})}},{key:"disconnect",value:function(){l.call(this.disconnecting,function(a){return a.call(void 0)})}}],e(a.prototype,b),f&&e(a,f),g}();a.ValueChangedEvent=c,a.register=function(a,c){if(null==a||!k(a))throw new TypeError("adapter id must be extensible");if("function"!=typeof c)throw new TypeError("adapter factory must be a callable");if("adapter"in a)throw new TypeError("adapter id is already associated to an adapter factory");var b=function(a){!function(b,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),a&&g(b,a)}(h,a);var b,e,i=(b=h,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}(),function(){var c,g,a,d,h=f(b);if(e){var i=f(this).constructor;d=Reflect.construct(h,arguments,i)}else d=h.apply(this,arguments);return g=this,(a=d)&&("object"==((c=a)&&"undefined"!=typeof Symbol&&c.constructor===Symbol?"symbol":typeof c)||"function"==typeof a)?a:function(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}(g)});function h(b){var a;return d(this,h),c((a=i.call(this,b)).eventTarget),a}return h}(s);i(b),i(b.prototype),j(a,"adapter",{writable:!1,configurable:!1,value:b})},a.registerWireService=function(){},Object.defineProperty(a,"__esModule",{value:!0})})
|