@mixd-id/web-scaffold 0.1.230406103 → 0.1.230406106

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.230406103",
4
+ "version": "0.1.230406106",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -11,6 +11,9 @@
11
11
  "exports": {
12
12
  ".": "./src/index.js",
13
13
  "./themes/default": "./src/themes/default/index.js",
14
+ "./components/Modal.vue": "./src/components/Modal.vue",
15
+ "./components/Modal2.vue": "./src/components/Modal2.vue",
16
+ "./components/Textbox.vue": "./src/components/Textbox.vue",
14
17
  "./mixin/component": "./src/mixin/component.js",
15
18
  "./mixin/edit-mode": "./src/mixin/edit-mode.js",
16
19
  "./helpers": {
@@ -359,7 +359,7 @@ export default{
359
359
 
360
360
  case 'create':
361
361
  case 'update':
362
- if(Object.keys(items[0]).length <= 1 && Object.keys(items[0])[0] === 'uid'){
362
+ if(items[0] && Object.keys(items[0]).length <= 1 && Object.keys(items[0])[0] === 'uid'){
363
363
  this.socketEmit2(this.src, {
364
364
  columns:this.config.columns,
365
365
  preset:{
@@ -1,7 +1,10 @@
1
1
  <template>
2
2
  <div>
3
3
  <Teleport to=".bW9k">
4
- <Transition :name="transition" @after-leave="onAfterLeave" @after-enter="$emit('show')">
4
+ <Transition :name="transition"
5
+ appear
6
+ @after-leave="onAfterLeave"
7
+ @after-enter="$emit('show')">
5
8
  <div v-if="computedState" :class="computedClass" ref="modal" :style="computedStyle"
6
9
  :data-state="computedState ? 1 : 0">
7
10
  <form v-if="useForm" @submit.prevent="$emit('submit')">
@@ -39,6 +42,7 @@
39
42
  let modals = []
40
43
 
41
44
  const registerModal = (modal) => {
45
+ if(modals.includes(modal)) return
42
46
 
43
47
  modals.forEach((_) => {
44
48
  _.isDisabled = 1
@@ -48,7 +52,6 @@ const registerModal = (modal) => {
48
52
  }
49
53
 
50
54
  const unRegisterModal = (modal) => {
51
-
52
55
  modals = modals.filter((_) => _ !== modal)
53
56
 
54
57
  if(modals.length > 0)
@@ -122,25 +125,20 @@ export default{
122
125
  watch:{
123
126
 
124
127
  computedState(to, from){
125
-
126
- if(to){
127
- let overlay = document.querySelector('.bW9k')
128
- if(overlay){
129
- overlay.classList.add('bW9l')
130
- }
131
-
132
- registerModal(this)
133
- }
134
- else{
135
- unRegisterModal(this)
136
- }
128
+ this.setState(to)
137
129
  }
138
130
 
139
131
  },
140
132
 
141
133
  mounted() {
142
134
  document.querySelector('.bW9k').addEventListener('click', this.onDismiss)
143
- window,addEventListener('keydown', this.onKeyDown)
135
+ window.addEventListener('keydown', this.onKeyDown)
136
+
137
+ this.$nextTick(() => {
138
+ if(this.computedState){
139
+ this.setState(this.computedState)
140
+ }
141
+ })
144
142
  },
145
143
 
146
144
  methods: {
@@ -184,6 +182,20 @@ export default{
184
182
  if(this.dismissable && this.$refs.modal && e.keyCode === 27){
185
183
  this.$emit('dismiss')
186
184
  }
185
+ },
186
+
187
+ setState(to){
188
+ if(to){
189
+ let overlay = document.querySelector('.bW9k')
190
+ if(overlay){
191
+ overlay.classList.add('bW9l')
192
+ }
193
+
194
+ registerModal(this)
195
+ }
196
+ else{
197
+ unRegisterModal(this)
198
+ }
187
199
  }
188
200
  }
189
201
 
@@ -210,7 +222,6 @@ export default{
210
222
  @apply bg-base-400;
211
223
  @apply border-[1px] border-text-50 z-20 flex max-h-[90vh];
212
224
  @apply rounded-xl overflow-hidden;
213
- transition: all 300ms cubic-bezier(0.25, 1, 0.5, 1);
214
225
  }
215
226
 
216
227
  .modal form{
@@ -2,7 +2,7 @@
2
2
  <div>
3
3
  <Teleport to=".bW9k">
4
4
  <div :class="computedClass" ref="modal" :style="computedStyle"
5
- :data-state="computedState ? 1 : 0">
5
+ :data-state="!!computedState ? 1 : 0">
6
6
  <form v-if="useForm" @submit.prevent="$emit('submit')">
7
7
  <div class="modal-head">
8
8
  <slot name="head" :context="context"></slot>
@@ -37,6 +37,7 @@
37
37
  let modals = []
38
38
 
39
39
  const registerModal = (modal) => {
40
+ if(modals.includes(modal)) return
40
41
 
41
42
  modals.forEach((_) => {
42
43
  _.isDisabled = 1
@@ -66,7 +67,10 @@ export default{
66
67
  type: String,
67
68
  default: 'bottom'
68
69
  },
69
- state: [ Number, Boolean, String ],
70
+ state: {
71
+ type: [ Number, Boolean, String ],
72
+ default: true
73
+ },
70
74
  transition: { type: String, default: 'slideup' },
71
75
  width: String,
72
76
  useForm: {
@@ -121,29 +125,18 @@ export default{
121
125
  watch:{
122
126
 
123
127
  computedState(to, from){
124
-
125
- if(to){
126
- let overlay = document.querySelector('.bW9k')
127
- if(overlay){
128
- overlay.classList.add('bW9l')
129
- }
130
-
131
- this.$emit('show')
132
- registerModal(this)
133
- }
134
- else{
135
- this.$nextTick(() => {
136
- this.onAfterLeave()
137
- unRegisterModal(this)
138
- })
139
- }
128
+ this.setState(to)
140
129
  }
141
130
 
142
131
  },
143
132
 
144
133
  mounted() {
145
134
  document.querySelector('.bW9k').addEventListener('click', this.onDismiss)
146
- window,addEventListener('keydown', this.onKeyDown)
135
+ window.addEventListener('keydown', this.onKeyDown)
136
+
137
+ if(this.computedState){
138
+ this.setState(this.computedState)
139
+ }
147
140
  },
148
141
 
149
142
  methods: {
@@ -187,6 +180,24 @@ export default{
187
180
  if(this.dismissable && this.$refs.modal && e.keyCode === 27){
188
181
  this.$emit('dismiss')
189
182
  }
183
+ },
184
+
185
+ setState(to){
186
+ if(to){
187
+ let overlay = document.querySelector('.bW9k')
188
+ if(overlay){
189
+ overlay.classList.add('bW9l')
190
+ }
191
+
192
+ this.$emit('show')
193
+ registerModal(this)
194
+ }
195
+ else{
196
+ this.$nextTick(() => {
197
+ this.onAfterLeave()
198
+ unRegisterModal(this)
199
+ })
200
+ }
190
201
  }
191
202
  }
192
203
 
@@ -259,7 +259,7 @@ export default{
259
259
  }
260
260
 
261
261
  .slider>div:nth-child(1){
262
- @apply absolute bg-base-300 rounded-lg;
262
+ @apply absolute bg-text-50 rounded-lg;
263
263
  height: .5rem;
264
264
  top: 50%;
265
265
  left: .75rem;
@@ -282,4 +282,4 @@ export default{
282
282
  touch-action: none;
283
283
  }
284
284
 
285
- </style>
285
+ </style>
@@ -187,7 +187,8 @@ export default{
187
187
  .size-lg{ @apply min-h-[var(--h-cp-lg)]; }
188
188
 
189
189
  .textbox>input{
190
- @apply flex-1 outline-none p-2 bg-transparent
190
+ @apply flex-1 outline-none p-2 bg-transparent;
191
+ font-size: inherit;
191
192
  }
192
193
 
193
194
  .active{