@osovitny/anatoly 1.2.7 → 1.2.9

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.
Files changed (25) hide show
  1. package/bundles/osovitny-anatoly.umd.js +101 -26
  2. package/bundles/osovitny-anatoly.umd.js.map +1 -1
  3. package/bundles/osovitny-anatoly.umd.min.js +2 -2
  4. package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
  5. package/esm2015/lib/core/alerts.js +53 -8
  6. package/esm2015/lib/core/components/html-editor/base-html-editor.component.js +45 -15
  7. package/esm2015/lib/core/components/html-editor/forms-html-editor.component.js +2 -2
  8. package/esm2015/lib/core/components/html-editor/html-editor.component.js +2 -2
  9. package/esm2015/lib/core/components/html-editor/html-editor.defaultoptions.js +2 -2
  10. package/esm2015/lib/core/components/validation/item-validation-summary.component.js +4 -4
  11. package/esm5/lib/core/alerts.js +53 -8
  12. package/esm5/lib/core/components/html-editor/base-html-editor.component.js +44 -14
  13. package/esm5/lib/core/components/html-editor/forms-html-editor.component.js +2 -2
  14. package/esm5/lib/core/components/html-editor/html-editor.component.js +2 -2
  15. package/esm5/lib/core/components/html-editor/html-editor.defaultoptions.js +2 -2
  16. package/esm5/lib/core/components/validation/item-validation-summary.component.js +4 -4
  17. package/fesm2015/osovitny-anatoly.js +102 -27
  18. package/fesm2015/osovitny-anatoly.js.map +1 -1
  19. package/fesm5/osovitny-anatoly.js +101 -26
  20. package/fesm5/osovitny-anatoly.js.map +1 -1
  21. package/lib/core/alerts.d.ts +3 -1
  22. package/lib/core/components/html-editor/base-html-editor.component.d.ts +9 -5
  23. package/lib/core/components/html-editor/forms-html-editor.component.d.ts +0 -1
  24. package/lib/core/components/validation/item-validation-summary.component.d.ts +2 -2
  25. package/package.json +1 -1
@@ -222,7 +222,7 @@
222
222
  }
