free-fe-core-modules 0.0.3 → 0.0.4

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.
@@ -76,15 +76,26 @@
76
76
 
77
77
  <script>
78
78
  import { defineComponent } from 'vue';
79
- import mixins from 'free-fe-mixins';
79
+ import { useObjectData, objectDataProps } from '../../composible/useObjectData';
80
80
 
81
81
  export default defineComponent({
82
82
  name: 'SummaryHead',
83
- mixins: [mixins.ArrayDataMixin],
84
83
  props: {
84
+ ...objectDataProps,
85
85
  has_multiple_head: { type: Boolean, default: false },
86
86
  values: {type: Object, default: () => ({})},
87
87
  },
88
+ setup(props, ctx) {
89
+ const {
90
+ data,
91
+ refreshData,
92
+ } = useObjectData(props, ctx);
93
+
94
+ return {
95
+ data,
96
+ refreshData,
97
+ };
98
+ },
88
99
  created() {
89
100
  if (this.values) {
90
101
  this.data = this.values;
@@ -100,14 +100,13 @@
100
100
  </template>
101
101
 
102
102
  <script>
103
- import mixins from 'free-fe-mixins';
104
103
  import { defineComponent } from 'vue';
105
104
  import FreeField from '../../free-field/composible/fieldWrapper';
106
105
  import EIcon from '../Basic/EIcon.vue';
107
106
 
108
107
  export default defineComponent({
109
108
  name: 'BasicDialog',
110
- mixins: [mixins.InputFieldValidator],
109
+ // mixins: [mixins.InputFieldValidator],
111
110
  emits: ['hide', 'ok', 'cancel'],
112
111
  props: {
113
112
  persistent: { type: Boolean, default: true },
@@ -26,13 +26,13 @@
26
26
  </template>
27
27
 
28
28
  <script>
29
- import mixins from 'free-fe-mixins';
30
29
  import { defineComponent } from 'vue';
30
+ import { useObjectData, objectDataProps } from '../../composible/useObjectData';
31
31
 
32
32
  export default defineComponent({
33
33
  name: 'SlidingCarousel',
34
- mixins: [mixins.ArrayDataMixin],
35
34
  props: {
35
+ ...objectDataProps,
36
36
  interval: { type: Number, default: 3000 },
37
37
  height: { type: String, default: '220px' },
38
38
  width: { type: String, default: '100%' },
@@ -42,6 +42,17 @@ export default defineComponent({
42
42
  swipeable: { type: Boolean, default: true },
43
43
  thumbnails: { type: Boolean, default: true },
44
44
  },
45
+ setup(props, ctx) {
46
+ const {
47
+ data,
48
+ refreshData,
49
+ } = useObjectData(props, ctx);
50
+
51
+ return {
52
+ data,
53
+ refreshData,
54
+ };
55
+ },
45
56
  data() {
46
57
  return {
47
58
  slide: 0,
@@ -65,13 +65,13 @@
65
65
  </template>
66
66
 
67
67
  <script>
68
- import mixins from 'free-fe-mixins';
69
68
  import { defineComponent } from 'vue';
69
+ import { useObjectData, objectDataProps } from '../../composible/useObjectData';
70
70
 
71
71
  export default defineComponent({
72
72
  name: 'SlidingNews',
73
- mixins: [mixins.ArrayDataMixin],
74
73
  props: {
74
+ ...objectDataProps,
75
75
  interval: { type: Number, default: 3000 },
76
76
  height: { type: String, default: '40px' },
77
77
  width: { type: String, default: '100%' },
@@ -83,6 +83,17 @@ export default defineComponent({
83
83
  transitionPrev: { type: String, default: 'slide-up' },
84
84
  transitionNext: { type: String, default: 'slide-down' },
85
85
  },
86
+ setup(props, ctx) {
87
+ const {
88
+ data,
89
+ refreshData,
90
+ } = useObjectData(props, ctx);
91
+
92
+ return {
93
+ data,
94
+ refreshData,
95
+ };
96
+ },
86
97
  data() {
87
98
  return {
88
99
  visible: true,
@@ -137,7 +137,6 @@ export default defineComponent({
137
137
  })
138
138
 
139
139
  watch(hasThis, (v) => {
140
- console.log('hasThis changed', v)
141
140
  if (v) {
142
141
  // checked from unchecked
143
142
  fieldData.value = fieldData.value || {};
@@ -17,10 +17,10 @@ import fYear from './Year.js';
17
17
  import fYearRange from './YearRange.vue';
18
18
  import fRadioList from './RadioList.vue';
19
19
  import fBoolean from './Boolean.js';
20
- import fFile from './File.vue';
21
- import fFileList from './FileList.vue';
22
- import fImage from './Image.vue';
23
- import fImageList from './ImageList.vue';
20
+ // import fFile from './File.vue';
21
+ // import fFileList from './FileList.vue';
22
+ // import fImage from './Image.vue';
23
+ // import fImageList from './ImageList.vue';
24
24
  import fFixedList from './FixedList.vue';
25
25
  import fDynamicList from './DynamicList.js';
26
26
  import fSingleList from './SingleList.vue';
@@ -32,8 +32,8 @@ import fCustomize from './Customize.js';
32
32
  import fAgreementCheck from './AgreementCheck.js';
33
33
  import fSeparator from './Separator.js';
34
34
  import fQueryFilters from './QueryFilters.vue';
35
- import fFileListCombined from './FileListCombined.vue';
36
- import fImageListCombined from './ImageListCombined.vue';
35
+ // import fFileListCombined from './FileListCombined.vue';
36
+ // import fImageListCombined from './ImageListCombined.vue';
37
37
  import fApiCall from './ApiCall.js';
38
38
 
39
39
  export default {
@@ -56,10 +56,10 @@ export default {
56
56
  YearRange: fYearRange,
57
57
  RadioList: fRadioList,
58
58
  Boolean: fBoolean,
59
- File: fFile,
60
- FileList: fFileList,
61
- Image: fImage,
62
- ImageList: fImageList,
59
+ // File: fFile,
60
+ // FileList: fFileList,
61
+ // Image: fImage,
62
+ // ImageList: fImageList,
63
63
  FixedList: fFixedList,
64
64
  DynamicList: fDynamicList,
65
65
  SingleList: fSingleList,
@@ -71,8 +71,8 @@ export default {
71
71
  AgreementCheck: fAgreementCheck,
72
72
  Separator: fSeparator,
73
73
  QueryFilters: fQueryFilters,
74
- FileListCombined: fFileListCombined,
75
- ImageListCombined: fImageListCombined,
74
+ // FileListCombined: fFileListCombined,
75
+ // ImageListCombined: fImageListCombined,
76
76
  ApiCall: fApiCall,
77
77
  // Static: () => import('./Static.vue'),
78
78
  // Select: () => import('./Select.vue'),
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "free-fe-core-modules",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "main": "index.js",
5
5
  "repository": "git@gitlab.com:eis-base/modules/free-fe-core-modules.git",
6
6
  "author": "zhiquan",
7
7
  "license": "UNLICENSED",
8
8
  "dependencies": {
9
- "@tinymce/tinymce-vue": "^5.0.0"
9
+ "@tinymce/tinymce-vue": "^5.0.1"
10
10
  }
11
11
  }
@@ -91,7 +91,7 @@ import { useObjectData, objectDataProps } from '../../composible/useObjectData';
91
91
 
92
92
  export default defineComponent({
93
93
  name: 'MenuPage',
94
- mixins: [mixins.InputFieldValidator],
94
+ // mixins: [mixins.InputFieldValidator],
95
95
  props: {
96
96
  ...objectDataProps,
97
97
  addMenu: { type: Function, default: () => { } },
@@ -1,382 +0,0 @@
1
- <template>
2
- <div class="row input-field-file">
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
- >
8
- <q-tooltip
9
- v-if="Field.Description"
10
- anchor="top right"
11
- >{{Field.Description}}</q-tooltip>
12
- {{Field.Label || ''}}
13
- <span
14
- v-if="Field.Required"
15
- class="required-mark"
16
- >*</span>
17
- </span>
18
-
19
- <q-uploader
20
- @uploaded="uploaded"
21
- @removed="fieldData = ''; $emit('input')"
22
- @rejected="filesRejected"
23
- ref="uploader"
24
- :factory="factoryFn"
25
- auto-upload
26
- :max-file-size="maxFileSize"
27
- :accept="acceptedFileTypes"
28
- :class="`q-ma-xs ${hasError ? 'input-field--error' : ''}`"
29
- >
30
- <template v-slot:list="scope">
31
- <div
32
- v-if="Field.Options && Field.Options.AsLink && scope.files.length"
33
- class="file-link row full-width ellipsis items-center"
34
- >
35
- <div
36
- class="row ellipsis full-width"
37
- v-for="(file, index) in scope.files"
38
- :key="index"
39
- >
40
- <q-btn
41
- icon="cloud_download"
42
- dense
43
- flat
44
- ></q-btn>
45
- <a
46
- class="ellipsis"
47
- target="_blank"
48
- :href="$filter('serverPath',file.id)"
49
- :download="file.name"
50
- >
51
- {{ file.name }}
52
- <q-tooltip>{{ file.name }}</q-tooltip>
53
- </a>
54
- </div>
55
- </div>
56
- <div v-else>
57
- <div
58
- class="uploader-btns row no-wrap items-center"
59
- v-if="!dense"
60
- >
61
- <q-spinner
62
- v-if="scope.isUploading"
63
- class="q-uploader__spinner"
64
- />
65
- <q-btn
66
- v-if="!scope.isUploading && !Field.ReadOnly"
67
- type="a"
68
- icon="cloud_upload"
69
- dense
70
- flat
71
- class="upload-btn"
72
- label="点击上传"
73
- >
74
- <q-uploader-add-trigger v-if="!Field.ReadOnly" />
75
- </q-btn>
76
- <q-btn
77
- v-if="scope.isUploading && !Field.ReadOnly"
78
- icon="clear"
79
- @click="scope.abort"
80
- class="clear-btn"
81
- round
82
- dense
83
- flat
84
- ></q-btn>
85
- <slot name="warning"></slot>
86
- </div>
87
-
88
- <q-item v-if="dense && scope.files.length">
89
- <q-item-section v-if="scope.files.length && scope.files[0].name">
90
- <q-item-label class="full-width ellipsis">
91
- {{ scope.files[0].name }}
92
- <q-tooltip>{{ scope.files[0].name }}</q-tooltip>
93
- </q-item-label>
94
- </q-item-section>
95
-
96
- <q-item-section side>
97
- <q-btn
98
- v-if="!scope.isUploading && !Field.ReadOnly"
99
- type="a"
100
- icon="cloud_upload"
101
- class="upload-btn"
102
- dense
103
- flat
104
- >
105
- <q-uploader-add-trigger v-if="!Field.ReadOnly" />
106
- </q-btn>
107
- </q-item-section>
108
- </q-item>
109
-
110
- <div
111
- v-else-if="scope.files.length"
112
- class="file-list row items-start justify-start"
113
- >
114
- <q-card
115
- flat
116
- class="file-list-item"
117
- v-for="(file, index) in scope.files"
118
- :key="index"
119
- >
120
- <e-icon
121
- class="file-image"
122
- :name="fileThumb(file)"
123
- thumb
124
- :relative="filePreviewType(file) !== 'image'"
125
- @click="preview(file)"
126
- >
127
- <div class="view-btn-wrapper absolute-full justify-center text-center">
128
- <q-btn
129
- flat
130
- class="view-btn full-height full-width"
131
- >查看</q-btn>
132
- </div>
133
- </e-icon>
134
- <span class="file-name full-width ellipsis">
135
- <a
136
- v-if="file && file.id"
137
- target="_blank"
138
- :href="$filter('serverPath',file.id)"
139
- :download="file.name">
140
- {{ file.name }}
141
- </a>
142
- <span v-else-if="file && file.name">
143
- {{file.name}}
144
- </span>
145
- <q-tooltip>{{ file.name }}</q-tooltip>
146
- </span>
147
-
148
- <span class="file-size full-width ellipsis">
149
- Size: {{ file.sizeLabel || file.__sizeLabel }}
150
- </span>
151
-
152
- <q-btn
153
- flat
154
- dense
155
- round
156
- class="delete-btn"
157
- icon="close"
158
- @click="scope.removeFile(file)"
159
- v-if="!Field.ReadOnly"
160
- />
161
- </q-card>
162
- </div>
163
- <div
164
- class="input-field--error-tag"
165
- v-if="hasError"
166
- >
167
- <e-icon name="error"></e-icon>
168
- </div>
169
- </div>
170
- </template>
171
- </q-uploader>
172
- <q-dialog
173
- class="image-preview-dialog"
174
- flat
175
- full-width
176
- full-height
177
- v-model="showPreview"
178
- style="background: rgba(0,0,0,0)"
179
- >
180
- <div class="image-preview">
181
- <q-img
182
- v-if="previewType=== 'image'"
183
- contain
184
- :src="previewFile"
185
- @click="showPreview=false"
186
- style="height: 100%; max-width: 100%;"
187
- >
188
- </q-img>
189
-
190
- <q-pdfviewer
191
- v-if="previewType === 'pdf'"
192
- v-model="showPreview"
193
- @click="showPreview=false"
194
- @error="pdfError"
195
- @load="pdfLoad"
196
- :src="previewFile"
197
- type="pdfjs"
198
- style="height: 100%; max-width: 100%;"
199
- />
200
- </div>
201
- </q-dialog>
202
- </div>
203
- </template>
204
-
205
- <script>
206
- import { defineComponent } from 'vue';
207
- import mixins from 'free-fe-mixins';
208
-
209
- export default defineComponent({
210
- name: 'InputFieldFile',
211
- mixins: [mixins.UploaderMixin, mixins.InputFieldMixin],
212
- emits:['input'],
213
- fieldInfo: {
214
- Category: 'Upload',
215
- Label: '文件',
216
- Value: 'File',
217
- Extra: [
218
- {
219
- Type: 'String',
220
- Label: '支持的文件类型',
221
- Name: 'Options.Ext',
222
- Default: 'pdf,doc,docx',
223
- },
224
- {
225
- Type: 'String',
226
- Label: '最大文件大小',
227
- Name: 'MaxValue',
228
- Default: '10m',
229
- },
230
- {
231
- Type: 'Boolean',
232
- Label: '紧凑样式',
233
- Name: 'Options.Dense',
234
- Default: false,
235
- },
236
- {
237
- Type: 'Boolean',
238
- Label: '显示为链接',
239
- Name: 'Options.AsLink',
240
- Default: false,
241
- },
242
- ],
243
- Description: '',
244
- },
245
- data() {
246
- return {
247
- hasError: false,
248
- };
249
- },
250
- computed: {
251
- dense() {
252
- return (
253
- !!this.Field
254
- && (!!this.Field.dense
255
- || (!!this.Field.Options && !!this.Field.Options.Dense))
256
- );
257
- },
258
- },
259
- watch: {
260
- fieldData() {
261
- if (this.fieldData) {
262
- try {
263
- this.$refs.uploader.files = typeof this.fieldData === 'string'
264
- ? [JSON.parse(this.fieldData)]
265
- : [this.fieldData];
266
- } catch (ex) {
267
- //
268
- }
269
- }
270
- },
271
- },
272
- mounted() {
273
- if (this.fieldData) {
274
- try {
275
- this.$refs.uploader.files = typeof this.fieldData === 'string'
276
- ? [JSON.parse(this.fieldData)]
277
- : [this.fieldData];
278
- } catch (ex) {
279
- //
280
- }
281
- }
282
- },
283
- methods: {
284
- validate() {
285
- if (this.Field.Required) {
286
- this.hasError = this.$refs.uploader.files.length <= 0;
287
- return this.$refs.uploader.files.length > 0;
288
- }
289
-
290
- const rules = Array.isArray(typeof this.Field.Rules)
291
- ? this.Field.Rules
292
- : [this.Field.Rules];
293
-
294
- let isValid = true;
295
- for (let i = 0; i < rules.length; i += 1) {
296
- const r = rules[i];
297
-
298
- if (typeof r === 'function') {
299
- isValid = isValid && r(this.$refs.uploader.files);
300
- }
301
- }
302
-
303
- this.hasError = !isValid;
304
- return isValid;
305
- },
306
- factoryFn() {
307
- return {
308
- url: this.Field.url || `${this.ctx.config.baseUrl}/upload`,
309
- fieldName: 'file',
310
- };
311
- },
312
- // fileAdded(files) {
313
- // this.$refs.uploader.files = files;
314
- // },
315
- pdfLoad() {
316
- //
317
- },
318
- pdfError() {
319
- //
320
- },
321
- uploaded(info) {
322
- if (info && info.files && info.files.length && info.files[0].xhr) {
323
- const { xhr } = info.files[0];
324
- let res;
325
- if (xhr.response) {
326
- if (typeof xhr.response === 'string') {
327
- //
328
- res = JSON.parse(xhr.response);
329
- } else if (typeof xhr.response === 'object') {
330
- //
331
- res = xhr.response;
332
- } else {
333
- //
334
- return;
335
- }
336
-
337
- if (res && res.msg === 'OK') {
338
- // this.fieldData = JSON.stringify({
339
- // id: res.data.id,
340
- // // eslint-disable-next-line no-underscore-dangle
341
- // sizeLabel: info.files[0].__sizeLabel,
342
- // name: info.files[0].name,
343
- // size: info.files[0].size,
344
- // type: info.files[0].type,
345
- // });
346
-
347
- this.fieldData = {
348
- id: res.data.id,
349
- date: res.data.date || new Date(),
350
- // eslint-disable-next-line no-underscore-dangle
351
- sizeLabel: info.files[0].__sizeLabel,
352
- name: info.files[0].name,
353
- size: info.files[0].size,
354
- type: info.files[0].type,
355
- };
356
-
357
- this.$emit('input');
358
- }
359
- }
360
-
361
- this.validate();
362
- }
363
- },
364
- },
365
- });
366
- </script>
367
-
368
- <style lang="sass" scoped>
369
- .file-link
370
- &>div
371
- display: inline-block
372
- white-space: nowrap
373
- overflow: hidden
374
- & a
375
- white-space: nowrap
376
- overflow: hidden
377
- </style>
378
-
379
- <style lang="sass">
380
- .q-uploader__header
381
- display: none
382
- </style>