@opendesign-plus-test/components 0.0.1-rc.303 → 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) => ({ v5b62014a: 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,16 +30475,16 @@ 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
- let e = c.value;
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;
30479
30480
  return e ? {
30480
30481
  container: e,
30481
30482
  viewTop: e === window ? document.documentElement.clientTop : e.getBoundingClientRect().top,
30482
30483
  scrollTop: e === window ? window.scrollY : e.scrollTop
30483
30484
  } : null;
30484
- }, h = () => {
30485
+ }, v = () => {
30485
30486
  if (!a.value.length) return;
30486
- let e = m();
30487
+ let e = h();
30487
30488
  if (!e) return;
30488
30489
  let t = (n.targetOffset ?? 0) + 1, r = null;
30489
30490
  for (let n of a.value) {
@@ -30492,13 +30493,31 @@ var Jw = {
30492
30493
  }
30493
30494
  r && s.value !== r && (s.value = r);
30494
30495
  };
30495
- Yt(c, "scroll", h), W(() => n.expanded, (e) => {
30496
- e && E(h);
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
+ });
30511
+ };
30512
+ W(() => n.expanded, (e) => {
30513
+ e && E(() => {
30514
+ v(), E(() => requestAnimationFrame(y));
30515
+ });
30497
30516
  }), W(() => n.items, () => {
30498
- E(h);
30517
+ E(v);
30499
30518
  }, { deep: !0 });
30500
- let v = (e) => {
30501
- let t = e.observeHref || e.href, i = document.getElementById(t.replace(/^#/, "")), a = m();
30519
+ let b = (e) => {
30520
+ let t = e.observeHref || e.href, i = document.getElementById(t.replace(/^#/, "")), a = h();
30502
30521
  if (i) {
30503
30522
  if (!a) i.scrollIntoView({
30504
30523
  behavior: "smooth",
@@ -30515,7 +30534,7 @@ var Jw = {
30515
30534
  });
30516
30535
  }
30517
30536
  }
30518
- r("close");
30537
+ n.changeHash !== !1 && e.href.startsWith("#") && window.location.hash !== e.href && (window.location.hash = e.href), r("close");
30519
30538
  };
30520
30539
  return (t, n) => (P(), f("div", tT, [p("div", {
30521
30540
  class: "o-article-anchor--mobile__fab",
@@ -30538,6 +30557,8 @@ var Jw = {
30538
30557
  }, {
30539
30558
  header: G(() => [p("span", rT, H(e.title), 1)]),
30540
30559
  default: G(() => [_(U($e), {
30560
+ ref_key: "menuRef",
30561
+ ref: c,
30541
30562
  modelValue: s.value,
30542
30563
  "onUpdate:modelValue": n[1] ||= (e) => s.value = e,
30543
30564
  class: "o-article-anchor--mobile__menu"
@@ -30545,25 +30566,35 @@ var Jw = {
30545
30566
  default: G(() => [(P(!0), f(o, null, B(e.items, (e) => (P(), f(o, { key: e.href }, [_(U(et), {
30546
30567
  class: "o-article-anchor--mobile__menu-item",
30547
30568
  value: e.href,
30548
- onClick: (t) => v(e)
30569
+ "data-anchor-href": e.href,
30570
+ onClick: (t) => b(e)
30549
30571
  }, {
30550
30572
  default: G(() => [g(H(e.title), 1)]),
30551
30573
  _: 2
30552
- }, 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), {
30553
30579
  key: e.href,
30554
30580
  value: e.href,
30581
+ "data-anchor-href": e.href,
30555
30582
  class: "o-article-anchor--mobile__menu-subitem",
30556
- onClick: (t) => v(e)
30583
+ onClick: (t) => b(e)
30557
30584
  }, {
30558
30585
  default: G(() => [g(H(e.title), 1)]),
30559
30586
  _: 2
30560
- }, 1032, ["value", "onClick"]))), 128)) : d("", !0)], 64))), 128))]),
30587
+ }, 1032, [
30588
+ "value",
30589
+ "data-anchor-href",
30590
+ "onClick"
30591
+ ]))), 128)) : d("", !0)], 64))), 128))]),
30561
30592
  _: 1
30562
30593
  }, 8, ["modelValue"])]),
30563
30594
  _: 1
30564
30595
  }, 8, ["visible", "style"])]));
30565
30596
  }
30566
- }), [["__scopeId", "data-v-71148053"]]), aT = {
30597
+ }), [["__scopeId", "data-v-48ded1e0"]]), aT = {
30567
30598
  key: 0,
30568
30599
  class: "o-article-anchor"
30569
30600
  }, oT = { class: "o-article-anchor__body" }, sT = /*#__PURE__*/ i(/* @__PURE__ */ v({
@@ -30747,6 +30778,7 @@ var Jw = {
30747
30778
  items: m.value,
30748
30779
  container: t.container,
30749
30780
  "target-offset": t.targetOffset,
30781
+ "change-hash": t.changeHash,
30750
30782
  onToggle: n[2] ||= (e) => g.value = !0,
30751
30783
  onClose: n[3] ||= (e) => g.value = !1
30752
30784
  }, null, 8, [
@@ -30755,7 +30787,8 @@ var Jw = {
30755
30787
  "expanded",
30756
30788
  "items",
30757
30789
  "container",
30758
- "target-offset"
30790
+ "target-offset",
30791
+ "change-hash"
30759
30792
  ])) : d("", !0),
30760
30793
  p("div", {
30761
30794
  ref_key: "hiddenSlotRef",
@@ -30796,7 +30829,7 @@ var Jw = {
30796
30829
  }, 512)])], 8, ["to", "disabled"]))
30797
30830
  ])) : d("", !0);
30798
30831
  }
30799
- }), [["__scopeId", "data-v-79012307"]]), cT = Object.assign(sT, { install(e) {
30832
+ }), [["__scopeId", "data-v-4f781be4"]]), cT = Object.assign(sT, { install(e) {
30800
30833
  e.component("OArticleAnchor", sT);
30801
30834
  } }), lT = Object.assign(PC, { install(e) {
30802
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_71148053_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-71148053"]]);
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) => ({ "v5b62014a": _ctx.radius }));
26
+ useCssVars((_ctx) => ({ "v26de9145": _ctx.radius }));
26
27
  const props = __props;
27
28
  const emit = __emit;
28
29
  const visible = computed({
@@ -41,6 +42,7 @@ 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;
@@ -70,8 +72,30 @@ var ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
70
72
  if (current && active.value !== current) active.value = current;
71
73
  };
72
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
+ };
73
94
  watch(() => props.expanded, (value) => {
74
- if (value) nextTick(updateActive);
95
+ if (value) nextTick(() => {
96
+ updateActive();
97
+ nextTick(() => requestAnimationFrame(scrollActiveIntoView));
98
+ });
75
99
  });
76
100
  watch(() => props.items, () => {
77
101
  nextTick(updateActive);
@@ -97,6 +121,7 @@ var ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
97
121
  });
98
122
  }
99
123
  }
124
+ if (props.changeHash !== false && item.href.startsWith("#") && window.location.hash !== item.href) window.location.hash = item.href;
100
125
  emit("close");
101
126
  };
102
127
  return (_ctx, _cache) => {
@@ -121,6 +146,8 @@ var ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
121
146
  }, {
122
147
  header: withCtx(() => [createElementVNode("span", _hoisted_3, toDisplayString(__props.title), 1)]),
123
148
  default: withCtx(() => [createVNode(unref(OMenu), {
149
+ ref_key: "menuRef",
150
+ ref: menuRef,
124
151
  modelValue: active.value,
125
152
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => active.value = $event),
126
153
  class: "o-article-anchor--mobile__menu"
@@ -129,20 +156,30 @@ var ArticleAnchorMobile_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
129
156
  return openBlock(), createElementBlock(Fragment, { key: item.href }, [createVNode(unref(OMenuItem), {
130
157
  class: "o-article-anchor--mobile__menu-item",
131
158
  value: item.href,
159
+ "data-anchor-href": item.href,
132
160
  onClick: ($event) => jump(item)
133
161
  }, {
134
162
  default: withCtx(() => [createTextVNode(toDisplayString(item.title), 1)]),
135
163
  _: 2
136
- }, 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) => {
137
169
  return openBlock(), createBlock(unref(OMenuItem), {
138
170
  key: child.href,
139
171
  value: child.href,
172
+ "data-anchor-href": child.href,
140
173
  class: "o-article-anchor--mobile__menu-subitem",
141
174
  onClick: ($event) => jump(child)
142
175
  }, {
143
176
  default: withCtx(() => [createTextVNode(toDisplayString(child.title), 1)]),
144
177
  _: 2
145
- }, 1032, ["value", "onClick"]);
178
+ }, 1032, [
179
+ "value",
180
+ "data-anchor-href",
181
+ "onClick"
182
+ ]);
146
183
  }), 128)) : createCommentVNode("", true)], 64);
147
184
  }), 128))]),
148
185
  _: 1
@@ -1,15 +1,15 @@
1
- .hover-icon-rotate .o-icon[data-v-71148053] {
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-71148053] {
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-71148053] {
10
- --o-article-anchor-radius: var(--v5b62014a);
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-71148053] {
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-71148053] {
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-71148053] {
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-71148053] {
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-71148053] {
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-71148053] {
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-71148053] {
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.303",
3
+ "version": "0.0.1-rc.304",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",