Multi-page form data and event isolation system and method in low-code platform based on SPA

By introducing react-router-cache-route plug-in and remodeling the PubSubJS library in the low-code platform, combining Redux for data storage, the problem of data loss and slow response speed under the single-page architecture is solved, and multi-page form data and events are realized Isolation ensures data accuracy and event validity.

CN118550656BActive Publication Date: 2024-11-12BEIJING NEUSOFT HUIJU INFORMATION TECH HLDG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411045768.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2024-11-12
Estimated Expiration
2044-08-01

AI Technical Summary

Technical Problem

The existing low-code platform is based on a single-page architecture and causes data loss and slow response speed, especially when multi-components work together, it is difficult to meet the needs of complex business scenarios.

Method used

Use plug-in replacement module, pubsubJS library transformation module and ID splicing module, replace the original react-router through react-router-cache-route plug-in, and add and modify the PubSubJS library method, combine Redux for data storage and event isolation, and generate unique components. Identifier and form ID to ensure data isolation from events.

Benefits of technology

Avoid component uninstallation when path mismatch, data and behavior are not lost, form data accuracy and event validity are maintained, and independent form instance management of multiple pages and reference pages is supported.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550656B_ABST
    Figure CN118550656B_ABST
Patent Text Reader

Abstract

The present invention discloses a multi-page form data and event isolation system and method in a low-code platform based on SPA, which belongs to the field of computer technology. The system includes: a plug-in replacement module, a pubsubJS library transformation module and an ID splicing module; the plug-in replacement module is used to introduce a new plug-in to replace the original plug-in in the project entry file; the pubsubJS library transformation module transforms the original PubSubJS library through a new transformation method to complete the core structure construction; the ID splicing module is used to splice the page ID of each page and the original ID of the component to obtain a new component identifier, and splice the page ID of each page and the pop-up box page ID to obtain a new pop-up box event name; the ID splicing module also uses Redux to store and assign data, and generates form IDs for ordinary pages and reference pages, and uses the form ID to complete data and event isolation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and specifically relates to a multi-page form data and event isolation system and method in a low-code platform based on SPA. Background Art

[0002] Currently, most low-code platforms on the market are single-page (SPA) architectures, which have a series of problems, such as: (1) Data loss: After accessing menu A, if you then access menu B, the data entered by the user on page A and the user operation records will be cleared. This results in a poor user experience and may require repeated input of information; (2) Each time a page is opened, the page metadata is retrieved and the page is re-rendered. This increases user waiting time, which may cause the application to respond more slowly, especially in the case of complex pages or poor network conditions.

[0003] In order to solve the above-mentioned problems caused by the single page, the low-code platforms currently available on the market store the component instances of each page in a global variable defined by the system, and the communication between components directly operates the component instance. There are two problems with this solution: (1) It is not possible to add custom methods to the components, and only the built-in methods of the components can be used; (2) The communication operation can only be one-to-one. This method is difficult to meet the needs of complex business scenarios, especially when multiple components need to work together. Summary of the invention

[0004] The present invention aims to solve the deficiencies of the prior art and provides the following solutions:

[0005] A multi-page form data and event isolation system in a low-code platform based on SPA, including: plugin replacement module, pubsubJS library transformation module and ID splicing module;

[0006] The plug-in replacement module is used to introduce the react-router-cache-route plug-in into the project entry file to replace the original react-router plug-in;

[0007] The pubsubJS library transformation module transforms the original PubSubJS library by adding a new transformation method to complete the core structure construction;

[0008] The ID splicing module is used to splice the page ID of each page with the original component ID to obtain a new component identifier, and splice the page ID of each page with the pop-up box page ID to obtain a new pop-up box event name;

[0009] The ID splicing module also uses Redux to store and assign data, and generates form IDs for ordinary pages and reference pages, and uses the new component identifier, the new pop-up event name and the form ID to complete data and event isolation.

[0010] Preferably, the workflow of the pubsubJS library transformation module includes:

