nuxt-hs-ui 1.0.10 → 2.0.2

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.
Files changed (112) hide show
  1. package/README.md +11 -4
  2. package/dist/module.d.mts +10 -2
  3. package/dist/module.d.ts +10 -2
  4. package/dist/module.json +5 -2
  5. package/dist/module.mjs +90 -51
  6. package/dist/runtime/assets/flatpickr-dark.css +1 -0
  7. package/dist/runtime/assets/flatpickr-month-select-style.css +1 -0
  8. package/dist/runtime/assets/tabulator-custom.css +1 -0
  9. package/dist/runtime/assets/tabulator.css +1 -0
  10. package/dist/runtime/assets/vue-select.css +1 -0
  11. package/dist/runtime/components/{hs-fc/btn/line-loading.vue → form/btn-line-loading.vue} +28 -42
  12. package/dist/runtime/components/form/btn.vue +488 -0
  13. package/dist/runtime/components/form/check-box.vue +352 -0
  14. package/dist/runtime/components/form/check-list.vue +354 -0
  15. package/dist/runtime/components/form/datepicker copy.vue +770 -0
  16. package/dist/runtime/components/form/datepicker.vue +897 -0
  17. package/dist/runtime/components/form/input-frame.vue +272 -0
  18. package/dist/runtime/components/form/radio.vue +685 -0
  19. package/dist/runtime/components/form/select-img-icon.vue +53 -0
  20. package/dist/runtime/components/form/select.vue +438 -0
  21. package/dist/runtime/components/form/text-box.vue +375 -0
  22. package/dist/runtime/components/form/textarea.vue +466 -0
  23. package/dist/runtime/components/form/value-box.vue +681 -0
  24. package/dist/runtime/components/interactive/alert.vue +113 -0
  25. package/dist/runtime/components/{hs-ui → interactive}/block-loading.vue +42 -59
  26. package/dist/runtime/components/{hs-ui/dialog/index.vue → interactive/dialog.vue} +132 -127
  27. package/dist/runtime/components/interactive/modal-bg.vue +82 -0
  28. package/dist/runtime/components/interactive/modal.vue +143 -0
  29. package/dist/runtime/components/{hs-ui/toast/index.vue → interactive/toast.vue} +76 -109
  30. package/dist/runtime/components/{hs-ui → interactive}/window-loader.vue +12 -9
  31. package/dist/runtime/components/{hs-ui → layout}/accordion.vue +21 -30
  32. package/dist/runtime/components/layout/aspect-box.vue +71 -0
  33. package/dist/runtime/components/layout/card-item.vue +193 -0
  34. package/dist/runtime/components/layout/card.vue +42 -0
  35. package/dist/runtime/components/layout/container.vue +40 -0
  36. package/dist/runtime/components/misc/breadcrumb.vue +96 -0
  37. package/dist/runtime/components/misc/tabulator.vue +187 -0
  38. package/dist/runtime/components/misc/view-name-display-target.vue +39 -0
  39. package/dist/runtime/components/misc/view-name-display.vue +90 -0
  40. package/dist/runtime/composables/use-hs-dialog.d.ts +40 -0
  41. package/dist/runtime/composables/{use-hs-ui-dialog.js → use-hs-dialog.js} +15 -10
  42. package/dist/runtime/composables/{use-hs-form-focus.d.ts → use-hs-focus.d.ts} +1 -1
  43. package/dist/runtime/composables/{use-hs-form-focus.js → use-hs-focus.js} +2 -4
  44. package/dist/runtime/composables/use-hs-misc.d.ts +22 -0
  45. package/dist/runtime/composables/use-hs-misc.js +62 -0
  46. package/dist/runtime/composables/use-hs-modal.d.ts +31 -0
  47. package/dist/runtime/{components/hs-ui/modal/use-ui-modal.js → composables/use-hs-modal.js} +18 -16
  48. package/dist/runtime/composables/use-hs-multi-lang.d.ts +14 -6
  49. package/dist/runtime/composables/use-hs-multi-lang.js +44 -11
  50. package/dist/runtime/composables/{use-hs-ui-toast.d.ts → use-hs-toast.d.ts} +3 -3
  51. package/dist/runtime/composables/{use-hs-ui-toast.js → use-hs-toast.js} +4 -5
  52. package/dist/runtime/composables/{use-hs-ui-window-loader.d.ts → use-hs-window-loader.d.ts} +1 -1
  53. package/dist/runtime/composables/{use-hs-ui-window-loader.js → use-hs-window-loader.js} +1 -2
  54. package/dist/runtime/plugin/v-select.d.ts +2 -0
  55. package/dist/runtime/plugin/v-select.js +5 -0
  56. package/dist/runtime/style.css +22 -1
  57. package/dist/runtime/tailwind.css +78 -0
  58. package/dist/runtime/types/app.config.d.ts +5 -0
  59. package/dist/runtime/{components/hs-ui/dialog/index.type.d.ts → types/dialog.d.ts} +3 -3
  60. package/dist/runtime/{components/hs-ui/toast/index.type.d.ts → types/toast.d.ts} +1 -2
  61. package/dist/runtime/{components/hs-ui/toast/index.type.js → types/toast.js} +0 -1
  62. package/dist/runtime/utils/class-style.d.ts +6 -0
  63. package/dist/runtime/utils/class-style.js +27 -0
  64. package/dist/runtime/utils/com.d.ts +6 -0
  65. package/dist/runtime/{lib → utils}/com.js +1 -4
  66. package/dist/runtime/utils/dayjs.d.ts +53 -0
  67. package/dist/runtime/utils/dayjs.js +124 -0
  68. package/dist/runtime/utils/float.d.ts +2 -0
  69. package/dist/runtime/utils/float.js +35 -0
  70. package/dist/runtime/utils/multi-lang-object.d.ts +17 -0
  71. package/dist/runtime/utils/multi-lang-object.js +34 -0
  72. package/dist/runtime/{lib → utils}/multi-lang.d.ts +1 -1
  73. package/dist/runtime/{lib → utils}/multi-lang.js +31 -27
  74. package/dist/runtime/{lib → utils}/number.d.ts +2 -4
  75. package/dist/runtime/{lib → utils}/number.js +29 -69
  76. package/dist/runtime/utils/object.d.ts +46 -0
  77. package/dist/runtime/utils/object.js +107 -0
  78. package/dist/runtime/utils/select-item.d.ts +31 -0
  79. package/dist/runtime/utils/select.d.ts +14 -0
  80. package/dist/runtime/utils/select.js +36 -0
  81. package/dist/runtime/utils/string.d.ts +39 -0
  82. package/dist/runtime/utils/string.js +125 -0
  83. package/dist/runtime/utils/tabulator.d.ts +108 -0
  84. package/dist/runtime/utils/tabulator.js +296 -0
  85. package/dist/runtime/utils/theme.d.ts +21 -0
  86. package/dist/runtime/utils/theme.js +31 -0
  87. package/dist/runtime/utils/tv.d.ts +101 -0
  88. package/dist/runtime/utils/tv.js +26 -0
  89. package/dist/runtime/utils/wareki.d.ts +3 -0
  90. package/dist/runtime/utils/wareki.js +106 -0
  91. package/dist/types.d.mts +1 -17
  92. package/dist/types.d.ts +1 -17
  93. package/package.json +99 -37
  94. package/dist/runtime/components/hs-fc/btn/index.vue +0 -510
  95. package/dist/runtime/components/hs-ui/aspect-box.vue +0 -83
  96. package/dist/runtime/components/hs-ui/card-item.vue +0 -141
  97. package/dist/runtime/components/hs-ui/card.vue +0 -54
  98. package/dist/runtime/components/hs-ui/container.vue +0 -50
  99. package/dist/runtime/components/hs-ui/modal/bg.vue +0 -94
  100. package/dist/runtime/components/hs-ui/modal/index.vue +0 -206
  101. package/dist/runtime/components/hs-ui/modal/use-ui-modal.d.ts +0 -20
  102. package/dist/runtime/components/v-test.vue +0 -60
  103. package/dist/runtime/composables/use-hs-ui-dialog.d.ts +0 -22
  104. package/dist/runtime/lib/class-style.d.ts +0 -8
  105. package/dist/runtime/lib/class-style.js +0 -59
  106. package/dist/runtime/lib/com.d.ts +0 -14
  107. package/dist/runtime/lib/prefix.d.ts +0 -2
  108. package/dist/runtime/lib/prefix.js +0 -17
  109. package/dist/runtime/lib/theme.d.ts +0 -2
  110. package/dist/runtime/lib/theme.js +0 -21
  111. /package/dist/runtime/{components/hs-ui/dialog/index.type.js → types/dialog.js} +0 -0
  112. /package/dist/runtime/{components/hs-fc/hoge → utils/select-item.js} +0 -0
