@opendesign-plus-test/components 0.0.1-rc.302 → 0.0.1-rc.304

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.
@@ -30455,7 +30455,8 @@ var Jw = {
30455
30455
  expanded: { type: Boolean },
30456
30456
  items: {},
30457
30457
  container: {},
30458
- targetOffset: {}
30458
+ targetOffset: {},
30459
+ changeHash: { type: Boolean }
30459
30460
  },
30460
30461
  emits: [
30461
30462
  "toggle",
@@ -30463,7 +30464,7 @@ var Jw = {
30463
30464
  "update:visible"
30464
30465
  ],
30465
30466
  setup(e, { emit: t }) {
30466
- ce((e) => ({ v13ec28d5: e.radius }));
30467
+ ce((e) => ({ v26de9145: e.radius }));
30467
30468
  let n = e, r = t, i = l({
30468
30469
  get: () => !!n.expanded,
30469
30470
  set: (e) => {
@@ -30474,28 +30475,66 @@ var Jw = {
30474
30475
  return n.items?.forEach((t) => {
30475
30476
  e.push(t), t.children?.length && e.push(...t.children);
30476
30477
  }), e;
30477
- }), s = R(""), c = l(() => typeof n.container == "string" ? document.querySelector(n.container) : n.container && n.container !== window ? n.container : window), m = () => {
30478
+ }), s = R(""), c = R(), m = l(() => typeof n.container == "string" ? document.querySelector(n.container) : n.container && n.container !== window ? n.container : window), h = () => {
30479
+ let e = m.value;
30480
+ return e ? {
30481
+ container: e,
30482
+ viewTop: e === window ? document.documentElement.clientTop : e.getBoundingClientRect().top,
30483
+ scrollTop: e === window ? window.scrollY : e.scrollTop
30484
+ } : null;
30485
+ }, v = () => {
30478
30486
  if (!a.value.length) return;
30479
- let e = c.value;
30487
+ let e = h();
30480
30488
  if (!e) return;
30481
- let t = e === window ? 0 : e.getBoundingClientRect().top, r = (n.targetOffset ?? 0) + 1, i = null;
30482
- for (let e of a.value) {
30483
- let n = (e.observeHref || e.href).replace(/^#/, ""), a = document.getElementById(n);
30484
- a && a.getBoundingClientRect().top - t <= r && (i = e.href);
30489
+ let t = (n.targetOffset ?? 0) + 1, r = null;
30490
+ for (let n of a.value) {
30491
+ let i = (n.observeHref || n.href).replace(/^#/, ""), a = document.getElementById(i);
30492
+ a && a.getBoundingClientRect().top - e.viewTop <= t && (r = n.href);
30485
30493
  }
30486
- i && s.value !== i && (s.value = i);
30494
+ r && s.value !== r && (s.value = r);
30495
+ };
30496
+ Yt(m, "scroll", v);
30497
+ let y = () => {
30498
+ let e = c.value?.$el;
30499
+ if (!e || !s.value) return;
30500
+ let t = e.querySelector(`[data-anchor-href="${CSS.escape(s.value)}"]`);
30501
+ if (!t) return;
30502
+ let n = t.closest(".o-scrollbar-container");
30503
+ if (!n || n.scrollHeight <= n.clientHeight) return;
30504
+ let r = n.getBoundingClientRect(), i = t.getBoundingClientRect();
30505
+ if (i.top >= r.top && i.bottom <= r.bottom) return;
30506
+ let a = n.clientHeight ? r.height / n.clientHeight : 1, o = (i.top < r.top ? i.top - r.top : i.bottom - r.bottom) / (a || 1), l = n.scrollHeight - n.clientHeight;
30507
+ n.scrollTo({
30508
+ top: Math.min(Math.max(n.scrollTop + o, 0), l),
30509
+ behavior: "smooth"
30510
+ });
30487
30511
  };
30488
- Yt(c, "scroll", m), W(() => n.expanded, (e) => {
30489
- e && E(m);
30512
+ W(() => n.expanded, (e) => {
30513
+ e && E(() => {
30514
+ v(), E(() => requestAnimationFrame(y));
30515
+ });
30490
30516
  }), W(() => n.items, () => {
30491
- E(m);
30517
+ E(v);
30492
30518
  }, { deep: !0 });
30493
- let h = (e) => {
30494
- let t = e.observeHref || e.href;
30495
- document.getElementById(t.replace(/^#/, ""))?.scrollIntoView({
30496
- behavior: "smooth",
30497
- block: "start"
30498
- }), r("close");
30519
+ let b = (e) => {
30520
+ let t = e.observeHref || e.href, i = document.getElementById(t.replace(/^#/, "")), a = h();
30521
+ if (i) {
30522
+ if (!a) i.scrollIntoView({
30523
+ behavior: "smooth",
30524
+ block: "start"
30525
+ });
30526
+ else {
30527
+ let e = a.scrollTop + i.getBoundingClientRect().top - a.viewTop - (n.targetOffset ?? 0);
30528
+ a.container === window ? window.scrollTo({
30529
+ top: e,
30530
+ behavior: "smooth"
30531
+ }) : a.container.scrollTo({
30532
+ top: e,
30533
+ behavior: "smooth"
30534
+ });
30535
+ }
30536
+ }
30537
+ n.changeHash !== !1 && e.href.startsWith("#") && window.location.hash !== e.href && (window.location.hash = e.href), r("close");
30499
30538
  };
30500
30539
  return (t, n) => (P(), f("div", tT, [p("div", {
30501
30540
  class: "o-article-anchor--mobile__fab",
@@ -30518,6 +30557,8 @@ var Jw = {
30518
30557
  }, {
30519
30558
  header: G(() => [p("span", rT, H(e.title), 1)]),
30520
30559
  default: G(() => [_(U($e), {
30560
+ ref_key: "menuRef",
30561
+ ref: c,
30521
30562
  modelValue: s.value,
30522
30563
  "onUpdate:modelValue": n[1] ||= (e) => s.value = e,
30523
30564
  class: "o-article-anchor--mobile__menu"
@@ -30525,25 +30566,35 @@ var Jw = {
30525
30566
  default: G(() => [(P(!0), f(o, null, B(e.items, (e) => (P(), f(o, { key: e.href }, [_(U(et), {
30526
30567
  class: "o-article-anchor--mobile__menu-item",
30527
30568
  value: e.href,
30528
- onClick: (t) => h(e)
30569
+ "data-anchor-href": e.href,
30570
+ onClick: (t) => b(e)
30529
30571
  }, {
30530
30572
  default: G(() => [g(H(e.title), 1)]),
30531
30573
  _: 2
30532
- }, 1032, ["value", "onClick"]), e.children?.length ? (P(!0), f(o, { key: 0 }, B(e.children, (e) => (P(), u(U(et), {
30574
+ }, 1032, [
30575
+ "value",
30576
+ "data-anchor-href",
30577
+ "onClick"
30578
+ ]), e.children?.length ? (P(!0), f(o, { key: 0 }, B(e.children, (e) => (P(), u(U(et), {
30533
30579
  key: e.href,
30534
30580
  value: e.href,
30581
+ "data-anchor-href": e.href,
30535
30582
  class: "o-article-anchor--mobile__menu-subitem",
30536
- onClick: (t) => h(e)
30583
+ onClick: (t) => b(e)
30537
30584
  }, {
30538
30585
  default: G(() => [g(H(e.title), 1)]),
30539
30586
  _: 2
30540
- }, 1032, ["value", "onClick"]))), 128)) : d("", !0)], 64))), 128))]),
30587
+ }, 1032, [
30588
+ "value",
30589
+ "data-anchor-href",
30590
+ "onClick"
30591
+ ]))), 128)) : d("", !0)], 64))), 128))]),
30541
30592
  _: 1
30542
30593
  }, 8, ["modelValue"])]),
30543
30594
  _: 1
30544
30595
  }, 8, ["visible", "style"])]));
30545
30596
  }
30546
- }), [["__scopeId", "data-v-6012bec2"]]), aT = {
30597
+ }), [["__scopeId", "data-v-48ded1e0"]]), aT = {
30547
30598
  key: 0,
30548
30599
  class: "o-article-anchor"
30549
30600
  }, oT = { class: "o-article-anchor__body" }, sT = /*#__PURE__*/ i(/* @__PURE__ */ v({
@@ -30727,6 +30778,7 @@ var Jw = {
30727
30778
  items: m.value,
30728
30779
  container: t.container,
30729
30780
  "target-offset": t.targetOffset,
30781
+ "change-hash": t.changeHash,
30730
30782
  onToggle: n[2] ||= (e) => g.value = !0,
30731
30783
  onClose: n[3] ||= (e) => g.value = !1
30732
30784
  }, null, 8, [
@@ -30735,7 +30787,8 @@ var Jw = {
30735
30787
  "expanded",
30736
30788
  "items",
30737
30789
  "container",
30738
- "target-offset"
30790
+ "target-offset",
30791
+ "change-hash"
30739
30792
  ])) : d("", !0),
30740
30793
  p("div", {
30741
30794
  ref_key: "hiddenSlotRef",
@@ -30776,7 +30829,7 @@ var Jw = {
30776
30829
  }, 512)])], 8, ["to", "disabled"]))
30777
30830
  ])) : d("", !0);
30778
30831
  }
30779
- }), [["__scopeId", "data-v-79012307"]]), cT = Object.assign(sT, { install(e) {
30832
+ }), [["__scopeId", "data-v-4f781be4"]]), cT = Object.assign(sT, { install(e) {
30780
30833
  e.component("OArticleAnchor", sT);
30781
30834
  } }), lT = Object.assign(PC, { install(e) {
30782
30835
  e.component("OArticlePagination", PC);
@@ -1,6 +1,6 @@
1
1
  import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export-helper.mjs";
2
2
  import OArticleAnchor_vue_vue_type_script_setup_true_lang_default from "./OArticleAnchor.vue_vue_type_script_setup_true_lang.mjs";
3
- import './OArticleAnchor.vue_vue_type_style_index_0_scoped_79012307_lang.css';
3
+ import './OArticleAnchor.vue_vue_type_style_index_0_scoped_4f781be4_lang.css';
4
4
  // src/components/article-anchor/OArticleAnchor.vue
5
- var OArticleAnchor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(OArticleAnchor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-79012307"]]);
5
+ var OArticleAnchor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(OArticleAnchor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-4f781be4"]]);
6
6
  export { OArticleAnchor_default as default };
@@ -279,6 +279,7 @@ var OArticleAnchor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
279
279
  items: items.value,
280
280
  container: __props.container,
281
281
  "target-offset": __props.targetOffset,
282
+ "change-hash": __props.changeHash,
282
283
  onToggle: _cache[2] || (_cache[2] = ($event) => expanded.value = true),
283
284
  onClose: _cache[3] || (_cache[3] = ($event) => expanded.value = false)
284
285
  }, null, 8, [
@@ -287,7 +288,8 @@ var OArticleAnchor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
287
288
  "expanded",
288
289
  "items",
289
290
  "container",
290
- "target-offset"
291
+ "target-offset",
292
+ "change-hash"
291
293
  ])) : createCommentVNode("", true),
292
294
  createElementVNode("div", {
293
295
  ref_key: "hiddenSlotRef",
@@ -1,37 +1,37 @@
1
- .hover-icon-rotate .o-icon[data-v-79012307] {
1
+ .hover-icon-rotate .o-icon[data-v-4f781be4] {
2
2
  transition: all var(--o-duration-m1) var(--o-easing-standard-in);
3
3
  }
4
4
  @media (hover: hover) {
5
- .hover-icon-rotate:hover .o-icon[data-v-79012307] {
5
+ .hover-icon-rotate:hover .o-icon[data-v-4f781be4] {
6
6
  transform: rotate(-180deg);
7
7
  }
8
8
  }
9
- .o-article-anchor[data-v-79012307] {
9
+ .o-article-anchor[data-v-4f781be4] {
10
10
  --o-article-height: var(--o-doc-layout-anchor-max-height, 70vh);
11
11
  }
12
- .o-article-anchor .o-article-anchor__body[data-v-79012307] .o-scroller {
12
+ .o-article-anchor .o-article-anchor__body[data-v-4f781be4] .o-scroller {
13
13
  max-height: calc(var(--o-article-height) - 86px);
14
14
  }
15
15
  @media (max-width: 1680px) {
16
- .o-article-anchor .o-article-anchor__body[data-v-79012307] .o-scroller {
16
+ .o-article-anchor .o-article-anchor__body[data-v-4f781be4] .o-scroller {
17
17
  max-height: calc(var(--o-article-height) - 62px);
18
18
  }
19
19
  }
20
20
  @media (max-width: 1200px) {
21
- .o-article-anchor .o-article-anchor__body[data-v-79012307] .o-scroller {
21
+ .o-article-anchor .o-article-anchor__body[data-v-4f781be4] .o-scroller {
22
22
  max-height: calc(var(--o-article-height) - 66px);
23
23
  }
24
24
  }
25
- .o-article-anchor .o-article-anchor__body[data-v-79012307] .o-scroller .o-scrollbar {
25
+ .o-article-anchor .o-article-anchor__body[data-v-4f781be4] .o-scroller .o-scrollbar {
26
26
  --scrollbar-y-right: -6px;
27
27
  }
28
- .o-article-anchor .o-article-anchor__body[data-v-79012307] .o-anchor {
28
+ .o-article-anchor .o-article-anchor__body[data-v-4f781be4] .o-anchor {
29
29
  --anchor-item-link-color: var(--o-color-info2);
30
30
  --anchor-item-link-color-active: var(--o-color-primary1);
31
31
  --anchor-item-link-color-hover: var(--o-color-primary2);
32
32
  --anchor-item-link-color-press: var(--o-color-primary3);
33
33
  --anchor-line-bg-color: var(--o-color-control4);
34
34
  }
35
- .o-article-anchor .o-article-anchor--hidden[data-v-79012307] {
35
+ .o-article-anchor .o-article-anchor--hidden[data-v-4f781be4] {
36
36
  display: none;
37
37
  }
@@ -1,6 +1,6 @@
1
1
  import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_export-helper.mjs";
2
2
  import ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default from "./ArticleAnchorMobile.vue_vue_type_script_setup_true_lang.mjs";
3
- import './ArticleAnchorMobile.vue_vue_type_style_index_0_scoped_6012bec2_lang.css';
3
+ import './ArticleAnchorMobile.vue_vue_type_style_index_0_scoped_48ded1e0_lang.css';
4
4
  // src/components/article-anchor/components/ArticleAnchorMobile.vue
5
- var ArticleAnchorMobile_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-6012bec2"]]);
5
+ var ArticleAnchorMobile_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-48ded1e0"]]);
6
6
  export { ArticleAnchorMobile_default as default };
@@ -1,3 +1,4 @@
1
+ import { nextTick } from 'vue';
1
2
  import { ArticleAnchorItemT } from '../types';
2
3
  type __VLS_Props = {
3
4
  title?: string;
@@ -6,6 +7,7 @@ type __VLS_Props = {
6
7
  items?: ArticleAnchorItemT[];
7
8
  container?: string | HTMLElement | Window;
8
9
  targetOffset?: number;
10
+ changeHash?: boolean;
9
11
  };
10
12
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
13
  close: () => any;
@@ -15,5 +17,158 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
15
17
  onClose?: (() => any) | undefined;
16
18
  onToggle?: (() => any) | undefined;
17
19
  "onUpdate:visible"?: ((args_0: boolean) => any) | undefined;
18
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
20
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
21
+ menuRef: ({
22
+ $: import('vue').ComponentInternalInstance;
23
+ $data: {};
24
+ $props: Partial<{
25
+ size: "medium" | "small";
26
+ defaultValue: string;
27
+ accordion: boolean;
28
+ defaultExpanded: string[];
29
+ selectStrictly: boolean;
30
+ arrowPosition: "left" | "right";
31
+ }> & Omit<{
32
+ readonly size: "small" | "medium";
33
+ readonly defaultValue: string;
34
+ readonly accordion: boolean;
35
+ readonly defaultExpanded: string[];
36
+ readonly selectStrictly: boolean;
37
+ readonly arrowPosition: "left" | "right";
38
+ readonly modelValue?: string | undefined;
39
+ readonly expanded?: string[] | undefined;
40
+ readonly onChange?: ((val: string) => any) | undefined | undefined;
41
+ readonly "onUpdate:modelValue"?: ((val: string) => any) | undefined | undefined;
42
+ readonly "onUpdate:expanded"?: ((val: string[]) => any) | undefined | undefined;
43
+ readonly "onExpanded-change"?: ((val: string[]) => any) | undefined | undefined;
44
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "size" | "defaultValue" | "accordion" | "defaultExpanded" | "selectStrictly" | "arrowPosition">;
45
+ $attrs: import('vue').Attrs;
46
+ $refs: {
47
+ [x: string]: unknown;
48
+ };
49
+ $slots: Readonly<{
50
+ [name: string]: import('vue').Slot<any> | undefined;
51
+ }>;
52
+ $root: import('vue').ComponentPublicInstance | null;
53
+ $parent: import('vue').ComponentPublicInstance | null;
54
+ $host: Element | null;
55
+ $emit: ((event: "change", val: string) => void) & ((event: "update:modelValue", val: string) => void) & ((event: "update:expanded", val: string[]) => void) & ((event: "expanded-change", val: string[]) => void);
56
+ $el: HTMLUListElement;
57
+ $options: import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
58
+ size: {
59
+ type: import('vue').PropType<import('@opensig/opendesign').MenuSizeT>;
60
+ default: string;
61
+ };
62
+ accordion: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
66
+ modelValue: {
67
+ type: StringConstructor;
68
+ };
69
+ defaultValue: {
70
+ type: StringConstructor;
71
+ default: string;
72
+ };
73
+ expanded: {
74
+ type: import('vue').PropType<Array<string>>;
75
+ };
76
+ defaultExpanded: {
77
+ type: import('vue').PropType<Array<string>>;
78
+ default: () => never[];
79
+ };
80
+ selectStrictly: {
81
+ type: BooleanConstructor;
82
+ default: boolean;
83
+ };
84
+ arrowPosition: {
85
+ type: import('vue').PropType<"left" | "right">;
86
+ default: string;
87
+ };
88
+ }>> & Readonly<{
89
+ onChange?: ((val: string) => any) | undefined;
90
+ "onUpdate:modelValue"?: ((val: string) => any) | undefined;
91
+ "onUpdate:expanded"?: ((val: string[]) => any) | undefined;
92
+ "onExpanded-change"?: ((val: string[]) => any) | undefined;
93
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
94
+ change: (val: string) => any;
95
+ "update:modelValue": (val: string) => any;
96
+ "update:expanded": (val: string[]) => any;
97
+ "expanded-change": (val: string[]) => any;
98
+ }, string, {
99
+ size: "medium" | "small";
100
+ defaultValue: string;
101
+ accordion: boolean;
102
+ defaultExpanded: string[];
103
+ selectStrictly: boolean;
104
+ arrowPosition: "left" | "right";
105
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
106
+ beforeCreate?: (() => void) | (() => void)[];
107
+ created?: (() => void) | (() => void)[];
108
+ beforeMount?: (() => void) | (() => void)[];
109
+ mounted?: (() => void) | (() => void)[];
110
+ beforeUpdate?: (() => void) | (() => void)[];
111
+ updated?: (() => void) | (() => void)[];
112
+ activated?: (() => void) | (() => void)[];
113
+ deactivated?: (() => void) | (() => void)[];
114
+ beforeDestroy?: (() => void) | (() => void)[];
115
+ beforeUnmount?: (() => void) | (() => void)[];
116
+ destroyed?: (() => void) | (() => void)[];
117
+ unmounted?: (() => void) | (() => void)[];
118
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
119
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
120
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
121
+ };
122
+ $forceUpdate: () => void;
123
+ $nextTick: typeof nextTick;
124
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
125
+ } & Readonly<{
126
+ size: "medium" | "small";
127
+ defaultValue: string;
128
+ accordion: boolean;
129
+ defaultExpanded: string[];
130
+ selectStrictly: boolean;
131
+ arrowPosition: "left" | "right";
132
+ }> & Omit<Readonly<import('vue').ExtractPropTypes<{
133
+ size: {
134
+ type: import('vue').PropType<import('@opensig/opendesign').MenuSizeT>;
135
+ default: string;
136
+ };
137
+ accordion: {
138
+ type: BooleanConstructor;
139
+ default: boolean;
140
+ };
141
+ modelValue: {
142
+ type: StringConstructor;
143
+ };
144
+ defaultValue: {
145
+ type: StringConstructor;
146
+ default: string;
147
+ };
148
+ expanded: {
149
+ type: import('vue').PropType<Array<string>>;
150
+ };
151
+ defaultExpanded: {
152
+ type: import('vue').PropType<Array<string>>;
153
+ default: () => never[];
154
+ };
155
+ selectStrictly: {
156
+ type: BooleanConstructor;
157
+ default: boolean;
158
+ };
159
+ arrowPosition: {
160
+ type: import('vue').PropType<"left" | "right">;
161
+ default: string;
162
+ };
163
+ }>> & Readonly<{
164
+ onChange?: ((val: string) => any) | undefined;
165
+ "onUpdate:modelValue"?: ((val: string) => any) | undefined;
166
+ "onUpdate:expanded"?: ((val: string[]) => any) | undefined;
167
+ "onExpanded-change"?: ((val: string[]) => any) | undefined;
168
+ }>, "size" | "defaultValue" | "accordion" | "defaultExpanded" | "selectStrictly" | "arrowPosition"> & {} & import('vue').ComponentCustomProperties & {} & {
169
+ $slots: {
170
+ default?(_: {}): any;
171
+ };
172
+ }) | null;
173
+ }, HTMLDivElement>;
19
174
  export default _default;
@@ -14,7 +14,8 @@ var ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
14
14
  expanded: { type: Boolean },
15
15
  items: {},
16
16
  container: {},
17
- targetOffset: {}
17
+ targetOffset: {},
18
+ changeHash: { type: Boolean }
18
19
  },
19
20
  emits: [
20
21
  "toggle",
@@ -22,7 +23,7 @@ var ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
22
23
  "update:visible"
23
24
  ],
24
25
  setup(__props, { emit: __emit }) {
25
- useCssVars((_ctx) => ({ "v13ec28d5": _ctx.radius }));
26
+ useCssVars((_ctx) => ({ "v26de9145": _ctx.radius }));
26
27
  const props = __props;
27
28
  const emit = __emit;
28
29
  const visible = computed({
@@ -41,39 +42,86 @@ var ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
41
42
  return list;
42
43
  });
43
44
  const active = ref("");
45
+ const menuRef = ref();
44
46
  const scrollTarget = computed(() => {
45
47
  if (typeof props.container === "string") return document.querySelector(props.container);
46
48
  if (props.container && props.container !== window) return props.container;
47
49
  return window;
48
50
  });
51
+ const getScrollState = () => {
52
+ const container = scrollTarget.value;
53
+ if (!container) return null;
54
+ return {
55
+ container,
56
+ viewTop: container === window ? document.documentElement.clientTop : container.getBoundingClientRect().top,
57
+ scrollTop: container === window ? window.scrollY : container.scrollTop
58
+ };
59
+ };
49
60
  const updateActive = () => {
50
61
  if (!flatItems.value.length) return;
51
- const container = scrollTarget.value;
52
- if (!container) return;
53
- const containerTop = container === window ? 0 : container.getBoundingClientRect().top;
62
+ const scrollState = getScrollState();
63
+ if (!scrollState) return;
54
64
  const offset = (props.targetOffset ?? 0) + 1;
55
65
  let current = null;
56
66
  for (const item of flatItems.value) {
57
67
  const observeId = (item.observeHref || item.href).replace(/^#/, "");
58
68
  const el = document.getElementById(observeId);
59
69
  if (!el) continue;
60
- if (el.getBoundingClientRect().top - containerTop <= offset) current = item.href;
70
+ if (el.getBoundingClientRect().top - scrollState.viewTop <= offset) current = item.href;
61
71
  }
62
72
  if (current && active.value !== current) active.value = current;
63
73
  };
64
74
  useEventListener(scrollTarget, "scroll", updateActive);
75
+ /** 打开弹窗后,高亮项若未完整显示在滚动容器内,最小滚动量补全 */
76
+ const scrollActiveIntoView = () => {
77
+ const rootEl = menuRef.value?.$el;
78
+ if (!rootEl || !active.value) return;
79
+ const item = rootEl.querySelector(`[data-anchor-href="${CSS.escape(active.value)}"]`);
80
+ if (!item) return;
81
+ const containerEl = item.closest(".o-scrollbar-container");
82
+ if (!containerEl || containerEl.scrollHeight <= containerEl.clientHeight) return;
83
+ const cRect = containerEl.getBoundingClientRect();
84
+ const eRect = item.getBoundingClientRect();
85
+ if (eRect.top >= cRect.top && eRect.bottom <= cRect.bottom) return;
86
+ const scale = containerEl.clientHeight ? cRect.height / containerEl.clientHeight : 1;
87
+ const delta = (eRect.top < cRect.top ? eRect.top - cRect.top : eRect.bottom - cRect.bottom) / (scale || 1);
88
+ const maxTop = containerEl.scrollHeight - containerEl.clientHeight;
89
+ containerEl.scrollTo({
90
+ top: Math.min(Math.max(containerEl.scrollTop + delta, 0), maxTop),
91
+ behavior: "smooth"
92
+ });
93
+ };
65
94
  watch(() => props.expanded, (value) => {
66
- if (value) nextTick(updateActive);
95
+ if (value) nextTick(() => {
96
+ updateActive();
97
+ nextTick(() => requestAnimationFrame(scrollActiveIntoView));
98
+ });
67
99
  });
68
100
  watch(() => props.items, () => {
69
101
  nextTick(updateActive);
70
102
  }, { deep: true });
71
103
  const jump = (item) => {
72
104
  const target = item.observeHref || item.href;
73
- document.getElementById(target.replace(/^#/, ""))?.scrollIntoView({
74
- behavior: "smooth",
75
- block: "start"
76
- });
105
+ const el = document.getElementById(target.replace(/^#/, ""));
106
+ const scrollState = getScrollState();
107
+ if (el) {
108
+ if (!scrollState) el.scrollIntoView({
109
+ behavior: "smooth",
110
+ block: "start"
111
+ });
112
+ else {
113
+ const top = scrollState.scrollTop + el.getBoundingClientRect().top - scrollState.viewTop - (props.targetOffset ?? 0);
114
+ if (scrollState.container === window) window.scrollTo({
115
+ top,
116
+ behavior: "smooth"
117
+ });
118
+ else scrollState.container.scrollTo({
119
+ top,
120
+ behavior: "smooth"
121
+ });
122
+ }
123
+ }
124
+ if (props.changeHash !== false && item.href.startsWith("#") && window.location.hash !== item.href) window.location.hash = item.href;
77
125
  emit("close");
78
126
  };
79
127
  return (_ctx, _cache) => {
@@ -98,6 +146,8 @@ var ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
98
146
  }, {
99
147
  header: withCtx(() => [createElementVNode("span", _hoisted_3, toDisplayString(__props.title), 1)]),
100
148
  default: withCtx(() => [createVNode(unref(OMenu), {
149
+ ref_key: "menuRef",
150
+ ref: menuRef,
101
151
  modelValue: active.value,
102
152
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => active.value = $event),
103
153
  class: "o-article-anchor--mobile__menu"
@@ -106,20 +156,30 @@ var ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
106
156
  return openBlock(), createElementBlock(Fragment, { key: item.href }, [createVNode(unref(OMenuItem), {
107
157
  class: "o-article-anchor--mobile__menu-item",
108
158
  value: item.href,
159
+ "data-anchor-href": item.href,
109
160
  onClick: ($event) => jump(item)
110
161
  }, {
111
162
  default: withCtx(() => [createTextVNode(toDisplayString(item.title), 1)]),
112
163
  _: 2
113
- }, 1032, ["value", "onClick"]), item.children?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(item.children, (child) => {
164
+ }, 1032, [
165
+ "value",
166
+ "data-anchor-href",
167
+ "onClick"
168
+ ]), item.children?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(item.children, (child) => {
114
169
  return openBlock(), createBlock(unref(OMenuItem), {
115
170
  key: child.href,
116
171
  value: child.href,
172
+ "data-anchor-href": child.href,
117
173
  class: "o-article-anchor--mobile__menu-subitem",
118
174
  onClick: ($event) => jump(child)
119
175
  }, {
120
176
  default: withCtx(() => [createTextVNode(toDisplayString(child.title), 1)]),
121
177
  _: 2
122
- }, 1032, ["value", "onClick"]);
178
+ }, 1032, [
179
+ "value",
180
+ "data-anchor-href",
181
+ "onClick"
182
+ ]);
123
183
  }), 128)) : createCommentVNode("", true)], 64);
124
184
  }), 128))]),
125
185
  _: 1
@@ -1,15 +1,15 @@
1
- .hover-icon-rotate .o-icon[data-v-6012bec2] {
1
+ .hover-icon-rotate .o-icon[data-v-48ded1e0] {
2
2
  transition: all var(--o-duration-m1) var(--o-easing-standard-in);
3
3
  }
4
4
  @media (hover: hover) {
5
- .hover-icon-rotate:hover .o-icon[data-v-6012bec2] {
5
+ .hover-icon-rotate:hover .o-icon[data-v-48ded1e0] {
6
6
  transform: rotate(-180deg);
7
7
  }
8
8
  }
9
- .o-article-anchor--mobile[data-v-6012bec2] {
10
- --o-article-anchor-radius: var(--v13ec28d5);
9
+ .o-article-anchor--mobile[data-v-48ded1e0] {
10
+ --o-article-anchor-radius: var(--v26de9145);
11
11
  }
12
- .o-article-anchor--mobile__fab[data-v-6012bec2] {
12
+ .o-article-anchor--mobile__fab[data-v-48ded1e0] {
13
13
  display: flex;
14
14
  align-items: center;
15
15
  justify-content: center;
@@ -21,27 +21,27 @@
21
21
  border-radius: var(--o-article-anchor-radius);
22
22
  box-shadow: var(--o-shadow-2);
23
23
  }
24
- .o-article-anchor--mobile__fab-icon[data-v-6012bec2] {
24
+ .o-article-anchor--mobile__fab-icon[data-v-48ded1e0] {
25
25
  font-size: 24px;
26
26
  color: var(--o-color-info2);
27
27
  line-height: 1;
28
28
  }
29
- .o-article-anchor--mobile__sheet-title[data-v-6012bec2] {
29
+ .o-article-anchor--mobile__sheet-title[data-v-48ded1e0] {
30
30
  color: var(--o-color-info1);
31
31
  font-weight: 600;
32
32
  font-size: 18px;
33
33
  line-height: 26px;
34
34
  }
35
- .o-article-anchor--mobile__menu[data-v-6012bec2] {
35
+ .o-article-anchor--mobile__menu[data-v-48ded1e0] {
36
36
  --menu-width: 100%;
37
37
  }
38
- .o-article-anchor--mobile__menu-item[data-v-6012bec2] {
38
+ .o-article-anchor--mobile__menu-item[data-v-48ded1e0] {
39
39
  padding: 12px 16px;
40
40
  }
41
- .o-article-anchor--mobile__menu-subitem[data-v-6012bec2] {
41
+ .o-article-anchor--mobile__menu-subitem[data-v-48ded1e0] {
42
42
  padding: 12px 16px;
43
43
  padding-left: 28px;
44
44
  }
45
- [data-o-theme*=dark] .o-article-anchor--mobile__fab[data-v-6012bec2] {
45
+ [data-o-theme*=dark] .o-article-anchor--mobile__fab[data-v-48ded1e0] {
46
46
  border: 1px solid var(--o-color-control4);
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendesign-plus-test/components",
3
- "version": "0.0.1-rc.302",
3
+ "version": "0.0.1-rc.304",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",