@livinglogic/livingapi 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/HOWTO-release.md +74 -0
- package/LICENSE.txt +1 -1
- package/README.md +6 -8
- package/dist/esm-node/livingapi.js +1 -1
- package/dist/esm-node/livingapi.js.map +1 -1
- package/dist/esm-static/livingapi.js +1 -1
- package/dist/esm-static/livingapi.js.map +1 -1
- package/dist/umd/livingapi.js +1 -1
- package/dist/umd/livingapi.js.map +1 -1
- package/package.json +1 -1
- package/src/livingapi.js +85 -25
package/package.json
CHANGED
package/src/livingapi.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* LivingAPI JavaScript Library
|
|
3
3
|
* https://my.living-apps.de/docs/LivingAPI.html
|
|
4
4
|
*
|
|
5
|
-
* Copyright 2017-
|
|
6
|
-
* Copyright 2017-
|
|
5
|
+
* Copyright 2017-2023 by LivingLogic AG, Bayreuth/Germany
|
|
6
|
+
* Copyright 2017-2023 by Walter Dörwald
|
|
7
7
|
*
|
|
8
8
|
* All Rights Reserved
|
|
9
9
|
*
|
|
@@ -257,7 +257,7 @@ export class Globals extends Base
|
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
// distance between two geo coordinates (see https://de.wikipedia.org/wiki/Orthodrome#Genauere_Formel_zur_Abstandsberechnung_auf_der_Erde)
|
|
260
|
-
|
|
260
|
+
dist(geo1, geo2)
|
|
261
261
|
{
|
|
262
262
|
let sqsin = function sqsin(x) {x = Math.sin(x); return x*x};
|
|
263
263
|
let sqcos = function sqsos(x) {x = Math.cos(x); return x*x};
|
|
@@ -496,12 +496,12 @@ export class Globals extends Base
|
|
|
496
496
|
};
|
|
497
497
|
|
|
498
498
|
Globals.prototype._ul4onattrs = ["version", "platform", "user", "maxdbactions", "maxtemplateruntime", "lang", "datasources", "hostname", "app", "record", "mode", "view_template_id", "email_template_id", "view_id"];
|
|
499
|
-
Globals.prototype._ul4attrs = new Set(["version", "hostname", "platform", "user", "lang", "datasources", "app", "record", "maxdbactions", "maxtemplateruntime", "flashmessages", "mode", "scaled_url", "
|
|
499
|
+
Globals.prototype._ul4attrs = new Set(["version", "hostname", "platform", "user", "lang", "datasources", "app", "record", "maxdbactions", "maxtemplateruntime", "flashmessages", "mode", "scaled_url", "dist", "current_geo", "log_debug", "log_info", "log_warning", "log_error"]);
|
|
500
500
|
ul4.expose(Globals.prototype.log_debug, ["message", "*"]);
|
|
501
501
|
ul4.expose(Globals.prototype.log_info, ["message", "*"]);
|
|
502
502
|
ul4.expose(Globals.prototype.log_warning, ["message", "*"]);
|
|
503
503
|
ul4.expose(Globals.prototype.log_error, ["message", "*"]);
|
|
504
|
-
ul4.expose(Globals.prototype.
|
|
504
|
+
ul4.expose(Globals.prototype.dist, ["geo1", "pk", "geo2", "pk"]);
|
|
505
505
|
ul4.expose(Globals.prototype.current_geo, []);
|
|
506
506
|
ul4.expose(Globals.prototype.scaled_url, [
|
|
507
507
|
"image", "p",
|
|
@@ -700,8 +700,8 @@ export class App extends Base
|
|
|
700
700
|
};
|
|
701
701
|
|
|
702
702
|
|
|
703
|
-
App.prototype._ul4onattrs = ["globals", "name", "description", "lang", "startlink", "iconlarge", "iconsmall", "createdby", "controls", "records", "recordcount", "installation", "categories", "params", "views", "datamanagement_identifier", "basetable", "primarykey", "insertprocedure", "updateprocedure", "deleteprocedure", "templates", "createdat", "updatedat", "updatedby", "superid", "favorite", "_active_view"];
|
|
704
|
-
App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "lang", "startlink", "iconlarge", "iconsmall", "createdat", "createdby", "updatedat", "updatedby", "controls", "layout_controls", "records", "recordcount", "installation", "categories", "params", "views", "datamanagement_identifier", "insert", "favorite", "_active_view", "template_url", "new_embedded_url", "new_standalone_url"]);
|
|
703
|
+
App.prototype._ul4onattrs = ["globals", "name", "description", "lang", "startlink", "iconlarge", "iconsmall", "createdby", "controls", "records", "recordcount", "installation", "categories", "params", "views", "datamanagement_identifier", "basetable", "primarykey", "insertprocedure", "updateprocedure", "deleteprocedure", "templates", "createdat", "updatedat", "updatedby", "superid", "favorite", "_active_view", "datasource", "menus", "panels"];
|
|
704
|
+
App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "lang", "startlink", "iconlarge", "iconsmall", "createdat", "createdby", "updatedat", "updatedby", "controls", "layout_controls", "records", "recordcount", "installation", "categories", "params", "views", "menus", "panels", "datasource", "datamanagement_identifier", "insert", "favorite", "_active_view", "template_url", "new_embedded_url", "new_standalone_url"]);
|
|
705
705
|
ul4.expose(App.prototype[ul4.symbols.call], ["values", "**"], {"needsobject": true});
|
|
706
706
|
ul4.expose(App.prototype.insert, ["values", "**"], {"needsobject": true});
|
|
707
707
|
ul4.expose(App.prototype.template_url, ["identifier", "p", "record", "p=", null, "params", "**"]);
|
|
@@ -2510,7 +2510,7 @@ export class ChoiceFieldBase extends Field
|
|
|
2510
2510
|
label,
|
|
2511
2511
|
{
|
|
2512
2512
|
"value": value,
|
|
2513
|
-
"class": value === this.control.
|
|
2513
|
+
"class": value === this.control.none_key ? "la-none-option" : null,
|
|
2514
2514
|
"selected": selected ? "selected" : null,
|
|
2515
2515
|
}
|
|
2516
2516
|
);
|
|
@@ -2531,18 +2531,18 @@ export class ChoiceFieldBase extends Field
|
|
|
2531
2531
|
let value = dom_option.getAttribute("value");
|
|
2532
2532
|
if (lookupdata.has(value))
|
|
2533
2533
|
selected.add(value);
|
|
2534
|
-
else if (value === this.control.
|
|
2534
|
+
else if (value === this.control.none_key)
|
|
2535
2535
|
none_selected = true;
|
|
2536
2536
|
}
|
|
2537
2537
|
|
|
2538
2538
|
let new_children = [];
|
|
2539
|
-
if (this.control.
|
|
2539
|
+
if (this.control.none_key !== null)
|
|
2540
2540
|
{
|
|
2541
2541
|
new_children.push(
|
|
2542
2542
|
this._make_option(
|
|
2543
2543
|
none_selected,
|
|
2544
|
-
this.control.
|
|
2545
|
-
this.control.
|
|
2544
|
+
this.control.none_key,
|
|
2545
|
+
this.control.none_label !== null ? this.control.none_label : this.globals.msg_nothing_selected()
|
|
2546
2546
|
)
|
|
2547
2547
|
);
|
|
2548
2548
|
}
|
|
@@ -2576,13 +2576,13 @@ export class ChoiceFieldBase extends Field
|
|
|
2576
2576
|
{
|
|
2577
2577
|
if (lookupdata.has(value))
|
|
2578
2578
|
selected.add(value);
|
|
2579
|
-
else if (value === this.control.
|
|
2579
|
+
else if (value === this.control.none_key)
|
|
2580
2580
|
none_selected = true;
|
|
2581
2581
|
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
2584
|
|
|
2585
|
-
let dom_none_input = this._dom_root.querySelector("input[value=" + this.control.
|
|
2585
|
+
let dom_none_input = this._dom_root.querySelector("input[value=" + this.control.none_key + "]");
|
|
2586
2586
|
if (dom_none_input !== null)
|
|
2587
2587
|
dom_none_input.checked = none_selected;
|
|
2588
2588
|
|
|
@@ -2741,7 +2741,7 @@ export class LookupField extends LookupFieldBase
|
|
|
2741
2741
|
_validate(change)
|
|
2742
2742
|
{
|
|
2743
2743
|
let v = change.value;
|
|
2744
|
-
if (v === null || v === "" || this.control.
|
|
2744
|
+
if (v === null || v === "" || this.control.none_key === v)
|
|
2745
2745
|
{
|
|
2746
2746
|
if (this.control.required)
|
|
2747
2747
|
change.errors.push(this.msg_field_required(v));
|
|
@@ -2797,7 +2797,7 @@ export class LookupRadioField extends LookupField
|
|
|
2797
2797
|
if (value instanceof LookupItem)
|
|
2798
2798
|
value = value.key;
|
|
2799
2799
|
if (value === null)
|
|
2800
|
-
value = this.control.
|
|
2800
|
+
value = this.control.none_key;
|
|
2801
2801
|
|
|
2802
2802
|
for (let node of this._dom_controls)
|
|
2803
2803
|
node.checked = node.getAttribute("value") === value;
|
|
@@ -2833,7 +2833,7 @@ export class LookupSelectField extends LookupField
|
|
|
2833
2833
|
let value = super._get_dom_value();
|
|
2834
2834
|
if (value)
|
|
2835
2835
|
{
|
|
2836
|
-
if (value === this.control.
|
|
2836
|
+
if (value === this.control.none_key)
|
|
2837
2837
|
value = null;
|
|
2838
2838
|
else
|
|
2839
2839
|
value = this.control.lookupdata.get(value);
|
|
@@ -2845,7 +2845,7 @@ export class LookupSelectField extends LookupField
|
|
|
2845
2845
|
{
|
|
2846
2846
|
let change = {value: value, errors: []};
|
|
2847
2847
|
this._validate(change);
|
|
2848
|
-
super._set_dom_value(change.value != null ? change.value.key : this.control.
|
|
2848
|
+
super._set_dom_value(change.value != null ? change.value.key : this.control.none_key);
|
|
2849
2849
|
}
|
|
2850
2850
|
|
|
2851
2851
|
_set_dom_lookupdata(lookupdata)
|
|
@@ -2911,7 +2911,7 @@ export class MultipleLookupField extends LookupFieldBase
|
|
|
2911
2911
|
let v = change.value;
|
|
2912
2912
|
let islist = (Object.prototype.toString.call(v) === "[object Array]");
|
|
2913
2913
|
|
|
2914
|
-
if (v === null || v === "" || this.control.
|
|
2914
|
+
if (v === null || v === "" || this.control.none_key === v || (islist && v.length === 0))
|
|
2915
2915
|
{
|
|
2916
2916
|
if (this.control.required)
|
|
2917
2917
|
change.errors.push(this.msg_field_required(v));
|
|
@@ -3234,7 +3234,7 @@ export class AppLookupSelectField extends AppLookupField
|
|
|
3234
3234
|
{
|
|
3235
3235
|
let change = {value: value, errors: []};
|
|
3236
3236
|
this._validate(change);
|
|
3237
|
-
super._set_dom_value(change.value != null ? change.value.id : this.control.
|
|
3237
|
+
super._set_dom_value(change.value != null ? change.value.id : this.control.none_key);
|
|
3238
3238
|
}
|
|
3239
3239
|
|
|
3240
3240
|
_set_dom_lookupdata(lookupdata)
|
|
@@ -3312,7 +3312,7 @@ export class MultipleAppLookupField extends AppLookupFieldBase
|
|
|
3312
3312
|
let v = change.value;
|
|
3313
3313
|
let islist = (Object.prototype.toString.call(v) === "[object Array]");
|
|
3314
3314
|
|
|
3315
|
-
if (v === null || v === "" || this.control.
|
|
3315
|
+
if (v === null || v === "" || this.control.none_key === v || (islist && v.length === 0))
|
|
3316
3316
|
{
|
|
3317
3317
|
if (this.control.required)
|
|
3318
3318
|
change.errors.push(this.msg_field_required(v));
|
|
@@ -4261,7 +4261,7 @@ export class LookupControl extends Control
|
|
|
4261
4261
|
return view_control.autoexpandable;
|
|
4262
4262
|
}
|
|
4263
4263
|
|
|
4264
|
-
get
|
|
4264
|
+
get none_key()
|
|
4265
4265
|
{
|
|
4266
4266
|
let view_control = this._view_control();
|
|
4267
4267
|
if (view_control === null)
|
|
@@ -4269,7 +4269,7 @@ export class LookupControl extends Control
|
|
|
4269
4269
|
return view_control.lookupnonekey;
|
|
4270
4270
|
}
|
|
4271
4271
|
|
|
4272
|
-
get
|
|
4272
|
+
get none_label()
|
|
4273
4273
|
{
|
|
4274
4274
|
let view_control = this._view_control();
|
|
4275
4275
|
if (view_control === null)
|
|
@@ -4395,7 +4395,7 @@ export class AppLookupControl extends Control
|
|
|
4395
4395
|
return new Map();
|
|
4396
4396
|
}
|
|
4397
4397
|
|
|
4398
|
-
get
|
|
4398
|
+
get none_key()
|
|
4399
4399
|
{
|
|
4400
4400
|
let view_control = this._view_control();
|
|
4401
4401
|
if (view_control === null)
|
|
@@ -4403,7 +4403,7 @@ export class AppLookupControl extends Control
|
|
|
4403
4403
|
return view_control.lookupnonekey;
|
|
4404
4404
|
}
|
|
4405
4405
|
|
|
4406
|
-
get
|
|
4406
|
+
get none_label()
|
|
4407
4407
|
{
|
|
4408
4408
|
let view_control = this._view_control();
|
|
4409
4409
|
if (view_control === null)
|
|
@@ -5555,6 +5555,62 @@ AppParameter.prototype._ul4onattrs = ["owner", "parent", "type", "order", "ident
|
|
|
5555
5555
|
AppParameter.prototype._ul4attrs = new Set(["id", "owner", "parent", "app", "type", "order", "identifier", "description", "value", "createdat", "createdby", "updatedat", "updatedby"]);
|
|
5556
5556
|
|
|
5557
5557
|
|
|
5558
|
+
class MenuItemType extends ul4.Type
|
|
5559
|
+
{
|
|
5560
|
+
instancecheck(obj)
|
|
5561
|
+
{
|
|
5562
|
+
return obj instanceof MenuItem;
|
|
5563
|
+
}
|
|
5564
|
+
};
|
|
5565
|
+
|
|
5566
|
+
let menuitemtype = new MenuItemType("la", "MenuItem", "An additional menu item in an app that links to a target page.");
|
|
5567
|
+
|
|
5568
|
+
|
|
5569
|
+
export class MenuItem extends Base
|
|
5570
|
+
{
|
|
5571
|
+
[ul4.symbols.type]()
|
|
5572
|
+
{
|
|
5573
|
+
return menuitemtype;
|
|
5574
|
+
}
|
|
5575
|
+
|
|
5576
|
+
[ul4.symbols.repr]()
|
|
5577
|
+
{
|
|
5578
|
+
return "<MenuItem id=" + ul4._repr(this.id) + "identifier=" + ul4._repr(this.identifier) + " label=" + ul4._repr(this.label) + " type=" + ul4._repr(this.type) + ">";
|
|
5579
|
+
}
|
|
5580
|
+
};
|
|
5581
|
+
|
|
5582
|
+
MenuItem.prototype._ul4onattrs = ["app", "identifier", "label", "type", "icon", "title", "target", "cssclass", "url", "order", "start_time", "end_time", "on_app_overview_page", "on_app_detail_page", "on_form_page", "on_iframe_page", "on_custom_overview_page", "children", "createdat", "createdby", "updatedat", "updatedby"];
|
|
5583
|
+
MenuItem.prototype._ul4attrs = new Set(["id", "app", "identifier", "label", "type", "icon", "title", "target", "cssclass", "url", "order", "start_time", "end_time", "on_app_overview_page", "on_app_detail_page", "on_form_page", "on_iframe_page", "on_custom_overview_page", "children", "createdat", "createdby", "updatedat", "updatedby"]);
|
|
5584
|
+
|
|
5585
|
+
|
|
5586
|
+
class PanelType extends MenuItemType
|
|
5587
|
+
{
|
|
5588
|
+
instancecheck(obj)
|
|
5589
|
+
{
|
|
5590
|
+
return obj instanceof Panel;
|
|
5591
|
+
}
|
|
5592
|
+
};
|
|
5593
|
+
|
|
5594
|
+
let paneltype = new MenuItemType("la", "Panel", "An additional panel in an app that is displayed on various LivingApps pages and links to a target page.");
|
|
5595
|
+
|
|
5596
|
+
|
|
5597
|
+
export class Panel extends MenuItem
|
|
5598
|
+
{
|
|
5599
|
+
[ul4.symbols.type]()
|
|
5600
|
+
{
|
|
5601
|
+
return paneltype;
|
|
5602
|
+
}
|
|
5603
|
+
|
|
5604
|
+
[ul4.symbols.repr]()
|
|
5605
|
+
{
|
|
5606
|
+
return "<Panel id=" + ul4._repr(this.id) + "identifier=" + ul4._repr(this.identifier) + " label=" + ul4._repr(this.label) + " type=" + ul4._repr(this.type) + ">";
|
|
5607
|
+
}
|
|
5608
|
+
};
|
|
5609
|
+
|
|
5610
|
+
Panel.prototype._ul4onattrs = [...MenuItem.prototype._ul4onattrs, "description", "description_url", "image", "row", "column", "width", "height"];
|
|
5611
|
+
Panel.prototype._ul4attrs = new Set([...MenuItem.prototype._ul4attrs, "description", "description_url", "image", "row", "column", "width", "height"]);
|
|
5612
|
+
|
|
5613
|
+
|
|
5558
5614
|
class FormType extends ul4.Type
|
|
5559
5615
|
{
|
|
5560
5616
|
instancecheck(obj)
|
|
@@ -5724,6 +5780,8 @@ let classes = [
|
|
|
5724
5780
|
FlashMessage,
|
|
5725
5781
|
App,
|
|
5726
5782
|
View,
|
|
5783
|
+
MenuItem,
|
|
5784
|
+
Panel,
|
|
5727
5785
|
DataSource,
|
|
5728
5786
|
Record,
|
|
5729
5787
|
BoolControl,
|
|
@@ -5862,5 +5920,7 @@ export const module = new ul4.Module(
|
|
|
5862
5920
|
ViewLookupItem: ViewLookupItem,
|
|
5863
5921
|
Category: Category,
|
|
5864
5922
|
AppParameter: AppParameter,
|
|
5923
|
+
MenuItem: ItemItem,
|
|
5924
|
+
Panel: Panel,
|
|
5865
5925
|
}
|
|
5866
5926
|
);
|