Skip to content

Commit 2e41087

Browse files
committed
building files
1 parent 5649a0e commit 2e41087

File tree

2 files changed

+59
-23
lines changed

2 files changed

+59
-23
lines changed

src/Autocomplete/assets/dist/controller.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import { Controller } from '@hotwired/stimulus';
22
import TomSelect from 'tom-select';
33

4-
/******************************************************************************
5-
Copyright (c) Microsoft Corporation.
6-
7-
Permission to use, copy, modify, and/or distribute this software for any
8-
purpose with or without fee is hereby granted.
9-
10-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16-
PERFORMANCE OF THIS SOFTWARE.
17-
***************************************************************************** */
18-
19-
function __classPrivateFieldGet(receiver, state, kind, f) {
20-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
21-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
22-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4+
/******************************************************************************
5+
Copyright (c) Microsoft Corporation.
6+
7+
Permission to use, copy, modify, and/or distribute this software for any
8+
purpose with or without fee is hereby granted.
9+
10+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16+
PERFORMANCE OF THIS SOFTWARE.
17+
***************************************************************************** */
18+
19+
function __classPrivateFieldGet(receiver, state, kind, f) {
20+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
21+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
22+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2323
}
2424

2525
var _instances, _getCommonConfig, _createAutocomplete, _createAutocompleteWithHtmlContents, _createAutocompleteWithRemoteData, _stripTags, _mergeObjects, _createTomSelect, _dispatchEvent;

src/LiveComponent/assets/dist/live_controller.js

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,7 @@ class default_1 extends Controller {
12001200
this.originalDataJSON = '{}';
12011201
this.mutationObserver = null;
12021202
this.childComponentControllers = [];
1203+
this.pendingActionTriggerModelElement = null;
12031204
this.markAsWindowUnloaded = () => {
12041205
this.isWindowUnloaded = true;
12051206
};
@@ -1230,7 +1231,6 @@ class default_1 extends Controller {
12301231
this.element.addEventListener('input', this.handleInputEvent);
12311232
this.element.addEventListener('change', this.handleChangeEvent);
12321233
this.element.addEventListener('live:connect', this.handleConnectedControllerEvent);
1233-
this.element.addEventListener('live:disconnect', this.handleDisconnectedControllerEvent);
12341234
this._dispatchEvent('live:connect', { controller: this });
12351235
}
12361236
disconnect() {
@@ -1249,6 +1249,9 @@ class default_1 extends Controller {
12491249
}
12501250
}
12511251
update(event) {
1252+
if (event.type === 'input' || event.type === 'change') {
1253+
throw new Error(`Since LiveComponents 2.3, you no longer need data-action="live#update" on form elements. Found on element: ${getElementAsTagText(event.target)}`);
1254+
}
12521255
this._updateModelFromElement(event.target, null);
12531256
}
12541257
action(event) {
@@ -1274,7 +1277,7 @@ class default_1 extends Controller {
12741277
}
12751278
break;
12761279
case 'debounce': {
1277-
const length = modifier.value ? parseInt(modifier.value) : DEFAULT_DEBOUNCE;
1280+
const length = modifier.value ? parseInt(modifier.value) : this.getDefaultDebounce();
12781281
if (this.actionDebounceTimeout) {
12791282
clearTimeout(this.actionDebounceTimeout);
12801283
this.actionDebounceTimeout = null;
@@ -1291,6 +1294,14 @@ class default_1 extends Controller {
12911294
}
12921295
});
12931296
if (!handled) {
1297+
if (getModelDirectiveFromInput(event.currentTarget, false)) {
1298+
this.pendingActionTriggerModelElement = event.currentTarget;
1299+
window.setTimeout(() => {
1300+
this.pendingActionTriggerModelElement = null;
1301+
_executeAction();
1302+
}, 10);
1303+
return;
1304+
}
12941305
_executeAction();
12951306
}
12961307
});
@@ -1316,6 +1327,7 @@ class default_1 extends Controller {
13161327
}
13171328
let shouldRender = true;
13181329
let targetEventName = 'input';
1330+
let debounce = null;
13191331
modelDirective.modifiers.forEach((modifier) => {
13201332
switch (modifier.name) {
13211333
case 'on':
@@ -1330,15 +1342,31 @@ class default_1 extends Controller {
13301342
case 'norender':
13311343
shouldRender = false;
13321344
break;
1345+
case 'debounce':
1346+
debounce = modifier.value ? parseInt(modifier.value) : this.getDefaultDebounce();
1347+
break;
13331348
default:
13341349
console.warn(`Unknown modifier "${modifier.name}" in data-model="${modelDirective.getString()}".`);
13351350
}
13361351
});
1352+
if (this.pendingActionTriggerModelElement === element) {
1353+
shouldRender = false;
1354+
}
13371355
if (eventName && targetEventName !== eventName) {
13381356
return;
13391357
}
1358+
if (null === debounce) {
1359+
if (targetEventName === 'input') {
1360+
debounce = this.getDefaultDebounce();
1361+
}
1362+
else {
1363+
debounce = 0;
1364+
}
1365+
}
13401366
const finalValue = getValueFromInput(element, this.valueStore);
1341-
this.$updateModel(modelDirective.action, finalValue, shouldRender, element.hasAttribute('name') ? element.getAttribute('name') : null, {});
1367+
this.$updateModel(modelDirective.action, finalValue, shouldRender, element.hasAttribute('name') ? element.getAttribute('name') : null, {
1368+
debounce
1369+
});
13421370
}
13431371
$updateModel(model, value, shouldRender = true, extraModelName = null, options = {}) {
13441372
const modelName = normalizeModelName(model);
@@ -1361,10 +1389,14 @@ class default_1 extends Controller {
13611389
this.unsyncedInputs.remove(modelName);
13621390
if (shouldRender) {
13631391
this._clearWaitingDebouncedRenders();
1392+
let debounce = this.getDefaultDebounce();
1393+
if (options.debounce !== undefined && options.debounce !== null) {
1394+
debounce = options.debounce;
1395+
}
13641396
this.renderDebounceTimeout = window.setTimeout(() => {
13651397
this.renderDebounceTimeout = null;
13661398
this.$render();
1367-
}, this.hasDebounceValue ? this.debounceValue : DEFAULT_DEBOUNCE);
1399+
}, debounce);
13681400
}
13691401
}
13701402
_makeRequest(action, args) {
@@ -1602,6 +1634,7 @@ class default_1 extends Controller {
16021634
return;
16031635
}
16041636
this.childComponentControllers.push(event.detail.controller);
1637+
event.detail.controller.element.addEventListener('live:disconnect', this.handleDisconnectedControllerEvent);
16051638
}
16061639
handleDisconnectedControllerEvent(event) {
16071640
if (event.target === this.element) {
@@ -1767,6 +1800,9 @@ class default_1 extends Controller {
17671800
attributes: true
17681801
});
17691802
}
1803+
getDefaultDebounce() {
1804+
return this.hasDebounceValue ? this.debounceValue : DEFAULT_DEBOUNCE;
1805+
}
17701806
}
17711807
default_1.values = {
17721808
url: String,

0 commit comments

Comments
 (0)