@genesislcap/pbc-notify-ui 14.484.2-alpha-92fa356.0 → 14.484.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.
Files changed (17) hide show
  1. package/dist/custom-elements.json +50 -147
  2. package/dist/dts/components/components.d.ts.map +1 -1
  3. package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.d.ts +8 -7
  4. package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.d.ts.map +1 -1
  5. package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.d.ts.map +1 -1
  6. package/dist/esm/components/components.js +0 -2
  7. package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.js +70 -52
  8. package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.js +36 -5
  9. package/dist/tsconfig.tsbuildinfo +1 -1
  10. package/package.json +23 -23
  11. package/src/components/components.ts +0 -2
  12. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.ts +48 -6
  13. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.ts +74 -55
  14. package/dist/dts/components/foundation-notification-dashboard/rule-expression-builder.utils.d.ts +0 -10
  15. package/dist/dts/components/foundation-notification-dashboard/rule-expression-builder.utils.d.ts.map +0 -1
  16. package/dist/esm/components/foundation-notification-dashboard/rule-expression-builder.utils.js +0 -230
  17. package/src/components/foundation-notification-dashboard/rule-expression-builder.utils.ts +0 -259
@@ -2078,114 +2078,6 @@
2078
2078
  }
2079
2079
  ]
2080
2080
  },
