mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-22 05:12:25 +01:00
Fix up recur days
This commit is contained in:
parent
70db89b2f6
commit
b67abdafd1
@ -11,7 +11,7 @@
|
|||||||
import {css, html, PropertyValues, TemplateResult} from "@lion/core";
|
import {css, html, PropertyValues, TemplateResult} from "@lion/core";
|
||||||
import {Et2StaticSelectMixin, StaticOptions as so} from "./StaticOptions";
|
import {Et2StaticSelectMixin, StaticOptions as so} from "./StaticOptions";
|
||||||
import {Et2widgetWithSelectMixin} from "./Et2WidgetWithSelectMixin";
|
import {Et2widgetWithSelectMixin} from "./Et2WidgetWithSelectMixin";
|
||||||
import {SelectOption} from "./FindSelectOptions";
|
import {cleanSelectOptions, SelectOption} from "./FindSelectOptions";
|
||||||
import {SlMenuItem, SlSelect} from "@shoelace-style/shoelace";
|
import {SlMenuItem, SlSelect} from "@shoelace-style/shoelace";
|
||||||
import shoelace from "../Styles/shoelace";
|
import shoelace from "../Styles/shoelace";
|
||||||
import {Et2WithSearchMixin} from "./SearchMixin";
|
import {Et2WithSearchMixin} from "./SearchMixin";
|
||||||
@ -898,11 +898,48 @@ customElements.define("et2-select-day", Et2SelectDay);
|
|||||||
|
|
||||||
export class Et2SelectDayOfWeek extends Et2StaticSelectMixin(Et2Select)
|
export class Et2SelectDayOfWeek extends Et2StaticSelectMixin(Et2Select)
|
||||||
{
|
{
|
||||||
constructor()
|
connectedCallback()
|
||||||
{
|
{
|
||||||
super();
|
super.connectedCallback();
|
||||||
|
|
||||||
this.static_options = so.dow(this, {other: this.other || []});
|
// Wait for connected instead of constructor because attributes make a difference in
|
||||||
|
// which options are offered
|
||||||
|
this.fetchComplete = so.dow(this, {other: this.other || []}).then(options =>
|
||||||
|
{
|
||||||
|
this.set_static_options(cleanSelectOptions(options));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
set value(new_value)
|
||||||
|
{
|
||||||
|
let expanded_value = typeof new_value == "object" ? new_value : [];
|
||||||
|
if(new_value && (typeof new_value == "string" || typeof new_value == "number"))
|
||||||
|
{
|
||||||
|
let int_value = parseInt(new_value);
|
||||||
|
this.updateComplete.then(() =>
|
||||||
|
{
|
||||||
|
this.fetchComplete.then(() =>
|
||||||
|
{
|
||||||
|
let options = this.select_options;
|
||||||
|
for(let index in options)
|
||||||
|
{
|
||||||
|
let right = parseInt(options[index].value);
|
||||||
|
if(!!(int_value & right))
|
||||||
|
{
|
||||||
|
expanded_value.push("" + right);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.value = expanded_value;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.value = expanded_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get value()
|
||||||
|
{
|
||||||
|
return super.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,10 +343,10 @@ export const StaticOptions = new class StaticOptionsType
|
|||||||
return this.cached_server_side(widget, 'select-state', options);
|
return this.cached_server_side(widget, 'select-state', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
dow(widget : Et2SelectWidgets, attrs) : SelectOption[] | Promise<SelectOption[]>
|
dow(widget : Et2SelectWidgets, attrs) : Promise<SelectOption[]>
|
||||||
{
|
{
|
||||||
var options = ',' + (attrs.other || []).join(',');
|
var options = /*(widget.rows || "") +*/ ',' + (attrs.other || []).join(',');
|
||||||
return this.cached_server_side(widget, 'select-dow', options);
|
return <Promise<SelectOption[]>>this.cached_server_side(widget, 'select-dow', options, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
lang(widget : Et2SelectWidgets, attrs) : SelectOption[] | Promise<SelectOption[]>
|
lang(widget : Et2SelectWidgets, attrs) : SelectOption[] | Promise<SelectOption[]>
|
||||||
|
@ -44,9 +44,7 @@ class Select extends Etemplate\Widget
|
|||||||
'select-bool',
|
'select-bool',
|
||||||
'select-cat',
|
'select-cat',
|
||||||
'select-country',
|
'select-country',
|
||||||
// DOW needs some server-side pre-processing to unpack the options,
|
'select-dow',
|
||||||
// so can't be skipped.
|
|
||||||
//'select-dow',
|
|
||||||
'select-number',
|
'select-number',
|
||||||
'select-priority',
|
'select-priority',
|
||||||
'select-percent',
|
'select-percent',
|
||||||
|
@ -120,7 +120,8 @@
|
|||||||
</row>
|
</row>
|
||||||
<row valign="top">
|
<row valign="top">
|
||||||
<et2-description for="recur_data" value="Repeat days"></et2-description>
|
<et2-description for="recur_data" value="Repeat days"></et2-description>
|
||||||
<et2-select-dow statustext="Days of the week for a weekly repeated event" id="recur_data" rows="6" multiple="1" placeholder="1"></et2-select-dow>
|
<et2-select-dow statustext="Days of the week for a weekly repeated event" id="recur_data" rows="6"
|
||||||
|
multiple="true" placeholder=""></et2-select-dow>
|
||||||
<et2-vbox>
|
<et2-vbox>
|
||||||
<et2-description value="Exceptions"></et2-description>
|
<et2-description value="Exceptions"></et2-description>
|
||||||
<et2-button statustext="Create an exception for the given date" label="@exception_label" id="button[exception]" noLang="1"></et2-button>
|
<et2-button statustext="Create an exception for the given date" label="@exception_label" id="button[exception]" noLang="1"></et2-button>
|
||||||
|
Loading…
Reference in New Issue
Block a user