renusify 2.2.0 → 2.2.2

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.
@@ -1,252 +1,155 @@
1
1
  <template>
2
- <div>
3
- <r-container class="container-fluid">
4
- <r-row class="h-start h-space-between">
5
- <r-col class="col-auto">
6
- <r-btn @click.prevent="newItem"
7
- v-if="!disableAdd"
8
- class="color-success-text"
9
- outlined
10
- rounded>{{ $t('new', 'renusify') }}
2
+ <div>
3
+ <r-container class="container-fluid">
4
+ <r-row class="h-start h-space-between">
5
+ <r-col class="col-auto">
6
+ <r-btn v-if="!disableAdd"
7
+ class="color-success-text"
8
+ outlined
9
+ rounded
10
+ @click.prevent="newItem">{{ $t('new', 'renusify') }}
11
+ </r-btn>
12
+ </r-col>
13
+ <r-col class="col-auto">
14
+ <template v-if="mcud">
15
+ <r-btn class="color-error mx-1" icon @click.prevent="showConfirm=true">
16
+ <r-icon v-html="$r.icons.delete"></r-icon>
11
17
  </r-btn>
12
- </r-col>
13
- <r-col class="col-auto">
14
- <template v-if="mcud">
15
- <r-btn class="color-error mx-1" icon @click.prevent="showConfirm=true">
16
- <r-icon v-html="$r.icons.delete"></r-icon>
17
- </r-btn>
18
- <r-btn icon class="color-success mx-1" @click.prevent="$emit('copy',true)">
19
- <r-icon v-html="$r.icons.copy"></r-icon>
20
- </r-btn>
21
- <r-btn icon class="color-info mx-1" @click.prevent="$emit('edit',true)">
22
- <r-icon v-html="$r.icons.edit"></r-icon>
23
- </r-btn>
24
- </template>
25
- <r-btn @click.prevent="open"
26
- v-if="advanceSearch"
27
- :class="{'color-info':!show,'color-error':show}"
28
- rounded>{{$t(!show?'advance_search':'search','renusify')}}
29
- </r-btn>
30
- </r-col>
31
- <r-col v-if="!show" class="col-12">
32
- <r-text-input :label="$t('search','renusify')"
33
- @update:modelValue="$emit('update:modelValue',$event)"
34
- :model-value="search"></r-text-input>
35
- </r-col>
36
- <r-col v-else class="col-12">
37
- <r-container class="pa-0" full-width>
38
- <r-select-input :model-value="select" :items="header" text="text" disableSearch
39
- :label="$t('add','renusify')" @update:model-value="add"></r-select-input>
40
- <r-divider class="my-3"></r-divider>
41
- <template v-for="(item,i) in inputs" :key="i">
42
- <r-row v-if="['r-text-input','r-text-area'].includes(item.option.type)" class="v-baseline">
43
- <r-col class="col-5 md-3">
44
- <r-select-input v-model="item.advance.action"
45
- :items="[
46
- {name:$t('advance_search_like','renusify'),value:'r'},
47
- {name:$t('advance_search_not_like','renusify'),value:'nr'},
48
- {name:$t('advance_search_equal','renusify'),value:'e'},
49
- {name:$t('advance_search_not_equal','renusify'),value:'ne'},
50
- {name:$t('advance_search_id','renusify'),value:'_id'}
51
- ]"
52
- justValue
53
- disableSearch
54
- firstSelect
55
- :label="$t('advance_search_operator','renusify')"></r-select-input>
56
- </r-col>
57
- <r-col class="col-6 md-8">
58
- <r-text-input v-model="item.advance.search" :label="item.text"></r-text-input>
59
- </r-col>
60
- <r-col class="col-1">
61
- <r-btn class="color-error" icon @click.prevent="del(i)">
62
- <r-icon v-html="$r.icons.delete"></r-icon>
63
- </r-btn>
64
- </r-col>
65
- </r-row>
66
- <r-row v-else-if="'r-number-input'===item.option.type" class="v-baseline">
67
- <r-col class="col-6 md-3">
68
- <r-select-input v-model="item.advance.action"
69
- :items="[
18
+ <r-btn class="color-success mx-1" icon @click.prevent="$emit('copy',true)">
19
+ <r-icon v-html="$r.icons.copy"></r-icon>
20
+ </r-btn>
21
+ <r-btn class="color-info mx-1" icon @click.prevent="$emit('edit',true)">
22
+ <r-icon v-html="$r.icons.edit"></r-icon>
23
+ </r-btn>
24
+ </template>
25
+ <r-btn v-if="advanceSearch"
26
+ :class="{'color-info':!show,'color-error':show}"
27
+ rounded
28
+ @click.prevent="open">{{ $t(!show ? 'advance_search' : 'search', 'renusify') }}
29
+ </r-btn>
30
+ </r-col>
31
+ <r-col v-if="!show" class="col-12">
32
+ <r-text-input :label="$t('search','renusify')"
33
+ :model-value="search"
34
+ @update:modelValue="$emit('update:modelValue',$event)"></r-text-input>
35
+ </r-col>
36
+ <r-col v-else class="col-12">
37
+ <r-container class="pa-0" full-width>
38
+ <r-json-input v-model="advance"
39
+ :label="$t('search','renusify')">
40
+ <template v-slot="{info,add}">
41
+ <r-select-input v-model="info.key"
42
+ :items="headers[0]"
43
+ :label="$t('name','renusify')"
44
+ just-value></r-select-input>
45
+ <div v-if="info.key" :key="info.key">
46
+ <r-select-input v-model="info.action"
47
+ :items="[
70
48
  {name:$t('advance_search_equal','renusify'),value:'e'},
