@omegagrid/grid 0.11.11 → 0.11.13
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/dropdownList.d.ts +25 -0
- package/dist/editors/dropdownList.d.ts.map +1 -0
- package/dist/editors/dropdownList.js +73 -0
- package/dist/editors/dropdownList.js.map +1 -0
- package/dist/ui/grid.editing.d.ts +5 -0
- package/dist/ui/grid.editing.d.ts.map +1 -1
- package/dist/ui/grid.editing.js +30 -5
- package/dist/ui/grid.editing.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CellModel, CellValueType } from "@omegagrid/grid-core";
|
|
2
|
+
import { TreeAdapter, TreeOptions, TreeSource } from "@omegagrid/tree";
|
|
3
|
+
/** The items a dropdown cell takes its value from - the content of the cell, or the tree of its adapter. */
|
|
4
|
+
export declare class DropdownList {
|
|
5
|
+
/** false when the list may miss some items - a page of them, a result of a search, children loaded on expanding */
|
|
6
|
+
readonly complete: boolean;
|
|
7
|
+
private readonly byKey;
|
|
8
|
+
/** a text is a label first (the grid shows and copies the labels), then a key; an exact match before one ignoring the case */
|
|
9
|
+
private readonly byText;
|
|
10
|
+
constructor(source: TreeSource, options?: Partial<TreeOptions>);
|
|
11
|
+
/**
|
|
12
|
+
* The value a pasted one becomes: the key of the item it stands for with its label, as the dropdown editor commits
|
|
13
|
+
* them. A value missing in the list clears the cell, unless the cell allows invalid values or the list may miss
|
|
14
|
+
* the item - then the value stays as pasted.
|
|
15
|
+
*/
|
|
16
|
+
resolve(pasted: CellValueType, allowInvalid?: boolean): CellValueType;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The source of the list a value of a dropdown cell comes from - the content of the cell before its adapter, the same
|
|
20
|
+
* as in the dropdown editor. Null when the value is not limited by a list: no dropdown, an empty content (the editor
|
|
21
|
+
* offers just the current value then), or an editor of its own.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getDropdownListSource(cell: CellModel): TreeSource | TreeAdapter;
|
|
24
|
+
export declare function loadDropdownList(source: TreeSource | TreeAdapter): Promise<DropdownList>;
|
|
25
|
+
//# sourceMappingURL=dropdownList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdownList.d.ts","sourceRoot":"","sources":["../../src/editors/dropdownList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAc,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAa,WAAW,EAAa,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAkB7F,4GAA4G;AAC5G,qBAAa,YAAY;IAExB,mHAAmH;IACnH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,8HAA8H;IAC9H,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;gBAEtB,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC;IAc9D;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,UAAQ,GAAG,aAAa;CAenE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAM/E;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAI9F"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { utils } from "@omegagrid/core";
|
|
2
|
+
import { TreeModel } from "@omegagrid/tree";
|
|
3
|
+
/** A key or a label as the lookup compares them - the white space around does not count. */
|
|
4
|
+
const toText = (value) => (value ?? '').toString().trim();
|
|
5
|
+
/** Finds an item by its key or label, the first of the items of the same text wins - the one the list shows first. */
|
|
6
|
+
const createLookup = (items, property, ignoreCase) => {
|
|
7
|
+
const normalize = (value) => ignoreCase ? toText(value).toLocaleLowerCase() : toText(value);
|
|
8
|
+
const map = new Map();
|
|
9
|
+
for (const item of items) {
|
|
10
|
+
const text = normalize(item[property]);
|
|
11
|
+
if (text !== '' && !map.has(text))
|
|
12
|
+
map.set(text, item);
|
|
13
|
+
}
|
|
14
|
+
return (text) => text === '' ? undefined : map.get(normalize(text));
|
|
15
|
+
};
|
|
16
|
+
/** The items a dropdown cell takes its value from - the content of the cell, or the tree of its adapter. */
|
|
17
|
+
export class DropdownList {
|
|
18
|
+
constructor(source, options) {
|
|
19
|
+
const model = new TreeModel(source ?? [], null);
|
|
20
|
+
// a node without a checkbox cannot be picked, it is a heading of a group
|
|
21
|
+
const items = model.nodes.filter(node => node.key != null && node.checkbox !== false);
|
|
22
|
+
this.complete = !(options?.pageSize > 0) && !options?.customSearch && model.nodes.every(node => node.isLoaded);
|
|
23
|
+
this.byKey = createLookup(items, 'key', false);
|
|
24
|
+
this.byText = [
|
|
25
|
+
createLookup(items, 'value', false),
|
|
26
|
+
this.byKey,
|
|
27
|
+
createLookup(items, 'value', true),
|
|
28
|
+
createLookup(items, 'key', true),
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The value a pasted one becomes: the key of the item it stands for with its label, as the dropdown editor commits
|
|
33
|
+
* them. A value missing in the list clears the cell, unless the cell allows invalid values or the list may miss
|
|
34
|
+
* the item - then the value stays as pasted.
|
|
35
|
+
*/
|
|
36
|
+
resolve(pasted, allowInvalid = false) {
|
|
37
|
+
const props = utils.isObject(pasted) ? pasted : null;
|
|
38
|
+
if (props && !('v' in props))
|
|
39
|
+
return pasted; // no value pasted, e.g. just the formats
|
|
40
|
+
// a value copied from a grid is the key and its label comes along, a plain text is a label or a key
|
|
41
|
+
const key = props ? toText(props.v) : '';
|
|
42
|
+
const text = toText(props ? (props.dv ?? props.v) : pasted);
|
|
43
|
+
let item = this.byKey(key);
|
|
44
|
+
for (const lookup of this.byText)
|
|
45
|
+
item ?? (item = lookup(text));
|
|
46
|
+
if (item)
|
|
47
|
+
return { ...props, v: item.key, dv: item.value };
|
|
48
|
+
if ((key !== '' || text !== '') && (allowInvalid || !this.complete))
|
|
49
|
+
return pasted;
|
|
50
|
+
return props ? { ...props, v: null, dv: null } : null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The source of the list a value of a dropdown cell comes from - the content of the cell before its adapter, the same
|
|
55
|
+
* as in the dropdown editor. Null when the value is not limited by a list: no dropdown, an empty content (the editor
|
|
56
|
+
* offers just the current value then), or an editor of its own.
|
|
57
|
+
*/
|
|
58
|
+
export function getDropdownListSource(cell) {
|
|
59
|
+
if (cell.type !== 's' || cell.editorFactory)
|
|
60
|
+
return null;
|
|
61
|
+
const content = cell.editorContent;
|
|
62
|
+
if (content)
|
|
63
|
+
return Array.isArray(content) && content.length > 0 ? content : null;
|
|
64
|
+
const adapter = cell.adapter;
|
|
65
|
+
return typeof adapter?.getTree === 'function' ? adapter : null;
|
|
66
|
+
}
|
|
67
|
+
export async function loadDropdownList(source) {
|
|
68
|
+
if (Array.isArray(source))
|
|
69
|
+
return new DropdownList(source);
|
|
70
|
+
const [tree, options] = await Promise.all([source.getTree({}), source.getOptions()]);
|
|
71
|
+
return new DropdownList(tree, options);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=dropdownList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdownList.js","sourceRoot":"","sources":["../../src/editors/dropdownList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAA0B,SAAS,EAA2B,MAAM,iBAAiB,CAAC;AAI7F,4FAA4F;AAC5F,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;AAEnE,sHAAsH;AACtH,MAAM,YAAY,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id/core\";\nimport { CellModel, CellSource, CellValueType } from \"@omegagrid/grid-core\";\nimport { NodeModel, TreeAdapter, TreeModel, TreeOptions, TreeSource } from \"@omegagrid/tree\";\n\ntype Lookup = (text: string) => NodeModel;\n\n/** A key or a label as the lookup compares them - the white space around does not count. */\nconst toText = (value: unknown) => (value ?? '').toString().trim();\n\n/** Finds an item by its key or label, the first of the items of the same text wins - the one the list shows first. */\nconst createLookup = (items: NodeModel[], property: 'key'|'value', ignoreCase: boolean): Lookup => {\n\tconst normalize = (value: unknown) => ignoreCase ? toText(value).toLocaleLowerCase() : toText(value);\n\tconst map = new Map<string, NodeModel>();\n\tfor (const item of items) {\n\t\tconst text = normalize(item[property]);\n\t\tif (text !== '' && !map.has(text)) map.set(text, item);\n\t}\n\treturn (text: string) => text === '' ? undefined : map.get(normalize(text));\n};\n\n/** The items a dropdown cell takes its value from - the content of the cell, or the tree of its adapter. */\nexport class DropdownList {\n\n\t/** false when the list may miss some items - a page of them, a result of a search, children loaded on expanding */\n\treadonly complete: boolean;\n\n\tprivate readonly byKey: Lookup;\n\t/** a text is a label first (the grid shows and copies the labels), then a key; an exact match before one ignoring the case */\n\tprivate readonly byText: Lookup[];\n\n\tconstructor(source: TreeSource, options?: Partial<TreeOptions>) {\n\t\tconst model = new TreeModel(source ?? [], null);\n\t\t// a node without a checkbox cannot be picked, it is a heading of a group\n\t\tconst items = model.nodes.filter(node => node.key != null && node.checkbox !== false);\n\t\tthis.complete = !(options?.pageSize > 0) && !options?.customSearch && model.nodes.every(node => node.isLoaded);\n\t\tthis.byKey = createLookup(items, 'key', false);\n\t\tthis.byText = [\n\t\t\tcreateLookup(items, 'value', false),\n\t\t\tthis.byKey,\n\t\t\tcreateLookup(items, 'value', true),\n\t\t\tcreateLookup(items, 'key', true),\n\t\t];\n\t}\n\n\t/**\n\t * The value a pasted one becomes: the key of the item it stands for with its label, as the dropdown editor commits\n\t * them. A value missing in the list clears the cell, unless the cell allows invalid values or the list may miss\n\t * the item - then the value stays as pasted.\n\t */\n\tresolve(pasted: CellValueType, allowInvalid = false): CellValueType {\n\t\tconst props = utils.isObject(pasted) ? pasted as Partial<CellSource> : null;\n\t\tif (props && !('v' in props)) return pasted; // no value pasted, e.g. just the formats\n\n\t\t// a value copied from a grid is the key and its label comes along, a plain text is a label or a key\n\t\tconst key = props ? toText(props.v) : '';\n\t\tconst text = toText(props ? (props.dv ?? props.v) : pasted);\n\t\tlet item = this.byKey(key);\n\t\tfor (const lookup of this.byText) item ??= lookup(text);\n\n\t\tif (item) return {...props, v: item.key, dv: item.value};\n\t\tif ((key !== '' || text !== '') && (allowInvalid || !this.complete)) return pasted;\n\t\treturn props ? {...props, v: null, dv: null} : null;\n\t}\n\n}\n\n/**\n * The source of the list a value of a dropdown cell comes from - the content of the cell before its adapter, the same\n * as in the dropdown editor. Null when the value is not limited by a list: no dropdown, an empty content (the editor\n * offers just the current value then), or an editor of its own.\n */\nexport function getDropdownListSource(cell: CellModel): TreeSource | TreeAdapter {\n\tif (cell.type !== 's' || cell.editorFactory) return null;\n\tconst content = cell.editorContent as TreeSource;\n\tif (content) return Array.isArray(content) && content.length > 0 ? content : null;\n\tconst adapter = cell.adapter as TreeAdapter;\n\treturn typeof adapter?.getTree === 'function' ? adapter : null;\n}\n\nexport async function loadDropdownList(source: TreeSource | TreeAdapter): Promise<DropdownList> {\n\tif (Array.isArray(source)) return new DropdownList(source);\n\tconst [tree, options] = await Promise.all([source.getTree({}), source.getOptions()]);\n\treturn new DropdownList(tree, options);\n}\n"]}
|
|
@@ -49,6 +49,11 @@ export declare class GridEditing {
|
|
|
49
49
|
getSelectionCellData(): CellSource[][];
|
|
50
50
|
copySelection(): void;
|
|
51
51
|
private pasteMatrix;
|
|
52
|
+
/**
|
|
53
|
+
* A value pasted into a dropdown cell becomes the item of its list it stands for, see DropdownList.resolve;
|
|
54
|
+
* a list the cells share (an adapter of a column) is loaded once.
|
|
55
|
+
*/
|
|
56
|
+
private resolveDropdownValues;
|
|
52
57
|
private pasteText;
|
|
53
58
|
paste(): Promise<void>;
|
|
54
59
|
openComments(cell: CellModel): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.editing.d.ts","sourceRoot":"","sources":["../../src/ui/grid.editing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"grid.editing.d.ts","sourceRoot":"","sources":["../../src/ui/grid.editing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAA0D,aAAa,EAA2B,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC1K,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAI9B,MAAM,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAA;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC3C,WAAW,EAAE,MAAM,CAAA;CACnB,CAAC;AAEF,qBAAa,WAAW;IAmBX,QAAQ,CAAC,IAAI,EAAE,IAAI;IAjB/B,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,MAAM,CAAa;IAE3B,YAAY,UAAS;IACrB,SAAS,UAAS;IAElB,IAAI,KAAK,6CAA6B;IACtC,IAAI,SAAS,kDAAiC;IAC9C,IAAI,QAAQ,kCAAgC;IAC5C,IAAI,MAAM,uCAA8B;IACxC,IAAI,KAAK,4BAA6B;IACtC,IAAI,SAAS,YAA2B;IACxC,IAAI,YAAY,eAAyB;IAEzC,OAAO,CAAC,YAAY,CAAS;IAC7B,IAAI,aAAa,YAAiE;gBAE7D,IAAI,EAAE,IAAI;IAE/B,OAAO,CAAC,IAAI,EAAE,SAAS;IAIvB,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,GAAG,UAAU,EAAE,aAAa,UAAO,EAAE,WAAW,UAAQ;IAIxG,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,aAAa,GAAG,UAAU,CAAC,EAAE,EAAE,aAAa,UAAO,EAAE,WAAW,UAAQ;IA6DjH,gBAAgB;IAKhB,cAAc,CAAC,KAAK,UAAO;IAQ3B,SAAS,CAAC,YAAY,GAAE,OAAc;IAuBtC,OAAO;IASP,UAAU;IAOV,UAAU,CAAC,OAAO,EAAE,aAAa;IAYjC,aAAa,CAAC,OAAO,EAAE,aAAa;IAYpC,UAAU,CAAC,OAAO,EAAE,aAAa;IAYjC,aAAa,CAAC,OAAO,EAAE,aAAa;IAYpC,QAAQ,CAAC,OAAO,EAAE,aAAa;IAY/B,WAAW,CAAC,OAAO,EAAE,aAAa;IAYlC,cAAc,CAAC,aAAa,UAAO;IAMnC,SAAS,CAAC,IAAI,EAAE,SAAS;IAoBzB,gBAAgB;IAUhB,oBAAoB;IAMpB,aAAa;YA4BC,WAAW;IA4FzB;;;OAGG;YACW,qBAAqB;YAiBrB,SAAS;IAIjB,KAAK;IAoBX,YAAY,CAAC,IAAI,EAAE,SAAS;IAM5B,IAAI;IA6BJ,IAAI;IA6BJ,iBAAiB,CAAC,EAAE,EAAE,MAAM;IAI5B,KAAK,CAAC,KAAK,CAAC,EAAE,WAAW;IASzB,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW;CAW3B"}
|
package/dist/ui/grid.editing.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { csv, utils } from "@omegagrid/core";
|
|
2
2
|
import { FormulaEditor, getEditorFactory } from "../editors";
|
|
3
|
+
import { getDropdownListSource, loadDropdownList } from "../editors/dropdownList";
|
|
3
4
|
import { isFormula, hasQuotePrefix, stripQuotePrefix, CellRange, decodeColumn, decodeRow } from "@omegagrid/grid-core";
|
|
4
5
|
import { GridEditEvent, GridEvent } from "./grid.events";
|
|
5
6
|
import constants from "../constants";
|
|
@@ -264,7 +265,7 @@ export class GridEditing {
|
|
|
264
265
|
}
|
|
265
266
|
navigator.clipboard.write([new ClipboardItem(clipboardData)]).then(() => this.grid.logger.info("selected content copied"), () => this.grid.logger.error("copy rejected"));
|
|
266
267
|
}
|
|
267
|
-
pasteMatrix(data) {
|
|
268
|
+
async pasteMatrix(data) {
|
|
268
269
|
const range = this.selection.range;
|
|
269
270
|
const cells = [];
|
|
270
271
|
const cellValues = [];
|
|
@@ -336,11 +337,35 @@ export class GridEditing {
|
|
|
336
337
|
cells.push(cell);
|
|
337
338
|
}
|
|
338
339
|
}
|
|
340
|
+
await this.resolveDropdownValues(cells, cellValues);
|
|
339
341
|
this.updateCells(cells, cellValues, true);
|
|
340
342
|
this.grid.rendering.updateCells(cells, true);
|
|
341
343
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
/**
|
|
345
|
+
* A value pasted into a dropdown cell becomes the item of its list it stands for, see DropdownList.resolve;
|
|
346
|
+
* a list the cells share (an adapter of a column) is loaded once.
|
|
347
|
+
*/
|
|
348
|
+
async resolveDropdownValues(cells, values) {
|
|
349
|
+
const lists = new Map();
|
|
350
|
+
await Promise.all(cells.map(async (cell, i) => {
|
|
351
|
+
const source = getDropdownListSource(cell);
|
|
352
|
+
// a pasted formula stays a formula, its result is not an item of the list
|
|
353
|
+
const formula = this.model.formulasEnabled
|
|
354
|
+
&& (utils.isObject(values[i]) ? !!values[i].f : isFormula(values[i]));
|
|
355
|
+
if (!source || formula)
|
|
356
|
+
return;
|
|
357
|
+
if (!lists.has(source))
|
|
358
|
+
lists.set(source, loadDropdownList(source).catch(() => {
|
|
359
|
+
this.grid.logger.warn('dropdown list failed to load, the pasted values stay unchecked');
|
|
360
|
+
return null;
|
|
361
|
+
}));
|
|
362
|
+
const list = await lists.get(source);
|
|
363
|
+
if (list)
|
|
364
|
+
values[i] = list.resolve(values[i], cell.validation?.allowInvalid);
|
|
365
|
+
}));
|
|
366
|
+
}
|
|
367
|
+
async pasteText(text) {
|
|
368
|
+
await this.pasteMatrix(csv.csvToArray(text));
|
|
344
369
|
}
|
|
345
370
|
async paste() {
|
|
346
371
|
this.grid.selecting.hideCopySelector();
|
|
@@ -351,11 +376,11 @@ export class GridEditing {
|
|
|
351
376
|
const clipboardItem = clipboardItems[0];
|
|
352
377
|
if (clipboardItem.types.includes(constants.CUSTOM_CLIPBOARD_TYPE)) {
|
|
353
378
|
const data = await clipboardItem.getType(constants.CUSTOM_CLIPBOARD_TYPE);
|
|
354
|
-
this.pasteMatrix(JSON.parse(await data.text()));
|
|
379
|
+
await this.pasteMatrix(JSON.parse(await data.text()));
|
|
355
380
|
}
|
|
356
381
|
else if (clipboardItem.types.includes('text/plain')) {
|
|
357
382
|
const data = await clipboardItem.getType('text/plain');
|
|
358
|
-
this.pasteText(await data.text());
|
|
383
|
+
await this.pasteText(await data.text());
|
|
359
384
|
}
|
|
360
385
|
}
|
|
361
386
|
catch (_e) {
|
|
@@ -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,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,KAA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AAC,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,CAAC,KAAmB;QAC1B,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QACjE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI;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 { 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\tgetSelectionCellData() {\n\t\treturn this.model.getCellMatrix(this.selection.range).map(\n\t\t\trow => row.map(cell => cell.getSourceData({displayValue: true}))\n\t\t);\n\t}\n\n\tcopySelection() {\n\t\tconst customClipboardSupport = ClipboardItem.supports(constants.CUSTOM_CLIPBOARD_TYPE);\n\t\tconst values = this.model.getValuesInRange(this.selection.range, customClipboardSupport);\n\t\tthis.grid.selecting.hideSelector();\n\t\tthis.grid.selecting.showCopySelector();\n\n\t\tconst { columns, rows } = this.selection.range.size;\n\t\tlet csvText = csv.arrayToCsv(values, {decimalSeparator: this.model.options.systemDecimalSeparator});\n\t\tif (columns === 1 && rows === 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 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\tthis.updateCells(cells, cellValues, true);\n\t\tthis.grid.rendering.updateCells(cells, true);\n\t}\n\n\tprivate pasteText(text: string) {\n\t\tthis.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\tthis.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\tthis.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,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,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AO,CAAC,KAAmB;QAC1B,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QACjE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI;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\tgetSelectionCellData() {\n\t\treturn this.model.getCellMatrix(this.selection.range).map(\n\t\t\trow => row.map(cell => cell.getSourceData({displayValue: true}))\n\t\t);\n\t}\n\n\tcopySelection() {\n\t\tconst customClipboardSupport = ClipboardItem.supports(constants.CUSTOM_CLIPBOARD_TYPE);\n\t\tconst values = this.model.getValuesInRange(this.selection.range, customClipboardSupport);\n\t\tthis.grid.selecting.hideSelector();\n\t\tthis.grid.selecting.showCopySelector();\n\n\t\tconst { columns, rows } = this.selection.range.size;\n\t\tlet csvText = csv.arrayToCsv(values, {decimalSeparator: this.model.options.systemDecimalSeparator});\n\t\tif (columns === 1 && rows === 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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/grid",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.13",
|
|
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.13",
|
|
39
|
+
"@omegagrid/core": "^0.11.13",
|
|
40
|
+
"@omegagrid/grid-core": "^0.11.13",
|
|
41
|
+
"@omegagrid/localize": "^0.11.13",
|
|
42
|
+
"@omegagrid/tabs": "^0.11.13",
|
|
43
|
+
"@omegagrid/tree": "^0.11.13",
|
|
44
44
|
"@stdlib/stats": "^0.0.13",
|
|
45
45
|
"date-fns": "^3.2.0",
|
|
46
46
|
"lit": "^3.1.1",
|