| 13 | |
| 14 | // - exclusionRules: the value obtained from settings, with the shape [{pattern, passKeys}]. |
| 15 | setForm(exclusionRules = []) { |
| 16 | const rulesTable = document.querySelector("#exclusion-rules"); |
| 17 | // Remove any previous rows. |
| 18 | const existingRuleEls = rulesTable.querySelectorAll(".rule"); |
| 19 | for (const el of existingRuleEls) { |
| 20 | el.remove(); |
| 21 | } |
| 22 | |
| 23 | const rowTemplate = document.querySelector("#exclusion-rule-template").content; |
| 24 | for (const rule of exclusionRules) { |
| 25 | this.addRow(rule.pattern, rule.passKeys); |
| 26 | } |
| 27 | }, |
| 28 | |
| 29 | // `pattern` and `passKeys` are optional. |
| 30 | addRow(pattern, passKeys) { |