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: Drop jQuery requirement #734

Merged
merged 28 commits into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3df8a00
Drop jQuery requirement
MarkoBL Jan 25, 2023
054f05b
- removed jQuery from slick.groupitemmetadataprovider.js
MarkoBL Jan 25, 2023
7f56bdf
Rebase
MarkoBL Mar 6, 2023
897ae9f
- removed jQuery from slick.groupitemmetadataprovider.js
MarkoBL Jan 26, 2023
c10a9a1
fixed tests: example-checkbox-header-row.spec.js,
MarkoBL Jan 26, 2023
34cdfbc
fix test: example-composite-editor-modal-dialog.spec.js
MarkoBL Jan 27, 2023
79e8efc
fix test: example-composite-editor-modal-dialog.spec.js
MarkoBL Jan 27, 2023
29d9afa
moved slideUp/slideDown into Slick.Utils
MarkoBL Jan 28, 2023
afafcaa
Fixed Utils.position
MarkoBL Jan 28, 2023
5481602
Switched from mouseenter/mouseleave to mouseover/mouseout
MarkoBL Jan 28, 2023
4ce5e54
Use mouseenter/mouseleave on header and headerRow again, fixes test: …
MarkoBL Jan 31, 2023
b8436e9
Reworked EventData, fixed Drag and Drop, fixes test example-row-detai…
MarkoBL Jan 30, 2023
59ba584
fixed updateColumnHeader(), fixes test: example-draggable-grouping.sp…
MarkoBL Jan 31, 2023
0a8e2ab
fixed scrollTop/scrollLeft
MarkoBL Jan 31, 2023
cd517e3
Fixed Grid.ensureCellNodesInRowsCache, and other drag and drop relate…
MarkoBL Jan 31, 2023
a3b1603
fixed grid.getMaxSupportedCssHeight
MarkoBL Feb 1, 2023
a9e073b
some fixes
MarkoBL Feb 1, 2023
11ef8ae
Revert vscode tasks.json
MarkoBL Feb 1, 2023
6f7ba1c
fixing _footerRow exception
MarkoBL Feb 1, 2023
3451b55
Removed TreeColumns and unused variables
MarkoBL Feb 1, 2023
8fd7bd5
Revert "Removed TreeColumns and unused variables"
MarkoBL Feb 1, 2023
a899f70
Merge branch '6pac:master' into no-jquery
MarkoBL Mar 8, 2023
008ed88
PATCH: ensure frozen options are set before render. Fixes #727
6pac Mar 13, 2023
ae37d3c
Merge branch '6pac:master' into no-jquery
MarkoBL Mar 13, 2023
f711c24
Curly braces and other small changes requested by @ghiscoding
MarkoBL Mar 13, 2023
c5a8c25
Even more curly braces :)
MarkoBL Mar 13, 2023
def1727
fixed events
MarkoBL Mar 13, 2023
5367e73
ES5 syntax
MarkoBL Mar 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test: example-composite-editor-modal-dialog.spec.js
  • Loading branch information
