@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,225 +1,225 @@
|
|
|
1
|
-
import { i18n, utils as dataUtils } from '@easydata/core';
|
|
2
|
-
import { DefaultDialogService, domel, EasyGrid } from '@easydata/ui';
|
|
3
|
-
import { EntityEditFormBuilder } from '../form/entity_form_builder';
|
|
4
|
-
import { TextFilterWidget } from '../widgets/text_filter_widget';
|
|
5
|
-
import { RequiredValidator } from '../validators/required_validator';
|
|
6
|
-
import { TypeValidator } from '../validators/type_validator';
|
|
7
|
-
import { setLocation } from '../utils/utils';
|
|
8
|
-
var EntityDataView = /** @class */ (function () {
|
|
9
|
-
function EntityDataView(slot, context, basePath, options) {
|
|
10
|
-
var _this = this;
|
|
11
|
-
this.slot = slot;
|
|
12
|
-
this.context = context;
|
|
13
|
-
this.basePath = basePath;
|
|
14
|
-
this.options = {
|
|
15
|
-
showFilterBox: true,
|
|
16
|
-
showBackToEntities: true
|
|
17
|
-
};
|
|
18
|
-
this.defaultValidators = [new RequiredValidator(), new TypeValidator()];
|
|
19
|
-
this.options = dataUtils.assignDeep(this.options, options || {});
|
|
20
|
-
this.dlg = new DefaultDialogService();
|
|
21
|
-
var ent = this.context.getActiveEntity();
|
|
22
|
-
if (!ent) {
|
|
23
|
-
throw "Can't find active entity for " + window.location.pathname;
|
|
24
|
-
}
|
|
25
|
-
this.slot.innerHTML += "<h1>"
|
|
26
|
-
if (this.options.showBackToEntities) {
|
|
27
|
-
domel(this.slot)
|
|
28
|
-
.addChild('a', function (b) { return b
|
|
29
|
-
.attr('href', 'javascript:void(0)')
|
|
30
|
-
.text("\u2190 "
|
|
31
|
-
.on('click', function (e) {
|
|
32
|
-
e.preventDefault();
|
|
33
|
-
setLocation(_this.basePath);
|
|
34
|
-
}); });
|
|
35
|
-
}
|
|
36
|
-
this.renderGrid();
|
|
37
|
-
}
|
|
38
|
-
EntityDataView.prototype.syncGridColumnHandler = function (column) {
|
|
39
|
-
if (column.dataColumn) {
|
|
40
|
-
var attr = this.context.getMetaData().getAttributeById(column.dataColumn.id);
|
|
41
|
-
if (attr) {
|
|
42
|
-
column.isVisible = attr.showOnView;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
EntityDataView.prototype.renderGrid = function () {
|
|
47
|
-
var _this = this;
|
|
48
|
-
this.context.fetchDataset()
|
|
49
|
-
.then(function (result) {
|
|
50
|
-
var gridSlot = document.createElement('div');
|
|
51
|
-
_this.slot.appendChild(gridSlot);
|
|
52
|
-
gridSlot.id = 'Grid';
|
|
53
|
-
_this.grid = new EasyGrid(dataUtils.assignDeep({
|
|
54
|
-
slot: gridSlot,
|
|
55
|
-
dataTable: result,
|
|
56
|
-
paging: {
|
|
57
|
-
pageSize: 15,
|
|
58
|
-
allowPageSizeChange: true,
|
|
59
|
-
pageSizeItems: [15, 30, 50, 100, 200]
|
|
60
|
-
},
|
|
61
|
-
showPlusButton: _this.context.getActiveEntity().isEditable,
|
|
62
|
-
plusButtonTitle: i18n.getText('AddRecordBtnTitle'),
|
|
63
|
-
showActiveRow: false,
|
|
64
|
-
onPlusButtonClick: _this.addClickHandler.bind(_this),
|
|
65
|
-
onGetCellRenderer: _this.manageCellRenderer.bind(_this),
|
|
66
|
-
onRowDbClick: _this.rowDbClickHandler.bind(_this),
|
|
67
|
-
onSyncGridColumn: _this.syncGridColumnHandler.bind(_this)
|
|
68
|
-
}, _this.options.grid || {}));
|
|
69
|
-
if (_this.options.showFilterBox) {
|
|
70
|
-
var filterWidgetSlot_1;
|
|
71
|
-
var filterBarDiv = domel('div')
|
|
72
|
-
.addClass("kfrm-form")
|
|
73
|
-
.setStyle('margin', '10px 0px')
|
|
74
|
-
.addChild('div', function (b) {
|
|
75
|
-
return filterWidgetSlot_1 = b.toDOM();
|
|
76
|
-
}).toDOM();
|
|
77
|
-
_this.slot.insertBefore(filterBarDiv, gridSlot);
|
|
78
|
-
var dataFilter = _this.context.createFilter();
|
|
79
|
-
_this.filterWidget = new TextFilterWidget(filterWidgetSlot_1, _this.grid, dataFilter);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
EntityDataView.prototype.manageCellRenderer = function (column, defaultRenderer) {
|
|
84
|
-
var _this = this;
|
|
85
|
-
if (column.isRowNum) {
|
|
86
|
-
column.width = 110;
|
|
87
|
-
return function (value, column, cell, rowEl) {
|
|
88
|
-
var b = domel('div', cell)
|
|
89
|
-
.addClass("keg-cell-value");
|
|
90
|
-
if (_this.context.getActiveEntity().isEditable) {
|
|
91
|
-
b.addChild('a', function (b) { return b
|
|
92
|
-
.attr('href', 'javascript:void(0)')
|
|
93
|
-
.text(i18n.getText('EditBtn'))
|
|
94
|
-
.on('click', function (ev) { return _this.editClickHandler(ev, parseInt(rowEl.getAttribute('data-row-idx'))); }); })
|
|
95
|
-
.addChild('span', function (b) { return b.text(' | '); })
|
|
96
|
-
.addChild('a', function (b) { return b
|
|
97
|
-
.attr('href', 'javascript:void(0)')
|
|
98
|
-
.text(i18n.getText('DeleteBtn'))
|
|
99
|
-
.on('click', function (ev) {
|
|
100
|
-
return _this.deleteClickHandler(ev, parseInt(rowEl.getAttribute('data-row-idx')));
|
|
101
|
-
}); });
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
EntityDataView.prototype.addClickHandler = function () {
|
|
107
|
-
var _this = this;
|
|
108
|
-
var activeEntity = this.context.getActiveEntity();
|
|
109
|
-
var form = new EntityEditFormBuilder(this.context)
|
|
110
|
-
.onSubmit(function () { return dlg.submit(); })
|
|
111
|
-
.build();
|
|
112
|
-
form.useValidators(this.defaultValidators);
|
|
113
|
-
var dlg = this.dlg.open({
|
|
114
|
-
title: i18n.getText('AddDlgCaption')
|
|
115
|
-
.replace('{entity}', activeEntity.caption),
|
|
116
|
-
body: form.getHtml(),
|
|
117
|
-
onSubmit: function () {
|
|
118
|
-
if (!form.validate())
|
|
119
|
-
return false;
|
|
120
|
-
form.getData()
|
|
121
|
-
.then(function (obj) { return _this.context.createRecord(obj); })
|
|
122
|
-
.then(function () {
|
|
123
|
-
return _this.refreshData();
|
|
124
|
-
})
|
|
125
|
-
.catch(function (error) {
|
|
126
|
-
_this.processError(error);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
EntityDataView.prototype.editClickHandler = function (ev, rowIndex) {
|
|
132
|
-
var _this = this;
|
|
133
|
-
this.grid.getData().getRow(rowIndex)
|
|
134
|
-
.then(function (row) {
|
|
135
|
-
if (row) {
|
|
136
|
-
_this.showEditForm(row);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
EntityDataView.prototype.showEditForm = function (row) {
|
|
141
|
-
var _this = this;
|
|
142
|
-
var activeEntity = this.context.getActiveEntity();
|
|
143
|
-
var form = new EntityEditFormBuilder(this.context, { isEditForm: true, values: row })
|
|
144
|
-
.onSubmit(function () { return dlg.submit(); })
|
|
145
|
-
.build();
|
|
146
|
-
form.useValidators(this.defaultValidators);
|
|
147
|
-
var dlg = this.dlg.open({
|
|
148
|
-
title: i18n.getText('EditDlgCaption')
|
|
149
|
-
.replace('{entity}', activeEntity.caption),
|
|
150
|
-
body: form.getHtml(),
|
|
151
|
-
onSubmit: function () {
|
|
152
|
-
if (!form.validate())
|
|
153
|
-
return false;
|
|
154
|
-
form.getData()
|
|
155
|
-
.then(function (obj) { return _this.context.updateRecord(obj); })
|
|
156
|
-
.then(function () {
|
|
157
|
-
return _this.refreshData();
|
|
158
|
-
})
|
|
159
|
-
.catch(function (error) {
|
|
160
|
-
_this.processError(error);
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
EntityDataView.prototype.rowDbClickHandler = function (ev) {
|
|
166
|
-
if (this.context.getActiveEntity().isEditable) {
|
|
167
|
-
this.showEditForm(ev.row);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
EntityDataView.prototype.deleteClickHandler = function (ev, rowIndex) {
|
|
171
|
-
var _this = this;
|
|
172
|
-
this.grid.getData().getRow(rowIndex)
|
|
173
|
-
.then(function (row) {
|
|
174
|
-
if (row) {
|
|
175
|
-
var activeEntity = _this.context.getActiveEntity();
|
|
176
|
-
var keyAttrs = activeEntity.getPrimaryAttrs();
|
|
177
|
-
var keyVals_1 = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
|
|
178
|
-
var keys_1 = keyAttrs.reduce(function (val, attr, index) {
|
|
179
|
-
var property = attr.id.substring(attr.id.lastIndexOf('.') + 1);
|
|
180
|
-
val[property] = keyVals_1[index];
|
|
181
|
-
return val;
|
|
182
|
-
}, {});
|
|
183
|
-
_this.dlg.openConfirm(i18n.getText('DeleteDlgCaption')
|
|
184
|
-
.replace('{entity}', activeEntity.caption), i18n.getText('DeleteDlgMessage')
|
|
185
|
-
.replace('{recordId}', Object.keys(keys_1)
|
|
186
|
-
.map(function (key) { return key
|
|
187
|
-
.then(function (result) {
|
|
188
|
-
if (result) {
|
|
189
|
-
_this.context.deleteRecord(keys_1)
|
|
190
|
-
.then(function () {
|
|
191
|
-
return _this.refreshData();
|
|
192
|
-
})
|
|
193
|
-
.catch(function (error) {
|
|
194
|
-
_this.processError(error);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
};
|
|
201
|
-
EntityDataView.prototype.processError = function (error) {
|
|
202
|
-
this.dlg.open({
|
|
203
|
-
title: 'Ooops, something went wrong',
|
|
204
|
-
body: error.message,
|
|
205
|
-
closable: true,
|
|
206
|
-
cancelable: false
|
|
207
|
-
});
|
|
208
|
-
};
|
|
209
|
-
EntityDataView.prototype.refreshData = function () {
|
|
210
|
-
var _this = this;
|
|
211
|
-
return this.context.fetchDataset()
|
|
212
|
-
.then(function () {
|
|
213
|
-
var processed = false;
|
|
214
|
-
if (_this.filterWidget) {
|
|
215
|
-
processed = _this.filterWidget.applyFilter(false);
|
|
216
|
-
}
|
|
217
|
-
if (!processed) {
|
|
218
|
-
_this.grid.refresh();
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
|
-
return EntityDataView;
|
|
223
|
-
}());
|
|
224
|
-
export { EntityDataView };
|
|
1
|
+
import { i18n, utils as dataUtils } from '@easydata/core';
|
|
2
|
+
import { DefaultDialogService, domel, EasyGrid } from '@easydata/ui';
|
|
3
|
+
import { EntityEditFormBuilder } from '../form/entity_form_builder';
|
|
4
|
+
import { TextFilterWidget } from '../widgets/text_filter_widget';
|
|
5
|
+
import { RequiredValidator } from '../validators/required_validator';
|
|
6
|
+
import { TypeValidator } from '../validators/type_validator';
|
|
7
|
+
import { setLocation } from '../utils/utils';
|
|
8
|
+
var EntityDataView = /** @class */ (function () {
|
|
9
|
+
function EntityDataView(slot, context, basePath, options) {
|
|
10
|
+
var _this = this;
|
|
11
|
+
this.slot = slot;
|
|
12
|
+
this.context = context;
|
|
13
|
+
this.basePath = basePath;
|
|
14
|
+
this.options = {
|
|
15
|
+
showFilterBox: true,
|
|
16
|
+
showBackToEntities: true
|
|
17
|
+
};
|
|
18
|
+
this.defaultValidators = [new RequiredValidator(), new TypeValidator()];
|
|
19
|
+
this.options = dataUtils.assignDeep(this.options, options || {});
|
|
20
|
+
this.dlg = new DefaultDialogService();
|
|
21
|
+
var ent = this.context.getActiveEntity();
|
|
22
|
+
if (!ent) {
|
|
23
|
+
throw "Can't find active entity for " + window.location.pathname;
|
|
24
|
+
}
|
|
25
|
+
this.slot.innerHTML += "<h1>".concat(ent.captionPlural || ent.caption, "</h1>");
|
|
26
|
+
if (this.options.showBackToEntities) {
|
|
27
|
+
domel(this.slot)
|
|
28
|
+
.addChild('a', function (b) { return b
|
|
29
|
+
.attr('href', 'javascript:void(0)')
|
|
30
|
+
.text("\u2190 ".concat(i18n.getText('BackToEntities')))
|
|
31
|
+
.on('click', function (e) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
setLocation(_this.basePath);
|
|
34
|
+
}); });
|
|
35
|
+
}
|
|
36
|
+
this.renderGrid();
|
|
37
|
+
}
|
|
38
|
+
EntityDataView.prototype.syncGridColumnHandler = function (column) {
|
|
39
|
+
if (column.dataColumn) {
|
|
40
|
+
var attr = this.context.getMetaData().getAttributeById(column.dataColumn.id);
|
|
41
|
+
if (attr) {
|
|
42
|
+
column.isVisible = attr.showOnView;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
EntityDataView.prototype.renderGrid = function () {
|
|
47
|
+
var _this = this;
|
|
48
|
+
this.context.fetchDataset()
|
|
49
|
+
.then(function (result) {
|
|
50
|
+
var gridSlot = document.createElement('div');
|
|
51
|
+
_this.slot.appendChild(gridSlot);
|
|
52
|
+
gridSlot.id = 'Grid';
|
|
53
|
+
_this.grid = new EasyGrid(dataUtils.assignDeep({
|
|
54
|
+
slot: gridSlot,
|
|
55
|
+
dataTable: result,
|
|
56
|
+
paging: {
|
|
57
|
+
pageSize: 15,
|
|
58
|
+
allowPageSizeChange: true,
|
|
59
|
+
pageSizeItems: [15, 30, 50, 100, 200]
|
|
60
|
+
},
|
|
61
|
+
showPlusButton: _this.context.getActiveEntity().isEditable,
|
|
62
|
+
plusButtonTitle: i18n.getText('AddRecordBtnTitle'),
|
|
63
|
+
showActiveRow: false,
|
|
64
|
+
onPlusButtonClick: _this.addClickHandler.bind(_this),
|
|
65
|
+
onGetCellRenderer: _this.manageCellRenderer.bind(_this),
|
|
66
|
+
onRowDbClick: _this.rowDbClickHandler.bind(_this),
|
|
67
|
+
onSyncGridColumn: _this.syncGridColumnHandler.bind(_this)
|
|
68
|
+
}, _this.options.grid || {}));
|
|
69
|
+
if (_this.options.showFilterBox) {
|
|
70
|
+
var filterWidgetSlot_1;
|
|
71
|
+
var filterBarDiv = domel('div')
|
|
72
|
+
.addClass("kfrm-form")
|
|
73
|
+
.setStyle('margin', '10px 0px')
|
|
74
|
+
.addChild('div', function (b) {
|
|
75
|
+
return filterWidgetSlot_1 = b.toDOM();
|
|
76
|
+
}).toDOM();
|
|
77
|
+
_this.slot.insertBefore(filterBarDiv, gridSlot);
|
|
78
|
+
var dataFilter = _this.context.createFilter();
|
|
79
|
+
_this.filterWidget = new TextFilterWidget(filterWidgetSlot_1, _this.grid, dataFilter);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
EntityDataView.prototype.manageCellRenderer = function (column, defaultRenderer) {
|
|
84
|
+
var _this = this;
|
|
85
|
+
if (column.isRowNum) {
|
|
86
|
+
column.width = 110;
|
|
87
|
+
return function (value, column, cell, rowEl) {
|
|
88
|
+
var b = domel('div', cell)
|
|
89
|
+
.addClass("keg-cell-value");
|
|
90
|
+
if (_this.context.getActiveEntity().isEditable) {
|
|
91
|
+
b.addChild('a', function (b) { return b
|
|
92
|
+
.attr('href', 'javascript:void(0)')
|
|
93
|
+
.text(i18n.getText('EditBtn'))
|
|
94
|
+
.on('click', function (ev) { return _this.editClickHandler(ev, parseInt(rowEl.getAttribute('data-row-idx'))); }); })
|
|
95
|
+
.addChild('span', function (b) { return b.text(' | '); })
|
|
96
|
+
.addChild('a', function (b) { return b
|
|
97
|
+
.attr('href', 'javascript:void(0)')
|
|
98
|
+
.text(i18n.getText('DeleteBtn'))
|
|
99
|
+
.on('click', function (ev) {
|
|
100
|
+
return _this.deleteClickHandler(ev, parseInt(rowEl.getAttribute('data-row-idx')));
|
|
101
|
+
}); });
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
EntityDataView.prototype.addClickHandler = function () {
|
|
107
|
+
var _this = this;
|
|
108
|
+
var activeEntity = this.context.getActiveEntity();
|
|
109
|
+
var form = new EntityEditFormBuilder(this.context)
|
|
110
|
+
.onSubmit(function () { return dlg.submit(); })
|
|
111
|
+
.build();
|
|
112
|
+
form.useValidators(this.defaultValidators);
|
|
113
|
+
var dlg = this.dlg.open({
|
|
114
|
+
title: i18n.getText('AddDlgCaption')
|
|
115
|
+
.replace('{entity}', activeEntity.caption),
|
|
116
|
+
body: form.getHtml(),
|
|
117
|
+
onSubmit: function () {
|
|
118
|
+
if (!form.validate())
|
|
119
|
+
return false;
|
|
120
|
+
form.getData()
|
|
121
|
+
.then(function (obj) { return _this.context.createRecord(obj); })
|
|
122
|
+
.then(function () {
|
|
123
|
+
return _this.refreshData();
|
|
124
|
+
})
|
|
125
|
+
.catch(function (error) {
|
|
126
|
+
_this.processError(error);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
EntityDataView.prototype.editClickHandler = function (ev, rowIndex) {
|
|
132
|
+
var _this = this;
|
|
133
|
+
this.grid.getData().getRow(rowIndex)
|
|
134
|
+
.then(function (row) {
|
|
135
|
+
if (row) {
|
|
136
|
+
_this.showEditForm(row);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
EntityDataView.prototype.showEditForm = function (row) {
|
|
141
|
+
var _this = this;
|
|
142
|
+
var activeEntity = this.context.getActiveEntity();
|
|
143
|
+
var form = new EntityEditFormBuilder(this.context, { isEditForm: true, values: row })
|
|
144
|
+
.onSubmit(function () { return dlg.submit(); })
|
|
145
|
+
.build();
|
|
146
|
+
form.useValidators(this.defaultValidators);
|
|
147
|
+
var dlg = this.dlg.open({
|
|
148
|
+
title: i18n.getText('EditDlgCaption')
|
|
149
|
+
.replace('{entity}', activeEntity.caption),
|
|
150
|
+
body: form.getHtml(),
|
|
151
|
+
onSubmit: function () {
|
|
152
|
+
if (!form.validate())
|
|
153
|
+
return false;
|
|
154
|
+
form.getData()
|
|
155
|
+
.then(function (obj) { return _this.context.updateRecord(obj); })
|
|
156
|
+
.then(function () {
|
|
157
|
+
return _this.refreshData();
|
|
158
|
+
})
|
|
159
|
+
.catch(function (error) {
|
|
160
|
+
_this.processError(error);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
EntityDataView.prototype.rowDbClickHandler = function (ev) {
|
|
166
|
+
if (this.context.getActiveEntity().isEditable) {
|
|
167
|
+
this.showEditForm(ev.row);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
EntityDataView.prototype.deleteClickHandler = function (ev, rowIndex) {
|
|
171
|
+
var _this = this;
|
|
172
|
+
this.grid.getData().getRow(rowIndex)
|
|
173
|
+
.then(function (row) {
|
|
174
|
+
if (row) {
|
|
175
|
+
var activeEntity = _this.context.getActiveEntity();
|
|
176
|
+
var keyAttrs = activeEntity.getPrimaryAttrs();
|
|
177
|
+
var keyVals_1 = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
|
|
178
|
+
var keys_1 = keyAttrs.reduce(function (val, attr, index) {
|
|
179
|
+
var property = attr.id.substring(attr.id.lastIndexOf('.') + 1);
|
|
180
|
+
val[property] = keyVals_1[index];
|
|
181
|
+
return val;
|
|
182
|
+
}, {});
|
|
183
|
+
_this.dlg.openConfirm(i18n.getText('DeleteDlgCaption')
|
|
184
|
+
.replace('{entity}', activeEntity.caption), i18n.getText('DeleteDlgMessage')
|
|
185
|
+
.replace('{recordId}', Object.keys(keys_1)
|
|
186
|
+
.map(function (key) { return "".concat(key, ":").concat(keys_1[key]); }).join(';')))
|
|
187
|
+
.then(function (result) {
|
|
188
|
+
if (result) {
|
|
189
|
+
_this.context.deleteRecord(keys_1)
|
|
190
|
+
.then(function () {
|
|
191
|
+
return _this.refreshData();
|
|
192
|
+
})
|
|
193
|
+
.catch(function (error) {
|
|
194
|
+
_this.processError(error);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
EntityDataView.prototype.processError = function (error) {
|
|
202
|
+
this.dlg.open({
|
|
203
|
+
title: 'Ooops, something went wrong',
|
|
204
|
+
body: error.message,
|
|
205
|
+
closable: true,
|
|
206
|
+
cancelable: false
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
EntityDataView.prototype.refreshData = function () {
|
|
210
|
+
var _this = this;
|
|
211
|
+
return this.context.fetchDataset()
|
|
212
|
+
.then(function () {
|
|
213
|
+
var processed = false;
|
|
214
|
+
if (_this.filterWidget) {
|
|
215
|
+
processed = _this.filterWidget.applyFilter(false);
|
|
216
|
+
}
|
|
217
|
+
if (!processed) {
|
|
218
|
+
_this.grid.refresh();
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
return EntityDataView;
|
|
223
|
+
}());
|
|
224
|
+
export { EntityDataView };
|
|
225
225
|
//# sourceMappingURL=entity_data_view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity_data_view.js","sourceRoot":"","sources":["../../../src/views/entity_data_view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,IAAI,EAAE,KAAK,IA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A,UAAG,GAAG,cAAI,MAAI,CAAC,GAAG,CAAC,CAAE,EAArB,CAAqB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CACxD;qBACA,IAAI,CAAC,UAAC,MAAM;oBACT,IAAI,MAAM,EAAE;wBACR,KAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAI,CAAC;6BAC1B,IAAI,CAAC;4BACF,OAAO,KAAI,CAAC,WAAW,EAAE,CAAC;wBAC9B,CAAC,CAAC;6BACD,KAAK,CAAC,UAAC,KAAK;4BACT,KAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;wBAC7B,CAAC,CAAC,CAAC;qBACV;gBACL,CAAC,CAAC,CAAA;aACL;QACL,CAAC,CAAC,CAAC;IACX,CAAC;IAEO,qCAAY,GAApB,UAAqB,KAAK;QACtB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,6BAA6B;YACpC,IAAI,EAAE,KAAK,CAAC,OAAO;YACnB,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;SACpB,CAAC,CAAC;IACP,CAAC;IAEO,oCAAW,GAAnB;QAAA,iBAYC;QAXG,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;aAC7B,IAAI,CAAC;YACF,IAAI,SAAS,GAAG,KAAK,CAAC;YACtB,IAAI,KAAI,CAAC,YAAY,EAAE;gBACnB,SAAS,GAAG,KAAI,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;aACpD;YAED,IAAI,CAAC,SAAS,EAAE;gBACZ,KAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;aACvB;QACL,CAAC,CAAC,CAAC;IACX,CAAC;IACL,qBAAC;AAAD,CAAC,AAzPD,IAyPC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { EasyDataTableOptions } from '@easydata/core';
|
|
2
|
-
import { EasyGridOptions } from '@easydata/ui';
|
|
3
|
-
export interface EasyDataViewOptions {
|
|
4
|
-
showFilterBox?: boolean;
|
|
5
|
-
showBackToEntities?: boolean;
|
|
6
|
-
grid?: Omit<EasyGridOptions, 'slot' | 'dataTable'>;
|
|
7
|
-
dataTable?: EasyDataTableOptions;
|
|
8
|
-
}
|
|
9
|
-
export interface EasyDataViewDispatcherOptions extends EasyDataViewOptions {
|
|
10
|
-
endpoint?: string;
|
|
11
|
-
basePath?: string;
|
|
12
|
-
rootEntity?: string;
|
|
13
|
-
container?: HTMLElement | string;
|
|
14
|
-
}
|
|
1
|
+
import { EasyDataTableOptions } from '@easydata/core';
|
|
2
|
+
import { EasyGridOptions } from '@easydata/ui';
|
|
3
|
+
export interface EasyDataViewOptions {
|
|
4
|
+
showFilterBox?: boolean;
|
|
5
|
+
showBackToEntities?: boolean;
|
|
6
|
+
grid?: Omit<EasyGridOptions, 'slot' | 'dataTable'>;
|
|
7
|
+
dataTable?: EasyDataTableOptions;
|
|
8
|
+
}
|
|
9
|
+
export interface EasyDataViewDispatcherOptions extends EasyDataViewOptions {
|
|
10
|
+
endpoint?: string;
|
|
11
|
+
basePath?: string;
|
|
12
|
+
rootEntity?: string;
|
|
13
|
+
container?: HTMLElement | string;
|
|
14
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DataContext } from '../main/data_context';
|
|
2
|
-
export declare class RootDataView {
|
|
3
|
-
private slot;
|
|
4
|
-
private context;
|
|
5
|
-
private basePath;
|
|
6
|
-
private metaData;
|
|
7
|
-
constructor(slot: HTMLElement, context: DataContext, basePath: string);
|
|
8
|
-
private renderEntitySelector;
|
|
9
|
-
}
|
|
1
|
+
import { DataContext } from '../main/data_context';
|
|
2
|
+
export declare class RootDataView {
|
|
3
|
+
private slot;
|
|
4
|
+
private context;
|
|
5
|
+
private basePath;
|
|
6
|
+
private metaData;
|
|
7
|
+
constructor(slot: HTMLElement, context: DataContext, basePath: string);
|
|
8
|
+
private renderEntitySelector;
|
|
9
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { i18n } from '@easydata/core';
|
|
2
|
-
import { domel } from '@easydata/ui';
|
|
3
|
-
import { setLocation } from '../utils/utils';
|
|
4
|
-
var RootDataView = /** @class */ (function () {
|
|
5
|
-
function RootDataView(slot, context, basePath) {
|
|
6
|
-
this.slot = slot;
|
|
7
|
-
this.context = context;
|
|
8
|
-
this.basePath = basePath;
|
|
9
|
-
this.metaData = this.context.getMetaData();
|
|
10
|
-
this.slot.innerHTML += "<h1>"
|
|
11
|
-
this.renderEntitySelector();
|
|
12
|
-
}
|
|
13
|
-
RootDataView.prototype.renderEntitySelector = function () {
|
|
14
|
-
var _this = this;
|
|
15
|
-
var entities = this.metaData.getRootEntity().subEntities;
|
|
16
|
-
if (this.slot) {
|
|
17
|
-
domel(this.slot)
|
|
18
|
-
.addChild('div', function (b) { return b
|
|
19
|
-
.addClass('ed-root')
|
|
20
|
-
.addChild('div', function (b) { return b
|
|
21
|
-
.addClass('ed-menu-description')
|
|
22
|
-
.addText(i18n.getText(!_this.metaData.isEmpty() ? 'EntityMenuDesc' : 'ModelIsEmpty')); })
|
|
23
|
-
.addChild('ul', function (b) {
|
|
24
|
-
b.addClass('ed-entity-menu');
|
|
25
|
-
entities.forEach(function (ent) {
|
|
26
|
-
b.addChild('li', function (b) {
|
|
27
|
-
b.addClass('ed-entity-item')
|
|
28
|
-
.on('click', function () {
|
|
29
|
-
setLocation(_this.basePath
|
|
30
|
-
})
|
|
31
|
-
.addChild('div', function (b) {
|
|
32
|
-
b.addClass('ed-entity-item-caption')
|
|
33
|
-
.addText(ent.captionPlural || ent.caption);
|
|
34
|
-
});
|
|
35
|
-
if (ent.description) {
|
|
36
|
-
b.addChild('div', function (b) {
|
|
37
|
-
b.addClass('ed-entity-item-descr')
|
|
38
|
-
.addText(""
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}); });
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
return RootDataView;
|
|
47
|
-
}());
|
|
48
|
-
export { RootDataView };
|
|
1
|
+
import { i18n } from '@easydata/core';
|
|
2
|
+
import { domel } from '@easydata/ui';
|
|
3
|
+
import { setLocation } from '../utils/utils';
|
|
4
|
+
var RootDataView = /** @class */ (function () {
|
|
5
|
+
function RootDataView(slot, context, basePath) {
|
|
6
|
+
this.slot = slot;
|
|
7
|
+
this.context = context;
|
|
8
|
+
this.basePath = basePath;
|
|
9
|
+
this.metaData = this.context.getMetaData();
|
|
10
|
+
this.slot.innerHTML += "<h1>".concat(i18n.getText('RootViewTitle'), "</h1>");
|
|
11
|
+
this.renderEntitySelector();
|
|
12
|
+
}
|
|
13
|
+
RootDataView.prototype.renderEntitySelector = function () {
|
|
14
|
+
var _this = this;
|
|
15
|
+
var entities = this.metaData.getRootEntity().subEntities;
|
|
16
|
+
if (this.slot) {
|
|
17
|
+
domel(this.slot)
|
|
18
|
+
.addChild('div', function (b) { return b
|
|
19
|
+
.addClass('ed-root')
|
|
20
|
+
.addChild('div', function (b) { return b
|
|
21
|
+
.addClass('ed-menu-description')
|
|
22
|
+
.addText(i18n.getText(!_this.metaData.isEmpty() ? 'EntityMenuDesc' : 'ModelIsEmpty')); })
|
|
23
|
+
.addChild('ul', function (b) {
|
|
24
|
+
b.addClass('ed-entity-menu');
|
|
25
|
+
entities.forEach(function (ent) {
|
|
26
|
+
b.addChild('li', function (b) {
|
|
27
|
+
b.addClass('ed-entity-item')
|
|
28
|
+
.on('click', function () {
|
|
29
|
+
setLocation("".concat(_this.basePath, "/").concat(decodeURIComponent(ent.id)));
|
|
30
|
+
})
|
|
31
|
+
.addChild('div', function (b) {
|
|
32
|
+
b.addClass('ed-entity-item-caption')
|
|
33
|
+
.addText(ent.captionPlural || ent.caption);
|
|
34
|
+
});
|
|
35
|
+
if (ent.description) {
|
|
36
|
+
b.addChild('div', function (b) {
|
|
37
|
+
b.addClass('ed-entity-item-descr')
|
|
38
|
+
.addText("".concat(ent.description));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}); });
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return RootDataView;
|
|
47
|
+
}());
|
|
48
|
+
export { RootDataView };
|
|
49
49
|
//# sourceMappingURL=root_data_view.js.map
|