numerous updates

This commit is contained in:
Ross
2022-05-20 20:26:02 +01:00
parent 0373b22e78
commit 77ccdbc92a
246 changed files with 22615 additions and 2409 deletions
@@ -3,7 +3,7 @@
*/
var yl = yl || {};
yl.functions = {};
yl.functions = yl.functions || {};
/**
* Register your own JS function for DAL.
*
@@ -125,7 +125,7 @@ window.addEventListener("load", function () {
// these are used by django-nested-admin for nested template formsets
// note that the filter also ensures that 'empty' is not actually the related_name for some relation
// by ensuring that it is not surrounded by numbers on both sides
return !this.id.match(/(?<!-\d+)-empty-(?!\d+-)/);
return !this.id.match(/-empty-/) || this.id.match(/-\d+-empty-\d+-/);
});
}
@@ -167,6 +167,15 @@ window.addEventListener("load", function () {
// Add element to the array of already initialized fields
initialized.push(element);
// creates and dispatches the event to notify of the initialization completed
var dalElementInitializedEvent = new CustomEvent("dal-element-initialized", {
detail: {
element: element,
}
});
document.dispatchEvent(dalElementInitializedEvent);
}
if (!window.__dal__initialize) {
@@ -237,7 +246,10 @@ window.addEventListener("load", function () {
data: function (params) {
return {
term: params.term,
page: params.page
page: params.page,
app_label: $element.data('app-label'),
model_name: $element.data('model-name'),
field_name: $element.data('field-name')
};
}
}
@@ -458,4 +470,4 @@ window.addEventListener("load", function () {
};
})(django.jQuery, yl);
});
});