@mixd-id/web-scaffold 0.1.230406019 → 0.1.230406020

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406019",
4
+ "version": "0.1.230406020",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -3,7 +3,7 @@
3
3
  <Transition name="alert-outer">
4
4
  <div v-if="!!state" :class="$style.alert" ref="alert">
5
5
  <Transition name="alert" @after-appear="onAfterAppear" appear>
6
- <div class="p-4 flex flex-col items-center leading-6">
6
+ <div :class="$style.cont1">
7
7
  <slot v-if="$slots['icon']" name="icon"></slot>
8
8
  <svg v-else-if="mode === 'alert'" width="100" height="100" class="fill-red-500" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
9
9
  <path fill-rule="evenodd" clip-rule="evenodd" d="M12 13.75C12.4142 13.75 12.75 13.4142 12.75 13V8.00001C12.75 7.5858 12.4142 7.25001 12 7.25001C11.5858 7.25001 11.25 7.5858 11.25 8.00001V13C11.25 13.4142 11.5858 13.75 12 13.75Z"/>
@@ -16,9 +16,9 @@
16
16
  <path fill-rule="evenodd" clip-rule="evenodd" d="M12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 7.30558 16.6944 3.5 12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"/>
17
17
  </svg>
18
18
 
19
- <div class="my-4 text-center flex-1 overflow-y-auto">
20
- <h5 class="my-1 break-all">{{ title }}</h5>
21
- <p class="break-words overflow-y-auto whitespace-pre-line text-center">{{ description }}</p>
19
+ <div :class="$style.cont2">
20
+ <h5 :class="$style.title">{{ title }}</h5>
21
+ <p :class="$style.description">{{ description }}</p>
22
22
  </div>
23
23
 
24
24
  <div class="mt-4" v-if="mode === 'alert'">
@@ -140,6 +140,22 @@ export default{
140
140
  @apply min-w-[280px] max-w-[80vw] md:max-w-[400px];
141
141
  }
142
142
 
143
+ .cont1{
144
+ @apply p-4 flex flex-col items-center leading-6;
145
+ }
146
+
147
+ .cont2{
148
+ @apply my-4 text-center flex-1 overflow-y-auto;
149
+ }
150
+
151
+ .title{
152
+ @apply my-1 break-words;
153
+ }
154
+
155
+ .description{
156
+ @apply break-words overflow-y-auto whitespace-pre-line text-center;
157
+ }
158
+
143
159
  </style>
144
160
 
145
161
  <style>
@@ -1,9 +1,9 @@
1
1
  <template>
2
2
  <div :class="computedClass">
3
3
  <slot name="start"></slot>
4
- <input :type="type" :disabled="isDisabled" @focus="isActive = true" @blur="onBlur"
4
+ <input :type="computedType" :disabled="isDisabled" @focus="isActive = true" @blur="onBlur"
5
5
  :placeholder="placeholder" :maxlength="maxlength" ref="input" autocomplete="new-password"
6
- :value="modelValue ?? value" @input="onInput" :readonly="Boolean(readonly)"
6
+ :value="displayedValue" @input="onInput" :readonly="Boolean(readonly)"
7
7
  @keydown="onKeyDown"/>
8
8
  <div v-if="!!(errors)">
9
9
  <svg :class="$style.svg" width="24" height="24" class="fill-red-500" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
@@ -100,6 +100,36 @@ export default{
100
100
 
101
101
  isDisabled(){
102
102
  return this.state === 2
103
+ },
104
+
105
+ displayedValue(){
106
+ if(this.isActive){
107
+ return this.modelValue ?? this.value
108
+ }
109
+ else{
110
+ switch(this.type){
111
+
112
+ case 'number':
113
+ const val = parseInt(this.modelValue)
114
+ return isNaN(val) ? '' : val.toLocaleString()
115
+
116
+ default:
117
+ return this.modelValue ?? this.value
118
+
119
+ }
120
+ }
121
+ },
122
+
123
+ computedType(){
124
+
125
+ switch(this.type){
126
+
127
+ case 'number':
128
+ return 'text'
129
+
130
+ default:
131
+ return this.type
132
+ }
103
133
  }
104
134
 
105
135
  },