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,375 @@
1
+ <script setup lang="ts">
2
+ /* ----------------------------------------------------------------------------
3
+ // src\runtime\components\form\text-box.vue
4
+ // ----------------------------------------------------------------------------
5
+ // TextBox
6
+ // TextBoxTextBox
7
+ ----------------------------------------------------------------------------- */
8
+
9
+ // [ tailwind ]
10
+ import { twMerge } from "tailwind-merge";
11
+
12
+ // [ NUXT ]
13
+ import { reactive, ref, watch, computed, nextTick, useId } from "#imports";
14
+
15
+ // [ utils ]
16
+ import type { ClassType } from "../../utils/class-style";
17
+ // [ composables ]
18
+ import { useHsFocus } from "../../composables/use-hs-focus";
19
+ // [ Components ]
20
+ import InputFrame from "./input-frame.vue";
21
+ // ----------------------------------------------------------------------------
22
+ const fcFocus = useHsFocus();
23
+ // ----------------------------------------------------------------------------
24
+ // [ Props ]
25
+ type Props = {
26
+ // ----------------------------------------------------------------------------
27
+ // Input 種類別
28
+ type?: "email" | "number" | "password" | "tel" | "text" | "url";
29
+ textAlign?: "left" | "center" | "right";
30
+ maxLen?: number;
31
+ autocomplete?: string;
32
+ datalist?: string[];
33
+ enterkeyhint?: string;
34
+ inputmode?:
35
+ | "text"
36
+ | "search"
37
+ | "none"
38
+ | "tel"
39
+ | "url"
40
+ | "email"
41
+ | "numeric"
42
+ | "decimal"
43
+ | undefined;
44
+ // ----------------------------------------------------------------------------
45
+ data: string;
46
+ diff?: string | undefined;
47
+ tabindex?: string | undefined;
48
+ // ----------------------------------------------------------------------------
49
+ class?: ClassType;
50
+ classHeader?: ClassType;
51
+ classInput?: ClassType;
52
+ // ----------------------------------------------------------------------------
53
+ // 状態
54
+ // focus?: boolean;
55
+ focusColor?: string;
56
+ // change?: boolean;
57
+ changeColor?: string;
58
+ error?: boolean;
59
+ errorColor?: string;
60
+ disabled?: boolean;
61
+ disabledColor?: string;
62
+ readonly?: boolean;
63
+ // ----------------------------------------------------------------------------
64
+ // 表示
65
+ label?: string;
66
+ // 表示-副情報
67
+ require?: boolean;
68
+ requireText?: string;
69
+ warn?: string;
70
+ warnTimeOut?: number;
71
+ // ----------------------------------------------------------------------------
72
+ // 設定
73
+ size?: "s" | "m" | "l";
74
+ };
75
+ const props = withDefaults(defineProps<Props>(), {
76
+ // ----------------------------------------------------------------------------
77
+ // Input 種類別
78
+ type: "text",
79
+ textAlign: "left",
80
+ maxLen: 0,
81
+ autocomplete: "off",
82
+ datalist: () => [],
83
+ enterkeyhint: undefined,
84
+ inputmode: undefined,
85
+ // ----------------------------------------------------------------------------
86
+ diff: undefined,
87
+ tabindex: undefined,
88
+ // ----------------------------------------------------------------------------
89
+ class: "",
90
+ classHeader: "",
91
+ classInput: "",
92
+ // ----------------------------------------------------------------------------
93
+ // 状態
94
+ // focus: false,
95
+ focusColor: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]",
96
+ // change: false,
97
+ changeColor: "shadow-[inset_0px_0px_1px_2px_#fd9831be]",
98
+ error: false,
99
+ errorColor: "shadow-[inset_0px_0px_1px_2px_#d80000dc]",
100
+ disabled: false,
101
+ disabledColor: "",
102
+ readonly: false,
103
+ // ----------------------------------------------------------------------------
104
+ // 表示
105
+ label: "",
106
+ // 表示-副情報
107
+ require: false,
108
+ requireText: "必須",
109
+ warn: "",
110
+ warnTimeOut: 300,
111
+ // ----------------------------------------------------------------------------
112
+ // 設定
113
+ size: "m",
114
+ });
115
+ // ----------------------------------------------------------------------------
116
+ // [ emit ]
117
+ type Emits = {
118
+ ref: [element: HTMLElement];
119
+ focus: [elm: HTMLElement];
120
+ blur: [elm: HTMLElement];
121
+ // ----------------------------
122
+ "update:data": [value: string];
123
+ "value-change": [after: string, before: string];
124
+ // ----------------------------
125
+ keydown: [event: KeyboardEvent];
126
+ keyup: [event: KeyboardEvent];
127
+ // ----------------------------
128
+ };
129
+ const emit = defineEmits<Emits>();
130
+ // ----------------------------------------------------------------------------
131
+ const slots = defineSlots<{
132
+ default(props: { msg: string }): any;
133
+ "right-icons"(): any;
134
+ "left-icons"(): any;
135
+ }>();
136
+ // ----------------------------------------------------------------------------
137
+ // [ getCurrentInstance ]
138
+ const uid = useId();
139
+ // ----------------------------------------------------------------------------
140
+
141
+ // [ reactive ]
142
+ interface State {
143
+ value: string;
144
+ }
145
+ const state = reactive<State>({
146
+ value: "",
147
+ });
148
+ // ----------------------------------------------------------------------------
149
+ watch(
150
+ () => props.data,
151
+ () => {
152
+ setValue(props.data);
153
+ }
154
+ );
155
+
156
+ // 更新を親コンポーネントに伝える
157
+ const updateValue = async (text: string | null) => {
158
+ const before = props.data;
159
+ let setText = "";
160
+ if (text === null) {
161
+ setText = "";
162
+ } else if (props.maxLen === 0 || text.length <= props.maxLen) {
163
+ setText = text;
164
+ } else {
165
+ const CutLen = (text: string, len: number, addWard = "") => {
166
+ if (text === null) return "";
167
+ if (len === 0) return text;
168
+ return text.substring(0, len) + addWard;
169
+ };
170
+ setText = CutLen(text, props.maxLen, "");
171
+ }
172
+ state.value = setText;
173
+ emit("update:data", setText);
174
+ await nextTick();
175
+ emit("value-change", setText, before);
176
+ };
177
+
178
+ const setValue = (text: string | null) => {
179
+ // console.log({ text });
180
+ if (text === null) {
181
+ state.value = "";
182
+ return;
183
+ }
184
+ if (props.maxLen === 0 || text.length <= props.maxLen) {
185
+ state.value = text;
186
+ } else {
187
+ // 文字数のオーバーフロー確定
188
+ // 親コンポーネントへの更新処理に移動
189
+ updateValue(text);
190
+ }
191
+ };
192
+ setValue(props.data);
193
+
194
+ // [ ref ]
195
+ const inputElement = ref();
196
+ const setRef = (elm: any) => {
197
+ inputElement.value = elm;
198
+ emit("ref", elm);
199
+ };
200
+
201
+ /**
202
+ * 強制focus
203
+ */
204
+ const elmFocus = () => {
205
+ if (props.disabled === true) return;
206
+ if (props.readonly === true) return;
207
+ inputElement.value.focus();
208
+ };
209
+
210
+ // [ focus, blur ]
211
+ interface FocusState {
212
+ isActivate: boolean;
213
+ isMmousedown: boolean;
214
+ }
215
+
216
+ const focusState = reactive<FocusState>({
217
+ isActivate: false,
218
+ isMmousedown: false,
219
+ });
220
+
221
+ /**
222
+ * コントロールのFocus判定
223
+ */
224
+ const computedActivate = computed(() => {
225
+ if (props.disabled === true) return false;
226
+ if (props.readonly === true) return false;
227
+ if (fcFocus.state.id !== uid) return false;
228
+ if (focusState.isActivate) return true;
229
+ if (focusState.isMmousedown) return true;
230
+ return false;
231
+ });
232
+
233
+ /**
234
+ * focus, blur イベント
235
+ */
236
+ watch(computedActivate, (value) => {
237
+ if (value === true) {
238
+ setTimeout(() => {
239
+ emit("focus", inputElement.value);
240
+ }, 10);
241
+ } else {
242
+ emit("blur", inputElement.value);
243
+ }
244
+ });
245
+
246
+ const onFocus = () => {
247
+ if (props.disabled === true) return;
248
+ if (props.readonly === true) return;
249
+ focusState.isActivate = true;
250
+ fcFocus.state.id = uid;
251
+ };
252
+ const onBlur = () => {
253
+ focusState.isActivate = false;
254
+ };
255
+ // ----------------------------------------------------------------------------
256
+ // 更新の有無判定
257
+ const isChangeData = computed(() => {
258
+ if (props.diff === undefined) return false;
259
+ if (props.diff === null && props.data === "") return false;
260
+ if (props.diff === "" && props.data === null) return false;
261
+ if (props.diff !== props.data) return true;
262
+ return false;
263
+ });
264
+ // tabindex
265
+ const tabindex = computed(() => {
266
+ if (props.disabled === true) return -1;
267
+ if (props.readonly === true) return -1;
268
+ return props.tabindex;
269
+ });
270
+
271
+ // ----------------------------------------------------------------------------
272
+ const lenLabelClass = computed(() => {
273
+ return [
274
+ twMerge(
275
+ "text-white bg-[#2fa412]",
276
+ props.maxLen - state.value.length < 5 ? "bg-[#fdc90d]" : "",
277
+ props.maxLen - state.value.length < 3 ? "bg-[#fd750d]" : "",
278
+ props.maxLen - state.value.length < 1 ? "bg-[#fa541d]" : ""
279
+ ),
280
+ ];
281
+ });
282
+
283
+ const dataListId = ref(`textbox-list-${uid}`);
284
+ // ----------------------------------------------------------------------------
285
+ </script>
286
+
287
+ <template>
288
+ <InputFrame
289
+ :class="props.class"
290
+ :class-header="props.classHeader"
291
+ :class-input="[props.classInput]"
292
+ :focus="computedActivate"
293
+ :focus-color="props.focusColor"
294
+ :change="isChangeData"
295
+ :change-color="props.changeColor"
296
+ :error="props.error"
297
+ :error-color="props.errorColor"
298
+ :disabled="props.disabled"
299
+ :disabled-color="props.disabledColor"
300
+ :readonly="props.readonly"
301
+ :label="props.label"
302
+ :require="props.require"
303
+ :require-text="props.requireText"
304
+ :warn="props.warn"
305
+ :warn-time-out="props.warnTimeOut"
306
+ :size="props.size"
307
+ @click="elmFocus"
308
+ >
309
+ <template v-if="slots['left-icons']" #left-icons>
310
+ <slot name="left-icons" />
311
+ </template>
312
+ <template v-if="slots['right-icons']" #right-icons>
313
+ <slot name="left-icons" />
314
+ </template>
315
+ <template v-if="props.maxLen > 0" #header-right="{ defaultClass }">
316
+ <div :class="[defaultClass, lenLabelClass]">
317
+ {{ state.value.length }} / {{ props.maxLen }}
318
+ </div>
319
+ </template>
320
+ <div
321
+ v-if="props.disabled"
322
+ class="input-d"
323
+ :style="`text-align:${props.textAlign};`"
324
+ >
325
+ {{ state.value }}
326
+ </div>
327
+ <input
328
+ v-else
329
+ :ref="(e) => setRef(e)"
330
+ v-model="state.value"
331
+ :list="props.datalist.length > 0 ? dataListId : undefined"
332
+ :type="props.type"
333
+ :autocomplete="props.autocomplete"
334
+ style="ime-mode: active"
335
+ :style="`text-align:${props.textAlign};`"
336
+ class="w-full"
337
+ :disabled="props.disabled"
338
+ :readonly="props.readonly"
339
+ :tabindex="tabindex"
340
+ :enterkeyhint="props.enterkeyhint"
341
+ :inputmode="props.inputmode"
342
+ @blur="onBlur()"
343
+ @focus="onFocus()"
344
+ @input="updateValue(state.value)"
345
+ @keydown="(e: KeyboardEvent) => emit('keydown', e)"
346
+ @keyup="(e: KeyboardEvent) => emit('keyup', e)"
347
+ @click.stop=""
348
+ />
349
+ <datalist v-if="props.datalist.length !== 0" :id="dataListId">
350
+ <template v-for="(row, index) in props.datalist" :key="index">
351
+ <option :value="row" />
352
+ </template>
353
+ </datalist>
354
+ </InputFrame>
355
+ </template>
356
+
357
+ <style scoped>
358
+ .input-d,
359
+ input {
360
+ width: 100%;
361
+ height: auto;
362
+ background-color: transparent;
363
+ -webkit-appearance: none;
364
+ -moz-appearance: none;
365
+ appearance: none;
366
+ border: 0px;
367
+ outline: none;
368
+ line-height: 1em;
369
+ color: inherit;
370
+ }
371
+
372
+ input::-webkit-calendar-picker-indicator {
373
+ opacity: 0;
374
+ }
375
+ </style>