@omegagrid/grid 0.11.32 → 0.11.34
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/editors/baseEditor.d.ts.map +1 -1
- package/dist/editors/baseEditor.js +6 -3
- package/dist/editors/baseEditor.js.map +1 -1
- package/dist/editors/calendarEditor.d.ts +10 -1
- package/dist/editors/calendarEditor.d.ts.map +1 -1
- package/dist/editors/calendarEditor.js +113 -19
- package/dist/editors/calendarEditor.js.map +1 -1
- package/dist/editors/dateEditor.d.ts +3 -1
- package/dist/editors/dateEditor.d.ts.map +1 -1
- package/dist/editors/dateEditor.js +22 -3
- package/dist/editors/dateEditor.js.map +1 -1
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +2 -0
- package/dist/editors/index.js.map +1 -1
- package/dist/filters/dateFilter.d.ts +54 -0
- package/dist/filters/dateFilter.d.ts.map +1 -0
- package/dist/filters/dateFilter.js +179 -0
- package/dist/filters/dateFilter.js.map +1 -0
- package/dist/filters/filterFactory.js +3 -3
- package/dist/filters/filterFactory.js.map +1 -1
- package/dist/filters/index.d.ts +1 -2
- package/dist/filters/index.d.ts.map +1 -1
- package/dist/filters/index.js +1 -2
- package/dist/filters/index.js.map +1 -1
- package/dist/renderers/DateTimeRenderer.d.ts.map +1 -1
- package/dist/renderers/DateTimeRenderer.js +3 -1
- package/dist/renderers/DateTimeRenderer.js.map +1 -1
- package/dist/ui/filterLabel.d.ts.map +1 -1
- package/dist/ui/filterLabel.js +0 -27
- package/dist/ui/filterLabel.js.map +1 -1
- package/dist/ui/grid.d.ts +15 -0
- package/dist/ui/grid.d.ts.map +1 -1
- package/dist/ui/grid.editing.d.ts.map +1 -1
- package/dist/ui/grid.editing.js +5 -4
- package/dist/ui/grid.editing.js.map +1 -1
- package/dist/ui/grid.js +39 -4
- package/dist/ui/grid.js.map +1 -1
- package/package.json +7 -7
- package/dist/filters/rangeFilter.d.ts +0 -15
- package/dist/filters/rangeFilter.d.ts.map +0 -1
- package/dist/filters/rangeFilter.js +0 -130
- package/dist/filters/rangeFilter.js.map +0 -1
- package/dist/filters/rangeFilterPopup.d.ts +0 -30
- package/dist/filters/rangeFilterPopup.d.ts.map +0 -1
- package/dist/filters/rangeFilterPopup.js +0 -137
- package/dist/filters/rangeFilterPopup.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.editing.js","sourceRoot":"","sources":["../../src/ui/grid.editing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAU,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAgB,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAa,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAiB,YAAY,EAAE,SAAS,EAA2B,MAAM,sBAAsB,CAAC;AAE1K,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,SAAS,MAAM,cAAc,CAAC;AAiBrC,MAAM,OAAO,WAAW;IAQvB,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC;IACtC,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAA,CAAC,CAAC;IAC9C,IAAI,QAAQ,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAA,CAAC,CAAC;IAC5C,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAA,CAAC,CAAC;IACxC,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC;IACtC,IAAI,SAAS,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAA,CAAC,CAAC;IACxC,I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I;YAAE,OAAO;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7G,CAAC;CAED","sourcesContent":["import { csv, Matrix, utils } from \"@omegagrid/core\";\nimport { FormulaEditor, getEditorFactory } from \"../editors\";\nimport { BaseEditor } from \"../editors/baseEditor\";\nimport { DropdownList, getDropdownListSource, loadDropdownList } from \"../editors/dropdownList\";\nimport { CellModel, isFormula, hasQuotePrefix, stripQuotePrefix, CellRange, CellValueType, decodeColumn, decodeRow, CellSource, CellAddress } from \"@omegagrid/grid-core\";\nimport { Grid } from \"./grid\";\nimport { GridEditEvent, GridEvent } from \"./grid.events\";\nimport constants from \"../constants\";\n\nexport type DeleteOptions = {\n\tindex: number,\n\tcount: number,\n\tdispatchEvent?: boolean,\n\tfromHistory?: boolean\n};\n\nexport type InsertOptions = DeleteOptions & {\n\tafter?: boolean\n};\n\nexport type MovingOptions = DeleteOptions & {\n\ttargetIndex: number\n};\n\nexport class GridEditing {\n\n\tprivate editorMap = new Map<string, BaseEditor>();\n\tprivate editor: BaseEditor;\n\n\tcolumnMoving = false;\n\trowMoving = false;\n\n\tget model() { return this.grid.model }\n\tget selection() { return this.grid.selection }\n\tget selector() { return this.grid.selector }\n\tget events() { return this.grid.events }\n\tget table() { return this.grid.table }\n\tget isEditing() { return !!this.editor }\n\tget activeEditor() { return this.editor }\n\n\tprivate _formulaMode = false;\n\tget isFormulaMode() { return this._formulaMode || this.grid.group?.isFormulaMode }\n\n\tconstructor(readonly grid: Grid) { }\n\n\tcanEdit(cell: CellModel) {\n\t\treturn (cell.editable || this.grid.designMode) && cell.type !== 'a';\n\t}\n\n\tupdateCell(cell: CellModel, value: CellValueType | CellSource, dispatchEvent = true, fromHistory = false) {\n\t\tthis.updateCells([cell], [value], dispatchEvent, fromHistory);\n\t}\n\n\tupdateCells(cells: CellModel[], values: (CellValueType | CellSource)[], dispatchEvent = true, fromHistory = false) {\n\t\tlet oldValues: CellValueType[];\n\t\tlet oldPropsArr: CellValueType[];\n\t\tlet newValues: CellValueType[];\n\t\tlet newPropsArr: CellValueType[];\n\t\tlet editedCells: CellModel[];\n\t\tcells.forEach((cell, i) => {\n\t\t\tconst oldValue = cell.value;\n\t\t\tlet newValue: CellValueType;\n\t\t\tlet newProps: Partial<CellSource>;\n\n\t\t\tif (utils.isObject(values[i])) {\n\t\t\t\tnewProps = values[i] as CellSource;\n\t\t\t\tnewValue = ('v' in newProps) ? newProps.v : undefined;\n\t\t\t\tif (cell.quotePrefixable && hasQuotePrefix(newValue)) {\n\t\t\t\t\tnewProps = {...newProps, dv: stripQuotePrefix(newValue) as string};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewValue = values[i] as CellValueType;\n\t\t\t}\n\n\t\t\tlet oldProps: Partial<CellSource>;\n\t\t\tif (newProps) {\n\t\t\t\toldProps = cell.update(newProps);\n\t\t\t} else {\n\t\t\t\tcell.clearFormula();\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\toldProps = {v: oldValue, dv: cell.displayValue};\n\t\t\t\t\tcell.value = newValue;\n\t\t\t\t\tif (cell.quotePrefix) cell.displayValue = stripQuotePrefix(newValue) as string;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dispatchEvent && oldProps) {\n\t\t\t\toldValues = oldValues || [];\n\t\t\t\toldPropsArr = oldPropsArr || [];\n\t\t\t\tnewValues = newValues || [];\n\t\t\t\tnewPropsArr = newPropsArr || [];\n\t\t\t\teditedCells = editedCells || [];\n\t\t\t\toldValues.push(oldValue);\n\t\t\t\toldPropsArr.push(oldProps);\n\t\t\t\tnewValues.push(newValue);\n\t\t\t\tnewPropsArr.push(newProps);\n\t\t\t\teditedCells.push(cell);\n\t\t\t}\n\t\t});\n\n\t\tif (dispatchEvent && editedCells?.length) {\n\t\t\tthis.grid.dispatchEvent(new GridEditEvent({\n\t\t\t\tgrid: this.grid,\n\t\t\t\tfromHistory: !!fromHistory,\n\t\t\t\tcells: editedCells,\n\t\t\t\teditType: 'value',\n\t\t\t\tnewValues: newValues,\n\t\t\t\tnewProps: newPropsArr,\n\t\t\t\toldValues: oldValues,\n\t\t\t\toldProps: oldPropsArr\n\t\t\t}));\n\t\t}\n\t}\n\n\tstartFormulaMode() {\n\t\tthis._formulaMode = true;\n\t\tif (this.grid.group) this.grid.group.startFormulaMode(this.grid);\n\t}\n\n\tendFormulaMode(group = true) {\n\t\tthis._formulaMode = false;\n\t\tif (group && this.grid.group) this.grid.group.endFormulaMode();\n\t\tthis.grid.selecting.hideFormulaSelector();\n\t\tthis.grid.selecting.removeFormulaHighlight();\n\t\tthis.grid.selecting.showSelector();\n\t}\n\n\tstartEdit(initialValue: unknown = null) {\n\t\tconst cell = this.grid.selecting.activeCell;\n\t\tif (cell && this.canEdit(cell)) {\n\t\t\tthis.grid.logger.info(`start edit ${(new CellRange(cell.c, cell.r)).A1}`);\n\t\t\tlet formula = true;\n\t\t\tif (this.model.formulasEnabled && isFormula(initialValue as string)) {\n\t\t\t\tthis.editor = this.getFormulaEditor().open(this.grid, initialValue);\n\t\t\t} else {\n\t\t\t\tif (initialValue == null && cell.hasOwnFormula) {\n\t\t\t\t\tthis.editor = this.getFormulaEditor().open(this.grid, initialValue);\n\t\t\t\t} else {\n\t\t\t\t\tformula = false;\n\t\t\t\t\tthis.editor = this.getEditor(cell).open(this.grid, initialValue);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.grid.dispatchEvent(new GridEvent('startEdit', {grid: this.grid}));\n\t\t\tif (formula) {\n\t\t\t\tthis.startFormulaMode();\n\t\t\t\tthis.grid.dispatchEvent(new GridEvent('startFormulaEdit', {grid: this.grid}));\n\t\t\t}\n\t\t}\n\t}\n\n\tendEdit() {\n\t\tif (!this.editor) return;\n\t\tthis.grid.logger.info('end edit');\n\t\tthis.grid.editing.endFormulaMode();\n\t\tthis.editor?.close();\n\t\tthis.editor = null;\n\t\tthis.grid.dispatchEvent(new GridEvent('endEdit', {grid: this.grid}));\n\t}\n\n\tcommitEdit() {\n\t\tif (this.editor) {\n\t\t\tthis.editor.commit();\n\t\t\tthis.endEdit();\n\t\t}\n\t}\n\n\tinsertRows(options: InsertOptions) {\n\t\tconst newRows = this.model.insertRows(options.index, options.count, options.after);\n\t\tthis.grid.rendering.renderAll(true);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: !!options.fromHistory,\n\t\t\teditType: 'insert_row',\n\t\t\tnewValues: newRows\n\t\t}));\n\t\treturn newRows;\n\t}\n\n\tinsertColumns(options: InsertOptions) {\n\t\tconst newColumns = this.model.insertColumns(options.index , options.count, options.after);\n\t\tthis.grid.rendering.renderAll(true);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: !!options.fromHistory,\n\t\t\teditType: 'insert_column',\n\t\t\tnewValues: newColumns\n\t\t}));\n\t\treturn newColumns;\n\t}\n\n\tdeleteRows(options: DeleteOptions) {\n\t\tconst deletedRows = this.model.deleteRows(options.index, options.count);\n\t\tthis.grid.rendering.renderAll(true);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: !!options.fromHistory,\n\t\t\teditType: 'delete_row',\n\t\t\toldValues: deletedRows\n\t\t}));\n\t\treturn deletedRows;\n\t}\n\n\tdeleteColumns(options: DeleteOptions) {\n\t\tconst deletedColumns = this.model.deleteColumns(options.index, options.count);\n\t\tthis.grid.rendering.renderAll(true);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: !!options.fromHistory,\n\t\t\teditType: 'delete_column',\n\t\t\toldValues: deletedColumns\n\t\t}));\n\t\treturn deletedColumns\n\t}\n\n\tmoveRows(options: MovingOptions) {\n\t\tthis.model.moveRows(options.index, options.count, options.targetIndex);\n\t\tthis.grid.rendering.renderAll(false);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: options.fromHistory,\n\t\t\teditType: 'move_row',\n\t\t\toldValues: [new CellRange(0, options.index, Infinity, options.index + options.count - 1)],\n\t\t\tnewValues: [new CellRange(0, options.targetIndex, Infinity, options.targetIndex + options.count - 1)],\n\t\t}));\n\t}\n\n\tmoveColumns(options: MovingOptions) {\n\t\tthis.model.moveColumns(options.index, options.count, options.targetIndex);\n\t\tthis.grid.rendering.renderAll(false);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: options.fromHistory,\n\t\t\teditType: 'move_column',\n\t\t\toldValues: [new CellRange(options.index, options.index + options.count - 1, Infinity)],\n\t\t\tnewValues: [new CellRange(options.targetIndex, 0, options.targetIndex + options.count - 1, Infinity)],\n\t\t}));\n\t}\n\n\tclearSelection(dispatchEvent = true) {\n\t\tconst cells = this.model.getCellArray(this.selection.range).filter(cell => this.canEdit(cell));\n\t\tthis.updateCells(cells, cells.map(() => null as CellModel), dispatchEvent);\n\t\tthis.grid.rendering.updateCells(cells, true);\n\t}\n\n\tgetEditor(cell: CellModel) {\n\t\tlet factory = cell.editorFactory;\n\t\tlet key: string = null;\n\n\t\tif (factory) {\n\t\t\tkey = cell.address;\n\t\t} else {\n\t\t\tkey = cell.type;\n\t\t\tfactory = getEditorFactory(cell.type);\n\t\t}\n\n\t\tif (!this.editorMap.has(key)) {\n\t\t\tconst editor = factory(cell, this.model.options.editing) as BaseEditor;\n\t\t\tthis.grid.shadowRoot.appendChild(editor);\n\t\t\tthis.editorMap.set(key, editor);\n\t\t}\n\n\t\treturn this.editorMap.get(key);\n\t}\n\n\tgetFormulaEditor() {\n\t\tconst type = 'formula';\n\t\tif (!this.editorMap.has(type)) {\n\t\t\tconst editor = new FormulaEditor();\n\t\t\tthis.grid.shadowRoot.appendChild(editor);\n\t\t\tthis.editorMap.set(type, editor);\n\t\t}\n\t\treturn this.editorMap.get(type);\n\t}\n\n\t/** the cells of the selection for the clipboard: the rows the user sees only, see copySelection */\n\tgetSelectionCellData() {\n\t\treturn this.model.getCellMatrix(this.selection.range, true).map(\n\t\t\trow => row.map(cell => cell.getSourceData({displayValue: true}))\n\t\t);\n\t}\n\n\t/**\n\t * Copies the selection: the rows the table shows only, as the user does not see the rows a filter\n\t * or a collapsed row hides inside the range and does not expect them in the clipboard.\n\t */\n\tcopySelection() {\n\t\tconst customClipboardSupport = ClipboardItem.supports(constants.CUSTOM_CLIPBOARD_TYPE);\n\t\tconst values = this.model.getValuesInRange(this.selection.range, customClipboardSupport, true);\n\t\tthis.grid.selecting.hideSelector();\n\t\tthis.grid.selecting.showCopySelector();\n\n\t\tlet csvText = csv.arrayToCsv(values, {decimalSeparator: this.model.options.systemDecimalSeparator});\n\t\tif (values.length === 1 && values[0].length === 1) csvText = csvText.replace(/[\\r\\n]+$/, '');\n\n\t\tconst clipboardData: Record<string, string|Blob> = {'text/plain': new Blob([csvText], {\n\t\t\ttype: \"text/plain\"\n\t\t})};\n\n\t\tif (customClipboardSupport) {\n\t\t\tclipboardData[constants.CUSTOM_CLIPBOARD_TYPE] = new Blob([JSON.stringify(this.getSelectionCellData())], {\n\t\t\t\ttype: \"application/json\"\n\t\t\t});\n\t\t} else {\n\t\t\tthis.grid.logger.warn(\"Browser does not support custom clipboard type\");\n\t\t}\n\n\t\tnavigator.clipboard.write([new ClipboardItem(clipboardData)]).then(\n\t\t\t() => this.grid.logger.info(\"selected content copied\"),\n\t\t\t() => this.grid.logger.error(\"copy rejected\")\n\t\t);\n\t}\n\n\tprivate async pasteMatrix(data: Matrix<string | CellSource>) {\n\t\tconst range = this.selection.range;\n\t\tconst cells: CellModel[] = [];\n\t\tconst cellValues: CellValueType[] = [];\n\t\tconst rowPasteMode = this.model.options.clipboard?.rowPasteMode;\n\t\tconst columnPasteMode = this.model.options.clipboard?.columnPasteMode;\n\n\t\tconst pasteProps = (this.model.options.clipboard?.pasteProps ?? 'all') == 'all'\n\t\t\t? null : this.model.options.clipboard.pasteProps as (keyof CellSource)[];\n\n\t\tconst height = data.length;\n\t\tconst width = height > 0 ? data[0].length : 0;\n\n\t\t// insert rows if needed\n\t\tif (rowPasteMode == 'insert') {\n\t\t\tthis.insertRows({index: range.r1, count: height, after: false});\n\t\t} else if (rowPasteMode == 'rewrite_append' && range.r1 + height > this.model.rows.length - 1) {\n\t\t\tthis.insertRows({\n\t\t\t\tindex: this.model.rows.length - 1,\n\t\t\t\tcount: range.r1 + height - this.model.rows.length,\n\t\t\t\tafter: true\n\t\t\t});\n\t\t}\n\n\t\t// insert columns if needed\n\t\tif (columnPasteMode == 'insert') {\n\t\t\tthis.insertColumns({index: range.c1, count: width, after: false});\n\t\t} else if (columnPasteMode == 'rewrite_append' && range.c1 + width > this.model.columns.length - 1) {\n\t\t\tthis.insertColumns({\n\t\t\t\tindex: this.model.columns.length - 1,\n\t\t\t\tcount: range.c1 + width - this.model.columns.length,\n\t\t\t\tafter: true\n\t\t\t});\n\t\t}\n\n\t\t// duplicate clipboard matrix over selection range if it fits\n\t\tconst dataFitsSelection = height > 0 && width > 0 &&\n\t\t\trange.size.rows % height == 0 && range.size.columns % width == 0;\n\n\t\tlet rMax = Math.min(\n\t\t\tdataFitsSelection ? range.r2 : range.r1 + height - 1,\n\t\t\tthis.model.rows.length - 1\n\t\t);\n\n\t\tconst cMax = Math.min(\n\t\t\tdataFitsSelection ? range.c2 : range.c1 + width - 1,\n\t\t\tthis.model.columns.length - 1\n\t\t);\n\n\t\tfor (let r = range.r1; r <= rMax; r++) {\n\t\t\tconst i = (r - range.r1) % height;\n\t\t\tconst row = this.model.rows[r];\n\t\t\tif (!row) break;\n\n\t\t\tif (this.model.options.clipboard?.skipHiddenRows) {\n\t\t\t\tif (!row.visible) {\n\t\t\t\t\t// resize target range to accommodate skipped row, but only if clipboard data is larger than selection\n\t\t\t\t\tif (height > range.size.rows) rMax++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (let c = range.c1; c <= cMax; c++) {\n\t\t\t\tconst cell = row.cell(c);\n\t\t\t\tif (!cell.editable) continue;\n\n\t\t\t\tconst j = (c - range.c1) % data[i].length;\n\n\t\t\t\tif (pasteProps && utils.isObject(data[i][j])) {\n\t\t\t\t\t// filter unwanted properties\n\t\t\t\t\tconst updateProps: Partial<CellSource> = {};\n\t\t\t\t\tpasteProps.forEach(<T extends keyof Partial<CellSource>>(key: T) => {\n\t\t\t\t\t\tupdateProps[key] = (data[i][j] as CellSource)[key];\n\t\t\t\t\t});\n\n\t\t\t\t\t// copiing properties of cell with display value into cell without display value\n\t\t\t\t\tif (!cell.prefersDisplayValue) updateProps.dv = undefined;\n\n\t\t\t\t\tcellValues.push(updateProps);\n\t\t\t\t} else {\n\t\t\t\t\tcellValues.push(data[i][j]);\n\t\t\t\t}\n\n\t\t\t\tcells.push(cell);\n\t\t\t}\n\t\t}\n\n\t\tawait this.resolveDropdownValues(cells, cellValues);\n\t\tthis.updateCells(cells, cellValues, true);\n\t\tthis.grid.rendering.updateCells(cells, true);\n\t}\n\n\t/**\n\t * A value pasted into a dropdown cell becomes the item of its list it stands for, see DropdownList.resolve;\n\t * a list the cells share (an adapter of a column) is loaded once.\n\t */\n\tprivate async resolveDropdownValues(cells: CellModel[], values: CellValueType[]) {\n\t\tconst lists = new Map<unknown, Promise<DropdownList>>();\n\t\tawait Promise.all(cells.map(async (cell, i) => {\n\t\t\tconst source = getDropdownListSource(cell);\n\t\t\t// a pasted formula stays a formula, its result is not an item of the list\n\t\t\tconst formula = this.model.formulasEnabled\n\t\t\t\t&& (utils.isObject(values[i]) ? !!(values[i] as CellSource).f : isFormula(values[i] as string));\n\t\t\tif (!source || formula) return;\n\t\t\tif (!lists.has(source)) lists.set(source, loadDropdownList(source).catch((): DropdownList => {\n\t\t\t\tthis.grid.logger.warn('dropdown list failed to load, the pasted values stay unchecked');\n\t\t\t\treturn null;\n\t\t\t}));\n\t\t\tconst list = await lists.get(source);\n\t\t\tif (list) values[i] = list.resolve(values[i], cell.validation?.allowInvalid);\n\t\t}));\n\t}\n\n\tprivate async pasteText(text: string) {\n\t\tawait this.pasteMatrix(csv.csvToArray(text));\n\t}\n\n\tasync paste() {\n\t\tthis.grid.selecting.hideCopySelector();\n\n\t\ttry\t{\n\t\t\tconst clipboardItems = await navigator.clipboard.read();\n\t\t\tif (clipboardItems.length == 0) return;\n\t\t\tconst clipboardItem = clipboardItems[0];\n\t\t\tif (clipboardItem.types.includes(constants.CUSTOM_CLIPBOARD_TYPE)) {\n\t\t\t\tconst data = await clipboardItem.getType(constants.CUSTOM_CLIPBOARD_TYPE);\n\t\t\t\tawait this.pasteMatrix(JSON.parse(await data.text()));\n\t\t\t} else if (clipboardItem.types.includes('text/plain')) {\n\t\t\t\tconst data = await clipboardItem.getType('text/plain');\n\t\t\t\tawait this.pasteText(await data.text());\n\t\t\t}\n\t\t} catch (_e) {\n\t\t\tthis.grid.logger.error(\"paste rejected\");\n\t\t\treturn;\n\t\t}\n\t}\n\n\topenComments(cell: CellModel) {\n\t\tsetTimeout(() => {\n\t\t\tthis.grid.comment.attachTo(this.grid.table.getCellByCellModel(cell), cell, true);\n\t\t}, 100);\n\t}\n\n\tundo() {\n\t\tlet cells: CellModel[];\n\t\tconst [item] = this.grid.history.pop();\n\t\tif (!item) return;\n\t\tswitch (item.type) {\n\t\t\tcase 'value':\n\t\t\t\tcells = item.addresses.map(addr => this.model.getCellByA1(addr));\n\t\t\t\tthis.updateCells(cells, item.oldProps, true, true);\n\t\t\t\tthis.grid.rendering.updateCells(cells, true);\n\t\t\t\tbreak;\n\t\t\tcase 'insert_column':\n\t\t\t\titem.newValues.forEach((_, i) => this.grid.editing.deleteColumns({\n\t\t\t\t\tindex: decodeColumn(item.addresses[i]),\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tdispatchEvent: true,\n\t\t\t\t\tfromHistory: true\n\t\t\t\t}));\n\t\t\t\tbreak;\n\t\t\tcase 'insert_row':\n\t\t\t\titem.newValues.forEach((_, i) => this.grid.editing.deleteRows({\n\t\t\t\t\tindex: decodeRow(item.addresses[i]),\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tdispatchEvent: true,\n\t\t\t\t\tfromHistory: true\n\t\t\t\t}));\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tredo() {\n\t\tlet cells: CellModel[];\n\t\tconst [item] = this.grid.history.pop2();\n\t\tif (!item) return;\n\t\tswitch (item.type) {\n\t\t\tcase 'value':\n\t\t\t\tcells = item.addresses.map(addr => this.model.getCellByA1(addr))\n\t\t\t\tthis.updateCells(cells, item.newValues, true, true);\n\t\t\t\tthis.grid.rendering.updateCells(cells, true);\n\t\t\t\tbreak;\n\t\t\tcase 'insert_column':\n\t\t\t\titem.newValues.forEach((_, i) => this.grid.editing.insertColumns({\n\t\t\t\t\tindex: decodeColumn(item.addresses[i]),\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tdispatchEvent: true,\n\t\t\t\t\tfromHistory: true\n\t\t\t\t}));\n\t\t\t\tbreak;\n\t\t\tcase 'insert_row':\n\t\t\t\titem.newValues.forEach((_, i) => this.grid.editing.insertRows({\n\t\t\t\t\tindex: decodeRow(item.addresses[i]),\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tdispatchEvent: true,\n\t\t\t\t\tfromHistory: true\n\t\t\t\t}));\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tstartColumnMoving(_c: number) {\n\t\tthis.columnMoving = true;\n\t}\n\n\tmerge(range?: CellAddress) {\n\t\tconst r = range ? CellRange.fromA1(range) : this.selection.range;\n\t\tconst cell = this.model.rows[r.r1]?.cell(r.c1);\n\t\tif (!cell) return;\n\t\tthis.model.merges.add({r: r.r1, c: r.c1, rs: r.size.rows, cs: r.size.columns});\n\t\tthis.grid.rendering.renderCells({vertical: true, horizontal: true});\n\t\tthis.grid.selecting.select(r);\n\t}\n\n\tunmerge(range?: CellAddress) {\n\t\tconst r = range ? CellRange.fromA1(range) : this.selection.range;\n\t\tconst cell = this.model.rows[r.r1]?.cell(r.c1);\n\t\tif (!cell) return;\n\t\tconst merge = this.model.merges.mergedCells.get(cell.address);\n\t\tif (!merge) return;\n\t\tthis.model.merges.remove(cell.address);\n\t\tthis.grid.rendering.renderCells({vertical: true, horizontal: true});\n\t\tthis.grid.selecting.select(new CellRange(merge.c, merge.r, merge.c + merge.cs - 1, merge.r + merge.rs - 1));\n\t}\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"grid.editing.js","sourceRoot":"","sources":["../../src/ui/grid.editing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAU,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAgB,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChG,O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AE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7G,CAAC;CAED","sourcesContent":["import { csv, Matrix, utils } from \"@omegagrid/core\";\nimport { FormulaEditor, getEditorFactory } from \"../editors\";\nimport { BaseEditor } from \"../editors/baseEditor\";\nimport { DropdownList, getDropdownListSource, loadDropdownList } from \"../editors/dropdownList\";\nimport { CellModel, isFormula, hasQuotePrefix, stripQuotePrefix, CellRange, CellValueType, decodeColumn, decodeRow, CellSource, CellAddress, isCellSource } from \"@omegagrid/grid-core\";\nimport { Grid } from \"./grid\";\nimport { GridEditEvent, GridEvent } from \"./grid.events\";\nimport constants from \"../constants\";\n\nexport type DeleteOptions = {\n\tindex: number,\n\tcount: number,\n\tdispatchEvent?: boolean,\n\tfromHistory?: boolean\n};\n\nexport type InsertOptions = DeleteOptions & {\n\tafter?: boolean\n};\n\nexport type MovingOptions = DeleteOptions & {\n\ttargetIndex: number\n};\n\nexport class GridEditing {\n\n\tprivate editorMap = new Map<string, BaseEditor>();\n\tprivate editor: BaseEditor;\n\n\tcolumnMoving = false;\n\trowMoving = false;\n\n\tget model() { return this.grid.model }\n\tget selection() { return this.grid.selection }\n\tget selector() { return this.grid.selector }\n\tget events() { return this.grid.events }\n\tget table() { return this.grid.table }\n\tget isEditing() { return !!this.editor }\n\tget activeEditor() { return this.editor }\n\n\tprivate _formulaMode = false;\n\tget isFormulaMode() { return this._formulaMode || this.grid.group?.isFormulaMode }\n\n\tconstructor(readonly grid: Grid) { }\n\n\tcanEdit(cell: CellModel) {\n\t\treturn (cell.editable || this.grid.designMode) && cell.type !== 'a';\n\t}\n\n\tupdateCell(cell: CellModel, value: CellValueType | CellSource, dispatchEvent = true, fromHistory = false) {\n\t\tthis.updateCells([cell], [value], dispatchEvent, fromHistory);\n\t}\n\n\tupdateCells(cells: CellModel[], values: (CellValueType | CellSource)[], dispatchEvent = true, fromHistory = false) {\n\t\tlet oldValues: CellValueType[];\n\t\tlet oldPropsArr: CellValueType[];\n\t\tlet newValues: CellValueType[];\n\t\tlet newPropsArr: CellValueType[];\n\t\tlet editedCells: CellModel[];\n\t\tcells.forEach((cell, i) => {\n\t\t\tconst oldValue = cell.value;\n\t\t\tlet newValue: CellValueType;\n\t\t\tlet newProps: Partial<CellSource>;\n\n\t\t\t// a Date (the value of a date and time cell put back by redo) is a value, not the properties of the cell\n\t\t\tif (isCellSource(values[i])) {\n\t\t\t\tnewProps = values[i] as CellSource;\n\t\t\t\tnewValue = ('v' in newProps) ? newProps.v : undefined;\n\t\t\t\tif (cell.quotePrefixable && hasQuotePrefix(newValue)) {\n\t\t\t\t\tnewProps = {...newProps, dv: stripQuotePrefix(newValue) as string};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewValue = values[i] as CellValueType;\n\t\t\t}\n\n\t\t\tlet oldProps: Partial<CellSource>;\n\t\t\tif (newProps) {\n\t\t\t\toldProps = cell.update(newProps);\n\t\t\t} else {\n\t\t\t\tcell.clearFormula();\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\toldProps = {v: oldValue, dv: cell.displayValue};\n\t\t\t\t\tcell.value = newValue;\n\t\t\t\t\tif (cell.quotePrefix) cell.displayValue = stripQuotePrefix(newValue) as string;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dispatchEvent && oldProps) {\n\t\t\t\toldValues = oldValues || [];\n\t\t\t\toldPropsArr = oldPropsArr || [];\n\t\t\t\tnewValues = newValues || [];\n\t\t\t\tnewPropsArr = newPropsArr || [];\n\t\t\t\teditedCells = editedCells || [];\n\t\t\t\toldValues.push(oldValue);\n\t\t\t\toldPropsArr.push(oldProps);\n\t\t\t\tnewValues.push(newValue);\n\t\t\t\tnewPropsArr.push(newProps);\n\t\t\t\teditedCells.push(cell);\n\t\t\t}\n\t\t});\n\n\t\tif (dispatchEvent && editedCells?.length) {\n\t\t\tthis.grid.dispatchEvent(new GridEditEvent({\n\t\t\t\tgrid: this.grid,\n\t\t\t\tfromHistory: !!fromHistory,\n\t\t\t\tcells: editedCells,\n\t\t\t\teditType: 'value',\n\t\t\t\tnewValues: newValues,\n\t\t\t\tnewProps: newPropsArr,\n\t\t\t\toldValues: oldValues,\n\t\t\t\toldProps: oldPropsArr\n\t\t\t}));\n\t\t}\n\t}\n\n\tstartFormulaMode() {\n\t\tthis._formulaMode = true;\n\t\tif (this.grid.group) this.grid.group.startFormulaMode(this.grid);\n\t}\n\n\tendFormulaMode(group = true) {\n\t\tthis._formulaMode = false;\n\t\tif (group && this.grid.group) this.grid.group.endFormulaMode();\n\t\tthis.grid.selecting.hideFormulaSelector();\n\t\tthis.grid.selecting.removeFormulaHighlight();\n\t\tthis.grid.selecting.showSelector();\n\t}\n\n\tstartEdit(initialValue: unknown = null) {\n\t\tconst cell = this.grid.selecting.activeCell;\n\t\tif (cell && this.canEdit(cell)) {\n\t\t\tthis.grid.logger.info(`start edit ${(new CellRange(cell.c, cell.r)).A1}`);\n\t\t\tlet formula = true;\n\t\t\tif (this.model.formulasEnabled && isFormula(initialValue as string)) {\n\t\t\t\tthis.editor = this.getFormulaEditor().open(this.grid, initialValue);\n\t\t\t} else {\n\t\t\t\tif (initialValue == null && cell.hasOwnFormula) {\n\t\t\t\t\tthis.editor = this.getFormulaEditor().open(this.grid, initialValue);\n\t\t\t\t} else {\n\t\t\t\t\tformula = false;\n\t\t\t\t\tthis.editor = this.getEditor(cell).open(this.grid, initialValue);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.grid.dispatchEvent(new GridEvent('startEdit', {grid: this.grid}));\n\t\t\tif (formula) {\n\t\t\t\tthis.startFormulaMode();\n\t\t\t\tthis.grid.dispatchEvent(new GridEvent('startFormulaEdit', {grid: this.grid}));\n\t\t\t}\n\t\t}\n\t}\n\n\tendEdit() {\n\t\tif (!this.editor) return;\n\t\tthis.grid.logger.info('end edit');\n\t\tthis.grid.editing.endFormulaMode();\n\t\tthis.editor?.close();\n\t\tthis.editor = null;\n\t\tthis.grid.dispatchEvent(new GridEvent('endEdit', {grid: this.grid}));\n\t}\n\n\tcommitEdit() {\n\t\tif (this.editor) {\n\t\t\tthis.editor.commit();\n\t\t\tthis.endEdit();\n\t\t}\n\t}\n\n\tinsertRows(options: InsertOptions) {\n\t\tconst newRows = this.model.insertRows(options.index, options.count, options.after);\n\t\tthis.grid.rendering.renderAll(true);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: !!options.fromHistory,\n\t\t\teditType: 'insert_row',\n\t\t\tnewValues: newRows\n\t\t}));\n\t\treturn newRows;\n\t}\n\n\tinsertColumns(options: InsertOptions) {\n\t\tconst newColumns = this.model.insertColumns(options.index , options.count, options.after);\n\t\tthis.grid.rendering.renderAll(true);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: !!options.fromHistory,\n\t\t\teditType: 'insert_column',\n\t\t\tnewValues: newColumns\n\t\t}));\n\t\treturn newColumns;\n\t}\n\n\tdeleteRows(options: DeleteOptions) {\n\t\tconst deletedRows = this.model.deleteRows(options.index, options.count);\n\t\tthis.grid.rendering.renderAll(true);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: !!options.fromHistory,\n\t\t\teditType: 'delete_row',\n\t\t\toldValues: deletedRows\n\t\t}));\n\t\treturn deletedRows;\n\t}\n\n\tdeleteColumns(options: DeleteOptions) {\n\t\tconst deletedColumns = this.model.deleteColumns(options.index, options.count);\n\t\tthis.grid.rendering.renderAll(true);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: !!options.fromHistory,\n\t\t\teditType: 'delete_column',\n\t\t\toldValues: deletedColumns\n\t\t}));\n\t\treturn deletedColumns\n\t}\n\n\tmoveRows(options: MovingOptions) {\n\t\tthis.model.moveRows(options.index, options.count, options.targetIndex);\n\t\tthis.grid.rendering.renderAll(false);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: options.fromHistory,\n\t\t\teditType: 'move_row',\n\t\t\toldValues: [new CellRange(0, options.index, Infinity, options.index + options.count - 1)],\n\t\t\tnewValues: [new CellRange(0, options.targetIndex, Infinity, options.targetIndex + options.count - 1)],\n\t\t}));\n\t}\n\n\tmoveColumns(options: MovingOptions) {\n\t\tthis.model.moveColumns(options.index, options.count, options.targetIndex);\n\t\tthis.grid.rendering.renderAll(false);\n\t\tif (utils.ifNull(options.dispatchEvent, true)) this.grid.dispatchEvent(new GridEditEvent({\n\t\t\tgrid: this.grid,\n\t\t\tfromHistory: options.fromHistory,\n\t\t\teditType: 'move_column',\n\t\t\toldValues: [new CellRange(options.index, options.index + options.count - 1, Infinity)],\n\t\t\tnewValues: [new CellRange(options.targetIndex, 0, options.targetIndex + options.count - 1, Infinity)],\n\t\t}));\n\t}\n\n\tclearSelection(dispatchEvent = true) {\n\t\tconst cells = this.model.getCellArray(this.selection.range).filter(cell => this.canEdit(cell));\n\t\tthis.updateCells(cells, cells.map(() => null as CellModel), dispatchEvent);\n\t\tthis.grid.rendering.updateCells(cells, true);\n\t}\n\n\tgetEditor(cell: CellModel) {\n\t\tlet factory = cell.editorFactory;\n\t\tlet key: string = null;\n\n\t\tif (factory) {\n\t\t\tkey = cell.address;\n\t\t} else {\n\t\t\tkey = cell.type;\n\t\t\tfactory = getEditorFactory(cell.type);\n\t\t}\n\n\t\tif (!this.editorMap.has(key)) {\n\t\t\tconst editor = factory(cell, this.model.options.editing) as BaseEditor;\n\t\t\tthis.grid.shadowRoot.appendChild(editor);\n\t\t\tthis.editorMap.set(key, editor);\n\t\t}\n\n\t\treturn this.editorMap.get(key);\n\t}\n\n\tgetFormulaEditor() {\n\t\tconst type = 'formula';\n\t\tif (!this.editorMap.has(type)) {\n\t\t\tconst editor = new FormulaEditor();\n\t\t\tthis.grid.shadowRoot.appendChild(editor);\n\t\t\tthis.editorMap.set(type, editor);\n\t\t}\n\t\treturn this.editorMap.get(type);\n\t}\n\n\t/** the cells of the selection for the clipboard: the rows the user sees only, see copySelection */\n\tgetSelectionCellData() {\n\t\treturn this.model.getCellMatrix(this.selection.range, true).map(\n\t\t\trow => row.map(cell => cell.getSourceData({displayValue: true}))\n\t\t);\n\t}\n\n\t/**\n\t * Copies the selection: the rows the table shows only, as the user does not see the rows a filter\n\t * or a collapsed row hides inside the range and does not expect them in the clipboard.\n\t */\n\tcopySelection() {\n\t\tconst customClipboardSupport = ClipboardItem.supports(constants.CUSTOM_CLIPBOARD_TYPE);\n\t\tconst values = this.model.getValuesInRange(this.selection.range, customClipboardSupport, true);\n\t\tthis.grid.selecting.hideSelector();\n\t\tthis.grid.selecting.showCopySelector();\n\n\t\tlet csvText = csv.arrayToCsv(values, {decimalSeparator: this.model.options.systemDecimalSeparator});\n\t\tif (values.length === 1 && values[0].length === 1) csvText = csvText.replace(/[\\r\\n]+$/, '');\n\n\t\tconst clipboardData: Record<string, string|Blob> = {'text/plain': new Blob([csvText], {\n\t\t\ttype: \"text/plain\"\n\t\t})};\n\n\t\tif (customClipboardSupport) {\n\t\t\tclipboardData[constants.CUSTOM_CLIPBOARD_TYPE] = new Blob([JSON.stringify(this.getSelectionCellData())], {\n\t\t\t\ttype: \"application/json\"\n\t\t\t});\n\t\t} else {\n\t\t\tthis.grid.logger.warn(\"Browser does not support custom clipboard type\");\n\t\t}\n\n\t\tnavigator.clipboard.write([new ClipboardItem(clipboardData)]).then(\n\t\t\t() => this.grid.logger.info(\"selected content copied\"),\n\t\t\t() => this.grid.logger.error(\"copy rejected\")\n\t\t);\n\t}\n\n\tprivate async pasteMatrix(data: Matrix<string | CellSource>) {\n\t\tconst range = this.selection.range;\n\t\tconst cells: CellModel[] = [];\n\t\tconst cellValues: CellValueType[] = [];\n\t\tconst rowPasteMode = this.model.options.clipboard?.rowPasteMode;\n\t\tconst columnPasteMode = this.model.options.clipboard?.columnPasteMode;\n\n\t\tconst pasteProps = (this.model.options.clipboard?.pasteProps ?? 'all') == 'all'\n\t\t\t? null : this.model.options.clipboard.pasteProps as (keyof CellSource)[];\n\n\t\tconst height = data.length;\n\t\tconst width = height > 0 ? data[0].length : 0;\n\n\t\t// insert rows if needed\n\t\tif (rowPasteMode == 'insert') {\n\t\t\tthis.insertRows({index: range.r1, count: height, after: false});\n\t\t} else if (rowPasteMode == 'rewrite_append' && range.r1 + height > this.model.rows.length - 1) {\n\t\t\tthis.insertRows({\n\t\t\t\tindex: this.model.rows.length - 1,\n\t\t\t\tcount: range.r1 + height - this.model.rows.length,\n\t\t\t\tafter: true\n\t\t\t});\n\t\t}\n\n\t\t// insert columns if needed\n\t\tif (columnPasteMode == 'insert') {\n\t\t\tthis.insertColumns({index: range.c1, count: width, after: false});\n\t\t} else if (columnPasteMode == 'rewrite_append' && range.c1 + width > this.model.columns.length - 1) {\n\t\t\tthis.insertColumns({\n\t\t\t\tindex: this.model.columns.length - 1,\n\t\t\t\tcount: range.c1 + width - this.model.columns.length,\n\t\t\t\tafter: true\n\t\t\t});\n\t\t}\n\n\t\t// duplicate clipboard matrix over selection range if it fits\n\t\tconst dataFitsSelection = height > 0 && width > 0 &&\n\t\t\trange.size.rows % height == 0 && range.size.columns % width == 0;\n\n\t\tlet rMax = Math.min(\n\t\t\tdataFitsSelection ? range.r2 : range.r1 + height - 1,\n\t\t\tthis.model.rows.length - 1\n\t\t);\n\n\t\tconst cMax = Math.min(\n\t\t\tdataFitsSelection ? range.c2 : range.c1 + width - 1,\n\t\t\tthis.model.columns.length - 1\n\t\t);\n\n\t\tfor (let r = range.r1; r <= rMax; r++) {\n\t\t\tconst i = (r - range.r1) % height;\n\t\t\tconst row = this.model.rows[r];\n\t\t\tif (!row) break;\n\n\t\t\tif (this.model.options.clipboard?.skipHiddenRows) {\n\t\t\t\tif (!row.visible) {\n\t\t\t\t\t// resize target range to accommodate skipped row, but only if clipboard data is larger than selection\n\t\t\t\t\tif (height > range.size.rows) rMax++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (let c = range.c1; c <= cMax; c++) {\n\t\t\t\tconst cell = row.cell(c);\n\t\t\t\tif (!cell.editable) continue;\n\n\t\t\t\tconst j = (c - range.c1) % data[i].length;\n\n\t\t\t\tif (pasteProps && isCellSource(data[i][j])) {\n\t\t\t\t\t// filter unwanted properties\n\t\t\t\t\tconst updateProps: Partial<CellSource> = {};\n\t\t\t\t\tpasteProps.forEach(<T extends keyof Partial<CellSource>>(key: T) => {\n\t\t\t\t\t\tupdateProps[key] = (data[i][j] as CellSource)[key];\n\t\t\t\t\t});\n\n\t\t\t\t\t// copiing properties of cell with display value into cell without display value\n\t\t\t\t\tif (!cell.prefersDisplayValue) updateProps.dv = undefined;\n\n\t\t\t\t\tcellValues.push(updateProps);\n\t\t\t\t} else {\n\t\t\t\t\tcellValues.push(data[i][j]);\n\t\t\t\t}\n\n\t\t\t\tcells.push(cell);\n\t\t\t}\n\t\t}\n\n\t\tawait this.resolveDropdownValues(cells, cellValues);\n\t\tthis.updateCells(cells, cellValues, true);\n\t\tthis.grid.rendering.updateCells(cells, true);\n\t}\n\n\t/**\n\t * A value pasted into a dropdown cell becomes the item of its list it stands for, see DropdownList.resolve;\n\t * a list the cells share (an adapter of a column) is loaded once.\n\t */\n\tprivate async resolveDropdownValues(cells: CellModel[], values: CellValueType[]) {\n\t\tconst lists = new Map<unknown, Promise<DropdownList>>();\n\t\tawait Promise.all(cells.map(async (cell, i) => {\n\t\t\tconst source = getDropdownListSource(cell);\n\t\t\t// a pasted formula stays a formula, its result is not an item of the list\n\t\t\tconst formula = this.model.formulasEnabled\n\t\t\t\t&& (isCellSource(values[i]) ? !!(values[i] as CellSource).f : isFormula(values[i] as string));\n\t\t\tif (!source || formula) return;\n\t\t\tif (!lists.has(source)) lists.set(source, loadDropdownList(source).catch((): DropdownList => {\n\t\t\t\tthis.grid.logger.warn('dropdown list failed to load, the pasted values stay unchecked');\n\t\t\t\treturn null;\n\t\t\t}));\n\t\t\tconst list = await lists.get(source);\n\t\t\tif (list) values[i] = list.resolve(values[i], cell.validation?.allowInvalid);\n\t\t}));\n\t}\n\n\tprivate async pasteText(text: string) {\n\t\tawait this.pasteMatrix(csv.csvToArray(text));\n\t}\n\n\tasync paste() {\n\t\tthis.grid.selecting.hideCopySelector();\n\n\t\ttry\t{\n\t\t\tconst clipboardItems = await navigator.clipboard.read();\n\t\t\tif (clipboardItems.length == 0) return;\n\t\t\tconst clipboardItem = clipboardItems[0];\n\t\t\tif (clipboardItem.types.includes(constants.CUSTOM_CLIPBOARD_TYPE)) {\n\t\t\t\tconst data = await clipboardItem.getType(constants.CUSTOM_CLIPBOARD_TYPE);\n\t\t\t\tawait this.pasteMatrix(JSON.parse(await data.text()));\n\t\t\t} else if (clipboardItem.types.includes('text/plain')) {\n\t\t\t\tconst data = await clipboardItem.getType('text/plain');\n\t\t\t\tawait this.pasteText(await data.text());\n\t\t\t}\n\t\t} catch (_e) {\n\t\t\tthis.grid.logger.error(\"paste rejected\");\n\t\t\treturn;\n\t\t}\n\t}\n\n\topenComments(cell: CellModel) {\n\t\tsetTimeout(() => {\n\t\t\tthis.grid.comment.attachTo(this.grid.table.getCellByCellModel(cell), cell, true);\n\t\t}, 100);\n\t}\n\n\tundo() {\n\t\tlet cells: CellModel[];\n\t\tconst [item] = this.grid.history.pop();\n\t\tif (!item) return;\n\t\tswitch (item.type) {\n\t\t\tcase 'value':\n\t\t\t\tcells = item.addresses.map(addr => this.model.getCellByA1(addr));\n\t\t\t\tthis.updateCells(cells, item.oldProps, true, true);\n\t\t\t\tthis.grid.rendering.updateCells(cells, true);\n\t\t\t\tbreak;\n\t\t\tcase 'insert_column':\n\t\t\t\titem.newValues.forEach((_, i) => this.grid.editing.deleteColumns({\n\t\t\t\t\tindex: decodeColumn(item.addresses[i]),\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tdispatchEvent: true,\n\t\t\t\t\tfromHistory: true\n\t\t\t\t}));\n\t\t\t\tbreak;\n\t\t\tcase 'insert_row':\n\t\t\t\titem.newValues.forEach((_, i) => this.grid.editing.deleteRows({\n\t\t\t\t\tindex: decodeRow(item.addresses[i]),\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tdispatchEvent: true,\n\t\t\t\t\tfromHistory: true\n\t\t\t\t}));\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tredo() {\n\t\tlet cells: CellModel[];\n\t\tconst [item] = this.grid.history.pop2();\n\t\tif (!item) return;\n\t\tswitch (item.type) {\n\t\t\tcase 'value':\n\t\t\t\tcells = item.addresses.map(addr => this.model.getCellByA1(addr))\n\t\t\t\tthis.updateCells(cells, item.newValues, true, true);\n\t\t\t\tthis.grid.rendering.updateCells(cells, true);\n\t\t\t\tbreak;\n\t\t\tcase 'insert_column':\n\t\t\t\titem.newValues.forEach((_, i) => this.grid.editing.insertColumns({\n\t\t\t\t\tindex: decodeColumn(item.addresses[i]),\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tdispatchEvent: true,\n\t\t\t\t\tfromHistory: true\n\t\t\t\t}));\n\t\t\t\tbreak;\n\t\t\tcase 'insert_row':\n\t\t\t\titem.newValues.forEach((_, i) => this.grid.editing.insertRows({\n\t\t\t\t\tindex: decodeRow(item.addresses[i]),\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tdispatchEvent: true,\n\t\t\t\t\tfromHistory: true\n\t\t\t\t}));\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tstartColumnMoving(_c: number) {\n\t\tthis.columnMoving = true;\n\t}\n\n\tmerge(range?: CellAddress) {\n\t\tconst r = range ? CellRange.fromA1(range) : this.selection.range;\n\t\tconst cell = this.model.rows[r.r1]?.cell(r.c1);\n\t\tif (!cell) return;\n\t\tthis.model.merges.add({r: r.r1, c: r.c1, rs: r.size.rows, cs: r.size.columns});\n\t\tthis.grid.rendering.renderCells({vertical: true, horizontal: true});\n\t\tthis.grid.selecting.select(r);\n\t}\n\n\tunmerge(range?: CellAddress) {\n\t\tconst r = range ? CellRange.fromA1(range) : this.selection.range;\n\t\tconst cell = this.model.rows[r.r1]?.cell(r.c1);\n\t\tif (!cell) return;\n\t\tconst merge = this.model.merges.mergedCells.get(cell.address);\n\t\tif (!merge) return;\n\t\tthis.model.merges.remove(cell.address);\n\t\tthis.grid.rendering.renderCells({vertical: true, horizontal: true});\n\t\tthis.grid.selecting.select(new CellRange(merge.c, merge.r, merge.c + merge.cs - 1, merge.r + merge.rs - 1));\n\t}\n\n}\n"]}
|
package/dist/ui/grid.js
CHANGED
|
@@ -37,7 +37,13 @@ let Grid = class Grid extends LitElement {
|
|
|
37
37
|
this.tooltipRef = createRef();
|
|
38
38
|
this.commentRef = createRef();
|
|
39
39
|
this.selection = new SelectionModel(0, 0);
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* The options objects this grid made with initOptions(): a `.options` binding or an assignment from outside
|
|
42
|
+
* brings a partial object instead, which willUpdate() completes before the model gets it
|
|
43
|
+
* (a model holding partial options has no `selecting`, `scrolling`... and the rendering falls over).
|
|
44
|
+
*/
|
|
45
|
+
this._initializedOptions = new WeakSet();
|
|
46
|
+
this.options = this._initOptions();
|
|
41
47
|
this.logger = new log.Logger('Ωgrid');
|
|
42
48
|
this.zoom = 1;
|
|
43
49
|
this.rendering = new GridRendering(this);
|
|
@@ -217,9 +223,24 @@ let Grid = class Grid extends LitElement {
|
|
|
217
223
|
this.dispatchEvent(new GridEvent('afterLoad', { grid: this }));
|
|
218
224
|
}
|
|
219
225
|
updateOptions(options) {
|
|
220
|
-
this.options =
|
|
226
|
+
this.options = this._initOptions(options, this.options);
|
|
221
227
|
this.requestUpdate();
|
|
222
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Options started over from the defaults: only the state the grid holds itself (the zoom) is carried over
|
|
231
|
+
* from the previous ones. Used when the adapter is replaced - the options of the previous adapter must not
|
|
232
|
+
* leak into the next one (a refresh of the same adapter merges its options over the current ones instead,
|
|
233
|
+
* see initAdapter()).
|
|
234
|
+
*/
|
|
235
|
+
resetOptions(previous) {
|
|
236
|
+
return this._initOptions({ zoom: previous?.zoom });
|
|
237
|
+
}
|
|
238
|
+
/** initOptions() whose result the grid recognizes as complete (see `_initializedOptions`) */
|
|
239
|
+
_initOptions(options, origOptions) {
|
|
240
|
+
const result = initOptions(options, origOptions);
|
|
241
|
+
this._initializedOptions.add(result);
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
223
244
|
openCommands() {
|
|
224
245
|
this.commands.open();
|
|
225
246
|
}
|
|
@@ -282,12 +303,26 @@ let Grid = class Grid extends LitElement {
|
|
|
282
303
|
}
|
|
283
304
|
setSourceData(data) {
|
|
284
305
|
if (data.options)
|
|
285
|
-
this.options =
|
|
306
|
+
this.options = this._initOptions(data.options, this.options);
|
|
286
307
|
this.model = new GridModel(data, this.options, this.logger);
|
|
287
308
|
}
|
|
288
309
|
willUpdate(changedProps) {
|
|
310
|
+
// options set from outside (`.options="${partial}"`) are completed over the previous ones before
|
|
311
|
+
// updated() hands them to the model; the grid's own options are complete already
|
|
312
|
+
const bound = changedProps.has('options') && !this._initializedOptions.has(this.options) ? this.options ?? {} : null;
|
|
313
|
+
const prev = bound ? changedProps.get('options') : this.options;
|
|
314
|
+
if (changedProps.has('adapter') && changedProps.get('adapter')) {
|
|
315
|
+
// a different adapter: its options start over; options bound in the same update still apply
|
|
316
|
+
// (done here, not in updated(): a property set there costs another update cycle and a Lit warning)
|
|
317
|
+
this.options = this.resetOptions(prev);
|
|
318
|
+
if (bound)
|
|
319
|
+
this.options = this._initOptions(bound, this.options);
|
|
320
|
+
}
|
|
321
|
+
else if (bound) {
|
|
322
|
+
this.options = this._initOptions(bound, prev);
|
|
323
|
+
}
|
|
289
324
|
if (changedProps.has('model')) {
|
|
290
|
-
this.options =
|
|
325
|
+
this.options = this._initOptions(this.model.options, this.options);
|
|
291
326
|
this.model.options = this.options;
|
|
292
327
|
this.history = new History(this.model);
|
|
293
328
|
this.filtering.init();
|
package/dist/ui/grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/ui/grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAuB,OAAO,EAAkB,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAc,cAAc,EAAW,WAAW,EAAE,OAAO,EAAE,SAAS,EAAc,MAAM,sBAAsB,CAAC;AAEnI,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,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E,MAAM,EAAC,CAAC;qCACJ;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;uCAC4B;AAGrD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;qCACQ;AAGjC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;oCACmB;AAG5C;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kCAChB;AAvDG,IAAI;IADhB,aAAa,CAAC,SAAS,CAAC;GACZ,IAAI,CA8VhB","sourcesContent":["import { dom, log, Slider, Sizer, Layout, Menu, Plugins, AnyConstructor, events } from '@omegagrid/core';\nimport { GridModel, GridSource, SelectionModel, Options, initOptions, History, CellRange, TableTheme } from '@omegagrid/grid-core';\nimport { Selector } from './selector';\nimport { CommandManager } from '@omegagrid/commands';\nimport { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { Table } from './table';\nimport { GridTooltip as Tooltip } from './tooltip';\nimport { styles } from './grid.style';\nimport { GridRendering } from './grid.rendering';\nimport { GridSelecting } from './grid.selecting';\nimport { GridErrorEvent, GridEvent, GridEvents } from './grid.events';\nimport { GridEditing } from './grid.editing';\nimport { GridFiltering } from './grid.filtering';\nimport { GridObjects } from './grid.objects';\nimport { GridSorting } from './grid.sorting';\nimport { GridMenus } from './grid.menu';\nimport { GridGroup } from './group';\nimport { Comment } from './comment';\nimport { UserColumnWidths } from './userColumnWidths';\nimport { GridAdapter } from '../gridAdapter';\nimport { initGridCommands } from '../commands';\nimport { debounce } from 'ts-debounce';\n\n@customElement('og-grid')\nexport class Grid extends LitElement implements Layout {\n\n\tstatic styles = [styles];\n\n\tprivate tableRef = createRef<Table>();\n\tget table() : Table { return this.tableRef.value }\n\n\tprivate hSliderRef = createRef<Slider>();\n\tget hSlider() { return this.hSliderRef.value }\n\n\tprivate vSliderRef = createRef<Slider>();\n\tget vSlider() { return this.vSliderRef.value }\n\n\tprivate hSizerRef = createRef<Sizer>();\n\tget hSizer() { return this.hSizerRef.value }\n\n\tprivate vSizerRef = createRef<Sizer>();\n\tget vSizer() { return this.vSizerRef.value }\n\n\tprivate selectorRef = createRef<Selector>();\n\tget selector() { return this.selectorRef.value }\n\n\tprivate copySelectorRef = createRef<Selector>();\n\tget copySelector() { return this.copySelectorRef.value }\n\n\tprivate formulaSelectorRef = createRef<Selector>();\n\tget formulaSelector() { return this.formulaSelectorRef.value }\n\n\tprivate contextMenuRef = createRef<Menu>();\n\tget contextMenu() { return this.contextMenuRef.value }\n\n\tprivate tooltipRef = createRef<Tooltip>();\n\tget tooltip() { return this.tooltipRef.value }\n\n\tprivate commentRef = createRef<Comment>();\n\tget comment() { return this.commentRef.value }\n\n\tget designMode() { return this.group ? this.group.designMode : false }\n\n\t@property({type: Object})\n\tmodel: GridModel;\n\n\t@property({type: Object})\n\tadapter: GridAdapter;\n\n\t@property({type: Object})\n\tselection: SelectionModel = new SelectionModel(0, 0);\n\n\t@property({type: Object})\n\toptions: Options = initOptions();\n\n\t@property({type: Object})\n\tlogger: log.Logger = new log.Logger('Ωgrid')\n\n\t@property({type: Number})\n\tzoom = 1;\n\n\tgroup: GridGroup;\n\thistory: History;\n\trendering = new GridRendering(this);\n\tselecting = new GridSelecting(this);\n\tevents = new GridEvents(this);\n\tediting = new GridEditing(this);\n\tfiltering = new GridFiltering(this);\n\tsorting = new GridSorting(this);\n\tmenus = new GridMenus(this);\n\tobjects = new GridObjects(this);\n\tcommands = new CommandManager(this);\n\tplugins = new Plugins<Grid>(this);\n\treadonly userColumnWidths = new UserColumnWidths();\n\tloading = false;\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis.logger.info('connected');\n\t\t// release an update deferred while the grid was disconnected\n\t\tthis._resumeUpdate?.();\n\t\tthis._resumeUpdate = null;\n\t\tthis.layout();\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.destroy();\n\t}\n\n\tprivate _resumeUpdate: () => void;\n\n\t/**\n\t * Defer updates while the grid is not connected. Rendering the template\n\t * of a disconnected element wipes the element refs (the lit ref directive\n\t * sets the ref value only when connected), so firstUpdated/updated would\n\t * crash on the missing table/menu. Deferring in scheduleUpdate keeps the\n\t * changed properties, the update runs on (re)connection.\n\t */\n\tprotected async scheduleUpdate() {\n\t\twhile (!this.isConnected) {\n\t\t\tawait new Promise<void>(resolve => this._resumeUpdate = resolve);\n\t\t}\n\t\tsuper.scheduleUpdate();\n\t}\n\n\tdestroy() {\n\t\t//dom.remove(this.mouseTooltip);\n\t\tif (this.contextMenu) dom.remove(this.contextMenu);\n\t\tif (this.comment) dom.remove(this.comment);\n\t}\n\n\tasync initAdapter() {\n\t\tthis.adapter.attach(this);\n\t\tif (this.table) this.table.rowOffset = 0;\n\t\tthis.dispatchEvent(new GridEvent('beforeLoad', {grid: this}));\n\t\tconst columns = await this.adapter.getColumns();\n\t\tconst options = initOptions(await this.adapter.getOptions(), this.options);\n\t\tconst prevFilter = this.model?.filter;\n\t\tconst prevSorting = this.model?.sorting;\n\t\tconst requestFilters = this.rendering.getAdapterRequestFilters();\n\t\t// on the first load the adapter has no model to resolve the column indexes of the filter and order by\n\t\tif (!this.model) requestFilters.columns = columns;\n\t\tif (!this.model && options.pageSize > 0) {\n\t\t\tconst defaultFilter = options.filters?.defaultSettings;\n\t\t\tconst defaultOrder = options.sorting?.defaultSettings;\n\t\t\tif (defaultFilter?.length) requestFilters.filter = defaultFilter.map(s => ({...s}));\n\t\t\tif (defaultOrder?.length) requestFilters.order = defaultOrder.map(s => ({...s}));\n\t\t}\n\t\tconst rows = await this.adapter.getRows(requestFilters);\n\t\trequestFilters.rows = rows;\n\t\tconst cells = await this.adapter.getCells(requestFilters);\n\t\tconst sparklines = await this.adapter.getSparklines();\n\t\tconst comments = await this.adapter.getComments();\n\t\tconst rules = await this.adapter.getRules();\n\t\tconst styles = await this.adapter.getStyles();\n\t\tthis.setSourceData({\n\t\t\tcolumns,\n\t\t\trows,\n\t\t\tcells,\n\t\t\toptions,\n\t\t\tsparklines,\n\t\t\tcomments,\n\t\t\trules,\n\t\t\tstyles\n\t\t});\n\t\tthis.userColumnWidths.apply(this.model.columns);\n\t\t// the previous model holds the state of the user, an empty one included: the default settings\n\t\t// the new model applied to itself in its constructor must not come back after a refresh\n\t\tif (prevFilter) {\n\t\t\tif (prevFilter.settings.length) {\n\t\t\t\tthis.model.filter.restore(prevFilter.settings, prevFilter.custom);\n\t\t\t} else if (this.model.filter.settings.length) {\n\t\t\t\tthis.model.filter.resetFilter(false);\n\t\t\t\tthis.model.filter.custom = prevFilter.custom;\n\t\t\t}\n\t\t} else if (this.model.filter.settings.length && this.filtering.isCustomFilter) {\n\t\t\tthis.model.filter.restore(this.model.filter.settings, true);\n\t\t}\n\t\tif (prevSorting) {\n\t\t\tif (prevSorting.settings.length) {\n\t\t\t\tthis.model.sorting.restore(prevSorting.settings, !this.sorting.isCustomSorting);\n\t\t\t} else if (this.model.sorting.settings.length) {\n\t\t\t\tthis.model.sorting.resetSort();\n\t\t\t}\n\t\t} else if (this.model.sorting.settings.length && this.sorting.isCustomSorting) {\n\t\t\tthis.model.sorting.restore(this.model.sorting.settings, false);\n\t\t}\n\t\tthis.dispatchEvent(new GridEvent('afterLoad', {grid: this}));\n\t}\n\n\tupdateOptions(options: Partial<Options>) {\n\t\tthis.options = initOptions(options, this.options);\n\t\tthis.requestUpdate();\n\t}\n\n\tprivate _debounceVerticalSlide = debounce(this.events._onVerticalSlide, Slider.SLIDE_DELAY, {isImmediate: true, maxWait: 50});\n\tprivate _debounceHorizontalSlide = debounce(this.events._onHorizontalSlide, Slider.SLIDE_DELAY, {isImmediate: true, maxWait: 50});\n\n\trender = () => html`\n\t\t<og-table ${ref(this.tableRef)}\n\t\t\t.zoom=\"${this.zoom}\"\n\t\t\t.hideOuterBorder=\"${this.options.hideOuterBorder}\">\n\t\t</og-table>\n\n\t\t<og-slider ${ref(this.vSliderRef)}\n\t\t\t?hidden=\"${true}\"\n\t\t\tdirection=\"vertical\"\n\t\t\t@slide=\"${this._debounceVerticalSlide}\"\n\t\t\t@slideStart=\"${this.events._onSlideStart}\"\n\t\t\t@slideEnd=\"${this.events._onSlideStop}\">\n\t\t</og-slider>\n\n\t\t<og-slider ${ref(this.hSliderRef)}\n\t\t\t?hidden=\"${true}\"\n\t\t\tdirection=\"horizontal\"\n\t\t\t@slide=\"${this._debounceHorizontalSlide}\"\n\t\t\t@slideStart=\"${this.events._onSlideStart}\"\n\t\t\t@slideEnd=\"${this.events._onSlideStop}\">\n\t\t</og-slider>\n\n\t\t<og-sizer ${ref(this.vSizerRef)} orientation=\"vertical\"></og-sizer>\n\n\t\t<og-sizer ${ref(this.hSizerRef)} orientation=\"horizontal\"></og-sizer>\n\n\t\t<og-selector ${ref(this.selectorRef)}\n\t\t\t?autofill=\"${this.options.autofill}\"\n\t\t\t?movable=\"${true}\"\n\t\t\t?subselector=\"${true}\">\n\t\t</og-selector>\n\n\t\t<og-selector ${ref(this.copySelectorRef)}\n\t\t\t?autofill=\"${false}\"\n\t\t\t?movable=\"${false}\"\n\t\t\t?animated=\"${true}\">\n\t\t</og-selector>\n\n\t\t<og-selector ${ref(this.formulaSelectorRef)}\n\t\t\t?autofill=\"${false}\"\n\t\t\t?movable=\"${false}\"\n\t\t\t?animated=\"${true}\"\n\t\t\tstyle=\"z-index: 110\">\n\t\t</og-selector>\n\n\t\t<og-menu ${ref(this.contextMenuRef)} style=\"display: none; z-index: 1000\"></og-menu>\n\n\t\t<og-grid-tooltip ${ref(this.tooltipRef)} style=\"display: none\"></og-grid-tooltip>\n\n\t\t<og-grid-comment ${ref(this.commentRef)} style=\"display: none\"></og-grid-comment>\n\t`;\n\n\topenCommands() {\n\t\tthis.commands.open();\n\t}\n\n\tcloseCommands() {\n\t\tthis.commands.close();\n\t}\n\n\tasync firstUpdated() {\n\t\tthis.tabIndex = 0;\n\t\tthis.events.init();\n\t\tthis.menus.init();\n\n\t\tawait this.table.updateComplete;\n\t\tthis.logger.info('init');\n\t\tthis.dispatchEvent(new GridEvent('init', {grid: this}));\n\t}\n\n\tasync updated(changedProps: Map<PropertyKey, unknown>) {\n\t\tdom.setSize(this.table, {w: this.clientWidth, h: this.clientHeight});\n\t\tif (changedProps.has('adapter')) {\n\t\t\tif (changedProps.get('adapter')) this.userColumnWidths.clear(); // a different adapter brings a different column set\n\t\t\ttry {\n\t\t\t\tawait this.initAdapter();\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger.error('Error initializing adapter:', error);\n\t\t\t\tthis.dispatchEvent(new GridErrorEvent(error as Error));\n\t\t\t}\n\t\t}\n\n\t\tif (this.model) {\n\t\t\tif (this.options) this.model.options = this.options;\n\t\t\tthis.rendering.requireVerticalUpdate = true;\n\t\t\tthis.rendering.requireHorizontalUpdate = true;\n\t\t\tthis.table.model = this.model;\n\t\t\tif (changedProps.has('model')) {\n\t\t\t\tthis.sorting.init();\n\n\t\t\t\tif (this.model.options.firstCell) { // TODO: move somewhere else\n\t\t\t\t\tconst cell = CellRange.fromA1(this.model.options.firstCell);\n\t\t\t\t\tthis.table.colOffset = cell.c1;\n\t\t\t\t\tthis.table.rowOffset = cell.r1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait this.table.updateComplete;\n\t\t\tthis.rendering.updateSliders();\n\t\t\tthis.rendering.debounceRenderCells();\n\t\t\tinitGridCommands(this);\n\t\t\tthis.dispatchEvent(new GridEvent('loadmodel', {grid: this}));\n\t\t}\n\n\t\tif (changedProps.has('zoom') && (changedProps.get('zoom') || 1) !== (this.zoom || 1)) {\n\t\t\tthis.options.zoom = this.zoom;\n\t\t\tthis.rendering.render(true);\n\t\t}\n\t}\n\n\tinnerLayout() {\n\t\tdom.setSize(this.table, {w: this.clientWidth, h: this.clientHeight});\n\t\tthis.table.requestUpdate();\n\t}\n\n\tdebounceInnerLayout = debounce(this.innerLayout, 100);\n\n\tlayout() {\n\t\tif (this.table) this.debounceInnerLayout();\n\t}\n\n\tsetSourceData(data: GridSource) {\n\t\tif (data.options) this.options = initOptions(data.options, this.options);\n\t\tthis.model = new GridModel(data, this.options, this.logger);\n\t}\n\n\twillUpdate(changedProps: Map<PropertyKey, unknown>) {\n\t\tif (changedProps.has('model')) {\n\t\t\tthis.options = initOptions(this.model.options, this.options);\n\t\t\tthis.model.options = this.options;\n\t\t\tthis.history = new History(this.model);\n\t\t\tthis.filtering.init();\n\t\t\tthis.zoom = this.options.zoom || 1;\n\t\t}\n\t}\n\n\tfocus(options?: FocusOptions): void {\n\t\tsuper.focus(options);\n\t\tthis.editing.activeEditor?.focus();\n\t}\n\n\tasync refresh() {\n\t\tif (this.adapter) {\n\t\t\tthis.table.clearHeaderCache();\n\t\t\tthis.table.clearBodyCache();\n\t\t\tawait this.initAdapter();\n\t\t} else {\n\t\t\tawait this.rendering.render(true);\n\t\t}\n\t}\n\n\tcreateEvent<TEvent extends GridEvent>(type: string, args?: Partial<TEvent>, event?: AnyConstructor<TEvent>) {\n\t\tconst EventConstructor = (event ?? GridEvent) as AnyConstructor<TEvent>;\n\t\treturn new EventConstructor(type, {grid: this, ...args});\n\t}\n\n\tdispatchGridEvent<TEvent extends GridEvent>(type: string, args?: Partial<TEvent>, event?: AnyConstructor<TEvent>) {\n\t\tthis.dispatchEvent(this.createEvent(type, args, event));\n\t}\n\n\tgetConnectedGrid(name: string) {\n\t\treturn this.group?.getGrid(name);\n\t}\n\n\tgetSourceData() {\n\t\tconst data = this.model?.getSourceData() ?? {};\n\t\tconst event = new events.SerialzieEvent<GridSource>(data);\n\t\tthis.dispatchEvent(event);\n\t\treturn event.data;\n\t}\n\n\tsetTheme(theme: TableTheme) {\n\t\tthis.model.theme = theme;\n\t\tthis.model.applyTheme(theme, true);\n\t\tthis.refresh();\n\t}\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/ui/grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,G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AAG5C;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kCAChB;AA9DG,IAAI;IADhB,aAAa,CAAC,SAAS,CAAC;GACZ,IAAI,CAkYhB","sourcesContent":["import { dom, log, Slider, Sizer, Layout, Menu, Plugins, AnyConstructor, events } from '@omegagrid/core';\nimport { GridModel, GridSource, SelectionModel, Options, OptionSource, initOptions, History, CellRange, TableTheme } from '@omegagrid/grid-core';\nimport { Selector } from './selector';\nimport { CommandManager } from '@omegagrid/commands';\nimport { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { Table } from './table';\nimport { GridTooltip as Tooltip } from './tooltip';\nimport { styles } from './grid.style';\nimport { GridRendering } from './grid.rendering';\nimport { GridSelecting } from './grid.selecting';\nimport { GridErrorEvent, GridEvent, GridEvents } from './grid.events';\nimport { GridEditing } from './grid.editing';\nimport { GridFiltering } from './grid.filtering';\nimport { GridObjects } from './grid.objects';\nimport { GridSorting } from './grid.sorting';\nimport { GridMenus } from './grid.menu';\nimport { GridGroup } from './group';\nimport { Comment } from './comment';\nimport { UserColumnWidths } from './userColumnWidths';\nimport { GridAdapter } from '../gridAdapter';\nimport { initGridCommands } from '../commands';\nimport { debounce } from 'ts-debounce';\n\n@customElement('og-grid')\nexport class Grid extends LitElement implements Layout {\n\n\tstatic styles = [styles];\n\n\tprivate tableRef = createRef<Table>();\n\tget table() : Table { return this.tableRef.value }\n\n\tprivate hSliderRef = createRef<Slider>();\n\tget hSlider() { return this.hSliderRef.value }\n\n\tprivate vSliderRef = createRef<Slider>();\n\tget vSlider() { return this.vSliderRef.value }\n\n\tprivate hSizerRef = createRef<Sizer>();\n\tget hSizer() { return this.hSizerRef.value }\n\n\tprivate vSizerRef = createRef<Sizer>();\n\tget vSizer() { return this.vSizerRef.value }\n\n\tprivate selectorRef = createRef<Selector>();\n\tget selector() { return this.selectorRef.value }\n\n\tprivate copySelectorRef = createRef<Selector>();\n\tget copySelector() { return this.copySelectorRef.value }\n\n\tprivate formulaSelectorRef = createRef<Selector>();\n\tget formulaSelector() { return this.formulaSelectorRef.value }\n\n\tprivate contextMenuRef = createRef<Menu>();\n\tget contextMenu() { return this.contextMenuRef.value }\n\n\tprivate tooltipRef = createRef<Tooltip>();\n\tget tooltip() { return this.tooltipRef.value }\n\n\tprivate commentRef = createRef<Comment>();\n\tget comment() { return this.commentRef.value }\n\n\tget designMode() { return this.group ? this.group.designMode : false }\n\n\t@property({type: Object})\n\tmodel: GridModel;\n\n\t@property({type: Object})\n\tadapter: GridAdapter;\n\n\t@property({type: Object})\n\tselection: SelectionModel = new SelectionModel(0, 0);\n\n\t/**\n\t * The options objects this grid made with initOptions(): a `.options` binding or an assignment from outside\n\t * brings a partial object instead, which willUpdate() completes before the model gets it\n\t * (a model holding partial options has no `selecting`, `scrolling`... and the rendering falls over).\n\t */\n\tprivate _initializedOptions = new WeakSet<Options>();\n\n\t@property({type: Object})\n\toptions: Options = this._initOptions();\n\n\t@property({type: Object})\n\tlogger: log.Logger = new log.Logger('Ωgrid')\n\n\t@property({type: Number})\n\tzoom = 1;\n\n\tgroup: GridGroup;\n\thistory: History;\n\trendering = new GridRendering(this);\n\tselecting = new GridSelecting(this);\n\tevents = new GridEvents(this);\n\tediting = new GridEditing(this);\n\tfiltering = new GridFiltering(this);\n\tsorting = new GridSorting(this);\n\tmenus = new GridMenus(this);\n\tobjects = new GridObjects(this);\n\tcommands = new CommandManager(this);\n\tplugins = new Plugins<Grid>(this);\n\treadonly userColumnWidths = new UserColumnWidths();\n\tloading = false;\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis.logger.info('connected');\n\t\t// release an update deferred while the grid was disconnected\n\t\tthis._resumeUpdate?.();\n\t\tthis._resumeUpdate = null;\n\t\tthis.layout();\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.destroy();\n\t}\n\n\tprivate _resumeUpdate: () => void;\n\n\t/**\n\t * Defer updates while the grid is not connected. Rendering the template\n\t * of a disconnected element wipes the element refs (the lit ref directive\n\t * sets the ref value only when connected), so firstUpdated/updated would\n\t * crash on the missing table/menu. Deferring in scheduleUpdate keeps the\n\t * changed properties, the update runs on (re)connection.\n\t */\n\tprotected async scheduleUpdate() {\n\t\twhile (!this.isConnected) {\n\t\t\tawait new Promise<void>(resolve => this._resumeUpdate = resolve);\n\t\t}\n\t\tsuper.scheduleUpdate();\n\t}\n\n\tdestroy() {\n\t\t//dom.remove(this.mouseTooltip);\n\t\tif (this.contextMenu) dom.remove(this.contextMenu);\n\t\tif (this.comment) dom.remove(this.comment);\n\t}\n\n\tasync initAdapter() {\n\t\tthis.adapter.attach(this);\n\t\tif (this.table) this.table.rowOffset = 0;\n\t\tthis.dispatchEvent(new GridEvent('beforeLoad', {grid: this}));\n\t\tconst columns = await this.adapter.getColumns();\n\t\tconst options = initOptions(await this.adapter.getOptions(), this.options);\n\t\tconst prevFilter = this.model?.filter;\n\t\tconst prevSorting = this.model?.sorting;\n\t\tconst requestFilters = this.rendering.getAdapterRequestFilters();\n\t\t// on the first load the adapter has no model to resolve the column indexes of the filter and order by\n\t\tif (!this.model) requestFilters.columns = columns;\n\t\tif (!this.model && options.pageSize > 0) {\n\t\t\tconst defaultFilter = options.filters?.defaultSettings;\n\t\t\tconst defaultOrder = options.sorting?.defaultSettings;\n\t\t\tif (defaultFilter?.length) requestFilters.filter = defaultFilter.map(s => ({...s}));\n\t\t\tif (defaultOrder?.length) requestFilters.order = defaultOrder.map(s => ({...s}));\n\t\t}\n\t\tconst rows = await this.adapter.getRows(requestFilters);\n\t\trequestFilters.rows = rows;\n\t\tconst cells = await this.adapter.getCells(requestFilters);\n\t\tconst sparklines = await this.adapter.getSparklines();\n\t\tconst comments = await this.adapter.getComments();\n\t\tconst rules = await this.adapter.getRules();\n\t\tconst styles = await this.adapter.getStyles();\n\t\tthis.setSourceData({\n\t\t\tcolumns,\n\t\t\trows,\n\t\t\tcells,\n\t\t\toptions,\n\t\t\tsparklines,\n\t\t\tcomments,\n\t\t\trules,\n\t\t\tstyles\n\t\t});\n\t\tthis.userColumnWidths.apply(this.model.columns);\n\t\t// the previous model holds the state of the user, an empty one included: the default settings\n\t\t// the new model applied to itself in its constructor must not come back after a refresh\n\t\tif (prevFilter) {\n\t\t\tif (prevFilter.settings.length) {\n\t\t\t\tthis.model.filter.restore(prevFilter.settings, prevFilter.custom);\n\t\t\t} else if (this.model.filter.settings.length) {\n\t\t\t\tthis.model.filter.resetFilter(false);\n\t\t\t\tthis.model.filter.custom = prevFilter.custom;\n\t\t\t}\n\t\t} else if (this.model.filter.settings.length && this.filtering.isCustomFilter) {\n\t\t\tthis.model.filter.restore(this.model.filter.settings, true);\n\t\t}\n\t\tif (prevSorting) {\n\t\t\tif (prevSorting.settings.length) {\n\t\t\t\tthis.model.sorting.restore(prevSorting.settings, !this.sorting.isCustomSorting);\n\t\t\t} else if (this.model.sorting.settings.length) {\n\t\t\t\tthis.model.sorting.resetSort();\n\t\t\t}\n\t\t} else if (this.model.sorting.settings.length && this.sorting.isCustomSorting) {\n\t\t\tthis.model.sorting.restore(this.model.sorting.settings, false);\n\t\t}\n\t\tthis.dispatchEvent(new GridEvent('afterLoad', {grid: this}));\n\t}\n\n\tupdateOptions(options: Partial<Options>) {\n\t\tthis.options = this._initOptions(options, this.options);\n\t\tthis.requestUpdate();\n\t}\n\n\t/**\n\t * Options started over from the defaults: only the state the grid holds itself (the zoom) is carried over\n\t * from the previous ones. Used when the adapter is replaced - the options of the previous adapter must not\n\t * leak into the next one (a refresh of the same adapter merges its options over the current ones instead,\n\t * see initAdapter()).\n\t */\n\tresetOptions(previous?: Options): Options {\n\t\treturn this._initOptions({zoom: previous?.zoom});\n\t}\n\n\t/** initOptions() whose result the grid recognizes as complete (see `_initializedOptions`) */\n\tprivate _initOptions(options?: Partial<OptionSource>, origOptions?: Options): Options {\n\t\tconst result = initOptions(options, origOptions);\n\t\tthis._initializedOptions.add(result);\n\t\treturn result;\n\t}\n\n\tprivate _debounceVerticalSlide = debounce(this.events._onVerticalSlide, Slider.SLIDE_DELAY, {isImmediate: true, maxWait: 50});\n\tprivate _debounceHorizontalSlide = debounce(this.events._onHorizontalSlide, Slider.SLIDE_DELAY, {isImmediate: true, maxWait: 50});\n\n\trender = () => html`\n\t\t<og-table ${ref(this.tableRef)}\n\t\t\t.zoom=\"${this.zoom}\"\n\t\t\t.hideOuterBorder=\"${this.options.hideOuterBorder}\">\n\t\t</og-table>\n\n\t\t<og-slider ${ref(this.vSliderRef)}\n\t\t\t?hidden=\"${true}\"\n\t\t\tdirection=\"vertical\"\n\t\t\t@slide=\"${this._debounceVerticalSlide}\"\n\t\t\t@slideStart=\"${this.events._onSlideStart}\"\n\t\t\t@slideEnd=\"${this.events._onSlideStop}\">\n\t\t</og-slider>\n\n\t\t<og-slider ${ref(this.hSliderRef)}\n\t\t\t?hidden=\"${true}\"\n\t\t\tdirection=\"horizontal\"\n\t\t\t@slide=\"${this._debounceHorizontalSlide}\"\n\t\t\t@slideStart=\"${this.events._onSlideStart}\"\n\t\t\t@slideEnd=\"${this.events._onSlideStop}\">\n\t\t</og-slider>\n\n\t\t<og-sizer ${ref(this.vSizerRef)} orientation=\"vertical\"></og-sizer>\n\n\t\t<og-sizer ${ref(this.hSizerRef)} orientation=\"horizontal\"></og-sizer>\n\n\t\t<og-selector ${ref(this.selectorRef)}\n\t\t\t?autofill=\"${this.options.autofill}\"\n\t\t\t?movable=\"${true}\"\n\t\t\t?subselector=\"${true}\">\n\t\t</og-selector>\n\n\t\t<og-selector ${ref(this.copySelectorRef)}\n\t\t\t?autofill=\"${false}\"\n\t\t\t?movable=\"${false}\"\n\t\t\t?animated=\"${true}\">\n\t\t</og-selector>\n\n\t\t<og-selector ${ref(this.formulaSelectorRef)}\n\t\t\t?autofill=\"${false}\"\n\t\t\t?movable=\"${false}\"\n\t\t\t?animated=\"${true}\"\n\t\t\tstyle=\"z-index: 110\">\n\t\t</og-selector>\n\n\t\t<og-menu ${ref(this.contextMenuRef)} style=\"display: none; z-index: 1000\"></og-menu>\n\n\t\t<og-grid-tooltip ${ref(this.tooltipRef)} style=\"display: none\"></og-grid-tooltip>\n\n\t\t<og-grid-comment ${ref(this.commentRef)} style=\"display: none\"></og-grid-comment>\n\t`;\n\n\topenCommands() {\n\t\tthis.commands.open();\n\t}\n\n\tcloseCommands() {\n\t\tthis.commands.close();\n\t}\n\n\tasync firstUpdated() {\n\t\tthis.tabIndex = 0;\n\t\tthis.events.init();\n\t\tthis.menus.init();\n\n\t\tawait this.table.updateComplete;\n\t\tthis.logger.info('init');\n\t\tthis.dispatchEvent(new GridEvent('init', {grid: this}));\n\t}\n\n\tasync updated(changedProps: Map<PropertyKey, unknown>) {\n\t\tdom.setSize(this.table, {w: this.clientWidth, h: this.clientHeight});\n\t\tif (changedProps.has('adapter')) {\n\t\t\tif (changedProps.get('adapter')) this.userColumnWidths.clear(); // a different adapter brings a different column set\n\t\t\ttry {\n\t\t\t\tawait this.initAdapter();\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger.error('Error initializing adapter:', error);\n\t\t\t\tthis.dispatchEvent(new GridErrorEvent(error as Error));\n\t\t\t}\n\t\t}\n\n\t\tif (this.model) {\n\t\t\tif (this.options) this.model.options = this.options;\n\t\t\tthis.rendering.requireVerticalUpdate = true;\n\t\t\tthis.rendering.requireHorizontalUpdate = true;\n\t\t\tthis.table.model = this.model;\n\t\t\tif (changedProps.has('model')) {\n\t\t\t\tthis.sorting.init();\n\n\t\t\t\tif (this.model.options.firstCell) { // TODO: move somewhere else\n\t\t\t\t\tconst cell = CellRange.fromA1(this.model.options.firstCell);\n\t\t\t\t\tthis.table.colOffset = cell.c1;\n\t\t\t\t\tthis.table.rowOffset = cell.r1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait this.table.updateComplete;\n\t\t\tthis.rendering.updateSliders();\n\t\t\tthis.rendering.debounceRenderCells();\n\t\t\tinitGridCommands(this);\n\t\t\tthis.dispatchEvent(new GridEvent('loadmodel', {grid: this}));\n\t\t}\n\n\t\tif (changedProps.has('zoom') && (changedProps.get('zoom') || 1) !== (this.zoom || 1)) {\n\t\t\tthis.options.zoom = this.zoom;\n\t\t\tthis.rendering.render(true);\n\t\t}\n\t}\n\n\tinnerLayout() {\n\t\tdom.setSize(this.table, {w: this.clientWidth, h: this.clientHeight});\n\t\tthis.table.requestUpdate();\n\t}\n\n\tdebounceInnerLayout = debounce(this.innerLayout, 100);\n\n\tlayout() {\n\t\tif (this.table) this.debounceInnerLayout();\n\t}\n\n\tsetSourceData(data: GridSource) {\n\t\tif (data.options) this.options = this._initOptions(data.options, this.options);\n\t\tthis.model = new GridModel(data, this.options, this.logger);\n\t}\n\n\twillUpdate(changedProps: Map<PropertyKey, unknown>) {\n\t\t// options set from outside (`.options=\"${partial}\"`) are completed over the previous ones before\n\t\t// updated() hands them to the model; the grid's own options are complete already\n\t\tconst bound = changedProps.has('options') && !this._initializedOptions.has(this.options) ? this.options ?? {} : null;\n\t\tconst prev = bound ? changedProps.get('options') as Options : this.options;\n\t\tif (changedProps.has('adapter') && changedProps.get('adapter')) {\n\t\t\t// a different adapter: its options start over; options bound in the same update still apply\n\t\t\t// (done here, not in updated(): a property set there costs another update cycle and a Lit warning)\n\t\t\tthis.options = this.resetOptions(prev);\n\t\t\tif (bound) this.options = this._initOptions(bound, this.options);\n\t\t} else if (bound) {\n\t\t\tthis.options = this._initOptions(bound, prev);\n\t\t}\n\t\tif (changedProps.has('model')) {\n\t\t\tthis.options = this._initOptions(this.model.options, this.options);\n\t\t\tthis.model.options = this.options;\n\t\t\tthis.history = new History(this.model);\n\t\t\tthis.filtering.init();\n\t\t\tthis.zoom = this.options.zoom || 1;\n\t\t}\n\t}\n\n\tfocus(options?: FocusOptions): void {\n\t\tsuper.focus(options);\n\t\tthis.editing.activeEditor?.focus();\n\t}\n\n\tasync refresh() {\n\t\tif (this.adapter) {\n\t\t\tthis.table.clearHeaderCache();\n\t\t\tthis.table.clearBodyCache();\n\t\t\tawait this.initAdapter();\n\t\t} else {\n\t\t\tawait this.rendering.render(true);\n\t\t}\n\t}\n\n\tcreateEvent<TEvent extends GridEvent>(type: string, args?: Partial<TEvent>, event?: AnyConstructor<TEvent>) {\n\t\tconst EventConstructor = (event ?? GridEvent) as AnyConstructor<TEvent>;\n\t\treturn new EventConstructor(type, {grid: this, ...args});\n\t}\n\n\tdispatchGridEvent<TEvent extends GridEvent>(type: string, args?: Partial<TEvent>, event?: AnyConstructor<TEvent>) {\n\t\tthis.dispatchEvent(this.createEvent(type, args, event));\n\t}\n\n\tgetConnectedGrid(name: string) {\n\t\treturn this.group?.getGrid(name);\n\t}\n\n\tgetSourceData() {\n\t\tconst data = this.model?.getSourceData() ?? {};\n\t\tconst event = new events.SerialzieEvent<GridSource>(data);\n\t\tthis.dispatchEvent(event);\n\t\treturn event.data;\n\t}\n\n\tsetTheme(theme: TableTheme) {\n\t\tthis.model.theme = theme;\n\t\tthis.model.applyTheme(theme, true);\n\t\tthis.refresh();\n\t}\n\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/grid",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.34",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Universal datagrid component",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"_prepublish": "yarn test && yarn lint"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@omegagrid/commands": "^0.11.
|
|
39
|
-
"@omegagrid/core": "^0.11.
|
|
40
|
-
"@omegagrid/grid-core": "^0.11.
|
|
41
|
-
"@omegagrid/localize": "^0.11.
|
|
42
|
-
"@omegagrid/tabs": "^0.11.
|
|
43
|
-
"@omegagrid/tree": "^0.11.
|
|
38
|
+
"@omegagrid/commands": "^0.11.34",
|
|
39
|
+
"@omegagrid/core": "^0.11.34",
|
|
40
|
+
"@omegagrid/grid-core": "^0.11.34",
|
|
41
|
+
"@omegagrid/localize": "^0.11.34",
|
|
42
|
+
"@omegagrid/tabs": "^0.11.34",
|
|
43
|
+
"@omegagrid/tree": "^0.11.34",
|
|
44
44
|
"@stdlib/stats": "^0.0.13",
|
|
45
45
|
"date-fns": "^3.2.0",
|
|
46
46
|
"lit": "^3.1.1",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseFilter } from "./baseFilter";
|
|
2
|
-
export declare class RangeFilter extends BaseFilter {
|
|
3
|
-
static styles: import("lit").CSSResult[];
|
|
4
|
-
private dropdownEl;
|
|
5
|
-
private popupEl;
|
|
6
|
-
private get popupType();
|
|
7
|
-
private _currentRange;
|
|
8
|
-
private _formatLabel;
|
|
9
|
-
private _onApply;
|
|
10
|
-
private _onClear;
|
|
11
|
-
render: () => import("lit-html").TemplateResult<1>;
|
|
12
|
-
activate(): void;
|
|
13
|
-
deactivate(): void;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=rangeFilter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rangeFilter.d.ts","sourceRoot":"","sources":["../../src/filters/rangeFilter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgB1C,qBACa,WAAY,SAAQ,UAAU;IAE1C,MAAM,CAAC,MAAM,4BAaV;IAGH,OAAO,CAAC,UAAU,CAAW;IAG7B,OAAO,CAAC,OAAO,CAAmB;IAElC,OAAO,KAAK,SAAS,GAGpB;IAED,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,QAAQ,CAQf;IAED,OAAO,CAAC,QAAQ,CAIf;IAED,MAAM,6CASJ;IAEF,QAAQ;IAUR,UAAU;CAIV"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import constants from "../constants";
|
|
8
|
-
import { customElement, query } from 'lit/decorators.js';
|
|
9
|
-
import { BaseFilter } from "./baseFilter";
|
|
10
|
-
import { html, css } from 'lit';
|
|
11
|
-
const isRangeTerm = (v) => !!v && typeof v === 'object' && !Array.isArray(v) && v.kind === 'range';
|
|
12
|
-
const toDate = (v) => {
|
|
13
|
-
if (v == null || v === '')
|
|
14
|
-
return null;
|
|
15
|
-
if (v instanceof Date)
|
|
16
|
-
return v;
|
|
17
|
-
const d = new Date(v);
|
|
18
|
-
return Number.isNaN(d.getTime()) ? null : d;
|
|
19
|
-
};
|
|
20
|
-
let RangeFilter = class RangeFilter extends BaseFilter {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
this._onApply = (e) => {
|
|
24
|
-
if (e.from == null && e.to == null) {
|
|
25
|
-
this.clearFilter();
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this.filter({ kind: 'range', from: e.from, to: e.to });
|
|
29
|
-
}
|
|
30
|
-
this.dropdownEl?.close();
|
|
31
|
-
this.deactivate();
|
|
32
|
-
};
|
|
33
|
-
this._onClear = () => {
|
|
34
|
-
this.clearFilter();
|
|
35
|
-
this.dropdownEl?.close();
|
|
36
|
-
this.deactivate();
|
|
37
|
-
};
|
|
38
|
-
this.render = () => html `
|
|
39
|
-
<og-dropdown color="transparent" alignment="left">
|
|
40
|
-
<div slot="label">${this._formatLabel()}</div>
|
|
41
|
-
<og-filter-range-popup slot="content"
|
|
42
|
-
type="${this.popupType}"
|
|
43
|
-
@apply="${this._onApply}"
|
|
44
|
-
@clear="${this._onClear}">
|
|
45
|
-
</og-filter-range-popup>
|
|
46
|
-
</og-dropdown>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
get popupType() {
|
|
50
|
-
const t = this.columnModel?.type;
|
|
51
|
-
return (t === 'dt' || t === 'tm') ? t : 'd';
|
|
52
|
-
}
|
|
53
|
-
_currentRange() {
|
|
54
|
-
const r = isRangeTerm(this.currentValue) ? this.currentValue : null;
|
|
55
|
-
if (!r)
|
|
56
|
-
return { from: null, to: null };
|
|
57
|
-
switch (this.popupType) {
|
|
58
|
-
case 'd':
|
|
59
|
-
case 'dt': return { from: toDate(r.from), to: toDate(r.to) };
|
|
60
|
-
case 'tm': return {
|
|
61
|
-
from: r.from == null ? null : String(r.from),
|
|
62
|
-
to: r.to == null ? null : String(r.to),
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
_formatLabel() {
|
|
67
|
-
const r = isRangeTerm(this.currentValue) ? this.currentValue : null;
|
|
68
|
-
if (!r || (r.from == null && r.to == null))
|
|
69
|
-
return '';
|
|
70
|
-
const type = this.popupType;
|
|
71
|
-
const fmt = (v) => {
|
|
72
|
-
if (v == null)
|
|
73
|
-
return '';
|
|
74
|
-
if (v instanceof Date)
|
|
75
|
-
return v.toLocaleDateString();
|
|
76
|
-
if (type === 'd' || type === 'dt') {
|
|
77
|
-
const d = toDate(v);
|
|
78
|
-
if (d)
|
|
79
|
-
return d.toLocaleDateString();
|
|
80
|
-
}
|
|
81
|
-
return String(v);
|
|
82
|
-
};
|
|
83
|
-
const from = fmt(r.from);
|
|
84
|
-
const to = fmt(r.to);
|
|
85
|
-
if (from && to)
|
|
86
|
-
return `${from} – ${to}`;
|
|
87
|
-
if (from)
|
|
88
|
-
return `≥ ${from}`;
|
|
89
|
-
return `≤ ${to}`;
|
|
90
|
-
}
|
|
91
|
-
activate() {
|
|
92
|
-
super.activate();
|
|
93
|
-
const { from, to } = this._currentRange();
|
|
94
|
-
setTimeout(() => {
|
|
95
|
-
if (!this.activated)
|
|
96
|
-
return; // closed before the delay ran out, e.g. by a scroll
|
|
97
|
-
this.popupEl?.setValues(from, to);
|
|
98
|
-
this.dropdownEl?.open();
|
|
99
|
-
}, 50);
|
|
100
|
-
}
|
|
101
|
-
deactivate() {
|
|
102
|
-
this.dropdownEl?.close();
|
|
103
|
-
super.deactivate();
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
RangeFilter.styles = [...BaseFilter.styles, css `
|
|
107
|
-
:host {
|
|
108
|
-
display: block;
|
|
109
|
-
box-sizing: border-box;
|
|
110
|
-
height: 100%;
|
|
111
|
-
width: 100%;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
og-dropdown {
|
|
115
|
-
display: flex;
|
|
116
|
-
width: 100%;
|
|
117
|
-
height: 100%;
|
|
118
|
-
}
|
|
119
|
-
`];
|
|
120
|
-
__decorate([
|
|
121
|
-
query('og-dropdown')
|
|
122
|
-
], RangeFilter.prototype, "dropdownEl", void 0);
|
|
123
|
-
__decorate([
|
|
124
|
-
query(`${constants.PREFIX}-filter-range-popup`)
|
|
125
|
-
], RangeFilter.prototype, "popupEl", void 0);
|
|
126
|
-
RangeFilter = __decorate([
|
|
127
|
-
customElement(`${constants.PREFIX}-filter-range`)
|
|
128
|
-
], RangeFilter);
|
|
129
|
-
export { RangeFilter };
|
|
130
|
-
//# sourceMappingURL=rangeFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rangeFilter.js","sourceRoot":"","sources":["../../src/filters/rangeFilter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,I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AAU,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO,CAAC,oDAAoD;YACjF,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAClC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC,EAAE,EAAE,CAAC,CAAC;IACR,CAAC;IAED,UAAU;QACT,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;QACzB,KAAK,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;;AAnGM,kBAAM,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;;;;EAazC,CAAC,AAbW,CAaV;AAGK;IADP,KAAK,CAAC,aAAa,CAAC;+CACQ;AAGrB;IADP,KAAK,CAAC,GAAG,SAAS,CAAC,MAAM,qBAAqB,CAAC;4CACd;AArBtB,WAAW;IADvB,aAAa,CAAC,GAAG,SAAS,CAAC,MAAM,eAAe,CAAC;GACrC,WAAW,CAsGvB","sourcesContent":["import constants from \"../constants\";\nimport { customElement, query } from 'lit/decorators.js';\nimport { BaseFilter } from \"./baseFilter\";\nimport { html, css } from 'lit';\nimport { FilterRange } from \"@omegagrid/grid-core\";\nimport { Dropdown } from \"@omegagrid/core\";\nimport { RangeFilterApplyEvent, RangeFilterPopup, RangeFilterType, RangeValue } from \"./rangeFilterPopup\";\n\nconst isRangeTerm = (v: unknown): v is FilterRange =>\n\t!!v && typeof v === 'object' && !Array.isArray(v) && (v as FilterRange).kind === 'range';\n\nconst toDate = (v: unknown): Date | null => {\n\tif (v == null || v === '') return null;\n\tif (v instanceof Date) return v;\n\tconst d = new Date(v as string);\n\treturn Number.isNaN(d.getTime()) ? null : d;\n};\n\n@customElement(`${constants.PREFIX}-filter-range`)\nexport class RangeFilter extends BaseFilter {\n\n\tstatic styles = [...BaseFilter.styles, css`\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t\tbox-sizing: border-box;\n\t\t\theight: 100%;\n\t\t\twidth: 100%;\n\t\t}\n\n\t\tog-dropdown {\n\t\t\tdisplay: flex;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t}\n\t`];\n\n\t@query('og-dropdown')\n\tprivate dropdownEl: Dropdown;\n\n\t@query(`${constants.PREFIX}-filter-range-popup`)\n\tprivate popupEl: RangeFilterPopup;\n\n\tprivate get popupType(): RangeFilterType {\n\t\tconst t = this.columnModel?.type;\n\t\treturn (t === 'dt' || t === 'tm') ? t : 'd';\n\t}\n\n\tprivate _currentRange(): { from: RangeValue, to: RangeValue } {\n\t\tconst r = isRangeTerm(this.currentValue) ? this.currentValue : null;\n\t\tif (!r) return { from: null, to: null };\n\t\tswitch (this.popupType) {\n\t\t\tcase 'd':\n\t\t\tcase 'dt': return { from: toDate(r.from), to: toDate(r.to) };\n\t\t\tcase 'tm': return {\n\t\t\t\tfrom: r.from == null ? null : String(r.from),\n\t\t\t\tto: r.to == null ? null : String(r.to),\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate _formatLabel(): string {\n\t\tconst r = isRangeTerm(this.currentValue) ? this.currentValue : null;\n\t\tif (!r || (r.from == null && r.to == null)) return '';\n\t\tconst type = this.popupType;\n\t\tconst fmt = (v: unknown) => {\n\t\t\tif (v == null) return '';\n\t\t\tif (v instanceof Date) return v.toLocaleDateString();\n\t\t\tif (type === 'd' || type === 'dt') {\n\t\t\t\tconst d = toDate(v);\n\t\t\t\tif (d) return d.toLocaleDateString();\n\t\t\t}\n\t\t\treturn String(v);\n\t\t};\n\t\tconst from = fmt(r.from);\n\t\tconst to = fmt(r.to);\n\t\tif (from && to) return `${from} – ${to}`;\n\t\tif (from) return `≥ ${from}`;\n\t\treturn `≤ ${to}`;\n\t}\n\n\tprivate _onApply = (e: RangeFilterApplyEvent) => {\n\t\tif (e.from == null && e.to == null) {\n\t\t\tthis.clearFilter();\n\t\t} else {\n\t\t\tthis.filter({ kind: 'range', from: e.from, to: e.to } as FilterRange);\n\t\t}\n\t\tthis.dropdownEl?.close();\n\t\tthis.deactivate();\n\t}\n\n\tprivate _onClear = () => {\n\t\tthis.clearFilter();\n\t\tthis.dropdownEl?.close();\n\t\tthis.deactivate();\n\t}\n\n\trender = () => html`\n\t\t<og-dropdown color=\"transparent\" alignment=\"left\">\n\t\t\t<div slot=\"label\">${this._formatLabel()}</div>\n\t\t\t<og-filter-range-popup slot=\"content\"\n\t\t\t\ttype=\"${this.popupType}\"\n\t\t\t\t@apply=\"${this._onApply}\"\n\t\t\t\t@clear=\"${this._onClear}\">\n\t\t\t</og-filter-range-popup>\n\t\t</og-dropdown>\n\t`;\n\n\tactivate() {\n\t\tsuper.activate();\n\t\tconst { from, to } = this._currentRange();\n\t\tsetTimeout(() => {\n\t\t\tif (!this.activated) return; // closed before the delay ran out, e.g. by a scroll\n\t\t\tthis.popupEl?.setValues(from, to);\n\t\t\tthis.dropdownEl?.open();\n\t\t}, 50);\n\t}\n\n\tdeactivate() {\n\t\tthis.dropdownEl?.close();\n\t\tsuper.deactivate();\n\t}\n}\n"]}
|