@livinglogic/livingapi 1.35.0 → 1.37.0
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 +23 -0
- package/README.md +2 -2
- package/dist/esm-node/livingapi.js +1 -1
- package/dist/esm-node/livingapi.js.map +1 -1
- package/dist/esm-npm/livingapi.js +1 -1
- package/dist/esm-npm/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 +80 -75
package/package.json
CHANGED
package/src/livingapi.js
CHANGED
|
@@ -889,7 +889,7 @@ export class AppLang extends LangBase
|
|
|
889
889
|
this.name = null;
|
|
890
890
|
this.description = null;
|
|
891
891
|
this.typename_grammatical_gender = null;
|
|
892
|
-
this.typenames =
|
|
892
|
+
this.typenames = new Map();
|
|
893
893
|
}
|
|
894
894
|
|
|
895
895
|
[ul4.symbols.type]()
|
|
@@ -897,6 +897,28 @@ export class AppLang extends LangBase
|
|
|
897
897
|
return applangtype;
|
|
898
898
|
}
|
|
899
899
|
|
|
900
|
+
[ul4.symbols.setattr](name, value)
|
|
901
|
+
{
|
|
902
|
+
if (name === "typenames")
|
|
903
|
+
{
|
|
904
|
+
if (ul4._isobject(value))
|
|
905
|
+
value = new Map(Object.entries(value));
|
|
906
|
+
else if (value !== null && !(value instanceof Map))
|
|
907
|
+
throw new ul4.ArgumentError(name + " must be None or a dict");
|
|
908
|
+
this.typenames = value;
|
|
909
|
+
}
|
|
910
|
+
else
|
|
911
|
+
super[ul4.symbols.setattr](name, value);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
_setDefaultUL4ONAttr(name)
|
|
915
|
+
{
|
|
916
|
+
if (name === "typenames")
|
|
917
|
+
this.typenames = new Map();
|
|
918
|
+
else
|
|
919
|
+
super._setDefaultUL4ONAttr(name);
|
|
920
|
+
}
|
|
921
|
+
|
|
900
922
|
[ul4.symbols.repr]()
|
|
901
923
|
{
|
|
902
924
|
return "<AppLang lang=" + ul4._repr(this.lang) + " name=" + ul4._repr(this.name) + ">";
|
|
@@ -905,7 +927,7 @@ export class AppLang extends LangBase
|
|
|
905
927
|
|
|
906
928
|
AppLang.prototype._ul4onattrs = ["app", "lang", "name", "description", "typename_grammatical_gender", "typenames"];
|
|
907
929
|
AppLang.prototype._ul4attrs = new Set(["id", "app", "lang", "name", "description", "typename_grammatical_gender", "typenames"]);
|
|
908
|
-
AppLang.prototype._settableattrs = new Set(["name", "description", "typename_grammatical_gender"]);
|
|
930
|
+
AppLang.prototype._settableattrs = new Set(["name", "description", "typename_grammatical_gender", "typenames"]);
|
|
909
931
|
|
|
910
932
|
|
|
911
933
|
class AppGroupLangType extends ul4.Type
|
|
@@ -1100,14 +1122,7 @@ export class App extends WithAttachments
|
|
|
1100
1122
|
|
|
1101
1123
|
get typename_nominative_singular()
|
|
1102
1124
|
{
|
|
1103
|
-
|
|
1104
|
-
if (translation !== null && translation.typenames !== null)
|
|
1105
|
-
{
|
|
1106
|
-
let value = translation.typenames.get("nom_sin");
|
|
1107
|
-
if (value !== null && value !== undefined)
|
|
1108
|
-
return value;
|
|
1109
|
-
}
|
|
1110
|
-
return this._typename_nominative_singular;
|
|
1125
|
+
return this.typename("nom_sin");
|
|
1111
1126
|
}
|
|
1112
1127
|
|
|
1113
1128
|
set typename_nominative_singular(value)
|
|
@@ -1117,14 +1132,7 @@ export class App extends WithAttachments
|
|
|
1117
1132
|
|
|
1118
1133
|
get typename_genitive_singular()
|
|
1119
1134
|
{
|
|
1120
|
-
|
|
1121
|
-
if (translation !== null && translation.typenames !== null)
|
|
1122
|
-
{
|
|
1123
|
-
let value = translation.typenames.get("gen_sin");
|
|
1124
|
-
if (value !== null && value !== undefined)
|
|
1125
|
-
return value;
|
|
1126
|
-
}
|
|
1127
|
-
return this._typename_genitive_singular;
|
|
1135
|
+
return this.typename("gen_sin");
|
|
1128
1136
|
}
|
|
1129
1137
|
|
|
1130
1138
|
set typename_genitive_singular(value)
|
|
@@ -1134,14 +1142,7 @@ export class App extends WithAttachments
|
|
|
1134
1142
|
|
|
1135
1143
|
get typename_dative_singular()
|
|
1136
1144
|
{
|
|
1137
|
-
|
|
1138
|
-
if (translation !== null && translation.typenames !== null)
|
|
1139
|
-
{
|
|
1140
|
-
let value = translation.typenames.get("dat_sin");
|
|
1141
|
-
if (value !== null && value !== undefined)
|
|
1142
|
-
return value;
|
|
1143
|
-
}
|
|
1144
|
-
return this._typename_dative_singular;
|
|
1145
|
+
return this.typename("dat_sin");
|
|
1145
1146
|
}
|
|
1146
1147
|
|
|
1147
1148
|
set typename_dative_singular(value)
|
|
@@ -1151,14 +1152,7 @@ export class App extends WithAttachments
|
|
|
1151
1152
|
|
|
1152
1153
|
get typename_accusative_singular()
|
|
1153
1154
|
{
|
|
1154
|
-
|
|
1155
|
-
if (translation !== null && translation.typenames !== null)
|
|
1156
|
-
{
|
|
1157
|
-
let value = translation.typenames.get("acc_sin");
|
|
1158
|
-
if (value !== null && value !== undefined)
|
|
1159
|
-
return value;
|
|
1160
|
-
}
|
|
1161
|
-
return this._typename_accusative_singular;
|
|
1155
|
+
return this.typename("acc_sin");
|
|
1162
1156
|
}
|
|
1163
1157
|
|
|
1164
1158
|
set typename_accusative_singular(value)
|
|
@@ -1168,14 +1162,7 @@ export class App extends WithAttachments
|
|
|
1168
1162
|
|
|
1169
1163
|
get typename_nominative_plural()
|
|
1170
1164
|
{
|
|
1171
|
-
|
|
1172
|
-
if (translation !== null && translation.typenames !== null)
|
|
1173
|
-
{
|
|
1174
|
-
let value = translation.typenames.get("nom_plu");
|
|
1175
|
-
if (value !== null && value !== undefined)
|
|
1176
|
-
return value;
|
|
1177
|
-
}
|
|
1178
|
-
return this._typename_nominative_plural;
|
|
1165
|
+
return this.typename("nom_plu");
|
|
1179
1166
|
}
|
|
1180
1167
|
|
|
1181
1168
|
set typename_nominative_plural(value)
|
|
@@ -1185,14 +1172,7 @@ export class App extends WithAttachments
|
|
|
1185
1172
|
|
|
1186
1173
|
get typename_genitive_plural()
|
|
1187
1174
|
{
|
|
1188
|
-
|
|
1189
|
-
if (translation !== null && translation.typenames !== null)
|
|
1190
|
-
{
|
|
1191
|
-
let value = translation.typenames.get("gen_plu");
|
|
1192
|
-
if (value !== null && value !== undefined)
|
|
1193
|
-
return value;
|
|
1194
|
-
}
|
|
1195
|
-
return this._typename_genitive_plural;
|
|
1175
|
+
return this.typename("gen_plu");
|
|
1196
1176
|
}
|
|
1197
1177
|
|
|
1198
1178
|
set typename_genitive_plural(value)
|
|
@@ -1202,14 +1182,7 @@ export class App extends WithAttachments
|
|
|
1202
1182
|
|
|
1203
1183
|
get typename_dative_plural()
|
|
1204
1184
|
{
|
|
1205
|
-
|
|
1206
|
-
if (translation !== null && translation.typenames !== null)
|
|
1207
|
-
{
|
|
1208
|
-
let value = translation.typenames.get("dat_plu");
|
|
1209
|
-
if (value !== null && value !== undefined)
|
|
1210
|
-
return value;
|
|
1211
|
-
}
|
|
1212
|
-
return this._typename_dative_plural;
|
|
1185
|
+
return this.typename("dat_plu");
|
|
1213
1186
|
}
|
|
1214
1187
|
|
|
1215
1188
|
set typename_dative_plural(value)
|
|
@@ -1219,14 +1192,7 @@ export class App extends WithAttachments
|
|
|
1219
1192
|
|
|
1220
1193
|
get typename_accusative_plural()
|
|
1221
1194
|
{
|
|
1222
|
-
|
|
1223
|
-
if (translation !== null && translation.typenames !== null)
|
|
1224
|
-
{
|
|
1225
|
-
let value = translation.typenames.get("acc_plu");
|
|
1226
|
-
if (value !== null && value !== undefined)
|
|
1227
|
-
return value;
|
|
1228
|
-
}
|
|
1229
|
-
return this._typename_accusative_plural;
|
|
1195
|
+
return this.typename("acc_plu");
|
|
1230
1196
|
}
|
|
1231
1197
|
|
|
1232
1198
|
set typename_accusative_plural(value)
|
|
@@ -1234,15 +1200,43 @@ export class App extends WithAttachments
|
|
|
1234
1200
|
this._typename_accusative_plural = value;
|
|
1235
1201
|
}
|
|
1236
1202
|
|
|
1237
|
-
|
|
1203
|
+
// Return the type name in the noun form ``form`` (e.g. ``nom_sin`` for
|
|
1204
|
+
// nominative singular).
|
|
1205
|
+
//
|
|
1206
|
+
// The form from the translation for the current language (``globals.lang``)
|
|
1207
|
+
// wins, then the form from the translation for the system language
|
|
1208
|
+
// (``app.lang``), then the (German) form stored in the app itself.
|
|
1209
|
+
// If none of them has the form ``null`` is returned.
|
|
1210
|
+
typename(form)
|
|
1238
1211
|
{
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1212
|
+
if (form === null)
|
|
1213
|
+
return null;
|
|
1214
|
+
if (typeof(form) !== "string")
|
|
1215
|
+
throw new ul4.TypeError("form must be None or a string");
|
|
1216
|
+
let typename = this._translation_typename(this.translations.get(), form);
|
|
1217
|
+
if (typename === null)
|
|
1218
|
+
typename = this._translation_typename(this.translations.get(this.lang), form);
|
|
1219
|
+
if (typename === null)
|
|
1220
|
+
typename = this._legacy_typename(form);
|
|
1221
|
+
return typename;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
// Return the type name in the noun form ``form`` from the translation
|
|
1225
|
+
// ``translation`` (or ``null`` if the translation doesn't have it).
|
|
1226
|
+
_translation_typename(translation, form)
|
|
1227
|
+
{
|
|
1228
|
+
if (translation === null || translation.typenames === null)
|
|
1229
|
+
return null;
|
|
1230
|
+
let value = translation.typenames.get(form);
|
|
1231
|
+
return value !== undefined ? value : null;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
// Return the type name in the noun form ``form`` from the eight (German)
|
|
1235
|
+
// forms stored in the app itself (or ``null`` if ``form`` isn't one of them).
|
|
1236
|
+
_legacy_typename(form)
|
|
1237
|
+
{
|
|
1238
|
+
let name = App._legacy_typename_attrs.get(form);
|
|
1239
|
+
return name !== undefined ? this[name] : null;
|
|
1246
1240
|
}
|
|
1247
1241
|
|
|
1248
1242
|
_dumpUL4ONAttr(name)
|
|
@@ -1467,14 +1461,25 @@ export class App extends WithAttachments
|
|
|
1467
1461
|
};
|
|
1468
1462
|
|
|
1469
1463
|
|
|
1464
|
+
App._legacy_typename_attrs = new Map([
|
|
1465
|
+
["nom_sin", "_typename_nominative_singular"],
|
|
1466
|
+
["gen_sin", "_typename_genitive_singular"],
|
|
1467
|
+
["dat_sin", "_typename_dative_singular"],
|
|
1468
|
+
["acc_sin", "_typename_accusative_singular"],
|
|
1469
|
+
["nom_plu", "_typename_nominative_plural"],
|
|
1470
|
+
["gen_plu", "_typename_genitive_plural"],
|
|
1471
|
+
["dat_plu", "_typename_dative_plural"],
|
|
1472
|
+
["acc_plu", "_typename_accusative_plural"],
|
|
1473
|
+
]);
|
|
1470
1474
|
App.prototype._ul4onattrs = ["globals", "internal_id", "_name", "_description", "lang", "appgroup", "_typename_grammatical_gender", "_typename_nominative_singular", "_typename_genitive_singular", "_typename_dative_singular", "_typename_accusative_singular", "_typename_nominative_plural", "_typename_genitive_plural", "_typename_dative_plural", "_typename_accusative_plural",
|
|
1471
1475
|
"startlink", "image", "createdby", "controls", "records", "record_start", "record_count", "record_total", "installation", "categories", "params", "views", "datamanagement_identifier", "basetable", "primarykey", "insertprocedure", "updateprocedure", "deleteprocedure", "templates", "createdat", "updatedat", "updatedby", "superid", "favorite", "_active_view", "datasource", "main", "ai_generated", "viewtemplates", "filter_default", "sort_default", "filter_owndata", "_permissions", "data_actions", "attachments", "order", "translations"];
|
|
1472
|
-
App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "translations", "lang", "appgroup", "group", "main", "order", "ai_generated", "typename_grammatical_gender", "typename_nominative_singular", "typename_genitive_singular", "typename_dative_singular", "typename_accusative_singular", "typename_nominative_plural", "typename_genitive_plural", "typename_dative_plural", "typename_accusative_plural", "
|
|
1476
|
+
App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "translations", "lang", "appgroup", "group", "main", "order", "ai_generated", "typename_grammatical_gender", "typename_nominative_singular", "typename_genitive_singular", "typename_dative_singular", "typename_accusative_singular", "typename_nominative_plural", "typename_genitive_plural", "typename_dative_plural", "typename_accusative_plural", "typename", "startlink", "image", "createdat", "createdby", "updatedat", "updatedby", "controls", "layout_controls", "records", "record_start", "record_count", "record_total", "installation", "categories", "params", "views", "menus", "panels", "datasource", "datamanagement_identifier", "insert", "favorite", "_active_view", "filter_default", "sort_default", "filter_owndata", "permissions", "data_actions", "attachments", "template_url", "new_embedded_url", "new_standalone_url", "home_url", "datamanagement_url", "import_url", "tasks_url", /*"formbuilder_url", "tasks_config_url",*/ "datamanagement_config_url", "permissions_url", "datamanageview_url"]);
|
|
1473
1477
|
ul4.expose(App.prototype[ul4.symbols.call], ["values", "**"], {"needsobject": true});
|
|
1474
1478
|
ul4.expose(App.prototype.insert, ["values", "**"], {"needsobject": true});
|
|
1475
1479
|
ul4.expose(App.prototype.template_url, ["identifier", "p", "record", "p=", null, "params", "**"]);
|
|
1476
1480
|
ul4.expose(App.prototype.new_embedded_url, ["params", "**"]);
|
|
1477
1481
|
ul4.expose(App.prototype.new_standalone_url, ["params", "**"]);
|
|
1482
|
+
ul4.expose(App.prototype.typename, ["form", "pk"]);
|
|
1478
1483
|
|
|
1479
1484
|
|
|
1480
1485
|
class AppGroupType extends ul4.Type
|