unclean SPARC

This commit is contained in:
STEINNI
2025-08-27 07:03:09 +00:00
commit f308460931
430 changed files with 54426 additions and 0 deletions
@@ -0,0 +1,8 @@
<div class="confirm-dialog">
<section>
<alert eicalert ${severity} ${muted}>
${message}
</alert>
</section>
</div>
@@ -0,0 +1,69 @@
/**
* @category MyEic
* @subcategory Views
*
* @extends EICDialogContent
*/
class ConfirmDialog extends EICDialogContent {
actions = [
{
label: 'Cancel',
onclick: this.cancel.bind(this),
severity: 'secondary',
role: 'cancel'
}
]
constructor(options) {
super(options);
this.options = options;
if(this.options.cancelLabel) this.actions[0].label = this.options.cancelLabel
if(this.options.cancelSeverity) this.actions[0].severity = this.options.cancelSeverity
if(this.options.okLabel != '') {
this.actions.push({
label: this.options.okLabel || 'OK',
onclick: this.comply.bind(this),
severity: options.okSeverity||options.severity,
role: 'comply'
});
}
}
DOMContentLoaded() {
ui.eicfy(this.el);
if(typeof(this.options.contentLoaded)=='function') this.options.contentLoaded(this.el)
if(this.options.promptsClass) this.form = new Form(this.find('.'+this.options.promptsClass))
}
comply() {
let data = true
if(this.options.promptsClass){
if(!this.form.validate()) return
data = this.form.value
}
this.actions.find(o => o.role == 'comply').button.loading = true;
this.actions.find(o => o.role == 'cancel').button.disabled = true;
if(this.options.okPromise){
this.options.okPromise(data).then( this.onSuccess.bind(this,data), this.onFailed.bind(this) )
} else {
this.onSuccess(data)
}
}
onSuccess(data) {
this.actions.find(o => o.role == 'comply').button.loading = false;
this.actions.find(o => o.role == 'cancel').button.disabled = false;
this.commit(data);
}
onFailed() {
this.actions.find(o => o.role == 'comply').button.loading = false;
this.actions.find(o => o.role == 'cancel').button.disabled = false;
this.abort();
}
}
app.registerClass('ConfirmDialog',ConfirmDialog);