@globalbrain/sefirot 2.45.0 → 2.46.1

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.
@@ -13,7 +13,7 @@ const props = withDefaults(defineProps<{
13
13
  divider: true
14
14
  })
15
15
 
16
- provide('sefirot-desc-label-wdith', () => props.labelWidth)
16
+ provide('sefirot-desc-label-width', () => props.labelWidth)
17
17
  </script>
18
18
 
19
19
  <template>
@@ -6,7 +6,9 @@ defineProps<{
6
6
  span?: string | number
7
7
  }>()
8
8
 
9
- const labelWidthProp = inject<() => string | number | undefined>('sefirot-desc-label-wdith')
9
+ const labelWidthProp = inject<() => string | number | undefined>(
10
+ 'sefirot-desc-label-width', () => undefined
11
+ )
10
12
 
11
13
  const labelWidth = computed(() => {
12
14
  const w = labelWidthProp?.()
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import IconCaretDown from '@iconify-icons/ph/caret-down-bold'
3
- import { type DropdownSection } from 'sefirot/composables/Dropdown'
4
3
  import {
4
+ type DropdownSection,
5
5
  getSelectedOption,
6
6
  useManualDropdownPosition
7
7
  } from 'sefirot/composables/Dropdown'
@@ -1,8 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
3
  import IconQuestion from '@iconify-icons/ph/question'
4
- import { type DefineComponent } from 'vue'
5
- import { computed, unref, useSlots } from 'vue'
4
+ import { type DefineComponent, computed, unref, useSlots } from 'vue'
6
5
  import { type Validatable } from '../composables/Validation'
7
6
  import SIcon from './SIcon.vue'
8
7
  import STooltip from './STooltip.vue'
@@ -3,10 +3,8 @@ import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
3
  import IconCaretDown from '@iconify-icons/ph/caret-down-bold'
4
4
  import IconCaretUp from '@iconify-icons/ph/caret-up-bold'
5
5
  import xor from 'lodash-es/xor'
6
- import { type DefineComponent } from 'vue'
7
- import { computed, ref } from 'vue'
8
- import { type DropdownSectionFilter } from '../composables/Dropdown'
9
- import { useManualDropdownPosition } from '../composables/Dropdown'
6
+ import { type DefineComponent, computed, ref } from 'vue'
7
+ import { type DropdownSectionFilter, useManualDropdownPosition } from '../composables/Dropdown'
10
8
  import { useFlyout } from '../composables/Flyout'
11
9
  import { type Validatable } from '../composables/Validation'
12
10
  import { isArray } from '../support/Utils'
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { type DefineComponent } from 'vue'
4
- import { computed, ref } from 'vue'
3
+ import { type DefineComponent, computed, ref } from 'vue'
5
4
  import { type Validatable } from '../composables/Validation'
6
5
  import SInputBase from './SInputBase.vue'
7
6
 
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { type DefineComponent } from 'vue'
4
- import { computed, ref } from 'vue'
3
+ import { type DefineComponent, computed, ref } from 'vue'
5
4
  import { type Validatable } from '../composables/Validation'
6
5
  import SInputBase from './SInputBase.vue'
7
6
 
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { type DefineComponent } from 'vue'
4
- import { computed } from 'vue'
3
+ import { type DefineComponent, computed } from 'vue'
5
4
  import { type Validatable } from '../composables/Validation'
6
5
  import { isNullish, isString } from '../support/Utils'
7
6
  import SInputText from './SInputText.vue'
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { type DefineComponent } from 'vue'
4
- import { computed } from 'vue'
3
+ import { type DefineComponent, computed } from 'vue'
5
4
  import { type Validatable } from '../composables/Validation'
6
5
  import SInputBase from './SInputBase.vue'
7
6
  import SInputRadio from './SInputRadio.vue'
@@ -2,8 +2,7 @@
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
3
  import IconCaretDown from '@iconify-icons/ph/caret-down-bold'
4
4
  import IconCaretUp from '@iconify-icons/ph/caret-up-bold'
5
- import { type DefineComponent } from 'vue'
6
- import { computed, ref } from 'vue'
5
+ import { type DefineComponent, computed, ref } from 'vue'
7
6
  import { type Validatable } from '../composables/Validation'
8
7
  import SIcon from './SIcon.vue'
9
8
  import SInputBase from './SInputBase.vue'
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { type DefineComponent } from 'vue'
4
- import { computed } from 'vue'
3
+ import { type DefineComponent, computed } from 'vue'
5
4
  import { type Validatable } from '../composables/Validation'
6
5
  import SInputBase from './SInputBase.vue'
7
6
 
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { type DefineComponent } from 'vue'
4
- import { computed } from 'vue'
3
+ import { type DefineComponent, computed } from 'vue'
5
4
  import { type Validatable } from '../composables/Validation'
6
5
  import SInputBase from './SInputBase.vue'
7
6
  import SInputSwitch from './SInputSwitch.vue'
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { type DefineComponent } from 'vue'
4
- import { computed, ref } from 'vue'
3
+ import { type DefineComponent, computed, ref } from 'vue'
5
4
  import { type Validatable } from '../composables/Validation'
6
5
  import { isString } from '../support/Utils'
7
6
  import SIcon from './SIcon.vue'
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { type IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { type DefineComponent } from 'vue'
4
- import { computed, ref } from 'vue'
3
+ import { type DefineComponent, computed, ref } from 'vue'
5
4
  import { type Validatable } from '../composables/Validation'
6
5
  import SInputBase from './SInputBase.vue'
7
6
 
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, nextTick, shallowRef, watch } from 'vue'
3
- import { type LinkCallback, type LinkSubscriberPayload } from '../composables/Markdown'
4
- import { useLink, useMarkdown } from '../composables/Markdown'
3
+ import { type LinkCallback, type LinkSubscriberPayload, useLink, useMarkdown } from '../composables/Markdown'
5
4
 
6
5
  const props = defineProps<{
7
6
  tag?: string
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { type Mode, type Type } from './SButton.vue'
3
- import SButton from './SButton.vue'
2
+ import SButton, { type Mode, type Type } from './SButton.vue'
4
3
 
5
4
  defineProps<{
6
5
  type?: Type
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import IconX from '@iconify-icons/ph/x'
3
- import { type SnackbarAction } from '../stores/Snackbars'
4
- import { useSnackbars } from '../stores/Snackbars'
3
+ import { type SnackbarAction, useSnackbars } from '../stores/Snackbars'
5
4
  import SButton from './SButton.vue'
6
5
  import SIcon from './SIcon.vue'
7
6
 
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { type PropType } from 'vue'
3
- import { computed } from 'vue'
2
+ import { type PropType, computed } from 'vue'
4
3
  import { type BarMode, type Step } from '../composables/Step'
5
4
  import SStep from './SStep.vue'
6
5
 
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useVirtualizer } from '@tanstack/vue-virtual'
2
3
  import { useResizeObserver } from '@vueuse/core'
3
4
  import {
4
5
  computed,
@@ -9,7 +10,6 @@ import {
9
10
  unref,
10
11
  watch
11
12
  } from 'vue'
12
- import { DynamicScroller, DynamicScrollerItem } from 'vue-virtual-scroller'
13
13
  import { type Table } from '../composables/Table'
14
14
  import SSpinner from './SSpinner.vue'
15
15
  import STableCell from './STableCell.vue'
@@ -111,14 +111,18 @@ const recordsWithSummary = computed(() => {
111
111
  const records = unref(props.options.records) ?? []
112
112
  const summary = unref(props.options.summary)
113
113
 
114
- const res = summary ? [...records, summary] : records
114
+ return summary ? [...records, summary] : records
115
+ })
115
116
 
116
- res.forEach((record, index) => {
117
- record.__index = index
118
- })
117
+ const virtualizerOptions = computed(() => ({
118
+ count: recordsWithSummary.value.length,
119
+ getScrollElement: () => body.value,
120
+ estimateSize: () => unref(props.options.rowSize) ?? 41,
121
+ overscan: 10
122
+ }))
119
123
 
120
- return res
121
- })
124
+ const rowVirtualizer = useVirtualizer(virtualizerOptions)
125
+ const virtualItems = computed(() => rowVirtualizer.value.getVirtualItems())
122
126
 
123
127
  watch(() => props.options.records, () => {
124
128
  headLock = true
@@ -272,75 +276,50 @@ function getCell(key: string, index: number) {
272
276
  @mouseleave="lockBody(false)"
273
277
  @scroll="syncBodyScroll"
274
278
  >
275
- <template v-if="unref(options.virtualScroll)">
276
- <DynamicScroller
277
- :items="recordsWithSummary"
278
- :min-item-size="40"
279
- key-field="__index"
280
- class="block"
281
- :style="blockWidth ? { width: `${blockWidth}px` } : undefined"
282
- :prerender="Math.min(10, recordsWithSummary.length)"
283
- >
284
- <template #default="{ item: record, index: rIndex, active }">
285
- <DynamicScrollerItem
286
- :item="record"
287
- :active="active"
288
- :data-index="rIndex"
289
- >
290
- <div class="row" :class="isSummaryOrLastClass(rIndex)">
291
- <STableItem
292
- v-for="key in ordersToShow"
293
- :key="key"
294
- :name="key"
295
- :class-name="unref(options.columns)[key].className"
296
- :width="colWidths[key]"
297
- >
298
- <STableCell
299
- :name="key"
300
- :class="isSummary(rIndex) && 'summary'"
301
- :class-name="unref(options.columns)[key].className"
302
- :cell="getCell(key, rIndex)"
303
- :value="record[key]"
304
- :record="record"
305
- :records="unref(options.records)!"
306
- />
307
- </STableItem>
308
- </div>
309
- </DynamicScrollerItem>
310
- </template>
311
- </DynamicScroller>
312
- </template>
313
- <template v-else>
279
+ <div
280
+ class="block"
281
+ :style="{
282
+ width: blockWidth ? `${blockWidth}px` : '100%',
283
+ height: `${rowVirtualizer.getTotalSize()}px`,
284
+ position: 'relative'
285
+ }"
286
+ >
314
287
  <div
315
- class="block"
316
- :style="blockWidth ? { width: `${blockWidth}px` } : undefined"
288
+ v-for="{ index, key: __key, size, start } in virtualItems"
289
+ :key="__key"
317
290
  >
318
291
  <div
319
- v-for="(record, rIndex) in recordsWithSummary"
320
- :key="record.__index"
292
+ class="row"
293
+ :class="isSummaryOrLastClass(index)"
294
+ :style="{
295
+ position: 'absolute',
296
+ top: 0,
297
+ left: 0,
298
+ width: '100%',
299
+ height: `${size}px`,
300
+ transform: `translateY(${start}px)`
301
+ }"
321
302
  >
322
- <div class="row" :class="isSummaryOrLastClass(rIndex)">
323
- <STableItem
324
- v-for="key in ordersToShow"
325
- :key="key"
303
+ <STableItem
304
+ v-for="key in ordersToShow"
305
+ :key="key"
306
+ :name="key"
307
+ :class-name="unref(options.columns)[key].className"
308
+ :width="colWidths[key]"
309
+ >
310
+ <STableCell
326
311
  :name="key"
312
+ :class="isSummary(index) && 'summary'"
327
313
  :class-name="unref(options.columns)[key].className"
328
- :width="colWidths[key]"
329
- >
330
- <STableCell
331
- :name="key"
332
- :class="isSummary(rIndex) && 'summary'"
333
- :class-name="unref(options.columns)[key].className"
334
- :cell="getCell(key, rIndex)"
335
- :value="record[key]"
336
- :record="record"
337
- :records="unref(options.records)!"
338
- />
339
- </STableItem>
340
- </div>
314
+ :cell="getCell(key, index)"
315
+ :value="recordsWithSummary[index][key]"
316
+ :record="recordsWithSummary[index]"
317
+ :records="unref(options.records)!"
318
+ />
319
+ </STableItem>
341
320
  </div>
342
321
  </div>
343
- </template>
322
+ </div>
344
323
  </div>
345
324
  </div>
346
325
 
@@ -417,14 +396,11 @@ function getCell(key: string, index: number) {
417
396
  .container.body {
418
397
  border-radius: 6px 6px var(--table-border-radius) var(--table-border-radius);
419
398
  line-height: 0;
399
+ max-height: var(--table-max-height, 100%);
420
400
 
421
401
  .STable.has-footer & {
422
402
  border-radius: 0;
423
403
  }
424
-
425
- .block {
426
- max-height: var(--table-max-height, 100%);
427
- }
428
404
  }
429
405
 
430
406
  .block {
@@ -1,6 +1,5 @@
1
1
  import { type MaybeRef, useElementBounding, useWindowSize } from '@vueuse/core'
2
- import { type Component, type Ref } from 'vue'
3
- import { ref, unref } from 'vue'
2
+ import { type Component, type Ref, ref, unref } from 'vue'
4
3
 
5
4
  export type DropdownSection =
6
5
  | DropdownSectionMenu
@@ -21,7 +21,7 @@ export interface Table<
21
21
  reset?: MaybeRef<boolean | undefined>
22
22
  borderless?: MaybeRef<boolean>
23
23
  loading?: MaybeRef<boolean | undefined>
24
- virtualScroll?: MaybeRef<boolean | undefined>
24
+ rowSize?: MaybeRef<number | undefined>
25
25
  onPrev?(): void
26
26
  onNext?(): void
27
27
  onReset?(): void
@@ -1,5 +1,4 @@
1
1
  @import "normalize.css";
2
2
  @import "v-calendar/dist/style.css";
3
- @import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
4
3
  @import "./variables";
5
4
  @import "./base";
@@ -1,9 +1,3 @@
1
1
  declare module 'v-calendar' {
2
2
  export const DatePicker: any
3
3
  }
4
-
5
- declare module 'vue-virtual-scroller' {
6
- export const RecycleScroller: any
7
- export const DynamicScroller: any
8
- export const DynamicScrollerItem: any
9
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "2.45.0",
4
- "packageManager": "pnpm@8.6.2",
3
+ "version": "2.46.1",
4
+ "packageManager": "pnpm@8.7.5",
5
5
  "description": "Vue Components for Global Brain Design System.",
6
6
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",
7
7
  "license": "MIT",
@@ -23,69 +23,65 @@
23
23
  "peerDependencies": {
24
24
  "@iconify-icons/ph": "^1.2.4",
25
25
  "@iconify/vue": "^4.1.1",
26
- "@types/body-scroll-lock": "^3.1.0",
27
- "@types/lodash-es": "^4.17.7",
28
- "@types/markdown-it": "^12.2.3",
29
- "@vuelidate/core": "^2.0.2",
30
- "@vuelidate/validators": "^2.0.2",
31
- "@vueuse/core": "^10.1.2",
26
+ "@tanstack/vue-virtual": "3.0.0-beta.60",
27
+ "@vuelidate/core": "^2.0.3",
28
+ "@vuelidate/validators": "^2.0.4",
29
+ "@vueuse/core": "^10.4.1",
32
30
  "body-scroll-lock": "4.0.0-beta.0",
33
31
  "fuse.js": "^6.6.2",
34
32
  "lodash-es": "^4.17.21",
35
33
  "markdown-it": "^13.0.1",
36
34
  "normalize.css": "^8.0.1",
37
- "pinia": "^2.0.36",
38
- "postcss": "^8.4.23",
35
+ "pinia": "^2.1.6",
36
+ "postcss": "^8.4.29",
39
37
  "postcss-nested": "^6.0.1",
40
- "typescript": "~4.9.5",
41
38
  "v-calendar": "^3.0.3",
42
- "vue": "^3.2.47",
43
- "vue-router": "^4.1.6",
44
- "vue-virtual-scroller": "2.0.0-beta.8"
39
+ "vue": "^3.3.4",
40
+ "vue-router": "^4.2.4"
45
41
  },
46
42
  "dependencies": {
47
- "dayjs": "^1.11.7"
43
+ "dayjs": "^1.11.9"
48
44
  },
49
45
  "devDependencies": {
50
- "@globalbrain/eslint-config": "^1.5.1",
51
- "@histoire/plugin-vue": "^0.16.1",
46
+ "@globalbrain/eslint-config": "^1.5.2",
47
+ "@histoire/plugin-vue": "^0.17.1",
52
48
  "@iconify-icons/ph": "^1.2.4",
53
49
  "@iconify/vue": "^4.1.1",
50
+ "@tanstack/vue-virtual": "3.0.0-beta.60",
54
51
  "@types/body-scroll-lock": "^3.1.0",
55
- "@types/lodash-es": "^4.17.7",
56
- "@types/markdown-it": "^12.2.3",
57
- "@types/node": "^20.1.1",
58
- "@vitejs/plugin-vue": "^4.2.1",
59
- "@vitest/coverage-c8": "^0.33.0",
60
- "@vue/test-utils": "^2.3.2",
61
- "@vuelidate/core": "^2.0.2",
62
- "@vuelidate/validators": "^2.0.2",
63
- "@vueuse/core": "^10.1.2",
52
+ "@types/lodash-es": "^4.17.9",
53
+ "@types/markdown-it": "^13.0.1",
54
+ "@types/node": "^20.6.0",
55
+ "@vitejs/plugin-vue": "^4.3.4",
56
+ "@vitest/coverage-v8": "^0.34.4",
57
+ "@vue/test-utils": "^2.4.1",
58
+ "@vuelidate/core": "^2.0.3",
59
+ "@vuelidate/validators": "^2.0.4",
60
+ "@vueuse/core": "^10.4.1",
64
61
  "body-scroll-lock": "4.0.0-beta.0",
65
62
  "chalk": "^4.1.2",
66
- "conventional-changelog-cli": "^2.2.2",
67
- "enquirer": "^2.3.6",
68
- "eslint": "^8.44.0",
63
+ "conventional-changelog-cli": "^4.1.0",
64
+ "enquirer": "^2.4.1",
65
+ "eslint": "^8.49.0",
69
66
  "execa": "^5.1.1",
70
67
  "fuse.js": "^6.6.2",
71
- "happy-dom": "^10.1.1",
72
- "histoire": "^0.16.1",
68
+ "happy-dom": "^11.0.2",
69
+ "histoire": "^0.17.0",
73
70
  "lodash-es": "^4.17.21",
74
71
  "markdown-it": "^13.0.1",
75
72
  "normalize.css": "^8.0.1",
76
- "pinia": "^2.0.36",
77
- "postcss": "^8.4.23",
73
+ "pinia": "^2.1.6",
74
+ "postcss": "^8.4.29",
78
75
  "postcss-nested": "^6.0.1",
79
- "semver": "^7.5.0",
80
- "typescript": "~4.9.5",
76
+ "semver": "^7.5.4",
77
+ "typescript": "~5.2.2",
81
78
  "v-calendar": "^3.0.3",
82
- "vite": "^4.3.5",
83
- "vitepress": "1.0.0-alpha.75",
84
- "vitest": "^0.33.0",
85
- "vue": "^3.2.47",
86
- "vue-router": "^4.1.6",
87
- "vue-tsc": "^1.7.1",
88
- "vue-virtual-scroller": "2.0.0-beta.8"
79
+ "vite": "^4.4.9",
80
+ "vitepress": "1.0.0-rc.11",
81
+ "vitest": "^0.34.4",
82
+ "vue": "^3.3.4",
83
+ "vue-router": "^4.2.4",
84
+ "vue-tsc": "^1.8.10"
89
85
  },
90
86
  "scripts": {
91
87
  "docs": "vitepress dev docs --port 4000",