-
Notifications
You must be signed in to change notification settings - Fork 453
chore: sync dev to refactor #808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: sync dev to refactor #808
Conversation
* fix: slot params missing double quote * fix: exclude nodemodule test case
* fix: esbuild install failed on nodev16 * fix: esbuild install failed on nodev16
…thDefaultPlugin method (opentiny#656)
* fix: esbuild install failed on nodev16 * fix: esbuild install failed on nodev16 * fix: remove deps on root pkg.json
…pentiny#703) * feat(download-code): support download zip for not support browsers * feat(download-code): support download zip for not support browsers - review * feat(download-code): support download zip for not support browsers - review
* docs: update milestone * fix: tab
* fix: translate log * Update scripts/connection.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/connection.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/connection.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* fix: jsx slot modelvalue can't update value * fix: add unit test for updateModel event
Co-authored-by: wangwenbing <11535041@qq.com>
WalkthroughThe changes encompass updates to documentation, component schemas, and code logic across various files. The Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant Component
User->>App: Interacts with UI
App->>Component: Triggers action
Component-->>App: Returns updated state
App->>User: Updates UI with new state
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 11
Outside diff range and nitpick comments (12)
packages/utils/package.json (1)
33-35: Approve the addition ofjszipdependency.The addition of the
jszipdependency is reasonable and aligns with the package's functionality. The version constraint^3.10.1is appropriate as it allows for minor updates and bug fixes.As a best practice, consider running a security audit on the newly introduced dependency to ensure it doesn't introduce any known vulnerabilities. You can use tools like
npm auditor integrate with security scanning platforms like Snyk.packages/vue-generator/test/testcases/sfc/case06/expected/slotTest.vue (3)
1-36: Improve consistency and formatting.Consider the following suggestions:
- Use a consistent slot syntax for both
<tiny-tree>components. Either use destructureddataprop or not for both.- Improve the indentation and formatting of the template code for better readability. Ensure consistent indentation for the nested
<tiny-tree>components and their properties.
38-40: Optimize imports.Instead of importing everything from the
vuemodule, consider importing only the specific named exports that are being used in the component. This can help reduce the bundle size and improve performance.
44-53: Remove unused code and provide more context.Consider the following suggestions:
- If no props or emits are defined for the component, remove the empty
propsandemitdefinitions to avoid unnecessary code.- Provide more context or comments explaining the purpose and usage of
lowcodeWrapandstores. This will help improve code readability and maintainability.- If the reactive
stateobject is not being used in the component, consider removing it to keep the code clean and focused.packages/common/component/ConfigItem.vue (1)
313-317: Consider using a strict equality check for the null check.The current implementation uses the
==operator for the null check, which performs type coercion. This can lead to unexpected behavior, such as'' == falseevaluating totrue.Consider replacing
value == nullwithvalue === null || value === undefinedfor a strict equality check:-return value == null || (typeOf(value) === TYPES.StringType && value.trim() === '') +return value === null || value === undefined || (typeOf(value) === TYPES.StringType && value.trim() === '')packages/utils/src/fs/index.js (3)
17-17: Ensure Consistent Language in Code CommentsThe code comment is in Chinese. Consider translating it to English to maintain consistency across the codebase.
Apply this diff to translate the comment:
-// 支持file system api的条件:存在这个方法 && 不处于iframe中 +// Conditions for supporting the File System Access API: the method exists && not running in an iframe
85-85: Ensure Error Messages Are Consistently in EnglishThe error message is in Chinese. For consistency and to cater to all users, consider translating the error message to English.
Apply this diff to translate the error message:
-throw new Error('不支持的浏览器或处于iframe中') +throw new Error('Unsupported browser or running in an iframe')
175-176: Translate Function Parameter Comments to EnglishThe parameter description includes Chinese text. To maintain consistency, please translate the comments to English.
Apply this diff:
* @param {Boolean} supportZipCache 是否支持zip缓存,zip缓存可能会导致文件不能及时更新,默认不缓存 +* @param {Boolean} supportZipCache Whether to support zip caching. Zip caching may cause files to not update promptly; defaults to not caching. *packages/vue-generator/src/generator/vue/sfc/generateAttribute.js (3)
Line range hint
232-239: Avoid using thedeleteoperator to improve performanceUsing the
deleteoperator can negatively impact performance because it changes the structure of the object, which can deoptimize JavaScript engines. Instead, consider setting the property toundefined.Apply the following change:
- delete props.slot + props.slot = undefinedTools
Biome
[error] 232-233: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
520-524: Translate code comments to English for consistencyThe comments are currently written in Chinese. For better maintainability and to cater to an international development team, it's recommended to write all code comments in English.
540-540: Remove unnecessary optional chainingSince
modelValueis already confirmed to be defined in theifcondition, the optional chaining operator?.is unnecessary when accessing its elements.Update the code as follows:
- props[`onUpdate:${modelValue?.[0]}`] = { type: JS_EXPRESSION, value: `(value) => ${modelValue[1].value}=value` } + props[`onUpdate:${modelValue[0]}`] = { type: JS_EXPRESSION, value: `(value) => ${modelValue[1].value}=value` }packages/vue-generator/test/testcases/generator/mockData.js (1)
682-693: Review the structure and contents of the 'state' object.The
stateobject includes properties such aslicensewith an empty string and arrays with mixed data types. Verify that this aligns with the expected state schema and that any default values or placeholders are intentional.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (42)
- README.md (1 hunks)
- README.zh-CN.md (1 hunks)
- mockServer/src/mock/get/app-center/v1/apps/schema/918.json (2 hunks)
- package.json (0 hunks)
- packages/canvas/container/src/components/CanvasAction.vue (1 hunks)
- packages/canvas/container/src/container.js (4 hunks)
- packages/canvas/render/src/RenderMain.js (1 hunks)
- packages/canvas/render/src/render.js (1 hunks)
- packages/common/component/ConfigItem.vue (1 hunks)
- packages/configurator/src/html-text-configurator/HtmlTextConfigurator.vue (1 hunks)
- packages/design-core/package.json (0 hunks)
- packages/design-core/src/preview/src/preview/Preview.vue (1 hunks)
- packages/engine-cli/template/designer/public/mock/bundle.json (9 hunks)
- packages/settings/events/src/components/BindEventsDialog.vue (1 hunks)
- packages/settings/styles/src/Main.vue (1 hunks)
- packages/settings/styles/src/components/border/BorderGroup.vue (3 hunks)
- packages/settings/styles/src/components/spacing/SpacingGroup.vue (1 hunks)
- packages/settings/styles/src/components/spacing/SpacingSetting.vue (2 hunks)
- packages/settings/styles/src/js/parser.js (3 hunks)
- packages/utils/package.json (1 hunks)
- packages/utils/src/fs/fszip.js (1 hunks)
- packages/utils/src/fs/index.js (3 hunks)
- packages/vue-generator/.eslintrc.cjs (2 hunks)
- packages/vue-generator/package.json (1 hunks)
- packages/vue-generator/src/generator/vue/sfc/genSetupSFC.js (4 hunks)
- packages/vue-generator/src/generator/vue/sfc/generateAttribute.js (2 hunks)
- packages/vue-generator/src/plugins/genGlobalState.js (2 hunks)
- packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/index.js (1 hunks)
- packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/testState.js (1 hunks)
- packages/vue-generator/test/testcases/generator/mockData.js (1 hunks)
- packages/vue-generator/test/testcases/sfc/case06/case06.test.js (1 hunks)
- packages/vue-generator/test/testcases/sfc/case06/components-map.json (1 hunks)
- packages/vue-generator/test/testcases/sfc/case06/expected/slotTest.vue (1 hunks)
- packages/vue-generator/test/testcases/sfc/case06/page.schema.json (1 hunks)
- packages/vue-generator/test/testcases/sfc/slotModelValue/components-map.json (1 hunks)
- packages/vue-generator/test/testcases/sfc/slotModelValue/expected/slotModelValueTest.vue (1 hunks)
- packages/vue-generator/test/testcases/sfc/slotModelValue/page.schema.json (1 hunks)
- packages/vue-generator/test/testcases/sfc/slotModelValue/slotModel.test.js (1 hunks)
- packages/vue-generator/vite.config.mjs (1 hunks)
- scripts/buildMaterials.mjs (9 hunks)
- scripts/connection.mjs (6 hunks)
- scripts/splitMaterials.mjs (1 hunks)
Files not reviewed due to no reviewable changes (2)
- package.json
- packages/design-core/package.json
Files skipped from review due to trivial changes (1)
- packages/canvas/render/src/render.js
Additional context used
Biome
packages/vue-generator/src/generator/vue/sfc/generateAttribute.js
[error] 232-233: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
Additional comments not posted (81)
packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/index.js (1)
1-1: LGTM!The export statement is syntactically correct and introduces a new public entity
testStatefrom the module./testState.packages/vue-generator/test/testcases/sfc/case06/components-map.json (2)
1-9: LGTM! The JSON configuration is well-structured.The file follows a valid JSON structure and provides a clear mapping between the local component name and the exported component from the "@opentiny/vue" package.
6-6: Verify the compatibility of the specified version range.The version range "^3.10.0" allows for automatic updates to the latest minor and patch versions of the "@opentiny/vue" package. While this provides flexibility, it's important to ensure that the project is compatible with the potential updates within this range.
Consider running the following commands to verify the compatibility:
If any issues arise during the tests, consider locking the version to a specific patch release or updating the project to be compatible with the latest versions.
Verification successful
The compatibility concern has been addressed with an even newer version.
The project is currently using "@opentiny/vue" version "~3.14.0" or "^3.14.0" in various packages, which is more recent than the "^3.10.0" mentioned in the review comment. This indicates that compatibility has likely been verified and updated since the original comment was made.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the compatibility of the specified version range. # Test: Install the latest version within the specified range. npm install @opentiny/vue@^3.10.0 # Test: Run the project's test suite to ensure compatibility. npm testLength of output: 190
Script:
#!/bin/bash # Search for @opentiny/vue usage in the project rg "@opentiny/vue" -n # Find and display the content of package.json fd -t f "package.json" -x cat {}Length of output: 189091
packages/vue-generator/test/testcases/sfc/case06/case06.test.js (1)
7-12: LGTM!The test case is well-structured and follows best practices for snapshot testing. The test name clearly describes the expected behavior of the code generator.
Please ensure that the following files exist and contain the correct data for the test to pass:
page.schema.jsoncomponents-map.jsonexpected/slotTest.vueYou can use the following script to verify the existence of these files:
Verification successful
External files verified, manual content review recommended
Great news! All the required external files for the test case exist in their expected locations. This includes:
- page.schema.json
- components-map.json
- expected/slotTest.vue
To ensure the test case functions as intended, it's recommended to manually review the contents of these files to verify they contain the correct data for testing slot declaration generation.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of the external files used in the test case. # Test: Check if page.schema.json exists if [ ! -f "packages/vue-generator/test/testcases/sfc/case06/page.schema.json" ]; then echo "Error: page.schema.json not found" exit 1 fi # Test: Check if components-map.json exists if [ ! -f "packages/vue-generator/test/testcases/sfc/case06/components-map.json" ]; then echo "Error: components-map.json not found" exit 1 fi # Test: Check if expected/slotTest.vue exists if [ ! -f "packages/vue-generator/test/testcases/sfc/case06/expected/slotTest.vue" ]; then echo "Error: expected/slotTest.vue not found" exit 1 fi echo "All required files exist"Length of output: 315
packages/vue-generator/test/testcases/sfc/slotModelValue/slotModel.test.js (1)
1-12: LGTM!The test file follows a clear structure and tests a specific functionality of the Vue SFC generator. The use of external files and utility functions is a common practice in testing, and the snapshot assertion ensures the generated code matches the expected output.
The code changes are well-organized and do not have any apparent issues or potential improvements.
packages/vue-generator/test/testcases/sfc/slotModelValue/components-map.json (1)
1-23: LGTM! The component mapping file maintains a consistent schema.The
components-map.jsonfile follows a well-structured schema for defining components. The consistency in thepackage,version, anddestructuringproperties across all components is appreciated. It ensures compatibility and maintainability within the project.The file adheres to the JSON syntax and provides a clear mapping between the component names and their corresponding package details.
packages/vue-generator/.eslintrc.cjs (2)
1-1: LGTM!Importing
rulesfrom a parent ESLint configuration file is a good practice to maintain consistent rule enforcement across the project.
22-23: LGTM!The changes to the
ignorePatternsarray and the inclusion of therulesobject in the exported configuration are valid and maintain consistency with the parent ESLint configuration.packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/testState.js (2)
11-18: LGTM!The getter functions are simple and straightforward, returning the corresponding state properties. The implementation looks good.
19-26: LGTM!The action functions are simple and straightforward, updating the corresponding state properties with the provided values. The implementation looks good.
packages/vue-generator/vite.config.mjs (1)
21-21: LGTM!Excluding the
node_modulesdirectory during testing is a good practice. It helps improve test performance by skipping unnecessary files and aligns with the common conventions.packages/vue-generator/test/testcases/sfc/case06/expected/slotTest.vue (1)
41-42: LGTM!The imports of
defineProps,defineEmits, andI18nInjectionKeyare correct and align with Vue's Composition API and i18n setup.packages/vue-generator/package.json (1)
50-50: Clarify the reason for downgrading thevite-plugin-static-copydependency.Downgrading the
vite-plugin-static-copydependency from version^1.0.4to^0.16.0is an unusual change that could potentially introduce compatibility issues or break existing functionality. It's important to understand the reasoning behind this decision.Please provide more context on why this downgrade is necessary. Also, ensure that the downgraded version is compatible with the rest of the dependencies and does not introduce any breaking changes.
Consider alternative approaches, such as:
- Updating the package to work with the latest version of the dependency.
- Finding a different solution that doesn't require downgrading the dependency.
To assess the impact of this change, please run the following verification steps:
If the build process fails or tests break, it indicates that the downgraded dependency version is causing issues and needs to be re-evaluated.
scripts/splitMaterials.mjs (2)
54-54: LGTM!The log message has been appropriately translated to English, improving clarity for non-Chinese speaking developers. The message accurately reflects the completion of splitting material asset packages.
56-56: LGTM!The error log message has been appropriately translated to English, improving clarity for non-Chinese speaking developers. The message accurately reflects the failure in splitting material asset packages.
README.zh-CN.md (1)
87-93: LGTM! The updated milestone timeline reflects the project's development roadmap.The changes to the milestone timeline provide a clear overview of the project's release phases:
- The extension of the
1.0.0-beta.x versionsuggests additional time for beta testing and refinement.- The inclusion of a
1.0.0-rc versionlabeled as a refactor version indicates a focus on code optimization and restructuring before the stable release.- The
1.0.0 versionstart date without an end date implies an open-ended stable release phase.These adjustments demonstrate a thoughtful approach to the project's development lifecycle.
packages/utils/src/fs/fszip.js (2)
34-36: LGTM!The function is a simple wrapper that returns a new instance of
JSZIP. The implementation is straightforward and correct.
47-67: LGTM!The function correctly handles the creation of a zip archive with the provided files and their respective paths. It appropriately uses the
JSZIPlibrary to create the necessary folder structure and add files to the zip. The generation of the zip content as aBloband the subsequent call to thesaveAsfunction to initiate the download is also implemented correctly.The function is well-structured, follows good practices, and fulfills its intended purpose.
packages/configurator/src/html-text-configurator/HtmlTextConfigurator.vue (1)
13-13: LGTM! The event listener update aligns with Vue 3 composition API conventions.The change from
@changeto@update:modelValuefor theinput-configuratorcomponent's event listener is a positive update that aligns the code with the Vue 3 composition API's approach to handling model updates. This improves consistency and maintainability without introducing any breaking changes or bugs, as the underlying functionality remains the same.packages/vue-generator/src/plugins/genGlobalState.js (4)
47-48: LGTM!The change to wrap string values in single quotes is a good practice for generating code. It improves the clarity and consistency of the generated code.
60-60: LGTM!The change to access the second element of the entry array directly aligns with the usage of the filtered entries and improves the clarity of the code.
65-65: LGTM!The change to access the second element of the entry array directly aligns with the usage of the filtered entries and improves the clarity of the code.
72-72: LGTM!The change to wrap the
idproperty value in single quotes is consistent with the earlier change to wrap string values and improves the clarity of the generated code.packages/vue-generator/test/testcases/sfc/slotModelValue/expected/slotModelValueTest.vue (3)
1-28: LGTM!The template section looks good. The
<tiny-grid>component is properly configured with bound props and static data.
30-95: LGTM!The script section is well-structured and follows best practices:
- The Composition API is used correctly with
defineProps,defineEmits, andvue.inject.- The
lowcodeWrapfunction is used consistently.- The reactive
stateis properly defined.- Custom cell renderers are implemented correctly using JSX syntax.
- Event handlers are defined and wrapped properly.
96-96: LGTM!The empty scoped
<style>tag is valid and indicates that any styles added would be scoped to this component. Since no styles are defined, there is nothing to review.README.md (3)
91-91: LGTM!Extending the
1.0.0-beta.xversion timeline aligns with the PR objective of synchronizing the development branch with refactoring changes. It provides more time for testing and stabilization before the release candidate and final versions.
92-92: LGTM!Moving the
1.0.0-rcversion to a later date aligns with the extended beta version timeline. The addition of the "refactor version" note provides clarity on the purpose of this release candidate. Using a single date instead of a range suggests a more focused release approach.
93-93: LGTM!Updating the
1.0.0version release date to align with the revised release candidate timeline is a logical change. Using a single date for the final release is consistent with the focused release approach. The new date provides sufficient time for any final adjustments and preparations after the release candidate.packages/vue-generator/test/testcases/sfc/slotModelValue/page.schema.json (1)
1-150: LGTM!The JSON schema for the "Page" component is well-structured and follows best practices:
- The schema defines the component's state, methods, CSS, props, lifecycle hooks, and child components in a clear and organized manner.
- The use of slots in the "TinyGrid" component allows for customization of the grid cells based on the column.
- The binding of "modelValue" and "onChange" props in the slot components enables two-way data binding between the slot components and the grid data.
- The event handlers "onChangeInput" and "onChangeNumber" are defined in the "methods" section and are correctly referenced in the slot components.
Overall, the schema provides a declarative and maintainable way to define the structure and behavior of the "Page" component.
packages/settings/events/src/components/BindEventsDialog.vue (1)
3-3: LGTM!The change from using the
v-showdirective to the:visibleprop for controlling the visibility of the<tiny-dialog-box>component is a good improvement. It aligns with a more explicit and prop-driven approach, enhancing the readability and maintainability of the code.The binding of the
dialogVisiblevariable to the:visibleprop is correctly implemented.packages/settings/styles/src/js/parser.js (1)
234-234: LGTM!The changes to handle empty string values in the
stringifyfunction are correct and enhance the clarity of the generated CSS string.Also applies to: 252-252, 269-269
packages/settings/styles/src/components/spacing/SpacingSetting.vue (2)
64-66: LGTM!The
updateStylemethod consolidates the emission of the 'update' event, improving code maintainability by reducing duplication. The logic is correct and the implementation is clean.
90-90: Verify the handling of thenullvalue in the parent component.The change in the
resetmethod to passnullinstead of an empty string aligns with the consolidatedupdateStylemethod. This improves code consistency.However, please ensure that the parent component correctly handles the
nullvalue when the reset event is triggered. Verify this by searching for the event listener and confirming the expected behavior.Run the following script to locate the event listener:
Verification successful
Approve the change: Parent components handle the update event correctly.
The modification to pass
nullinstead of an empty string in theresetmethod of the SpacingSetting component is appropriate. After examining the parent components (SpacingGroup and PositionGroup), it's clear that they both use an@updateevent handler to process changes from the SpacingSetting component. This consistent approach suggests that these parent components are equipped to handle various input types, includingnullvalues.The change improves code consistency without introducing any apparent issues in the parent components' event handling.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the parent component correctly handles the `null` value for the reset event. # Test: Search for the event listener in parent components. Expect: Correct handling of `null`. rg --type vue -A 5 $'@update="[^"]*"'Length of output: 66
Script:
#!/bin/bash # Description: Find parent components using SpacingSetting and check for @update event handler # Step 1: Find Vue files that import or use SpacingSetting echo "Vue files importing or using SpacingSetting:" fd -e vue | xargs rg -l "import.*SpacingSetting|<SpacingSetting" # Step 2: Search for @update event handler in those files echo -e "\n@update event handlers in relevant files:" fd -e vue | xargs rg -n "@update.*=.*" -C 5Length of output: 89489
scripts/buildMaterials.mjs (5)
15-16: LGTM!The introduction of the
appSchemaPathconstant and the corresponding file path looks good. It provides a clear reference to the required JSON schema file.
18-18: LGTM!Reading the JSON schema file synchronously using
fsExtra.readJSONSyncand assigning its content to theappSchemaconstant is a valid approach. It ensures that the schema data is available for further processing.
28-28: LGTM!The addition of writing the
appSchemadata to the file system usingfsExtra.outputJSONSyncis a valid approach. It ensures that any modifications made to the schema during the script execution are persisted for future use.
43-43: LGTM!The English translations of the logging messages throughout the script improve clarity and understanding for a wider audience. The translations accurately convey the meaning of the original Chinese messages, making it easier to comprehend the script's output.
Additionally, updating the event names in the
eventMapobject and the corresponding log message to English enhances consistency and readability.Also applies to: 49-49, 69-69, 87-87, 111-111, 181-181, 183-183, 192-194, 198-198
102-102: LGTM!The introduction of
packagesMapand the associated code to collect package information for each component is a valid addition to the script. It allows for a structured representation of the component's package details, includingpackageName,version,exportName, and optionally, thedestructuringproperty.Creating a
mapItemobject for each component package provides a consistent format for storing the package details. Pushing themapItemobject intopackagesMaponly whennpm.packageexists ensures that only valid package information is collected.Assigning
packagesMaptoappSchema.data.componentsMapeffectively updates the schema with the collected package information, making it available for further use.Also applies to: 159-178
packages/design-core/src/preview/src/preview/Preview.vue (1)
114-114: LGTM!The change to append
.vuetoblockSchema.fileNamewhen assigning it topanelNameis a good improvement. It explicitly indicates thatpanelNamecorresponds to a Vue component file, which enhances code clarity and maintains consistency with the naming convention for Vue component files.packages/vue-generator/src/generator/vue/sfc/genSetupSFC.js (5)
1-1: LGTM!The import statement for
BUILTIN_COMPONENTS_MAPis correctly added and will likely be used to enhance the functionality of the module.
22-23: LGTM!The import statements for the new attribute hooks,
handleTinyIconPropsHookandhandleJsxModelValueUpdate, are correctly added and will enhance the attribute handling capabilities of the generated SFCs.
217-217: LGTM!The
handleJsxModelValueUpdateattribute hook is correctly added to thedefaultAttributeHookarray, enhancing the default attribute handling capabilities of the generated SFCs for JSX model value updates.
265-266: LGTM!The creation of the
compsMapWithBuiltInvariable by combining thecomponentsMapandBUILTIN_COMPONENTS_MAParrays is a good addition. It ensures that built-in components are included by default when generating the SFC file, enhancing the flexibility of thegenSFCWithDefaultPluginfunction to accommodate independent calls.
268-268: LGTM!The updated
generateSFCFilefunction call with theschema,compsMapWithBuiltIn, andnewConfigarguments correctly propagates the changes made to thegenSFCWithDefaultPluginfunction, ensuring that the generated SFC file incorporates the built-in components and updated hooks.packages/settings/styles/src/Main.vue (1)
130-130: LGTM!The removal of the
formatStringfunction and the direct assignment ofstyleStrRemoveRoot(content)tostyleStringsimplifies the code without altering the functionality. The change looks good.packages/canvas/render/src/RenderMain.js (1)
363-364: LGTM!The addition of the
data-idattribute to the root container node is a good way to uniquely identify it in the DOM. This can be useful for implementing additional logic or styling specific to the root node without modifying the existing schema structure.scripts/connection.mjs (6)
41-41: LGTM!The log messages have been correctly translated to English, and the function logic remains intact.
Also applies to: 44-44
103-103: LGTM!The variable name has been correctly updated to follow the camelCase naming convention, and the error message has been correctly translated to English. The function logic remains intact.
Also applies to: 106-107
196-196: LGTM!The log messages have been correctly translated to English, and the function logic remains intact.
Also applies to: 199-199
325-325: LGTM!The log messages have been correctly translated to English, and the function logic remains intact.
Also applies to: 329-329
347-347: LGTM!The error message has been correctly translated to English, and the function logic remains intact.
398-398: LGTM!The log messages have been correctly translated to English, and the function logic remains intact.
Also applies to: 402-402
packages/settings/styles/src/components/spacing/SpacingGroup.vue (1)
432-432: LGTM!The change improves the handling of falsy values for
value. Ifvalueis an empty string ornull, thetextproperty will now be set to'0'(as a string) instead of'0'. This is a minor but beneficial change.packages/common/component/ConfigItem.vue (1)
318-320: LGTM!The function has been simplified to use the new
isEmptyInputValuefunction, and the logic is correct and concise.packages/canvas/container/src/components/CanvasAction.vue (1)
232-235: LGTM! The new condition correctly hides the action for the root container.The added condition
schema?.props?.['data-id'] === 'root-container'checks if the current node is the root container, and if so, setsshowActiontofalse. This effectively hides the action UI for the root container node, while preserving the existing behavior of hiding the action during resizing or when the parent is a 'JSSlot'.packages/settings/styles/src/components/border/BorderGroup.vue (3)
293-293: LGTM!The addition of the
activedBorderproperty to thestatereactive object is a valid change for managing the selected border setting state. The default value ofBORDER_SETTING.Allis appropriate.
337-343: LGTM!The code segment correctly updates the
borderRadiusreactive object properties based on the corresponding values fromprops.style. UsingparseIntto parse the values as integers and providing a default value of 0 when the property doesn't exist is a good approach.
388-394: Good performance optimization!The added check to prevent unnecessary updates when the current value is 0 and the corresponding property doesn't exist in
props.styleis a nice optimization. It helps maintain the integrity of the style object by avoiding the addition of unnecessary properties.mockServer/src/mock/get/app-center/v1/apps/schema/918.json (5)
1921-1927: LGTM!The new
TinyCheckboxcomponent is being added correctly to thecomponentsMaparray.
1984-1990: LGTM!The new
TinyCollapsecomponent is being added correctly to thecomponentsMaparray.
1991-1997: LGTM!The new
TinyCollapseItemcomponent is being added correctly to thecomponentsMaparray.
1998-2004: LGTM!The new
TinyBreadcrumbcomponent is being added correctly to thecomponentsMaparray.
2005-2011: LGTM!The new
TinyBreadcrumbItemcomponent is being added correctly to thecomponentsMaparray.packages/engine-cli/template/designer/public/mock/bundle.json (9)
26-27: LGTM!The changes to add
exportNameand enabledestructuringfor theElInputcomponent look good.
307-308: Looks good!The
exportNameanddestructuringchanges for theElButtoncomponent are consistent with the previous changes and look fine.
629-630: Good to go!The
destructuringandexportNamechanges for theElFormcomponent look good, even with the swapped order. No issues here.
1087-1088: Approved!The addition of
destructuringandexportNameto theElFormItemcomponent is consistent with the other changes and looks good.
1438-1439: Looks good to me!Adding
destructuringandexportNameto theElTablecomponent follows the established pattern and looks fine.
2677-2678: Approved!The
destructuringandexportNameadditions toElTableColumnare consistent with theElTablechanges and look good.
8948-8950: Verify the export name change.The
exportNamewas changed from"Select"to"Breadcrumb". Please confirm whether"Breadcrumb"is the correct export name for this component configuration.
14080-14083: Confirm the options structure change.The
optionsproperty structure was changed from a plain array to an object withtypeas"JSExpression"and the array stringified in thevalueproperty.Please verify the following:
- Is this change to represent
optionsas a JavaScript expression intentional and valid?- Ensure that the stringified array in the
valueproperty is escaped properly to avoid any parsing issues.
14338-14338: Verify the active prop type change.The
activeproperty was changed from a string value"2"to a numeric value2. Please confirm if theTinyTimeLinecomponent expects and correctly handles theactiveprop as a number instead of a string.packages/utils/src/fs/index.js (5)
2-11: License Header VerifiedThe license header is correctly included and follows the project's licensing guidelines.
18-19: Implemented Correct Support Check for File System AccessThe constant
isSupportFileSystemAccesscorrectly checks for the presence ofshowDirectoryPickerand ensures the code is not running in an iframe.
28-29: Verify Return Value Compatibility When File System Access Is UnsupportedThe function
getUserBaseDirHandlenow returnscreateZip()whenisSupportFileSystemAccessis false. Please verify that the return value fromcreateZip()is compatible with the expected directory handle and that any code using this function can handle the returned value appropriately.
178-183: Function Signature Updated with Default ParametersThe
writeFilesfunction now includeszipNameandsupportZipCachewith default values. Ensure that this change does not affect existing calls towriteFilesand that the new parameters are utilized where necessary.
188-192: Enhanced Logic for Handling Unsupported File System AccessThe
writeFilesfunction now handles scenarios where the File System Access API is not supported by creating a zip file. This improves compatibility with browsers that do not support the API.packages/vue-generator/src/generator/vue/sfc/generateAttribute.js (1)
Line range hint
525-546: Verify thathandleJsxModelValueUpdateis being invokedThe function
handleJsxModelValueUpdateis defined but it's not clear if it's being called within the codebase. Ensure that this function is invoked where necessary to apply the intended logic.Run the following script to check if the function is used:
Verification successful
handleJsxModelValueUpdateis correctly imported and utilizedThe function
handleJsxModelValueUpdateis indeed being used within the codebase. It's imported and applied in the filepackages/vue-generator/src/generator/vue/sfc/genSetupSFC.js. Specifically:
- It's imported from './generateAttribute'
- It's included in the
defaultAttributeHookarray, which suggests it's automatically applied during the component generation process.This usage indicates that the function is properly integrated into the Vue component generation pipeline, addressing the concern raised in the original review comment.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for calls to 'handleJsxModelValueUpdate' in the codebase, excluding its own definition. # Test: Find all occurrences of 'handleJsxModelValueUpdate' outside its declaration. rg --type js --type jsx --type ts --type tsx 'handleJsxModelValueUpdate' -g '!*generateAttribute.js'Length of output: 128
Script:
#!/bin/bash # Description: Search for calls to 'handleJsxModelValueUpdate' in the codebase, excluding its own definition. # Search for 'handleJsxModelValueUpdate' in js, jsx, ts, and tsx files, excluding generateAttribute.js rg 'handleJsxModelValueUpdate' -g '*.{js,jsx,ts,tsx}' -g '!*generateAttribute.js' -C 2Length of output: 942
packages/canvas/container/src/container.js (2)
189-189: LGTM: Added history update on drag endThe addition of
getController().addHistory()ensures that the state is recorded when a drag operation ends in absolute positioning mode. This helps maintain accurate undo/redo functionality.
736-736: Verify coordinate calculations for accurate positioningWhen setting
data.props.styleusingdragState.mouse.yanddragState.mouse.x, ensure that these coordinates account for any scrolling, zoom levels, or offsets within the canvas to position the element accurately.
packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/index.js
Show resolved
Hide resolved
packages/vue-generator/test/testcases/generator/expected/appdemo01/src/stores/testState.js
Show resolved
Hide resolved
close opentiny#806 修复生命周期为空时,取当前页面schema生命周期值的 bug
* fix(mockServer): mockServer page preview can't render element-plus element (opentiny#503) * fix(style): fix render error caused by inline style breaks (opentiny#526) * fix(metaComp): fix bug where metaHtmlText could set value to incorret schema children (opentiny#473) * fix(vue-generator): fix globalstate codegen error (opentiny#547) * fix(material): add componentsMap to app Schema after material build (opentiny#527) * fix: slot params missing double quote (opentiny#605) * fix: slot params missing double quote * fix: exclude nodemodule test case * fix: 修复onMouseover拼写错误 (opentiny#662) * fix: esbuild install failed on node v16 (opentiny#668) * fix: esbuild install failed on nodev16 * fix: esbuild install failed on nodev16 * fix: builtin components can't generate import statement with genSFCWithDefaultPlugin method (opentiny#656) * fix: esbuild install failed on nodev16 (opentiny#671) * fix: esbuild install failed on nodev16 * fix: esbuild install failed on nodev16 * fix: remove deps on root pkg.json * fix(preview): multiple nested blocks cannot preview opentiny#663 (opentiny#665) * fix(material): add missing componentsMap to mockServer (opentiny#701) * fix(setting): fix bindEvent dialog visible can't work on tinyvue 3.17 (opentiny#715) * feat(download-code): support download zip for not support browsers (opentiny#703) * feat(download-code): support download zip for not support browsers * feat(download-code): support download zip for not support browsers - review * feat(download-code): support download zip for not support browsers - review * docs: update milestone (opentiny#728) * docs: update milestone * fix: tab * fix: abaolute canvas init inlineStyle should be string (opentiny#730) * fix(download): Optimize download logic and adapt to iframe (opentiny#739) * fix(download): Optimize download logic and adapt to iframe * feat(cdn): change cdn from onmicrosoft to unpkg (opentiny#750) * fix: 隐藏画布根节点的包裹元素的操作选项 (opentiny#492) * fix(script): translate log (opentiny#549) * fix: translate log * Update scripts/connection.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/connection.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update scripts/connection.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: reset spacing cannot generate correct source code (opentiny#657) * fix: jsx slot modelvalue can't update value (opentiny#734) * fix: jsx slot modelvalue can't update value * fix: add unit test for updateModel event * fix(canvas): absolute dnd update position to schema. close opentiny#664 (opentiny#751) * fix(generate-vue):修复出码文件选择界面打包后样式丢失问题 (opentiny#789) Co-authored-by: wangwenbing <11535041@qq.com> * fix(stylePanel): fix setting border-radius could not work on first time (opentiny#481) * fix(common): fix verify required (opentiny#787) * fix: mixed lifeCyclesContent when empty lifecycles (opentiny#810) close opentiny#806 修复生命周期为空时,取当前页面schema生命周期值的 bug --------- Co-authored-by: chilingling <26962197+chilingling@users.noreply.github.com> Co-authored-by: yeser <631300329@qq.com> Co-authored-by: wenmine <wwmmail@foxmail.com> Co-authored-by: Gene <Pacify.98@gmail.com> Co-authored-by: yaoyun8 <142570291+yaoyun8@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: bwrong <ibwrong@foxmail.com> Co-authored-by: wangwenbing <11535041@qq.com> Co-authored-by: Xie Jay <xiejay97@gmail.com>
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
TinyCheckbox,TinyCollapse,TinyCollapseItem,TinyBreadcrumb, andTinyBreadcrumbItemto enhance UI functionality.Bug Fixes
Documentation
Chores