Skip to content

Commit 9a5b9cf

Browse files
committed
rebuild after rebase
1 parent a8b58d2 commit 9a5b9cf

File tree

1 file changed

+1
-103
lines changed

1 file changed

+1
-103
lines changed

src/LiveComponent/assets/dist/live_controller.js

Lines changed: 1 addition & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,109 +1796,7 @@ class ExternalMutationTracker {
17961796
return element.tagName === 'FONT' && element.getAttribute('style') === 'vertical-align: inherit;';
17971797
}
17981798
}
1799-
function isValueEmpty(value) {
1800-
if (null === value || value === '' || undefined === value || (Array.isArray(value) && value.length === 0)) {
1801-
return true;
1802-
}
1803-
if (typeof value !== 'object') {
1804-
return false;
1805-
}
1806-
for (const key of Object.keys(value)) {
1807-
if (!isValueEmpty(value[key])) {
1808-
return false;
1809-
}
1810-
}
1811-
return true;
1812-
}
1813-
function toQueryString(data) {
1814-
const buildQueryStringEntries = (data, entries = {}, baseKey = '') => {
1815-
Object.entries(data).forEach(([iKey, iValue]) => {
1816-
const key = baseKey === '' ? iKey : `${baseKey}[${iKey}]`;
1817-
if ('' === baseKey && isValueEmpty(iValue)) {
1818-
entries[key] = '';
1819-
}
1820-
else if (null !== iValue) {
1821-
if (typeof iValue === 'object') {
1822-
entries = { ...entries, ...buildQueryStringEntries(iValue, entries, key) };
1823-
}
1824-
else {
1825-
entries[key] = encodeURIComponent(iValue)
1826-
.replace(/%20/g, '+')
1827-
.replace(/%2C/g, ',');
1828-
}
1829-
}
1830-
});
1831-
return entries;
1832-
};
1833-
const entries = buildQueryStringEntries(data);
1834-
return Object.entries(entries)
1835-
.map(([key, value]) => `${key}=${value}`)
1836-
.join('&');
1837-
}
1838-
function fromQueryString(search) {
1839-
search = search.replace('?', '');
1840-
if (search === '')
1841-
return {};
1842-
const insertDotNotatedValueIntoData = (key, value, data) => {
1843-
const [first, second, ...rest] = key.split('.');
1844-
if (!second) {
1845-
data[key] = value;
1846-
return value;
1847-
}
1848-
if (data[first] === undefined) {
1849-
data[first] = Number.isNaN(Number.parseInt(second)) ? {} : [];
1850-
}
1851-
insertDotNotatedValueIntoData([second, ...rest].join('.'), value, data[first]);
1852-
};
1853-
const entries = search.split('&').map((i) => i.split('='));
1854-
const data = {};
1855-
entries.forEach(([key, value]) => {
1856-
value = decodeURIComponent(String(value || '').replace(/\+/g, '%20'));
1857-
if (!key.includes('[')) {
1858-
data[key] = value;
1859-
}
1860-
else {
1861-
if ('' === value)
1862-
return;
1863-
const dotNotatedKey = key.replace(/\[/g, '.').replace(/]/g, '');
1864-
insertDotNotatedValueIntoData(dotNotatedKey, value, data);
1865-
}
1866-
});
1867-
return data;
1868-
}
1869-
class UrlUtils extends URL {
1870-
has(key) {
1871-
const data = this.getData();
1872-
return Object.keys(data).includes(key);
1873-
}
1874-
set(key, value) {
1875-
const data = this.getData();
1876-
data[key] = value;
1877-
this.setData(data);
1878-
}
1879-
get(key) {
1880-
return this.getData()[key];
1881-
}
1882-
remove(key) {
1883-
const data = this.getData();
1884-
delete data[key];
1885-
this.setData(data);
1886-
}
1887-
getData() {
1888-
if (!this.search) {
1889-
return {};
1890-
}
1891-
return fromQueryString(this.search);
1892-
}
1893-
setData(data) {
1894-
this.search = toQueryString(data);
1895-
}
1896-
}
1897-
class HistoryStrategy {
1898-
static replace(url) {
1899-
history.replaceState(history.state, '', url);
1900-
}
1901-
}
1799+
19021800
class UnsyncedInputsTracker {
19031801
constructor(component, modelElementResolver) {
19041802
this.elementEventListeners = [

0 commit comments

Comments
 (0)