71
49
  {name:$t('advance_search_not_equal','renusify'),value:'ne'},
72
50
  {name:$t('advance_search_gt','renusify'),value:'gt'},
73
- {name:$t('advance_search_gte','renusify'),value:'gte'},
74
- {name:$t('advance_search_lt','renusify'),value:'lt'},
75
- {name:$t('advance_search_lte','renusify'),value:'lte'}]"
76
- firstSelect
77
- justValue
78
- disableSearch
79
- :label="$t('advance_search_operator','renusify')"></r-select-input>
80
- </r-col>
81
- <r-col class="col-6 md-8">
82
- <r-number-input v-model="item.advance.search" :label="item.text"></r-number-input>
83
- </r-col>
84
- <r-col class="col-1">
85
- <r-btn class="color-error" icon @click.prevent="del(i)">
86
- <r-icon v-html="$r.icons.delete"></r-icon>
87
- </r-btn>
88
- </r-col>
89
- </r-row>
90
- <r-row v-else-if="'r-switch-input'===item.option.type" class="v-baseline">
91
- <r-col class="col-5 md-3">
92
- <r-select-input v-model="item.advance.action"
93
- :items="[
94
- {name:$t('advance_search_equal','renusify'),value:'e'}
95
- ]"
96
- justValue
97
- firstSelect
98
- disableSearch
99
- :label="$t('advance_search_operator','renusify')"></r-select-input>
100
- </r-col>
101
- <r-col class="col-6 md-8">
102
- <r-switch-input v-model="item.advance.search" :label="item.text"></r-switch-input>
103
- </r-col>
104
- <r-col class="col-1">
105
- <r-btn class="color-error" icon @click.prevent="del(i)">
106
- <r-icon v-html="$r.icons.delete"></r-icon>
107
- </r-btn>
108
- </r-col>
109
- </r-row>
110
- <r-row v-else-if="'r-select-input'===item.option.type" class="v-baseline">
111
- <r-col class="col-5 md-3">
112
- <r-select-input v-model="item.advance.action"
113
- :items="[
114
- {name:$t('advance_search_in','renusify'),value:'in'},
115
- {name:$t('advance_search_not_in','renusify'),value:'nin'}
116
- ]"
117
- justValue
118
- firstSelect
119
- disableSearch
120
- :label="$t('advance_search_operator','renusify')"></r-select-input>
121
- </r-col>
122
- <r-col class="col-6 md-8">
123
- <r-select-input v-model="item.advance.search" :label="item.text" :items="item.option.items"
124
- justValue multiple tags></r-select-input>
125
- </r-col>
126
- <r-col class="col-1">
127
- <r-btn class="color-error" icon @click.prevent="del(i)">
128
- <r-icon v-html="$r.icons.delete"></r-icon>
129
- </r-btn>
130
- </r-col>
131
- </r-row>
132
- <r-row v-else-if="'r-json-input'===item.option.type" class="v-baseline">
133
- <r-col class="col-5 md-3">
134
- <r-select-input v-model="item.advance.action"
135
- :items="[
136
- {name:$t('advance_search_equal','renusify'),value:'e'},
137
- {name:$t('advance_search_not_equal','renusify'),value:'ne'}
138
- ]"
139
- :label="$t('advance_search_operator','renusify')"
140
- disableSearch
141
- firstSelect
142
- justValue></r-select-input>
143
- </r-col>
144
- <r-col class="col-6 md-8">
145
- <r-json-input v-model="item.advance.search" :label="item.text"></r-json-input>
146
- </r-col>
147
- <r-col class="col-1">
148
- <r-btn class="color-error" icon @click.prevent="del(i)">
149
- <r-icon v-html="$r.icons.delete"></r-icon>
150
- </r-btn>
151
- </r-col>
152
- </r-row>
153
- <r-row v-else-if="['r-date-input','r-time-ago'].includes(item.option.type)" class="v-baseline">
154
- <r-col class="col-5 md-3" :a="item.advance.t='date'">
155
- <r-select-input v-model="item.advance.action"
156
- :items="[
157
- {name:$t('advance_search_gt','renusify'),value:'gt'},
158
- {name:$t('advance_search_gte','renusify'),value:'gte'},
159
- {name:$t('advance_search_lt','renusify'),value:'lt'},
160
- {name:$t('advance_search_lte','renusify'),value:'lte'}
161
- ]"
162
- justValue
163
- disableSearch
164
- firstSelect
165
- :label="$t('advance_search_operator','renusify')"></r-select-input>
166
- </r-col>
167
- <r-col class="col-6 md-8">
168
- <r-date-input with-time v-model="item.advance.search" :label="item.text"></r-date-input>
169
- </r-col>
170
- <r-col class="col-1">
171
- <r-btn class="color-error" icon @click.prevent="del(i)">
172
- <r-icon v-html="$r.icons.delete"></r-icon>
173
- </r-btn>
174
- </r-col>
175
- </r-row>
176
- </template>
177
- <r-btn block rounded class="color-info" :loading="loading" @click.prevent="send">{{$t('search','renusify')}}</r-btn>
178
- </r-container>
179
- </r-col>
180
- </r-row>
181
- </r-container>
182
- <r-progress-line v-if="loading" color="color-one"></r-progress-line>
183
- <r-confirm
184
- hard
185
- v-model="showConfirm"
186
- v-on:accept="accept"
187
- v-on:cancel="showConfirm = false"
188
- />
189
- </div>
51
+ {name:$t('advance_search_lt','renusify'),value:'lt'}]"
52
+ :label="$t('advance_search_operator','renusify')"
53
+ disableSearch
54
+ firstSelect
55
+ justValue></r-select-input>
56
+ </div>
57
+ <div v-if="info.key" :key="info.key">
58
+ <component :is="headers[1][info.key].type" v-if="headers[1][info.key].type"
59
+ v-model="info.value"
60
+ :label="$t('search','renusify')"
61
+ v-bind="headers[1][info.key].props"></component>
62
+ </div>
63
+ <r-btn :rounded="!$r.inputs.tile" class="ms-1 color-success" @click.prevent="added(info,add)">
64
+ {{ $t('add', 'renusify') }}
65
+ </r-btn>
66
+ </template>
67
+ </r-json-input>
68
+
69
+ <r-btn :loading="loading" block class="color-info mt-2" rounded @click.prevent="send">
70
+ {{ $t('search', 'renusify') }}
71
+ </r-btn>
72
+ </r-container>
73
+ </r-col>
74
+ </r-row>
75
+ </r-container>
76
+ <r-progress-line v-if="loading" color="color-one"></r-progress-line>
77
+ <r-confirm
78
+ v-model="showConfirm"
79
+ hard
80
+ v-on:accept="accept"
81
+ v-on:cancel="showConfirm = false"
82
+ />
83
+ </div>
190
84
  </template>
