@revolist/revogrid 4.23.14 → 4.23.16
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/cjs/{cell-renderer-Dcz022q7.js → cell-renderer-DfUCisis.js} +23 -5
- package/dist/cjs/{column.drag.plugin-BGLbi1zS.js → column.drag.plugin-ByDJ7Rk3.js} +35 -6
- package/dist/cjs/{column.service-C1Qvcf5l.js → column.service-BNWNiJW3.js} +62 -23
- package/dist/cjs/{filter.button-w6LWnyhi.js → filter.button-C4xpvyyE.js} +14 -4
- package/dist/cjs/{header-cell-renderer-vVr4IWNV.js → header-cell-renderer-DyjOxArm.js} +1 -1
- package/dist/cjs/index.cjs.js +8 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +6 -6
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +40 -4
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +14 -6
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +177 -48
- package/dist/collection/components/clipboard/revogr-clipboard.js +1 -1
- package/dist/collection/components/data/column.service.js +62 -23
- package/dist/collection/components/data/row-renderer.js +15 -2
- package/dist/collection/components/overlay/clipboard.utils.js +26 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +27 -7
- package/dist/collection/components/revoGrid/revo-grid.js +14 -7
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +10 -2
- package/dist/collection/plugins/filter/filter.button.js +12 -4
- package/dist/collection/plugins/filter/filter.panel.js +138 -48
- package/dist/collection/plugins/filter/filter.plugin.js +1 -1
- package/dist/collection/plugins/filter/filter.reorder.js +44 -0
- package/dist/collection/plugins/filter/filter.style.css +96 -6
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +7 -2
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js +30 -2
- package/dist/collection/serve/controller.js +1 -0
- package/dist/esm/{cell-renderer-BtN-NGCk.js → cell-renderer-CLTRlCa5.js} +23 -5
- package/dist/esm/{column.drag.plugin-4Ixr4ijU.js → column.drag.plugin-BZacA8n_.js} +35 -7
- package/dist/esm/{column.service-CC_SD8W3.js → column.service-C6hByxPy.js} +62 -23
- package/dist/esm/filter.button-B-RBiF67.js +38 -0
- package/dist/esm/{header-cell-renderer-B-LX2sgu.js → header-cell-renderer-BMmXRsd_.js} +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +6 -6
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +40 -4
- package/dist/esm/revogr-clipboard_3.entry.js +1 -1
- package/dist/esm/revogr-data_4.entry.js +14 -6
- package/dist/esm/revogr-filter-panel.entry.js +177 -48
- package/dist/revo-grid/{cell-renderer-BtN-NGCk.js → cell-renderer-CLTRlCa5.js} +23 -5
- package/dist/revo-grid/{column.drag.plugin-4Ixr4ijU.js → column.drag.plugin-BZacA8n_.js} +35 -7
- package/dist/revo-grid/{column.service-CC_SD8W3.js → column.service-C6hByxPy.js} +62 -23
- package/dist/revo-grid/filter.button-B-RBiF67.js +38 -0
- package/dist/revo-grid/{header-cell-renderer-B-LX2sgu.js → header-cell-renderer-BMmXRsd_.js} +1 -1
- package/dist/revo-grid/index.esm.js +6 -6
- package/dist/revo-grid/revo-grid.entry.js +6 -6
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js +40 -4
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +14 -6
- package/dist/revo-grid/revogr-filter-panel.entry.js +177 -48
- package/dist/types/components/data/column.service.d.ts +10 -1
- package/dist/types/components/data/row-renderer.d.ts +1 -1
- package/dist/types/components/overlay/clipboard.utils.d.ts +3 -0
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +4 -3
- package/dist/types/components/revoGrid/revo-grid.d.ts +4 -4
- package/dist/types/components.d.ts +14 -14
- package/dist/types/plugins/filter/filter.button.d.ts +23 -2
- package/dist/types/plugins/filter/filter.panel.d.ts +8 -1
- package/dist/types/plugins/filter/filter.plugin.d.ts +1 -0
- package/dist/types/plugins/filter/filter.reorder.d.ts +4 -0
- package/dist/types/plugins/filter/filter.types.d.ts +8 -0
- package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +4 -0
- package/dist/types/types/interfaces.d.ts +8 -0
- package/hydrate/index.js +358 -90
- package/hydrate/index.mjs +358 -90
- package/package.json +1 -1
- package/readme.md +20 -1
- package/standalone/column.service.js +1 -1
- package/standalone/filter.button.js +1 -1
- package/standalone/index.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-clipboard2.js +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
- package/dist/esm/filter.button-C8XTWPU2.js +0 -30
- package/dist/revo-grid/filter.button-C8XTWPU2.js +0 -30
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
var index = require('./index-Dq8Xzj5l.js');
|
|
7
|
-
var column_service = require('./column.service-
|
|
7
|
+
var column_service = require('./column.service-BNWNiJW3.js');
|
|
8
8
|
var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
|
|
9
|
-
var cellRenderer = require('./cell-renderer-
|
|
10
|
-
var filter_button = require('./filter.button-
|
|
11
|
-
var headerCellRenderer = require('./header-cell-renderer-
|
|
9
|
+
var cellRenderer = require('./cell-renderer-DfUCisis.js');
|
|
10
|
+
var filter_button = require('./filter.button-C4xpvyyE.js');
|
|
11
|
+
var headerCellRenderer = require('./header-cell-renderer-DyjOxArm.js');
|
|
12
12
|
var throttle = require('./throttle-BCwEuJJq.js');
|
|
13
13
|
var viewport_helpers = require('./viewport.helpers-BND76K2j.js');
|
|
14
14
|
require('./debounce-CcpHiH2p.js');
|
|
@@ -830,9 +830,17 @@ const RevogrViewportScroll = class {
|
|
|
830
830
|
}
|
|
831
831
|
render() {
|
|
832
832
|
var _a, _b;
|
|
833
|
-
const
|
|
833
|
+
const clientHeight = (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0;
|
|
834
|
+
// When content fits in the viewport (no scroll needed), don't inflate content-wrapper
|
|
835
|
+
// to clientHeight — that would prevent inner-content-table from shrinking and push
|
|
836
|
+
// rowPinEnd (footer) to the bottom instead of letting it follow the data rows.
|
|
837
|
+
// For large/compressed grids (content > clientHeight), physicalContentHeight handles
|
|
838
|
+
// the browser scroll-size compression correctly.
|
|
839
|
+
const physicalContentHeight = this.contentHeight < clientHeight
|
|
840
|
+
? Math.max(this.contentHeight, 0)
|
|
841
|
+
: throttle.getContentSize(this.contentHeight, clientHeight);
|
|
834
842
|
const physicalContentWidth = throttle.getContentSize(this.contentWidth, 0);
|
|
835
|
-
return (index.h(index.Host, { key: '
|
|
843
|
+
return (index.h(index.Host, { key: '3dd9d29cf26743d7aa4995f51180d56008526e54', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, index.h("div", { key: 'af75428e845044c33eba2fecd1ec04a9177b9b5c', class: "inner-content-table", style: { width: `${physicalContentWidth}px` } }, index.h("div", { key: 'a0149f597588371e1fafe69efc3bd4411379a017', class: "header-wrapper", ref: e => (this.header = e) }, index.h("slot", { key: 'e5d2570bf93897cd97ef702141c83bb8c0e13ee2', name: viewport_helpers.HEADER_SLOT })), index.h("div", { key: 'd1388ff0d721dd8ce925b934bb2128fddc1ac17b', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, index.h("div", { key: 'a306ff56f62279402e2a881a081e3224341d5bdf', class: "content-wrapper", style: { height: `${physicalContentHeight}px` } }, index.h("slot", { key: '898bda8e9429da06c9ff2bd41626ac27f3cde3cc', name: viewport_helpers.CONTENT_SLOT }))), index.h("div", { key: '5e9eba1edd5fca07a964971054a7900e4dd84099', class: "footer-wrapper", ref: e => (this.footer = e) }, index.h("slot", { key: 'f233ad1c23b3f692c45e1db235cfef4704a80726', name: viewport_helpers.FOOTER_SLOT })))));
|
|
836
844
|
}
|
|
837
845
|
/**
|
|
838
846
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
var index = require('./index-Dq8Xzj5l.js');
|
|
7
7
|
var debounce = require('./debounce-CcpHiH2p.js');
|
|
8
|
-
var filter_button = require('./filter.button-
|
|
8
|
+
var filter_button = require('./filter.button-C4xpvyyE.js');
|
|
9
9
|
|
|
10
10
|
(function closest() {
|
|
11
11
|
if (!Element.prototype.matches) {
|
|
@@ -26,12 +26,55 @@ var filter_button = require('./filter.button-w6LWnyhi.js');
|
|
|
26
26
|
}
|
|
27
27
|
})();
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const FILTER_REORDER_MIME = 'text/revogrid-filter-id';
|
|
30
|
+
function setFilterReorderData(dataTransfer, id) {
|
|
31
|
+
if (!dataTransfer) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
dataTransfer.effectAllowed = 'move';
|
|
35
|
+
dataTransfer.setData(FILTER_REORDER_MIME, String(id));
|
|
36
|
+
dataTransfer.setData('text/plain', String(id));
|
|
37
|
+
}
|
|
38
|
+
function getFilterReorderId(dataTransfer) {
|
|
39
|
+
if (!dataTransfer) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const rawId = dataTransfer.getData(FILTER_REORDER_MIME) || dataTransfer.getData('text/plain');
|
|
43
|
+
const normalizedId = rawId.trim();
|
|
44
|
+
if (!normalizedId) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const id = Number(normalizedId);
|
|
48
|
+
return Number.isFinite(id) ? id : undefined;
|
|
49
|
+
}
|
|
50
|
+
function moveFilterItem(items, sourceId, targetId) {
|
|
51
|
+
if (sourceId === targetId) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const sourceIndex = items.findIndex(item => item.id === sourceId);
|
|
55
|
+
const targetIndex = items.findIndex(item => item.id === targetId);
|
|
56
|
+
if (sourceIndex === -1 || targetIndex === -1 || sourceIndex === targetIndex) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const relationsByPosition = items.map(item => { var _a; return (_a = item.relation) !== null && _a !== void 0 ? _a : 'and'; });
|
|
60
|
+
const [movedItem] = items.splice(sourceIndex, 1);
|
|
61
|
+
items.splice(targetIndex, 0, movedItem);
|
|
62
|
+
items.forEach((item, index) => {
|
|
63
|
+
var _a;
|
|
64
|
+
item.relation = index === items.length - 1
|
|
65
|
+
? 'and'
|
|
66
|
+
: (_a = relationsByPosition[index]) !== null && _a !== void 0 ? _a : 'and';
|
|
67
|
+
});
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const filterStyleCss = () => `.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}revogr-filter-panel{display:block}revogr-filter-panel .filter-panel-dialog{position:fixed;top:0;left:0;z-index:100;max-height:calc(100vh - 16px);overflow:auto;opacity:1;transform:none;background-color:var(--revo-grid-filter-panel-bg, #fff);border:1px solid var(--revo-grid-filter-panel-border, #cecece);transform-origin:62px 0px;box-shadow:0 5px 18px -2px var(--revo-grid-filter-panel-shadow, rgba(0, 0, 0, 0.15));box-sizing:border-box;padding:10px;border-radius:8px;margin:0;min-width:220px;text-align:left;animation:revogr-filter-panel-open 140ms cubic-bezier(0.2, 0, 0, 1)}revogr-filter-panel .filter-panel-dialog .filter-holder>div{display:flex;flex-direction:column}revogr-filter-panel .filter-panel-dialog label{font-size:13px;display:block;padding:8px 0}revogr-filter-panel .filter-panel-dialog select{width:100%}revogr-filter-panel .filter-panel-dialog input[type=text]{border:0;min-height:34px;margin:5px 0;background:var(--revo-grid-filter-panel-input-bg, #f3f3f3);border-radius:5px;padding:0 10px;box-sizing:border-box;width:100%}revogr-filter-panel .filter-panel-dialog .filter-actions{position:sticky;right:0;bottom:-10px;left:0;z-index:1;text-align:right;margin:10px -10px -10px;padding:0 5px 10px 10px;background:var(--revo-grid-filter-panel-bg, #fff);border-top:1px solid var(--revo-grid-filter-panel-divider, #d9d9d9)}revogr-filter-panel .filter-panel-dialog .filter-actions button{margin-top:10px;margin-right:5px}@keyframes revogr-filter-panel-open{from{opacity:0;transform:translateY(-4px) scale(0.98)}to{opacity:1;transform:none}}@media (prefers-reduced-motion: reduce){revogr-filter-panel .filter-panel-dialog{animation:none}}.rgHeaderCell:hover .rv-filter{transition:opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms}.rgHeaderCell:hover .rv-filter,.rgHeaderCell .rv-filter.active{opacity:1}.rgHeaderCell .rv-filter{height:24px;width:24px;background:none;border:0;opacity:0;visibility:visible;cursor:pointer;border-radius:4px}.rgHeaderCell .rv-filter.active{color:#10224a}.rgHeaderCell .rv-filter .filter-img{color:gray;width:11px}.select-css{display:block;font-family:sans-serif;line-height:1.3;padding:0.6em 1.4em 0.5em 0.8em;width:100%;max-width:100%;box-sizing:border-box;margin:0;border:1px solid var(--revo-grid-filter-panel-select-border, #d9d9d9);box-shadow:transparent;border-radius:0.5em;appearance:none;background-color:var(--revo-grid-filter-panel-input-bg, #f3f3f3);background-image:url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");background-repeat:no-repeat, repeat;background-position:right 0.7em top 50%, 0 0;background-size:0.65em auto, 100%;}.select-css::-ms-expand{display:none}.select-css:hover{border-color:var(--revo-grid-filter-panel-select-border, #d9d9d9)}.select-css:focus{border-color:var(--revo-grid-filter-panel-select-border-hover, #d9d9d9);box-shadow:0 0 1px 3px rgba(59, 153, 252, 0.7);box-shadow:0 0 0 3px -moz-mac-focusring;outline:none}.select-css option{font-weight:normal}.select-css:disabled,.select-css[aria-disabled=true]{color:gray;background-image:url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"), linear-gradient(to bottom, #ffffff 0%, #ffffff 100%)}.select-css:disabled:hover,.select-css[aria-disabled=true]{border-color:var(--revo-grid-filter-panel-select-border, #d9d9d9)}.multi-filter-list{margin-top:5px;margin-bottom:5px}.multi-filter-list div{white-space:nowrap}.multi-filter-list .multi-filter-list-row{display:flex;align-items:center;gap:6px;position:relative}.multi-filter-list .multi-filter-list-row.filter-row-dragging{opacity:0.65}.multi-filter-list .multi-filter-list-row.filter-row-drag-over::before{content:"";position:absolute;top:-4px;right:0;left:0;z-index:2;height:2px;background:var(--revo-grid-filter-panel-reorder-accent, #007cb2);border-radius:999px;box-shadow:0 0 0 2px var(--revo-grid-filter-panel-bg, #fff)}.multi-filter-list .multi-filter-list-row.filter-row-drop-active .filter-row-drop-target{pointer-events:auto}.multi-filter-list .filter-row-drop-target{position:absolute;inset:0;z-index:1;padding:0;pointer-events:none;background:transparent;border:0}.multi-filter-list .multi-filter-list-action{display:flex;align-self:stretch;flex:0 0 auto;justify-content:flex-end;align-items:center}.multi-filter-list .and-or-button{margin:0 0 0 10px;min-width:58px;cursor:pointer}.multi-filter-list .trash-button{margin:0 0 -2px 6px;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;width:22px;height:100%;font-size:16px}.multi-filter-list .trash-button .trash-img{width:1em}.multi-filter-list .reorder-button{border:0;background:transparent;color:var(--revo-grid-filter-panel-reorder-color, #6b7280);cursor:grab;font-family:monospace;font-size:12px;letter-spacing:0;line-height:1;padding:6px 2px;transform:scaleX(0.8);width:16px}.multi-filter-list .reorder-button.filter-row-drag-over{color:var(--revo-grid-filter-panel-reorder-accent, #007cb2)}.multi-filter-list .reorder-button:active{cursor:grabbing}.multi-filter-list-container{padding:0;margin:0;list-style:none}.add-filter-divider{display:block;margin:0 -10px 10px -10px;border-bottom:1px solid var(--revo-grid-filter-panel-divider, #d9d9d9);height:10px}.select-input{display:flex;align-items:center;flex:1 1 auto;gap:6px;min-width:0}.select-input .select-filter,.select-input .filter-extra{flex:1 1 0;min-width:0}.select-input .select-filter{width:auto}.select-input .filter-extra{display:flex}.select-input .filter-extra>*{width:100%}.select-input input[type=text],.select-input input[type=date]{margin:0}`;
|
|
30
72
|
|
|
31
73
|
const defaultType = 'none';
|
|
32
74
|
const FILTER_LIST_CLASS = 'multi-filter-list';
|
|
33
75
|
const FILTER_LIST_CLASS_ACTION = 'multi-filter-list-action';
|
|
34
76
|
const FILTER_ID = 'add-filter';
|
|
77
|
+
const VIEWPORT_PADDING = 8;
|
|
35
78
|
const FilterPanel = class {
|
|
36
79
|
constructor(hostRef) {
|
|
37
80
|
index.registerInstance(this, hostRef);
|
|
@@ -48,6 +91,9 @@ const FilterPanel = class {
|
|
|
48
91
|
placeholder: 'Enter value...',
|
|
49
92
|
and: 'and',
|
|
50
93
|
or: 'or',
|
|
94
|
+
filterCondition: 'Filter condition',
|
|
95
|
+
removeFilter: 'Remove filter',
|
|
96
|
+
reorderFilter: 'Reorder filter',
|
|
51
97
|
};
|
|
52
98
|
this.isFilterIdSet = false;
|
|
53
99
|
this.filterId = 0;
|
|
@@ -121,18 +167,28 @@ const FilterPanel = class {
|
|
|
121
167
|
if (typeof prop === 'undefined')
|
|
122
168
|
return '';
|
|
123
169
|
const propFilters = (_b = this.filterItems[prop]) !== null && _b !== void 0 ? _b : [];
|
|
124
|
-
const
|
|
125
|
-
|
|
170
|
+
const visibleFilterCount = propFilters.filter(filter => !filter.hidden).length;
|
|
171
|
+
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
172
|
+
return (index.h("div", { key: this.filterId }, index.h("ul", { class: "multi-filter-list-container" }, propFilters.map((filter, index$1) => {
|
|
126
173
|
let andOrButton;
|
|
127
174
|
if (filter.hidden) {
|
|
128
175
|
return;
|
|
129
176
|
}
|
|
130
177
|
// hide toggle button if there is only one filter and the last one
|
|
131
178
|
if (index$1 !== this.filterItems[prop].length - 1) {
|
|
132
|
-
andOrButton = (index.h(
|
|
179
|
+
andOrButton = (index.h(filter_button.AndOrButton, { text: filter.relation === 'and' ? capts.and : capts.or, onClick: () => this.toggleFilterAndOr(filter.id) }));
|
|
133
180
|
}
|
|
134
|
-
|
|
135
|
-
|
|
181
|
+
const extra = this.renderExtra(prop, index$1);
|
|
182
|
+
const isDragging = this.draggedFilterId === filter.id;
|
|
183
|
+
const isDragOver = this.dragOverFilterId === filter.id && !isDragging;
|
|
184
|
+
const canReorder = visibleFilterCount > 1;
|
|
185
|
+
return (index.h("li", { key: filter.id, class: FILTER_LIST_CLASS, "aria-label": `${capts.filterCondition} ${index$1 + 1}` }, index.h("div", { class: {
|
|
186
|
+
'multi-filter-list-row': true,
|
|
187
|
+
'filter-row-drop-active': this.draggedFilterId !== undefined && !isDragging,
|
|
188
|
+
'filter-row-dragging': isDragging,
|
|
189
|
+
'filter-row-drag-over': isDragOver,
|
|
190
|
+
} }, canReorder ? (index.h("button", { type: "button", class: "filter-row-drop-target", tabIndex: -1, "aria-label": `${capts.filterCondition} ${index$1 + 1}`, onDragOver: e => this.onFilterDragOver(e, filter.id), onDragLeave: () => this.onFilterDragLeave(filter.id), onDrop: e => this.onFilterDrop(e, prop, filter.id) })) : '', canReorder ? (index.h(filter_button.ReorderButton, { ariaLabel: capts.reorderFilter, dragging: isDragging, dragOver: isDragOver, onDragStart: e => this.onFilterDragStart(e, filter.id), onDragEnd: () => this.onFilterDragEnd(), onKeyDown: e => this.onFilterReorderKeyDown(e, prop, filter.id) })) : '', index.h("div", { class: { 'select-input': true } }, index.h("select", { class: "select-css select-filter", onChange: e => this.onFilterTypeChange(e, prop, index$1) }, this.renderSelectOptions(this.filterItems[prop][index$1].type, true)), extra ? index.h("div", { class: "filter-extra" }, extra) : ''), index.h("div", { class: FILTER_LIST_CLASS_ACTION }, andOrButton, index.h(filter_button.TrashButton, { ariaLabel: capts.removeFilter, onClick: () => this.onRemoveFilter(filter.id) })))));
|
|
191
|
+
})), propFilters.filter(f => !f.hidden).length > 0 ? index.h("div", { class: "add-filter-divider" }) : ''));
|
|
136
192
|
}
|
|
137
193
|
componentDidRender() {
|
|
138
194
|
this.syncDialog();
|
|
@@ -151,37 +207,35 @@ const FilterPanel = class {
|
|
|
151
207
|
this.dialog.show();
|
|
152
208
|
}
|
|
153
209
|
if (this.changes.autoCorrect !== false) {
|
|
210
|
+
this.autoCorrect(this.dialog);
|
|
154
211
|
requestAnimationFrame(() => this.autoCorrect(this.dialog));
|
|
155
212
|
}
|
|
156
213
|
}
|
|
157
214
|
autoCorrect(el) {
|
|
158
|
-
|
|
215
|
+
var _a;
|
|
216
|
+
if (!el || !this.changes) {
|
|
159
217
|
return;
|
|
160
218
|
}
|
|
219
|
+
el.style.maxHeight = '';
|
|
220
|
+
el.style.left = `${this.changes.x}px`;
|
|
221
|
+
el.style.top = `${this.changes.y}px`;
|
|
161
222
|
const pos = el.getBoundingClientRect();
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const isInside = e.clientX >= rect.left &&
|
|
179
|
-
e.clientX <= rect.right &&
|
|
180
|
-
e.clientY >= rect.top &&
|
|
181
|
-
e.clientY <= rect.bottom;
|
|
182
|
-
if (!isInside) {
|
|
183
|
-
this.onCancel();
|
|
184
|
-
}
|
|
223
|
+
const anchorTop = (_a = this.changes.anchorY) !== null && _a !== void 0 ? _a : this.changes.y;
|
|
224
|
+
const anchorBottom = this.changes.y;
|
|
225
|
+
const spaceAbove = Math.max(0, anchorTop - VIEWPORT_PADDING);
|
|
226
|
+
const spaceBelow = Math.max(0, window.innerHeight - anchorBottom - VIEWPORT_PADDING);
|
|
227
|
+
const openAbove = pos.height > spaceBelow && spaceAbove > spaceBelow;
|
|
228
|
+
const availableHeight = Math.max(VIEWPORT_PADDING, openAbove ? spaceAbove : spaceBelow);
|
|
229
|
+
el.style.maxHeight = `${availableHeight}px`;
|
|
230
|
+
const adjustedPos = el.getBoundingClientRect();
|
|
231
|
+
const maxLeft = Math.max(VIEWPORT_PADDING, window.innerWidth - adjustedPos.width - VIEWPORT_PADDING);
|
|
232
|
+
const maxTop = Math.max(VIEWPORT_PADDING, window.innerHeight - adjustedPos.height - VIEWPORT_PADDING);
|
|
233
|
+
const left = Math.min(Math.max(VIEWPORT_PADDING, this.changes.x), maxLeft);
|
|
234
|
+
const top = openAbove
|
|
235
|
+
? Math.min(Math.max(VIEWPORT_PADDING, anchorTop - adjustedPos.height), maxTop)
|
|
236
|
+
: Math.min(Math.max(VIEWPORT_PADDING, anchorBottom), maxTop);
|
|
237
|
+
el.style.left = `${left}px`;
|
|
238
|
+
el.style.top = `${top}px`;
|
|
185
239
|
}
|
|
186
240
|
onFilterTypeChange(e, prop, index) {
|
|
187
241
|
if (!(e.target instanceof HTMLSelectElement)) {
|
|
@@ -273,6 +327,80 @@ const FilterPanel = class {
|
|
|
273
327
|
this.debouncedApplyFilter();
|
|
274
328
|
}
|
|
275
329
|
}
|
|
330
|
+
onFilterDragStart(e, id) {
|
|
331
|
+
this.draggedFilterId = id;
|
|
332
|
+
setFilterReorderData(e.dataTransfer, id);
|
|
333
|
+
}
|
|
334
|
+
onFilterDragOver(e, id) {
|
|
335
|
+
if (this.draggedFilterId === undefined || this.draggedFilterId === id) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
e.preventDefault();
|
|
339
|
+
if (e.dataTransfer) {
|
|
340
|
+
e.dataTransfer.dropEffect = 'move';
|
|
341
|
+
}
|
|
342
|
+
this.dragOverFilterId = id;
|
|
343
|
+
}
|
|
344
|
+
onFilterDragLeave(id) {
|
|
345
|
+
if (this.dragOverFilterId === id) {
|
|
346
|
+
this.dragOverFilterId = undefined;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
onFilterDrop(e, prop, targetId) {
|
|
350
|
+
var _a;
|
|
351
|
+
e.preventDefault();
|
|
352
|
+
const sourceId = (_a = this.draggedFilterId) !== null && _a !== void 0 ? _a : getFilterReorderId(e.dataTransfer);
|
|
353
|
+
this.onFilterDragEnd();
|
|
354
|
+
if (sourceId === undefined) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const items = this.filterItems[prop];
|
|
358
|
+
if (!items) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (!moveFilterItem(items, sourceId, targetId)) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
this.filterId++;
|
|
365
|
+
if (!this.disableDynamicFiltering) {
|
|
366
|
+
this.debouncedApplyFilter();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
onFilterDragEnd() {
|
|
370
|
+
this.draggedFilterId = undefined;
|
|
371
|
+
this.dragOverFilterId = undefined;
|
|
372
|
+
}
|
|
373
|
+
onFilterReorderKeyDown(e, prop, sourceId) {
|
|
374
|
+
let direction = 0;
|
|
375
|
+
if (e.key === 'ArrowUp') {
|
|
376
|
+
direction = -1;
|
|
377
|
+
}
|
|
378
|
+
else if (e.key === 'ArrowDown') {
|
|
379
|
+
direction = 1;
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const items = this.filterItems[prop];
|
|
385
|
+
if (!items) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const visibleItems = items.filter(item => !item.hidden);
|
|
389
|
+
const sourceIndex = visibleItems.findIndex(item => item.id === sourceId);
|
|
390
|
+
if (sourceIndex === -1) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
e.preventDefault();
|
|
394
|
+
e.stopPropagation();
|
|
395
|
+
const target = visibleItems[sourceIndex + direction];
|
|
396
|
+
if (!target || !moveFilterItem(items, sourceId, target.id)) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
this.filterId++;
|
|
400
|
+
if (!this.disableDynamicFiltering) {
|
|
401
|
+
this.debouncedApplyFilter();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
276
404
|
toggleFilterAndOr(id) {
|
|
277
405
|
var _a;
|
|
278
406
|
this.assertChanges();
|
|
@@ -311,7 +439,7 @@ const FilterPanel = class {
|
|
|
311
439
|
});
|
|
312
440
|
});
|
|
313
441
|
if (!isDefaultTypeRemoved) {
|
|
314
|
-
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
442
|
+
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
315
443
|
options.push(index.h("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0
|
|
316
444
|
? capts.add
|
|
317
445
|
: this.filterNames[defaultType]));
|
|
@@ -344,7 +472,7 @@ const FilterPanel = class {
|
|
|
344
472
|
select.focus();
|
|
345
473
|
}
|
|
346
474
|
};
|
|
347
|
-
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
475
|
+
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
348
476
|
const extra = this.filterEntities[currentFilter[index$1].type].extra;
|
|
349
477
|
if (typeof extra === 'function') {
|
|
350
478
|
return extra(index.h, {
|
|
@@ -381,32 +509,33 @@ const FilterPanel = class {
|
|
|
381
509
|
} }));
|
|
382
510
|
}
|
|
383
511
|
render() {
|
|
384
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
512
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
385
513
|
const style = {
|
|
386
514
|
left: `${(_b = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0}px`,
|
|
387
515
|
top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
|
|
388
516
|
};
|
|
389
|
-
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
390
|
-
return (index.h(index.Host, { key: '
|
|
517
|
+
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
518
|
+
return (index.h(index.Host, { key: '4e969f8b7033363c885c94b1f7770917786669f2' }, index.h("dialog", { key: '79b2713724684fa99f56621fe43645a0b0ad54bf', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
|
|
391
519
|
e.preventDefault();
|
|
392
520
|
this.onCancel();
|
|
393
|
-
}
|
|
394
|
-
index.h("slot", { key:
|
|
521
|
+
} }, this.changes && [
|
|
522
|
+
index.h("slot", { key: "header-slot", slot: "header" }),
|
|
395
523
|
((_f = (_e = this.changes).extraContent) === null || _f === void 0 ? void 0 : _f.call(_e, this.changes)) || '',
|
|
396
524
|
((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
|
|
397
|
-
index.h("label", { key:
|
|
398
|
-
index.h("div", { key:
|
|
399
|
-
index.h("div", { key:
|
|
525
|
+
index.h("label", { key: "filter-title" }, capts.title),
|
|
526
|
+
index.h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
|
|
527
|
+
index.h("div", { key: "add-filter", class: "add-filter" }, index.h("select", { key: 'fc894bdfae1ff35d5c49adc7646dd3182b7bd49e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
|
|
400
528
|
],
|
|
401
|
-
index.h("slot", { key:
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
index.h("button", { key:
|
|
529
|
+
index.h("slot", { key: "default-slot" }),
|
|
530
|
+
((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
|
|
531
|
+
index.h("div", { key: "filter-actions", class: "filter-actions" }, this.disableDynamicFiltering && [
|
|
532
|
+
index.h("button", { key: "save", id: "revo-button-save", "aria-label": "save", class: "revo-button green", onClick: () => this.onSave() }, capts.save),
|
|
533
|
+
index.h("button", { key: "cancel", id: "revo-button-ok", "aria-label": "ok", class: "revo-button green", onClick: () => this.onCancel() }, capts.cancel),
|
|
405
534
|
], !this.disableDynamicFiltering && [
|
|
406
|
-
index.h("button", { key:
|
|
407
|
-
index.h("button", { key:
|
|
535
|
+
index.h("button", { key: "ok", id: "revo-button-ok", "aria-label": "ok", class: "revo-button green", onClick: () => this.onCancel() }, capts.ok),
|
|
536
|
+
index.h("button", { key: "reset", id: "revo-button-reset", "aria-label": "reset", class: "revo-button outline", onClick: () => this.onReset() }, capts.reset),
|
|
408
537
|
]),
|
|
409
|
-
index.h("slot", { key:
|
|
538
|
+
index.h("slot", { key: "footer-slot", slot: "footer" }),
|
|
410
539
|
])));
|
|
411
540
|
}
|
|
412
541
|
get element() { return index.getElement(this); }
|
|
@@ -124,7 +124,7 @@ export class Clipboard {
|
|
|
124
124
|
}
|
|
125
125
|
getData(e) {
|
|
126
126
|
return (e.clipboardData ||
|
|
127
|
-
(
|
|
127
|
+
(globalThis === null || globalThis === void 0 ? void 0 : globalThis.clipboardData));
|
|
128
128
|
}
|
|
129
129
|
static get is() { return "revogr-clipboard"; }
|
|
130
130
|
static get properties() {
|
|
@@ -144,43 +144,82 @@ export default class ColumnService {
|
|
|
144
144
|
mapping,
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
getTransformedDataToApply(start, data) {
|
|
147
|
+
getTransformedDataToApply({ start, data, targetRange, }) {
|
|
148
148
|
const changed = {};
|
|
149
149
|
const copyRowLength = data.length;
|
|
150
|
+
if (!copyRowLength) {
|
|
151
|
+
return {
|
|
152
|
+
changed,
|
|
153
|
+
range: null,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
150
156
|
const colLength = this.columns.length;
|
|
151
157
|
const rowLength = this.dataStore.get('items').length;
|
|
158
|
+
const bounds = this.getDataApplyBounds(start, targetRange, copyRowLength, rowLength, colLength);
|
|
159
|
+
if (!bounds) {
|
|
160
|
+
return {
|
|
161
|
+
changed,
|
|
162
|
+
range: null,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const { startRow, startCol, endRow } = bounds;
|
|
166
|
+
let maxCol = startCol - 1;
|
|
167
|
+
let lastRow = startRow - 1;
|
|
152
168
|
// rows
|
|
153
|
-
let rowIndex =
|
|
154
|
-
let maxCol = 0;
|
|
155
|
-
for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
|
|
169
|
+
for (let rowIndex = startRow, i = 0; rowIndex <= endRow; rowIndex++, i++) {
|
|
156
170
|
// copy original data link
|
|
157
171
|
const copyRow = data[i % copyRowLength];
|
|
158
172
|
const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
|
|
162
|
-
const p = this.columns[colIndex].prop;
|
|
163
|
-
const currentCol = j % colLength;
|
|
164
|
-
/** if can write */
|
|
165
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
166
|
-
/** to show before save */
|
|
167
|
-
if (!changed[rowIndex]) {
|
|
168
|
-
changed[rowIndex] = {};
|
|
169
|
-
}
|
|
170
|
-
changed[rowIndex][p] = copyRow[currentCol];
|
|
171
|
-
}
|
|
173
|
+
if (!copyColLength) {
|
|
174
|
+
continue;
|
|
172
175
|
}
|
|
173
|
-
maxCol = Math.max(maxCol,
|
|
176
|
+
maxCol = Math.max(maxCol, this.applyClipboardRow(changed, {
|
|
177
|
+
bounds,
|
|
178
|
+
copyColLength,
|
|
179
|
+
copyRow,
|
|
180
|
+
rowIndex,
|
|
181
|
+
start,
|
|
182
|
+
targetRange,
|
|
183
|
+
}));
|
|
184
|
+
lastRow = rowIndex;
|
|
174
185
|
}
|
|
175
|
-
const range = getRange(start, {
|
|
176
|
-
y: rowIndex - 1,
|
|
177
|
-
x: maxCol,
|
|
178
|
-
});
|
|
179
186
|
return {
|
|
180
187
|
changed,
|
|
181
|
-
range,
|
|
188
|
+
range: this.getAppliedRange(bounds, lastRow, maxCol),
|
|
182
189
|
};
|
|
183
190
|
}
|
|
191
|
+
getDataApplyBounds(start, targetRange, copyRowLength, rowLength, colLength) {
|
|
192
|
+
var _a, _b, _c;
|
|
193
|
+
const startRow = (_a = targetRange === null || targetRange === void 0 ? void 0 : targetRange.y) !== null && _a !== void 0 ? _a : start.y;
|
|
194
|
+
const startCol = (_b = targetRange === null || targetRange === void 0 ? void 0 : targetRange.x) !== null && _b !== void 0 ? _b : start.x;
|
|
195
|
+
const endRow = Math.min(rowLength - 1, (_c = targetRange === null || targetRange === void 0 ? void 0 : targetRange.y1) !== null && _c !== void 0 ? _c : start.y + copyRowLength - 1);
|
|
196
|
+
if (endRow < startRow || startCol >= colLength) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
return { startRow, startCol, endRow, colLength };
|
|
200
|
+
}
|
|
201
|
+
applyClipboardRow(changed, { bounds, copyColLength, copyRow, rowIndex, start, targetRange, }) {
|
|
202
|
+
var _a;
|
|
203
|
+
const endCol = Math.min(bounds.colLength - 1, (_a = targetRange === null || targetRange === void 0 ? void 0 : targetRange.x1) !== null && _a !== void 0 ? _a : start.x + copyColLength - 1);
|
|
204
|
+
for (let colIndex = bounds.startCol, j = 0; colIndex <= endCol; colIndex++, j++) {
|
|
205
|
+
if (this.isReadOnly(rowIndex, colIndex)) {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
const prop = this.columns[colIndex].prop;
|
|
209
|
+
changed[rowIndex] = changed[rowIndex] || {};
|
|
210
|
+
changed[rowIndex][prop] = copyRow[j % copyColLength];
|
|
211
|
+
}
|
|
212
|
+
return endCol;
|
|
213
|
+
}
|
|
214
|
+
getAppliedRange({ startRow, startCol }, lastRow, maxCol) {
|
|
215
|
+
if (lastRow < startRow || maxCol < startCol) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
return getRange({ x: startCol, y: startRow }, {
|
|
219
|
+
y: lastRow,
|
|
220
|
+
x: maxCol,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
184
223
|
getRangeStaticData(d, value) {
|
|
185
224
|
const changed = {};
|
|
186
225
|
// rows
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
5
|
+
var t = {};
|
|
6
|
+
for (var p in s)
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
10
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
11
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
12
|
+
t[p[i]] = s[p[i]];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
4
16
|
import { h } from "@stencil/core";
|
|
5
17
|
import { DATA_ROW } from "../../utils/consts";
|
|
6
18
|
export const PADDING_DEPTH = 10;
|
|
7
|
-
const RowRenderer = (
|
|
8
|
-
|
|
19
|
+
const RowRenderer = (_a, cells) => {
|
|
20
|
+
var { rowClass, index, size, start, depth, groupingLevel } = _a, attrs = __rest(_a, ["rowClass", "index", "size", "start", "depth", "groupingLevel"]);
|
|
21
|
+
const props = Object.assign(Object.assign(Object.assign({}, attrs), { [DATA_ROW]: index }), (typeof groupingLevel === 'number'
|
|
9
22
|
? { 'data-level': groupingLevel }
|
|
10
23
|
: {}));
|
|
11
24
|
return (h("div", Object.assign({}, props, { class: `rgRow ${rowClass || ''}`, style: {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist OU ❤️
|
|
3
|
+
*/
|
|
4
|
+
export function getRangeFillClipboardData(data, useClipboard) {
|
|
5
|
+
var _a;
|
|
6
|
+
if (!isClipboardRangeFillEnabled(useClipboard)) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const normalized = trimTrailingEmptyClipboardRows(data);
|
|
10
|
+
return normalized.length === 1 && ((_a = normalized[0]) === null || _a === void 0 ? void 0 : _a.length) === 1
|
|
11
|
+
? normalized
|
|
12
|
+
: null;
|
|
13
|
+
}
|
|
14
|
+
export function isClipboardRangeFillEnabled(useClipboard) {
|
|
15
|
+
return (typeof useClipboard === 'object' && useClipboard.rangeFill === true);
|
|
16
|
+
}
|
|
17
|
+
function trimTrailingEmptyClipboardRows(data) {
|
|
18
|
+
const rows = [...data];
|
|
19
|
+
while (rows.length > 1 && isEmptyClipboardRow(rows[rows.length - 1])) {
|
|
20
|
+
rows.pop();
|
|
21
|
+
}
|
|
22
|
+
return rows;
|
|
23
|
+
}
|
|
24
|
+
function isEmptyClipboardRow(row) {
|
|
25
|
+
return !row || row.every(cell => cell === '');
|
|
26
|
+
}
|
|
@@ -10,6 +10,7 @@ import { collectModelsOfRange, getCell, getFocusCellBasedOnEvent, styleByCellPro
|
|
|
10
10
|
import { isEditInput } from "../editors/edit.utils";
|
|
11
11
|
import { KeyboardService } from "./keyboard.service";
|
|
12
12
|
import { AutoFillService } from "./autofill.service";
|
|
13
|
+
import { getRangeFillClipboardData } from "./clipboard.utils";
|
|
13
14
|
import { verifyTouchTarget } from "../../utils/events";
|
|
14
15
|
import { getCellData } from "../../utils";
|
|
15
16
|
/**
|
|
@@ -233,9 +234,9 @@ export class OverlaySelection {
|
|
|
233
234
|
nodes.push(h("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, rowType: this.types.rowType, onRowdragstartinit: e => this.rowDragStart(e) }));
|
|
234
235
|
}
|
|
235
236
|
}
|
|
236
|
-
return (h(Host, { key: '
|
|
237
|
+
return (h(Host, { key: 'ff303c39d59e4ef217421fa11b9a80de07311b07', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true), onCloseedit: (e) => this.closeEdit(e),
|
|
237
238
|
// it's done to be able to throw events from different levels, not just from editor
|
|
238
|
-
onCelledit: (e) => this.onEditCell(e) }, nodes, h("slot", { key: '
|
|
239
|
+
onCelledit: (e) => this.onEditCell(e) }, nodes, h("slot", { key: '3cbe4c3ad7d447f779e9e20f73eec2e3107275e0', name: "data" })));
|
|
239
240
|
}
|
|
240
241
|
/**
|
|
241
242
|
* Executes the focus operation on the specified range of cells.
|
|
@@ -400,13 +401,25 @@ export class OverlaySelection {
|
|
|
400
401
|
if (!focus || isEditing) {
|
|
401
402
|
return;
|
|
402
403
|
}
|
|
403
|
-
|
|
404
|
+
const rangeFillData = getRangeFillClipboardData(data, this.useClipboard);
|
|
405
|
+
const targetRange = rangeFillData
|
|
406
|
+
? this.getClipboardPasteTargetRange()
|
|
407
|
+
: null;
|
|
408
|
+
let { changed, range } = this.columnService.getTransformedDataToApply({
|
|
409
|
+
start: focus,
|
|
410
|
+
data: rangeFillData || data,
|
|
411
|
+
targetRange,
|
|
412
|
+
});
|
|
404
413
|
const { defaultPrevented: canPaste } = this.rangeClipboardPaste.emit(Object.assign({ data: changed, models: collectModelsOfRange(changed, this.dataStore), range }, this.types));
|
|
405
414
|
if (canPaste) {
|
|
406
415
|
return;
|
|
407
416
|
}
|
|
408
417
|
(_a = this.autoFillService) === null || _a === void 0 ? void 0 : _a.onRangeApply(changed, range, range);
|
|
409
418
|
}
|
|
419
|
+
getClipboardPasteTargetRange() {
|
|
420
|
+
const range = this.selectionStore.get('range');
|
|
421
|
+
return range && !isRangeSingleCell(range) ? range : null;
|
|
422
|
+
}
|
|
410
423
|
async focusNext() {
|
|
411
424
|
var _a;
|
|
412
425
|
const canFocus = await ((_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyChangeSelection(new KeyboardEvent('keydown', {
|
|
@@ -565,15 +578,22 @@ export class OverlaySelection {
|
|
|
565
578
|
"type": "boolean",
|
|
566
579
|
"mutable": false,
|
|
567
580
|
"complexType": {
|
|
568
|
-
"original": "boolean",
|
|
569
|
-
"resolved": "boolean",
|
|
570
|
-
"references": {
|
|
581
|
+
"original": "boolean | ClipboardConfig",
|
|
582
|
+
"resolved": "ClipboardConfig | boolean",
|
|
583
|
+
"references": {
|
|
584
|
+
"ClipboardConfig": {
|
|
585
|
+
"location": "import",
|
|
586
|
+
"path": "@type",
|
|
587
|
+
"id": "src/types/index.ts::ClipboardConfig",
|
|
588
|
+
"referenceLocation": "ClipboardConfig"
|
|
589
|
+
}
|
|
590
|
+
}
|
|
571
591
|
},
|
|
572
592
|
"required": false,
|
|
573
593
|
"optional": false,
|
|
574
594
|
"docs": {
|
|
575
595
|
"tags": [],
|
|
576
|
-
"text": "Enable revogr-clipboard component (read more in revogr-clipboard component).\nAllows copy/paste."
|
|
596
|
+
"text": "Enable revogr-clipboard component (read more in revogr-clipboard component).\nAllows copy/paste. Can be boolean or clipboard config."
|
|
577
597
|
},
|
|
578
598
|
"getter": false,
|
|
579
599
|
"setter": false,
|