nuxt-hs-ui 2.12.7 → 4.0.0-beta.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 (131) hide show
  1. package/README.md +202 -14
  2. package/dist/module.d.mts +3 -4
  3. package/dist/module.json +9 -6
  4. package/dist/module.mjs +125 -99
  5. package/dist/runtime/assets/flatpickr-dark.css +1 -1
  6. package/dist/runtime/assets/main.css +1 -0
  7. package/dist/runtime/assets/tabulator-custom.css +1 -1
  8. package/dist/runtime/components/form/_select/hidden-item-toggle.vue +28 -0
  9. package/dist/runtime/components/form/_select/hidden-item-toggle.vue.d.ts +10 -0
  10. package/dist/runtime/components/form/_select/item-container.vue +63 -0
  11. package/dist/runtime/components/form/_select/item-container.vue.d.ts +19 -0
  12. package/dist/runtime/components/form/_select/item-label.vue +31 -0
  13. package/dist/runtime/components/form/_select/item-label.vue.d.ts +13 -0
  14. package/dist/runtime/components/form/_select/item-row.vue +62 -0
  15. package/dist/runtime/components/form/_select/item-row.vue.d.ts +34 -0
  16. package/dist/runtime/components/form/btn-line-loading.vue +62 -81
  17. package/dist/runtime/components/form/btn-line-loading.vue.d.ts +14 -0
  18. package/dist/runtime/components/form/btn.vue +411 -494
  19. package/dist/runtime/components/form/btn.vue.d.ts +0 -0
  20. package/dist/runtime/components/form/check-box.vue +200 -315
  21. package/dist/runtime/components/form/check-box.vue.d.ts +71 -0
  22. package/dist/runtime/components/form/check-list.vue +234 -364
  23. package/dist/runtime/components/form/check-list.vue.d.ts +99 -0
  24. package/dist/runtime/components/form/combo-box.vue +340 -0
  25. package/dist/runtime/components/form/combo-box.vue.d.ts +69 -0
  26. package/dist/runtime/components/form/datepicker.vue +717 -883
  27. package/dist/runtime/components/form/datepicker.vue.d.ts +122 -0
  28. package/dist/runtime/components/form/input-frame.vue +174 -258
  29. package/dist/runtime/components/form/input-frame.vue.d.ts +88 -0
  30. package/dist/runtime/components/form/radio.vue +451 -614
  31. package/dist/runtime/components/form/radio.vue.d.ts +62 -0
  32. package/dist/runtime/components/form/select-img-icon.vue +38 -53
  33. package/dist/runtime/components/form/select-img-icon.vue.d.ts +15 -0
  34. package/dist/runtime/components/form/select.vue +733 -579
  35. package/dist/runtime/components/form/select.vue.d.ts +63 -0
  36. package/dist/runtime/components/form/text-box.vue +266 -365
  37. package/dist/runtime/components/form/text-box.vue.d.ts +105 -0
  38. package/dist/runtime/components/form/textarea.vue +338 -421
  39. package/dist/runtime/components/form/textarea.vue.d.ts +98 -0
  40. package/dist/runtime/components/form/value-box.vue +512 -641
  41. package/dist/runtime/components/form/value-box.vue.d.ts +128 -0
  42. package/dist/runtime/components/interactive/alert.vue +49 -113
  43. package/dist/runtime/components/interactive/alert.vue.d.ts +30 -0
  44. package/dist/runtime/components/interactive/block-loading.vue +91 -119
  45. package/dist/runtime/components/interactive/block-loading.vue.d.ts +22 -0
  46. package/dist/runtime/components/interactive/dialog.vue +252 -407
  47. package/dist/runtime/components/interactive/dialog.vue.d.ts +3 -0
  48. package/dist/runtime/components/interactive/modal-bg.vue +72 -82
  49. package/dist/runtime/components/interactive/modal-bg.vue.d.ts +11 -0
  50. package/dist/runtime/components/interactive/modal.vue +121 -169
  51. package/dist/runtime/components/interactive/modal.vue.d.ts +38 -0
  52. package/dist/runtime/components/interactive/toast.vue +164 -206
  53. package/dist/runtime/components/interactive/toast.vue.d.ts +3 -0
  54. package/dist/runtime/components/interactive/window-loader.vue +61 -84
  55. package/dist/runtime/components/interactive/window-loader.vue.d.ts +3 -0
  56. package/dist/runtime/components/layout/accordion-down.vue +72 -0
  57. package/dist/runtime/components/layout/accordion-down.vue.d.ts +26 -0
  58. package/dist/runtime/components/layout/accordion.vue +47 -78
  59. package/dist/runtime/components/layout/accordion.vue.d.ts +22 -0
  60. package/dist/runtime/components/layout/aspect-box.vue +29 -58
  61. package/dist/runtime/components/layout/aspect-box.vue.d.ts +29 -0
  62. package/dist/runtime/components/layout/card-item.vue +148 -193
  63. package/dist/runtime/components/layout/card-item.vue.d.ts +0 -0
  64. package/dist/runtime/components/layout/card.vue +27 -42
  65. package/dist/runtime/components/layout/card.vue.d.ts +23 -0
  66. package/dist/runtime/components/layout/container.vue +25 -40
  67. package/dist/runtime/components/layout/container.vue.d.ts +35 -0
  68. package/dist/runtime/components/layout/divider-h.vue +30 -50
  69. package/dist/runtime/components/layout/divider-h.vue.d.ts +18 -0
  70. package/dist/runtime/components/misc/breadcrumb.vue +47 -95
  71. package/dist/runtime/components/misc/breadcrumb.vue.d.ts +22 -0
  72. package/dist/runtime/components/misc/tabulator.vue +122 -190
  73. package/dist/runtime/components/misc/tabulator.vue.d.ts +28 -0
  74. package/dist/runtime/components/misc/view-name-display.vue +53 -68
  75. package/dist/runtime/components/misc/view-name-display.vue.d.ts +14 -0
  76. package/dist/runtime/components/test.vue +13 -0
  77. package/dist/runtime/components/test.vue.d.ts +3 -0
  78. package/dist/runtime/composables/test.d.ts +8 -0
  79. package/dist/runtime/composables/test.js +12 -0
  80. package/dist/runtime/composables/use-hs-dialog.d.ts +3 -20
  81. package/dist/runtime/composables/use-hs-dialog.js +3 -9
  82. package/dist/runtime/composables/use-hs-is-mobile.d.ts +8 -2
  83. package/dist/runtime/composables/use-hs-is-mobile.js +43 -25
  84. package/dist/runtime/composables/use-hs-misc.d.ts +8 -38
  85. package/dist/runtime/composables/use-hs-misc.js +9 -61
  86. package/dist/runtime/composables/use-hs-modal.js +1 -3
  87. package/dist/runtime/composables/use-hs-multi-lang.d.ts +23 -40
  88. package/dist/runtime/composables/use-hs-multi-lang.js +30 -74
  89. package/dist/runtime/composables/use-hs-scroll-lock.js +2 -1
  90. package/dist/runtime/composables/use-hs-toast.d.ts +2 -2
  91. package/dist/runtime/composables/use-hs-toast.js +12 -4
  92. package/dist/runtime/composables/use-pinia.d.ts +1 -0
  93. package/dist/runtime/composables/use-pinia.js +2 -0
  94. package/dist/runtime/plugin.d.ts +2 -0
  95. package/dist/runtime/plugin.js +4 -0
  96. package/dist/runtime/server/tsconfig.json +3 -3
  97. package/dist/runtime/types/dialog.d.ts +11 -20
  98. package/dist/runtime/types/dialog.js +2 -1
  99. package/dist/runtime/types/flatpickr/default.js +2 -23
  100. package/dist/runtime/types/flatpickr/ja.js +3 -37
  101. package/dist/runtime/types/toast.d.ts +1 -1
  102. package/dist/runtime/utils/dayjs.d.ts +8 -6
  103. package/dist/runtime/utils/dayjs.js +12 -5
  104. package/dist/runtime/utils/modal.d.ts +9 -28
  105. package/dist/runtime/utils/modal.js +7 -36
  106. package/dist/runtime/utils/multi-lang-object.d.ts +2 -2
  107. package/dist/runtime/utils/multi-lang-object.js +1 -5
  108. package/dist/runtime/utils/multi-lang.js +12 -22
  109. package/dist/runtime/utils/number.js +1 -1
  110. package/dist/runtime/utils/object.js +1 -1
  111. package/dist/runtime/utils/select-item.d.ts +3 -1
  112. package/dist/runtime/utils/stop-watch.js +6 -4
  113. package/dist/runtime/utils/string.js +4 -4
  114. package/dist/runtime/utils/tabulator.d.ts +1 -42
  115. package/dist/runtime/utils/tabulator.js +2 -99
  116. package/dist/runtime/utils/theme.d.ts +20 -20
  117. package/dist/runtime/utils/theme.js +180 -30
  118. package/dist/runtime/utils/tv.d.ts +1 -101
  119. package/dist/runtime/utils/tv.js +0 -22
  120. package/dist/types.d.mts +3 -1
  121. package/package.json +61 -118
  122. package/dist/module.cjs +0 -5
  123. package/dist/module.d.ts +0 -16
  124. package/dist/runtime/assets/vue-select.css +0 -1
  125. package/dist/runtime/components/misc/view-name-display-target.vue +0 -39
  126. package/dist/runtime/plugin/v-select.d.ts +0 -2
  127. package/dist/runtime/plugin/v-select.js +0 -5
  128. package/dist/runtime/style.css +0 -22
  129. package/dist/runtime/tailwind.css +0 -78
  130. package/dist/runtime/types/app.config.d.ts +0 -5
  131. package/dist/types.d.ts +0 -1