223
223
  Alerts.Info = function (text) {
224
224
  Swal.fire({
225
- title: "Info!",
225
+ title: "Information",
226
226
  text: text,
227
227
  icon: "info",
228
228
  confirmButtonText: "OK"
@@ -230,7 +230,7 @@
230
230
  };
231
231
  Alerts.Warning = function (text) {
232
232
  Swal.fire({
233
- title: "warning!",
233
+ title: "Warning",
234
234
  text: text,
235
235
  icon: "warning",
236
236
  confirmButtonText: "OK"
@@ -238,7 +238,7 @@
238
238
  };
239
239
  Alerts.Error = function (text) {
240
240
  Swal.fire({
241
- title: "error!",
241
+ title: "Error",
242
242
  text: text,
243
243
  icon: "error",
244
244
  confirmButtonText: "OK"
@@ -280,7 +280,10 @@
280
280
  ;
281
281
  Alerts.Success = function (text, title, successAction) {
282
282
  if (typeof title == "undefined" || title == null)
283
- title = "Success!";
283
+ title = "Success";
284
+ if (!text) {
285
+ text = "Operation was successful";
286
+ }
284
287
  Swal.fire({
285
288
  title: title,
286
289
  text: text,
@@ -293,11 +296,53 @@
293
296
  }
294
297
  });
295
298
  };
296
- ;
297
299
  Alerts.Cancel = function (text) {
298
- Swal.fire('Cancelled', text, 'error');
300
+ if (!text) {
301
+ text = "Operation has been cancled";
302
+ }
303
+ Swal.fire({
304
+ title: 'Cancelled',
305
+ text: text,
306
+ icon: "info"
307
+ });
308
+ };
309
+ //Notifications
310
+ Alerts.NotificationCancel = function (text) {
311
+ if (!text) {
312
+ text = "Operation has been cancled";
313
+ }
314
+ var toast = Swal.mixin({
315
+ toast: true,
316
+ position: 'top-end',
317
+ showConfirmButton: false,
318
+ timer: 3000,
319
+ timerProgressBar: true
320
+ });
321
+ toast.fire({
322
+ title: 'Cancelled',
323
+ text: text,
324
+ icon: "info"
325
+ });
326
+ };
327
+ Alerts.NotificationSuccess = function (text, title) {
328
+ if (typeof title == "undefined" || title == null)
329
+ title = "Success";
330
+ if (!text) {
331
+ text = "Operation was successful";
332
+ }
333
+ var toast = Swal.mixin({
334
+ toast: true,
335
+ position: 'top-end',
336
+ showConfirmButton: false,
337
+ timer: 3000,
338
+ timerProgressBar: true
339
+ });
340
+ toast.fire({
341
+ title: title,
342
+ text: text,
343
+ icon: "success",
344
+ });
299
345
  };
300
- ;
301
346
  return Alerts;
302
347
  }());
303
348
 
@@ -775,14 +820,14 @@
775
820
  }
776
821
  __decorate([
777
822
  core.Input()
778
- ], ItemValidationSummaryComponent.prototype, "key", void 0);
823
+ ], ItemValidationSummaryComponent.prototype, "controlName", void 0);
779
824
  __decorate([
780
825
  core.Input()
781
- ], ItemValidationSummaryComponent.prototype, "title", void 0);
826
+ ], ItemValidationSummaryComponent.prototype, "controlTitle", void 0);
782
827
  ItemValidationSummaryComponent = __decorate([
783
828
  core.Component({
784
829
  selector: 'anatoly-item-validation-summary',
785
- template: "<ul class=\"list-unstyled\" *ngIf=\"isItemInvalid(key)\">\r\n <li *ngFor=\"let error of getValidationMessages(formGroup.get(key), title)\">\r\n <span class=\"help-block\">{{ error }}</span>\r\n </li>\r\n</ul>"
830
+ template: "<ul class=\"list-unstyled\" *ngIf=\"isItemInvalid(controlName)\">\r\n <li *ngFor=\"let error of getValidationMessages(formGroup.get(controlName), controlTitle)\">\r\n <span class=\"help-block\">{{ error }}</span>\r\n </li>\r\n</ul>\r\n"
786
831
  })
787
832
  ], ItemValidationSummaryComponent);
788
833
  return ItemValidationSummaryComponent;
@@ -817,7 +862,7 @@
817
862
  */
818
863
  imageUploadURL: '/api/HtmlEditor/UploadImage',
819
864
  imageAllowedTypes: ['jpeg', 'jpg', 'png'],
820
- imageUploadParams: { uploadType: '', uploadParentId: '' },
865
+ imageUploadParams: { uploadType: '', uploadParentId: '' }
821
866
  };
822
867
 
823
868
  /*
@@ -839,7 +884,8 @@
839
884
  __extends(BaseHtmlEditorComponent, _super);
840
885
  function BaseHtmlEditorComponent() {
841
886
  var _this = _super.call(this) || this;
842
- _this.editorInitialized = false;
887
+ _this.froalaEditorInitialized = false;
888
+ _this.afterInitializedActions = [];
843
889
  //General params
844
890
  _this.editorId = '';
845
891
  _this.editorLabelText = 'Html';
@@ -856,34 +902,63 @@
856
902
  if (key) {
857
903
  newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
858
904
  }
859
- /*
860
905
  if (newOptions.events && newOptions.events.initialized) {
861
906
  newOptions.events.initialized.overridden = false;
862
907
  }
908
+ newOptions.editorId = this.editorId;
909
+ /*
910
+ newOptions.froalaEditorInitialized = false;
911
+ newOptions.afterInitializedActions = this.afterInitializedActions;
863
912
  */
864
913
  this.options = newOptions;
865
914
  };
