flameresttable 1.0.6 → 1.0.7

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/Table/Table.vue +57 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flameresttable",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "main": "./src/plugin.ts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -93,6 +93,7 @@
93
93
  Table.columns[column].title !== '' ? Table.columns[column].title : Table.columns[column].name }}</div>
94
94
  <div class="text-xs text-slate-400">{{ Table.columns[column].Popup.desc }}</div>
95
95
  </div>
96
+
96
97
  <div
97
98
  v-if="Table.columns[column].Popup.popupType === 'string' || Table.columns[column].Popup.popupType === 'text'"
98
99
  class="flex-1 mr-5 w-full flex flex-col self-stretch">
@@ -101,10 +102,12 @@
101
102
  :disabled="!Table.columns[column].Popup.isEnabled"
102
103
  :placeholder="Table.columns[column].Popup.placeholder !== '' ? Table.columns[column].Popup.placeholder : Table.columns[column].title !== '' ? Table.columns[column].title : Table.columns[column].name">
103
104
  </div>
105
+
104
106
  <div v-if="Table.columns[column].Popup.popupType === 'date'"
105
107
  class="flex-1 mr-5 w-full flex flex-col self-stretch">
106
108
  <Datepicker v-model="Table.columns[column].Popup.model" :auto-apply="true" />
107
109
  </div>
110
+
108
111
  <div v-if="Table.columns[column].Popup.popupType === 'selector'"
109
112
  class="flex-1 mr-5 w-full flex flex-col self-stretch"><select v-model="Table.columns[column].Popup.model"
110
113
  class="h-full self-stretch py-1 px-2 w-full outline-none border border-slate-100">
@@ -112,18 +115,53 @@
112
115
  :key="'sel_' + selectorKey"
113
116
  :value="getSelector(Table.columns[column].Popup.Selector.values, selectorKey, selectorVal)[1]">{{
114
117
  getSelector(Table.columns[column].Popup.Selector.values, selectorKey, selectorVal)[0] }}</option>
115
- </select></div>
118
+ </select>
119
+ </div>
120
+
121
+ <!-- КАРТИНКА -->
116
122
  <div v-if="Table.columns[column].Popup.popupType === 'image'"
117
123
  class="flex-1 border border-slate-100 mr-5 w-full flex self-stretch">
118
- <div class="flex-1"><img :src="fileGetData(Table.columns[column].Popup.model)"></div><!-- Загрузчик--><label
119
- :for="'cfile_' + column"><svg class="my-auto cursor-pointer" width="24" height="24" viewbox="0 0 24 24"
120
- fill="none" xmlns="http://www.w3.org/2000/svg">
124
+ <div class="flex-1">
125
+ <img class="max-w-[200px]" :src="fileGetData(Table.columns[column].Popup.model, true)">
126
+ </div>
127
+
128
+ <!-- Загрузчик-->
129
+ <label :for="'cfile_' + column">
130
+
131
+ <svg class="my-auto cursor-pointer" width="24" height="24" viewbox="0 0 24 24" fill="none"
132
+ xmlns="http://www.w3.org/2000/svg">
133
+ <path fill-rule="evenodd" clip-rule="evenodd"
134
+ d="M11.4697 2.46967C11.7626 2.17678 12.2374 2.17678 12.5303 2.46967L17.0303 6.96967C17.3232 7.26256 17.3232 7.73744 17.0303 8.03033C16.7374 8.32322 16.2626 8.32322 15.9697 8.03033L12.75 4.81066L12.75 16.5C12.75 16.9142 12.4142 17.25 12 17.25C11.5858 17.25 11.25 16.9142 11.25 16.5L11.25 4.81066L8.03033 8.03033C7.73744 8.32322 7.26256 8.32322 6.96967 8.03033C6.67678 7.73744 6.67678 7.26256 6.96967 6.96967L11.4697 2.46967ZM3 15.75C3.41421 15.75 3.75 16.0858 3.75 16.5V18.75C3.75 19.5784 4.42157 20.25 5.25 20.25H18.75C19.5784 20.25 20.25 19.5784 20.25 18.75V16.5C20.25 16.0858 20.5858 15.75 21 15.75C21.4142 15.75 21.75 16.0858 21.75 16.5V18.75C21.75 20.4069 20.4069 21.75 18.75 21.75H5.25C3.59315 21.75 2.25 20.4069 2.25 18.75V16.5C2.25 16.0858 2.58579 15.75 3 15.75Z"
135
+ fill="#0F172A" />
136
+ </svg>
137
+
138
+ <input class="hidden" :name="'cfile_' + column" type="file" @change="fileUpdated(column, $event)">
139
+
140
+ </label>
141
+ </div>
142
+
143
+ <!-- ФАЙЛЫ -->
144
+ <div v-if="Table.columns[column].Popup.popupType === 'file'"
145
+ class="flex-1 border border-slate-100 mr-5 w-full flex self-stretch">
146
+ <div class="flex-1">
147
+ {{ fileGetData(Table.columns[column].Popup.model, false).name }}
148
+ </div>
149
+
150
+ <!-- Загрузчик-->
151
+ <label :for="'cfile_' + column">
152
+
153
+ <svg class="my-auto cursor-pointer" width="24" height="24" viewbox="0 0 24 24" fill="none"
154
+ xmlns="http://www.w3.org/2000/svg">
121
155
  <path fill-rule="evenodd" clip-rule="evenodd"
