free-fe-core-modules 0.0.55 → 0.1.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,99 +1,49 @@
1
1
  <template>
2
2
  <div class="row free-field-image-list" v-if="Field">
3
- <span
4
- :class="`field-label ${(Field.Label && Field.Label.trim().length)
5
- ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
6
- v-if="Field.Label !== void 0">
7
- <q-tooltip v-if="Field.Description" anchor="top right">{{Field.Description}}</q-tooltip>
8
- {{Field.Label || ''}}
3
+ <span :class="`field-label ${(Field.Label && Field.Label.trim().length)
4
+ ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`" v-if="Field.Label !== void 0">
5
+ <q-tooltip v-if="Field.Description" anchor="top right">{{ Field.Description }}</q-tooltip>
6
+ {{ Field.Label || '' }}
9
7
  <span v-if="Field.Required" class="required-mark">*</span>
10
8
  </span>
11
- <q-uploader
12
- @added="localFiles.push(...$event)"
13
- @uploaded="uploaded"
14
- @removed="removeFile"
15
- @rejected="filesRejected"
16
- :factory="factoryFn"
17
- multiple
18
- :max-files="Field.Options && Field.Options.MaxCount"
19
- :max-file-size="maxFileSize"
20
- :max-total-size="maxTotalSize"
21
- :class="`q-ma-xs ${hasError ? 'free-field--error' : ''}`"
22
- ref="uploader"
23
- >
9
+ <q-uploader @added="localFiles.push(...$event)" @uploaded="uploaded" @removed="removeFile" @rejected="filesRejected"
10
+ :factory="factoryFn" multiple :max-files="Field.Options && Field.Options.MaxCount" :max-file-size="maxFileSize"
11
+ :max-total-size="maxTotalSize" :class="`q-ma-xs ${hasError ? 'free-field--error' : ''}`" ref="uploader">
24
12
  <template v-slot:list="scope">
25
13
  <div class="uploader-btns row no-wrap items-center">
26
14
  <q-spinner v-if="scope.isUploading" class="q-uploader__spinner" />
27
- <q-btn
28
- v-if="scope.canAddFiles"
29
- type="a"
30
- icon="add_box"
31
- label="点击添加"
32
- class="add-btn"
33
- dense
34
- flat
35
- :disabled="Field.ReadOnly"
36
- >
37
- <q-uploader-add-trigger v-if="!Field.ReadOnly"/>
15
+ <q-btn v-if="scope.canAddFiles" type="a" icon="add_box" label="点击添加" class="add-btn" dense flat
16
+ :disabled="Field.ReadOnly">
17
+ <q-uploader-add-trigger v-if="!Field.ReadOnly" />
38
18
  </q-btn>
39
- <q-btn
40
- v-if="scope.canUpload"
41
- icon="cloud_upload"
42
- @click="scope.upload"
43
- class="upload-btn"
44
- label="点击上传"
45
- dense
46
- flat
47
- :disabled="Field.ReadOnly"
48
- ></q-btn>
19
+ <q-btn v-if="scope.canUpload" icon="cloud_upload" @click="scope.upload" class="upload-btn" label="点击上传" dense
20
+ flat :disabled="Field.ReadOnly"></q-btn>
49
21
 
50
- <q-btn
51
- v-if="scope.isUploading"
52
- icon="clear"
53
- @click="scope.abort"
54
- class="abort-btn"
55
- round
56
- dense
57
- flat
58
- :disabled="Field.ReadOnly"
59
- ></q-btn>
22
+ <q-btn v-if="scope.isUploading" icon="clear" @click="scope.abort" class="abort-btn" round dense flat
23
+ :disabled="Field.ReadOnly"></q-btn>
60
24
  <slot name="warning"></slot>
61
25
  </div>
62
26
 
63
- <div v-if="Array.isArray(allFiles) && allFiles.length" class="file-list row items-start justify-start q-gutter-xl">
64
- <q-card
65
- flat
66
- class="file-list-item"
67
- v-for="(file, index) in allFiles" :key="index">
68
- <e-icon class="file-image" :name="fileThumb(file)" thumb
69
- :relative="filePreviewType(file) !== 'image'"
70
- @click="preview(file)">
71
- <div class="view-btn-wrapper absolute-full justify-center text-center">
72
- <q-btn
73
- flat
74
- class="view-btn full-height full-width"
75
- @click="preview(file)"
76
- >查看</q-btn>
77
- </div>
78
- </e-icon>
79
- <span class="file-name full-width ellipsis">
80
- {{ file.name }}
81
- <q-tooltip>{{ file.name }}</q-tooltip>
82
- </span>
27
+ <div v-if="Array.isArray(allFiles) && allFiles.length"
28
+ class="file-list row items-start justify-start q-gutter-xl">
29
+ <q-card flat class="file-list-item" v-for="(file, index) in allFiles" :key="index">
30
+ <e-icon class="file-image" :name="fileThumb(file)" thumb :relative="filePreviewType(file) !== 'image'"
31
+ @click="preview(file)">
32
+ <div class="view-btn-wrapper absolute-full justify-center text-center">
33
+ <q-btn flat class="view-btn full-height full-width" @click="preview(file)">查看</q-btn>
34
+ </div>
35
+ </e-icon>
36
+ <span class="file-name full-width ellipsis">
37
+ {{ file.name }}
38
+ <q-tooltip>{{ file.name }}</q-tooltip>
39
+ </span>
83
40
 
84
- <span class="file-size full-width ellipsis">
85
- Size: {{ file.sizeLabel || file.__sizeLabel }}
86
- </span>
41
+ <span class="file-size full-width ellipsis">
42
+ Size: {{ file.sizeLabel || file.__sizeLabel }}
43
+ </span>
87
44
 
88
- <q-btn
89
- flat
90
- dense
91
- round
92
- class="delete-btn"
93
- icon="close"
94
- @click="scope.removeFile(file)"
95
- :disabled="Field.ReadOnly"
96
- />
45
+ <q-btn flat dense round class="delete-btn" icon="close" @click="scope.removeFile(file)"
46
+ :disabled="Field.ReadOnly" />
97
47
  </q-card>
98
48
  </div>
99
49
  <!-- <q-list separator v-if="scope.files.length">
@@ -134,32 +84,18 @@
134
84
  </div>
135
85
  </template>
136
86
  </q-uploader>
137
- <q-dialog class="image-preview-dialog"
138
- flat
139
- full-width full-height v-model="showPreview"
87
+ <q-dialog class="image-preview-dialog" flat full-width full-height v-model="showPreview"
140
88
  style="background: rgba(0,0,0,0)">
141
89
  <div class="image-preview">
142
- <q-icon name="close"
143
- class="absolute cursor-pointer bg-white text-primary"
144
- style="border-radius: 6px;border: 1px solid primary;right: 0;"
145
- round size="20px"
146
- @click="showPreview=false"></q-icon>
147
- <q-img
148
- fit="contain"
149
- v-if="previewType=== 'image'"
150
- :src="previewFile"
151
- @click="showPreview=false"
90
+ <q-icon name="close" class="absolute cursor-pointer bg-white text-primary"
91
+ style="border-radius: 6px;border: 1px solid primary;right: 0;" round size="20px"
92
+ @click="showPreview = false"></q-icon>
93
+ <q-img fit="contain" v-if="previewType === 'image'" :src="previewFile" @click="showPreview = false"
152
94
  style="height: 100%; max-width: 100%;">
153
95
  </q-img>
154
96
 
155
- <q-pdfviewer
156
- v-if="previewType === 'pdf'"
157
- v-model="showPreview"
158
- @click="showPreview=false"
159
- :src="previewFile"
160
- type="pdfjs"
161
- style="height: 100%; max-width: 100%;"
162
- />
97
+ <q-pdfviewer v-if="previewType === 'pdf'" v-model="showPreview" @click="showPreview = false" :src="previewFile"
98
+ type="pdfjs" style="height: 100%; max-width: 100%;" />
163
99
  </div>
164
100
  </q-dialog>
165
101
  </div>
@@ -167,9 +103,9 @@
167
103
 
168
104
  <script>
169
105
  import { computed, defineComponent, getCurrentInstance, ref } from 'vue';
170
- import { useFreeField, freeFieldProps } from '../composible/useFreeField';
171
- import { useFormValidator} from '../../composible/useFormValidator';
172
- import { useUploader } from '../composible/useUploader';
106
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField.js';
107
+ import { useFormValidator} from '../../composible/useFormValidator.js';
108
+ import { useUploader } from '../composible/useUploader.js';
173
109
 
174
110
  export default defineComponent({
175
111
  name: 'InputFieldImageList',
@@ -274,7 +210,6 @@ export default defineComponent({
274
210
  if (res && res.msg === 'OK') {
275
211
  uploadedFiles.push({
276
212
  id: res.data.id,
277
- // eslint-disable-next-line no-underscore-dangle
278
213
  sizeLabel: file.__sizeLabel,
279
214
  name: file.name,
280
215
  size: file.size,
@@ -104,7 +104,6 @@ export default defineComponent({
104
104
  props: {
105
105
  ...freeFieldProps,
106
106
  },
107
- emits: ['input'],
108
107
  setup(props, { emit, slots , expose }){
109
108
  if (!props.Field) return {};
110
109
 
@@ -3,38 +3,26 @@
3
3
  <slot name="warning"></slot>
4
4
  <div class="buttons relative-position" v-if="Field && Field.ShowButtons">
5
5
  <span class="q-ml-lg select-all-btn">
6
- <q-btn round icon="check" @click="setFieldData(Object.assign({},serviceList))"></q-btn>
6
+ <q-btn round icon="check" @click="setFieldData(Object.assign({}, serviceList))"></q-btn>
7
7
  </span>
8
8
  <span class="q-ml-md clear-btn">
9
9
  <q-btn round icon="clear" @click="setFieldData({})"></q-btn>
10
10
  </span>
11
11
  </div>
12
12
  <div class="roles relative-position row items-center">
13
- <q-radio
14
- class="role"
15
- v-model="currentRole"
16
- v-for="(r, idx) in (Field && Field.Roles) || []"
17
- :key="idx"
18
- :val="r.Name"
19
- :label="r.Name || idx"
20
- @update:modelValue="setFieldData(r.Permission || {})"/>
13
+ <q-radio class="role" v-model="currentRole" v-for="(r, idx) in (Field && Field.Roles) || []" :key="idx"
14
+ :val="r.Name" :label="r.Name || idx" @update:modelValue="setFieldData(r.Permission || {})" />
21
15
  </div>
22
- <permission-editor
23
- v-if="Field && !Field.HideEditor"
24
- class="permission-editor"
25
- :Permission="fieldData.value"
26
- :Service="serviceList"
27
- :readonly="Field.ReadOnly"
28
- @changed="permissionChanged"
29
- :noDataScope="Field.NoDataScope"
30
- ></permission-editor>
16
+ <permission-editor v-if="Field && !Field.HideEditor" class="permission-editor" :Permission="fieldData.value"
17
+ :Service="serviceList" :readonly="Field.ReadOnly" @changed="permissionChanged"
18
+ :noDataScope="Field.NoDataScope"></permission-editor>
31
19
  </span>
32
20
  </template>
33
21
 
34
22
  <script>
35
23
  import { defineComponent } from 'vue';
36
- import { useFreeField, freeFieldProps } from '../composible/useFreeField';
37
- import PermissionEditor from './PermissionEditor';
24
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField.js';
25
+ import PermissionEditor from './PermissionEditor.vue';
38
26
 
39
27
  export default defineComponent({
40
28
  name: 'InputFieldPermission',
@@ -4,68 +4,48 @@
4
4
  <q-card class="free-field-search-dialog-card">
5
5
  <q-toolbar>
6
6
  <div class="simple-field full-width">
7
- <q-input
8
- autofocus
9
- v-model="searchKey"
10
- hide-bottom-space
11
- :placeholder="Field &&
12
- ((Field.Options?.SearchPlaceholder) || Field.Placeholder)"
13
- @keydown.enter="search()"
14
- class="full-width"
15
- v-bind="inputControlSettings"
16
- >
7
+ <q-input autofocus v-model="searchKey" hide-bottom-space :placeholder="Field &&
8
+ ((Field.Options?.SearchPlaceholder) || Field.Placeholder)" @keydown.enter="search()" class="full-width"
9
+ v-bind="inputControlSettings">
17
10
  <template v-slot:append>
18
- <q-btn :class="Field.Options?.SearchBtnClasses" :flat="!Field.Options?.SearchBtn3D" :round="!Field.Options?.SearchBtnRect" icon="search" @click="search()" :disabled="Field.ReadOnly">{{Field.Options.SearchBtnText}}</q-btn>
11
+ <q-btn :class="Field.Options?.SearchBtnClasses" :flat="!Field.Options?.SearchBtn3D"
12
+ :round="!Field.Options?.SearchBtnRect" icon="search" @click="search()" :disabled="Field.ReadOnly">{{
13
+ Field.Options.SearchBtnText }}</q-btn>
19
14
  </template>
20
15
  </q-input>
21
16
  </div>
22
17
  </q-toolbar>
23
18
 
24
19
  <q-card-section :style="`
