How dream-num/luckysheet works
Main Components
• Frontend/User Interface: The UI includes the HTML container (src/index.html) and associated JavaScript (src/index.js) that initializes and renders the spreadsheet. The UI displays the grid, menus, toolbars, cell formatting controls, and plugins.
• Data Layer: Include the “src/data” folder and demo data in “src/demoData” to represent how sheet data, chart configurations, comments, formulas, etc. are structured and stored. This layer is responsible for managing state changes.
• Global and Utility Modules: The “src/global” and “src/utils” directories contain utility functions (such as drawing, API calls, configuration, event binding, etc.) that support interactions between components.
• Plugins and Extensions: The “src/plugins” and “src/expendPlugins” directories add extra functionality for charts, Excel import/export, print, etc.
• Configuration and Localization: The “src/config.js” and “src/locale” provide customization, internationalization, and initial settings.
• Store/State Management: The “src/store” (index.js) acts as a central state or data store, which several modules depend on for session information and data consistency.
Relationships and Interactions
• The UI layer interacts directly with the business logic controllers; for example, user events such as cell selection or formatting trigger controller functions.
• Controllers communicate with the data layer to update cell values and with the store to maintain overall application state.
• Utility modules (in “global” and “utils”) are invoked by controllers and the store to perform common functions like rendering, math calculations, and event processing.
• Plugin components extend core functionalities. For instance, the chart plugin in “src/expendPlugins/chart” integrates with sheet data and the UI to render dynamic charts.
• Configuration and localization files are injected into various layers (controllers, UI, and plugins), ensuring adaptability and international support.
Incorporate Relevant Technologies and Frameworks
• JavaScript and jQuery (as implied by the demo code snippet using $() in the README).
• CSS for styling, with custom stylesheet modules in “src/css”.
• Build tools like gulp (gulpfile.js) and configuration files (package.json, commitlint.config.js) indicate a Node.js-based build environment.
• Integration with third-party dependency management (CDN links for plugins in the usage example) should be noted.