2081
- {
2082
- "kind": "javascript-module",
2083
- "path": "src/components/foundation-notification-dashboard/rule-expression-builder.utils.ts",
2084
- "declarations": [
2085
- {
2086
- "kind": "function",
2087
- "name": "mapFieldsToExpressionBuilderFields",
2088
- "return": {
2089
- "type": {
2090
- "text": "ExpressionBuilderTypes.Field[]"
2091
- }
2092
- },
2093
- "parameters": [
2094
- {
2095
- "name": "fields",
2096
- "type": {
2097
- "text": "Field[]"
2098
- }
2099
- }
2100
- ]
2101
- },
2102
- {
2103
- "kind": "function",
2104
- "name": "ruleExpressionToRawText",
2105
- "return": {
2106
- "type": {
2107
- "text": "string"
2108
- }
2109
- },
2110
- "parameters": [
2111
- {
2112
- "name": "expr",
2113
- "type": {
2114
- "text": "AnyExpression | null | undefined"
2115
- }
2116
- }
2117
- ]
2118
- },
2119
- {
2120
- "kind": "function",
2121
- "name": "rawTextToRuleExpression",
2122
- "return": {
2123
- "type": {
2124
- "text": "PredicateExpression | null"
2125
- }
2126
- },
2127
- "parameters": [
2128
- {
2129
- "name": "raw",
2130
- "type": {
2131
- "text": "string"
2132
- }
2133
- }
2134
- ]
2135
- },
2136
- {
2137
- "kind": "function",
2138
- "name": "conditionsToRuleExpression",
2139
- "return": {
2140
- "type": {
2141
- "text": "PredicateExpression"
2142
- }
2143
- },
2144
- "parameters": [
2145
- {
2146
- "name": "conditions",
2147
- "type": {
2148
- "text": "RuleExpression.Condition[]"
2149
- }
2150
- }
2151
- ]
2152
- }
2153
- ],
2154
- "exports": [
2155
- {
2156
- "kind": "js",
2157
- "name": "mapFieldsToExpressionBuilderFields",
2158
- "declaration": {
2159
- "name": "mapFieldsToExpressionBuilderFields",
2160
- "module": "src/components/foundation-notification-dashboard/rule-expression-builder.utils.ts"
2161
- }
2162
- },
2163
- {
2164
- "kind": "js",
2165
- "name": "ruleExpressionToRawText",
2166
- "declaration": {
2167
- "name": "ruleExpressionToRawText",
2168
- "module": "src/components/foundation-notification-dashboard/rule-expression-builder.utils.ts"
2169
- }
2170
- },
2171
- {
2172
- "kind": "js",
2173
- "name": "rawTextToRuleExpression",
2174
- "declaration": {
2175
- "name": "rawTextToRuleExpression",
2176
- "module": "src/components/foundation-notification-dashboard/rule-expression-builder.utils.ts"
2177
- }
2178
- },
2179
- {
2180
- "kind": "js",
2181
- "name": "conditionsToRuleExpression",
2182
- "declaration": {
2183
- "name": "conditionsToRuleExpression",
2184
- "module": "src/components/foundation-notification-dashboard/rule-expression-builder.utils.ts"
2185
- }
2186
- }
2187
- ]
2188
- },
2189
2081
  {
2190
2082
  "kind": "javascript-module",
2191
2083
  "path": "src/components/foundation-inbox/inbox-base/inbox-base.ts",
@@ -5000,7 +4892,7 @@
5000
4892
  {
5001
4893
  "kind": "variable",
5002
4894
  "name": "RuleDialogTemplate",
5003
- "default": "html<RuleDialog>`\n <rapid-modal ${ref('dialog')} class=\"dialog\" :onCloseCallback=${(x) => () => x.close()}>\n <div slot=\"top\" class=\"dialog-top\">${(x) => x.ruleDialogTitle}</div>\n\n <div class=\"dialog-content\">\n <div class=\"content-row\">\n <div class=\"control\">\n <rapid-text-field\n :value=${sync((x) => x.name)}\n @change=\"${(x) => x.validateRequiredFields()}\"\n autofocus\n autocomplete=\"off\"\n required\n >\n Name\n </rapid-text-field>\n </div>\n\n <div class=\"control\">\n <rapid-text-field\n :value=${sync((x) => x.description)}\n @change=\"${(x) => x.validateRequiredFields()}\"\n autocomplete=\"off\"\n required\n >\n Description\n </rapid-text-field>\n </div>\n </div>\n\n <div class=\"content-row\">\n <div class=\"control\">\n <label>Resource</label>\n <rapid-select\n :value=${sync((x) => x.resource)}\n title=${(x) => x.resource}\n position=\"below\"\n >\n ${repeat(\n (x) => x.resources,\n html`\n <rapid-option value=${(x) => x} title=${(x) => x}>${(x) => x}</rapid-option>\n `,\n )}\n </rapid-select>\n </div>\n\n <div class=\"control\">\n <label>Topic</label>\n <rapid-combobox\n autocomplete=\"both\"\n :value=${sync((x) => x.topic)}\n title=${(x) => x.topic}\n >\n ${repeat(\n (x) => x.topics,\n html`\n <rapid-option value=${(x) => x} title=${(x) => x}>${(x) => x}</rapid-option>\n `,\n )}\n </rapid-combobox>\n </div>\n\n <div class=\"control\">\n <label>Severity</label>\n <rapid-select :value=${sync((x) => x.severity)}>\n <options-datasource\n value-field=\"value\"\n label-field=\"value\"\n option-element=\"rapid-option\"\n :data=${(_) => Object.values(Severity).map((value) => ({ value }))}\n ></options-datasource>\n </rapid-select>\n </div>\n\n <div class=\"control\">\n <label>Update Type</label>\n <rapid-multiselect\n :selectedOptions=${(x) => x.updateType}\n @selectionChange=${(x, c) => {\n x.updateType = (c.event as CustomEvent).detail;\n }}\n search=\"false\"\n all=\"false\"\n >\n <multiselect-datasource\n value-field=\"value\"\n label-field=\"value\"\n :data=${() => Object.values(UpdateType).map((value) => ({ value, label: value }))}\n ></multiselect-datasource>\n </rapid-multiselect>\n </div>\n </div>\n\n <div class=\"content-row\">\n <div class=\"control\">\n <rapid-text-field\n required\n :value=${sync((x) => x.header)}\n @change=\"${(x) => x.validateRequiredFields()}\"\n autocomplete=\"off\"\n >\n Header\n </rapid-text-field>\n </div>\n\n <div class=\"control\">\n <rapid-text-field\n required\n :value=${sync((x) => x.message)}\n @change=\"${(x) => x.validateRequiredFields()}\"\n autocomplete=\"off\"\n >\n Message\n </rapid-text-field>\n </div>\n </div>\n\n <div class=\"control\">\n <label>Condition(s)</label>\n <rapid-rule-expression-builder\n :ruleConfig=${(x) => x.ruleExpressionConfig}\n @change=${(x, c) => x.handleRuleExpressionChange((c.event as CustomEvent).detail)}\n ></rapid-rule-expression-builder>\n <rapid-text-area\n class=\"expression-preview\"\n readonly\n :value=${(x) => x.rawExpressionPreview}\n >\n Compiled expression\n </rapid-text-area>\n </div>\n </div>\n\n <div slot=\"bottom\" class=\"dialog-bottom\">\n <rapid-button\n appearance=\"primary\"\n @click=${(x) => x.submit()}\n ?disabled=${(x) => x.submitDisabled}\n >\n Submit\n </rapid-button>\n </div>\n </rapid-modal>\n`"
4895
+ "default": "html<RuleDialog>`\n <rapid-modal ${ref('dialog')} class=\"dialog\" :onCloseCallback=${(x) => () => x.close()}>\n <div slot=\"top\" class=\"dialog-top\">${(x) => x.ruleDialogTitle}</div>\n\n <div class=\"dialog-content\">\n <div class=\"content-row\">\n <div class=\"control\">\n <rapid-text-field\n :value=${sync((x) => x.name)}\n @change=\"${(x) => x.validateRequiredFields()}\"\n autofocus\n autocomplete=\"off\"\n required\n >\n Name\n </rapid-text-field>\n </div>\n\n <div class=\"control\">\n <rapid-text-field\n :value=${sync((x) => x.description)}\n @change=\"${(x) => x.validateRequiredFields()}\"\n autocomplete=\"off\"\n required\n >\n Description\n </rapid-text-field>\n </div>\n </div>\n\n <div class=\"content-row\">\n <div class=\"control\">\n <label>Resource</label>\n <rapid-select\n :value=${sync((x) => x.resource)}\n title=${(x) => x.resource}\n position=\"below\"\n >\n ${repeat(\n (x) => x.resources,\n html`\n <rapid-option value=${(x) => x} title=${(x) => x}>${(x) => x}</rapid-option>\n `,\n )}\n </rapid-select>\n </div>\n\n <div class=\"control\">\n <label>Topic</label>\n <rapid-combobox\n autocomplete=\"both\"\n :value=${sync((x) => x.topic)}\n title=${(x) => x.topic}\n >\n ${repeat(\n (x) => x.topics,\n html`\n <rapid-option value=${(x) => x} title=${(x) => x}>${(x) => x}</rapid-option>\n `,\n )}\n </rapid-combobox>\n </div>\n\n <div class=\"control\">\n <label>Severity</label>\n <rapid-select :value=${sync((x) => x.severity)}>\n <options-datasource\n value-field=\"value\"\n label-field=\"value\"\n option-element=\"rapid-option\"\n :data=${(_) => Object.values(Severity).map((value) => ({ value }))}\n ></options-datasource>\n </rapid-select>\n </div>\n\n <div class=\"control\">\n <label>Update Type</label>\n <rapid-multiselect\n :selectedOptions=${(x) => x.updateType}\n @selectionChange=${(x, c) => {\n x.updateType = (c.event as CustomEvent).detail;\n }}\n search=\"false\"\n all=\"false\"\n >\n <multiselect-datasource\n value-field=\"value\"\n label-field=\"value\"\n :data=${() => Object.values(UpdateType).map((value) => ({ value, label: value }))}\n ></multiselect-datasource>\n </rapid-multiselect>\n </div>\n </div>\n\n <div class=\"content-row\">\n <div class=\"control\">\n <rapid-text-field\n required\n :value=${sync((x) => x.header)}\n @change=\"${(x) => x.validateRequiredFields()}\"\n autocomplete=\"off\"\n >\n Header\n </rapid-text-field>\n </div>\n\n <div class=\"control\">\n <rapid-text-field\n required\n :value=${sync((x) => x.message)}\n @change=\"${(x) => x.validateRequiredFields()}\"\n autocomplete=\"off\"\n >\n Message\n </rapid-text-field>\n </div>\n </div>\n\n <div class=\"control\">\n <label>Condition(s)</label>\n <div class=\"items\">\n <div class=\"content-row item\">\n ${repeat(\n (x) => x.conditions,\n html<ConditionNode, RuleDialog>`\n ${when(\n (x) => isGroup(x),\n html<ConditionNode>`\n <rule-condition-group\n :fields=${(x, c) => c.parent.fields}\n :node=${(x) => x}\n :isFirst=${(x, c) => c.index === 0}\n @edit=${(x, c) => c.parent.editCondition(eventDetail(c))}\n @delete=${(x, c) => c.parent.deleteCondition(eventDetail(c))}\n ></rule-condition-group>\n `,\n )}\n ${when(\n (x) => !isGroup(x),\n html<ConditionNode>`\n <rule-condition-builder\n :fields=${(x, c) => c.parent.fields}\n :condition=${(x) => x}\n :isFirst=${(x, c) => c.index === 0}\n @edit=${(x, c) => c.parent.editCondition(eventDetail(c))}\n @delete=${(x, c) => c.parent.deleteCondition(eventDetail(c))}\n ></rule-condition-builder>\n `,\n )}\n `,\n { positioning: true },\n )}\n </div>\n\n <div class=\"content-row\">\n <rapid-button appearance=\"lightweight\" @click=${(x) => x.newCondition()}>\n + Condition\n </rapid-button>\n <rapid-button appearance=\"lightweight\" @click=${(x) => x.newGroup()}>\n + Group\n </rapid-button>\n </div>\n </div>\n <rapid-text-area\n class=\"expression-preview\"\n readonly\n :value=${(x) => x.rawExpressionPreview}\n >\n Compiled expression\n </rapid-text-area>\n </div>\n </div>\n\n <div slot=\"bottom\" class=\"dialog-bottom\">\n <rapid-button\n appearance=\"primary\"\n @click=${(x) => x.submit()}\n ?disabled=${(x) => x.submitDisabled}\n >\n Submit\n </rapid-button>\n </div>\n </rapid-modal>\n`"
5004
4896
  }
5005
4897
  ],
