Cross-frame table component implementation method and device for configuring driving and adaptive rendering
By implementing a cross-frame table component with configuration-driven and adaptive rendering, the problems of configuration complexity, development efficiency, cross-frame reusability, and large-scale data rendering performance of traditional table components are solved. It achieves efficient cross-frame adaptation and optimized rendering, improving development efficiency and rendering performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-23
- Publication Date
- 2026-03-24
AI Technical Summary
Traditional table components have issues with configuration complexity, development efficiency, cross-framework reusability, and large-scale data rendering performance, making them unable to meet the complex needs of enterprise applications.
The cross-frame table component implementation method adopts configuration-driven and adaptive rendering. It generates standardized configuration objects through a configuration parsing engine, performs attribute mapping and component inference in combination with an intelligent property converter, and uses an adaptive rendering engine for cross-frame adaptation and rendering optimization. It supports multi-frame operation and monitors user interaction and configuration changes in real time to dynamically adjust the rendering strategy.
Significantly improves development efficiency, supports multi-framework operation, enables smooth rendering of 100,000-level data, has intelligent inference and adaptive adjustment capabilities, reduces template code, and optimizes rendering performance.
Smart Images

Figure CN121387287B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and apparatus for implementing a cross-frame table component with configuration-driven and adaptive rendering, belonging to the field of front-end development technology. Background Technology
[0002] In front-end development, table components are one of the core components for data display. As enterprise applications become more complex, the requirements for table components are also becoming increasingly complex.
[0003] Traditional table component development faces the following problems: 1) The contradiction between configuration complexity and development efficiency: Although traditional table components offer rich functionality, the configuration process is complex, the learning cost is high, and the development efficiency is low. 2) Technical barriers to cross-framework component reuse: Table components of different front-end frameworks (such as Vue, React, Angular) cannot be directly reused, leading to increased costs of repeated development and maintenance. 3) Performance bottlenecks in large-scale data rendering: Traditional table components have significant performance problems when processing large-scale data, such as rendering stuttering and excessive memory consumption. 4) Fragmented functionality and low reusability: Existing table components often only solve part of the problem, with scattered functionality and poor reusability.
[0004] Existing technologies, such as CN114218906A, disclose a method for implementing a table data formatting component based on Vue, but it is limited to the Vue framework and has relatively simple functionality. CN120561123A discloses a configuration-based general data table system, but it lacks cross-framework adaptation and intelligent inference capabilities. Therefore, there is an urgent need for a technical solution that can solve the above problems. Summary of the Invention
[0005] To address the aforementioned issues, this invention proposes a method and apparatus for implementing cross-frame table components with configuration-driven and adaptive rendering.
[0006] The technical solution adopted by this invention to solve its technical problem is as follows:
[0007] In a first aspect, the present invention provides a method for implementing a cross-frame table component with configuration-driven and adaptive rendering, comprising the following steps:
[0008] Step S1: Receive configuration information input, the configuration information including column configuration information, data source configuration information and rendering configuration information;
[0009] Step S2: The configuration information is parsed using a configuration parsing engine to generate a standardized configuration object;
[0010] Step S3: Based on the standardized configuration object, perform attribute mapping and component inference through the intelligent attribute converter to generate the underlying component configuration;
[0011] Step S4: The adaptive rendering engine performs cross-framework adaptation and rendering optimization based on the underlying component configuration.
[0012] Step S5: Obtain data based on the data source configuration information and display it in a table based on the rendering results;
[0013] Step S6: Monitor user interactions and configuration changes in real time and dynamically adjust the rendering strategy.
[0014] Secondly, an embodiment of the present invention provides a configuration-driven and adaptive rendering cross-frame table component implementation apparatus, comprising:
[0015] A configuration receiving module is used to receive configuration information input, which includes column configuration information, data source configuration information, and rendering configuration information.
[0016] The configuration parsing module is used to parse the configuration information through the configuration parsing engine and generate standardized configuration objects;
[0017] The intelligent conversion module is used to generate the underlying component configuration by performing attribute mapping and component inference through the intelligent attribute converter based on the standardized configuration object.
[0018] The adaptive rendering module is used to perform cross-framework adaptation and rendering optimization based on the configuration of the underlying components through the adaptive rendering engine.
[0019] The data management module is used to retrieve data based on the data source configuration information and display it in a table based on the rendering results.
[0020] The dynamic adjustment module is used to monitor user interactions and configuration changes in real time and dynamically adjust the rendering strategy.
[0021] Thirdly, an electronic device provided by an embodiment of the present invention includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the cross-frame table component implementation method with arbitrary configuration driving and adaptive rendering as described above.
[0022] Fourthly, embodiments of the present invention provide a storage medium storing a computer program, which, when run by a processor, executes the steps of the cross-frame table component implementation method described above for arbitrary configuration driving and adaptive rendering.
[0023] One of the above technical solutions has the following advantages or beneficial effects:
[0024] 1. Significantly improved development efficiency: By using a configuration-driven approach, more than 90% of template code has been reduced, and development time has been reduced from an average of 8 hours to less than 1 hour.
[0025] 2. Strong cross-framework adaptability: Supports mainstream front-end frameworks such as Vue, React, and Angular, enabling a single codebase to run across multiple frameworks.
[0026] 3. Significantly improved rendering performance: Through virtual DOM optimization, batch rendering and other technologies, it supports smooth rendering of 100,000 data points.
[0027] 4. Outstanding intelligent inference capabilities: It can automatically infer appropriate editing components and validation rules based on field names, data types, etc.
[0028] 5. Strong adaptive adjustment capability: It can dynamically adjust the rendering strategy according to device performance, network conditions, etc. Attached Figure Description
[0029] Figure 1 This is a flowchart illustrating a configuration-driven and adaptive rendering cross-frame table component implementation method according to an exemplary embodiment;
[0030] Figure 2 This is a schematic diagram of a configuration-driven and adaptive rendering cross-frame table component implementation device according to an exemplary embodiment;
[0031] Figure 3 This is a flowchart illustrating a data source processing method according to an exemplary embodiment;
[0032] Figure 4 This is a schematic diagram of a three-layer architecture of a smart table component according to an exemplary embodiment;
[0033] Figure 5 This is an example of an automated paging loading flowchart.
[0034] Figure 6 This is a flowchart illustrating a dynamic injection and update mechanism for verification rules at runtime, according to an exemplary embodiment. Detailed Implementation
[0035] To more clearly illustrate the technical features of the present invention, the present invention will be described in detail below through specific embodiments and in conjunction with the accompanying drawings.
[0036] like Figure 1 As shown in the figure, an embodiment of the present invention provides a method for implementing a cross-frame table component with configuration-driven and adaptive rendering, which includes the following steps:
[0037] Step S1: Receive configuration information input, which includes column configuration information, data source configuration information, and rendering configuration information.
[0038] Specifically, step S1 includes the following steps: step S11, receiving interactive configuration input from the user through a graphical configuration interface; step S12, receiving declarative configuration input through a JSON configuration file; step S13, receiving programmatic configuration input through an API interface; and step S14, selecting a predefined configuration template through a configuration template library.
[0039] As one possible implementation of this embodiment, the column configuration information includes:
[0040] The basic attributes module includes field name (prop), display name (label), column width (width), alignment (align), column fixing method (fixed), and visibility (visible), as shown in Table 1, defining the most basic meta-information of the column;
[0041] Editing and Validation Module: Includes editability, edit component type, edit options, and validation rules, as shown in Table 2, with declarative definitions for editing and validation rules;
[0042] The UI presentation and formatting module includes a data formatter, a cell class name, and a cell renderer, as shown in Table 3, which control how the data is displayed.
[0043] Interaction and Functional Modules: These include sortability and filterability, as shown in Table 4.
[0044] Table 1: Basic Attribute Module
[0045]
[0046] Table 2: Editing and Verification Module
[0047]
[0048] Table 3: UI Presentation and Formatting Modules
[0049]
[0050] Table 4: Interaction & Function Module
[0051]
[0052] As one possible implementation of this embodiment, the data source configuration information includes:
[0053] Static data mode: Directly configure local data arrays;
[0054] Dynamic API mode: Configure API request functions to support asynchronous data retrieval;
[0055] Hybrid data mode: Supports a combination of static and dynamic data.
[0056] As one possible implementation of this embodiment, the rendering configuration information includes:
[0057] Pagination configuration: includes whether to display pagination, the number of items per page, and the paginator type;
[0058] Virtual scrolling configuration: includes whether to enable virtual scrolling, buffer size, and scrolling threshold;
[0059] Style configuration: includes table borders, zebra stripes, row height, and cell inner margins;
[0060] Performance configuration: includes rendering batch size, lazy loading threshold, and caching strategy.
[0061] Step S2: The configuration information is parsed by the configuration parsing engine to generate a standardized configuration object.
[0062] Specifically, step S2 includes the following steps: Step S21, verifying the integrity and syntactic correctness of the configuration information, and converting configurations of different formats into a unified format; Step S22, parsing the dependencies between configuration items and injecting default values for unconfigured options; Step S23, converting configurations from different sources into a unified data structure; Step S24, converting string configurations into corresponding data types and converting relative values into absolute values; Step S25, merging multiple configuration sources into a single configuration object.
[0063] As one possible implementation of this embodiment, the verification of the integrity and syntactic correctness of the configuration information includes:
[0064] Syntax validation: Checks the correctness of the JSON or YAML format;
[0065] Semantic validation: Verifies the logical correctness of configuration items;
[0066] Integrity check: Checks whether the required configuration items are complete;
[0067] Consistency check: Checks the consistency between configuration items.
[0068] As one possible implementation of this embodiment, the dependencies between the parsed configuration items include:
[0069] Column dependency analysis: Analyzes the explicit dependencies between columns;
[0070] Data dependency analysis: Analyze the dependencies between data sources and column configurations;
[0071] Rendering dependency analysis: Analyze the dependencies between rendering configuration and component configuration;
[0072] Generate a dependency graph: Construct a dependency graph for configuration items.
[0073] Step S3: Based on the standardized configuration object, perform attribute mapping and component inference through the intelligent attribute converter to generate the underlying component configuration.
[0074] Specifically, step S3 includes the following steps: Step S31, perform basic attribute mapping, mapping standardized attribute names to underlying component attribute names; Step S32, perform intelligent inference of edit attributes, inferring appropriate edit component types based on field features; Step S33, perform dynamic compilation of validation rules, compiling declarative validation rules into executable validation functions; Step S34, perform UI attribute conversion, converting advanced UI configurations into underlying rendering configurations.
[0075] As one possible implementation of this embodiment, the basic attribute mapping includes: establishing a mapping table between standardized attribute names and underlying component attribute names; traversing all attributes of the user configuration object and performing key-name conversion; keeping the attribute values unchanged and only converting the attribute names; and outputting the basic configuration object after key-name conversion.
[0076] As one possible implementation of this embodiment, the intelligent inference of edit attributes includes: heuristic inference based on field names to identify keywords in field names; type inference based on sample data to analyze the type characteristics of field values; optimization inference based on user feedback to adjust inference rules according to historical usage data; and contextual inference based on business scenarios to consider the special needs of the current business scenario.
[0077] As one possible implementation of this embodiment, the heuristic inference based on field names specifically includes: identifying field names containing the keywords "time" or "date" and inferring them as date pickers; identifying field names containing the keywords "email" or "mail" and inferring them as input boxes with automatic email verification; identifying field names containing the keywords "age" or "amount" and inferring them as numeric input boxes; identifying field names containing the keywords "status" or "type" and inferring them as dropdown selectors; and identifying field names containing the keywords "phone" or "mobile" and inferring them as input boxes with automatic mobile phone number format verification.
[0078] As one possible implementation of this embodiment, the dynamic compilation of the verification rules includes: identifying the type of verification rule, including string rules, regular expressions, configuration objects, and user-defined functions; converting string rules into corresponding verification function implementations; compiling regular expressions into executable verification functions; and converting configuration objects into complete verification rule configurations.
[0079] Step S4: The adaptive rendering engine performs cross-framework adaptation and rendering optimization based on the underlying component configuration.
[0080] Specifically, step S4 includes the following steps: Step S41, establish a unified state management mechanism and maintain a unique responsive data source; Step S42, capture and extract edit events and listen for edit events of underlying components; Step S43, perform intelligent data synchronization, automatically update internal states and persist data; Step S44, perform semantic event notification and convert underlying events into business semantic events.
[0081] As one possible implementation of this embodiment, the unified state management mechanism includes: maintaining the state of centralized table data to ensure data consistency; implementing responsive data binding to automatically trigger view updates; managing pagination state, including the current page number and the number of items per page; and managing sorting and filtering state, supporting multi-column sorting and complex filtering.
[0082] As one possible implementation of this embodiment, the capture and data extraction of the editing event includes: listening to the native editing events of the underlying table component; extracting context information from the event object, including row data and column information; obtaining a comparison of data before and after editing to identify specific data changes; and capturing metadata of the editing operation, including the editing time and the user of the operation.
[0083] As one possible implementation of this embodiment, the intelligent data synchronization includes: using row identifiers to accurately locate the record that needs to be updated in the internal data array; using reactive operations to merge the new data into the existing record; automatically deciding whether to initiate an asynchronous update request based on the data source type; and realizing batch processing of data changes to optimize performance.
[0084] As one possible implementation of this embodiment, the adaptive rendering engine supports cross-framework adaptation: implementing a Vue framework adapter, using Vue's reactive system and template syntax; implementing a React framework adapter, using JSX syntax and Hooks mechanism; implementing an Angular framework adapter, using template syntax and data binding; and establishing unified component lifecycle management to ensure consistent behavior across frameworks.
[0085] As one possible implementation of this embodiment, the unified component lifecycle management includes: an initialization phase, parsing configuration and initializing the state manager; a DOM mounting phase, obtaining DOM references and initializing third-party library instances; an update phase, responding to configuration changes and recalculating derived states; and a destruction phase, cleaning up event listeners and releasing resources.
[0086] As one possible implementation of this embodiment, the adaptive rendering engine also includes a performance optimization mechanism: implementing virtual DOM differential comparison to optimize rendering performance; implementing rendering batch processing and asynchronous updates to reduce the number of re-renderings; implementing memory usage optimization and garbage collection to reduce memory consumption; and implementing real-time performance monitoring and adaptive adjustment to dynamically optimize rendering strategies.
[0087] As one possible implementation of this embodiment, the virtual DOM differential comparison includes: dividing the table DOM structure into multiple logical levels for comparison; implementing an intelligent skip mechanism to skip deep comparison of static parts; using stable key values to optimize comparison and identify row movement rather than re-creation; and implementing selective deep comparison, only comparing the deep attributes of the changed parts.
[0088] Step S5: Obtain data based on the data source configuration information and display it in a table based on the rendering results.
[0089] Specifically, step S5 includes the following steps:
[0090] Step S51: Obtain data according to the data source configuration information. Specifically: directly read the local data array, perform front-end pagination and sorting; construct request parameters, initiate an asynchronous request, and process the data returned by the back-end; establish a real-time data connection and receive data pushed by the server; read cached data from local storage.
[0091] Step S52: Display the table based on the rendering results. Specifically: render the table header according to the column configuration; render the table data rows according to the data array; render the pagination component according to the pagination configuration; and render the toolbar buttons according to the functions.
[0092] As one possible implementation of this embodiment, the steps of constructing request parameters, initiating an asynchronous request, and processing the backend returned data include:
[0093] Parameter construction: Construct request parameters based on pagination, sorting, and filtering configurations;
[0094] Request initiation: Use fetch or axios to initiate an HTTP request;
[0095] Response handling: Handling HTTP responses, including error handling and retry mechanisms;
[0096] Data transformation: Converts response data into the required table format.
[0097] As one possible implementation of this embodiment, the step of rendering table data rows based on the data array includes:
[0098] Row data binding: Binds data to a table row;
[0099] Cell rendering: Render each cell according to the column configuration;
[0100] Editing status management: Manages the editing status of cells;
[0101] Event binding: Bind row click, double-click, and right-click menu events.
[0102] Step S6: Monitor user interactions and configuration changes in real time and dynamically adjust the rendering strategy.
[0103] Specifically, step S6 includes the following steps:
[0104] Step S61, Real-time monitoring of user interaction and configuration changes: Monitor user interaction behaviors such as clicking, scrolling, and input; monitor dynamic changes in configuration information; monitor updates and changes in data sources; monitor rendering performance, memory usage, and other metrics;
[0105] Step S62, dynamically adjust the rendering strategy: adjust the rendering complexity according to CPU and GPU performance; adjust the data preloading strategy according to network bandwidth; adjust the caching strategy according to memory pressure; optimize the response strategy according to user interaction mode.
[0106] As one possible implementation of this embodiment, the step of adjusting the rendering complexity based on CPU and GPU performance includes:
[0107] Enable complex effects, add animations, and improve rendering quality; balance effects and performance, and moderately optimize rendering; simplify effects, disable unnecessary animations, and reduce rendering quality; optimize for touch and reduce memory usage.
[0108] like Figure 2 As shown in the figure, an embodiment of the present invention provides a cross-frame table component implementation device with configuration-driven and adaptive rendering, comprising:
[0109] A configuration receiving module is used to receive configuration information input, which includes column configuration information, data source configuration information, and rendering configuration information.
[0110] The configuration parsing module is used to parse the configuration information through the configuration parsing engine and generate standardized configuration objects;
[0111] The intelligent conversion module is used to generate the underlying component configuration by performing attribute mapping and component inference through the intelligent attribute converter based on the standardized configuration object.
[0112] The adaptive rendering module is used to perform cross-framework adaptation and rendering optimization based on the configuration of the underlying components through the adaptive rendering engine.
[0113] The data management module is used to retrieve data based on the data source configuration information and display it in a table based on the rendering results.
[0114] The dynamic adjustment module is used to monitor user interactions and configuration changes in real time and dynamically adjust the rendering strategy.
[0115] The implementation of the embodiments of the present invention mainly involves the following aspects.
[0116] 1. Configure driver architecture:
[0117] 1.1 Standardized Column Configuration Protocol:
[0118] 1.1.1 Design Goals: This protocol aims to fully define all behaviors, appearances, and interaction logic of a column in a table through a structured, declarative JSON configuration object. It acts as an abstraction layer and translator between user intent and underlying complex table components (such as vxe-grid), freeing developers from tedious template code and low-level API calls.
[0119] 1.1.2 Core Idea: "Configuration is Functionality". Developers do not need to write imperative code on how to implement pagination, editing, or validation. They only need to declare "what functionality is needed" in the configuration (e.g., visible: true), and the system will automatically convert it into the complex parameters and logic required by the underlying components.
[0120] 1.1.3 Protocol Structure: The protocol is represented by a JavaScript object (or JSON), and its properties can be divided into three core modules as shown in Tables 1 to 3: the Basic Attributes Module, the Editing & Validation Module, and the UI & Formatting Module. 1.2 Smart Attribute Converter:
[0121] 1.2.1 Configuration parsing: The converter reads the column configuration object provided by the user. It recognizes specific attributes in the configuration (such as editable, editType, validate), which are the "signals" that trigger the conversion rules.
[0122] 1.2.2 Semantic Mapping: The converter internally maintains a set of mapping rules, which defines how to convert high-level configuration properties into low-level configuration properties. Examples of mapping rules: 1) IF detects editable: true → THEN generates a basic editRender configuration, which uses an input box by default; 2) IF detects both editable: true and editType: 'select' → THEN generates a more complex editRender configuration, specifies the component as a dropdown selector, and handles editOptions; 3) IF detects validate: 'required' → THEN generates the corresponding validation rule object and binds it to the column's editRules or similar properties.
[0123] 1.2.3 First Layer: Basic Attribute Mapping Rules. This layer handles the most direct and simplest attribute mapping, typically a one-to-one conversion. 1) Mapping Principle: Direct forwarding. Map the generic attribute names in the protocol to the specific attribute names expected by the underlying component library. 2) The mapping rule library is shown in Table 5. 3) Processing Flow: a) Traverse all attributes of the user configuration object. b) If the attribute is in the basic mapping table, replace its key with the key name of the underlying library, leaving the value unchanged. c) Output the basic configuration object after key name conversion.
[0124] Table 5: Examples of Mapping Rule Bases
[0125]
[0126] 1.2.4 Second Layer: Intelligent Inference Mechanism for Editable Attributes. 1) Inference Engine Input: Configuration after processing in the first layer; column prop name (can be used to infer data type); user-declared editType; optional sample data (for more accurate type inference). 2) Core Inference Logic: Component Type Inference Decision Tree: Priority 1: User Explicit Declaration. If the user has configured editType, its value is used directly, and the corresponding component mapping is found; Priority 2: Heuristic Inference Based on Prop Name. If editType is not configured but editable:true, it is guessed based on the prop name: Field name containing time / date → inferred as 'date'. Field name containing email → inferred as 'input', but email validation rules are automatically injected. Field name containing age / amount → inferred as 'number'; Priority 3: Type Inference Based on Sample Data. If there is sample data, the type of the corresponding value of the prop is analyzed: boolean type → inferred as 'checkbox' or 'switch'. number type → inferred as 'input' and type: 'number' is set. Value is within a specific preset range → inferred as 'select'. Component options are automatically generated: Based on the inferred or user-specified editType, a complete underlying editRender configuration is generated. The mapping table is shown in Table 6.
[0127] Table 6: Examples of mapping representations:
[0128]
[0129] Dependency property handling: If editOptions is configured, the converter will intelligently merge or map its contents into the generated editRender configuration. For example, it will map editOptions.data to editRender.options.
[0130] 1.2.5 Third Layer: Dynamic Compilation Technology for Validation Rules. This layer is responsible for compiling declarative, concise validation rules into specific validation functions and configurations that can be executed by the underlying components. Input: The `validate` property, whose type can be String|Function|Array|Object; Output: A standard array of validation rules required by the underlying components (e.g., `editRules:[...]`); Compilation process: 1) Identify the type of the `validate` property and normalize it into an internal array of rule descriptors. For example, 'required' is converted to `{type:'required'}`. 2) Traverse the normalized array of rule descriptors. 3) For string rules: Find the corresponding implementation from the pre-built rule library. 4) For regular expressions: Compile them into a validator function: `(value)=>regex.test(value)`. 5) For custom functions: Directly use them as validators. Simultaneously, the converter will wrap them with error handling logic to prevent the function from throwing an exception that could crash the entire program. 6) For configuration objects: Merge their validator, message, trigger, and other properties. 7) Assign the array of validation rules obtained after compilation to the corresponding property of the underlying component (such as editRules).
[0131] 1.3 Unified data source processing interface:
[0132] 1.3.1 Design Goal: To provide a consistent data interaction experience for upper-layer components, regardless of whether the data comes from a local static array or a remote API interface. The core of this interface is to abstract and automate the entire process of data acquisition, pagination parameter passing, response data parsing, and error handling, so that developers do not need to worry about the differences in data sources.
[0133] 1.3.2 Interface Input Specification: This interface receives input through the component's dataSource property and supports two types:
[0134] Type 1: Array type (static data):
[0135] Description: A simple local data array;
[0136] Processing flow: When the interface detects that the input is an array, it directly uses it as the final data and disables the asynchronous pagination processing logic (unless front-end pagination is configured).
[0137] Type 2: Function type (dynamic API):
[0138] Description: A function that returns a Promise, typically used to initiate asynchronous requests (such as axios or fetch calls);
[0139] Processing flow: The API will automatically call this function, passing in the standardized pagination, sorting, and query parameters. After the Promise returned by the function resolves, the API will extract the required data.
[0140] Function and signature: dataSource(requestParams:Object) => Promise <response>.
[0141] 1.3.3 Data processing flow (e.g.) Figure 3 (As shown) and mechanism:
[0142] Step 1: Parameter standardization. When pagination changes or a refresh is triggered, the interface will automatically construct a standard request parameter object and pass it to the dataSource function.
[0143] Step 2: Data acquisition and distribution. The interface calls the dataSource function (or reads a static array) and waits for the result.
[0144] Step 3: Response Data Parsing (Adaptive Converter):
[0145] Default mapping rule: The system has a built-in default converter (JSON object type, containing lists). <array>The data array of the current page, total <nunber>(Total number of data items), and expect the data returned by the backend to be in a common, general structure.
[0146] Configurable mapping rules (format converter): When the format returned by the backend API does not match the default format, users do not need to modify the backend code; they only need to provide a simple mapping function (dataMapper) in the configuration.
[0147] The dataMapper function interface is: (response:Any)=>{data:Array,total:Number}.
[0148] Step 4: Data Injection and Rendering. The standardized data {data:[...],total:...} output by the converter will be automatically injected into the component's internal state tableData and totalCount, thereby triggering a re-render of the view.
[0149] 2. Two-way bridging layer design:
[0150] 2.1 Event Semantic Converter: Converts native events into business semantic events.
[0151] 2.2 Method Proxy Mechanism: While exposing vxe-grid methods, business methods are encapsulated. The implementation of method proxy can be divided into the following four steps:
[0152] Step 1: Proxy Method List: The system predefines a list of core method names that need to be proxied (e.g., ['validate', 'exportData', 'getTableData']). This list is filtered based on high-frequency usage and business criticality, ensuring the efficiency and effectiveness of the proxy.
[0153] Step 2: Establish Proxy Mapping: During the component initialization phase, dynamically create methods with the same name for the SmartGrid component by traversing the above proxy list.
[0154] Step 3: Call Forwarding: When a user calls these proxy methods (such as this.$refs.smartGrid.validate()), the proxy mechanism transparently forwards the call request and all its parameters (...args) to the internally maintained underlying component instance (this.$refs.gridRef). This encapsulation of proxy method logic allows for method reuse and reduces intrusion from other business logic.
[0155] Step 4: Execution Result Return: After the underlying component executes the corresponding method, the returned result will be sent back to the user through the delegate method. For the user, it appears as if they directly called the underlying component, completely unaware of the delegate process.
[0156] 3. Adaptive rendering engine:
[0157] 3.1 Unified State Management:
[0158] Mechanism: The adaptive rendering engine internally maintains a unique, reactive data source, tableData (corresponding to the data of the current page). All view rendering is based on this state.
[0159] Implementation: Regardless of whether the data comes from a static array or a remote API, the engine will ultimately normalize the data to the internal state `tableData`. This means that editing operations only need to modify this central state, and the view will automatically update.
[0160] 3.2 Capturing and Extracting Data from Editing Events:
[0161] Mechanism: The engine listens for native edit events (such as edit-closed) of the underlying table components (such as vxe-grid).
[0162] Implementation: When the user finishes editing a cell, the underlying component triggers an event. This event object contains rich context information (a jison object, including row: {…} the original row data before modification, row2: {…} the new row data after modification, and column: {…} the configuration information of the currently edited column).
[0163] 3.3 Intelligent Data Synchronization:
[0164] Locating the data: The engine uses the row provided in the event object (which usually contains a unique identifier such as id) to accurately locate the record that needs to be updated in the internal tableData array.
[0165] Update state: The engine will use reactive operations such as Object.assign, Vue.set, or direct assignment (for React, use setState) to merge the new data into the old records it finds.
[0166] Automated persistent layer interaction: If dataSource is a static array, the above memory update is the final result; if dataSource is an API function, the engine can automatically initiate an asynchronous request (such as PATCH / api / items / {id}) to send the changes to the backend server, without requiring the user to manually write Ajax calls.
[0167] 3.4 Seamless linkage of paginated data:
[0168] Mechanism: tableData is just a "view" of all the data; the engine updates only the data for the current page. The paginator itself (current page number, number of records per page) is merely a filtering condition.
[0169] Implementation: The `loadData()` method is automatically triggered when switching pages. It requests the latest data from the data source (either a local static array or a remote API) with the new pagination parameters. Data you modify on page 1 is automatically saved in memory or on the backend. When you switch to page 2 and then back to page 1, `loadData()` ensures that you see the latest modified data.
[0170] 3.5 Semantic Event Notification:
[0171] Mechanism: After the state update is completed, the engine will trigger a semantic custom event (such as edit-saved) to the parent component.
[0172] Implementation: The key difference with native events is that when the parent component listens for this event, data synchronization is automatically handled by the engine. The parent component typically receives this notification only to perform additional business logic (such as logging or notifying other components), without needing to concern itself with updating the table data itself. The specific steps are as follows:
[0173] Native event feature extraction: 1) Multi-channel event monitoring: The algorithm simultaneously monitors multiple native event channels of the underlying table component (such as vxe-grid), including: user interaction events: cell-click, edit-closed, page-change, sort-change; data change events: data-changed, edit-activated, edit-stopped; lifecycle events: load-success, load-error. 2) Context feature enhancement: Extract the current table state: editing mode, pagination information, sorting status; obtain associated configurations: column definitions, validation rules, business constraints; record user operation sequences: identify continuous operation patterns.
[0174] Business Semantic Recognition and Mapping: 1) Multi-dimensional Semantic Analysis: Operation Intent Recognition: Differentiate between "Save Edit", "Cancel Edit", and "Validation Failed"; Business Impact Assessment: Determine the degree of impact of the operation on the business process; User Behavior Patterns: Identify batch operations, rapid continuous operations, and other patterns. 2) Intelligent Event Classification: 2.1) Data Operation Events: data-created: Add data record; data-updated: Update existing data; data-deleted: Delete data record; data-validated: Data validation completed. 2.2) User Interaction Events: row-selected: Row selection status change; column-sorted: Column sorting operation; filter-applied: Filter conditions applied. 2.3) System Status Events: page-loaded: Paged data loading completed; loading-state-changed: Loading status change; error-occurred: System error occurred. 3) Contextual Information Supplementation and Event Reconstruction: 3.1) Data Relationship Mining: Identify parent-child data relationships; extract cross-field dependency information; construct operation impact chain analysis. 3.2) Priority Queue Management: High priority - data change, error events; Medium priority - user interaction events; Low priority - state synchronization events. 4) Real-time Processing Pipeline: Native event input, feature extraction (technical features + business features), semantic recognition (pattern matching + intent analysis), context enhancement (business data + environmental information), event reconstruction (standardized format + metadata), semantic event output. 5) Error Handling and Degradation: 5.1) Semantic Recognition Degradation: When pattern matching confidence falls below a threshold, it falls back to a general event type. 5.2) Context Supplement Degradation: When the business context is unavailable, it provides minimal effective information. 5.3) Performance Protection Mechanism: Event processing automatically terminates upon timeout to prevent blocking the main thread.
[0175] 3.6 Responsive optimization mechanism for state management:
[0176] 3.6.1 Rule Usage Frequency Statistics: The system configures and maintains a usage frequency counter for each mapping rule. Each time a rule is triggered and executed, its corresponding counter automatically increments. This mechanism is used to count and identify the usage frequency of each mapping rule.
[0177] 3.6.2 User Feedback Collection: Explicit Feedback: Users rate the automatically generated configurations using the "Like / Dislike" buttons provided in the UI. Implicit Feedback (More Crucial): Configuration Override Rate: The percentage and specific content of configurations that users manually modify after accepting the system's automatically generated configurations. For example, if the system infers the use of input, but the user immediately changes it to select, this is a strong negative feedback signal. Validation Rule Adjustment: The frequency with which users add or delete validation rules for columns automatically inferred by the system. Feature Usage Stickiness: The percentage of users who repeatedly use the same configuration pattern within a single session.
[0178] 3.6.3 Analysis and Learning Engine: Collected data is fed into the analysis engine for pattern mining using the following algorithms: 1. Association Rule Mining: Objective: Discover strong relationships between configuration attributes. Algorithm: Similar to Apriori. Application Example: It was found that when the prop name is "email", 85% of users will add an additional validation rule with format:'email'. The system can automatically optimize the rule based on this and automatically inject email validation into this field in the future. It was found that when editType is "select" and the data source comes from a specific API, 100% of users will configure the remote:true attribute. The system can learn this pattern and automatically mark it as a remote search selector. 2. Cluster Analysis: Objective: Identify different "user configuration preference groups". Algorithm: K-Means or DBSCAN. Application Example: Group A (Strict): Prefers to add required validation to all editable columns. Group B (Efficiency): Prefers to use minimal configuration and relies on system defaults.
[0179] The system can provide slightly different default rule weights for different user groups, achieving personalization. 3. Feedback Weighting System: Assigns a dynamic weight score to each mapping rule (initial value 1.0). Weight update formula (New weight = Old weight + α * (Positive feedback - Negative feedback) + β * Usage frequency gain) α: Feedback influence factor. β: Frequency influence factor. Positive feedback: Configuration not modified, receives user likes. Negative feedback: Configuration immediately modified, receives user dislikes.
[0180] 3.6.4 Rule Optimization and Dynamic Adjustment, 1. Dynamic Priority Ranking of Rules: In a multi-layered mapping system, when multiple rules may match simultaneously, the system no longer executes them in a fixed order, but prioritizes rules with higher weights. Example: For a field with `prop` as `category_id`, the system might initially match both "inferring numeric input based on the `_id` suffix" and "inferring a selector based on the `category` prefix." Through learning, it discovers that the latter has a much higher weight than the former, and the system will prioritize executing the latter. 2. Automatic Adjustment of Rule Parameters: The system optimizes the default parameters within rules. Example: In the "inferring components based on data type" rule, the system might learn that for boolean types, 75% of the team's users prefer the switch component over the default checkbox. The system will automatically adjust the default component to switch. For date types, users generally expect the format YYYY-MM-DD rather than MM / DD / YYYY. 3. Automatic Generation of New Rules: When the analysis engine discovers a high-frequency configuration pattern not covered by existing rules, it can automatically propose or generate new mapping rules. Process: Pattern Recognition: When a prop ends with _at (e.g., created_at, updated_at), it is found that users will 100% configure editType: 'datetime' and width: 160. Rule Generation: A new rule is automatically created: "If a prop ends with _at, it is inferred to be a datetime selector, and its width is set to 160". Sandbox Testing: The new rule is first A / B tested in a limited environment to verify its effectiveness. Global Deployment: After passing the tests, it is included in the official rule base.
[0181] 3.6.5 Personalization and Context Awareness: 1) Project-level Preference Learning: The system recognizes and remembers the configuration style of specific projects. For example, a project team might prefer all tables to have borders, zebra stripes, and row hover effects. When components are used in that project, the system automatically applies these preferences. 2) User-level Habit Learning: For logged-in users, the system can remember their personal preferences. For example, user A always prefers to fix a specific width and alignment for the operation columns. 3) Domain Adaptation: The system can perceive the current application domain (such as a CRM system, financial system, or OA system) and load the most suitable set of rule weights for that domain. Example: In a financial system, rules related to numerical precision and currency format are automatically strengthened; in a CRM system, rules related to customer status and contact information are strengthened.
[0182] 3.7 Handling Rendering Differences Between Different Front-End Frameworks: The template syntax and rendering mechanisms of various mainstream frameworks differ fundamentally. Adaptive rendering engines handle these differences in the following ways: 1) Template Compilation Strategy: Vue Adapter: Mechanism: Directly uses Vue's single-file component (.vue) format and its reactive system. Dynamic Slots: Utilizes Vue's $slots and dynamic slot names (#[slotName]) to achieve automatic slot discovery, automatically injecting the parent component's template fragment into the correct position. Property Passing: Seamlessly passes properties and events through v-bind="$attrs" and v-on="$listeners", ensuring all functionalities of the underlying components are available. React Adapter: Mechanism: Uses JSX syntax to create a virtual DOM through React.createElement or JSX transformation functions. Dynamic Rendering: Implements custom content rendering using props.children and Render Props patterns. For complex slot systems, function callbacks are needed for simulation. Property Passing: Passes common properties through the spread operator {...this.props}, while filtering out framework-specific reserved properties. Angular Adapter: Mechanism: Uses Angular's template syntax and data binding. Content projection: via <ng-content select="[slotName]">< / ng-content> To implement slot functionality, possible slot positions need to be predefined in the template. Property binding: Use the syntax `[prop]="value"` and `(event)="handler"` for property and event binding. 2) Reactive system bridging: Vue: Directly uses `ref()`, `reactive()`, and `computed()`, naturally reactive. React: Uses `useState` and `useReducer` to manage state, and `useMemo` and `useCallback` to simulate computed properties. Angular: Relies on Zone.js's dirty checking mechanism, using `@Input()` property binding and `@Output()` event emitters. Unified strategy: Maintain a framework-independent state machine in the core layer (CoreLayer), with each adapter responsible for mapping core state changes to its respective framework's reactive update mechanism; Unified management of component lifecycle: To maintain consistent internal logic across different frameworks, a unified component lifecycle model needs to be established. The lifecycle mapping table is shown in Table 7: Lifecycle Mapping Table:
[0183]
[0184] The unified lifecycle is implemented as follows: The manager is designed as a standalone, framework-independent JavaScript / TypeScript class named `LifecycleManager`. Its core responsibility is to centrally manage cross-framework lifecycle callbacks and provide a unified registration and triggering interface. Internally, the manager maintains four independent callback function arrays (or Map structures), corresponding to the four key stages of the lifecycle: `onInitCallbacks`: stores all callback functions to be executed during the initialization stage; `onMountCallbacks`: stores all callback functions to be executed during the mounting stage; `onUpdateCallbacks`: stores all callback functions to be executed during the update stage; and `onDestroyCallbacks`: stores all callback functions to be executed during the destruction stage. Lifecycle callback registration methods: Four public registration methods are provided, allowing the core logic to register execution functions at different lifecycle stages: `onInit(callback:Function):void` - adds the callback function to the `onInitCallbacks` array; `onMount(callback:Function):void` - adds the callback function to the `onMountCallbacks` array; `onUpdate ... `id` - Adds the callback function to the `onUpdateCallbacks` array; `onDestroy(callback:Function):void` - Adds the callback function to the `onDestroyCallbacks` array. Lifecycle trigger methods: Provides four corresponding trigger methods, called by each framework adapter at appropriate times: `triggerInit():void` - Iterates through and executes all functions in `onInitCallbacks`; `triggerMount():void` - Iterates through and executes all functions in `onMountCallbacks`; `triggerUpdate():void` - Iterates through and executes all functions in `onUpdateCallbacks`; `triggerDestroy():void` - Iterates through and executes all functions in `onDestroyCallbacks`. Vue adapter: Calls `lifecycleManager.triggerInit()` in `setup()` or `created()`. React adapter: Calls the `mount` logic in an empty dependency array of `useEffect`. Angular adapter: Triggers `init` and `mount` in `ngOnInit` and `ngAfterViewInit` respectively.
[0185] 3.8 Virtual DOM Differentiation Comparison Optimization: 1) Hierarchical Comparison Strategy. Based on table structure analysis, the algorithm first divides the table DOM structure into multiple logical layers: header container layer (fixed header, grouped header); data row layer (visible area rows, buffer rows); cell layer (cells of different column types); editing component layer (embedded input boxes, selectors, etc.). Intelligent skip mechanism: For static header sections, deep comparison is automatically skipped during data updates; unchanged column areas are identified, and only columns with changed data are compared in a refined manner; the specific cells requiring updates are quickly located using a row and column index mapping table. 2) Key-value Optimization Comparison. Stable key-value allocation: Stable key-values based on unique data identifiers are generated for each row of data; columns use field names configured as fixed key-values; version identifiers are added to edit status cells to ensure correct state reset. Movement-aware algorithm: Detects changes in row order, identifying row movement rather than recreating it through key-value mapping; for sorting and filtering operations, the minimum DOM operation sequence is calculated; row expand / collapse states are decoupled from data key-values to avoid unnecessary re-rendering. 3) Selective Deep Comparison. Shallow comparison prioritized: First, perform a reference equality check, quickly skipping unchanged rows; perform shallow attribute comparisons on row data objects; only initiate deep attribute comparisons for rows where changes are detected. Attribute change impact analysis: Establish a mapping relationship between column attributes and rendering impact; identify attribute changes that only affect style (such as row background color); distinguish between change types requiring component reconstruction and those that only update data.
[0186] 3.9 Rendering Batch Processing and Asynchronous Updates: 1) Multi-level batch processing system. Microtask-level batch processing: Merges multiple state updates within the same event loop into a single rendering; performs atomic updates on pagination parameter changes, sorting status, and filtering conditions; uses a Promise microtask queue to ensure batch processing timing. Frame-level batch processing: Visual update batch processing based on requestAnimationFrame; delays style calculations and layout operations on non-critical paths to browser idle periods; performs frame synchronization for scroll position calculations and virtual scroll area updates. 2) Priority scheduling mechanism. Update priority classification: User interaction updates (editing, selection): immediate synchronous processing; Data updates (pagination, sorting): high-priority asynchronous processing; Style updates (hover effects, zebra stripes): normal priority; Statistical information updates (row count, page number): low-priority delayed processing. Incremental rendering strategy: Large datasets are rendered in blocks, with priority given to rendering visible areas; related updates caused by editing operations are progressively committed; background pre-rendering of row data about to enter the viewport. 3) Asynchronous update pipeline. Update Task Queue: Maintains multiple priority update task queues; deduplicates and merges tasks to avoid duplicate execution of the same calculations; automatically degrades timed-out tasks to prevent prolonged blocking of user interaction. Rendering Progress Feedback: Provides progress indications for large-scale updates; allows users to interrupt long-running rendering tasks; triggers a completion event upon rendering completion to support subsequent business logic.
[0187] 3.10 Memory Usage Optimization and Garbage Collection: 1) Object Pooling and Caching Mechanism. DOM Node Object Pool: Maintains a reusable row container and cell DOM node pool; recycles DOM nodes leaving the viewport during virtual scrolling; intelligently reuses existing nodes that meet the conditions when configuration changes. Data Caching Layers: Hot Data Caching: Data from the current page and adjacent pages resides in memory; Warm Data Caching: Recently accessed historical data, managed using an LRU strategy; Cold Data Index: Memory index for large datasets, loading detailed data on demand. 2) Memory Usage Monitoring and Early Warning. Memory Allocation Tracking: Monitors memory allocation patterns related to table components; detects abnormal memory growth trends and provides early warnings; statistically analyzes the memory usage characteristics of different types of data. Automatic Memory Reclamation: Listens for component unloading and page hiding events, proactively releasing resources; performs lazy cleanup of cached data that has not been accessed for a long time; cleans up temporary data during editing immediately after the operation is completed. 3) Garbage Collection-Friendly Design. Reference Relationship Management: Avoids circular references, especially mutual references between event listeners and DOM nodes; uses weak references to store the auxiliary index structure of large datasets; promptly removes event listeners and observers from removed components. Memory fragmentation prevention: Pre-allocate fixed-size row data objects to reduce dynamic allocation; use object pools for frequently created and destroyed temporary objects; and adopt a contiguous memory block storage strategy for large data operations.
[0188] 3.11 Performance Monitoring and Adaptive Tuning: 1) Real-time Performance Measurement. Rendering Performance Monitoring: Measure virtual DOM comparison time and actual DOM update time; monitor frame rate changes to detect rendering performance bottlenecks; statistically analyze user interaction response latency to evaluate user experience. Memory Usage Statistics: Track object pool hit rate and optimize pool size configuration; monitor cache efficiency and dynamically adjust cache strategy parameters; detect memory leak patterns and automatically trigger diagnosis and repair. 2) Dynamic Parameter Tuning. Adaptive Buffering Strategy: Dynamically adjust the virtual scroll buffer based on device performance and dataset size; preload more data when network conditions are good and reduce preloading when conditions are poor; adjust rendering priority based on scroll speed prediction. Algorithm Parameter Optimization: Adjust batch processing time window based on data update frequency; optimize event debouncing parameters based on user interaction patterns; automatically adjust cache size and recycling frequency based on memory pressure.
[0189] 4. Design principle of "cohesive logic and simple external interface":
[0190] 4.1 The pain points of existing technologies are tight coupling and high complexity, specifically manifested in the following two undesirable patterns:
[0191] Pattern 1: Directly Exposing Internal Methods (Ref Penetration Pattern): The parent component needs to directly access the methods of the underlying table instance through deep $refs, such as this.$refs.myGrid.$refs.vxeGrid.validate(). This pattern presents the following problems: 1) The parent component needs to understand the internal structure of the child component, violating the encapsulation principle. Once the child component is refactored (e.g., a third-party library is replaced), all parent component code needs to be modified synchronously, resulting in extremely high maintenance costs; 2) The parent component directly depends on the API of the underlying library (such as vxe-grid) rather than a stable abstract interface.
[0192] Pattern 2: Hard-coded event handling (imperative handling pattern): The parent component needs to listen to the native events of the underlying components and write detailed, imperative logic in the event handler function to manage state and side effects. Problems with this pattern: 1) A large amount of boilerplate code: Each edit event requires repetitive code for data lookup, update, and request; 2) Logic duplication: The same state management logic is scattered across various parent components; 3) Prone to errors: Developers need to handle reactive data and pagination states very carefully, which can easily introduce bugs.
[0193] 4.2 The solution proposed in this invention: a bidirectional bridging layer and "cohesive logic, simplified external interface":
[0194] 4.2.1 Inward bridging unifies the reception of external calls while hiding the internal implementation. It provides a stable and concise set of high-level APIs. The specific implementation is as follows: Internally, the component defines a list of method names to be proxied (PROXY_METHODS), which includes method names such as 'validate', 'exportData', and 'getTableData'. The component dynamically creates methods with the same names for itself by iterating through this list; each created method is a proxy function. When the parent component calls these methods (e.g., this.$refs.smartGrid.validate()), the logic of the proxy function is executed. The proxy function receives all passed parameters (...args) and then forwards these parameters intact to a lower-level table component instance (accessed via this.$refs.gridRef). The lower-level instance (e.g., vxe-grid) actually executes the method (e.g., validate) and returns the result, which the proxy function then returns to the parent component.
[0195] 4.2.2 Outward bridging transforms internal low-level events into external high-level business events. It's part of the "adaptive rendering engine," listening to internal events, handling common logic, and then emitting semantically clear events. Specifically, the parent component listens to a series of low-level, technical events (such as `edit-closed` and `page-change` in `vxe-grid`) through its template reference ($refs) of the table component instance. This invocation method is very concise and clear; the parent component doesn't need to know how these methods are implemented internally.
[0196] 5-component implementation:
[0197] The working mechanism of a component can be clearly divided into three levels, and its structure and data flow are as follows: Figure 4 As shown.
[0198] 5.1 Template Layer:
[0199] Core responsibility: Serves as the rendering exit and enables automatic pass-through of custom slots.
[0200] Implementation mechanism: 1) Use vxe-grid as the underlying rendering container. 2) Use v-bind="gridOptions" to dynamically bind all complex configurations generated by computed properties to the underlying component all at once. 3) Use the v-for dynamic slot mechanism.
[0201] 5.2 Script Layer:
[0202] The Props Interface defines the configuration protocol for a component, accepting four main configuration types:
[0203] Configuration 1: columns: Array of column definitions (core configuration);
[0204] Configuration 2: dataSource: Data source (supports static arrays or asynchronous functions);
[0205] Configuration 3: pagination: pagination configuration (supports boolean values or configuration objects);
[0206] Configuration 4: editConfig: Edit configuration (supports object-level configuration).
[0207] Computed Properties – the “configuration transformation engine” – are the concrete implementations of the configuration parsing engine. They respond to changes in props in real time and generate the format required by the underlying components.
[0208] processedColumns: Transforms the user's concise column configuration into a column configuration with complex attributes such as field, title, and editRender required by vxe-grid;
[0209] gridOptions: Assembles all the options that are finally passed to vxe-grid, integrating pagination, editing, additional attributes ($attrs), etc.
[0210] paginationConfig: Generates specific paginator configurations based on paginationprop;
[0211] Data & State manages the internal state of components, such as tableData (current page data), currentPage, pageSize, and totalCount.
[0212] Methods - "The executor of the function":
[0213] loadData(): The core of the data adapter. It determines whether the dataSource is a function or an array, performs asynchronous retrieval or static assignment accordingly, and updates its internal state.
[0214] handlePageChange(): Responds to pagination events, updates page numbers and the number of items per page, and automatically triggers loadData() to fetch data again;
[0215] handleEditClosed(): Responds to the edit event and triggers a semantic custom event edit-saved to the parent component;
[0216] getGridRef(): An accessor for the method proxy layer, used to directly obtain the underlying component instance.
[0217] Lifecycle and Watchers:
[0218] created: Automatically calls loadData() to initialize data when the component is created;
[0219] watch: Listens for changes in the dataSource and automatically reloads the data to achieve reactive data updates.
[0220] 6. A comparison between the technical solution of this invention and traditional implementation techniques is shown in Table 8:
[0221] Table 8: Comparison of the core characteristics of the technical solution of this invention with traditional implementation techniques
[0222]
[0223] 7. Unlike traditional VXegrid configurations, it is much simpler to set up:
[0224] 7.1 Data Acquisition and Pagination:
[0225] Vxe-gird requires manually writing the `loadData` function to manage parameters, requests, and state assignments. This invention, however, only requires declaring `data-source=" / api / data"` and `:pagination="{…}`, and the engine can automatically assemble pagination parameters, initiate requests, parse responses, and update state and views.
[0226] 7.2 Cell Editing:
[0227] Vxe-gird requires configuring the edit-config and the editRender property for each column. This invention, however, only requires setting editable:true directly in the column configuration to automatically generate the underlying complex editRender configuration.
[0228] 7.3 Data Export:
[0229] Vxe-gird requires manually obtaining the component Ref, calling the exportCsv() method, and customizing the toolbar button. This invention, however, sets the export-enabled attribute, and the engine automatically generates an export button in the toolbar and delegates all export logic. Users only need to declare "required".
[0230] 7.4 State Synchronization:
[0231] Vxe-grid requires manually listening to the `edit-closed` event, writing code to update in-memory data, and requesting the backend. This invention, however, listens to the semantic `edit-saved` event, and the engine automatically performs reactive updates to the in-memory data. If the `data-source` is a function, it will also automatically initiate an update request.
[0232] 8. Innovative technologies proposed in this invention:
[0233] 8.1 Configuration-Component Two-Way Mapping Model: Enables zero-code development for 90% of table scenarios, with configuration changes automatically synchronized to components.
[0234] 8.2 Automated pagination loading chain, such as Figure 5 As shown.
[0235] 8.3 Self-management mechanism for editing status:
[0236] 8.3.1 Automatically track cell editing status;
[0237] 8.3.2 Dynamic Injection Verification Rules:
[0238] 8.3.2.1 Rule definition method:
[0239] 8.3.2.1.1 String shortcut rules (pre-built rule library):
[0240] Description: Provides a set of predefined rule strings for easy and quick configuration of common validations;
[0241] Syntax: validate:'ruleName';
[0242] Supported built-in rules typically include required, number, integer, phone, etc.
[0243] 8.3.2.1.2 Regular Expression Rules:
[0244] Description: Offers exceptional flexibility, allowing users to define complex text pattern validations using regular expressions;
[0245] Syntax: validate: / ^your_regex$ / ;
[0246] 8.3.2.1.3 Configuring object rules:
[0247] Description: Allows for more detailed configuration of rules, most commonly customizing error messages;
[0248] Syntax: validate:{rule:value,message:'prompt message'};
[0249] 8.3.2.1.4 Custom validation function:
[0250] Description: Provides support for the most complex business logic. Validation functions can be completely customizable and can even include asynchronous operations;
[0251] Syntax: validate:(value,row)=>{...};
[0252] Parameters: value: The value of the cell currently being edited; row: The complete data object of the current row;
[0253] Return value: true, null, or undefined, indicating that the validation passed; String: indicating that the validation failed, returning a string as the error message; Error: indicating that the validation failed, throwing an error object with the error message Error.message.
[0254] 8.3.2.2 Injection Timing:
[0255] 8.3.2.2.1 Initialization Injection:
[0256] Timing: During the component's created or mounted lifecycle, and when the column configuration changes (via watch);
[0257] Process: Process 1: The configuration parsing engine iterates through each item in the columns; Process 2: If a column's configuration contains the validate attribute, it begins parsing that attribute; Process 3: Based on the above definition, strings, regular expressions, functions, etc., are uniformly converted into a validation configuration format that the underlying table component (such as vxe-grid) can recognize; Process 4: The converted rules are bound to the corresponding column's editRules or similar attributes, completing the initial injection.
[0258] 8.3.2.2.2 Runtime injection / update, such as Figure 6 As shown:
[0259] Timing: When edit mode is activated (when the user begins editing a cell);
[0260] Process: Process 1: The edit event is triggered, and the table component prepares to render the edit component (such as input, select); Process 2: Before rendering, the system checks the validation rules configured in the current edit column; Process 3: For custom functions, since they may depend on the real-time values of other fields (i.e., cross-row validation), the system ensures that the latest row data is obtained as the parameter of the validation function to achieve the most accurate validation; Process 4: The rules are dynamically set on the edit component that will be displayed.
[0261] 9. Integration methods in different front-end frameworks:
[0262] 9.1 Integrating Vue 2 / 3:
[0263] Implementation method: Implemented as a standard Vue component (SmartGrid.vue);
[0264] Core technologies:
[0265] 1) Props: Use Vue's props to define configuration interfaces;
[0266] 2) Responsive: Utilize computed properties to achieve real-time transformation and response of configurations;
[0267] 3) Slots: Use $slots and dynamic slot names to implement an automatic expansion slot discovery mechanism, perfectly passing through custom templates;
[0268] 4) ref & Methods: Implement method proxy mechanism using Vue's ref and component methods.
[0269] 9.2 Integrating React:
[0270] Implementation: A React functional component that uses a custom Hook to encapsulate the core logic.
[0271] Core technologies:
[0272] 1) Props: Define component properties using the TypeScript Interface;
[0273] 2) Responsiveness: Use useMemo and useCallback to simulate Vue's computed properties to optimize performance;
[0274] 3) State Management: Use useState to manage the internal state of tableData, page, etc.
[0275] 4) Side effects: Use useEffect to handle side effects such as data acquisition and configuration changes;
[0276] 5) ref & Methods: Use useImperativeHandleHook to implement a method proxy mechanism, exposing internal methods to the parent component;
[0277] 6) Slots: Custom rendering is achieved through props.children or render props mode, offering extremely high flexibility.
[0278] 9.3 Sandbox isolation mechanism when integrating within a framework:
[0279] 9.3.1 Style isolation: Prevents component styles from affecting global styles or other components, and avoids global styles from ruining the appearance of components;
[0280] 1) Scoped CSS (Vue): Naturally supported by the Vue adapter <style scoped>,会自动为组件内所有元素添加唯一的data-v-xxxxx属性,并使CSS规则仅作用于这些元素;
[0281] 2)CSS Modules(React):React适配器可以使用CSS Modules;导入styles.module.css文件,样式名在编译时会被转换为哈希字符串,确保唯一性。
[0282] 9.3.2脚本隔离:确保组件内部使用的JavaScript不会与宿主应用发生冲突;
[0283] 1)模块化:组件及其核心逻辑全部以ESModule形式编写和发布,天然具有模块作用域,不会向全局窗口(window)对象注入多余的变量;
[0284] 2)第三方库封装:问题:组件依赖的第三方库(如vxe-table、day.js)可能会向全局暴露变量;解决方案:在构建时,将所有这些依赖打包并捆绑(Bundled)在组件库内部;使用Webpack等工具配置,让它们与宿主环境使用的相同库隔离开来,避免版本冲突;
[0285] 3)谨慎的全局API使用:组件内部避免直接用window.*等全局API,而是通过适配器注入(例如,请求库axios或fetch应该由宿主应用提供,而不是组件内部直接引入),这提升了可测试性和灵活性;
[0286] 4)错误边界(React):React适配器可以实现错误边界(Error Boundaries),捕获组件内部JavaScript错误并做优雅降级处理,防止整个应用崩溃。
[0287] 9.3.3命名空间隔离:所有组件内部的CSS类名、数据属性(data-*)都使用带有唯一前缀的命名方案(例如.sg-grid__cell、data-smart-grid-id),极大降低与宿主应用样式和选择器发生冲突的概率。
[0288] 本发明实现了配置驱动的表格开发,支持Vue、React、Angular等多框架适配,具备智能推断和自适应渲染能力,显著提高了开发效率和渲染性能。
[0289] 本发明实施例提供的一种电子设备,包括处理器、存储器和总线,所述存储器存储有所述处理器可执行的机器可读指令,当所述电子设备运行时,所述处理器与所述存储器之间通过总线通信,所述处理器执行所述机器可读指令,以执行如上述任意配置驱动与自适应渲染的跨框架表格组件实现方法的步骤。
[0290] 具体地,上述存储器和处理器能够为通用的存储器和处理器,这里不做具体限定,当处理器运行存储器存储的计算机程序时,能够执行上述配置驱动与自适应渲染的跨框架表格组件实现方法。
[0291] 对应于上述应用程序的启动方法,本发明实施例还提供了一种存储介质,该存储介质上存储有计算机程序,该计算机程序被处理器运行时执行如上述任意配置驱动与自适应渲染的跨框架表格组件实现方法的步骤。
[0292] 本技术方案在实施过程中,严格遵循现行法律法规,包括但不限于《网络安全法》、《数据安全法》、《个人信息保护法》以及相关监管要求,致力于在技术创新与用户权益保护、社会公共利益之间取得平衡。
[0293] 最后应当说明的是:以上实施例仅用以说明本发明的技术方案而非对其限制,尽管参照上述实施例对本发明进行了详细的说明,所属领域的普通技术人员应当理解,依然可以对本发明的具体实施方式进行修改或者等同替换,而未脱离本发明精神和范围的任何修改或者等同替换,其均应涵盖在本发明的权利要求保护范围之内。< / style> < / nunber> < / array> < / response>
Claims
1. A method for implementing a cross-frame table component with configuration-driven and adaptive rendering, characterized in that, Includes the following steps: Step S1: Receive configuration information input, the configuration information including column configuration information, data source configuration information and rendering configuration information; Step S2: The configuration information is parsed using a configuration parsing engine to generate a standardized configuration object; Step S3: Based on the standardized configuration object, perform attribute mapping and component inference through the intelligent attribute converter to generate the underlying component configuration; Step S4: The adaptive rendering engine performs cross-framework adaptation and rendering optimization based on the underlying component configuration. Step S5: Obtain data based on the data source configuration information and display it in a table based on the rendering results; Step S6: Monitor user interactions and configuration changes in real time and dynamically adjust the rendering strategy; Step S3 includes the following steps: Step S31: Perform basic property mapping, mapping standardized property names to underlying component property names; Step S32: Perform intelligent inference of editing attributes and infer the type of editing component based on field features; Step S33: Perform dynamic compilation of verification rules, compiling the declarative verification rules into executable verification functions; Step S34: Perform UI property conversion, converting the advanced UI configuration into the underlying rendering configuration; Step S6 includes the following steps: Step S61, Real-time monitoring of user interaction and configuration changes: Monitoring user click, scroll, and input interactions; Monitoring dynamic changes in configuration information; Monitor updates and changes to data sources; Monitor rendering performance and memory usage metrics; Step S62, dynamically adjust the rendering strategy: adjust the rendering complexity according to CPU and GPU performance; adjust the data preloading strategy according to network bandwidth; adjust the caching strategy according to memory pressure; optimize the response strategy according to user interaction mode.
2. The method for implementing a cross-frame table component with configuration-driven and adaptive rendering according to claim 1, characterized in that, Step S1 includes the following steps: Step S11: Receive interactive configuration input from the user through a graphical configuration interface; Step S12: Receive declarative configuration input via a JSON configuration file; Step S13: Receive programmatic configuration input via API interface; Step S14: Select a predefined configuration template from the configuration template library.
3. The method for implementing a cross-frame table component with configuration-driven and adaptive rendering according to claim 1, characterized in that, Step S2 includes the following steps: Step S21: Verify the completeness and syntactic correctness of the configuration information, and convert configurations of different formats into a unified format; Step S22: parse the dependencies between configuration items and inject default values for unconfigured options; Step S23: Convert the configurations from different sources into a unified data structure; Step S24: Convert the string configuration to the corresponding data type and convert the relative value to the absolute value; Step S25: Merge multiple configuration sources into a single configuration object.
4. The method for implementing a cross-frame table component with configuration-driven and adaptive rendering according to claim 1, characterized in that, Step S4 includes the following steps: Step S41: Establish a unified state management mechanism and maintain responsive data sources; Step S42: Capture and extract edit events, and listen for edit events of the underlying components; Step S43: Perform intelligent data synchronization, automatically update the internal state and persist the data; Step S44: Perform semantic event notification, converting underlying events into business semantic events.
5. The method for implementing a cross-frame table component with configuration-driven and adaptive rendering according to claim 1, characterized in that, Step S5 includes the following steps: Step S51: Obtain data according to the data source configuration information. Specifically: directly read the local data array, perform front-end pagination and sorting; construct request parameters, initiate an asynchronous request, and process the data returned by the back-end; establish a real-time data connection and receive data pushed by the server; read cached data from local storage. Step S52: Display the table based on the rendering results. Specifically: render the table header according to the column configuration; render the table data rows according to the data array; render the pagination component according to the pagination configuration; and render the toolbar buttons according to the functions.
6. A configuration-driven and adaptive rendering cross-frame table component implementation apparatus, used to implement the configuration-driven and adaptive rendering cross-frame table component implementation method as described in any one of claims 1-5, characterized in that, include: A configuration receiving module is used to receive configuration information input, which includes column configuration information, data source configuration information, and rendering configuration information. The configuration parsing module is used to parse the configuration information through the configuration parsing engine and generate standardized configuration objects; The intelligent conversion module is used to generate the underlying component configuration by performing attribute mapping and component inference through the intelligent attribute converter based on the standardized configuration object. The adaptive rendering module is used to perform cross-framework adaptation and rendering optimization based on the configuration of the underlying components through the adaptive rendering engine. The data management module is used to retrieve data based on the data source configuration information and display it in a table based on the rendering results. The dynamic adjustment module is used to monitor user interactions and configuration changes in real time and dynamically adjust the rendering strategy.
7. An electronic device, characterized in that, The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the configuration-driven and adaptive rendering cross-frame table component implementation method as described in any one of claims 1-5.
8. A storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, performs the steps of the configuration-driven and adaptive rendering cross-frame table component implementation method as described in any one of claims 1-5.
Citation Information
Patent Citations
Vue-based table data formatting component implementation method
CN114218906A
General data table system based on configuration
CN120561123A
Micro-front-end real-time visual automatic rendering method and system
CN121050719A