@easydata/crud 1.3.6-rc01 → 1.4.0-beta01

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.
@@ -1477,7 +1477,7 @@ var http_client_HttpClient = /** @class */ (function () {
1477
1477
  }
1478
1478
  var responseContentType = xhr.getResponseHeader('Content-Type') || '';
1479
1479
  var status = xhr.status;
1480
- if (status >= 300 || status < 200) {
1480
+ if (status >= 400) {
1481
1481
  var rtPromise = (xhr.responseType === 'arraybuffer'
1482
1482
  || xhr.responseType === 'blob')
1483
1483
  ? HttpClient.decodeArrayBuffer(xhr.response)
@@ -2392,6 +2392,7 @@ var data_column_DataColumn = /** @class */ (function () {
2392
2392
  this.displayFormat = desc.dfmt;
2393
2393
  this.groupFooterColumnTemplate = desc.gfct;
2394
2394
  this.style = desc.style || {};
2395
+ this.description = desc.description;
2395
2396
  }
2396
2397
  return DataColumn;
2397
2398
  }());
@@ -2946,6 +2947,22 @@ var event_emitter_EventEmitter = /** @class */ (function () {
2946
2947
  }());
2947
2948
 
2948
2949
  //# sourceMappingURL=event_emitter.js.map
2950
+ // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/core/dist/lib/utils/liquid.js
2951
+ var liquid;
2952
+ (function (liquid) {
2953
+ function renderLiquidTemplate(template, vars) {
2954
+ var result = template;
2955
+ if (vars) {
2956
+ for (var v in vars) {
2957
+ var liquidVarRegexp = new RegExp('\{\{' + v + '\}\}', 'g');
2958
+ result = result.replace(liquidVarRegexp, vars[v]);
2959
+ }
2960
+ }
2961
+ return result;
2962
+ }
2963
+ liquid.renderLiquidTemplate = renderLiquidTemplate;
2964
+ })(liquid || (liquid = {}));
2965
+ //# sourceMappingURL=liquid.js.map
2949
2966
  // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/core/dist/lib/i18n/load_default_locale_settings.js
2950
2967
 
2951
2968
  i18n_i18n.resetLocales();
@@ -2977,6 +2994,7 @@ i18n_i18n.resetLocales();
2977
2994
 
2978
2995
 
2979
2996
 
2997
+
2980
2998
  if (typeof Object.values !== 'function') {
2981
2999
  Object.values = function (obj) {
2982
3000
  return Object.keys(obj).map(function (key) { return obj[key]; });
@@ -4292,6 +4310,7 @@ var easy_grid_columns_GridColumn = /** @class */ (function () {
4292
4310
  function GridColumn(column, grid, isRowNum) {
4293
4311
  if (isRowNum === void 0) { isRowNum = false; }
4294
4312
  this._label = null;
4313
+ this._description = null;
4295
4314
  //public left: number;
4296
4315
  this.align = GridColumnAlign.NONE;
4297
4316
  this.isVisible = true;
@@ -4318,6 +4337,7 @@ var easy_grid_columns_GridColumn = /** @class */ (function () {
4318
4337
  this.width = DEFAULT_WIDTH_STRING;
4319
4338
  }
4320
4339
  this.cellRenderer = this.grid.cellRendererStore.getDefaultRenderer(column.type);
4340
+ this._description = column.description;
4321
4341
  }
4322
4342
  else if (isRowNum) {
4323
4343
  this.isRowNum = true;
@@ -4340,6 +4360,14 @@ var easy_grid_columns_GridColumn = /** @class */ (function () {
4340
4360
  configurable: true
4341
4361
  });
4342
4362
  ;
4363
+ Object.defineProperty(GridColumn.prototype, "description", {
4364
+ /** Get column description. */
4365
+ get: function () {
4366
+ return this._description;
4367
+ },
4368
+ enumerable: true,
4369
+ configurable: true
4370
+ });
4343
4371
  Object.defineProperty(GridColumn.prototype, "type", {
4344
4372
  get: function () {
4345
4373
  return this.dataColumn ? this.dataColumn.type : null;
@@ -4682,6 +4710,12 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4682
4710
  }
4683
4711
  });
4684
4712
  };
4713
+ EasyGrid.prototype.getContainerWidth = function () {
4714
+ return this.columns.getItems()
4715
+ .filter(function (col) { return col.isVisible; })
4716
+ .map(function (col) { return col.width; })
4717
+ .reduce(function (sum, current) { return sum + current; });
4718
+ };
4685
4719
  EasyGrid.prototype.renderHeader = function () {
4686
4720
  var _this = this;
4687
4721
  this.headerDiv = domel('div')
@@ -4707,7 +4741,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4707
4741
  .addChildElement(_this.renderAddColumnButton());
4708
4742
  }
4709
4743
  });
4710
- var containerWidth = this.columns.getItems().map(function (column) { return column.width; }).reduce(function (sum, current) { return sum + current; });
4744
+ var containerWidth = this.getContainerWidth();
4711
4745
  domel(this.headerCellContainerDiv)
4712
4746
  .setStyle('width', containerWidth + "px");
4713
4747
  };
@@ -4732,6 +4766,11 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4732
4766
  .addClass(this.cssPrefix + "-header-cell-label")
4733
4767
  .text(column.label);
4734
4768
  }
4769
+ if (column.description) {
4770
+ domel('div', colDiv)
4771
+ .addClass('question-mark')
4772
+ .title(column.description);
4773
+ }
4735
4774
  if (this.options.allowDragDrop) {
4736
4775
  eqDragManager.registerDraggableItem({
4737
4776
  element: colDiv,
@@ -4801,8 +4840,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4801
4840
  _this.updateTotalsState(groups_1, row, true);
4802
4841
  }
4803
4842
  }
4804
- var containerWidth = _this.columns.getItems()
4805
- .map(function (column) { return column.width; }).reduce(function (sum, current) { return sum + current; });
4843
+ var containerWidth = _this.getContainerWidth();
4806
4844
  domel(_this.bodyCellContainerDiv)
4807
4845
  .setStyle('width', containerWidth + "px");
4808
4846
  return rows.length;
@@ -4962,7 +5000,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4962
5000
  for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
4963
5001
  var colId = _a[_i];
4964
5002
  var keyVal = row.getValue(colId);
4965
- if (caseInsensitive) {
5003
+ if (caseInsensitive && typeof (keyVal) === 'string') {
4966
5004
  keyVal = keyVal.toLowerCase();
4967
5005
  }
4968
5006
  result[colId] = keyVal;
@@ -6048,6 +6086,14 @@ var default_date_time_picker_DefaultDateTimePicker = /** @class */ (function (_s
6048
6086
  }(date_time_picker_DateTimePicker));
6049
6087
 
6050
6088
  //# sourceMappingURL=default_date_time_picker.js.map
6089
+ // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/dialogs/dialog_service.js
6090
+ var DialogFooterAlignment;
6091
+ (function (DialogFooterAlignment) {
6092
+ DialogFooterAlignment[DialogFooterAlignment["Left"] = 1] = "Left";
6093
+ DialogFooterAlignment[DialogFooterAlignment["Center"] = 2] = "Center";
6094
+ DialogFooterAlignment[DialogFooterAlignment["Right"] = 3] = "Right";
6095
+ })(DialogFooterAlignment || (DialogFooterAlignment = {}));
6096
+ //# sourceMappingURL=dialog_service.js.map
6051
6097
  // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/dialogs/default_dialog_service.js
6052
6098
  var default_dialog_service_extends = (undefined && undefined.__extends) || (function () {
6053
6099
  var extendStatics = function (d, b) {
@@ -6064,6 +6110,7 @@ var default_dialog_service_extends = (undefined && undefined.__extends) || (func
6064
6110
  })();
6065
6111
 
6066
6112
 
6113
+
6067
6114
  var default_dialog_service_cssPrefix = "kdlg";
6068
6115
  var DefaultDialogService = /** @class */ (function () {
6069
6116
  function DefaultDialogService() {
@@ -6147,17 +6194,20 @@ var DefaultDialogService = /** @class */ (function () {
6147
6194
  _this.open(options);
6148
6195
  });
6149
6196
  };
6150
- DefaultDialogService.prototype.open = function (options) {
6197
+ DefaultDialogService.prototype.open = function (options, data) {
6151
6198
  var _this = this;
6199
+ var dialog = new default_dialog_service_DefaultDialog(options, data);
6152
6200
  var onDestroy = options.onDestroy;
6153
- options.onDestroy = function () {
6201
+ options.onDestroy = function (dlg) {
6154
6202
  _this.untrack(dlg);
6155
- onDestroy && onDestroy();
6203
+ onDestroy && onDestroy(dlg);
6156
6204
  };
6157
- var dlg = new default_dialog_service_DefaultDialog(options);
6158
- dlg.open();
6159
- this.track(dlg);
6160
- return dlg;
6205
+ dialog.open();
6206
+ this.track(dialog);
6207
+ return dialog;
6208
+ };
6209
+ DefaultDialogService.prototype.createSet = function (options) {
6210
+ return new DefaultDialogSet(options, this);
6161
6211
  };
6162
6212
  DefaultDialogService.prototype.untrack = function (dlg) {
6163
6213
  var index = DefaultDialogService.openDialogs.indexOf(dlg);
@@ -6170,15 +6220,15 @@ var DefaultDialogService = /** @class */ (function () {
6170
6220
  };
6171
6221
  DefaultDialogService.prototype.openProgress = function (options) {
6172
6222
  var _this = this;
6223
+ var dialog = new default_dialog_service_DefaultProgressDialog(options);
6173
6224
  var onDestroy = options.onDestroy;
6174
- options.onDestroy = function () {
6225
+ options.onDestroy = function (dlg) {
6175
6226
  _this.untrack(dlg);
6176
- onDestroy && onDestroy();
6227
+ onDestroy && onDestroy(dlg);
6177
6228
  };
6178
- var dlg = new default_dialog_service_DefaultProgressDialog(options);
6179
- dlg.open();
6180
- this.track(dlg);
6181
- return dlg;
6229
+ dialog.open();
6230
+ this.track(dialog);
6231
+ return dialog;
6182
6232
  };
6183
6233
  DefaultDialogService.prototype.getAllDialogs = function () {
6184
6234
  return Array.from(DefaultDialogService.openDialogs);
@@ -6194,11 +6244,11 @@ var DefaultDialogService = /** @class */ (function () {
6194
6244
  }());
6195
6245
 
6196
6246
  var default_dialog_service_DefaultDialog = /** @class */ (function () {
6197
- function DefaultDialog(options) {
6247
+ function DefaultDialog(options, data) {
6198
6248
  var _this = this;
6199
6249
  this.options = options;
6200
- this.submitHandler = function () {
6201
- if (_this.options.onSubmit && _this.options.onSubmit() === false) {
6250
+ this.submitHandler = function (token) {
6251
+ if (_this.options.onSubmit && _this.options.onSubmit(_this, token) === false) {
6202
6252
  return false;
6203
6253
  }
6204
6254
  _this.destroy();
@@ -6206,7 +6256,7 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
6206
6256
  };
6207
6257
  this.cancelHandler = function () {
6208
6258
  if (_this.options.onCancel) {
6209
- _this.options.onCancel();
6259
+ _this.options.onCancel(_this);
6210
6260
  }
6211
6261
  _this.destroy();
6212
6262
  };
@@ -6221,11 +6271,12 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
6221
6271
  }
6222
6272
  return true;
6223
6273
  };
6224
- var id = utils_utils.generateId('dlg');
6274
+ this.dialogId = utils_utils.generateId('dlg');
6275
+ this.data = data;
6225
6276
  this.slot =
6226
6277
  domel('div', document.body)
6227
6278
  .attr('tab-index', '-1')
6228
- .data('dialog-id', id)
6279
+ .data('dialog-id', this.dialogId)
6229
6280
  .addClass(default_dialog_service_cssPrefix + "-modal", 'is-active')
6230
6281
  .focus()
6231
6282
  .addChild('div', function (b) { return b
@@ -6246,36 +6297,68 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
6246
6297
  _this.cancelHandler();
6247
6298
  })
6248
6299
  .focus(); });
6300
+ })
6301
+ .addChild('div', function (b) {
6302
+ b.addClass(default_dialog_service_cssPrefix + "-alert-container");
6303
+ _this.alertElement = b.toDOM();
6249
6304
  })
6250
6305
  .addChild('section', function (b) {
6251
6306
  _this.bodyElement = b
6252
6307
  .addClass(default_dialog_service_cssPrefix + "-body")
6253
6308
  .toDOM();
6254
6309
  if (typeof options.body === 'string') {
6255
- b.addHtml(options.body);
6310
+ var html = liquid.renderLiquidTemplate(options.body, data);
6311
+ b.addHtml(html);
6256
6312
  }
6257
6313
  else {
6258
6314
  b.addChildElement(options.body);
6259
6315
  }
6260
6316
  })
6261
- .addChild('div', function (b) { return _this.alertElement = b
6262
- .addClass(default_dialog_service_cssPrefix + "-alert-container")
6263
- .toDOM(); })
6264
6317
  .addChild('footer', function (b) {
6318
+ var alignClass = null;
6319
+ if (options.footerAlignment && options.footerAlignment == DialogFooterAlignment.Center) {
6320
+ alignClass = 'align-center';
6321
+ }
6322
+ else {
6323
+ alignClass = 'align-right';
6324
+ }
6265
6325
  _this.footerElement = b
6266
- .addClass(default_dialog_service_cssPrefix + "-footer", 'align-right')
6326
+ .addClass(default_dialog_service_cssPrefix + "-footer")
6267
6327
  .toDOM();
6328
+ b.addClass(alignClass);
6268
6329
  if (options.submitable === false)
6269
6330
  return;
6270
- b.addChild('button', function (b) { return b
6271
- .addClass('kfrm-button', 'is-info')
6272
- .addText(options.submitButtonText || i18n_i18n.getText('ButtonOK'))
6273
- .on('click', function (e) {
6274
- _this.submitHandler();
6275
- })
6276
- .focus(); });
6331
+ b.addChild('button', function (bb) {
6332
+ bb.id(_this.dialogId + '-btn-submit')
6333
+ .addClass('kfrm-button', 'is-info')
6334
+ .addText(options.submitButtonText || i18n_i18n.getText('ButtonOK'));
6335
+ if (options.recaptchaSiteKey) {
6336
+ bb.data('sitekey', options.recaptchaSiteKey);
6337
+ bb.addClass('g-recaptcha');
6338
+ bb.on('click', function (e) {
6339
+ if (grecaptcha) {
6340
+ grecaptcha.ready(function () {
6341
+ grecaptcha.execute(options.recaptchaSiteKey, { action: 'submit' })
6342
+ .then(function (token) {
6343
+ _this.submitHandler(token);
6344
+ });
6345
+ });
6346
+ }
6347
+ else {
6348
+ _this.submitHandler();
6349
+ }
6350
+ });
6351
+ }
6352
+ else {
6353
+ bb.on('click', function (e) {
6354
+ _this.submitHandler();
6355
+ });
6356
+ }
6357
+ bb.focus();
6358
+ });
6277
6359
  if (options.cancelable !== false)
6278
- b.addChild('button', function (builder) { return builder
6360
+ b.addChild('button', function (bb) { return bb
6361
+ .id(_this.dialogId + '-btn-cancel')
6279
6362
  .addClass('kfrm-button')
6280
6363
  .addText(options.cancelButtonText || i18n_i18n.getText('ButtonCancel'))
6281
6364
  .on('click', function (e) {
@@ -6285,12 +6368,22 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
6285
6368
  .toDOM(); })
6286
6369
  .toDOM();
6287
6370
  }
6371
+ DefaultDialog.prototype.getData = function () {
6372
+ return this.data;
6373
+ };
6288
6374
  DefaultDialog.prototype.getRootElement = function () {
6289
6375
  return this.slot;
6290
6376
  };
6377
+ DefaultDialog.prototype.getSubmitButtonElement = function () {
6378
+ return document.getElementById(this.dialogId + '-btn-submit');
6379
+ };
6380
+ DefaultDialog.prototype.getCancelButtonElement = function () {
6381
+ return document.getElementById(this.dialogId + '-btn-cancel');
6382
+ };
6291
6383
  DefaultDialog.prototype.open = function () {
6384
+ var _this = this;
6292
6385
  if (this.options.beforeOpen) {
6293
- this.options.beforeOpen();
6386
+ this.options.beforeOpen(this);
6294
6387
  }
6295
6388
  domel(this.slot).show();
6296
6389
  if (this.options.arrangeParents) {
@@ -6311,6 +6404,19 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
6311
6404
  if (this.options.submitOnEnter) {
6312
6405
  window.addEventListener('keydown', this.keydownHandler, false);
6313
6406
  }
6407
+ //clear alert on change in any input element
6408
+ this.slot.querySelectorAll('input')
6409
+ .forEach(function (element) {
6410
+ return element.addEventListener('input', function () {
6411
+ _this.clearAlert();
6412
+ if (_this.options.onInput) {
6413
+ _this.options.onInput(_this);
6414
+ }
6415
+ });
6416
+ });
6417
+ if (this.options.onShow) {
6418
+ this.options.onShow(this);
6419
+ }
6314
6420
  };
6315
6421
  DefaultDialog.prototype.submit = function () {
6316
6422
  this.submitHandler();
@@ -6350,6 +6456,9 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
6350
6456
  this.alertElement.innerHTML = '';
6351
6457
  };
6352
6458
  DefaultDialog.prototype.destroy = function () {
6459
+ var elem = document.querySelectorAll("[data-dialog-id=\"" + this.dialogId + "\"]");
6460
+ if (elem.length <= 0)
6461
+ return;
6353
6462
  if (this.options.arrangeParents) {
6354
6463
  this.arrangeParents(false);
6355
6464
  }
@@ -6358,7 +6467,7 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
6358
6467
  window.removeEventListener('keydown', this.keydownHandler, false);
6359
6468
  }
6360
6469
  if (this.options.onDestroy) {
6361
- this.options.onDestroy();
6470
+ this.options.onDestroy(this);
6362
6471
  }
6363
6472
  };
6364
6473
  DefaultDialog.prototype.isActiveDialog = function () {
@@ -6386,7 +6495,7 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
6386
6495
 
6387
6496
  var default_dialog_service_DefaultProgressDialog = /** @class */ (function (_super) {
6388
6497
  default_dialog_service_extends(DefaultProgressDialog, _super);
6389
- function DefaultProgressDialog(options) {
6498
+ function DefaultProgressDialog(options, data) {
6390
6499
  var _this = this;
6391
6500
  var contentElement;
6392
6501
  var progressElement;
@@ -6421,7 +6530,7 @@ var default_dialog_service_DefaultProgressDialog = /** @class */ (function (_sup
6421
6530
  cancelable: false,
6422
6531
  closable: false,
6423
6532
  onDestroy: options.onDestroy
6424
- }) || this;
6533
+ }, data) || this;
6425
6534
  _this.contentElement = contentElement;
6426
6535
  _this.progressElement = progressElement;
6427
6536
  return _this;
@@ -6450,6 +6559,53 @@ var default_dialog_service_DefaultProgressDialog = /** @class */ (function (_sup
6450
6559
  return DefaultProgressDialog;
6451
6560
  }(default_dialog_service_DefaultDialog));
6452
6561
 
6562
+ var DefaultDialogSet = /** @class */ (function () {
6563
+ function DefaultDialogSet(options, dialogService) {
6564
+ this.options = options;
6565
+ this.dialogService = dialogService;
6566
+ this.currentDialog = null;
6567
+ this.currentIndex = 0;
6568
+ this.options = options;
6569
+ this.dialogService = dialogService;
6570
+ }
6571
+ DefaultDialogSet.prototype.getCurrent = function () {
6572
+ return this.currentDialog;
6573
+ };
6574
+ DefaultDialogSet.prototype.openNext = function (data) {
6575
+ return this.open(this.currentIndex + 1, data);
6576
+ };
6577
+ DefaultDialogSet.prototype.openPrev = function (data) {
6578
+ return this.open(this.currentIndex - 1, data);
6579
+ };
6580
+ DefaultDialogSet.prototype.open = function (page, data) {
6581
+ if (page < 0) {
6582
+ this.currentIndex = 0;
6583
+ }
6584
+ else if (page >= this.options.length) {
6585
+ this.currentIndex = this.options.length - 1;
6586
+ }
6587
+ else {
6588
+ this.currentIndex = page;
6589
+ }
6590
+ if (this.currentDialog) {
6591
+ try {
6592
+ this.currentDialog.close();
6593
+ }
6594
+ catch (e) { }
6595
+ }
6596
+ var dlgOptions = this.options[this.currentIndex];
6597
+ this.currentDialog = this.dialogService.open(dlgOptions, data);
6598
+ return this.currentDialog;
6599
+ };
6600
+ DefaultDialogSet.prototype.close = function () {
6601
+ if (this.currentDialog) {
6602
+ this.currentDialog.close();
6603
+ this.currentDialog = null;
6604
+ }
6605
+ };
6606
+ return DefaultDialogSet;
6607
+ }());
6608
+
6453
6609
  //# sourceMappingURL=default_dialog_service.js.map
6454
6610
  // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/i18n/text_resources.js
6455
6611
 
@@ -6488,6 +6644,7 @@ addEasyDataUITexts();
6488
6644
 
6489
6645
 
6490
6646
 
6647
+
6491
6648
  // export dialogs to use outside of context as global
6492
6649
  var dialogs = new DefaultDialogService();
6493
6650
 
@@ -7245,9 +7402,17 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7245
7402
  .toDOM();
7246
7403
  }
7247
7404
  domel(parent)
7248
- .addChild('label', function (b) { return b
7249
- .attr('for', attr.id)
7250
- .addHtml(attr.caption + " " + (required ? '<sup style="color: red">*</sup>' : '') + ": "); });
7405
+ .addChild('label', function (b) {
7406
+ b.attr('for', attr.id);
7407
+ b.addHtml(attr.caption + " " + (required ? '<sup style="color: red">*</sup>' : '') + ": ");
7408
+ if (attr.description) {
7409
+ b.addChild('div', function (b) { return b
7410
+ .attr('title', attr.description)
7411
+ .addClass('question-mark')
7412
+ .setStyle('vertical-align', 'middle')
7413
+ .setStyle('display', 'inline-block'); });
7414
+ }
7415
+ });
7251
7416
  if (attr.kind === EntityAttrKind.Lookup) {
7252
7417
  this.setupLookupField(parent, attr, readOnly, value);
7253
7418
  return;