5006
4898
  "exports": [
@@ -5131,6 +5023,14 @@
5131
5023
  },
5132
5024
  "default": "''"
5133
5025
  },
5026
+ {
5027
+ "kind": "field",
5028
+ "name": "conditions",
5029
+ "type": {
5030
+ "text": "Array<ConditionNode>"
5031
+ },
5032
+ "default": "[]"
5033
+ },
5134
5034
  {
5135
5035
  "kind": "field",
5136
5036
  "name": "submitDisabled",
@@ -5138,6 +5038,14 @@
5138
5038
  "text": "boolean"
5139
5039
  }
5140
5040
  },
5041
+ {
5042
+ "kind": "field",
5043
+ "name": "rawExpressionPreview",
5044
+ "type": {
5045
+ "text": "string"
5046
+ },
5047
+ "default": "''"
5048
+ },
5141
5049
  {
5142
5050
  "kind": "field",
5143
5051
  "name": "resources",
@@ -5162,31 +5070,6 @@
5162
5070
  },
5163
5071
  "default": "[]"
5164
5072
  },
5165
- {
5166
- "kind": "field",
5167
- "name": "ruleExpressionConfig",
5168
- "type": {
5169
- "text": "ExpressionBuilderTypes.RuleConfig"
5170
- },
5171
- "default": "{\n fields: [],\n partialRuleValidationWarning: true,\n }"
5172
- },
5173
- {
5174
- "kind": "field",
5175
- "name": "currentRuleExpression",
5176
- "type": {
5177
- "text": "RuleExpression.Expression['PredicateExpression'] | null"
5178
- },
5179
- "privacy": "private",
5180
- "default": "null"
5181
- },
5182
- {
5183
- "kind": "field",
5184
- "name": "rawExpressionPreview",
5185
- "type": {
5186
- "text": "string"
5187
- },
5188
- "default": "''"
5189
- },
5190
5073
  {
5191
5074
  "kind": "method",
5192
5075
  "name": "openDialog",
@@ -5221,21 +5104,9 @@
5221
5104
  },
