diff --git a/demos/basic/breadcrumb.php b/demos/basic/breadcrumb.php index afb81606f2..38b47b5597 100644 --- a/demos/basic/breadcrumb.php +++ b/demos/basic/breadcrumb.php @@ -25,7 +25,8 @@ $model = new Country($app->db); $model->setLimit(15); -if ($id = $crumb->stickyGet('country_id')) { +$id = $crumb->stickyGet('country_id'); +if ($id) { // perhaps we edit individual country? $model = $model->load($id); $crumb->addCrumb($model->name, []); diff --git a/demos/collection/table.php b/demos/collection/table.php index 177e9e6e20..785eeae382 100644 --- a/demos/collection/table.php +++ b/demos/collection/table.php @@ -14,7 +14,7 @@ /** @var \Atk4\Ui\App $app */ require_once __DIR__ . '/../init-app.php'; -if ($id = $_GET['id'] ?? null) { +if ($_GET['id'] ?? null) { $app->layout->js(true, new JsToast('Details link is in simulation mode.')); } diff --git a/demos/form-control/lookup-dep.php b/demos/form-control/lookup-dep.php index 7e02349cbb..010b0c4b7d 100644 --- a/demos/form-control/lookup-dep.php +++ b/demos/form-control/lookup-dep.php @@ -42,7 +42,9 @@ $model->addCondition($model->fieldName()->name, 'like', $letter . '%'); } - isset($data['contains']) ? $model->addCondition($model->fieldName()->name, 'like', '%' . $data['contains'] . '%') : null; + if (isset($data['contains'])) { + $model->addCondition($model->fieldName()->name, 'like', '%' . $data['contains'] . '%'); + } }, 'placeholder' => 'Selection depends on Dropdown above', 'search' => [Country::hinting()->fieldName()->name, Country::hinting()->fieldName()->iso, Country::hinting()->fieldName()->iso3], @@ -72,7 +74,9 @@ Form\Control\Lookup::class, 'model' => new Country($app->db), 'dependency' => function (Country $model, $data) { - isset($data['ends_with']) ? $model->addCondition($model->fieldName()->name, 'like', '%' . $data['ends_with']) : null; + if (isset($data['ends_with'])) { + $model->addCondition($model->fieldName()->name, 'like', '%' . $data['ends_with']); + } }, 'multiple' => true, 'search' => [Country::hinting()->fieldName()->name, Country::hinting()->fieldName()->iso, Country::hinting()->fieldName()->iso3], diff --git a/docs/breadcrumb.rst b/docs/breadcrumb.rst index 495eb5543a..debbb47b38 100644 --- a/docs/breadcrumb.rst +++ b/docs/breadcrumb.rst @@ -56,7 +56,8 @@ For example the next code will use some logic:: $model = new User($app->db); - if ($id = $app->stickyGet('user_id')) { + $id = $app->stickyGet('user_id'); + if ($id) { // perhaps we edit individual user? $model = $model->load($id); $crumb->addCrumb($model->get('name'), []); diff --git a/js/.eslintrc.js b/js/.eslintrc.js index 5424a5a1c5..bd2faa3071 100644 --- a/js/.eslintrc.js +++ b/js/.eslintrc.js @@ -35,7 +35,6 @@ module.exports = { js: 'never', vue: 'never', }], - 'import/no-unresolved': 'off', 'import/prefer-default-export': 'off', indent: ['error', 4, { SwitchCase: 1, @@ -81,7 +80,6 @@ module.exports = { 'unicorn/no-this-assignment': 'off', 'unicorn/prefer-module': 'off', 'unicorn/prevent-abbreviations': 'off', - 'unicorn/switch-case-braces': ['error', 'avoid'], 'vue/attribute-hyphenation': ['error', 'never'], 'vue/html-indent': ['error', 4], }, diff --git a/js/src/plugins/file-upload.plugin.js b/js/src/plugins/file-upload.plugin.js index a332484333..65476ac3ef 100644 --- a/js/src/plugins/file-upload.plugin.js +++ b/js/src/plugins/file-upload.plugin.js @@ -93,7 +93,7 @@ export default class AtkFileUploadPlugin extends AtkPlugin { */ setState(mode) { switch (mode) { - case 'delete': + case 'delete': { this.action.html(this.getEraseContent); setTimeout(() => { this.bar.progress('reset'); @@ -101,7 +101,8 @@ export default class AtkFileUploadPlugin extends AtkPlugin { }, 1000); break; - case 'upload': + } + case 'upload': { this.action.html(this.actionContent); this.textInput.val(''); this.fileInput.val(''); @@ -109,6 +110,7 @@ export default class AtkFileUploadPlugin extends AtkPlugin { this.$el.data().fileId = null; break; + } } } diff --git a/js/src/services/vue.service.js b/js/src/services/vue.service.js index db0cff6da2..fac420977e 100644 --- a/js/src/services/vue.service.js +++ b/js/src/services/vue.service.js @@ -66,7 +66,7 @@ class VueService { if (registry[name] === undefined && registry[camelize(name)] === undefined) { const namePascalized = capitalize(camelize(name)); if (registry[namePascalized] === undefined && vueFomanticUiComponentNamesSet.has(namePascalized)) { - registry[namePascalized] = asyncComponentFactory(namePascalized, () => (import('vue-fomantic-ui')).then((r) => r[namePascalized])); + registry[namePascalized] = asyncComponentFactory(namePascalized, () => (import('vue-fomantic-ui')).then((r) => r[namePascalized])); // eslint-disable-line import/no-unresolved } } }; diff --git a/js/src/vue-components/multiline/multiline-header.component.js b/js/src/vue-components/multiline/multiline-header.component.js index c08cd3a24a..55f9690d44 100644 --- a/js/src/vue-components/multiline/multiline-header.component.js +++ b/js/src/vue-components/multiline/multiline-header.component.js @@ -53,10 +53,11 @@ export default { switch (column.type) { case 'integer': case 'float': - case 'atk4_money': + case 'atk4_money': { align = 'right'; break; + } } } diff --git a/js/src/vue-components/query-builder/fomantic-ui-rule.component.vue b/js/src/vue-components/query-builder/fomantic-ui-rule.component.vue index 79372e5a99..692cf9f977 100644 --- a/js/src/vue-components/query-builder/fomantic-ui-rule.component.vue +++ b/js/src/vue-components/query-builder/fomantic-ui-rule.component.vue @@ -164,11 +164,21 @@ export default { } switch (type) { - case 'input': return this.isInput; - case 'checkbox': return this.isCheckbox; - case 'select': return this.isSelect; - case 'custom-component': return this.isComponent; - default: return false; + case 'input': { + return this.isInput; + } + case 'checkbox': { + return this.isCheckbox; + } + case 'select': { + return this.isSelect; + } + case 'custom-component': { + return this.isComponent; + } + default: { + return false; + } } }, }, diff --git a/js/src/vue-components/tree-item-selector/tree-item-selector.component.js b/js/src/vue-components/tree-item-selector/tree-item-selector.component.js index 517bf1361c..e3df3db402 100644 --- a/js/src/vue-components/tree-item-selector/tree-item-selector.component.js +++ b/js/src/vue-components/tree-item-selector/tree-item-selector.component.js @@ -172,14 +172,16 @@ export default { onToggleSelect: function () { const { options } = this.getRootData(); switch (options.mode) { - case 'single': + case 'single': { this.handleSingleSelect(); break; - case 'multiple': + } + case 'multiple': { this.handleMultipleSelect(); break; + } } }, /** diff --git a/js/webpack.config.js b/js/webpack.config.js index 72e3f5f4f8..3ad9fda6c2 100644 --- a/js/webpack.config.js +++ b/js/webpack.config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const webpack = require('webpack'); const { VueLoaderPlugin } = require('vue-loader'); const TerserPlugin = require('terser-webpack-plugin'); -const VueFomanticUi = require('vue-fomantic-ui'); +const VueFomanticUi = require('vue-fomantic-ui'); // eslint-disable-line import/no-unresolved module.exports = (env) => { const isProduction = env === undefined ? false /* for eslint-import-resolver-webpack */ : env.production; diff --git a/public/external/jquery/dist/jquery.js b/public/external/jquery/dist/jquery.js index 12e65d069f..baea4451f0 100644 --- a/public/external/jquery/dist/jquery.js +++ b/public/external/jquery/dist/jquery.js @@ -1,5 +1,5 @@ /*! - * jQuery JavaScript Library v3.6.1 + * jQuery JavaScript Library v3.6.2 * https://jquery.com/ * * Includes Sizzle.js @@ -9,7 +9,7 @@ * Released under the MIT license * https://jquery.org/license * - * Date: 2022-08-26T17:52Z + * Date: 2022-12-13T14:56Z */ ( function( global, factory ) { @@ -151,7 +151,7 @@ function toType( obj ) { var - version = "3.6.1", + version = "3.6.2", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -522,14 +522,14 @@ function isArrayLike( obj ) { } var Sizzle = /*! - * Sizzle CSS Selector Engine v2.3.6 + * Sizzle CSS Selector Engine v2.3.8 * https://sizzlejs.com/ * * Copyright JS Foundation and other contributors * Released under the MIT license * https://js.foundation/ * - * Date: 2021-02-16 + * Date: 2022-11-16 */ ( function( window ) { var i, @@ -879,6 +879,27 @@ function Sizzle( selector, context, results, seed ) { } try { + + // `qSA` may not throw for unrecognized parts using forgiving parsing: + // https://drafts.csswg.org/selectors/#forgiving-selector + // like the `:has()` pseudo-class: + // https://drafts.csswg.org/selectors/#relational + // `CSS.supports` is still expected to return `false` then: + // https://drafts.csswg.org/css-conditional-4/#typedef-supports-selector-fn + // https://drafts.csswg.org/css-conditional-4/#dfn-support-selector + if ( support.cssSupportsSelector && + + // eslint-disable-next-line no-undef + !CSS.supports( "selector(" + newSelector + ")" ) ) { + + // Support: IE 11+ + // Throw to get to the same code path as an error directly in qSA. + // Note: once we only support browser supporting + // `CSS.supports('selector(...)')`, we can most likely drop + // the `try-catch`. IE doesn't implement the API. + throw new Error(); + } + push.apply( results, newContext.querySelectorAll( newSelector ) ); @@ -1174,6 +1195,31 @@ setDocument = Sizzle.setDocument = function( node ) { !el.querySelectorAll( ":scope fieldset div" ).length; } ); + // Support: Chrome 105+, Firefox 104+, Safari 15.4+ + // Make sure forgiving mode is not used in `CSS.supports( "selector(...)" )`. + // + // `:is()` uses a forgiving selector list as an argument and is widely + // implemented, so it's a good one to test against. + support.cssSupportsSelector = assert( function() { + /* eslint-disable no-undef */ + + return CSS.supports( "selector(*)" ) && + + // Support: Firefox 78-81 only + // In old Firefox, `:is()` didn't use forgiving parsing. In that case, + // fail this test as there's no selector to test against that. + // `CSS.supports` uses unforgiving parsing + document.querySelectorAll( ":is(:jqfake)" ) && + + // `*` is needed as Safari & newer Chrome implemented something in between + // for `:has()` - it throws in `qSA` if it only contains an unsupported + // argument but multiple ones, one of which is supported, are fine. + // We want to play safe in case `:is()` gets the same treatment. + !CSS.supports( "selector(:is(*,:jqfake))" ); + + /* eslint-enable */ + } ); + /* Attributes ---------------------------------------------------------------------- */ @@ -1440,6 +1486,18 @@ setDocument = Sizzle.setDocument = function( node ) { } ); } + if ( !support.cssSupportsSelector ) { + + // Support: Chrome 105+, Safari 15.4+ + // `:has()` uses a forgiving selector list as an argument so our regular + // `try-catch` mechanism fails to catch `:has()` with arguments not supported + // natively like `:has(:contains("Foo"))`. Where supported & spec-compliant, + // we now use `CSS.supports("selector(SELECTOR_TO_BE_TESTED)")` but outside + // that, let's mark `:has` as buggy to always use jQuery traversal for + // `:has()`. + rbuggyQSA.push( ":has" ); + } + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); @@ -1452,7 +1510,14 @@ setDocument = Sizzle.setDocument = function( node ) { // As in, an element does not contain itself contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, + + // Support: IE <9 only + // IE doesn't have `contains` on `document` so we need to check for + // `documentElement` presence. + // We need to fall back to `a` when `documentElement` is missing + // as `ownerDocument` of elements within `