Declarative control configuration method and device, computer equipment and storage medium

By defining event structures and view structures, responding to operation events and modifying attributes, the problems of form linkage and dynamic form configuration under complex rules are solved, and flexible control configuration and secure form display are achieved.

CN119271297APending Publication Date: 2025-01-07NEW H3C BIG DATA TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411306486.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

It is difficult for the existing technology to realize form linkage and dynamic form configuration under complex rules. The traditional form declarative configuration method is complex and not suitable for complex scenarios, and it is difficult to interact with the background to obtain the default value of the option.

Method used

By defining the event structure and view structure, responding to the operation events of the target control, determining the actions based on the event structure and modifying the view structure properties, using the interpreter to parse and display the modified controls, realizing dynamic form configuration.

Benefits of technology

The functions of complex form linkage and dynamic form are realized, which lowers the development threshold, is suitable for diverse application scenarios, and ensures that security does not involve code injection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271297A_ABST
    Figure CN119271297A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of front-end configuration, and discloses a declarative control configuration method and device, computer equipment and a storage medium, and the method comprises the following steps: configuring a corresponding target event structure body for a target control according to a predefined event structure body; the event structure body is used for configuring an action corresponding to the operation event; according to a predefined view structure body, configuring a corresponding target view structure body for the target control; the view structure body is used for configuring attributes of the control view; determining a target action corresponding to the target operation event according to a target event structure body of the target control; modifying attributes in the target view structural body according to the target action, and / or modifying attributes in view structural bodies of other controls; and analyzing and displaying the modified control by utilizing an interpreter. According to the method, control such as complex linkage of the control is uniformly abstracted into modification of the expression of the control through the operation event, so that functions such as a dynamic form can be realized, and more application scenes can be covered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of front-end configuration, and in particular to a declarative control configuration method, device, computer equipment and storage medium. Background Art

[0002] There are more and more personalized and customized demands on the Web. The traditional one-time coding determines the page content, which makes it passive when facing the diverse needs of customers. In order to change the page content through simple configuration modifications or simple operations on the page after the product is delivered, the current mainstream approach is to use interpreters + declarative configuration to develop pages. As the form is an important way for front-end and back-end data interaction and an important source of most user customization needs, the interpreter + declarative configuration solution applied to the form is particularly important.

[0003] Currently, the declarative configuration of forms is designed to be extended one by one based on specific functions. However, this method is mainly used to configure the properties of forms, and it is difficult to implement complex dynamic forms, such as form linkage under complex rules. Summary of the invention

[0004] In view of this, the present invention provides a declarative control configuration method, apparatus, computer equipment and storage medium, so as to generate a dynamic form by using declarative configuration.

[0005] In a first aspect, the present invention provides a declarative control configuration method, comprising:

[0006] According to the predefined event structure, a corresponding target event structure is configured for the target control; the event structure is used to configure the action corresponding to the operation event;

[0007] According to the predefined view structure, a corresponding target view structure is configured for the target control; the view structure is used to configure the properties of the control view;

[0008] In response to a target operation event of the target control, determining a target action corresponding to the target operation event according to the target event structure;

[0009] Modify the properties in the target view structure according to the target action, and / or modify the properties in the view structures of other controls;

[0010] Use the interpreter to parse and display the modified controls.

[0011] In some optional implementations, the event structure includes a plurality of predefined built-in event objects; each of the built-in event objects corresponds to a different operation event;

[0012] The built-in event object is used to configure the action corresponding to the operation event and the triggering condition for executing the action;

[0013] The step of determining a target action corresponding to the target operation event according to the target event structure includes:

[0014] Determine a target built-in event object corresponding to the target operation event in the target event structure;

[0015] According to the trigger condition matched in the target built-in event object, a corresponding target action is determined.

[0016] In some optional implementations, the built-in event object is a two-dimensional array structure;

[0017] The first dimension of the built-in event object corresponds to the inner event array, and the second dimension of the built-in event object corresponds to the inner event element in the inner event array; the inner event array includes at least one mutually exclusive inner event element, and the inner event element includes a condition item representing the trigger condition and a corresponding action item;

[0018] The determining a corresponding target action according to the trigger condition matched in the target built-in event object includes:

[0019] Performing a first matching process on each target inner event array of the first dimension of the target built-in event object in sequence until the target inner event arrays in the target built-in event object are traversed;

[0020] The first matching process includes:

[0021] Determine whether the current state matches the trigger condition of the inner event element in the target inner event array;

[0022] The action item corresponding to the trigger condition matching the current state is used as the target action item to be executed.

[0023] In some optional implementations, the trigger condition is a two-dimensional array structure;

[0024] The first dimension of the trigger condition corresponds to an inner condition array that performs a logical AND, and the second dimension of the trigger condition corresponds to an inner condition element that performs a logical OR in the inner condition array; the inner condition array includes at least one inner condition element, and the inner condition element is used to represent a determination rule;

[0025] The determining whether the current state matches the triggering condition of the inner event element in the target inner event array includes:

[0026] For any pending trigger condition of the inner event element in the target inner event array, performing a second matching process on each target inner condition array of the first dimension of the pending trigger condition to determine whether the current state matches the target inner condition array;

[0027] In the case where the current state matches each of the target inner condition arrays, determining that the current state matches the pending trigger condition;

[0028] The second matching process includes:

[0029] Determining whether the current state matches a determination rule represented by at least one inner condition element in the target inner condition array;

[0030] In the case where the current state matches a determination rule represented by at least one inner condition element in the target inner condition array, it is determined that the current state matches the target inner condition array.

[0031] In some optional implementations, the event structure further includes an initialization event object and / or a custom event object;

[0032] The initialization event object is used to configure the action to be performed when the control is initialized; the custom event object is used to configure the user-defined action;

[0033] The determining of a target action corresponding to the target operation event according to the target event structure further includes:

[0034] When initializing the target control, determining the corresponding target initialization event object in the target event structure, and determining the corresponding target action according to the action configured in the target initialization event object;

[0035] In the case where the target operation event is a user-defined operation, a target custom event object corresponding to the target operation event in the target event structure is determined, and a corresponding target action is determined according to the action configured in the target custom event object.