@@ -1,641 +1,498 @@
1
- <script setup lang="ts">
2
- /* ----------------------------------------------------------------------------
3
- // src\runtime\components\form\value-box.vue
4
- // ----------------------------------------------------------------------------
5
- // ValueBox
6
- // ValueBoxValueBox
7
- ----------------------------------------------------------------------------- */
8
-
9
- // [ node_modules ]
10
- import BigNumber from "bignumber.js";
11
- // [ NUXT ]
12
- import {
13
- reactive,
14
- ref,
15
- watch,
16
- computed,
17
- useId,
18
- onMounted,
19
- nextTick,
20
- } from "#imports";
21
- // [ utils ]
22
- import type { ClassType } from "../../utils/class-style";
23
- import { InsertComma } from "../../utils/number";
24
- import { FloatNullable } from "../../utils/float";
25
- import type { MultiLang } from "../../utils/multi-lang";
26
- // [ composables ]
27
- import { useHsFocus } from "../../composables/use-hs-focus";
28
- import { useHsToast } from "../../composables/use-hs-toast";
29
- import { useHsMisc } from "../../composables/use-hs-misc";
30
- import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
31
- // [ Components ]
32
- import InputFrame from "./input-frame.vue";
33
- // ----------------------------------------------------------------------------
34
- // [ com > lib > * ]
35
- // import { FloatNullable } from '~/com/lib/float';
36
- // ----------------------------------------------------------------------------
37
- const hsFocus = useHsFocus();
38
- const hsMisc = useHsMisc();
39
- const Toast = useHsToast();
40
- const multiLang = useHsMultiLang();
41
- const gt = multiLang.gt;
42
-
43
- // ----------------------------------------------------------------------------
44
- // [ Props ]
45
- type Props = {
46
- // ----------------------------------------------------------------------------
47
- // Input 種類別
48
- nullable?: boolean;
49
- unit?: string;
50
- step?: number;
51
- min?: number;
52
- max?: number;
53
- digits?: number;
54
- isShowBtnControl?: boolean;
55
- comma?: string;
56
- enterkeyhint?: string;
57
- // ----------------------------------------------------------------------------
58
- data: number | null;
59
- diff?: number | null | undefined;
60
- tabindex?: string | undefined;
61
- // ----------------------------------------------------------------------------
62
- class?: ClassType;
63
- classHeader?: ClassType;
64
- classInput?: ClassType;
65
- // ----------------------------------------------------------------------------
66
- // 状態
67
- // focus?: boolean;
68
- focusColor?: string;
69
- // change?: boolean;
70
- changeColor?: string;
71
- error?: boolean;
72
- errorColor?: string;
73
- disabled?: boolean;
74
- disabledColor?: string;
75
- readonly?: boolean;
76
- headerless?: boolean;
77
- // ----------------------------------------------------------------------------
78
- // 表示
79
- label?: MultiLang;
80
- // 表示-副情報
81
- require?: boolean;
82
- requireText?: MultiLang;
83
- warn?: string;
84
- warnTimeOut?: number;
85
- // ----------------------------------------------------------------------------
86
- // 設定
87
- size?: "s" | "m" | "l";
88
- // ----------------------------------------------------------------------------
89
- uiText?: {
90
- validError: {
91
- title: MultiLang;
92
- nullValue: MultiLang;
93
- minValue: MultiLang;
94
- maxValue: MultiLang;
95
- };
96
- };
97
- };
98
- const props = withDefaults(defineProps<Props>(), {
99
- // ----------------------------------------------------------------------------
100
- // Input 種類別
101
- nullable: true,
102
- unit: "",
103
- step: 1,
104
- min: -9999999999,
105
- max: 9999999999,
106
- digits: 0,
107
- isShowBtnControl: false,
108
- comma: ",",
109
- enterkeyhint: undefined,
110
-
111
- // ----------------------------------------------------------------------------
112
- diff: undefined,
113
- tabindex: undefined,
114
- // ----------------------------------------------------------------------------
115
- class: "",
116
- classHeader: "",
117
- classInput: "",
118
- // ----------------------------------------------------------------------------
119
- // 状態
120
- // focus: false,
121
- focusColor: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]",
122
- // change: false,
123
- changeColor: "shadow-[inset_0px_0px_1px_2px_#fd9831be]",
124
- error: false,
125
- errorColor: "shadow-[inset_0px_0px_1px_2px_#d80000dc]",
126
- disabled: false,
127
- disabledColor: "",
128
- readonly: false,
129
- headerless: false,
130
- // ----------------------------------------------------------------------------
131
- // 表示
132
- label: "",
133
- // 表示-副情報
134
- require: false,
135
- requireText: () => ({ ja: "必須", en: "Required" }),
136
- warn: "",
137
- warnTimeOut: 3000,
138
- // ----------------------------------------------------------------------------
139
- // 設定
140
- size: "m",
141
- // ----------------------------------------------------------------------------
142
- uiText: () => {
143
- return {
144
- validError: {
145
- title: { ja: "入力値の警告", en: "Input Value Warning" },
146
- nullValue: {
147
- ja: "数値以外は許可されていません。",
148
- en: "Non-numeric values are not allowed.",
149
- },
150
- minValue: {
151
- ja: "[{value}]以下の数値は入力できません",
152
- en: "You cannot enter a number below {value}.",
153
- },
154
- maxValue: {
155
- ja: "[{value}]以上の数値は入力できません",
156
- en: "You cannot enter a number greater than {value}.",
157
- },
158
- },
159
- };
160
- },
161
- });
162
-
163
- // ----------------------------------------------------------------------------
164
- // [ emit ]
165
- type Emits = {
166
- ref: [element: HTMLElement];
167
- focus: [elm: HTMLElement];
168
- blur: [elm: HTMLElement];
169
- // ----------------------------
170
- "update:data": [value: number | null];
171
- "value-change": [after: number | null, before: number | null];
172
- // ----------------------------
173
- keydown: [event: KeyboardEvent];
174
- keyup: [event: KeyboardEvent];
175
- // ----------------------------
176
- };
177
- const emit = defineEmits<Emits>();
178
- // ----------------------------------------------------------------------------
179
- const slots = defineSlots<{
180
- default(props: { msg: string }): any;
181
- overlay?(): any;
182
- "right-icons"?(): any;
183
- "left-icons"?(): any;
184
- }>();
185
- // ----------------------------------------------------------------------------
186
- // [ getCurrentInstance ]
187
- const uid = useId();
188
-
189
- // ----------------------------------------------------------------------------
190
- // [ reactive ]
191
- interface State {
192
- value: string;
193
- inputMode: string;
194
- }
195
- const state = reactive<State>({
196
- value: "",
197
- inputMode: "text",
198
- });
199
- // ----------------------------------------------------------------------------
200
- onMounted(() => {
201
- state.inputMode = hsMisc.state.isMobile === true ? "numeric" : "text";
202
- });
203
- watch(
204
- () => hsMisc.state.isMobile,
205
- () => {
206
- state.inputMode = hsMisc.state.isMobile === true ? "numeric" : "text";
207
- }
208
- );
209
-
210
- // ----------------------------------------------------------------------------
211
- /**
212
- * 表示(カンマ表示)
213
- */
214
- const displayText = computed(() => {
215
- if (props.data === null) return "";
216
- return InsertComma(props.data, props.digits, "0", props.comma);
217
- });
218
-
219
- /**
220
- * 値が適正かチェックする
221
- */
222
- const validCheck = (
223
- val: number | null
224
- ): { result: boolean; message: string; value: number | null } => {
225
- if (val === null) {
226
- if (props.nullable === false) {
227
- return {
228
- result: false,
229
- value: 0,
230
- message: gt(props.uiText.validError.nullValue),
231
- };
232
- } else {
233
- return { result: true, value: null, message: "" };
234
- }
235
- }
236
- if (val < props.min) {
237
- return {
238
- result: false,
239
- value: props.min,
240
- message: gt(props.uiText.validError.minValue).replace(
241
- /\{value\}/g,
242
- String(props.min)
243
- ),
244
- // `[${props.min}]以下の数値は入力できません`,
245
- };
246
- } else if (props.max < val) {
247
- return {
248
- result: false,
249
- value: props.max,
250
- message: gt(props.uiText.validError.maxValue).replace(
251
- /\{value\}/g,
252
- String(props.max)
253
- ),
254
- // message: `[${props.max}]以上の数値は入力できません`,
255
- };
256
- }
257
- return { result: true, value: val, message: "" };
258
- };
259
-
260
- /**
261
- * 更新を親コンポーネントに伝える
262
- * @param val
263
- */
264
- const updateData = async (val: number | null, f = true) => {
265
- // console.log('updateData', val);
266
- const before = props.data;
267
- let updateValue: number | null = null;
268
- if (val !== null) {
269
- updateValue = val;
270
- } else if (props.nullable === false) {
271
- updateValue = 0;
272
- } else {
273
- updateValue = null;
274
- }
275
- emit("update:data", updateValue);
276
- await nextTick();
277
- if (f) emit("value-change", updateValue, before);
278
- };
279
-
280
- /**
281
- * 要素のイベント stepValue
282
- */
283
- const stepValue = (isUp: boolean) => {
284
- if (props.disabled === true) return;
285
- if (props.readonly === true) return;
286
- let nextValue = 0;
287
- const inputValue = FloatNullable(props.data, props.digits);
288
- const step = isUp === true ? props.step : props.step * -1;
289
- if (inputValue === null) {
290
- nextValue = step;
291
- if (isUp === true) {
292
- if (nextValue < props.min || props.max < nextValue) {
293
- nextValue = props.max;
294
- }
295
- } else if (nextValue < props.min || props.max < nextValue) {
296
- nextValue = props.min;
297
- }
298
- } else if (props.digits > 0 || step < 1) {
299
- if (isUp === true) {
300
- nextValue = BigNumber(inputValue).plus(BigNumber(props.step)).toNumber();
301
- } else {
302
- nextValue = BigNumber(inputValue).minus(BigNumber(props.step)).toNumber();
303
- }
304
- } else {
305
- nextValue = inputValue + step;
306
- }
307
- const validCheckResult = validCheck(nextValue);
308
- // console.log({ validCheckResult });
309
- if (validCheckResult.result === true) {
310
- updateData(validCheckResult.value);
311
- // } else {
312
- // emit('warn', validCheckResult.message, '入力値の警告', props.toastTime);
313
- }
314
- };
315
-
316
- const isArrowUp = computed(() => {
317
- if (props.data === null) return true;
318
- if (props.data + props.step <= props.max) return true;
319
- return false;
320
- });
321
- const isArrowDown = computed(() => {
322
- if (props.data === null) return true;
323
- if (props.min <= props.data - props.step) return true;
324
- return false;
325
- });
326
-
327
- /**
328
- * 全角数値を半角数値へ変換する
329
- */
330
- const hankakuToZenkaku = (str: string) => {
331
- return (str + "").replace(/[0-9]/g, (s) => {
332
- return String.fromCharCode(s.charCodeAt(0) - 0xfee0);
333
- });
334
- };
335
-
336
- /**
337
- * 入力値の変更を起点としてチェック
338
- */
339
- const checkValueByInput = () => {
340
- const inputText = hankakuToZenkaku(state.value)
341
- .replace(/ー/g, "-")
342
- .replace(/[^(0-9)|.\-+]+/g, "");
343
- const inputValue = FloatNullable(inputText, props.digits);
344
- const validCheckResult = validCheck(inputValue);
345
-
346
- // console.log(uid, { moto: state.value, inputText, inputValue, validCheckResult });
347
- if (validCheckResult.value === null) {
348
- state.value = "";
349
- } else {
350
- state.value = validCheckResult.value.toFixed(props.digits);
351
- }
352
- if (props.data !== validCheckResult.value) {
353
- updateData(validCheckResult.value);
354
- }
355
- if (validCheckResult.result === false) {
356
- Toast.Warning(
357
- validCheckResult.message,
358
- props.uiText.validError.title,
359
- props.warnTimeOut
360
- );
361
- }
362
- };
363
-
364
- /**
365
- * prop.data からのデータ入力
366
- */
367
- const setValueByPropsData = () => {
368
- const val = FloatNullable(props.data, props.digits);
369
- if (props.data !== val) {
370
- // 小数点許容確認とデータ修正
371
- updateData(val, false);
372
- return;
373
- }
374
- const validCheckResult = validCheck(val);
375
- if (validCheckResult.result === true) {
376
- if (validCheckResult.value === null) {
377
- state.value = "";
378
- } else {
379
- state.value = validCheckResult.value.toFixed(props.digits);
380
- }
381
- } else {
382
- updateData(validCheckResult.value, false);
383
- Toast.Warning(
384
- validCheckResult.message,
385
- props.uiText.validError.title,
386
- props.warnTimeOut
387
- );
388
- }
389
- };
390
-
391
- /**
392
- * 要素のイベント keydown
393
- */
394
- const keydown = (e: KeyboardEvent) => {
395
- emit("keydown", e);
396
- if (
397
- !props.isShowBtnControl &&
398
- (e.key === "ArrowUp" || e.key === "ArrowDown")
399
- ) {
400
- e.preventDefault();
401
- return;
402
- }
403
- if (e.key === "ArrowUp") {
404
- stepValue(true);
405
- } else if (e.key === "ArrowDown") {
406
- stepValue(false);
407
- }
408
- };
409
-
410
- /**
411
- * 要素のイベント keydown
412
- */
413
- const onWheel = (e: WheelEvent) => {
414
- if (!props.isShowBtnControl) return;
415
- if (props.disabled === true) return;
416
- if (props.readonly === true) return;
417
- if (e.deltaY < 0) {
418
- stepValue(true);
419
- } else if (e.deltaY > 0) {
420
- stepValue(false);
421
- }
422
- e.preventDefault();
423
- };
424
-
425
- // [ ref ]
426
- const inputElement = ref();
427
- const setRef = (elm: any) => {
428
- inputElement.value = elm;
429
- emit("ref", elm as HTMLInputElement);
430
- };
431
-
432
- /**
433
- * 強制focus
434
- */
435
- const elmFocus = () => {
436
- inputElement.value.focus();
437
- };
438
-
439
- // [ focus, blur ]
440
-
441
- interface FocusState {
442
- isActivate: boolean;
443
- isMmousedown: boolean;
444
- }
445
-
446
- const focusState = reactive<FocusState>({
447
- isActivate: false,
448
- isMmousedown: false,
449
- });
450
-
451
- /**
452
- * コントロールのFocus判定
453
- */
454
- const computedActivate = computed(() => {
455
- if (hsFocus.state.id !== uid) return false;
456
- if (props.disabled === true) return false;
457
- if (props.readonly === true) return false;
458
- if (focusState.isActivate) return true;
459
- if (focusState.isMmousedown) return true;
460
- return false;
461
- });
462
-
463
- /**
464
- * focus, blur イベント
465
- */
466
- watch(computedActivate, (value) => {
467
- if (value === true) {
468
- // クリックでの遷移の場合に
469
- // 一つ前のコントロールのblurイベントよりも早くfocusが発生しないようにする対策で10ミリ秒処理をずらす
470
- setTimeout(() => {
471
- emit("focus", inputElement.value);
472
- }, 10);
473
- } else {
474
- emit("blur", inputElement.value);
475
- }
476
- });
477
-
478
- const zeroFlag = ref(false);
479
- const onFocus = () => {
480
- zeroFlag.value = false;
481
- if (props.disabled === true) return;
482
- if (props.readonly === true) return;
483
- hsFocus.state.id = uid;
484
- focusState.isActivate = true;
485
- if (state.inputMode === "text") {
486
- // inputElement.value.select();
487
- } else if (state.value === "0") {
488
- zeroFlag.value = true;
489
- state.value = "";
490
- }
491
- };
492
- // const instance = getCurrentInstance(); // コンポーネント固有のUIDを取得する
493
- // const uid = instance != null ? String(instance.uid) : '';
494
- // const id = useId();
495
- const onBlur = () => {
496
- try {
497
- if (props.disabled === true) return;
498
- if (props.readonly === true) return;
499
- if (zeroFlag.value && state.value === "") {
500
- state.value = "0";
501
- }
502
- focusState.isActivate = false;
503
- focusState.isMmousedown = false;
504
- // await Sleep(50);
505
- checkValueByInput();
506
- } catch (err) {
507
- console.error(err);
508
- } finally {
509
- zeroFlag.value = true;
510
- }
511
- };
512
-
513
- // ----------------------------------------------------------------------------
514
- // 更新の有無判定
515
- const isChangeData = computed(() => {
516
- if (props.diff === undefined) return false;
517
- if (props.diff !== props.data) return true;
518
- return false;
519
- });
520
-
521
- // tabindex
522
- const tabindex = computed(() => {
523
- if (props.disabled === true) return -1;
524
- return props.tabindex;
525
- });
526
-
527
- // [ locked ]
528
- const locked = computed(() => {
529
- if (props.disabled === true) return true;
530
- if (props.readonly === true) return true;
531
- return false;
532
- });
533
- // ----------------------------------------------------------------------------
534
-
535
- onMounted(() => {
536
- setValueByPropsData();
537
- });
538
-
539
- watch(
540
- () => props.data,
541
- () => {
542
- setValueByPropsData();
543
- }
544
- );
545
- // ----------------------------------------------------------------------------
546
- </script>
547
-
548
- <template>
549
- <InputFrame
550
- :class="props.class"
551
- :class-header="props.classHeader"
552
- :class-input="[props.classInput]"
553
- :focus="computedActivate"
554
- :focus-color="props.focusColor"
555
- :change="isChangeData"
556
- :change-color="props.changeColor"
557
- :error="props.error"
558
- :error-color="props.errorColor"
559
- :disabled="props.disabled"
560
- :disabled-color="props.disabledColor"
561
- :readonly="props.readonly"
562
- :label="props.label"
563
- :require="props.require"
564
- :require-text="props.requireText"
565
- :warn="props.warn"
566
- :warn-time-out="props.warnTimeOut"
567
- :size="props.size"
568
- :headerless="props.headerless"
569
- @click="elmFocus"
570
- >
571
- <template v-if="slots['left-icons']" #left-icons>
572
- <slot name="left-icons" :disabled="disabled" />
573
- </template>
574
- <template v-if="slots.overlay" #overlay>
575
- <slot name="overlay"></slot>
576
- </template>
577
- <div class="flex items-end justify-end">
578
- <div class="flex-1">
579
- <input
580
- :ref="(e) => setRef(e)"
581
- v-model="state.value"
582
- type="text"
583
- :inputmode="hsMisc.state.isMobile ? 'numeric' : 'text'"
584
- class="pe-[4px] w-full"
585
- :class="[
586
- //
587
- computedActivate ? 'opacity-100' : 'opacity-0',
588
- // { isShow: computedActivate },
589
- ]"
590
- maxlength="20"
591
- :enterkeyhint="props.enterkeyhint"
592
- :disabled="props.disabled"
593
- :readonly="props.readonly"
594
- :tabindex="tabindex"
595
- @wheel="onWheel"
596
- @keydown="keydown"
597
- @keyup="(e) => emit('keyup', e)"
598
- @blur="onBlur()"
599
- @focus="onFocus()"
600
- />
601
- <input
602
- type="text"
603
- class="displayText pe-[4px] w-full"
604
- :class="[
605
- //
606
- computedActivate ? 'opacity-0' : 'opacity-100',
607
- { readonly: props.readonly },
608
- ]"
609
- :value="displayText"
610
- :disabled="props.disabled"
611
- :tabindex="-1"
612
- readonly
613
- />
614
- </div>
615
- <div v-if="props.unit.length !== 0" class="flex-none unit">
616
- {{ props.unit }}
617
- </div>
618
- </div>
619
- <template #right-icons>
620
- <div v-if="props.isShowBtnControl === true" class="u-d-icon" @click.stop>
621
- <div
622
- :class="[{ activate: isArrowUp && !locked }]"
623
- @click="stepValue(true)"
624
- >
625
- <i class="fas fa-caret-up"></i>
626
- </div>
627
- <div
628
- :class="[{ activate: isArrowDown && !locked }]"
629
- @click="stepValue(false)"
630
- >
631
- <i class="fas fa-caret-down"></i>
632
- </div>
633
- </div>
634
- <slot name="right-icons" :disabled="disabled" />
635
- </template>
636
- </InputFrame>
637
- </template>
638
-
1
+ <script setup>
2
+ import BigNumber from "bignumber.js";
3
+ import { reactive, ref, watch, computed, useId, onMounted, nextTick } from "#imports";
4
+ import { InsertComma } from "../../utils/number";
5
+ import { FloatNullable } from "../../utils/float";
6
+ import { useHsFocus } from "../../composables/use-hs-focus";
7
+ import { useHsToast } from "../../composables/use-hs-toast";
8
+ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
9
+ import { useHsIsMobile } from "../../composables/use-hs-is-mobile";
10
+ import { useHsPinia } from "../../composables/use-pinia";
11
+ import { useHsMisc } from "../../composables/use-hs-misc";
12
+ import InputFrame from "./input-frame.vue";
13
+ const hsMisc = useHsMisc(useHsPinia());
14
+ const hsIsMobile = useHsIsMobile(useHsPinia());
15
+ const hsFocus = useHsFocus(useHsPinia());
16
+ const Toast = useHsToast(useHsPinia());
17
+ const multiLang = useHsMultiLang(useHsPinia());
18
+ const tx = multiLang.tx;
19
+ const gt = multiLang.gt;
20
+ const props = defineProps({
21
+ nullable: { type: Boolean, required: false, default: true },
22
+ unit: { type: String, required: false, default: "" },
23
+ step: { type: Number, required: false, default: 1 },
24
+ min: { type: Number, required: false, default: -9999999999 },
25
+ max: { type: Number, required: false, default: 9999999999 },
26
+ digits: { type: Number, required: false, default: 0 },
27
+ digitsAuto: { type: Boolean, required: false, default: false },
28
+ isShowBtnControl: { type: Boolean, required: false, default: false },
29
+ comma: { type: String, required: false, default: "," },
30
+ enterkeyhint: { type: null, required: false, default: void 0 },
31
+ inputSize: { type: [String, Number], required: false, default: 10 },
32
+ placeholder: { type: [String, Object], required: false, default: "" },
33
+ textAlign: { type: String, required: false, default: "right" },
34
+ digitsPointSmall: { type: Boolean, required: false, default: false },
35
+ data: { type: [Number, null], required: true },
36
+ diff: { type: null, required: false, default: void 0 },
37
+ tabindex: { type: null, required: false, default: void 0 },
38
+ class: { type: [String, Object, Array], required: false, default: "" },
39
+ classHeader: { type: [String, Object, Array], required: false, default: "" },
40
+ classInput: { type: [String, Object, Array], required: false, default: "" },
41
+ focusColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]" },
42
+ changeColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#fd9831be]" },
43
+ error: { type: Boolean, required: false, default: false },
44
+ errorColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#d80000dc]" },
45
+ disabled: { type: Boolean, required: false, default: false },
46
+ disabledColor: { type: String, required: false, default: "" },
47
+ readonly: { type: Boolean, required: false, default: false },
48
+ headerless: { type: Boolean, required: false, default: false },
49
+ label: { type: [String, Object], required: false, default: "" },
50
+ require: { type: Boolean, required: false, default: false },
51
+ requireText: { type: [String, Object], required: false, default: () => ({ ja: "\u5FC5\u9808", en: "Required" }) },
52
+ warn: { type: String, required: false, default: "" },
53
+ warnTimeOut: { type: Number, required: false, default: 3e3 },
54
+ size: { type: String, required: false, default: "m" },
55
+ uiText: { type: Object, required: false, default: () => {
56
+ return {
57
+ validError: {
58
+ title: { ja: "\u5165\u529B\u5024\u306E\u8B66\u544A", en: "Input Value Warning" },
59
+ nullValue: {
60
+ ja: "\u6570\u5024\u4EE5\u5916\u306F\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",
61
+ en: "Non-numeric values are not allowed."
62
+ },
63
+ minValue: {
64
+ ja: "[{value}]\u4EE5\u4E0B\u306E\u6570\u5024\u306F\u5165\u529B\u3067\u304D\u307E\u305B\u3093",
65
+ en: "You cannot enter a number below {value}."
66
+ },
67
+ maxValue: {
68
+ ja: "[{value}]\u4EE5\u4E0A\u306E\u6570\u5024\u306F\u5165\u529B\u3067\u304D\u307E\u305B\u3093",
69
+ en: "You cannot enter a number greater than {value}."
70
+ }
71
+ }
72
+ };
73
+ } }
74
+ });
75
+ const emit = defineEmits(["ref", "focus", "blur", "update:data", "value-change", "keydown", "keyup"]);
76
+ const slots = defineSlots();
77
+ const uid = useId();
78
+ const state = reactive({
79
+ value: "",
80
+ inputMode: "text"
81
+ });
82
+ onMounted(() => {
83
+ state.inputMode = hsIsMobile.isMobile === true ? "numeric" : "text";
84
+ });
85
+ watch(
86
+ () => hsIsMobile.isMobile,
87
+ () => {
88
+ state.inputMode = hsIsMobile.isMobile === true ? "numeric" : "text";
89
+ }
90
+ );
91
+ const convertText = (str) => {
92
+ if (props.digitsAuto) {
93
+ if (/\./.test(str)) {
94
+ return str.replace(/0*$/g, "").replace(/\.$/g, "");
95
+ }
96
+ return str;
97
+ } else {
98
+ return str;
99
+ }
100
+ };
101
+ const displayText = computed(() => {
102
+ if (props.data === null) return "";
103
+ const ret = InsertComma(props.data, props.digits, "0", props.comma);
104
+ return convertText(ret);
105
+ });
106
+ const displayDiffText = computed(() => {
107
+ if (!props.diff) return "";
108
+ const ret = InsertComma(props.diff, props.digits, "0", props.comma);
109
+ return convertText(ret);
110
+ });
111
+ const validCheck = (val) => {
112
+ if (val === null) {
113
+ if (props.nullable === false) {
114
+ return {
115
+ result: false,
116
+ value: 0,
117
+ message: gt(props.uiText.validError.nullValue)
118
+ };
119
+ } else {
120
+ return { result: true, value: null, message: "" };
121
+ }
122
+ }
123
+ if (val < props.min) {
124
+ return {
125
+ result: false,
126
+ value: props.min,
127
+ message: gt(props.uiText.validError.minValue).replace(/\{value\}/g, String(props.min))
128
+ // `[${props.min}]以下の数値は入力できません`,
129
+ };
130
+ } else if (props.max < val) {
131
+ return {
132
+ result: false,
133
+ value: props.max,
134
+ message: gt(props.uiText.validError.maxValue).replace(/\{value\}/g, String(props.max))
135
+ // message: `[${props.max}]以上の数値は入力できません`,
136
+ };
137
+ }
138
+ return { result: true, value: val, message: "" };
139
+ };
140
+ const updateData = async (val, f = true) => {
141
+ const before = props.data;
142
+ let updateValue = null;
143
+ if (val !== null) {
144
+ updateValue = val;
145
+ } else if (props.nullable === false) {
146
+ updateValue = 0;
147
+ } else {
148
+ updateValue = null;
149
+ }
150
+ emit("update:data", updateValue);
151
+ await nextTick();
152
+ if (f) emit("value-change", updateValue, before);
153
+ await nextTick();
154
+ if (props.data !== val) {
155
+ setValueByPropsData();
156
+ }
157
+ };
158
+ const stepValue = (isUp) => {
159
+ if (props.disabled === true) return;
160
+ if (props.readonly === true) return;
161
+ let nextValue = 0;
162
+ const inputValue = FloatNullable(props.data, props.digits);
163
+ const step = isUp === true ? props.step : props.step * -1;
164
+ if (inputValue === null) {
165
+ nextValue = step;
166
+ if (isUp === true) {
167
+ if (nextValue < props.min || props.max < nextValue) {
168
+ nextValue = props.max;
169
+ }
170
+ } else if (nextValue < props.min || props.max < nextValue) {
171
+ nextValue = props.min;
172
+ }
173
+ } else if (props.digits > 0 || step < 1) {
174
+ if (isUp === true) {
175
+ nextValue = BigNumber(inputValue).plus(BigNumber(props.step)).toNumber();
176
+ } else {
177
+ nextValue = BigNumber(inputValue).minus(BigNumber(props.step)).toNumber();
178
+ }
179
+ } else {
180
+ nextValue = inputValue + step;
181
+ }
182
+ const validCheckResult = validCheck(nextValue);
183
+ if (validCheckResult.result === true) {
184
+ updateData(validCheckResult.value);
185
+ }
186
+ };
187
+ const isArrowUp = computed(() => {
188
+ if (props.data === null) return true;
189
+ if (props.data + props.step <= props.max) return true;
190
+ return false;
191
+ });
192
+ const isArrowDown = computed(() => {
193
+ if (props.data === null) return true;
194
+ if (props.min <= props.data - props.step) return true;
195
+ return false;
196
+ });
197
+ const hankakuToZenkaku = (str) => {
198
+ return (str + "").replace(/[0-9]/g, (s) => {
199
+ return String.fromCharCode(s.charCodeAt(0) - 65248);
200
+ });
201
+ };
202
+ const checkValueByInput = () => {
203
+ const inputText = hankakuToZenkaku(state.value).replace(/[ー―-–—]/g, "-").replace(/[^(0-9)|.\-+]+/g, "");
204
+ const inputValue = FloatNullable(inputText, props.digits);
205
+ const validCheckResult = validCheck(inputValue);
206
+ if (validCheckResult.value === null) {
207
+ state.value = "";
208
+ } else {
209
+ state.value = convertText(validCheckResult.value.toFixed(props.digits));
210
+ }
211
+ if (props.data !== validCheckResult.value) {
212
+ updateData(validCheckResult.value);
213
+ }
214
+ if (validCheckResult.result === false) {
215
+ Toast.Warning(validCheckResult.message, props.uiText.validError.title, props.warnTimeOut);
216
+ }
217
+ };
218
+ const setValueByPropsData = () => {
219
+ const val = FloatNullable(props.data, props.digits);
220
+ if (props.data !== val) {
221
+ updateData(val, false);
222
+ return;
223
+ }
224
+ const validCheckResult = validCheck(val);
225
+ if (validCheckResult.result === true) {
226
+ if (validCheckResult.value === null) {
227
+ state.value = "";
228
+ } else {
229
+ state.value = convertText(validCheckResult.value.toFixed(props.digits));
230
+ }
231
+ } else {
232
+ updateData(validCheckResult.value, false);
233
+ Toast.Warning(validCheckResult.message, props.uiText.validError.title, props.warnTimeOut);
234
+ }
235
+ };
236
+ const keydown = (e) => {
237
+ emit("keydown", e);
238
+ if (!props.isShowBtnControl && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
239
+ e.preventDefault();
240
+ return;
241
+ }
242
+ if (e.key === "ArrowUp") {
243
+ stepValue(true);
244
+ } else if (e.key === "ArrowDown") {
245
+ stepValue(false);
246
+ }
247
+ };
248
+ const onWheel = (e) => {
249
+ if (!props.isShowBtnControl) return;
250
+ if (props.disabled === true) return;
251
+ if (props.readonly === true) return;
252
+ if (e.deltaY < 0) {
253
+ stepValue(true);
254
+ } else if (e.deltaY > 0) {
255
+ stepValue(false);
256
+ }
257
+ e.preventDefault();
258
+ };
259
+ const inputElement = ref();
260
+ defineExpose({ el: inputElement });
261
+ const setRef = (elm) => {
262
+ inputElement.value = elm;
263
+ emit("ref", elm);
264
+ };
265
+ const focusState = reactive({
266
+ isActivate: false,
267
+ isMmousedown: false
268
+ });
269
+ const computedActivate = computed(() => {
270
+ if (hsFocus.state.id !== uid) return false;
271
+ if (props.disabled === true) return false;
272
+ if (props.readonly === true) return false;
273
+ if (focusState.isActivate) return true;
274
+ if (focusState.isMmousedown) return true;
275
+ return false;
276
+ });
277
+ watch(computedActivate, (value) => {
278
+ if (value === true) {
279
+ setTimeout(() => {
280
+ emit("focus", inputElement.value);
281
+ }, 10);
282
+ } else {
283
+ emit("blur", inputElement.value);
284
+ }
285
+ });
286
+ const zeroFlag = ref(false);
287
+ const onFocus = () => {
288
+ zeroFlag.value = false;
289
+ if (props.disabled === true) return;
290
+ if (props.readonly === true) return;
291
+ if (hsFocus.state.id !== uid) {
292
+ hsFocus.state.id = uid;
293
+ }
294
+ focusState.isActivate = true;
295
+ if (state.inputMode === "text") {
296
+ } else if (state.value === "0") {
297
+ zeroFlag.value = true;
298
+ state.value = "";
299
+ }
300
+ };
301
+ const onBlur = () => {
302
+ try {
303
+ if (props.disabled === true) return;
304
+ if (props.readonly === true) return;
305
+ if (zeroFlag.value && state.value === "") {
306
+ state.value = "0";
307
+ }
308
+ focusState.isActivate = false;
309
+ focusState.isMmousedown = false;
310
+ checkValueByInput();
311
+ } catch (err) {
312
+ console.error(err);
313
+ } finally {
314
+ zeroFlag.value = true;
315
+ }
316
+ };
317
+ const isChangeData = computed(() => {
318
+ if (props.diff === void 0) return false;
319
+ if (props.diff !== props.data) return true;
320
+ return false;
321
+ });
322
+ const tabindex = computed(() => {
323
+ if (props.disabled === true) return -1;
324
+ return props.tabindex;
325
+ });
326
+ const locked = computed(() => {
327
+ if (props.disabled === true) return true;
328
+ if (props.readonly === true) return true;
329
+ return false;
330
+ });
331
+ onMounted(() => {
332
+ setValueByPropsData();
333
+ });
334
+ watch(
335
+ () => props.data,
336
+ () => {
337
+ setValueByPropsData();
338
+ }
339
+ );
340
+ const placeholder = computed(() => tx(props.placeholder).value);
341
+ const displayTextArr = computed(() => {
342
+ const text = displayText.value;
343
+ if (props.digits === 0) return [text, ""];
344
+ if (!text) return [text, ""];
345
+ if (!/\./.test(text)) return [text, ""];
346
+ const top = text.replace(/(\.\d*)$/, "");
347
+ const bottom = text.replace(/.*(\.\d*)$/, "$1");
348
+ return [top ?? "", bottom ?? ""];
349
+ });
350
+ const pHolder = computed(() => {
351
+ const text = placeholder.value;
352
+ if (props.digits === 0) return [text, ""];
353
+ if (!text) return [text, ""];
354
+ if (!/\./.test(text)) return [text, ""];
355
+ const top = text.replace(/(\.\d*)$/, "");
356
+ const bottom = text.replace(/.*(\.\d*)$/, "$1");
357
+ return [top ?? "", bottom ?? ""];
358
+ });
359
+ </script>
360
+
361
+ <template>
362
+ <InputFrame
363
+ :class="props.class"
364
+ :class-header="props.classHeader"
365
+ :class-input="[props.classInput]"
366
+ :focus="computedActivate"
367
+ :focus-color="props.focusColor"
368
+ :change="isChangeData"
369
+ :change-color="props.changeColor"
370
+ :error="props.error"
371
+ :error-color="props.errorColor"
372
+ :disabled="props.disabled"
373
+ :disabled-color="props.disabledColor"
374
+ :readonly="props.readonly"
375
+ :label="props.label"
376
+ :require="props.require"
377
+ :require-text="props.requireText"
378
+ :warn="props.warn"
379
+ :warn-time-out="props.warnTimeOut"
380
+ :size="props.size"
381
+ :headerless="props.headerless"
382
+ >
383
+ <template #overlay="{ focus, change }">
384
+ <div
385
+ v-if="props.diff !== void 0 && change"
386
+ class="absolute inset-0 bg-red/30 transition-opacity flex items-center p-1 bg-dark/20"
387
+ :class="!focus && hsMisc.capsLockState ? 'opacity-100' : 'opacity-0 pointer-events-none select-none'"
388
+ >
389
+ <div class="flex">
390
+ <Btn
391
+ variant="outlined"
392
+ theme="error"
393
+ tabindex="-1"
394
+ size="xs"
395
+ class="bg-white flex-none"
396
+ @click="updateData(props.diff)"
397
+ >
398
+ <i class="fa-solid fa-rotate-right"></i>
399
+ </Btn>
400
+ <div v-if="props.diff" class="px-1 truncate bg-white mx-1 flex items-center">{{ displayDiffText }}</div>
401
+ </div>
402
+ </div>
403
+ <template v-if="slots.overlay">
404
+ <slot name="overlay" :focus="focus" :change="change"></slot>
405
+ </template>
406
+ </template>
407
+ <template v-if="slots['left-icons']" #left-icons>
408
+ <slot name="left-icons" :disabled="disabled" />
409
+ </template>
410
+ <template #right-icons>
411
+ <div v-if="props.isShowBtnControl === true" class="u-d-icon" @click.stop>
412
+ <div :class="[{ activate: isArrowUp && !locked }]" @click="stepValue(true)">
413
+ <i class="fas fa-caret-up"></i>
414
+ </div>
415
+ <div :class="[{ activate: isArrowDown && !locked }]" @click="stepValue(false)">
416
+ <i class="fas fa-caret-down"></i>
417
+ </div>
418
+ </div>
419
+ <slot name="right-icons" :disabled="disabled" />
420
+ </template>
421
+ <template v-if="slots['label-prepend']" #label-prepend>
422
+ <slot name="label-prepend" />
423
+ </template>
424
+ <template v-if="slots['label-append']" #label-append>
425
+ <slot name="label-append" />
426
+ </template>
427
+ <template v-if="slots['header-right']" #header-right>
428
+ <slot name="header-right" />
429
+ </template>
430
+ <template #default="{ focus }">
431
+ <div class="flex items-end justify-end w-full relative">
432
+ <div class="flex-1 relative">
433
+ <span
434
+ v-if="placeholder"
435
+ class="text-black/50 pointer-events-none select-none px-1 absolute inset-0 items-center transition-opacity truncate"
436
+ :class="focus || !!state.value || !!displayText ? 'opacity-0' : ''"
437
+ >
438
+ <div class="truncate w-full" :style="`text-align:${props.textAlign};`">
439
+ <div v-if="props.digitsPointSmall">
440
+ <span class="font-semibold">{{ pHolder[0] }}</span>
441
+ <span class="text-[0.8em] text-[#333] font-normal">{{ pHolder[1] }}</span>
442
+ </div>
443
+ <template v-else>
444
+ {{ placeholder }}
445
+ </template>
446
+ </div>
447
+ </span>
448
+ <input
449
+ :ref="(e) => setRef(e)"
450
+ v-model="state.value"
451
+ type="text"
452
+ :inputmode="hsIsMobile.isMobile ? 'numeric' : 'text'"
453
+ class="pe-1 w-full"
454
+ :class="[computedActivate ? 'opacity-100' : 'opacity-0']"
455
+ :style="`text-align:${props.textAlign};`"
456
+ maxlength="20"
457
+ :enterkeyhint="props.enterkeyhint"
458
+ :disabled="props.disabled"
459
+ :readonly="props.readonly"
460
+ :tabindex="tabindex"
461
+ :size="props.inputSize"
462
+ @wheel="onWheel"
463
+ @keydown="keydown"
464
+ @keyup="(e) => emit('keyup', e)"
465
+ @blur="onBlur()"
466
+ @focus="onFocus()"
467
+ />
468
+ <div
469
+ v-if="props.data !== null"
470
+ class="displayText pe-1 w-full"
471
+ :class="[
472
+ //
473
+ focus || computedActivate ? 'opacity-0' : 'opacity-100',
474
+ { readonly: props.readonly }
475
+ ]"
476
+ :style="`justify-content:${props.textAlign === 'right' ? 'end' : props.textAlign === 'center' ? 'center' : 'start'};`"
477
+ readonly
478
+ >
479
+ <div v-if="props.digitsPointSmall" class=" ">
480
+ <span class="font-semibold">{{ displayTextArr[0] }}</span>
481
+ <span class="text-[0.8em] text-[#333] font-normal">{{ displayTextArr[1] }}</span>
482
+ </div>
483
+ <template v-else>
484
+ {{ displayText }}
485
+ </template>
486
+ </div>
487
+ </div>
488
+ <div v-if="props.unit.length !== 0" class="flex-none unit">
489
+ {{ props.unit }}
490
+ </div>
491
+ </div>
492
+ </template>
493
+ </InputFrame>
494
+ </template>
495
+
639
496
  <style scoped>