5222
5105
  {
5223
5106
  "kind": "method",
5224
- "name": "refreshRuleExpressionConfig",
5107
+ "name": "refreshExpressionPreview",
5225
5108
  "privacy": "private"
5226
5109
  },
5227
- {
5228
- "kind": "method",
5229
- "name": "handleRuleExpressionChange",
5230
- "parameters": [
5231
- {
5232
- "name": "expression",
5233
- "type": {
5234
- "text": "RuleExpression.Expression['PredicateExpression']"
5235
- }
5236
- }
5237
- ]
5238
- },
5239
5110
  {
5240
5111
  "kind": "method",
5241
5112
  "name": "attributeAssignments",
@@ -5281,6 +5152,38 @@
5281
5152
  "kind": "method",
5282
5153
  "name": "resourceChanged"
5283
5154
  },
5155
+ {
5156
+ "kind": "method",
5157
+ "name": "newCondition"
5158
+ },
5159
+ {
5160
+ "kind": "method",
5161
+ "name": "newGroup"
5162
+ },
5163
+ {
5164
+ "kind": "method",
5165
+ "name": "editCondition",
5166
+ "parameters": [
5167
+ {
5168
+ "name": "editedCondition",
5169
+ "type": {
5170
+ "text": "ConditionNode"
5171
+ }
5172
+ }
5173
+ ]
5174
+ },
5175
+ {
5176
+ "kind": "method",
5177
+ "name": "deleteCondition",
5178
+ "parameters": [
5179
+ {
5180
+ "name": "deletedCondition",
5181
+ "type": {
5182
+ "text": "ConditionNode"
5183
+ }
5184
+ }
5185
+ ]
5186
+ },
5284
5187
  {
5285
5188
  "kind": "method",
5286
5189
  "name": "validateRequiredFields",
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/components/components.ts"],"names":[],"mappings":"AAuDA,wBAAsB,WAAW,kBAIhC"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/components/components.ts"],"names":[],"mappings":"AAqDA,wBAAsB,WAAW,kBAIhC"}
@@ -1,7 +1,6 @@
1
- import { ExpressionBuilderTypes, RuleExpression } from '@genesislcap/foundation-ui';
2
1
  import type { Modal } from '@genesislcap/rapid-design-system';
3
2
  import { GenesisElement } from '@genesislcap/web-core';
4
- import { UpdateType } from '../../../../../notify.types';
3
+ import { ConditionNode, UpdateType } from '../../../../../notify.types';
5
4
  import { NotifyService } from '../../../../../services/notify.service';
6
5
  import { RuleService } from '../../../../../services/rule.service';
7
6
  import { Field, SystemService } from '../../../../../services/system.service';
@@ -27,25 +26,27 @@ export declare class RuleDialog extends GenesisElement {
27
26
  updateType: UpdateType[];
28
27
  header: string;
29
28
  message: string;
29
+ conditions: Array<ConditionNode>;
30
30
  submitDisabled: boolean;
31
+ rawExpressionPreview: string;
31
32
  resources: Array<string>;
32
33
  fields: Array<Field>;
33
34
  topics: string[];
34
- ruleExpressionConfig: ExpressionBuilderTypes.RuleConfig;
35
- private currentRuleExpression;
36
- rawExpressionPreview: string;
37
35
  openDialog(params: RuleDialogParams): Promise<void>;
38
36
  close(): void;
39
37
  private createRule;
40
38
  private editRule;
41
- private refreshRuleExpressionConfig;
42
- handleRuleExpressionChange(expression: RuleExpression.Expression['PredicateExpression']): void;
39
+ private refreshExpressionPreview;
43
40
  private attributeAssignments;
44
41
  get ruleDialogTitle(): string;
45
42
  submit(): void;
46
43
  private createRuleObject;
47
44
  validateResponse(response: any): void;
48
45
  resourceChanged(): Promise<void>;
46
+ newCondition(): void;
47
+ newGroup(): void;
48
+ editCondition(editedCondition: ConditionNode): void;
49
+ deleteCondition(deletedCondition: ConditionNode): void;
49
50
  validateRequiredFields(): void;
50
51
  }
