@sigmaott/base-next 1.4.29 → 1.4.31

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": "@sigmaott/base-next",
3
3
  "type": "module",
4
- "version": "1.4.29",
4
+ "version": "1.4.31",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,6 +27,10 @@ function formatDateTime(value: string) {
27
27
  return dayjs(value).subtract(timezoneOffset.value, 'minute').format('YYYY-MM-DD HH:mm:ss')
28
28
  }
29
29
 
30
+ function formatDate(value: string) {
31
+ return dayjs(value).subtract(timezoneOffset.value, 'minute').format('YYYY-MM-DD')
32
+ }
33
+
30
34
  function mapValue(value: string[], input: string) {
31
35
  switch (value.length) {
32
36
  case 0:
@@ -39,11 +43,16 @@ function mapValue(value: string[], input: string) {
39
43
 
40
44
  if (['select', 'multiselect'].includes(input))
41
45
  return `[ ${value[0]} ]`
42
- if (['datetime', 'date'].includes(input)) {
46
+ if (['datetime'].includes(input)) {
43
47
  return value[0].length === 2
44
48
  ? `[ ${formatDateTime(value[0][0])} -> ${formatDateTime(value[0][1])} ]`
45
49
  : formatDateTime(value[0])
46
50
  }
51
+ if (['date'].includes(input)) {
52
+ return value[0].length === 2
53
+ ? `[ ${formatDate(value[0][0])} -> ${formatDate(value[0][1])} ]`
54
+ : formatDate(value[0])
55
+ }
47
56
 
48
57
  return value[0]
49
58
  default:
@@ -60,22 +69,13 @@ function getTooltipContent(query: JsonRule) {
60
69
  </script>
61
70
 
62
71
  <template>
63
- <el-tag
64
- v-for="(query, idx) in queryTagList"
65
- :key="query.id"
66
- type="info"
67
- class="tag-query"
68
- closable
69
- @close="onRemoveQuery(idx)"
70
- >
71
- <el-tooltip
72
- :content="getTooltipContent(query)"
73
- placement="top"
74
- :show-after="500"
75
- >
72
+ <el-tag v-for="(query, idx) in queryTagList" :key="query.id" type="info" class="tag-query" closable
73
+ @close="onRemoveQuery(idx)">
74
+ <el-tooltip :content="getTooltipContent(query)" placement="top" :show-after="500">
76
75
  <div class="cursor-pointer" @click="emit('edit')">
77
76
  <span class="mr-1 font-semibold">{{ query.label || query.field }}</span>
78
- <span class="mr-1 text-red-500">{{ t(`Filter.operator.${defaultConfig.operators[query.operator].type}`) }}</span>
77
+ <span class="mr-1 text-red-500">{{ t(`Filter.operator.${defaultConfig.operators[query.operator].type}`)
78
+ }}</span>
79
79
  <span v-if="isNullValue(query.operator)" class="text-green-500">
80
80
  "{{ mapValue(query.value, query.input) }}"
81
81
  </span>
@@ -23,14 +23,14 @@ export const defaultConfig = {
23
23
  label: '==',
24
24
  nb_input: 1,
25
25
  multiple: false,
26
- apply_to: ['text', 'number', 'boolean', 'select', 'time'],
26
+ apply_to: ['text', 'number', 'boolean', 'select', 'time', 'date'],
27
27
  },
28
28
  not_equal: {
29
29
  type: 'not_equal',
30
30
  label: '!=',
31
31
  nb_input: 1,
32
32
  multiple: false,
33
- apply_to: ['text', 'number', 'boolean', 'select', 'time'],
33
+ apply_to: ['text', 'number', 'boolean', 'select', 'time', 'date'],
34
34
  },
35
35
  less: {
36
36
  type: 'less',