Skip to content

Commit

Permalink
Update to the development version of selectize.js (#3897)
Browse files Browse the repository at this point in the history
Co-authored-by: cpsievert <[email protected]>
  • Loading branch information
cpsievert and cpsievert authored Sep 15, 2023
1 parent eddc304 commit a6fc6bf
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 70 deletions.
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ plugins:
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.2.3.cjs
checksumBehavior: update
4 changes: 2 additions & 2 deletions inst/www/shared/selectize/css/selectize.bootstrap3.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inst/www/shared/selectize/js/selectize.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inst/www/shared/selectize/scss/selectize.scss
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ $select-spinner-border-color: $select-color-border;
cursor: text;
}

&:after {
&:not(.no-arrow):after {
content: " ";
display: block;
position: absolute;
Expand All @@ -340,7 +340,7 @@ $select-spinner-border-color: $select-color-border;
border-width: $select-arrow-size $select-arrow-size 0 $select-arrow-size;
border-color: $select-arrow-color transparent transparent transparent;
}
&.dropdown-active:after {
&:not(.no-arrow).dropdown-active:after {
margin-top: $select-arrow-size * -0.8;
border-width: 0 $select-arrow-size $select-arrow-size $select-arrow-size;
border-color: transparent transparent $select-arrow-color transparent;
Expand Down
14 changes: 1 addition & 13 deletions inst/www/shared/shiny.js
Original file line number Diff line number Diff line change
Expand Up @@ -8857,7 +8857,7 @@
if (!$el.hasClass("symbol")) {
return null;
}
if (this._isMultipleSelect($el)) {
if ($el.attr("multiple") === "multiple") {
return "shiny.symbolList";
} else {
return "shiny.symbol";
Expand Down Expand Up @@ -9029,13 +9029,6 @@
control.destroy();
control = this._newSelectize($el, settings);
}
if (this._isMultipleSelect($el)) {
control.on("item_add", function() {
var input = control.$control_input;
if (input && input.length)
input[0].focus();
});
}
return control;
}
}, {
Expand All @@ -9049,11 +9042,6 @@
shinyBindAll($el.parent());
return control;
}
}, {
key: "_isMultipleSelect",
value: function _isMultipleSelect($el) {
return $el.attr("multiple") === "multiple";
}
}]);
return SelectInputBinding2;
}(InputBinding);
Expand Down
4 changes: 2 additions & 2 deletions inst/www/shared/shiny.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inst/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@babel/preset-typescript": "^7.13.0",
"@babel/runtime": "^7.14.0",
"@deanc/esbuild-plugin-postcss": "^1.0.2",
"@selectize/selectize": "0.15.2",
"@selectize/selectize": "https://github.com/selectize/selectize.js.git#e3f2e0b4aa251375bc21b5fcd8ca7d374a921f08",
"@testing-library/dom": "^7.31.0",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/user-event": "^13.1.9",
Expand Down
18 changes: 1 addition & 17 deletions srcts/src/bindings/input/selectInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ type SelectInputReceiveMessageData = {
type SelectizeOptions = Selectize.IOptions<string, unknown>;
type SelectizeInfo = Selectize.IApi<string, unknown> & {
settings: SelectizeOptions;
// eslint-disable-next-line @typescript-eslint/naming-convention
$control_input?: JQuery<HTMLElement>;
};

function getLabelNode(el: SelectHTMLElement): JQuery<HTMLElement> {
Expand Down Expand Up @@ -55,7 +53,7 @@ class SelectInputBinding extends InputBinding {
// default character type
return null;
}
if (this._isMultipleSelect($el)) {
if ($el.attr("multiple") === "multiple") {
return "shiny.symbolList";
} else {
return "shiny.symbol";
Expand Down Expand Up @@ -297,17 +295,6 @@ class SelectInputBinding extends InputBinding {
control = this._newSelectize($el, settings);
}

// (Hopefully temporary) workaround for a v0.15.2 selectize bug where the
// dropdown (instead of the <input>) gets focus after an item added via
// click.
// FIXME: https://github.com/selectize/selectize.js/issues/2032
if (this._isMultipleSelect($el)) {
control.on("item_add", function () {
const input = control.$control_input;
if (input && input.length) input[0].focus();
});
}

return control;
}

Expand All @@ -325,9 +312,6 @@ class SelectInputBinding extends InputBinding {
if (binding) shinyBindAll($el.parent());
return control;
}
protected _isMultipleSelect($el: JQuery<HTMLElement>): boolean {
return $el.attr("multiple") === "multiple";
}
}

export { SelectInputBinding };
Expand Down
2 changes: 0 additions & 2 deletions srcts/types/src/bindings/input/selectInput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type SelectInputReceiveMessageData = {
type SelectizeOptions = Selectize.IOptions<string, unknown>;
type SelectizeInfo = Selectize.IApi<string, unknown> & {
settings: SelectizeOptions;
$control_input?: JQuery<HTMLElement>;
};
declare class SelectInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
Expand All @@ -36,7 +35,6 @@ declare class SelectInputBinding extends InputBinding {
initialize(el: SelectHTMLElement): void;
protected _selectize(el: SelectHTMLElement, update?: boolean): SelectizeInfo | undefined;
protected _newSelectize($el: JQuery<HTMLSelectElement>, options: SelectizeOptions): SelectizeInfo;
protected _isMultipleSelect($el: JQuery<HTMLElement>): boolean;
}
export { SelectInputBinding };
export type { SelectInputReceiveMessageData };
5 changes: 2 additions & 3 deletions tools/updateSelectize.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,16 @@ for (patch in list.files(patch_dir, full.names = TRUE)) {
# =============================================================================
# Add versions to files
# =============================================================================
version <- jsonlite::fromJSON("package.json")$devDependencies[["@selectize/selectize"]]
pkg_json <- jsonlite::fromJSON(file.path(node_dir, "../package.json"))
writeLines(
c(
"# Generated by tools/updateSelectize.R; do not edit by hand",
sprintf('version_selectize <- "%s"', version)
sprintf('version_selectize <- "%s"', pkg_json$version)
),
find_package_root_file("R", "version_selectize.R")
)



# =============================================================================
# Generate minified js
# =============================================================================
Expand Down
29 changes: 6 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1828,17 +1828,16 @@ __metadata:
languageName: node
linkType: hard

"@selectize/selectize@npm:0.15.2":
"@selectize/selectize@https://github.com/selectize/selectize.js.git#e3f2e0b4aa251375bc21b5fcd8ca7d374a921f08":
version: 0.15.2
resolution: "@selectize/selectize@npm:0.15.2"
dependencies:
jquery-ui: ^1.13.2
resolution: "@selectize/selectize@https://github.com/selectize/selectize.js.git#commit=e3f2e0b4aa251375bc21b5fcd8ca7d374a921f08"
peerDependencies:
jquery: ^1.7.0 || ^2 || ^3
dependenciesMeta:
jquery-ui: ^1.13.2
peerDependenciesMeta:
jquery-ui:
optional: true
checksum: 114f63a430b44a41e87d38364d17367d405b84f0e93baf48aca016f25fc449a21b876699d8ae0ebba5fca05a0ccb3564ed9d4ade0440404c15901eb08933a773
checksum: ba260ba5804c16b1455ff79f9d00ce860e12ae36e29d7a5f702da6b384c9454497421b8e06fe683d10fac53e2dc6ec008da4fa129a153cbbfe5396e027eb4247
languageName: node
linkType: hard

Expand Down Expand Up @@ -2198,7 +2197,7 @@ __metadata:
"@babel/preset-typescript": ^7.13.0
"@babel/runtime": ^7.14.0
"@deanc/esbuild-plugin-postcss": ^1.0.2
"@selectize/selectize": 0.15.2
"@selectize/selectize": "https://github.com/selectize/selectize.js.git#e3f2e0b4aa251375bc21b5fcd8ca7d374a921f08"
"@testing-library/dom": ^7.31.0
"@testing-library/jest-dom": ^5.12.0
"@testing-library/user-event": ^13.1.9
Expand Down Expand Up @@ -6741,22 +6740,6 @@ __metadata:
languageName: node
linkType: hard

"jquery-ui@npm:^1.13.2":
version: 1.13.2
resolution: "jquery-ui@npm:1.13.2"
dependencies:
jquery: ">=1.8.0 <4.0.0"
checksum: 0d04a4b86e703d6ff71bcc37335f99be137b03fa24fa22f00f61f5aac132e7143b7d6dd9973ad4f72366e102826e417bc3d88c1640f7dd824961a7131bd3966a
languageName: node
linkType: hard

"jquery@npm:>=1.8.0 <4.0.0":
version: 3.7.0
resolution: "jquery@npm:3.7.0"
checksum: 907785e133afc427650a131af5fccef66a404885037513b3d4d7d63aee6409bcc32a39836868c60e59b05aa0fb8ace8961c18b2ee3ffdf6ffdb571d6d7cd88ff
languageName: node
linkType: hard

"jquery@npm:^3.6.0":
version: 3.6.3
resolution: "jquery@npm:3.6.3"
Expand Down

0 comments on commit a6fc6bf

Please sign in to comment.