typo3-typescript-sources 14.3.8 → 14.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/sync-and-publish.yml +240 -191
- package/.last-synced-tag +1 -1
- package/README.md +13 -5
- package/adminpanel/admin-panel.ts +22 -22
- package/adminpanel/modules/cache.ts +3 -3
- package/backend/action-dispatcher.ts +8 -3
- package/backend/bookmark/bookmark-store.ts +5 -5
- package/backend/clipboard-panel.ts +2 -2
- package/backend/code-editor/element/code-mirror-element.ts +1 -1
- package/backend/code-editor/language/typoscript.ts +3 -3
- package/backend/code-editor/stream-parser/typoscript.ts +2 -2
- package/backend/color-picker.ts +2 -2
- package/backend/column-selector-button.ts +6 -6
- package/backend/context-help.ts +3 -3
- package/backend/context-menu.ts +8 -3
- package/backend/drag-tooltip.ts +9 -4
- package/backend/drag-uploader.ts +4 -4
- package/backend/element/draggable-resizable-element.ts +18 -12
- package/backend/element/icon-element.ts +2 -2
- package/backend/element/thumbnail-element.ts +2 -2
- package/backend/element-browser.ts +1 -1
- package/backend/event/consumer-scope.ts +2 -2
- package/backend/event/interaction-request-assignment.ts +1 -1
- package/backend/event/interaction-request-map.ts +3 -3
- package/backend/form-engine/container/flex-form-container-container.ts +2 -2
- package/backend/form-engine/container/flex-form-section-container.ts +1 -1
- package/backend/form-engine/container/inline-control-container.ts +14 -14
- package/backend/form-engine/element/abstract-sortable-select-items.ts +3 -3
- package/backend/form-engine/element/color-element.ts +1 -1
- package/backend/form-engine/element/datetime-element.ts +1 -1
- package/backend/form-engine/element/extra/char-counter.ts +2 -2
- package/backend/form-engine/element/extra/select-box-filter.ts +1 -1
- package/backend/form-engine/element/mfa-info-element.ts +2 -2
- package/backend/form-engine/element/online-media-form-element.ts +5 -1
- package/backend/form-engine/element/select-multiple-side-by-side-element.ts +2 -2
- package/backend/form-engine/element/select-tree.ts +3 -3
- package/backend/form-engine/element/slug-element.ts +7 -7
- package/backend/form-engine/element/suggest/result-container.ts +1 -1
- package/backend/form-engine/element/table-wizard-element.ts +4 -4
- package/backend/form-engine/inline-relation/ajax-dispatcher.ts +3 -3
- package/backend/form-engine-validation.ts +11 -5
- package/backend/form-engine.ts +11 -11
- package/backend/global-event-handler.ts +1 -1
- package/backend/hotkeys/hotkey-struct.ts +1 -1
- package/backend/hotkeys.ts +3 -3
- package/backend/image-manipulation.ts +19 -19
- package/backend/layout-module/drag-drop.ts +4 -4
- package/backend/layout-module/paste.ts +1 -1
- package/backend/live-search/element/result/item/action/action-container.ts +1 -1
- package/backend/live-search/element/result/item/item-container.ts +4 -4
- package/backend/live-search/element/result/result-container.ts +5 -0
- package/backend/live-search/element/result/result-pagination.ts +1 -1
- package/backend/live-search/live-search.ts +2 -2
- package/backend/localization/label-provider.ts +4 -4
- package/backend/localization/localization-wizard.ts +4 -4
- package/backend/localization/steps/content-record-selection-step.ts +8 -8
- package/backend/localization/steps/handler-selection-step.ts +4 -4
- package/backend/localization/steps/mode-step.ts +4 -4
- package/backend/localization/steps/source-language-step.ts +4 -4
- package/backend/localization/steps/target-language-step.ts +4 -4
- package/backend/login.ts +2 -2
- package/backend/module/iframe.ts +10 -0
- package/backend/module/router.ts +10 -0
- package/backend/module-menu.ts +3 -3
- package/backend/multi-record-selection-action.ts +1 -1
- package/backend/multi-record-selection-delete-action.ts +1 -1
- package/backend/multi-record-selection.ts +14 -14
- package/backend/multi-step-wizard.ts +9 -2
- package/backend/new-multiple-pages.ts +2 -2
- package/backend/new-record-wizard.ts +15 -15
- package/backend/page-wizard/page-wizard.ts +2 -2
- package/backend/page-wizard/steps/doktype-step.ts +5 -5
- package/backend/pagetsconfig/pagetsconfig-includes.ts +1 -1
- package/backend/popover.ts +5 -5
- package/backend/record-download-button.ts +1 -1
- package/backend/recordlist.ts +6 -6
- package/backend/security/element/csp-reports.ts +8 -8
- package/backend/setup-module.ts +2 -2
- package/backend/sortable-table.ts +10 -4
- package/backend/storage/abstract-client-storage.ts +2 -2
- package/backend/storage/module-state-storage.ts +2 -2
- package/backend/tests/backend/utility/dom-helper-test.ts +2 -2
- package/backend/tests/form-engine/element/extra/select-box-filter-test.ts +3 -3
- package/backend/tests/form-engine-validation-test.ts +1 -1
- package/backend/tests/tree/tree-test.ts +41 -0
- package/backend/tree/file-storage-browser.ts +1 -1
- package/backend/tree/file-storage-tree-container.ts +4 -4
- package/backend/tree/page-browser.ts +1 -1
- package/backend/tree/page-position-select.ts +1 -1
- package/backend/tree/page-tree-element.ts +1 -1
- package/backend/tree/page-tree.ts +7 -1
- package/backend/tree/tree-module-state.ts +5 -5
- package/backend/tree/tree.ts +15 -8
- package/backend/user-pass-login.ts +2 -2
- package/backend/utility/collapse-state-persister.ts +1 -1
- package/backend/utility/collapse-state-search.ts +6 -6
- package/backend/utility/dom-helper.ts +3 -3
- package/backend/utility.ts +6 -6
- package/backend/viewport/content-navigation.ts +5 -0
- package/backend/viewport/navigation-container.ts +1 -1
- package/backend/viewport/toolbar.ts +3 -3
- package/backend/window-manager.ts +2 -2
- package/backend/wizard/events/auto-advance-event.ts +6 -0
- package/backend/wizard/events/before-next-step-event.ts +6 -0
- package/backend/wizard/events/step-summary-event.ts +6 -0
- package/backend/wizard/move-content-element.ts +1 -1
- package/backend/wizard/wizard.ts +8 -10
- package/belog/backend-log.ts +2 -2
- package/beuser/permissions.ts +2 -2
- package/core/ajax/ajax-response.ts +1 -1
- package/core/ajax/input-transformer.ts +1 -1
- package/core/event/debounce-event.ts +4 -4
- package/core/event/event-interface.ts +3 -3
- package/core/event/regular-event.ts +7 -7
- package/core/event/request-animation-frame-event.ts +4 -4
- package/core/event/throttle-event.ts +4 -4
- package/core/java-script-item-processor.ts +6 -0
- package/core/referrer-refresh.ts +2 -2
- package/core/security-utility.ts +1 -1
- package/dashboard/dashboard-wizard.ts +2 -2
- package/dashboard/dashboard.ts +5 -5
- package/dashboard/wizard/steps/preset-step.ts +3 -3
- package/extensionmanager/main.ts +7 -7
- package/filelist/browse-files.ts +1 -1
- package/filelist/browse-folders.ts +2 -2
- package/filelist/file-list-dragdrop.ts +5 -5
- package/filelist/file-list-transfer-handler.ts +2 -2
- package/filelist/file-list.ts +5 -5
- package/form/backend/form-editor/component/date-editor.ts +4 -0
- package/form/backend/form-editor/component/form-element-selector.ts +4 -0
- package/form/backend/form-editor/inspector-component.ts +6 -6
- package/form/backend/form-editor/mediator.ts +36 -36
- package/form/backend/form-editor/modals-component.ts +1 -1
- package/form/backend/form-editor/stage-component.ts +4 -4
- package/form/backend/form-editor/view-model.ts +7 -7
- package/form/backend/form-manager/view-model.ts +5 -5
- package/form/backend/form-wizard/form-wizard.ts +2 -2
- package/form/backend/form-wizard/steps/storage-step.ts +1 -1
- package/impexp/import-export.ts +1 -1
- package/info/translation-status.ts +2 -2
- package/install/ajax/ajax-queue.ts +1 -1
- package/install/module/abstract-interactable-module.ts +2 -2
- package/install/module/environment/image-processing.ts +4 -4
- package/install/module/environment/mail-test.ts +2 -2
- package/install/module/maintenance/clear-tables.ts +3 -3
- package/install/module/maintenance/clear-typo3temp-files.ts +8 -8
- package/install/module/maintenance/create-admin.ts +3 -3
- package/install/module/maintenance/database-analyzer.ts +9 -7
- package/install/module/maintenance/language-packs.ts +4 -4
- package/install/module/maintenance/reference-index.ts +1 -1
- package/install/module/settings/change-install-tool-password.ts +1 -1
- package/install/module/settings/extension-configuration.ts +5 -5
- package/install/module/settings/features.ts +1 -1
- package/install/module/settings/local-configuration.ts +5 -5
- package/install/module/settings/presets.ts +2 -2
- package/install/module/settings/system-maintainer.ts +1 -1
- package/install/module/upgrade/extension-scanner.ts +5 -5
- package/install/module/upgrade/tca-migrations-check.ts +1 -1
- package/install/module/upgrade/upgrade-docs.ts +16 -16
- package/install/module/upgrade/upgrade-wizards.ts +7 -8
- package/install/renderable/language-packs.ts +8 -2
- package/lowlevel/query-generator.ts +2 -2
- package/package.json +2 -2
- package/redirects/event-handler.ts +6 -0
- package/rte-ckeditor/ckeditor5.ts +7 -3
- package/rte-ckeditor/tests/ckeditor5-test.ts +68 -0
- package/scheduler/form-engine/element/timing-options-element.ts +1 -1
- package/scheduler/scheduler.ts +2 -2
- package/styleguide/checkbox-demo.ts +1 -1
- package/tstemplate/template-analyzer.ts +1 -1
- package/viewpage/main.ts +1 -1
- package/workspaces/backend.ts +5 -5
- package/workspaces/preview.ts +2 -2
- package/workspaces/renderable/record-table.ts +1 -1
- package/workspaces/renderable/send-to-stage-form.ts +1 -1
|
@@ -101,7 +101,7 @@ class MultiRecordSelection {
|
|
|
101
101
|
// which were already evaluated and do not call the evaluation for them again.
|
|
102
102
|
let actionsToggled: boolean = false;
|
|
103
103
|
const identifiers: Array<string> = [];
|
|
104
|
-
checked.forEach((checkbox
|
|
104
|
+
checked.forEach((checkbox) => {
|
|
105
105
|
(checkbox.closest(MultiRecordSelectionSelectors.elementSelector) as HTMLElement)?.classList.add(MultiRecordSelection.activeClass);
|
|
106
106
|
const identifier: string = MultiRecordSelection.getIdentifier(checkbox);
|
|
107
107
|
if (identifier !== '' && !identifiers.includes(identifier)) {
|
|
@@ -132,12 +132,12 @@ class MultiRecordSelection {
|
|
|
132
132
|
|
|
133
133
|
if (!MultiRecordSelection.getCheckboxes(CheckboxState.checked, identifier).length) {
|
|
134
134
|
// In case no checkbox is checked, hide all action containers and return
|
|
135
|
-
actionContainers.forEach((container
|
|
135
|
+
actionContainers.forEach((container): void => MultiRecordSelection.changeActionContainerVisibility(container, false));
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
// Remove hidden state of all action containers, since checked checkboxes exist
|
|
140
|
-
actionContainers.forEach((container
|
|
140
|
+
actionContainers.forEach((container): void => MultiRecordSelection.changeActionContainerVisibility(container));
|
|
141
141
|
|
|
142
142
|
const actions: NodeListOf<HTMLButtonElement> = document.querySelectorAll(
|
|
143
143
|
[MultiRecordSelection.getCombinedSelector(MultiRecordSelectionSelectors.actionsSelector, identifier), Buttons.actionButton].join(' ')
|
|
@@ -148,7 +148,7 @@ class MultiRecordSelection {
|
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
actions.forEach((action
|
|
151
|
+
actions.forEach((action): void => {
|
|
152
152
|
if (!action.dataset.multiRecordSelectionActionConfig) {
|
|
153
153
|
// In case the action does not define any configuration, no toggling is possible
|
|
154
154
|
return;
|
|
@@ -208,7 +208,7 @@ class MultiRecordSelection {
|
|
|
208
208
|
* state would may led to misbehaviour.
|
|
209
209
|
*/
|
|
210
210
|
private static unsetManuallyChangedAttribute(identifier: string): void {
|
|
211
|
-
MultiRecordSelection.getCheckboxes(CheckboxState.any, identifier).forEach((checkbox
|
|
211
|
+
MultiRecordSelection.getCheckboxes(CheckboxState.any, identifier).forEach((checkbox): void => {
|
|
212
212
|
checkbox.removeAttribute('data-manually-changed');
|
|
213
213
|
});
|
|
214
214
|
}
|
|
@@ -251,20 +251,20 @@ class MultiRecordSelection {
|
|
|
251
251
|
new RegularEvent('multiRecordSelection:actions:show', (e: CustomEvent): void => {
|
|
252
252
|
const identifier: string = e.detail?.identifier || '';
|
|
253
253
|
const actionContainers: NodeListOf<HTMLElement> = document.querySelectorAll(MultiRecordSelection.getCombinedSelector(MultiRecordSelectionSelectors.actionsSelector, identifier));
|
|
254
|
-
actionContainers.forEach((container
|
|
254
|
+
actionContainers.forEach((container): void => MultiRecordSelection.changeActionContainerVisibility(container));
|
|
255
255
|
}).bindTo(document);
|
|
256
256
|
new RegularEvent('multiRecordSelection:actions:hide', (e: CustomEvent): void => {
|
|
257
257
|
const identifier: string = e.detail?.identifier || '';
|
|
258
258
|
const actionContainers: NodeListOf<HTMLElement> = document.querySelectorAll(MultiRecordSelection.getCombinedSelector(MultiRecordSelectionSelectors.actionsSelector, identifier));
|
|
259
|
-
actionContainers.forEach((container
|
|
259
|
+
actionContainers.forEach((container): void => MultiRecordSelection.changeActionContainerVisibility(container, false));
|
|
260
260
|
}).bindTo(document);
|
|
261
261
|
new RegularEvent('multiRecordSelection:checkboxes:check', (e: CustomEvent): void => {
|
|
262
262
|
const identifier: string = e.detail?.identifier || '';
|
|
263
|
-
MultiRecordSelection.getCheckboxes(CheckboxState.any, identifier).forEach((checkbox
|
|
263
|
+
MultiRecordSelection.getCheckboxes(CheckboxState.any, identifier).forEach((checkbox): void => MultiRecordSelection.changeCheckboxState(checkbox, true));
|
|
264
264
|
}).bindTo(document);
|
|
265
265
|
new RegularEvent('multiRecordSelection:checkboxes:uncheck', (e: CustomEvent): void => {
|
|
266
266
|
const identifier: string = e.detail?.identifier || '';
|
|
267
|
-
MultiRecordSelection.getCheckboxes(CheckboxState.any, identifier).forEach((checkbox
|
|
267
|
+
MultiRecordSelection.getCheckboxes(CheckboxState.any, identifier).forEach((checkbox): void => MultiRecordSelection.changeCheckboxState(checkbox, false));
|
|
268
268
|
}).bindTo(document);
|
|
269
269
|
}
|
|
270
270
|
|
|
@@ -293,17 +293,17 @@ class MultiRecordSelection {
|
|
|
293
293
|
// Perform requested action
|
|
294
294
|
switch (target.dataset.multiRecordSelectionCheckAction) {
|
|
295
295
|
case CheckboxActions.checkAll:
|
|
296
|
-
checkboxes.forEach((checkbox
|
|
296
|
+
checkboxes.forEach((checkbox) => {
|
|
297
297
|
MultiRecordSelection.changeCheckboxState(checkbox, true);
|
|
298
298
|
});
|
|
299
299
|
break;
|
|
300
300
|
case CheckboxActions.checkNone:
|
|
301
|
-
checkboxes.forEach((checkbox
|
|
301
|
+
checkboxes.forEach((checkbox) => {
|
|
302
302
|
MultiRecordSelection.changeCheckboxState(checkbox, false);
|
|
303
303
|
});
|
|
304
304
|
break;
|
|
305
305
|
case CheckboxActions.toggle:
|
|
306
|
-
checkboxes.forEach((checkbox
|
|
306
|
+
checkboxes.forEach((checkbox) => {
|
|
307
307
|
MultiRecordSelection.changeCheckboxState(checkbox, !checkbox.checked);
|
|
308
308
|
});
|
|
309
309
|
break;
|
|
@@ -438,7 +438,7 @@ class MultiRecordSelection {
|
|
|
438
438
|
const end = checkboxes.indexOf(this.lastChecked);
|
|
439
439
|
// Get the checkboxes which should be changed (we use min() and max() to allow ranges in both directions)
|
|
440
440
|
const checkboxesToChange = checkboxes.slice(Math.min(start, end), Math.max(start, end) + 1);
|
|
441
|
-
checkboxesToChange.forEach((checkbox
|
|
441
|
+
checkboxesToChange.forEach((checkbox): void => {
|
|
442
442
|
// Change the state of each checkbox in question. Do not change the current target since we
|
|
443
443
|
// use it's current checked state, making both "check all" and "uncheck all" possible.
|
|
444
444
|
if (checkbox !== target) {
|
|
@@ -452,7 +452,7 @@ class MultiRecordSelection {
|
|
|
452
452
|
|
|
453
453
|
// With the alt or ctrl key, it's possible to toggle the current selection
|
|
454
454
|
if (e.altKey || e.ctrlKey) {
|
|
455
|
-
MultiRecordSelection.getCheckboxes(CheckboxState.any, identifier).forEach((checkbox
|
|
455
|
+
MultiRecordSelection.getCheckboxes(CheckboxState.any, identifier).forEach((checkbox): void => {
|
|
456
456
|
// Toggle all checkboxes except the current target as this was already done by clicking on it
|
|
457
457
|
if (checkbox !== target) {
|
|
458
458
|
MultiRecordSelection.changeCheckboxState(checkbox, !checkbox.checked);
|
|
@@ -293,7 +293,7 @@ class MultiStepWizard {
|
|
|
293
293
|
this.initializeSlidePrevEvent($modal);
|
|
294
294
|
|
|
295
295
|
// Event fires when the slide transition is invoked
|
|
296
|
-
this.setup.$carousel.get(0).addEventListener('slide.bs.carousel', (evt
|
|
296
|
+
this.setup.$carousel.get(0).addEventListener('slide.bs.carousel', (evt): void => {
|
|
297
297
|
if (evt.direction === 'left') {
|
|
298
298
|
this.nextSlideChanges($modal);
|
|
299
299
|
} else {
|
|
@@ -302,7 +302,7 @@ class MultiStepWizard {
|
|
|
302
302
|
});
|
|
303
303
|
|
|
304
304
|
// Event is fired when the carousel has completed its slide transition
|
|
305
|
-
this.setup.$carousel.get(0).addEventListener('slid.bs.carousel', (evt
|
|
305
|
+
this.setup.$carousel.get(0).addEventListener('slid.bs.carousel', (evt): void => {
|
|
306
306
|
const currentIndex = this.setup.$carousel.data('currentIndex');
|
|
307
307
|
const slide = this.setup.slides[currentIndex];
|
|
308
308
|
|
|
@@ -567,3 +567,10 @@ if (!multistepWizardObject) {
|
|
|
567
567
|
}
|
|
568
568
|
|
|
569
569
|
export default multistepWizardObject;
|
|
570
|
+
|
|
571
|
+
declare global {
|
|
572
|
+
interface HTMLElementEventMap {
|
|
573
|
+
'slide.bs.carousel': Event & Carousel.Event;
|
|
574
|
+
'slid.bs.carousel': Event & Carousel.Event;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
@@ -89,10 +89,10 @@ class NewMultiplePages {
|
|
|
89
89
|
* @private
|
|
90
90
|
*/
|
|
91
91
|
private resetFieldAttributes(this: HTMLInputElement): void {
|
|
92
|
-
document.querySelectorAll(Identifiers.containerSelector + ' ' + Identifiers.pageTitleSelector).forEach((inputElement
|
|
92
|
+
document.querySelectorAll<HTMLInputElement>(Identifiers.containerSelector + ' ' + Identifiers.pageTitleSelector).forEach((inputElement): void => {
|
|
93
93
|
inputElement.removeAttribute('value');
|
|
94
94
|
});
|
|
95
|
-
document.querySelectorAll(Identifiers.containerSelector + ' ' + Identifiers.doktypeSelector).forEach((selectElement
|
|
95
|
+
document.querySelectorAll<HTMLSelectElement>(Identifiers.containerSelector + ' ' + Identifiers.doktypeSelector).forEach((selectElement): void => {
|
|
96
96
|
for (const option of selectElement) {
|
|
97
97
|
option.removeAttribute('selected');
|
|
98
98
|
}
|
|
@@ -92,19 +92,19 @@ export class Category {
|
|
|
92
92
|
return new Category(
|
|
93
93
|
data.identifier,
|
|
94
94
|
data.label,
|
|
95
|
-
data.items.map((item
|
|
95
|
+
data.items.map((item) => Item.fromData(item))
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
public reset(): void {
|
|
100
100
|
this.disabled = false;
|
|
101
|
-
this.items.forEach((item
|
|
101
|
+
this.items.forEach((item): void => {
|
|
102
102
|
item.reset();
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
public activeItems(): Item[] {
|
|
107
|
-
return this.items.filter((item
|
|
107
|
+
return this.items.filter((item): boolean => item.visible) ?? [];
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -116,18 +116,18 @@ export class Categories {
|
|
|
116
116
|
|
|
117
117
|
public static fromData(data: DataCategoriesInterface) {
|
|
118
118
|
return new Categories(
|
|
119
|
-
Object.values(data).map((item
|
|
119
|
+
Object.values(data).map((item) => Category.fromData(item))
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
public reset(): void {
|
|
124
|
-
this.items.forEach((item
|
|
124
|
+
this.items.forEach((item): void => {
|
|
125
125
|
item.reset();
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
public categoriesWithItems(): Category[] {
|
|
130
|
-
return this.items.filter((item
|
|
130
|
+
return this.items.filter((item): boolean => item.activeItems().length > 0) ?? [];
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -488,11 +488,11 @@ export class NewRecordWizard extends LitElement {
|
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
const needsCategoryChange: boolean = this.categories.categoriesWithItems()
|
|
491
|
-
.filter((item
|
|
491
|
+
.filter((item): boolean => item === this.selectedCategory).length === 0;
|
|
492
492
|
if (needsCategoryChange) {
|
|
493
493
|
if (savedCategoryIdentifier) {
|
|
494
494
|
this.selectedCategory = this.categories.categoriesWithItems().find(
|
|
495
|
-
(category
|
|
495
|
+
(category): boolean => category.identifier === savedCategoryIdentifier
|
|
496
496
|
) ?? this.categories.categoriesWithItems()[0] ?? null;
|
|
497
497
|
} else {
|
|
498
498
|
this.selectedCategory = this.categories.categoriesWithItems()[0] ?? null;
|
|
@@ -516,16 +516,16 @@ export class NewRecordWizard extends LitElement {
|
|
|
516
516
|
protected filter(searchTerm: string): void {
|
|
517
517
|
this.searchTerm = searchTerm;
|
|
518
518
|
this.categories.reset();
|
|
519
|
-
this.categories.items.forEach((category
|
|
519
|
+
this.categories.items.forEach((category) => {
|
|
520
520
|
const categoryText = category.label.trim().replace(/\s+/g, ' ');
|
|
521
521
|
const categoryMatch: boolean = !(this.searchTerm !== '' && !RegExp(this.searchTerm, 'i').test(categoryText));
|
|
522
522
|
if (!categoryMatch) {
|
|
523
|
-
category.items.forEach((item
|
|
523
|
+
category.items.forEach((item) => {
|
|
524
524
|
const text = item.label.trim().replace(/\s+/g, ' ') + item.description?.trim().replace(/\s+/g, ' ');
|
|
525
525
|
item.visible = !(this.searchTerm !== '' && !RegExp(this.searchTerm, 'i').test(text));
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
|
-
category.disabled = category.items.filter((item
|
|
528
|
+
category.disabled = category.items.filter((item): boolean => item.visible).length === 0;
|
|
529
529
|
});
|
|
530
530
|
this.selectAvailableCategory();
|
|
531
531
|
}
|
|
@@ -601,7 +601,7 @@ export class NewRecordWizard extends LitElement {
|
|
|
601
601
|
protected renderNavigationList(): TemplateResult {
|
|
602
602
|
return html`
|
|
603
603
|
<div class="navigation-list${(this.toggleMenu === true) ? ' show' : ''}" role="tablist" aria-orientation="vertical">
|
|
604
|
-
${this.categories.items.map((category
|
|
604
|
+
${this.categories.items.map((category) => {
|
|
605
605
|
return html`
|
|
606
606
|
<button
|
|
607
607
|
data-identifier="${category.identifier}"
|
|
@@ -633,7 +633,7 @@ export class NewRecordWizard extends LitElement {
|
|
|
633
633
|
|
|
634
634
|
protected handleNavigationKeydown(event: KeyboardEvent, category: Category): void {
|
|
635
635
|
const activeCategories = this.categories.categoriesWithItems();
|
|
636
|
-
const currentIndex = activeCategories.findIndex((item
|
|
636
|
+
const currentIndex = activeCategories.findIndex((item): boolean => item.identifier === category.identifier);
|
|
637
637
|
let selectedCategory: Category | undefined = undefined;
|
|
638
638
|
|
|
639
639
|
if (event.key === KeyTypesEnum.UP) {
|
|
@@ -654,7 +654,7 @@ export class NewRecordWizard extends LitElement {
|
|
|
654
654
|
protected renderCategories(): TemplateResult {
|
|
655
655
|
return html`
|
|
656
656
|
<div class="elementwizard-categories">
|
|
657
|
-
${this.categories.items.map((category
|
|
657
|
+
${this.categories.items.map((category) => {
|
|
658
658
|
return this.renderCategory(category);
|
|
659
659
|
})}
|
|
660
660
|
</div>
|
|
@@ -672,7 +672,7 @@ export class NewRecordWizard extends LitElement {
|
|
|
672
672
|
</div>`
|
|
673
673
|
: nothing}
|
|
674
674
|
<div class="elementwizard-category-items">
|
|
675
|
-
${category.items.map((item
|
|
675
|
+
${category.items.map((item) => this.renderCategoryItem(item))}
|
|
676
676
|
</div>
|
|
677
677
|
</div>` :
|
|
678
678
|
nothing
|
|
@@ -34,7 +34,7 @@ export interface PageWizardDataStore extends DataStore {
|
|
|
34
34
|
type PageWizardDataStoreKey = keyof PageWizardDataStore;
|
|
35
35
|
|
|
36
36
|
export interface PageWizardContext {
|
|
37
|
-
wizard: Wizard
|
|
37
|
+
wizard: Wizard<PageWizardDataStore>;
|
|
38
38
|
configuration?: PageWizardConfiguration,
|
|
39
39
|
getStoreData: <T extends PageWizardDataStoreKey>(key: T) => NoInfer<PageWizardDataStore[T]>;
|
|
40
40
|
setStoreData: <T extends PageWizardDataStoreKey>(key: T, value: NoInfer<PageWizardDataStore[T]>) => void;
|
|
@@ -50,7 +50,7 @@ export class PageWizard extends LitElement {
|
|
|
50
50
|
@state() steps: WizardStepInterface[] = [];
|
|
51
51
|
@state() submissionService: SubmissionServiceInterface;
|
|
52
52
|
|
|
53
|
-
@query('typo3-backend-wizard') wizard!: Wizard
|
|
53
|
+
@query('typo3-backend-wizard') wizard!: Wizard<PageWizardDataStore>;
|
|
54
54
|
|
|
55
55
|
private fixedSteps: WizardStepInterface[] = [];
|
|
56
56
|
|
|
@@ -102,12 +102,12 @@ export class DoktypeStep implements WizardStepInterface, WizardStepValueInterfac
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
const filteredDoktypes = doktypes
|
|
105
|
-
.filter((doktype
|
|
105
|
+
.filter((doktype) => doktype.value === '--div--' || doktype.label.toLowerCase().includes(this.searchTerm.toLowerCase()));
|
|
106
106
|
|
|
107
107
|
const groups: DoktypeGroup[] = [];
|
|
108
108
|
let currentGroup: DoktypeGroup = { label: '', items: [] };
|
|
109
109
|
|
|
110
|
-
filteredDoktypes.forEach((doktype
|
|
110
|
+
filteredDoktypes.forEach((doktype) => {
|
|
111
111
|
if (doktype.value === '--div--') {
|
|
112
112
|
if (currentGroup.items.length > 0) {
|
|
113
113
|
groups.push(currentGroup);
|
|
@@ -147,9 +147,9 @@ export class DoktypeStep implements WizardStepInterface, WizardStepValueInterfac
|
|
|
147
147
|
</div>
|
|
148
148
|
${finalGroups.length == 0 ? html`<div role="alert" class="alert alert-info">${labels.get('step.doktype.filter.noResults')}</div>` : nothing}
|
|
149
149
|
<div class="form-check-card-container">
|
|
150
|
-
${finalGroups.map((group
|
|
150
|
+
${finalGroups.map((group) => html`
|
|
151
151
|
${group.label ? html`<h3 class="form-check-card-container-headline">${group.label}</h3>` : nothing}
|
|
152
|
-
${group.items.map((doktype
|
|
152
|
+
${group.items.map((doktype) => html`
|
|
153
153
|
<div class="form-check form-check-type-card">
|
|
154
154
|
<input
|
|
155
155
|
class="form-check-input"
|
|
@@ -203,7 +203,7 @@ export class DoktypeStep implements WizardStepInterface, WizardStepValueInterfac
|
|
|
203
203
|
return [];
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
const selectedDoktype = this.task.value.find((doktype
|
|
206
|
+
const selectedDoktype = this.task.value.find((doktype) => doktype.value === selectedDoktypeKey);
|
|
207
207
|
if (!selectedDoktype) {
|
|
208
208
|
return [];
|
|
209
209
|
}
|
|
@@ -33,7 +33,7 @@ class PageTsConfigIncludes {
|
|
|
33
33
|
private async registerEventListeners(): Promise<void> {
|
|
34
34
|
await DocumentService.ready();
|
|
35
35
|
|
|
36
|
-
document.querySelectorAll('.t3js-pagetsconfig-includes-modal').forEach((link
|
|
36
|
+
document.querySelectorAll<HTMLAnchorElement>('.t3js-pagetsconfig-includes-modal').forEach((link): void => {
|
|
37
37
|
link.addEventListener('click', (e: Event): void => {
|
|
38
38
|
e.preventDefault();
|
|
39
39
|
|
package/backend/popover.ts
CHANGED
|
@@ -36,7 +36,7 @@ class Popover {
|
|
|
36
36
|
*/
|
|
37
37
|
public initialize(selector?: string): void {
|
|
38
38
|
selector = selector || this.DEFAULT_SELECTOR;
|
|
39
|
-
document.querySelectorAll(selector).forEach((element
|
|
39
|
+
document.querySelectorAll<HTMLElement>(selector).forEach((element): void => {
|
|
40
40
|
this.applyTitleIfAvailable(element);
|
|
41
41
|
new BootstrapPopover(element);
|
|
42
42
|
});
|
|
@@ -47,7 +47,7 @@ class Popover {
|
|
|
47
47
|
* Popover wrapper function
|
|
48
48
|
*/
|
|
49
49
|
public popover(element: NodeListOf<HTMLElement> | HTMLElement) {
|
|
50
|
-
this.toIterable(element).forEach((element
|
|
50
|
+
this.toIterable(element).forEach((element): void => {
|
|
51
51
|
this.applyTitleIfAvailable(element);
|
|
52
52
|
new BootstrapPopover(element);
|
|
53
53
|
});
|
|
@@ -138,12 +138,12 @@ class Popover {
|
|
|
138
138
|
popover.toggle();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
private toIterable(element: NodeListOf<HTMLElement> | HTMLElement | unknown):
|
|
142
|
-
let elementList;
|
|
141
|
+
private toIterable(element: NodeListOf<HTMLElement> | HTMLElement | unknown): NodeListOf<HTMLElement> | HTMLElement[] {
|
|
142
|
+
let elementList: NodeListOf<HTMLElement> | HTMLElement[];
|
|
143
143
|
if (element instanceof HTMLElement) {
|
|
144
144
|
elementList = [element];
|
|
145
145
|
} else if (element instanceof NodeList) {
|
|
146
|
-
elementList = element
|
|
146
|
+
elementList = element as NodeListOf<HTMLElement>;
|
|
147
147
|
} else {
|
|
148
148
|
throw `Cannot consume element of type ${element.constructor.name}, expected NodeListOf<HTMLElement> or HTMLElement`;
|
|
149
149
|
}
|
|
@@ -82,7 +82,7 @@ export class RecordDownloadButton extends PseudoButtonLitElement {
|
|
|
82
82
|
|
|
83
83
|
formatSelect.addEventListener('change', (e: Event): void => {
|
|
84
84
|
const selectetFormat: string = (<HTMLSelectElement>e.target).value;
|
|
85
|
-
formatOptions.forEach((option
|
|
85
|
+
formatOptions.forEach((option) => {
|
|
86
86
|
if (option.dataset.formatname !== selectetFormat) {
|
|
87
87
|
option.classList.add('hide');
|
|
88
88
|
} else {
|
package/backend/recordlist.ts
CHANGED
|
@@ -151,7 +151,7 @@ class Recordlist {
|
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
// Evaluate all checked records and if valid, add their uid to the list
|
|
154
|
-
eventDetails.checkboxes.forEach((checkbox
|
|
154
|
+
eventDetails.checkboxes.forEach((checkbox): void => {
|
|
155
155
|
const checkboxContainer: HTMLElement = checkbox.closest(MultiRecordSelectionSelectors.elementSelector);
|
|
156
156
|
if (checkboxContainer !== null && checkboxContainer.dataset[configuration.idField]) {
|
|
157
157
|
entityIdentifiers.push(checkboxContainer.dataset[configuration.idField]);
|
|
@@ -170,12 +170,12 @@ class Recordlist {
|
|
|
170
170
|
returnUrl = target.dataset.returnUrl || '';
|
|
171
171
|
columnsOnly = JSON.parse(target.dataset.columnsOnly || '{}');
|
|
172
172
|
// Check if there are selected records, which would limit the records to edit
|
|
173
|
-
const selection: NodeListOf<
|
|
173
|
+
const selection: NodeListOf<HTMLInputElement> = tableContainer.querySelectorAll(
|
|
174
174
|
this.identifier.entity + '[data-uid][data-table="' + tableName + '"] td.col-checkbox input[type="checkbox"]:checked'
|
|
175
175
|
);
|
|
176
176
|
if (selection.length) {
|
|
177
177
|
// If there are selected records, only those are added to the list
|
|
178
|
-
selection.forEach((entity
|
|
178
|
+
selection.forEach((entity): void => {
|
|
179
179
|
entityIdentifiers.push((entity.closest(this.identifier.entity + selector`[data-uid][data-table="${tableName}"]`) as HTMLElement).dataset.uid);
|
|
180
180
|
});
|
|
181
181
|
} else {
|
|
@@ -184,7 +184,7 @@ class Recordlist {
|
|
|
184
184
|
if (!entities.length) {
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
|
-
entities.forEach((entity
|
|
187
|
+
entities.forEach((entity): void => {
|
|
188
188
|
entityIdentifiers.push(entity.dataset.uid);
|
|
189
189
|
});
|
|
190
190
|
}
|
|
@@ -201,7 +201,7 @@ class Recordlist {
|
|
|
201
201
|
+ '&returnUrl=' + Recordlist.getReturnUrl(returnUrl);
|
|
202
202
|
|
|
203
203
|
if (columnsOnly.length > 0) {
|
|
204
|
-
editUrl += columnsOnly.map((column
|
|
204
|
+
editUrl += columnsOnly.map((column, i): string => '&columnsOnly[' + tableName + '][' + i + ']=' + column).join('');
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
window.location.href = editUrl;
|
|
@@ -273,7 +273,7 @@ class Recordlist {
|
|
|
273
273
|
};
|
|
274
274
|
|
|
275
275
|
private readonly registerPaginationEvents = (): void => {
|
|
276
|
-
document.querySelectorAll('.t3js-recordlist-paging').forEach((trigger
|
|
276
|
+
document.querySelectorAll<HTMLInputElement>('.t3js-recordlist-paging').forEach((trigger) => {
|
|
277
277
|
trigger.addEventListener('keydown', (e: KeyboardEvent) => {
|
|
278
278
|
if (e.key === 'Enter') {
|
|
279
279
|
e.preventDefault();
|
|
@@ -96,7 +96,7 @@ export class CspReports extends LitElement {
|
|
|
96
96
|
@state() selectedReport: SummarizedCspReport | null = null;
|
|
97
97
|
@state() suggestions: MutationSuggestion[] = [];
|
|
98
98
|
|
|
99
|
-
private peripheralEvent: RegularEvent
|
|
99
|
+
private peripheralEvent: RegularEvent<Event, HTMLElement>;
|
|
100
100
|
private previouslyFocusedRow: HTMLElement | null = null;
|
|
101
101
|
|
|
102
102
|
public override connectedCallback(): void {
|
|
@@ -154,7 +154,7 @@ export class CspReports extends LitElement {
|
|
|
154
154
|
${this.reports.length === 0 ? html`
|
|
155
155
|
<tr><td colspan="5">${labels.get('module.label.noEntriesAvailable')}</td></tr>
|
|
156
156
|
` : nothing}
|
|
157
|
-
${this.reports.map((report
|
|
157
|
+
${this.reports.map((report) => html`
|
|
158
158
|
<tr class=${classMap({ 'table-info': this.selectedReport === report })} data-mutation-group=${report.mutationHashes.join('-')}
|
|
159
159
|
@click=${() => this.selectReport(report)}
|
|
160
160
|
@keydown=${(e: KeyboardEvent) => this.handleReportKeydown(e, report)}
|
|
@@ -197,7 +197,7 @@ export class CspReports extends LitElement {
|
|
|
197
197
|
</span>
|
|
198
198
|
${labels.get('module.label.all')}
|
|
199
199
|
</button>
|
|
200
|
-
${this.scopes.map((scope
|
|
200
|
+
${this.scopes.map((scope) => html`
|
|
201
201
|
<li>
|
|
202
202
|
<button class="dropdown-item dropdown-item-spaced" title="${scope}" @click=${() => this.selectScope(scope)}>
|
|
203
203
|
<span class="${scope === this.selectedScope ? 'text-primary' : '' }">
|
|
@@ -272,10 +272,10 @@ export class CspReports extends LitElement {
|
|
|
272
272
|
<h3>${labels.get('module.label.suggestions')}</h3>
|
|
273
273
|
</div>
|
|
274
274
|
` : nothing}
|
|
275
|
-
${this.suggestions.map((suggestion
|
|
275
|
+
${this.suggestions.map((suggestion) => html`
|
|
276
276
|
<div class="card-body">
|
|
277
277
|
<h4>${suggestion.label || suggestion.identifier}</h4>
|
|
278
|
-
${suggestion.collection.mutations.map((mutation
|
|
278
|
+
${suggestion.collection.mutations.map((mutation) => html`
|
|
279
279
|
<p>
|
|
280
280
|
<i>${mutation.mode}</i>
|
|
281
281
|
<code>${mutation.directive}: ${mutation.sources.join(' ')}</code>
|
|
@@ -407,7 +407,7 @@ export class CspReports extends LitElement {
|
|
|
407
407
|
if (uuids.includes(this.selectedReport?.uuid)) {
|
|
408
408
|
this.selectedReport = null;
|
|
409
409
|
}
|
|
410
|
-
this.reports = this.reports.filter((report
|
|
410
|
+
this.reports = this.reports.filter((report) => !uuids.includes(report.uuid));
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
private invokeFetchReportsAction(): Promise<SummarizedCspReport[]> {
|
|
@@ -424,8 +424,8 @@ export class CspReports extends LitElement {
|
|
|
424
424
|
|
|
425
425
|
private invokeMutateReportAction(report: SummarizedCspReport, suggestion: MutationSuggestion) {
|
|
426
426
|
const summaries = this.reports
|
|
427
|
-
.filter((other
|
|
428
|
-
.map((other
|
|
427
|
+
.filter((other) => other.mutationHashes.includes(suggestion.hash))
|
|
428
|
+
.map((other) => other.summary);
|
|
429
429
|
return (new AjaxRequest(this.controlUri))
|
|
430
430
|
.post({ action: 'mutateReport', scope: report.scope, hmac: suggestion.hmac, suggestion, summaries })
|
|
431
431
|
.then((response: AjaxResponse) => response.resolve('application/json'))
|
package/backend/setup-module.ts
CHANGED
|
@@ -35,8 +35,8 @@ class SetupModule {
|
|
|
35
35
|
});
|
|
36
36
|
element.dispatchEvent(clickEvent);
|
|
37
37
|
}).delegateTo(document, '[data-event="click"][data-event-name]');
|
|
38
|
-
document.querySelectorAll('[data-setup-avatar-field]')
|
|
39
|
-
.forEach((fieldElement
|
|
38
|
+
document.querySelectorAll<HTMLElement>('[data-setup-avatar-field]')
|
|
39
|
+
.forEach((fieldElement): void => {
|
|
40
40
|
const fieldName = fieldElement.dataset.setupAvatarField;
|
|
41
41
|
const clearElement = document.getElementById('clear_button_' + fieldName);
|
|
42
42
|
const addElement = document.getElementById('add_button_' + fieldName);
|
|
@@ -174,8 +174,8 @@ export default class SortableTable {
|
|
|
174
174
|
icon.classList.remove('text-primary');
|
|
175
175
|
});
|
|
176
176
|
|
|
177
|
-
const menuIcons = table.tHead.querySelectorAll('.dropdown-toggle[data-sorting-toggle] + .dropdown-menu typo3-backend-icon');
|
|
178
|
-
menuIcons.forEach((menuIcon
|
|
177
|
+
const menuIcons = table.tHead.querySelectorAll<IconElement>('.dropdown-toggle[data-sorting-toggle] + .dropdown-menu typo3-backend-icon');
|
|
178
|
+
menuIcons.forEach((menuIcon) => {
|
|
179
179
|
menuIcon.identifier = 'empty-empty';
|
|
180
180
|
});
|
|
181
181
|
|
|
@@ -192,8 +192,8 @@ export default class SortableTable {
|
|
|
192
192
|
sortingIcon.identifier = 'actions-sort-amount-down';
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
const sortingButtons = sortingDropdown.querySelectorAll('.dropdown-item');
|
|
196
|
-
sortingButtons.forEach((button
|
|
195
|
+
const sortingButtons = sortingDropdown.querySelectorAll<HTMLButtonElement>('.dropdown-item');
|
|
196
|
+
sortingButtons.forEach((button) => {
|
|
197
197
|
const sortingButtonDirection = button.dataset.sortDirection;
|
|
198
198
|
const sortingButtonIcon = button.querySelector('typo3-backend-icon');
|
|
199
199
|
if (sortingButtonDirection === sortingCell.ariaSort) {
|
|
@@ -207,3 +207,9 @@ export default class SortableTable {
|
|
|
207
207
|
new TablesortWithButtons(table);
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
+
|
|
211
|
+
declare global {
|
|
212
|
+
interface HTMLElementEventMap {
|
|
213
|
+
'afterSort': CustomEvent;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
@@ -57,8 +57,8 @@ export default abstract class AbstractClientStorage {
|
|
|
57
57
|
}
|
|
58
58
|
prefix = this.keyPrefix + prefix;
|
|
59
59
|
Object.keys(this.storage)
|
|
60
|
-
.filter((key
|
|
61
|
-
.forEach((key
|
|
60
|
+
.filter((key) => key.startsWith(prefix))
|
|
61
|
+
.forEach((key) => this.storage.removeItem(key));
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
public clear(): void {
|
|
@@ -89,8 +89,8 @@ export class ModuleStateStorage {
|
|
|
89
89
|
public static purge(): void
|
|
90
90
|
{
|
|
91
91
|
Object.keys(sessionStorage)
|
|
92
|
-
.filter((key
|
|
93
|
-
.forEach((key
|
|
92
|
+
.filter((key) => key.startsWith(ModuleStateStorage.prefix))
|
|
93
|
+
.forEach((key) => sessionStorage.removeItem(key));
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
private static fetch(module: string): CurrentState|null {
|
|
@@ -31,9 +31,9 @@ describe('@typo3/backend/utility/dom-helper', () => {
|
|
|
31
31
|
const wrapperElement = document.createElement('div');
|
|
32
32
|
wrapperElement.append(document.createRange().createContextualFragment(markup));
|
|
33
33
|
|
|
34
|
-
const parents = DomHelper.parents(wrapperElement.querySelector('#enter-here'), '.dummy-matching-element');
|
|
34
|
+
const parents = DomHelper.parents<HTMLElement>(wrapperElement.querySelector('#enter-here'), '.dummy-matching-element');
|
|
35
35
|
expect(parents).to.length(3);
|
|
36
|
-
expect(parents.map((el
|
|
36
|
+
expect(parents.map((el) => el.tagName)).to.have.ordered.members(['SPAN', 'P', 'DIV']);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
it('nextAll() returns a proper list of all next elements', () => {
|
|
@@ -39,9 +39,9 @@ describe('@typo3/backend/form-engine/element/extra/select-box-filter', () => {
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
const visibleOptions = (): string[] => Array
|
|
42
|
-
.from(root.querySelectorAll('select[multiple] option'))
|
|
43
|
-
.filter((option
|
|
44
|
-
.map((option
|
|
42
|
+
.from(root.querySelectorAll<HTMLOptionElement>('select[multiple] option'))
|
|
43
|
+
.filter((option): boolean => !option.hidden)
|
|
44
|
+
.map((option): string => option.textContent);
|
|
45
45
|
|
|
46
46
|
const filterBy = (value: string): void => {
|
|
47
47
|
filterField.value = value;
|
|
@@ -35,7 +35,7 @@ type Values = any;
|
|
|
35
35
|
* @param {Function|Array|Object} values
|
|
36
36
|
* @param {Function} func
|
|
37
37
|
*/
|
|
38
|
-
function using(values: (() => Values)|Values, func: (...args:
|
|
38
|
+
function using(values: (() => Values)|Values, func: (...args: any[]) => void): void {
|
|
39
39
|
if (values instanceof Function) {
|
|
40
40
|
values = values();
|
|
41
41
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the TYPO3 CMS project.
|
|
3
|
+
*
|
|
4
|
+
* It is free software; you can redistribute it and/or modify it under
|
|
5
|
+
* the terms of the GNU General Public License, either version 2
|
|
6
|
+
* of the License, or any later version.
|
|
7
|
+
*
|
|
8
|
+
* For the full copyright and license information, please read the
|
|
9
|
+
* LICENSE.txt file that was distributed with this source code.
|
|
10
|
+
*
|
|
11
|
+
* The TYPO3 project - inspiring people to share!
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { expect } from '@open-wc/testing';
|
|
15
|
+
import { Tree } from '@typo3/backend/tree/tree.js';
|
|
16
|
+
import type { TreeNodeInterface } from '@typo3/backend/tree/tree-node.js';
|
|
17
|
+
import type { } from 'mocha';
|
|
18
|
+
|
|
19
|
+
class TestTree extends Tree {
|
|
20
|
+
public enhance(nodes: TreeNodeInterface[]): TreeNodeInterface[] {
|
|
21
|
+
return this.enhanceNodes(nodes);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
customElements.define('typo3-test-storage-tree', TestTree);
|
|
26
|
+
|
|
27
|
+
describe('file storage tree search', () => {
|
|
28
|
+
it('expands every matching storage root', () => {
|
|
29
|
+
const tree = document.createElement('typo3-test-storage-tree') as TestTree;
|
|
30
|
+
tree.searchTerm = 'needle';
|
|
31
|
+
const nodes = [
|
|
32
|
+
{ identifier: '1:/', depth: 0, loaded: false, hasChildren: true },
|
|
33
|
+
{ identifier: '1:/needle', depth: 1, loaded: true, hasChildren: false },
|
|
34
|
+
{ identifier: '2:/', depth: 0, loaded: false, hasChildren: true },
|
|
35
|
+
{ identifier: '2:/needle', depth: 1, loaded: true, hasChildren: false },
|
|
36
|
+
] as unknown as TreeNodeInterface[];
|
|
37
|
+
|
|
38
|
+
expect(tree.enhance(nodes).filter(node => node.depth === 0).map(node => node.__expanded))
|
|
39
|
+
.to.deep.equal([true, true]);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -119,7 +119,7 @@ export class FileStorageBrowser extends LitElement {
|
|
|
119
119
|
private readonly selectActiveNode = (evt: CustomEvent): void => {
|
|
120
120
|
// Activate the current node
|
|
121
121
|
const nodes = evt.detail.nodes as Array<TreeNodeInterface>;
|
|
122
|
-
evt.detail.nodes = nodes.map((node
|
|
122
|
+
evt.detail.nodes = nodes.map((node) => {
|
|
123
123
|
if (decodeURIComponent(node.identifier) === this.activeFolder) {
|
|
124
124
|
node.checked = true;
|
|
125
125
|
}
|