@livinglogic/livingapi 1.12.0 → 1.14.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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@livinglogic/livingapi",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "description": "Javascript version of the LivingAPI classes of LivingApps",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/LivingLogic/LivingApps.Javascript.LivingAPI.git"
7
+ "url": "git+https://github.com/LivingLogic/LivingApps.Javascript.LivingAPI.git"
8
8
  },
9
9
  "publishConfig": {
10
10
  "access": "public"
package/src/livingapi.js CHANGED
@@ -60,7 +60,7 @@ export function element(name, ...args)
60
60
 
61
61
  function _append_param_to_url(urlparams, name, value)
62
62
  {
63
- if (ul4._islist(value))
63
+ if (ul4._islist(value) || ul4._isset(value))
64
64
  {
65
65
  for (let v of value)
66
66
  _append_param_to_url(urlparams, name, v);
@@ -783,8 +783,10 @@ export class App extends Base
783
783
  };
784
784
 
785
785
 
786
- App.prototype._ul4onattrs = ["globals", "name", "description", "lang", "startlink", "image", "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"];
787
- App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "lang", "startlink", "image", "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", "home_url", "datamanagement_url", "import_url", "tasks_url", /*"formbuilder_url", "tasks_config_url",*/ "datamanagement_config_url", "permissions_url", "datamanageview_url"]);
786
+ App.prototype._ul4onattrs = ["globals", "name", "description", "lang", "gramgen", "typename_nom_sin", "typename_gen_sin", "typename_dat_sin", "typename_acc_sin", "typename_nom_plu", "typename_gen_plu", "typename_dat_plu", "typename_acc_plu",
787
+ "startlink", "image", "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"];
788
+ App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "lang", "gramgen", "typename_nom_sin", "typename_gen_sin", "typename_dat_sin", "typename_acc_sin", "typename_nom_plu", "typename_gen_plu", "typename_dat_plu", "typename_acc_plu",
789
+ "startlink", "image", "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", "home_url", "datamanagement_url", "import_url", "tasks_url", /*"formbuilder_url", "tasks_config_url",*/ "datamanagement_config_url", "permissions_url", "datamanageview_url"]);
788
790
  ul4.expose(App.prototype[ul4.symbols.call], ["values", "**"], {"needsobject": true});
789
791
  ul4.expose(App.prototype.insert, ["values", "**"], {"needsobject": true});
790
792
  ul4.expose(App.prototype.template_url, ["identifier", "p", "record", "p=", null, "params", "**"]);
@@ -853,6 +855,62 @@ DataSource.prototype._ul4onattrs = ["identifier", "app", "apps"];
853
855
  DataSource.prototype._ul4attrs = new Set(["id", "identifier", "app", "apps"]);
854
856
 
855
857
 
858
+ class DataSourceChildrenType extends ul4.Type
859
+ {
860
+ instancecheck(obj)
861
+ {
862
+ return obj instanceof DataSourceChildren;
863
+ }
864
+ };
865
+
866
+ let datasourcechildrentype = new DataSourceChildrenType("la", "DataSourceChildren", "A master/detail specification in a data source");
867
+
868
+
869
+ export class DataSourceChildren extends Base
870
+ {
871
+ [ul4.symbols.type]()
872
+ {
873
+ return datasourcetypechildren;
874
+ }
875
+
876
+ [ul4.symbols.repr]()
877
+ {
878
+ return "<DataSourceChildren id=" + ul4._repr(this.id) + " identifier=" + ul4._repr(this.identifier) + ">";
879
+ }
880
+ };
881
+
882
+ DataSourceChildren.prototype._ul4onattrs = ["datasource", "identifier", "control"];
883
+ DataSourceChildren.prototype._ul4attrs = new Set(["id", "identifier", "datasource", "control"]);
884
+
885
+
886
+ class RecordChildrenType extends ul4.Type
887
+ {
888
+ instancecheck(obj)
889
+ {
890
+ return obj instanceof RecordChildren;
891
+ }
892
+ };
893
+
894
+ let recordchildrentype = new RecordChildrenType("la", "RecordChildren", "The child records of a master record");
895
+
896
+
897
+ export class RecordChildren extends Base
898
+ {
899
+ [ul4.symbols.type]()
900
+ {
901
+ return recordtypechildren;
902
+ }
903
+
904
+ [ul4.symbols.repr]()
905
+ {
906
+ return "<RecordChildren id=" + ul4._repr(this.id) + ">";
907
+ }
908
+ };
909
+
910
+ RecordChildren.prototype._ul4onattrs = ["record", "datasourcechildren", "records"];
911
+ RecordChildren.prototype._ul4attrs = new Set(["id", "record", "datasourcechildren", "records"]);
912
+
913
+
856
914
  class RecordType extends ul4.Type
857
915
  {
858
916
  instancecheck(obj)
@@ -878,7 +936,8 @@ export class Record extends Base
878
936
  this._sparsevalues = new Map();
879
937
  this._values = null;
880
938
  this._fields = null;
881
- this.children = new Map();
939
+ this.details = new Map();
940
+ this._children = null;
882
941
  this.attachments = null;
883
942
  this.errors = [];
884
943
  this._sparsefielderrors = null;
@@ -1003,6 +1062,19 @@ export class Record extends Base
1003
1062
  return this._fields;
1004
1063
  }
1005
1064
 
1065
+ get children()
1066
+ {
1067
+ if (this._children === null)
1068
+ {
1069
+ this._children = new Map();
1070
+ for (const recordchildren of this.details.values())
1071
+ {
1072
+ this._children.set(recordchildren.datasourcechildren.identifier, recordchildren.records);
1073
+ }
1074
+ }
1075
+ return this._children;
1076
+ }
1077
+
1006
1078
  is_dirty()
