diff --git a/packages/primevue/src/cascadeselect/style/CascadeSelectStyle.js b/packages/primevue/src/cascadeselect/style/CascadeSelectStyle.js index 9b389af0b..b3b2e1aa6 100644 --- a/packages/primevue/src/cascadeselect/style/CascadeSelectStyle.js +++ b/packages/primevue/src/cascadeselect/style/CascadeSelectStyle.js @@ -271,7 +271,7 @@ const classes = { 'p-cascadeselect-label', { 'p-placeholder': instance.label === props.placeholder, - 'p-cascadeselect-label-empty': !instance.$slots['value'] && (instance.label === 'p-emptylabel' || instance.label.length === 0) + 'p-cascadeselect-label-empty': !instance.$slots['value'] && (instance.label === 'p-emptylabel' || instance.label?.length === 0) } ], clearIcon: 'p-cascadeselect-clear-icon', diff --git a/packages/primevue/src/datepicker/DatePicker.vue b/packages/primevue/src/datepicker/DatePicker.vue index 198c4c0fa..92d3288d5 100755 --- a/packages/primevue/src/datepicker/DatePicker.vue +++ b/packages/primevue/src/datepicker/DatePicker.vue @@ -1329,6 +1329,8 @@ export default { if (lookAhead(match)) { while (num.length < len) { num = '0' + num; + this.selectionStart = this.selectionStart + 1; + this.selectionEnd = this.selectionEnd + 1; } } diff --git a/packages/primevue/src/select/Select.vue b/packages/primevue/src/select/Select.vue index 8bc9c760b..4dd99e211 100755 --- a/packages/primevue/src/select/Select.vue +++ b/packages/primevue/src/select/Select.vue @@ -798,7 +798,10 @@ export default { hasFocusableElements() { return getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0; }, - isOptionMatched(option) { + isOptionExactMatched(option) { + return this.isValidOption(option) && typeof this.getOptionLabel(option) === 'string' && this.getOptionLabel(option)?.toLocaleLowerCase(this.filterLocale) == this.searchValue.toLocaleLowerCase(this.filterLocale); + }, + isOptionStartsWith(option) { return this.isValidOption(option) && typeof this.getOptionLabel(option) === 'string' && this.getOptionLabel(option)?.toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale)); }, isValidOption(option) { @@ -846,11 +849,10 @@ export default { let matched = false; if (isNotEmpty(this.searchValue)) { - if (this.focusedOptionIndex !== -1) { - optionIndex = this.visibleOptions.slice(this.focusedOptionIndex).findIndex((option) => this.isOptionMatched(option)); - optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionIndex).findIndex((option) => this.isOptionMatched(option)) : optionIndex + this.focusedOptionIndex; - } else { - optionIndex = this.visibleOptions.findIndex((option) => this.isOptionMatched(option)); + optionIndex = this.visibleOptions.findIndex((option) => this.isOptionExactMatched(option)); + + if (optionIndex === -1) { + optionIndex = this.visibleOptions.findIndex((option) => this.isOptionStartsWith(option)); } if (optionIndex !== -1) { diff --git a/packages/primevue/src/tree/Tree.spec.js b/packages/primevue/src/tree/Tree.spec.js index 848212857..92394a609 100644 --- a/packages/primevue/src/tree/Tree.spec.js +++ b/packages/primevue/src/tree/Tree.spec.js @@ -50,6 +50,7 @@ describe('Tree.vue', () => { let searchField = wrapper.find('input.p-inputtext'); const key = 't'; + searchField.element.value = key; await searchField.trigger('keyup', { diff --git a/packages/primevue/src/virtualscroller/VirtualScroller.vue b/packages/primevue/src/virtualscroller/VirtualScroller.vue index ac947c07d..f2a05e8df 100644 --- a/packages/primevue/src/virtualscroller/VirtualScroller.vue +++ b/packages/primevue/src/virtualscroller/VirtualScroller.vue @@ -91,11 +91,12 @@ export default { this.d_loading = newValue; } }, - items(newValue, oldValue) { - if (!oldValue || oldValue.length !== (newValue || []).length) { + items: { + handler(newValue) { this.init(); this.calculateAutoSize(); - } + }, + deep: true }, itemSize() { this.init(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0f2dc885d..897124def 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -55,7 +55,7 @@ importers: version: 9.32.0(eslint@8.57.1) pnpm: specifier: ^9.6.0 - version: 9.15.1 + version: 9.15.2 prettier: specifier: 2.7.1 version: 2.7.1 @@ -4864,15 +4864,15 @@ packages: resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} engines: {node: '>= 6'} - pkg-types@1.2.1: - resolution: {integrity: sha512-sQoqa8alT3nHjGuTjuKgOnvjo4cljkufdtLMnO2LBP/wRwuDlo1tkaEdMxCRhyGRPacv/ztlZgDPm2b7FAmEvw==} + pkg-types@1.3.0: + resolution: {integrity: sha512-kS7yWjVFCkIw9hqdJBoMxDdzEngmkr5FXeWZZfQ6GoYacjVnsW6l2CcYW/0ThD0vF4LPJgVYnrg4d0uuhwYQbg==} pluralize@8.0.0: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} engines: {node: '>=4'} - pnpm@9.15.1: - resolution: {integrity: sha512-GstWXmGT7769p3JwKVBGkVDPErzHZCYudYfnHRncmKQj3/lTblfqRMSb33kP9pToPCe+X6oj1n4MAztYO+S/zw==} + pnpm@9.15.2: + resolution: {integrity: sha512-k+V7ASbw33TOa/8paAOUwLpU7Ecka5zzIfASHY2bsD91CnBfJO3DwRgIU6/XwsO5QZbQo9U9PgadnieT7xHzIQ==} engines: {node: '>=18.12'} hasBin: true @@ -5312,8 +5312,8 @@ packages: resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==} engines: {node: ^10 || ^12 || >=14} - preact@10.25.3: - resolution: {integrity: sha512-dzQmIFtM970z+fP9ziQ3yG4e3ULIbwZzJ734vaMVUTaKQ2+Ru1Ou/gjshOYVHCcd1rpAelC6ngjvjDXph98unQ==} + preact@10.25.4: + resolution: {integrity: sha512-jLdZDb+Q+odkHJ+MpW/9U5cODzqnB+fy2EiHSZES7ldV5LK7yjlVzTp7R8Xy6W6y75kfK8iWYtFVH7lvjwrCMA==} prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} @@ -5996,8 +5996,8 @@ packages: tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} - tinyexec@0.3.1: - resolution: {integrity: sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==} + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} tinyglobby@0.2.10: resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==} @@ -6228,12 +6228,12 @@ packages: resolution: {integrity: sha512-5liCNPuJW8dqh3+DM6uNM2EI3MLLpCKp/KY+9pB5M2S2SR2qvvDHhKgBOaTWEbZTAws3CXfB0rKTIolWKL05VQ==} engines: {node: '>=14.0.0'} - unplugin@2.1.0: - resolution: {integrity: sha512-us4j03/499KhbGP8BU7Hrzrgseo+KdfJYWcbcajCOqsAyb8Gk0Yn2kiUIcZISYCb1JFaZfIuG3b42HmguVOKCQ==} + unplugin@2.1.2: + resolution: {integrity: sha512-Q3LU0e4zxKfRko1wMV2HmP8lB9KWislY7hxXpxd+lGx0PRInE4vhMBVEZwpdVYHvtqzhSrzuIfErsob6bQfCzw==} engines: {node: '>=18.12.0'} - unstorage@1.14.3: - resolution: {integrity: sha512-nj1rtc2XWCck2fDB39sboAajqooj9LmxZ9/eBM1XR+iUQAFctKvLl0FcPP5f4vzRgU1dmJ03SZhqZMLc9RDXIA==} + unstorage@1.14.4: + resolution: {integrity: sha512-1SYeamwuYeQJtJ/USE1x4l17LkmQBzg7deBJ+U9qOBoHo15d1cDxG4jM31zKRgF7pG0kirZy4wVMX6WL6Zoscg==} peerDependencies: '@azure/app-configuration': ^1.8.0 '@azure/cosmos': ^4.2.0 @@ -7601,7 +7601,7 @@ snapshots: '@docsearch/js@3.8.2(@algolia/client-search@5.18.0)(search-insights@2.17.3)': dependencies: '@docsearch/react': 3.8.2(@algolia/client-search@5.18.0)(search-insights@2.17.3) - preact: 10.25.3 + preact: 10.25.4 transitivePeerDependencies: - '@algolia/client-search' - '@types/react' @@ -8200,7 +8200,7 @@ snapshots: global-dirs: 3.0.1 magicast: 0.3.5 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 prompts: 2.4.2 rc9: 2.1.2 semver: 7.6.3 @@ -8233,7 +8233,7 @@ snapshots: pacote: 17.0.7 pathe: 1.1.2 perfect-debounce: 1.0.0 - pkg-types: 1.2.1 + pkg-types: 1.3.0 rc9: 2.1.2 semver: 7.6.3 simple-git: 3.27.0 @@ -8279,7 +8279,7 @@ snapshots: mlly: 1.7.3 ohash: 1.1.4 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 semver: 7.6.3 ufo: 1.5.4 @@ -8306,7 +8306,7 @@ snapshots: mlly: 1.7.3 ohash: 1.1.4 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 semver: 7.6.3 ufo: 1.5.4 @@ -8333,7 +8333,7 @@ snapshots: mlly: 1.7.3 ohash: 1.1.4 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 semver: 7.6.3 ufo: 1.5.4 @@ -8360,7 +8360,7 @@ snapshots: lodash.template: 4.5.0 mlly: 1.7.3 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 semver: 7.6.3 unctx: 2.4.1 @@ -8385,7 +8385,7 @@ snapshots: lodash.template: 4.5.0 mlly: 1.7.3 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 semver: 7.6.3 unctx: 2.4.1 @@ -8406,7 +8406,7 @@ snapshots: mlly: 1.7.3 nuxi: 3.3.2 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 tsconfck: 3.1.4(typescript@5.7.2) unbuild: 2.0.0(typescript@5.7.2) transitivePeerDependencies: @@ -8423,7 +8423,7 @@ snapshots: defu: 6.1.4 hookable: 5.5.3 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 std-env: 3.8.0 ufo: 1.5.4 @@ -8443,7 +8443,7 @@ snapshots: defu: 6.1.4 hookable: 5.5.3 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 std-env: 3.8.0 ufo: 1.5.4 @@ -8463,7 +8463,7 @@ snapshots: hookable: 5.5.3 jiti: 1.21.7 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 postcss-import-resolver: 2.0.0 scule: 1.3.0 std-env: 3.8.0 @@ -8483,7 +8483,7 @@ snapshots: hookable: 5.5.3 jiti: 1.21.7 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 postcss-import-resolver: 2.0.0 scule: 1.3.0 std-env: 3.8.0 @@ -8558,10 +8558,10 @@ snapshots: radix3: 1.1.2 scule: 1.3.0 std-env: 3.8.0 - tinyexec: 0.3.1 + tinyexec: 0.3.2 ufo: 1.5.4 unenv: 1.10.0 - unplugin: 2.1.0 + unplugin: 2.1.2 vite: 5.4.11(@types/node@18.19.68)(terser@5.37.0) vitest-environment-nuxt: 1.0.1(@types/node@18.19.68)(@vue/test-utils@2.4.6)(magicast@0.3.5)(rollup@4.29.1)(terser@5.37.0)(typescript@5.7.2)(vitest@1.6.0(@types/node@18.19.68)(terser@5.37.0)) vue: 3.5.13(typescript@5.7.2) @@ -8608,7 +8608,7 @@ snapshots: ohash: 1.1.4 pathe: 1.1.2 perfect-debounce: 0.1.3 - pkg-types: 1.2.1 + pkg-types: 1.3.0 postcss: 8.4.49 postcss-import: 15.1.0(postcss@8.4.49) postcss-url: 10.1.3(postcss@8.4.49) @@ -8667,7 +8667,7 @@ snapshots: ohash: 1.1.4 pathe: 1.1.2 perfect-debounce: 0.1.3 - pkg-types: 1.2.1 + pkg-types: 1.3.0 postcss: 8.4.49 postcss-import: 15.1.0(postcss@8.4.49) postcss-url: 10.1.3(postcss@8.4.49) @@ -9865,7 +9865,7 @@ snapshots: ohash: 1.1.4 pathe: 1.1.2 perfect-debounce: 1.0.0 - pkg-types: 1.2.1 + pkg-types: 1.3.0 rc9: 2.1.2 optionalDependencies: magicast: 0.3.5 @@ -9882,7 +9882,7 @@ snapshots: ohash: 1.1.4 pathe: 1.1.2 perfect-debounce: 1.0.0 - pkg-types: 1.2.1 + pkg-types: 1.3.0 rc9: 2.1.2 optionalDependencies: magicast: 0.3.5 @@ -9947,7 +9947,7 @@ snapshots: ofetch: 1.4.1 open: 10.1.0 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 semver: 7.6.3 std-env: 3.8.0 @@ -11451,7 +11451,7 @@ snapshots: local-pkg@0.5.1: dependencies: mlly: 1.7.3 - pkg-types: 1.2.1 + pkg-types: 1.3.0 locate-path@6.0.0: dependencies: @@ -11686,7 +11686,7 @@ snapshots: jiti: 1.21.7 mlly: 1.7.3 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 postcss: 8.4.49 postcss-nested: 6.2.0(postcss@8.4.49) semver: 7.6.3 @@ -11698,7 +11698,7 @@ snapshots: dependencies: acorn: 8.14.0 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 ufo: 1.5.4 mri@1.2.0: {} @@ -11775,7 +11775,7 @@ snapshots: openapi-typescript: 7.4.4(encoding@0.1.13)(typescript@5.7.2) pathe: 1.1.2 perfect-debounce: 1.0.0 - pkg-types: 1.2.1 + pkg-types: 1.3.0 pretty-bytes: 6.1.1 radix3: 1.1.2 rollup: 4.29.1 @@ -11790,7 +11790,7 @@ snapshots: unctx: 2.4.1 unenv: 1.10.0 unimport: 3.14.5(rollup@4.29.1) - unstorage: 1.14.3(db0@0.2.1)(ioredis@5.4.2) + unstorage: 1.14.4(db0@0.2.1)(ioredis@5.4.2) untyped: 1.5.2 unwasm: 0.3.9 transitivePeerDependencies: @@ -11865,7 +11865,7 @@ snapshots: ohash: 1.1.4 pathe: 1.1.2 perfect-debounce: 0.1.3 - pkg-types: 1.2.1 + pkg-types: 1.3.0 pretty-bytes: 6.1.1 radix3: 1.1.2 rollup: 3.29.5 @@ -11879,7 +11879,7 @@ snapshots: ufo: 1.5.4 unenv: 1.10.0 unimport: 3.14.5(rollup@3.29.5) - unstorage: 1.14.3(db0@0.2.1)(ioredis@5.4.2) + unstorage: 1.14.4(db0@0.2.1)(ioredis@5.4.2) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -12204,7 +12204,7 @@ snapshots: consola: 3.3.3 execa: 8.0.1 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 ufo: 1.5.4 object-assign@4.1.1: {} @@ -12404,7 +12404,7 @@ snapshots: pirates@4.0.6: {} - pkg-types@1.2.1: + pkg-types@1.3.0: dependencies: confbox: 0.1.8 mlly: 1.7.3 @@ -12412,7 +12412,7 @@ snapshots: pluralize@8.0.0: {} - pnpm@9.15.1: {} + pnpm@9.15.2: {} postcss-calc@10.0.2(postcss@8.4.49): dependencies: @@ -12813,7 +12813,7 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 - preact@10.25.3: {} + preact@10.25.4: {} prelude-ls@1.2.1: {} @@ -13563,7 +13563,7 @@ snapshots: tinybench@2.9.0: {} - tinyexec@0.3.1: {} + tinyexec@0.3.2: {} tinyglobby@0.2.10: dependencies: @@ -13636,7 +13636,7 @@ snapshots: rollup: 4.29.1 source-map: 0.8.0-beta.0 sucrase: 3.35.0 - tinyexec: 0.3.1 + tinyexec: 0.3.2 tinyglobby: 0.2.10 tree-kill: 1.2.2 optionalDependencies: @@ -13706,7 +13706,7 @@ snapshots: mkdist: 1.6.0(typescript@5.7.2) mlly: 1.7.3 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 pretty-bytes: 6.1.1 rollup: 3.29.5 rollup-plugin-dts: 6.1.1(rollup@3.29.5)(typescript@5.7.2) @@ -13726,7 +13726,7 @@ snapshots: acorn: 8.14.0 estree-walker: 3.0.3 magic-string: 0.30.17 - unplugin: 2.1.0 + unplugin: 2.1.2 undici-types@5.26.5: {} @@ -13770,7 +13770,7 @@ snapshots: mlly: 1.7.3 pathe: 1.1.2 picomatch: 4.0.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 strip-literal: 2.1.1 unplugin: 1.16.0 @@ -13789,7 +13789,7 @@ snapshots: mlly: 1.7.3 pathe: 1.1.2 picomatch: 4.0.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 scule: 1.3.0 strip-literal: 2.1.1 unplugin: 1.16.0 @@ -13853,12 +13853,12 @@ snapshots: acorn: 8.14.0 webpack-virtual-modules: 0.6.2 - unplugin@2.1.0: + unplugin@2.1.2: dependencies: acorn: 8.14.0 webpack-virtual-modules: 0.6.2 - unstorage@1.14.3(db0@0.2.1)(ioredis@5.4.2): + unstorage@1.14.4(db0@0.2.1)(ioredis@5.4.2): dependencies: anymatch: 3.1.3 chokidar: 3.6.0 @@ -13899,7 +13899,7 @@ snapshots: magic-string: 0.30.17 mlly: 1.7.3 pathe: 1.1.2 - pkg-types: 1.2.1 + pkg-types: 1.3.0 unplugin: 1.16.0 update-browserslist-db@1.1.1(browserslist@4.24.3):