[0011] Added the setCurrentPathname method to store the address of the currently opened page and maintain a collection containing information about all opened pages;

[0012] Added registerComponent method, which can inject instances of all components under the current page when routing jumps, and bind these instances to the routing address;

[0013] Added unRegisterComponent method to destroy all instances of the current page when the page is closed;

[0014] Modify the publish method, reconstruct the event matching mechanism, and use the unique component information injected by the registerComponent method to ensure correct matching to the corresponding component instance;

[0015] Added the deleteClosePathName method to delete the invalid information data stored by the setCurrentPathname method when the page is closed.

[0016] Preferably, the workflow of obtaining the form ID in the ID splicing module includes:

[0017] Redux is used to store and assign data, and the form ID is generated for the common page and the reference page through the form ID uniqueness strategy;

[0018] For the common page, the form ID is composed of the service center name, a separator and the page ID;

[0019] For the reference page, the form ID is composed of a service center name, a separator, a reference page component ID, a separator, and the page ID.

[0020] The present invention also provides a method for isolating multi-page form data and events in a low-code platform based on SPA, and the method is applied to any of the above-mentioned systems, comprising the following steps:

[0021] Introduce the react-router-cache-route plug-in in the project entry file to replace the original react-router plug-in;

[0022] The original PubSubJS library is transformed by adding new transformation methods to complete the core structure construction;

[0023] The page ID of each page and the original component ID are concatenated to obtain a new component identifier, and the page ID of each page and the pop-up box page ID are concatenated to obtain a new pop-up box event name;

[0024] Redux is used to store and assign data, and form IDs of common pages and reference pages are generated. The form ID is used to isolate data from events. The new component identifier, the new pop-up event name and the form ID are used to isolate data from events.

[0025] Preferably, the new modification method comprises:

[0026] Added the setCurrentPathname method to store the address of the currently opened page and maintain a collection containing information about all opened pages;

[0027] Added registerComponent method, which can inject instances of all components under the current page when routing jumps, and bind these instances to the routing address;

[0028] Added unRegisterComponent method to destroy all instances of the current page when the page is closed;

[0029] Modify the publish method, reconstruct the event matching mechanism, and use the unique component information injected by the registerComponent method to ensure correct matching to the corresponding component instance;

[0030] Added the deleteClosePathName method to delete the invalid information data stored by the setCurrentPathname method when the page is closed.

[0031] Preferably, the workflow for obtaining the form ID includes:

[0032] Redux is used to store and assign data, and the form ID is generated for the common page and the reference page through the form ID uniqueness strategy;

[0033] For the common page, the form ID is composed of the service center name, a separator and the page ID;

[0034] For the reference page, the form ID is composed of a service center name, a separator, a reference page component ID, a separator, and the page ID.

[0035] Compared with the prior art, the present invention has the following beneficial effects:

[0036] By using the system of the present invention, when the paths of the tab pages do not match, other menu components will not be uninstalled, data and behavior will not be lost. When the metadata IDs or component IDs of multiple pages are opened with the same ID, form data will not be confused, and events will not be invalidated / confused. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0038] Figure 1 Schematic diagram of the system structure of an embodiment of the present invention. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0040] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0041] First, the nouns appearing in the embodiments are introduced:

[0042] SAP is a single-page web application.

[0043] A low-code platform is a development platform that uses drag-and-drop components and model-driven logic to create web and mobile applications, and can quickly generate applications with a small amount of code.

[0044] Multi-page means that a system supports opening multiple routes at the same time. The routes will not be uninstalled when the paths do not match, and the corresponding real nodes will be hidden from the DOM tree instead of deleted.

[0045] The PubSubJS library is a topic-based publish / subscribe library written in JavaScript, which features synchronous decoupling and asynchronous publishing, which helps keep the program predictable.

