@brightspace-ui/core 2.184.7 → 2.186.0
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/components/form/form.js +37 -17
- package/helpers/mathjax.js +10 -1
- package/lang/ar.js +2 -3
- package/lang/cy.js +2 -3
- package/lang/da.js +2 -3
- package/lang/de.js +2 -3
- package/lang/en-gb.js +2 -3
- package/lang/en.js +2 -3
- package/lang/es-es.js +2 -3
- package/lang/es.js +2 -3
- package/lang/fr-fr.js +2 -3
- package/lang/fr.js +2 -3
- package/lang/hi.js +2 -3
- package/lang/ja.js +2 -3
- package/lang/ko.js +2 -3
- package/lang/nl.js +2 -3
- package/lang/pt.js +2 -3
- package/lang/sv.js +2 -3
- package/lang/tr.js +2 -3
- package/lang/zh-cn.js +2 -3
- package/lang/zh-tw.js +2 -3
- package/package.json +1 -1
- package/templates/primary-secondary/primary-secondary.js +62 -36
- package/tools/mathjax-test-context.js +2 -1
package/components/form/form.js
CHANGED
@@ -51,7 +51,7 @@ class Form extends FormMixin(LitElement) {
|
|
51
51
|
disconnectedCallback() {
|
52
52
|
super.disconnectedCallback();
|
53
53
|
/** @ignore */
|
54
|
-
this.dispatchEvent(new CustomEvent('d2l-form-
|
54
|
+
this.dispatchEvent(new CustomEvent('d2l-form-disconnect'));
|
55
55
|
this._isSubForm = false;
|
56
56
|
}
|
57
57
|
|
@@ -85,11 +85,15 @@ class Form extends FormMixin(LitElement) {
|
|
85
85
|
const errorMap = new Map();
|
86
86
|
const formElements = this._findFormElements();
|
87
87
|
for (const ele of formElements) {
|
88
|
-
if (this.
|
89
|
-
const
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
if (this._hasSubForms(ele)) {
|
89
|
+
const forms = this._getSubForms(ele);
|
90
|
+
for (const form of forms) {
|
91
|
+
if (!form.noNesting) {
|
92
|
+
const formErrors = await form.validate();
|
93
|
+
for (const [key, val] of formErrors) {
|
94
|
+
errorMap.set(key, val);
|
95
|
+
}
|
96
|
+
}
|
93
97
|
}
|
94
98
|
} else {
|
95
99
|
const eleErrors = await this._validateFormElement(ele, true);
|
@@ -112,16 +116,16 @@ class Form extends FormMixin(LitElement) {
|
|
112
116
|
}
|
113
117
|
|
114
118
|
_findFormElements() {
|
115
|
-
const isFormElementPredicate = ele => this.
|
116
|
-
const visitChildrenPredicate = ele => !this.
|
119
|
+
const isFormElementPredicate = ele => this._hasSubForms(ele);
|
120
|
+
const visitChildrenPredicate = ele => !this._hasSubForms(ele);
|
117
121
|
return findFormElements(this, isFormElementPredicate, visitChildrenPredicate);
|
118
122
|
}
|
119
123
|
|
120
|
-
|
124
|
+
_getSubForms(ele) {
|
121
125
|
return this._nestedForms.get(ele);
|
122
126
|
}
|
123
127
|
|
124
|
-
|
128
|
+
_hasSubForms(ele) {
|
125
129
|
return this._nestedForms.has(ele);
|
126
130
|
}
|
127
131
|
|
@@ -136,13 +140,27 @@ class Form extends FormMixin(LitElement) {
|
|
136
140
|
e.stopPropagation();
|
137
141
|
e.preventDefault();
|
138
142
|
const form = e.composedPath()[0];
|
139
|
-
|
143
|
+
|
144
|
+
if (!this._nestedForms.has(e.target)) {
|
145
|
+
this._nestedForms.set(e.target, []);
|
146
|
+
}
|
147
|
+
this._nestedForms.get(e.target).push(form);
|
140
148
|
|
141
149
|
const onFormDisconnect = () => {
|
142
150
|
form.removeEventListener('d2l-form-disconnect', onFormDisconnect);
|
143
|
-
this._nestedForms.
|
151
|
+
if (this._nestedForms.has(e.target)) {
|
152
|
+
const forms = this._nestedForms.get(e.target);
|
153
|
+
const index = forms.indexOf(form);
|
154
|
+
if (index > -1) {
|
155
|
+
forms.splice(index, 1);
|
156
|
+
}
|
157
|
+
if (forms.length === 0) {
|
158
|
+
this._nestedForms.delete(e.target);
|
159
|
+
}
|
160
|
+
}
|
144
161
|
};
|
145
162
|
form.addEventListener('d2l-form-disconnect', onFormDisconnect);
|
163
|
+
|
146
164
|
}
|
147
165
|
|
148
166
|
async _submitData(submitter) {
|
@@ -154,11 +172,13 @@ class Form extends FormMixin(LitElement) {
|
|
154
172
|
const eleData = getFormElementData(ele, submitter);
|
155
173
|
if (isCustomFormElement(ele) || isNativeFormElement(ele)) {
|
156
174
|
formData = { ...formData, ...eleData };
|
157
|
-
} else if (this.
|
158
|
-
const
|
159
|
-
|
160
|
-
form.
|
161
|
-
|
175
|
+
} else if (this._hasSubForms(ele)) {
|
176
|
+
const forms = this._getSubForms(ele);
|
177
|
+
forms.forEach(form => {
|
178
|
+
if (!form.noNesting) {
|
179
|
+
form._submitData(submitter);
|
180
|
+
}
|
181
|
+
});
|
162
182
|
}
|
163
183
|
}
|
164
184
|
/** Dispatched when the form is submitted. The form data can be obtained from the `detail`'s `formData` property. */
|
package/helpers/mathjax.js
CHANGED
@@ -47,6 +47,7 @@ class HtmlBlockMathRenderer {
|
|
47
47
|
|
48
48
|
const mathJaxConfig = {
|
49
49
|
deferTypeset: true,
|
50
|
+
enableMML3Support: context.enableMML3Support,
|
50
51
|
renderLatex: context.renderLatex,
|
51
52
|
outputScale: context.outputScale || 1,
|
52
53
|
window: window
|
@@ -102,7 +103,15 @@ export function loadMathJax(mathJaxConfig) {
|
|
102
103
|
settings: { zoom: 'None' }
|
103
104
|
}
|
104
105
|
},
|
105
|
-
loader: {
|
106
|
+
loader: {
|
107
|
+
load: mathJaxConfig && mathJaxConfig.enableMML3Support
|
108
|
+
? [
|
109
|
+
'[mml]/mml3',
|
110
|
+
'ui/menu'
|
111
|
+
] : [
|
112
|
+
'ui/menu'
|
113
|
+
]
|
114
|
+
},
|
106
115
|
startup: {
|
107
116
|
ready: () => {
|
108
117
|
|
package/lang/ar.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "مسافة للخلف/حذف",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "حذف العلامة المركّز عليها",
|
125
125
|
"components.tag-list-item.tooltip-title": "عناصر التحكم في لوحة المفاتيح",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "السهم المتّجه إلى الأعلى أو إلى الأسفل لضبط حجم لوحات العرض"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/cy.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Yn ôl/Dileu",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Dileu’r tag â ffocws",
|
125
125
|
"components.tag-list-item.tooltip-title": "Rheolyddion Bysellfwrdd",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Saeth i fyny neu i lawr i addasu maint y paneli gweld"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/da.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Tilbage/Slet",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Slet det fokuserede tag",
|
125
125
|
"components.tag-list-item.tooltip-title": "Kontrolelementer på tastaturet",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Pil op eller ned for at justere størrelsen på visningspaneler"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/de.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Rücktaste/Entfernen",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Ausgewählten Tag löschen",
|
125
125
|
"components.tag-list-item.tooltip-title": "Tastatursteuerung",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Pfeil nach oben oder unten, um die Größe der Ansichtsbereiche anzupassen"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/en-gb.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Backspace/Delete",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Delete the focused tag",
|
125
125
|
"components.tag-list-item.tooltip-title": "Keyboard Controls",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Arrow up or down to adjust the size of the view panels"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/en.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Backspace/Delete",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Delete the focused tag",
|
125
125
|
"components.tag-list-item.tooltip-title": "Keyboard Controls",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Arrow up or down to adjust the size of the view panels"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/es-es.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Retroceso/Eliminar",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Eliminar la etiqueta seleccionada",
|
125
125
|
"components.tag-list-item.tooltip-title": "Controles del teclado",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Flecha hacia arriba o abajo para ajustar el tamaño de los paneles de visualización"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/es.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Retroceso/Suprimir",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Eliminar la etiqueta enfocada",
|
125
125
|
"components.tag-list-item.tooltip-title": "Controles del teclado",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Utilice la flecha hacia arriba o hacia abajo para ajustar el tamaño de los paneles de visualización"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/fr-fr.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Retour arrière/Supprimer",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Supprimez l’étiquette ciblée",
|
125
125
|
"components.tag-list-item.tooltip-title": "Commandes du clavier",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Flèche vers le haut ou vers le bas pour régler la taille des panneaux d’affichage"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/fr.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Retour arrière/suppression",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Supprimer la balise ciblée",
|
125
125
|
"components.tag-list-item.tooltip-title": "Commandes du clavier",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Flèche vers le haut ou vers le bas pour régler la taille des volets d'affichage"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/hi.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "बैकस्पेस/हटाएँ",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "फ़ोकिस किए हुए टैग को हटाएँ",
|
125
125
|
"components.tag-list-item.tooltip-title": "कीबोर्ड कंट्रोल",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "दृश्य पैनल्स का आकार समायोजित करने के लिए तीर ऊपर या नीचे करें"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/ja.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Backspace キー/Delete キー",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "フォーカスされたタグを削除します",
|
125
125
|
"components.tag-list-item.tooltip-title": "キーボードコントロール",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "上矢印または下矢印を使用して、ビューパネルのサイズを調整します"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/ko.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "백스페이스/삭제",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "포커스된 태그를 삭제합니다",
|
125
125
|
"components.tag-list-item.tooltip-title": "키보드 컨트롤",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "위 또는 아래 화살표로 보기 패널의 크기 조정"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/nl.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Backspace/Verwijderen",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Verwijder de gerichte tag",
|
125
125
|
"components.tag-list-item.tooltip-title": "Bedieningselementen op het toetsenbord",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Pijl omhoog of omlaag om de grootte van de weergavevensters aan te passen"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/pt.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Retroceder/Excluir",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Excluir a marca de foco",
|
125
125
|
"components.tag-list-item.tooltip-title": "Controles do teclado",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Use a seta para cima ou para baixo para ajustar o tamanho dos painéis de exibição"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/sv.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Backstegstangenten/Delete-tangenten",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Ta bort den fokuserade taggen",
|
125
125
|
"components.tag-list-item.tooltip-title": "Tangentbordskontroller",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Pil upp eller ned för att justera storleken på vypaneler"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/tr.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "Geri Al/Sil",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "Odaklanılan etiketi sil",
|
125
125
|
"components.tag-list-item.tooltip-title": "Klavye Kontrolleri",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "Görüntü panellerinin boyutunu ayarlamak için yukarı veya aşağı okları kullanın"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/zh-cn.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "退格键/Delete 键",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "删除具有焦点的标签",
|
125
125
|
"components.tag-list-item.tooltip-title": "键盘控制",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "向上或向下箭头可调整视图面板的大小"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/lang/zh-tw.js
CHANGED
@@ -123,7 +123,6 @@ export default {
|
|
123
123
|
"components.tag-list-item.tooltip-delete-key": "退格/刪除",
|
124
124
|
"components.tag-list-item.tooltip-delete-key-desc": "刪除對焦標記",
|
125
125
|
"components.tag-list-item.tooltip-title": "鍵盤控制項",
|
126
|
-
"templates.primary-secondary.
|
127
|
-
"templates.primary-secondary.
|
128
|
-
"templates.primary-secondary.keyboardVertical": "向上或向下箭頭可調整檢視面板的大小"
|
126
|
+
"templates.primary-secondary.divider": "Secondary panel divider",
|
127
|
+
"templates.primary-secondary.secondary-panel": "Secondary panel"
|
129
128
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.186.0",
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
5
5
|
"type": "module",
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|
@@ -4,9 +4,8 @@ import '../../components/icons/icon.js';
|
|
4
4
|
import '../../components/offscreen/offscreen.js';
|
5
5
|
import { css, html, LitElement, unsafeCSS } from 'lit';
|
6
6
|
import { classMap } from 'lit/directives/class-map.js';
|
7
|
+
import { formatPercent } from '@brightspace-ui/intl';
|
7
8
|
import { getFocusPseudoClass } from '../../helpers/focus.js';
|
8
|
-
import { getUniqueId } from '../../helpers/uniqueId.js';
|
9
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
10
9
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
11
10
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
12
11
|
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
@@ -591,7 +590,8 @@ class TemplatePrimarySecondary extends RtlMixin(LocalizeCoreElement(LitElement))
|
|
591
590
|
_isCollapsed: { type: Boolean, attribute: false },
|
592
591
|
_isExpanded: { type: Boolean, attribute: false },
|
593
592
|
_isMobile: { type: Boolean, attribute: false },
|
594
|
-
_size: { type: Number, attribute: false }
|
593
|
+
_size: { type: Number, attribute: false },
|
594
|
+
_sizeAsPercent: { state: true }
|
595
595
|
};
|
596
596
|
}
|
597
597
|
|
@@ -681,7 +681,8 @@ class TemplatePrimarySecondary extends RtlMixin(LocalizeCoreElement(LitElement))
|
|
681
681
|
:host([resizable]:not([dir="rtl"])[secondary-first]) aside {
|
682
682
|
float: right;
|
683
683
|
}
|
684
|
-
.d2l-template-primary-secondary-divider
|
684
|
+
.d2l-template-primary-secondary-divider,
|
685
|
+
.d2l-template-primary-secondary-divider-not-resizable {
|
685
686
|
background-color: var(--d2l-color-mica);
|
686
687
|
flex: none;
|
687
688
|
outline: none;
|
@@ -991,9 +992,8 @@ class TemplatePrimarySecondary extends RtlMixin(LocalizeCoreElement(LitElement))
|
|
991
992
|
this._isCollapsed = false;
|
992
993
|
this._isExpanded = false;
|
993
994
|
this._isMobile = isMobile();
|
994
|
-
|
995
|
-
this._keyboardDescId = getUniqueId();
|
996
995
|
this._hasConnectedResizers = false;
|
996
|
+
this._sizeAsPercent = 0;
|
997
997
|
}
|
998
998
|
|
999
999
|
disconnectedCallback() {
|
@@ -1018,24 +1018,19 @@ class TemplatePrimarySecondary extends RtlMixin(LocalizeCoreElement(LitElement))
|
|
1018
1018
|
}
|
1019
1019
|
|
1020
1020
|
render() {
|
1021
|
-
let tabindex;
|
1022
1021
|
const size = this._size ?? 0;
|
1023
1022
|
const secondaryPanelStyles = {};
|
1024
1023
|
if (this._isResizable()) {
|
1025
1024
|
secondaryPanelStyles[this._isMobile ? 'height' : 'width'] = `${size}px`;
|
1026
|
-
tabindex = 0;
|
1027
1025
|
}
|
1028
|
-
const separatorVal = size && Math.round(size);
|
1029
|
-
const separatorMax = this._contentBounds && Math.round(this._isMobile ? this._contentBounds.maxHeight : this._contentBounds.maxWidth);
|
1030
1026
|
const scrollClasses = {
|
1031
1027
|
'd2l-template-scroll': isWindows
|
1032
1028
|
};
|
1033
|
-
const keyboardHelpText = this._isMobile ? this.localize('templates.primary-secondary.keyboardVertical') : this.localize('templates.primary-secondary.keyboardHorizontal');
|
1034
1029
|
const primarySection = html`<main class="${classMap(scrollClasses)}"><slot name="primary"></slot></main>`;
|
1035
1030
|
const secondarySection = html`
|
1036
1031
|
<div style=${styleMap(secondaryPanelStyles)} class="d2l-template-primary-secondary-secondary-container" @transitionend=${this._onTransitionEnd}>
|
1037
1032
|
<div class="d2l-template-primary-secondary-divider-shadow"></div>
|
1038
|
-
<aside class="${classMap(scrollClasses)}">
|
1033
|
+
<aside class="${classMap(scrollClasses)}" aria-label="${this.localize('templates.primary-secondary.secondary-panel')}">
|
1039
1034
|
<slot name="secondary"></slot>
|
1040
1035
|
</aside>
|
1041
1036
|
</div>`;
|
@@ -1044,27 +1039,7 @@ class TemplatePrimarySecondary extends RtlMixin(LocalizeCoreElement(LitElement))
|
|
1044
1039
|
<header><slot name="header"></slot></header>
|
1045
1040
|
<div class="d2l-template-primary-secondary-content" data-background-shading="${this.backgroundShading}" ?data-animate-resize=${this._animateResize} ?data-is-collapsed=${this._isCollapsed} ?data-is-expanded=${this._isExpanded}>
|
1046
1041
|
${this.secondaryFirst && !this._isMobile ? secondarySection : primarySection}
|
1047
|
-
|
1048
|
-
<div tabindex="${ifDefined(tabindex)}" class="d2l-template-primary-secondary-divider" role=separator aria-label="${this.localize('templates.primary-secondary.adjustableSplitView')}" aria-describedby="${this._keyboardDescId}" aria-orientation=${this._isMobile ? 'horizontal' : 'vertical'} aria-valuenow="${ifDefined(separatorVal)}" aria-valuemax="${ifDefined(separatorMax)}">
|
1049
|
-
<div class="d2l-template-primary-secondary-divider-handle" @click=${this._onHandleTap} @mousedown=${this._onHandleTapStart}>
|
1050
|
-
<div class="d2l-template-primary-secondary-divider-handle-desktop">
|
1051
|
-
<d2l-icon-custom size="tier1" class="d2l-template-primary-secondary-divider-handle-left">
|
1052
|
-
<svg width="18" height="18" xmlns="http://www.w3.org/2000/svg">
|
1053
|
-
<path transform="rotate(90 9.004714965820312,9.000227928161623)" d="m13.708,6.29a1.006,1.006 0 0 0 -0.708,-0.29l-7.995,0a1,1 0 0 0 -0.705,1.71l4,4a1.013,1.013 0 0 0 1.42,0l4,-4a1.01,1.01 0 0 0 -0.013,-1.42l0.001,0z" fill="#494c4e"/>
|
1054
|
-
</svg>
|
1055
|
-
</d2l-icon-custom>
|
1056
|
-
<div class="d2l-template-primary-secondary-divider-handle-line"></div>
|
1057
|
-
<d2l-icon-custom size="tier1" class="d2l-template-primary-secondary-divider-handle-right">
|
1058
|
-
<svg width="18" height="18" xmlns="http://www.w3.org/2000/svg">
|
1059
|
-
<path transform="rotate(-90 9.004714965820314,9.000227928161621)" d="m13.708,6.29a1.006,1.006 0 0 0 -0.708,-0.29l-7.995,0a1,1 0 0 0 -0.705,1.71l4,4a1.013,1.013 0 0 0 1.42,0l4,-4a1.01,1.01 0 0 0 -0.013,-1.42l0.001,0z" fill="#494c4e"/>
|
1060
|
-
</svg>
|
1061
|
-
</d2l-icon-custom>
|
1062
|
-
</div>
|
1063
|
-
<div class="d2l-template-primary-secondary-divider-handle-mobile">
|
1064
|
-
<d2l-icon icon=${size === 0 ? 'tier1:chevron-up' : 'tier1:chevron-down'}></d2l-icon>
|
1065
|
-
</div>
|
1066
|
-
</div>
|
1067
|
-
</div>
|
1042
|
+
${this._renderDivider()}
|
1068
1043
|
${this.secondaryFirst && !this._isMobile ? primarySection : secondarySection}
|
1069
1044
|
</div>
|
1070
1045
|
<footer ?hidden="${!this._hasFooter}">
|
@@ -1126,19 +1101,24 @@ class TemplatePrimarySecondary extends RtlMixin(LocalizeCoreElement(LitElement))
|
|
1126
1101
|
for (const resizer of this._resizers) {
|
1127
1102
|
resizer.panelSize = val;
|
1128
1103
|
}
|
1104
|
+
this._sizeAsPercent = Math.round((val / (this._isMobile ? this._contentBounds?.height : this._contentBounds?.width)) * 100) || 0;
|
1129
1105
|
this.requestUpdate('_size', oldSize);
|
1130
1106
|
}
|
1131
1107
|
|
1132
1108
|
_computeContentBounds(contentRect) {
|
1133
1109
|
if (!this.shadowRoot) return;
|
1134
|
-
const divider = this.
|
1110
|
+
const divider = this._isResizable() ?
|
1111
|
+
this.shadowRoot.querySelector('.d2l-template-primary-secondary-divider') :
|
1112
|
+
this.shadowRoot.querySelector('.d2l-template-primary-secondary-divider-not-resizable');
|
1135
1113
|
const desktopDividerSize = divider.offsetWidth;
|
1136
1114
|
const mobileDividerSize = divider.offsetHeight;
|
1137
1115
|
return {
|
1116
|
+
height: contentRect.height,
|
1138
1117
|
minWidth: desktopMinSize,
|
1139
1118
|
maxWidth: contentRect.width - desktopMinSize - desktopDividerSize,
|
1140
1119
|
minHeight: (contentRect.height - mobileDividerSize) * (1 / 3),
|
1141
|
-
maxHeight: (contentRect.height - mobileDividerSize) * (2 / 3)
|
1120
|
+
maxHeight: (contentRect.height - mobileDividerSize) * (2 / 3),
|
1121
|
+
width: contentRect.width
|
1142
1122
|
};
|
1143
1123
|
}
|
1144
1124
|
|
@@ -1175,7 +1155,9 @@ class TemplatePrimarySecondary extends RtlMixin(LocalizeCoreElement(LitElement))
|
|
1175
1155
|
if (this._isMobile) {
|
1176
1156
|
this._size = this._contentBounds.minHeight;
|
1177
1157
|
} else if (this.shadowRoot) {
|
1178
|
-
const divider = this.
|
1158
|
+
const divider = this._isResizable() ?
|
1159
|
+
this.shadowRoot.querySelector('.d2l-template-primary-secondary-divider') :
|
1160
|
+
this.shadowRoot.querySelector('.d2l-template-primary-secondary-divider-not-resizable');
|
1179
1161
|
const desktopDividerSize = contentRect.width - divider.offsetWidth;
|
1180
1162
|
this._size = Math.max(desktopMinSize, desktopDividerSize * (1 / 3));
|
1181
1163
|
}
|
@@ -1249,6 +1231,50 @@ class TemplatePrimarySecondary extends RtlMixin(LocalizeCoreElement(LitElement))
|
|
1249
1231
|
}
|
1250
1232
|
this._animateResize = false;
|
1251
1233
|
}
|
1234
|
+
|
1235
|
+
_renderDivider() {
|
1236
|
+
|
1237
|
+
const size = this._size ?? 0;
|
1238
|
+
const separatorMax = Math.round(
|
1239
|
+
this._isMobile ?
|
1240
|
+
(this._contentBounds?.maxHeight / this._contentBounds?.height) * 100 :
|
1241
|
+
(this._contentBounds?.maxWidth / this._contentBounds?.width) * 100
|
1242
|
+
) || 100;
|
1243
|
+
|
1244
|
+
return html`
|
1245
|
+
<div class="d2l-template-primary-secondary-divider-not-resizable" ?hidden="${this._isResizable()}"></div>
|
1246
|
+
<div class="d2l-template-primary-secondary-divider"
|
1247
|
+
tabindex="0"
|
1248
|
+
role="slider"
|
1249
|
+
aria-label="${this.localize('templates.primary-secondary.divider')}"
|
1250
|
+
aria-orientation="${this._isMobile ? 'vertical' : 'horizontal'}"
|
1251
|
+
aria-valuemax="${separatorMax}"
|
1252
|
+
aria-valuenow="${this._sizeAsPercent}"
|
1253
|
+
aria-valuemin="0"
|
1254
|
+
aria-valuetext="${formatPercent(this._sizeAsPercent / 100)}"
|
1255
|
+
?hidden="${!this._isResizable()}">
|
1256
|
+
<div class="d2l-template-primary-secondary-divider-handle" @click=${this._onHandleTap} @mousedown=${this._onHandleTapStart}>
|
1257
|
+
<div class="d2l-template-primary-secondary-divider-handle-desktop">
|
1258
|
+
<d2l-icon-custom size="tier1" class="d2l-template-primary-secondary-divider-handle-left">
|
1259
|
+
<svg width="18" height="18" xmlns="http://www.w3.org/2000/svg">
|
1260
|
+
<path transform="rotate(90 9.004714965820312,9.000227928161623)" d="m13.708,6.29a1.006,1.006 0 0 0 -0.708,-0.29l-7.995,0a1,1 0 0 0 -0.705,1.71l4,4a1.013,1.013 0 0 0 1.42,0l4,-4a1.01,1.01 0 0 0 -0.013,-1.42l0.001,0z" fill="#494c4e"/>
|
1261
|
+
</svg>
|
1262
|
+
</d2l-icon-custom>
|
1263
|
+
<div class="d2l-template-primary-secondary-divider-handle-line"></div>
|
1264
|
+
<d2l-icon-custom size="tier1" class="d2l-template-primary-secondary-divider-handle-right">
|
1265
|
+
<svg width="18" height="18" xmlns="http://www.w3.org/2000/svg">
|
1266
|
+
<path transform="rotate(-90 9.004714965820314,9.000227928161621)" d="m13.708,6.29a1.006,1.006 0 0 0 -0.708,-0.29l-7.995,0a1,1 0 0 0 -0.705,1.71l4,4a1.013,1.013 0 0 0 1.42,0l4,-4a1.01,1.01 0 0 0 -0.013,-1.42l0.001,0z" fill="#494c4e"/>
|
1267
|
+
</svg>
|
1268
|
+
</d2l-icon-custom>
|
1269
|
+
</div>
|
1270
|
+
<div class="d2l-template-primary-secondary-divider-handle-mobile">
|
1271
|
+
<d2l-icon icon=${size === 0 ? 'tier1:chevron-up' : 'tier1:chevron-down'}></d2l-icon>
|
1272
|
+
</div>
|
1273
|
+
</div>
|
1274
|
+
</div>
|
1275
|
+
`;
|
1276
|
+
|
1277
|
+
}
|
1252
1278
|
}
|
1253
1279
|
|
1254
1280
|
customElements.define('d2l-template-primary-secondary', TemplatePrimarySecondary);
|
@@ -2,5 +2,6 @@ console.warn('Using mathjax test context, this is intended for demo pages and te
|
|
2
2
|
|
3
3
|
document.getElementsByTagName('html')[0].dataset.mathjaxContext = JSON.stringify({
|
4
4
|
outputScale: 1.1,
|
5
|
-
renderLatex: !(window.location.search.indexOf('latex=false') !== -1)
|
5
|
+
renderLatex: !(window.location.search.indexOf('latex=false') !== -1),
|
6
|
+
enableMML3Support: true
|
6
7
|
});
|