@revolist/revogrid 4.0.11 → 4.0.12
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/{column.service-e83d9809.js → column.service-bc269420.js} +23 -9
- package/dist/cjs/column.service-bc269420.js.map +1 -0
- package/dist/cjs/{events-7ccd6894.js → events-f8893bba.js} +15 -5
- package/dist/cjs/events-f8893bba.js.map +1 -0
- package/dist/cjs/{header-cell-renderer-8ba9b56d.js → header-cell-renderer-57acd2f7.js} +2 -2
- package/dist/cjs/{header-cell-renderer-8ba9b56d.js.map → header-cell-renderer-57acd2f7.js.map} +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +29 -13
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +176 -126
- package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +2 -2
- package/dist/collection/components/data/column.service.js.map +1 -1
- package/dist/collection/components/data/revogr-data.js +1 -1
- package/dist/collection/components/editors/revogr-edit.js +1 -1
- package/dist/collection/components/order/revogr-order-editor.js +4 -1
- package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
- package/dist/collection/components/overlay/autofill.service.js +36 -24
- package/dist/collection/components/overlay/autofill.service.js.map +1 -1
- package/dist/collection/components/overlay/keyboard.service.js +7 -7
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
- package/dist/collection/components/overlay/revogr-overlay-selection.js +107 -59
- package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
- package/dist/collection/components/overlay/selection.utils.js +37 -9
- package/dist/collection/components/overlay/selection.utils.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid-style.css +8 -3
- package/dist/collection/components/revoGrid/revo-grid.js +26 -11
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.helpers.js +22 -8
- package/dist/collection/components/revoGrid/viewport.helpers.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.service.js +1 -0
- package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
- package/dist/collection/serve/controller.js +86 -18
- package/dist/collection/store/selection/index.js +0 -1
- package/dist/collection/store/selection/index.js.map +1 -1
- package/dist/collection/types/interfaces.js +4 -0
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/collection/utils/events.js +11 -1
- package/dist/collection/utils/events.js.map +1 -1
- package/dist/collection/utils/row-header-utils.js +2 -2
- package/dist/collection/utils/row-header-utils.js.map +1 -1
- package/dist/esm/{column.service-f4922a8d.js → column.service-195345ab.js} +23 -9
- package/dist/esm/column.service-195345ab.js.map +1 -0
- package/dist/esm/{events-3dd8ee7c.js → events-3e39de50.js} +15 -5
- package/dist/esm/events-3e39de50.js.map +1 -0
- package/dist/esm/{header-cell-renderer-ac962570.js → header-cell-renderer-7c76465d.js} +2 -2
- package/dist/esm/{header-cell-renderer-ac962570.js.map → header-cell-renderer-7c76465d.js.map} +1 -1
- package/dist/esm/revo-grid.entry.js +29 -13
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +176 -126
- package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +2 -2
- package/dist/revo-grid/column.service-195345ab.js +5 -0
- package/dist/revo-grid/column.service-195345ab.js.map +1 -0
- package/dist/revo-grid/{events-3dd8ee7c.js → events-3e39de50.js} +2 -2
- package/dist/revo-grid/events-3e39de50.js.map +1 -0
- package/dist/revo-grid/{header-cell-renderer-ac962570.js → header-cell-renderer-7c76465d.js} +2 -2
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/types/components/data/column.service.d.ts +2 -2
- package/dist/types/components/order/revogr-order-editor.d.ts +3 -0
- package/dist/types/components/overlay/autofill.service.d.ts +9 -6
- package/dist/types/components/overlay/keyboard.service.d.ts +2 -3
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +38 -15
- package/dist/types/components/overlay/selection.utils.d.ts +12 -4
- package/dist/types/components/revoGrid/revo-grid.d.ts +4 -1
- package/dist/types/components/revoGrid/viewport.helpers.d.ts +11 -2
- package/dist/types/components.d.ts +26 -2
- package/dist/types/store/selection/index.d.ts +0 -1
- package/dist/types/types/interfaces.d.ts +444 -23
- package/dist/types/utils/events.d.ts +4 -1
- package/dist/types/utils/row-header-utils.d.ts +1 -1
- package/hydrate/index.js +265 -169
- package/package.json +5 -6
- package/standalone/column.service.js.map +1 -1
- package/standalone/revo-grid.js +28 -11
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-focus2.js +1 -1
- package/standalone/revogr-order-editor2.js.map +1 -1
- package/standalone/revogr-overlay-selection2.js +140 -143
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +2 -2
- package/standalone/revogr-row-headers2.js.map +1 -1
- package/standalone/revogr-temp-range2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +22 -8
- package/standalone/revogr-viewport-scroll2.js.map +1 -1
- package/standalone/selection.utils.js +72 -9
- package/standalone/selection.utils.js.map +1 -1
- package/dist/cjs/column.service-e83d9809.js.map +0 -1
- package/dist/cjs/events-7ccd6894.js.map +0 -1
- package/dist/collection/store/selection/selection.store.service.js +0 -39
- package/dist/collection/store/selection/selection.store.service.js.map +0 -1
- package/dist/esm/column.service-f4922a8d.js.map +0 -1
- package/dist/esm/events-3dd8ee7c.js.map +0 -1
- package/dist/revo-grid/column.service-f4922a8d.js +0 -5
- package/dist/revo-grid/column.service-f4922a8d.js.map +0 -1
- package/dist/revo-grid/events-3dd8ee7c.js.map +0 -1
- package/dist/types/store/selection/selection.store.service.d.ts +0 -17
- /package/dist/revo-grid/{header-cell-renderer-ac962570.js.map → header-cell-renderer-7c76465d.js.map} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
5
5
|
import { F as FOCUS_CLASS } from './consts.js';
|
|
6
|
-
import {
|
|
6
|
+
import { a as getElStyle } from './selection.utils.js';
|
|
7
7
|
import { b as getSourceItem } from './data.store.js';
|
|
8
8
|
|
|
9
9
|
const revogrFocusStyleCss = ".revo-drag-icon{width:11px}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#6200ee;height:34px;line-height:34px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037;border:1px solid #00772d}.revo-button.red{background-color:#E0662E;border:1px solid #d55920}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.light{border:1px solid #cedefa;line-height:32px;background:none;color:#000;box-shadow:none}revogr-focus.focused-cell{box-shadow:-1px 0 0 #0d63e8 inset, 1px 0 0 #0d63e8 inset, 0 -1px 0 #0d63e8 inset, 0 1px 0 #0d63e8 inset;position:absolute;pointer-events:none;z-index:9;display:block !important}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"revogr-order-editor2.js","mappings":";;;;;;;;;MASqB,eAAe;IAIlC,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAH1B,gBAAW,GAAgB,IAAI,CAAC;QAChC,gBAAW,GAAkB,IAAI,CAAC;KAEJ;;IAGtC,QAAQ,CAAC,CAAa,EAAE,IAAe;QACrC,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;YAC7B,OAAO;SACR;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;;QAGrC,IAAI,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE;;YAEnC,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE;gBAChB,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;aACd;;iBAEI,IAAI,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,WAA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,KAAK;YAC7B,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;SAC9B,CAAC;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["debounce"],"sources":["src/components/order/order-row.service.ts","src/components/order/revogr-order-editor.tsx"],"sourcesContent":["import { getItemByPosition } from '../../store/dimension/dimension.helpers';\nimport { DimensionSettingsState, PositionItem } from '../..';\nimport { Cell } from '../..';\n\ntype EventData = { el: HTMLElement; rows: DimensionSettingsState; cols: DimensionSettingsState };\ninterface Config {\n positionChanged(from: number, to: number): void;\n}\n\nexport default class RowOrderService {\n private currentCell: Cell | null = null;\n private previousRow: number | null = null;\n\n constructor(private config: Config) {}\n\n /** Drag finished, calculate and apply changes */\n endOrder(e: MouseEvent, data: EventData) {\n if (this.currentCell === null) {\n return;\n }\n const newRow = this.getCell(e, data);\n\n // if position changed\n if (newRow.y !== this.currentCell.y) {\n // rgRow dragged out table\n if (newRow.y < 0) {\n newRow.y = 0;\n }\n // rgRow dragged to the top\n else if (newRow.y < this.currentCell.y) {\n newRow.y++;\n }\n this.config.positionChanged(this.currentCell.y, newRow.y);\n }\n this.clear();\n }\n\n /** Drag started, reserve initial cell for farther use */\n startOrder(e: MouseEvent, data: EventData): Cell {\n this.currentCell = this.getCell(e, data);\n return this.currentCell;\n }\n\n move(y: number, data: EventData): PositionItem | null {\n const rgRow = this.getRow(y, data);\n // if rgRow same as previous or below range (-1 = 0) do nothing\n if (this.previousRow === rgRow.itemIndex || rgRow.itemIndex < -1) {\n return null;\n }\n this.previousRow = rgRow.itemIndex;\n return rgRow;\n }\n\n /** Drag stopped, probably cursor outside of document area */\n clear() {\n this.currentCell = null;\n this.previousRow = null;\n }\n\n /** Calculate cell based on x, y position */\n getRow(y: number, { el, rows }: EventData): PositionItem {\n const { top } = el.getBoundingClientRect();\n const topRelative = y - top;\n const rgRow = getItemByPosition(rows, topRelative);\n const absolutePosition = {\n itemIndex: rgRow.itemIndex,\n start: rgRow.start + top,\n end: rgRow.end + top,\n };\n return absolutePosition;\n }\n\n /** Calculate cell based on x, y position */\n getCell({ x, y }: Cell, { el, rows, cols }: EventData): Cell {\n const { top, left } = el.getBoundingClientRect();\n const topRelative = y - top;\n const leftRelative = x - left;\n const rgRow = getItemByPosition(rows, topRelative);\n const rgCol = getItemByPosition(cols, leftRelative);\n return { x: rgCol.itemIndex, y: rgRow.itemIndex };\n }\n}\n","import {\n Component,\n Method,\n Event,\n EventEmitter,\n Prop,\n} from '@stencil/core';\nimport debounce from 'lodash/debounce';\n\nimport { DSourceState, setItems } from '../../store/dataSource/data.store';\nimport { DRAGG_TEXT } from '../../utils/consts';\nimport RowOrderService from './order-row.service';\nimport { DimensionRows } from '../../types/dimension';\nimport {\n DataType,\n DimensionSettingsState,\n DragStartEvent,\n Observable,\n PositionItem,\n} from '../../types/interfaces';\nimport { Cell } from '../../types/selection';\n\n@Component({ tag: 'revogr-order-editor' })\nexport class OrderEditor {\n // #region Properties\n /** Parent element */\n @Prop() parent: HTMLElement;\n /** Dimension settings Y */\n @Prop() dimensionRow: Observable<DimensionSettingsState>;\n /** Dimension settings X */\n @Prop() dimensionCol: Observable<DimensionSettingsState>;\n\n /** Static stores, not expected to change during component lifetime */\n @Prop() dataStore: Observable<DSourceState<DataType, DimensionRows>>;\n // #endregion\n\n // #region Events\n /** Row drag started */\n @Event({ eventName: 'rowdragstartinit', cancelable: true })\n rowDragStart: EventEmitter<{\n cell: Cell;\n text: string;\n pos: PositionItem;\n event: MouseEvent;\n }>;\n\n /** Row drag ended started */\n @Event({ eventName: 'rowdragendinit' })\n rowDragEnd: EventEmitter;\n\n /** Row move started */\n @Event({ eventName: 'rowdragmoveinit', cancelable: true }) rowDrag: EventEmitter<PositionItem>;\n\n /** Row mouse move started */\n @Event({ eventName: 'rowdragmousemove', cancelable: true })rowMouseMove: EventEmitter<Cell>;\n\n /** Row dragged, new range ready to be applied */\n @Event({ eventName: 'rowdropinit', cancelable: true }) rowDropped: EventEmitter<{\n from: number;\n to: number;\n }>;\n // #endregion\n\n // #region Private\n private rowOrderService: RowOrderService;\n private events: { name: keyof DocumentEventMap; listener: (e: MouseEvent) => void; }[] = [];\n private rowMoveFunc = debounce((y: number) => {\n const rgRow = this.rowOrderService.move(y, this.getData());\n if (rgRow !== null) {\n this.rowDrag.emit(rgRow);\n }\n }, 5);\n // #endregion\n\n // #region Methods\n @Method() async dragStart(e: DragStartEvent) {\n e.originalEvent.preventDefault();\n\n // extra check if previous ended\n if (this.events.length) {\n this.clearOrder();\n }\n\n const data = this.getData();\n const cell = this.rowOrderService.startOrder(e.originalEvent, data);\n const pos = this.rowOrderService.getRow(e.originalEvent.y, data);\n const dragStartEvent = this.rowDragStart.emit({\n cell,\n text: DRAGG_TEXT,\n pos,\n event: e.originalEvent,\n });\n if (dragStartEvent.defaultPrevented) {\n return;\n }\n\n const moveMove = (e: MouseEvent) => this.move(e);\n const mouseUp = (e: MouseEvent) => this.endOrder(e);\n const mouseLeave = () => this.clearOrder();\n\n this.events.push({\n name: 'mousemove',\n listener: moveMove,\n }, {\n name: 'mouseup',\n listener: mouseUp,\n }, {\n name: 'mouseleave',\n listener: mouseLeave,\n });\n document.addEventListener('mousemove', moveMove);\n // Action finished inside of the document\n document.addEventListener('mouseup', mouseUp);\n document.addEventListener('mouseleave', mouseLeave);\n }\n\n @Method() async endOrder(e: MouseEvent) {\n this.rowOrderService.endOrder(e, this.getData());\n this.clearOrder();\n }\n\n @Method() async clearOrder() {\n this.rowOrderService.clear();\n this.events.forEach(v => document.removeEventListener(v.name, v.listener));\n this.events.length = 0;\n this.rowDragEnd.emit();\n }\n // #endregion\n\n move({ x, y }: { x: number; y: number }) {\n this.rowMouseMove.emit({ x, y });\n this.rowMoveFunc(y);\n }\n\n connectedCallback() {\n this.rowOrderService = new RowOrderService({\n positionChanged: (f, t) => this.onPositionChanged(f, t),\n });\n }\n\n private onPositionChanged(from: number, to: number) {\n const dropEvent = this.rowDropped.emit({ from, to });\n if (dropEvent.defaultPrevented) {\n return;\n }\n const items = [...this.dataStore.get('items')];\n const toMove = items.splice(from, 1);\n items.splice(to, 0, ...toMove);\n setItems(this.dataStore, items);\n }\n\n private getData() {\n return {\n el: this.parent,\n rows: this.dimensionRow.state,\n cols: this.dimensionCol.state,\n };\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"revogr-order-editor2.js","mappings":";;;;;;;;;MASqB,eAAe;IAIlC,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAH1B,gBAAW,GAAgB,IAAI,CAAC;QAChC,gBAAW,GAAkB,IAAI,CAAC;KAEJ;;IAGtC,QAAQ,CAAC,CAAa,EAAE,IAAe;QACrC,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;YAC7B,OAAO;SACR;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;;QAGrC,IAAI,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE;;YAEnC,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE;gBAChB,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;aACd;;iBAEI,IAAI,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE;gBACtC,MAAM,CAAC,CAAC,EAAE,CAAC;aACZ;YACD,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;SAC3D;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;KACd;;IAGD,UAAU,CAAC,CAAa,EAAE,IAAe;QACvC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,WAAW,CAAC;KACzB;IAED,IAAI,CAAC,CAAS,EAAE,IAAe;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAA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AAG,IAAI,eAAe,CAAC;YACzC,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;SACxD,CAAC,CAAC;KACJ;IAEO,iBAAiB,CAAC,IAAY,EAAE,EAAU;QAChD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,SAAS,CAAC,gBAAgB,EAAE;YAC9B,OAAO;SACR;QACD,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACrC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;KACjC;IAEO,OAAO;QACb,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,MAAM;YACf,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC7B,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;SAC9B,CAAC;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["debounce"],"sources":["src/components/order/order-row.service.ts","src/components/order/revogr-order-editor.tsx"],"sourcesContent":["import { getItemByPosition } from '../../store/dimension/dimension.helpers';\nimport { DimensionSettingsState, PositionItem } from '../..';\nimport { Cell } from '../..';\n\ntype EventData = { el: HTMLElement; rows: DimensionSettingsState; cols: DimensionSettingsState };\ninterface Config {\n positionChanged(from: number, to: number): void;\n}\n\nexport default class RowOrderService {\n private currentCell: Cell | null = null;\n private previousRow: number | null = null;\n\n constructor(private config: Config) {}\n\n /** Drag finished, calculate and apply changes */\n endOrder(e: MouseEvent, data: EventData) {\n if (this.currentCell === null) {\n return;\n }\n const newRow = this.getCell(e, data);\n\n // if position changed\n if (newRow.y !== this.currentCell.y) {\n // rgRow dragged out table\n if (newRow.y < 0) {\n newRow.y = 0;\n }\n // rgRow dragged to the top\n else if (newRow.y < this.currentCell.y) {\n newRow.y++;\n }\n this.config.positionChanged(this.currentCell.y, newRow.y);\n }\n this.clear();\n }\n\n /** Drag started, reserve initial cell for farther use */\n startOrder(e: MouseEvent, data: EventData): Cell {\n this.currentCell = this.getCell(e, data);\n return this.currentCell;\n }\n\n move(y: number, data: EventData): PositionItem | null {\n const rgRow = this.getRow(y, data);\n // if rgRow same as previous or below range (-1 = 0) do nothing\n if (this.previousRow === rgRow.itemIndex || rgRow.itemIndex < -1) {\n return null;\n }\n this.previousRow = rgRow.itemIndex;\n return rgRow;\n }\n\n /** Drag stopped, probably cursor outside of document area */\n clear() {\n this.currentCell = null;\n this.previousRow = null;\n }\n\n /** Calculate cell based on x, y position */\n getRow(y: number, { el, rows }: EventData): PositionItem {\n const { top } = el.getBoundingClientRect();\n const topRelative = y - top;\n const rgRow = getItemByPosition(rows, topRelative);\n const absolutePosition = {\n itemIndex: rgRow.itemIndex,\n start: rgRow.start + top,\n end: rgRow.end + top,\n };\n return absolutePosition;\n }\n\n /** Calculate cell based on x, y position */\n getCell({ x, y }: Cell, { el, rows, cols }: EventData): Cell {\n const { top, left } = el.getBoundingClientRect();\n const topRelative = y - top;\n const leftRelative = x - left;\n const rgRow = getItemByPosition(rows, topRelative);\n const rgCol = getItemByPosition(cols, leftRelative);\n return { x: rgCol.itemIndex, y: rgRow.itemIndex };\n }\n}\n","import { Component, Method, Event, EventEmitter, Prop } from '@stencil/core';\nimport debounce from 'lodash/debounce';\n\nimport { DSourceState, setItems } from '../../store/dataSource/data.store';\nimport { DRAGG_TEXT } from '../../utils/consts';\nimport RowOrderService from './order-row.service';\nimport { DimensionRows } from '../../types/dimension';\nimport {\n DataType,\n DimensionSettingsState,\n DragStartEvent,\n Observable,\n PositionItem,\n} from '../../types/interfaces';\nimport { Cell } from '../../types/selection';\n\n/**\n * Component for handling row order editor.\n */\n@Component({ tag: 'revogr-order-editor' })\nexport class OrderEditor {\n // #region Properties\n /** Parent element */\n @Prop() parent: HTMLElement;\n /** Dimension settings Y */\n @Prop() dimensionRow: Observable<DimensionSettingsState>;\n /** Dimension settings X */\n @Prop() dimensionCol: Observable<DimensionSettingsState>;\n\n /** Static stores, not expected to change during component lifetime */\n @Prop() dataStore: Observable<DSourceState<DataType, DimensionRows>>;\n // #endregion\n\n // #region Events\n /** Row drag started */\n @Event({ eventName: 'rowdragstartinit', cancelable: true })\n rowDragStart: EventEmitter<{\n cell: Cell;\n text: string;\n pos: PositionItem;\n event: MouseEvent;\n }>;\n\n /** Row drag ended started */\n @Event({ eventName: 'rowdragendinit' })\n rowDragEnd: EventEmitter;\n\n /** Row move started */\n @Event({ eventName: 'rowdragmoveinit', cancelable: true })\n rowDrag: EventEmitter<PositionItem>;\n\n /** Row mouse move started */\n @Event({ eventName: 'rowdragmousemove', cancelable: true })\n rowMouseMove: EventEmitter<Cell>;\n\n /** Row dragged, new range ready to be applied */\n @Event({ eventName: 'rowdropinit', cancelable: true })\n rowDropped: EventEmitter<{\n from: number;\n to: number;\n }>;\n // #endregion\n\n // #region Private\n private rowOrderService: RowOrderService;\n private events: {\n name: keyof DocumentEventMap;\n listener: (e: MouseEvent) => void;\n }[] = [];\n private rowMoveFunc = debounce((y: number) => {\n const rgRow = this.rowOrderService.move(y, this.getData());\n if (rgRow !== null) {\n this.rowDrag.emit(rgRow);\n }\n }, 5);\n // #endregion\n\n // #region Methods\n @Method() async dragStart(e: DragStartEvent) {\n e.originalEvent.preventDefault();\n\n // extra check if previous ended\n if (this.events.length) {\n this.clearOrder();\n }\n\n const data = this.getData();\n const cell = this.rowOrderService.startOrder(e.originalEvent, data);\n const pos = this.rowOrderService.getRow(e.originalEvent.y, data);\n const dragStartEvent = this.rowDragStart.emit({\n cell,\n text: DRAGG_TEXT,\n pos,\n event: e.originalEvent,\n });\n if (dragStartEvent.defaultPrevented) {\n return;\n }\n\n const moveMove = (e: MouseEvent) => this.move(e);\n const mouseUp = (e: MouseEvent) => this.endOrder(e);\n const mouseLeave = () => this.clearOrder();\n\n this.events.push(\n {\n name: 'mousemove',\n listener: moveMove,\n },\n {\n name: 'mouseup',\n listener: mouseUp,\n },\n {\n name: 'mouseleave',\n listener: mouseLeave,\n },\n );\n document.addEventListener('mousemove', moveMove);\n // Action finished inside of the document\n document.addEventListener('mouseup', mouseUp);\n document.addEventListener('mouseleave', mouseLeave);\n }\n\n @Method() async endOrder(e: MouseEvent) {\n this.rowOrderService.endOrder(e, this.getData());\n this.clearOrder();\n }\n\n @Method() async clearOrder() {\n this.rowOrderService.clear();\n this.events.forEach(v => document.removeEventListener(v.name, v.listener));\n this.events.length = 0;\n this.rowDragEnd.emit();\n }\n // #endregion\n\n move({ x, y }: { x: number; y: number }) {\n this.rowMouseMove.emit({ x, y });\n this.rowMoveFunc(y);\n }\n\n connectedCallback() {\n this.rowOrderService = new RowOrderService({\n positionChanged: (f, t) => this.onPositionChanged(f, t),\n });\n }\n\n private onPositionChanged(from: number, to: number) {\n const dropEvent = this.rowDropped.emit({ from, to });\n if (dropEvent.defaultPrevented) {\n return;\n }\n const items = [...this.dataStore.get('items')];\n const toMove = items.splice(from, 1);\n items.splice(to, 0, ...toMove);\n setItems(this.dataStore, items);\n }\n\n private getData() {\n return {\n el: this.parent,\n rows: this.dimensionRow.state,\n cols: this.dimensionCol.state,\n };\n }\n}\n"],"version":3}
|
|
@@ -5,74 +5,13 @@ import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/
|
|
|
5
5
|
import { g as getRange, C as ColumnService, a as isRangeSingleCell } from './column.service.js';
|
|
6
6
|
import { c as codesLetter, i as isClear, a as isEnterKey, b as isCopy, e as isCut, f as isPaste, g as isAll, h as isLetterKey, j as isEditInput, d as defineCustomElement$2 } from './revogr-edit2.js';
|
|
7
7
|
import { R as RESIZE_INTERVAL, k as CELL_HANDLER_CLASS, l as MOBILE_CLASS, S as SELECTION_BORDER_CLASS } from './consts.js';
|
|
8
|
-
import {
|
|
8
|
+
import { b as getCoordinate, i as isAfterLast, c as isBeforeFirst, d as getCell, g as getPropertyFromEvent, e as getCurrentCell, a as getElStyle, f as getFocusCellBasedOnEvent, v as verifyTouchTarget } from './selection.utils.js';
|
|
9
9
|
import { t as timeout } from './index2.js';
|
|
10
10
|
import { d as debounce_1 } from './debounce.js';
|
|
11
11
|
import { b as getSourceItem } from './data.store.js';
|
|
12
12
|
import { d as defineCustomElement$3 } from './revogr-clipboard2.js';
|
|
13
13
|
import { d as defineCustomElement$1 } from './revogr-order-editor2.js';
|
|
14
14
|
|
|
15
|
-
class SelectionStoreService {
|
|
16
|
-
constructor(store, config) {
|
|
17
|
-
this.store = store;
|
|
18
|
-
this.config = config;
|
|
19
|
-
this.store = store;
|
|
20
|
-
}
|
|
21
|
-
get edited() {
|
|
22
|
-
return this.store.get('edit');
|
|
23
|
-
}
|
|
24
|
-
get focused() {
|
|
25
|
-
return this.store.get('focus');
|
|
26
|
-
}
|
|
27
|
-
get ranged() {
|
|
28
|
-
return this.store.get('range');
|
|
29
|
-
}
|
|
30
|
-
changeRange(range) {
|
|
31
|
-
return this.config.changeRange(range);
|
|
32
|
-
}
|
|
33
|
-
focus(cell, isMulti = false) {
|
|
34
|
-
if (!cell) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
let end = cell;
|
|
38
|
-
// range edit
|
|
39
|
-
if (isMulti) {
|
|
40
|
-
let start = this.store.get('focus');
|
|
41
|
-
if (start) {
|
|
42
|
-
return this.config.changeRange(getRange(start, end));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// single focus
|
|
46
|
-
return this.config.focus(cell, end);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function isTouch(e) {
|
|
51
|
-
return !!e.touches;
|
|
52
|
-
}
|
|
53
|
-
function verifyTouchTarget(touchEvent, focusClass) {
|
|
54
|
-
if (focusClass && touchEvent) {
|
|
55
|
-
if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
function getFromEvent(e, prop, focusClass // for touch events
|
|
62
|
-
) {
|
|
63
|
-
if (isTouch(e)) {
|
|
64
|
-
if (e.touches.length > 0) {
|
|
65
|
-
const touchEvent = e.touches[0];
|
|
66
|
-
if (!verifyTouchTarget(touchEvent, focusClass)) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
return touchEvent[prop] || 0;
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
return e[prop] || 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
15
|
const DIRECTION_CODES = [
|
|
77
16
|
codesLetter.TAB,
|
|
78
17
|
codesLetter.ARROW_UP,
|
|
@@ -84,9 +23,9 @@ class KeyboardService {
|
|
|
84
23
|
constructor(sv) {
|
|
85
24
|
this.sv = sv;
|
|
86
25
|
}
|
|
87
|
-
async keyDown(e, canRange) {
|
|
26
|
+
async keyDown(e, canRange, isEditMode, { range, focus }) {
|
|
88
27
|
// IF EDIT MODE
|
|
89
|
-
if (
|
|
28
|
+
if (isEditMode) {
|
|
90
29
|
switch (e.code) {
|
|
91
30
|
case codesLetter.ESCAPE:
|
|
92
31
|
this.sv.cancel();
|
|
@@ -96,12 +35,12 @@ class KeyboardService {
|
|
|
96
35
|
}
|
|
97
36
|
// IF NOT EDIT MODE
|
|
98
37
|
// pressed clear key
|
|
99
|
-
if (
|
|
38
|
+
if (range && isClear(e.code)) {
|
|
100
39
|
this.sv.clearCell();
|
|
101
40
|
return;
|
|
102
41
|
}
|
|
103
42
|
// below works with focus only
|
|
104
|
-
if (!
|
|
43
|
+
if (!focus) {
|
|
105
44
|
return;
|
|
106
45
|
}
|
|
107
46
|
// tab key means same as arrow right
|
|
@@ -177,7 +116,7 @@ class KeyboardService {
|
|
|
177
116
|
}
|
|
178
117
|
if (isMulti) {
|
|
179
118
|
const eData = this.sv.getData();
|
|
180
|
-
if (isAfterLast(data.end, eData) || isBeforeFirst(data.start)) {
|
|
119
|
+
if (isAfterLast(data.end, eData.lastCell) || isBeforeFirst(data.start)) {
|
|
181
120
|
return false;
|
|
182
121
|
}
|
|
183
122
|
const range = getRange(data.start, data.end);
|
|
@@ -229,7 +168,10 @@ class AutoFillService {
|
|
|
229
168
|
return (h("div", { class: {
|
|
230
169
|
[CELL_HANDLER_CLASS]: true,
|
|
231
170
|
[MOBILE_CLASS]: true,
|
|
232
|
-
}, style: {
|
|
171
|
+
}, style: {
|
|
172
|
+
left: `${handlerStyle.right}px`,
|
|
173
|
+
top: `${handlerStyle.bottom}px`,
|
|
174
|
+
}, onMouseDown: (e) => this.autoFillHandler(e), onTouchStart: (e) => this.autoFillHandler(e) }));
|
|
233
175
|
}
|
|
234
176
|
autoFillHandler(e, type = "AutoFill" /* AutoFillType.autoFill */) {
|
|
235
177
|
let target = null;
|
|
@@ -245,7 +187,9 @@ class AutoFillService {
|
|
|
245
187
|
get isAutoFill() {
|
|
246
188
|
return !!this.autoFillType;
|
|
247
189
|
}
|
|
248
|
-
/**
|
|
190
|
+
/**
|
|
191
|
+
* Process mouse move events
|
|
192
|
+
*/
|
|
249
193
|
selectionMouseMove(e) {
|
|
250
194
|
// initiate mouse move debounce if not present
|
|
251
195
|
if (!this.onMouseMoveAutofill) {
|
|
@@ -255,9 +199,7 @@ class AutoFillService {
|
|
|
255
199
|
this.onMouseMoveAutofill(e, this.sv.getData());
|
|
256
200
|
}
|
|
257
201
|
}
|
|
258
|
-
getFocus() {
|
|
259
|
-
let focus = this.sv.selectionStoreService.focused;
|
|
260
|
-
const range = this.sv.selectionStoreService.ranged;
|
|
202
|
+
getFocus(focus, range) {
|
|
261
203
|
// there was an issue that it was taking last cell from range but focus was out
|
|
262
204
|
if (!focus && range) {
|
|
263
205
|
focus = { x: range.x, y: range.y };
|
|
@@ -273,8 +215,8 @@ class AutoFillService {
|
|
|
273
215
|
if (!this.autoFillInitial) {
|
|
274
216
|
return;
|
|
275
217
|
}
|
|
276
|
-
const x =
|
|
277
|
-
const y =
|
|
218
|
+
const x = getPropertyFromEvent(event, 'clientX', MOBILE_CLASS);
|
|
219
|
+
const y = getPropertyFromEvent(event, 'clientY', MOBILE_CLASS);
|
|
278
220
|
// skip touch
|
|
279
221
|
if (x === null || y === null) {
|
|
280
222
|
return;
|
|
@@ -287,11 +229,12 @@ class AutoFillService {
|
|
|
287
229
|
}
|
|
288
230
|
}
|
|
289
231
|
// check if not the latest, if latest - do nothing
|
|
290
|
-
if (isAfterLast(current, data)) {
|
|
232
|
+
if (isAfterLast(current, data.lastCell)) {
|
|
291
233
|
return;
|
|
292
234
|
}
|
|
293
235
|
this.autoFillLast = current;
|
|
294
|
-
const isSame = current.x === this.autoFillInitial.x &&
|
|
236
|
+
const isSame = current.x === this.autoFillInitial.x &&
|
|
237
|
+
current.y === this.autoFillInitial.y;
|
|
295
238
|
// if same as initial - clear
|
|
296
239
|
if (isSame) {
|
|
297
240
|
this.sv.setTempRange(null);
|
|
@@ -312,39 +255,48 @@ class AutoFillService {
|
|
|
312
255
|
selectionStart(target, data, type = "Selection" /* AutoFillType.selection */) {
|
|
313
256
|
/** Get cell by autofill element */
|
|
314
257
|
const { top, left } = target.getBoundingClientRect();
|
|
315
|
-
this.autoFillInitial = this.getFocus();
|
|
258
|
+
this.autoFillInitial = this.getFocus(data.focus, data.range);
|
|
316
259
|
this.autoFillType = type;
|
|
317
260
|
this.autoFillStart = getCurrentCell({ x: left, y: top }, data);
|
|
318
261
|
}
|
|
319
262
|
/**
|
|
320
|
-
* Clear current range selection
|
|
321
|
-
* on mouse up and mouse leave events
|
|
263
|
+
* Clear current range selection on mouse up and mouse leave events
|
|
322
264
|
*/
|
|
323
|
-
clearAutoFillSelection() {
|
|
324
|
-
//
|
|
265
|
+
clearAutoFillSelection(focus, oldRange) {
|
|
266
|
+
// If autofill was active, apply autofill values
|
|
325
267
|
if (this.autoFillInitial) {
|
|
326
|
-
//
|
|
327
|
-
this.autoFillInitial = this.getFocus();
|
|
328
|
-
// Apply range data if
|
|
268
|
+
// Fetch latest focus
|
|
269
|
+
this.autoFillInitial = this.getFocus(focus, oldRange);
|
|
270
|
+
// Apply range data if autofill mode is active
|
|
329
271
|
if (this.autoFillType === "AutoFill" /* AutoFillType.autoFill */) {
|
|
330
272
|
const range = getRange(this.autoFillInitial, this.autoFillLast);
|
|
273
|
+
// If range is present, apply data
|
|
331
274
|
if (range) {
|
|
332
|
-
const { defaultPrevented: stopApply, detail: { range: newRange } } = this.sv.clearRangeDataApply({
|
|
275
|
+
const { defaultPrevented: stopApply, detail: { range: newRange }, } = this.sv.clearRangeDataApply({
|
|
333
276
|
range,
|
|
334
277
|
});
|
|
278
|
+
// If data apply was not prevented, apply new range
|
|
335
279
|
if (!stopApply) {
|
|
336
|
-
this.applyRangeWithData(newRange);
|
|
280
|
+
this.applyRangeWithData(newRange, oldRange);
|
|
337
281
|
}
|
|
338
282
|
else {
|
|
339
|
-
//
|
|
283
|
+
// If data apply was prevented, clear temporary range
|
|
340
284
|
this.sv.setTempRange(null);
|
|
341
285
|
}
|
|
342
286
|
}
|
|
343
287
|
}
|
|
344
288
|
else {
|
|
289
|
+
// If not autofill mode, apply range only
|
|
345
290
|
this.applyRangeOnly(this.autoFillInitial, this.autoFillLast);
|
|
346
291
|
}
|
|
347
292
|
}
|
|
293
|
+
// Reset autofill state
|
|
294
|
+
this.resetAutoFillState();
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Reset autofill state
|
|
298
|
+
*/
|
|
299
|
+
resetAutoFillState() {
|
|
348
300
|
this.autoFillType = null;
|
|
349
301
|
this.autoFillInitial = null;
|
|
350
302
|
this.autoFillLast = null;
|
|
@@ -364,8 +316,7 @@ class AutoFillService {
|
|
|
364
316
|
this.sv.setRange(range);
|
|
365
317
|
}
|
|
366
318
|
/** Apply range and copy data during range application */
|
|
367
|
-
applyRangeWithData(newRange) {
|
|
368
|
-
const oldRange = this.sv.selectionStoreService.ranged;
|
|
319
|
+
applyRangeWithData(newRange, oldRange) {
|
|
369
320
|
const rangeData = {
|
|
370
321
|
type: this.sv.dataStore.get('type'),
|
|
371
322
|
colType: this.sv.columnService.type,
|
|
@@ -455,44 +406,60 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
455
406
|
// #endregion
|
|
456
407
|
// #region Listeners
|
|
457
408
|
onMouseMove(e) {
|
|
458
|
-
if (this.
|
|
409
|
+
if (this.selectionStore.get('focus')) {
|
|
459
410
|
this.autoFillService.selectionMouseMove(e);
|
|
460
411
|
}
|
|
461
412
|
}
|
|
462
|
-
/**
|
|
463
|
-
|
|
413
|
+
/**
|
|
414
|
+
* Action finished inside of the document.
|
|
415
|
+
* Pointer left document, clear any active operation.
|
|
416
|
+
*/
|
|
464
417
|
onMouseUp() {
|
|
465
|
-
|
|
418
|
+
// Clear auto fill selection
|
|
419
|
+
// when pointer left document,
|
|
420
|
+
// clear any active operation.
|
|
421
|
+
this.autoFillService.clearAutoFillSelection(this.selectionStore.get('focus'), this.selectionStore.get('range'));
|
|
466
422
|
}
|
|
467
|
-
/**
|
|
423
|
+
/**
|
|
424
|
+
* Row drag started.
|
|
425
|
+
* This event is fired when drag action started on cell.
|
|
426
|
+
*/
|
|
468
427
|
onCellDrag(e) {
|
|
469
428
|
var _a;
|
|
429
|
+
// Invoke drag start on order editor.
|
|
470
430
|
(_a = this.orderEditor) === null || _a === void 0 ? void 0 : _a.dragStart(e.detail);
|
|
471
431
|
}
|
|
472
|
-
/**
|
|
432
|
+
/**
|
|
433
|
+
* Get keyboard down from element.
|
|
434
|
+
* This event is fired when keyboard key is released.
|
|
435
|
+
*/
|
|
473
436
|
onKeyUp(e) {
|
|
437
|
+
// Emit before key up event.
|
|
474
438
|
this.beforeKeyUp.emit(e);
|
|
475
439
|
}
|
|
476
|
-
/**
|
|
440
|
+
/**
|
|
441
|
+
* Get keyboard down from element.
|
|
442
|
+
* This event is fired when keyboard key is pressed.
|
|
443
|
+
*/
|
|
477
444
|
onKeyDown(e) {
|
|
478
445
|
var _a;
|
|
446
|
+
// Emit before key down event and check if default prevention is set.
|
|
479
447
|
const proxy = this.beforeKeyDown.emit(e);
|
|
480
448
|
if (e.defaultPrevented || proxy.defaultPrevented) {
|
|
481
449
|
return;
|
|
482
450
|
}
|
|
483
|
-
|
|
451
|
+
// Invoke key down on keyboard service.
|
|
452
|
+
(_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyDown(e, this.range, !!this.selectionStore.get('edit'), {
|
|
453
|
+
focus: this.selectionStore.get('focus'),
|
|
454
|
+
range: this.selectionStore.get('range'),
|
|
455
|
+
});
|
|
484
456
|
}
|
|
485
457
|
// #endregion
|
|
486
458
|
/** Selection & Keyboard */
|
|
487
459
|
selectionServiceSet(s) {
|
|
488
|
-
this.selectionStoreService = new SelectionStoreService(s, {
|
|
489
|
-
changeRange: range => this.triggerRangeEvent(range),
|
|
490
|
-
focus: (focus, end) => this.doFocus(focus, end),
|
|
491
|
-
});
|
|
492
460
|
this.keyboardService = new KeyboardService({
|
|
493
|
-
selectionStoreService: this.selectionStoreService,
|
|
494
461
|
selectionStore: s,
|
|
495
|
-
range: r => this.
|
|
462
|
+
range: r => this.triggerRangeEvent(r),
|
|
496
463
|
focusNext: (f, next) => this.doFocus(f, f, next),
|
|
497
464
|
change: val => {
|
|
498
465
|
if (this.readonly) {
|
|
@@ -514,7 +481,6 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
514
481
|
/** Autofill */
|
|
515
482
|
createAutoFillService() {
|
|
516
483
|
this.autoFillService = new AutoFillService({
|
|
517
|
-
selectionStoreService: this.selectionStoreService,
|
|
518
484
|
dimensionRow: this.dimensionRow,
|
|
519
485
|
dimensionCol: this.dimensionCol,
|
|
520
486
|
columnService: this.columnService,
|
|
@@ -590,10 +556,10 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
590
556
|
nodes.push(editCell);
|
|
591
557
|
}
|
|
592
558
|
else {
|
|
593
|
-
const range = this.
|
|
594
|
-
const
|
|
559
|
+
const range = this.selectionStore.get('range');
|
|
560
|
+
const focus = this.selectionStore.get('focus');
|
|
595
561
|
// Clipboard
|
|
596
|
-
if ((range ||
|
|
562
|
+
if ((range || focus) && this.useClipboard) {
|
|
597
563
|
nodes.push(h("revogr-clipboard", { readonly: this.readonly, onCopyregion: e => this.onCopy(e.detail), onClearregion: () => !this.readonly && this.clearCell(), ref: e => (this.clipboard = e), onPasteregion: e => this.onPaste(e.detail) }));
|
|
598
564
|
}
|
|
599
565
|
// Range
|
|
@@ -601,23 +567,19 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
601
567
|
nodes.push(...this.renderRange(range));
|
|
602
568
|
}
|
|
603
569
|
// Autofill
|
|
604
|
-
if (
|
|
605
|
-
nodes.push(this.autoFillService.renderAutofill(range,
|
|
570
|
+
if (focus && !this.readonly && this.range) {
|
|
571
|
+
nodes.push(this.autoFillService.renderAutofill(range, focus));
|
|
606
572
|
}
|
|
607
573
|
// Order
|
|
608
574
|
if (this.canDrag) {
|
|
609
575
|
nodes.push(h("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, onRowdragstartinit: e => this.rowDragStart(e) }));
|
|
610
576
|
}
|
|
611
577
|
}
|
|
612
|
-
return (h(Host, { key: '
|
|
613
|
-
// Open Editor on DblClick
|
|
614
|
-
onDblClick: (e) => {
|
|
615
|
-
// DblClick prevented outside - Editor will not open
|
|
616
|
-
if (!e.defaultPrevented) {
|
|
617
|
-
this.doEdit();
|
|
618
|
-
}
|
|
619
|
-
}, onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, nodes, h("slot", { key: '89b9bec7824739ea11fadeecbf3908ac74e85c96', name: "data" })));
|
|
578
|
+
return (h(Host, { key: '9dbb6247aebf4ad00c1c8c78852191671be33a11', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, nodes, h("slot", { key: '7769092a5029c5a49da8c2d6f36eb9f17b461bc2', name: "data" })));
|
|
620
579
|
}
|
|
580
|
+
/**
|
|
581
|
+
* Executes the focus operation on the specified range of cells.
|
|
582
|
+
*/
|
|
621
583
|
doFocus(focus, end, next) {
|
|
622
584
|
const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
|
|
623
585
|
if (defaultPrevented) {
|
|
@@ -651,31 +613,48 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
651
613
|
}
|
|
652
614
|
return !e.defaultPrevented;
|
|
653
615
|
}
|
|
616
|
+
/**
|
|
617
|
+
* Open Editor on DblClick
|
|
618
|
+
*/
|
|
619
|
+
onElementDblClick(e) {
|
|
620
|
+
// DblClick prevented outside - Editor will not open
|
|
621
|
+
// Get data from the component
|
|
622
|
+
const data = this.getData();
|
|
623
|
+
const focusCell = getFocusCellBasedOnEvent(e, data);
|
|
624
|
+
if (!focusCell) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
this.doEdit();
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Handle mouse down event on Host element
|
|
631
|
+
*/
|
|
654
632
|
onElementMouseDown(e, touch = false) {
|
|
633
|
+
// Get the target element from the event object
|
|
634
|
+
const targetElement = e.target;
|
|
655
635
|
// Ignore focus if clicked input
|
|
656
|
-
if (isEditInput(
|
|
636
|
+
if (isEditInput(targetElement)) {
|
|
657
637
|
return;
|
|
658
638
|
}
|
|
639
|
+
// Get data from the component
|
|
659
640
|
const data = this.getData();
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
}
|
|
663
|
-
const x = getFromEvent(e, 'clientX');
|
|
664
|
-
const y = getFromEvent(e, 'clientY');
|
|
665
|
-
// skip touch
|
|
666
|
-
if (x === null || y === null) {
|
|
641
|
+
const focusCell = getFocusCellBasedOnEvent(e, data);
|
|
642
|
+
if (!focusCell) {
|
|
667
643
|
return;
|
|
668
644
|
}
|
|
669
|
-
//
|
|
670
|
-
|
|
671
|
-
this.selectionStoreService.focus(focusCell, this.range && e.shiftKey);
|
|
645
|
+
// Set focus on the current cell
|
|
646
|
+
this.focus(focusCell, this.range && e.shiftKey);
|
|
672
647
|
// Initiate autofill selection
|
|
673
648
|
if (this.range) {
|
|
674
|
-
this.autoFillService.selectionStart(
|
|
649
|
+
this.autoFillService.selectionStart(targetElement, this.getData());
|
|
650
|
+
// Prevent default behavior for mouse events,
|
|
651
|
+
// but only if target element is not a mobile input
|
|
675
652
|
if (!touch) {
|
|
676
653
|
e.preventDefault();
|
|
677
654
|
}
|
|
678
655
|
else if (verifyTouchTarget(e.touches[0], MOBILE_CLASS)) {
|
|
656
|
+
// Prevent default behavior for touch events
|
|
657
|
+
// if target element is a mobile input
|
|
679
658
|
e.preventDefault();
|
|
680
659
|
}
|
|
681
660
|
}
|
|
@@ -686,8 +665,8 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
686
665
|
doEdit(val = '') {
|
|
687
666
|
var _a;
|
|
688
667
|
if (this.canEdit()) {
|
|
689
|
-
const
|
|
690
|
-
const data = this.columnService.getSaveData(
|
|
668
|
+
const focus = this.selectionStore.get('focus');
|
|
669
|
+
const data = this.columnService.getSaveData(focus.y, focus.x);
|
|
691
670
|
(_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { val }));
|
|
692
671
|
}
|
|
693
672
|
}
|
|
@@ -710,8 +689,8 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
710
689
|
this.cellEditApply.emit(dataToSave);
|
|
711
690
|
}
|
|
712
691
|
getRegion() {
|
|
713
|
-
const focus = this.
|
|
714
|
-
let range = this.
|
|
692
|
+
const focus = this.selectionStore.get('focus');
|
|
693
|
+
let range = this.selectionStore.get('range');
|
|
715
694
|
if (!range) {
|
|
716
695
|
range = getRange(focus, focus);
|
|
717
696
|
}
|
|
@@ -737,8 +716,8 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
737
716
|
return true;
|
|
738
717
|
}
|
|
739
718
|
onPaste(data) {
|
|
740
|
-
const focus = this.
|
|
741
|
-
const isEditing = this.
|
|
719
|
+
const focus = this.selectionStore.get('focus');
|
|
720
|
+
const isEditing = this.selectionStore.get('edit') !== null;
|
|
742
721
|
if (!focus || isEditing) {
|
|
743
722
|
return;
|
|
744
723
|
}
|
|
@@ -758,13 +737,13 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
758
737
|
}
|
|
759
738
|
}
|
|
760
739
|
clearCell() {
|
|
761
|
-
if (this.
|
|
762
|
-
!isRangeSingleCell(this.
|
|
763
|
-
const data = this.columnService.getRangeStaticData(this.
|
|
764
|
-
this.autoFillService.onRangeApply(data, this.
|
|
740
|
+
if (this.selectionStore.get('range') &&
|
|
741
|
+
!isRangeSingleCell(this.selectionStore.get('range'))) {
|
|
742
|
+
const data = this.columnService.getRangeStaticData(this.selectionStore.get('range'), '');
|
|
743
|
+
this.autoFillService.onRangeApply(data, this.selectionStore.get('range'));
|
|
765
744
|
}
|
|
766
745
|
else if (this.canEdit()) {
|
|
767
|
-
const focused = this.
|
|
746
|
+
const focused = this.selectionStore.get('focus');
|
|
768
747
|
const cell = this.columnService.getSaveData(focused.y, focused.x);
|
|
769
748
|
this.cellEdit({
|
|
770
749
|
rgRow: focused.y,
|
|
@@ -786,8 +765,24 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
786
765
|
if (this.readonly) {
|
|
787
766
|
return false;
|
|
788
767
|
}
|
|
789
|
-
const
|
|
790
|
-
return
|
|
768
|
+
const focus = this.selectionStore.get('focus');
|
|
769
|
+
return focus && !((_a = this.columnService) === null || _a === void 0 ? void 0 : _a.isReadOnly(focus.y, focus.x));
|
|
770
|
+
}
|
|
771
|
+
get edited() {
|
|
772
|
+
return this.selectionStore.get('edit');
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Sets the focus on a cell and optionally edits a range.
|
|
776
|
+
*/
|
|
777
|
+
focus(cell, isRangeEdit = false) {
|
|
778
|
+
if (!cell)
|
|
779
|
+
return false;
|
|
780
|
+
const end = cell;
|
|
781
|
+
const start = this.selectionStore.get('focus');
|
|
782
|
+
if (isRangeEdit && start) {
|
|
783
|
+
return this.triggerRangeEvent(getRange(start, end));
|
|
784
|
+
}
|
|
785
|
+
return this.doFocus(cell, end);
|
|
791
786
|
}
|
|
792
787
|
get types() {
|
|
793
788
|
return {
|
|
@@ -804,6 +799,8 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
804
799
|
rows: this.dimensionRow.state,
|
|
805
800
|
cols: this.dimensionCol.state,
|
|
806
801
|
lastCell: this.lastCell,
|
|
802
|
+
focus: this.selectionStore.get('focus'),
|
|
803
|
+
range: this.selectionStore.get('range'),
|
|
807
804
|
};
|
|
808
805
|
}
|
|
809
806
|
get element() { return this; }
|
|
@@ -866,6 +863,6 @@ function defineCustomElement() {
|
|
|
866
863
|
} });
|
|
867
864
|
}
|
|
868
865
|
|
|
869
|
-
export { OverlaySelection as O, defineCustomElement as d
|
|
866
|
+
export { OverlaySelection as O, defineCustomElement as d };
|
|
870
867
|
|
|
871
868
|
//# sourceMappingURL=revogr-overlay-selection2.js.map
|