@7365admin1/layer-common 4.2.6 → 4.2.7-staging.275

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.
@@ -165,7 +165,7 @@
165
165
  v-else
166
166
  class="vms__grid"
167
167
  :style="{
168
- gridTemplateColumns: `repeat(${layout.columns}, minmax(0, 1fr))`,
168
+ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
169
169
  gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))`,
170
170
  }"
171
171
  >
@@ -336,6 +336,7 @@
336
336
 
337
337
  <script setup lang="ts">
338
338
  import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
339
+ import { useDisplay } from "vuetify";
339
340
 
340
341
  import {
341
342
  capabilityView,
@@ -348,6 +349,7 @@ import {
348
349
  pickerView,
349
350
  sharedCapabilityNote,
350
351
  wallCameras,
352
+ wallColumns,
351
353
  wallLayout,
352
354
  wallPageCount,
353
355
  wallRows,
@@ -455,7 +457,17 @@ watch(() => props.site, () => {
455
457
 
456
458
  const layoutKey = ref<TWallLayoutKey>(DEFAULT_WALL_LAYOUT);
457
459
  const layout = computed(() => wallLayout(layoutKey.value));
458
- const dense = computed(() => isDenseLayout(layoutKey.value));
460
+
461
+ /**
462
+ * PHONE OVERRIDE. `smAndDown` is Vuetify's own phone/small-tablet cutoff
463
+ * (<960px) — the same composable `NavigationDrawer.vue` already reads its
464
+ * breakpoint from. Below it the wall always draws one column, whatever
465
+ * layout button is selected; the pure column/dense/row rules live in
466
+ * `camera-wall.ts` (see `wallColumns`) so they stay testable there.
467
+ */
468
+ const { smAndDown } = useDisplay();
469
+ const columns = computed(() => wallColumns(layoutKey.value, smAndDown.value));
470
+ const dense = computed(() => isDenseLayout(layoutKey.value, smAndDown.value));
459
471
 
460
472
  const selectedIds = ref<string[]>([]);
461
473
  const showPicker = ref(false);
@@ -479,7 +491,7 @@ const tiles = computed(() =>
479
491
  * four empty rectangles. Nothing can be done with an empty cell from here
480
492
  * anyway: cameras are added in Site Settings.
481
493
  */
482
- const rows = computed(() => wallRows(tiles.value.length, layoutKey.value));
494
+ const rows = computed(() => wallRows(tiles.value.length, layoutKey.value, smAndDown.value));
483
495
 
484
496
  /**
485
497
  * A layout change resizes the page, so the old page NUMBER no longer means
@@ -13,11 +13,11 @@
13
13
  <template>
14
14
  <v-list-item :class="props.divider ? border : defaultBorder">
15
15
  <v-row>
16
- <v-col cols="4" class="app-list-row__label">
16
+ <v-col cols="12" sm="4" class="app-list-row__label">
17
17
  <slot name="title"> List Title </slot>
18
18
  </v-col>
19
19
 
20
- <v-col cols="8" class="app-list-row__value">
20
+ <v-col cols="12" sm="8" class="app-list-row__value">
21
21
  <slot name="value"> value </slot>
22
22
  </v-col>
23
23
  </v-row>
@@ -48,7 +48,7 @@
48
48
  <v-btn
49
49
  rounded="md"
50
50
  variant="text"
51
- color="primary"
51
+ color="white"
52
52
  class="text-truncate text-decoration-underline px-0"
53
53
  @click="goToUnregistered"
54
54
  >
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.2.6",
5
+ "version": "4.2.7-staging.275",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
@@ -101,6 +101,21 @@ export function wallLayout(key: string | undefined) {
101
101
  return WALL_LAYOUTS.find((l) => l.key === key) ?? WALL_LAYOUTS[1];
102
102
  }
103
103
 
104
+ /**
105
+ * The columns the wall actually draws, after the phone override.
106
+ *
107
+ * A phone rendering three columns of a nine-tile wall is the unusable case:
108
+ * each tile shrinks past the point its status text — or the picture itself —
109
+ * is legible. So on a phone the wall always draws one column, whatever layout
110
+ * button is selected; the button still means "this many tiles", it stops
111
+ * meaning "this many columns" below the phone breakpoint. Tablet and desktop
112
+ * are untouched — `isPhone` is the caller's own `smAndDown` (or equivalent),
113
+ * this file has no notion of viewport width itself.
114
+ */
115
+ export function wallColumns(key: string | undefined, isPhone = false): number {
116
+ return isPhone ? 1 : wallLayout(key).columns;
117
+ }
118
+
104
119
  /**
105
120
  * At three columns a tile is small enough that the chrome starts eating the
106
121
  * picture, so the type shrinks and the recorder line loses its timestamp.
@@ -111,9 +126,12 @@ export function wallLayout(key: string | undefined) {
111
126
  * from furthest away and the one where a camera is most likely to be missed.
112
127
  * Whether a camera is alive is the tile's whole job; it is not the thing that
113
128
  * gets cut for room.
129
+ *
130
+ * A phone forced to one column (see `wallColumns`) is never dense — a single
131
+ * full-width tile is the opposite problem.
114
132
  */
115
- export function isDenseLayout(key: string | undefined) {
116
- return wallLayout(key).columns >= 3;
133
+ export function isDenseLayout(key: string | undefined, isPhone = false) {
134
+ return wallColumns(key, isPhone) >= 3;
117
135
  }
118
136
 
119
137
  /* -------------------------------------------------------------------------- */
@@ -302,8 +320,13 @@ export function focusedCamera(
302
320
  *
303
321
  * Never more rows than the layout would have had, and never fewer than one.
304
322
  */
305
- export function wallRows(count: number, layoutKey: string | undefined): number {
306
- const { columns, tiles } = wallLayout(layoutKey);
323
+ export function wallRows(
324
+ count: number,
325
+ layoutKey: string | undefined,
326
+ isPhone = false
327
+ ): number {
328
+ const { tiles } = wallLayout(layoutKey);
329
+ const columns = wallColumns(layoutKey, isPhone);
307
330
  const capped = Math.min(Math.max(0, Math.floor(count)), tiles);
308
331
  return Math.min(Math.ceil(tiles / columns), Math.max(1, Math.ceil(capped / columns)));
309
332
  }