[0046] Redux is a predictable state container for JavaScript applications. As the requirements of JavaScript single-page applications become more and more complex, the front-end code must manage more states than ever before, such as data returned by the interface and locally created data that has not yet been persisted to the server. The complexity of the UI state is also increasing. If these problems are only handled separately at the component level, it will be difficult and complicated to manage this ever-changing state. Because there will be a lot of bloated code and repeated logic, making code maintenance more urgent and difficult. In this case, it is very necessary to introduce Redux. Redux is just a solution for Web architecture. Its ultimate role is to make our development more convenient, the code more concise, and the maintenance easier.

[0047] react-router-cache-rout is a plug-in for route caching. The original react-router route does not support multi-tab (page) display. For example, the components configured in the route will be uninstalled when the path does not match, and the corresponding real nodes will also be deleted from the DOM tree, resulting in the loss of data and behavior. react-router-cache-rout can solve this problem. The route will not be uninstalled when the path does not match, and the corresponding real nodes will not be deleted from the DOM tree, but only hidden, so that the data information and behavior of all components in the page are cached.

[0048] The reference page is another page nested in the component during page design.

[0049] refId is the component ID of the reference page component. The purpose of this component is to nest other pages.

[0050] Embodiment 1

[0051] In this embodiment, if Figure 1 As shown, the multi-page form data and event isolation system in the SPA-based low-code platform includes: plug-in replacement module, pubsubJS library transformation module and ID splicing module.

[0052] The plugin replacement module is used to introduce the react-router-cache-route plugin in the project entry file to replace the original react-router plugin.

[0053] In this embodiment, after introducing the react-router-cache-route plug-in to replace the original react-router plug-in, the corresponding code logic is modified according to the plug-in features. After the code is completed, the project will cache the previously opened pages when the route jumps. At this time, the multi-page function of the project is realized, and the following modules are all to solve the negative problems brought by multi-page applications.

[0054] The pubsubJS library transformation module transforms the original PubSubJS library by adding new transformation methods to complete the construction of the core structure.

[0055] The workflow of the pubsubJS library transformation module includes: adding a setCurrentPathname method to store the address of the currently opened page and maintaining a collection containing information of all opened pages; adding a registerComponent method to inject instances of all components under the current page when the route jumps, and bind these instances to the route address; adding an unRegisterComponent method to destroy all instances under the current page when the page is closed; transforming the publish method, reconstructing the event matching mechanism, and using the unique component information injected by the registerComponent method to ensure correct matching to the corresponding component instance; adding a deleteClosePathName method to delete the invalid information data stored by the setCurrentPathname method when the page is closed.

[0056] The ID splicing module is used to splice the page ID of each page and the original component ID to obtain a new component identifier, and to splice the page ID of each page and the pop-up box page ID to obtain a new pop-up box event name.

[0057] In this embodiment, after the transformation of the pubsubJS library is completed, the core architecture of this embodiment is built. In the process of page metadata parsing, this embodiment adopts a dynamic component ID generation strategy to ensure the uniqueness of each component in a multi-page environment. Specifically, the page ID is spliced ​​with the original component ID to form a new, unique new component identifier.

[0058] In order to ensure the uniqueness and traceability of the global pop-up box event, this embodiment adopts a new event name generation strategy, which corresponds to the method of obtaining the new component identifier. Specifically, the final form of the pop-up box event name is composed of the page ID and the pop-up box page ID.

[0059] The ID splicing module also uses Redux to store and assign data, and generates form IDs for ordinary pages and reference pages, using new component identifiers, new pop-up event names and form IDs to isolate data and events.

[0060] Specifically: Redux is used to store and assign data, and form IDs are generated for ordinary pages and reference pages through the form ID uniqueness strategy; for ordinary pages, the form ID is composed of the service center name, separator and page ID; for reference pages, the form ID is composed of the service center name, separator, reference page component ID (refId), separator and page ID; use the form ID to complete data and event isolation.

