ninemoon-ui 0.0.19 → 0.0.21

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.css CHANGED
@@ -102,9 +102,6 @@
102
102
  .tdd-top-4 {
103
103
  top: 1rem;
104
104
  }
105
- .-tdd-z-10 {
106
- z-index: -10;
107
- }
108
105
  .tdd-z-10 {
109
106
  z-index: 10;
110
107
  }
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
@@ -107,9 +107,6 @@
107
107
  .tdd-top-4 {
108
108
  top: 1rem;
109
109
  }
110
- .-tdd-z-10 {
111
- z-index: -10;
112
- }
113
110
  .tdd-z-10 {
114
111
  z-index: 10;
115
112
  }
@@ -5224,16 +5221,13 @@
5224
5221
  const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
5225
5222
  __name: "tabs",
5226
5223
  props: {
5227
- active: { default: "" },
5224
+ active: {},
5228
5225
  type: { default: "line" }
5229
5226
  },
5230
5227
  emits: ["update:active"],
5231
5228
  setup(__props, { emit }) {
5232
5229
  const props = __props;
5233
5230
  const showBaseline = vue.computed(() => props.type === "line");
5234
- const changeHandle = (name) => {
5235
- emit("update:active", name);
5236
- };
5237
5231
  const noactive = vue.computed(() => props.active == null);
5238
5232
  const activename = vue.ref("");
5239
5233
  const currentActive = vue.computed({
@@ -5241,7 +5235,7 @@
5241
5235
  if (noactive.value) {
5242
5236
  activename.value = val;
5243
5237
  } else {
5244
- changeHandle(val);
5238
+ emit("update:active", val);
5245
5239
  }
5246
5240
  },
5247
5241
  get() {
@@ -5256,6 +5250,25 @@
5256
5250
  const arrowNum = vue.ref(8);
5257
5251
  const arrowWidth = vue.ref(0);
5258
5252
  const slots = vue.useSlots();
5253
+ const renderBar = () => {
5254
+ return vue.h(
5255
+ "div",
5256
+ {
5257
+ class: vue.normalizeClass(["ETab", [props.type === "line" ? "tdd-px-2 tdd-pt-2" : " ETab_Card"]])
5258
+ },
5259
+ slots.default().map((it, index2) => {
5260
+ if (typeof it.children == "string")
5261
+ return null;
5262
+ if (Array.isArray(it.children)) {
5263
+ return it.children.map((simple, i) => {
5264
+ return renderBtn(simple, i);
5265
+ });
5266
+ } else {
5267
+ return renderBtn(it, index2);
5268
+ }
5269
+ })
5270
+ );
5271
+ };
5259
5272
  const renderBtn = (node, index2) => {
5260
5273
  let btc = [];
5261
5274
  let divc = [];
@@ -5303,39 +5316,6 @@
5303
5316
  )
5304
5317
  );
5305
5318
  };
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
5319
  const renderContent = () => {
5340
5320
  let defaultindex = -1;
5341
5321
  return vue.h(
@@ -5356,18 +5336,43 @@
5356
5336
  })
5357
5337
  );
5358
5338
  };
5359
- const btnBar = vue.ref();
5339
+ const contentHandle = (it, i) => {
5340
+ if (currentActive.value === it.props.name) {
5341
+ activeIndex.value = i;
5342
+ }
5343
+ return vue.withDirectives(
5344
+ vue.h(it, {
5345
+ key: it.props.name
5346
+ }),
5347
+ [[vue.vShow, activeIndex.value === i]]
5348
+ );
5349
+ };
5350
+ const observerRef = vue.ref();
5351
+ let observer;
5360
5352
  vue.onMounted(() => {
5361
- if (showBaseline.value) {
5362
- const aim = btnBar.value.children[activeIndex.value];
5363
- arrowWidth.value = aim.children[0].innerHTML.length * 14;
5353
+ observer = new IntersectionObserver((entries) => {
5354
+ entries.forEach((entry) => {
5355
+ if (entry.isIntersecting) {
5356
+ const aim = observerRef.value.children[activeIndex.value];
5357
+ arrowWidth.value = aim.offsetWidth;
5358
+ arrowNum.value = aim.offsetLeft;
5359
+ }
5360
+ });
5361
+ });
5362
+ if (observerRef.value) {
5363
+ observer.observe(observerRef.value);
5364
+ }
5365
+ });
5366
+ vue.onUnmounted(() => {
5367
+ if (observerRef.value) {
5368
+ observer.unobserve(observerRef.value);
5364
5369
  }
5365
5370
  });
5366
5371
  return (_ctx, _cache) => {
5367
5372
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
5368
5373
  vue.createVNode(renderBar, {
5369
- ref_key: "btnBar",
5370
- ref: btnBar
5374
+ ref_key: "observerRef",
5375
+ ref: observerRef
5371
5376
  }, null, 512),
5372
5377
  showBaseline.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
5373
5378
  vue.createElementVNode("div", {
@@ -5660,15 +5665,13 @@
5660
5665
  const bodyHandle = (MySlot, d) => {
5661
5666
  let between = d - activeIndex.value;
5662
5667
  let transformNum = 0;
5663
- if (between < 0) {
5664
- if (between == -1) {
5665
- transformNum = -translatexNum.value;
5666
- } else {
5667
- transformNum = (totalLen.value + between) * translatexNum.value;
5668
- }
5668
+ if (totalLen.value <= 2) {
5669
+ transformNum = Math.abs(between * translatexNum.value);
5669
5670
  } else {
5670
- if (activeIndex.value === 0 && d == totalLen.value - 1 && totalLen.value != 1) {
5671
+ if (activeIndex.value === 0 && d == totalLen.value - 1) {
5671
5672
  transformNum = -translatexNum.value;
5673
+ } else if (between < -1) {
5674
+ transformNum = (totalLen.value + between) * translatexNum.value;
5672
5675
  } else {
5673
5676
  transformNum = between * translatexNum.value;
5674
5677
  }
@@ -5676,7 +5679,7 @@
5676
5679
  return vue.h(
5677
5680
  "div",
5678
5681
  {
5679
- class: vue.normalizeClass(["carouselBody", [activeIndex.value === d ? "tdd-z-10" : "-tdd-z-10"]]),
5682
+ class: vue.normalizeClass(["carouselBody", [activeIndex.value === d ? "" : "tdd-opacity-0"]]),
5680
5683
  style: {
5681
5684
  transform: `translateX(${transformNum}px)`
5682
5685
  }
@@ -45,15 +45,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
45
45
  const bodyHandle = (MySlot, d) => {
46
46
  let between = d - activeIndex.value;
47
47
  let transformNum = 0;
48
- if (between < 0) {
49
- if (between == -1) {
50
- transformNum = -translatexNum.value;
51
- } else {
52
- transformNum = (totalLen.value + between) * translatexNum.value;
53
- }
48
+ if (totalLen.value <= 2) {
49
+ transformNum = Math.abs(between * translatexNum.value);
54
50
  } else {
55
- if (activeIndex.value === 0 && d == totalLen.value - 1 && totalLen.value != 1) {
51
+ if (activeIndex.value === 0 && d == totalLen.value - 1) {
56
52
  transformNum = -translatexNum.value;
53
+ } else if (between < -1) {
54
+ transformNum = (totalLen.value + between) * translatexNum.value;
57
55
  } else {
58
56
  transformNum = between * translatexNum.value;
59
57
  }
@@ -61,7 +59,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
59
  return h(
62
60
  "div",
63
61
  {
64
- class: normalizeClass(["carouselBody", [activeIndex.value === d ? "tdd-z-10" : "-tdd-z-10"]]),
62
+ class: normalizeClass(["carouselBody", [activeIndex.value === d ? "" : "tdd-opacity-0"]]),
65
63
  style: {
66
64
  transform: `translateX(${transformNum}px)`
67
65
  }
@@ -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.21",
5
5
  "author": "zhuboy",
6
6
  "keywords": [
7
7
  "vue3",