Conversation
WalkthroughThis update introduces a comprehensive date utility module, enhances client-side rendering control for search box documentation components, and improves documentation clarity by updating property names and descriptions. It also refines dropdown and event handling logic, adjusts dependencies, and ensures style imports are handled in the correct files. Several code and documentation files are updated for consistency and maintainability. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant DocsComponent
participant ClientOnly
participant TinySearchBox
User->>DocsComponent: Load documentation page
DocsComponent->>ClientOnly: Render wrapper
alt On client-side
ClientOnly->>TinySearchBox: Render component
else On server-side
ClientOnly-->>TinySearchBox: Do not render
end
sequenceDiagram
participant App
participant DateUtils
App->>DateUtils: toDate(value, format, minDate)
DateUtils->>DateUtils: Parse and validate value
DateUtils-->>App: Return Date or undefined
App->>DateUtils: format(date, format)
DateUtils->>DateUtils: Format date string
DateUtils-->>App: Return formatted string
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (8)
packages/docs/examples/events.md (1)
3-3: Minor style nit – consider inline code formatting for key termsAlthough no property name is mentioned here, referring to “事件” or typical event names (e.g.
first-level-select) in back-ticks usually improves readability and keeps style consistent with other docs.packages/docs/examples/potential-match.md (1)
3-3: Consistency & formatting
- Add “属性” to mirror the wording of other example files.
- Wrap the attribute name in back-ticks for clarity.
-通过 potentialOptions 配置潜在匹配项 +通过 `potentialOptions` 属性配置潜在匹配项packages/docs/examples/panel-max-height.md (1)
3-3: Use back-ticks around attribute nameFollow the same formatting convention adopted elsewhere.
-通过 panelMaxHeight 属性可以设置下拉面板的最大高度 +通过 `panelMaxHeight` 属性可以设置下拉面板的最大高度packages/docs/examples/empty-placeholder.md (1)
3-3: Inline-code formatting for attribute-通过 emptyPlaceholder 属性可以设置没有筛选项时的占位文本 +通过 `emptyPlaceholder` 属性可以设置没有筛选项时的占位文本packages/docs/examples/group-key.md (1)
3-3: Apply back-ticks to attribute name-通过 groupKey 属性可以自定义属性分组 +通过 `groupKey` 属性可以自定义属性分组packages/docs/search-box/editable.vue (1)
63-65: Systematic SSR fix completion.The
<ClientOnly>wrapper correctly completes the systematic fix across all documentation files. The approach consistently addresses SSR build failures while preserving component functionality.Consider adding a brief comment in the documentation explaining why
<ClientOnly>is used, to help future developers understand the SSR considerations:<template> + <!-- Wrapped in ClientOnly to prevent SSR issues --> <ClientOnly> <tiny-search-box v-model="tags" :items="items" editable /> </ClientOnly> </template>packages/search-box/src/composables/use-init.ts (1)
32-32: Simplify redundant condition in showDropdown callThe condition
item.field === state.prevItem.field && item !== state.prevItemis already checked by the parent if statement on line 15, making this expression always evaluate totruewithin this block.- showDropdown(state, item.field === state.prevItem.field && item !== state.prevItem) + showDropdown(state, true)Or even simpler since
trueis the default:- showDropdown(state, item.field === state.prevItem.field && item !== state.prevItem) + showDropdown(state)packages/docs/search-box/custom-panel.vue (1)
42-47: Remove unused scope parameters from template slotsThe
scopeparameters in the template slots are not being used after the simplification.- <template #autocomplete="scope"> + <template #autocomplete> <div class="tvp-search-box__date-wrap"> <div class="tvp-search-box__dropdown-title">选择人员</div> 我是人员自定义面板 </div> </template>Apply similar changes to other template slots that don't use the scope parameter.
Also applies to: 49-51, 53-58, 60-62
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (40)
packages/docs/.vitepress/theme/index.less(1 hunks)packages/docs/.vitepress/theme/index.ts(0 hunks)packages/docs/examples/auto-match.md(1 hunks)packages/docs/examples/default-field.md(1 hunks)packages/docs/examples/empty-placeholder.md(1 hunks)packages/docs/examples/events.md(1 hunks)packages/docs/examples/group-key.md(1 hunks)packages/docs/examples/help.md(1 hunks)packages/docs/examples/id-map-key.md(1 hunks)packages/docs/examples/item-placeholder.md(1 hunks)packages/docs/examples/max-length.md(1 hunks)packages/docs/examples/panel-max-height.md(1 hunks)packages/docs/examples/potential-match.md(1 hunks)packages/docs/examples/split-input-value.md(1 hunks)packages/docs/examples/v-model.md(1 hunks)packages/docs/package.json(2 hunks)packages/docs/search-box/auto-match.vue(1 hunks)packages/docs/search-box/basic-usage.vue(1 hunks)packages/docs/search-box/combination-panel.vue(2 hunks)packages/docs/search-box/custom-panel.vue(2 hunks)packages/docs/search-box/default-field.vue(1 hunks)packages/docs/search-box/editable.vue(1 hunks)packages/docs/search-box/empty-placeholder.vue(1 hunks)packages/docs/search-box/events.vue(1 hunks)packages/docs/search-box/group-key.vue(1 hunks)packages/docs/search-box/help.vue(1 hunks)packages/docs/search-box/id-map-key.vue(1 hunks)packages/docs/search-box/item-placeholder.vue(1 hunks)packages/docs/search-box/max-length.vue(1 hunks)packages/docs/search-box/max-time-length.vue(1 hunks)packages/docs/search-box/merge-tag.vue(1 hunks)packages/docs/search-box/panel-max-height.vue(1 hunks)packages/docs/search-box/potential-match.vue(1 hunks)packages/docs/search-box/split-input-value.vue(1 hunks)packages/docs/search-box/v-model.vue(1 hunks)packages/search-box/src/composables/use-dropdown.ts(0 hunks)packages/search-box/src/composables/use-init.ts(1 hunks)packages/search-box/src/composables/use-match.ts(1 hunks)packages/search-box/src/index.vue(4 hunks)packages/search-box/src/utils/date.ts(1 hunks)
💤 Files with no reviewable changes (2)
- packages/docs/.vitepress/theme/index.ts
- packages/search-box/src/composables/use-dropdown.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/search-box/src/composables/use-init.ts (1)
packages/search-box/src/utils/dropdown.ts (1)
showDropdown(6-16)
🪛 Biome (1.9.4)
packages/search-box/src/utils/date.ts
[error] 51-51: Do not shadow the global "toString" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
[error] 171-171: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.
(lint/suspicious/noGlobalIsFinite)
🔇 Additional comments (36)
packages/docs/.vitepress/theme/index.less (1)
1-1: Clarify LESS import mode to avoid accidental parsing issuesLESS treats
@import 'something.css'as a regular LESS file unless you explicitly mark it as CSS.
To guarantee the file is included verbatim and to prevent mis-parsing or duplicated CSS when the loader configuration changes, consider adding the(css)modifier:-@import '@opentiny/vue-theme/dark-theme-index.css'; +@import (css) '@opentiny/vue-theme/dark-theme-index.css';Please run a quick SSR build to verify there are no new style compilation warnings.
packages/docs/examples/events.md (1)
5-5: LGTM – preview tag fixRemoving the superfluous space brings this tag in line with the other examples.
packages/docs/examples/default-field.md (1)
3-3: Good documentation improvement!The change from "default-field" to "defaultField" aligns with JavaScript camelCase conventions and clarifies the property's purpose. This consistency improvement supports better developer understanding.
packages/docs/examples/item-placeholder.md (1)
3-3: Documentation simplification improves clarity.The updated text focuses on the core functionality of
itemPlaceholderrather than internal implementation details, making it more user-friendly and accessible.packages/docs/examples/max-length.md (1)
3-3: Good generalization of the documentation.Removing the specific "8-character limit" and generalizing the description makes the documentation more flexible and applicable to different use cases.
packages/docs/examples/help.md (1)
3-3: Excellent documentation improvement.The change to camelCase "showHelp" and the clear explanation of default behavior (true) and false value behavior makes this documentation more precise and user-friendly.
packages/search-box/src/composables/use-match.ts (1)
40-45: Excellent SSR compatibility fix!The addition of the
typeof document !== 'undefined'check before creating the loading instance properly addresses SSR build failures. This prevents DOM access in server-side environments while maintaining full functionality in client-side environments.packages/docs/examples/id-map-key.md (1)
3-3: Documentation improvement looks good!The update from
id-map-keytoidMapKeyaligns with JavaScript camelCase naming conventions, and the clarification about the default value and usage improves the documentation.packages/docs/examples/auto-match.md (1)
5-5: LGTM!Minor formatting improvement.
packages/docs/search-box/basic-usage.vue (1)
9-11: Good fix for SSR compatibility!Wrapping the search box component in
<ClientOnly>correctly prevents server-side rendering issues, which aligns with the PR objective of fixing SSR build failures.packages/docs/examples/v-model.md (1)
3-5: Documentation improvements look good!The clarification about using
v-modelfor default filter items improves clarity, and the formatting fix maintains consistency.packages/docs/search-box/potential-match.vue (1)
42-44: LGTM! Proper SSR fix implementation.The
<ClientOnly>wrapper correctly prevents server-side rendering of the search box component, which addresses the SSR build failure mentioned in the PR objectives. This is especially important for this component since it contains async logic that could cause hydration mismatches.packages/docs/search-box/empty-placeholder.vue (1)
9-11: LGTM! Consistent SSR fix implementation.The
<ClientOnly>wrapper is correctly applied, following the same pattern as other files in this PR. This ensures consistent client-side rendering for the search box component across all documentation examples.packages/docs/search-box/group-key.vue (1)
10-12: LGTM! Consistent implementation.The
<ClientOnly>wrapper is properly implemented and maintains consistency with the overall PR approach. The reactive data handling will work correctly with client-side rendering.packages/docs/search-box/merge-tag.vue (1)
55-57: LGTM! Proper SSR fix with event handling.The
<ClientOnly>wrapper correctly addresses the SSR issue while preserving the component's functionality, including the@changeevent handler. The complex reactive data structure with merge tag functionality will work properly with client-side rendering.packages/docs/search-box/id-map-key.vue (1)
127-129: LGTM! Systematic SSR fix completion.The
<ClientOnly>wrapper is correctly implemented for the most complex component in the set, handling nested data structures and map types. This completes the systematic application of the SSR fix across all documentation examples, ensuring consistent client-side rendering behavior.packages/docs/search-box/item-placeholder.vue (1)
117-119: Action Required: Confirm<ClientOnly>RegistrationI’ve verified that there’s no
nuxt.config.js/tsat the repo root and a global search didn’t reveal any imports or registrations ofClientOnly. Please ensure that the<ClientOnly>wrapper you added will actually work:• If this is a Nuxt project, confirm that
nuxt.config.jsornuxt.config.tsexists (Nuxt provides<ClientOnly>out of the box).
• If you’re on a standard Vue setup, import and registerClientOnlyeither globally or locally:– Local registration in
item-placeholder.vue:<script setup lang="ts"> + import ClientOnly from 'vue-client-only' // … </script>– Global registration in your entry file (
main.js/main.ts):import { createApp } from 'vue' import App from './App.vue' import ClientOnly from 'vue-client-only' const app = createApp(App) app.component('ClientOnly', ClientOnly) app.mount('#app')Once confirmed, the SSR fix is good to go.
packages/docs/search-box/default-field.vue (1)
10-12: Consistent SSR fix implementation.The
<ClientOnly>wrapper is correctly applied, maintaining consistency with the SSR fix approach across documentation files.packages/docs/search-box/help.vue (1)
12-15: Efficient grouping of related components.Both search box components are correctly wrapped in a single
<ClientOnly>wrapper, which is efficient and maintains their functional relationship while fixing SSR issues.packages/docs/search-box/auto-match.vue (1)
11-13: Consistent SSR fix pattern.The
<ClientOnly>wrapper is correctly applied, maintaining the established pattern for addressing SSR build failures across documentation components.packages/docs/search-box/v-model.vue (1)
21-23: LGTM! Proper SSR fix implementation.The
<ClientOnly>wrapper correctly prevents server-side rendering of the search box component, which addresses the SSR build failure mentioned in the PR objectives.packages/docs/search-box/panel-max-height.vue (1)
11-13: LGTM! Consistent SSR fix implementation.The
<ClientOnly>wrapper is properly implemented and consistent with the SSR fix pattern used across other search box components.packages/docs/search-box/split-input-value.vue (1)
11-13: LGTM! SSR fix with improved prop binding.The
<ClientOnly>wrapper addresses the SSR build failure, and the change fromsplit-input-value="|"to:split-input-value="'|'"improves the prop binding by using proper Vue syntax for string literal binding.packages/docs/examples/split-input-value.md (1)
3-3: LGTM! Documentation correctly reflects component usage.The updated documentation properly explains the
splitInputValueproperty and its default behavior, which aligns with the prop binding improvements made in the corresponding Vue component.packages/docs/search-box/max-time-length.vue (1)
45-47: LGTM! Consistent SSR fix pattern.The
<ClientOnly>wrapper properly addresses the SSR build failure while preserving all existing functionality including the complex date/time configuration and event handling.packages/docs/search-box/events.vue (1)
149-160: LGTM - Correct SSR fix implementation.The
<ClientOnly>wrapper correctly prevents server-side rendering of thetiny-search-boxcomponent, which aligns with the PR objective of fixing SSR build failures. This is a standard pattern for components that require browser-specific APIs.packages/docs/search-box/max-length.vue (2)
20-20: Good simplification - using native alert instead of Modal.Replacing
Modal.messagewith nativealertreduces dependencies and eliminates potential SSR issues with the Modal component. This is a practical approach for simple notifications in documentation examples.
25-27: LGTM - Consistent SSR fix implementation.The
<ClientOnly>wrapper ensures client-side-only rendering, preventing SSR build failures. This matches the pattern applied across other search-box documentation components.packages/docs/package.json (1)
12-13: Good modularization - replacing broad dependency with specific packages.Replacing
@opentiny/vuewith specific packages (@opentiny/vue-buttonand@opentiny/vue-autocomplete) improves tree-shaking and reduces bundle size. This granular approach also helps minimize potential SSR compatibility issues.packages/search-box/src/index.vue (4)
277-281: Essential SSR fix - document availability check.Adding
typeof document !== 'undefined'guards prevents runtime errors in server-side environments wheredocumentis not available. This is a critical fix for SSR compatibility.
285-289: Consistent SSR protection for cleanup.The document check in
onBeforeUnmountensures safe cleanup of event listeners, maintaining consistency with the mounted lifecycle hook guards.
353-353: UX improvement - enable click-outside to close dropdown.Adding
close-on-click-outside="true"provides better user experience by allowing users to close the dropdown by clicking outside of it, which is expected behavior.
392-396: Improved readability with multi-line formatting.The multi-line formatting of component attributes improves code readability and maintainability without affecting functionality.
packages/docs/search-box/combination-panel.vue (2)
4-5: Consistent with dependency modularization.The import changes align with the
package.jsonupdates, using specific packages instead of the broad@opentiny/vuepackage. This supports better tree-shaking and reduces potential SSR issues.
62-90: Proper SSR prevention with ClientOnly wrapper.The
<ClientOnly>wrapper ensures the search-box component and its slot templates render only on the client side, preventing SSR build failures. This is consistent with the pattern applied across other documentation components.packages/docs/search-box/custom-panel.vue (1)
39-40: Good use of ClientOnly wrapper for SSR compatibilityWrapping the search box component in
<ClientOnly>effectively prevents SSR-related issues, which aligns with the PR's objective to fix SSR build failures.Also applies to: 64-64
| * | ||
| * isNumber(369) // true | ||
| */ | ||
| export const isNumber = (value: any) => typeof value === 'number' && isFinite(value) |
There was a problem hiding this comment.
Use Number.isFinite for safer type checking.
isFinite performs type coercion which can lead to unexpected behavior. Number.isFinite is safer as it doesn't coerce the value.
Apply this diff:
-export const isNumber = (value: any) => typeof value === 'number' && isFinite(value)
+export const isNumber = (value: any) => typeof value === 'number' && Number.isFinite(value)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export const isNumber = (value: any) => typeof value === 'number' && isFinite(value) | |
| export const isNumber = (value: any) => typeof value === 'number' && Number.isFinite(value) |
🤖 Prompt for AI Agents
In packages/search-box/src/utils/date.ts at line 156, replace the use of the
global isFinite function with Number.isFinite to avoid type coercion issues.
Update the isNumber function to use Number.isFinite(value) instead of
isFinite(value) for safer and more accurate finite number checking.
| } | ||
| } | ||
|
|
||
| export const toString = Object.prototype.toString |
There was a problem hiding this comment.
Rename toString to avoid shadowing the global property.
The variable shadows the global toString property, which can cause confusion about its origin.
Apply this diff:
-export const toString = Object.prototype.toString
+export const objectToString = Object.prototype.toStringAlso update all references to use objectToString:
- Line 92:
class2type[objectToString.call(obj)] - Line 118:
objectToString.call(obj) !== '[object Object]'
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In packages/search-box/src/utils/date.ts at line 47, rename the exported
constant from `toString` to `objectToString` to avoid shadowing the global
`toString` property. Then update all references to this constant accordingly,
specifically at line 92 and line 118, replacing `toString.call(obj)` with
`objectToString.call(obj)`.
| import { reactive, ref, shallowRef } from 'vue' | ||
| import TinyAutocomplete from '@opentiny/vue-autocomplete' // 改为动态加载 | ||
|
|
There was a problem hiding this comment.
Remove unused imports
The imports shallowRef and TinyAutocomplete are not used anywhere in the component. Additionally, the comment mentions "dynamic loading" but the import is still static.
-import { reactive, ref, shallowRef } from 'vue'
-import TinyAutocomplete from '@opentiny/vue-autocomplete' // 改为动态加载
+import { reactive, ref } from 'vue'If dynamic loading is intended for the future, consider using dynamic imports when actually needed:
const TinyAutocomplete = () => import('@opentiny/vue-autocomplete')🤖 Prompt for AI Agents
In packages/docs/search-box/custom-panel.vue lines 2 to 4, remove the unused
imports shallowRef and TinyAutocomplete since they are not used in the
component. If dynamic loading of TinyAutocomplete is intended, replace the
static import with a dynamic import using a function that returns
import('@opentiny/vue-autocomplete') when needed.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (3)
packages/docs/search-box/custom-panel.vue (1)
2-4: Remove unused importsThe imports
shallowRefandTinyAutocompleteare not used anywhere in the component. The comment mentions "改为动态加载" (change to dynamic loading) but the import is still static.packages/search-box/src/utils/date.ts (2)
47-47: RenametoStringto avoid shadowing the global property.The variable shadows the global
toStringproperty, which can cause confusion about its origin.
156-156: UseNumber.isFinitefor safer type checking.
isFiniteperforms type coercion which can lead to unexpected behavior.Number.isFiniteis safer as it doesn't coerce the value.
🧹 Nitpick comments (1)
packages/search-box/src/utils/date.ts (1)
184-184: Add missing type annotation for consistency.The
valueparameter is missing a type annotation, which is inconsistent with other similar functions in the file.-export const isDate = (value) => typeOf(value) === 'date' +export const isDate = (value: any) => typeOf(value) === 'date'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (40)
packages/docs/.vitepress/theme/index.less(1 hunks)packages/docs/.vitepress/theme/index.ts(0 hunks)packages/docs/examples/auto-match.md(1 hunks)packages/docs/examples/default-field.md(1 hunks)packages/docs/examples/empty-placeholder.md(1 hunks)packages/docs/examples/events.md(1 hunks)packages/docs/examples/group-key.md(1 hunks)packages/docs/examples/help.md(1 hunks)packages/docs/examples/id-map-key.md(1 hunks)packages/docs/examples/item-placeholder.md(1 hunks)packages/docs/examples/max-length.md(1 hunks)packages/docs/examples/panel-max-height.md(1 hunks)packages/docs/examples/potential-match.md(1 hunks)packages/docs/examples/split-input-value.md(1 hunks)packages/docs/examples/v-model.md(1 hunks)packages/docs/package.json(2 hunks)packages/docs/search-box/auto-match.vue(1 hunks)packages/docs/search-box/basic-usage.vue(1 hunks)packages/docs/search-box/combination-panel.vue(2 hunks)packages/docs/search-box/custom-panel.vue(2 hunks)packages/docs/search-box/default-field.vue(1 hunks)packages/docs/search-box/editable.vue(1 hunks)packages/docs/search-box/empty-placeholder.vue(1 hunks)packages/docs/search-box/events.vue(1 hunks)packages/docs/search-box/group-key.vue(1 hunks)packages/docs/search-box/help.vue(1 hunks)packages/docs/search-box/id-map-key.vue(1 hunks)packages/docs/search-box/item-placeholder.vue(1 hunks)packages/docs/search-box/max-length.vue(1 hunks)packages/docs/search-box/max-time-length.vue(1 hunks)packages/docs/search-box/merge-tag.vue(1 hunks)packages/docs/search-box/panel-max-height.vue(1 hunks)packages/docs/search-box/potential-match.vue(1 hunks)packages/docs/search-box/split-input-value.vue(1 hunks)packages/docs/search-box/v-model.vue(1 hunks)packages/search-box/src/composables/use-dropdown.ts(0 hunks)packages/search-box/src/composables/use-init.ts(1 hunks)packages/search-box/src/composables/use-match.ts(1 hunks)packages/search-box/src/index.vue(4 hunks)packages/search-box/src/utils/date.ts(1 hunks)
💤 Files with no reviewable changes (2)
- packages/docs/.vitepress/theme/index.ts
- packages/search-box/src/composables/use-dropdown.ts
✅ Files skipped from review due to trivial changes (4)
- packages/docs/search-box/id-map-key.vue
- packages/docs/examples/split-input-value.md
- packages/docs/search-box/merge-tag.vue
- packages/docs/examples/panel-max-height.md
🚧 Files skipped from review as they are similar to previous changes (32)
- packages/docs/examples/group-key.md
- packages/docs/examples/auto-match.md
- packages/docs/search-box/item-placeholder.vue
- packages/docs/search-box/auto-match.vue
- packages/docs/search-box/group-key.vue
- packages/docs/search-box/potential-match.vue
- packages/docs/search-box/basic-usage.vue
- packages/docs/.vitepress/theme/index.less
- packages/docs/search-box/editable.vue
- packages/docs/examples/v-model.md
- packages/docs/examples/events.md
- packages/docs/examples/potential-match.md
- packages/docs/search-box/panel-max-height.vue
- packages/docs/search-box/default-field.vue
- packages/docs/examples/max-length.md
- packages/docs/search-box/max-time-length.vue
- packages/docs/search-box/split-input-value.vue
- packages/docs/examples/default-field.md
- packages/docs/examples/empty-placeholder.md
- packages/docs/search-box/help.vue
- packages/docs/package.json
- packages/docs/search-box/v-model.vue
- packages/docs/search-box/events.vue
- packages/docs/search-box/combination-panel.vue
- packages/docs/search-box/max-length.vue
- packages/docs/examples/help.md
- packages/search-box/src/composables/use-match.ts
- packages/docs/examples/id-map-key.md
- packages/docs/search-box/empty-placeholder.vue
- packages/docs/examples/item-placeholder.md
- packages/search-box/src/composables/use-init.ts
- packages/search-box/src/index.vue
🧰 Additional context used
🪛 Biome (1.9.4)
packages/search-box/src/utils/date.ts
[error] 51-51: Do not shadow the global "toString" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
[error] 171-171: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.
(lint/suspicious/noGlobalIsFinite)
🔇 Additional comments (5)
packages/docs/search-box/custom-panel.vue (2)
39-64: Good use of ClientOnly for SSR compatibility!Wrapping the search box component in
<ClientOnly>is the correct approach to prevent SSR build failures.
42-58: Verify the removal of autocomplete functionalityThe custom panels have been simplified to show only static text ("我是人员自定义面板"). According to the changes, all autocomplete functionality including the input field, suggestion fetching, and confirm/cancel buttons have been removed.
Please confirm if this simplification is intentional for the documentation example or if the functionality should be preserved.
packages/search-box/src/utils/date.ts (3)
285-371: Comprehensive date parsing logic handles multiple formats correctly.The three date parsers (yyyymmdd, mmddyyyy, and ISO8601) properly handle different date formats, timezone conversions, leap years, and invalid date validation. The complex logic is well-structured and covers edge cases appropriately.
546-675: Well-designed main utility functions provide comprehensive date handling.The
toDate,format,getDateWithNewTimezone, andtoDateStrfunctions offer flexible APIs with proper error handling, type checking, and edge case management. The implementation efficiently handles various input formats and timezone conversions.
1-724: Date utility usage confirmedThe
date.tsmodule is actively used within the Search-Box package:• In
packages/search-box/src/composables/use-dropdown.ts– callsformat(...)
• Inpackages/search-box/src/composables/use-edit.ts– callsformat(...)No other date-handling utilities exist in the codebase, so this comprehensive module is necessary for parsing and formatting dates in these components.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (2)
packages/search-box/src/utils/date.ts (2)
47-47: RenametoStringto avoid shadowing the global property.The variable shadows the global
toStringproperty, which can cause confusion about its origin.
156-156: UseNumber.isFinitefor safer type checking.
isFiniteperforms type coercion which can lead to unexpected behavior.Number.isFiniteis safer as it doesn't coerce the value.
🧹 Nitpick comments (1)
packages/docs/examples/events.md (1)
3-3: Use back-ticks to highlight event identifiers.Wrapping the event names in inline code markers improves readability and keeps the style consistent with other docs (
first-level-select,search, etc.).-通过first-level-select、search、change、clear、tag-click等事件可以监听组件的各种状态变化 +通过 `first-level-select`、`search`、`change`、`clear`、`tag-click` 等事件可以监听组件的各种状态变化
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (41)
packages/docs/.vitepress/theme/index.less(1 hunks)packages/docs/.vitepress/theme/index.ts(0 hunks)packages/docs/examples/auto-match.md(1 hunks)packages/docs/examples/default-field.md(1 hunks)packages/docs/examples/empty-placeholder.md(1 hunks)packages/docs/examples/events.md(1 hunks)packages/docs/examples/group-key.md(1 hunks)packages/docs/examples/help.md(1 hunks)packages/docs/examples/id-map-key.md(1 hunks)packages/docs/examples/item-placeholder.md(1 hunks)packages/docs/examples/max-length.md(1 hunks)packages/docs/examples/panel-max-height.md(1 hunks)packages/docs/examples/potential-match.md(1 hunks)packages/docs/examples/split-input-value.md(1 hunks)packages/docs/examples/v-model.md(1 hunks)packages/docs/package.json(2 hunks)packages/docs/search-box/auto-match.vue(1 hunks)packages/docs/search-box/basic-usage.vue(1 hunks)packages/docs/search-box/combination-panel.vue(2 hunks)packages/docs/search-box/custom-panel.vue(2 hunks)packages/docs/search-box/default-field.vue(1 hunks)packages/docs/search-box/editable.vue(1 hunks)packages/docs/search-box/empty-placeholder.vue(1 hunks)packages/docs/search-box/events.vue(1 hunks)packages/docs/search-box/group-key.vue(1 hunks)packages/docs/search-box/help.vue(1 hunks)packages/docs/search-box/id-map-key.vue(1 hunks)packages/docs/search-box/item-placeholder.vue(1 hunks)packages/docs/search-box/max-length.vue(1 hunks)packages/docs/search-box/max-time-length.vue(1 hunks)packages/docs/search-box/merge-tag.vue(1 hunks)packages/docs/search-box/panel-max-height.vue(1 hunks)packages/docs/search-box/potential-match.vue(1 hunks)packages/docs/search-box/split-input-value.vue(1 hunks)packages/docs/search-box/v-model.vue(1 hunks)packages/search-box/package.json(1 hunks)packages/search-box/src/composables/use-dropdown.ts(0 hunks)packages/search-box/src/composables/use-init.ts(1 hunks)packages/search-box/src/composables/use-match.ts(1 hunks)packages/search-box/src/index.vue(4 hunks)packages/search-box/src/utils/date.ts(1 hunks)
💤 Files with no reviewable changes (2)
- packages/docs/.vitepress/theme/index.ts
- packages/search-box/src/composables/use-dropdown.ts
✅ Files skipped from review due to trivial changes (4)
- packages/search-box/package.json
- packages/docs/search-box/split-input-value.vue
- packages/docs/examples/split-input-value.md
- packages/docs/search-box/merge-tag.vue
🚧 Files skipped from review as they are similar to previous changes (33)
- packages/docs/examples/auto-match.md
- packages/docs/search-box/basic-usage.vue
- packages/docs/package.json
- packages/docs/search-box/v-model.vue
- packages/docs/search-box/events.vue
- packages/docs/.vitepress/theme/index.less
- packages/docs/examples/max-length.md
- packages/docs/search-box/max-time-length.vue
- packages/docs/search-box/default-field.vue
- packages/docs/examples/item-placeholder.md
- packages/docs/search-box/item-placeholder.vue
- packages/docs/examples/id-map-key.md
- packages/docs/search-box/auto-match.vue
- packages/docs/examples/empty-placeholder.md
- packages/search-box/src/composables/use-init.ts
- packages/docs/search-box/max-length.vue
- packages/docs/examples/group-key.md
- packages/docs/search-box/custom-panel.vue
- packages/docs/examples/potential-match.md
- packages/docs/examples/panel-max-height.md
- packages/search-box/src/composables/use-match.ts
- packages/docs/search-box/help.vue
- packages/docs/search-box/combination-panel.vue
- packages/docs/search-box/potential-match.vue
- packages/docs/search-box/editable.vue
- packages/search-box/src/index.vue
- packages/docs/search-box/id-map-key.vue
- packages/docs/examples/help.md
- packages/docs/search-box/group-key.vue
- packages/docs/examples/v-model.md
- packages/docs/search-box/empty-placeholder.vue
- packages/docs/search-box/panel-max-height.vue
- packages/docs/examples/default-field.md
🧰 Additional context used
🪛 LanguageTool
packages/docs/examples/events.md
[grammar] ~3-~3: Ensure spelling is correct
Context: ...st-level-select、search、change、clear、tag-click等事件可以监听组件的各种状态变化
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🪛 Biome (1.9.4)
packages/search-box/src/utils/date.ts
[error] 51-51: Do not shadow the global "toString" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
[error] 171-171: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.
(lint/suspicious/noGlobalIsFinite)
🔇 Additional comments (8)
packages/docs/examples/events.md (1)
5-5: 👍 Removed stray space inside<preview>tag.The cleanup avoids potential path-parsing edge cases in the docs tooling.
packages/search-box/src/utils/date.ts (7)
1-45: LGTM! Well-implemented string padding utility.The
fillCharfunction is correctly implemented with proper parameter validation and handles both append and prepend modes efficiently.
50-149: Excellent type checking utilities implementation.The type checking functions are well-designed with comprehensive documentation and handle edge cases properly. The
isPlainObjectfunction correctly distinguishes between plain objects and other object types.
158-200: Robust numeric and type validation functions.The
isNumeric,isDate,isSame,isRegExp, andisPromisefunctions are well-implemented with proper handling of edge cases like NaN comparison.
202-387: Comprehensive date parsing infrastructure.The regex patterns for different date formats (yyyy/mm/dd, mm/dd/yyyy, ISO8601) are well-constructed, and the parsing functions handle timezone conversions and validation correctly. The leap year calculation and date validation logic are mathematically sound.
389-561: Sophisticated date conversion logic.The
toDatefunction and its supporting utilities provide robust date parsing with support for multiple formats and custom date formats. The implementation correctly handles edge cases and provides fallback behavior.
563-629: Flexible and well-documented date formatting.The
formatfunction provides comprehensive date formatting capabilities with support for various format tokens and proper timezone handling. The implementation is robust and handles both Date objects and string inputs.
631-723: Solid timezone and week calculation utilities.The timezone conversion functions and
getWeekOfFirstDayutility are well-implemented with proper parameter validation and handling of different timezone formats. The week calculation correctly handles both Monday and Sunday as the first day of the week.
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (3)
packages/docs/search-box/custom-panel.vue (1)
2-2: Remove unused importshallowRefThe
shallowRefimport is not used anywhere in the component and should be removed to clean up the code.packages/search-box/src/utils/date.ts (2)
47-47: RenametoStringto avoid shadowing the global property.
156-156: UseNumber.isFinitefor safer type checking.
🧹 Nitpick comments (3)
packages/docs/examples/events.md (1)
3-3: Add code-style back-ticks & polish wording for clarity.Event names stand out better when wrapped in back-ticks and the sentence flows more naturally in Chinese; see the diff below.
-通过first-level-select、search、change、clear、tag-click等可以监听组件的各种事件。 +通过 `first-level-select`、`search`、`change`、`clear`、`tag-click` 等事件可以监听组件的各种状态变化。packages/search-box/src/utils/date.ts (2)
194-195: Consider usingObject.is()for complete same-value equality.The current implementation doesn't handle all edge cases, such as
-0 === 0(which should be false for same-value equality). Consider usingObject.is()for a more comprehensive check.-export const isSame = (x: any, y: any) => - x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y)) +export const isSame = (x: any, y: any) => Object.is(x, y)
709-723: Clarify timezone offset calculation.The multiplication of a number with a template literal string is confusing and relies on implicit type conversion.
- value = minoffset * `${match[1]}1` + value = minoffset * (match[1] === '-' ? -1 : 1)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (41)
packages/docs/.vitepress/theme/index.less(1 hunks)packages/docs/.vitepress/theme/index.ts(0 hunks)packages/docs/examples/auto-match.md(1 hunks)packages/docs/examples/default-field.md(1 hunks)packages/docs/examples/empty-placeholder.md(1 hunks)packages/docs/examples/events.md(1 hunks)packages/docs/examples/group-key.md(1 hunks)packages/docs/examples/help.md(1 hunks)packages/docs/examples/id-map-key.md(1 hunks)packages/docs/examples/item-placeholder.md(1 hunks)packages/docs/examples/max-length.md(1 hunks)packages/docs/examples/panel-max-height.md(1 hunks)packages/docs/examples/potential-match.md(1 hunks)packages/docs/examples/split-input-value.md(1 hunks)packages/docs/examples/v-model.md(1 hunks)packages/docs/package.json(2 hunks)packages/docs/search-box/auto-match.vue(1 hunks)packages/docs/search-box/basic-usage.vue(1 hunks)packages/docs/search-box/combination-panel.vue(2 hunks)packages/docs/search-box/custom-panel.vue(2 hunks)packages/docs/search-box/default-field.vue(1 hunks)packages/docs/search-box/editable.vue(1 hunks)packages/docs/search-box/empty-placeholder.vue(1 hunks)packages/docs/search-box/events.vue(1 hunks)packages/docs/search-box/group-key.vue(1 hunks)packages/docs/search-box/help.vue(1 hunks)packages/docs/search-box/id-map-key.vue(1 hunks)packages/docs/search-box/item-placeholder.vue(1 hunks)packages/docs/search-box/max-length.vue(1 hunks)packages/docs/search-box/max-time-length.vue(1 hunks)packages/docs/search-box/merge-tag.vue(1 hunks)packages/docs/search-box/panel-max-height.vue(1 hunks)packages/docs/search-box/potential-match.vue(1 hunks)packages/docs/search-box/split-input-value.vue(1 hunks)packages/docs/search-box/v-model.vue(1 hunks)packages/search-box/package.json(1 hunks)packages/search-box/src/composables/use-dropdown.ts(0 hunks)packages/search-box/src/composables/use-init.ts(1 hunks)packages/search-box/src/composables/use-match.ts(1 hunks)packages/search-box/src/index.vue(4 hunks)packages/search-box/src/utils/date.ts(1 hunks)
💤 Files with no reviewable changes (2)
- packages/docs/.vitepress/theme/index.ts
- packages/search-box/src/composables/use-dropdown.ts
✅ Files skipped from review due to trivial changes (5)
- packages/docs/search-box/empty-placeholder.vue
- packages/search-box/package.json
- packages/docs/search-box/id-map-key.vue
- packages/docs/search-box/split-input-value.vue
- packages/docs/search-box/events.vue
🚧 Files skipped from review as they are similar to previous changes (31)
- packages/docs/examples/potential-match.md
- packages/docs/.vitepress/theme/index.less
- packages/docs/search-box/basic-usage.vue
- packages/docs/search-box/potential-match.vue
- packages/docs/examples/group-key.md
- packages/docs/search-box/merge-tag.vue
- packages/docs/search-box/v-model.vue
- packages/docs/examples/auto-match.md
- packages/docs/examples/panel-max-height.md
- packages/docs/search-box/max-time-length.vue
- packages/docs/search-box/default-field.vue
- packages/docs/search-box/group-key.vue
- packages/docs/search-box/item-placeholder.vue
- packages/docs/examples/empty-placeholder.md
- packages/docs/examples/v-model.md
- packages/docs/examples/help.md
- packages/docs/search-box/panel-max-height.vue
- packages/docs/search-box/max-length.vue
- packages/docs/examples/item-placeholder.md
- packages/docs/examples/max-length.md
- packages/docs/search-box/help.vue
- packages/docs/search-box/auto-match.vue
- packages/docs/search-box/combination-panel.vue
- packages/docs/search-box/editable.vue
- packages/search-box/src/composables/use-match.ts
- packages/docs/examples/default-field.md
- packages/docs/examples/id-map-key.md
- packages/search-box/src/index.vue
- packages/docs/examples/split-input-value.md
- packages/search-box/src/composables/use-init.ts
- packages/docs/package.json
🧰 Additional context used
🪛 Biome (1.9.4)
packages/search-box/src/utils/date.ts
[error] 51-51: Do not shadow the global "toString" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
[error] 171-171: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.
(lint/suspicious/noGlobalIsFinite)
🪛 LanguageTool
packages/docs/examples/events.md
[grammar] ~3-~3: Ensure spelling is correct
Context: ...st-level-select、search、change、clear、tag-click等可以监听组件的各种事件。 <preview path="../search-box/events.v...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (2)
packages/docs/examples/events.md (1)
5-5: Preview path looks good – no further changes needed.packages/docs/search-box/custom-panel.vue (1)
37-62: Excellent SSR fix implementationWrapping the search box component in
<ClientOnly>is the correct approach to resolve SSR build failures. This ensures the component only renders on the client side, preventing server-side rendering issues while maintaining the component's functionality.
| let textPos = 0 | ||
|
|
||
| for (let i = 0, len = str.length; i < len; i++) { | ||
| const charValue = str.substr(i, 1) |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Use substring instead of substr for consistency.
The function uses both substr and substring. Stick to substring for consistency since substr is deprecated.
- const charValue = str.substr(i, 1)
+ const charValue = str.substring(i, i + 1)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const charValue = str.substr(i, 1) | |
| const charValue = str.substring(i, i + 1) |
🤖 Prompt for AI Agents
In packages/search-box/src/utils/date.ts at line 438, replace the use of the
deprecated `substr` method with `substring` to maintain consistency. Change the
code to use `str.substring(i, i + 1)` instead of `str.substr(i, 1)` to extract
the single character at position `i`.
| if (!timeZone.includes(':')) { | ||
| timeZone = timeZone.substr(0, 3) + ':' + timeZone.substr(3) | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Replace deprecated substr with substring.
The substr method is deprecated.
- timeZone = timeZone.substr(0, 3) + ':' + timeZone.substr(3)
+ timeZone = timeZone.substring(0, 3) + ':' + timeZone.substring(3)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (!timeZone.includes(':')) { | |
| timeZone = timeZone.substr(0, 3) + ':' + timeZone.substr(3) | |
| } | |
| if (!timeZone.includes(':')) { | |
| timeZone = timeZone.substring(0, 3) + ':' + timeZone.substring(3) | |
| } |
🤖 Prompt for AI Agents
In packages/search-box/src/utils/date.ts around lines 358 to 360, the code uses
the deprecated substr method to manipulate the timeZone string. Replace all
instances of substr with substring to avoid using deprecated methods.
Specifically, change timeZone.substr(0, 3) to timeZone.substring(0, 3) and
timeZone.substr(3) to timeZone.substring(3).
| export const fillChar = (string, length, append, chr = '0') => { | ||
| if (typeof string === 'string' && typeof chr === 'string' && isNumber(length)) { | ||
| let len = string.length - length | ||
|
|
||
| if (len > 0) { | ||
| return append ? string.substr(0, length) : string.substr(len, length) | ||
| } else { | ||
| const appendStr = [] | ||
| len = Math.abs(len) / chr.length | ||
|
|
||
| for (; len > 0; len--) { | ||
| appendStr.push(chr) | ||
| } | ||
|
|
||
| const s = appendStr.join('') | ||
|
|
||
| return append ? string + s : s + string | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Replace deprecated substr with substring.
The substr method is deprecated. Replace it with substring for better compatibility.
- return append ? string.substr(0, length) : string.substr(len, length)
+ return append ? string.substring(0, length) : string.substring(len, length)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export const fillChar = (string, length, append, chr = '0') => { | |
| if (typeof string === 'string' && typeof chr === 'string' && isNumber(length)) { | |
| let len = string.length - length | |
| if (len > 0) { | |
| return append ? string.substr(0, length) : string.substr(len, length) | |
| } else { | |
| const appendStr = [] | |
| len = Math.abs(len) / chr.length | |
| for (; len > 0; len--) { | |
| appendStr.push(chr) | |
| } | |
| const s = appendStr.join('') | |
| return append ? string + s : s + string | |
| } | |
| } | |
| } | |
| export const fillChar = (string, length, append, chr = '0') => { | |
| if (typeof string === 'string' && typeof chr === 'string' && isNumber(length)) { | |
| let len = string.length - length | |
| if (len > 0) { | |
| return append | |
| ? string.substring(0, length) | |
| : string.substring(len, length) | |
| } else { | |
| const appendStr = [] | |
| len = Math.abs(len) / chr.length | |
| for (; len > 0; len--) { | |
| appendStr.push(chr) | |
| } | |
| const s = appendStr.join('') | |
| return append ? string + s : s + string | |
| } | |
| } | |
| } |
🤖 Prompt for AI Agents
In packages/search-box/src/utils/date.ts between lines 26 and 45, the code uses
the deprecated substr method to extract parts of a string. Replace all instances
of substr with substring, adjusting the parameters accordingly since substring
takes a start index and an end index (exclusive), unlike substr which takes a
start index and length. This will ensure better compatibility and avoid
deprecated method usage.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (6)
packages/search-box/src/utils/date.ts (5)
26-45: Replace deprecatedsubstrwithsubstring.The
substrmethod is deprecated and should be replaced withsubstringfor better compatibility.
47-47: RenametoStringto avoid shadowing the global property.The variable shadows the global
toStringproperty, which can cause confusion about its origin.
156-156: UseNumber.isFinitefor safer type checking.
isFiniteperforms type coercion which can lead to unexpected behavior.Number.isFiniteis safer as it doesn't coerce the value.
358-360: Replace deprecatedsubstrwithsubstring.The
substrmethod is deprecated.
438-438: Usesubstringinstead ofsubstrfor consistency.The function uses both
substrandsubstring. Stick tosubstringfor consistency sincesubstris deprecated.packages/docs/search-box/custom-panel.vue (1)
2-2: Remove unused imports.The imports
shallowRefandTinyAutocompleteare not used anywhere in the component.
🧹 Nitpick comments (1)
packages/docs/examples/events.md (1)
3-3: Wrap event literals in back-ticks for clarityInline-code formatting helps readers quickly distinguish event names from surrounding Chinese text.
-通过first-level-select、search、change、clear、tag-click等可以监听组件的各种事件。 +通过 `first-level-select`、`search`、`change`、`clear`、`tag-click` 等可以监听组件的各种事件。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (41)
packages/docs/.vitepress/theme/index.less(1 hunks)packages/docs/.vitepress/theme/index.ts(0 hunks)packages/docs/examples/auto-match.md(1 hunks)packages/docs/examples/default-field.md(1 hunks)packages/docs/examples/empty-placeholder.md(1 hunks)packages/docs/examples/events.md(1 hunks)packages/docs/examples/group-key.md(1 hunks)packages/docs/examples/help.md(1 hunks)packages/docs/examples/id-map-key.md(1 hunks)packages/docs/examples/item-placeholder.md(1 hunks)packages/docs/examples/max-length.md(1 hunks)packages/docs/examples/panel-max-height.md(1 hunks)packages/docs/examples/potential-match.md(1 hunks)packages/docs/examples/split-input-value.md(1 hunks)packages/docs/examples/v-model.md(1 hunks)packages/docs/package.json(2 hunks)packages/docs/search-box/auto-match.vue(1 hunks)packages/docs/search-box/basic-usage.vue(1 hunks)packages/docs/search-box/combination-panel.vue(2 hunks)packages/docs/search-box/custom-panel.vue(2 hunks)packages/docs/search-box/default-field.vue(1 hunks)packages/docs/search-box/editable.vue(1 hunks)packages/docs/search-box/empty-placeholder.vue(1 hunks)packages/docs/search-box/events.vue(1 hunks)packages/docs/search-box/group-key.vue(1 hunks)packages/docs/search-box/help.vue(1 hunks)packages/docs/search-box/id-map-key.vue(1 hunks)packages/docs/search-box/item-placeholder.vue(1 hunks)packages/docs/search-box/max-length.vue(1 hunks)packages/docs/search-box/max-time-length.vue(1 hunks)packages/docs/search-box/merge-tag.vue(1 hunks)packages/docs/search-box/panel-max-height.vue(1 hunks)packages/docs/search-box/potential-match.vue(1 hunks)packages/docs/search-box/split-input-value.vue(1 hunks)packages/docs/search-box/v-model.vue(1 hunks)packages/search-box/package.json(1 hunks)packages/search-box/src/composables/use-dropdown.ts(0 hunks)packages/search-box/src/composables/use-init.ts(1 hunks)packages/search-box/src/composables/use-match.ts(1 hunks)packages/search-box/src/index.vue(5 hunks)packages/search-box/src/utils/date.ts(1 hunks)
💤 Files with no reviewable changes (2)
- packages/docs/.vitepress/theme/index.ts
- packages/search-box/src/composables/use-dropdown.ts
✅ Files skipped from review due to trivial changes (2)
- packages/search-box/package.json
- packages/docs/search-box/id-map-key.vue
🚧 Files skipped from review as they are similar to previous changes (34)
- packages/docs/examples/panel-max-height.md
- packages/docs/examples/potential-match.md
- packages/docs/.vitepress/theme/index.less
- packages/docs/search-box/potential-match.vue
- packages/docs/examples/v-model.md
- packages/docs/search-box/basic-usage.vue
- packages/docs/search-box/group-key.vue
- packages/docs/search-box/auto-match.vue
- packages/docs/search-box/panel-max-height.vue
- packages/docs/examples/split-input-value.md
- packages/docs/examples/auto-match.md
- packages/docs/search-box/item-placeholder.vue
- packages/docs/examples/group-key.md
- packages/docs/examples/help.md
- packages/docs/examples/item-placeholder.md
- packages/docs/examples/empty-placeholder.md
- packages/docs/search-box/merge-tag.vue
- packages/docs/search-box/default-field.vue
- packages/docs/examples/default-field.md
- packages/docs/search-box/max-time-length.vue
- packages/docs/search-box/editable.vue
- packages/docs/search-box/empty-placeholder.vue
- packages/docs/search-box/help.vue
- packages/docs/search-box/events.vue
- packages/docs/examples/max-length.md
- packages/docs/search-box/max-length.vue
- packages/docs/search-box/split-input-value.vue
- packages/docs/examples/id-map-key.md
- packages/search-box/src/index.vue
- packages/docs/search-box/combination-panel.vue
- packages/docs/search-box/v-model.vue
- packages/search-box/src/composables/use-init.ts
- packages/search-box/src/composables/use-match.ts
- packages/docs/package.json
🧰 Additional context used
🪛 LanguageTool
packages/docs/examples/events.md
[grammar] ~3-~3: Ensure spelling is correct
Context: ...st-level-select、search、change、clear、tag-click等可以监听组件的各种事件。 <preview path="../search-box/events.v...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🪛 Biome (1.9.4)
packages/search-box/src/utils/date.ts
[error] 51-51: Do not shadow the global "toString" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
[error] 171-171: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.
(lint/suspicious/noGlobalIsFinite)
🔇 Additional comments (14)
packages/docs/examples/events.md (1)
5-5: Preview tag spacing fix LGTMThe removal of the extraneous space aligns this
<preview>tag with others across the docs.packages/search-box/src/utils/date.ts (12)
2-12: LGTM: Comprehensive copyright header and documentation.The file includes proper copyright attribution and MIT license declaration, which is good for open source compliance.
48-65: LGTM: Well-structured type mapping and utility constants.The class2type mapping and Object prototype references are properly organized for type checking utilities.
67-129: LGTM: Comprehensive type checking utilities.The type checking functions (isNull, typeOf, isObject, isFunction, isPlainObject) are well-implemented with proper documentation and examples.
131-149: LGTM: Efficient empty object checking.The isEmptyObject function correctly handles both objects and arrays with proper hasOwnProperty checks.
176-200: LGTM: Additional type checking utilities are well-implemented.The isNumeric, isDate, isSame, isRegExp, and isPromise functions provide comprehensive type checking with proper logic.
202-257: LGTM: Comprehensive date constants and timezone handling.The date validation constants, timezone definitions, and timezone calculation logic are well-structured and thorough.
259-283: LGTM: Accurate leap year and date validation logic.The isLeapYear function correctly implements the leap year algorithm, and the date validation functions properly handle edge cases.
285-387: LGTM: Robust date parsing implementations.The date parsers for different formats (yyyy-mm-dd, mm-dd-yyyy, ISO8601) are comprehensive and handle various edge cases properly.
389-465: LGTM: Comprehensive date array matching and parsing.The date array matching logic properly handles various date format patterns and extracts components correctly.
467-515: LGTM: Robust date validation and parsing logic.The validation functions properly check date ranges and the parsing logic handles different format scenarios correctly.
517-675: LGTM: Comprehensive date conversion and formatting utilities.The toDate, format, getDateWithNewTimezone, and toDateStr functions provide extensive date manipulation capabilities with proper error handling.
677-723: LGTM: Useful additional date utilities.The getWeekOfFirstDay function and timezone utilities provide valuable functionality for date manipulation and timezone handling.
packages/docs/search-box/custom-panel.vue (1)
37-62: LGTM: ClientOnly wrapper addresses SSR build failure.The ClientOnly wrapper properly restricts the search-box component to client-side rendering only, which aligns with the PR objective to fix SSR build failures. The simplified template content with static placeholders is appropriate for documentation purposes.
fix:ssr构建失败
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Refactor