digitalmarketplace-frontend
Version:
Digital Marketplace Frontend contains assets and components used in Digital Marketplace projects
1 lines • 21.9 kB
Source Map (JSON)
{"version":3,"file":"option-tree.bundle.mjs","sources":["../../../../src/digitalmarketplace/components/option-tree/option-tree.ts"],"sourcesContent":["import { DigitalMarketplaceFrontendComponent } from '../../digitalmarketplace-frontend-component'\n\nclass OptionTreeSummary {\n $totalSelected: JQuery<HTMLElement>\n $totalSelectedText: JQuery<HTMLElement>\n itemNameSingular: string\n itemNamePlural: string\n\n constructor ($summary: JQuery<HTMLElement>, itemNameSingular: string, itemNamePlural: string) {\n this.$totalSelected = $summary.find('.dm-option-tree__summary-total-selected')\n this.$totalSelectedText = $summary.find('.dm-option-tree__summary-total-selected-text')\n this.itemNameSingular = itemNameSingular\n this.itemNamePlural = itemNamePlural\n }\n\n updateSelectedCount = (numberSelected: number) => {\n this.$totalSelected.text(numberSelected)\n\n if (numberSelected === 1) {\n this.$totalSelectedText.text(`${this.itemNameSingular} selected`)\n } else {\n this.$totalSelectedText.text(`${this.itemNamePlural} selected`)\n }\n }\n}\n\nclass OptionTreeSection {\n optionTree: OptionTree\n $section: JQuery<HTMLDetailsElement>\n tier: number\n optionTreeSections: OptionTreeSection[]\n $checkbox?: JQuery<HTMLInputElement>\n checkboxes: JQuery<HTMLInputElement>[]\n isParent: boolean\n\n constructor (optionTree: OptionTree, $section: JQuery<HTMLDetailsElement>, tier: number) {\n this.optionTree = optionTree\n this.$section = $section\n this.tier = tier\n this.optionTreeSections = this.$section.find('> .dm-option-tree-details__text > .dm-option-tree-details').get().map((element) => new OptionTreeSection(this.optionTree, $(element as HTMLDetailsElement), tier + 1))\n this.checkboxes = this.$section.find<HTMLInputElement>('> .dm-option-tree-details__text > .govuk-form-group > .govuk-checkboxes > .govuk-checkboxes__item > .govuk-checkboxes__input').get().map((element) => $(element))\n this.isParent = this.optionTreeSections.length > 0\n\n const checkbox = this.$section.find<HTMLInputElement>('> .dm-option-tree-details__summary-checkbox > .dm-option-tree-details__summary-text > .dm-option-tree-details__summary-text-label > .govuk-checkboxes__item > .govuk-checkboxes__input').get(0)\n\n if (checkbox) {\n this.$checkbox = $(checkbox)\n }\n }\n\n init = () => {\n this.openSectionIfSelected()\n\n if (this.isParent) {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.init())\n } else {\n this.checkboxes.forEach(($checkbox) => {\n $checkbox.on('click', () => {\n this.optionTree.updateTotals($checkbox.val(), $checkbox.is(':checked'))\n })\n })\n }\n\n if (this.$checkbox) {\n // Stop checkbox/label clicks toggling the parent <details> (which collapses\n // the section); expand/collapse stays on the chevron.\n this.$checkbox.closest('.govuk-checkboxes__item').on('click', (event) => {\n event.stopPropagation()\n })\n\n this.$checkbox.on('click', (event) => {\n const $checkbox = $(event.target)\n\n if (this.optionTree.independentSelection) {\n // Selecting a section is a selection of the section itself: it neither\n // selects nor expands its children. Any click clears descendant\n // selections, so checking makes the section the sole selection in its\n // subtree and unchecking clears the subtree entirely.\n const isChecked = $checkbox.is(':checked')\n\n if (this.isParent) {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.toggleAllCheckboxes(false))\n } else {\n this.checkboxes.forEach(($leafCheckbox) => $leafCheckbox.prop('checked', false))\n }\n\n $checkbox.prop('checked', isChecked)\n this.optionTree.updateAllParts()\n return\n }\n\n if ($checkbox.is(':checked')) {\n this.openSections()\n }\n\n if (this.isParent) {\n this.optionTree.updateAllTotals(this.optionTreeSections, $checkbox.is(':checked'))\n } else {\n this.optionTree.updateAllTotals([this], $checkbox.is(':checked'))\n }\n })\n }\n }\n\n private selectedItems = () => {\n return this.checkboxes.filter(($checkbox) => $checkbox.is(':checked'))\n }\n\n private openSectionIfSelected = () => {\n // In independent selection mode a section selected by itself stays collapsed;\n // only open it when the selection sits somewhere in its subtree.\n const shouldOpen = this.optionTree.independentSelection\n ? this.hasSelectedDescendants()\n : this.countSelected() > 0\n\n if (shouldOpen && this.$section.attr('open') !== 'open') {\n this.$section.attr('open', 'open')\n }\n }\n\n hasSelectedDescendants = (): boolean => {\n if (this.isParent) {\n return this.optionTreeSections.some((optionTreeSection) =>\n optionTreeSection.$checkbox?.is(':checked') ||\n optionTreeSection.hasSelectedDescendants()\n )\n }\n\n return this.selectedItems().length > 0\n }\n\n openSections = () => {\n if (this.$section.attr('open') !== 'open') {\n this.$section.attr('open', 'open')\n }\n\n if (this.isParent) {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.openSections())\n }\n }\n\n countSelected = (): number => {\n // A section's own checkbox is a selection in its own right in independent\n // selection mode.\n let total = this.optionTree.independentSelection && this.$checkbox?.is(':checked') ? 1 : 0\n\n if (this.isParent) {\n total += this.optionTreeSections.reduce(\n (sectionTotal, optionTreeSection) => sectionTotal + optionTreeSection.countSelected(), 0\n )\n } else {\n total += this.selectedItems().length\n }\n\n return total\n }\n\n isAllSelected = (): boolean => {\n if (this.isParent) {\n return this.optionTreeSections.every((optionTreeSection) => optionTreeSection.isAllSelected())\n } else {\n return this.countSelected() == this.checkboxes.length\n }\n }\n\n selectedItemValues = (): (string | undefined)[] => {\n const values = this.isParent\n ? this.optionTreeSections.map((optionTreeSection) => optionTreeSection.selectedItemValues()).flat()\n : this.selectedItems().map(($checkbox) => $checkbox.val())\n\n if (this.optionTree.independentSelection && this.$checkbox?.is(':checked')) {\n values.push(this.$checkbox.val())\n }\n\n return values\n }\n\n updateSectionLocks = (fromTier: number) => {\n if (this.countSelected()) {\n if (this.tier === fromTier) {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.toggleSectionLock(false))\n } else {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.updateSectionLocks(fromTier))\n }\n } else {\n this.toggleSectionLock(true)\n }\n }\n\n updateSectionCheckbox = () => {\n if (this.optionTree.independentSelection) {\n // Derive state bottom-up so child section checkboxes are final before the\n // parent reads them. A section is a selection in its own right: a tick\n // only ever means the user selected the section itself, and any selection\n // beneath it clears that tick. Descendant selections show no derived\n // state on the parent at all.\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.updateSectionCheckbox())\n\n if (this.$checkbox && this.hasSelectedDescendants()) {\n this.$checkbox.prop('checked', false)\n }\n\n return\n }\n\n this.$checkbox?.prop('checked', this.isAllSelected())\n\n if (this.isParent) {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.updateSectionCheckbox())\n }\n }\n\n toggleSectionLock = (isLocked: boolean) => {\n if (this.isParent) {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.toggleSectionLock(isLocked))\n } else {\n this.checkboxes.forEach((checkbox) => checkbox.prop('disabled', isLocked))\n }\n\n if (isLocked) {\n this.$section.attr('disabled', 'disabled')\n this.$section.attr('tabIndex', -1)\n this.$section.removeAttr('open')\n this.$checkbox?.prop('disabled', true)\n this.$checkbox?.prop('checked', false)\n } else {\n this.$section.removeAttr('disabled')\n this.$section.removeAttr('tabIndex')\n this.$checkbox?.prop('disabled', false)\n }\n }\n\n toggleCheckbox = (value: string | undefined, isChecked: boolean) => {\n if (this.isParent) {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.toggleCheckbox(value, isChecked))\n } else {\n this.checkboxes.forEach(($checkbox) => {\n if ($checkbox.val() === value) {\n $checkbox.prop('checked', isChecked)\n }\n })\n }\n }\n\n toggleAllCheckboxes = (isChecked: boolean) => {\n if (this.$checkbox) {\n this.$checkbox.prop('checked', isChecked)\n }\n\n if (this.isParent) {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.toggleAllCheckboxes(isChecked))\n } else {\n this.checkboxes.forEach(($checkbox) => {\n $checkbox.prop('checked', isChecked)\n })\n }\n }\n}\n\nclass OptionTree implements DigitalMarketplaceFrontendComponent {\n static moduleName = 'dm-option-tree'\n $optionTree: JQuery<HTMLElement>\n optionTreeSummary: OptionTreeSummary\n optionTreeSections: OptionTreeSection[]\n tierLimit: number\n independentSelection: boolean\n currentCount: number = 0\n\n constructor ($optionTree: JQuery<HTMLElement>) {\n this.$optionTree = $optionTree\n this.optionTreeSummary = new OptionTreeSummary(this.$optionTree.find('.dm-option-tree__summary'), this.$optionTree.data('itemNameSingular'), this.$optionTree.data('itemNamePlural'))\n this.tierLimit = this.$optionTree.data('tierRestriction') || 0\n this.independentSelection = this.$optionTree.data('independentSelection') === true\n this.optionTreeSections = this.$optionTree.find<HTMLDetailsElement>('.dm-option-tree__options > .dm-option-tree-details').get().map((element) => new OptionTreeSection(this, $(element), 1))\n }\n\n init = () => {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.init())\n\n this.updateAllParts()\n }\n\n private countSelected = () => {\n return new Set(this.optionTreeSections.map((optionTreeSection) => optionTreeSection.selectedItemValues()).flat()).size\n }\n\n private updateOptionTreeSummaryCount = () => {\n this.currentCount = this.countSelected()\n this.optionTreeSummary.updateSelectedCount(this.currentCount)\n }\n\n private updateSectionLocks = () => {\n if (!this.tierLimit) return\n\n this.optionTreeSections.forEach((optionTreeSection) => {\n if (this.currentCount === 0) {\n optionTreeSection.toggleSectionLock(false)\n } else {\n optionTreeSection.updateSectionLocks(this.tierLimit)\n }\n })\n }\n\n private updateSectionsCheckboxes = () => {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.updateSectionCheckbox())\n }\n\n updateAllParts = () => {\n this.updateSectionsCheckboxes()\n this.updateOptionTreeSummaryCount()\n this.updateSectionLocks()\n }\n\n updateTotals = (value: string | undefined, isChecked: boolean) => {\n this.optionTreeSections.forEach((optionTreeSection) => optionTreeSection.toggleCheckbox(value, isChecked))\n\n this.updateAllParts()\n }\n\n updateAllTotals = (optionTreeSections: OptionTreeSection[], isChecked: boolean) => {\n optionTreeSections.forEach((optionTreeSection) => optionTreeSection.toggleAllCheckboxes(isChecked))\n\n this.updateAllParts()\n }\n}\n\nexport { OptionTree }\n"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,CAAA;AACrB,IAAA,cAAc;AACd,IAAA,kBAAkB;AAClB,IAAA,gBAAgB;AAChB,IAAA,cAAc;AAEd,IAAA,WAAA,CAAa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