nuxt-hs-ui 2.11.2 → 2.11.4
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/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -121,7 +121,7 @@ const module = defineNuxtModule({
|
|
|
121
121
|
exposeConfig: true,
|
|
122
122
|
config: twConfig
|
|
123
123
|
});
|
|
124
|
-
await installModule("@pinia/nuxt"
|
|
124
|
+
await installModule("@pinia/nuxt");
|
|
125
125
|
await installModule("@vueuse/nuxt");
|
|
126
126
|
addPlugin(resolve("runtime/plugin/v-select"));
|
|
127
127
|
}
|
|
@@ -9,12 +9,21 @@
|
|
|
9
9
|
// [ tailwind ]
|
|
10
10
|
import { twMerge } from "tailwind-merge";
|
|
11
11
|
// [ NUXT ]
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
reactive,
|
|
14
|
+
ref,
|
|
15
|
+
watch,
|
|
16
|
+
computed,
|
|
17
|
+
useId,
|
|
18
|
+
nextTick,
|
|
19
|
+
type Ref,
|
|
20
|
+
} from "#imports";
|
|
13
21
|
// [ utils ]
|
|
14
22
|
import { type ClassType, ClassTypeToString } from "../../utils/class-style";
|
|
15
23
|
import type { SelectItem } from "../../utils/select-item";
|
|
16
24
|
import { useDisplayList, type DisplaySelectItem } from "../../utils/select";
|
|
17
25
|
import type { MultiLang } from "../../utils/multi-lang";
|
|
26
|
+
import { ObjectCopy } from "../../utils/object";
|
|
18
27
|
|
|
19
28
|
// [ composables ]
|
|
20
29
|
import { useHsFocus } from "../../composables/use-hs-focus";
|
|
@@ -28,6 +37,7 @@ import Btn from "../form/btn.vue";
|
|
|
28
37
|
const hsFocus = useHsFocus();
|
|
29
38
|
const multiLang = useHsMultiLang();
|
|
30
39
|
const tx = multiLang.tx;
|
|
40
|
+
const gt = multiLang.gt;
|
|
31
41
|
// ----------------------------------------------------------------------------
|
|
32
42
|
// [ Props ]
|
|
33
43
|
type Props = {
|
|
@@ -208,10 +218,14 @@ interface SelectItemShow extends DisplaySelectItem<IdType> {
|
|
|
208
218
|
activate: boolean;
|
|
209
219
|
i: number;
|
|
210
220
|
}
|
|
221
|
+
const displayList: Ref<SelectItemShow[]> = ref([]);
|
|
211
222
|
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
223
|
+
const setDisplayList = () => {
|
|
224
|
+
console.log("setDisplayList");
|
|
225
|
+
displayList.value = useDisplayList<IdType>({
|
|
226
|
+
list: ObjectCopy(props.list).map((row) => {
|
|
227
|
+
return { ...row, text: gt(row.text) };
|
|
228
|
+
}),
|
|
215
229
|
id: props.data,
|
|
216
230
|
order: props.order,
|
|
217
231
|
unKnownData: unKnownData.value,
|
|
@@ -226,8 +240,26 @@ const displayList = computed<SelectItemShow[]>(() => {
|
|
|
226
240
|
activate: false,
|
|
227
241
|
i: index,
|
|
228
242
|
};
|
|
229
|
-
});
|
|
230
|
-
}
|
|
243
|
+
}) as SelectItemShow[];
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
watch(
|
|
247
|
+
() => [
|
|
248
|
+
props.list,
|
|
249
|
+
props.list.length,
|
|
250
|
+
props.data,
|
|
251
|
+
isShowHidden.value,
|
|
252
|
+
props.require,
|
|
253
|
+
props.nullable,
|
|
254
|
+
props.nullText,
|
|
255
|
+
],
|
|
256
|
+
() => {
|
|
257
|
+
nextTick(() => {
|
|
258
|
+
setDisplayList();
|
|
259
|
+
});
|
|
260
|
+
},
|
|
261
|
+
{ immediate: true }
|
|
262
|
+
);
|
|
231
263
|
// ----------------------------------------------------------------------------
|
|
232
264
|
|
|
233
265
|
const checkData = (id: IdType | null) => {
|
|
@@ -306,7 +338,7 @@ const onBlur = (index: null | number) => {
|
|
|
306
338
|
if (props.readonly) return;
|
|
307
339
|
if (index === null) {
|
|
308
340
|
focusState.isNullActivate = false;
|
|
309
|
-
} else {
|
|
341
|
+
} else if (index in displayList.value) {
|
|
310
342
|
displayList.value[index].activate = false;
|
|
311
343
|
}
|
|
312
344
|
setTimeout(() => {
|
|
@@ -358,6 +390,7 @@ const onKeyup = (event: KeyboardEvent) => {
|
|
|
358
390
|
const setValue = async (row: SelectItemShow | null) => {
|
|
359
391
|
if (props.disabled) return;
|
|
360
392
|
if (props.readonly) return;
|
|
393
|
+
console.log(row);
|
|
361
394
|
displayData.value = row;
|
|
362
395
|
};
|
|
363
396
|
|
|
@@ -9,10 +9,15 @@
|
|
|
9
9
|
// [ tailwind ]
|
|
10
10
|
// [ NUXT ]
|
|
11
11
|
import { reactive, ref, watch, computed, useId, nextTick } from "#imports";
|
|
12
|
+
|
|
13
|
+
// import { createPopper } from "@popperjs/core";
|
|
14
|
+
|
|
12
15
|
// [ utils ]
|
|
13
16
|
import type { ClassType } from "../../utils/class-style";
|
|
14
17
|
import type { SelectItem } from "../../utils/select-item";
|
|
15
18
|
import { useDisplayList, type DisplaySelectItem } from "../../utils/select";
|
|
19
|
+
import { ObjectCopy } from "../../utils/object";
|
|
20
|
+
|
|
16
21
|
import type { MultiLang } from "../../utils/multi-lang";
|
|
17
22
|
// [ composables ]
|
|
18
23
|
import { useHsFocus } from "../../composables/use-hs-focus";
|
|
@@ -193,25 +198,58 @@ const unKnownData = computed(() => {
|
|
|
193
198
|
// ----------------------------------------------------------------------------
|
|
194
199
|
const isShowHidden = ref(false);
|
|
195
200
|
/** 選択肢に非表示アイテムが含まれているかどうか */
|
|
201
|
+
|
|
202
|
+
const pList = computed(() => {
|
|
203
|
+
return ObjectCopy(props.list);
|
|
204
|
+
});
|
|
196
205
|
const includeHidden = computed(() => {
|
|
197
|
-
return
|
|
206
|
+
return pList.value.filter((row) => row.hidden).length > 0;
|
|
198
207
|
});
|
|
199
208
|
// ----------------------------------------------------------------------------
|
|
200
209
|
/** 選択肢 */
|
|
201
|
-
const displayList =
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
const displayList = ref<DisplaySelectItem<IdType>[]>([]);
|
|
211
|
+
|
|
212
|
+
watch(
|
|
213
|
+
() => [
|
|
214
|
+
props.list,
|
|
215
|
+
props.list.length,
|
|
216
|
+
props.data,
|
|
217
|
+
isShowHidden.value,
|
|
218
|
+
props.require,
|
|
219
|
+
props.nullable,
|
|
220
|
+
props.nullText,
|
|
221
|
+
],
|
|
222
|
+
() => {
|
|
223
|
+
displayList.value = useDisplayList<IdType>({
|
|
224
|
+
list: ObjectCopy(props.list).map((row) => {
|
|
225
|
+
return { ...row, text: gt(row.text) };
|
|
226
|
+
}),
|
|
227
|
+
id: props.data,
|
|
228
|
+
order: props.order,
|
|
229
|
+
unKnownData: unKnownData.value,
|
|
230
|
+
unKnownSelected: unKnownSelected.value,
|
|
231
|
+
isShowHidden: isShowHidden.value,
|
|
232
|
+
require: props.require || !props.nullable,
|
|
233
|
+
nullText: tx(props.nullText).value,
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
{ immediate: true }
|
|
237
|
+
);
|
|
238
|
+
// const displayList = computed(() => {
|
|
239
|
+
// console.log("displayList");
|
|
240
|
+
// return useDisplayList<IdType>({
|
|
241
|
+
// list: ObjectCopy(props.list).map((row) => {
|
|
242
|
+
// return { ...row, text: gt(row.text) };
|
|
243
|
+
// }),
|
|
244
|
+
// id: props.data,
|
|
245
|
+
// order: props.order,
|
|
246
|
+
// unKnownData: unKnownData.value,
|
|
247
|
+
// unKnownSelected: unKnownSelected.value,
|
|
248
|
+
// isShowHidden: isShowHidden.value,
|
|
249
|
+
// require: props.require || !props.nullable,
|
|
250
|
+
// nullText: tx(props.nullText).value,
|
|
251
|
+
// });
|
|
252
|
+
// });
|
|
215
253
|
// ----------------------------------------------------------------------------
|
|
216
254
|
|
|
217
255
|
const checkData = (id: IdType | null) => {
|
|
@@ -286,6 +324,33 @@ const selectClose = () => {
|
|
|
286
324
|
focusState.isOpen = false;
|
|
287
325
|
emit("selectClose", uid);
|
|
288
326
|
};
|
|
327
|
+
// const placement = ref("top");
|
|
328
|
+
const inputElement = ref<HTMLElement | null>(null);
|
|
329
|
+
// const withPopper = (dropdownList: any, component: any, { width }: any) => {
|
|
330
|
+
// dropdownList.style.width = width;
|
|
331
|
+
// const popper = createPopper(component.$refs.toggle, dropdownList, {
|
|
332
|
+
// placement: placement.value as any,
|
|
333
|
+
// modifiers: [
|
|
334
|
+
// {
|
|
335
|
+
// name: "offset",
|
|
336
|
+
// options: {
|
|
337
|
+
// offset: [0, -1],
|
|
338
|
+
// },
|
|
339
|
+
// },
|
|
340
|
+
// {
|
|
341
|
+
// name: "toggleClass",
|
|
342
|
+
// enabled: true,
|
|
343
|
+
// phase: "write",
|
|
344
|
+
// fn({ state }) {
|
|
345
|
+
// component.$el.classList.toggle("drop-up", state.placement === "top");
|
|
346
|
+
// },
|
|
347
|
+
// },
|
|
348
|
+
// ],
|
|
349
|
+
// });
|
|
350
|
+
// return () => popper.destroy();
|
|
351
|
+
// };
|
|
352
|
+
// :calculate-position="withPopper"
|
|
353
|
+
|
|
289
354
|
// ----------------------------------------------------------------------------
|
|
290
355
|
// ----------------------------------------------------------------------------
|
|
291
356
|
</script>
|
|
@@ -351,7 +416,10 @@ const selectClose = () => {
|
|
|
351
416
|
<!-- -->
|
|
352
417
|
<!-- -->
|
|
353
418
|
<template #selected-option="{ text, imgUrl, deleted, appendIcon }">
|
|
354
|
-
<div
|
|
419
|
+
<div
|
|
420
|
+
class="flex items-baseline w-full max-w-full min-w-0"
|
|
421
|
+
:class="loading ? 'opacity-0' : ''"
|
|
422
|
+
>
|
|
355
423
|
<SelectImgIcon
|
|
356
424
|
v-if="imgUrl && props.image"
|
|
357
425
|
class="flex-none"
|
|
@@ -500,6 +568,10 @@ const selectClose = () => {
|
|
|
500
568
|
display: none;
|
|
501
569
|
}
|
|
502
570
|
|
|
571
|
+
.vs__dropdown-menu {
|
|
572
|
+
max-height: 250px;
|
|
573
|
+
}
|
|
574
|
+
|
|
503
575
|
.v-select-hidden-toggle-switch {
|
|
504
576
|
pointer-events: all !important;
|
|
505
577
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// [ tailwind ]
|
|
10
10
|
import { twMerge } from "tailwind-merge";
|
|
11
11
|
// [ NUXT ]
|
|
12
|
-
import { useId, computed, watch, onUnmounted, ref } from "#imports";
|
|
12
|
+
import { useId, computed, watch, onUnmounted, ref, useHead } from "#imports";
|
|
13
13
|
// [ utils ]
|
|
14
14
|
import { type ClassType, ClassTypeToString } from "../../utils/class-style";
|
|
15
15
|
// [ composables ]
|
|
@@ -59,6 +59,14 @@ if (props.show) {
|
|
|
59
59
|
hsModal.add(id, props.closeable);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
useHead({
|
|
63
|
+
style: [
|
|
64
|
+
{
|
|
65
|
+
// flatpickr が毎回勝てるよう、都度上書き
|
|
66
|
+
children: `.flatpickr-calendar{z-index:${zOrder.value + 1} !important;}`,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
});
|
|
62
70
|
watch(
|
|
63
71
|
() => props.show,
|
|
64
72
|
(show) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-hs-ui",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.4",
|
|
4
4
|
"description": "My new Nuxt module",
|
|
5
5
|
"repository": "https://github.com/hare-systems-ryo/nuxt-hs-ui",
|
|
6
6
|
"license": "MIT",
|
|
@@ -117,6 +117,7 @@
|
|
|
117
117
|
"@nuxt/ui": "^2.21.0",
|
|
118
118
|
"@nuxtjs/tailwindcss": "^6.13.1",
|
|
119
119
|
"@pinia/nuxt": "0.11.0",
|
|
120
|
+
"@popperjs/core": "^2.11.8",
|
|
120
121
|
"@vueuse/core": "^12.3.0",
|
|
121
122
|
"@vueuse/integrations": "^12.3.0",
|
|
122
123
|
"@vueuse/nuxt": "^12.3.0",
|
|
@@ -146,8 +147,8 @@
|
|
|
146
147
|
"eslint": "^9.18.0",
|
|
147
148
|
"nuxt": "^3.15.1",
|
|
148
149
|
"sass": "^1.83.4",
|
|
149
|
-
"tailwindcss": "^3.4.17",
|
|
150
150
|
"sass-embedded": "^1.83.4",
|
|
151
|
+
"tailwindcss": "^3.4.17",
|
|
151
152
|
"typescript": "~5.7.3",
|
|
152
153
|
"vitest": "^2.1.8",
|
|
153
154
|
"vue-tsc": "^2.2.0"
|