191
85
  <script>
192
- export default {
193
- name: 'manageHeader',
194
- props: {
195
- headerTable: Object,
196
- loading: Boolean,
197
- disableAdd: Boolean,
198
- advanceSearch: Boolean,
199
- mcud: Boolean,
200
- newItem: Function,
201
- search: String
202
- },
203
- emits:['update:modelValue','copy','edit','delete','a-search'],
204
- data() {
205
- return {
206
- show: false,
207
- showConfirm: false,
208
- select: [],
209
- inputs: []
210
- }
211
- },
212
- methods: {
213
- accept(){
214
- this.$emit('delete',true)
215
- this.showConfirm=false
216
- },
217
- send() {
218
- this.$emit('update:modelValue', '')
219
- let r = []
220
- this.inputs.forEach((item) => {
221
- r.push({'name': item.value, 'advance': item.advance})
222
- })
223
- this.$emit('a-search', r)
224
- },
225
- del(i){
226
- this.inputs.splice(i,1)
227
- },
228
- open(){
229
- this.show=!this.show
230
- },
231
- add($event) {
232
- this.inputs.push($event)
233
- $event.advance = {}
234
- if ($event.option.type === 'r-switch-input') {
235
- $event.advance.search = false
236
- }
237
- this.select = []
238
- }
239
- },
240
- computed: {
241
- header() {
242
- let res = []
243
- this.headerTable.forEach((item) => {
244
- if (['r-text-input', 'r-text-area', 'r-number-input', 'r-switch-input', 'r-select-input', 'r-json-input', 'r-date-input', 'r-time-ago'].includes(item.option.type)) {
245
- res.push(item)
246
- }
247
- })
248
- return res
249
- }
250
- }
86
+ export default {
87
+ name: 'manageHeader',
88
+ props: {
89
+ headerTable: Object,
90
+ loading: Boolean,
91
+ disableAdd: Boolean,
92
+ advanceSearch: Boolean,
93
+ mcud: Boolean,
94
+ newItem: Function,
95
+ search: String
96
+ },
97
+ emits: ['update:modelValue', 'copy', 'edit', 'delete', 'a-search'],
98
+ data() {
99
+ return {
100
+ show: false,
101
+ showConfirm: false,
102
+ advance: null
103
+ }
104
+ },
105
+ computed: {
106
+ headers() {
107
+ let r = []
108
+ let r2 = {}
109
+ for (let i = 0; i < this.headerTable.length; i++) {
110
+ r.push({'name': this.$t(this.headerTable[i].text), 'value': this.headerTable[i].value})
111
+ r2[this.headerTable[i].value] = this.headerTable[i].option
112
+ }
113
+ return [r, r2]
251
114
  }
115
+ },
116
+ methods: {
117
+ added(info, add) {
118
+ let item = this.headers[1][info.key]
119
+ if (info.key === '_id' || item.is_object_id) {
120
+ info.value = {'$oid': info.value}
121
+ } else if (item.type === 'r-date-input' || item.type === 'r-time-ago') {
122
+ if (info.action === 'eq') {
123
+ info.value = {'$date': info.value}
124
+ } else if (info.action === 'ne') {
125
+ info.value = {'$ne': {'$date': info.value}}
126
+ } else if (info.action === 'gt') {
127
+ info.value = {'$gt': {'$date': info.value}}
128
+ } else if (info.action === 'lt') {
129
+ info.value = {'$lt': {'$date': info.value}}
130
+ }
131
+ } else {
132
+ if (info.action === 'ne') {
133
+ info.value = {'$ne': info.value}
134
+ } else if (info.action === 'gt') {
135
+ info.value = {'$gt': info.value}
136
+ } else if (info.action === 'lt') {
137
+ info.value = {'$lt': info.value}
138
+ }
139
+ }
140
+ add()
141
+ },
142
+ accept() {
143
+ this.$emit('delete', true)
144
+ this.showConfirm = false
145
+ },
146
+ send() {
147
+ this.$emit('update:modelValue', '')
148
+ this.$emit('a-search', this.advance)
149
+ },
150
+ open() {
151
+ this.show = !this.show
152
+ },
153
+ }
154
+ }
252
155
  </script>
@@ -14,7 +14,4 @@ export * as l_col from '../../container/col.js'
14
14
  export * as l_divider from '../../container/divider.js'
15
15
  export * as l_json from '../../form/jsonInput/index.js'
16
16
  export * as l_text from '../../form/textInput/index.js'
17
- export * as l_select from '../../form/selectInput/index.js'
18
- export * as l_date from '../../form/dateInput/index.js'
19
- export * as l_number from '../../form/numberInput/index.js'
20
17
  export * as l_switch from '../../form/switchInput/index.js'