51
52
  //# sourceMappingURL=rule-dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rule-dialog.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAA2C,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAe9E,OAAO,EAAQ,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE7E;;;;;GAKG;AACH,qBAKa,UAAW,SAAQ,cAAc;IAC/B,WAAW,EAAE,WAAW,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAE5C,MAAM,EAAE,KAAK,CAAC;IACF,cAAc,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAEjF,OAAO,CAAC,MAAM,CAAgB;IAClB,IAAI,EAAE,MAAM,CAAM;IAClB,WAAW,EAAE,MAAM,CAAM;IACzB,QAAQ,EAAE,MAAM,CAAM;IACtB,KAAK,EAAE,MAAM,CAAM;IACnB,QAAQ,EAAE,MAAM,CAAM;IACtB,UAAU,EAAE,UAAU,EAAE,CAAqB;IAC7C,MAAM,EAAE,MAAM,CAAM;IACpB,OAAO,EAAE,MAAM,CAAM;IACrB,cAAc,EAAE,OAAO,CAAC;IAExB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAC9B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAM;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAM;IAStB,oBAAoB,EAAE,sBAAsB,CAAC,UAAU,CAGjE;IACF,OAAO,CAAC,qBAAqB,CAAiE;IAIlF,oBAAoB,EAAE,MAAM,CAAM;IAEjC,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAmBhD,KAAK;YAsBS,UAAU;YAUV,QAAQ;IAoBtB,OAAO,CAAC,2BAA2B;IASnC,0BAA0B,CAAC,UAAU,EAAE,cAAc,CAAC,UAAU,CAAC,qBAAqB,CAAC;IAKvF,OAAO,CAAC,oBAAoB;IAc5B,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,MAAM;IAaN,OAAO,CAAC,gBAAgB;IAwBxB,gBAAgB,CAAC,QAAQ,KAAA;IASnB,eAAe;IAMd,sBAAsB;CAK9B"}
