@easyquery/ui 7.4.0-rc02 → 7.4.0-rc04
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/assets/css/easyquery.css +1 -0
- package/dist/assets/css/easyquery.ui.css +3 -0
- package/dist/easyquery.ui.cjs.js +140 -67
- package/dist/easyquery.ui.esm.js +141 -68
- package/dist/types/widgets/columns_bar.d.ts +1 -0
- package/dist/types/widgets/renderers/columnsbar/editable_column_renderer_cb.d.ts +5 -0
- package/dist/types/widgets/widget_options.d.ts +7 -0
- package/package.json +2 -2
|
@@ -3295,6 +3295,9 @@ body {
|
|
|
3295
3295
|
position: relative;
|
|
3296
3296
|
font: normal 14px Trebuchet MS, Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif;
|
|
3297
3297
|
padding: 0.5rem;
|
|
3298
|
+
-webkit-user-select: none;
|
|
3299
|
+
-moz-user-select: none;
|
|
3300
|
+
user-select: none;
|
|
3298
3301
|
}
|
|
3299
3302
|
|
|
3300
3303
|
.eqjs-cb-header, .eqjs-sb-header {
|
package/dist/easyquery.ui.cjs.js
CHANGED
|
@@ -613,6 +613,13 @@ class EntitiesPanel extends core.Widget {
|
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
+
exports.ColumnsEditMode = void 0;
|
|
617
|
+
(function (ColumnsEditMode) {
|
|
618
|
+
ColumnsEditMode[ColumnsEditMode["ReadOnly"] = 0] = "ReadOnly";
|
|
619
|
+
ColumnsEditMode[ColumnsEditMode["FixedList"] = 16] = "FixedList";
|
|
620
|
+
ColumnsEditMode[ColumnsEditMode["Full"] = 255] = "Full";
|
|
621
|
+
})(exports.ColumnsEditMode || (exports.ColumnsEditMode = {}));
|
|
622
|
+
|
|
616
623
|
class MenuLevel {
|
|
617
624
|
get applyItem() {
|
|
618
625
|
return this._applyItem;
|
|
@@ -2009,15 +2016,22 @@ class ColumnRendererCP {
|
|
|
2009
2016
|
this.createFormatsMenu();
|
|
2010
2017
|
}
|
|
2011
2018
|
this.createButtonMenu();
|
|
2019
|
+
const isFullMode = this.panel.options.editMode === exports.ColumnsEditMode.Full;
|
|
2020
|
+
const isReadOnlyMode = this.panel.options.editMode === exports.ColumnsEditMode.ReadOnly;
|
|
2021
|
+
const showCheckboxes = this.panel.options.showCheckboxes !== false;
|
|
2012
2022
|
builder
|
|
2013
2023
|
.addClass(this.getClassesToAdd())
|
|
2014
|
-
.addClass(getMobileCssClass())
|
|
2015
|
-
|
|
2024
|
+
.addClass(getMobileCssClass());
|
|
2025
|
+
if (showCheckboxes && !isReadOnlyMode && !this.column.isReadOnly()) {
|
|
2026
|
+
builder.addChildElement(this.renderCheckbox());
|
|
2027
|
+
}
|
|
2028
|
+
if (!isReadOnlyMode) {
|
|
2016
2029
|
//start sort button
|
|
2017
|
-
.addChild('div', builder => builder
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2030
|
+
builder.addChild('div', builder => builder
|
|
2031
|
+
.addClass(`${eqCssPrefix}-button-placeholder`, `${this.cssPrefix}-button-placeholder`, `${this.cssPrefix}-colelement`, `${this.cssPrefix}-sortbutton-placeholder`)
|
|
2032
|
+
.addChildElement(this.sortingButton));
|
|
2033
|
+
// end sort button
|
|
2034
|
+
}
|
|
2021
2035
|
builder.addChildElement(this.renderExpressionBlock());
|
|
2022
2036
|
if (this.panel.options.showColumnTitles !== false && !ui.browserUtils.isMobileMode()) {
|
|
2023
2037
|
builder
|
|
@@ -2031,36 +2045,37 @@ class ColumnRendererCP {
|
|
|
2031
2045
|
builder
|
|
2032
2046
|
.addClass(`${eqCssPrefix}-column-buttonsBlock`, `${this.cssPrefix}-buttonsBlock`)
|
|
2033
2047
|
.addClass(getMobileCssClass());
|
|
2048
|
+
const buttonsToShow = this.getButtonsToShow();
|
|
2034
2049
|
//start enable button
|
|
2035
|
-
if (
|
|
2050
|
+
if (buttonsToShow.indexOf("enable") >= 0 && isFullMode && !showCheckboxes && !this.column.isReadOnly()) {
|
|
2036
2051
|
builder.addChildElement(this.renderEnabledButton());
|
|
2037
2052
|
buttonsIndex++;
|
|
2038
2053
|
buttonsList += 'Enable';
|
|
2039
2054
|
}
|
|
2040
2055
|
//end enable button
|
|
2041
2056
|
//start aggr func button
|
|
2042
|
-
if (
|
|
2057
|
+
if (buttonsToShow.indexOf("type") >= 0 && this.columnEnabled && isFullMode) {
|
|
2043
2058
|
builder.addChildElement(this.renderColumnTypeButton());
|
|
2044
2059
|
buttonsIndex++;
|
|
2045
2060
|
buttonsList += 'Type';
|
|
2046
2061
|
}
|
|
2047
2062
|
//end aggr func button
|
|
2048
2063
|
//start format selector button
|
|
2049
|
-
if (
|
|
2064
|
+
if (buttonsToShow.indexOf("format") >= 0 && this.columnEnabled && !isReadOnlyMode) {
|
|
2050
2065
|
builder.addChildElement(this.renderColumnFormatButton());
|
|
2051
2066
|
buttonsIndex++;
|
|
2052
2067
|
buttonsList += 'Format';
|
|
2053
2068
|
}
|
|
2054
2069
|
//end format selector button
|
|
2055
2070
|
//start delete button
|
|
2056
|
-
if (
|
|
2071
|
+
if (buttonsToShow.indexOf("delete") >= 0 && isFullMode && !this.column.isReadOnly()) {
|
|
2057
2072
|
builder.addChildElement(this.renderDeleteButton());
|
|
2058
2073
|
buttonsIndex++;
|
|
2059
2074
|
buttonsList += 'Delete';
|
|
2060
2075
|
}
|
|
2061
2076
|
//end delete button
|
|
2062
2077
|
//start menu button
|
|
2063
|
-
if (
|
|
2078
|
+
if (buttonsToShow.indexOf("menu") >= 0 && !(this.column.isReadOnly() || isReadOnlyMode)) {
|
|
2064
2079
|
builder.addChildElement(this.renderMenuButton());
|
|
2065
2080
|
buttonsIndex++;
|
|
2066
2081
|
buttonsList += 'Menu';
|
|
@@ -2084,7 +2099,7 @@ class ColumnRendererCP {
|
|
|
2084
2099
|
if (this.panel.options.alwaysShowButtons) {
|
|
2085
2100
|
this.showButtons();
|
|
2086
2101
|
}
|
|
2087
|
-
if (
|
|
2102
|
+
if (!showCheckboxes) {
|
|
2088
2103
|
builder.addClass("eqjs-no-checkbox");
|
|
2089
2104
|
}
|
|
2090
2105
|
return this.element;
|
|
@@ -2260,25 +2275,20 @@ class ColumnRendererCP {
|
|
|
2260
2275
|
.toDOM();
|
|
2261
2276
|
}
|
|
2262
2277
|
renderCheckbox() {
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
.toDOM();
|
|
2278
|
-
}
|
|
2279
|
-
else {
|
|
2280
|
-
return null;
|
|
2281
|
-
}
|
|
2278
|
+
return ui.domel("div")
|
|
2279
|
+
.title(core.i18n.getText('CmdToggleEnable'))
|
|
2280
|
+
.attr('tabIndex', '0')
|
|
2281
|
+
.addClass(`${this.cssPrefix}-colelement ${this.cssPrefix}-column-checkbox`)
|
|
2282
|
+
.addClass(`${this.columnEnabled ? 'enabled' : ''}`)
|
|
2283
|
+
.on('click', () => {
|
|
2284
|
+
this.columnEnabled = !this.columnEnabled;
|
|
2285
|
+
this.column.fireChangedEvent();
|
|
2286
|
+
return false;
|
|
2287
|
+
})
|
|
2288
|
+
.on('keypress', evt => { if ([13, 32].includes(evt.keyCode)) {
|
|
2289
|
+
evt.target.click();
|
|
2290
|
+
} })
|
|
2291
|
+
.toDOM();
|
|
2282
2292
|
}
|
|
2283
2293
|
renderDeleteButton() {
|
|
2284
2294
|
return ui.domel('div')
|
|
@@ -2374,7 +2384,13 @@ class ColumnRendererCP {
|
|
|
2374
2384
|
} })).toDOM();
|
|
2375
2385
|
}
|
|
2376
2386
|
isEditable() {
|
|
2377
|
-
|
|
2387
|
+
// Allow editing (title/sort/order) in Full or FixedList mode only
|
|
2388
|
+
switch (this.panel.options.editMode) {
|
|
2389
|
+
case exports.ColumnsEditMode.ReadOnly:
|
|
2390
|
+
return false;
|
|
2391
|
+
default:
|
|
2392
|
+
return this.column.enabled && !this.column.isReadOnly();
|
|
2393
|
+
}
|
|
2378
2394
|
}
|
|
2379
2395
|
changeFormatHandler(ev) {
|
|
2380
2396
|
const formats = this.panel
|
|
@@ -2527,7 +2543,18 @@ class ColumnRendererCP {
|
|
|
2527
2543
|
.concat(formats.map(format => ({ id: format.format, text: core.i18n.getText("DisplayFormats", format.name) || format.name })));
|
|
2528
2544
|
}
|
|
2529
2545
|
getButtonsToShow() {
|
|
2530
|
-
|
|
2546
|
+
// In ReadOnly mode, no buttons
|
|
2547
|
+
if (this.panel.options.editMode === exports.ColumnsEditMode.ReadOnly) {
|
|
2548
|
+
return [];
|
|
2549
|
+
}
|
|
2550
|
+
// In FixedList mode, only allow sorting and caption editing
|
|
2551
|
+
if (this.panel.options.editMode === exports.ColumnsEditMode.FixedList) {
|
|
2552
|
+
return ["sorting", "format"];
|
|
2553
|
+
}
|
|
2554
|
+
// Default (Full)
|
|
2555
|
+
return this.panel.options.buttons && Array.isArray(this.panel.options.buttons)
|
|
2556
|
+
? this.panel.options.buttons
|
|
2557
|
+
: ["enable", "delete", "type", "sorting", "format"];
|
|
2531
2558
|
}
|
|
2532
2559
|
buttonMenuHandler(action, evt) {
|
|
2533
2560
|
switch (action) {
|
|
@@ -2760,7 +2787,7 @@ class AttrColumnRendererCP extends ColumnRendererCP {
|
|
|
2760
2787
|
renderBaseExpression() {
|
|
2761
2788
|
const baseAttr = this.getAttribute();
|
|
2762
2789
|
const attrCaption = this.panel.getContext().getAttributeTitle(baseAttr);
|
|
2763
|
-
if (this.isEditable()) {
|
|
2790
|
+
if (this.isEditable() && this.panel.options.editMode === exports.ColumnsEditMode.Full) {
|
|
2764
2791
|
return ui.domel('a')
|
|
2765
2792
|
.attr('href', 'javascript:void(0)')
|
|
2766
2793
|
.title(attrCaption)
|
|
@@ -2779,10 +2806,12 @@ class AttrColumnRendererCP extends ColumnRendererCP {
|
|
|
2779
2806
|
})
|
|
2780
2807
|
.toDOM();
|
|
2781
2808
|
}
|
|
2782
|
-
|
|
2783
|
-
.
|
|
2784
|
-
|
|
2785
|
-
|
|
2809
|
+
else {
|
|
2810
|
+
return ui.domel('span')
|
|
2811
|
+
.text(attrCaption)
|
|
2812
|
+
.title(attrCaption)
|
|
2813
|
+
.toDOM();
|
|
2814
|
+
}
|
|
2786
2815
|
}
|
|
2787
2816
|
baseExpressionItemSelectedCallback(data, item) {
|
|
2788
2817
|
const attrid = data.id;
|
|
@@ -2933,7 +2962,8 @@ class AggrFuncColumnRendererCP extends AttrColumnRendererCP {
|
|
|
2933
2962
|
for (let idx = 0; idx < arrLength; idx++) {
|
|
2934
2963
|
item = arrFormat[idx];
|
|
2935
2964
|
if (item.type === 1) {
|
|
2936
|
-
|
|
2965
|
+
// Only allow function/type change in Full mode
|
|
2966
|
+
if (this.panel.options.editMode === exports.ColumnsEditMode.Full && this.isEditable()) {
|
|
2937
2967
|
const functionLink = ui.domel('a')
|
|
2938
2968
|
.attr('href', 'javascript:void(0)')
|
|
2939
2969
|
.text(item.text)
|
|
@@ -3070,7 +3100,7 @@ class EditableColumnRendererCP extends AttrColumnRendererCP {
|
|
|
3070
3100
|
let builder = ui.domel('div', exprBlock)
|
|
3071
3101
|
.addClass(`${this.cssPrefix}-colelement`, `${this.cssPrefix}-attrelement`)
|
|
3072
3102
|
.addClass(getMobileCssClass());
|
|
3073
|
-
if (this.isEditable()) {
|
|
3103
|
+
if (this.isEditable() && this.panel.options.editMode === exports.ColumnsEditMode.Full) {
|
|
3074
3104
|
builder
|
|
3075
3105
|
.addChild('a', b => b
|
|
3076
3106
|
.attr('href', 'javascript:void(0)')
|
|
@@ -3146,7 +3176,8 @@ class EditableColumnRendererCP extends AttrColumnRendererCP {
|
|
|
3146
3176
|
builder = ui.domel('div', exprBlock)
|
|
3147
3177
|
.addClass(`${this.cssPrefix}-colelement`, `${this.cssPrefix}-attrelement`)
|
|
3148
3178
|
.addClass(getMobileCssClass());
|
|
3149
|
-
|
|
3179
|
+
// Only allow data type change in Full mode
|
|
3180
|
+
if (this.panel.options.editMode === exports.ColumnsEditMode.Full && this.isEditable()) {
|
|
3150
3181
|
this.createDataTypeMenu();
|
|
3151
3182
|
builder
|
|
3152
3183
|
.addChild('a', dataTypeLink => dataTypeLink
|
|
@@ -3166,7 +3197,6 @@ class EditableColumnRendererCP extends AttrColumnRendererCP {
|
|
|
3166
3197
|
}));
|
|
3167
3198
|
}
|
|
3168
3199
|
else {
|
|
3169
|
-
this.column.expr.dataType;
|
|
3170
3200
|
builder
|
|
3171
3201
|
.addChild('span', b => {
|
|
3172
3202
|
b.text(core$1.DataType[this.column.expr.dataType])
|
|
@@ -3317,7 +3347,8 @@ class ColumnsPanel extends core.Widget {
|
|
|
3317
3347
|
customExpressionText: 0,
|
|
3318
3348
|
allowHiddenColumns: false,
|
|
3319
3349
|
showAddAllForEntity: false,
|
|
3320
|
-
showIndicatorOnLoad: true
|
|
3350
|
+
showIndicatorOnLoad: true,
|
|
3351
|
+
editMode: exports.ColumnsEditMode.Full
|
|
3321
3352
|
};
|
|
3322
3353
|
this.landingSlot = ui.domel('div')
|
|
3323
3354
|
.addClass(`${this.cssPrefix}-col-landing-slot`)
|
|
@@ -3423,7 +3454,8 @@ class ColumnsPanel extends core.Widget {
|
|
|
3423
3454
|
.addClass(`${this.cssPrefix}-columns`)
|
|
3424
3455
|
.addClass(getMobileCssClass())
|
|
3425
3456
|
.toDOM();
|
|
3426
|
-
|
|
3457
|
+
// Only show add row in Full edit mode
|
|
3458
|
+
if (this.options.showAddRow && this.options.editMode === exports.ColumnsEditMode.Full) {
|
|
3427
3459
|
this.addRowElement =
|
|
3428
3460
|
ui.domel('div', this.slot)
|
|
3429
3461
|
.addClass(`${eqCssPrefix}-addrow`, `${this.cssPrefix}-addrow`, `${eqCssPrefix}-addrow-empty`)
|
|
@@ -3611,7 +3643,9 @@ class ColumnsPanel extends core.Widget {
|
|
|
3611
3643
|
}
|
|
3612
3644
|
setOptions(options) {
|
|
3613
3645
|
core$1.utils.assignDeep(this.options, options);
|
|
3614
|
-
|
|
3646
|
+
if (typeof options.allowCustomExpressions !== 'undefined') {
|
|
3647
|
+
this.context.options.allowCustomExpressions = options.allowCustomExpressions;
|
|
3648
|
+
}
|
|
3615
3649
|
if (options.attrElementFormat) {
|
|
3616
3650
|
this.context.options.attributeFormat = options.attrElementFormat;
|
|
3617
3651
|
}
|
|
@@ -3706,6 +3740,10 @@ class ColumnsPanel extends core.Widget {
|
|
|
3706
3740
|
}
|
|
3707
3741
|
}
|
|
3708
3742
|
addNewColumn(attrs, index) {
|
|
3743
|
+
// Only allow adding columns in Full edit mode
|
|
3744
|
+
if (this.options.editMode !== exports.ColumnsEditMode.Full) {
|
|
3745
|
+
return null;
|
|
3746
|
+
}
|
|
3709
3747
|
this.getContext().getModel();
|
|
3710
3748
|
const query = this.getQuery();
|
|
3711
3749
|
if (Array.isArray(attrs)) {
|
|
@@ -3904,6 +3942,10 @@ class ColumnsPanel extends core.Widget {
|
|
|
3904
3942
|
this.entitiesMenu.showMenu(menuOptions);
|
|
3905
3943
|
}
|
|
3906
3944
|
moveColumn(column, direction) {
|
|
3945
|
+
// Only allow moving columns in Full or FixedList edit mode
|
|
3946
|
+
if (this.options.editMode !== exports.ColumnsEditMode.Full && this.options.editMode !== exports.ColumnsEditMode.FixedList) {
|
|
3947
|
+
return;
|
|
3948
|
+
}
|
|
3907
3949
|
const query = this.getQuery();
|
|
3908
3950
|
const columns = query.getColumns();
|
|
3909
3951
|
const index = columns.indexOf(column);
|
|
@@ -3996,7 +4038,7 @@ class ColumnRendererCB {
|
|
|
3996
4038
|
.replaceChild(builder.toDOM(), this.element);
|
|
3997
4039
|
}
|
|
3998
4040
|
this.element = builder.toDOM();
|
|
3999
|
-
if (this.bar.
|
|
4041
|
+
if (this.bar.isDraggable()) {
|
|
4000
4042
|
ui.eqDragManager.registerDraggableItem({
|
|
4001
4043
|
element: this.element,
|
|
4002
4044
|
scope: "entityAttrSort",
|
|
@@ -4043,15 +4085,19 @@ class ColumnRendererCB {
|
|
|
4043
4085
|
this.render();
|
|
4044
4086
|
}
|
|
4045
4087
|
isEditable() {
|
|
4046
|
-
|
|
4088
|
+
// Editable if enabled, not read-only, and editMode is All or FixedList (for title/sort/order)
|
|
4089
|
+
return this.column.enabled && !this.column.isReadOnly() && (this.bar.options.editMode === exports.ColumnsEditMode.Full || this.bar.options.editMode === exports.ColumnsEditMode.FixedList);
|
|
4047
4090
|
}
|
|
4048
4091
|
renderButtonsBlock() {
|
|
4092
|
+
// Only show delete/type buttons in All mode
|
|
4093
|
+
const showDelete = this.bar.options.editMode === exports.ColumnsEditMode.Full;
|
|
4094
|
+
const showType = this.bar.options.editMode === exports.ColumnsEditMode.Full;
|
|
4049
4095
|
return ui.domel('div', this.element)
|
|
4050
4096
|
.addClass(`${eqCssPrefix}-column-buttonsBlock`, `${this.cssPrefix}-buttonsBlock`)
|
|
4051
4097
|
.addChildElement(this.renderSortingButton())
|
|
4052
|
-
.addChildElement(this.renderColumnTypeButton())
|
|
4098
|
+
.addChildElement(showType ? this.renderColumnTypeButton() : null)
|
|
4053
4099
|
.addChildElement(this.renderColumnFormatButton())
|
|
4054
|
-
.addChildElement(this.renderDeleteButton())
|
|
4100
|
+
.addChildElement(showDelete ? this.renderDeleteButton() : null)
|
|
4055
4101
|
.toDOM();
|
|
4056
4102
|
}
|
|
4057
4103
|
renderCaptionBlock() {
|
|
@@ -4236,7 +4282,8 @@ class ColumnRendererCB {
|
|
|
4236
4282
|
return false;
|
|
4237
4283
|
}
|
|
4238
4284
|
renderDeleteButton() {
|
|
4239
|
-
|
|
4285
|
+
// Only show delete in All mode
|
|
4286
|
+
if (this.column.isReadOnly() || this.bar.options.editMode !== exports.ColumnsEditMode.Full) {
|
|
4240
4287
|
return null;
|
|
4241
4288
|
}
|
|
4242
4289
|
return ui.domel('div')
|
|
@@ -4309,7 +4356,8 @@ class ColumnRendererCB {
|
|
|
4309
4356
|
});
|
|
4310
4357
|
}
|
|
4311
4358
|
renderColumnTypeButton() {
|
|
4312
|
-
|
|
4359
|
+
// Only show type button in All mode
|
|
4360
|
+
if (!this.isEditable() || this.bar.options.allowAggrColumns === false || this.bar.options.editMode !== exports.ColumnsEditMode.Full) {
|
|
4313
4361
|
return null;
|
|
4314
4362
|
}
|
|
4315
4363
|
return ui.domel('div')
|
|
@@ -4520,6 +4568,9 @@ class AttrColumnRendererCB extends ColumnRendererCB {
|
|
|
4520
4568
|
this.fireColumnChanged();
|
|
4521
4569
|
}
|
|
4522
4570
|
changeColumnTypeHandler(ev) {
|
|
4571
|
+
// Only allow type change in All mode
|
|
4572
|
+
if (this.bar.options.editMode !== exports.ColumnsEditMode.Full)
|
|
4573
|
+
return;
|
|
4523
4574
|
this.functionMenu.showMenu({
|
|
4524
4575
|
anchor: ev.target,
|
|
4525
4576
|
selectedIds: null,
|
|
@@ -4564,10 +4615,18 @@ class AggrFuncColumnRendererCB extends AttrColumnRendererCB {
|
|
|
4564
4615
|
this.fireColumnChanged();
|
|
4565
4616
|
}
|
|
4566
4617
|
changeColumnTypeHandler(ev) {
|
|
4618
|
+
// Only allow type change in All mode
|
|
4619
|
+
if (this.bar.options.editMode !== exports.ColumnsEditMode.Full)
|
|
4620
|
+
return;
|
|
4567
4621
|
this.changeTypeToSimple();
|
|
4568
4622
|
}
|
|
4569
4623
|
}
|
|
4570
4624
|
|
|
4625
|
+
/**
|
|
4626
|
+
* Base class for editable column renderers for the ColumnsBar widgets.
|
|
4627
|
+
* It provides common functionality for rendering editable columns,
|
|
4628
|
+
* including handling column type changes and rendering buttons.
|
|
4629
|
+
*/
|
|
4571
4630
|
class EditableColumnRendererCB extends ColumnRendererCB {
|
|
4572
4631
|
getClassesToAdd() {
|
|
4573
4632
|
return `${this.cssPrefix}-row ${this.cssPrefix}-row-column-entattr` + super.getClassesToAdd();
|
|
@@ -4594,6 +4653,9 @@ class EditableColumnRendererCB extends ColumnRendererCB {
|
|
|
4594
4653
|
return true;
|
|
4595
4654
|
}
|
|
4596
4655
|
changeColumnTypeHandler(ev) {
|
|
4656
|
+
// Only allow type change in All mode
|
|
4657
|
+
if (this.bar.options.editMode !== exports.ColumnsEditMode.Full)
|
|
4658
|
+
return;
|
|
4597
4659
|
this.changeTypeToSimple();
|
|
4598
4660
|
}
|
|
4599
4661
|
}
|
|
@@ -4661,7 +4723,8 @@ class ColumnsBar extends core.Widget {
|
|
|
4661
4723
|
sortEntities: false,
|
|
4662
4724
|
columnRenderedCallback: null,
|
|
4663
4725
|
customExpressionText: 0,
|
|
4664
|
-
showAddAllForEntity: false
|
|
4726
|
+
showAddAllForEntity: false,
|
|
4727
|
+
editMode: exports.ColumnsEditMode.Full
|
|
4665
4728
|
};
|
|
4666
4729
|
this.landingSlot = ui.domel('div')
|
|
4667
4730
|
.addClass(`${eqCssPrefix}-highlight`)
|
|
@@ -4688,6 +4751,10 @@ class ColumnsBar extends core.Widget {
|
|
|
4688
4751
|
getWidgetType() {
|
|
4689
4752
|
return 'columnsBar';
|
|
4690
4753
|
}
|
|
4754
|
+
isDraggable() {
|
|
4755
|
+
// Only allow drag-drop in All and FixedList modes
|
|
4756
|
+
return this.options.allowDragDrop && this.options.editMode > exports.ColumnsEditMode.ReadOnly;
|
|
4757
|
+
}
|
|
4691
4758
|
init(context, options) {
|
|
4692
4759
|
super.init(context, options);
|
|
4693
4760
|
this.setOptions(options);
|
|
@@ -4700,7 +4767,8 @@ class ColumnsBar extends core.Widget {
|
|
|
4700
4767
|
this.detachQueryObserver();
|
|
4701
4768
|
this.attachQueryObserver();
|
|
4702
4769
|
ui.eqDragManager.removeDropContainer(this.slot);
|
|
4703
|
-
|
|
4770
|
+
// Only allow drag-drop in All and FixedList modes
|
|
4771
|
+
if (this.isDraggable()) {
|
|
4704
4772
|
ui.eqDragManager.registerDropContainer({
|
|
4705
4773
|
element: this.slot,
|
|
4706
4774
|
scopes: ["entityAttrSort"],
|
|
@@ -4826,7 +4894,9 @@ class ColumnsBar extends core.Widget {
|
|
|
4826
4894
|
}
|
|
4827
4895
|
setOptions(options) {
|
|
4828
4896
|
this.options = core$1.utils.assignDeep(this.options, options);
|
|
4829
|
-
|
|
4897
|
+
if (typeof options.allowCustomExpressions !== 'undefined') {
|
|
4898
|
+
this.context.options.allowCustomExpressions = options.allowCustomExpressions;
|
|
4899
|
+
}
|
|
4830
4900
|
}
|
|
4831
4901
|
showLandingSlot(pageX, pageY) {
|
|
4832
4902
|
const elements = this.columnsBlock.querySelectorAll(`[class*=${this.cssPrefix}-row]`);
|
|
@@ -4937,7 +5007,8 @@ class ColumnsBar extends core.Widget {
|
|
|
4937
5007
|
.addClass(`${this.cssPrefix}-columns`)
|
|
4938
5008
|
.addClass(getMobileCssClass())
|
|
4939
5009
|
.toDOM();
|
|
4940
|
-
|
|
5010
|
+
// Only show add row in All mode
|
|
5011
|
+
if (this.options.showAddRow && this.options.editMode === exports.ColumnsEditMode.Full) {
|
|
4941
5012
|
this.addRowButton =
|
|
4942
5013
|
ui.domel('div')
|
|
4943
5014
|
.toDOM();
|
|
@@ -5000,16 +5071,18 @@ class ColumnsBar extends core.Widget {
|
|
|
5000
5071
|
return false;
|
|
5001
5072
|
})
|
|
5002
5073
|
.toDOM();
|
|
5003
|
-
this.
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5074
|
+
if (this.options.editMode == exports.ColumnsEditMode.Full) {
|
|
5075
|
+
this.buttonsBlockDeleteButton = ui.domel('div', this.columnButtonsBlockMobile)
|
|
5076
|
+
.addClass(`${this.cssPrefix}-column-button`, `${this.cssPrefix}-column-button-delete`)
|
|
5077
|
+
.on('touchstart click', (ev) => {
|
|
5078
|
+
ev.stopPropagation();
|
|
5079
|
+
this.currentColumnRenderer.buttonDeleteClickHandler.call(this.currentColumnRenderer, ev);
|
|
5080
|
+
this.toggleColumnPicked(null);
|
|
5081
|
+
this.hideColumnButtonsMobile();
|
|
5082
|
+
return false;
|
|
5083
|
+
})
|
|
5084
|
+
.toDOM();
|
|
5085
|
+
}
|
|
5013
5086
|
ui.domel('div', this.columnButtonsBlockMobile)
|
|
5014
5087
|
.addClass(`${this.cssPrefix}-column-button-close-block`)
|
|
5015
5088
|
.on('touchstart click', () => {
|
|
@@ -5038,7 +5111,7 @@ class ColumnsBar extends core.Widget {
|
|
|
5038
5111
|
.setStyle('top', (top + rect.height).toString() + 'px');
|
|
5039
5112
|
}
|
|
5040
5113
|
//show/hide separate buttons
|
|
5041
|
-
if (column.enabled && !column.isReadOnly()) {
|
|
5114
|
+
if (column.enabled && !column.isReadOnly() && this.options.editMode > exports.ColumnsEditMode.ReadOnly) {
|
|
5042
5115
|
ui.domel(this.buttonsBlockSortingButton).show();
|
|
5043
5116
|
ui.domel(this.buttonsBlockTypeButton).show();
|
|
5044
5117
|
if (columnRenderer.formatButtonIsShown()) {
|
|
@@ -5053,7 +5126,7 @@ class ColumnsBar extends core.Widget {
|
|
|
5053
5126
|
ui.domel(this.buttonsBlockTypeButton).hide();
|
|
5054
5127
|
}
|
|
5055
5128
|
//show
|
|
5056
|
-
if (column.isReadOnly()) {
|
|
5129
|
+
if (column.isReadOnly() || this.options.editMode == exports.ColumnsEditMode.ReadOnly) {
|
|
5057
5130
|
ui.domel(this.columnButtonsBlockMobile).hide();
|
|
5058
5131
|
}
|
|
5059
5132
|
else {
|
package/dist/easyquery.ui.esm.js
CHANGED
|
@@ -611,6 +611,13 @@ class EntitiesPanel extends Widget {
|
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
|
|
614
|
+
var ColumnsEditMode;
|
|
615
|
+
(function (ColumnsEditMode) {
|
|
616
|
+
ColumnsEditMode[ColumnsEditMode["ReadOnly"] = 0] = "ReadOnly";
|
|
617
|
+
ColumnsEditMode[ColumnsEditMode["FixedList"] = 16] = "FixedList";
|
|
618
|
+
ColumnsEditMode[ColumnsEditMode["Full"] = 255] = "Full";
|
|
619
|
+
})(ColumnsEditMode || (ColumnsEditMode = {}));
|
|
620
|
+
|
|
614
621
|
class MenuLevel {
|
|
615
622
|
get applyItem() {
|
|
616
623
|
return this._applyItem;
|
|
@@ -2007,15 +2014,22 @@ class ColumnRendererCP {
|
|
|
2007
2014
|
this.createFormatsMenu();
|
|
2008
2015
|
}
|
|
2009
2016
|
this.createButtonMenu();
|
|
2017
|
+
const isFullMode = this.panel.options.editMode === ColumnsEditMode.Full;
|
|
2018
|
+
const isReadOnlyMode = this.panel.options.editMode === ColumnsEditMode.ReadOnly;
|
|
2019
|
+
const showCheckboxes = this.panel.options.showCheckboxes !== false;
|
|
2010
2020
|
builder
|
|
2011
2021
|
.addClass(this.getClassesToAdd())
|
|
2012
|
-
.addClass(getMobileCssClass())
|
|
2013
|
-
|
|
2022
|
+
.addClass(getMobileCssClass());
|
|
2023
|
+
if (showCheckboxes && !isReadOnlyMode && !this.column.isReadOnly()) {
|
|
2024
|
+
builder.addChildElement(this.renderCheckbox());
|
|
2025
|
+
}
|
|
2026
|
+
if (!isReadOnlyMode) {
|
|
2014
2027
|
//start sort button
|
|
2015
|
-
.addChild('div', builder => builder
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2028
|
+
builder.addChild('div', builder => builder
|
|
2029
|
+
.addClass(`${eqCssPrefix}-button-placeholder`, `${this.cssPrefix}-button-placeholder`, `${this.cssPrefix}-colelement`, `${this.cssPrefix}-sortbutton-placeholder`)
|
|
2030
|
+
.addChildElement(this.sortingButton));
|
|
2031
|
+
// end sort button
|
|
2032
|
+
}
|
|
2019
2033
|
builder.addChildElement(this.renderExpressionBlock());
|
|
2020
2034
|
if (this.panel.options.showColumnTitles !== false && !browserUtils.isMobileMode()) {
|
|
2021
2035
|
builder
|
|
@@ -2029,36 +2043,37 @@ class ColumnRendererCP {
|
|
|
2029
2043
|
builder
|
|
2030
2044
|
.addClass(`${eqCssPrefix}-column-buttonsBlock`, `${this.cssPrefix}-buttonsBlock`)
|
|
2031
2045
|
.addClass(getMobileCssClass());
|
|
2046
|
+
const buttonsToShow = this.getButtonsToShow();
|
|
2032
2047
|
//start enable button
|
|
2033
|
-
if (
|
|
2048
|
+
if (buttonsToShow.indexOf("enable") >= 0 && isFullMode && !showCheckboxes && !this.column.isReadOnly()) {
|
|
2034
2049
|
builder.addChildElement(this.renderEnabledButton());
|
|
2035
2050
|
buttonsIndex++;
|
|
2036
2051
|
buttonsList += 'Enable';
|
|
2037
2052
|
}
|
|
2038
2053
|
//end enable button
|
|
2039
2054
|
//start aggr func button
|
|
2040
|
-
if (
|
|
2055
|
+
if (buttonsToShow.indexOf("type") >= 0 && this.columnEnabled && isFullMode) {
|
|
2041
2056
|
builder.addChildElement(this.renderColumnTypeButton());
|
|
2042
2057
|
buttonsIndex++;
|
|
2043
2058
|
buttonsList += 'Type';
|
|
2044
2059
|
}
|
|
2045
2060
|
//end aggr func button
|
|
2046
2061
|
//start format selector button
|
|
2047
|
-
if (
|
|
2062
|
+
if (buttonsToShow.indexOf("format") >= 0 && this.columnEnabled && !isReadOnlyMode) {
|
|
2048
2063
|
builder.addChildElement(this.renderColumnFormatButton());
|
|
2049
2064
|
buttonsIndex++;
|
|
2050
2065
|
buttonsList += 'Format';
|
|
2051
2066
|
}
|
|
2052
2067
|
//end format selector button
|
|
2053
2068
|
//start delete button
|
|
2054
|
-
if (
|
|
2069
|
+
if (buttonsToShow.indexOf("delete") >= 0 && isFullMode && !this.column.isReadOnly()) {
|
|
2055
2070
|
builder.addChildElement(this.renderDeleteButton());
|
|
2056
2071
|
buttonsIndex++;
|
|
2057
2072
|
buttonsList += 'Delete';
|
|
2058
2073
|
}
|
|
2059
2074
|
//end delete button
|
|
2060
2075
|
//start menu button
|
|
2061
|
-
if (
|
|
2076
|
+
if (buttonsToShow.indexOf("menu") >= 0 && !(this.column.isReadOnly() || isReadOnlyMode)) {
|
|
2062
2077
|
builder.addChildElement(this.renderMenuButton());
|
|
2063
2078
|
buttonsIndex++;
|
|
2064
2079
|
buttonsList += 'Menu';
|
|
@@ -2082,7 +2097,7 @@ class ColumnRendererCP {
|
|
|
2082
2097
|
if (this.panel.options.alwaysShowButtons) {
|
|
2083
2098
|
this.showButtons();
|
|
2084
2099
|
}
|
|
2085
|
-
if (
|
|
2100
|
+
if (!showCheckboxes) {
|
|
2086
2101
|
builder.addClass("eqjs-no-checkbox");
|
|
2087
2102
|
}
|
|
2088
2103
|
return this.element;
|
|
@@ -2258,25 +2273,20 @@ class ColumnRendererCP {
|
|
|
2258
2273
|
.toDOM();
|
|
2259
2274
|
}
|
|
2260
2275
|
renderCheckbox() {
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
.toDOM();
|
|
2276
|
-
}
|
|
2277
|
-
else {
|
|
2278
|
-
return null;
|
|
2279
|
-
}
|
|
2276
|
+
return domel("div")
|
|
2277
|
+
.title(i18n$1.getText('CmdToggleEnable'))
|
|
2278
|
+
.attr('tabIndex', '0')
|
|
2279
|
+
.addClass(`${this.cssPrefix}-colelement ${this.cssPrefix}-column-checkbox`)
|
|
2280
|
+
.addClass(`${this.columnEnabled ? 'enabled' : ''}`)
|
|
2281
|
+
.on('click', () => {
|
|
2282
|
+
this.columnEnabled = !this.columnEnabled;
|
|
2283
|
+
this.column.fireChangedEvent();
|
|
2284
|
+
return false;
|
|
2285
|
+
})
|
|
2286
|
+
.on('keypress', evt => { if ([13, 32].includes(evt.keyCode)) {
|
|
2287
|
+
evt.target.click();
|
|
2288
|
+
} })
|
|
2289
|
+
.toDOM();
|
|
2280
2290
|
}
|
|
2281
2291
|
renderDeleteButton() {
|
|
2282
2292
|
return domel('div')
|
|
@@ -2372,7 +2382,13 @@ class ColumnRendererCP {
|
|
|
2372
2382
|
} })).toDOM();
|
|
2373
2383
|
}
|
|
2374
2384
|
isEditable() {
|
|
2375
|
-
|
|
2385
|
+
// Allow editing (title/sort/order) in Full or FixedList mode only
|
|
2386
|
+
switch (this.panel.options.editMode) {
|
|
2387
|
+
case ColumnsEditMode.ReadOnly:
|
|
2388
|
+
return false;
|
|
2389
|
+
default:
|
|
2390
|
+
return this.column.enabled && !this.column.isReadOnly();
|
|
2391
|
+
}
|
|
2376
2392
|
}
|
|
2377
2393
|
changeFormatHandler(ev) {
|
|
2378
2394
|
const formats = this.panel
|
|
@@ -2525,7 +2541,18 @@ class ColumnRendererCP {
|
|
|
2525
2541
|
.concat(formats.map(format => ({ id: format.format, text: i18n$1.getText("DisplayFormats", format.name) || format.name })));
|
|
2526
2542
|
}
|
|
2527
2543
|
getButtonsToShow() {
|
|
2528
|
-
|
|
2544
|
+
// In ReadOnly mode, no buttons
|
|
2545
|
+
if (this.panel.options.editMode === ColumnsEditMode.ReadOnly) {
|
|
2546
|
+
return [];
|
|
2547
|
+
}
|
|
2548
|
+
// In FixedList mode, only allow sorting and caption editing
|
|
2549
|
+
if (this.panel.options.editMode === ColumnsEditMode.FixedList) {
|
|
2550
|
+
return ["sorting", "format"];
|
|
2551
|
+
}
|
|
2552
|
+
// Default (Full)
|
|
2553
|
+
return this.panel.options.buttons && Array.isArray(this.panel.options.buttons)
|
|
2554
|
+
? this.panel.options.buttons
|
|
2555
|
+
: ["enable", "delete", "type", "sorting", "format"];
|
|
2529
2556
|
}
|
|
2530
2557
|
buttonMenuHandler(action, evt) {
|
|
2531
2558
|
switch (action) {
|
|
@@ -2758,7 +2785,7 @@ class AttrColumnRendererCP extends ColumnRendererCP {
|
|
|
2758
2785
|
renderBaseExpression() {
|
|
2759
2786
|
const baseAttr = this.getAttribute();
|
|
2760
2787
|
const attrCaption = this.panel.getContext().getAttributeTitle(baseAttr);
|
|
2761
|
-
if (this.isEditable()) {
|
|
2788
|
+
if (this.isEditable() && this.panel.options.editMode === ColumnsEditMode.Full) {
|
|
2762
2789
|
return domel('a')
|
|
2763
2790
|
.attr('href', 'javascript:void(0)')
|
|
2764
2791
|
.title(attrCaption)
|
|
@@ -2777,10 +2804,12 @@ class AttrColumnRendererCP extends ColumnRendererCP {
|
|
|
2777
2804
|
})
|
|
2778
2805
|
.toDOM();
|
|
2779
2806
|
}
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2807
|
+
else {
|
|
2808
|
+
return domel('span')
|
|
2809
|
+
.text(attrCaption)
|
|
2810
|
+
.title(attrCaption)
|
|
2811
|
+
.toDOM();
|
|
2812
|
+
}
|
|
2784
2813
|
}
|
|
2785
2814
|
baseExpressionItemSelectedCallback(data, item) {
|
|
2786
2815
|
const attrid = data.id;
|
|
@@ -2931,7 +2960,8 @@ class AggrFuncColumnRendererCP extends AttrColumnRendererCP {
|
|
|
2931
2960
|
for (let idx = 0; idx < arrLength; idx++) {
|
|
2932
2961
|
item = arrFormat[idx];
|
|
2933
2962
|
if (item.type === 1) {
|
|
2934
|
-
|
|
2963
|
+
// Only allow function/type change in Full mode
|
|
2964
|
+
if (this.panel.options.editMode === ColumnsEditMode.Full && this.isEditable()) {
|
|
2935
2965
|
const functionLink = domel('a')
|
|
2936
2966
|
.attr('href', 'javascript:void(0)')
|
|
2937
2967
|
.text(item.text)
|
|
@@ -3068,7 +3098,7 @@ class EditableColumnRendererCP extends AttrColumnRendererCP {
|
|
|
3068
3098
|
let builder = domel('div', exprBlock)
|
|
3069
3099
|
.addClass(`${this.cssPrefix}-colelement`, `${this.cssPrefix}-attrelement`)
|
|
3070
3100
|
.addClass(getMobileCssClass());
|
|
3071
|
-
if (this.isEditable()) {
|
|
3101
|
+
if (this.isEditable() && this.panel.options.editMode === ColumnsEditMode.Full) {
|
|
3072
3102
|
builder
|
|
3073
3103
|
.addChild('a', b => b
|
|
3074
3104
|
.attr('href', 'javascript:void(0)')
|
|
@@ -3144,7 +3174,8 @@ class EditableColumnRendererCP extends AttrColumnRendererCP {
|
|
|
3144
3174
|
builder = domel('div', exprBlock)
|
|
3145
3175
|
.addClass(`${this.cssPrefix}-colelement`, `${this.cssPrefix}-attrelement`)
|
|
3146
3176
|
.addClass(getMobileCssClass());
|
|
3147
|
-
|
|
3177
|
+
// Only allow data type change in Full mode
|
|
3178
|
+
if (this.panel.options.editMode === ColumnsEditMode.Full && this.isEditable()) {
|
|
3148
3179
|
this.createDataTypeMenu();
|
|
3149
3180
|
builder
|
|
3150
3181
|
.addChild('a', dataTypeLink => dataTypeLink
|
|
@@ -3164,7 +3195,6 @@ class EditableColumnRendererCP extends AttrColumnRendererCP {
|
|
|
3164
3195
|
}));
|
|
3165
3196
|
}
|
|
3166
3197
|
else {
|
|
3167
|
-
this.column.expr.dataType;
|
|
3168
3198
|
builder
|
|
3169
3199
|
.addChild('span', b => {
|
|
3170
3200
|
b.text(DataType[this.column.expr.dataType])
|
|
@@ -3315,7 +3345,8 @@ class ColumnsPanel extends Widget {
|
|
|
3315
3345
|
customExpressionText: 0,
|
|
3316
3346
|
allowHiddenColumns: false,
|
|
3317
3347
|
showAddAllForEntity: false,
|
|
3318
|
-
showIndicatorOnLoad: true
|
|
3348
|
+
showIndicatorOnLoad: true,
|
|
3349
|
+
editMode: ColumnsEditMode.Full
|
|
3319
3350
|
};
|
|
3320
3351
|
this.landingSlot = domel('div')
|
|
3321
3352
|
.addClass(`${this.cssPrefix}-col-landing-slot`)
|
|
@@ -3421,7 +3452,8 @@ class ColumnsPanel extends Widget {
|
|
|
3421
3452
|
.addClass(`${this.cssPrefix}-columns`)
|
|
3422
3453
|
.addClass(getMobileCssClass())
|
|
3423
3454
|
.toDOM();
|
|
3424
|
-
|
|
3455
|
+
// Only show add row in Full edit mode
|
|
3456
|
+
if (this.options.showAddRow && this.options.editMode === ColumnsEditMode.Full) {
|
|
3425
3457
|
this.addRowElement =
|
|
3426
3458
|
domel('div', this.slot)
|
|
3427
3459
|
.addClass(`${eqCssPrefix}-addrow`, `${this.cssPrefix}-addrow`, `${eqCssPrefix}-addrow-empty`)
|
|
@@ -3609,7 +3641,9 @@ class ColumnsPanel extends Widget {
|
|
|
3609
3641
|
}
|
|
3610
3642
|
setOptions(options) {
|
|
3611
3643
|
utils.assignDeep(this.options, options);
|
|
3612
|
-
|
|
3644
|
+
if (typeof options.allowCustomExpressions !== 'undefined') {
|
|
3645
|
+
this.context.options.allowCustomExpressions = options.allowCustomExpressions;
|
|
3646
|
+
}
|
|
3613
3647
|
if (options.attrElementFormat) {
|
|
3614
3648
|
this.context.options.attributeFormat = options.attrElementFormat;
|
|
3615
3649
|
}
|
|
@@ -3704,6 +3738,10 @@ class ColumnsPanel extends Widget {
|
|
|
3704
3738
|
}
|
|
3705
3739
|
}
|
|
3706
3740
|
addNewColumn(attrs, index) {
|
|
3741
|
+
// Only allow adding columns in Full edit mode
|
|
3742
|
+
if (this.options.editMode !== ColumnsEditMode.Full) {
|
|
3743
|
+
return null;
|
|
3744
|
+
}
|
|
3707
3745
|
this.getContext().getModel();
|
|
3708
3746
|
const query = this.getQuery();
|
|
3709
3747
|
if (Array.isArray(attrs)) {
|
|
@@ -3902,6 +3940,10 @@ class ColumnsPanel extends Widget {
|
|
|
3902
3940
|
this.entitiesMenu.showMenu(menuOptions);
|
|
3903
3941
|
}
|
|
3904
3942
|
moveColumn(column, direction) {
|
|
3943
|
+
// Only allow moving columns in Full or FixedList edit mode
|
|
3944
|
+
if (this.options.editMode !== ColumnsEditMode.Full && this.options.editMode !== ColumnsEditMode.FixedList) {
|
|
3945
|
+
return;
|
|
3946
|
+
}
|
|
3905
3947
|
const query = this.getQuery();
|
|
3906
3948
|
const columns = query.getColumns();
|
|
3907
3949
|
const index = columns.indexOf(column);
|
|
@@ -3994,7 +4036,7 @@ class ColumnRendererCB {
|
|
|
3994
4036
|
.replaceChild(builder.toDOM(), this.element);
|
|
3995
4037
|
}
|
|
3996
4038
|
this.element = builder.toDOM();
|
|
3997
|
-
if (this.bar.
|
|
4039
|
+
if (this.bar.isDraggable()) {
|
|
3998
4040
|
eqDragManager.registerDraggableItem({
|
|
3999
4041
|
element: this.element,
|
|
4000
4042
|
scope: "entityAttrSort",
|
|
@@ -4041,15 +4083,19 @@ class ColumnRendererCB {
|
|
|
4041
4083
|
this.render();
|
|
4042
4084
|
}
|
|
4043
4085
|
isEditable() {
|
|
4044
|
-
|
|
4086
|
+
// Editable if enabled, not read-only, and editMode is All or FixedList (for title/sort/order)
|
|
4087
|
+
return this.column.enabled && !this.column.isReadOnly() && (this.bar.options.editMode === ColumnsEditMode.Full || this.bar.options.editMode === ColumnsEditMode.FixedList);
|
|
4045
4088
|
}
|
|
4046
4089
|
renderButtonsBlock() {
|
|
4090
|
+
// Only show delete/type buttons in All mode
|
|
4091
|
+
const showDelete = this.bar.options.editMode === ColumnsEditMode.Full;
|
|
4092
|
+
const showType = this.bar.options.editMode === ColumnsEditMode.Full;
|
|
4047
4093
|
return domel('div', this.element)
|
|
4048
4094
|
.addClass(`${eqCssPrefix}-column-buttonsBlock`, `${this.cssPrefix}-buttonsBlock`)
|
|
4049
4095
|
.addChildElement(this.renderSortingButton())
|
|
4050
|
-
.addChildElement(this.renderColumnTypeButton())
|
|
4096
|
+
.addChildElement(showType ? this.renderColumnTypeButton() : null)
|
|
4051
4097
|
.addChildElement(this.renderColumnFormatButton())
|
|
4052
|
-
.addChildElement(this.renderDeleteButton())
|
|
4098
|
+
.addChildElement(showDelete ? this.renderDeleteButton() : null)
|
|
4053
4099
|
.toDOM();
|
|
4054
4100
|
}
|
|
4055
4101
|
renderCaptionBlock() {
|
|
@@ -4234,7 +4280,8 @@ class ColumnRendererCB {
|
|
|
4234
4280
|
return false;
|
|
4235
4281
|
}
|
|
4236
4282
|
renderDeleteButton() {
|
|
4237
|
-
|
|
4283
|
+
// Only show delete in All mode
|
|
4284
|
+
if (this.column.isReadOnly() || this.bar.options.editMode !== ColumnsEditMode.Full) {
|
|
4238
4285
|
return null;
|
|
4239
4286
|
}
|
|
4240
4287
|
return domel('div')
|
|
@@ -4307,7 +4354,8 @@ class ColumnRendererCB {
|
|
|
4307
4354
|
});
|
|
4308
4355
|
}
|
|
4309
4356
|
renderColumnTypeButton() {
|
|
4310
|
-
|
|
4357
|
+
// Only show type button in All mode
|
|
4358
|
+
if (!this.isEditable() || this.bar.options.allowAggrColumns === false || this.bar.options.editMode !== ColumnsEditMode.Full) {
|
|
4311
4359
|
return null;
|
|
4312
4360
|
}
|
|
4313
4361
|
return domel('div')
|
|
@@ -4518,6 +4566,9 @@ class AttrColumnRendererCB extends ColumnRendererCB {
|
|
|
4518
4566
|
this.fireColumnChanged();
|
|
4519
4567
|
}
|
|
4520
4568
|
changeColumnTypeHandler(ev) {
|
|
4569
|
+
// Only allow type change in All mode
|
|
4570
|
+
if (this.bar.options.editMode !== ColumnsEditMode.Full)
|
|
4571
|
+
return;
|
|
4521
4572
|
this.functionMenu.showMenu({
|
|
4522
4573
|
anchor: ev.target,
|
|
4523
4574
|
selectedIds: null,
|
|
@@ -4562,10 +4613,18 @@ class AggrFuncColumnRendererCB extends AttrColumnRendererCB {
|
|
|
4562
4613
|
this.fireColumnChanged();
|
|
4563
4614
|
}
|
|
4564
4615
|
changeColumnTypeHandler(ev) {
|
|
4616
|
+
// Only allow type change in All mode
|
|
4617
|
+
if (this.bar.options.editMode !== ColumnsEditMode.Full)
|
|
4618
|
+
return;
|
|
4565
4619
|
this.changeTypeToSimple();
|
|
4566
4620
|
}
|
|
4567
4621
|
}
|
|
4568
4622
|
|
|
4623
|
+
/**
|
|
4624
|
+
* Base class for editable column renderers for the ColumnsBar widgets.
|
|
4625
|
+
* It provides common functionality for rendering editable columns,
|
|
4626
|
+
* including handling column type changes and rendering buttons.
|
|
4627
|
+
*/
|
|
4569
4628
|
class EditableColumnRendererCB extends ColumnRendererCB {
|
|
4570
4629
|
getClassesToAdd() {
|
|
4571
4630
|
return `${this.cssPrefix}-row ${this.cssPrefix}-row-column-entattr` + super.getClassesToAdd();
|
|
@@ -4592,6 +4651,9 @@ class EditableColumnRendererCB extends ColumnRendererCB {
|
|
|
4592
4651
|
return true;
|
|
4593
4652
|
}
|
|
4594
4653
|
changeColumnTypeHandler(ev) {
|
|
4654
|
+
// Only allow type change in All mode
|
|
4655
|
+
if (this.bar.options.editMode !== ColumnsEditMode.Full)
|
|
4656
|
+
return;
|
|
4595
4657
|
this.changeTypeToSimple();
|
|
4596
4658
|
}
|
|
4597
4659
|
}
|
|
@@ -4659,7 +4721,8 @@ class ColumnsBar extends Widget {
|
|
|
4659
4721
|
sortEntities: false,
|
|
4660
4722
|
columnRenderedCallback: null,
|
|
4661
4723
|
customExpressionText: 0,
|
|
4662
|
-
showAddAllForEntity: false
|
|
4724
|
+
showAddAllForEntity: false,
|
|
4725
|
+
editMode: ColumnsEditMode.Full
|
|
4663
4726
|
};
|
|
4664
4727
|
this.landingSlot = domel('div')
|
|
4665
4728
|
.addClass(`${eqCssPrefix}-highlight`)
|
|
@@ -4686,6 +4749,10 @@ class ColumnsBar extends Widget {
|
|
|
4686
4749
|
getWidgetType() {
|
|
4687
4750
|
return 'columnsBar';
|
|
4688
4751
|
}
|
|
4752
|
+
isDraggable() {
|
|
4753
|
+
// Only allow drag-drop in All and FixedList modes
|
|
4754
|
+
return this.options.allowDragDrop && this.options.editMode > ColumnsEditMode.ReadOnly;
|
|
4755
|
+
}
|
|
4689
4756
|
init(context, options) {
|
|
4690
4757
|
super.init(context, options);
|
|
4691
4758
|
this.setOptions(options);
|
|
@@ -4698,7 +4765,8 @@ class ColumnsBar extends Widget {
|
|
|
4698
4765
|
this.detachQueryObserver();
|
|
4699
4766
|
this.attachQueryObserver();
|
|
4700
4767
|
eqDragManager.removeDropContainer(this.slot);
|
|
4701
|
-
|
|
4768
|
+
// Only allow drag-drop in All and FixedList modes
|
|
4769
|
+
if (this.isDraggable()) {
|
|
4702
4770
|
eqDragManager.registerDropContainer({
|
|
4703
4771
|
element: this.slot,
|
|
4704
4772
|
scopes: ["entityAttrSort"],
|
|
@@ -4824,7 +4892,9 @@ class ColumnsBar extends Widget {
|
|
|
4824
4892
|
}
|
|
4825
4893
|
setOptions(options) {
|
|
4826
4894
|
this.options = utils.assignDeep(this.options, options);
|
|
4827
|
-
|
|
4895
|
+
if (typeof options.allowCustomExpressions !== 'undefined') {
|
|
4896
|
+
this.context.options.allowCustomExpressions = options.allowCustomExpressions;
|
|
4897
|
+
}
|
|
4828
4898
|
}
|
|
4829
4899
|
showLandingSlot(pageX, pageY) {
|
|
4830
4900
|
const elements = this.columnsBlock.querySelectorAll(`[class*=${this.cssPrefix}-row]`);
|
|
@@ -4935,7 +5005,8 @@ class ColumnsBar extends Widget {
|
|
|
4935
5005
|
.addClass(`${this.cssPrefix}-columns`)
|
|
4936
5006
|
.addClass(getMobileCssClass())
|
|
4937
5007
|
.toDOM();
|
|
4938
|
-
|
|
5008
|
+
// Only show add row in All mode
|
|
5009
|
+
if (this.options.showAddRow && this.options.editMode === ColumnsEditMode.Full) {
|
|
4939
5010
|
this.addRowButton =
|
|
4940
5011
|
domel('div')
|
|
4941
5012
|
.toDOM();
|
|
@@ -4998,16 +5069,18 @@ class ColumnsBar extends Widget {
|
|
|
4998
5069
|
return false;
|
|
4999
5070
|
})
|
|
5000
5071
|
.toDOM();
|
|
5001
|
-
this.
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5072
|
+
if (this.options.editMode == ColumnsEditMode.Full) {
|
|
5073
|
+
this.buttonsBlockDeleteButton = domel('div', this.columnButtonsBlockMobile)
|
|
5074
|
+
.addClass(`${this.cssPrefix}-column-button`, `${this.cssPrefix}-column-button-delete`)
|
|
5075
|
+
.on('touchstart click', (ev) => {
|
|
5076
|
+
ev.stopPropagation();
|
|
5077
|
+
this.currentColumnRenderer.buttonDeleteClickHandler.call(this.currentColumnRenderer, ev);
|
|
5078
|
+
this.toggleColumnPicked(null);
|
|
5079
|
+
this.hideColumnButtonsMobile();
|
|
5080
|
+
return false;
|
|
5081
|
+
})
|
|
5082
|
+
.toDOM();
|
|
5083
|
+
}
|
|
5011
5084
|
domel('div', this.columnButtonsBlockMobile)
|
|
5012
5085
|
.addClass(`${this.cssPrefix}-column-button-close-block`)
|
|
5013
5086
|
.on('touchstart click', () => {
|
|
@@ -5036,7 +5109,7 @@ class ColumnsBar extends Widget {
|
|
|
5036
5109
|
.setStyle('top', (top + rect.height).toString() + 'px');
|
|
5037
5110
|
}
|
|
5038
5111
|
//show/hide separate buttons
|
|
5039
|
-
if (column.enabled && !column.isReadOnly()) {
|
|
5112
|
+
if (column.enabled && !column.isReadOnly() && this.options.editMode > ColumnsEditMode.ReadOnly) {
|
|
5040
5113
|
domel(this.buttonsBlockSortingButton).show();
|
|
5041
5114
|
domel(this.buttonsBlockTypeButton).show();
|
|
5042
5115
|
if (columnRenderer.formatButtonIsShown()) {
|
|
@@ -5051,7 +5124,7 @@ class ColumnsBar extends Widget {
|
|
|
5051
5124
|
domel(this.buttonsBlockTypeButton).hide();
|
|
5052
5125
|
}
|
|
5053
5126
|
//show
|
|
5054
|
-
if (column.isReadOnly()) {
|
|
5127
|
+
if (column.isReadOnly() || this.options.editMode == ColumnsEditMode.ReadOnly) {
|
|
5055
5128
|
domel(this.columnButtonsBlockMobile).hide();
|
|
5056
5129
|
}
|
|
5057
5130
|
else {
|
|
@@ -14459,4 +14532,4 @@ if (!Array.prototype.findIndex) {
|
|
|
14459
14532
|
};
|
|
14460
14533
|
}
|
|
14461
14534
|
|
|
14462
|
-
export { AddRowRenderer, AdvancedSearchView, AggrFuncColumnRendererCB, AggrFuncColumnRendererCP, AggrSettingsDialog, AggrSettingsRenderer, AggregationBar, AttrColumnRendererCB, AttrColumnRendererCP, AttributeExpressionRenderer, BaseElementRenderer, ChartFacet, ChartJsWidget, ChartType, ChartWidget, ColumnAction, ColumnRendererCB, ColumnRendererCP, ColumnsBar, ColumnsPanel, ConditionAction, ConditionGroupRenderer, ConditionGroupRowRenderer, ConditionRenderer, ConstColumnRendererCP, CustomListExpressionRenderer, CustomSqlColumnRendererCP, DataFilterView, DataTableFacet, DateTimeExpressionRenderer, DomDropDownElementBuilder, DropDownRenderer, EasyGridWidget, EntitiesPanel, EqHtmlGrid, ExportDialog, ExportWidget, ExpressionRenderer, FacetContainer, FacetType, FilterBar, GoogleChartWidget, Grid, HtmlContentWidget, HtmlDataFilterView, InputExpressionRenderer, ListExpressionRenderer, ManageDrillDownWidget, OperatorRenderer, PivotTableFacet, PopupMenu, ProcessWidget, QPEditablePart, QueryPanel, ReportView, ResultFacet, ResultFacetsPanel, SimpleConditionRenderer, SortingBar, SqlListExpressionRenderer, StatementPanel, SubQueryExpressionRenderer, TextRenderer, View, dropdown };
|
|
14535
|
+
export { AddRowRenderer, AdvancedSearchView, AggrFuncColumnRendererCB, AggrFuncColumnRendererCP, AggrSettingsDialog, AggrSettingsRenderer, AggregationBar, AttrColumnRendererCB, AttrColumnRendererCP, AttributeExpressionRenderer, BaseElementRenderer, ChartFacet, ChartJsWidget, ChartType, ChartWidget, ColumnAction, ColumnRendererCB, ColumnRendererCP, ColumnsBar, ColumnsEditMode, ColumnsPanel, ConditionAction, ConditionGroupRenderer, ConditionGroupRowRenderer, ConditionRenderer, ConstColumnRendererCP, CustomListExpressionRenderer, CustomSqlColumnRendererCP, DataFilterView, DataTableFacet, DateTimeExpressionRenderer, DomDropDownElementBuilder, DropDownRenderer, EasyGridWidget, EntitiesPanel, EqHtmlGrid, ExportDialog, ExportWidget, ExpressionRenderer, FacetContainer, FacetType, FilterBar, GoogleChartWidget, Grid, HtmlContentWidget, HtmlDataFilterView, InputExpressionRenderer, ListExpressionRenderer, ManageDrillDownWidget, OperatorRenderer, PivotTableFacet, PopupMenu, ProcessWidget, QPEditablePart, QueryPanel, ReportView, ResultFacet, ResultFacetsPanel, SimpleConditionRenderer, SortingBar, SqlListExpressionRenderer, StatementPanel, SubQueryExpressionRenderer, TextRenderer, View, dropdown };
|
|
@@ -20,6 +20,7 @@ export declare class ColumnsBar extends Widget {
|
|
|
20
20
|
private customQuery?;
|
|
21
21
|
constructor(slot: HTMLElement, customQuery?: Query);
|
|
22
22
|
getWidgetType(): string;
|
|
23
|
+
isDraggable(): boolean;
|
|
23
24
|
init(context: EqContext, options?: ColumnsBarOptions): void;
|
|
24
25
|
private attachQueryObserver;
|
|
25
26
|
getQuery(): Query;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { ColumnRendererCB } from './column_renderer_cb';
|
|
2
|
+
/**
|
|
3
|
+
* Base class for editable column renderers for the ColumnsBar widgets.
|
|
4
|
+
* It provides common functionality for rendering editable columns,
|
|
5
|
+
* including handling column type changes and rendering buttons.
|
|
6
|
+
*/
|
|
2
7
|
export declare class EditableColumnRendererCB extends ColumnRendererCB {
|
|
3
8
|
protected getClassesToAdd(): string;
|
|
4
9
|
protected renderColumnTypeButton(): HTMLDivElement;
|
|
@@ -15,6 +15,11 @@ export interface UseInOptions {
|
|
|
15
15
|
useInResult: boolean;
|
|
16
16
|
useInSorting: boolean;
|
|
17
17
|
}
|
|
18
|
+
export declare enum ColumnsEditMode {
|
|
19
|
+
ReadOnly = 0,
|
|
20
|
+
FixedList = 16,
|
|
21
|
+
Full = 255
|
|
22
|
+
}
|
|
18
23
|
/** EntitiesPanel options */
|
|
19
24
|
export interface EntitiesPanelOptions {
|
|
20
25
|
showToolbar?: boolean;
|
|
@@ -168,6 +173,8 @@ export interface ColumnsPanelOptions {
|
|
|
168
173
|
showAddAllForEntity?: boolean;
|
|
169
174
|
/** Gets or sets a value indicating whether a progress indicator should appear while the model is loading */
|
|
170
175
|
showIndicatorOnLoad?: boolean;
|
|
176
|
+
/** Gets or sets the edit mode option: All, FixedList or ReadOnly */
|
|
177
|
+
editMode?: ColumnsEditMode;
|
|
171
178
|
[name: string]: any;
|
|
172
179
|
}
|
|
173
180
|
/** Columns bar options */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyquery/ui",
|
|
3
|
-
"version": "7.4.0-
|
|
3
|
+
"version": "7.4.0-rc04",
|
|
4
4
|
"description": "EasyQuery.JS Community UI widgets",
|
|
5
5
|
"types": "./dist/types/public_api.d.ts",
|
|
6
6
|
"main": "./dist/easyquery.ui.cjs.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"bugs": "https://korzh.com/support",
|
|
31
31
|
"license": "LGPL-3.0",
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@easyquery/core": "^7.4.0-
|
|
33
|
+
"@easyquery/core": "^7.4.0-rc04"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|