640
497
  input {
641
498
  background-color: transparent;
@@ -644,7 +501,6 @@ input {
644
501
  appearance: none;
645
502
  border: 0px;
646
503
  outline: none;
647
- text-align: right;
648
504
  color: inherit;
649
505
  }
650
506
  input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button {
@@ -660,16 +516,31 @@ input.displayText {
660
516
  margin-top: auto;
661
517
  margin-bottom: auto;
662
518
  pointer-events: none;
519
+ display: flex;
520
+ align-items: center;
663
521
  }
664
522
  input.displayText.readonly {
665
523
  pointer-events: all;
666
524
  }
667
525
 
526
+ .displayText {
527
+ position: absolute;
528
+ inset: 0 0 0 0;
529
+ margin-top: auto;
530
+ margin-bottom: auto;
531
+ pointer-events: none;
532
+ display: flex;
533
+ align-items: center;
534
+ }
535
+ .displayText.readonly {
536
+ pointer-events: all;
537
+ }
538
+
668
539
  .unit {
669
540
  color: #696969;
670
541
  align-items: flex-end;
671
542
  align-self: flex-end;
672
- margin: 0px 0px 2px 4px;
543
+ margin: 0px 0px 0px 4px;
673
544
  font-size: min(0.8em, 1rem);
674
545
  -moz-user-select: none;
675
546
  -webkit-user-select: none;
@@ -709,4 +580,4 @@ input.displayText.readonly {
709
580
  .u-d-icon > div:first-child {
710
581
  border-bottom: solid 1px gray;
711
582
  }
712
- </style>
583
+ </style>