122
156
  d="M11.4697 2.46967C11.7626 2.17678 12.2374 2.17678 12.5303 2.46967L17.0303 6.96967C17.3232 7.26256 17.3232 7.73744 17.0303 8.03033C16.7374 8.32322 16.2626 8.32322 15.9697 8.03033L12.75 4.81066L12.75 16.5C12.75 16.9142 12.4142 17.25 12 17.25C11.5858 17.25 11.25 16.9142 11.25 16.5L11.25 4.81066L8.03033 8.03033C7.73744 8.32322 7.26256 8.32322 6.96967 8.03033C6.67678 7.73744 6.67678 7.26256 6.96967 6.96967L11.4697 2.46967ZM3 15.75C3.41421 15.75 3.75 16.0858 3.75 16.5V18.75C3.75 19.5784 4.42157 20.25 5.25 20.25H18.75C19.5784 20.25 20.25 19.5784 20.25 18.75V16.5C20.25 16.0858 20.5858 15.75 21 15.75C21.4142 15.75 21.75 16.0858 21.75 16.5V18.75C21.75 20.4069 20.4069 21.75 18.75 21.75H5.25C3.59315 21.75 2.25 20.4069 2.25 18.75V16.5C2.25 16.0858 2.58579 15.75 3 15.75Z"
123
157
  fill="#0F172A" />
124
- </svg><input class="hidden" :name="'cfile_' + column" type="file"
125
- @change="fileUpdated(column, $event)"></label>
158
+ </svg>
159
+
160
+ <input class="hidden" :name="'cfile_' + column" type="file" @change="fileUpdated(column, $event)">
161
+
162
+ </label>
126
163
  </div>
164
+
127
165
  </label>
128
166
 
129
167
  <!-- КНОПКИ СОХРАНЕНИЯ-->
@@ -291,13 +329,22 @@ export default defineComponent({
291
329
 
292
330
  },
293
331
  methods: {
294
- fileGetData(thisArr: any) {
332
+ fileGetData(thisArr: any, getSource: boolean = true) {
333
+
334
+
295
335
 
296
336
  if (thisArr instanceof Array && thisArr.length > 0) {
297
- if (typeof thisArr[0].data === 'string') return thisArr[0].data;
298
- if (typeof thisArr[0].file === 'string') return thisArr[0].file;
337
+ // Получить строку с исходником
338
+ if (getSource) {
339
+ if (typeof thisArr[0].data === 'string') return thisArr[0].data;
340
+ if (typeof thisArr[0].file === 'string') return thisArr[0].file;
341
+ return "";
342
+ }
343
+ // Получить данные целиком
344
+ return thisArr[0]
299
345
  }
300
- return "";
346
+
347
+ return null
301
348
 
302
349
  }
303
350
  },