[0036] In some optional implementations, the action configured in the event structure includes: an action type, an action value, and a pointed control;

[0037] The action type includes an event type and a configuration type; when the action type is an event type, the action value includes a name of the event to be executed; when the action type is a configuration type, the action value includes a value to be configured;

[0038] The modifying the properties in the target view structure according to the target action, and / or modifying the properties in the view structure of other controls, includes:

[0039] The control pointed to by the target action is used as a control to be operated; the control to be operated includes the target control and / or other controls;

[0040] In the case where the action type of the target action is an event type, determining an operation event to be executed corresponding to the event name contained in the action value of the target action, and controlling the control to be operated to execute a corresponding action according to the operation event to be executed;

[0041] In the case where the action type of the target action is a configuration type, the value to be configured contained in the action value of the target action is configured for the control to be operated.

[0042] In some optional implementations, configuring a corresponding target event structure for the target control includes:

[0043] According to a preset value template, corresponding option values ​​are set for the target event structure; the value template includes a value type and a value path.

[0044] In a second aspect, the present invention provides a declarative control configuration device, comprising:

[0045] A configuration module, configured to configure a corresponding target event structure for a target control according to a predefined event structure; the event structure is used to configure an action corresponding to an operation event; and to configure a corresponding target view structure for the target control according to a predefined view structure; the view structure is used to configure properties of a control view;

[0046] An event response module, configured to respond to a target operation event of the target control and determine a target action corresponding to the target operation event according to the target event structure;

[0047] A property modification module, used to modify the properties in the target view structure according to the target action, and / or modify the properties in the view structures of other controls;

[0048] The parsing and display module is used to parse and display the modified controls using the interpreter.

[0049] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the declarative control configuration method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0050] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the declarative control configuration method of the first aspect or any corresponding embodiment thereof.

[0051] The present invention abstracts the configuration of the control into a view structure and an event structure, and performs a simple abstraction on the configuration. It can not only distinguish the existing configuration of the control, but also separate the performance and control of the control, and uniformly abstract the complex linkage and other controls of the control into modifying the performance of the control through operation events, which can realize functions such as dynamic forms; developers can configure the performance and control of the control more flexibly, which is in line with development intuition and can cover more application scenarios; and the structure also has good scalability and is suitable for business scenarios such as page layout. In addition, it only needs to be configured based on the view structure and the event structure, and does not involve function expressions, so that code injection is not required, and security can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0053] Figure 1 is a flowchart of a declarative control configuration method according to an embodiment of the present invention;

[0054] Figure 2 is a schematic diagram of execution logic according to an embodiment of the present invention;

[0055] Figure 3 is a flowchart of another declarative control configuration method according to an embodiment of the present invention;

[0056] Figure 4 is a schematic diagram of a data structure of a built-in event object according to an embodiment of the present invention;

[0057] Figure 5 is a structural block diagram of a declarative control configuration device according to an embodiment of the present invention;

[0058] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0060] Declarative programming is a programming paradigm that is opposite to imperative programming. It emphasizes logical expression rather than specific execution. Similarly, in contrast to imperative configuration, declarative configuration uses an easy-to-understand language or format (such as JSON, XML, etc.) to define the structure, behavior, or style of a page without writing specific implementation code; this approach allows non-developers to participate in the configuration, lowering the technical threshold. The structure of the form (such as field type, layout, etc.) is defined through declarative configuration, and the interpreter dynamically generates form items based on these configurations. In this way, without modifying the code, you can quickly adapt to different form requirements by simply adjusting the configuration.

[0061] Among them, the interpreter generally needs to be designed and developed according to the definition and format of the declarative configuration. The simpler and clearer the declarative configuration structure is, the higher the parsing efficiency of the interpreter is, and the easier it is to develop. Therefore, the most important thing here is the design of the declarative configuration, considering the generality. In addition, since in most cases the front-end and back-end interactions are based on the JSON (JavaScript Object Notation, a simplified data exchange format) data structure, and there is a standard data structure for describing the JSON structure, namely JSON Schema (a specification for describing the JSON data format), it is easy to think of using JSON Schema as a configuration template for dynamic form generation. However, most of the usage scenarios of JSON Schema are used to verify JSON, which is for data. Some expression attributes of page form controls are not defined (such as: hidden, disabled, size, etc.), and there is no definition of control event linkage.

[0062] The related technologies are extended designs for single declarative configuration based on specific functions one by one. For example, some solutions add a series of attribute identifiers starting with "ui:" to the attributes of the form. For example, the ui:widget attribute identifies the type of control used for display, ui:autofocus indicates whether it is automatically selected, and ui:hide indicates whether it is hidden.

[0063] For example, if a form item of "age" needs to be set as a drop-down box type and cannot be hidden, it can be configured as follows:

[0064]

[0065] In addition, with the help of anyOf configuration and dependencies configuration in JSON Schema, some form linkage rules can be implemented. For example, through anyOf configuration, different content can be selected for form items under different selections; for example, when the user name setting is selected, the form item is displayed as the first name and last name, and when the ID setting is selected, the user ID is displayed.

[0066] However, these configuration methods of JSON Schema have complex and irregular rule formats. Each scenario requires a corresponding rule format and parameter nesting logic, which requires front-end developers to remember a lot of content. The implementation threshold is high and it is not suitable for complex form linkage scenarios. In addition, this configuration method cannot cover all scenarios. For example, it cannot interact with the background to obtain option default values, and some types of controls (input boxes, selection boxes, counters, etc.) cannot be specified.

[0067] In addition, some solutions are extended based on the native JSON Schema structure to support richer form control configurations, such as defining the form layout direction and defining the control type; and using function expressions to implement form linkage.

[0068] The newly added configuration based on this extension method is confused with the native JSON Schema configuration and is difficult to distinguish; and because the newly defined extended attributes may appear in any node, the parser needs to parse each node of the JSON Schema configuration.

