ninemoon-ui 0.0.19 → 0.0.20

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.
@@ -5,7 +5,6 @@ declare const _default: import("vue").DefineComponent<{
5
5
  };
6
6
  active: {
7
7
  type: import("vue").PropType<string>;
8
- default: string;
9
8
  };
10
9
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:active"[], "update:active", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
11
10
  type: {
@@ -14,12 +13,10 @@ declare const _default: import("vue").DefineComponent<{
14
13
  };
15
14
  active: {
16
15
  type: import("vue").PropType<string>;
17
- default: string;
18
16
  };
19
17
  }>> & {
20
18
  "onUpdate:active"?: ((...args: any[]) => any) | undefined;
21
19
  }, {
22
20
  type: "line" | "card";
23
- active: string;
24
21
  }, {}>;
25
22
  export default _default;
package/dist/index.d.ts CHANGED
@@ -2284,7 +2284,6 @@ declare const LibTabs: import("vue").DefineComponent<{
2284
2284
  };
2285
2285
  active: {
2286
2286
  type: import("vue").PropType<string>;
2287
- default: string;
2288
2287
  };
2289
2288
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:active"[], "update:active", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
2290
2289
  type: {
@@ -2293,13 +2292,11 @@ declare const LibTabs: import("vue").DefineComponent<{
2293
2292
  };
2294
2293
  active: {
2295
2294
  type: import("vue").PropType<string>;
2296
- default: string;
2297
2295
  };
2298
2296
  }>> & {
2299
2297
  "onUpdate:active"?: ((...args: any[]) => any) | undefined;
2300
2298
  }, {
2301
2299
  type: "line" | "card";
2302
- active: string;
2303
2300
  }, {}>;
2304
2301
  declare const LibTabsPane: {
2305
2302
  new (...args: any[]): {
package/dist/index.umd.js CHANGED
@@ -5224,16 +5224,13 @@
5224
5224
  const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
5225
5225
  __name: "tabs",
5226
5226
  props: {
5227
- active: { default: "" },
5227
+ active: {},
5228
5228
  type: { default: "line" }
5229
5229
  },
5230
5230
  emits: ["update:active"],
5231
5231
  setup(__props, { emit }) {
5232
5232
  const props = __props;
5233
5233
  const showBaseline = vue.computed(() => props.type === "line");
5234
- const changeHandle = (name) => {
5235
- emit("update:active", name);
5236
- };
5237
5234
  const noactive = vue.computed(() => props.active == null);
5238
5235
  const activename = vue.ref("");
5239
5236
  const currentActive = vue.computed({
@@ -5241,7 +5238,7 @@
5241
5238
  if (noactive.value) {
5242
5239
  activename.value = val;
5243
5240
  } else {
5244
- changeHandle(val);
5241
+ emit("update:active", val);
5245
5242
  }
5246
5243
  },
5247
5244
  get() {
@@ -5256,6 +5253,25 @@
5256
5253
  const arrowNum = vue.ref(8);
5257
5254
  const arrowWidth = vue.ref(0);
5258
5255
  const slots = vue.useSlots();
5256
+ const renderBar = () => {
5257
+ return vue.h(
5258
+ "div",
5259
+ {
5260
+ class: vue.normalizeClass(["ETab", [props.type === "line" ? "tdd-px-2 tdd-pt-2" : " ETab_Card"]])
5261
+ },
5262
+ slots.default().map((it, index2) => {
5263
+ if (typeof it.children == "string")
5264
+ return null;
5265
+ if (Array.isArray(it.children)) {
5266
+ return it.children.map((simple, i) => {
5267
+ return renderBtn(simple, i);
5268
+ });
5269
+ } else {
5270
+ return renderBtn(it, index2);
5271
+ }
5272
+ })
5273
+ );
5274
+ };
5259
5275
  const renderBtn = (node, index2) => {
5260
5276
  let btc = [];
5261
5277
  let divc = [];
@@ -5303,39 +5319,6 @@
5303
5319
  )
5304
5320
  );
5305
5321
  };
5306
- const renderBar = () => {
5307
- return vue.h(
5308
- "div",
5309
- {
5310
- class: vue.normalizeClass(["ETab", [props.type === "line" ? "tdd-px-2 tdd-pt-2" : " ETab_Card"]])
5311
- },
5312
- slots.default().map((it, index2) => {
5313
- if (typeof it.children == "string")
5314
- return null;
5315
- if (Array.isArray(it.children)) {
5316
- return it.children.map((simple, i) => {
5317
- return renderBtn(simple, i);
5318
- });
5319
- } else {
5320
- return renderBtn(it, index2);
5321
- }
5322
- })
5323
- );
5324
- };
5325
- const contentHandle = (it, i) => {
5326
- if (currentActive.value === "") {
5327
- activeIndex.value = i;
5328
- currentActive.value = it.props.name;
5329
- } else if (currentActive.value === it.props.name) {
5330
- activeIndex.value = i;
5331
- }
5332
- return vue.withDirectives(
5333
- vue.h(it, {
5334
- key: it.props.name
5335
- }),
5336
- [[vue.vShow, currentActive.value === "" || currentActive.value === it.props.name]]
5337
- );
5338
- };
5339
5322
  const renderContent = () => {
5340
5323
  let defaultindex = -1;
5341
5324
  return vue.h(
@@ -5356,18 +5339,43 @@
5356
5339
  })
5357
5340
  );
5358
5341
  };
5359
- const btnBar = vue.ref();
5342
+ const contentHandle = (it, i) => {
5343
+ if (currentActive.value === it.props.name) {
5344
+ activeIndex.value = i;
5345
+ }
5346
+ return vue.withDirectives(
5347
+ vue.h(it, {
5348
+ key: it.props.name
5349
+ }),
5350
+ [[vue.vShow, activeIndex.value === i]]
5351
+ );
5352
+ };
5353
+ const observerRef = vue.ref();
5354
+ let observer;
5360
5355
  vue.onMounted(() => {
5361
- if (showBaseline.value) {
5362
- const aim = btnBar.value.children[activeIndex.value];
5363
- arrowWidth.value = aim.children[0].innerHTML.length * 14;
5356
+ observer = new IntersectionObserver((entries) => {
5357
+ entries.forEach((entry) => {
5358
+ if (entry.isIntersecting) {
5359
+ const aim = observerRef.value.children[activeIndex.value];
5360
+ arrowWidth.value = aim.offsetWidth;
5361
+ arrowNum.value = aim.offsetLeft;
5362
+ }
5363
+ });
5364
+ });
5365
+ if (observerRef.value) {
5366
+ observer.observe(observerRef.value);
5367
+ }
5368
+ });
5369
+ vue.onUnmounted(() => {
5370
+ if (observerRef.value) {
5371
+ observer.unobserve(observerRef.value);
5364
5372
  }
5365
5373
  });
5366
5374
  return (_ctx, _cache) => {
5367
5375
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
5368
5376
  vue.createVNode(renderBar, {
5369
- ref_key: "btnBar",
5370
- ref: btnBar
5377
+ ref_key: "observerRef",
5378
+ ref: observerRef
5371
5379
  }, null, 512),
5372
5380
  showBaseline.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
5373
5381
  vue.createElementVNode("div", {
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, ref, useSlots, onMounted, openBlock, createElementBlock, createVNode, createElementVNode, normalizeStyle, createCommentVNode, h, normalizeClass, withDirectives, vShow } from "vue";
1
+ import { defineComponent, computed, ref, useSlots, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, createElementVNode, normalizeStyle, createCommentVNode, h, normalizeClass, withDirectives, vShow } from "vue";
2
2
  const _hoisted_1 = { class: "tdd-relative tdd-w-full tdd-overflow-hidden" };
3
3
  const _hoisted_2 = {
4
4
  key: 0,
@@ -8,16 +8,13 @@ const _hoisted_3 = { class: "tdd-relative tdd-w-full" };
8
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
9
9
  __name: "tabs",
10
10
  props: {
11
- active: { default: "" },
11
+ active: {},
12
12
  type: { default: "line" }
13
13
  },
14
14
  emits: ["update:active"],
15
15
  setup(__props, { emit }) {
16
16
  const props = __props;
17
17
  const showBaseline = computed(() => props.type === "line");
18
- const changeHandle = (name) => {
19
- emit("update:active", name);
20
- };
21
18
  const noactive = computed(() => props.active == null);
22
19
  const activename = ref("");
23
20
  const currentActive = computed({
@@ -25,7 +22,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25
22
  if (noactive.value) {
26
23
  activename.value = val;
27
24
  } else {
28
- changeHandle(val);
25
+ emit("update:active", val);
29
26
  }
30
27
  },
31
28
  get() {
@@ -40,6 +37,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40
37
  const arrowNum = ref(8);
41
38
  const arrowWidth = ref(0);
42
39
  const slots = useSlots();
40
+ const renderBar = () => {
41
+ return h(
42
+ "div",
43
+ {
44
+ class: normalizeClass(["ETab", [props.type === "line" ? "tdd-px-2 tdd-pt-2" : " ETab_Card"]])
45
+ },
46
+ slots.default().map((it, index) => {
47
+ if (typeof it.children == "string")
48
+ return null;
49
+ if (Array.isArray(it.children)) {
50
+ return it.children.map((simple, i) => {
51
+ return renderBtn(simple, i);
52
+ });
53
+ } else {
54
+ return renderBtn(it, index);
55
+ }
56
+ })
57
+ );
58
+ };
43
59
  const renderBtn = (node, index) => {
44
60
  let btc = [];
45
61
  let divc = [];
@@ -87,39 +103,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
87
103
  )
88
104
  );
89
105
  };
90
- const renderBar = () => {
91
- return h(
92
- "div",
93
- {
94
- class: normalizeClass(["ETab", [props.type === "line" ? "tdd-px-2 tdd-pt-2" : " ETab_Card"]])
95
- },
96
- slots.default().map((it, index) => {
97
- if (typeof it.children == "string")
98
- return null;
99
- if (Array.isArray(it.children)) {
100
- return it.children.map((simple, i) => {
101
- return renderBtn(simple, i);
102
- });
103
- } else {
104
- return renderBtn(it, index);
105
- }
106
- })
107
- );
108
- };
109
- const contentHandle = (it, i) => {
110
- if (currentActive.value === "") {
111
- activeIndex.value = i;
112
- currentActive.value = it.props.name;
113
- } else if (currentActive.value === it.props.name) {
114
- activeIndex.value = i;
115
- }
116
- return withDirectives(
117
- h(it, {
118
- key: it.props.name
119
- }),
120
- [[vShow, currentActive.value === "" || currentActive.value === it.props.name]]
121
- );
122
- };
123
106
  const renderContent = () => {
124
107
  let defaultindex = -1;
125
108
  return h(
@@ -140,18 +123,43 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
140
123
  })
141
124
  );
142
125
  };
143
- const btnBar = ref();
126
+ const contentHandle = (it, i) => {
127
+ if (currentActive.value === it.props.name) {
128
+ activeIndex.value = i;
129
+ }
130
+ return withDirectives(
131
+ h(it, {
132
+ key: it.props.name
133
+ }),
134
+ [[vShow, activeIndex.value === i]]
135
+ );
136
+ };
137
+ const observerRef = ref();
138
+ let observer;
144
139
  onMounted(() => {
145
- if (showBaseline.value) {
146
- const aim = btnBar.value.children[activeIndex.value];
147
- arrowWidth.value = aim.children[0].innerHTML.length * 14;
140
+ observer = new IntersectionObserver((entries) => {
141
+ entries.forEach((entry) => {
142
+ if (entry.isIntersecting) {
143
+ const aim = observerRef.value.children[activeIndex.value];
144
+ arrowWidth.value = aim.offsetWidth;
145
+ arrowNum.value = aim.offsetLeft;
146
+ }
147
+ });
148
+ });
149
+ if (observerRef.value) {
150
+ observer.observe(observerRef.value);
151
+ }
152
+ });
153
+ onUnmounted(() => {
154
+ if (observerRef.value) {
155
+ observer.unobserve(observerRef.value);
148
156
  }
149
157
  });
150
158
  return (_ctx, _cache) => {
151
159
  return openBlock(), createElementBlock("div", _hoisted_1, [
152
160
  createVNode(renderBar, {
153
- ref_key: "btnBar",
154
- ref: btnBar
161
+ ref_key: "observerRef",
162
+ ref: observerRef
155
163
  }, null, 512),
156
164
  showBaseline.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
157
165
  createElementVNode("div", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninemoon-ui",
3
3
  "private": false,
4
- "version": "0.0.19",
4
+ "version": "0.0.20",
5
5
  "author": "zhuboy",
6
6
  "keywords": [
7
7
  "vue3",