@easydata/crud 1.4.12 → 1.4.17
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/dist/browser/easydata.css +2186 -2181
- package/dist/browser/easydata.css.map +1 -1
- package/dist/browser/easydata.js +10903 -11624
- package/dist/browser/easydata.js.map +1 -1
- package/dist/browser/easydata.min.css +3 -1
- package/dist/browser/easydata.min.js +1 -1
- package/dist/browser/easydata.min.js.map +1 -1
- package/dist/bundles/easydata.crud.js +8447 -8429
- package/dist/bundles/easydata.crud.js.map +1 -1
- package/dist/bundles/easydata.crud.min.js +1 -1
- package/dist/bundles/easydata.crud.min.js.map +1 -1
- package/dist/lib/filter/data_filter.d.ts +6 -6
- package/dist/lib/filter/data_filter.js +1 -0
- package/dist/lib/filter/text_data_filter.d.ts +16 -16
- package/dist/lib/filter/text_data_filter.js +122 -122
- package/dist/lib/form/entity_edit_form.d.ts +20 -20
- package/dist/lib/form/entity_edit_form.js +133 -133
- package/dist/lib/form/entity_edit_form.js.map +1 -1
- package/dist/lib/form/entity_form_builder.d.ts +27 -27
- package/dist/lib/form/entity_form_builder.js +440 -440
- package/dist/lib/form/entity_form_builder.js.map +1 -1
- package/dist/lib/i18n/text_resources.d.ts +1 -1
- package/dist/lib/i18n/text_resources.js +31 -31
- package/dist/lib/main/data_context.d.ts +45 -45
- package/dist/lib/main/data_context.js +167 -167
- package/dist/lib/main/data_context.js.map +1 -1
- package/dist/lib/main/easy_data_server_loader.d.ts +11 -11
- package/dist/lib/main/easy_data_server_loader.js +43 -43
- package/dist/lib/public_api.d.ts +16 -16
- package/dist/lib/public_api.js +16 -14
- package/dist/lib/public_api.js.map +1 -1
- package/dist/lib/utils/utils.d.ts +4 -4
- package/dist/lib/utils/utils.js +24 -24
- package/dist/lib/utils/utils.js.map +1 -1
- package/dist/lib/validators/datetime_validator.d.ts +6 -6
- package/dist/lib/validators/datetime_validator.js +45 -43
- package/dist/lib/validators/datetime_validator.js.map +1 -1
- package/dist/lib/validators/required_validator.d.ts +6 -6
- package/dist/lib/validators/required_validator.js +36 -34
- package/dist/lib/validators/required_validator.js.map +1 -1
- package/dist/lib/validators/type_validator.d.ts +6 -6
- package/dist/lib/validators/type_validator.js +46 -44
- package/dist/lib/validators/type_validator.js.map +1 -1
- package/dist/lib/validators/validator.d.ts +9 -9
- package/dist/lib/validators/validator.js +6 -6
- package/dist/lib/views/easy_data_view_dispatcher.d.ts +18 -18
- package/dist/lib/views/easy_data_view_dispatcher.js +113 -113
- package/dist/lib/views/entity_data_view.d.ts +23 -23
- package/dist/lib/views/entity_data_view.js +224 -224
- package/dist/lib/views/entity_data_view.js.map +1 -1
- package/dist/lib/views/options.d.ts +14 -14
- package/dist/lib/views/options.js +1 -0
- package/dist/lib/views/root_data_view.d.ts +9 -9
- package/dist/lib/views/root_data_view.js +48 -48
- package/dist/lib/views/root_data_view.js.map +1 -1
- package/dist/lib/widgets/progress_bar.d.ts +6 -6
- package/dist/lib/widgets/progress_bar.js +15 -15
- package/dist/lib/widgets/text_filter_widget.d.ts +24 -24
- package/dist/lib/widgets/text_filter_widget.js +213 -213
- package/package.json +28 -27
- package/webpack.config.js +12 -9
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import { utils as dataUtils } from '@easydata/core';
|
|
2
|
-
import { ProgressBar } from '../widgets/progress_bar';
|
|
3
|
-
import { DataContext } from '../main/data_context';
|
|
4
|
-
import { EntityDataView } from './entity_data_view';
|
|
5
|
-
import { RootDataView } from './root_data_view';
|
|
6
|
-
var EasyDataViewDispatcher = /** @class */ (function () {
|
|
7
|
-
function EasyDataViewDispatcher(options) {
|
|
8
|
-
var _this = this;
|
|
9
|
-
this.options = {
|
|
10
|
-
container: '#EasyDataContainer',
|
|
11
|
-
basePath: 'easydata'
|
|
12
|
-
};
|
|
13
|
-
this.onSetLocation = function () {
|
|
14
|
-
_this.setActiveView();
|
|
15
|
-
};
|
|
16
|
-
this.attach = function () {
|
|
17
|
-
window.addEventListener('ed_set_location', _this.onSetLocation);
|
|
18
|
-
window.addEventListener('popstate', _this.onSetLocation);
|
|
19
|
-
};
|
|
20
|
-
this.options = dataUtils.assign(this.options, options || {});
|
|
21
|
-
if (this.options.rootEntity) {
|
|
22
|
-
this.options.showBackToEntities = false;
|
|
23
|
-
this.basePath = '/';
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this.basePath = this.normalizeBasePath(this.options.basePath);
|
|
27
|
-
}
|
|
28
|
-
this.setContainer(this.options.container);
|
|
29
|
-
var progressBarSlot = document.createElement('div');
|
|
30
|
-
var bar = new ProgressBar(progressBarSlot);
|
|
31
|
-
var parent = this.container.parentElement;
|
|
32
|
-
parent.insertBefore(progressBarSlot, parent.firstElementChild);
|
|
33
|
-
this.context = new DataContext({
|
|
34
|
-
endpoint: this.options.endpoint,
|
|
35
|
-
dataTable: this.options.dataTable,
|
|
36
|
-
onProcessStart: function () { return bar.show(); },
|
|
37
|
-
onProcessEnd: function () { return bar.hide(); }
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
EasyDataViewDispatcher.prototype.normalizeBasePath = function (basePath) {
|
|
41
|
-
basePath = this.trimSlashes(basePath);
|
|
42
|
-
var fullPath = decodeURIComponent(window.location.pathname);
|
|
43
|
-
var idx = fullPath.toLocaleLowerCase().indexOf(basePath);
|
|
44
|
-
return idx >= 0 ? fullPath.substring(0, idx + basePath.length) : '/';
|
|
45
|
-
};
|
|
46
|
-
EasyDataViewDispatcher.prototype.trimSlashes = function (path) {
|
|
47
|
-
return path.replace(/^\/|\/$/g, '');
|
|
48
|
-
};
|
|
49
|
-
EasyDataViewDispatcher.prototype.setContainer = function (container) {
|
|
50
|
-
if (!container) {
|
|
51
|
-
throw 'Container is undefined';
|
|
52
|
-
}
|
|
53
|
-
if (typeof container === 'string') {
|
|
54
|
-
if (container.length) {
|
|
55
|
-
if (container[0] === '.') {
|
|
56
|
-
var result = document.getElementsByClassName(container.substring(1));
|
|
57
|
-
if (result.length)
|
|
58
|
-
this.container = result[0];
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
if (container[0] === '#') {
|
|
62
|
-
container = container.substring(1);
|
|
63
|
-
}
|
|
64
|
-
this.container = document.getElementById(container);
|
|
65
|
-
}
|
|
66
|
-
if (!this.container) {
|
|
67
|
-
throw Error('Unrecognized `container` parameter: ' + container + '\n'
|
|
68
|
-
+ 'It must be an element ID, a class name (starting with .) or an HTMLElement object itself.');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.container = container;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
EasyDataViewDispatcher.prototype.getActiveSourceId = function () {
|
|
77
|
-
if (this.options.rootEntity)
|
|
78
|
-
return this.options.rootEntity;
|
|
79
|
-
var path = decodeURIComponent(window.location.pathname);
|
|
80
|
-
var idIndex = this.basePath.length + 1;
|
|
81
|
-
return idIndex < path.length ? path.substring(idIndex) : null;
|
|
82
|
-
};
|
|
83
|
-
EasyDataViewDispatcher.prototype.run = function () {
|
|
84
|
-
var _this = this;
|
|
85
|
-
this.attach();
|
|
86
|
-
return this.context.loadMetaData()
|
|
87
|
-
.then(function () {
|
|
88
|
-
_this.setActiveView();
|
|
89
|
-
})
|
|
90
|
-
.catch(function (error) { return console.error(error); });
|
|
91
|
-
};
|
|
92
|
-
EasyDataViewDispatcher.prototype.setActiveView = function () {
|
|
93
|
-
this.clear();
|
|
94
|
-
var sourceId = this.getActiveSourceId();
|
|
95
|
-
if (sourceId) {
|
|
96
|
-
this.context.setActiveSource(sourceId);
|
|
97
|
-
window['EDView'] = new EntityDataView(this.container, this.context, this.basePath, this.options);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
window['EDView'] = new RootDataView(this.container, this.context, this.basePath);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
EasyDataViewDispatcher.prototype.clear = function () {
|
|
104
|
-
this.container.innerHTML = '';
|
|
105
|
-
this.context.getData().clear();
|
|
106
|
-
};
|
|
107
|
-
EasyDataViewDispatcher.prototype.detach = function () {
|
|
108
|
-
window.removeEventListener('ed_set_location', this.onSetLocation);
|
|
109
|
-
window.removeEventListener('popstate', this.onSetLocation);
|
|
110
|
-
};
|
|
111
|
-
return EasyDataViewDispatcher;
|
|
112
|
-
}());
|
|
113
|
-
export { EasyDataViewDispatcher };
|
|
1
|
+
import { utils as dataUtils } from '@easydata/core';
|
|
2
|
+
import { ProgressBar } from '../widgets/progress_bar';
|
|
3
|
+
import { DataContext } from '../main/data_context';
|
|
4
|
+
import { EntityDataView } from './entity_data_view';
|
|
5
|
+
import { RootDataView } from './root_data_view';
|
|
6
|
+
var EasyDataViewDispatcher = /** @class */ (function () {
|
|
7
|
+
function EasyDataViewDispatcher(options) {
|
|
8
|
+
var _this = this;
|
|
9
|
+
this.options = {
|
|
10
|
+
container: '#EasyDataContainer',
|
|
11
|
+
basePath: 'easydata'
|
|
12
|
+
};
|
|
13
|
+
this.onSetLocation = function () {
|
|
14
|
+
_this.setActiveView();
|
|
15
|
+
};
|
|
16
|
+
this.attach = function () {
|
|
17
|
+
window.addEventListener('ed_set_location', _this.onSetLocation);
|
|
18
|
+
window.addEventListener('popstate', _this.onSetLocation);
|
|
19
|
+
};
|
|
20
|
+
this.options = dataUtils.assign(this.options, options || {});
|
|
21
|
+
if (this.options.rootEntity) {
|
|
22
|
+
this.options.showBackToEntities = false;
|
|
23
|
+
this.basePath = '/';
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.basePath = this.normalizeBasePath(this.options.basePath);
|
|
27
|
+
}
|
|
28
|
+
this.setContainer(this.options.container);
|
|
29
|
+
var progressBarSlot = document.createElement('div');
|
|
30
|
+
var bar = new ProgressBar(progressBarSlot);
|
|
31
|
+
var parent = this.container.parentElement;
|
|
32
|
+
parent.insertBefore(progressBarSlot, parent.firstElementChild);
|
|
33
|
+
this.context = new DataContext({
|
|
34
|
+
endpoint: this.options.endpoint,
|
|
35
|
+
dataTable: this.options.dataTable,
|
|
36
|
+
onProcessStart: function () { return bar.show(); },
|
|
37
|
+
onProcessEnd: function () { return bar.hide(); }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
EasyDataViewDispatcher.prototype.normalizeBasePath = function (basePath) {
|
|
41
|
+
basePath = this.trimSlashes(basePath);
|
|
42
|
+
var fullPath = decodeURIComponent(window.location.pathname);
|
|
43
|
+
var idx = fullPath.toLocaleLowerCase().indexOf(basePath);
|
|
44
|
+
return idx >= 0 ? fullPath.substring(0, idx + basePath.length) : '/';
|
|
45
|
+
};
|
|
46
|
+
EasyDataViewDispatcher.prototype.trimSlashes = function (path) {
|
|
47
|
+
return path.replace(/^\/|\/$/g, '');
|
|
48
|
+
};
|
|
49
|
+
EasyDataViewDispatcher.prototype.setContainer = function (container) {
|
|
50
|
+
if (!container) {
|
|
51
|
+
throw 'Container is undefined';
|
|
52
|
+
}
|
|
53
|
+
if (typeof container === 'string') {
|
|
54
|
+
if (container.length) {
|
|
55
|
+
if (container[0] === '.') {
|
|
56
|
+
var result = document.getElementsByClassName(container.substring(1));
|
|
57
|
+
if (result.length)
|
|
58
|
+
this.container = result[0];
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (container[0] === '#') {
|
|
62
|
+
container = container.substring(1);
|
|
63
|
+
}
|
|
64
|
+
this.container = document.getElementById(container);
|
|
65
|
+
}
|
|
66
|
+
if (!this.container) {
|
|
67
|
+
throw Error('Unrecognized `container` parameter: ' + container + '\n'
|
|
68
|
+
+ 'It must be an element ID, a class name (starting with .) or an HTMLElement object itself.');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.container = container;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
EasyDataViewDispatcher.prototype.getActiveSourceId = function () {
|
|
77
|
+
if (this.options.rootEntity)
|
|
78
|
+
return this.options.rootEntity;
|
|
79
|
+
var path = decodeURIComponent(window.location.pathname);
|
|
80
|
+
var idIndex = this.basePath.length + 1;
|
|
81
|
+
return idIndex < path.length ? path.substring(idIndex) : null;
|
|
82
|
+
};
|
|
83
|
+
EasyDataViewDispatcher.prototype.run = function () {
|
|
84
|
+
var _this = this;
|
|
85
|
+
this.attach();
|
|
86
|
+
return this.context.loadMetaData()
|
|
87
|
+
.then(function () {
|
|
88
|
+
_this.setActiveView();
|
|
89
|
+
})
|
|
90
|
+
.catch(function (error) { return console.error(error); });
|
|
91
|
+
};
|
|
92
|
+
EasyDataViewDispatcher.prototype.setActiveView = function () {
|
|
93
|
+
this.clear();
|
|
94
|
+
var sourceId = this.getActiveSourceId();
|
|
95
|
+
if (sourceId) {
|
|
96
|
+
this.context.setActiveSource(sourceId);
|
|
97
|
+
window['EDView'] = new EntityDataView(this.container, this.context, this.basePath, this.options);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
window['EDView'] = new RootDataView(this.container, this.context, this.basePath);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
EasyDataViewDispatcher.prototype.clear = function () {
|
|
104
|
+
this.container.innerHTML = '';
|
|
105
|
+
this.context.getData().clear();
|
|
106
|
+
};
|
|
107
|
+
EasyDataViewDispatcher.prototype.detach = function () {
|
|
108
|
+
window.removeEventListener('ed_set_location', this.onSetLocation);
|
|
109
|
+
window.removeEventListener('popstate', this.onSetLocation);
|
|
110
|
+
};
|
|
111
|
+
return EasyDataViewDispatcher;
|
|
112
|
+
}());
|
|
113
|
+
export { EasyDataViewDispatcher };
|
|
114
114
|
//# sourceMappingURL=easy_data_view_dispatcher.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { DataContext } from '../main/data_context';
|
|
2
|
-
import { EasyDataViewOptions } from './options';
|
|
3
|
-
export declare class EntityDataView {
|
|
4
|
-
private slot;
|
|
5
|
-
private context;
|
|
6
|
-
private basePath;
|
|
7
|
-
private options;
|
|
8
|
-
private dlg;
|
|
9
|
-
private grid;
|
|
10
|
-
private filterWidget;
|
|
11
|
-
private defaultValidators;
|
|
12
|
-
constructor(slot: HTMLElement, context: DataContext, basePath: string, options: EasyDataViewOptions);
|
|
13
|
-
private syncGridColumnHandler;
|
|
14
|
-
private renderGrid;
|
|
15
|
-
private manageCellRenderer;
|
|
16
|
-
private addClickHandler;
|
|
17
|
-
private editClickHandler;
|
|
18
|
-
private showEditForm;
|
|
19
|
-
private rowDbClickHandler;
|
|
20
|
-
private deleteClickHandler;
|
|
21
|
-
private processError;
|
|
22
|
-
private refreshData;
|
|
23
|
-
}
|
|
1
|
+
import { DataContext } from '../main/data_context';
|
|
2
|
+
import { EasyDataViewOptions } from './options';
|
|
3
|
+
export declare class EntityDataView {
|
|
4
|
+
private slot;
|
|
5
|
+
private context;
|
|
6
|
+
private basePath;
|
|
7
|
+
private options;
|
|
8
|
+
private dlg;
|
|
9
|
+
private grid;
|
|
10
|
+
private filterWidget;
|
|
11
|
+
private defaultValidators;
|
|
12
|
+
constructor(slot: HTMLElement, context: DataContext, basePath: string, options: EasyDataViewOptions);
|
|
13
|
+
private syncGridColumnHandler;
|
|
14
|
+
private renderGrid;
|
|
15
|
+
private manageCellRenderer;
|
|
16
|
+
private addClickHandler;
|
|
17
|
+
private editClickHandler;
|
|
18
|
+
private showEditForm;
|
|
19
|
+
private rowDbClickHandler;
|
|
20
|
+
private deleteClickHandler;
|
|
21
|
+
private processError;
|
|
22
|
+
private refreshData;
|
|
23
|
+
}
|