ru.coon 2.8.65 → 3.0.2
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/CHANGELOG.md +319 -6
- package/package.json +1 -1
- package/src/Function.js +1 -1
- package/src/VisualLinker.js +610 -0
- package/src/VisualLinker.scss +219 -0
- package/src/app/Application.js +1 -0
- package/src/app/ApplicationSettings.js +49 -0
- package/src/app/Config.js +60 -0
- package/src/app/Router.js +37 -21
- package/src/app/viewPort/CVWrapperPanel.js +53 -0
- package/src/app/viewPort/CenterView.js +153 -46
- package/src/app/viewPort/CenterView.scss +151 -0
- package/src/app/viewPort/ComponentContextManager.js +24 -0
- package/src/app/viewPort/Main.js +4 -1
- package/src/app/viewPort/Routing.d2 +23 -0
- package/src/app/viewPort/TabHistory.js +81 -0
- package/src/common/ComponentFactory.js +167 -0
- package/src/common/button/DropdownContentButton.js +146 -0
- package/src/common/button/DropdownContentButton.scss +92 -0
- package/src/common/button/DropdownContentButtonController.js +60 -0
- package/src/common/component/editor/EditorFactory.js +3 -1
- package/src/common/component/formeditor/UiCustomFilterForm.scss +0 -1
- package/src/common/component/settings/modules/settingClosePageConfirmation.js +1 -3
- package/src/common/component/settings/modules/settingFavoritePanelShow.js +21 -0
- package/src/common/component/settings/modules/settingReportCalculator.js +22 -0
- package/src/common/component/settings/modules/settingShowNeedReloadMessage.js +1 -3
- package/src/common/component/settings/modules/settingwindowHolder.js +2 -3
- package/src/common/panel/WindowWrap.js +19 -11
- package/src/common/tree/BaseContextMenu.js +4 -3
- package/src/log.js +4 -5
- package/src/nav/AppNavCalcButton.js +23 -0
- package/src/nav/AppNavCalcButton.scss +6 -0
- package/src/nav/AppNavigationBar.js +1 -1
- package/src/nav/AppNavigationMenuController.js +2 -2
- package/src/nav/AppNavigationMenuMinimized.js +61 -0
- package/src/nav/AppNavigationPanel.js +115 -0
- package/src/nav/AppNavigationPanel.scss +178 -0
- package/src/nav/AppNavigationPanelController.js +386 -0
- package/src/nav/FavoriteCfg.js +18 -0
- package/src/nav/MenuEntity.js +23 -15
- package/src/nav/MenuFavoritesBar.js +100 -0
- package/src/nav/MenuFavoritesBar.scss +92 -0
- package/src/nav/editor/NavigateElementEditorView.js +2 -2
- package/src/nav/editor/workspace/NavWorkspaceListView.js +1 -4
- package/src/nav/menu/WorkspaceMenuViewMinimized.js +22 -0
- package/src/overrides/panel/TabPanel.js +36 -0
- package/src/overrides/panel/TabPanel.scss +65 -0
- package/src/report/component/ClearFiltersButton.js +4 -1
- package/src/report/component/CopyCellValueMenuItem.js +18 -0
- package/src/report/component/ReportFieldMap.js +274 -0
- package/src/report/component/ReportPanel.js +73 -44
- package/src/report/component/ReportPanel.scss +2 -2
- package/src/report/component/ReportTagLookup.js +59 -2
- package/src/report/component/calculator/ReportCalculatorController.js +266 -0
- package/src/report/component/calculator/ReportCalculatorField.js +47 -0
- package/src/report/component/calculator/ReportCalculatorHistoryPlugin.js +128 -0
- package/src/report/component/calculator/ReportCalculatorHistoryPlugin.scss +33 -0
- package/src/report/component/calculator/ReportCalculatorMenuItem.js +101 -0
- package/src/report/component/calculator/ReportCalculatorMenuItem.scss +41 -0
- package/src/report/component/calculator/ReportCalculatorPanel.js +363 -0
- package/src/report/component/calculator/ReportCalculatorPanel.scss +86 -0
- package/src/report/component/reportpanel/CopyReportPanelController.js +1 -1
- package/src/report/component/reportpanel/FilterPanel.js +13 -15
- package/src/report/component/reportpanel/FilterPanel.scss +5 -1
- package/src/report/component/reportpanel/FormFieldFocusPlugin.js +157 -0
- package/src/report/component/reportpanel/FormFieldFocusPlugin.scss +14 -0
- package/src/report/component/reportpanel/NorthPanel.js +16 -17
- package/src/report/component/reportpanel/NorthPanel.scss +1 -1
- package/src/report/component/reportpanel/ReportContextMenu.js +219 -0
- package/src/report/component/reportpanel/ReportGrid.js +1 -0
- package/src/report/component/reportpanel/ReportGrid.scss +4 -0
- package/src/report/component/settings/field/ReportFormFieldsGrid.js +2 -2
- package/src/report/component/settings/field/ReportFormFieldsGridController.js +2 -2
- package/src/report/component/settings/property/ReportPropertiesPanelController.js +1 -1
- package/src/report/component/settings/property/ReportPropertyDictionary.js +7 -0
- package/src/report/plugin/configPanel/AddFilterConditionPluginConfigPanel.js +34 -11
- package/src/report/plugin/configPanel/GridFiltersPluginConfigPanelFiltersGrid.js +3 -2
- package/src/report/plugin/configPanel/openCustomPanelButtonPlugin/OpenCustomPanelButtonPluginConfigPanel.js +274 -255
- package/src/report/plugin/configPanel/openCustomPanelButtonPlugin/OpenCustomPanelButtonPluginConfigPanel.scss +17 -0
- package/src/report/plugin/grid/AddFilterConditionPlugin.js +530 -87
- package/src/report/plugin/grid/CalculatorPlugin.js +90 -0
- package/src/report/plugin/grid/GridContextMenu.js +12 -10
- package/src/report/plugin/grid/GridRowCountPlugin.js +0 -1
- package/src/report/plugin/grid/GridToolbarButtonPlugin.js +11 -2
- package/src/report/plugin/grid/OpenCustomPanelButtonPlugin.js +126 -89
- package/src/report/plugin/grid/ReportCharacteristicBindPlugin.js +6 -4
- package/src/report/plugin/grid/ReportColumnStatePlugin.js +15 -3
- package/src/report/plugin/grid/SetSingleParameterPlugin.js +1 -1
- package/src/report/plugin/grid/ToolbarButtonPlugin.js +1 -1
- package/src/report/plugin/grid/addFilterConditionPlugin/AdvancedSearchPanel.js +55 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/AdvancedSearchPanelController.js +226 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/FilterConfigMixin.js +138 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/FilterFieldFactory.js +223 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/FilterItem.js +164 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/FilterItem.scss +21 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/FilterMenu.js +29 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/FilterWrapPanel.js +53 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/FilterWrapPanelController.js +57 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/InfoMenuItem.js +111 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/InfoMenuItem.scss +83 -0
- package/src/report/plugin/grid/addFilterConditionPlugin/SelectColumnPanel.js +102 -0
- package/src/report/selectionModels/MixedRowSelectionModel.js +36 -45
- package/src/report/toolbar/dropdown/ToolbarOverflowButton.js +16 -5
- package/src/report/toolbar/dropdown/ToolbarOverflowPanel.scss +26 -14
- package/src/report/toolbar/layout/ReportToolbarOverflow.js +5 -2
- package/src/ringBuffer.js +7 -3
- package/src/uielement/command/GetUIElementCommand.js +0 -1
- package/src/uielement/component/UiCPWrapper.js +26 -36
- package/src/uielement/component/UiCustomController.js +7 -0
- package/src/uielement/component/UiCustomPanel.js +46 -2
- package/src/uielement/component/settings/UiCustomPanelEditorController.js +35 -29
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginGrid.js +146 -33
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginGrid.scss +28 -0
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginGridController.js +366 -22
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginModel.js +1 -0
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginPanel.js +10 -4
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginPanelController.js +28 -30
- package/src/uielement/plugin/UnifiedButtonToolbarPlugin.js +203 -22
- package/src/uielement/plugin/configPanel/ExecuteFunctionPluginConfigPanelFormEditor.js +4 -36
- package/src/uielement/plugin/configPanel/FireEventPluginConfigPanelFormEditor.js +5 -36
- package/src/uielement/plugin/configPanel/MethodChainPluginConfigPanelFormEditor.js +4 -36
- package/src/uielement/plugin/configPanel/OpenPanelPluginConfigPanelFormEditor.js +2 -38
- package/src/uielement/plugin/configPanel/PrintPdfPluginConfigPanelFormEditor.js +2 -35
- package/src/uielement/plugin/configPanel/UiCPPluginFormPanel.js +54 -0
- package/src/uielement/plugin/configPanel/UnifiedButtonToolbarPluginConfigPanelFormEditor.js +28 -18
- package/src/userSettings.js +1 -0
- package/src/util/ContextManager.js +109 -0
- package/src/util.js +96 -15
- package/src/version.js +1 -1
- package/src/app/viewPort/CenterViewController.js +0 -158
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Ext.define('Coon.report.plugin.grid.addFilterConditionPlugin.AdvancedSearchPanelController', {
|
|
2
|
+
extend: 'Ext.app.ViewController',
|
|
3
|
+
alias: 'controller.AdvancedSearchPanelController',
|
|
4
|
+
mixins: ['Coon.report.plugin.grid.addFilterConditionPlugin.FilterConfigMixin'],
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {Object} filters
|
|
8
|
+
* @param {Object} newFilterConfig
|
|
9
|
+
*/
|
|
10
|
+
doInit(filters, newFilterConfig) {
|
|
11
|
+
if (!Ext.isObject(filters)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
// console.log('filters', filters);
|
|
15
|
+
this.filters = filters;
|
|
16
|
+
this.newFilterConfig = newFilterConfig;
|
|
17
|
+
this.cellValue = newFilterConfig.value;
|
|
18
|
+
this.createItems(this.createConfig());
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
createConfig() {
|
|
22
|
+
const currentColumnDataIndex = this.newFilterConfig.currentColumnDataIndex;
|
|
23
|
+
const currentFilter = Object.values(this.filters).find((conf) => conf.dataIndex === currentColumnDataIndex);
|
|
24
|
+
const activeFilters = Object.values(this.filters);
|
|
25
|
+
|
|
26
|
+
if (!currentFilter && currentColumnDataIndex && this.newFilterConfig.isCurrentColumnFilterable) {
|
|
27
|
+
const newFilterCfg = this.newFilterCfg(currentColumnDataIndex, true, this.newFilterConfig.useCombo);
|
|
28
|
+
this.filters[currentColumnDataIndex] = newFilterCfg;
|
|
29
|
+
activeFilters.push(newFilterCfg);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
activeFilters.forEach((filter) => {
|
|
33
|
+
this.addFilterProperties(filter);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return activeFilters;
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
newFilterCfg(dataIndex, isCurrent, useCombo) {
|
|
40
|
+
const gridColumn = this.getGridColumn(dataIndex);
|
|
41
|
+
return {
|
|
42
|
+
isCurrent,
|
|
43
|
+
columnName: gridColumn.text,
|
|
44
|
+
columnGroup: gridColumn.columnGroup,
|
|
45
|
+
dataIndex,
|
|
46
|
+
type: gridColumn.filter || 'string',
|
|
47
|
+
operator: 'eq',
|
|
48
|
+
useCombo,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
createItems(filters) {
|
|
53
|
+
this.clearItems();
|
|
54
|
+
if (!Array.isArray(filters)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
filters.forEach(function(filter) {
|
|
59
|
+
this.createItem(filter);
|
|
60
|
+
}, this);
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
createItem(filter) {
|
|
64
|
+
const comp = Ext.create({xtype: 'FilterItem', filter});
|
|
65
|
+
comp.on('fieldsadded', function(fields) {
|
|
66
|
+
fields.forEach(function(field) {
|
|
67
|
+
field.on('change', this.validateFilters, this);
|
|
68
|
+
}, this);
|
|
69
|
+
}, this);
|
|
70
|
+
this.getView().insert(0, comp);
|
|
71
|
+
this.getView().fireEvent('addremovefilter');
|
|
72
|
+
comp.on('beforedestroy', this.onRemoveFilter, this);
|
|
73
|
+
comp.on('destroy', this.validateFilters, this);
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
validateFilters() {
|
|
77
|
+
let isFiltersValid = true;
|
|
78
|
+
this.getView().items.each((item) => {
|
|
79
|
+
if ((!item.destroyed || !item.destroying) && !item.isValid()) {
|
|
80
|
+
isFiltersValid = false;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
this.getViewModel().set('isFiltersValid', isFiltersValid);
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
clearItems() {
|
|
87
|
+
this.getView().removeAll();
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
onAddNewFilterClick() {
|
|
91
|
+
const panel = Ext.widget('SelectColumnPanel', {});
|
|
92
|
+
panel.on('selectColumn', this.addFilter, this);
|
|
93
|
+
Ext.widget('WindowWrap', {
|
|
94
|
+
maximizable: false,
|
|
95
|
+
resizable: false,
|
|
96
|
+
autoShow: true,
|
|
97
|
+
closeAction: 'close',
|
|
98
|
+
width: 600,
|
|
99
|
+
height: 720,
|
|
100
|
+
items: panel,
|
|
101
|
+
});
|
|
102
|
+
const filtersKeys = Object.keys(this.filters);
|
|
103
|
+
const filterAllVisible = this.getView().filterAllVisible;
|
|
104
|
+
const filterOptions = this.getView().filterOptions;
|
|
105
|
+
const reportColumns = this.getGridColumns().filter(function(el) {
|
|
106
|
+
return !filtersKeys.includes(el.dataIndex) && (filterAllVisible || filterOptions[el.dataIndex]);
|
|
107
|
+
}, this);
|
|
108
|
+
const treeData = this.getTreeData(reportColumns);
|
|
109
|
+
panel.getStore().setRoot(treeData);
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
getTreeData(data) {
|
|
113
|
+
data = Ext.clone(data);
|
|
114
|
+
const treeData = {
|
|
115
|
+
expanded: true,
|
|
116
|
+
children: [],
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* @param node
|
|
120
|
+
* @param {Array} groupHeader
|
|
121
|
+
*/
|
|
122
|
+
const addTreeNode = function(node, groupHeader, column) {
|
|
123
|
+
const nodeText= groupHeader.shift();
|
|
124
|
+
let found = node.find((el) => el.text === nodeText);
|
|
125
|
+
if (!found) {
|
|
126
|
+
found = {
|
|
127
|
+
text: nodeText,
|
|
128
|
+
expanded: true,
|
|
129
|
+
children: [],
|
|
130
|
+
leaf: false,
|
|
131
|
+
};
|
|
132
|
+
node.push(found);
|
|
133
|
+
}
|
|
134
|
+
if (groupHeader.length) {
|
|
135
|
+
addTreeNode(found.children, groupHeader, column);
|
|
136
|
+
} else {
|
|
137
|
+
found.children.push({
|
|
138
|
+
text: column.text,
|
|
139
|
+
columnGroup: column.columnGroup,
|
|
140
|
+
id: column.dataIndex,
|
|
141
|
+
leaf: true,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
data.forEach((column) => {
|
|
146
|
+
const groupHeader = column.groupHeader;
|
|
147
|
+
if (Array.isArray(groupHeader) && groupHeader.length) {
|
|
148
|
+
addTreeNode(treeData.children, groupHeader, column);
|
|
149
|
+
} else {
|
|
150
|
+
treeData.children.push({
|
|
151
|
+
text: column.text,
|
|
152
|
+
id: column.dataIndex,
|
|
153
|
+
leaf: true,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return treeData;
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
closeHandler() {
|
|
161
|
+
this.getView().fireEvent('close');
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
filterHandler() {
|
|
165
|
+
this.applyHandler();
|
|
166
|
+
this.closeHandler();
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
applyHandler() {
|
|
170
|
+
this.fireFilterConfig();
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
fireFilterConfig() {
|
|
174
|
+
const filters = this.getFilters().map((rec) => {
|
|
175
|
+
return {
|
|
176
|
+
dataIndex: rec.dataIndex,
|
|
177
|
+
operator: rec.type === 'list' ? 'in': rec.operator,
|
|
178
|
+
value: rec.operator === 'between' ?
|
|
179
|
+
[rec.fromValue, rec.toValue].map(this.prepareValue):
|
|
180
|
+
this.prepareValue(rec.fromValue),
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
this.getView().fireEvent('addfilters', filters);
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
getFilters() {
|
|
187
|
+
const filters = [];
|
|
188
|
+
this.getView().items.each(function(filterPanel) {
|
|
189
|
+
const filter = filterPanel.getFilter();
|
|
190
|
+
filters.push(filter);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
return filters;
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Удалили панель фильтрации
|
|
198
|
+
* @param {Coon.report.plugin.grid.addFilterConditionPlugin.FilterItem} filterPanel
|
|
199
|
+
*/
|
|
200
|
+
onRemoveFilter: function(filterPanel) {
|
|
201
|
+
Coon.log.debug('onRemoveFilter', filterPanel);
|
|
202
|
+
const filter = filterPanel.getViewModel().get('filter');
|
|
203
|
+
const dataIndex = filter.dataIndex;
|
|
204
|
+
delete this.filters[dataIndex];
|
|
205
|
+
this.getView().fireEvent('addremovefilter');
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
addFilter(recordData) {
|
|
209
|
+
Coon.log.debug('addFilter', recordData);
|
|
210
|
+
const dataIndex = recordData.dataIndex;
|
|
211
|
+
if (dataIndex) {
|
|
212
|
+
const filter = this.newFilterCfg(dataIndex);
|
|
213
|
+
this.addFilterProperties(filter);
|
|
214
|
+
Coon.log.debug('newFilterData', filter);
|
|
215
|
+
this.filters[dataIndex] = filter;
|
|
216
|
+
this.createItem(filter);
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
isCurrent(dataIndex) {
|
|
221
|
+
const found = Object.values(this.filters).find((filter) => {
|
|
222
|
+
return filter.dataIndex === dataIndex && filter.isCurrent;
|
|
223
|
+
});
|
|
224
|
+
return !!found;
|
|
225
|
+
},
|
|
226
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Ext.define('Coon.report.plugin.grid.addFilterConditionPlugin.FilterConfigMixin', {
|
|
2
|
+
|
|
3
|
+
addFilterProperties(filter) {
|
|
4
|
+
const isCurrent = this.isCurrent(filter.dataIndex);
|
|
5
|
+
const defaultFilterValueConfig = this.getDefaultFilterValue(filter, isCurrent);
|
|
6
|
+
if (Array.isArray(filter.value) && filter.operator==='between') {
|
|
7
|
+
const betweenValues = filter.value;
|
|
8
|
+
filter.fromValue = betweenValues[0];
|
|
9
|
+
filter.toValue = betweenValues[1];
|
|
10
|
+
} else {
|
|
11
|
+
filter.fromValue = Ext.isEmpty(filter.value) && filter.operator !== 'notfilled' ? defaultFilterValueConfig.value: filter.value;
|
|
12
|
+
filter.toValue = undefined;
|
|
13
|
+
}
|
|
14
|
+
const columnConf = this.report.serviceMap.getColumnData(filter.dataIndex);
|
|
15
|
+
|
|
16
|
+
const column = this.getGridColumn(filter.dataIndex);
|
|
17
|
+
filter.columnName = column.text;
|
|
18
|
+
filter.columnGroup = column.columnGroup;
|
|
19
|
+
if (columnConf) {
|
|
20
|
+
if (filter.type==='list' || (filter.type==='string' && filter.useCombo)) {
|
|
21
|
+
const uniqSet = columnConf ? columnConf.data: [];
|
|
22
|
+
const listData = [...uniqSet].filter((value) => !Ext.isEmpty(value)).map((value) => ({
|
|
23
|
+
value,
|
|
24
|
+
}));
|
|
25
|
+
Ext.apply(filter, {listData});
|
|
26
|
+
}
|
|
27
|
+
Ext.apply(filter, this.getExtremum(filter.type, columnConf));
|
|
28
|
+
}
|
|
29
|
+
if (filter.type==='boolean') {
|
|
30
|
+
const booleanLabels = column && column.booleanLabels;
|
|
31
|
+
if (booleanLabels) {
|
|
32
|
+
Ext.apply(filter, {booleanLabels});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
defaultOperator: {
|
|
38
|
+
string: 'eq',
|
|
39
|
+
numeric: 'eq',
|
|
40
|
+
date: 'eq',
|
|
41
|
+
boolean: 'eq',
|
|
42
|
+
list: 'in',
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Значение по умолчанию для фильтра
|
|
46
|
+
* @param {string} filter - тип фильтра
|
|
47
|
+
* @param {boolean} isByCellClicked - был клик по конкретной колонке
|
|
48
|
+
*/
|
|
49
|
+
getDefaultFilterValue(filter, isByCellClicked) {
|
|
50
|
+
let value;
|
|
51
|
+
const columnConf = this.report.serviceMap.getColumnData(filter.dataIndex);
|
|
52
|
+
const extremum = this.getExtremum(filter.type, columnConf);
|
|
53
|
+
const extremumValue = isByCellClicked ? this.cellValue: extremum && extremum.minValue;
|
|
54
|
+
|
|
55
|
+
switch (filter.type) {
|
|
56
|
+
case 'boolean':
|
|
57
|
+
value = Ext.isBoolean(this.cellValue) ? this.cellValue: true;
|
|
58
|
+
break;
|
|
59
|
+
case 'list':
|
|
60
|
+
value = [this.cellValue];
|
|
61
|
+
break;
|
|
62
|
+
case 'numeric':
|
|
63
|
+
case 'date':
|
|
64
|
+
value = extremumValue;
|
|
65
|
+
break;
|
|
66
|
+
case 'string':
|
|
67
|
+
value = isByCellClicked ? this.cellValue: undefined;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
value,
|
|
72
|
+
operator: Ext.isEmpty(value) ? 'notfilled': this.defaultOperator[filter.type],
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
getGridColumns() {
|
|
77
|
+
if (!this.gridColumns) {
|
|
78
|
+
this.gridColumns = this.getView().reportGrid.getVisibleColumns()
|
|
79
|
+
.filter((column) => column.dataIndex /* && !column.isXType('checkcolumn')*/)
|
|
80
|
+
.map((column) => {
|
|
81
|
+
const isBooleancolumn = column.isXType('booleancolumn');
|
|
82
|
+
const groupHeader = Ext.isString(column.columnGroup) && Ext.util.Format.stripTags(column.columnGroup).split(';');
|
|
83
|
+
return {
|
|
84
|
+
groupHeader: groupHeader,
|
|
85
|
+
columnGroup: column.columnGroup,
|
|
86
|
+
dataIndex: column.dataIndex,
|
|
87
|
+
text: this.prepareText(column.text) || column.dataIndex,
|
|
88
|
+
filter: column.filter.type,
|
|
89
|
+
booleanLabels: isBooleancolumn ? {trueText: column.trueText, falseText: column.falseText} :{},
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return this.gridColumns;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
getGridColumn(dataIndex) {
|
|
97
|
+
if (!dataIndex) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return this.getGridColumns().find((column) => column.dataIndex === dataIndex);
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
prepareText(str) {
|
|
104
|
+
if (!Ext.isString(str)) {
|
|
105
|
+
return str;
|
|
106
|
+
}
|
|
107
|
+
const replaced = str.replace(/<br\s*\/?>/gi, ' ');
|
|
108
|
+
return Ext.util.Format.stripTags(replaced);
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
getExtremum(filterType, columnConf) {
|
|
112
|
+
if (Ext.isObject(columnConf) && columnConf.isExtremum) {
|
|
113
|
+
if (filterType==='date') {
|
|
114
|
+
const format = Coon.format.date;
|
|
115
|
+
const minValue = columnConf.data.get('min'); // milliseconds
|
|
116
|
+
const maxValue = columnConf.data.get('max'); // milliseconds
|
|
117
|
+
return {
|
|
118
|
+
minValue: new Date(minValue),
|
|
119
|
+
minValueText: Ext.Date.format(new Date(minValue), format),
|
|
120
|
+
maxValue: new Date(maxValue),
|
|
121
|
+
maxValueText: Ext.Date.format(new Date(maxValue), format),
|
|
122
|
+
};
|
|
123
|
+
} else {
|
|
124
|
+
return {
|
|
125
|
+
minValue: columnConf.data.get('min'),
|
|
126
|
+
maxValue: columnConf.data.get('max'),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
prepareValue(value) {
|
|
135
|
+
const checkIsDate = Ext.Date.parse(value, Coon.format.dateTimeInternal);
|
|
136
|
+
return checkIsDate ? checkIsDate: value;
|
|
137
|
+
},
|
|
138
|
+
});
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
Ext.define('Coon.report.plugin.grid.addFilterConditionPlugin.FilterFieldFactory', {
|
|
2
|
+
|
|
3
|
+
getFields(type, options) {
|
|
4
|
+
if (!Ext.isObject(options)) {
|
|
5
|
+
options = {};
|
|
6
|
+
}
|
|
7
|
+
switch (type) {
|
|
8
|
+
case 'string':
|
|
9
|
+
return this.getStringFields(options);
|
|
10
|
+
case 'date':
|
|
11
|
+
return this.getDateFields();
|
|
12
|
+
case 'boolean':
|
|
13
|
+
return this.getBooleanFields(options.booleanLabels);
|
|
14
|
+
case 'numeric':
|
|
15
|
+
return this.getNumericFields();
|
|
16
|
+
case 'list':
|
|
17
|
+
return this.getListFields(options.listData);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
getListFields(data) {
|
|
22
|
+
return Ext.create({
|
|
23
|
+
xtype: 'tagfield',
|
|
24
|
+
cls: 'simple-report-tag',
|
|
25
|
+
// growMax: 150,
|
|
26
|
+
grow: false,
|
|
27
|
+
fieldLabel: 'Значение',
|
|
28
|
+
displayField: 'value',
|
|
29
|
+
valueField: 'value',
|
|
30
|
+
// filterPickList: true,
|
|
31
|
+
queryMode: 'local',
|
|
32
|
+
store: {
|
|
33
|
+
fields: ['value'],
|
|
34
|
+
data,
|
|
35
|
+
},
|
|
36
|
+
bind: {
|
|
37
|
+
value: '{filter.fromValue}',
|
|
38
|
+
},
|
|
39
|
+
triggers: {
|
|
40
|
+
clear: Ext.apply({}, {weight: -1}, this.getClearTrigger()),
|
|
41
|
+
},
|
|
42
|
+
listeners: {
|
|
43
|
+
change: (field, value) => {
|
|
44
|
+
if (Array.isArray(value) && !value.length) {
|
|
45
|
+
value = false;
|
|
46
|
+
}
|
|
47
|
+
field.triggers.clear.setHidden(!value);
|
|
48
|
+
},
|
|
49
|
+
beforequery: (e) => {
|
|
50
|
+
e.forceAll = false;
|
|
51
|
+
const len = e.query.length;
|
|
52
|
+
e.query = new RegExp('.*' + Ext.String.escapeRegex(e.query) + '.*', 'i');
|
|
53
|
+
e.query.length = len;
|
|
54
|
+
return true;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
getBooleanFields(labels) {
|
|
60
|
+
labels = labels || {};
|
|
61
|
+
return {
|
|
62
|
+
xtype: 'container',
|
|
63
|
+
items: {
|
|
64
|
+
xtype: 'radiogroup',
|
|
65
|
+
layout: {
|
|
66
|
+
type: 'hbox',
|
|
67
|
+
},
|
|
68
|
+
simpleValue: true,
|
|
69
|
+
items: [
|
|
70
|
+
{boxLabel: labels.trueText || 'Да', name: 'condition', inputValue: true},
|
|
71
|
+
{boxLabel: labels.falseText || 'Нет', name: 'condition', inputValue: false, margin: '0 0 0 15'}
|
|
72
|
+
],
|
|
73
|
+
bind: {
|
|
74
|
+
value: '{filter.fromValue}',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
maxWidth: 550,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
getNumericFields() {
|
|
81
|
+
const numberDefaultConfig = {
|
|
82
|
+
xtype: 'numberfield',
|
|
83
|
+
fieldLabel: 'Значение ',
|
|
84
|
+
allowDecimals: true,
|
|
85
|
+
hideTrigger: true,
|
|
86
|
+
decimalSeparator: Coon.Function.getDecimalSeparator(),
|
|
87
|
+
triggers: {
|
|
88
|
+
clear: this.getClearTrigger(),
|
|
89
|
+
},
|
|
90
|
+
listeners: {
|
|
91
|
+
change: (field, value) => {
|
|
92
|
+
let hide = true;
|
|
93
|
+
if (Ext.isNumber(value)) {
|
|
94
|
+
hide = false;
|
|
95
|
+
}
|
|
96
|
+
field.triggers.clear.setHidden(hide);
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
return [
|
|
101
|
+
Ext.apply({}, {
|
|
102
|
+
bind: {
|
|
103
|
+
fieldLabel: 'мин. {filter.minValue}',
|
|
104
|
+
value: '{filter.fromValue}',
|
|
105
|
+
minValue: '{filter.minValue}',
|
|
106
|
+
},
|
|
107
|
+
}, numberDefaultConfig),
|
|
108
|
+
Ext.apply({}, {
|
|
109
|
+
bind: {
|
|
110
|
+
fieldLabel: 'макс. {filter.maxValue}',
|
|
111
|
+
value: '{filter.toValue}',
|
|
112
|
+
maxValue: '{filter.maxValue}',
|
|
113
|
+
disabled: '{valueToDisabled}',
|
|
114
|
+
},
|
|
115
|
+
}, numberDefaultConfig)
|
|
116
|
+
];
|
|
117
|
+
},
|
|
118
|
+
getStringFields(options) {
|
|
119
|
+
if (options.useCombo) {
|
|
120
|
+
return [Ext.create({
|
|
121
|
+
xtype: 'BaseComboBox',
|
|
122
|
+
flex: 1,
|
|
123
|
+
fieldLabel: 'Значение',
|
|
124
|
+
forceSelection: true,
|
|
125
|
+
bind: {
|
|
126
|
+
value: '{filter.fromValue}',
|
|
127
|
+
},
|
|
128
|
+
triggers: {
|
|
129
|
+
clear: Ext.apply({}, {weight: -1}, this.getClearTrigger()),
|
|
130
|
+
},
|
|
131
|
+
displayField: 'value',
|
|
132
|
+
valueField: 'value',
|
|
133
|
+
listeners: {
|
|
134
|
+
change: (field, value) => {
|
|
135
|
+
field.triggers.clear.setHidden(!value);
|
|
136
|
+
},
|
|
137
|
+
beforequery: (e) => {
|
|
138
|
+
e.forceAll = false;
|
|
139
|
+
const len = e.query.length;
|
|
140
|
+
e.query = new RegExp('.*' + Ext.String.escapeRegex(e.query) + '.*', 'i');
|
|
141
|
+
e.query.length = len;
|
|
142
|
+
return true;
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
store: {
|
|
146
|
+
fields: ['value'],
|
|
147
|
+
data: options.listData,
|
|
148
|
+
},
|
|
149
|
+
})];
|
|
150
|
+
} else {
|
|
151
|
+
const stringDefaultConfig = {
|
|
152
|
+
xtype: 'textfield',
|
|
153
|
+
reference: 'filterValueField',
|
|
154
|
+
fieldLabel: 'Значение',
|
|
155
|
+
flex: 1,
|
|
156
|
+
triggers: {
|
|
157
|
+
clear: this.getClearTrigger(),
|
|
158
|
+
},
|
|
159
|
+
listeners: {
|
|
160
|
+
change: (field, value) => {
|
|
161
|
+
field.triggers.clear.setHidden(!value);
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
formatText: '',
|
|
165
|
+
bind: {
|
|
166
|
+
fieldLabel: 'Значение',
|
|
167
|
+
value: '{filter.fromValue}',
|
|
168
|
+
disabled: '{notfilledDisabled}',
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return [stringDefaultConfig];
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
getDateFields() {
|
|
176
|
+
const dateDefaultConfig = {
|
|
177
|
+
xtype: 'datefield',
|
|
178
|
+
fieldLabel: 'Дата',
|
|
179
|
+
triggers: {
|
|
180
|
+
clear: Ext.apply({}, {weight: -1}, this.getClearTrigger()),
|
|
181
|
+
},
|
|
182
|
+
listeners: {
|
|
183
|
+
change: (field, value) => {
|
|
184
|
+
field.triggers.clear.setHidden(!value);
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
formatText: '',
|
|
188
|
+
};
|
|
189
|
+
return [
|
|
190
|
+
Ext.apply({}, {
|
|
191
|
+
fieldLabel: 'От',
|
|
192
|
+
bind: {
|
|
193
|
+
fieldLabel: 'От (мин. {filter.minValueText})',
|
|
194
|
+
value: '{filter.fromValue}',
|
|
195
|
+
maxValue: '{filter.maxValue}',
|
|
196
|
+
minValue: '{filter.minValue}',
|
|
197
|
+
},
|
|
198
|
+
}, dateDefaultConfig),
|
|
199
|
+
Ext.apply({}, {
|
|
200
|
+
fieldLabel: 'До',
|
|
201
|
+
bind: {
|
|
202
|
+
fieldLabel: 'До (макс. {filter.maxValueText})',
|
|
203
|
+
value: '{filter.toValue}',
|
|
204
|
+
maxValue: '{filter.maxValue}',
|
|
205
|
+
minValue: '{filter.minValue}',
|
|
206
|
+
disabled: '{valueToDisabled}',
|
|
207
|
+
},
|
|
208
|
+
}, dateDefaultConfig)
|
|
209
|
+
];
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
getClearTrigger() {
|
|
213
|
+
return {
|
|
214
|
+
cls: 'svg-icon svg-icon-cancel-small',
|
|
215
|
+
tooltip: 'Очистить поле',
|
|
216
|
+
hidden: true,
|
|
217
|
+
hideOnReadOnly: true,
|
|
218
|
+
handler: function() {
|
|
219
|
+
this.setValue(null);
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
});
|