[0061] In the ID splicing module, this embodiment adopts a strategy different from the page publishing and subscription event strategy, but uses Redux to store and assign data. This method provides an independent form instance for each page, reference page and pop-up box. In order to ensure the accuracy and isolation of the data, this embodiment implements a strict form ID (formId) uniqueness strategy. The specific form ID generation rules are as follows: (1) For ordinary pages: formId = service center name + separator + page ID: (2) For reference pages: formId = service center name + separator + refId + separator and page ID. This uniqueness strategy has the following advantages: (1) Global uniqueness: By combining the service center name, page ID, and optional refId, the uniqueness of formId is ensured throughout the entire application; (2) Data isolation: Each form has a unique formId, which effectively prevents confusion and interference between data in different forms; (3) Service center distinction: Using the service center name as a prefix makes form management across service centers possible, enhancing the scalability of the system; (4) Reference page support: By introducing refId, we can accurately distinguish and manage forms of reference pages, improving the flexibility of the system; (5) Redux integration: This ID generation strategy perfectly matches the state management mode of Redux, facilitating efficient data access and updates.

[0062] Embodiment 2

[0063] In this embodiment, a method for isolating multi-page form data and events in a low-code platform based on SPA includes the following steps:

[0064] S1. Introduce the react-router-cache-route plug-in in the project entry file to replace the original react-router plug-in.

[0065] In this embodiment, after introducing the react-router-cache-route plug-in to replace the original react-router plug-in, the corresponding code logic is modified according to the plug-in features. After the code is completed, the project will cache the previously opened pages when the route jumps. At this time, the multi-page function of the project is realized, and the following modules are all to solve the negative problems brought by multi-page applications.

[0066] S2. The original PubSubJS library is transformed by adding new transformation methods to complete the construction of the core structure.

[0067] The newly added transformation methods include: a new setCurrentPathname method, which is used to store the address of the currently opening page and maintain a collection containing information about all opened pages; a new registerComponent method, which can inject instances of all components under the current page when the route jumps, and bind these instances to the route address; a new unRegisterComponent method, which destroys all instances under the current page when the page is closed; the publish method is transformed, the event matching mechanism is reconstructed, and the unique component information injected by the registerComponent method is used to ensure correct matching to the corresponding component instance; a new deleteClosePathName method is added to delete the invalid information data stored by the setCurrentPathname method when the page is closed.

[0068] S3. Concatenate the page ID of each page and the original component ID to obtain a new component identifier, and concatenate the page ID of each page and the pop-up box page ID to obtain a new pop-up box event name.

[0069] In this embodiment, after the transformation of the pubsubJS library is completed, the core architecture of this embodiment is built. In the process of page metadata parsing, this embodiment adopts a dynamic component ID generation strategy to ensure the uniqueness of each component in a multi-page environment. Specifically, the page ID is spliced ​​with the original component ID to form a new, unique new component identifier.

[0070] In order to ensure the uniqueness and traceability of the global pop-up box event, this embodiment adopts a new event name generation strategy, which corresponds to the method of obtaining the new component identifier. Specifically, the final form of the pop-up box event name is composed of the page ID and the pop-up box page ID.

[0071] S4. Use Redux to store and assign data, generate form IDs for common pages and reference pages, and use new component identifiers, new pop-up event names, and form IDs to isolate data and events.

[0072] The method of completing data and event isolation includes: using Redux to store and assign data, generating form IDs for ordinary pages and reference pages through the form ID uniqueness strategy; for ordinary pages, the form ID is composed of the service center name, separator and page ID; for reference pages, the form ID is composed of the service center name, separator, reference page component ID, separator and page ID; using the form ID to complete data and event isolation.

[0073] In the form data management of S4, this embodiment adopts a strategy different from the page publishing and subscription event strategy, but uses Redux to store and assign data. This method provides an independent form instance for each page, reference page and pop-up box. In order to ensure the accuracy and isolation of data, this embodiment implements a strict form ID (formId) uniqueness strategy. The specific form ID generation rules are as follows: (1) For ordinary pages: formId = service center name + separator + page ID: (2) For reference pages: formId = service center name + separator + refId + separator and page ID. This uniqueness strategy has the following advantages: (1) Global uniqueness: By combining the service center name, page ID, and optional refId, the uniqueness of formId is ensured throughout the entire application; (2) Data isolation: Each form has a unique formId, which effectively prevents confusion and interference between data in different forms; (3) Service center distinction: Using the service center name as a prefix makes form management across service centers possible, enhancing the scalability of the system; (4) Reference page support: By introducing refId, we can accurately distinguish and manage forms of reference pages, improving the flexibility of the system; (5) Redux integration: This ID generation strategy perfectly matches the state management mode of Redux, facilitating efficient data access and updates.

