aurelia-syncfusion-ej2-bridge 0.1.0-beta.9 → 1.0.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.
Files changed (54) hide show
  1. package/README.md +1 -0
  2. package/dist/commonjs/common/controlBase.d.ts +3 -1
  3. package/dist/commonjs/common/controlBase.js +13 -4
  4. package/dist/commonjs/common/syncfusionWrapper.d.ts +3 -0
  5. package/dist/commonjs/common/syncfusionWrapper.js +11 -2
  6. package/dist/commonjs/configBuider.d.ts +2 -0
  7. package/dist/commonjs/configBuider.js +12 -2
  8. package/dist/commonjs/controlBindings.d.ts +10 -0
  9. package/dist/commonjs/controlBindings.js +70 -38
  10. package/dist/commonjs/widgets/button/ej2-button.d.ts +1 -1
  11. package/dist/commonjs/widgets/button/ej2-button.js +9 -7
  12. package/dist/commonjs/widgets/checkbox/ej2-checkbox-list.js +0 -1
  13. package/dist/commonjs/widgets/checkbox/ej2-checkbox.js +1 -2
  14. package/dist/commonjs/widgets/grid/ej2-grid.js +22 -22
  15. package/dist/commonjs/widgets/listView/ej2-listView.js +1 -1
  16. package/dist/commonjs/widgets/multiSelect/ej2-multiSelect.d.ts +10 -0
  17. package/dist/commonjs/widgets/multiSelect/ej2-multiSelect.js +44 -0
  18. package/dist/commonjs/widgets/progressButton/ej2-progress-button.d.ts +1 -1
  19. package/dist/commonjs/widgets/progressButton/ej2-progress-button.js +8 -6
  20. package/dist/commonjs/widgets/radio/ej2-radio.js +3 -3
  21. package/dist/commonjs/widgets/schedule/ej2-schedule.d.ts +8 -0
  22. package/dist/commonjs/widgets/schedule/ej2-schedule.js +32 -0
  23. package/dist/commonjs/widgets/splitter/ej2-splitter.js +0 -2
  24. package/dist/commonjs/widgets/switch/ej2-switch.d.ts +2 -1
  25. package/dist/commonjs/widgets/switch/ej2-switch.js +8 -4
  26. package/dist/commonjs/widgets/uploader/ej2-uploader.d.ts +7 -1
  27. package/dist/commonjs/widgets/uploader/ej2-uploader.js +65 -29
  28. package/dist/native-modules/common/controlBase.d.ts +3 -1
  29. package/dist/native-modules/common/controlBase.js +13 -4
  30. package/dist/native-modules/common/syncfusionWrapper.d.ts +3 -0
  31. package/dist/native-modules/common/syncfusionWrapper.js +11 -2
  32. package/dist/native-modules/configBuider.d.ts +2 -0
  33. package/dist/native-modules/configBuider.js +12 -2
  34. package/dist/native-modules/controlBindings.d.ts +10 -0
  35. package/dist/native-modules/controlBindings.js +70 -38
  36. package/dist/native-modules/widgets/button/ej2-button.d.ts +1 -1
  37. package/dist/native-modules/widgets/button/ej2-button.js +9 -7
  38. package/dist/native-modules/widgets/checkbox/ej2-checkbox-list.js +0 -1
  39. package/dist/native-modules/widgets/checkbox/ej2-checkbox.js +2 -3
  40. package/dist/native-modules/widgets/grid/ej2-grid.js +22 -22
  41. package/dist/native-modules/widgets/listView/ej2-listView.js +1 -1
  42. package/dist/native-modules/widgets/multiSelect/ej2-multiSelect.d.ts +10 -0
  43. package/dist/native-modules/widgets/multiSelect/ej2-multiSelect.js +41 -0
  44. package/dist/native-modules/widgets/progressButton/ej2-progress-button.d.ts +1 -1
  45. package/dist/native-modules/widgets/progressButton/ej2-progress-button.js +8 -6
  46. package/dist/native-modules/widgets/radio/ej2-radio.js +3 -3
  47. package/dist/native-modules/widgets/schedule/ej2-schedule.d.ts +8 -0
  48. package/dist/native-modules/widgets/schedule/ej2-schedule.js +29 -0
  49. package/dist/native-modules/widgets/splitter/ej2-splitter.js +0 -2
  50. package/dist/native-modules/widgets/switch/ej2-switch.d.ts +2 -1
  51. package/dist/native-modules/widgets/switch/ej2-switch.js +8 -4
  52. package/dist/native-modules/widgets/uploader/ej2-uploader.d.ts +7 -1
  53. package/dist/native-modules/widgets/uploader/ej2-uploader.js +65 -29
  54. package/package.json +9 -4