MarkoBL committed Mar 6, 2023
commit 34cdfbcad13c28b23b8cba5f2f3a7142a9e87855
40 changes: 20 additions & 20 deletions slick.compositeeditor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function ($) {
(function () {
/***
* A composite SlickGrid editor factory.
* Generates an editor that is composed of multiple editors for given columns.
Expand Down Expand Up @@ -75,7 +75,7 @@
while (idx < columns.length) {
if (columns[idx].editor) {
var column = columns[idx];
newArgs = Slick.Utils.extend({}, args);
newArgs = Slick.Utils.extend(false, {}, args);
newArgs.container = containers[idx];
newArgs.column = column;
newArgs.position = getContainerBox(idx);
Expand Down Expand Up @@ -162,21 +162,21 @@
this.validate = function (targetElm) {
var validationResults;
var errors = [];
var $targetElm = targetElm ? $(targetElm) : null;
var targetElm = targetElm ? targetElm : null;

firstInvalidEditor = null;

var idx = 0;
while (idx < editors.length) {
var columnDef = editors[idx].args && editors[idx].args.column || {};
if (columnDef) {
var $validationElm = document.querySelector(".item-details-validation.editor-" + columnDef.id);
var $labelElm = document.querySelector(".item-details-label.editor-" + columnDef.id);
var $editorElm = document.querySelector("[data-editorid=" + columnDef.id + "]");
var validationElm = document.querySelector(".item-details-validation.editor-" + columnDef.id);
var labelElm = document.querySelector(".item-details-label.editor-" + columnDef.id);
var editorElm = document.querySelector("[data-editorid=" + columnDef.id + "]");
var validationMsgPrefix = options && options.validationMsgPrefix || "";

// ($editorElm.has($targetElm).length > 0)
if (!$targetElm || Slick.Utils.contains($editorElm, $targetElm)) {
if (!targetElm || ($(editorElm).has(targetElm).length > 0)/*Slick.Utils.contains($editorElm, $targetElm)*/) {
validationResults = editors[idx].validate();

if (!validationResults.valid) {
Expand All @@ -188,24 +188,24 @@
msg: validationResults.msg
});

if ($validationElm) {
$validationElm.textContent = validationMsgPrefix + validationResults.msg;
$labelElm.classList.add("invalid");
$editorElm.classList.add("invalid");
if (validationElm) {
validationElm.textContent = validationMsgPrefix + validationResults.msg;
labelElm.classList.add("invalid");
editorElm.classList.add("invalid");
}
} else if ($validationElm) {
$validationElm.textContent = "";
$editorElm.classList.remove("invalid");
$labelElm.classList.remove("invalid");
} else if (validationElm) {
validationElm.textContent = "";
editorElm.classList.remove("invalid");
labelElm.classList.remove("invalid");
}
}
$validationElm = null;
$labelElm = null;
$editorElm = null;
validationElm = null;
labelElm = null;
editorElm = null;
}
idx++;
}
$targetElm = null;
targetElm = null;

if (errors.length) {
return {
Expand Down Expand Up @@ -259,4 +259,4 @@
Slick.Utils.extend(Slick, {
CompositeEditor: CompositeEditor
});
})(jQuery);
})();
13 changes: 11 additions & 2 deletions slick.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,12 @@
}

function contains(parent, child) {
parent.contains(child);
const parents = parents(child);
return !parents.every((p) => {
if(parent == p)
return false;
return true;
});
}

function isHidden(el)
Expand Down Expand Up @@ -887,7 +892,7 @@
}
function extend() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[ 0 ] || {},
target = arguments[ 0 ],
i = 1,
length = arguments.length,
deep = true;
Copy link
Collaborator

@ghiscoding ghiscoding Apr 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the deep default property is wrong, it should be set to false since that would follow more closely jQuery.extend() and not cause surprises (and possibly breaking change) that I found myself. I found this to be a problem when in my own Slickgrid-Universal lib in which column filters were not showing up when they should be. Basically, the following code in SlickGrid should not be deep copied (the 1st argument is {} and in jQuery simply mean merge the 2 next arguments or assign to a new object {} when undefined)

var m = columns[i] = utils.extend({}, columnDefaults, columns[i]);

is supposed to be a shallow copy (work as a pointer), however because of this deep = true, it actually became a deep copy and is causing issues in my lib because my lib assume these column copies are shallow copy and not deep copy. After changing default to deep = false, that would also follow more closely the NodeJS implementation in external 3rd party lib node.extend

https://github.com/dreamerslab/node.extend/blob/62adee3327630c83f3d39395f7e275bfba281ecc/lib/extend.js#L47-L55

module.exports = function extend() {
  var target = arguments[0] || {};
  var i = 1;
  var length = arguments.length;
  var deep = false;
  var options, name, src, copy, copyIsArray, clone;
  // ....

Expand All @@ -896,6 +901,10 @@
target = arguments[ i ] || {};
i++;
}
else
{
target = target || {}
}
if ( typeof target !== "object" && !isFunction( target ) ) {
target = {};
}
Expand Down