Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
57 lines
1.8 KiB
JavaScript
57 lines
1.8 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = getScrollContainer;
|
|
var _getComputedStyle = _interopRequireDefault(require("./get-computed-style"));
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
/**
|
|
* Given a DOM node, finds the closest scrollable container node or the node
|
|
* itself, if scrollable.
|
|
*
|
|
* @param {Element | null} node Node from which to start.
|
|
* @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').
|
|
* Defaults to 'vertical'.
|
|
* @return {Element | undefined} Scrollable container node, if found.
|
|
*/
|
|
function getScrollContainer(node, direction = 'vertical') {
|
|
if (!node) {
|
|
return undefined;
|
|
}
|
|
if (direction === 'vertical' || direction === 'all') {
|
|
// Scrollable if scrollable height exceeds displayed...
|
|
if (node.scrollHeight > node.clientHeight) {
|
|
// ...except when overflow is defined to be hidden or visible
|
|
const {
|
|
overflowY
|
|
} = (0, _getComputedStyle.default)(node);
|
|
if (/(auto|scroll)/.test(overflowY)) {
|
|
return node;
|
|
}
|
|
}
|
|
}
|
|
if (direction === 'horizontal' || direction === 'all') {
|
|
// Scrollable if scrollable width exceeds displayed...
|
|
if (node.scrollWidth > node.clientWidth) {
|
|
// ...except when overflow is defined to be hidden or visible
|
|
const {
|
|
overflowX
|
|
} = (0, _getComputedStyle.default)(node);
|
|
if (/(auto|scroll)/.test(overflowX)) {
|
|
return node;
|
|
}
|
|
}
|
|
}
|
|
if (node.ownerDocument === node.parentNode) {
|
|
return node;
|
|
}
|
|
|
|
// Continue traversing.
|
|
return getScrollContainer( /** @type {Element} */node.parentNode, direction);
|
|
}
|
|
//# sourceMappingURL=get-scroll-container.js.map
|