flameresttable 1.0.36 → 1.0.38

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/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <meta charset="UTF-8" />
6
6
  <link rel="icon" href="/favicon.ico" />
7
7
  <meta name="description" content="Vite App">
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
9
9
  <title>Vite App</title>
10
10
  </head>
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flameresttable",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "main": "./src/plugin.ts",
5
5
  "repository": {
6
6
  "type": "git",
package/src/App.vue CHANGED
@@ -39,7 +39,7 @@ opts.set("name", {
39
39
 
40
40
 
41
41
  opts.addVirtual('test', { title: 'test title', Table: { isShow: true, } })
42
- opts.addVirtual('date', { title: 'dt', Filter: { isShow: true, type: 'daterange' }, Table: { isShow: true, } })
42
+ opts.addVirtual('date', { title: 'dt', Filter: { isShow: true, type: 'number' }, Table: { isShow: true, } })
43
43
 
44
44
  opts.Add.can = true;
45
45
  opts.Remove.can = true;
@@ -131,6 +131,10 @@ export class Column implements IColumn {
131
131
  // Значение
132
132
  valueString: "",
133
133
  valueRange: [],
134
+ valueRangeNumbers: {
135
+ from: '',
136
+ to: ''
137
+ },
134
138
 
135
139
  // Тип фильтра
136
140
  type: 'text' as "text" | "fixed" | "fulltext" | "number" | "date" | "daterange" | "selector",
@@ -308,6 +312,10 @@ export interface IColumn {
308
312
  // Значение
309
313
  valueString?: string,
310
314
  valueRange?: Array<string>,
315
+ valueRangeNumbers?: {
316
+ from?: string,
317
+ to?: string
318
+ },
311
319
 
312
320
  // Минимальное число символов в строке фильтра, после которого будет произведён запрос
313
321
  filterMinSymbolsRequest?: number,
@@ -269,8 +269,17 @@ export default class FlameTable<T> {
269
269
 
270
270
  break;
271
271
 
272
- // ДИАПАЗОН
272
+ // ЧИСЛА
273
273
  case 'number':
274
+
275
+ if (el.valueRangeNumbers.from.length > 0)
276
+ customFilters.where[key + '_from'] = ['>=', key, el.valueRangeNumbers.from];
277
+ if (el.valueRangeNumbers.to.length > 0)
278
+ customFilters.where[key + '_to'] = ['<=', key, el.valueRangeNumbers.to];
279
+
280
+ break;
281
+
282
+ // ДИАПАЗОН ДАТ
274
283
  case 'daterange':
275
284
 
276
285
  if (el.valueRange.length > 0) {
@@ -280,6 +289,8 @@ export default class FlameTable<T> {
280
289
 
281
290
  break;
282
291
 
292
+
293
+
283
294
  case 'selector':
284
295
 
285
296
  if (el.selector.multiselect) {
@@ -1,40 +1,49 @@
1
1
  <template>
2
2
  <div class="fc flex-wrap">
3
- <div v-for="(col) in props.columns" :key="col.name" v-show="col.Filter.isShow" class="py-1"
4
- :class="col.Filter.classes + (col.Filter.type === 'selector' && col.Filter.selector.mode === 'horizontal' ? ' w-full ' : '')">
3
+ <div v-for="(col) in props.columns" :key="col.name" v-show="col.Filter.isShow"
4
+ :class="(col.Filter.classes + (col.Filter.type === 'selector' && col.Filter.selector.mode === 'horizontal' ? ' w-full ' : ''))"
5
+ class="py-1 mobile:w-full mobile:px-2 mobile:block desktop:inline-block desktop:mx-2">
5
6
 
6
- <div class="fc flex-col">
7
+ <div class="fc flex-col ">
7
8
  <div class="text-xs text-slate-400">{{ col.title.toUpperCase() ?? col.name }}</div>
8
9
 
9
10
  <!-- ТЕКСТ -->
10
- <div v-if="col.Filter.type === 'text' || col.Filter.type === 'fixed' || col.Filter.type === 'fulltext'">
11
- <input class="outline-none border border-slate-500 px-2 py-1 mx-2" :placeholder="col.title ?? col.name"
11
+ <div class="mobile:w-full"
12
+ v-if="col.Filter.type === 'text' || col.Filter.type === 'fixed' || col.Filter.type === 'fulltext'">
13
+ <input class="mobile:w-full outline-none border border-slate-500 px-2 py-1" :placeholder="col.title ?? col.name"
12
14
  type="text" @keyup="update()" v-model="col.Filter.valueString" />
13
15
  </div>
14
16
 
17
+ <!-- ЦИФРЫ -->
18
+ <div class="fc mobile:w-full px-2" v-if="col.Filter.type === 'number' || col.Filter.type === 'fixed'">
19
+ <input class="max-w-[100px] flex-1 outline-none border border-slate-500 px-2 py-1"
20
+ :placeholder="'From ' + col.title ?? col.name" type="text" @keyup="update()"
21
+ v-model="col.Filter.valueRangeNumbers.from" />
22
+ <span class="mx-2"> - </span>
23
+ <input class="max-w-[100px] flex-1 outline-none border border-slate-500 px-2 py-1"
24
+ :placeholder="'To ' + (col.title ?? col.name)" type="text" @keyup="update()"
25
+ v-model="col.Filter.valueRangeNumbers.to" />
26
+ </div>
27
+
15
28
  <!-- СЕЛЕКТОРЫ -->
16
- <div v-if="col.Filter.type === 'selector'">
17
- <!-- ВЕРТИКАЛЬНЫЕ -->
18
- <!--<select v-if="col.Filter.selector.mode === 'vertical'" :multiple="col.Filter.selector.multiselect"
19
- class="outline-none border border-slate-500 px-2 py-1 mx-2" :placeholder="col.title ?? col.name"
20
- @change="update(col)" v-model="col.Filter.valueString">
21
- <option v-for="item in col.Selector.values" :key="item.id" :value="item.id">
22
- {{ item.title }}
23
- </option>
24
- </select>-->
29
+
30
+ <!-- ВЕРТИКАЛЬНЫЕ -->
31
+ <div v-if="col.Filter.type === 'selector'" class="mobile:w-full">
25
32
  <v-select :multiple="col.Filter.selector.multiselect" v-model="col.Filter.valueString"
26
- :options="col.Selector.values" class="min-w-[150px]" @option:selected="update(col)"
33
+ :options="col.Selector.values" class="mobile:w-full min-w-[150px]" @option:selected="update(col)"
27
34
  @option:deselected="update(col)" />
28
35
  </div>
36
+
37
+ <!-- ГОРИЗОНТАЛЬНЫЕ -->
29
38
  <div v-if="col.Filter.type === 'selector' && col.Filter.selector.mode === 'horizontal'"
30
39
  class="w-full text-center">
31
- <!-- ГОРИЗОНТАЛЬНЫЕ -->
32
40
  <div v-for="item in col.Selector.values" :key="item.id" class="px-2 py-1 mx-1 inline-block rounded-[30px]"
33
41
  :style="'background-color:' + (item.color ?? 'rgb(148,163,184)')">
34
42
  {{ item.title }}
35
43
  </div>
36
44
  </div>
37
45
 
46
+ <!-- ДАТА -->
38
47
  <div v-if="col.Filter.type === 'date' || col.Filter.type === 'daterange'">
39
48
  <Datepicker v-if="col.Filter.type === 'date'" v-model="col.Filter.valueString" :auto-apply="true"
40
49
  :enable-time-picker="false" @update:model-value="update()" :teleport="true"></Datepicker>