@@ -17,70 +17,70 @@ let Ej2Grid = class Ej2Grid extends syncfusionWrapper_1.SyncfusionWrapper {
17
17
  this.syncfusionWidgetType = ej2_grids_1.Grid;
18
18
  }
19
19
  onBeforeWidgetInstantiation() {
20
- if (this.eModel.allowPaging) {
20
+ if (this._eModel.allowPaging) {
21
21
  ej2_grids_1.Grid.Inject(ej2_grids_1.Page);
22
22
  }
23
- if (this.eModel.allowSelection) {
23
+ if (this._eModel.allowSelection) {
24
24
  ej2_grids_1.Grid.Inject(ej2_grids_1.Selection);
25
25
  }
26
- if (this.eModel.editSettings) {
26
+ if (this._eModel.editSettings) {
27
27
  ej2_grids_1.Grid.Inject(ej2_grids_1.Edit);
28
28
  }
29
- if (this.eModel.allowReordering) {
29
+ if (this._eModel.allowReordering) {
30
30
  ej2_grids_1.Grid.Inject(ej2_grids_1.Reorder);
31
31
  }
32
- if (this.eModel.allowSorting) {
32
+ if (this._eModel.allowSorting) {
33
33
  ej2_grids_1.Grid.Inject(ej2_grids_1.Sort);
34
34
  }
35
- if (this.eModel.showColumnChooser) {
35
+ if (this._eModel.showColumnChooser) {
36
36
  ej2_grids_1.Grid.Inject(ej2_grids_1.ColumnChooser);
37
37
  }
38
- if (this.eModel.toolbar) {
38
+ if (this._eModel.toolbar) {
39
39
  ej2_grids_1.Grid.Inject(ej2_grids_1.Toolbar);
40
40
  }
41
- if (this.eModel.editSettings) {
41
+ if (this._eModel.editSettings) {
42
42
  ej2_grids_1.Grid.Inject(ej2_grids_1.Edit);
43
43
  }
44
- if (this.eModel.filterSettings) {
44
+ if (this._eModel.filterSettings) {
45
45
  ej2_grids_1.Grid.Inject(ej2_grids_1.Filter);
46
46
  }
47
- if (this.eModel.groupSettings) {
47
+ if (this._eModel.groupSettings) {
48
48
  ej2_grids_1.Grid.Inject(ej2_grids_1.Group);
49
49
  }
50
- if (this.eModel.aggregates) {
50
+ if (this._eModel.aggregates) {
51
51
  ej2_grids_1.Grid.Inject(ej2_grids_1.Aggregate);
52
52
  }
53
- if (this.eModel.showColumnMenu) {
53
+ if (this._eModel.showColumnMenu) {
54
54
  ej2_grids_1.Grid.Inject(ej2_grids_1.ColumnMenu);
55
55
  }
56
- if (this.eModel.detailTemplate) {
56
+ if (this._eModel.detailTemplate) {
57
57
  ej2_grids_1.Grid.Inject(ej2_grids_1.DetailRow);
58
58
  }
59
- if (this.eModel.contextMenuItems) {
59
+ if (this._eModel.contextMenuItems) {
60
60
  ej2_grids_1.Grid.Inject(ej2_grids_1.ContextMenu);
61
61
  }
62
- if (this.eModel.frozenColumns || this.eModel.frozenRows) {
62
+ if (this._eModel.frozenColumns || this._eModel.frozenRows) {
63
63
  ej2_grids_1.Grid.Inject(ej2_grids_1.Freeze);
64
64
  }
65
- if (this.eModel.allowResizing) {
65
+ if (this._eModel.allowResizing) {
66
66
  ej2_grids_1.Grid.Inject(ej2_grids_1.Resize);
67
67
  }
68
- if (this.eModel.allowRowDragAndDrop) {
68
+ if (this._eModel.allowRowDragAndDrop) {
69
69
  ej2_grids_1.Grid.Inject(ej2_grids_1.RowDD);
70
70
  }
71
- if (this.eModel.searchSettings) {
71
+ if (this._eModel.searchSettings) {
72
72
  ej2_grids_1.Grid.Inject(ej2_grids_1.Search);
73
73
  }
74
- if (this.eModel.printMode) {
74
+ if (this._eModel.printMode) {
75
75
  ej2_grids_1.Grid.Inject(ej2_grids_1.Print);
76
76
  }
77
- if (this.eModel.enableVirtualization) {
77
+ if (this._eModel.enableVirtualization) {
78
78
  ej2_grids_1.Grid.Inject(ej2_grids_1.VirtualScroll);
79
79
  }
80
- if (this.eModel.allowExcelExport) {
80
+ if (this._eModel.allowExcelExport) {
81
81
  ej2_grids_1.Grid.Inject(ej2_grids_1.ExcelExport);
82
82
  }
83
- if (this.eModel.allowPdfExport) {
83
+ if (this._eModel.allowPdfExport) {
84
84
  ej2_grids_1.Grid.Inject(ej2_grids_1.PdfExport);
85
85
  }
86
86
  }
@@ -21,7 +21,7 @@ let Ej2ListView = class Ej2ListView extends syncfusionWrapper_1.SyncfusionWrappe
21
21
  onWidgetCreated() {
22
22
  }
23
23
  onBeforeWidgetInstantiation() {
24
- if (this.eModel.enableVirtualization) {
24
+ if (this._eModel.enableVirtualization) {
25
25
  ej2_lists_1.ListView.Inject(ej2_lists_1.Virtualization);
26
26
  }
27
27
  }
@@ -0,0 +1,10 @@
1
+ import { SyncfusionWrapper } from "../../common/syncfusionWrapper";
2
+ import { MultiSelect, MultiSelectModel } from "@syncfusion/ej2-dropdowns";
3
+ export declare class Ej2MultiSelect extends SyncfusionWrapper<MultiSelect, MultiSelectModel> {
4
+ protected syncfusionWidgetType: typeof MultiSelect;
5
+ protected onWrapperCreated(): void;
6
+ protected onWidgetCreated(): void;
7
+ onInput(args: any): void;
8
+ onChange(args: any): void;
9
+ attached(): void;
10
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Ej2MultiSelect = void 0;
10
+ const constants_1 = require("../../common/constants");
11
+ const syncfusionWrapper_1 = require("../../common/syncfusionWrapper");
12
+ const ej2_dropdowns_1 = require("@syncfusion/ej2-dropdowns");
13
+ const decorator_1 = require("../../utilities/decorator");
14
+ const ej2_base_1 = require("@syncfusion/ej2-base");
15
+ const aurelia_framework_1 = require("aurelia-framework");
16
+ ej2_base_1.enableRipple(true);
17
+ let Ej2MultiSelect = class Ej2MultiSelect extends syncfusionWrapper_1.SyncfusionWrapper {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.syncfusionWidgetType = ej2_dropdowns_1.MultiSelect;
21
+ }
22
+ onWrapperCreated() {
23
+ }
24
+ onWidgetCreated() {
25
+ let _this = this;
26
+ this.widget.addEventListener("change", (args) => { _this.onChange(args); });
27
+ }
28
+ onInput(args) {
29
+ this[`${constants_1.constants.bindablePrefix}value`] = args.value;
30
+ }
31
+ onChange(args) {
32
+ this[`${constants_1.constants.bindablePrefix}value`] = args.value;
33
+ }
34
+ attached() {
35
+ this.widgetElement = this.element.querySelector("select,input");
36
+ super.attached();
37
+ }
38
+ };
39
+ Ej2MultiSelect = __decorate([
40
+ decorator_1.generateBindables("multiSelect"),
41
+ aurelia_framework_1.inlineView(`<template><div><slot><input /></slot></div></template>`),
42
+ aurelia_framework_1.customElement('ej2-multi-select')
43
+ ], Ej2MultiSelect);
44
+ exports.Ej2MultiSelect = Ej2MultiSelect;
@@ -2,10 +2,10 @@ import { ProgressButton, ProgressButtonModel } from '@syncfusion/ej2-splitbutton
2
2
  import { SyncfusionWrapper } from '../../common/syncfusionWrapper';
3
3
  export declare class Ej2ProgressButton extends SyncfusionWrapper<ProgressButton, ProgressButtonModel> {
4
4
  clickEvent: Event;
5
+ _onClick: (event: Event) => void;
5
6
  protected onWidgetCreated(): void;
6
7
  protected onWrapperCreated(): void;
7
8
  protected syncfusionWidgetType: typeof ProgressButton;
8
- _onClick(event: Event): void;
9
9
  refresh(): void;
10
10
  focusIn(): void;
11
11
  click(): void;
@@ -15,20 +15,22 @@ let Ej2ProgressButton = class Ej2ProgressButton extends syncfusionWrapper_1.Sync
15
15
  constructor() {
16
16
  super(...arguments);
17
17
  this.clickEvent = null;
18
+ this._onClick = null;
18
19
  this.syncfusionWidgetType = ej2_splitbuttons_1.ProgressButton;
19
20
  }
20
21
  onWidgetCreated() {
21
- this.widget.element.addEventListener("click", this._onClick.bind(this));
22
+ let _this = this;
23
+ this._onClick = (event) => {
24
+ _this.element.dispatchEvent(_this.clickEvent);
25
+ event.stopPropagation();
26
+ };
27
+ this.widget.element.addEventListener("click", this._onClick, false);
22
28
  }
23
29
  onWrapperCreated() {
24
30
  this.clickEvent = new CustomEvent("on-click", {
25
31
  bubbles: true
26
32
  });
27
33
  }
28
- _onClick(event) {
29
- this.element.dispatchEvent(this.clickEvent);
30
- event.stopPropagation();
31
- }
32
34
  refresh() {
33
35
  this.widget.refresh();
34
36
  }
@@ -51,7 +53,7 @@ let Ej2ProgressButton = class Ej2ProgressButton extends syncfusionWrapper_1.Sync
51
53
  this.widget.stop();
52
54
  }
53
55
  detached() {
54
- this.widget.element.removeEventListener("click", this._onClick);
56
+ this.widget.element.removeEventListener("click", this._onClick, false);
55
57
  }
56
58
  };
57
59
  Ej2ProgressButton = __decorate([
@@ -24,17 +24,17 @@ let Ej2Radio = class Ej2Radio extends syncfusionWrapper_1.SyncfusionWrapper {
24
24
  onWrapperCreated() {
25
25
  }
26
26
  onBind() {
27
- if (!this.eModel.name) {
27
+ if (!this._eModel.name) {
28
28
  throw "Radio e-name is required";
29
29
  }
30
30
  this.widget.change = () => {
31
31
  this[`${constants_1.constants.bindablePrefix}checked`] = this.widget.checked;
32
- this.eventAggregator.publish(`ej2-radio-${this.eModel.name}-changed`, this[`${constants_1.constants.bindablePrefix}label`]);
32
+ this.eventAggregator.publish(`ej2-radio-${this._eModel.name}-changed`, this[`${constants_1.constants.bindablePrefix}label`]);
33
33
  };
34
34
  this.checkedSubscription = this.bindingEngine.propertyObserver(this, this[`${constants_1.constants.bindablePrefix}checked`]).subscribe((newValue) => {
35
35
  this.widget.checked = newValue;
36
36
  });
37
- this.selectionChangedSubscription = this.eventAggregator.subscribe(`ej2-radio-${this.eModel.name}-changed`, (selectedLabel) => {
37
+ this.selectionChangedSubscription = this.eventAggregator.subscribe(`ej2-radio-${this._eModel.name}-changed`, (selectedLabel) => {
38
38
  if (this[`${constants_1.constants.bindablePrefix}label`] !== selectedLabel) {
39
39
  this[`${constants_1.constants.bindablePrefix}checked`] = false;
40
40
  }
@@ -0,0 +1,8 @@
1
+ import { Schedule, ScheduleModel } from '@syncfusion/ej2-schedule';
2
+ import { SyncfusionWrapper } from '../../common/syncfusionWrapper';
3
+ export declare class Ej2Schedule extends SyncfusionWrapper<Schedule, ScheduleModel> {
4
+ protected syncfusionWidgetType: any;
5
+ protected onWrapperCreated(): void;
6
+ protected onWidgetCreated(): void;
7
+ onBeforeWidgetInstantiation(): void;
8
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Ej2Schedule = void 0;
10
+ const aurelia_framework_1 = require("aurelia-framework");
11
+ const ej2_schedule_1 = require("@syncfusion/ej2-schedule");
12
+ const decorator_1 = require("../../utilities/decorator");
13
+ const syncfusionWrapper_1 = require("../../common/syncfusionWrapper");
14
+ let Ej2Schedule = class Ej2Schedule extends syncfusionWrapper_1.SyncfusionWrapper {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.syncfusionWidgetType = ej2_schedule_1.Schedule;
18
+ }
19
+ onWrapperCreated() {
20
+ }
21
+ onWidgetCreated() {
22
+ }
23
+ onBeforeWidgetInstantiation() {
24
+ ej2_schedule_1.Schedule.Inject(ej2_schedule_1.Day, ej2_schedule_1.Week, ej2_schedule_1.WorkWeek, ej2_schedule_1.Month, ej2_schedule_1.Agenda, ej2_schedule_1.TimelineViews, ej2_schedule_1.TimelineMonth, ej2_schedule_1.TimelineYear, ej2_schedule_1.DragAndDrop, ej2_schedule_1.Resize, ej2_schedule_1.ExcelExport, ej2_schedule_1.ICalendarExport, ej2_schedule_1.ICalendarImport, ej2_schedule_1.Print);
25
+ }
26
+ };
27
+ Ej2Schedule = __decorate([
28
+ decorator_1.generateBindables("radio"),
29
+ aurelia_framework_1.inlineView(`<template><div element.ref="widgetElement"></div></template>`),
30
+ aurelia_framework_1.customElement('ej2-schedule')
31
+ ], Ej2Schedule);
32
+ exports.Ej2Schedule = Ej2Schedule;
@@ -17,10 +17,8 @@ let Ej2Splitter = class Ej2Splitter extends syncfusionWrapper_1.SyncfusionWrappe
17
17
  this.syncfusionWidgetType = ej2_layouts_1.Splitter;
18
18
  }
19
19
  onWrapperCreated() {
20
- this.debug("splitter wrapper created");
21
20
  }
22
21
  onWidgetCreated() {
23
- this.debug("splitter widget created", this.widget);
24
22
  }
25
23
  };
26
24
  Ej2Splitter = __decorate([
@@ -3,8 +3,9 @@ import { Switch, SwitchModel } from '@syncfusion/ej2-buttons';
3
3
  export declare class Ej2Switch extends SyncfusionWrapper<Switch, SwitchModel> {
4
4
  protected syncfusionWidgetType: typeof Switch;
5
5
  private id;
6
+ private onChange;
6
7
  protected onWrapperCreated(): void;
7
8
  protected onWidgetCreated(): void;
8
- onChange(args: any): void;
9
9
  recreate(): void;
10
+ detached(): void;
10
11
  }
@@ -17,6 +17,7 @@ let Ej2Switch = class Ej2Switch extends syncfusionWrapper_1.SyncfusionWrapper {
17
17
  super(...arguments);
18
18
  this.syncfusionWidgetType = ej2_buttons_1.Switch;
19
19
  this.id = null;
20
+ this.onChange = null;
20
21
  }
21
22
  onWrapperCreated() {
22
23
  this.id = this.element.getAttribute("id");
@@ -27,10 +28,10 @@ let Ej2Switch = class Ej2Switch extends syncfusionWrapper_1.SyncfusionWrapper {
27
28
  }
28
29
  onWidgetCreated() {
29
30
  let _this = this;
30
- this.widget.addEventListener("change", (args) => { _this.onChange(args); });
31
- }
32
- onChange(args) {
33
- this[`${constants_1.constants.bindablePrefix}checked`] = args.checked;
31
+ this.onChange = (args) => {
32
+ _this[`${constants_1.constants.bindablePrefix}checked`] = args.checked;
33
+ };
34
+ this.widget.addEventListener("change", this.onChange);
34
35
  }
35
36
  recreate() {
36
37
  if (this.id) {
@@ -39,6 +40,9 @@ let Ej2Switch = class Ej2Switch extends syncfusionWrapper_1.SyncfusionWrapper {
39
40
  this.element.setAttribute("id", this.id);
40
41
  super.recreate();
41
42
  }
43
+ detached() {
44
+ this.widget.removeEventListener("change", this.onChange);
45
+ }
42
46
  };
43
47
  Ej2Switch = __decorate([
44
48
  decorator_1.generateBindables("switch"),
@@ -3,6 +3,7 @@ import { Uploader, UploaderModel, RemovingEventArgs } from "@syncfusion/ej2-inpu
3
3
  import { SyncfusionWrapper } from "../../common/syncfusionWrapper";
4
4
  export declare class Ej2Uploader extends SyncfusionWrapper<Uploader, UploaderModel> {
5
5
  private _filesProperty;
6
+ private originalFiles;
6
7
  private _filesCollectionSubscription;
7
8
  private _privateIdProperty;
8
9
  protected syncfusionWidgetType: typeof Uploader;
@@ -15,13 +16,18 @@ export declare class Ej2Uploader extends SyncfusionWrapper<Uploader, UploaderMod
15
16
  dataAdapter: Ej2UploaderDataAdapter;
16
17
  autoRemoveServerFiles: boolean;
17
18
  context: any;
19
+ files: any[];
20
+ private firstBind;
18
21
  private get _files();
19
22
  serverDelete: boolean;
20
23
  protected onWrapperCreated(): void;
21
- filesChanged(): void;
24
+ onfilesChanged(): void;
25
+ recreating(): void;
26
+ recreated(): void;
22
27
  initializeFileCollection(): void;
23
28
  initializeFile(widgetFile: any, i: any, extraProperties: any): void;
24
29
  protected onWidgetCreated(): void;
30
+ onBind(): void;
25
31
  createFilesCollectionSubscription(): Disposable;
26
32
  change(): void;
27
33
  getFilesThatWereRemoved(): any[];
@@ -15,12 +15,13 @@ const ej2_inputs_1 = require("@syncfusion/ej2-inputs");
15
15
  const syncfusionWrapper_1 = require("../../common/syncfusionWrapper");
16
16
  const decorator_1 = require("../../utilities/decorator");
17
17
  const aurelia_framework_1 = require("aurelia-framework");
18
- const uid = require("uuid/v4");
18
+ const uuid_1 = require("uuid");
19
19
  const aurelia_framework_2 = require("aurelia-framework");
20
20
  let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrapper {
21
21
  constructor() {
22
22
  super(...arguments);
23
23
  this._filesProperty = `${constants_1.constants.bindablePrefix}files`;
24
+ this.originalFiles = null;
24
25
  this._filesCollectionSubscription = null;
25
26
  this._privateIdProperty = "__id";
26
27
  this.syncfusionWidgetType = ej2_inputs_1.Uploader;
@@ -33,13 +34,14 @@ let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrappe
33
34
  this.dataAdapter = null;
34
35
  this.autoRemoveServerFiles = true;
35
36
  this.context = null;
37
+ this.files = null;
38
+ this.firstBind = true;
36
39
  this.serverDelete = true;
37
40
  }
38
41
  get _files() {
39
42
  return this[this._filesProperty];
40
43
  }
41
44
  onWrapperCreated() {
42
- this.debug("wrapper created");
43
45
  this.widget.uploading = (args) => { this.onFileUpload(args); };
44
46
  this.widget.success = (args) => { this.success(args); };
45
47
  this.widget.failure = (args) => { this.failure(args); };
@@ -55,20 +57,28 @@ let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrappe
55
57
  _this.widget.removingEventCallback(eventArgs, formData, selectedFiles, file);
56
58
  });
57
59
  };
60
+ this.widget.asyncSettings.removeUrl = null;
58
61
  }
59
62
  }
60
63
  }
61
- filesChanged() {
62
- this.debug("files Changed");
63
- this.recreate();
64
+ onfilesChanged() {
65
+ if (!this.firstBind) {
66
+ this.widget.clearAll();
67
+ this.recreate();
68
+ }
69
+ }
70
+ recreating() {
64
71
  this._filesCollectionSubscription.dispose();
65
- this.taskQueue.queueTask(() => {
66
- this.widget.files = this._files;
67
- this.initializeFileCollection();
68
- this._filesCollectionSubscription = this.createFilesCollectionSubscription();
69
- });
72
+ this[this._filesProperty].splice(0, this[this._filesProperty].length, ...this.originalFiles);
73
+ }
74
+ recreated() {
75
+ this.initializeFileCollection();
76
+ this._filesCollectionSubscription = this.createFilesCollectionSubscription();
70
77
  }
71
78
  initializeFileCollection() {
79
+ if (this.files && Array.isArray(this.files)) {
80
+ this.widget.files.push(...JSON.parse(JSON.stringify(this.files)));
81
+ }
72
82
  if (this.widget.files) {
73
83
  let extraProperties = [];
74
84
  let widgetFiles = this.widget.getFilesData();
@@ -82,7 +92,7 @@ let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrappe
82
92
  }
83
93
  }
84
94
  initializeFile(widgetFile, i, extraProperties) {
85
- let __id = uid();
95
+ let __id = uuid_1.v4();
86
96
  widgetFile[this._privateIdProperty] = __id;
87
97
  this._files[i][this._privateIdProperty] = __id;
88
98
  extraProperties.forEach((prop) => {
@@ -94,14 +104,34 @@ let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrappe
94
104
  this._filesCollectionSubscription = this.createFilesCollectionSubscription();
95
105
  this.subscriptions.push(this._filesCollectionSubscription);
96
106
  }
107
+ onBind() {
108
+ this.firstBind = false;
109
+ this.subscriptions.push(this.bindingEngine.propertyObserver(this, "files").subscribe(() => { this.onfilesChanged(); }));
110
+ if (this[this._filesProperty] && Array.isArray(this[this._filesProperty])) {
111
+ this.originalFiles = JSON.parse(JSON.stringify(this[this._filesProperty]));
112
+ }
113
+ else if (this.files && Array.isArray(this.files)) {
114
+ this.originalFiles = JSON.parse(JSON.stringify(this.files));
115
+ }
116
+ else {
117
+ this.originalFiles = [];
118
+ }
119
+ }
97
120
  createFilesCollectionSubscription() {
98
- return this.bindingEngine.collectionObserver(this._files).subscribe((changed) => {
99
- });
121
+ if (!this._files) {
122
+ this[this._filesProperty] = [];
123
+ }
124
+ return this.bindingEngine.collectionObserver(this._files).subscribe((changed) => { });
100
125
  }
101
126
  change() {
102
127
  if (this.autoRemoveServerFiles) {
103
128
  this.getFilesThatWereRemoved().forEach((file) => {
104
- this.removeFile(file);
129
+ this.removing({
130
+ filesData: [file],
131
+ customFormData: null,
132
+ event: null,
133
+ cancel: false
134
+ });
105
135
  });
106
136
  }
107
137
  }
@@ -124,11 +154,9 @@ let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrappe
124
154
  });
125
155
  }
126
156
  removeFile(file) {
127
- this.debug("removeFile", file);
128
157
  this.widget.remove(file);
129
158
  }
130
159
  async removing(args) {
131
- this.debug("removing", args);
132
160
  let event = new CustomEvent("on-removing", {
133
161
  bubbles: true,
134
162
  detail: args
@@ -149,7 +177,6 @@ let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrappe
149
177
  this.onWidgetRemoveFailed(error, args);
150
178
  }
151
179
  }
152
- this.onRemoveSuccess(args);
153
180
  }
154
181
  onWidgetRemoveComplete(response, args) {
155
182
  this.widget.removeCompleted(response, args.filesData[0], false);
@@ -158,15 +185,16 @@ let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrappe
158
185
  this.widget.removeFailed(e, args.filesData[0], false);
159
186
  }
160
187
  onRemoveSuccess(args) {
161
- this.debug("onRemoveSuccess", args);
162
188
  let _file = args.filesData[0];
163
189
  let index = this[this._filesProperty].findIndex((x) => x.__id === _file.__id);
164
- this[this._filesProperty].splice(index, 1);
165
- let event = new CustomEvent("on-remove-success", {
166
- bubbles: true,
167
- detail: args
168
- });
169
- this.element.dispatchEvent(event);
190
+ if (index !== -1) {
191
+ const removedFile = this[this._filesProperty].splice(index, 1)[0];
192
+ let event = new CustomEvent("on-remove-success", {
193
+ bubbles: true,
194
+ detail: { args: args, removedFile: removedFile }
195
+ });
196
+ this.element.dispatchEvent(event);
197
+ }
170
198
  }
171
199
  success(args) {
172
200
  if (args.operation === "upload") {
@@ -174,7 +202,7 @@ let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrappe
174
202
  let _uploadedFile = args.file;
175
203
  let fileName = _uploadedFile.name.substr(0, _uploadedFile.name.length - (_uploadedFile.type.length + 1));
176
204
  let additionalProperties = {};
177
- additionalProperties[this._privateIdProperty] = uid();
205
+ additionalProperties[this._privateIdProperty] = uuid_1.v4();
178
206
  if (this.uploadResultModel) {
179
207
  for (let prop in this.uploadResultModel) {
180
208
  additionalProperties[this.uploadResultModel[prop]] = response[prop];
@@ -191,15 +219,19 @@ let Ej2Uploader = class Ej2Uploader extends syncfusionWrapper_1.SyncfusionWrappe
191
219
  this[this._filesProperty] = [];
192
220
  }
193
221
  this[this._filesProperty].push(file);
194
- let event = new CustomEvent("on-success", {
222
+ let uploadedEvent = new CustomEvent("on-uploaded", {
195
223
  bubbles: true,
196
- detail: args
224
+ detail: { args: args, uploadedFile: file }
197
225
  });
198
- console.log("file after upload", _uploadedFile);
199
- this.element.dispatchEvent(event);
226
+ this.element.dispatchEvent(uploadedEvent);
200
227
  }
201
228
  else if (args.operation === "remove") {
202
229
  }
230
+ let successEvent = new CustomEvent("on-success", {
231
+ bubbles: true,
232
+ detail: args
233
+ });
234
+ this.element.dispatchEvent(successEvent);
203
235
  }
204
236
  failure(args) {
205
237
  let event = new CustomEvent("on-failure", {
@@ -298,6 +330,10 @@ __decorate([
298
330
  aurelia_framework_1.bindable,
299
331
  __metadata("design:type", Object)
300
332
  ], Ej2Uploader.prototype, "context", void 0);
333
+ __decorate([
334
+ aurelia_framework_1.bindable,
335
+ __metadata("design:type", Array)
336
+ ], Ej2Uploader.prototype, "files", void 0);
301
337
  __decorate([
302
338
  aurelia_framework_1.bindable,
303
339
  __metadata("design:type", Boolean)
@@ -8,7 +8,8 @@ export declare class ControlBase<T, U> {
8
8
  protected taskQueue: TaskQueue;
9
9
  protected eventAggregator: EventAggregator;
10
10
  protected element: Element;
11
- eModel: U;
11
+ private eModel;
12
+ protected _eModel: U;
12
13
  protected widgetElement: HTMLElement;
13
14
  widget: T;
14
15
  protected bindingContext: any;
@@ -18,6 +19,7 @@ export declare class ControlBase<T, U> {
18
19
  protected subscriptions: Disposable[];
19
20
  constructor(bindingEngine: BindingEngine, controlContainer: ControlContainer, taskQueue: TaskQueue, eventAggregator: EventAggregator, element: Element);
20
21
  onBind(): void;
22
+ onAttached(): void;
21
23
  onCreateControl(): void;
22
24
  protected debug(message: string, ...rest: any[]): void;
23
25
  protected info(message: string, ...rest: any[]): void;
@@ -21,19 +21,21 @@ let ControlBase = class ControlBase {
21
21
  this.eventAggregator = eventAggregator;
22
22
  this.element = element;
23
23
  this.eModel = null;
24
+ this._eModel = null;
24
25
  this.widgetElement = null;
25
26
  this.widget = null;
26
27
  this.bindingContext = null;
27
28
  this.logName = "";
28
29
  this.propertyPriority = true;
29
30
  this.subscriptions = [];
30
- this.eModel = {};
31
31
  }
32
32
  get controlType() {
33
33
  throw "syncfusionControlType is not set";
34
34
  }
35
35
  onBind() {
36
36
  }
37
+ onAttached() {
38
+ }
37
39
  onCreateControl() {
38
40
  throw "onCreateControl is not implemented";
39
41
  }
@@ -52,6 +54,7 @@ let ControlBase = class ControlBase {
52
54
  bind(context) {
53
55
  this.logName = this.controlType.name;
54
56
  this.bindingContext = context;
57
+ this._eModel = Object.assign({}, this.eModel);
55
58
  this.setInitialBindings();
56
59
  this.onCreateControl();
57
60
  this.onBind();
@@ -62,8 +65,8 @@ let ControlBase = class ControlBase {
62
65
  _control.bindableProperties.forEach((property) => {
63
66
  if (!property.startsWith(constants.eventPrefix)) {
64
67
  let modelProperty = property.substr(bindablePrefixLength);
65
- if (this[property] !== undefined && (this.propertyPriority || this.eModel[modelProperty] === undefined)) {
66
- this.eModel[modelProperty] = this[property];
68
+ if (this[property] !== undefined && (this.propertyPriority || this._eModel[modelProperty] === undefined)) {
69
+ this._eModel[modelProperty] = this[property];
67
70
  }
68
71
  }
69
72
  });
@@ -121,15 +124,21 @@ let ControlBase = class ControlBase {
121
124
  }
122
125
  attached() {
123
126
  this.appendWidget();
127
+ this.onAttached();
124
128
  }
125
129
  appendWidget() {
126
130
  this.widget.appendTo(this.widgetElement);
127
131
  }
128
132
  detached() {
129
- this.subscriptions.forEach((subscription) => subscription.dispose());
133
+ this.subscriptions.forEach((subscription) => { if (subscription) {
134
+ subscription.dispose();
135
+ } });
130
136
  if (this.widget.destroy) {
131
137
  this.widget.destroy();
132
138
  }
139
+ this.widget = null;
140
+ this._eModel = null;
141
+ this.widgetElement = null;
133
142
  }
134
143
  };
135
144
  __decorate([
@@ -5,6 +5,9 @@ export declare abstract class SyncfusionWrapper<T, U> extends ControlBase<T, U>
5
5
  protected abstract onWidgetCreated(): any;
6
6
  onCreateControl(): void;
7
7
  recreate(): void;
8
+ onRecreate(): void;
9
+ recreating(): void;
10
+ recreated(): void;
8
11
  refresh(): void;
9
12
  dataBind(): void;
10
13
  protected get controlType(): any;