[0069] The form linkage method based on function expressions needs to execute function expressions to obtain the real value when implementing form linkage, but because the parsing order cannot be specified, the default value cannot be operated, and errors may even occur; for example, the default value of other options cannot be dynamically modified (cleared) when one option changes. This method also cannot configure form operations (such as gaining focus, changing option values, typing, etc.). In addition, because executable configuration code is introduced, additional processing logic such as anti-injection also needs to be added.

[0070] According to an embodiment of the present invention, a declarative control configuration method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0071] In this embodiment, a declarative control configuration method is provided, which can be applied to devices capable of parsing front-end codes, such as mobile terminals, personal computers, etc. Figure 1 is a flowchart of a declarative control configuration method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps.

[0072] Step S101, configuring a corresponding target event structure for a target control according to a predefined event structure; the event structure is used to configure an action corresponding to an operation event.

[0073] In this embodiment, an event structure is predefined, and the event structure is used to configure an action corresponding to an operation event. The operation event can be an event that can be triggered when a user operates a control, or an event when the control is initialized. For example, the control can be a form item, and the operation event can be a typing event when a user types a corresponding value, or a value change event for changing a value in a form item.

[0074] The action configured in the event structure indicates the action to be performed when a certain operation event is triggered. For example, if the value in a control changes, it is necessary to change some properties of the control or other controls. The action used to change the control properties can be defined through the event structure.

[0075] In practical applications, for target controls involving linkage and other functions, a suitable event structure, namely a target event structure, can be set for them according to actual needs. The target event structure is configured according to the format of a predefined event structure.

[0076] Step S102: configuring a corresponding target view structure for the target control according to a predefined view structure; the view structure is used to configure the properties of the control view.

[0077] In this embodiment, a view structure is also predefined, and the view structure is used to configure the properties of the control view, so as to configure the display effect of the control. For example, the properties of the control view may specifically include: control type, whether the control is hidden, etc.

[0078] In practical applications, a suitable view structure, ie, a target view structure, may be set for a target control according to actual requirements. The target view structure is configured according to a predefined view structure format.

[0079] Among them, the event structure and view structure in this embodiment are both declaratively configured structures and do not involve specific implementation codes.

[0080] The event structure and view structure are both extended attribute configurations. To distinguish them from the original attribute configurations, you can set a key prefix for the event structure and view structure.

[0081] For example, you can extend the event structure and view structure based on JSON Schema and set the key prefix "x_".

[0082] For example, you can add a new view structure x_ui to control the display configuration of the control, such as whether the control is disabled, visible, the control type, the default value, etc. Similarly, add a new event structure x_event to dynamically modify the display configuration of the control and the JSON Schema configuration itself by configuring the action of the operation event.

[0083] For example, a format of the view structure x_ui can be as follows:

[0084]

[0085] The properties in the view structure x_ui are used to describe the instantaneous state of the control. Among them, widget indicates the type of control used for display, default indicates the initial value of the control, and props is used for the control-specific property configuration extension (such as: options in the drop-down selection control, step in the slider control, etc.); the view structure x_ui can also include some common control properties, such as: width indicates the width of the control, hide indicates whether the control is hidden, disable indicates whether the control is disabled, readOnly indicates whether the control is read-only, etc. In addition, the properties can also be extended according to the actual situation.

[0086] Step S103, in response to the target operation event of the target control, determining the target action corresponding to the target operation event according to the target event structure.

[0087] In this embodiment, there may be an operation event directed to the target control, i.e., a target operation event. For example, after the target control is rendered and displayed, the user may actively operate the target control, thereby inputting a corresponding target operation event. Based on the target operation event, the target event structure of the target control may be triggered, and then based on the target event structure configured for the target control, the action corresponding to the target operation event, i.e., the target action, may be determined.

[0088] Step S104, modifying the properties in the target view structure according to the target action, and / or modifying the properties in the view structures of other controls.

[0089] In this embodiment, the actions in the event structure are used to directly or indirectly modify the properties of the control view, and the actions in the event structure of a certain control can be used to modify its own properties or the properties of other controls, depending on the actions configured in the control.

[0090] Specifically, using the target action in the target event structure, it is possible to determine what property the target action is used to modify, and then based on the specific content of the target action, the properties in the view structure of the corresponding control can be modified; for example, the properties in the target view structure can be modified, and the properties in the view structure of other controls can also be modified, depending on the configuration content in the target action.

[0091] For example, if two controls are displayed on the page, one control A is a form item indicating the user's age, and the other control B is a form item indicating whether the user is an adult. Control A indicating the user's age can be used as the target control, and a target event structure can be set for it. The target event structure specifically indicates that if the input value is less than 18, the content of control B is configured as "minor", otherwise the content of control B is configured as "adult".

[0092] When the user enters a specific age into control A, a typing event can be triggered. If the value entered in the typing event is 17, based on the target event structure of control A, the target action corresponding to the typing event can be determined to be: setting the content of control B to "minor". Then, based on this, the value in control B can be modified to "minor", thereby realizing the linkage between controls A and B.

[0093] Step S105, using an interpreter to parse and display the modified control.

[0094] In this embodiment, after modifying the properties of the target control and / or other controls' declarative configuration, the modified control can be parsed using an interpreter to parse the declarative event structure and view structure into corresponding configurations or scripts, and the modified control can be displayed to the user by rendering the control.

[0095] It can be understood that the process from step S103 to step S105 is cyclic and dynamic. Figure 2 A schematic diagram of the execution logic is shown.

[0096] The declarative control configuration method provided in this embodiment abstracts the control configuration into a view structure and an event structure, and performs a simple abstraction of the configuration. It can not only distinguish the existing configuration of the control, but also separate the performance and control of the control, and uniformly abstract the complex linkage and other controls of the control into modifying the performance of the control through operation events, which can realize functions such as dynamic forms; developers can configure the performance and control of the control more flexibly, which is in line with the development intuition and can cover more application scenarios; and the structure also has good scalability and is suitable for business scenarios such as page layout. In addition, it only needs to be configured based on the view structure and the event structure, and does not involve function expressions, so there is no need for code injection, which can ensure security.

[0097] In this embodiment, a declarative control configuration method is provided, which can be applied to devices capable of parsing front-end codes, such as mobile terminals, personal computers, etc. Figure 3 is a flowchart of a declarative control configuration method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps.

