typo3-typescript-sources 14.3.5 → 14.3.7
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/.last-synced-tag +1 -1
- package/README-TYPO3.md +1 -1
- package/README.md +1 -1
- package/backend/element/contextual-record-edit-trigger.ts +9 -1
- package/backend/form-engine/element/extra/select-box-filter.ts +8 -5
- package/backend/form-engine/element/select-tree.ts +16 -2
- package/backend/form-engine/element/slug-element.ts +13 -5
- package/backend/form-engine/field-control/add-record.ts +27 -1
- package/backend/form-engine.ts +80 -1
- package/backend/layout-module/sticky-language-header.ts +186 -0
- package/backend/live-search/element/result/item/item.ts +2 -0
- package/backend/live-search/element/result/result-detail-container.ts +14 -1
- package/backend/localization/localization-wizard.ts +3 -0
- package/backend/localization/steps/handler-selection-step.ts +12 -17
- package/backend/localization/steps/mode-step.ts +9 -14
- package/backend/localization/steps/source-language-step.ts +8 -13
- package/backend/localization/steps/target-language-step.ts +12 -17
- package/backend/modal.ts +124 -1
- package/backend/module-docheader.ts +58 -0
- package/backend/page-wizard/steps/position-step.ts +5 -0
- package/backend/tests/form-engine/element/extra/select-box-filter-test.ts +215 -0
- package/backend/tests/form-engine/element/select-tree-test.ts +121 -0
- package/backend/tree/page-position-select.ts +25 -0
- package/backend/wizard/finisher/event-finisher.ts +62 -0
- package/backend/wizard/steps/finisher-step.ts +2 -2
- package/backend/wizard/wizard.ts +110 -7
- package/core/ajax/ajax-request.ts +18 -0
- package/core/tests/ajax/ajax-request-test.ts +1 -1
- package/core/tests/utility/text-normalizer-test.ts +138 -0
- package/core/utility/text-normalizer.ts +98 -0
- package/dashboard/dashboard-wizard.ts +86 -0
- package/dashboard/dashboard.ts +28 -76
- package/dashboard/wizard/finisher/dashboard-wizard-submission-service.ts +43 -0
- package/dashboard/wizard/steps/preset-step.ts +164 -0
- package/dashboard/wizard/steps/title-step.ts +90 -0
- package/form/backend/form-editor/core.ts +22 -9
- package/form/backend/form-editor/inspector-component.ts +61 -38
- package/form/backend/form-editor/stage-component.ts +2 -2
- package/form/backend/form-editor/view-model.ts +1 -1
- package/form/backend/form-wizard/form-wizard.ts +1 -0
- package/form/backend/form-wizard/steps/settings-step.ts +6 -13
- package/package.json +2 -2
- package/workspaces/backend.ts +7 -2
- package/workspaces/renderable/comment-view.ts +4 -2
- package/workspaces/renderable/record-table.ts +41 -4
- package/workspaces/workspaces.ts +65 -12
|
@@ -22,6 +22,7 @@ import Icons from '@typo3/backend/icons';
|
|
|
22
22
|
import Modal from '@typo3/backend/modal';
|
|
23
23
|
import { MessageUtility } from '@typo3/backend/utility/message-utility';
|
|
24
24
|
import Sortable from 'sortablejs';
|
|
25
|
+
import dompurify from 'dompurify';
|
|
25
26
|
import {
|
|
26
27
|
type PropertyGridEditorEntry,
|
|
27
28
|
PropertyGridEditorUpdateEvent
|
|
@@ -158,6 +159,37 @@ function getFormElementDefinition<T extends keyof FormElementDefinition>(
|
|
|
158
159
|
return getFormEditorApp().getFormElementDefinition(formElement, formElementDefinitionKey);
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
const DOMPURIFY_LABEL_CONFIG = {
|
|
163
|
+
ALLOWED_TAGS: ['abbr', 'b', 'br', 'code', 'em', 'i', 'kbd', 'span', 'strong', 'u'],
|
|
164
|
+
ALLOWED_ATTR: ['class', 'title', 'role'],
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const DOMPURIFY_DESCRIPTION_CONFIG = {
|
|
168
|
+
ALLOWED_TAGS: ['a', 'abbr', 'blockquote', 'b', 'br', 'code', 'em', 'i', 'kbd', 'li', 'p', 'pre', 'span', 'strong', 'u', 'ul', 'ol'],
|
|
169
|
+
ALLOWED_ATTR: ['class', 'href', 'title', 'target', 'role', 'rel'],
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Safely sets sanitized HTML as label content on a DOM element.
|
|
174
|
+
* Only phrasing content (inline elements) is allowed, as required by the HTML
|
|
175
|
+
* specification for <label> elements.
|
|
176
|
+
*/
|
|
177
|
+
function setLabelHtmlContent(element: HTMLElement | null | undefined, html: string): void {
|
|
178
|
+
if (element) {
|
|
179
|
+
element.innerHTML = dompurify.sanitize(html, DOMPURIFY_LABEL_CONFIG);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Safely sets sanitized HTML as description content on a DOM element.
|
|
185
|
+
* Allows limited block-level markup (e.g. <p>, <ul>) in addition to inline elements.
|
|
186
|
+
*/
|
|
187
|
+
function setHtmlContent(element: HTMLElement | null | undefined, html: string): void {
|
|
188
|
+
if (element) {
|
|
189
|
+
element.innerHTML = dompurify.sanitize(html, DOMPURIFY_DESCRIPTION_CONFIG);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
161
193
|
/**
|
|
162
194
|
* @publish view/inspector/editor/insert/perform
|
|
163
195
|
*/
|
|
@@ -853,7 +885,7 @@ export function renderCollectionElementSelectionEditor(
|
|
|
853
885
|
collectionContainer?.replaceChildren();
|
|
854
886
|
|
|
855
887
|
const labelEl = getHelper().getTemplatePropertyElement('label', editorHtml);
|
|
856
|
-
|
|
888
|
+
setLabelHtmlContent(labelEl, editorConfiguration.label);
|
|
857
889
|
const selectElement = getHelper().getTemplatePropertyElement('selectOptions', editorHtml) as HTMLSelectElement | null;
|
|
858
890
|
const hasAlreadySelectedCollectionElements = (
|
|
859
891
|
!getUtility().isUndefinedOrNull(alreadySelectedCollectionElements) &&
|
|
@@ -897,7 +929,7 @@ export function renderCollectionElementSelectionEditor(
|
|
|
897
929
|
selectGroup?.remove();
|
|
898
930
|
const labelNoSelect = getHelper().getTemplatePropertyElement('label-no-select', editorHtml);
|
|
899
931
|
if (hasAlreadySelectedCollectionElements) {
|
|
900
|
-
|
|
932
|
+
setLabelHtmlContent(labelNoSelect, editorConfiguration.label);
|
|
901
933
|
} else {
|
|
902
934
|
labelNoSelect?.remove();
|
|
903
935
|
}
|
|
@@ -1047,7 +1079,7 @@ export function renderCollectionElementHeaderEditor(
|
|
|
1047
1079
|
const panelTitle = getHelper().getTemplatePropertyElement('panel-title', editorHtml);
|
|
1048
1080
|
if (panelTitle) {
|
|
1049
1081
|
panelTitle.removeAttribute('data-template-property');
|
|
1050
|
-
panelTitle
|
|
1082
|
+
setLabelHtmlContent(panelTitle, editorConfiguration.label);
|
|
1051
1083
|
}
|
|
1052
1084
|
}
|
|
1053
1085
|
}
|
|
@@ -1075,7 +1107,7 @@ export function renderFileMaxSizeEditor(
|
|
|
1075
1107
|
if (editorConfiguration.label) {
|
|
1076
1108
|
const element = getHelper().getTemplatePropertyElement('label', editorHtml);
|
|
1077
1109
|
const maximumFileSize = element?.getAttribute(getHelper().getDomElementDataAttribute('maximumFileSize'));
|
|
1078
|
-
element
|
|
1110
|
+
setLabelHtmlContent(element, editorConfiguration.label.replace('{0}', maximumFileSize ?? ''));
|
|
1079
1111
|
}
|
|
1080
1112
|
}
|
|
1081
1113
|
|
|
@@ -1106,8 +1138,7 @@ export function renderTextEditor(
|
|
|
1106
1138
|
1475421056
|
|
1107
1139
|
);
|
|
1108
1140
|
|
|
1109
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1110
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1141
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1111
1142
|
renderDescription(editorConfiguration, editorHtml);
|
|
1112
1143
|
|
|
1113
1144
|
if (getUtility().isNonEmptyString(editorConfiguration.placeholder)) {
|
|
@@ -1194,8 +1225,7 @@ export function renderValidationErrorMessageEditor(
|
|
|
1194
1225
|
1489874124
|
|
1195
1226
|
);
|
|
1196
1227
|
|
|
1197
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1198
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1228
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1199
1229
|
renderDescription(editorConfiguration, editorHtml);
|
|
1200
1230
|
|
|
1201
1231
|
const propertyPath = getFormEditorApp().buildPropertyPath(editorConfiguration.propertyPath);
|
|
@@ -1254,8 +1284,7 @@ export function renderCountrySelectEditor(
|
|
|
1254
1284
|
collectionName
|
|
1255
1285
|
);
|
|
1256
1286
|
|
|
1257
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1258
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1287
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1259
1288
|
renderDescription(editorConfiguration, editorHtml);
|
|
1260
1289
|
|
|
1261
1290
|
const selectElement = getHelper().getTemplatePropertyElement('selectOptions', editorHtml) as HTMLSelectElement | null;
|
|
@@ -1326,8 +1355,7 @@ export function renderSingleSelectEditor(
|
|
|
1326
1355
|
collectionName
|
|
1327
1356
|
);
|
|
1328
1357
|
|
|
1329
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1330
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1358
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1331
1359
|
renderDescription(editorConfiguration, editorHtml);
|
|
1332
1360
|
|
|
1333
1361
|
const selectElement = getHelper().getTemplatePropertyElement('selectOptions', editorHtml) as HTMLSelectElement | null;
|
|
@@ -1386,8 +1414,7 @@ export function renderMultiSelectEditor(
|
|
|
1386
1414
|
collectionName
|
|
1387
1415
|
);
|
|
1388
1416
|
|
|
1389
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1390
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1417
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1391
1418
|
renderDescription(editorConfiguration, editorHtml);
|
|
1392
1419
|
|
|
1393
1420
|
const selectElement = getHelper().getTemplatePropertyElement('selectOptions', editorHtml) as HTMLSelectElement | null;
|
|
@@ -1457,8 +1484,7 @@ export function renderGridColumnViewPortConfigurationEditor(
|
|
|
1457
1484
|
return;
|
|
1458
1485
|
}
|
|
1459
1486
|
|
|
1460
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1461
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1487
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1462
1488
|
|
|
1463
1489
|
const viewportButtonSel = getHelper().getDomElementDataIdentifierSelector('viewportButton');
|
|
1464
1490
|
const viewportButtonTemplate = editorHtml.querySelector(viewportButtonSel)?.cloneNode(true) as HTMLElement | null;
|
|
@@ -1480,15 +1506,15 @@ export function renderGridColumnViewPortConfigurationEditor(
|
|
|
1480
1506
|
|
|
1481
1507
|
const labelEl = getHelper().getTemplatePropertyElement('numbersOfColumnsToUse-label', numbersOfColumnsTemplateClone);
|
|
1482
1508
|
if (labelEl) {
|
|
1483
|
-
labelEl
|
|
1509
|
+
setLabelHtmlContent(labelEl,
|
|
1484
1510
|
editorConfiguration.configurationOptions.numbersOfColumnsToUse.label
|
|
1485
1511
|
.replace('{@viewPortLabel}', element.dataset.viewPortLabel ?? '')
|
|
1486
|
-
)
|
|
1512
|
+
);
|
|
1487
1513
|
}
|
|
1488
1514
|
|
|
1489
1515
|
const descEl = getHelper().getTemplatePropertyElement('numbersOfColumnsToUse-description', numbersOfColumnsTemplateClone);
|
|
1490
1516
|
if (descEl) {
|
|
1491
|
-
descEl
|
|
1517
|
+
setHtmlContent(descEl, editorConfiguration.configurationOptions.numbersOfColumnsToUse.description);
|
|
1492
1518
|
}
|
|
1493
1519
|
|
|
1494
1520
|
const propertyPath = editorConfiguration.configurationOptions.numbersOfColumnsToUse.propertyPath
|
|
@@ -1579,8 +1605,7 @@ export function renderPropertyGridEditor(
|
|
|
1579
1605
|
1475419232
|
|
1580
1606
|
);
|
|
1581
1607
|
|
|
1582
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1583
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1608
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1584
1609
|
renderDescription(editorConfiguration, editorHtml);
|
|
1585
1610
|
|
|
1586
1611
|
const propertyPathPrefix = (() => {
|
|
@@ -1740,8 +1765,7 @@ export function renderRequiredValidatorEditor(
|
|
|
1740
1765
|
);
|
|
1741
1766
|
|
|
1742
1767
|
const validatorIdentifier = editorConfiguration.validatorIdentifier;
|
|
1743
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1744
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1768
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1745
1769
|
|
|
1746
1770
|
let propertyValue: string;
|
|
1747
1771
|
let propertyPath: string;
|
|
@@ -1767,11 +1791,15 @@ export function renderRequiredValidatorEditor(
|
|
|
1767
1791
|
const validationErrorMessageTemplateClone = validationErrorMessageTemplate?.cloneNode(true) as HTMLElement | null;
|
|
1768
1792
|
getEditorWrapperDomElement(editorHtml)?.after(validationErrorMessageTemplateClone);
|
|
1769
1793
|
|
|
1770
|
-
|
|
1771
|
-
|
|
1794
|
+
setLabelHtmlContent(
|
|
1795
|
+
getHelper().getTemplatePropertyElement('validationErrorMessage-label', validationErrorMessageTemplateClone),
|
|
1796
|
+
editorConfiguration.configurationOptions.validationErrorMessage.label
|
|
1797
|
+
);
|
|
1772
1798
|
|
|
1773
|
-
|
|
1774
|
-
|
|
1799
|
+
setHtmlContent(
|
|
1800
|
+
getHelper().getTemplatePropertyElement('validationErrorMessage-description', validationErrorMessageTemplateClone),
|
|
1801
|
+
editorConfiguration.configurationOptions.validationErrorMessage.description
|
|
1802
|
+
);
|
|
1775
1803
|
|
|
1776
1804
|
propertyData = getCurrentlySelectedFormElement().get(validationErrorMessagePropertyPath);
|
|
1777
1805
|
if (getUtility().isUndefinedOrNull(propertyData)) {
|
|
@@ -1863,8 +1891,7 @@ export function renderCheckboxEditor(
|
|
|
1863
1891
|
1476218674
|
|
1864
1892
|
);
|
|
1865
1893
|
|
|
1866
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1867
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1894
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1868
1895
|
renderDescription(editorConfiguration, editorHtml);
|
|
1869
1896
|
|
|
1870
1897
|
const propertyPath = getFormEditorApp()
|
|
@@ -1927,8 +1954,7 @@ export function renderTextareaEditor(
|
|
|
1927
1954
|
const propertyPath = getFormEditorApp()
|
|
1928
1955
|
.buildPropertyPath(editorConfiguration.propertyPath, collectionElementIdentifier, collectionName);
|
|
1929
1956
|
|
|
1930
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
1931
|
-
?.append(document.createTextNode(editorConfiguration.label));
|
|
1957
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
1932
1958
|
renderDescription(editorConfiguration, editorHtml);
|
|
1933
1959
|
|
|
1934
1960
|
const propertyData = getCurrentlySelectedFormElement().get(propertyPath);
|
|
@@ -2023,10 +2049,8 @@ export function renderTypo3WinBrowserEditor(
|
|
|
2023
2049
|
1477300590
|
|
2024
2050
|
);
|
|
2025
2051
|
|
|
2026
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
2027
|
-
|
|
2028
|
-
getHelper().getTemplatePropertyElement('buttonLabel', editorHtml)
|
|
2029
|
-
?.append(document.createTextNode(editorConfiguration.buttonLabel));
|
|
2052
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label);
|
|
2053
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('buttonLabel', editorHtml), editorConfiguration.buttonLabel);
|
|
2030
2054
|
renderDescription(editorConfiguration, editorHtml);
|
|
2031
2055
|
|
|
2032
2056
|
const formEl = editorHtml.querySelector('form');
|
|
@@ -2222,8 +2246,7 @@ export function renderDateEditor(
|
|
|
2222
2246
|
collectionName
|
|
2223
2247
|
);
|
|
2224
2248
|
|
|
2225
|
-
getHelper().getTemplatePropertyElement('label', editorHtml)
|
|
2226
|
-
?.append(document.createTextNode(editorConfiguration.label || ''));
|
|
2249
|
+
setLabelHtmlContent(getHelper().getTemplatePropertyElement('label', editorHtml), editorConfiguration.label || '');
|
|
2227
2250
|
renderDescription(editorConfiguration, editorHtml);
|
|
2228
2251
|
|
|
2229
2252
|
const editorElement = editorHtml.querySelector('typo3-form-date-editor');
|
|
@@ -2266,7 +2289,7 @@ export function renderDescription(
|
|
|
2266
2289
|
): void {
|
|
2267
2290
|
const descEl = getHelper().getTemplatePropertyElement('description', editorHtml);
|
|
2268
2291
|
if (getUtility().isNonEmptyString(editorConfiguration.description)) {
|
|
2269
|
-
|
|
2292
|
+
setHtmlContent(descEl, editorConfiguration.description);
|
|
2270
2293
|
} else {
|
|
2271
2294
|
descEl?.remove();
|
|
2272
2295
|
}
|
|
@@ -273,8 +273,8 @@ function renderNestedSortableListItem(formElement: FormElement): HTMLElement {
|
|
|
273
273
|
const childFormElements = formElement.get('renderables');
|
|
274
274
|
const hasChildren = Array.isArray(childFormElements) && childFormElements.length > 0;
|
|
275
275
|
|
|
276
|
-
// Show "Create new element" placeholder
|
|
277
|
-
if (!hasChildren) {
|
|
276
|
+
// Show "Create new element" placeholder only for composite containers (not SummaryPage).
|
|
277
|
+
if (!hasChildren && isCompositeFormElement) {
|
|
278
278
|
childList.append(createNewElementPlaceholder(formElement, 'inside'));
|
|
279
279
|
}
|
|
280
280
|
|
|
@@ -802,7 +802,7 @@ export function addAbstractViewValidationResults(): void {
|
|
|
802
802
|
const validationElement = getStage().getAbstractViewFormElementDomElement(validationResults[i].formElementIdentifierPath);
|
|
803
803
|
|
|
804
804
|
// Set invalid property on Lit web component (FormElementStageItem)
|
|
805
|
-
const stageItem = validationElement
|
|
805
|
+
const stageItem = validationElement?.querySelector('typo3-form-form-element-stage-item') as HTMLElement | null;
|
|
806
806
|
if (stageItem && 'invalid' in stageItem) {
|
|
807
807
|
(stageItem as any).invalid = true;
|
|
808
808
|
}
|
|
@@ -107,6 +107,7 @@ export class FormWizard extends LitElement {
|
|
|
107
107
|
<typo3-backend-wizard .steps="${this.steps}"
|
|
108
108
|
.submissionService="${this.submissionService}"
|
|
109
109
|
confirm-button-label="${formManagerLabels.get('formManager.newFormWizard.step1.title')}"
|
|
110
|
+
skip-summary
|
|
110
111
|
></typo3-backend-wizard>
|
|
111
112
|
`;
|
|
112
113
|
}
|
|
@@ -158,7 +158,6 @@ export class SettingsStep implements WizardStepInterface, WizardStepValueInterfa
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
private renderFormNameInput(): TemplateResult {
|
|
161
|
-
this.focusInput('#new-form-name');
|
|
162
161
|
return html `
|
|
163
162
|
<div class="form-group">
|
|
164
163
|
<label class="form-label" for="new-form-name">${formManagerLabels.get('formManager.form_name')}</label>
|
|
@@ -185,6 +184,11 @@ export class SettingsStep implements WizardStepInterface, WizardStepValueInterfa
|
|
|
185
184
|
|
|
186
185
|
let templatesFormGroup: TemplateResult | typeof nothing = nothing;
|
|
187
186
|
if (templates.length > 0) {
|
|
187
|
+
// Auto-select first template if none selected yet
|
|
188
|
+
if (!this.data.template) {
|
|
189
|
+
this.setValue({ template: templates[0].value });
|
|
190
|
+
}
|
|
191
|
+
|
|
188
192
|
templatesFormGroup = html `
|
|
189
193
|
<div class="form-group">
|
|
190
194
|
<label class="form-label" for="new-form-template">${formManagerLabels.get('formManager.form_template')}</label>
|
|
@@ -227,20 +231,9 @@ export class SettingsStep implements WizardStepInterface, WizardStepValueInterfa
|
|
|
227
231
|
}
|
|
228
232
|
|
|
229
233
|
private setPrototype(currentPrototype: string ): void {
|
|
230
|
-
const currentTemplates = this.context.formManager.getTemplatesForPrototype(currentPrototype);
|
|
231
|
-
|
|
232
234
|
this.setValue({
|
|
233
235
|
prototype: currentPrototype,
|
|
234
|
-
template:
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
private focusInput(selector: string): void {
|
|
239
|
-
this.context.wizard.updateComplete.then(() => {
|
|
240
|
-
const input = this.context.wizard.renderRoot.querySelector<HTMLInputElement>(selector);
|
|
241
|
-
if (input) {
|
|
242
|
-
input.focus();
|
|
243
|
-
}
|
|
236
|
+
template: ''
|
|
244
237
|
});
|
|
245
238
|
}
|
|
246
239
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typo3-typescript-sources",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.7",
|
|
4
4
|
"description": "TYPO3 Core TypeScript Sources - Extracted from TYPO3/typo3 repository",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"typo3": {
|
|
30
30
|
"sourceRepository": "https://github.com/TYPO3/typo3",
|
|
31
|
-
"sourceTag": "v14.3.
|
|
31
|
+
"sourceTag": "v14.3.7",
|
|
32
32
|
"sourcePath": "Build/Sources/TypeScript"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/workspaces/backend.ts
CHANGED
|
@@ -469,6 +469,7 @@ class Backend extends Workspaces {
|
|
|
469
469
|
}
|
|
470
470
|
|
|
471
471
|
const workspacesRecordTable = document.querySelector('typo3-workspaces-record-table');
|
|
472
|
+
workspacesRecordTable.additionalColumns = result.additionalColumns ?? {};
|
|
472
473
|
workspacesRecordTable.results = result.data;
|
|
473
474
|
}
|
|
474
475
|
|
|
@@ -517,9 +518,13 @@ class Backend extends Workspaces {
|
|
|
517
518
|
filterFields: true
|
|
518
519
|
}),
|
|
519
520
|
).then(async (response: AjaxResponse): Promise<void> => {
|
|
520
|
-
const
|
|
521
|
-
const
|
|
521
|
+
const details = await response.resolve();
|
|
522
|
+
const item = details[0]?.result.data[0];
|
|
523
|
+
if (item === undefined) {
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
522
526
|
|
|
527
|
+
const modalButtons = [];
|
|
523
528
|
const content = document.createElement('typo3-workspaces-record-information');
|
|
524
529
|
content.record = item;
|
|
525
530
|
|
|
@@ -16,12 +16,13 @@ import { html, LitElement, nothing, type TemplateResult } from 'lit';
|
|
|
16
16
|
import { repeat } from 'lit/directives/repeat.js';
|
|
17
17
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
18
18
|
import { nl2br } from '@typo3/core/directive/nl2br';
|
|
19
|
+
import labels from '~labels/workspaces.messages';
|
|
19
20
|
|
|
20
21
|
type Comment = {
|
|
21
22
|
user_comment: string;
|
|
22
23
|
previous_stage_title: string;
|
|
23
24
|
stage_title: string;
|
|
24
|
-
tstamp:
|
|
25
|
+
tstamp: string;
|
|
25
26
|
user_username: string;
|
|
26
27
|
user_avatar: string
|
|
27
28
|
};
|
|
@@ -64,7 +65,8 @@ export class CommentViewElement extends LitElement {
|
|
|
64
65
|
${comment.previous_stage_title} ⇾ ${comment.stage_title}
|
|
65
66
|
</span>
|
|
66
67
|
<span class="badge badge-info">
|
|
67
|
-
${comment.tstamp}
|
|
68
|
+
${comment.tstamp ? labels.get('comment.tstamp.value', { tstamp: new Date(comment.tstamp) }) : nothing}
|
|
69
|
+
</span>
|
|
68
70
|
</div>
|
|
69
71
|
</div>
|
|
70
72
|
</div>
|
|
@@ -24,6 +24,14 @@ import '@typo3/backend/element/icon-element';
|
|
|
24
24
|
import '@typo3/backend/element/qrcode-modal-button';
|
|
25
25
|
import 'bootstrap'; // for data-bs-toggle="dropdown"
|
|
26
26
|
|
|
27
|
+
export type AdditionalColumnValue = {
|
|
28
|
+
label?: string,
|
|
29
|
+
value?: string,
|
|
30
|
+
icon?: string,
|
|
31
|
+
title?: string,
|
|
32
|
+
url?: string
|
|
33
|
+
};
|
|
34
|
+
|
|
27
35
|
export type RecordData = {
|
|
28
36
|
table: string,
|
|
29
37
|
id: string,
|
|
@@ -38,7 +46,7 @@ export type RecordData = {
|
|
|
38
46
|
value_nextStage: number,
|
|
39
47
|
value_prevStage: number,
|
|
40
48
|
path_Workspace: string,
|
|
41
|
-
|
|
49
|
+
lastChanged: string,
|
|
42
50
|
lastEditorId: number,
|
|
43
51
|
lastEditorName: string,
|
|
44
52
|
lastEditorRealName: string,
|
|
@@ -67,7 +75,8 @@ export type RecordData = {
|
|
|
67
75
|
integrity: {
|
|
68
76
|
status: string,
|
|
69
77
|
messages: string
|
|
70
|
-
}
|
|
78
|
+
},
|
|
79
|
+
additional?: Record<string, AdditionalColumnValue>
|
|
71
80
|
};
|
|
72
81
|
|
|
73
82
|
@customElement('typo3-workspaces-record-table')
|
|
@@ -75,6 +84,12 @@ export class RecordTableElement extends LitElement {
|
|
|
75
84
|
@property({ type: Array })
|
|
76
85
|
public results: RecordData[] = [];
|
|
77
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Labels of columns added by third party extensions, indexed by column identifier.
|
|
89
|
+
*/
|
|
90
|
+
@property({ type: Object })
|
|
91
|
+
public additionalColumns: Record<string, string> = {};
|
|
92
|
+
|
|
78
93
|
private latestPath: string | null = null;
|
|
79
94
|
|
|
80
95
|
protected override createRenderRoot(): HTMLElement | ShadowRoot {
|
|
@@ -139,6 +154,7 @@ export class RecordTableElement extends LitElement {
|
|
|
139
154
|
<th class="col-state">${labels.get('column.wsStateAction')}</th>
|
|
140
155
|
<th class="col-state">${labels.get('column.integrity')}</th>
|
|
141
156
|
<th>${labels.get('column.stage')}</th>
|
|
157
|
+
${Object.values(this.additionalColumns).map((label: string) => html`<th>${label}</th>`)}
|
|
142
158
|
<th class="col-control nowrap">
|
|
143
159
|
<span class="visually-hidden">${coreLabels.get('labels._CONTROL_')}</span>
|
|
144
160
|
</th>
|
|
@@ -200,7 +216,7 @@ export class RecordTableElement extends LitElement {
|
|
|
200
216
|
return html`
|
|
201
217
|
${latestPathChanged ? html`
|
|
202
218
|
<tr>
|
|
203
|
-
<th colspan
|
|
219
|
+
<th colspan=${8 + Object.keys(this.additionalColumns).length} class="col-white-space-normal">
|
|
204
220
|
<a href=${data.urlToPage}>${data.path_Workspace}</a>
|
|
205
221
|
</th>
|
|
206
222
|
</tr>
|
|
@@ -251,7 +267,7 @@ export class RecordTableElement extends LitElement {
|
|
|
251
267
|
` : html`
|
|
252
268
|
<span class="text-variant">${labels.get('column.editor.unknown')}</span>
|
|
253
269
|
`}
|
|
254
|
-
${data.
|
|
270
|
+
${data.lastChanged ? labels.get('column.last_change.value', { last_change: new Date(data.lastChanged) }) : nothing}
|
|
255
271
|
</div>
|
|
256
272
|
</td>
|
|
257
273
|
<td class="col-state">
|
|
@@ -263,6 +279,7 @@ export class RecordTableElement extends LitElement {
|
|
|
263
279
|
</span>
|
|
264
280
|
` : nothing}</td>
|
|
265
281
|
<td>${data.label_Stage}</td>
|
|
282
|
+
${Object.keys(this.additionalColumns).map((identifier: string) => this.renderAdditionalColumn(data, identifier))}
|
|
266
283
|
<td class="col-control nowrap">
|
|
267
284
|
<div class="btn-group">${this.renderElementActions(data)}</div>
|
|
268
285
|
<div class="btn-group">${this.renderVersioningActions(data)}</div>
|
|
@@ -271,6 +288,26 @@ export class RecordTableElement extends LitElement {
|
|
|
271
288
|
`;
|
|
272
289
|
}
|
|
273
290
|
|
|
291
|
+
protected renderAdditionalColumn(data: RecordData, identifier: string): TemplateResult {
|
|
292
|
+
const column = data.additional?.[identifier];
|
|
293
|
+
if (column === undefined) {
|
|
294
|
+
return html`<td></td>`;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const content = html`
|
|
298
|
+
${column.icon ? html`
|
|
299
|
+
<typo3-backend-icon identifier=${column.icon} size="small"></typo3-backend-icon>
|
|
300
|
+
` : nothing}
|
|
301
|
+
${column.value ?? ''}
|
|
302
|
+
`;
|
|
303
|
+
|
|
304
|
+
return html`
|
|
305
|
+
<td title=${ifDefined(column.title || undefined)}>
|
|
306
|
+
${column.url ? html`<a href=${column.url}>${content}</a>` : content}
|
|
307
|
+
</td>
|
|
308
|
+
`;
|
|
309
|
+
}
|
|
310
|
+
|
|
274
311
|
protected renderIndent(level: number) {
|
|
275
312
|
return html`<span class="indent indent-inline-block" style="--indent-level: ${level}"></span>`;
|
|
276
313
|
}
|
package/workspaces/workspaces.ts
CHANGED
|
@@ -11,14 +11,28 @@
|
|
|
11
11
|
* The TYPO3 project - inspiring people to share!
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import
|
|
14
|
+
import { AjaxResponse } from '@typo3/core/ajax/ajax-response';
|
|
15
15
|
import AjaxRequest from '@typo3/core/ajax/ajax-request';
|
|
16
16
|
import { SeverityEnum } from '@typo3/backend/enum/severity';
|
|
17
17
|
import { ProgressBarElement } from '@typo3/backend/element/progress-bar-element';
|
|
18
|
+
import Notification from '@typo3/backend/notification';
|
|
18
19
|
import { default as Modal, type ModalElement } from '@typo3/backend/modal';
|
|
19
20
|
import { html } from 'lit';
|
|
20
21
|
import labels from '~labels/workspaces.messages';
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Result of a single call of a dispatched call stack, carrying either
|
|
25
|
+
* `result` if the call succeeded, or `error` if it did not.
|
|
26
|
+
*/
|
|
27
|
+
interface RemoteCallResult {
|
|
28
|
+
method: string;
|
|
29
|
+
result?: unknown;
|
|
30
|
+
error?: {
|
|
31
|
+
message: string;
|
|
32
|
+
code: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
export default class Workspaces {
|
|
23
37
|
protected readonly ajaxRoute: string = 'workspace_dispatch';
|
|
24
38
|
protected progressBar: ProgressBarElement | null = null;
|
|
@@ -73,18 +87,22 @@ export default class Workspaces {
|
|
|
73
87
|
this.progressBar = document.createElement('typo3-backend-progress-bar');
|
|
74
88
|
document.querySelector(progressContainer).prepend(this.progressBar);
|
|
75
89
|
this.progressBar.start();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
90
|
+
const headers = {
|
|
91
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
92
|
+
};
|
|
93
|
+
return new AjaxRequest(TYPO3.settings.ajaxUrls[this.ajaxRoute])
|
|
94
|
+
.post(payload, { headers })
|
|
95
|
+
.catch(async (reason: unknown): Promise<never> => {
|
|
96
|
+
await this.notifyRequestFailure(reason);
|
|
97
|
+
// Rejection is kept up, so that callers do not continue with a payload
|
|
98
|
+
// that carries errors instead of the results they are written for.
|
|
99
|
+
throw reason;
|
|
100
|
+
})
|
|
101
|
+
.finally(() => {
|
|
102
|
+
if (this.progressBar) {
|
|
103
|
+
this.progressBar.done();
|
|
81
104
|
}
|
|
82
|
-
}
|
|
83
|
-
).finally(() => {
|
|
84
|
-
if (this.progressBar) {
|
|
85
|
-
this.progressBar.done();
|
|
86
|
-
}
|
|
87
|
-
});
|
|
105
|
+
});
|
|
88
106
|
}
|
|
89
107
|
|
|
90
108
|
/**
|
|
@@ -105,4 +123,39 @@ export default class Workspaces {
|
|
|
105
123
|
method: method,
|
|
106
124
|
};
|
|
107
125
|
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Reports a failed request to the user. The server describes failing calls in the
|
|
129
|
+
* JSON body, anything else - an unreachable server, a session timeout redirect or
|
|
130
|
+
* an error page that is no JSON at all - can only be reported in a generic way.
|
|
131
|
+
*/
|
|
132
|
+
private async notifyRequestFailure(reason: unknown): Promise<void> {
|
|
133
|
+
const title = labels.get('error.dispatch.title');
|
|
134
|
+
if (!(reason instanceof AjaxResponse)) {
|
|
135
|
+
Notification.error(title, labels.get('error.dispatch.unavailable'));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let details: unknown;
|
|
140
|
+
try {
|
|
141
|
+
details = await reason.resolve('json');
|
|
142
|
+
} catch {
|
|
143
|
+
Notification.error(title, labels.get('error.dispatch.unavailable'));
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const messages: string[] = [];
|
|
148
|
+
if (Array.isArray(details)) {
|
|
149
|
+
for (const item of details as RemoteCallResult[]) {
|
|
150
|
+
if (item?.error?.message) {
|
|
151
|
+
messages.push(item.error.message);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (messages.length === 0) {
|
|
156
|
+
Notification.error(title, labels.get('error.dispatch.unknown'));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
messages.forEach((message: string): void => Notification.error(title, message));
|
|
160
|
+
}
|
|
108
161
|
}
|