@entropic-bond/crud-panel 2.1.0 → 2.2.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/lib/crud-controller.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Callback, Persistent, Model } from 'entropic-bond';
|
|
1
|
+
import { Callback, Persistent, Model, Observable } from 'entropic-bond';
|
|
2
2
|
import { ProgressController, ProgressEvent } from './progress-controller';
|
|
3
3
|
export interface CrudControllerEvent<T extends Persistent> {
|
|
4
4
|
documentChanged?: T;
|
|
@@ -23,7 +23,7 @@ export declare abstract class CrudController<T extends Persistent> {
|
|
|
23
23
|
set document(value: T);
|
|
24
24
|
get document(): T;
|
|
25
25
|
protected progressController: ProgressController;
|
|
26
|
-
|
|
26
|
+
protected onChangeHdl: Observable<CrudControllerEvent<T>>;
|
|
27
27
|
private _model;
|
|
28
28
|
private _document;
|
|
29
29
|
}
|
package/lib/crud-controller.js
CHANGED
|
@@ -42,7 +42,7 @@ var progress_controller_1 = require("./progress-controller");
|
|
|
42
42
|
var CrudController = /** @class */ (function () {
|
|
43
43
|
function CrudController(document) {
|
|
44
44
|
this.progressController = new progress_controller_1.ProgressController();
|
|
45
|
-
this.
|
|
45
|
+
this.onChangeHdl = new entropic_bond_1.Observable();
|
|
46
46
|
this._document = document || this.createDocument();
|
|
47
47
|
}
|
|
48
48
|
CrudController.prototype.storeDoc = function () {
|
|
@@ -55,7 +55,7 @@ var CrudController = /** @class */ (function () {
|
|
|
55
55
|
return this.model.find().limit(limit).get();
|
|
56
56
|
};
|
|
57
57
|
CrudController.prototype.onChange = function (observer) {
|
|
58
|
-
return this.
|
|
58
|
+
return this.onChangeHdl.subscribe(observer);
|
|
59
59
|
};
|
|
60
60
|
CrudController.prototype.newDocument = function () {
|
|
61
61
|
return this.setDocument(this.createDocument());
|
|
@@ -75,7 +75,7 @@ var CrudController = /** @class */ (function () {
|
|
|
75
75
|
return [4 /*yield*/, this.storeDoc()];
|
|
76
76
|
case 2:
|
|
77
77
|
_d.sent();
|
|
78
|
-
_b = (_a = this.
|
|
78
|
+
_b = (_a = this.onChangeHdl).notify;
|
|
79
79
|
_c = {};
|
|
80
80
|
return [4 /*yield*/, this.documentCollection()];
|
|
81
81
|
case 3:
|
|
@@ -105,7 +105,7 @@ var CrudController = /** @class */ (function () {
|
|
|
105
105
|
return [4 /*yield*/, this.deleteDoc()];
|
|
106
106
|
case 2:
|
|
107
107
|
_d.sent();
|
|
108
|
-
_b = (_a = this.
|
|
108
|
+
_b = (_a = this.onChangeHdl).notify;
|
|
109
109
|
_c = {};
|
|
110
110
|
return [4 /*yield*/, this.documentCollection()];
|
|
111
111
|
case 3:
|
|
@@ -156,7 +156,7 @@ var CrudController = /** @class */ (function () {
|
|
|
156
156
|
CrudController.prototype.setDocument = function (value) {
|
|
157
157
|
if (this._document !== value) {
|
|
158
158
|
this._document = value;
|
|
159
|
-
this.
|
|
159
|
+
this.onChangeHdl.notify({ documentChanged: this._document });
|
|
160
160
|
}
|
|
161
161
|
return this;
|
|
162
162
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud-controller.js","sourceRoot":"","sources":["../src/crud-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuE;AACvE,6DAAyE;AAOzE;IACC,wBAAa,QAAY;QAkGf,uBAAkB,GAAuB,IAAI,wCAAkB,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"crud-controller.js","sourceRoot":"","sources":["../src/crud-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuE;AACvE,6DAAyE;AAOzE;IACC,wBAAa,QAAY;QAkGf,uBAAkB,GAAuB,IAAI,wCAAkB,EAAE,CAAA;QACjE,gBAAW,GAAuC,IAAI,0BAAU,EAA0B,CAAA;QAlGnG,IAAI,CAAC,SAAS,GA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