25
- width: ${Field.Options?.Width|| '800px'};
26
- max-width: ${Field.Options?.MaxWidth|| '80vw'};
20
+ width: ${Field.Options?.Width || '800px'};
21
+ max-width: ${Field.Options?.MaxWidth || '80vw'};
27
22
  overflow-y: scroll`">
28
- <q-table
29
- :flat="Field.Options?.Flat"
30
- :bordered="Field.Options?.Bordered"
31
- :rows="searchData.docs || []"
32
- :columns="searchColumns"
33
- row-key="id"
34
- :pagination="searchPagination"
35
- :selection="Field.Multiple ? 'multiple' : 'single'"
36
- :selected="searchSelected"
37
- @update:selected="searchSelected = $event"
38
- >
23
+ <q-table :flat="Field.Options?.Flat" :bordered="Field.Options?.Bordered" :rows="searchData.docs || []"
24
+ :columns="searchColumns" row-key="id" :pagination="searchPagination"
25
+ :selection="Field.Multiple ? 'multiple' : 'single'" :selected="searchSelected"
26
+ @update:selected="searchSelected = $event">
39
27
  <template v-slot:header="props">
40
28
  <q-tr :props="props">
41
- <q-th auto-width v-if="!Field.Options?.checkOnRight"/>
42
- <q-th
43
- v-for="col in props.cols"
44
- :key="col.name"
45
- :props="props"
46
- >
29
+ <q-th auto-width v-if="!Field.Options?.checkOnRight" />
30
+ <q-th v-for="col in props.cols" :key="col.name" :props="props">
47
31
  {{ col.label }}
48
32
  </q-th>
49
- <q-th auto-width v-if="Field.Options?.checkOnRight"/>
33
+ <q-th auto-width v-if="Field.Options?.checkOnRight" />
50
34
  </q-tr>
51
35
  </template>
52
36
  <template v-slot:body="props">
53
37
  <q-tr class="table-row">
54
38
  <q-td auto-width v-if="!Field.Options?.checkOnRight">
55
- <q-toggle v-model="props.selected" v-if="Field.Options?.useToggle"/>
56
- <q-checkbox v-else v-model="props.selected"></q-checkbox>
39
+ <q-toggle v-model="props.selected" v-if="Field.Options?.useToggle" />
40
+ <q-checkbox v-else v-model="props.selected"></q-checkbox>
57
41
  </q-td>
58
- <q-td
59
- v-for="col in props.cols"
60
- :key="col.name"
61
- :props="props"
62
- :class="`col-${col.name} col-${col.value}`"
63
- >
64
- {{col.value}}
42
+ <q-td v-for="col in props.cols" :key="col.name" :props="props"
43
+ :class="`col-${col.name} col-${col.value}`">
44
+ {{ col.value }}
65
45
  </q-td>
66
46
  <q-td auto-width v-if="Field.Options?.checkOnRight">
67
- <q-toggle v-model="props.selected" v-if="Field.Options?.useToggle"/>
68
- <q-checkbox v-else v-model="props.selected"></q-checkbox>
47
+ <q-toggle v-model="props.selected" v-if="Field.Options?.useToggle" />
48
+ <q-checkbox v-else v-model="props.selected"></q-checkbox>
69
49
  </q-td>
70
50
  </q-tr>
71
51
  </template>
@@ -77,97 +57,59 @@
77
57
 
78
58
  <template v-slot:bottom>
79
59
  <div class="full-width row flex-center">
80
- 共{{searchData.total}}条
81
- <q-pagination
82
- v-model="searchData.page"
83
- :max="searchData.pages"
84
- @update:modelValue="searchPaginationChanged"
85
- boundary-numbers
86
- direction-links
87
- :max-pages="2"
88
- ></q-pagination>
60
+ 共{{ searchData.total }}条
61
+ <q-pagination v-model="searchData.page" :max="searchData.pages"
62
+ @update:modelValue="searchPaginationChanged" boundary-numbers direction-links
63
+ :max-pages="2"></q-pagination>
89
64
  </div>
90
65
  </template>
91
66
  </q-table>
92
67
  </q-card-section>
93
68
  <q-card-actions>
94
69
  <div class="buttons row full-width justify-center q-ma-sm">
95
- <q-btn
96
- :icon="(Field.Options?.CancelIcon) || 'cancel'"
97
- class="cancel-btn q-mr-md"
98
- @click="showSearch = false; searchSelected=originalSelected; $emit('input')"
99
- >{{$t('cancelButtonText')}}</q-btn>
100
- <q-btn
101
- :icon="(Field.Options?.OkIcon) || 'check'"
102
- class="ok-btn" @click="searchOK">{{$t('okButtonText')}}</q-btn>
70
+ <q-btn :icon="(Field.Options?.CancelIcon) || 'cancel'" class="cancel-btn q-mr-md"
71
+ @click="showSearch = false; searchSelected = originalSelected; $emit('input')">{{ $t('cancelButtonText')
72
+ }}</q-btn>
73
+ <q-btn :icon="(Field.Options?.OkIcon) || 'check'" class="ok-btn" @click="searchOK">{{ $t('okButtonText')
74
+ }}</q-btn>
103
75
  </div>
104
76
  </q-card-actions>
105
77
  </q-card>
106
78
  </q-dialog>
107
79
 
108
80
  <span v-if="Field.ReadOnly" class="simple-field row">
109
- <span
110
- :class="`field-label field-label-readonly ${
111
- (Field.Label && Field.Label.trim().length)
112
- ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
113
- v-if="Field.Label !== void 0"
114
- >
115
- <q-tooltip v-if="Field.Description" anchor="top right">{{Field.Description}}</q-tooltip>
116
- {{Field.Label || ''}}
81
+ <span :class="`field-label field-label-readonly ${(Field.Label && Field.Label.trim().length)
82
+ ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`" v-if="Field.Label !== void 0">
83
+ <q-tooltip v-if="Field.Description" anchor="top right">{{ Field.Description }}</q-tooltip>
84
+ {{ Field.Label || '' }}
117
85
  <span v-if="Field.Required" class="required-mark">*</span>
118
86
  </span>
119
87
  <span class="readonly-content">
120
- <span :style="(Field.Info?.Style) ? Field.Info.Style : ''">{{searchDisplay}}</span>
88
+ <span :style="(Field.Info?.Style) ? Field.Info.Style : ''">{{ searchDisplay }}</span>
121
89
  </span>
122
90
  </span>
123
- <q-input
124
- v-else
125
- modelValue=""
126
- :type="`${Field?.Multiple ? 'textarea' : ''}`"
127
- rows="1"
128
- hide-bottom-space
129
- readonly
91
+ <q-input v-else modelValue="" :type="`${Field?.Multiple ? 'textarea' : ''}`" rows="1" hide-bottom-space readonly
130
92
  :class="`${Field?.Multiple
131
- ? '' : 'simple-field'} ${searchDisplay ? 'has-data' : 'empty'}`"
132
- ref="fieldToValid"
133
- @click="searchKey = '';searchData = {}; showSearch = true"
134
- >
93
+ ? '' : 'simple-field'} ${searchDisplay ? 'has-data' : 'empty'}`" ref="fieldToValid"
94
+ @click="searchKey = ''; searchData = {}; showSearch = true">
135
95
  <template v-slot:prepend>
136
- <q-chip
137
- v-for="(selected, index) in searchSelected"
138
- :key="index"
139
- removable
140
- :value="!!searchSelected[index]"
141
- @remove="removeSelected(selected)"
142
- :color="Field.BgColor || 'primary'"
143
- :text-color="Field.Color || 'white'"
144
- >
145
- <q-tooltip
146
- anchor="top right"
147
- >{{selected[(Field.Options?.SearchDisplayField) || 'id']}}</q-tooltip>
148
- {{selected[(Field.Options?.SearchDisplayField) || 'id']}}
96
+ <q-chip v-for="(selected, index) in searchSelected" :key="index" removable :value="!!searchSelected[index]"
97
+ @remove="removeSelected(selected)" :color="Field.BgColor || 'primary'" :text-color="Field.Color || 'white'">
98
+ <q-tooltip anchor="top right">{{ selected[(Field.Options?.SearchDisplayField) || 'id'] }}</q-tooltip>
99
+ {{ selected[(Field.Options?.SearchDisplayField) || 'id'] }}
149
100
  </q-chip>
150
101
  </template>
151
102
  <template v-slot:before>
152
- <span
153
- :class="`field-label ${(Field.Label?.trim().length)
154
- ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
155
- v-if="Field.Label !== void 0"
156
- >
157
- <q-tooltip v-if="Field.Description" anchor="top right">{{Field.Description}}</q-tooltip>
158
- {{Field.Label || ''}}
103
+ <span :class="`field-label ${(Field.Label?.trim().length)
104
+ ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`" v-if="Field.Label !== void 0">
105
+ <q-tooltip v-if="Field.Description" anchor="top right">{{ Field.Description }}</q-tooltip>
106
+ {{ Field.Label || '' }}
159
107
  <span v-if="Field.Required" class="required-mark">*</span>
160
108
  </span>
161
109
  </template>
162
110
  <template v-slot:append>
163
- <q-btn
164
- flat
165
- dense
166
- icon="search"
167
- class="search-btn"
168
- style="width: 36px"
169
- @click="searchKey = '';searchData = {}; showSearch = true"
170
- ></q-btn>
111
+ <q-btn flat dense icon="search" class="search-btn" style="width: 36px"
112
+ @click="searchKey = ''; searchData = {}; showSearch = true"></q-btn>
171
113
  </template>
172
114
  </q-input>
173
115
  <slot name="warning"></slot>
@@ -176,8 +118,8 @@
176
118
 
177
119
  <script>
178
120
  import { defineComponent, getCurrentInstance, watch, ref, computed } from 'vue';
179
- import { useFreeField, freeFieldProps } from 'free-fe-core-modules/free-field/composible/useFreeField';
180
- import { useFormValidator} from 'free-fe-core-modules/composible/useFormValidator';
121
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField.js';
122
+ import { useFormValidator} from '../../composible/useFormValidator.js';
181
123
 
182
124
  export default defineComponent({
183
125
  name: 'InputFieldSearch',