[0098] Step S301, pre-define an event structure and a view structure.

[0099] In this embodiment, a view structure related to the control performance and an event structure related to the control control are predefined, so that the corresponding control can be configured based on the format of the two structures. For example, when generating a form item, for each unit described by an attribute in the JSON Schema, an event structure and a view structure can be set as needed, and a suitable form item can be generated by setting these extended attributes.

[0100] It can be understood that after the event structure and the view structure have been defined, there is no need to redefine the event structure and the view structure when configuring the control, that is, there is no need to perform step S301 multiple times.

[0101] In some optional implementations, the event structure includes multiple predefined built-in event objects; each built-in event object corresponds to a different operation event; the built-in event object is used to configure the action corresponding to the operation event and the triggering condition for executing the action.

[0102] In this embodiment, a corresponding object, i.e., a built-in event object, may be set for each operation event. For example, the operation event may include a key-in event, a value change event, a focus loss event, a focus gain event, etc., and a corresponding built-in event object may be set for each operation event.

[0103] For example, one format of the event structure x_event can be as follows:

[0104]

[0105]

[0106] Among them, @input, @change, @blur, and @focus are the built-in event objects corresponding to the input event, value change event, focus loss event, and focus gain event, respectively. @initUI and @initData are initialization event objects, and customEvent1 and customEvent2 are custom event objects, which will be explained later.

[0107] Moreover, for each built-in event object, you can configure the action corresponding to the operation event and the trigger condition for executing the action, that is, the corresponding action can be executed only when the trigger condition is met. It can be understood that if the trigger condition is empty, the corresponding action can be executed after the operation event is triggered.

[0108] For the target time structure, based on the triggering conditions therein, the target action to be executed can be determined. Specifically, the subsequent step S304 "determine the target action corresponding to the target operation event according to the target event structure" can include the following steps A1 to A2.

[0109] Step A1, determining a target built-in event object corresponding to a target operation event in a target event structure.

[0110] Step A2: Determine the corresponding target action according to the trigger condition matched in the target built-in event object.

[0111] In this embodiment, when there is a target operation event for the target control, the built-in event object corresponding to the target operation event, that is, the target built-in event object, can be determined from the target event structure of the target control; it can be understood that if there is no built-in event object corresponding to the target operation event in the target event structure, there is no need to perform the corresponding action.

[0112] In addition, the target built-in event object is also configured with one or more actions and corresponding trigger conditions. If one or some of the trigger conditions are met, the current event matches these trigger conditions, and it can be determined that the action corresponding to the matching trigger condition is the action that needs to be executed, that is, the target action.

[0113] In this embodiment, a corresponding built-in event object is configured for each operation event, and the trigger conditions for executing the action can be configured, so that actions under different operation events can be configured for the target control based on the event structure, and by adding trigger conditions, form linkage can be achieved based on user needs.

[0114] Optionally, to facilitate the implementation of complex functions, the built-in event object is a two-dimensional array structure, wherein the first dimension of the built-in event object corresponds to the inner event array executed in sequence; the second dimension of the built-in event object corresponds to the inner event element in the inner event array; the inner event array includes at least one mutually exclusive inner event element, and the inner event element includes a condition item representing a trigger condition and a corresponding action item.

[0115] In this embodiment, the first dimension of the built-in event object of the two-dimensional array structure is a one-dimensional array, called an "inner event array"; each inner event array can be set with one or more second-dimensional elements, i.e., inner event elements, and the action of the built-in event object is set using each inner event element. The built-in event object can be a nested list, with the outer elements being the inner event array and the inner elements being the inner event elements.

[0116] Specifically, Figure 4 As shown, the minimum element of the built-in event object of the two-dimensional array structure is the inner event element, which includes a condition item representing the trigger condition and a corresponding action item, that is, when the condition item is met, the corresponding action item needs to be executed. One or more inner event elements can constitute the inner array of the built-in event object, that is, the inner event array; it can be understood that the inner event array is also the outer element of the built-in event object. Furthermore, one or more inner event arrays can form the required built-in event object.

[0117] In addition, each inner event array needs to be executed in order; and each inner event element in each inner event array is mutually exclusive, that is, for an inner event array, only one action that meets the trigger condition is executed. In general, multiple condition items in an inner event array are mutually exclusive, that is, only the trigger condition corresponding to one of the condition items can be met.

[0118] Specifically, the above step A2 of “determining the corresponding target action according to the trigger condition matched in the target built-in event object” includes step A21.

[0119] Step A21, performing a first matching process on each target inner event array of the first dimension of the target built-in event object in sequence until the target inner event arrays in the target built-in event object are traversed.

[0120] Among them, the first matching process includes: judging whether the current state matches the triggering condition of the inner event element in the target inner event array; taking the action item corresponding to the triggering condition matching the current state as the target action item to be executed.

[0121] In this embodiment, when determining the target action based on the target built-in event object, the target actions that may exist in each target inner event array in the target built-in event object will be determined in sequence according to a preset order. The preset order may be, for example, the arrangement order of each target inner event array in the target built-in event object. In addition, for any target inner event array, the target inner event array may include multiple inner event elements, and each inner event element corresponds to a trigger condition, and each trigger condition corresponds to a condition item; in this embodiment, it can be determined whether the current state of the control matches the corresponding trigger condition. If the current state meets the trigger condition, it matches the trigger condition, so that the corresponding action item, that is, the target action item that needs to be executed, can be determined.

[0122] It can be understood that, when the trigger condition is matched, each inner event element can determine a corresponding target action item, and each target action item corresponds to a target action.

[0123] For example, if a control sets a built-in event object such as Figure 4 As shown, the built-in event object includes three outer elements, namely three inner event arrays; Figure 4 As shown, the first inner event array includes three inner event elements, the second inner event array includes two inner event elements, and the third inner event array includes one inner event element.

[0124] When the operation event of the built-in event object is triggered, it will be executed in the order of the inner event array, that is, the first inner event array will be executed first; if condition item 1 is currently met, the corresponding action item 1 will be executed, and there is no need to determine whether condition 2 or condition 3 is met. After that, the second inner event array will be executed, and based on the condition item 4 or condition item 5 currently met, the corresponding action item 4 or action item 5 will be selected and executed; finally, the third inner event array will be executed, which will not be repeated.

[0125] For example, the structure of the inner event element can be {condition:[],action:[]}. Among them, condition:[] is the condition item, and action:[] is the action item. The action item action:[] indicates a series of actions that need to be performed when the corresponding condition item condition:[] is true. The action item action:[] can be configured with one action or multiple actions, depending on actual needs.

[0126] For example, the built-in event object of a two-dimensional array structure can be represented as:

[0127]

[0128] In this embodiment, each built-in event object is represented by a two-dimensional array, and the inner event array corresponding to the first dimension is executed in sequence, while the inner event elements corresponding to the second dimension are mutually exclusive items, that is, only one item that meets the conditions is executed; when setting the target event structure for the target control, the inner event elements and the order of the outer elements can be set based on actual needs, so that the event structure can be parsed in sequence to meet the diverse needs of users.

[0129] Optionally, the trigger condition in the event structure is also a two-dimensional array structure; for example, the condition item condition:[] in the inner event element is also a two-dimensional array structure.

[0130] Furthermore, the first dimension of the trigger condition corresponds to an inner condition array that performs logical AND, and the second dimension of the trigger condition corresponds to an inner condition element in the inner condition array that performs logical OR; the inner condition array includes at least one inner condition element, and the inner condition element is used to represent a judgment rule.

[0131] In this embodiment, similar to the above-mentioned built-in event object, the trigger condition is also a two-dimensional array structure, and its first dimension is also a one-dimensional array, called "inner condition array"; each inner condition array can set one or more second-dimensional elements, i.e., inner condition elements. The trigger condition can be a nested list, and its outer elements are inner condition arrays, and the inner elements are inner condition elements.

[0132] Among them, for a certain inner condition array, the inner condition elements perform "logical OR" between them, that is, as long as one of the inner condition elements is true, the inner condition array is true. In addition, the inner condition arrays perform "logical AND" between them, that is, only when all the inner condition arrays are true, the trigger condition is true, that is, the trigger condition is satisfied at this time.

[0133] It can be understood that if the inner condition array includes only one inner condition element, the inner condition array is true only when the inner condition element is true.

[0134] Furthermore, the first matching process in the above step A21, the process of "determining whether the current state matches the triggering condition of the inner event element in the target inner event array", specifically includes steps A211 to A212.

[0135] Step A211, for any pending trigger condition of the inner event element in the target inner event array, a second matching process is performed on each target inner condition array of the first dimension of the pending trigger condition to determine whether the current state matches the target inner condition array.

[0136] Step A212: When the current state matches each target inner condition array, it is determined that the current state matches the pending trigger condition.

[0137] Among them, the second matching processing includes: judging whether the current state matches the determination rule represented by at least one inner condition element in the target inner condition array; if the current state matches the determination rule represented by at least one inner condition element in the target inner condition array, determining that the current state matches the target inner condition array.

[0138] In this embodiment, the inner event element may include one or more trigger conditions, each trigger condition corresponds to a corresponding condition item. For the convenience of description, any trigger condition is referred to as a "pending trigger condition", and the above steps A211 to A212 can be executed.

[0139] For a pending trigger condition, the pending trigger condition includes one or more inner condition arrays, namely, a target inner condition array, and the target inner condition array may be provided with one or more inner condition elements. For a target inner condition array, since the inner condition elements therein perform logical AND, it is only necessary for at least one inner condition element to represent a judgment rule that matches the current element of the control, and the current state can be considered to match the target inner condition array, or in other words, the target inner condition array is "true". Since the inner condition array performs logical AND, it is necessary for all the target inner condition arrays in the pending trigger condition to be "true" before the entire pending trigger condition is "true", that is, the current state matches the pending trigger condition, and then the action corresponding to the pending trigger condition can be used as the target action.

[0140] For example, the inner conditional element may specifically include source data, a predicate and target data. For example, sourceValue represents the source data, which is the left value of the predicate, symbol represents the predicate (for example, ==, >, <, etc., and supports extension), and targetValue represents the target data, that is, the right value of the predicate. These three parts constitute the trigger condition.

[0141] For example, for a control a, if you need to perform a certain action when it is visible and its value is not empty, a condition item condition:[] of the control a can be set as follows:

[0142]

[0143]

[0144] Among them, formConf:a.x_ui.hide means obtaining the attribute value of the hidden attribute hide in the view structure diagram x_ui of control a; formData:a means obtaining the value in control a. Both of them conform to the value template set in this embodiment, and the value template will be described later.

[0145] In this embodiment, a two-dimensional array is used to set the trigger condition, and the outer layer elements and the inner layer elements respectively perform logical AND and logical OR, which can meet various complex condition requirements and is suitable for complex linkage scenarios.

[0146] Optionally, the event structure also includes an initialization event object and / or a custom event object; wherein the initialization event object is used to configure the action to be performed when the control is initialized; and the custom event object is used to configure user-defined actions.

[0147] Similar to the above step A1, the step S304 of "determining the target action corresponding to the target operation event according to the target event structure" may also include step A3 and step A4.

[0148] Step A3, when initializing the target control, determine the corresponding target initialization event object in the target event structure, and determine the corresponding target action according to the action configured in the target initialization event object.

[0149] Step A4, when the target operation event is a user-defined operation, determine the target custom event object corresponding to the target operation event in the target event structure, and determine the corresponding target action according to the action configured in the target custom event object.

[0150] In this embodiment, considering the need for initialization values ​​or option values, an initialization event object is added to the event structure, such as the above-mentioned @initData event, which is used to initiate and process requests so that the control default value or option value can be initialized using asynchronous requests. The configuration method of the initialization event object and the above-mentioned built-in event object may be slightly different. For example, the initialization event object may not be configured with a conditional item.

[0151] For example, the initialization event object can configure the request items related to the request and set the corresponding action items, which generally represent the assignment operation to be performed. For example, the request items may include: url attribute, which represents the request path; methods attribute, which represents the request type (GET / POST / HEAD / DELETE); params attribute, which represents the request parameters; data, which represents the request body configuration; header, which represents the request header configuration; autoSend, which represents whether to execute automatically (the default parsing configuration is execution). In addition, action can also be used to represent the assignment operation to be performed, that is, the action item.

[0152] For example, in the event structure x_event configured for a certain control, one configuration method of initializing the event object @initData is as follows:

[0153]

[0154]

[0155] Accordingly, when initializing the target control, if the target event structure is configured with an initialization event object, it can be used as the target initialization event object, and the corresponding target action can be determined according to the action configured in the target initialization event object. For example, if the target initialization event object does not have a trigger condition set, the action configured in it can be directly used as the target action and executed.

[0156] Similarly, the event structure also allows users to customize the required configuration objects, namely, customized event objects. The customized event objects can be configured based on the format of the above-mentioned built-in event objects or based on the format of the initialization event object. This embodiment does not limit this.

[0157] If the current target operation event is a user-defined operation, the corresponding custom event object, that is, the target custom event object, can be determined from the target event structure, and then the corresponding target action can also be determined. Among them, if the format of the target custom event object is consistent with that of the initialization event object, the action in the target custom event object can be directly used as the target action; if the format of the target custom event object is consistent with that of the built-in event object, that is, it has condition items and action items, then it is necessary to determine the corresponding target action by judging whether it matches the condition items, which will not be repeated here.

[0158] In this embodiment, by setting the initialization event object, the corresponding action can be executed when the control is initialized, which can meet the initialization requirements; and the initialization event object can set the request item to respond to the asynchronous request. By setting the custom event object, the user can configure the event structure based on their own needs, which is conducive to the expansion of the event structure.

[0159] Step S302: According to the predefined event structure, a corresponding target event structure is configured for the target control; the event structure is used to configure an action corresponding to the operation event.

[0160] Specifically, the above step S302 "configure a corresponding target event structure for the target control" may include:

[0161] Step S3021, setting corresponding option values ​​for the target event structure according to a preset value template; the value template includes a value type and a value path.

[0162] In this embodiment, since it is often necessary to use the current configuration or the current form filling content as a basis for judgment or to construct a new attribute value during use, a value template is set in the option value, and the format is "{value type: value path}". Based on the value template, the option value in the target event structure can be conveniently and uniformly set, for example, the option value in the condition item or action item can be set.

[0163] Specifically, the value types supported by the value template (the type of value to be selected) include: formData form fill value, formConf form configuration value, env context used by the form is passed in from the outside according to the application scenario (for example: token, userID), and interface response content response. The value path is the path of the value to be selected, which is similar to the control target pointed to above, and can also point to deeper attributes based on a format similar to bc.

[0164] Among them, the source of the value type is saved in JSON structure, and the value path is similar to the JSON value method. Most of the configurations in the event structure support value templates, which are used to define values ​​in the form of variables. For example, as mentioned above, formConf:a.x_ui.hide means getting the attribute value of the hidden attribute hide in the view structure diagram x_ui of control a; formData:a means getting the value in control a.

[0165] In addition, when parsing value templates, because there are numbers and Boolean values, when there are only value templates in the value, the interpreter should parse it as a real value instead of processing it all as a string to ensure the accuracy of the parsing result.

[0166] It is understandable that the above declarative examples are only used to understand the implementation method, and configuration can also be based on other syntaxes. For example, for the control target pointed to in the action item and the current configuration {formConf:***} obtained in the value template, JSON Path syntax can be used to obtain more powerful and flexible JSON structure parsing and selection capabilities, which will not be described in detail here.

[0167] Step S303: configure a corresponding target view structure for the target control according to the predefined view structure; the view structure is used to configure the properties of the control view.

[0168] For details, see Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0169] Step S304, in response to the target operation event of the target control, determining a target action corresponding to the target operation event according to the target event structure.

[0170] For details, see Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0171] Step S305: modify the properties in the target view structure according to the target action, and / or modify the properties in the view structures of other controls.

[0172] For details, see Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0173] In some optional implementations, the action configured in the event structure includes: action type, action value, and the control pointed to. The action type includes event type and configuration type; when the action type is event type, the action value includes the name of the event to be executed; when the action type is configuration type, the action value includes the value to be configured.

[0174] Among them, the above-mentioned built-in event objects, initialization event objects, and custom event objects can all be provided with corresponding action items action:[]. The action items action:[] of these objects can all be configured based on the above-mentioned method, that is, they can all include action type, action value, and pointed control.

[0175] In this embodiment, the action item action:[] can set the action type type, the action value value and the control target pointed to. The action type type can be divided into two categories: event type EVENT and configuration type SET.

[0176] The event type EVENT is used to execute the event of a control (generally other controls). In this case, the action value value indicates the name of the event to be executed. The configuration type SET indicates that the configuration of the control needs to be modified. In this case, the action value value indicates the value to be configured. The control target pointed to can be the name of the control pointed to by the action.

[0177] Furthermore, the above step S305 "modifying the properties in the target view structure according to the target action, and / or modifying the properties in the view structure of other controls" includes steps B1 to B3.

[0178] Step B1: taking the control pointed to by the target action as the control to be operated; the control to be operated includes the target control and / or other controls.

[0179] Step B2, when the action type of the target action is an event type, determine the operation event to be executed corresponding to the event name contained in the action value of the target action, and control the control to be operated to execute a corresponding action according to the operation event to be executed.

[0180] Step B3: when the action type of the target action is a configuration type, configure the value to be configured contained in the action value of the target action for the control to be operated.

[0181] In this embodiment, the control target pointed to by the target action is the control whose properties need to be modified later, which is called the control to be operated. For a target action, the number of controls to be operated can be one or more. Moreover, the control to be operated may be the target control, that is, the target action is used to change its own properties, or it may be other controls, that is, the target action is used to change the properties of other controls.

[0182] Among them, if the action type type of the target action is the event type EVENT, then the action value value of the target action is the name of the event to be executed. Therefore, based on this, the corresponding operation event, that is, the operation event to be executed, can be determined. Based on the event object corresponding to the operation event to be executed (for example, the built-in event object, the initialization event object, etc.), the process of executing other event objects can be triggered to complete the required action.

[0183] If the action type type of the target action is the configuration type SET, the target action directly modifies the property of the control to be operated, that is, the property of the control to be operated is configured to the value to be configured contained in the action value value of the target action.

[0184] For example, the configuration of an action item action:[] is as follows:

[0185]

[0186] Among them, bc can point to deeper properties, c[*] represents each subitem of the array, and _this represents the current form item.

[0187] As shown in the above example, when the action type is the event type EVENT, other event objects can be triggered. For example, the above example can trigger the initialization event object @initData, which can not only realize event linkage, but also set the order of parsing, that is, when the action item of an event object of a control can be executed, then execute another event object linked with it, and there is a dependency relationship between event objects.

[0188] Especially for the initialization event object @initData, since it is an asynchronous request, if the property value of the control to be obtained also needs to be obtained asynchronously, then the execution of the action of the initialization event object @initData needs to be in sequence; by setting the dependency relationship between the initialization event objects through the action items to trigger them in sequence, the accuracy of the execution order can be guaranteed. At this time, the initialization event object that depends on the time of other objects generally needs to be set to not be automatically executed, for example, set autoSend to false.

[0189] When the action type type is the configuration type SET, you can set the properties that need to be modified in the configuration type. As shown in the above example, the property that needs to be modified is "x_ui.hide", that is, whether the control is hidden. When the action item action:[] is triggered, the hidden property of the corresponding control will be modified to "false" so that these controls can be displayed to the user.

[0190] Step S306: parse the modified control using an interpreter and display it.

[0191] For details, see Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.

[0192] The declarative control configuration method provided in this embodiment uses the view structure and event structure to separate the expression and control of the control, and unifies and abstracts the complex linkage and other controls of the control into modifying the expression of the control through the operation event, which can realize functions such as dynamic forms; developers can configure the expression and control of the control more flexibly, which conforms to the development intuition and can cover more application scenarios. The option value can be set by using the value template to achieve unification; the built-in event object and conditional item can be realized by using the two-dimensional data structure, and a more complex event structure can be set, which can meet the control requirements of various complex scenarios and facilitate the linkage of load scenarios.

[0193] In this embodiment, a declarative control configuration device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated here. As used below, the term "module" may be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0194] This embodiment provides a declarative control configuration device, such as Figure 5 As shown, including:

[0195] Configuration module 501, configured to configure a corresponding target event structure for a target control according to a predefined event structure; the event structure is used to configure an action corresponding to an operation event; and to configure a corresponding target view structure for the target control according to a predefined view structure; the view structure is used to configure properties of a control view;

[0196] An event response module 502, configured to respond to a target operation event of the target control and determine a target action corresponding to the target operation event according to the target event structure;

[0197] The property modification module 503 is used to modify the properties in the target view structure according to the target action, and / or modify the properties in the view structures of other controls;

[0198] The parsing and displaying module 504 is used to parse and display the modified controls using an interpreter.

[0199] In some optional implementations, the event structure includes a plurality of predefined built-in event objects; each of the built-in event objects corresponds to a different operation event;

[0200] The built-in event object is used to configure the action corresponding to the operation event and the triggering condition for executing the action;

[0201] The event response module 502 determines a target action corresponding to the target operation event according to the target event structure, including:

[0202] Determine a target built-in event object corresponding to the target operation event in the target event structure;

[0203] According to the trigger condition matched in the target built-in event object, a corresponding target action is determined.

[0204] In some optional implementations, the built-in event object is a two-dimensional array structure;

[0205] The first dimension of the built-in event object corresponds to the inner event array, and the second dimension of the built-in event object corresponds to the inner event element in the inner event array; the inner event array includes at least one mutually exclusive inner event element, and the inner event element includes a condition item representing the trigger condition and a corresponding action item;

[0206] The event response module 502 determines the corresponding target action according to the trigger condition matched in the target built-in event object, including:

[0207] Performing a first matching process on each target inner event array of the first dimension of the target built-in event object in sequence until the target inner event arrays in the target built-in event object are traversed;

[0208] The first matching process includes:

[0209] Determine whether the current state matches the trigger condition of the inner event element in the target inner event array;

[0210] The action item corresponding to the trigger condition matching the current state is used as the target action item to be executed.

[0211] In some optional implementations, the trigger condition is a two-dimensional array structure;

[0212] The first dimension of the trigger condition corresponds to an inner condition array that performs a logical AND, and the second dimension of the trigger condition corresponds to an inner condition element that performs a logical OR in the inner condition array; the inner condition array includes at least one inner condition element, and the inner condition element is used to represent a determination rule;

[0213] The event response module 502 determines whether the current state matches the triggering condition of the inner event element in the target inner event array, including:

[0214] For any pending trigger condition of the inner event element in the target inner event array, performing a second matching process on each target inner condition array of the first dimension of the pending trigger condition to determine whether the current state matches the target inner condition array;

[0215] In the case where the current state matches each of the target inner condition arrays, determining that the current state matches the pending trigger condition;

[0216] The second matching process includes:

[0217] Determining whether the current state matches a determination rule represented by at least one inner condition element in the target inner condition array;

[0218] In the case where the current state matches a determination rule represented by at least one inner condition element in the target inner condition array, it is determined that the current state matches the target inner condition array.

[0219] In some optional implementations, the event structure further includes an initialization event object and / or a custom event object;

[0220] The initialization event object is used to configure the action to be performed when the control is initialized; the custom event object is used to configure the user-defined action;

[0221] The event response module 502 determines the target action corresponding to the target operation event according to the target event structure, and further includes:

[0222] When initializing the target control, determining the corresponding target initialization event object in the target event structure, and determining the corresponding target action according to the action configured in the target initialization event object;

[0223] In the case where the target operation event is a user-defined operation, a target custom event object corresponding to the target operation event in the target event structure is determined, and a corresponding target action is determined according to the action configured in the target custom event object.

[0224] In some optional implementations, the action configured in the event structure includes: an action type, an action value, and a pointed control;

[0225] The action type includes an event type and a configuration type; when the action type is an event type, the action value includes a name of the event to be executed; when the action type is a configuration type, the action value includes a value to be configured;

[0226] The property modification module 503 modifies the properties in the target view structure according to the target action, and / or modifies the properties in the view structure of other controls, including:

[0227] The control pointed to by the target action is used as a control to be operated; the control to be operated includes the target control and / or other controls;

[0228] In the case where the action type of the target action is an event type, determining an operation event to be executed corresponding to the event name contained in the action value of the target action, and controlling the control to be operated to execute a corresponding action according to the operation event to be executed;

[0229] In the case where the action type of the target action is a configuration type, the value to be configured contained in the action value of the target action is configured for the control to be operated.

[0230] In some optional implementations, the configuration module 501 configures a corresponding target event structure for the target control, including:

[0231] According to a preset value template, corresponding option values ​​are set for the target event structure; the value template includes a value type and a value path.

[0232] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0233] The declarative control configuration device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, including a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0234] The embodiment of the present invention also provides a computer device having the above Figure 5 The declarative control configuration device is shown.

[0235] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.

[0236] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0237] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0238] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0239] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0240] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.

[0241] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0242] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0243] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0244] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A declarative control configuration method, characterized in that: The method comprises: According to the predefined event structure, a corresponding target event structure is configured for the target control; the event structure is used to configure the action corresponding to the operation event; According to the predefined view structure, a corresponding target view structure is configured for the target control; the view structure is used to configure the properties of the control view; In response to a target operation event of the target control, determining a target action corresponding to the target operation event according to the target event structure; Modify the properties in the target view structure according to the target action, and / or modify the properties in the view structures of other controls; Use the interpreter to parse and display the modified controls.

2. The method according to claim 1, characterized in that: The event structure includes a plurality of predefined built-in event objects; each of the built-in event objects corresponds to a different operation event; The built-in event object is used to configure the action corresponding to the operation event and the triggering condition for executing the action; The step of determining a target action corresponding to the target operation event according to the target event structure includes: Determine a target built-in event object corresponding to the target operation event in the target event structure; According to the trigger condition matched in the target built-in event object, a corresponding target action is determined.

3. The method according to claim 2, characterized in that The built-in event object is a two-dimensional array structure; The first dimension of the built-in event object corresponds to the inner event array, and the second dimension of the built-in event object corresponds to the inner event element in the inner event array; the inner event array includes at least one mutually exclusive inner event element, and the inner event element includes a condition item representing the trigger condition and a corresponding action item; The determining a corresponding target action according to the trigger condition matched in the target built-in event object includes: Performing a first matching process on each target inner event array of the first dimension of the target built-in event object in sequence until the target inner event arrays in the target built-in event object are traversed; The first matching process includes: Determine whether the current state matches the triggering condition of the inner event element in the target inner event array; The action item corresponding to the trigger condition matching the current state is used as the target action item to be executed.

4. The method according to claim 3, characterized in that The trigger condition is a two-dimensional array structure; The first dimension of the trigger condition corresponds to an inner condition array that performs a logical AND, and the second dimension of the trigger condition corresponds to an inner condition element in the inner condition array that performs a logical OR; The inner condition array includes at least one inner condition element, and the inner condition element is used to represent a determination rule; The determining whether the current state matches the triggering condition of the inner event element in the target inner event array includes: For any pending trigger condition of the inner event element in the target inner event array, performing a second matching process on each target inner condition array of the first dimension of the pending trigger condition to determine whether the current state matches the target inner condition array; In the case where the current state matches each of the target inner condition arrays, determining that the current state matches the pending trigger condition; The second matching process includes: Determining whether the current state matches a determination rule represented by at least one inner condition element in the target inner condition array; In the case where the current state matches a determination rule represented by at least one inner condition element in the target inner condition array, it is determined that the current state matches the target inner condition array.

5. The method according to claim 2, characterized in that: The event structure also includes an initialization event object and / or a custom event object; The initialization event object is used to configure the action to be performed when the control is initialized; the custom event object is used to configure the user-defined action; The step of determining a target action corresponding to the target operation event according to the target event structure further includes: When initializing the target control, determining the corresponding target initialization event object in the target event structure, and determining the corresponding target action according to the action configured in the target initialization event object; In the case where the target operation event is a user-defined operation, a target custom event object corresponding to the target operation event in the target event structure is determined, and a corresponding target action is determined according to the action configured in the target custom event object.

6. The method according to claim 2 or 5, characterized in that: The action configured in the event structure includes: action type, action value and the control pointed to; The action type includes an event type and a configuration type; when the action type is an event type, the action value includes a name of the event to be executed; when the action type is a configuration type, the action value includes a value to be configured; The modifying the properties in the target view structure according to the target action, and / or modifying the properties in the view structure of other controls, includes: The control pointed to by the target action is used as a control to be operated; the control to be operated includes the target control and / or other controls; In the case where the action type of the target action is an event type, determining an operation event to be executed corresponding to the event name contained in the action value of the target action, and controlling the control to be operated to execute a corresponding action according to the operation event to be executed; In the case where the action type of the target action is a configuration type, the value to be configured contained in the action value of the target action is configured for the control to be operated.

7. The method according to claim 1, characterized in that The configuring a corresponding target event structure for the target control includes: According to a preset value template, corresponding option values ​​are set for the target event structure; the value template includes a value type and a value path.

8. A declarative control configuration device, characterized in that: The device comprises: A configuration module, configured to configure a corresponding target event structure for a target control according to a predefined event structure; the event structure is used to configure an action corresponding to an operation event; and to configure a corresponding target view structure for the target control according to a predefined view structure; the view structure is used to configure properties of a control view; An event response module, configured to respond to a target operation event of the target control and determine a target action corresponding to the target operation event according to the target event structure; A property modification module, used to modify the properties in the target view structure according to the target action, and / or modify the properties in the view structures of other controls; The parsing and display module is used to parse and display the modified controls using the interpreter.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the declarative control configuration method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the declarative control configuration method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Ampere lamp event dynamic authority control method based on OT-IT fusion state machine context and related device

    CN122469714A