@@ -0,0 +1,466 @@
1
+ <script setup lang="ts">
2
+ /* ----------------------------------------------------------------------------
3
+ // src\runtime\components\form\textarea.vue
4
+ // ----------------------------------------------------------------------------
5
+ // Textarea
6
+ // TextareaTextarea
7
+ ----------------------------------------------------------------------------- */
8
+
9
+ // [ tailwind ]
10
+ import { twMerge } from "tailwind-merge";
11
+ // [ NUXT ]
12
+ import { reactive, ref, watch, computed, useId, nextTick } from "#imports";
13
+ // [ utils ]
14
+ import type { ClassType } from "../../utils/class-style";
15
+ // [ composables ]
16
+ import { useHsFocus } from "../../composables/use-hs-focus";
17
+ import { useHsMisc } from "../../composables/use-hs-misc";
18
+ // [ Components ]
19
+ import InputFrame from "./input-frame.vue";
20
+ // ----------------------------------------------------------------------------
21
+ const hsFocus = useHsFocus();
22
+ const hsMisc = useHsMisc();
23
+ // ----------------------------------------------------------------------------
24
+ // [ Props ]
25
+ type Props = {
26
+ // ----------------------------------------------------------------------------
27
+ // Input 種類別
28
+ rows?: number;
29
+ maxRows?: number;
30
+ maxLen?: number;
31
+ // ----------------------------------------------------------------------------
32
+ data: string;
33
+ diff?: string | undefined;
34
+ tabindex?: string | undefined;
35
+ // ----------------------------------------------------------------------------
36
+ class?: ClassType;
37
+ classHeader?: ClassType;
38
+ classInput?: ClassType;
39
+ // ----------------------------------------------------------------------------
40
+ // 状態
41
+ // focus?: boolean;
42
+ focusColor?: string;
43
+ // change?: boolean;
44
+ changeColor?: string;
45
+ error?: boolean;
46
+ errorColor?: string;
47
+ disabled?: boolean;
48
+ disabledColor?: string;
49
+ readonly?: boolean;
50
+ // ----------------------------------------------------------------------------
51
+ // 表示
52
+ label?: string;
53
+ // 表示-副情報
54
+ require?: boolean;
55
+ requireText?: string;
56
+ warn?: string;
57
+ warnTimeOut?: number;
58
+ // ----------------------------------------------------------------------------
59
+ // 設定
60
+ size?: "s" | "m" | "l";
61
+ // ----------------------------------------------------------------------------
62
+ uiText?: {
63
+ rowsUnit: string;
64
+ };
65
+ };
66
+ const props = withDefaults(defineProps<Props>(), {
67
+ // ----------------------------------------------------------------------------
68
+ // Input 種類別
69
+ rows: 5,
70
+ maxRows: 0,
71
+ maxLen: 0,
72
+ // ----------------------------------------------------------------------------
73
+ diff: undefined,
74
+ tabindex: undefined,
75
+ // ----------------------------------------------------------------------------
76
+ class: "",
77
+ classHeader: "",
78
+ classInput: "",
79
+ // ----------------------------------------------------------------------------
80
+ // 状態
81
+ // focus: false,
82
+ focusColor: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]",
83
+ // change: false,
84
+ changeColor: "shadow-[inset_0px_0px_1px_2px_#fd9831be]",
85
+ error: false,
86
+ errorColor: "shadow-[inset_0px_0px_1px_2px_#d80000dc]",
87
+ disabled: false,
88
+ disabledColor: "",
89
+ readonly: false,
90
+ // ----------------------------------------------------------------------------
91
+ // 表示
92
+ label: "",
93
+ // 表示-副情報
94
+ require: false,
95
+ requireText: "必須",
96
+ warn: "",
97
+ warnTimeOut: 300,
98
+ // ----------------------------------------------------------------------------
99
+ // 設定
100
+ size: "m",
101
+
102
+ // ----------------------------------------------------------------------------
103
+ uiText: () => {
104
+ return {
105
+ rowsUnit: "行",
106
+ };
107
+ },
108
+ });
109
+ // ----------------------------------------------------------------------------
110
+ // [ emit ]
111
+ type Emits = {
112
+ ref: [element: HTMLElement];
113
+ focus: [elm: HTMLElement];
114
+ blur: [elm: HTMLElement];
115
+ // ----------------------------
116
+ "update:data": [value: string];
117
+ "value-change": [after: string, before: string];
118
+ // ----------------------------
119
+ keydown: [event: KeyboardEvent];
120
+ keyup: [event: KeyboardEvent];
121
+ // ----------------------------
122
+ };
123
+ const emit = defineEmits<Emits>();
124
+ // ----------------------------------------------------------------------------
125
+ // [ getCurrentInstance ]
126
+ const uid = useId();
127
+ // ----------------------------------------------------------------------------
128
+
129
+ // [ reactive ]
130
+ interface State {
131
+ value: string;
132
+ }
133
+ const state = reactive<State>({
134
+ value: "",
135
+ });
136
+ // ----------------------------------------------------------------------------
137
+ watch(
138
+ () => props.data,
139
+ () => {
140
+ setValue(props.data);
141
+ }
142
+ );
143
+
144
+ const CutLen = (text: string, len: number, addWard = "") => {
145
+ if (text === null) return "";
146
+ if (len === 0) return text;
147
+ return text.substring(0, len) + addWard;
148
+ };
149
+ const getCheckedText = (text: string) => {
150
+ // 各行を配列の要素に分ける
151
+ let ret = text;
152
+ if (props.maxRows !== 0) {
153
+ const lines = text.split("\n");
154
+ let amari = "";
155
+ // 入力行数が制限を超えた場合
156
+ if (lines.length > props.maxRows) {
157
+ const result = [];
158
+ for (let i = 0; i < lines.length; i++) {
159
+ if (i < props.maxRows) {
160
+ result.push(lines[i]);
161
+ } else {
162
+ amari += lines[i].replace(/\n/g, "");
163
+ }
164
+ }
165
+ ret = result.join("\n") + amari;
166
+ }
167
+ }
168
+ if (props.maxLen !== 0 || ret.length > props.maxLen) {
169
+ ret = CutLen(ret, props.maxLen, "");
170
+ }
171
+ return ret;
172
+ };
173
+
174
+ const setValue = (text: string | null) => {
175
+ if (text === null) {
176
+ state.value = "";
177
+ return;
178
+ }
179
+ const lineCheckedText = getCheckedText(text);
180
+ if (lineCheckedText === text) {
181
+ state.value = text;
182
+ } else {
183
+ // 文字数のオーバーフロー確定
184
+ // 親コンポーネントへの更新処理に移動
185
+ updateValue(text);
186
+ }
187
+ };
188
+ setValue(props.data);
189
+
190
+ // 更新を親コンポーネントに伝える
191
+ const updateValue = async (text: string | null) => {
192
+ const before = props.data;
193
+ let setText = "";
194
+ if (text === null) {
195
+ setText = "";
196
+ } else {
197
+ // 各行を配列の要素に分ける
198
+ setText = getCheckedText(text);
199
+ }
200
+ state.value = setText;
201
+ emit("update:data", setText);
202
+ await nextTick();
203
+ emit("value-change", setText, before);
204
+ };
205
+
206
+ // [ ref ]
207
+ const inputElement = ref();
208
+
209
+ const setRef = (elm: any) => {
210
+ inputElement.value = elm;
211
+ emit("ref", elm as HTMLInputElement);
212
+ };
213
+
214
+ /**
215
+ * 強制focus
216
+ */
217
+ const elmFocus = () => {
218
+ inputElement.value.focus();
219
+ };
220
+
221
+ // [ focus, blur ]
222
+
223
+ interface FocusState {
224
+ isActivate: boolean;
225
+ isMmousedown: boolean;
226
+ }
227
+
228
+ const focusState = reactive<FocusState>({
229
+ isActivate: false,
230
+ isMmousedown: false,
231
+ });
232
+
233
+ /**
234
+ * コントロールのFocus判定
235
+ */
236
+ const computedActivate = computed(() => {
237
+ if (props.disabled === true) return false;
238
+ if (props.readonly === true) return false;
239
+ if (hsFocus.state.id !== uid) return false;
240
+ if (focusState.isActivate) return true;
241
+ if (focusState.isMmousedown) return true;
242
+ return false;
243
+ });
244
+
245
+ /**
246
+ * focus, blur イベント
247
+ */
248
+ watch(computedActivate, (value) => {
249
+ if (value === true) {
250
+ // クリックでの遷移の場合に
251
+ // 一つ前のコントロールのblurイベントよりも早くfocusが発生しないようにする対策で10ミリ秒処理をずらす
252
+ setTimeout(() => {
253
+ emit("focus", inputElement.value);
254
+ }, 10);
255
+ } else {
256
+ emit("blur", inputElement.value);
257
+ }
258
+ });
259
+
260
+ const onMousedown = () => {
261
+ focusState.isMmousedown = true;
262
+ };
263
+ const onMouseup = () => {
264
+ elmFocus();
265
+ focusState.isMmousedown = false;
266
+ };
267
+
268
+ const onFocus = () => {
269
+ if (props.disabled === true) return;
270
+ if (props.readonly === true) return;
271
+ focusState.isActivate = true;
272
+ hsFocus.state.id = uid;
273
+ };
274
+ const onBlur = () => {
275
+ focusState.isActivate = false;
276
+ };
277
+
278
+ // [ baseClass ]
279
+ const tabindex = computed(() => {
280
+ if (props.disabled === true) return -1;
281
+ if (props.readonly === true) return -1;
282
+ return props.tabindex;
283
+ });
284
+
285
+ // 更新の有無確認
286
+ const isChangeData = computed(() => {
287
+ if (props.diff === undefined) return false;
288
+ if (props.diff === null && props.data === "") return false;
289
+ if (props.diff === "" && props.data === null) return false;
290
+ if (props.diff !== props.data) return true;
291
+ return false;
292
+ });
293
+ // ---------------------------------------------------------------------------------
294
+ // ----------------------------------------------------------------------------
295
+ const lenLabelClass = computed(() => {
296
+ const last = props.maxLen - state.value.length;
297
+ return [
298
+ twMerge(
299
+ "text-white bg-[#2fa412]",
300
+ last < 6 ? "bg-[#fdc90d]" : "",
301
+ last < 5 ? "bg-[#fd750d]" : "",
302
+ last < 2 ? "bg-[#fa541d]" : ""
303
+ ),
304
+ ];
305
+ });
306
+ const rowLabelClass = computed(() => {
307
+ const last = props.maxRows - state.value.split("\n").length;
308
+ return [
309
+ twMerge(
310
+ "text-white bg-[#2fa412]",
311
+ last < 5 ? "bg-[#fdc90d]" : "",
312
+ last < 3 ? "bg-[#fd750d]" : "",
313
+ last < 1 ? "bg-[#fa541d]" : ""
314
+ ),
315
+ ];
316
+ });
317
+
318
+ const textAreaFrameClass = computed(() => {
319
+ return [
320
+ twMerge(),
321
+ //
322
+ "bg-transparent",
323
+ "flex flex-row items-center justify-center",
324
+ "h-full w-full",
325
+ ];
326
+ });
327
+ const textAreaClass = computed(() => {
328
+ return [
329
+ twMerge(
330
+ //
331
+ "flex-1",
332
+ "!leading-[1.2em]",
333
+ "bg-transparent",
334
+ "mt-[1px]",
335
+ "min-h-full min-w-full"
336
+ ),
337
+ ];
338
+ });
339
+ </script>
340
+
341
+ <template>
342
+ <InputFrame
343
+ :class="['h-auto', props.class]"
344
+ :class-header="props.classHeader"
345
+ :class-input="['flex-1', props.classInput]"
346
+ :focus="computedActivate"
347
+ :focus-color="props.focusColor"
348
+ :change="isChangeData"
349
+ :change-color="props.changeColor"
350
+ :error="props.error"
351
+ :error-color="props.errorColor"
352
+ :disabled="props.disabled"
353
+ :disabled-color="props.disabledColor"
354
+ :readonly="props.readonly"
355
+ :label="props.label"
356
+ :require="props.require"
357
+ :require-text="props.requireText"
358
+ :warn="props.warn"
359
+ :warn-time-out="props.warnTimeOut"
360
+ :size="props.size"
361
+ @click="elmFocus"
362
+ >
363
+ <template v-if="$slots.label" #label>
364
+ <slot name="label"></slot>
365
+ </template>
366
+ <template
367
+ v-if="props.maxLen > 0 || props.maxRows > 0"
368
+ #header-right="{ defaultClass }"
369
+ >
370
+ <div v-if="props.maxLen !== 0" :class="[defaultClass, lenLabelClass]">
371
+ {{ state.value.length }} / {{ props.maxLen }}
372
+ </div>
373
+ <div v-if="props.maxRows !== 0" :class="[defaultClass, rowLabelClass]">
374
+ {{ state.value.split("\n").length }} / {{ props.maxRows }}
375
+ {{ props.uiText.rowsUnit }}
376
+ </div>
377
+ </template>
378
+ <div
379
+ class="nac-c-input-box"
380
+ :class="[textAreaFrameClass, { isMobile: hsMisc.state.isMobile }]"
381
+ >
382
+ <textarea
383
+ :ref="(e) => setRef(e)"
384
+ v-model="state.value"
385
+ type="text"
386
+ :class="textAreaClass"
387
+ :rows="props.rows"
388
+ :disabled="props.disabled || props.readonly"
389
+ :tabindex="tabindex"
390
+ @blur="onBlur()"
391
+ @focus="onFocus()"
392
+ @mousedown="onMousedown"
393
+ @mouseup="onMouseup"
394
+ @input="updateValue(state.value)"
395
+ @keydown="(e: KeyboardEvent) => emit('keydown', e)"
396
+ @keyup="(e: KeyboardEvent) => emit('keyup', e)"
397
+ ></textarea>
398
+ </div>
399
+ </InputFrame>
400
+ </template>
401
+
402
+ <style scoped>
403
+ @charset "UTF-8";
404
+ .nac-c-input-box {
405
+ padding: 4px 2px 4px 4px;
406
+ /*スクロールバーの軌道*/
407
+ /*スクロールバーの動く部分*/
408
+ }
409
+ .nac-c-input-box ::-webkit-scrollbar {
410
+ width: 6px;
411
+ padding-top: 3px;
412
+ padding-bottom: 4px;
413
+ cursor: pointer;
414
+ background-color: transparent;
415
+ }
416
+ .nac-c-input-box ::-webkit-scrollbar-track {
417
+ border-radius: 3px;
418
+ margin-top: -3px;
419
+ margin-bottom: 4px;
420
+ }
421
+ .nac-c-input-box ::-webkit-scrollbar-thumb {
422
+ border-radius: 3px;
423
+ }
424
+ .nac-c-input-box ::-webkit-resizer {
425
+ background-color: transparent;
426
+ opacity: 0;
427
+ height: 2px !important;
428
+ }
429
+ .nac-c-input-box:not(.isMobile)::after {
430
+ position: absolute;
431
+ z-index: 0;
432
+ bottom: 0px;
433
+ right: 0px;
434
+ width: 10px;
435
+ height: 16px;
436
+ content: "\f338";
437
+ font-family: "Font Awesome 5 Free";
438
+ font-weight: 900;
439
+ pointer-events: none;
440
+ text-align: right;
441
+ font-size: 10px;
442
+ padding-right: 2px;
443
+ color: #e26f2c;
444
+ }
445
+ @media screen and (min-width: 0px) and (max-width: 599.9px) {
446
+ .nac-c-input-box:not(.isMobile)::after {
447
+ opacity: 0;
448
+ }
449
+ }
450
+
451
+ textarea {
452
+ resize: vertical;
453
+ -webkit-appearance: none;
454
+ -moz-appearance: none;
455
+ appearance: none;
456
+ border: 0px;
457
+ outline: none;
458
+ white-space: pre;
459
+ overflow-wrap: normal;
460
+ overflow-x: auto;
461
+ overflow-y: scroll;
462
+ }
463
+ textarea[disabled]::-webkit-resizer {
464
+ background: #f3f3f3;
465
+ }
466
+ </style>