Compare commits
No commits in common. "f1a5e37febcec86cf95c2309c8310b31dd515cf1" and "207ea459aeb330a1128bbeff81ddc8f655be9b6e" have entirely different histories.
f1a5e37feb
...
207ea459ae
11
lib/plankton/plankton.d.ts
vendored
11
lib/plankton/plankton.d.ts
vendored
|
|
@ -1,11 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
declare type int = number;
|
type int = number;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
declare type float = number;
|
type float = number;
|
||||||
declare class Buffer {
|
declare class Buffer {
|
||||||
constructor(x: string, modifier?: string);
|
constructor(x: string, modifier?: string);
|
||||||
toString(modifier?: string): string;
|
toString(modifier?: string): string;
|
||||||
|
|
@ -19,7 +19,7 @@ declare namespace lib_plankton.base {
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
declare type type_pseudopointer<type_value> = {
|
type type_pseudopointer<type_value> = {
|
||||||
value: type_value;
|
value: type_value;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
|
@ -2002,7 +2002,7 @@ declare namespace lib_plankton.storage.memory {
|
||||||
clear(): Promise<void>;
|
clear(): Promise<void>;
|
||||||
write(key: any, value: any): Promise<boolean>;
|
write(key: any, value: any): Promise<boolean>;
|
||||||
delete(key: any): Promise<void>;
|
delete(key: any): Promise<void>;
|
||||||
read(key: any): Promise<type_item>;
|
read(key: any): Promise<Awaited<type_item>>;
|
||||||
search(term: any): Promise<{
|
search(term: any): Promise<{
|
||||||
key: string;
|
key: string;
|
||||||
preview: string;
|
preview: string;
|
||||||
|
|
@ -3861,9 +3861,6 @@ declare namespace lib_plankton.pit {
|
||||||
function to_ywd(pit: type_pit, { "timezone_shift": option_timezone_shift, }?: {
|
function to_ywd(pit: type_pit, { "timezone_shift": option_timezone_shift, }?: {
|
||||||
timezone_shift?: int;
|
timezone_shift?: int;
|
||||||
}): type_ywd;
|
}): type_ywd;
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function number_of_weeks(year: int): int;
|
|
||||||
/**
|
/**
|
||||||
* computes the point in time for switching to central european summer time
|
* computes the point in time for switching to central european summer time
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -2241,7 +2241,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
function step(op) {
|
function step(op) {
|
||||||
if (f) throw new TypeError("Generator is already executing.");
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
while (_) try {
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
switch (op[0]) {
|
switch (op[0]) {
|
||||||
|
|
@ -9970,6 +9970,12 @@ var lib_plankton;
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
class class_relation {
|
class class_relation {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
check(value, reference) {
|
||||||
|
return this.predicate(value, reference);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
|
|
@ -9979,12 +9985,6 @@ var lib_plankton;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.predicate = predicate;
|
this.predicate = predicate;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
check(value, reference) {
|
|
||||||
return this.predicate(value, reference);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
|
|
@ -11654,17 +11654,6 @@ var lib_plankton;
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
pit_1.to_ywd = to_ywd;
|
pit_1.to_ywd = to_ywd;
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function number_of_weeks(year) {
|
|
||||||
return lib_plankton.call.convey(year, [
|
|
||||||
x => from_ywd({ "year": (x + 1), "week": 1, "day": 6 }),
|
|
||||||
x => shift_week(x, -1),
|
|
||||||
to_ywd,
|
|
||||||
x => x.week,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
pit_1.number_of_weeks = number_of_weeks;
|
|
||||||
/**
|
/**
|
||||||
* computes the point in time for switching to central european summer time
|
* computes the point in time for switching to central european summer time
|
||||||
*
|
*
|
||||||
|
|
@ -11751,8 +11740,7 @@ var lib_plankton;
|
||||||
"time": ((datetime.time === null)
|
"time": ((datetime.time === null)
|
||||||
?
|
?
|
||||||
null
|
null
|
||||||
:
|
: datetime_shifted.time)
|
||||||
datetime_shifted.time)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,37 +145,4 @@ namespace _dali
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export var general_cache : lib_plankton.cache.type_subject<unknown> = lib_plankton.cache.make<unknown>(
|
|
||||||
/*
|
|
||||||
lib_plankton.storage.memory.implementation_chest(
|
|
||||||
{
|
|
||||||
}
|
|
||||||
)
|
|
||||||
*/
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export async function number_of_weeks(
|
|
||||||
year : int
|
|
||||||
) : Promise<int>
|
|
||||||
{
|
|
||||||
const value_raw : unknown = await lib_plankton.cache.get<unknown>(
|
|
||||||
_dali.general_cache,
|
|
||||||
lib_plankton.string.coin(
|
|
||||||
"number_of_weeks_{{year}}",
|
|
||||||
{
|
|
||||||
"year": year.toFixed(0),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
null,
|
|
||||||
() => Promise.resolve<int>(lib_plankton.pit.number_of_weeks(year))
|
|
||||||
);
|
|
||||||
return (value_raw as int);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,6 @@ namespace _dali
|
||||||
await _dali.backend.initialize(
|
await _dali.backend.initialize(
|
||||||
_dali.conf.get()["backend"]
|
_dali.conf.get()["backend"]
|
||||||
);
|
);
|
||||||
// init:general cache
|
|
||||||
lib_plankton.cache.init(_dali.general_cache);
|
|
||||||
// init:model
|
// init:model
|
||||||
await _dali.model.initialize(
|
await _dali.model.initialize(
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,6 @@ namespace _dali.widgets
|
||||||
private value : int;
|
private value : int;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
private dom_root : (null | HTMLElement);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public constructor(
|
public constructor(
|
||||||
|
|
@ -85,19 +80,6 @@ namespace _dali.widgets
|
||||||
this.maximum = maximum;
|
this.maximum = maximum;
|
||||||
this.value = initial_value;
|
this.value = initial_value;
|
||||||
this.action_change = action_change;
|
this.action_change = action_change;
|
||||||
this.dom_root = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public set_value(
|
|
||||||
value : int
|
|
||||||
) : void
|
|
||||||
{
|
|
||||||
this.value = value;
|
|
||||||
const dom_input : HTMLInputElement = (this.dom_root.querySelector(".widget-special_number_input-input") as HTMLInputElement);
|
|
||||||
dom_input.value = value.toFixed(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -178,7 +160,6 @@ namespace _dali.widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
target_element.appendChild(dom_root);
|
target_element.appendChild(dom_root);
|
||||||
this.dom_root = dom_root;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -713,17 +713,7 @@ namespace _dali.widgets
|
||||||
const dom_th = document.createElement("th");
|
const dom_th = document.createElement("th");
|
||||||
dom_th.classList.add("weekview-cell");
|
dom_th.classList.add("weekview-cell");
|
||||||
dom_th.classList.add("weekview-cell-day");
|
dom_th.classList.add("weekview-cell-day");
|
||||||
// const week : int = (this.week + offset);
|
dom_th.textContent = (this.week + offset).toFixed(0).padStart(2, "0");
|
||||||
const week : int = lib_plankton.call.convey(
|
|
||||||
this.week,
|
|
||||||
[
|
|
||||||
x => lib_plankton.pit.from_ywd({"year": this.year, "week": x, "day": 2}),
|
|
||||||
x => lib_plankton.pit.shift_week(x, offset),
|
|
||||||
lib_plankton.pit.to_ywd,
|
|
||||||
x => x.week
|
|
||||||
]
|
|
||||||
)
|
|
||||||
dom_th.textContent = week.toFixed(0).padStart(2, "0");
|
|
||||||
dom_tr.appendChild(dom_th);
|
dom_tr.appendChild(dom_th);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -888,75 +878,42 @@ namespace _dali.widgets
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
let input_year : _dali.widgets.class_widget_special_number_input;
|
|
||||||
let input_week : _dali.widgets.class_widget_special_number_input;
|
|
||||||
// control:year
|
// control:year
|
||||||
{
|
{
|
||||||
input_year = new _dali.widgets.class_widget_special_number_input(
|
const widget : lib_plankton.zoo_widget.interface_widget = new _dali.widgets.class_widget_special_number_input(
|
||||||
{
|
{
|
||||||
"label": lib_plankton.translate.get("widget.weekview.controls.year"),
|
"label": lib_plankton.translate.get("widget.weekview.controls.year"),
|
||||||
"minimum": 1900,
|
"minimum": 1900,
|
||||||
"maximum": 2500,
|
"maximum": 2500,
|
||||||
"initial_value": this.year,
|
"initial_value": this.year,
|
||||||
"action_change": async (year_raw) => {
|
"action_change": async (value) => {
|
||||||
// model
|
this.year = value;
|
||||||
const number_of_weeks : int = await _dali.number_of_weeks(year_raw);
|
|
||||||
if (this.week > number_of_weeks)
|
|
||||||
{
|
|
||||||
this.year = year_raw;
|
|
||||||
this.week = number_of_weeks;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.year = year_raw;
|
|
||||||
// this.week = this.week;
|
|
||||||
}
|
|
||||||
|
|
||||||
// view
|
|
||||||
input_week.set_value(this.week);
|
|
||||||
await this.update_table();
|
await this.update_table();
|
||||||
await this.update_entries();
|
await this.update_entries();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await input_year.load(target_element.querySelector(".weekview-controls"));
|
await widget.load(target_element.querySelector(".weekview-controls"));
|
||||||
}
|
}
|
||||||
// control:week
|
// control:week
|
||||||
{
|
{
|
||||||
input_week = new _dali.widgets.class_widget_special_number_input(
|
const widget : lib_plankton.zoo_widget.interface_widget = new _dali.widgets.class_widget_special_number_input(
|
||||||
{
|
{
|
||||||
"label": lib_plankton.translate.get("widget.weekview.controls.week"),
|
"label": lib_plankton.translate.get("widget.weekview.controls.week"),
|
||||||
|
"minimum": 1,
|
||||||
|
/**
|
||||||
|
* @todo correct
|
||||||
|
*/
|
||||||
|
"maximum": 53,
|
||||||
"initial_value": this.week,
|
"initial_value": this.week,
|
||||||
"action_change": async (week_raw) => {
|
"action_change": async (value) => {
|
||||||
// model
|
this.week = value;
|
||||||
if (week_raw < 1)
|
|
||||||
{
|
|
||||||
this.year = (this.year - 1);
|
|
||||||
this.week = await _dali.number_of_weeks(this.year);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (week_raw > await _dali.number_of_weeks(this.year))
|
|
||||||
{
|
|
||||||
this.year = (this.year + 1);
|
|
||||||
this.week = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// this.year = this.year;
|
|
||||||
this.week = week_raw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// view
|
|
||||||
input_year.set_value(this.year);
|
|
||||||
input_week.set_value(this.week);
|
|
||||||
await this.update_table();
|
await this.update_table();
|
||||||
await this.update_entries();
|
await this.update_entries();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await input_week.load(target_element.querySelector(".weekview-controls"));
|
await widget.load(target_element.querySelector(".weekview-controls"));
|
||||||
}
|
}
|
||||||
// control:count
|
// control:count
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue