free-fe-core-modules 0.0.7 → 0.0.9

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.
Files changed (39) hide show
  1. package/README.md +2 -2
  2. package/components/Basic/SummaryHead.vue +1 -6
  3. package/components/Dialog/BasicDialog.vue +140 -128
  4. package/components/SlidingNews/index.vue +12 -23
  5. package/composible/useFormValidator.js +8 -7
  6. package/composible/useObjectData.js +2 -2
  7. package/free-field/Fields/ApiCall.js +1 -4
  8. package/free-field/Fields/Boolean.js +1 -4
  9. package/free-field/Fields/Check.js +1 -4
  10. package/free-field/Fields/Column.vue +126 -0
  11. package/free-field/Fields/Date.js +1 -4
  12. package/free-field/Fields/DateRange.js +1 -4
  13. package/free-field/Fields/DynamicList.js +1 -4
  14. package/free-field/Fields/Labels.vue +1 -0
  15. package/free-field/Fields/Number.js +3 -6
  16. package/free-field/Fields/NumberRange.vue +145 -0
  17. package/free-field/Fields/Password.js +2 -5
  18. package/free-field/Fields/Permission.vue +1 -0
  19. package/free-field/Fields/PermissionEditor.vue +0 -1
  20. package/free-field/Fields/Row.vue +126 -0
  21. package/free-field/Fields/Search.vue +7 -10
  22. package/free-field/Fields/Select.vue +1 -1
  23. package/free-field/Fields/String.js +1 -4
  24. package/free-field/Fields/Tabs.vue +161 -0
  25. package/free-field/Fields/Text.js +1 -4
  26. package/free-field/Fields/Year.js +1 -4
  27. package/free-field/Fields/index.js +2 -38
  28. package/free-field/composible/fieldWrapper.js +1 -1
  29. package/free-field/composible/useFreeField.js +45 -112
  30. package/i18n/en-us/index.js +64 -67
  31. package/index.js +53 -50
  32. package/package.json +1 -1
  33. package/router/dict/data.js +0 -4
  34. package/router/error/data.js +0 -4
  35. package/router/menu/data.js +0 -4
  36. package/router/system/data.js +3 -4
  37. package/view/dict/index.vue +38 -24
  38. package/view/error/list.vue +17 -20
  39. package/view/menu/index.vue +0 -3
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <a href="https://freeeis.aslancer.com" target="_blank">
2
+ <a href="https://www.freeeis.com" target="_blank">
3
3
  <img
4
4
  src="https://user-images.githubusercontent.com/33030594/227073920-03ed137f-c4f7-4ed7-ae05-d781dd1991f7.png"
5
5
  alt="FreeEIS"
@@ -22,7 +22,7 @@
22
22
 
23
23
  简体中文 | [English](https://github.com/freeeis/.github/blob/main/profile/README.en-us.md)
24
24
 
25
- [更多文档](https://freeeis.aslancer.com)(完善中……)
25
+ [更多文档](https://www.freeeis.com)(完善中……)
26
26
 
27
27
  FreeEIS,是一种可扩展的、企业级系统统一开发框架。FreeEIS旨在解决越来越流行的远程协作开发中,系统拆分及组装的问题。并且通过积累越来越多的功能模块,使得系统的搭建更快捷。
28
28
 
@@ -123,12 +123,7 @@ export default defineComponent({
123
123
  for (let j = 0; j < filters.length; j += 1) {
124
124
  const f = filters[j];
125
125
 
126
- const filterFunc = this.$options.filters[f];
127
- if (filterFunc) {
128
- item.number = filterFunc(
129
- item.number,
130
- );
131
- }
126
+ item.number = this.$filter(f, item.number);
132
127
  }
133
128
 
134
129
  // remove the filter to avoid filter multiple times
@@ -102,7 +102,7 @@
102
102
  </template>
103
103
 
104
104
  <script>
105
- import { defineComponent } from 'vue';
105
+ import { defineComponent, ref, computed } from 'vue';
106
106
  import { useFormValidator } from '../../composible/useFormValidator';
107
107
  import FreeField from '../../free-field/composible/fieldWrapper';
108
108
  import EIcon from '../Basic/EIcon.vue';
@@ -157,168 +157,180 @@ export default defineComponent({
157
157
  FreeField,
158
158
  EIcon,
159
159
  },
160
- setup(props, { expose }) {
160
+ setup(props, { expose, emit }) {
161
161
  const { validate } = useFormValidator('fieldsToValid');
162
- expose({
163
- validate,
164
- })
165
162
 
166
- return {};
167
- },
168
- data() {
169
- return {
170
- timeLeft: 0,
171
- textContent: '',
172
- textValid: true,
173
- timer: undefined,
174
- promise: '',
175
- resolve: '',
176
- reject: '',
177
- };
178
- },
179
- watch: {
180
- visible() {
181
- if (this.visible) {
182
- this.timeout_counter();
183
- this.show();
184
- } else {
185
- this.hide();
186
- }
187
- },
188
- },
189
- computed: {
190
- disabled() {
191
- if (typeof this.okDisabled === 'object') {
192
- return this.okDisabled.value;
193
- }
163
+ const dialog = ref(null);
194
164
 
195
- return this.okDisabled;
196
- },
197
- warningMsg() {
198
- // 设置默认warning
199
- if (!this.showWarning) return '';
165
+ const timeLeft = ref(0),
166
+ textContent = ref(''),
167
+ textValid = ref(true),
168
+ timer = ref(undefined),
169
+ promise = ref(null),
170
+ resolve = ref(null),
171
+ reject = ref(null);
200
172
 
201
- if (!this.warning) {
202
- return '';
173
+ const timeout_counter = () => {
174
+ if (!props.timeout) {
175
+ return;
203
176
  }
204
- return this.warning;
205
- },
206
- },
207
- methods: {
208
- // following method is REQUIRED
209
- // (don't change its name --> "show")
210
- show() {
211
- this.$refs.dialog.show();
212
- this.timeout_counter();
213
-
214
- this.promise = new Promise((resolve, reject) => {
215
- this.resolve = resolve;
216
- this.reject = reject;
177
+
178
+ timeLeft.value = props.timeout;
179
+ timer.value = setInterval(() => {
180
+ timeLeft.value -= 1;
181
+ if (timeLeft.value < 1) {
182
+ clearInterval(timer.value);
183
+ btn_ok();
184
+ }
185
+ }, 1000);
186
+ };
187
+
188
+ const show = () => {
189
+ dialog.value.show();
190
+ timeout_counter();
191
+
192
+ promise.value = new Promise((resv, rej) => {
193
+ resolve.value = resv;
194
+ reject.value = rej;
217
195
  });
218
196
 
219
- return this.promise;
220
- },
197
+ return promise.value;
198
+ };
221
199
 
222
- // following method is REQUIRED
223
- // (don't change its name --> "hide")
224
- hide() {
225
- this.$refs.dialog.hide();
226
- },
227
- onDialogHide() {
228
- // required to be emitted
229
- // when QDialog emits "hide" event
230
- this.$emit('hide');
231
- },
232
- onOKClick() {
233
- // on OK, it is REQUIRED to
234
- // emit "ok" event (with optional payload)
235
- // before hiding the QDialog
236
- // this.$emit('ok');
237
- // or with payload: this.$emit('ok', { ... })
238
-
239
- // // validate
240
- // if (this.validateFunc && typeof this.validateFunc === 'function') {
241
- // // now we only have such content, but later we might will have more
242
- // this.textValid = this.validateFunc(this.textContent);
243
- // if (!this.textValid) return;
244
- // }
245
- if (!this.validate()) {
200
+ const hide = () => {
201
+ dialog.value.hide();
202
+ };
203
+
204
+ const onDialogHide = () => {
205
+ emit('hide');
206
+ };
207
+
208
+ const onOKClick = () => {
209
+ if (!props.canOK || !validate.value()) {
246
210
  return;
247
211
  }
248
212
 
249
- this.$emit('ok');
213
+ emit('ok');
250
214
 
251
- if (this.timer) {
252
- this.timeLeft = 0;
253
- clearInterval(this.timer);
215
+ if (timer.value) {
216
+ timeLeft.value = 0;
217
+ clearInterval(timer.value);
254
218
  }
255
219
 
256
- if (this.resolve) {
257
- if (this.needText) {
258
- this.resolve(this.textContent);
220
+ if (resolve.value) {
221
+ if (props.needText) {
222
+ resolve.value(textContent.value);
259
223
  } else {
260
- this.resolve('confirm');
224
+ resolve.value('confirm');
261
225
  }
262
226
 
263
- this.hide();
264
- this.remove();
227
+ hide();
228
+
229
+ if (typeof props.remove === 'function'){
230
+ props.remove();
231
+ }
265
232
  }
266
- },
267
- btnCancel() {
268
- this.$emit('cancel');
233
+ };
234
+
235
+ const btnCancel = () => {
236
+ if (!props.canCancel) return;
237
+
238
+ emit('cancel');
269
239
 
270
- if (this.timer) {
271
- this.timeLeft = 0;
272
- clearInterval(this.timer);
240
+ if (timer.value) {
241
+ timeLeft.value = 0;
242
+ clearInterval(timer.value);
273
243
  }
274
244
 
275
- if (this.reject) {
276
- this.reject('cancel');
277
- this.remove();
245
+ if (reject.value) {
246
+ reject.value('cancel');
247
+
248
+ if (typeof props.remove === 'function'){
249
+ props.remove();
250
+ }
278
251
  }
279
- },
280
- btn_ok() {
281
- if (!this.validate()) {
252
+ };
253
+
254
+ const btn_ok = () => {
255
+ if (!validate.value()) {
282
256
  return;
283
257
  }
284
258
 
285
- this.$emit('ok');
259
+ emit('ok');
286
260
 
287
- if (this.timer) {
288
- this.timeLeft = 0;
289
- clearInterval(this.timer);
261
+ if (timer.value) {
262
+ timeLeft.value = 0;
263
+ clearInterval(timer.value);
290
264
  }
291
265
 
292
- if (this.resolve) {
293
- if (this.needText) {
294
- this.resolve(this.textContent);
266
+ if (resolve.value) {
267
+ if (props.needText) {
268
+ resolve.value(textContent.value);
295
269
  } else {
296
- this.resolve('confirm');
270
+ resolve.value('confirm');
297
271
  }
298
272
 
299
- this.hide();
300
- this.remove();
273
+ hide();
274
+
275
+ if (typeof props.remove === 'function'){
276
+ props.remove();
277
+ }
301
278
  }
302
- },
303
- timeout_counter() {
304
- if (!this.timeout) {
305
- return;
279
+ };
280
+
281
+ expose({
282
+ validate,
283
+ show,
284
+ hide,
285
+ });
286
+
287
+ watch(() => props.visible, (v) => {
288
+ if (v) {
289
+ timeout_counter();
290
+ show();
291
+ } else {
292
+ hide();
306
293
  }
294
+ });
307
295
 
308
- this.timeLeft = this.timeout;
309
- this.timer = setInterval(() => {
310
- this.timeLeft -= 1;
311
- if (this.timeLeft < 1) {
312
- clearInterval(this.timer);
313
- this.btn_ok();
314
- }
315
- }, 1000);
316
- },
317
- onInputFieldInput(field){
318
- if(field.onInput) {
319
- field.onInput(field);
296
+
297
+ const disabled = computed(() => {
298
+ if (typeof props.okDisabled === 'object') {
299
+ return props.okDisabled.value;
320
300
  }
321
- }
301
+
302
+ return props.okDisabled;
303
+ });
304
+
305
+ const warningMsg = computed(() => {
306
+ // 设置默认warning
307
+ if (!props.showWarning) return '';
308
+
309
+ if (!props.warning) {
310
+ return '';
311
+ }
312
+ return props.warning;
313
+ });
314
+
315
+ return {
316
+ dialog,
317
+ timeLeft,
318
+ textContent,
319
+ textValid,
320
+
321
+ disabled,
322
+ warningMsg,
323
+
324
+ validate,
325
+
326
+ show,
327
+ hide,
328
+ onDialogHide,
329
+ onOKClick,
330
+ btnCancel,
331
+ btn_ok,
332
+ timeout_counter,
333
+ };
322
334
  },
323
335
  });
324
336
  </script>
@@ -37,7 +37,7 @@
37
37
  <q-space />
38
38
  <div class="sliding-news-right"
39
39
  :style="`line-height: ${heightString}`">
40
- {{filter('normalDate',(carouse.PublishDate || carouse.LastUpdateDate))}}
40
+ {{$filter('normalDate',(carouse.PublishDate || carouse.LastUpdateDate))}}
41
41
  </div>
42
42
  </div>
43
43
  </q-carousel-slide>
@@ -105,7 +105,6 @@ export default defineComponent({
105
105
  return {
106
106
  visible: true,
107
107
  slide: 0,
108
- timer: undefined,
109
108
  };
110
109
  },
111
110
  computed: {
@@ -119,18 +118,18 @@ export default defineComponent({
119
118
 
120
119
  return this.height;
121
120
  },
122
- },
123
- localData() {
124
- const fks = Object.keys(this.fields || {});
125
- return (this.data || []).map((dd) => {
126
- const ret = {};
127
- for (let i = 0; i < fks.length; i += 1) {
128
- const fk = fks[i];
129
- ret[fk] = dd[this.fields[fk]];
130
- }
121
+ localData() {
122
+ const fks = Object.keys(this.fields || {});
123
+ return (this.data || []).map((dd) => {
124
+ const ret = {};
125
+ for (let i = 0; i < fks.length; i += 1) {
126
+ const fk = fks[i];
127
+ ret[fk] = dd[this.fields[fk]];
128
+ }
131
129
 
132
- return { ...dd, ...ret };
133
- });
130
+ return { ...dd, ...ret };
131
+ });
132
+ },
134
133
  },
135
134
  methods: {
136
135
  newsClicked(news) {
@@ -142,16 +141,6 @@ export default defineComponent({
142
141
  this.router.push({ path: url });
143
142
  }
144
143
  },
145
- // carouselNext() {
146
- // if (!this.data || this.data.length < 2 || !this.$refs.carousel) {
147
- // return;
148
- // }
149
-
150
- // this.$refs.carousel.next();
151
- // },
152
144
  },
153
- // beforeUnmount() {
154
- // clearInterval(this.timer);
155
- // },
156
145
  });
157
146
  </script>
@@ -7,12 +7,12 @@ export function useFormValidator(...list) {
7
7
  validate: computed(() => {
8
8
  return (...args) => {
9
9
  if (vm.shouldHide) return true;
10
-
10
+
11
11
  // could have customized validate function in component
12
12
  if (vm.selfValidate && typeof vm.selfValidate === 'function') {
13
13
  return vm.selfValidate();
14
14
  }
15
-
15
+
16
16
  const refsList = [];
17
17
  for(let i = 0; i < list.length; i += 1) {
18
18
  if (typeof list[i] === 'string') {
@@ -20,24 +20,25 @@ export function useFormValidator(...list) {
20
20
  } else if (typeof list[i] === 'function') {
21
21
  list[i] = list[i]();
22
22
  }
23
-
23
+
24
24
  if (Array.isArray(list[i])) {
25
25
  refsList.push(...list[i])
26
26
  } else {
27
27
  refsList.push(list[i])
28
28
  }
29
29
  }
30
-
30
+
31
31
  if (refsList.length <= 0) return true;
32
-
32
+
33
33
  let hasErr = false;
34
34
  for (let i = 0; i < refsList.length; i += 1) {
35
35
  let refi = unref(refsList[i]);
36
36
 
37
+ if (!refi) continue;
37
38
 
38
39
  const validFun = unref(refi.validate || refi.methods?.validate || refi.component?.exposed?.validate|| refi.component?.ctx?.validate);
39
40
  const shouldHide = unref(refi.shouldHide || refi.component?.ctx?.shouldHide);
40
-
41
+
41
42
  if (typeof validFun === 'function' && shouldHide !== true) {
42
43
  hasErr = !validFun() || hasErr;
43
44
 
@@ -47,7 +48,7 @@ export function useFormValidator(...list) {
47
48
  }
48
49
  }
49
50
  }
50
-
51
+
51
52
  return !hasErr;
52
53
  };
53
54
  }),
@@ -44,12 +44,12 @@ export function useObjectData(props, ctx) {
44
44
 
45
45
  if (typeof getData === 'function') {
46
46
  Promise.resolve(getData(...args)).then((d) => {
47
- Object.assign(data.value, d);
47
+ Object.assign(data.value, d.value || d);
48
48
  }).finally(() => {
49
49
  callsLeft.value --;
50
50
  });
51
51
  } else {
52
- Object.assign(data.value, getData);
52
+ Object.assign(data.value, getData.value || getData);
53
53
  callsLeft.value --;
54
54
  }
55
55
  }
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, getCurrentInstance, h, ref, watchEffect } from 'vue';
2
- import { useFreeField, freeFieldProps, useFreeFieldMethods } from '../composible/useFreeField';
2
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
3
3
  import ReadonlyContent from '../composible/readonlyContent';
4
4
 
5
5
  export default defineComponent({
@@ -54,9 +54,6 @@ export default defineComponent({
54
54
  props: {
55
55
  ...freeFieldProps,
56
56
  },
57
- methods: {
58
- ...useFreeFieldMethods,
59
- },
60
57
  setup(props, { slots }){
61
58
  if (!props.Field) return {};
62
59
 
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, h, ref } from 'vue';
2
- import { useFreeField, freeFieldProps, useFreeFieldMethods } from '../composible/useFreeField';
2
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
3
3
  import { QToggle } from 'quasar';
4
4
  import freeFieldLabel from '../composible/freeFieldLabel';
5
5
 
@@ -69,9 +69,6 @@ export default defineComponent({
69
69
  ...freeFieldProps,
70
70
  },
71
71
  emits: ['input'],
72
- methods: {
73
- ...useFreeFieldMethods,
74
- },
75
72
  setup(props, { emit, slots }){
76
73
  if (!props.Field) return {};
77
74
 
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, h, ref } from 'vue';
2
- import { useFreeField, freeFieldProps, useFreeFieldMethods } from '../composible/useFreeField';
2
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
3
3
  import { QCheckbox } from 'quasar';
4
4
  import freeFieldLabel from '../composible/freeFieldLabel';
5
5
 
@@ -69,9 +69,6 @@ export default defineComponent({
69
69
  ...freeFieldProps,
70
70
  },
71
71
  emits: ['input'],
72
- methods: {
73
- ...useFreeFieldMethods,
74
- },
75
72
  setup(props, { emit, slots }){
76
73
  if (!props.Field) return {};
77
74
 
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div class="input-field-column column" :class="columnClasses">
3
+ <input-field
4
+ v-for="(field, idx) in Field.Options.List"
5
+ :Field="field"
6
+ :values="fieldData"
7
+ :key="idx"
8
+ @input="$emit('input')"></input-field>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import { InputFieldMixin } from 'eis-admin-mixins';
14
+
15
+ export default {
16
+ name: 'InputFieldColumn',
17
+ mixins: [InputFieldMixin],
18
+ fieldInfo: {
19
+ Category: 'Container',
20
+ Label: '列',
21
+ Value: 'Column',
22
+ Extra: [
23
+ {
24
+ Label: '不换行',
25
+ Name: 'Options.NoWrap',
26
+ Type: 'Bollean',
27
+ },
28
+ {
29
+ Label: '横向对齐',
30
+ Name: 'Options.ItemsAlign',
31
+ Type: 'Select',
32
+ Options: [
33
+ {
34
+ Label: '居上',
35
+ Value: 'items-start',
36
+ },
37
+ {
38
+ Label: '居中',
39
+ Value: 'items-center',
40
+ },
41
+ {
42
+ Label: '居下',
43
+ Value: 'items-end',
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ Label: '竖向对齐',
49
+ Name: 'Options.JustifyAlign',
50
+ Type: 'Select',
51
+ Options: [
52
+ {
53
+ Label: '居左',
54
+ Value: 'justify-start',
55
+ },
56
+ {
57
+ Label: '居中',
58
+ Value: 'justify-center',
59
+ },
60
+ {
61
+ Label: '居右',
62
+ Value: 'justify-end',
63
+ },
64
+ {
65
+ Label: '围绕',
66
+ Value: 'justify-around',
67
+ },
68
+ {
69
+ Label: '之间',
70
+ Value: 'justify-between',
71
+ },
72
+ {
73
+ Label: '均匀',
74
+ Value: 'justify-evently',
75
+ },
76
+ ],
77
+ },
78
+ {
79
+ Label: '字段',
80
+ Name: 'Options.List',
81
+ Type: 'FieldList',
82
+ Options: {
83
+ Columns: [
84
+ {
85
+ Label: '#',
86
+ Name: 'Index',
87
+ sortable: true,
88
+ },
89
+ {
90
+ Label: '类型',
91
+ Name: 'Type',
92
+ style: 'max-width: 120px;',
93
+ sortable: true,
94
+ },
95
+ {
96
+ Label: '名称',
97
+ Name: 'Name',
98
+ style: 'max-width: 200px;',
99
+ },
100
+ {
101
+ Label: '默认',
102
+ Name: 'Default',
103
+ style: 'max-width: 200px;',
104
+ },
105
+ {
106
+ Label: '标题',
107
+ Name: 'Label',
108
+ style: 'max-width: 200px;',
109
+ sortable: true,
110
+ },
111
+ ],
112
+ },
113
+ },
114
+ ],
115
+ Description: '',
116
+ },
117
+ computed: {
118
+ columnClasses() {
119
+ return '';
120
+ },
121
+ },
122
+ };
123
+ </script>
124
+
125
+ <style lang="scss" scoped>
126
+ </style>
@@ -1,6 +1,6 @@
1
1
  import { ref, defineComponent, getCurrentInstance, h, computed } from 'vue';
2
2
  import { QInput, QIcon, QPopupProxy, QDate } from 'quasar';
3
- import { useFreeField, freeFieldProps, useFreeFieldMethods } from '../composible/useFreeField';
3
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
4
4
  import freeFieldLabel from '../composible/freeFieldLabel';
5
5
  import { useFormValidator} from '../../composible/useFormValidator';
6
6
 
@@ -38,9 +38,6 @@ export default defineComponent({
38
38
  ...freeFieldProps,
39
39
  },
40
40
  emits: ['input'],
41
- methods: {
42
- ...useFreeFieldMethods,
43
- },
44
41
  setup(props, { emit, slots, expose }){
45
42
  if (!props.Field) return {};
46
43