From c3e747cb9cb66e4a3408fbe0d627cedc58e4c703 Mon Sep 17 00:00:00 2001 From: Wilson Gaturu Date: Wed, 26 Jul 2023 19:17:28 +0300 Subject: [PATCH] adds taxonomy topics ui --- indigo/bulk_creator.py | 4 ---- indigo_api/models/works.py | 21 +++++++++++++++++++ indigo_api/serializers.py | 5 ----- indigo_app/forms.py | 14 +++++++++++++ indigo_app/static/javascript/indigo-app.js | 6 +++--- .../indigo_api/_task_filter_form.html | 4 ++++ .../indigo_api/_work_filter_form.html | 3 +++ .../templates/indigo_api/task_list.html | 17 +++++++++++++-- .../templates/indigo_api/work_form.html | 2 +- indigo_app/templates/place/works.html | 19 +++++++++++++++-- indigo_app/views/places.py | 4 ++-- indigo_app/views/tasks.py | 4 +++- indigo_content_api/v2/serializers.py | 6 ++---- package-lock.json | 14 ++++++------- package.json | 2 +- 15 files changed, 93 insertions(+), 32 deletions(-) diff --git a/indigo/bulk_creator.py b/indigo/bulk_creator.py index a3df6de847..cef276a8da 100644 --- a/indigo/bulk_creator.py +++ b/indigo/bulk_creator.py @@ -937,10 +937,6 @@ def link_taxonomy(self, row, model=VocabularyTopic, attr='taxonomies', attr_sing except Task.DoesNotExist: self.create_task(row.work, row, task_type='link-taxonomy') - - - - def preview_task(self, row, task_type): task_preview = task_type.replace('-', ' ') if task_type == 'import-content': diff --git a/indigo_api/models/works.py b/indigo_api/models/works.py index 0f13846de7..bb07bc7161 100644 --- a/indigo_api/models/works.py +++ b/indigo_api/models/works.py @@ -14,6 +14,8 @@ from reversion.models import Version from cobalt import FrbrUri, RepealEvent from treebeard.mp_tree import MP_Node +from django.urls import reverse +from django.http import QueryDict from indigo.plugins import plugins @@ -117,6 +119,25 @@ def save(self, *args, **kwargs): self.slug = (f"{parent.slug}-" if parent else "") + slugify(self.name) super().save(*args, **kwargs) + @classmethod + def get_toc_tree(cls, query_dict): + # capture all preserve all filter parameters and add taxonomy_topic + new_query = query_dict.copy() + new_query.pop('taxonomy_topic', None) + + def fix_up(item): + item["title"] = item["data"]["name"] + new_query.update({'taxonomy_topic': item['data']['slug']}) + item["href"] = f"?{new_query.urlencode()}" + new_query.pop('taxonomy_topic', None) + for kid in item.get("children", []): + fix_up(kid) + + tree = cls.dump_bulk() + for x in tree: + fix_up(x) + return tree + class WorkMixin(object): """ Support methods that define behaviour for a work, independent of the database model. diff --git a/indigo_api/serializers.py b/indigo_api/serializers.py index 605ade8650..8f4b559bca 100644 --- a/indigo_api/serializers.py +++ b/indigo_api/serializers.py @@ -635,11 +635,6 @@ def get_taxonomy_topics(self, instance): "name": t.name, "slug": t.slug }) - for ancestor in t.get_ancestors(): - taxonomies.append({ - "name": ancestor.name, - "slug": ancestor.slug - }) return taxonomies diff --git a/indigo_app/forms.py b/indigo_app/forms.py index 897c07843f..b29c1030a7 100644 --- a/indigo_app/forms.py +++ b/indigo_app/forms.py @@ -303,6 +303,7 @@ class TaskFilterForm(forms.Form): submitted_by = forms.ModelMultipleChoiceField(queryset=User.objects) type = forms.MultipleChoiceField(choices=Task.CODES) country = forms.ModelMultipleChoiceField(queryset=Country.objects) + taxonomy_topic = forms.CharField() def __init__(self, country, *args, **kwargs): self.country = country @@ -338,6 +339,11 @@ def filter_queryset(self, queryset): queryset = queryset.filter(state__in=['pending_review', 'closed'])\ .filter(submitted_by_user__in=self.cleaned_data['submitted_by']) + if self.cleaned_data.get('taxonomy_topic'): + topic = TaxonomyTopic.objects.filter(slug=self.cleaned_data['taxonomy_topic']).first() + topics = [topic] + [t for t in topic.get_descendants()] + queryset = queryset.filter(work__taxonomy_topics__in=topics) + return queryset def data_as_url(self): @@ -380,6 +386,8 @@ class WorkFilterForm(forms.Form): advanced_filters = ['assent', 'publication', 'repeal', 'amendment', 'commencement', 'primary_subsidiary', 'taxonomies', 'completeness', 'status'] + taxonomy_topic = forms.CharField() + def __init__(self, country, *args, **kwargs): self.country = country super(WorkFilterForm, self).__init__(*args, **kwargs) @@ -511,6 +519,12 @@ def filter_queryset(self, queryset): end_date = self.cleaned_data['commencement_date_end'] queryset = queryset.filter(commencements__date__range=[start_date, end_date]).order_by('-commencements__date') + if self.cleaned_data.get('taxonomy_topic'): + topic = TaxonomyTopic.objects.filter(slug=self.cleaned_data['taxonomy_topic']).first() + if topic: + topics = [topic] + [t for t in topic.get_descendants()] + queryset = queryset.filter(taxonomy_topics__in=topics) + return queryset def filter_document_queryset(self, queryset): diff --git a/indigo_app/static/javascript/indigo-app.js b/indigo_app/static/javascript/indigo-app.js index e4d3c1711c..bd90499ea1 100644 --- a/indigo_app/static/javascript/indigo-app.js +++ b/indigo_app/static/javascript/indigo-app.js @@ -159,7 +159,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"LaTableOfContentsController\": () => (/* binding */ LaTableOfContentsController),\n/* harmony export */ \"defineCustomElement\": () => (/* binding */ defineCustomElement)\n/* harmony export */ });\n/* harmony import */ var _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @stencil/core/internal/client */ \"./node_modules/@stencil/core/internal/client/index.js\");\n/* harmony import */ var _debounce_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./debounce.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/debounce.js\");\n/* harmony import */ var _services_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./services.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/services.js\");\n/* harmony import */ var _table_of_contents_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./table-of-contents.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/table-of-contents.js\");\n/* harmony import */ var _toc_item_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./toc-item.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/toc-item.js\");\n/*!\n * (C) Law Widgets https://laws.africa - MIT License\n */\n\n\n\n\n\n\nconst tableOfContentsControllerCss = \"la-table-of-contents-controller *{-webkit-box-sizing:border-box;box-sizing:border-box}la-table-of-contents-controller .search{width:100%;margin-bottom:5px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:relative}la-table-of-contents-controller .search__input{-ms-flex:1;flex:1}la-table-of-contents-controller .search__clear-btn{position:absolute;top:0;right:0;height:100%}la-table-of-contents-controller .toggle{margin-bottom:5px}la-table-of-contents-controller .toggle__expand-all-btn{margin-right:5px}\";\n\nconst TableOfContentsController = /*@__PURE__*/ (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.proxyCustomElement)(class extends _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.HTMLElement {\n constructor() {\n super();\n this.__registerHost();\n /**\n * JSON value of array of items or string value parsed to array of items used to build the table of contents. Each\n * item must have a `title` attribute (which may be `null`), and a `children` attribute (which may be `null`).\n * */\n this.items = [];\n /**\n * Placeholder for search title filter\n * */\n this.titleFilterPlaceholder = 'Search the table of contents';\n /**\n * If true, hides clear title filter button\n */\n this.hideClearTitleFilterButton = false;\n /**\n * Additional classes added to title filter button\n */\n this.titleFilterClearBtnClasses = '';\n /**\n * Additional classes added to Expand all button\n * */\n this.expandAllBtnClasses = '';\n /**\n * Additional classes added to Collapse all button\n * */\n this.collapseAllBtnClasses = '';\n /**\n * Button text for expand all button\n * */\n this.expandAllBtnText = 'Expand all';\n /**\n * Button text for collapse all button\n * */\n this.collapseAllBtnText = 'Collapse all';\n /**\n * Additional CSS classes added to the search filter input\n * */\n this.titleFilterInputClasses = '';\n /** Fetch content from Laws.Africa services? Requires a Laws.Africa partnership and the frbrExpressionUri property to be set. */\n this.fetch = false;\n /** Provider URL for fetching content (advanced usage only). */\n this.provider = _services_js__WEBPACK_IMPORTED_MODULE_1__.P;\n this.titleFilter = '';\n this.handleTitleChange = (0,_debounce_js__WEBPACK_IMPORTED_MODULE_0__.d)((e) => {\n this.titleFilter = e.target.value;\n }, 300);\n }\n clearTitleFilter() {\n this.titleFilter = '';\n }\n async expandAll() {\n const tocElement = this.el.querySelector('la-table-of-contents');\n tocElement === null || tocElement === void 0 ? void 0 : tocElement.expandAll();\n }\n async collapseAll() {\n const tocElement = this.el.querySelector('la-table-of-contents');\n tocElement === null || tocElement === void 0 ? void 0 : tocElement.collapseAll();\n }\n render() {\n const renderHideClearFilterButton = () => {\n if (this.hideClearTitleFilterButton) {\n return null;\n }\n return ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"button\", { class: `search__clear-btn ${this.titleFilterClearBtnClasses}`, type: \"button\", onClick: () => this.clearTitleFilter(), disabled: !this.titleFilter }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"slot\", { name: \"clear-title-filter-icon\" }, \"\\u2715\")));\n };\n return ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.Host, null, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"div\", { class: \"search\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"input\", { class: `search__input ${this.titleFilterInputClasses}`, value: this.titleFilter, placeholder: this.titleFilterPlaceholder, onInput: (e) => this.handleTitleChange(e) }), renderHideClearFilterButton()), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"div\", { class: \"toggle\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"button\", { type: \"button\", class: `toggle__expand-all-btn ${this.expandAllBtnClasses}`, onClick: () => this.expandAll() }, this.expandAllBtnText), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"button\", { type: \"button\", class: `toggle__collapse-all-btn ${this.collapseAllBtnClasses}`, onClick: () => this.collapseAll() }, this.collapseAllBtnText)), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"la-table-of-contents\", { items: this.items, titleFilter: this.titleFilter, fetch: this.fetch, provider: this.provider, partner: this.partner, \"frbr-expression-uri\": this.frbrExpressionUri }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"span\", { slot: \"expand-icon\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"slot\", { name: \"expand-icon\" })), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"span\", { slot: \"collapse-icon\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"slot\", { name: \"collapse-icon\" })))));\n }\n get el() { return this; }\n static get style() { return tableOfContentsControllerCss; }\n}, [4, \"la-table-of-contents-controller\", {\n \"items\": [1],\n \"titleFilterPlaceholder\": [1, \"title-filter-placeholder\"],\n \"hideClearTitleFilterButton\": [4, \"hide-clear-title-filter-button\"],\n \"titleFilterClearBtnClasses\": [1, \"title-filter-clear-btn-classes\"],\n \"expandAllBtnClasses\": [1, \"expand-all-btn-classes\"],\n \"collapseAllBtnClasses\": [1, \"collapse-all-btn-classes\"],\n \"expandAllBtnText\": [1, \"expand-all-btn-text\"],\n \"collapseAllBtnText\": [1, \"collapse-all-btn-text\"],\n \"titleFilterInputClasses\": [1, \"title-filter-input-classes\"],\n \"frbrExpressionUri\": [1537, \"frbr-expression-uri\"],\n \"fetch\": [1540],\n \"partner\": [1537],\n \"provider\": [1],\n \"titleFilter\": [32]\n }]);\nfunction defineCustomElement$1() {\n if (typeof customElements === \"undefined\") {\n return;\n }\n const components = [\"la-table-of-contents-controller\", \"la-table-of-contents\", \"la-toc-item\"];\n components.forEach(tagName => { switch (tagName) {\n case \"la-table-of-contents-controller\":\n if (!customElements.get(tagName)) {\n customElements.define(tagName, TableOfContentsController);\n }\n break;\n case \"la-table-of-contents\":\n if (!customElements.get(tagName)) {\n (0,_table_of_contents_js__WEBPACK_IMPORTED_MODULE_2__.d)();\n }\n break;\n case \"la-toc-item\":\n if (!customElements.get(tagName)) {\n (0,_toc_item_js__WEBPACK_IMPORTED_MODULE_3__.d)();\n }\n break;\n } });\n}\n\nconst LaTableOfContentsController = TableOfContentsController;\nconst defineCustomElement = defineCustomElement$1;\n\n\n\n\n//# sourceURL=webpack://indigo/./node_modules/@lawsafrica/law-widgets/dist/components/la-table-of-contents-controller.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"LaTableOfContentsController\": () => (/* binding */ LaTableOfContentsController),\n/* harmony export */ \"defineCustomElement\": () => (/* binding */ defineCustomElement)\n/* harmony export */ });\n/* harmony import */ var _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @stencil/core/internal/client */ \"./node_modules/@stencil/core/internal/client/index.js\");\n/* harmony import */ var _debounce_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./debounce.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/debounce.js\");\n/* harmony import */ var _services_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./services.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/services.js\");\n/* harmony import */ var _table_of_contents_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./table-of-contents.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/table-of-contents.js\");\n/* harmony import */ var _toc_item_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./toc-item.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/toc-item.js\");\n/*!\n * (C) Law Widgets https://laws.africa - MIT License\n */\n\n\n\n\n\n\nconst tableOfContentsControllerCss = \"la-table-of-contents-controller *{-webkit-box-sizing:border-box;box-sizing:border-box}la-table-of-contents-controller .search{width:100%;margin-bottom:5px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:relative}la-table-of-contents-controller .search__input{-ms-flex:1;flex:1}la-table-of-contents-controller .search__clear-btn{position:absolute;top:0;right:0;height:100%}la-table-of-contents-controller .toggle{margin-bottom:5px}la-table-of-contents-controller .toggle__expand-all-btn{margin-right:5px}\";\n\nconst TableOfContentsController = /*@__PURE__*/ (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.proxyCustomElement)(class extends _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.HTMLElement {\n constructor() {\n super();\n this.__registerHost();\n /**\n * JSON value of array of items or string value parsed to array of items used to build the table of contents. Each\n * item must have a `title` attribute (which may be `null`), and a `children` attribute (which may be `null`).\n * */\n this.items = [];\n /**\n * Placeholder for search title filter\n * */\n this.titleFilterPlaceholder = 'Search the table of contents';\n /**\n * If true, hides clear title filter button\n */\n this.hideClearTitleFilterButton = false;\n /**\n * Additional classes added to title filter button\n */\n this.titleFilterClearBtnClasses = '';\n /**\n * Additional classes added to Expand all button\n * */\n this.expandAllBtnClasses = '';\n /**\n * Additional classes added to Collapse all button\n * */\n this.collapseAllBtnClasses = '';\n /**\n * Button text for expand all button\n * */\n this.expandAllBtnText = 'Expand all';\n /**\n * Button text for collapse all button\n * */\n this.collapseAllBtnText = 'Collapse all';\n /** Should the table of contents be expanded when first created? */\n this.expanded = true;\n /**\n * Additional CSS classes added to the search filter input\n * */\n this.titleFilterInputClasses = '';\n /** Fetch content from Laws.Africa services? Requires a Laws.Africa partnership and the frbrExpressionUri property to be set. */\n this.fetch = false;\n /** Provider URL for fetching content (advanced usage only). */\n this.provider = _services_js__WEBPACK_IMPORTED_MODULE_1__.P;\n this.titleFilter = '';\n this.handleTitleChange = (0,_debounce_js__WEBPACK_IMPORTED_MODULE_0__.d)((e) => {\n this.titleFilter = e.target.value;\n }, 300);\n }\n clearTitleFilter() {\n this.titleFilter = '';\n }\n async expandAll() {\n const tocElement = this.el.querySelector('la-table-of-contents');\n tocElement === null || tocElement === void 0 ? void 0 : tocElement.expandAll();\n }\n async collapseAll() {\n const tocElement = this.el.querySelector('la-table-of-contents');\n tocElement === null || tocElement === void 0 ? void 0 : tocElement.collapseAll();\n }\n render() {\n const renderHideClearFilterButton = () => {\n if (this.hideClearTitleFilterButton) {\n return null;\n }\n return ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"button\", { class: `search__clear-btn ${this.titleFilterClearBtnClasses}`, type: \"button\", onClick: () => this.clearTitleFilter(), disabled: !this.titleFilter }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"slot\", { name: \"clear-title-filter-icon\" }, \"\\u2715\")));\n };\n return ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.Host, null, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"div\", { class: \"search\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"input\", { class: `search__input ${this.titleFilterInputClasses}`, value: this.titleFilter, placeholder: this.titleFilterPlaceholder, onInput: (e) => this.handleTitleChange(e) }), renderHideClearFilterButton()), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"div\", { class: \"toggle\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"button\", { type: \"button\", class: `toggle__expand-all-btn ${this.expandAllBtnClasses}`, onClick: () => this.expandAll() }, this.expandAllBtnText), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"button\", { type: \"button\", class: `toggle__collapse-all-btn ${this.collapseAllBtnClasses}`, onClick: () => this.collapseAll() }, this.collapseAllBtnText)), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"la-table-of-contents\", { items: this.items, titleFilter: this.titleFilter, fetch: this.fetch, provider: this.provider, partner: this.partner, \"frbr-expression-uri\": this.frbrExpressionUri, expanded: this.expanded }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"span\", { slot: \"expand-icon\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"slot\", { name: \"expand-icon\" })), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"span\", { slot: \"collapse-icon\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_4__.h)(\"slot\", { name: \"collapse-icon\" })))));\n }\n get el() { return this; }\n static get style() { return tableOfContentsControllerCss; }\n}, [4, \"la-table-of-contents-controller\", {\n \"items\": [1],\n \"titleFilterPlaceholder\": [1, \"title-filter-placeholder\"],\n \"hideClearTitleFilterButton\": [4, \"hide-clear-title-filter-button\"],\n \"titleFilterClearBtnClasses\": [1, \"title-filter-clear-btn-classes\"],\n \"expandAllBtnClasses\": [1, \"expand-all-btn-classes\"],\n \"collapseAllBtnClasses\": [1, \"collapse-all-btn-classes\"],\n \"expandAllBtnText\": [1, \"expand-all-btn-text\"],\n \"collapseAllBtnText\": [1, \"collapse-all-btn-text\"],\n \"expanded\": [4],\n \"titleFilterInputClasses\": [1, \"title-filter-input-classes\"],\n \"frbrExpressionUri\": [1537, \"frbr-expression-uri\"],\n \"fetch\": [1540],\n \"partner\": [1537],\n \"provider\": [1],\n \"titleFilter\": [32]\n }]);\nfunction defineCustomElement$1() {\n if (typeof customElements === \"undefined\") {\n return;\n }\n const components = [\"la-table-of-contents-controller\", \"la-table-of-contents\", \"la-toc-item\"];\n components.forEach(tagName => { switch (tagName) {\n case \"la-table-of-contents-controller\":\n if (!customElements.get(tagName)) {\n customElements.define(tagName, TableOfContentsController);\n }\n break;\n case \"la-table-of-contents\":\n if (!customElements.get(tagName)) {\n (0,_table_of_contents_js__WEBPACK_IMPORTED_MODULE_2__.d)();\n }\n break;\n case \"la-toc-item\":\n if (!customElements.get(tagName)) {\n (0,_toc_item_js__WEBPACK_IMPORTED_MODULE_3__.d)();\n }\n break;\n } });\n}\n\nconst LaTableOfContentsController = TableOfContentsController;\nconst defineCustomElement = defineCustomElement$1;\n\n\n\n\n//# sourceURL=webpack://indigo/./node_modules/@lawsafrica/law-widgets/dist/components/la-table-of-contents-controller.js?"); /***/ }), @@ -214,7 +214,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"T\": () => (/* binding */ TableOfContents),\n/* harmony export */ \"d\": () => (/* binding */ defineCustomElement)\n/* harmony export */ });\n/* harmony import */ var _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @stencil/core/internal/client */ \"./node_modules/@stencil/core/internal/client/index.js\");\n/* harmony import */ var _services_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./services.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/services.js\");\n/* harmony import */ var _toc_item_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toc-item.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/toc-item.js\");\n/*!\n * (C) Law Widgets https://laws.africa - MIT License\n */\n\n\n\n\nconst TableOfContents = /*@__PURE__*/ (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.proxyCustomElement)(class extends _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.HTMLElement {\n constructor() {\n super();\n this.__registerHost();\n /**\n * JSON value or string value parsed to array of items used to build the table of contents. Each item must have\n * a `title` attribute (which may be `null`), and a `children` attribute (which may be `null`).\n * */\n this.items = [];\n /**\n * value to filter items by item title\n * */\n this.titleFilter = '';\n /** Fetch content from Laws.Africa services? Requires a Laws.Africa partnership and the frbrExpressionUri property to be set. */\n this.fetch = false;\n /** Provider URL for fetching content (advanced usage only). */\n this.provider = _services_js__WEBPACK_IMPORTED_MODULE_0__.P;\n this.filteredItems = null;\n this.innerItems = [];\n }\n parseItemsProp(newValue) {\n if (typeof newValue === 'string') {\n this.innerItems = JSON.parse(newValue);\n }\n else if (Array.isArray(newValue)) {\n this.innerItems = [...newValue];\n }\n }\n refetch() {\n this.fetchContent();\n }\n async fetchContent() {\n this.ensurePartner();\n if (this.fetch && this.frbrExpressionUri && this.provider) {\n const url = this.provider + '/p/' + this.partner + '/e/we/toc.json' + this.frbrExpressionUri;\n try {\n const resp = await fetch(url);\n if (resp.ok) {\n // @ts-ignore\n this.innerItems = (await resp.json()).toc;\n }\n }\n catch (error) {\n // ignore\n }\n }\n }\n ensurePartner() {\n if (!this.partner) {\n this.partner = (0,_services_js__WEBPACK_IMPORTED_MODULE_0__.g)();\n }\n }\n componentWillLoad() {\n this.parseItemsProp(this.items);\n this.titleFilterChanged(this.titleFilter);\n this.fetchContent();\n }\n /**\n * Expands all items\n */\n async expandAll() {\n Array.from(this.el.querySelectorAll('la-toc-item')).forEach((item) => {\n // @ts-ignore\n item.expanded = true;\n });\n }\n /**\n * Collapses all items\n */\n async collapseAll() {\n Array.from(this.el.querySelectorAll('la-toc-item')).forEach((item) => {\n // @ts-ignore\n item.expanded = false;\n });\n }\n titleFilterChanged(filter) {\n if (filter) {\n const needle = filter.toLocaleLowerCase().trim();\n const filteredItems = new Set();\n // recursively include all children\n // eslint-disable-next-line no-inner-declarations\n function includeKids(item) {\n for (const child of item.children || []) {\n filteredItems.add(child);\n includeKids(child);\n }\n }\n // Recursive function that determines whether or not an item should be rendered.\n // An item is rendered if its title matches the filter, or any of its children should be rendered.\n // eslint-disable-next-line no-inner-declarations\n function shouldInclude(item) {\n var _a;\n // this will be true if this item matches the search, or any child does\n let include = (((_a = item.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) || '').includes(needle);\n if (include) {\n // this item matches, show include all children automatically, no need to go any deeper\n includeKids(item);\n }\n else {\n // if any children match, then this node must be included\n if (item.children) {\n for (const child of item.children) {\n include = shouldInclude(child) || include;\n }\n }\n }\n if (include) {\n filteredItems.add(item);\n }\n return include;\n }\n for (const item of this.innerItems) {\n shouldInclude(item);\n }\n this.filteredItems = filteredItems;\n }\n else {\n this.filteredItems = null;\n }\n this.expandAll();\n }\n render() {\n const renderTOCItem = (item) => {\n const getSlotHTML = (selector) => {\n var _a;\n const element = this.el.querySelector(selector);\n /**\n * If slots originate from `la-table-of-contents`, query for slot html is\n * `this.el.querySelector(\"[slot]\").innerHTML`\n * If slot originate from `la-table-of-contents-controller` query for slot html is\n * `this.el.querySelector(\"[slot] [slot]\").innerHTML`\n * */\n // Slots originating from la-table-of-content-controller\n if (element === null || element === void 0 ? void 0 : element.querySelector(selector)) {\n return ((_a = element.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.innerHTML) || '';\n }\n // Slots originating from la-table-of-content\n return (element === null || element === void 0 ? void 0 : element.innerHTML) || '';\n };\n const expandIcon = getSlotHTML(\"[slot='expand-icon']\");\n const collapseIcon = getSlotHTML(\"[slot='collapse-icon']\");\n return ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(\"la-toc-item\", { item: item, filteredItems: this.filteredItems, expandIconHtml: expandIcon, collapseIconHtml: collapseIcon }));\n };\n return ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.Host, null, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(\"div\", { style: { display: 'none' } }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(\"slot\", { name: \"expand-icon\" }), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(\"slot\", { name: \"collapse-icon\" })), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(\"div\", { class: \"toc-items\" }, this.innerItems.map((item) => renderTOCItem(item)))));\n }\n get el() { return this; }\n static get watchers() { return {\n \"items\": [\"parseItemsProp\"],\n \"provider\": [\"refetch\"],\n \"frbrExpressionUri\": [\"refetch\"],\n \"fetch\": [\"refetch\"],\n \"titleFilter\": [\"titleFilterChanged\"]\n }; }\n}, [4, \"la-table-of-contents\", {\n \"items\": [1],\n \"titleFilter\": [1, \"title-filter\"],\n \"frbrExpressionUri\": [1537, \"frbr-expression-uri\"],\n \"fetch\": [1540],\n \"partner\": [1537],\n \"provider\": [1],\n \"filteredItems\": [32],\n \"innerItems\": [32],\n \"expandAll\": [64],\n \"collapseAll\": [64]\n }]);\nfunction defineCustomElement() {\n if (typeof customElements === \"undefined\") {\n return;\n }\n const components = [\"la-table-of-contents\", \"la-toc-item\"];\n components.forEach(tagName => { switch (tagName) {\n case \"la-table-of-contents\":\n if (!customElements.get(tagName)) {\n customElements.define(tagName, TableOfContents);\n }\n break;\n case \"la-toc-item\":\n if (!customElements.get(tagName)) {\n (0,_toc_item_js__WEBPACK_IMPORTED_MODULE_1__.d)();\n }\n break;\n } });\n}\n\n\n\n\n//# sourceURL=webpack://indigo/./node_modules/@lawsafrica/law-widgets/dist/components/table-of-contents.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"T\": () => (/* binding */ TableOfContents),\n/* harmony export */ \"d\": () => (/* binding */ defineCustomElement)\n/* harmony export */ });\n/* harmony import */ var _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @stencil/core/internal/client */ \"./node_modules/@stencil/core/internal/client/index.js\");\n/* harmony import */ var _services_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./services.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/services.js\");\n/* harmony import */ var _toc_item_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toc-item.js */ \"./node_modules/@lawsafrica/law-widgets/dist/components/toc-item.js\");\n/*!\n * (C) Law Widgets https://laws.africa - MIT License\n */\n\n\n\n\nconst TableOfContents = /*@__PURE__*/ (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.proxyCustomElement)(class extends _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.HTMLElement {\n constructor() {\n super();\n this.__registerHost();\n /**\n * JSON value or string value parsed to array of items used to build the table of contents. Each item must have\n * a `title` attribute (which may be `null`), and a `children` attribute (which may be `null`).\n *\n * Items may optionally have an id attribute and an href attribute, which are used to build the links for each item.\n * */\n this.items = [];\n /**\n * value to filter items by item title\n * */\n this.titleFilter = '';\n /**\n * Should items be expanded by default? This can be overridden by setting the expanded property for individual items.\n * */\n this.expanded = true;\n /** Fetch content from Laws.Africa services? Requires a Laws.Africa partnership and the frbrExpressionUri property to be set. */\n this.fetch = false;\n /** Provider URL for fetching content (advanced usage only). */\n this.provider = _services_js__WEBPACK_IMPORTED_MODULE_0__.P;\n this.filteredItems = null;\n this.innerItems = [];\n this.expandIconHtml = '';\n this.collapseIconHtml = '';\n }\n parseItemsProp(newValue) {\n if (typeof newValue === 'string') {\n this.innerItems = JSON.parse(newValue);\n }\n else if (Array.isArray(newValue)) {\n this.innerItems = [...newValue];\n }\n }\n refetch() {\n this.fetchContent();\n }\n async fetchContent() {\n this.ensurePartner();\n if (this.fetch && this.frbrExpressionUri && this.provider) {\n const url = this.provider + '/p/' + this.partner + '/e/we/toc.json' + this.frbrExpressionUri;\n try {\n const resp = await fetch(url);\n if (resp.ok) {\n // @ts-ignore\n this.innerItems = (await resp.json()).toc;\n }\n }\n catch (error) {\n // ignore\n }\n }\n }\n ensurePartner() {\n if (!this.partner) {\n this.partner = (0,_services_js__WEBPACK_IMPORTED_MODULE_0__.g)();\n }\n }\n getSlotHTML(selector) {\n var _a;\n const element = this.el.querySelector(selector);\n /**\n * If slots originate from `la-table-of-contents`, query for slot html is\n * `this.el.querySelector(\"[slot]\").innerHTML`\n * If slot originate from `la-table-of-contents-controller` query for slot html is\n * `this.el.querySelector(\"[slot] [slot]\").innerHTML`\n * */\n // Slots originating from la-table-of-content-controller\n if (element === null || element === void 0 ? void 0 : element.querySelector(selector)) {\n return ((_a = element.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.innerHTML) || '';\n }\n // Slots originating from la-table-of-content\n return (element === null || element === void 0 ? void 0 : element.innerHTML) || '';\n }\n componentWillLoad() {\n this.expandIconHtml = this.getSlotHTML(\"[slot='expand-icon']\");\n this.collapseIconHtml = this.getSlotHTML(\"[slot='collapse-icon']\");\n this.parseItemsProp(this.items);\n this.titleFilterChanged(this.titleFilter);\n this.fetchContent();\n }\n /**\n * Expands all items\n */\n async expandAll() {\n Array.from(this.el.querySelectorAll('la-toc-item')).forEach((item) => {\n // @ts-ignore\n item.expanded = true;\n });\n }\n /**\n * Collapses all items\n */\n async collapseAll() {\n Array.from(this.el.querySelectorAll('la-toc-item')).forEach((item) => {\n // @ts-ignore\n item.expanded = false;\n });\n }\n titleFilterChanged(filter) {\n if (filter) {\n const needle = filter.toLocaleLowerCase().trim();\n const filteredItems = new Set();\n // recursively include all children\n // eslint-disable-next-line no-inner-declarations\n function includeKids(item) {\n for (const child of item.children || []) {\n filteredItems.add(child);\n includeKids(child);\n }\n }\n // Recursive function that determines whether or not an item should be rendered.\n // An item is rendered if its title matches the filter, or any of its children should be rendered.\n // eslint-disable-next-line no-inner-declarations\n function shouldInclude(item) {\n var _a;\n // this will be true if this item matches the search, or any child does\n let include = (((_a = item.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) || '').includes(needle);\n if (include) {\n // this item matches, show include all children automatically, no need to go any deeper\n includeKids(item);\n }\n else {\n // if any children match, then this node must be included\n if (item.children) {\n for (const child of item.children) {\n include = shouldInclude(child) || include;\n }\n }\n }\n if (include) {\n filteredItems.add(item);\n }\n return include;\n }\n for (const item of this.innerItems) {\n shouldInclude(item);\n }\n this.filteredItems = filteredItems;\n }\n else {\n this.filteredItems = null;\n }\n this.expandAll();\n }\n /**\n * Render items recursively. We render from the bottom up, allowing us to append children into their\n * parents. Rendering recursively here rather than inside la-toc-item means we can make use of global\n * configuration details without having to pass them down the tree.\n */\n renderItem(item) {\n // render the children first, so we can add them to the parent\n const kids = (item.children || []).map((child) => this.renderItem(child));\n // if the item has an explicit expanded value, use that, otherwise use the tree's default value\n const expanded = item.expanded === undefined ? this.expanded : item.expanded;\n return (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(\"la-toc-item\", { item: item, filteredItems: this.filteredItems, expandIconHtml: this.expandIconHtml, collapseIconHtml: this.collapseIconHtml, expanded: expanded }, kids);\n }\n render() {\n return ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.Host, null, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(\"div\", { style: { display: 'none' } }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(\"slot\", { name: \"expand-icon\" }), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_2__.h)(\"slot\", { name: \"collapse-icon\" })), this.innerItems.map((item) => this.renderItem(item))));\n }\n get el() { return this; }\n static get watchers() { return {\n \"items\": [\"parseItemsProp\"],\n \"provider\": [\"refetch\"],\n \"frbrExpressionUri\": [\"refetch\"],\n \"fetch\": [\"refetch\"],\n \"titleFilter\": [\"titleFilterChanged\"]\n }; }\n}, [4, \"la-table-of-contents\", {\n \"items\": [1],\n \"titleFilter\": [1, \"title-filter\"],\n \"expanded\": [4],\n \"frbrExpressionUri\": [1537, \"frbr-expression-uri\"],\n \"fetch\": [1540],\n \"partner\": [1537],\n \"provider\": [1],\n \"filteredItems\": [32],\n \"innerItems\": [32],\n \"expandAll\": [64],\n \"collapseAll\": [64]\n }]);\nfunction defineCustomElement() {\n if (typeof customElements === \"undefined\") {\n return;\n }\n const components = [\"la-table-of-contents\", \"la-toc-item\"];\n components.forEach(tagName => { switch (tagName) {\n case \"la-table-of-contents\":\n if (!customElements.get(tagName)) {\n customElements.define(tagName, TableOfContents);\n }\n break;\n case \"la-toc-item\":\n if (!customElements.get(tagName)) {\n (0,_toc_item_js__WEBPACK_IMPORTED_MODULE_1__.d)();\n }\n break;\n } });\n}\n\n\n\n\n//# sourceURL=webpack://indigo/./node_modules/@lawsafrica/law-widgets/dist/components/table-of-contents.js?"); /***/ }), @@ -236,7 +236,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"T\": () => (/* binding */ TocItem),\n/* harmony export */ \"d\": () => (/* binding */ defineCustomElement)\n/* harmony export */ });\n/* harmony import */ var _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stencil/core/internal/client */ \"./node_modules/@stencil/core/internal/client/index.js\");\n/*!\n * (C) Law Widgets https://laws.africa - MIT License\n */\n\n\nconst tocItemCss = \"la-toc-item{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%}la-toc-item *{-webkit-box-sizing:border-box;box-sizing:border-box}la-toc-item .indented{width:1.4em;height:1.4em}la-toc-item .content{-ms-flex:1;flex:1}la-toc-item .content__action{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}la-toc-item .content__action__title{-ms-flex-positive:1;flex-grow:1}la-toc-item .content__children{display:none}la-toc-item[expanded]>.content>.content__children{display:inherit}la-toc-item.excluded{display:none}la-toc-item .indented__toggle-btn{cursor:pointer;display:inline-block;font-size:smaller;text-align:center;padding:1px 6px}\";\n\nconst TocItem = /*@__PURE__*/ (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.proxyCustomElement)(class extends _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.HTMLElement {\n constructor() {\n super();\n this.__registerHost();\n this.itemRendered = (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.createEvent)(this, \"itemRendered\", 7);\n this.itemTitleClicked = (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.createEvent)(this, \"itemTitleClicked\", 7);\n /**\n * Item used to build the table of contents\n * */\n this.item = {};\n /**\n * Array of items filtered by titleQuery used in la-toc-item to determine with item is shown or not\n * */\n this.filteredItems = null;\n /**\n * HTML displayed before item title\n * */\n this.prependHtml = '';\n /**\n * HTML displayed after item title\n * */\n this.appendHtml = '';\n /**\n * HTML displayed in toggle button when item is expanded\n * */\n this.expandIconHtml = '';\n /**\n * HTML displayed in toggle button when item is not expanded\n * */\n this.collapseIconHtml = '';\n /**\n * If true, `item` `children`, and the collapsed icon are shown but expanded icon is hidden. If false, the `item`\n * `children` and collapsed icon are hidden but the expanded icon is show\n * */\n this.expanded = true;\n this.onItemTitleClick = (e) => {\n this.itemTitleClicked.emit(e);\n };\n }\n toggle() {\n this.expanded = !this.expanded;\n }\n componentDidRender() {\n this.itemRendered.emit();\n }\n render() {\n var _a, _b;\n const isParent = !!((_a = this.item.children) === null || _a === void 0 ? void 0 : _a.length);\n const showItem = !this.filteredItems || this.filteredItems.has(this.item);\n const renderToggleBtnInner = () => {\n if (this.expanded) {\n return this.collapseIconHtml ? (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"span\", { innerHTML: this.collapseIconHtml }) : (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"span\", null, \"\\u25BC\");\n }\n return this.expandIconHtml ? (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"span\", { innerHTML: this.expandIconHtml }) : (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"span\", null, \"\\u25BA\");\n };\n return ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.Host, Object.assign({}, (isParent ? { parent: isParent } : {}), { class: `${!showItem ? 'excluded' : ''}` }), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"indented\" }, isParent ? ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"indented__toggle-btn\", role: \"button\", onClick: () => this.toggle() }, renderToggleBtnInner())) : null), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content__action\" }, this.prependHtml ? (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content__action__prepend\", innerHTML: this.prependHtml }) : null, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"a\", { href: `#${this.item.id || ''}`, class: \"content__action__title\", onClick: this.onItemTitleClick }, this.item.title), this.appendHtml ? (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content__action__append\", innerHTML: this.appendHtml }) : null), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content__children\" }, ((_b = this.item.children) === null || _b === void 0 ? void 0 : _b.length)\n ? this.item.children.map((item) => ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"la-toc-item\", { item: item, filteredItems: this.filteredItems, expandIconHtml: this.expandIconHtml, collapseIconHtml: this.collapseIconHtml })))\n : null))));\n }\n static get style() { return tocItemCss; }\n}, [0, \"la-toc-item\", {\n \"item\": [16],\n \"filteredItems\": [16],\n \"prependHtml\": [1, \"prepend-html\"],\n \"appendHtml\": [1, \"append-html\"],\n \"expandIconHtml\": [1, \"expand-icon-html\"],\n \"collapseIconHtml\": [1, \"collapse-icon-html\"],\n \"expanded\": [1540]\n }]);\nfunction defineCustomElement() {\n if (typeof customElements === \"undefined\") {\n return;\n }\n const components = [\"la-toc-item\", \"la-toc-item\"];\n components.forEach(tagName => { switch (tagName) {\n case \"la-toc-item\":\n if (!customElements.get(tagName)) {\n customElements.define(tagName, TocItem);\n }\n break;\n case \"la-toc-item\":\n if (!customElements.get(tagName)) {\n defineCustomElement();\n }\n break;\n } });\n}\n\n\n\n\n//# sourceURL=webpack://indigo/./node_modules/@lawsafrica/law-widgets/dist/components/toc-item.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"T\": () => (/* binding */ TocItem),\n/* harmony export */ \"d\": () => (/* binding */ defineCustomElement)\n/* harmony export */ });\n/* harmony import */ var _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stencil/core/internal/client */ \"./node_modules/@stencil/core/internal/client/index.js\");\n/*!\n * (C) Law Widgets https://laws.africa - MIT License\n */\n\n\nconst tocItemCss = \"la-toc-item{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%}la-toc-item *{-webkit-box-sizing:border-box;box-sizing:border-box}la-toc-item .indented{width:1.4em;height:1.4em}la-toc-item .content{-ms-flex:1;flex:1}la-toc-item .content__action{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}la-toc-item .content__action__title{-ms-flex-positive:1;flex-grow:1}la-toc-item .content__children{display:none}la-toc-item[expanded]>.content>.content__children{display:inherit}la-toc-item.excluded{display:none}la-toc-item .indented__toggle-btn{cursor:pointer;display:inline-block;font-size:smaller;text-align:center;padding:1px 6px}\";\n\nconst TocItem = /*@__PURE__*/ (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.proxyCustomElement)(class extends _stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.HTMLElement {\n constructor() {\n super();\n this.__registerHost();\n this.itemRendered = (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.createEvent)(this, \"itemRendered\", 7);\n this.itemTitleClicked = (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.createEvent)(this, \"itemTitleClicked\", 7);\n /**\n * Item used to build the table of contents\n * */\n this.item = {};\n /**\n * Array of items filtered by titleQuery used in la-toc-item to determine with item is shown or not\n * */\n this.filteredItems = null;\n /**\n * HTML displayed before item title\n * */\n this.prependHtml = '';\n /**\n * HTML displayed after item title\n * */\n this.appendHtml = '';\n /**\n * HTML displayed in toggle button when item is expanded\n * */\n this.expandIconHtml = '';\n /**\n * HTML displayed in toggle button when item is not expanded\n * */\n this.collapseIconHtml = '';\n /**\n * If true, `item` `children`, and the collapsed icon are shown but expanded icon is hidden. If false, the `item`\n * `children` and collapsed icon are hidden but the expanded icon is show\n * */\n this.expanded = true;\n this.onItemTitleClick = (e) => {\n this.itemTitleClicked.emit(e);\n };\n }\n toggle() {\n this.expanded = !this.expanded;\n }\n componentDidRender() {\n this.itemRendered.emit();\n }\n render() {\n var _a;\n const isParent = !!((_a = this.item.children) === null || _a === void 0 ? void 0 : _a.length);\n const showItem = !this.filteredItems || this.filteredItems.has(this.item);\n const href = this.item.href || `#${this.item.id || ''}`;\n const renderToggleBtnInner = () => {\n if (this.expanded) {\n return this.collapseIconHtml ? (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"span\", { innerHTML: this.collapseIconHtml }) : (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"span\", null, \"\\u25BC\");\n }\n return this.expandIconHtml ? (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"span\", { innerHTML: this.expandIconHtml }) : (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"span\", null, \"\\u25BA\");\n };\n return ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.Host, Object.assign({}, (isParent ? { parent: isParent } : {}), { class: `${!showItem ? 'excluded' : ''}` }), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"indented\" }, isParent ? ((0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"indented__toggle-btn\", role: \"button\", onClick: () => this.toggle() }, renderToggleBtnInner())) : null), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content__action\" }, this.prependHtml ? (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content__action__prepend\", innerHTML: this.prependHtml }) : null, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"a\", { href: href, class: \"content__action__title\", onClick: this.onItemTitleClick }, this.item.title), this.appendHtml ? (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content__action__append\", innerHTML: this.appendHtml }) : null), (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"div\", { class: \"content__children\" }, (0,_stencil_core_internal_client__WEBPACK_IMPORTED_MODULE_0__.h)(\"slot\", null)))));\n }\n static get style() { return tocItemCss; }\n}, [4, \"la-toc-item\", {\n \"item\": [16],\n \"filteredItems\": [16],\n \"prependHtml\": [1, \"prepend-html\"],\n \"appendHtml\": [1, \"append-html\"],\n \"expandIconHtml\": [1, \"expand-icon-html\"],\n \"collapseIconHtml\": [1, \"collapse-icon-html\"],\n \"expanded\": [1540]\n }]);\nfunction defineCustomElement() {\n if (typeof customElements === \"undefined\") {\n return;\n }\n const components = [\"la-toc-item\"];\n components.forEach(tagName => { switch (tagName) {\n case \"la-toc-item\":\n if (!customElements.get(tagName)) {\n customElements.define(tagName, TocItem);\n }\n break;\n } });\n}\n\n\n\n\n//# sourceURL=webpack://indigo/./node_modules/@lawsafrica/law-widgets/dist/components/toc-item.js?"); /***/ }), diff --git a/indigo_app/templates/indigo_api/_task_filter_form.html b/indigo_app/templates/indigo_api/_task_filter_form.html index 354cffd153..54f0af71fc 100644 --- a/indigo_app/templates/indigo_api/_task_filter_form.html +++ b/indigo_app/templates/indigo_api/_task_filter_form.html @@ -80,5 +80,9 @@ {% endif %} + + + + diff --git a/indigo_app/templates/indigo_api/_work_filter_form.html b/indigo_app/templates/indigo_api/_work_filter_form.html index 21b25e762e..c2ec76a887 100644 --- a/indigo_app/templates/indigo_api/_work_filter_form.html +++ b/indigo_app/templates/indigo_api/_work_filter_form.html @@ -211,6 +211,9 @@ + + +
{% trans 'Clear filters' %} diff --git a/indigo_app/templates/indigo_api/task_list.html b/indigo_app/templates/indigo_api/task_list.html index c099136701..14afa8c963 100644 --- a/indigo_app/templates/indigo_api/task_list.html +++ b/indigo_app/templates/indigo_api/task_list.html @@ -5,8 +5,20 @@ {% block content %} -
-
+
+ +
+
+ +
+ +
@@ -39,4 +51,5 @@
+
{% endblock %} diff --git a/indigo_app/templates/indigo_api/work_form.html b/indigo_app/templates/indigo_api/work_form.html index 2646bf0835..4cce425471 100644 --- a/indigo_app/templates/indigo_api/work_form.html +++ b/indigo_app/templates/indigo_api/work_form.html @@ -162,7 +162,7 @@
{% trans 'Classification' %}
- +