866
- BaseHtmlEditorComponent.prototype.doAfterEditorInitialized = function (action) {
915
+ BaseHtmlEditorComponent.prototype.ngAfterViewInit = function () {
916
+ /*
917
+ let that = this;
918
+ let elementId = ".htmleditor-" + this.editorId;
919
+
920
+ this.editor2 = new FroalaEditor(elementId, that.options, () => {
921
+ alert(that.options.editorId);
922
+ });
923
+ */
867
924
  var that = this;
868
- var timeOut = 500;
869
- if (this.editorInitialized) {
870
- timeOut = 100;
925
+ setTimeout(function () {
926
+ that.froalaEditorInitialized = true;
927
+ that.onInitialized();
928
+ }, 300);
929
+ };
930
+ BaseHtmlEditorComponent.prototype.onInitialized = function () {
931
+ var actions = this.afterInitializedActions;
932
+ //Clear actions
933
+ this.afterInitializedActions = [];
934
+ if (actions) {
935
+ for (var i = 0; i < actions.length; i++) {
936
+ actions[i]();
937
+ }
871
938
  }
872
- setTimeout(function () { action(that); }, timeOut);
939
+ //console.log("onInitialized: " + this.options.editorId);
873
940
  };
874
941
  BaseHtmlEditorComponent.prototype.getEditor = function () {
875
- if (this._control)
876
- return this._control.getEditor();
942
+ if (this.froalaEditor)
943
+ return this.froalaEditor.getEditor();
877
944
  return null;
878
945
  };
879
946
  //Public Funcs
947
+ BaseHtmlEditorComponent.prototype.doAfterInitialized = function (action) {
948
+ var that = this;
949
+ if (!this.froalaEditorInitialized) {
950
+ this.afterInitializedActions.push(function () { action(that); });
951
+ }
952
+ else {
953
+ action(that);
954
+ }
955
+ };
880
956
  BaseHtmlEditorComponent.prototype.initializeControl = function (control) {
881
- this._control = control;
882
- this._control.initialize();
883
- this.editorInitialized = true;
957
+ this.froalaEditor = control;
958
+ this.froalaEditor.initialize();
884
959
  };
885
960
  BaseHtmlEditorComponent.prototype.setUploadParams = function (uploadType, uploadParentId) {
886
- this.doAfterEditorInitialized(function (that) {
961
+ this.doAfterInitialized(function (that) {
887
962
  var editor = that.getEditor();
888
963
  if (typeof (editor) == "undefined" || editor == null) {
889
964
  return;
@@ -925,7 +1000,7 @@
925
1000
  return _super.call(this) || this;
926
1001
  }
927
1002
  HtmlEditorComponent.prototype.setHtml = function (content) {
928
- this.doAfterEditorInitialized(function (that) {
1003
+ this.doAfterInitialized(function (that) {
929
1004
  var editor = that.getEditor();
930
1005
  if (typeof (editor) == "undefined" || editor == null) {
931
1006
  return;
@@ -977,7 +1052,7 @@
977
1052
  FormsHtmlEditorComponent = __decorate([
978
1053
  core.Component({
979
1054
  selector: 'anatoly-forms-html-editor',
980
- template: "<div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isItemInvalid(editorFormKey) }\">\r\n <label class=\"control-label\">{{ editorLabelText }}</label>\r\n <textarea id=\"htmleditor-{{editorId}}\" class=\"htmleditor-{{editorId}}\"\r\n [formControlName]=\"editorFormKey\"\r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [key]=\"editorFormKey\"\r\n [title]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n </div>\r\n</div>\r\n"
1055
+ template: "<div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isItemInvalid(editorFormKey) }\">\r\n <label class=\"control-label\">{{ editorLabelText }}</label>\r\n <textarea id=\"htmleditor-{{editorId}}\" class=\"htmleditor-{{editorId}}\"\r\n [formControlName]=\"editorFormKey\"\r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [controlName]=\"editorFormKey\"\r\n [controlTitle]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n </div>\r\n</div>\r\n"
981
1056
  })
982
1057
  ], FormsHtmlEditorComponent);
983
1058
  return FormsHtmlEditorComponent;