Compare commits
2 commits
4f830b0790
...
58e8688bf7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58e8688bf7 | ||
|
|
4766fd7f59 |
847
lib/plankton/plankton.d.ts
vendored
847
lib/plankton/plankton.d.ts
vendored
|
|
@ -1,11 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
type int = number;
|
declare type int = number;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
type float = number;
|
declare 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
|
||||||
*/
|
*/
|
||||||
type type_pseudopointer<type_value> = {
|
declare type type_pseudopointer<type_value> = {
|
||||||
value: type_value;
|
value: type_value;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
|
@ -1969,7 +1969,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<Awaited<type_item>>;
|
read(key: any): Promise<type_item>;
|
||||||
search(term: any): Promise<{
|
search(term: any): Promise<{
|
||||||
key: string;
|
key: string;
|
||||||
preview: string;
|
preview: string;
|
||||||
|
|
@ -2037,6 +2037,513 @@ declare namespace lib_plankton.storage.localstorage {
|
||||||
}[]>;
|
}[]>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
declare namespace lib_plankton.shape {
|
||||||
|
/**
|
||||||
|
* @todo
|
||||||
|
*/
|
||||||
|
type type_jsonschema = any;
|
||||||
|
/**
|
||||||
|
* @todo
|
||||||
|
*/
|
||||||
|
type type_oas_schema = any;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
type type_inspection = {
|
||||||
|
flaws: Array<string>;
|
||||||
|
sub: Array<{
|
||||||
|
position: string;
|
||||||
|
inspection: type_inspection;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function inspection_create(): type_inspection;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function inspection_add(main: type_inspection, flaw: string): void;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function inspection_extend(main: type_inspection, prefix: string, sub: type_inspection): void;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_shape = {
|
||||||
|
kind: string;
|
||||||
|
parameters: Record<string, any>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
type type_logic = {
|
||||||
|
inspect: ((sub_inspect: ((shape: type_shape, value: any) => type_inspection), value: any) => type_inspection);
|
||||||
|
show: ((sub_show: ((shape: type_shape) => string)) => string);
|
||||||
|
to_typescript_type: ((sub_to_typescript_type: ((shape: type_shape) => string)) => string);
|
||||||
|
to_jsonschema: ((sub_to_json_schema: ((shape: type_shape) => type_jsonschema)) => type_jsonschema);
|
||||||
|
to_oas_schema: ((sub_to_oas_schema: ((shape: type_shape) => type_oas_schema)) => type_oas_schema);
|
||||||
|
example: ((sub_example: ((shape: type_shape) => any)) => any);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function inspect(shape: type_shape, value: any): type_inspection;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function inspect_flat(shape: type_shape, value: any): Array<string>;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function show(shape: type_shape): string;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function to_typescript_type(shape: type_shape): string;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function to_jsonschema(shape: type_shape): type_jsonschema;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function to_oas_schema(shape: type_shape): type_oas_schema;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function example(shape: type_shape): any;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function register<type_parameters, type_subject>(name: string, construct: ((parameters: type_parameters) => type_subject), logic: ((subject: type_subject) => type_logic)): void;
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.any {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(options?: {}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.null_ {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(options?: {}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.boolean {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {
|
||||||
|
soft: boolean;
|
||||||
|
defaultvalue: lib_plankton.pod.type_pod<any>;
|
||||||
|
description: lib_plankton.pod.type_pod<string>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(options?: {
|
||||||
|
soft?: boolean;
|
||||||
|
defaultvalue?: (null | boolean);
|
||||||
|
description?: string;
|
||||||
|
}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.integer {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {
|
||||||
|
soft: boolean;
|
||||||
|
defaultvalue: lib_plankton.pod.type_pod<any>;
|
||||||
|
description: lib_plankton.pod.type_pod<string>;
|
||||||
|
minimum: lib_plankton.pod.type_pod<int>;
|
||||||
|
maximum: lib_plankton.pod.type_pod<int>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(options?: {
|
||||||
|
soft?: boolean;
|
||||||
|
defaultvalue?: (null | int);
|
||||||
|
description?: string;
|
||||||
|
minimum?: int;
|
||||||
|
maximum?: int;
|
||||||
|
}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.float {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {
|
||||||
|
soft: boolean;
|
||||||
|
defaultvalue: lib_plankton.pod.type_pod<any>;
|
||||||
|
description: lib_plankton.pod.type_pod<string>;
|
||||||
|
minimum: lib_plankton.pod.type_pod<float>;
|
||||||
|
maximum: lib_plankton.pod.type_pod<float>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(options?: {
|
||||||
|
soft?: boolean;
|
||||||
|
defaultvalue?: (null | float);
|
||||||
|
description?: string;
|
||||||
|
minimum?: float;
|
||||||
|
maximum?: float;
|
||||||
|
}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.string {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {
|
||||||
|
soft: boolean;
|
||||||
|
defaultvalue: lib_plankton.pod.type_pod<any>;
|
||||||
|
description: lib_plankton.pod.type_pod<string>;
|
||||||
|
pattern: lib_plankton.pod.type_pod<string>;
|
||||||
|
min_length: lib_plankton.pod.type_pod<int>;
|
||||||
|
max_length: lib_plankton.pod.type_pod<int>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(options?: {
|
||||||
|
soft?: boolean;
|
||||||
|
defaultvalue?: (null | int);
|
||||||
|
description?: string;
|
||||||
|
pattern?: string;
|
||||||
|
min_length?: int;
|
||||||
|
max_length?: int;
|
||||||
|
}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.email {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {
|
||||||
|
core: type_shape;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(options?: {
|
||||||
|
soft?: boolean;
|
||||||
|
defaultvalue?: (null | int);
|
||||||
|
description?: string;
|
||||||
|
}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.list_ {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {
|
||||||
|
shape_element: type_shape;
|
||||||
|
soft: boolean;
|
||||||
|
defaultvalue: lib_plankton.pod.type_pod<any>;
|
||||||
|
description: lib_plankton.pod.type_pod<string>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(shape_element: type_shape, options?: {
|
||||||
|
soft?: boolean;
|
||||||
|
defaultvalue?: any;
|
||||||
|
description?: string;
|
||||||
|
}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.map {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {
|
||||||
|
shape_key: type_shape;
|
||||||
|
shape_value: type_shape;
|
||||||
|
soft: boolean;
|
||||||
|
defaultvalue: lib_plankton.pod.type_pod<any>;
|
||||||
|
description: lib_plankton.pod.type_pod<string>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(shape_key: type_shape, shape_value: type_shape, options?: {
|
||||||
|
soft?: boolean;
|
||||||
|
defaultvalue?: any;
|
||||||
|
description?: string;
|
||||||
|
}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.shape.record {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_field = {
|
||||||
|
name: string;
|
||||||
|
shape: type_shape;
|
||||||
|
required: boolean;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_subject = {
|
||||||
|
fields: Array<type_field>;
|
||||||
|
soft: boolean;
|
||||||
|
defaultvalue: lib_plankton.pod.type_pod<any>;
|
||||||
|
description: lib_plankton.pod.type_pod<string>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function make(fields_raw: Array<{
|
||||||
|
name: string;
|
||||||
|
shape: type_shape;
|
||||||
|
required?: boolean;
|
||||||
|
}>, options?: {
|
||||||
|
soft?: boolean;
|
||||||
|
defaultvalue?: any;
|
||||||
|
description?: string;
|
||||||
|
}): type_subject;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.www_form {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_source = Record<string, string>;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_target = string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function encode(source: type_source): type_target;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function decode(target: type_target): type_source;
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.www_form {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
class class_www_form implements lib_plankton.code.interface_code<type_source, type_target> {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* @implementation
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
encode(source: type_source): type_target;
|
||||||
|
/**
|
||||||
|
* @implementation
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
decode(target: type_target): type_source;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.url {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
type type_url = {
|
||||||
|
scheme: (null | string);
|
||||||
|
host: (null | string);
|
||||||
|
username: (null | string);
|
||||||
|
password: (null | string);
|
||||||
|
port: (null | int);
|
||||||
|
path: (null | string);
|
||||||
|
query: (null | string);
|
||||||
|
hash: (null | string);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.url {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function encode(url: type_url): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
* @todo arguments
|
||||||
|
*/
|
||||||
|
function decode(url_raw: string): type_url;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function implementation_code(): lib_plankton.code.type_code<type_url, string>;
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.url {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
class class_url implements lib_plankton.code.interface_code<type_url, string> {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* @implementation
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
encode(x: any): string;
|
||||||
|
/**
|
||||||
|
* @implementation
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
decode(x: string): any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.random {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
type type_state = {
|
||||||
|
builtin: boolean;
|
||||||
|
seed?: int;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function state_push(state: type_state): void;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function state_pop(): type_state;
|
||||||
|
/**
|
||||||
|
* returns a random floating point number in the interval [0,1[
|
||||||
|
*
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_unit(): float;
|
||||||
|
/**
|
||||||
|
* returns a random boolean value
|
||||||
|
*
|
||||||
|
* @param {float} [probability] the probability for the return-value "true"; default: 0.5
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_boolean(options?: {
|
||||||
|
probability?: float;
|
||||||
|
}): boolean;
|
||||||
|
/**
|
||||||
|
* returns a random integer number in the interval [a,b]
|
||||||
|
*
|
||||||
|
* @param {int} [minimum] the left side of the halfopen interval (i.e. the smallest included value in the range)
|
||||||
|
* @param {int} [minimum] the right side of the halfopen interval (i.e. the smallest excluded value in the range)
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_integer(options?: {
|
||||||
|
minimum?: int;
|
||||||
|
maximum?: int;
|
||||||
|
}): int;
|
||||||
|
var generate_int: typeof generate_integer;
|
||||||
|
/**
|
||||||
|
* returns a random floating point number in the given interval
|
||||||
|
*
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_float(options?: {
|
||||||
|
minimum?: int;
|
||||||
|
maximum?: int;
|
||||||
|
}): float;
|
||||||
|
/**
|
||||||
|
* returns a random date
|
||||||
|
*
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_date(options?: {
|
||||||
|
minimum?: Date;
|
||||||
|
maximum?: Date;
|
||||||
|
}): Date;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_hexdigit(): string;
|
||||||
|
/**
|
||||||
|
* generates a random string with an optional prefix
|
||||||
|
*
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_string(options?: {
|
||||||
|
length?: int;
|
||||||
|
}): string;
|
||||||
|
/**
|
||||||
|
* chooses a value randomly from a list of values with weights (a higher weight means a higher probability to be chosen)
|
||||||
|
*
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function choose_weighted<type_value>(sets: Array<{
|
||||||
|
weight: float;
|
||||||
|
value: type_value;
|
||||||
|
}>): type_value;
|
||||||
|
/**
|
||||||
|
* chooses a value randomly from a list of values with equal probabilities
|
||||||
|
*
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function choose_uniformly<type_value>(values: Array<type_value>): type_value;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function shuffle<type_element>(list: Array<type_element>): Array<type_element>;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_vowel(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_halfvowel(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_consonant(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_letter(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_syllable(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_word(options?: {
|
||||||
|
syllable_count_minimum?: int;
|
||||||
|
syllable_count_maximum?: int;
|
||||||
|
}): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_text(options?: {
|
||||||
|
word_count?: int;
|
||||||
|
}): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_city(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_street(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_guid(options?: {
|
||||||
|
with_braces?: boolean;
|
||||||
|
}): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_url(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_email_address(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_telephone_number(): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function generate_time(): any;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
* @deprecated
|
||||||
|
* @todo remove
|
||||||
|
*/
|
||||||
|
function generate_for_shape(shape: any): any;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
}
|
||||||
declare namespace lib_plankton.map {
|
declare namespace lib_plankton.map {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
@ -2775,6 +3282,9 @@ declare namespace lib_plankton.color {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function make_rgb(model_rgb: type_model_rgb): type_color;
|
function make_rgb(model_rgb: type_model_rgb): type_color;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function from_hex(hex: string): type_color;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function to_hsv(color: type_color): type_model_hsv;
|
function to_hsv(color: type_color): type_model_hsv;
|
||||||
|
|
@ -3033,57 +3543,6 @@ declare namespace lib_plankton.http {
|
||||||
implementation?: ("fetch" | "http_module");
|
implementation?: ("fetch" | "http_module");
|
||||||
}): Promise<type_response>;
|
}): Promise<type_response>;
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.url {
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
type type_url = {
|
|
||||||
scheme: (null | string);
|
|
||||||
host: (null | string);
|
|
||||||
username: (null | string);
|
|
||||||
password: (null | string);
|
|
||||||
port: (null | int);
|
|
||||||
path: (null | string);
|
|
||||||
query: (null | string);
|
|
||||||
hash: (null | string);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.url {
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
function encode(url: type_url): string;
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
* @todo arguments
|
|
||||||
*/
|
|
||||||
function decode(url_raw: string): type_url;
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
function implementation_code(): lib_plankton.code.type_code<type_url, string>;
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.url {
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
class class_url implements lib_plankton.code.interface_code<type_url, string> {
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
constructor();
|
|
||||||
/**
|
|
||||||
* @implementation
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
encode(x: any): string;
|
|
||||||
/**
|
|
||||||
* @implementation
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
decode(x: string): any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.pit {
|
declare namespace lib_plankton.pit {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
@ -3257,43 +3716,6 @@ declare namespace lib_plankton.pit {
|
||||||
omit_date?: boolean;
|
omit_date?: boolean;
|
||||||
}): string;
|
}): string;
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.www_form {
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_source = Record<string, string>;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_target = string;
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
function encode(source: type_source): type_target;
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
function decode(target: type_target): type_source;
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.www_form {
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
class class_www_form implements lib_plankton.code.interface_code<type_source, type_target> {
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
constructor();
|
|
||||||
/**
|
|
||||||
* @implementation
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
encode(source: type_source): type_target;
|
|
||||||
/**
|
|
||||||
* @implementation
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
decode(target: type_target): type_source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.translate {
|
declare namespace lib_plankton.translate {
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
|
|
@ -3436,6 +3858,191 @@ declare namespace lib_plankton.zoo_page {
|
||||||
export function start(): void;
|
export function start(): void;
|
||||||
export {};
|
export {};
|
||||||
}
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
interface interface_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
load(target_element: HTMLElement): Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_empty implements interface_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
load(target_element: HTMLElement): Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_string implements interface_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private content;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(content: string);
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
load(target_element: HTMLElement): Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_link implements interface_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private target;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private text;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private open_in_new_tab;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(target: string, { "text": text, "open_in_new_tab": open_in_new_tab, }?: {
|
||||||
|
text?: (null | string);
|
||||||
|
open_in_new_tab?: boolean;
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
load(target_element: HTMLElement): Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_text implements interface_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private paragraphs;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(paragraphs: Array<string>);
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
load(target_element: HTMLElement): Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_list implements interface_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private elements;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(elements: Array<interface_widget>);
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
load(target_element: HTMLElement): Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_panel implements interface_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private content;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private collapseable;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private collapsed_initial_value;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private classes;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
|
||||||
|
collapseable?: boolean;
|
||||||
|
collapsed_initial_value?: boolean;
|
||||||
|
classes?: Array<string>;
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
load(target_element: HTMLElement): Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_panel_info extends class_panel {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
|
||||||
|
collapseable?: boolean;
|
||||||
|
collapsed_initial_value?: boolean;
|
||||||
|
classes?: Array<string>;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_panel_warning extends class_panel {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
|
||||||
|
collapseable?: boolean;
|
||||||
|
collapsed_initial_value?: boolean;
|
||||||
|
classes?: Array<string>;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_panel_error extends class_panel {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
|
||||||
|
collapseable?: boolean;
|
||||||
|
collapsed_initial_value?: boolean;
|
||||||
|
classes?: Array<string>;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_panel_success extends class_panel {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
|
||||||
|
collapseable?: boolean;
|
||||||
|
collapsed_initial_value?: boolean;
|
||||||
|
classes?: Array<string>;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_bunch implements interface_widget {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private elements;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor(elements: Array<interface_widget>);
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
load(target_element: HTMLElement): Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
declare namespace lib_plankton.zoo_input {
|
declare namespace lib_plankton.zoo_input {
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
|
|
@ -3889,12 +4496,31 @@ declare namespace lib_plankton.zoo_input {
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
class class_input_password implements interface_input<string> {
|
class class_input_password implements interface_input<string> {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private exhibit;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private character_hide;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private character_show;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
private dom_input;
|
private dom_input;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
constructor();
|
private dom_exhibit;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor({ "exhibit_initial_value": exhibit_initial_value, "character_hide": character_hide, "character_show": character_show, }?: {
|
||||||
|
exhibit_initial_value?: boolean;
|
||||||
|
character_hide?: string;
|
||||||
|
character_show?: string;
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private toggle_exhibition;
|
||||||
/**
|
/**
|
||||||
* [implementation]
|
* [implementation]
|
||||||
*/
|
*/
|
||||||
|
|
@ -3976,7 +4602,7 @@ declare namespace lib_plankton.zoo_input {
|
||||||
name: string;
|
name: string;
|
||||||
input: interface_input<any>;
|
input: interface_input<any>;
|
||||||
label?: (null | string);
|
label?: (null | string);
|
||||||
help?: (null | string);
|
help?: (null | lib_plankton.zoo_widget.interface_widget);
|
||||||
}>);
|
}>);
|
||||||
/**
|
/**
|
||||||
* [implementation]
|
* [implementation]
|
||||||
|
|
@ -4069,6 +4695,39 @@ declare namespace lib_plankton.zoo_input {
|
||||||
write(value: lib_plankton.pit.type_datetime): Promise<void>;
|
write(value: lib_plankton.pit.type_datetime): Promise<void>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
declare namespace lib_plankton.zoo_input {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_input_color implements interface_input<(null | lib_plankton.color.type_color)> {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
private dom_input;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* [implementation]
|
||||||
|
*/
|
||||||
|
setup(parent: HTMLElement): Promise<void>;
|
||||||
|
/**
|
||||||
|
* [implementation]
|
||||||
|
*/
|
||||||
|
read(): Promise<(null | lib_plankton.color.type_color)>;
|
||||||
|
/**
|
||||||
|
* [implementation]
|
||||||
|
*/
|
||||||
|
write(value: (null | lib_plankton.color.type_color)): Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.zoo_input {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class class_input_hue extends class_input_wrapped<(null | lib_plankton.color.type_color), (null | float)> implements interface_input<(null | float)> {
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
}
|
||||||
declare namespace lib_plankton.zoo_form {
|
declare namespace lib_plankton.zoo_form {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -100,6 +100,7 @@ namespace _dali.type
|
||||||
*/
|
*/
|
||||||
export type calendar_object = {
|
export type calendar_object = {
|
||||||
name : string;
|
name : string;
|
||||||
|
hue : float;
|
||||||
access : {
|
access : {
|
||||||
public : boolean;
|
public : boolean;
|
||||||
default_level : enum_access_level;
|
default_level : enum_access_level;
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
"resource.kinds.caldav.read_only": "nur lesen",
|
"resource.kinds.caldav.read_only": "nur lesen",
|
||||||
"calendar.calendar": "Kalender",
|
"calendar.calendar": "Kalender",
|
||||||
"calendar.name": "Name",
|
"calendar.name": "Name",
|
||||||
|
"calendar.hue": "Farbton",
|
||||||
"calendar.resource": "Resource",
|
"calendar.resource": "Resource",
|
||||||
"calendar.access.access": "Zugriff",
|
"calendar.access.access": "Zugriff",
|
||||||
"calendar.access.public": "öffentlich",
|
"calendar.access.public": "öffentlich",
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
"resource.kinds.caldav.read_only": "read-only",
|
"resource.kinds.caldav.read_only": "read-only",
|
||||||
"calendar.calendar": "Kalendar",
|
"calendar.calendar": "Kalendar",
|
||||||
"calendar.name": "name",
|
"calendar.name": "name",
|
||||||
|
"calendar.hue": "hue",
|
||||||
"calendar.resource": "resource",
|
"calendar.resource": "resource",
|
||||||
"calendar.access.access": "access",
|
"calendar.access.access": "access",
|
||||||
"calendar.access.public": "public",
|
"calendar.access.public": "public",
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ namespace _dali.pages
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const form : lib_plankton.zoo_form.class_form<
|
const form : lib_plankton.zoo_form.class_form<
|
||||||
_dali.type.calendar_object,
|
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
access : {
|
access : {
|
||||||
|
|
@ -27,9 +26,22 @@ namespace _dali.pages
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
resource_kind : string;
|
resource_kind : string;
|
||||||
|
hue : (null | float);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : string;
|
||||||
|
access : {
|
||||||
|
public : boolean;
|
||||||
|
default_level : _dali.type.enum_access_level;
|
||||||
|
attributed : lib_plankton.map.type_map<
|
||||||
|
_dali.type.user_id,
|
||||||
|
_dali.type.enum_access_level
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
resource_kind : string;
|
||||||
|
hue : (null | float);
|
||||||
}
|
}
|
||||||
> = new lib_plankton.zoo_form.class_form<
|
> = new lib_plankton.zoo_form.class_form<
|
||||||
_dali.type.calendar_object,
|
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
access : {
|
access : {
|
||||||
|
|
@ -41,44 +53,24 @@ namespace _dali.pages
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
resource_kind : string;
|
resource_kind : string;
|
||||||
|
hue : (null | float);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : string;
|
||||||
|
access : {
|
||||||
|
public : boolean;
|
||||||
|
default_level : _dali.type.enum_access_level;
|
||||||
|
attributed : lib_plankton.map.type_map<
|
||||||
|
_dali.type.user_id,
|
||||||
|
_dali.type.enum_access_level
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
resource_kind : string;
|
||||||
|
hue : (null | float);
|
||||||
}
|
}
|
||||||
>(
|
>(
|
||||||
(calendar_object) => ({
|
(value) => value,
|
||||||
"name": calendar_object.name,
|
(raw) => raw,
|
||||||
"access": calendar_object.access,
|
|
||||||
"resource_kind": calendar_object.resource.kind,
|
|
||||||
}),
|
|
||||||
(raw) => ({
|
|
||||||
"name": raw.name,
|
|
||||||
"access": raw.access,
|
|
||||||
"resource": (() => {
|
|
||||||
switch (raw.resource_kind) {
|
|
||||||
case "local": {
|
|
||||||
return {
|
|
||||||
"kind": "local",
|
|
||||||
"data": {
|
|
||||||
"events": [],
|
|
||||||
}
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "caldav": {
|
|
||||||
return {
|
|
||||||
"kind": "caldav",
|
|
||||||
"data": {
|
|
||||||
"url": "", // TODO
|
|
||||||
"read_only": true, // TODO
|
|
||||||
}
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
throw (new Error("invalid resource kind: " + raw.resource_kind));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}) (),
|
|
||||||
}),
|
|
||||||
new lib_plankton.zoo_input.class_input_group<any>(
|
new lib_plankton.zoo_input.class_input_group<any>(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
@ -86,6 +78,12 @@ namespace _dali.pages
|
||||||
"input": new lib_plankton.zoo_input.class_input_text(),
|
"input": new lib_plankton.zoo_input.class_input_text(),
|
||||||
"label": lib_plankton.translate.get("calendar.name")
|
"label": lib_plankton.translate.get("calendar.name")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "hue",
|
||||||
|
"input": new lib_plankton.zoo_input.class_input_hue(
|
||||||
|
),
|
||||||
|
"label": lib_plankton.translate.get("calendar.hue"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "access",
|
"name": "access",
|
||||||
"input": new lib_plankton.zoo_input.class_input_group(
|
"input": new lib_plankton.zoo_input.class_input_group(
|
||||||
|
|
@ -130,12 +128,51 @@ namespace _dali.pages
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"label": lib_plankton.translate.get("page.calendar_add.actions.do"),
|
"label": lib_plankton.translate.get("page.calendar_add.actions.do"),
|
||||||
"target": "submit",
|
|
||||||
"procedure": async (get_value, get_representation) => {
|
"procedure": async (get_value, get_representation) => {
|
||||||
const value : any = await get_value();
|
const value : any = await get_value();
|
||||||
try {
|
const calendar_object : _dali.type.calendar_object = {
|
||||||
|
"name": value.name,
|
||||||
|
"access": {
|
||||||
|
"public": value.access.public,
|
||||||
|
"default_level": value.access.default_level,
|
||||||
|
"attributed": value.access.attributed,
|
||||||
|
},
|
||||||
|
"resource": (() => {
|
||||||
|
switch (value.resource_kind) {
|
||||||
|
case "local":
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"kind": "local",
|
||||||
|
"data": {
|
||||||
|
"events": [],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "caldav":
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"kind": "caldav",
|
||||||
|
"data": {
|
||||||
|
"url": "", // TODO
|
||||||
|
"read_only": true, // TODO
|
||||||
|
}
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
throw (new Error("invalid resource kind: " + value.resource_kind));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) (),
|
||||||
|
"hue": value.hue,
|
||||||
|
};
|
||||||
|
try
|
||||||
|
{
|
||||||
await _dali.backend.calendar_add(
|
await _dali.backend.calendar_add(
|
||||||
value
|
calendar_object
|
||||||
);
|
);
|
||||||
lib_plankton.zoo_page.set(
|
lib_plankton.zoo_page.set(
|
||||||
{
|
{
|
||||||
|
|
@ -144,7 +181,8 @@ namespace _dali.pages
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error)
|
||||||
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
/*
|
/*
|
||||||
lib_plankton.zoo_page.set(
|
lib_plankton.zoo_page.set(
|
||||||
|
|
@ -161,6 +199,28 @@ namespace _dali.pages
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
await form.setup(document.querySelector("#calendar_add_form"));
|
await form.setup(document.querySelector("#calendar_add_form"));
|
||||||
|
await form.input_write(
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"access": {
|
||||||
|
"public": false,
|
||||||
|
"default_level": _dali.type.enum_access_level.view,
|
||||||
|
"attributed": lib_plankton.map.hashmap.implementation_map<
|
||||||
|
_dali.type.user_id,
|
||||||
|
_dali.type.enum_access_level
|
||||||
|
>(
|
||||||
|
lib_plankton.map.hashmap.make<
|
||||||
|
_dali.type.user_id,
|
||||||
|
_dali.type.enum_access_level
|
||||||
|
>(
|
||||||
|
user_id => user_id.toFixed(0),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
},
|
||||||
|
"resource_kind": "local",
|
||||||
|
"hue": lib_plankton.random.generate_unit(),
|
||||||
|
}
|
||||||
|
);
|
||||||
return Promise.resolve<void>(undefined);
|
return Promise.resolve<void>(undefined);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,21 @@ namespace _dali.pages
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const form : lib_plankton.zoo_form.class_form<
|
const form : lib_plankton.zoo_form.class_form<
|
||||||
_dali.type.calendar_object,
|
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
|
hue : float;
|
||||||
|
access : {
|
||||||
|
public : boolean;
|
||||||
|
default_level : _dali.type.enum_access_level;
|
||||||
|
attributed : lib_plankton.map.type_map<
|
||||||
|
_dali.type.user_id,
|
||||||
|
_dali.type.enum_access_level
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : string;
|
||||||
|
hue : float;
|
||||||
access : {
|
access : {
|
||||||
public : boolean;
|
public : boolean;
|
||||||
default_level : _dali.type.enum_access_level;
|
default_level : _dali.type.enum_access_level;
|
||||||
|
|
@ -30,9 +42,21 @@ namespace _dali.pages
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
> = new lib_plankton.zoo_form.class_form<
|
> = new lib_plankton.zoo_form.class_form<
|
||||||
_dali.type.calendar_object,
|
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
|
hue : float;
|
||||||
|
access : {
|
||||||
|
public : boolean;
|
||||||
|
default_level : _dali.type.enum_access_level;
|
||||||
|
attributed : lib_plankton.map.type_map<
|
||||||
|
_dali.type.user_id,
|
||||||
|
_dali.type.enum_access_level
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : string;
|
||||||
|
hue : float;
|
||||||
access : {
|
access : {
|
||||||
public : boolean;
|
public : boolean;
|
||||||
default_level : _dali.type.enum_access_level;
|
default_level : _dali.type.enum_access_level;
|
||||||
|
|
@ -43,20 +67,8 @@ namespace _dali.pages
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
>(
|
>(
|
||||||
(calendar_object) => ({
|
(value) => value,
|
||||||
"name": calendar_object.name,
|
(raw) => raw,
|
||||||
"access": calendar_object.access,
|
|
||||||
}),
|
|
||||||
(raw) => ({
|
|
||||||
"name": raw.name,
|
|
||||||
"access": raw.access,
|
|
||||||
"resource": {
|
|
||||||
"kind": "local",
|
|
||||||
"data": {
|
|
||||||
"events": [],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
new lib_plankton.zoo_input.class_input_group<any>(
|
new lib_plankton.zoo_input.class_input_group<any>(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
@ -64,6 +76,12 @@ namespace _dali.pages
|
||||||
"input": new lib_plankton.zoo_input.class_input_text(),
|
"input": new lib_plankton.zoo_input.class_input_text(),
|
||||||
"label": lib_plankton.translate.get("calendar.name")
|
"label": lib_plankton.translate.get("calendar.name")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "hue",
|
||||||
|
"input": new lib_plankton.zoo_input.class_input_hue(
|
||||||
|
),
|
||||||
|
"label": lib_plankton.translate.get("calendar.hue"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "access",
|
"name": "access",
|
||||||
"input": new lib_plankton.zoo_input.class_input_group(
|
"input": new lib_plankton.zoo_input.class_input_group(
|
||||||
|
|
@ -98,13 +116,12 @@ namespace _dali.pages
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"label": lib_plankton.translate.get("page.calendar_edit.actions.change"),
|
"label": lib_plankton.translate.get("page.calendar_edit.actions.change"),
|
||||||
"target": "submit",
|
|
||||||
"procedure": async (get_value, get_representation) => {
|
"procedure": async (get_value, get_representation) => {
|
||||||
const value : any = await get_value();
|
const data : any = await get_value();
|
||||||
try {
|
try {
|
||||||
await _dali.backend.calendar_change(
|
await _dali.backend.calendar_change(
|
||||||
calendar_id,
|
calendar_id,
|
||||||
value
|
data
|
||||||
);
|
);
|
||||||
lib_plankton.zoo_page.set(
|
lib_plankton.zoo_page.set(
|
||||||
{
|
{
|
||||||
|
|
@ -129,7 +146,6 @@ namespace _dali.pages
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": lib_plankton.translate.get("page.calendar_edit.actions.remove"),
|
"label": lib_plankton.translate.get("page.calendar_edit.actions.remove"),
|
||||||
"target": "submit",
|
|
||||||
"procedure": async (get_value, get_representation) => {
|
"procedure": async (get_value, get_representation) => {
|
||||||
try {
|
try {
|
||||||
await _dali.backend.calendar_remove(
|
await _dali.backend.calendar_remove(
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ namespace _dali.pages.overview
|
||||||
{
|
{
|
||||||
id : _dali.type.calendar_id;
|
id : _dali.type.calendar_id;
|
||||||
name : string;
|
name : string;
|
||||||
|
hue : float;
|
||||||
access_level : _dali.type.enum_access_level;
|
access_level : _dali.type.enum_access_level;
|
||||||
}
|
}
|
||||||
> = await _dali.backend.calendar_list(
|
> = await _dali.backend.calendar_list(
|
||||||
|
|
|
||||||
|
|
@ -310,6 +310,7 @@ namespace _dali.backend
|
||||||
{
|
{
|
||||||
id : int;
|
id : int;
|
||||||
name : string;
|
name : string;
|
||||||
|
hue : float;
|
||||||
access_level : _dali.type.enum_access_level;
|
access_level : _dali.type.enum_access_level;
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
@ -328,6 +329,7 @@ namespace _dali.backend
|
||||||
(entry) => ({
|
(entry) => ({
|
||||||
"id": entry.id,
|
"id": entry.id,
|
||||||
"name": entry.name,
|
"name": entry.name,
|
||||||
|
"hue": entry.hue,
|
||||||
"access_level": access_level_decode(entry.access_level),
|
"access_level": access_level_decode(entry.access_level),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
@ -360,6 +362,7 @@ namespace _dali.backend
|
||||||
(raw) => Promise.resolve(
|
(raw) => Promise.resolve(
|
||||||
{
|
{
|
||||||
"name": raw.name,
|
"name": raw.name,
|
||||||
|
"hue": raw.hue,
|
||||||
"access": {
|
"access": {
|
||||||
"public": raw.access.public,
|
"public": raw.access.public,
|
||||||
"default_level": access_level_decode(raw.access.default_level),
|
"default_level": access_level_decode(raw.access.default_level),
|
||||||
|
|
@ -387,7 +390,7 @@ namespace _dali.backend
|
||||||
"data": {
|
"data": {
|
||||||
"events": []
|
"events": []
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -412,6 +415,7 @@ namespace _dali.backend
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
"name": calendar_object.name,
|
"name": calendar_object.name,
|
||||||
|
"hue": calendar_object.hue,
|
||||||
"access": {
|
"access": {
|
||||||
"public": calendar_object.access.public,
|
"public": calendar_object.access.public,
|
||||||
"default_level": access_level_encode(calendar_object.access.default_level),
|
"default_level": access_level_encode(calendar_object.access.default_level),
|
||||||
|
|
@ -435,7 +439,18 @@ namespace _dali.backend
|
||||||
*/
|
*/
|
||||||
export async function calendar_change(
|
export async function calendar_change(
|
||||||
calendar_id : _dali.type.calendar_id,
|
calendar_id : _dali.type.calendar_id,
|
||||||
calendar_object : _dali.type.calendar_object
|
data : {
|
||||||
|
name : string;
|
||||||
|
hue : float;
|
||||||
|
access : {
|
||||||
|
public : boolean;
|
||||||
|
default_level : _dali.type.enum_access_level;
|
||||||
|
attributed : lib_plankton.map.type_map<
|
||||||
|
_dali.type.user_id,
|
||||||
|
_dali.type.enum_access_level
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
}
|
||||||
) : Promise<
|
) : Promise<
|
||||||
void
|
void
|
||||||
>
|
>
|
||||||
|
|
@ -449,12 +464,13 @@ namespace _dali.backend
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
"name": calendar_object.name,
|
"name": data.name,
|
||||||
|
"hue": data.hue,
|
||||||
"access": {
|
"access": {
|
||||||
"public": calendar_object.access.public,
|
"public": data.access.public,
|
||||||
"default_level": access_level_encode(calendar_object.access.default_level),
|
"default_level": access_level_encode(data.access.default_level),
|
||||||
"attributed": (
|
"attributed": (
|
||||||
lib_plankton.map.dump(calendar_object.access.attributed)
|
lib_plankton.map.dump(data.access.attributed)
|
||||||
.map(
|
.map(
|
||||||
(pair) => ({
|
(pair) => ({
|
||||||
"user_id": pair.key,
|
"user_id": pair.key,
|
||||||
|
|
@ -463,7 +479,6 @@ namespace _dali.backend
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
"resource": calendar_object.resource,
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -588,6 +603,7 @@ namespace _dali.backend
|
||||||
{
|
{
|
||||||
calendar_id : _dali.type.calendar_id;
|
calendar_id : _dali.type.calendar_id;
|
||||||
calendar_name : string;
|
calendar_name : string;
|
||||||
|
hue : float;
|
||||||
access_level : _dali.type.enum_access_level;
|
access_level : _dali.type.enum_access_level;
|
||||||
event_id : (null | _dali.type.local_resource_event_id);
|
event_id : (null | _dali.type.local_resource_event_id);
|
||||||
event_object : _dali.type.event_object;
|
event_object : _dali.type.event_object;
|
||||||
|
|
@ -627,6 +643,7 @@ namespace _dali.backend
|
||||||
(entry) => ({
|
(entry) => ({
|
||||||
"calendar_id": entry.calendar_id,
|
"calendar_id": entry.calendar_id,
|
||||||
"calendar_name": entry.calendar_name,
|
"calendar_name": entry.calendar_name,
|
||||||
|
"hue": entry.hue,
|
||||||
"access_level": access_level_decode(entry.access_level),
|
"access_level": access_level_decode(entry.access_level),
|
||||||
"event_id": entry.event_id,
|
"event_id": entry.event_id,
|
||||||
"event_object": entry.event_object,
|
"event_object": entry.event_object,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ namespace _dali.widgets.listview
|
||||||
type type_entry = {
|
type type_entry = {
|
||||||
calendar_id : _dali.type.calendar_id;
|
calendar_id : _dali.type.calendar_id;
|
||||||
calendar_name : string;
|
calendar_name : string;
|
||||||
|
hue : float;
|
||||||
access_level : _dali.type.enum_access_level;
|
access_level : _dali.type.enum_access_level;
|
||||||
event_id : (null | _dali.type.local_resource_event_id);
|
event_id : (null | _dali.type.local_resource_event_id);
|
||||||
event_object : _dali.type.event_object;
|
event_object : _dali.type.event_object;
|
||||||
|
|
@ -229,9 +230,9 @@ namespace _dali.widgets.listview
|
||||||
),
|
),
|
||||||
"raw": JSON.stringify(entry),
|
"raw": JSON.stringify(entry),
|
||||||
"color": lib_plankton.color.output_hex(
|
"color": lib_plankton.color.output_hex(
|
||||||
lib_plankton.color.give_generic(
|
lib_plankton.color.make_hsv(
|
||||||
(entry.calendar_id - 1),
|
|
||||||
{
|
{
|
||||||
|
"hue": entry.hue,
|
||||||
"saturation": 0.375,
|
"saturation": 0.375,
|
||||||
"value": 0.375,
|
"value": 0.375,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ namespace _dali.widgets.sources
|
||||||
type type_entry = {
|
type type_entry = {
|
||||||
id : _dali.type.calendar_id;
|
id : _dali.type.calendar_id;
|
||||||
name : string;
|
name : string;
|
||||||
|
hue : float;
|
||||||
access_level : _dali.type.enum_access_level;
|
access_level : _dali.type.enum_access_level;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -101,18 +102,18 @@ namespace _dali.widgets.sources
|
||||||
// "access_level": entry.access_level, // TODO
|
// "access_level": entry.access_level, // TODO
|
||||||
// TODO centralize
|
// TODO centralize
|
||||||
"color_head": lib_plankton.color.output_hex(
|
"color_head": lib_plankton.color.output_hex(
|
||||||
lib_plankton.color.give_generic(
|
lib_plankton.color.make_hsv(
|
||||||
(entry.id - 1),
|
|
||||||
{
|
{
|
||||||
|
"hue": entry.hue,
|
||||||
"saturation": 0.375,
|
"saturation": 0.375,
|
||||||
"value": 0.375,
|
"value": 0.375,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
"color_body": lib_plankton.color.output_hex(
|
"color_body": lib_plankton.color.output_hex(
|
||||||
lib_plankton.color.give_generic(
|
lib_plankton.color.make_hsv(
|
||||||
(entry.id - 1),
|
|
||||||
{
|
{
|
||||||
|
"hue": entry.hue,
|
||||||
"saturation": 0.375,
|
"saturation": 0.375,
|
||||||
"value": 0.25,
|
"value": 0.25,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ namespace _dali.widgets.weekview
|
||||||
type type_entry = {
|
type type_entry = {
|
||||||
calendar_id : _dali.type.calendar_id;
|
calendar_id : _dali.type.calendar_id;
|
||||||
calendar_name : string;
|
calendar_name : string;
|
||||||
|
hue : float;
|
||||||
access_level : _dali.type.enum_access_level;
|
access_level : _dali.type.enum_access_level;
|
||||||
event_id : (null | _dali.type.local_resource_event_id);
|
event_id : (null | _dali.type.local_resource_event_id);
|
||||||
event_object : _dali.type.event_object;
|
event_object : _dali.type.event_object;
|
||||||
|
|
@ -223,6 +224,7 @@ namespace _dali.widgets.weekview
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
access_level : _dali.type.enum_access_level;
|
access_level : _dali.type.enum_access_level;
|
||||||
|
hue : float;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
rows : Array<
|
rows : Array<
|
||||||
|
|
@ -280,6 +282,7 @@ namespace _dali.widgets.weekview
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
access_level : _dali.type.enum_access_level;
|
access_level : _dali.type.enum_access_level;
|
||||||
|
hue : float;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
rows : Array<
|
rows : Array<
|
||||||
|
|
@ -314,6 +317,7 @@ namespace _dali.widgets.weekview
|
||||||
"value": {
|
"value": {
|
||||||
"name": entry.calendar_name,
|
"name": entry.calendar_name,
|
||||||
"access_level": entry.access_level,
|
"access_level": entry.access_level,
|
||||||
|
"hue": entry.hue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -508,6 +512,7 @@ namespace _dali.widgets.weekview
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
access_level : _dali.type.enum_access_level;
|
access_level : _dali.type.enum_access_level;
|
||||||
|
hue : float;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
rows : Array<
|
rows : Array<
|
||||||
|
|
@ -555,9 +560,9 @@ namespace _dali.widgets.weekview
|
||||||
"value": {
|
"value": {
|
||||||
"name": pair.value.name,
|
"name": pair.value.name,
|
||||||
"access_level": pair.value.access_level,
|
"access_level": pair.value.access_level,
|
||||||
"color": lib_plankton.color.give_generic(
|
"color": lib_plankton.color.make_hsv(
|
||||||
(pair.key - 1),
|
|
||||||
{
|
{
|
||||||
|
"hue": pair.value.hue,
|
||||||
"saturation": 0.375,
|
"saturation": 0.375,
|
||||||
"value": 0.375,
|
"value": 0.375,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ modules="${modules} storage"
|
||||||
modules="${modules} file"
|
modules="${modules} file"
|
||||||
modules="${modules} json"
|
modules="${modules} json"
|
||||||
modules="${modules} string"
|
modules="${modules} string"
|
||||||
|
modules="${modules} random"
|
||||||
modules="${modules} map"
|
modules="${modules} map"
|
||||||
modules="${modules} color"
|
modules="${modules} color"
|
||||||
# modules="${modules} xml"
|
# modules="${modules} xml"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue