@genesislcap/expression-builder 14.260.1 → 14.260.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +145 -139
- package/dist/dts/config/combinators.d.ts +14 -3
- package/dist/dts/config/combinators.d.ts.map +1 -1
- package/dist/dts/main/expression-builder.d.ts +111 -2
- package/dist/dts/main/expression-builder.d.ts.map +1 -1
- package/dist/dts/types/public.types.d.ts +206 -43
- package/dist/dts/types/public.types.d.ts.map +1 -1
- package/dist/dts/utils/formatting.d.ts +8 -4
- package/dist/dts/utils/formatting.d.ts.map +1 -1
- package/dist/esm/config/combinators.js +14 -3
- package/dist/esm/main/expression-builder.js +40 -2
- package/dist/esm/utils/formatting.js +8 -4
- package/dist/expression-builder.api.json +1156 -2
- package/dist/expression-builder.d.ts +339 -52
- package/docs/api/expression-builder.config.base_logical_combinators.md +16 -0
- package/docs/api/expression-builder.config.logical_combinators.md +16 -0
- package/docs/api/expression-builder.config.md +8 -0
- package/docs/api/expression-builder.config.null_combinator.md +18 -0
- package/docs/api/expression-builder.expressionbuilder.config.md +61 -0
- package/docs/api/expression-builder.expressionbuilder.dispatchchangeevent.md +31 -0
- package/docs/api/expression-builder.expressionbuilder.md +40 -0
- package/docs/api/expression-builder.expressionbuilder.model.md +35 -0
- package/docs/api/expression-builder.expressionbuilder.styles.md +39 -0
- package/docs/api/expression-builder.formatdatestring.md +18 -0
- package/docs/api/expression-builder.formatdatetimestring.md +18 -0
- package/docs/api/expression-builder.md +13 -0
- package/docs/api/expression-builder.types._operator.md +23 -0
- package/docs/api/expression-builder.types.binaryoperator.md +20 -0
- package/docs/api/expression-builder.types.checkboxinput.md +19 -0
- package/docs/api/expression-builder.types.combinator.md +29 -0
- package/docs/api/expression-builder.types.config.md +25 -0
- package/docs/api/expression-builder.types.customelements.md +47 -0
- package/docs/api/expression-builder.types.customstyles.md +32 -0
- package/docs/api/expression-builder.types.dateinput.md +20 -0
- package/docs/api/expression-builder.types.datetimeinput.md +20 -0
- package/docs/api/expression-builder.types.field.md +24 -0
- package/docs/api/expression-builder.types.fieldtypes.md +18 -0
- package/docs/api/expression-builder.types.group.md +49 -0
- package/docs/api/expression-builder.types.md +26 -0
- package/docs/api/expression-builder.types.numberinput.md +20 -0
- package/docs/api/expression-builder.types.operator.md +18 -0
- package/docs/api/expression-builder.types.rule.md +45 -0
- package/docs/api/expression-builder.types.selectinput.md +20 -0
- package/docs/api/expression-builder.types.styles.md +25 -0
- package/docs/api/expression-builder.types.ternararyoperator.md +20 -0
- package/docs/api/expression-builder.types.textinput.md +20 -0
- package/docs/api/expression-builder.types.uniraryoperator.md +22 -0
- package/docs/api/expression-builder.types.variadicoperator.md +20 -0
- package/docs/api-report.md +29 -34
- package/package.json +2 -2
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
"type": {
|
|
60
60
|
"text": "Combinator[]"
|
|
61
61
|
},
|
|
62
|
-
"default": "[\n {\n type: 'AND',\n maxRules: 'many',\n },\n {\n type: 'OR',\n maxRules: 'many',\n },\n]"
|
|
62
|
+
"default": "[\n {\n type: 'AND',\n maxRules: 'many',\n },\n {\n type: 'OR',\n maxRules: 'many',\n },\n]",
|
|
63
|
+
"description": "Basic `AND` and `OR` logical combinators which can be used in the model config."
|
|
63
64
|
},
|
|
64
65
|
{
|
|
65
66
|
"kind": "variable",
|
|
@@ -67,7 +68,8 @@
|
|
|
67
68
|
"type": {
|
|
68
69
|
"text": "Combinator[]"
|
|
69
70
|
},
|
|
70
|
-
"default": "[\n ...BASE_LOGICAL_COMBINATORS,\n {\n type: 'NOT',\n maxRules: 2,\n },\n {\n type: 'NAND',\n maxRules: 'many',\n },\n {\n type: 'NOR',\n maxRules: 'many',\n },\n {\n type: 'XOR',\n maxRules: 2,\n },\n]"
|
|
71
|
+
"default": "[\n ...BASE_LOGICAL_COMBINATORS,\n {\n type: 'NOT',\n maxRules: 2,\n },\n {\n type: 'NAND',\n maxRules: 'many',\n },\n {\n type: 'NOR',\n maxRules: 'many',\n },\n {\n type: 'XOR',\n maxRules: 2,\n },\n]",
|
|
72
|
+
"description": "A set of boolean logic combinators which configure the expression builder to produce boolean expressions."
|
|
71
73
|
},
|
|
72
74
|
{
|
|
73
75
|
"kind": "variable",
|
|
@@ -75,7 +77,8 @@
|
|
|
75
77
|
"type": {
|
|
76
78
|
"text": "Combinator"
|
|
77
79
|
},
|
|
78
|
-
"default": "{\n type: 'NULL',\n maxRules: 1,\n invisible: true,\n}"
|
|
80
|
+
"default": "{\n type: 'NULL',\n maxRules: 1,\n invisible: true,\n}",
|
|
81
|
+
"description": "A combinator which has a null action.\n\nIf configured as the only combinator then it configures the expression builder to only create a single rule."
|
|
79
82
|
}
|
|
80
83
|
],
|
|
81
84
|
"exports": [
|
|
@@ -444,7 +447,7 @@
|
|
|
444
447
|
"declarations": [
|
|
445
448
|
{
|
|
446
449
|
"kind": "class",
|
|
447
|
-
"description": "",
|
|
450
|
+
"description": "Top level component to allow the user to build expressions. It produces a generic payload which doesn't have any system by itself\nto evaluate or execute the built expression.\n\nThe basics required to work with this component:\n\nExpressionBuilder.config property to configure and input data and models into the component.\n\n_Event_ change - `Types.Group` emits the model configuration on change. If you create a child component of the expression builder\nwhere you want to use a different (e.g. domain specific) model then it will likely override then emit event and instead emit\nit's own model. To check the underlying `Types.Group` model check the ExpressionBuilder.model property.",
|
|
448
451
|
"name": "ExpressionBuilder",
|
|
449
452
|
"members": [
|
|
450
453
|
{
|
|
@@ -452,14 +455,16 @@
|
|
|
452
455
|
"name": "config",
|
|
453
456
|
"type": {
|
|
454
457
|
"text": "Config"
|
|
455
|
-
}
|
|
458
|
+
},
|
|
459
|
+
"description": "config - `Types.Config` the configuration which is required to be set for the expression builder. All properties are\ndefined under this single object to enforce that they're kept in sync with one another.\n\nIf you want to set the expression of the expression builder you should do it via the `model` property on this object.\n\nIf you're using a child class of this component with a specific model implementation you likely *don't* want to set this\nproperty directly. See example 3."
|
|
456
460
|
},
|
|
457
461
|
{
|
|
458
462
|
"kind": "field",
|
|
459
463
|
"name": "styles",
|
|
460
464
|
"type": {
|
|
461
465
|
"text": "Styles | undefined"
|
|
462
|
-
}
|
|
466
|
+
},
|
|
467
|
+
"description": "styles - `Types.Styles` optional configuration which allows you to set custom element tag names to be used, as well as\ncustom css to be inserted into the shadow DOM."
|
|
463
468
|
},
|
|
464
469
|
{
|
|
465
470
|
"kind": "field",
|
|
@@ -467,7 +472,8 @@
|
|
|
467
472
|
"type": {
|
|
468
473
|
"text": "ModelGroup | null"
|
|
469
474
|
},
|
|
470
|
-
"default": "null"
|
|
475
|
+
"default": "null",
|
|
476
|
+
"description": "model - `Types.Group` the current model which completely describes the state of the component.\n\n*IMPORTANT* you should not set this yourself via this property directly, you should always set it via the model property on the ExpressionBuilder.config block.\n\nYou may want to read from this variable to get the most up to date state, for example if you create a child component which\nhas a model which isn't valid for every single state (e.g. requires a complete rule) you can check this underlying model to\nverify what field or operator is selected."
|
|
471
477
|
},
|
|
472
478
|
{
|
|
473
479
|
"kind": "field",
|
|
@@ -784,7 +790,7 @@
|
|
|
784
790
|
}
|
|
785
791
|
}
|
|
786
792
|
],
|
|
787
|
-
"description": "Gets the string representation from a `Date` which is the format a `date` input uses.\n`yyyy-mm-dd
|
|
793
|
+
"description": "Gets the string representation from a `Date` which is the format a `date` input uses.\n`yyyy-mm-dd`.\nUses UTC methods to ensure consistent output regardless of timezone.\n\nUsed to convert a javascript date object into the required string format expected by the expression builder."
|
|
788
794
|
},
|
|
789
795
|
{
|
|
790
796
|
"kind": "function",
|
|
@@ -797,7 +803,7 @@
|
|
|
797
803
|
}
|
|
798
804
|
}
|
|
799
805
|
],
|
|
800
|
-
"description": "Gets the string representation from a `Date` which is the format a `datetime-local` input uses.\n`yyyy-mm-ddThh:mm:ss
|
|
806
|
+
"description": "Gets the string representation from a `Date` which is the format a `datetime-local` input uses.\n`yyyy-mm-ddThh:mm:ss`.\nUses UTC methods to ensure consistent output regardless of timezone.\n\nUsed to convert a javascript date object into the required string format expected by the expression builder."
|
|
801
807
|
}
|
|
802
808
|
],
|
|
803
809
|
"exports": [
|
|
@@ -1704,136 +1710,6 @@
|
|
|
1704
1710
|
}
|
|
1705
1711
|
]
|
|
1706
1712
|
},
|
|
1707
|
-
{
|
|
1708
|
-
"kind": "javascript-module",
|
|
1709
|
-
"path": "src/main/rule-operator/rule-operator.template.ts",
|
|
1710
|
-
"declarations": [
|
|
1711
|
-
{
|
|
1712
|
-
"kind": "variable",
|
|
1713
|
-
"name": "template",
|
|
1714
|
-
"default": "html<RuleOperator>`\n ${(context) => {\n const selectTag = context.styles?.customElements?.select || 'select';\n const optionTag = context.styles?.customElements?.option || 'option';\n const optgroupTag = 'optgroup'; // Not supporting custom optgroup for now\n\n return html<RuleOperator>`\n <${selectTag}\n class=\"form-select\"\n @change=${(x, c) => x.handleOperatorChange(c.event)}\n value=${(x) => x.operator?.type}\n >\n <${optionTag} value=\"\">Select an operator</${optionTag}>\n ${repeat(\n (x) => x.groupedOperators,\n html<{ optgroup: string | null; xs: Operator[] } | Operator, RuleOperator>`\n ${(groupOrOperator) => {\n if ('xs' in groupOrOperator) {\n return html<{ optgroup: string | null; xs: Operator[] }, RuleOperator>`\n <${optgroupTag} label=\"${groupOrOperator.optgroup}\">\n ${repeat(\n (x) => x.xs,\n html<Operator>`\n <${optionTag}\n value=\"${(x) => x.type}\"\n ?selected=${(x, c) => x.type === c.parentContext.parent.operator?.type}\n title=${(x) => x.tooltip}\n >\n ${(x) => x.type}\n </${optionTag}>\n `,\n )}\n </${optgroupTag}>\n `;\n } else {\n return html<Operator, RuleOperator>`\n <${optionTag}\n value=\"${(x) => x.type}\"\n ?selected=${(x, c) => c.parent.operator?.type === x.type}\n title=${(x) => x.tooltip}\n >\n ${(x) => x.type}\n </${optionTag}>\n `;\n }\n }}\n `,\n )}\n </${selectTag}>\n `;\n }}\n`"
|
|
1715
|
-
}
|
|
1716
|
-
],
|
|
1717
|
-
"exports": [
|
|
1718
|
-
{
|
|
1719
|
-
"kind": "js",
|
|
1720
|
-
"name": "template",
|
|
1721
|
-
"declaration": {
|
|
1722
|
-
"name": "template",
|
|
1723
|
-
"module": "src/main/rule-operator/rule-operator.template.ts"
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
]
|
|
1727
|
-
},
|
|
1728
|
-
{
|
|
1729
|
-
"kind": "javascript-module",
|
|
1730
|
-
"path": "src/main/rule-operator/rule-operator.ts",
|
|
1731
|
-
"declarations": [
|
|
1732
|
-
{
|
|
1733
|
-
"kind": "class",
|
|
1734
|
-
"description": "",
|
|
1735
|
-
"name": "RuleOperator",
|
|
1736
|
-
"members": [
|
|
1737
|
-
{
|
|
1738
|
-
"kind": "field",
|
|
1739
|
-
"name": "operators",
|
|
1740
|
-
"type": {
|
|
1741
|
-
"text": "Operator[]"
|
|
1742
|
-
},
|
|
1743
|
-
"default": "[]"
|
|
1744
|
-
},
|
|
1745
|
-
{
|
|
1746
|
-
"kind": "field",
|
|
1747
|
-
"name": "operator",
|
|
1748
|
-
"type": {
|
|
1749
|
-
"text": "Operator"
|
|
1750
|
-
}
|
|
1751
|
-
},
|
|
1752
|
-
{
|
|
1753
|
-
"kind": "field",
|
|
1754
|
-
"name": "field",
|
|
1755
|
-
"type": {
|
|
1756
|
-
"text": "Field | null"
|
|
1757
|
-
},
|
|
1758
|
-
"default": "null"
|
|
1759
|
-
},
|
|
1760
|
-
{
|
|
1761
|
-
"kind": "field",
|
|
1762
|
-
"name": "config",
|
|
1763
|
-
"type": {
|
|
1764
|
-
"text": "Config"
|
|
1765
|
-
}
|
|
1766
|
-
},
|
|
1767
|
-
{
|
|
1768
|
-
"kind": "field",
|
|
1769
|
-
"name": "styles",
|
|
1770
|
-
"type": {
|
|
1771
|
-
"text": "Styles | undefined"
|
|
1772
|
-
}
|
|
1773
|
-
},
|
|
1774
|
-
{
|
|
1775
|
-
"kind": "field",
|
|
1776
|
-
"name": "allowedOperators",
|
|
1777
|
-
"type": {
|
|
1778
|
-
"text": "Operator[]"
|
|
1779
|
-
},
|
|
1780
|
-
"readonly": true
|
|
1781
|
-
},
|
|
1782
|
-
{
|
|
1783
|
-
"kind": "field",
|
|
1784
|
-
"name": "groupedOperators",
|
|
1785
|
-
"type": {
|
|
1786
|
-
"text": "(Operator | { optgroup: string | null; xs: Operator[] })[]"
|
|
1787
|
-
},
|
|
1788
|
-
"readonly": true
|
|
1789
|
-
},
|
|
1790
|
-
{
|
|
1791
|
-
"kind": "method",
|
|
1792
|
-
"name": "handleOperatorChange",
|
|
1793
|
-
"parameters": [
|
|
1794
|
-
{
|
|
1795
|
-
"name": "event",
|
|
1796
|
-
"type": {
|
|
1797
|
-
"text": "Event"
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
]
|
|
1801
|
-
}
|
|
1802
|
-
],
|
|
1803
|
-
"events": [
|
|
1804
|
-
{
|
|
1805
|
-
"type": {
|
|
1806
|
-
"text": "CustomEvent"
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
],
|
|
1810
|
-
"superclass": {
|
|
1811
|
-
"name": "GenesisElement",
|
|
1812
|
-
"package": "@genesislcap/web-core"
|
|
1813
|
-
},
|
|
1814
|
-
"tagName": "expression-rule-operator",
|
|
1815
|
-
"customElement": true
|
|
1816
|
-
}
|
|
1817
|
-
],
|
|
1818
|
-
"exports": [
|
|
1819
|
-
{
|
|
1820
|
-
"kind": "js",
|
|
1821
|
-
"name": "RuleOperator",
|
|
1822
|
-
"declaration": {
|
|
1823
|
-
"name": "RuleOperator",
|
|
1824
|
-
"module": "src/main/rule-operator/rule-operator.ts"
|
|
1825
|
-
}
|
|
1826
|
-
},
|
|
1827
|
-
{
|
|
1828
|
-
"kind": "custom-element-definition",
|
|
1829
|
-
"name": "expression-rule-operator",
|
|
1830
|
-
"declaration": {
|
|
1831
|
-
"name": "RuleOperator",
|
|
1832
|
-
"module": "src/main/rule-operator/rule-operator.ts"
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
]
|
|
1836
|
-
},
|
|
1837
1713
|
{
|
|
1838
1714
|
"kind": "javascript-module",
|
|
1839
1715
|
"path": "src/main/rule-value/rule-value.helpers.ts",
|
|
@@ -2141,6 +2017,136 @@
|
|
|
2141
2017
|
}
|
|
2142
2018
|
}
|
|
2143
2019
|
]
|
|
2020
|
+
},
|
|
2021
|
+
{
|
|
2022
|
+
"kind": "javascript-module",
|
|
2023
|
+
"path": "src/main/rule-operator/rule-operator.template.ts",
|
|
2024
|
+
"declarations": [
|
|
2025
|
+
{
|
|
2026
|
+
"kind": "variable",
|
|
2027
|
+
"name": "template",
|
|
2028
|
+
"default": "html<RuleOperator>`\n ${(context) => {\n const selectTag = context.styles?.customElements?.select || 'select';\n const optionTag = context.styles?.customElements?.option || 'option';\n const optgroupTag = 'optgroup'; // Not supporting custom optgroup for now\n\n return html<RuleOperator>`\n <${selectTag}\n class=\"form-select\"\n @change=${(x, c) => x.handleOperatorChange(c.event)}\n value=${(x) => x.operator?.type}\n >\n <${optionTag} value=\"\">Select an operator</${optionTag}>\n ${repeat(\n (x) => x.groupedOperators,\n html<{ optgroup: string | null; xs: Operator[] } | Operator, RuleOperator>`\n ${(groupOrOperator) => {\n if ('xs' in groupOrOperator) {\n return html<{ optgroup: string | null; xs: Operator[] }, RuleOperator>`\n <${optgroupTag} label=\"${groupOrOperator.optgroup}\">\n ${repeat(\n (x) => x.xs,\n html<Operator>`\n <${optionTag}\n value=\"${(x) => x.type}\"\n ?selected=${(x, c) => x.type === c.parentContext.parent.operator?.type}\n title=${(x) => x.tooltip}\n >\n ${(x) => x.type}\n </${optionTag}>\n `,\n )}\n </${optgroupTag}>\n `;\n } else {\n return html<Operator, RuleOperator>`\n <${optionTag}\n value=\"${(x) => x.type}\"\n ?selected=${(x, c) => c.parent.operator?.type === x.type}\n title=${(x) => x.tooltip}\n >\n ${(x) => x.type}\n </${optionTag}>\n `;\n }\n }}\n `,\n )}\n </${selectTag}>\n `;\n }}\n`"
|
|
2029
|
+
}
|
|
2030
|
+
],
|
|
2031
|
+
"exports": [
|
|
2032
|
+
{
|
|
2033
|
+
"kind": "js",
|
|
2034
|
+
"name": "template",
|
|
2035
|
+
"declaration": {
|
|
2036
|
+
"name": "template",
|
|
2037
|
+
"module": "src/main/rule-operator/rule-operator.template.ts"
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
]
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
"kind": "javascript-module",
|
|
2044
|
+
"path": "src/main/rule-operator/rule-operator.ts",
|
|
2045
|
+
"declarations": [
|
|
2046
|
+
{
|
|
2047
|
+
"kind": "class",
|
|
2048
|
+
"description": "",
|
|
2049
|
+
"name": "RuleOperator",
|
|
2050
|
+
"members": [
|
|
2051
|
+
{
|
|
2052
|
+
"kind": "field",
|
|
2053
|
+
"name": "operators",
|
|
2054
|
+
"type": {
|
|
2055
|
+
"text": "Operator[]"
|
|
2056
|
+
},
|
|
2057
|
+
"default": "[]"
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
"kind": "field",
|
|
2061
|
+
"name": "operator",
|
|
2062
|
+
"type": {
|
|
2063
|
+
"text": "Operator"
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
{
|
|
2067
|
+
"kind": "field",
|
|
2068
|
+
"name": "field",
|
|
2069
|
+
"type": {
|
|
2070
|
+
"text": "Field | null"
|
|
2071
|
+
},
|
|
2072
|
+
"default": "null"
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
"kind": "field",
|
|
2076
|
+
"name": "config",
|
|
2077
|
+
"type": {
|
|
2078
|
+
"text": "Config"
|
|
2079
|
+
}
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
"kind": "field",
|
|
2083
|
+
"name": "styles",
|
|
2084
|
+
"type": {
|
|
2085
|
+
"text": "Styles | undefined"
|
|
2086
|
+
}
|
|
2087
|
+
},
|
|
2088
|
+
{
|
|
2089
|
+
"kind": "field",
|
|
2090
|
+
"name": "allowedOperators",
|
|
2091
|
+
"type": {
|
|
2092
|
+
"text": "Operator[]"
|
|
2093
|
+
},
|
|
2094
|
+
"readonly": true
|
|
2095
|
+
},
|
|
2096
|
+
{
|
|
2097
|
+
"kind": "field",
|
|
2098
|
+
"name": "groupedOperators",
|
|
2099
|
+
"type": {
|
|
2100
|
+
"text": "(Operator | { optgroup: string | null; xs: Operator[] })[]"
|
|
2101
|
+
},
|
|
2102
|
+
"readonly": true
|
|
2103
|
+
},
|
|
2104
|
+
{
|
|
2105
|
+
"kind": "method",
|
|
2106
|
+
"name": "handleOperatorChange",
|
|
2107
|
+
"parameters": [
|
|
2108
|
+
{
|
|
2109
|
+
"name": "event",
|
|
2110
|
+
"type": {
|
|
2111
|
+
"text": "Event"
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
]
|
|
2115
|
+
}
|
|
2116
|
+
],
|
|
2117
|
+
"events": [
|
|
2118
|
+
{
|
|
2119
|
+
"type": {
|
|
2120
|
+
"text": "CustomEvent"
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
],
|
|
2124
|
+
"superclass": {
|
|
2125
|
+
"name": "GenesisElement",
|
|
2126
|
+
"package": "@genesislcap/web-core"
|
|
2127
|
+
},
|
|
2128
|
+
"tagName": "expression-rule-operator",
|
|
2129
|
+
"customElement": true
|
|
2130
|
+
}
|
|
2131
|
+
],
|
|
2132
|
+
"exports": [
|
|
2133
|
+
{
|
|
2134
|
+
"kind": "js",
|
|
2135
|
+
"name": "RuleOperator",
|
|
2136
|
+
"declaration": {
|
|
2137
|
+
"name": "RuleOperator",
|
|
2138
|
+
"module": "src/main/rule-operator/rule-operator.ts"
|
|
2139
|
+
}
|
|
2140
|
+
},
|
|
2141
|
+
{
|
|
2142
|
+
"kind": "custom-element-definition",
|
|
2143
|
+
"name": "expression-rule-operator",
|
|
2144
|
+
"declaration": {
|
|
2145
|
+
"name": "RuleOperator",
|
|
2146
|
+
"module": "src/main/rule-operator/rule-operator.ts"
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
]
|
|
2144
2150
|
}
|
|
2145
2151
|
]
|
|
2146
2152
|
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { Combinator } from '../types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Basic `AND` and `OR` logical combinators which can be used in the model config.
|
|
4
|
+
* @beta
|
|
5
|
+
* */
|
|
3
6
|
export declare const BASE_LOGICAL_COMBINATORS: Combinator[];
|
|
4
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* A set of boolean logic combinators which configure the expression builder to produce boolean expressions.
|
|
9
|
+
* @beta
|
|
10
|
+
* */
|
|
5
11
|
export declare const LOGICAL_COMBINATORS: Combinator[];
|
|
6
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* A combinator which has a null action.
|
|
14
|
+
*
|
|
15
|
+
* If configured as the only combinator then it configures the expression builder to only create a single rule.
|
|
16
|
+
* @beta
|
|
17
|
+
* */
|
|
7
18
|
export declare const NULL_COMBINATOR: Combinator;
|
|
8
19
|
//# sourceMappingURL=combinators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../../../src/config/combinators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../../../src/config/combinators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;;KAGK;AACL,eAAO,MAAM,wBAAwB,EAAE,UAAU,EAShD,CAAC;AAEF;;;KAGK;AACL,eAAO,MAAM,mBAAmB,EAAE,UAAU,EAkB3C,CAAC;AAEF;;;;;KAKK;AACL,eAAO,MAAM,eAAe,EAAE,UAI7B,CAAC"}
|
|
@@ -1,10 +1,117 @@
|
|
|
1
1
|
import { GenesisElement } from '@genesislcap/web-core';
|
|
2
2
|
import { Config, Group, ModelGroup, Styles } from '../types';
|
|
3
3
|
import { MetadataProvider } from '../utils/data-model';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Top level component to allow the user to build expressions. It produces a generic payload which doesn't have any system by itself
|
|
6
|
+
* to evaluate or execute the built expression.
|
|
7
|
+
*
|
|
8
|
+
* The basics required to work with this component:
|
|
9
|
+
*
|
|
10
|
+
* {@link ExpressionBuilder.config} property to configure and input data and models into the component.
|
|
11
|
+
*
|
|
12
|
+
* _Event_ change - `Types.Group` emits the model configuration on change. If you create a child component of the expression builder
|
|
13
|
+
* where you want to use a different (e.g. domain specific) model then it will likely override then emit event and instead emit
|
|
14
|
+
* it's own model. To check the underlying `Types.Group` model check the {@link ExpressionBuilder.model} property.
|
|
15
|
+
*
|
|
16
|
+
* @beta
|
|
17
|
+
*/
|
|
5
18
|
export declare class ExpressionBuilder extends GenesisElement implements MetadataProvider {
|
|
19
|
+
/**
|
|
20
|
+
* config - `Types.Config` the configuration which is required to be set for the expression builder. All properties are
|
|
21
|
+
* defined under this single object to enforce that they're kept in sync with one another.
|
|
22
|
+
*
|
|
23
|
+
* If you want to set the expression of the expression builder you should do it via the `model` property on this object.
|
|
24
|
+
*
|
|
25
|
+
* If you're using a child class of this component with a specific model implementation you likely *don't* want to set this
|
|
26
|
+
* property directly. See example 3.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* Configuring the basic elements required by an expression builder instance
|
|
30
|
+
* ```ts
|
|
31
|
+
* const config: Types.Config = {
|
|
32
|
+
* fields: ...,
|
|
33
|
+
* combinators: ...,
|
|
34
|
+
* operators: ...,
|
|
35
|
+
* };
|
|
36
|
+
* document.querySelector('expression-builder').config = config;
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* Configuring the basic elements required by an expression builder instance, as well as inputting a model to hydrate
|
|
41
|
+
* ```ts
|
|
42
|
+
* const config: Types.Config = {
|
|
43
|
+
* fields: ...,
|
|
44
|
+
* combinators: ...,
|
|
45
|
+
* operators: ...,
|
|
46
|
+
* model: ...,
|
|
47
|
+
* };
|
|
48
|
+
* document.querySelector('expression-builder').config = config;
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* You may create your own child of the expression builder which automatically defines some of the properties, such
|
|
53
|
+
* as creating a rule builder which defines boolean operators and combinators. In this case you should use your own
|
|
54
|
+
* property name, and on change apply the user and your configurations back to the config property.
|
|
55
|
+
* ```ts
|
|
56
|
+
* const config: MyTypes.RuleConfig = {
|
|
57
|
+
* operators: ...,
|
|
58
|
+
* };
|
|
59
|
+
* // In the implementation of RuleExpressionBuilder it should listen to ruleConfigChanged and
|
|
60
|
+
* apply the missing combinators and opreators back to the config along with the user's configuration
|
|
61
|
+
* document.querySelector('rule-expression-builder').ruleConfig = config;
|
|
62
|
+
* ```
|
|
63
|
+
* @beta
|
|
64
|
+
*/
|
|
6
65
|
config: Config;
|
|
66
|
+
/**
|
|
67
|
+
* styles - `Types.Styles` optional configuration which allows you to set custom element tag names to be used, as well as
|
|
68
|
+
* custom css to be inserted into the shadow DOM.
|
|
69
|
+
* @example
|
|
70
|
+
* Bare bones example of using a custom select component
|
|
71
|
+
* ```ts
|
|
72
|
+
* const styles: Types.Styles = {
|
|
73
|
+
* customElements: {
|
|
74
|
+
* select: 'rapid-select',
|
|
75
|
+
* },
|
|
76
|
+
* styles: {
|
|
77
|
+
* // If you want to customise your `rapid-select` then you can do it here. The select input
|
|
78
|
+
* // is used in the value, field, and operator component, so you should set the styles for all of them for real
|
|
79
|
+
* value: `
|
|
80
|
+
* rapid-select {
|
|
81
|
+
* max-width: 180px;
|
|
82
|
+
* }
|
|
83
|
+
* `
|
|
84
|
+
* }
|
|
85
|
+
* }
|
|
86
|
+
* document.querySelector('expression-builder').styles = styles;
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @beta
|
|
90
|
+
*/
|
|
7
91
|
styles?: Styles;
|
|
92
|
+
/**
|
|
93
|
+
* model - `Types.Group` the current model which completely describes the state of the component.
|
|
94
|
+
*
|
|
95
|
+
* *IMPORTANT* you should not set this yourself via this property directly, you should always set it via the model property on the {@link ExpressionBuilder.config} block.
|
|
96
|
+
*
|
|
97
|
+
* You may want to read from this variable to get the most up to date state, for example if you create a child component which
|
|
98
|
+
* has a model which isn't valid for every single state (e.g. requires a complete rule) you can check this underlying model to
|
|
99
|
+
* verify what field or operator is selected.
|
|
100
|
+
*
|
|
101
|
+
* @beta
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const model = document.querySelector('expression-builder');
|
|
106
|
+
* // Once you have the model you can read it to check the applied config. While the primary use should be checking the updated model via
|
|
107
|
+
* the emited change event, you can use this to check more specific changes that a domain specific model might not.
|
|
108
|
+
*
|
|
109
|
+
* For example, imagine a RulExpressionBuilder which is an implementation specifically for a boolean logic expression. That component may not
|
|
110
|
+
* model a non-complete rule (a rule without a field, and operator, and value). In that case when it emits the event the payload will only change
|
|
111
|
+
* when the user has completely configured a new rule. But if you need to catch cases earlier when they've changed the field but before they've
|
|
112
|
+
* changed the value you can check the model here.
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
8
115
|
model: ModelGroup | null;
|
|
9
116
|
private ruleCount;
|
|
10
117
|
private groupCount;
|
|
@@ -20,7 +127,7 @@ export declare class ExpressionBuilder extends GenesisElement implements Metadat
|
|
|
20
127
|
/** @internal */
|
|
21
128
|
modelChanged(_: Config, newModel: ModelGroup): void;
|
|
22
129
|
/**
|
|
23
|
-
* @
|
|
130
|
+
* @beta
|
|
24
131
|
* Dispatches the provided model to the DOM.
|
|
25
132
|
*
|
|
26
133
|
* @remarks
|
|
@@ -33,7 +140,9 @@ export declare class ExpressionBuilder extends GenesisElement implements Metadat
|
|
|
33
140
|
getGroupId(): string;
|
|
34
141
|
/** @internal */
|
|
35
142
|
getRuleId(): string;
|
|
143
|
+
/** @internal */
|
|
36
144
|
connectedCallback(): void;
|
|
145
|
+
/** @internal */
|
|
37
146
|
disconnectedCallback(): void;
|
|
38
147
|
private handleAddGroup;
|
|
39
148
|
private _handleAddGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression-builder.d.ts","sourceRoot":"","sources":["../../../src/main/expression-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAa,MAAM,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAqB,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAkB7F
|
|
1
|
+
{"version":3,"file":"expression-builder.d.ts","sourceRoot":"","sources":["../../../src/main/expression-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAa,MAAM,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAqB,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAkB7F;;;;;;;;;;;;;GAaG;AACH,qBAKa,iBAAkB,SAAQ,cAAe,YAAW,gBAAgB;IAC/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACS,MAAM,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACS,MAAM,CAAC,EAAE,MAAM,CAAC;IAE5B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACS,KAAK,EAAE,UAAU,GAAG,IAAI,CAAQ;IAE5C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAK;IAEvB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB,CAAS;IAElC,gBAAgB;IAChB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAU1C,gBAAgB;IAChB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU;IAM5C;;;;;;OAMG;IACH,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK;IAa1C,gBAAgB;IAChB,SAAS,IAAI,MAAM;IAInB,gBAAgB;IAChB,UAAU;IAKV,gBAAgB;IAChB,SAAS;IAOT,gBAAgB;IAChB,iBAAiB;IA0BjB,gBAAgB;IAChB,oBAAoB,IAAI,IAAI;IAU5B,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,aAAa,CAAkC;IACvD,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,iBAAiB,CAAsC;IAC/D,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,qBAAqB,CAA0C;IACvE,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,oBAAoB,CAAyC;IACrE,OAAO,CAAC,qBAAqB;CAI9B"}
|