Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(editors): add Clone functionality to Composite Editor #236

Merged
merged 21 commits into from
Jan 25, 2021

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Jan 14, 2021

  • clone allows you to select a row and clone it, the benefit is that it opens the Composite Editor with the selected row data context and by doing so it allows you to edit anything in the form before doing the actual clone (it's like a copy+edit in a single feature)

TODOs

  • allow to Clone a row and edit some of the fields
  • allow to Clone a row without doing any field edit
  • add onSave callback to all modal type, not just mass updates & return data context when possible
    • when cloning an item
    • when creating an item
    • when editing an item
  • add Jest unit tests
  • add Cypress E2E tests
  • updated readme with new functionality
  • remove eslint experimental
  • create Wiki
  • add all necessary Clone translation commands into Aurelia-Slickgrid

- clone allows you to select a row and clone it, the benefit is that it opens the Composite Editor with the selected row data context and then it allows you to edit anything in the form before doing the actual clone
- in some cases we could fall into an infinite loop if a field changes another field which changes the first field and we fall into inifinite... to resolve this, we can provide an extra paramater "triggeredBy" ("user" or "system") and the developer can change his code to make sure a system change doesn't run more than once to avoid the infinite loop from happening
@codecov
Copy link

codecov bot commented Jan 14, 2021

Codecov Report

Merging #236 (12c39db) into master (f64ed37) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master      #236    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          207       207            
  Lines        11931     11974    +43     
  Branches      3945      4117   +172     
==========================================
+ Hits         11931     11974    +43     
Impacted Files Coverage Δ
packages/common/src/constants.ts 100.00% <ø> (ø)
packages/common/src/formatters/formatters.index.ts 100.00% <ø> (ø)
packages/common/src/editors/autoCompleteEditor.ts 100.00% <100.00%> (ø)
packages/common/src/editors/checkboxEditor.ts 100.00% <100.00%> (ø)
packages/common/src/editors/dateEditor.ts 100.00% <100.00%> (ø)
packages/common/src/editors/dualInputEditor.ts 100.00% <100.00%> (ø)
packages/common/src/editors/floatEditor.ts 100.00% <100.00%> (ø)
packages/common/src/editors/integerEditor.ts 100.00% <100.00%> (ø)
packages/common/src/editors/longTextEditor.ts 100.00% <100.00%> (ø)
packages/common/src/editors/selectEditor.ts 100.00% <100.00%> (ø)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f64ed37...12c39db. Read the comment docs.

- add new cloned item data context to the onSave
- add applyChangesCallback to the onSave
- add post callback code to the mdal type switch/case
- the experimental code got moved into the `@typescript-eslint/no-unused-vars`, so this is no longer necessary
@ghiscoding ghiscoding changed the title feat(editors): add Clone functionality to Composite Editor WIP - feat(editors): add Clone functionality to Composite Editor Jan 18, 2021
- rename from `complexFieldLabel` to `complexField` but keep previous property as an alternative to avoid breaking anyone's code
- the applyChanges callback is kind of unnecessary, we could remove it. If developer wants to refresh the grid, it's his own decision and won't interfere with this applyChanges anyway. This way is better because we no longer require the user to call the applyChanges callback and we didn't want to rely on that for all the other create/clone/edit which can now also benefit from this
- when using ColumnPicker, GridMenu or hiding a column via HeaderMenu, it has to recalculate the frozenColumn index because SlickGrid doesn't take care of that and the previous fix that I implement sometimes become out of sync. This PR simplifies the frozenColumn index position, it will simply update it when the index is different, as simple as that.
- even if the property is not found in the item data context, we should still apply the value, SF often has undefined property and that is shown in the Example 12 on the first row on the "% complete" field
@ghiscoding ghiscoding changed the title WIP - feat(editors): add Clone functionality to Composite Editor feat(editors): add Clone functionality to Composite Editor Jan 22, 2021
@ghiscoding ghiscoding merged commit df545e4 into master Jan 25, 2021
@ghiscoding ghiscoding deleted the feat/composite-editor-clone branch January 25, 2021 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant