ninemoon-ui 0.0.27 → 0.1.1
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.
- package/dist/components/alert/alert.d.ts +3 -11
- package/dist/components/alert/alertcomponent.vue.d.ts +22 -11
- package/dist/components/badge/badge.vue.d.ts +2 -0
- package/dist/components/carousel/carousel.vue.d.ts +29 -3
- package/dist/components/{tree/tree.vue.d.ts → carousel/clickbutton.vue.d.ts} +6 -19
- package/dist/components/check/checkbox.vue.d.ts +24 -16
- package/dist/components/check/checkgroup.vue.d.ts +15 -3
- package/dist/components/date/datepicker.vue.d.ts +28 -6
- package/dist/components/date/datepickerRange.vue.d.ts +15 -4
- package/dist/components/form/form.vue.d.ts +7 -20
- package/dist/components/form/formlabel.vue.d.ts +3 -3
- package/dist/components/form/type.d.ts +11 -0
- package/dist/components/icon/add.vue.d.ts +2 -0
- package/dist/components/icon/alertTip.vue.d.ts +2 -0
- package/dist/components/icon/arrow.vue.d.ts +2 -0
- package/dist/components/icon/calendar.vue.d.ts +2 -0
- package/dist/components/icon/close.vue.d.ts +2 -0
- package/dist/components/icon/dateArrow.vue.d.ts +2 -0
- package/dist/components/icon/dateArrowplus.vue.d.ts +2 -0
- package/dist/components/icon/delete.vue.d.ts +2 -0
- package/dist/components/icon/ellipsis.vue.d.ts +2 -0
- package/dist/components/icon/errTip.vue.d.ts +2 -0
- package/dist/components/icon/eye.vue.d.ts +2 -0
- package/dist/components/icon/infoTip.vue.d.ts +2 -0
- package/dist/components/icon/minus.vue.d.ts +2 -0
- package/dist/components/icon/successTip.vue.d.ts +2 -0
- package/dist/components/icon/turnleft.vue.d.ts +2 -0
- package/dist/components/icon/turnright.vue.d.ts +2 -0
- package/dist/components/icon/warnTip.vue.d.ts +2 -0
- package/dist/components/input/input.vue.d.ts +13 -8
- package/dist/components/loadding/loadcomponent.vue.d.ts +24 -4
- package/dist/components/loadding/loadding.d.ts +12 -19
- package/dist/components/menu/menu.vue.d.ts +13 -3
- package/dist/components/message/message.d.ts +68 -14
- package/dist/components/message/messagecomponent.vue.d.ts +5 -13
- package/dist/components/numberInput/numberinput.vue.d.ts +3 -3
- package/dist/components/pagination/pagination.vue.d.ts +24 -0
- package/dist/components/popover/poparrow.d.ts +55 -0
- package/dist/components/popover/popover.vue.d.ts +10 -4
- package/dist/components/radio/radiobox.vue.d.ts +24 -16
- package/dist/components/radio/radiogroup.vue.d.ts +15 -3
- package/dist/components/scrollBar/movebar.vue.d.ts +2 -2
- package/dist/components/scrollBar/scrollBar.vue.d.ts +12 -16
- package/dist/components/scrollloading/scrolllead.d.ts +18 -11
- package/dist/components/select/select.vue.d.ts +15 -1
- package/dist/components/select/selectoption.vue.d.ts +18 -6
- package/dist/components/switch/switch.vue.d.ts +14 -14
- package/dist/components/table/table.vue.d.ts +20 -9
- package/dist/components/table/tableItem.vue.d.ts +10 -4
- package/dist/components/tabs/tabs.vue.d.ts +14 -1
- package/dist/dialog.css +9 -0
- package/dist/directives/arrowKeys.d.ts +10 -0
- package/dist/directives/drag.d.ts +20 -0
- package/dist/directives/escape.d.ts +7 -0
- package/dist/directives/outsideclick.d.ts +14 -0
- package/dist/directives/watchwindow.d.ts +13 -0
- package/dist/directives/wheel.d.ts +12 -0
- package/dist/directives/whitespaceclick.d.ts +12 -0
- package/dist/index.css +1186 -873
- package/dist/index.d.ts +831 -401
- package/dist/index.es.js +22 -23
- package/dist/index.umd.js +4019 -3764
- package/dist/js/arrow/arrow.js +17 -0
- package/dist/js/badge/badge.js +9 -16
- package/dist/js/calendar/calendar.js +87 -0
- package/dist/js/carousel/carousel.js +101 -117
- package/dist/js/carousel/carouselitem.js +1 -7
- package/dist/js/check/checkbox.js +38 -4
- package/dist/js/check/checkgroup.js +40 -51
- package/dist/js/date/datepicker.js +146 -150
- package/dist/js/date/datepickerRange.js +265 -354
- package/dist/js/dateArrowplus/dateArrowplus.js +25 -0
- package/dist/js/delete/delete.js +19 -0
- package/dist/js/dialog/dialog.js +41 -57
- package/dist/js/form/form.js +30 -38
- package/dist/js/form/formlabel.js +99 -130
- package/dist/js/image/image.js +199 -149
- package/dist/js/index/index.js +605 -507
- package/dist/js/input/input.js +60 -43
- package/dist/js/menu/menu.js +47 -20
- package/dist/js/numberInput/numberinput.js +52 -60
- package/dist/js/pagination/pagination.js +125 -156
- package/dist/js/popover/popover.js +238 -134
- package/dist/js/radio/radiobox.js +37 -4
- package/dist/js/radio/radiogroup.js +15 -51
- package/dist/js/scrollBar/scrollBar.js +100 -56
- package/dist/js/select/select.js +155 -70
- package/dist/js/select/selectoption.js +45 -4
- package/dist/js/shapeFlag/shapeFlag.js +17 -0
- package/dist/js/switch/switch.js +14 -14
- package/dist/js/table/table.js +165 -111
- package/dist/js/table/tableItem.js +1 -1
- package/dist/js/tabs/tabs.js +57 -59
- package/dist/js/upload/upload.js +8 -23
- package/dist/tabs.css +3 -3
- package/dist/types/shapeFlag.d.ts +13 -0
- package/dist/{components/utils → utils}/tool.d.ts +11 -4
- package/package.json +1 -1
- package/dist/badge.css +0 -27
- package/dist/carousel.css +0 -13
- package/dist/checkgroup.css +0 -41
- package/dist/datepickerRange.css +0 -79
- package/dist/image.css +0 -8
- package/dist/js/getcalendar/getcalendar.js +0 -48
- package/dist/js/tree/tree.js +0 -72
- package/dist/js/tree/treeleaf.js +0 -116
- package/dist/radiogroup.css +0 -44
- package/dist/scrollBar.css +0 -37
- package/dist/select.css +0 -20
package/dist/js/table/table.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, useSlots, ref, watch, openBlock, createElementBlock, Fragment, createElementVNode, normalizeClass, createVNode, withDirectives, vShow, h, vModelCheckbox, withModifiers } from "vue";
|
|
2
|
-
|
|
2
|
+
import { S as ShapeFlags } from "../shapeFlag/shapeFlag.js";
|
|
3
|
+
const _hoisted_1 = { class: "text-center text-word6 text-base" };
|
|
3
4
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
5
|
__name: "table",
|
|
5
6
|
props: {
|
|
@@ -8,7 +9,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
8
9
|
showHead: { type: Boolean, default: true },
|
|
9
10
|
headclass: {},
|
|
10
11
|
cellclass: {},
|
|
11
|
-
tableclass: {}
|
|
12
|
+
tableclass: {},
|
|
13
|
+
idKey: {}
|
|
12
14
|
},
|
|
13
15
|
emits: ["rowClick", "selectionChange"],
|
|
14
16
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -18,43 +20,49 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18
20
|
});
|
|
19
21
|
const emit = __emit;
|
|
20
22
|
const slots = useSlots();
|
|
23
|
+
const validSlots = computed(() => {
|
|
24
|
+
return slots.default().reduce((pre, cur) => {
|
|
25
|
+
if (cur.shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
|
|
26
|
+
pre = pre.concat(cur.children);
|
|
27
|
+
} else if (cur.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
|
|
28
|
+
pre.push(cur);
|
|
29
|
+
}
|
|
30
|
+
return pre;
|
|
31
|
+
}, []);
|
|
32
|
+
});
|
|
33
|
+
const appendSlots = computed(
|
|
34
|
+
() => validSlots.value.filter((slot) => slot.props.type === "append")
|
|
35
|
+
);
|
|
36
|
+
const prependSlots = computed(
|
|
37
|
+
() => validSlots.value.filter((slot) => slot.props.type === "prepend")
|
|
38
|
+
);
|
|
39
|
+
const restSlots = computed(
|
|
40
|
+
() => validSlots.value.filter(
|
|
41
|
+
(slot) => slot.props.type !== "append" && slot.props.type !== "prepend"
|
|
42
|
+
)
|
|
43
|
+
);
|
|
21
44
|
const renderColGroup = () => {
|
|
22
45
|
return h(
|
|
23
46
|
"colgroup",
|
|
24
47
|
null,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
if (Array.isArray(it.children)) {
|
|
29
|
-
return it.children.map((itt, _i) => colitemHandle(itt));
|
|
30
|
-
} else {
|
|
31
|
-
return colitemHandle(it);
|
|
32
|
-
}
|
|
48
|
+
restSlots.value.map((it, _index) => {
|
|
49
|
+
return colitemHandle(it);
|
|
33
50
|
})
|
|
34
51
|
);
|
|
35
52
|
};
|
|
36
53
|
const colitemHandle = (it) => {
|
|
37
|
-
var _a;
|
|
38
54
|
return h("col", {
|
|
39
|
-
width:
|
|
55
|
+
width: it.props.width || null
|
|
40
56
|
});
|
|
41
57
|
};
|
|
42
58
|
const renderHead = () => {
|
|
43
59
|
return h(
|
|
44
60
|
"thead",
|
|
45
61
|
{
|
|
46
|
-
class: normalizeClass(["
|
|
62
|
+
class: normalizeClass(["text-word6", [props.headclass]])
|
|
47
63
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return null;
|
|
51
|
-
if (Array.isArray(it.children)) {
|
|
52
|
-
return it.children.map((itt) => {
|
|
53
|
-
return headitemHandle(itt);
|
|
54
|
-
});
|
|
55
|
-
} else {
|
|
56
|
-
return headitemHandle(it);
|
|
57
|
-
}
|
|
64
|
+
restSlots.value.map((it) => {
|
|
65
|
+
return headitemHandle(it);
|
|
58
66
|
})
|
|
59
67
|
);
|
|
60
68
|
};
|
|
@@ -63,18 +71,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
63
71
|
return h(
|
|
64
72
|
"th",
|
|
65
73
|
{
|
|
66
|
-
class: "
|
|
74
|
+
class: "font-normal h-10 border-b "
|
|
67
75
|
},
|
|
68
76
|
it.children && it.children.head ? it.children.head() : ((_a = it.props) == null ? void 0 : _a.type) && it.props.type === "selection" ? h(
|
|
69
77
|
"label",
|
|
70
78
|
{
|
|
71
|
-
class: "
|
|
79
|
+
class: "px-1 flex"
|
|
72
80
|
},
|
|
73
81
|
withDirectives(
|
|
74
82
|
h("input", {
|
|
75
83
|
type: "checkbox",
|
|
76
84
|
"onUpdate:modelValue": (value) => allSelect.value = value,
|
|
77
|
-
class: "
|
|
85
|
+
class: "appearance-none form-tick h-4 w-4 border border-gray-300 rounded checked:border-transparent checked:bg-blue-600 text-red-600 focus:outline-none"
|
|
78
86
|
}),
|
|
79
87
|
[[vModelCheckbox, allSelect.value]]
|
|
80
88
|
)
|
|
@@ -84,119 +92,165 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
84
92
|
const allSelect = computed({
|
|
85
93
|
set(flag) {
|
|
86
94
|
if (flag) {
|
|
87
|
-
|
|
95
|
+
allSelection();
|
|
88
96
|
} else {
|
|
89
|
-
|
|
97
|
+
clearSelection();
|
|
90
98
|
}
|
|
91
99
|
},
|
|
92
100
|
get() {
|
|
93
|
-
return hasData.value &&
|
|
101
|
+
return hasData.value && choosedKeys.value.length == props.data.length;
|
|
94
102
|
}
|
|
95
103
|
});
|
|
96
|
-
const
|
|
104
|
+
const MapData = computed(() => {
|
|
105
|
+
return props.data.reduce((map, item, index) => {
|
|
106
|
+
const key = props.idKey ? item[props.idKey] : index;
|
|
107
|
+
if (map.has(key)) {
|
|
108
|
+
console.warn(`重复键 ${key},已合并为数组`);
|
|
109
|
+
map.set(key, [...map.get(key), item]);
|
|
110
|
+
} else {
|
|
111
|
+
map.set(key, [item]);
|
|
112
|
+
}
|
|
113
|
+
return map;
|
|
114
|
+
}, /* @__PURE__ */ new Map());
|
|
115
|
+
});
|
|
116
|
+
const choosedSet = ref(/* @__PURE__ */ new Set());
|
|
117
|
+
const choosedKeys = computed(() => Array.from(choosedSet.value));
|
|
118
|
+
const resultArray = computed(() => {
|
|
119
|
+
return choosedKeys.value.map((key) => {
|
|
120
|
+
const mapKey = props.idKey ? key : Number(key);
|
|
121
|
+
return MapData.value.get(mapKey) || [];
|
|
122
|
+
}).flat();
|
|
123
|
+
});
|
|
97
124
|
const clearSelection = () => {
|
|
98
|
-
|
|
125
|
+
choosedSet.value = /* @__PURE__ */ new Set();
|
|
99
126
|
};
|
|
100
127
|
const allSelection = () => {
|
|
101
|
-
|
|
102
|
-
for (let i = 0; i < props.data.length; i++) {
|
|
103
|
-
temp.push(i);
|
|
104
|
-
}
|
|
105
|
-
choosed.value = temp;
|
|
128
|
+
choosedSet.value = new Set(MapData.value.keys());
|
|
106
129
|
};
|
|
107
|
-
watch(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
for (let i = 0; i < props.data.length; i++) {
|
|
120
|
-
temp.push(i);
|
|
121
|
-
}
|
|
122
|
-
choosed.value = temp.filter((i) => !choosed.value.includes(i));
|
|
123
|
-
};
|
|
124
|
-
const toggleSelection = (arr) => {
|
|
125
|
-
choosed.value = arr;
|
|
130
|
+
watch(choosedKeys, () => {
|
|
131
|
+
emit("selectionChange", resultArray.value);
|
|
132
|
+
});
|
|
133
|
+
const renderSlotRows = (slots2, row, index, colSpan, modify) => {
|
|
134
|
+
const rowKey = getRowKey(row, index);
|
|
135
|
+
return slots2.map(
|
|
136
|
+
(slot) => h(
|
|
137
|
+
"tr",
|
|
138
|
+
{ key: `${modify}-${rowKey}` },
|
|
139
|
+
h("td", { colSpan }, trRenderHandle(row, slot, index))
|
|
140
|
+
)
|
|
141
|
+
);
|
|
126
142
|
};
|
|
127
|
-
const
|
|
143
|
+
const renderMainRow = (row, index) => {
|
|
144
|
+
const rowKey = getRowKey(row, index);
|
|
128
145
|
return h(
|
|
129
|
-
"
|
|
130
|
-
{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}, ["stop"])
|
|
140
|
-
},
|
|
141
|
-
slots.default().map((it, _j) => {
|
|
142
|
-
if (typeof it.children == "string")
|
|
143
|
-
return null;
|
|
144
|
-
if (Array.isArray(it.children)) {
|
|
145
|
-
return it.children.map((itt) => {
|
|
146
|
-
return bodyHandle(row, itt, i);
|
|
147
|
-
});
|
|
148
|
-
} else {
|
|
149
|
-
return bodyHandle(row, it, i);
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
);
|
|
153
|
-
})
|
|
146
|
+
"tr",
|
|
147
|
+
{
|
|
148
|
+
class: "border-b hover:bg-gray-100 transition-colors",
|
|
149
|
+
key: rowKey,
|
|
150
|
+
// 使用唯一键替代索引
|
|
151
|
+
onClick: withModifiers(() => emit("rowClick", { row, index }), ["stop"])
|
|
152
|
+
},
|
|
153
|
+
restSlots.value.map(
|
|
154
|
+
(slot, colIndex) => bodyCellRenderer(row, slot, index, colIndex)
|
|
155
|
+
)
|
|
154
156
|
);
|
|
155
157
|
};
|
|
156
|
-
const
|
|
157
|
-
var _a;
|
|
158
|
+
const bodyCellRenderer = (row, slot, rowIndex, colIndex) => {
|
|
158
159
|
return h(
|
|
159
160
|
"td",
|
|
160
161
|
{
|
|
161
|
-
class:
|
|
162
|
+
class: cellClasses(slot.props),
|
|
163
|
+
// 提取样式生成逻辑
|
|
164
|
+
key: `${getRowKey(row, rowIndex)}-${colIndex}`
|
|
165
|
+
// 复合键
|
|
162
166
|
},
|
|
163
|
-
(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
167
|
+
renderCellContent(row, slot, rowIndex)
|
|
168
|
+
);
|
|
169
|
+
};
|
|
170
|
+
const renderCellContent = (row, slot, rowIndex) => {
|
|
171
|
+
var _a;
|
|
172
|
+
return ((_a = slot.props) == null ? void 0 : _a.type) === "selection" ? h(
|
|
173
|
+
"label",
|
|
174
|
+
{
|
|
175
|
+
class: "px-1 flex",
|
|
176
|
+
for: "checkbox"
|
|
177
|
+
},
|
|
178
|
+
h("input", {
|
|
179
|
+
type: "checkbox",
|
|
180
|
+
value: props.idKey ? row[props.idKey] : rowIndex,
|
|
181
|
+
onChange: (event) => {
|
|
182
|
+
const target = event.target;
|
|
183
|
+
const rowKey = props.idKey ? row[props.idKey] : rowIndex;
|
|
184
|
+
target.checked ? choosedSet.value.add(rowKey) : choosedSet.value.delete(rowKey);
|
|
168
185
|
},
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
) :
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
checked: choosedSet.value.has(
|
|
187
|
+
props.idKey ? row[props.idKey] : rowIndex
|
|
188
|
+
),
|
|
189
|
+
class: "appearance-none form-tick h-4 w-4 border border-gray-300 rounded checked:border-transparent checked:bg-blue-600 text-red-600 focus:outline-none "
|
|
190
|
+
})
|
|
191
|
+
) : trRenderHandle(row, slot, rowIndex);
|
|
192
|
+
};
|
|
193
|
+
const cellClasses = (props2) => {
|
|
194
|
+
return normalizeClass([
|
|
195
|
+
"text-center py-2",
|
|
196
|
+
props2 == null ? void 0 : props2.cellclass,
|
|
197
|
+
(props2 == null ? void 0 : props2.align) === "right" ? "text-right" : "text-left"
|
|
198
|
+
]);
|
|
199
|
+
};
|
|
200
|
+
const getRowKey = (row, index) => {
|
|
201
|
+
return props.idKey ? row[props.idKey] : `row-${index}`;
|
|
202
|
+
};
|
|
203
|
+
const renderBody = () => {
|
|
204
|
+
const { data } = props;
|
|
205
|
+
const prepend = prependSlots.value;
|
|
206
|
+
const append = appendSlots.value;
|
|
207
|
+
const rest = restSlots.value;
|
|
208
|
+
const colSpan = rest.length;
|
|
209
|
+
const renderRow = (row, index) => {
|
|
210
|
+
return [
|
|
211
|
+
// 前置插槽渲染
|
|
212
|
+
...renderSlotRows(prepend, row, index, colSpan, "pre"),
|
|
213
|
+
// 主体行
|
|
214
|
+
renderMainRow(row, index),
|
|
215
|
+
// 后置插槽渲染
|
|
216
|
+
...renderSlotRows(append, row, index, colSpan, "next")
|
|
217
|
+
];
|
|
218
|
+
};
|
|
219
|
+
return h("tbody", data.map(renderRow));
|
|
220
|
+
};
|
|
221
|
+
const trRenderHandle = (row, it, i) => {
|
|
222
|
+
return h(
|
|
223
|
+
"div",
|
|
224
|
+
null,
|
|
225
|
+
it.children && it.children.default ? it.children.default({
|
|
226
|
+
row,
|
|
227
|
+
index: i
|
|
228
|
+
}) : row[it.props.prop] || props.whiteword
|
|
188
229
|
);
|
|
189
230
|
};
|
|
190
231
|
__expose({
|
|
191
232
|
clearSelection,
|
|
192
233
|
allSelection,
|
|
193
|
-
|
|
194
|
-
|
|
234
|
+
toggleSelection: () => {
|
|
235
|
+
if (choosedSet.value.size === MapData.value.size) {
|
|
236
|
+
clearSelection();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const newSet = /* @__PURE__ */ new Set();
|
|
240
|
+
for (const key of MapData.value.keys()) {
|
|
241
|
+
if (!choosedSet.value.has(key))
|
|
242
|
+
newSet.add(key);
|
|
243
|
+
}
|
|
244
|
+
choosedSet.value = newSet;
|
|
245
|
+
},
|
|
246
|
+
setSelection: (arr) => {
|
|
247
|
+
choosedSet.value = new Set(arr);
|
|
248
|
+
}
|
|
195
249
|
});
|
|
196
250
|
return (_ctx, _cache) => {
|
|
197
251
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
198
252
|
createElementVNode("table", {
|
|
199
|
-
class: normalizeClass(["
|
|
253
|
+
class: normalizeClass(["w-full text-sm", _ctx.tableclass])
|
|
200
254
|
}, [
|
|
201
255
|
createVNode(renderColGroup),
|
|
202
256
|
withDirectives(createVNode(renderHead, null, null, 512), [
|
package/dist/js/tabs/tabs.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, useSlots, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, createElementVNode, normalizeStyle, createCommentVNode, h, normalizeClass, withDirectives, vShow } from "vue";
|
|
2
|
-
|
|
1
|
+
import { defineComponent, defineAsyncComponent, computed, ref, reactive, useSlots, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, normalizeStyle, createCommentVNode, h, normalizeClass, withDirectives, vShow } from "vue";
|
|
2
|
+
import { S as ShapeFlags } from "../shapeFlag/shapeFlag.js";
|
|
3
|
+
const _hoisted_1 = { class: "relative w-full overflow-hidden" };
|
|
3
4
|
const _hoisted_2 = {
|
|
4
5
|
key: 0,
|
|
5
|
-
class: "
|
|
6
|
+
class: "relative my-2 border-t-2 border-solid border-gray-200"
|
|
6
7
|
};
|
|
7
|
-
const _hoisted_3 = { class: "
|
|
8
|
+
const _hoisted_3 = { class: "relative w-full" };
|
|
8
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
10
|
__name: "tabs",
|
|
10
11
|
props: {
|
|
@@ -13,6 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13
14
|
},
|
|
14
15
|
emits: ["update:active"],
|
|
15
16
|
setup(__props, { emit: __emit }) {
|
|
17
|
+
const LibScrollBar = defineAsyncComponent(() => import("../scrollBar/scrollBar.js"));
|
|
16
18
|
const props = __props;
|
|
17
19
|
const showBaseline = computed(() => props.type === "line");
|
|
18
20
|
const emit = __emit;
|
|
@@ -35,33 +37,40 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
35
37
|
}
|
|
36
38
|
});
|
|
37
39
|
const activeIndex = ref(0);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
+
const indicatorPos = reactive({
|
|
41
|
+
left: 0,
|
|
42
|
+
width: 0
|
|
43
|
+
});
|
|
40
44
|
const slots = useSlots();
|
|
45
|
+
const validSlots = computed(() => {
|
|
46
|
+
return slots.default().reduce((pre, cur) => {
|
|
47
|
+
if (cur.shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
|
|
48
|
+
pre = pre.concat(cur.children);
|
|
49
|
+
} else if (cur.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
|
|
50
|
+
pre.push(cur);
|
|
51
|
+
}
|
|
52
|
+
return pre;
|
|
53
|
+
}, []);
|
|
54
|
+
});
|
|
41
55
|
const renderBar = () => {
|
|
42
56
|
return h(
|
|
43
57
|
"div",
|
|
44
58
|
{
|
|
45
|
-
class: normalizeClass([
|
|
59
|
+
class: normalizeClass([
|
|
60
|
+
"ETab",
|
|
61
|
+
[showBaseline.value ? "px-2 pt-2" : " ETab_Card"]
|
|
62
|
+
])
|
|
46
63
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return null;
|
|
50
|
-
if (Array.isArray(it.children)) {
|
|
51
|
-
return it.children.map((simple, i) => {
|
|
52
|
-
return renderBtn(simple, i);
|
|
53
|
-
});
|
|
54
|
-
} else {
|
|
55
|
-
return renderBtn(it, index);
|
|
56
|
-
}
|
|
64
|
+
validSlots.value.map((it, index) => {
|
|
65
|
+
return renderBtn(it, index);
|
|
57
66
|
})
|
|
58
67
|
);
|
|
59
68
|
};
|
|
60
69
|
const renderBtn = (node, index) => {
|
|
61
70
|
let btc = [];
|
|
62
71
|
let divc = [];
|
|
63
|
-
switch (
|
|
64
|
-
case
|
|
72
|
+
switch (showBaseline.value) {
|
|
73
|
+
case false:
|
|
65
74
|
btc.push("ETab_Card_Btn");
|
|
66
75
|
divc.push("ETabline");
|
|
67
76
|
if (index - 1 === activeIndex.value) {
|
|
@@ -86,44 +95,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
86
95
|
"button",
|
|
87
96
|
{
|
|
88
97
|
type: "button",
|
|
98
|
+
key: `tab-${index}`,
|
|
89
99
|
class: normalizeClass(btc),
|
|
90
100
|
onClick: (e) => {
|
|
91
101
|
activeIndex.value = index;
|
|
92
102
|
let aim = e.target;
|
|
93
|
-
|
|
94
|
-
|
|
103
|
+
indicatorPos.width = aim.offsetWidth;
|
|
104
|
+
indicatorPos.left = aim.offsetLeft;
|
|
95
105
|
currentActive.value = node.props.name;
|
|
96
106
|
}
|
|
97
107
|
},
|
|
98
108
|
h(
|
|
99
109
|
"span",
|
|
100
110
|
{
|
|
101
|
-
class: divc
|
|
111
|
+
class: normalizeClass(divc)
|
|
102
112
|
},
|
|
103
113
|
node.props.name
|
|
104
114
|
)
|
|
105
115
|
);
|
|
106
116
|
};
|
|
107
|
-
const renderContent = () => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"div",
|
|
111
|
-
{},
|
|
112
|
-
slots.default().map((it, _) => {
|
|
113
|
-
if (typeof it.children == "string")
|
|
114
|
-
return null;
|
|
115
|
-
if (Array.isArray(it.children)) {
|
|
116
|
-
return it.children.map((itt, _i) => {
|
|
117
|
-
defaultindex += 1;
|
|
118
|
-
return contentHandle(itt, defaultindex);
|
|
119
|
-
});
|
|
120
|
-
} else {
|
|
121
|
-
defaultindex += 1;
|
|
122
|
-
return contentHandle(it, defaultindex);
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
);
|
|
126
|
-
};
|
|
117
|
+
const renderContent = () => validSlots.value.map((it, i) => {
|
|
118
|
+
return contentHandle(it, i);
|
|
119
|
+
});
|
|
127
120
|
const contentHandle = (it, i) => {
|
|
128
121
|
if (currentActive.value === it.props.name) {
|
|
129
122
|
activeIndex.value = i;
|
|
@@ -142,35 +135,40 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
142
135
|
entries.forEach((entry) => {
|
|
143
136
|
if (entry.isIntersecting) {
|
|
144
137
|
const aim = observerRef.value.children[activeIndex.value];
|
|
145
|
-
|
|
146
|
-
|
|
138
|
+
indicatorPos.width = aim.offsetWidth;
|
|
139
|
+
indicatorPos.left = aim.offsetLeft;
|
|
147
140
|
}
|
|
148
141
|
});
|
|
149
142
|
});
|
|
150
|
-
if (
|
|
143
|
+
if (showBaseline.value) {
|
|
151
144
|
observer.observe(observerRef.value);
|
|
152
145
|
}
|
|
153
146
|
});
|
|
154
147
|
onUnmounted(() => {
|
|
155
|
-
if (
|
|
148
|
+
if (showBaseline.value) {
|
|
156
149
|
observer.unobserve(observerRef.value);
|
|
157
150
|
}
|
|
158
151
|
});
|
|
159
152
|
return (_ctx, _cache) => {
|
|
160
153
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
161
|
-
createVNode(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
154
|
+
createVNode(unref(LibScrollBar), null, {
|
|
155
|
+
default: withCtx(() => [
|
|
156
|
+
createVNode(renderBar, {
|
|
157
|
+
ref_key: "observerRef",
|
|
158
|
+
ref: observerRef
|
|
159
|
+
}, null, 512),
|
|
160
|
+
showBaseline.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
161
|
+
createElementVNode("div", {
|
|
162
|
+
class: "absolute bottom-0 border-t-2 border-solid border-blue-brand transition",
|
|
163
|
+
style: normalizeStyle({
|
|
164
|
+
transform: `translateX(${indicatorPos.left}px`,
|
|
165
|
+
width: `${indicatorPos.width}px`
|
|
166
|
+
})
|
|
167
|
+
}, null, 4)
|
|
168
|
+
])) : createCommentVNode("", true)
|
|
169
|
+
]),
|
|
170
|
+
_: 1
|
|
171
|
+
}),
|
|
174
172
|
createElementVNode("div", _hoisted_3, [
|
|
175
173
|
createVNode(renderContent)
|
|
176
174
|
])
|
package/dist/js/upload/upload.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent, ref, openBlock, createElementBlock, Fragment, createElementVNode, renderSlot, renderList, toDisplayString, createCommentVNode } from "vue";
|
|
1
|
+
import { defineComponent, ref, openBlock, createElementBlock, Fragment, createElementVNode, renderSlot, renderList, toDisplayString, createVNode, createCommentVNode } from "vue";
|
|
2
|
+
import { C as CloseIcon } from "../index/index.js";
|
|
2
3
|
const _hoisted_1 = ["accept", "multiple"];
|
|
3
4
|
const _hoisted_2 = {
|
|
4
5
|
key: 0,
|
|
5
|
-
class: "
|
|
6
|
+
class: "mt-1 list-none space-y-1"
|
|
6
7
|
};
|
|
7
8
|
const _hoisted_3 = ["onClick"];
|
|
8
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -61,7 +62,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
61
62
|
createElementVNode("button", {
|
|
62
63
|
onClick: fileGet,
|
|
63
64
|
type: "button",
|
|
64
|
-
class: "
|
|
65
|
+
class: "appearance-none"
|
|
65
66
|
}, [
|
|
66
67
|
renderSlot(_ctx.$slots, "default")
|
|
67
68
|
])
|
|
@@ -70,31 +71,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
70
71
|
(openBlock(true), createElementBlock(Fragment, null, renderList(fileList.value, (i, d) => {
|
|
71
72
|
return openBlock(), createElementBlock("li", {
|
|
72
73
|
key: d,
|
|
73
|
-
class: "
|
|
74
|
+
class: "flex w-full justify-between p-1 hover:bg-gray-100"
|
|
74
75
|
}, [
|
|
75
76
|
createElementVNode("span", null, toDisplayString(i.name), 1),
|
|
76
77
|
createElementVNode("button", {
|
|
77
78
|
type: "button",
|
|
78
79
|
onClick: ($event) => DeleteFileHandle(d)
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
83
|
-
width: "24",
|
|
84
|
-
height: "24",
|
|
85
|
-
viewBox: "0 0 24 24",
|
|
86
|
-
fill: "none"
|
|
87
|
-
}, [
|
|
88
|
-
createElementVNode("g", null, [
|
|
89
|
-
createElementVNode("path", {
|
|
90
|
-
"fill-rule": "evenodd",
|
|
91
|
-
"clip-rule": "evenodd",
|
|
92
|
-
d: "M16.7782 7.22943C16.4824 6.93364 16.0046 6.93364 15.7088 7.22943L12 10.9306L8.29124 7.22184C7.99545 6.92605 7.51763 6.92605 7.22184 7.22184C6.92605 7.51763 6.92605 7.99545 7.22184 8.29124L10.9306 12L7.22184 15.7088C6.92605 16.0046 6.92605 16.4824 7.22184 16.7782C7.51763 17.0739 7.99545 17.0739 8.29124 16.7782L12 13.0694L15.7088 16.7782C16.0046 17.0739 16.4824 17.0739 16.7782 16.7782C17.0739 16.4824 17.0739 16.0046 16.7782 15.7088L13.0694 12L16.7782 8.29124C17.0664 8.00303 17.0664 7.51763 16.7782 7.22943Z",
|
|
93
|
-
fill: "inherit"
|
|
94
|
-
})
|
|
95
|
-
])
|
|
96
|
-
], -1)
|
|
97
|
-
]), 8, _hoisted_3)
|
|
80
|
+
}, [
|
|
81
|
+
createVNode(CloseIcon, { class: "h-5 w-5 fill-gray-600" })
|
|
82
|
+
], 8, _hoisted_3)
|
|
98
83
|
]);
|
|
99
84
|
}), 128))
|
|
100
85
|
])) : createCommentVNode("", true)
|
package/dist/tabs.css
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum ShapeFlags {
|
|
2
|
+
ELEMENT = 1,// 表示一个普通的HTML元素
|
|
3
|
+
FUNCTIONAL_COMPONENT = 2,// 函数式组件
|
|
4
|
+
STATEFUL_COMPONENT = 4,// 有状态组件
|
|
5
|
+
TEXT_CHILDREN = 8,// 子节点是文本
|
|
6
|
+
ARRAY_CHILDREN = 16,// 子节点是数组
|
|
7
|
+
SLOTS_CHILDREN = 32,// 子节点是插槽
|
|
8
|
+
TELEPORT = 64,// 表示vnode描述的是个teleport组件
|
|
9
|
+
SUSPENSE = 128,// 表示vnode描述的是个suspense组件
|
|
10
|
+
COMPONENT_SHOULD_KEEP_ALIVE = 256,// 表示需要被keep-live的有状态组件
|
|
11
|
+
COMPONENT_KEPT_ALIVE = 512,// 已经被keep-live的有状态组件
|
|
12
|
+
COMPONENT = 6
|
|
13
|
+
}
|