1007
1079
  {
1008
1080
  if (this.id === null)
@@ -1148,7 +1220,11 @@ export class Record extends Base
1148
1220
  [ul4.symbols.getattr](name)
1149
1221
  {
1150
1222
  if (name.startsWith("c_"))
1223
+ {
1151
1224
  return this.children.get(name.substr(2))
1225
+ }
1226
+ else if (name.startsWith("d_"))
1227
+ return this.details.get(name.substr(2))
1152
1228
  else if (name.startsWith("f_"))
1153
1229
  return this.fields.get(name.substr(2))
1154
1230
  else if (name.startsWith("v_"))
@@ -1168,8 +1244,8 @@ export class Record extends Base
1168
1244
  }
1169
1245
  };
1170
1246
 
1171
- Record.prototype._ul4onattrs = ["app", "createdat", "createdby", "updatedat", "updatedby", "updatecount", "_sparsevalues", "attachments", "children", "errors", "_sparsefielderrors", "_sparsefieldlookupdata"];
1172
- Record.prototype._ul4attrs = new Set(["id", "app", "createdat", "createdby", "updatedat", "updatedby", "updatecount", "values", "fields", "attachments", "children", "errors", "template_url", "edit_embedded_url", "edit_standalone_url"]);
1247
+ Record.prototype._ul4onattrs = ["app", "createdat", "createdby", "updatedat", "updatedby", "updatecount", "_sparsevalues", "attachments", "details", "errors", "_sparsefielderrors", "_sparsefieldlookupdata"];
1248
+ Record.prototype._ul4attrs = new Set(["id", "app", "createdat", "createdby", "updatedat", "updatedby", "updatecount", "values", "fields", "attachments", "details", "children", "errors", "template_url", "edit_embedded_url", "edit_standalone_url"]);
1173
1249
  ul4.expose(Record.prototype.is_dirty, []);
1174
1250
  ul4.expose(Record.prototype.has_errors, []);
1175
1251
  ul4.expose(Record.prototype.delete, []);
@@ -1260,6 +1336,16 @@ export class Field extends Base
1260
1336
  this._dom_label.textContent = this.label;
1261
1337
  }
1262
1338
 
1339
+ get mode()
1340
+ {
1341
+ return this._mode ?? this.control.mode;
1342
+ }
1343
+
1344
+ set mode(value)
1345
+ {
1346
+ this._mode = value;
1347
+ }
1348
+
1263
1349
  get label()
1264
1350
  {
1265
1351
  return this._label ?? this.control.label;
@@ -1568,7 +1654,7 @@ export class Field extends Base
1568
1654
  };
1569
1655
 
1570
1656
  Field.prototype._ul4onattrs = ["control", "record", "label", "value", "errors", "_visible", "_enabled", "_writable", "_required"];
1571
- Field.prototype._ul4attrs = new Set(["control", "record", "label", "value", "errors", "visible", "enabled", "writable", "required", "top", "left", "width", "height"]);
1657
+ Field.prototype._ul4attrs = new Set(["control", "record", "label", "value", "mode", "errors", "visible", "enabled", "writable", "required", "top", "left", "width", "height"]);
1572
1658
  Field.prototype._inputevent = "input";
1573
1659
 
1574
1660
 
@@ -1597,6 +1683,23 @@ export class BoolField extends Field
1597
1683
  if (this.control.required)
1598
1684
  change.errors.push(this.msg_field_required(change.value));
1599
1685
  }
1686
+ else if (typeof(change.value) === "string")
1687
+ {
1688
+ if (change.value.length === 0)
1689
+ {
1690
+ if (this.control.required)
1691
+ change.errors.push(this.msg_bool_truerequired(change.value));
1692
+ change.value = null;
1693
+ }
1694
+ else if (["false", "no", "0", "off"].includes(change.value.toLowerCase()))
1695
+ {
1696
+ change.value = false;
1697
+ }
1698
+ else
1699
+ {
1700
+ change.value = true;
1701
+ }
1702
+ }
1600
1703
  else if (typeof(change.value) === "boolean")
1601
1704
  {
1602
1705
  if (this.control.required && !change.value)
@@ -3450,7 +3553,7 @@ export class AppLookupChoiceField extends AppLookupField
3450
3553
  {
3451
3554
  constructor(control, record, value)
3452
3555
  {
3453
- super(null);
3556
+ super(control, record, value);
3454
3557
  this._search_url = null;
3455
3558
  this._search_param_name = null;
3456
3559
  this._target_param_name = null;
@@ -6044,6 +6147,8 @@ let classes = [
6044
6147
  MenuItem,
6045
6148
  Panel,
6046
6149
  DataSource,
6150
+ DataSourceChildren,
6151
+ RecordChildren,
6047
6152
  Record,
6048
6153
  BoolControl,
6049
6154
  IntControl,
@@ -6165,6 +6270,7 @@ export const module = new ul4.Module(
6165
6270
  FileSignatureControl: FileSignatureControl,
6166
6271
  GeoControl: GeoControl,
6167
6272
  ViewControl: ViewControl,
6273
+ RecordChildren: RecordChildren,
6168
6274
  Record: Record,
6169
6275
  FileAttachment: FileAttachment,
6170
6276
  URLAttachment: URLAttachment,
@@ -6176,6 +6282,7 @@ export const module = new ul4.Module(
6176
6282
  ButtonLayoutControl: ButtonLayoutControl,
6177
6283
  View: View,
6178
6284
  DataSource: DataSource,
6285
+ DataSourceChildren: DataSourceChildren,
6179
6286
  LookupItem: LookupItem,
6180
6287
  ViewLookupItem: ViewLookupItem,
6181
6288
  Category: Category,