gristlabs_grist-core/sandbox/grist
Alex Hall bf271c822b (core) Copy column type and options when pasting into an empty column
Summary:
Adds a `data-grist-col-ref` attribute to the copied HTML, then uses that when pasting to look up the source column and retrieve info about it. Copies the info into the target column if:

- The document is the same (the docId hash matches)
- The source column still exists and has the same type as when copied
- The source type isn't Text, because in that case it's nice if type guessing still happens
- The target column is empty, meaning it has type Any (we check earlier that it's not a formula column)

The info copied is the type, widgetOptions, and reference column settings (visible and display columns) but not conditional formatting.

The changes are mostly in a function `parsePasteForView` which is based on `BaseView._parsePasteForView` but ported to TypeScript in a new file `BaseView2.ts`.

Added a useraction `MaybeCopyDisplayFormula` exposing an existing Python function `maybe_copy_display_formula` because the target column needs a slightly different display formula.

Test Plan: Added a new nbrowser test file and fixture doc.

Reviewers: cyprien

Reviewed By: cyprien

Subscribers: jarek, dsagal

Differential Revision: https://phab.getgrist.com/D3344
2022-04-04 14:53:16 +02:00
..
functions (core) Replace compute stack and frames with _current_node and _current_row_id 2022-03-11 12:34:00 +02:00
imports (core) When importing JSON, create columns of type Numeric rather than Int 2022-03-30 09:54:35 -04:00
acl_formula.py
acl.py
action_obj.py
action_summary.py
actions.py
autocomplete_context.py
codebuilder.py
column.py
csv_patch.py
depend.py
docactions.py
docmodel.py (core) Conditional formatting rules 2022-03-23 13:15:02 +01:00
engine.py (core) Make lookups depend on all rows 2022-03-14 19:42:51 +02:00
gencode.py Correct spelling mistakes 2022-02-19 09:46:49 +00:00
gpath.py
grist.py
identifiers.py
import_actions.py (core) Lossless imports 2022-03-08 12:14:39 +02:00
logger.py
lookup.py (core) Make lookups depend on all rows 2022-03-14 19:42:51 +02:00
main.py (core) Log number of rows in user tables in data engine 2022-02-22 00:59:56 +02:00
match_counter.py
migrations.py (core) Conditional formatting rules 2022-03-23 13:15:02 +01:00
moment.py
objtypes.py
parse_data.py (core) Lossless imports 2022-03-08 12:14:39 +02:00
records.py
relabeling.py
relation.py
runtests.py
sandbox.py
schema.py (core) Conditional formatting rules 2022-03-23 13:15:02 +01:00
sort_specs.py
summary.py (core) Conditional formatting rules 2022-03-23 13:15:02 +01:00
table_data_set.py
table.py (core) Compute sample_record lazily using a property 2022-03-25 20:07:32 +02:00
test_acl_formula.py
test_acl_renames.py
test_actions.py
test_codebuilder.py
test_column_actions.py (core) Fuller guessing of type and options when adding first data to blank columns 2022-03-01 22:00:45 +02:00
test_completion.py (core) add a user.SessionID value for trigger formulas and granular access rules 2022-02-22 12:50:43 -05:00
test_default_formulas.py
test_depend.py
test_derived.py (core) Log number of rows in user tables in data engine 2022-02-22 00:59:56 +02:00
test_display_cols.py (core) Backend restrictions for raw data widgets 2022-02-15 22:04:32 +02:00
test_docmodel.py (core) Backend restrictions for raw data widgets 2022-02-15 22:04:32 +02:00
test_engine.py
test_find_col.py Correct spelling mistakes 2022-02-19 09:46:49 +00:00
test_formula_error.py
test_formula_undo.py
test_functions.py
test_gencode.py
test_gpath.py
test_import_actions.py
test_logger.py
test_lookups.py (core) Log number of rows in user tables in data engine 2022-02-22 00:59:56 +02:00
test_match_counter.py (core) Import Hashable from six.moves.collections_abc 2022-02-22 00:27:51 +02:00
test_migrations.py
test_moment.py
test_record_func.py
test_recordlist.py
test_reflist_rel.py
test_relabeling.py
test_renames2.py Correct spelling mistakes 2022-02-19 09:46:49 +00:00
test_renames.py (core) add a user.SessionID value for trigger formulas and granular access rules 2022-02-22 12:50:43 -05:00
test_replay.py
test_rules.py (core) Conditional formatting rules 2022-03-23 13:15:02 +01:00
test_side_effects.py
test_sort_spec.py
test_summary2.py
test_summary_choicelist.py (core) Log number of rows in user tables in data engine 2022-02-22 00:59:56 +02:00
test_summary_undo.py
test_summary.py
test_table_actions.py
test_table_data_set.py
test_temp_rowids.py
test_textbuilder.py
test_treeview.py
test_trigger_formulas.py (core) add a user.SessionID value for trigger formulas and granular access rules 2022-02-22 12:50:43 -05:00
test_twowaymap.py
test_types.py
test_undo.py
test_urllib_patch.py
test_user.py (core) add a user.SessionID value for trigger formulas and granular access rules 2022-02-22 12:50:43 -05:00
test_useractions.py (core) Log number of rows in user tables in data engine 2022-02-22 00:59:56 +02:00
testsamples.py
testscript.json (core) Log number of rows in user tables in data engine 2022-02-22 00:59:56 +02:00
testutil.py
textbuilder.py
treeview.py
twowaymap.py
tzdata.data
urllib_patch.py
user.py (core) add a user.SessionID value for trigger formulas and granular access rules 2022-02-22 12:50:43 -05:00
useractions.py (core) Copy column type and options when pasting into an empty column 2022-04-04 14:53:16 +02:00
usercode.py
usertypes.py
xmlrunner.py