@castlabs/ui 5.4.4 → 5.5.2
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/dist/castlabs-ui.common.js +4 -4
- package/dist/castlabs-ui.common.js.map +1 -1
- package/dist/castlabs-ui.core.js +43 -11
- package/dist/castlabs-ui.css +2 -2
- package/dist/castlabs-ui.module.js +43 -11
- package/dist/castlabs-ui.umd.js +7 -7
- package/dist/castlabs-ui.umd.js.map +1 -1
- package/package.json +8 -8
- package/src/components/ClFooter/style.scss +2 -1
- package/src/components/form/ClForm/style.scss +4 -2
- package/src/components/navigation/ClNavTop/style.scss +6 -3
- package/src/components/section/ClSectionHeadline/style.scss +2 -0
- package/src/components/table/ClTable/style.scss +16 -0
- package/src/components/table/ClTable/style.variables.scss +38 -10
- package/src/components/table/ClTableCel/Links/style.scss +14 -0
- package/src/components/table/ClTableHead/style.scss +4 -0
- package/src/styles/layout/grid.scss +6 -3
- package/src/styles/layout/helper.scss +6 -0
|
@@ -214,7 +214,7 @@ function clMatomoSetup () {
|
|
|
214
214
|
|
|
215
215
|
export function clTableSetupResize (id) {
|
|
216
216
|
document.querySelectorAll(`#${id} .cl-resizer`).forEach(resizer => {
|
|
217
|
-
clTableSetResizeListeners(resizer)
|
|
217
|
+
clTableSetResizeListeners(resizer, id)
|
|
218
218
|
})
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -243,37 +243,69 @@ export function clTableSortStatic (id, col) {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
let lastX = 0
|
|
246
|
-
let
|
|
246
|
+
let nextCol = null
|
|
247
|
+
|
|
248
|
+
function clTableSetResizeListeners (resizer, id) {
|
|
249
|
+
const nowrap = !!document.querySelector(`#${id}.cl-table-nowrap`) // are we in nowrap mode?
|
|
247
250
|
|
|
248
|
-
function clTableSetResizeListeners (resizer) {
|
|
249
251
|
resizer.addEventListener('mousedown', mousedown => {
|
|
250
252
|
mousedown.preventDefault()
|
|
251
|
-
|
|
253
|
+
nextCol = mousedown.target ? mousedown.target.parentElement : null
|
|
252
254
|
lastX = mousedown.pageX
|
|
253
255
|
})
|
|
254
256
|
|
|
255
257
|
document.addEventListener('mousemove', mousemove => {
|
|
256
|
-
if (
|
|
258
|
+
if (nextCol !== null) {
|
|
257
259
|
mousemove.preventDefault()
|
|
258
260
|
const delta = mousemove.pageX - lastX
|
|
259
261
|
lastX = mousemove.pageX
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
263
|
-
|
|
262
|
+
|
|
263
|
+
const colIndex = getColIndex(nextCol)
|
|
264
|
+
if (nowrap) {
|
|
265
|
+
// in nowrap mode we only adjust the first col
|
|
266
|
+
document
|
|
267
|
+
.querySelectorAll(
|
|
268
|
+
`#${id} tr th:nth-child(${colIndex - 1})` // , #${id} tr td:nth-child(${colIndex - 1})
|
|
269
|
+
)
|
|
270
|
+
.forEach(cel => {
|
|
271
|
+
const width =
|
|
272
|
+
(cel.style.maxWidth === '' ? cel.offsetWidth : parseInt(cel.style.maxWidth)) + delta
|
|
273
|
+
cel.style.width = (width > 32 ? width : 32) + 'px'
|
|
274
|
+
cel.style.maxWidth = (width > 32 ? width : 32) + 'px'
|
|
275
|
+
})
|
|
276
|
+
} else {
|
|
277
|
+
// in regular mode we shrink one and enlarge the other col
|
|
278
|
+
document.querySelectorAll(`#${id} tr td:nth-child(${colIndex - 1})`).forEach(cel => {
|
|
279
|
+
const width = cel.offsetWidth + delta
|
|
280
|
+
cel.style.width = (width > 32 ? width : 32) + 'px'
|
|
281
|
+
})
|
|
282
|
+
document.querySelectorAll(`#${id} tr td:nth-child(${colIndex})`).forEach(cel => {
|
|
283
|
+
const width = cel.offsetWidth - delta
|
|
284
|
+
cel.style.width = (width > 32 ? width : 32) + 'px'
|
|
285
|
+
})
|
|
264
286
|
}
|
|
265
287
|
}
|
|
266
288
|
})
|
|
267
289
|
|
|
268
290
|
document.addEventListener('mouseup', mouseup => {
|
|
269
|
-
if (
|
|
291
|
+
if (nextCol !== null) {
|
|
270
292
|
mouseup.preventDefault()
|
|
271
293
|
lastX = 0
|
|
272
|
-
|
|
294
|
+
nextCol = null
|
|
273
295
|
}
|
|
274
296
|
})
|
|
275
297
|
}
|
|
276
298
|
|
|
299
|
+
function getColIndex (col) {
|
|
300
|
+
// calculate index of a col in a row
|
|
301
|
+
let colNo = 0
|
|
302
|
+
while (col) {
|
|
303
|
+
colNo++
|
|
304
|
+
col = col.previousElementSibling
|
|
305
|
+
}
|
|
306
|
+
return colNo
|
|
307
|
+
}
|
|
308
|
+
|
|
277
309
|
import bootstrap from 'bootstrap/dist/js/bootstrap.bundle.min'
|
|
278
310
|
|
|
279
311
|
// -----------------------------------------------------------------------------
|