yummy-guide-generic-administrate 0.8.15 → 0.8.16

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9da6643ffb00010859cc51766113d7c757744a92cb1415ce70a30dafb33c194
4
- data.tar.gz: 984902613fa65606e1ca1404bed57cc90b40cf821f678343583ec80e42ee8d95
3
+ metadata.gz: bea5c7cfc5273ba6a7f6cf59dacded8b77c7ce8c728859b689ddd8e504b6e4fc
4
+ data.tar.gz: e39d3ae5f41ca38513f96e5160ca2ac8949dac0faebee99cebb63e6e8645b66d
5
5
  SHA512:
6
- metadata.gz: 7cb593f606f48ca2bb18af508fd9df0e567cabfb457ae105901152d7501bc32c069ec5c7e662365e26084cd5b1095e949a9ea920d206da2525eec17db08bca2e
7
- data.tar.gz: 1ea3603669a04a6a83ef151dfe48b2c961befdd8e1d6de81f13407fb871980b5556f4e14d4db3ab47746b1907cc83b832354d2cd57db14190b4f649296c01f53
6
+ metadata.gz: 07caa0d706ce90f07bfed3d380c1e3ab7a8b527e2285bb856b66e19c6a4a5334ff700c38df3a9e22d45cdaaf78edb2acf3cbaf271c8097d223e1f822c1d1cca9
7
+ data.tar.gz: bdbebfc1293d49c7bbd12d495d478edb3295e3b2a8a4b193594d1883a63c57c0fbb5f611d569d9ac9c5740e814245c30252af2c8e1ee51a83b61243091d4339e
@@ -1,5 +1,6 @@
1
1
  (function() {
2
2
  var TABLE_SELECTOR = 'table[data-fixed-columns-count]';
3
+ var TANSTACK_TABLE_ATTRIBUTE = 'data-yummy-guide-administrate-tanstack-table';
3
4
  var CSS_STICKY_TABLE_SELECTOR = '[data-css-sticky-table]';
4
5
  var MAIN_CONTENT_SELECTOR = '.main-content';
5
6
  var STICKY_PAGE_HEADER_SELECTOR = '.main-content__header--sticky-table-layout, [data-reservations-sticky-header], .main-content__header';
@@ -544,12 +545,15 @@
544
545
 
545
546
  function refreshCssStickyLeftColumns(table) {
546
547
  if (!table || table.getAttribute('aria-hidden') === 'true') return;
548
+ if (table.hasAttribute(TANSTACK_TABLE_ATTRIBUTE)) return;
547
549
 
548
550
  refreshCssStickyLeftColumnSet(table, 'sticky-left', '--sticky-left', '--sticky-width');
549
551
  refreshCssStickyLeftColumnSet(table, 'sticky-left-mobile', '--sticky-mobile-left', '--sticky-mobile-width');
550
552
  }
551
553
 
552
554
  function refreshExternalStickyLeftColumns(table, options) {
555
+ if (table && table.hasAttribute(TANSTACK_TABLE_ATTRIBUTE)) return false;
556
+
553
557
  var api = window.YummyGuideAdministrateStickyLeftColumns;
554
558
  var settings = options || {};
555
559
 
@@ -571,6 +575,16 @@
571
575
  }
572
576
 
573
577
  function refreshTableWidthLayout(table, options) {
578
+ if (table && table.hasAttribute(TANSTACK_TABLE_ATTRIBUTE)) {
579
+ table.dispatchEvent(new CustomEvent('yummy-guide-administrate:column-width-change', {
580
+ bubbles: true,
581
+ detail: {
582
+ columnId: options && options.columnId,
583
+ width: options && options.width
584
+ }
585
+ }));
586
+ }
587
+
574
588
  refreshCssStickyLeftColumns(table);
575
589
  refreshExternalStickyLeftColumns(table, options);
576
590
  refreshStickyHeaderLayoutForTable(table);
@@ -1,5 +1,5 @@
1
1
  (function() {
2
- var TABLE_SELECTOR = "table[data-fixed-columns-count]";
2
+ var TABLE_SELECTOR = "table[data-fixed-columns-count]:not([data-yummy-guide-administrate-tanstack-table])";
3
3
  var MOBILE_MEDIA_QUERY = "(max-width: 767px)";
4
4
  var resizeObservers = new WeakMap();
5
5
  var suppressedResizeTables = new WeakMap();
@@ -645,7 +645,23 @@ td.cell-data:hover .admin-copy-cell__button:not([disabled]),
645
645
  left: calc(var(--admin-sticky-table-left-offset, 0px) + var(--sticky-left, 0px));
646
646
  }
647
647
 
648
+ // TanStackを利用するテーブルでは、製品側のReact entrypointがテーブル要素に
649
+ // 設定したCSS変数を使う。仮想行の生成ごとにセルへleftを直接書き込まない。
650
+ @for $index from 1 through 6 {
651
+ table[data-yummy-guide-administrate-tanstack-table] > :is(thead, tbody, tfoot) > tr:not(.js-virtualized-table-spacer) > :nth-child(#{$index}).sticky-left {
652
+ --sticky-left: var(--yummy-guide-administrate-tanstack-column-#{$index}-left) !important;
653
+ --sticky-width: var(--yummy-guide-administrate-tanstack-column-#{$index}-width) !important;
654
+ }
655
+ }
656
+
648
657
  @media (max-width: 767px) {
658
+ @for $index from 1 through 6 {
659
+ table[data-yummy-guide-administrate-tanstack-table] > :is(thead, tbody, tfoot) > tr:not(.js-virtualized-table-spacer) > :nth-child(#{$index}).sticky-left-mobile {
660
+ --sticky-mobile-left: var(--yummy-guide-administrate-tanstack-column-#{$index}-left) !important;
661
+ --sticky-mobile-width: var(--yummy-guide-administrate-tanstack-column-#{$index}-width) !important;
662
+ }
663
+ }
664
+
649
665
  @for $count from 1 through 6 {
650
666
  @for $index from 1 through $count {
651
667
  .scroll-table table[data-fixed-columns-count="#{$count}"] tr > :nth-child(#{$index}):not(.sticky-left),
@@ -98,6 +98,14 @@ module YummyGuide
98
98
  )
99
99
  end
100
100
 
101
+ # TanStack Table を利用する製品側テーブルが、従来の固定列JSではなく
102
+ # CSS変数経由で固定位置を受け取るためのopt-in属性を返す。
103
+ def yummy_guide_administrate_tanstack_table_attributes
104
+ {
105
+ "data-yummy-guide-administrate-tanstack-table" => "true"
106
+ }
107
+ end
108
+
101
109
  def yummy_guide_administrate_collection_table_fixed_columns_count(page:, collection_presenter:)
102
110
  yummy_guide_administrate_collection_fixed_columns_count_for(
103
111
  page: page,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module YummyGuide
4
4
  module Administrate
5
- VERSION = "0.8.15"
5
+ VERSION = "0.8.16"
6
6
  end
7
7
  end
@@ -26,6 +26,15 @@ RSpec.describe YummyGuide::Administrate::CollectionHelper do
26
26
  end.new
27
27
  end
28
28
 
29
+ describe "#yummy_guide_administrate_tanstack_table_attributes" do
30
+ # TanStack管理のテーブルだけが従来の固定列JSを回避できる属性を返すことを確認する
31
+ it "returns the TanStack opt-in data attribute" do
32
+ expect(helper_host.yummy_guide_administrate_tanstack_table_attributes).to eq(
33
+ "data-yummy-guide-administrate-tanstack-table" => "true"
34
+ )
35
+ end
36
+ end
37
+
29
38
  describe "#yummy_guide_administrate_collection_table_fixed_columns_count" do
30
39
  # dashboard の固定列数が表示列数を超えていても、実際の列数で打ち止めになることを確認する
31
40
  it "caps the fixed column count by the number of visible attributes" do
@@ -57,6 +57,18 @@ RSpec.describe "column resizer assets" do
57
57
  expect(javascript_source).not_to include("refreshStickyLeftColumnsForWidth")
58
58
  end
59
59
 
60
+ # TanStack管理テーブルは仮想行ごとの固定セル再計算を避け、幅変更イベントだけを通知することを確認する
61
+ it "delegates TanStack table pinning updates to the product entrypoint" do
62
+ sticky_left_columns_source = File.read(File.expand_path("../../../app/assets/javascripts/yummy_guide_administrate/sticky_left_columns.js", __dir__))
63
+ stylesheet_source = File.read(File.expand_path("../../../app/assets/stylesheets/yummy_guide_administrate/components.scss", __dir__))
64
+
65
+ expect(sticky_left_columns_source).to include('table[data-fixed-columns-count]:not([data-yummy-guide-administrate-tanstack-table])')
66
+ expect(javascript_source).to include("TANSTACK_TABLE_ATTRIBUTE = 'data-yummy-guide-administrate-tanstack-table'")
67
+ expect(javascript_source).to include("yummy-guide-administrate:column-width-change")
68
+ expect(javascript_source).to include("if (table.hasAttribute(TANSTACK_TABLE_ATTRIBUTE)) return;")
69
+ expect(stylesheet_source).to include('--yummy-guide-administrate-tanstack-column-#{$index}-left')
70
+ end
71
+
60
72
  # ドラッグ中は実テーブルを再レイアウトせず、プレビューだけを更新することを静的に確認する
61
73
  it "updates only the lightweight preview while dragging" do
62
74
  expect(javascript_source).to include("createDragPreview(sourceTable, previewHeader, startWidth, previewHeaderRect)")
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yummy-guide-generic-administrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.15
4
+ version: 0.8.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - akatsuki-kk
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-07-01 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: administrate
@@ -172,7 +171,6 @@ metadata:
172
171
  homepage_uri: https://github.com/yummy-guide/generic-administrate
173
172
  source_code_uri: https://github.com/yummy-guide/generic-administrate
174
173
  changelog_uri: https://github.com/yummy-guide/generic-administrate
175
- post_install_message:
176
174
  rdoc_options: []
177
175
  require_paths:
178
176
  - lib
@@ -187,8 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
185
  - !ruby/object:Gem::Version
188
186
  version: '0'
189
187
  requirements: []
190
- rubygems_version: 3.4.10
191
- signing_key:
188
+ rubygems_version: 4.0.21
192
189
  specification_version: 4
193
190
  summary: Shared Administrate extensions for Yummy Guide Rails apps
194
191
  test_files: []