1
+ {"version":3,"file":"rule-dialog.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAEL,aAAa,EAGb,UAAU,EACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAU9E,OAAO,EAAQ,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE7E;;;;;GAKG;AACH,qBAKa,UAAW,SAAQ,cAAc;IAC/B,WAAW,EAAE,WAAW,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAE5C,MAAM,EAAE,KAAK,CAAC;IACF,cAAc,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAEjF,OAAO,CAAC,MAAM,CAAgB;IAClB,IAAI,EAAE,MAAM,CAAM;IAClB,WAAW,EAAE,MAAM,CAAM;IACzB,QAAQ,EAAE,MAAM,CAAM;IACtB,KAAK,EAAE,MAAM,CAAM;IACnB,QAAQ,EAAE,MAAM,CAAM;IACtB,UAAU,EAAE,UAAU,EAAE,CAAqB;IAC7C,MAAM,EAAE,MAAM,CAAM;IACpB,OAAO,EAAE,MAAM,CAAM;IACrB,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAM;IACtC,cAAc,EAAE,OAAO,CAAC;IAIxB,oBAAoB,EAAE,MAAM,CAAM;IAElC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAC9B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAM;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAM;IAErB,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAmBhD,KAAK;YAsBS,UAAU;YAUV,QAAQ;IAuBtB,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,oBAAoB;IAc5B,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,MAAM;IAaN,OAAO,CAAC,gBAAgB;IAiCxB,gBAAgB,CAAC,QAAQ,KAAA;IASnB,eAAe;IAOrB,YAAY;IAKZ,QAAQ;IAKR,aAAa,CAAC,eAAe,EAAE,aAAa;IAI5C,eAAe,CAAC,gBAAgB,EAAE,aAAa;IAUxC,sBAAsB;CAK9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"rule-dialog.template.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAO,MAAM,kBAAkB,iEAgJ9B,CAAC"}
1
+ {"version":3,"file":"rule-dialog.template.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,eAAO,MAAM,kBAAkB,iEAuL9B,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { foundationLayoutComponents } from '@genesislcap/foundation-layout';
3
3
  import * as rapidDesignSystem from '@genesislcap/rapid-design-system';
4
- import { RapidRuleExpressionBuilder } from '@genesislcap/rapid-design-system';
5
4
  import { rapidGridComponents } from '@genesislcap/rapid-grid-pro';
6
5
  import { FoundationInboxCounter } from './foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter';
7
6
  import { InboxSubscription } from './foundation-inbox/components/inbox-subscription/inbox-subscription';
@@ -33,7 +32,6 @@ RuleManagement;
33
32
  RuleDialog;
34
33
  RuleConditionBuilder;
35
34
  RuleConditionGroup;
36
- RapidRuleExpressionBuilder;
37
35
  TemplateManagement;
38
36
  TemplateDialog;
39
37
  ParameterBuilder;
@@ -1,12 +1,11 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
2
  import { customElement, GenesisElement, observable } from '@genesislcap/web-core';
3
- import { Assignment, defaultUpdateType, Severity } from '../../../../../notify.types';
3
+ import { Assignment, defaultUpdateType, Severity, } from '../../../../../notify.types';
4
4
  import { NotifyService } from '../../../../../services/notify.service';
5
5
  import { RuleService } from '../../../../../services/rule.service';
6
6
  import { SystemService } from '../../../../../services/system.service';
7
7
  import { humanize } from '../../../../../utils';
8
- import { DynamicRuleUtils, showNotificationError, isEmpty, } from '../../../notification-dashboard.utils';
9
- import { conditionsToRuleExpression, mapFieldsToExpressionBuilderFields, rawTextToRuleExpression, ruleExpressionToRawText, } from '../../../rule-expression-builder.utils';
8
+ import { DynamicRuleUtils, RuleUtils, showNotificationError, isEmpty, } from '../../../notification-dashboard.utils';
10
9
  import { DynamicRuleDialogStyles } from '../../../styles/dynamic-rule.styles';
11
10
  import { RuleDialogTemplate } from './rule-dialog.template';
12
11
  import { RuleDialogMode } from './rule-dialog.types';
@@ -28,25 +27,14 @@ let RuleDialog = class RuleDialog extends GenesisElement {
28
27
  this.updateType = defaultUpdateType;
29
28
  this.header = '';
30
29
  this.message = '';
30
+ this.conditions = [];
31
+ // Live read-only preview of the compiled expression, so it's obvious
32
+ // exactly how a group of rows is being parenthesized as you build it,
33
+ // rather than only finding out after Submit.
34
+ this.rawExpressionPreview = '';
31
35
  this.resources = [];
32
36
  this.fields = [];
33
37
  this.topics = [];
34
- // Condition(s) are edited via the platform's rapid-rule-expression-builder
35
- // (@genesislcap/rapid-design-system) instead of a hand-rolled builder - it
36
- // natively supports nested AND/OR groups. ruleExpressionConfig.model holds
37
- // the tree being edited; currentRuleExpression tracks the latest emitted
38
- // value from the widget's own change event so submit() has something to
39
- // serialize even if the user never touched the fields (e.g. editing only
40
- // the header).
41
- this.ruleExpressionConfig = {
42
- fields: [],
43
- partialRuleValidationWarning: true,
44
- };
45
- this.currentRuleExpression = null;
46
- // Live read-only preview of the compiled RAW_RULE_EXPRESSION, so it's
47
- // obvious exactly how a group of rows is being parenthesized as you build
48
- // it, rather than only finding out after Submit.
49
- this.rawExpressionPreview = '';
50
38
  }
51
39
  openDialog(params) {
52
40
  return __awaiter(this, void 0, void 0, function* () {
@@ -77,28 +65,28 @@ let RuleDialog = class RuleDialog extends GenesisElement {
77
65
  this.topic = null;
78
66
  this.severity = null;
79
67
  this.ruleDialogMode = null;
80
- this.currentRuleExpression = null;
81
68
  // Arrays
82
69
  this.resources = [];
83
70
  this.topics = [];
71
+ this.conditions = [];
84
72
  this.updateType = [];
85
73
  this.dialog.close();
86
74
  this.$emit('close');
87
75
  }
88
76
  createRule() {
89
77
  return __awaiter(this, void 0, void 0, function* () {
78
+ this.conditions.push(DynamicRuleUtils.createEmptyCondition());
90
79
  this.resource = this.resources[0];
91
80
  this.fields = yield this.systemService.getFields(this.resource);
92
81
  this.topic = this.topics[0];
93
82
  this.severity = Severity.INFORMATION;
94
83
  this.updateType = defaultUpdateType;
95
- this.currentRuleExpression = null;
96
- this.refreshRuleExpressionConfig();
84
+ this.refreshExpressionPreview();
97
85
  });
98
86
  }
99
87
  editRule(data) {
100
88
  return __awaiter(this, void 0, void 0, function* () {
101
- var _a, _b;
89
+ var _a, _b, _c;
102
90
  const rule = data;
103
91
  this.ruleId = rule.DYNAMIC_RULE_ID;
104
92
  this.name = rule.RULE_NAME;
@@ -106,26 +94,28 @@ let RuleDialog = class RuleDialog extends GenesisElement {
106
94
  this.resource = rule.RULE_TABLE;
107
95
  this.updateType = rule.TABLE_OPERATIONS;
108
96
  this.fields = yield this.systemService.getFields(this.resource);
109
- // Structured (flat AND-only) CONDITIONS and raw (arbitrary AND/OR) rules
110
- // both normalise to a PredicateExpression to hydrate the widget with.
97
+ // OR-based rules are stored as a raw expression (RULE_EXPRESSION is null);
98
+ // reverse-parse it back into structured conditions so editing doesn't crash.
111
99
  const conditions = (_a = rule.RULE_EXPRESSION) === null || _a === void 0 ? void 0 : _a.CONDITIONS;
112
- this.currentRuleExpression = conditions
113
- ? conditionsToRuleExpression(conditions)
100
+ const loadedConditions = conditions
101
+ ? RuleUtils.getConditions(conditions)
114
102
  : rule.RAW_RULE_EXPRESSION
115
- ? rawTextToRuleExpression(rule.RAW_RULE_EXPRESSION)
116
- : null;
117
- this.refreshRuleExpressionConfig();
118
- this.attributeAssignments((_b = rule.RESULT_EXPRESSION) === null || _b === void 0 ? void 0 : _b.ASSIGNMENTS);
103
+ ? ((_b = DynamicRuleUtils.parseRawExpression(rule.RAW_RULE_EXPRESSION)) !== null && _b !== void 0 ? _b : [
104
+ DynamicRuleUtils.createEmptyCondition(),
105
+ ])
106
+ : [DynamicRuleUtils.createEmptyCondition()];
107
+ this.conditions = DynamicRuleUtils.resolveLeftValues(loadedConditions, this.fields);
108
+ this.refreshExpressionPreview();
109
+ this.attributeAssignments((_c = rule.RESULT_EXPRESSION) === null || _c === void 0 ? void 0 : _c.ASSIGNMENTS);
119
110
  });
120
111
  }
121
- refreshRuleExpressionConfig() {
122
- var _a;
123
- this.ruleExpressionConfig = Object.assign(Object.assign({}, this.ruleExpressionConfig), { fields: mapFieldsToExpressionBuilderFields(this.fields), model: (_a = this.currentRuleExpression) !== null && _a !== void 0 ? _a : undefined });
124
- this.rawExpressionPreview = ruleExpressionToRawText(this.currentRuleExpression);
125
- }
126
- handleRuleExpressionChange(expression) {
127
- this.currentRuleExpression = expression;
128
- this.rawExpressionPreview = ruleExpressionToRawText(expression);
112
+ refreshExpressionPreview() {
113
+ try {
114
+ this.rawExpressionPreview = DynamicRuleUtils.buildRawExpression(this.conditions);
115
+ }
116
+ catch (_a) {
117
+ this.rawExpressionPreview = '';
118
+ }
129
119
  }
130
120
  attributeAssignments(assignments) {
131
121
  var _a;
@@ -152,11 +142,19 @@ let RuleDialog = class RuleDialog extends GenesisElement {
152
142
  }
153
143
  }
154
144
  createRuleObject() {
155
- // The widget can express arbitrary AND/OR nesting that the structured
156
- // CONDITIONS format has no representation for, so rules built through it
157
- // always submit via RAW_RULE_EXPRESSION (RULE_EXPRESSION null) - the
158
- // server branches on which one is non-null.
159
- return Object.assign(Object.assign({}, (this.ruleDialogMode === RuleDialogMode.EDIT && { DYNAMIC_RULE_ID: this.ruleId })), { RULE_NAME: this.name, RULE_DESCRIPTION: this.description, RULE_TABLE: this.resource, TABLE_OPERATIONS: this.updateType, RULE_EXPRESSION: null, RAW_RULE_EXPRESSION: ruleExpressionToRawText(this.currentRuleExpression), RESULT_EXPRESSION: {
145
+ // When any condition carries multiple values, a row is explicitly
146
+ // OR-joined to the previous one, or a group is present (groups have no
147
+ // structured-CONDITIONS representation), submit an OR-expression via
148
+ // RAW_RULE_EXPRESSION (with RULE_EXPRESSION null); otherwise use the
149
+ // structured CONDITIONS. The server branches on which one is non-null.
150
+ const useRaw = DynamicRuleUtils.hasMultiValueCondition(this.conditions) ||
151
+ DynamicRuleUtils.hasOrJoin(this.conditions) ||
152
+ DynamicRuleUtils.hasGroup(this.conditions);
153
+ return Object.assign(Object.assign({}, (this.ruleDialogMode === RuleDialogMode.EDIT && { DYNAMIC_RULE_ID: this.ruleId })), { RULE_NAME: this.name, RULE_DESCRIPTION: this.description, RULE_TABLE: this.resource, TABLE_OPERATIONS: this.updateType, RULE_EXPRESSION: useRaw
154
+ ? null
155
+ : {
156
+ CONDITIONS: DynamicRuleUtils.createConditions(this.conditions),
157
+ }, RAW_RULE_EXPRESSION: useRaw ? DynamicRuleUtils.buildRawExpression(this.conditions) : null, RESULT_EXPRESSION: {
160
158
  ASSIGNMENTS: [
161
159
  DynamicRuleUtils.createAssignment(Assignment.TOPIC, this.topic),
162
160
  DynamicRuleUtils.createTextAssignment(Assignment.HEADER, this.header, this.fields),
@@ -174,11 +172,31 @@ let RuleDialog = class RuleDialog extends GenesisElement {
174
172
  }
175
173
  resourceChanged() {
176
174
  return __awaiter(this, void 0, void 0, function* () {
177
- this.currentRuleExpression = null;
175
+ this.conditions = [DynamicRuleUtils.createEmptyCondition()];
178
176
  this.fields = yield this.systemService.getFields(this.resource);
179
- this.refreshRuleExpressionConfig();
177
+ this.refreshExpressionPreview();
180
178
  });
181
179
  }
180
+ // #region Condition
181
+ newCondition() {
182
+ this.conditions.push(DynamicRuleUtils.createEmptyCondition());
183
+ this.refreshExpressionPreview();
184
+ }
185
+ newGroup() {
186
+ this.conditions.push(DynamicRuleUtils.createEmptyGroup());
187
+ this.refreshExpressionPreview();
188
+ }
189
+ editCondition(editedCondition) {
190
+ this.refreshExpressionPreview();
191
+ }
192
+ deleteCondition(deletedCondition) {
193
+ if (this.conditions.length <= 1) {
194
+ return;
195
+ }
196
+ this.conditions = this.conditions.filter((condition) => condition !== deletedCondition);
197
+ this.refreshExpressionPreview();
198
+ }
199
+ // #endregion
182
200
  validateRequiredFields() {
183
201
  this.submitDisabled = [this.name, this.description, this.header, this.message].some((value) => isEmpty(value));
184
202
  }
@@ -221,22 +239,22 @@ __decorate([
221
239
  ], RuleDialog.prototype, "message", void 0);
222
240
  __decorate([
223
241
  observable
224
- ], RuleDialog.prototype, "submitDisabled", void 0);
242
+ ], RuleDialog.prototype, "conditions", void 0);
225
243
  __decorate([
226
244
  observable
227
- ], RuleDialog.prototype, "resources", void 0);
245
+ ], RuleDialog.prototype, "submitDisabled", void 0);
228
246
  __decorate([
229
247
  observable
230
- ], RuleDialog.prototype, "fields", void 0);
248
+ ], RuleDialog.prototype, "rawExpressionPreview", void 0);
231
249
  __decorate([
232
250
  observable
233
- ], RuleDialog.prototype, "topics", void 0);
251
+ ], RuleDialog.prototype, "resources", void 0);
234
252
  __decorate([
235
253
  observable
236
- ], RuleDialog.prototype, "ruleExpressionConfig", void 0);
254
+ ], RuleDialog.prototype, "fields", void 0);
237
255
  __decorate([
238
256
  observable
239
- ], RuleDialog.prototype, "rawExpressionPreview", void 0);
257
+ ], RuleDialog.prototype, "topics", void 0);
240
258
  RuleDialog = __decorate([
241
259
  customElement({
242
260
  name: 'rule-dialog',
@@ -1,6 +1,8 @@
1
1
  import { sync } from '@genesislcap/foundation-utils';
2
- import { html, ref, repeat } from '@genesislcap/web-core';
2
+ import { html, ref, repeat, when } from '@genesislcap/web-core';
3
3
  import { Severity, UpdateType } from '../../../../../notify.types';
4
+ import { eventDetail } from '../../../../../utils/eventDetail';
5
+ const isGroup = (node) => Array.isArray(node.CHILDREN);
4
6
  export const RuleDialogTemplate = html `
5
7
  <rapid-modal ${ref('dialog')} class="dialog" :onCloseCallback=${(x) => () => x.close()}>
6
8
  <div slot="top" class="dialog-top">${(x) => x.ruleDialogTitle}</div>
@@ -115,10 +117,39 @@ export const RuleDialogTemplate = html `
115
117
 
116
118
  <div class="control">
117
119
  <label>Condition(s)</label>
118
- <rapid-rule-expression-builder
119
- :ruleConfig=${(x) => x.ruleExpressionConfig}
120
- @change=${(x, c) => x.handleRuleExpressionChange(c.event.detail)}
121
- ></rapid-rule-expression-builder>
120
+ <div class="items">
121
+ <div class="content-row item">
122
+ ${repeat((x) => x.conditions, html `
123
+ ${when((x) => isGroup(x), html `
124
+ <rule-condition-group
125
+ :fields=${(x, c) => c.parent.fields}
126
+ :node=${(x) => x}
127
+ :isFirst=${(x, c) => c.index === 0}
128
+ @edit=${(x, c) => c.parent.editCondition(eventDetail(c))}
129
+ @delete=${(x, c) => c.parent.deleteCondition(eventDetail(c))}
130
+ ></rule-condition-group>
131
+ `)}
132
+ ${when((x) => !isGroup(x), html `
133
+ <rule-condition-builder
134
+ :fields=${(x, c) => c.parent.fields}
135
+ :condition=${(x) => x}
136
+ :isFirst=${(x, c) => c.index === 0}
137
+ @edit=${(x, c) => c.parent.editCondition(eventDetail(c))}
138
+ @delete=${(x, c) => c.parent.deleteCondition(eventDetail(c))}
139
+ ></rule-condition-builder>
140
+ `)}
141
+ `, { positioning: true })}
142
+ </div>
143
+
144
+ <div class="content-row">
145
+ <rapid-button appearance="lightweight" @click=${(x) => x.newCondition()}>
146
+ + Condition
147
+ </rapid-button>
148
+ <rapid-button appearance="lightweight" @click=${(x) => x.newGroup()}>
149
+ + Group
150
+ </rapid-button>
151
+ </div>
152
+ </div>
122
153
  <rapid-text-area
123
154
  class="expression-preview"
124
155
  readonly