[0074] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.

Claims

1. A multi-page form data and event isolation system in a low-code platform based on SPA, characterized by: include: Plugin replacement module, pubsubJS library transformation module and ID splicing module; The plug-in replacement module is used to introduce the react-router-cache-route plug-in into the project entry file to replace the original react-router plug-in; The pubsubJS library transformation module transforms the original PubSubJS library by adding a new transformation method to complete the core structure construction; The ID splicing module is used to splice the page ID of each page with the original component ID to obtain a new component identifier, and splice the page ID of each page with the pop-up box page ID to obtain a new pop-up box event name; The ID splicing module also uses Redux to store and assign data, and generates form IDs for common pages and reference pages, and uses the new component identifier, the new pop-up event name and the form ID to complete data and event isolation; The workflow of the pubsubJS library transformation module includes: Added the setCurrentPathname method to store the address of the currently opened page and maintain a collection containing information about all opened pages; Added registerComponent method, which can inject instances of all components under the current page when routing jumps, and bind these instances to the routing address; Added unRegisterComponent method to destroy all instances of the current page when the page is closed; Modify the publish method, reconstruct the event matching mechanism, and use the unique component information injected by the registerComponent method to ensure correct matching to the corresponding component instance; Added deleteClosePathName method to delete the invalid information data stored by setCurrentPathname method when the page is closed; The workflow of obtaining the form ID in the ID splicing module includes: Redux is used to store and assign data, and the form ID is generated for the common page and the reference page through the form ID uniqueness strategy; For the common page, the form ID is composed of the service center name, a separator and the page ID; For the reference page, the form ID is composed of a service center name, a separator, a reference page component ID, and the page ID; The reference page is another page that is nested in the component during page design.

2. A method for isolating multi-page form data and events in a low-code platform based on SPA, the method being applied to the system of claim 1, characterized in that: The following steps are involved: Introduce the react-router-cache-route plug-in in the project entry file to replace the original react-router plug-in; The original PubSubJS library is transformed by adding new transformation methods to complete the core structure construction; The page ID of each page and the original component ID are concatenated to obtain a new component identifier, and the page ID of each page and the pop-up box page ID are concatenated to obtain a new pop-up box event name; Redux is used to store and assign data, and form IDs of common pages and reference pages are generated. The form ID is used to isolate data from events. The new component identifier, the new pop-up event name and the form ID are used to isolate data from events.

3. According to the method for isolating multi-page form data and events in a low-code platform based on SPA in claim 2, it is characterized in that: The newly added transformation method comprises: Added the setCurrentPathname method to store the address of the currently opened page and maintain a collection containing information about all opened pages; Added registerComponent method, which can inject instances of all components under the current page when routing jumps, and bind these instances to the routing address; Added unRegisterComponent method to destroy all instances of the current page when the page is closed; Modify the publish method, reconstruct the event matching mechanism, and use the unique component information injected by the registerComponent method to ensure correct matching to the corresponding component instance; Added the deleteClosePathName method to delete the invalid information data stored by the setCurrentPathname method when the page is closed.

4. According to the method for isolating multi-page form data and events in a low-code platform based on SPA in claim 2, it is characterized in that: The workflow for obtaining the form ID includes: Redux is used to store and assign data, and the form ID is generated for the common page and the reference page through the form ID uniqueness strategy; For the common page, the form ID is composed of the service center name, a separator and the page ID; For the reference page, the form ID is composed of a service center name, a separator, a reference page component ID, and the page ID.