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
@@ -35,6 +35,7 @@ import fQueryFilters from './QueryFilters.vue';
35
35
  // import fFileListCombined from './FileListCombined.vue';
36
36
  // import fImageListCombined from './ImageListCombined.vue';
37
37
  import fApiCall from './ApiCall.js';
38
+ import fTabs from './Tabs.vue';
38
39
 
39
40
  export default {
40
41
  Static: fStatic,
@@ -74,42 +75,5 @@ export default {
74
75
  // FileListCombined: fFileListCombined,
75
76
  // ImageListCombined: fImageListCombined,
76
77
  ApiCall: fApiCall,
77
- // Static: () => import('./Static.vue'),
78
- // Select: () => import('./Select.vue'),
79
- // String: () => import('./String.vue'),
80
- // Password: () => import('./Password.vue'),
81
- // Category: () => import('./Category.vue'),
82
- // Check: () => import('./Check.vue'),
83
- // Labels: () => import('./Labels.vue'),
84
- // Number: () => import('./Number.vue'),
85
- // Permission: () => import('./Permission.vue'),
86
- // Search: () => import('./Search.vue'),
87
- // Text: () => import('./Text.vue'),
88
- // Time: () => import('./Time.vue'),
89
- // TimeRange: () => import('./TimeRange.vue'),
90
- // Date: () => import('./Date.vue'),
91
- // DateRange: () => import('./DateRange.vue'),
92
- // Year: () => import('./Year.vue'),
93
- // YearRange: () => import('./YearRange.vue'),
94
- // RadioList: () => import('./RadioList.vue'),
95
- // Boolean: () => import('./Boolean.vue'),
96
- // File: () => import('./File.vue'),
97
- // FileList: () => import('./FileList.vue'),
98
- // Image: () => import('./Image.vue'),
99
- // ImageList: () => import('./ImageList.vue'),
100
- // FixedList: () => import('./FixedList.vue'),
101
- // DynamicList: () => import('./DynamicList.vue'),
102
- // SingleList: () => import('./SingleList.vue'),
103
- // SelectionChain: () => import('./SelectionChain.vue'),
104
- // Rich: () => import('./Rich.vue'),
105
- // FieldEditor: () => import('./FieldEditor.vue'),
106
- // FieldList: () => import('./InputFieldList.vue'),
107
- // MixedTable: () => import('./MixedTable.vue'),
108
- // Customize: () => import('./Customize.vue'),
109
- // AgreementCheck: () => import('./AgreementCheck.vue'),
110
- // Separator: () => import('./Separator.vue'),
111
- // QueryFilters: () => import('./QueryFilters.vue'),
112
- // FileListCombined: () => import('./FileListCombined.vue'),
113
- // ImageListCombined: () => import('./ImageListCombined.vue'),
114
- // ApiCall: () => import('./ApiCall.vue'),
78
+ Tabs: fTabs,
115
79
  };
@@ -197,7 +197,7 @@ export default defineComponent({
197
197
  onInput: () => {
198
198
  emit("input", props.Field);
199
199
  },
200
- ...compEmits,
200
+ ...compEmits.value,
201
201
  },
202
202
  {
203
203
  ...slots,
@@ -1,85 +1,63 @@
1
- import { reactive, watch, watchEffect } from "vue";
1
+ import { reactive, getCurrentInstance, watchEffect } from "vue";
2
2
 
3
3
  export const freeFieldProps = {
4
4
  values: { type: Object },
5
5
  Field: { type: Object },
6
6
  };
7
7
 
8
- export function useFreeField(props) {
8
+ export function useFreeField(props, ctx) {
9
+ const { proxy:vm } = getCurrentInstance();
9
10
  const fieldData = reactive({});
10
11
 
11
12
  watchEffect(() => {
12
- fieldData.value = Object.nestValue(props.values, props.Field?.Name);
13
-
14
- // TODO:following is from the old mixins, should we add more logic here accordingly?
15
- // let realData;
16
- // if (!this.Field) {
17
- // // return undefined;
18
- // } else if (!this.Field.Name) {
19
- // // this.fieldData = this.Field.Value || this.Field.Default || undefined;
20
- // realData = this.Field.Value || this.Field.Default || undefined;
21
- // } else {
22
- // let isnull = false;
23
- // if (this.Field && this.Field.Info && this.Field.Info.Dynamic && this.Field.Value) {
24
- // realData = this.Field.Value;
25
- // isnull = typeof realData === 'undefined';
26
- // } else {
27
- // realData = this.data;
28
-
29
- // if (this.Field.Name !== '.') {
30
- // const nameList = this.Field.Name.split('.');
31
-
32
- // for (let i = 0; i < nameList.length; i += 1) {
33
- // const name = nameList[i];
34
-
35
- // // if (!realData) return undefined;
36
- // if (typeof realData === 'undefined' || realData === null) {
37
- // isnull = true;
38
- // break;
39
- // } else {
40
- // realData = name ? realData[name] : realData;
41
- // }
42
- // }
43
- // }
44
- // }
45
-
46
- // if (!isnull) {
47
- // // for non-dynamic field, which have refer data, we should save this data into the field
48
- // if ((typeof realData === 'undefined') && (this.Field.Value || this.Field.Default)) {
49
- // realData = this.Field.Value || this.Field.Default;
13
+ let realData = void 0;
14
+
15
+ if (!props.Field) {
16
+ return;
17
+ }
18
+
19
+ if (!props.Field.Name) {
20
+ realData = props.Field.Value || props.Field.Default || undefined;
21
+ } else {
22
+ if (props.Field.Info?.Dynamic && props.Field.Value) {
23
+ realData = props.Field.Value;
24
+ } else {
25
+ realData = Object.nestValue(props.values, props.Field?.Name);
26
+ }
27
+ }
50
28
 
51
- // if (this.Field && this.Field.ReferTo && (!this.Field.Info || !this.Field.Info.Dynamic)) {
52
- // this.$emit('input');
53
- // }
54
- // }
29
+ // set to default if still undefined
30
+ if ((realData === void 0 || realData === null) && (props.Field.Value || props.Field.Default)) {
31
+ realData = props.Field.Value || props.Field.Default;
55
32
 
56
- // // realData = (typeof realData === 'undefined') ? (this.Field.Value || this.Field.Default) : realData;
33
+ // for non-dynamic field, which have refer data, we should save this data into the field
34
+ if (props.Field.ReferTo && !props.Field.Info?.Dynamic) {
35
+ ctx.emit('input');
36
+ }
37
+ }
57
38
 
58
- // if (this.Field.Options && this.Field.Options.Filters) {
59
- // let filters = [];
60
- // if (typeof this.Field.Options.Filters === 'string') {
61
- // // only one filter
62
- // filters.push(this.Field.Options.Filters);
63
- // } else if (Array.isArray(this.Field.Options.Filters)) {
64
- // filters = filters.concat(this.Field.Options.Filters);
65
- // }
39
+ // filter data
40
+ if (props.Field.Options && props.Field.Options.Filters) {
41
+ let filters = [];
42
+ if (typeof props.Field.Options.Filters === 'string') {
43
+ // only one filter
44
+ filters.push(props.Field.Options.Filters);
45
+ } else if (Array.isArray(props.Field.Options.Filters)) {
46
+ filters = filters.concat(props.Field.Options.Filters);
47
+ }
66
48
 
67
- // for (let i = 0; i < filters.length; i += 1) {
68
- // const f = filters[i];
69
- // const filter = this.$options.filters[f];
70
- // if (filter) {
71
- // realData = filter(realData);
72
- // }
73
- // }
74
- // }
75
- // }
76
- // }
49
+ for (let i = 0; i < filters.length; i += 1) {
50
+ const f = filters[i];
51
+ realData = vm.$filter(f, realData)
52
+ }
53
+ }
77
54
 
78
- // if ((typeof realData === 'undefined' || realData === null || !realData) && this.Field.Info && this.Field.Info.ShowNaN) {
79
- // return this.ctx.config.nanPlaceholder || '';
80
- // }
55
+ // show NaN placeholder
56
+ if ((realData === void 0 || realData === null || realData === '') && props.Field?.Info?.ShowNaN) {
57
+ return vm.ctx.config.nanPlaceholder || '';
58
+ }
81
59
 
82
- // return realData;
60
+ fieldData.value = realData;
83
61
  });
84
62
 
85
63
  return {
@@ -96,48 +74,3 @@ export function useFreeField(props) {
96
74
  },
97
75
  }
98
76
  };
99
-
100
-
101
- // TODO: make function for validating all fields in the current component
102
- function validate() {
103
- if (this.shouldHide) return true;
104
-
105
- // could have customized validate function in component
106
- if (this.selfValidate && typeof this.selfValidate === 'function' && !this.selfValidate()) {
107
- return false;
108
- }
109
-
110
- const validators = Object.keys(this.$refs).filter((k) => k.startsWith('input_field_validator_'));
111
- if (!validators || validators.length <= 0) {
112
- return true;
113
- }
114
-
115
- let hasError = false;
116
- for (let i = 0; i < validators.length; i += 1) {
117
- const valid = validators[i];
118
-
119
- if (this.$refs[valid]) {
120
- if (Array.isArray(this.$refs[valid])) {
121
- for (let j = 0; j < this.$refs[valid].length; j += 1) {
122
- const sv = this.$refs[valid][j];
123
-
124
- if (sv.shouldHide !== true) {
125
- if (typeof sv.validate === 'function') {
126
- hasError = !sv.validate() || hasError;
127
- }
128
- }
129
- }
130
- } else if (typeof this.$refs[valid].validate === 'function') {
131
- if (this.$refs[valid].shouldHide !== true) {
132
- hasError = !this.$refs[valid].validate() || hasError;
133
- }
134
- }
135
- }
136
- }
137
-
138
- return !hasError;
139
- };
140
-
141
- export const useFreeFieldMethods = {
142
- validate,
143
- };
@@ -1,73 +1,70 @@
1
1
  export default {
2
- justNow: 'just now',
3
- secondsAgo: 'seconds ago',
4
- minutesAgo: 'minutes ago',
5
- hoursAgo: 'hours ago',
6
- daysAgo: 'days ago',
7
- monthsAgo: 'months ago',
8
- yearsAgo: 'yearsAgo',
9
- SwitchTheme: 'Switch Theme',
2
+ justNow: 'just now',
3
+ secondsAgo: 'seconds ago',
4
+ minutesAgo: 'minutes ago',
5
+ hoursAgo: 'hours ago',
6
+ daysAgo: 'days ago',
7
+ monthsAgo: 'months ago',
8
+ yearsAgo: 'yearsAgo',
9
+ SwitchTheme: 'Switch Theme',
10
10
 
11
- validatorNotEmptyName: "非空",
12
- validatorNotEmptyDescription: "不能为空",
13
- validatorMobilePhoneName: "手机号",
14
- validatorMobilePhoneDescription: "中国手机号码格式",
15
- validatorEmailName: "邮箱",
16
- validatorEmailDescription: "",
17
- validatorPhoneOrEmailName: "手机号或邮箱",
18
- validatorPhoneOrEmailDescription: "",
19
- validatorChinaIDNumberName: "中国身份证号码",
20
- validatorChinaIDNumberDescription: "",
11
+ validatorNotEmptyName: "non-empty",
12
+ validatorNotEmptyDescription: "Cannot be empty",
13
+ validatorMobilePhoneName: "Phone Number",
14
+ validatorMobilePhoneDescription: "Chinese Mobile Number Format",
15
+ validatorEmailName: "mailbox",
16
+ validatorEmailDescription: "",
17
+ validatorPhoneOrEmailName: "mobile phone number or email",
18
+ validatorPhoneOrEmailDescription: "",
19
+ validatorChinaIDNumberName: "Chinese ID Number",
20
+ validatorChinaIDNumberDescription: "",
21
21
 
22
- validatorOnlyNumberName: "只能是数字",
23
- validatorOnlyNumberDescription: "",
24
- validatorOnlyCharName: "只能是字母",
25
- validatorOnlyCharDescription: "",
26
- validatorOnlyUpCharName: "只能是大写字母",
27
- validatorOnlyUpCharDescription: "",
28
- validatorOnlyLowerCharName: "只能是小写字母",
29
- validatorOnlyLowerCharDescription: "",
30
- validatorOnlyChineseName: "只能是中文",
31
- validatorOnlyChineseDescription: "",
32
- validatorOnlyCCName: "只能是中文或字母",
33
- validatorOnlyCCDescription: "",
34
- validatorOnlyCCNName: "只能是中文或字母或数字",
35
- validatorOnlyCCNDescription: "",
36
- validatorOnlyCNName: "只能是中文或数字",
37
- validatorOnlyCNDescription: "",
38
- validatorOnlyCNUName: "只能是中文或数字或下划线",
39
- validatorOnlyCNUDescription: "",
40
- validatorOnlyCNSName: "只能是中文或数字或特殊字符",
41
- validatorOnlyCNSDescription:
42
- `只能是中文或数字或("."、{'@'}、"<"、">"、"_"、"?")`,
22
+ validatorOnlyNumberName: "number only",
23
+ validatorOnlyNumberDescription: "",
24
+ validatorOnlyCharName: "letters only",
25
+ validatorOnlyCharDescription: "",
26
+ validatorOnlyUpCharName: "uppercase letters only",
27
+ validatorOnlyUpCharDescription: "",
28
+ validatorOnlyLowerCharName: "lowercase letters only",
29
+ validatorOnlyLowerCharDescription: "",
30
+ validatorOnlyChineseName: "Chinese only",
43
31
 
44
- validatorOnlyIntegerName: "只能是整数",
45
- validatorOnlyIntegerDescription: "",
46
- validatorOnlyPIName: "只能是正整数",
47
- validatorOnlyPIDescription: "",
48
- validatorOnlyPIZName: "只能是正整数或零",
49
- validatorOnlyPIZDescription: "",
50
- validatorOnlyNIName: "只能是负整数",
51
- validatorOnlyNIDescription: "",
52
- validatorOnlyNIZName: "只能是负整数或零",
53
- validatorOnlyNIZDescription: "",
32
+ validatorOnlyChineseDescription: "",
33
+ validatorOnlyCCName: "Chinese or letters",
34
+ validatorOnlyCCDescription: "",
35
+ validatorOnlyCCNName: "Chinese or letters or numbers",
36
+ validatorOnlyCCNDescription: "",
37
+ validatorOnlyCNName: "Chinese or numbers",
38
+ validatorOnlyCNDescription: "",
39
+ validatorOnlyCNUName: "Chinese or numbers or underscores",
40
+ validatorOnlyCNUDescription: "",
41
+ validatorOnlyCNSName: "Chinese or numbers or special characters",
42
+ validatorOnlyCNSDescription: `Chinese or a number or ("."、{'@'}、"<"、">"、"_"、"?")`,
54
43
 
55
- validatorUrlName: "URL地址",
56
- validatorUrlDescription: "",
57
- validatorOfficePhoneName: "固定电话号码",
58
- validatorOfficePhoneDescription: "固定电话号码(区号-号码)",
59
- validatorChinaZipName: "中国邮政编码",
60
- validatorChinaZipDescription: "",
44
+ validatorOnlyIntegerName: "integer only",
45
+ validatorOnlyIntegerDescription: "",
46
+ validatorOnlyPIName: "a positive integer",
47
+ validatorOnlyPIDescription: "",
48
+ validatorOnlyPIZName: "positive integers or zero",
49
+ validatorOnlyPIZDescription: "",
50
+ validatorOnlyNIName: "negative integers",
51
+ validatorOnlyNIDescription: "",
52
+ validatorOnlyNIZName: "a negative integer or zero",
53
+ validatorOnlyNIZDescription: "",
61
54
 
62
- validatorPwd1Name: "密码(强度一)",
63
- validatorPwd1Description: "长度在6-16位之间的任意密码",
64
- validatorPwd2Name: "密码(强度二)",
65
- validatorPwd2Description:
66
- "长度在6-16位的密码,必须包含数字、大写字母、小写字母",
67
- validatorPwd3Name: "密码(强度三)",
68
- validatorPwd3Description:
69
- "长度在6-16位的密码,必须包含数字、大写字母、小写字母、特殊字符",
70
- validatorPwd4Name: "密码(强度四)",
71
- validatorPwd4Description:
72
- "长度在6-16位的密码,必须包含数字、至少2个大写字母、至少2个小写字母、特殊字符",
73
- }
55
+ validatorUrlName: "URL address",
56
+ validatorUrlDescription: "",
57
+ validatorOfficePhoneName: "landline",
58
+ validatorOfficePhoneDescription: "landline (area code - number)",
59
+ validatorChinaZipName: "China Postal Code",
60
+ validatorChinaZipDescription: "",
61
+
62
+ validatorPwd1Name: "Password (strength one)",
63
+ validatorPwd1Description: "Any password between 6-16 digits in length",
64
+ validatorPwd2Name: "Password (Strength Two)",
65
+ validatorPwd2Description: "Passwords 6-16 digits in length, must contain numbers, uppercase letters, lowercase letters",
66
+ validatorPwd3Name: "Password (strength three)",
67
+ validatorPwd3Description: "Passwords 6-16 characters in length, must contain numbers, uppercase letters, lowercase letters, special characters",
68
+ validatorPwd4Name: "Password (strength four)",
69
+ validatorPwd4Description: "A password of 6-16 digits in length must contain numbers, at least 2 uppercase letters, at least 2 lowercase letters, special characters",
70
+ }
package/index.js CHANGED
@@ -27,17 +27,17 @@ const filters = {
27
27
 
28
28
  return url ? `${config.imageUrlBase}${url}` : '';
29
29
  },
30
- serverVideo: (url) => {
30
+ serverVideo: (url) => {
31
31
  if (typeof url === 'string' && url.startsWith('@')) return url.substring(1);
32
32
 
33
33
  return url ? `${config.videoUrlBase}${url}` : '';
34
34
  },
35
- serverThumb: (url) => {
35
+ serverThumb: (url) => {
36
36
  if (typeof url === 'string' && url.startsWith('@')) return url.substring(1);
37
37
 
38
38
  return url ? `${config.thumbUrlBase}${url}` : '';
39
39
  },
40
- serverDocument: (url) => {
40
+ serverDocument: (url) => {
41
41
  if (typeof url === 'string' && url.startsWith('@')) return url.substring(1);
42
42
 
43
43
  return url ? `${config.documentUrlBase}${url}` : '';
@@ -125,7 +125,8 @@ const filters = {
125
125
  let diff = quasarDate.getDateDiff(date1, date2, 'seconds');
126
126
  if (diff < 1) {
127
127
  return diff + Vue.prototype.$t('justNow');
128
- } if (diff < 60) {
128
+ }
129
+ if (diff < 60) {
129
130
  return diff + Vue.prototype.$t('secondsAgo');
130
131
  }
131
132
 
@@ -151,6 +152,27 @@ const filters = {
151
152
  diff = quasarDate.getDateDiff(date1, date2, 'years');
152
153
  return diff + Vue.prototype.$t('yearsAgo');
153
154
  },
155
+ stepCaption: (step, status, data) => {
156
+ if (!step) return '';
157
+ if (step && typeof step.Description === 'string') return step.Description;
158
+
159
+ let desc = '';
160
+ if (step && Array.isArray(step.Description)) {
161
+ let stepStatus;
162
+ if (data && data.Steps) {
163
+ const rStep = data.Steps[step.Index];
164
+ if (rStep) {
165
+ stepStatus = rStep.Status;
166
+ }
167
+ }
168
+ desc = step.Description.find((s) => s.Status === (status || stepStatus || '').toString());
169
+ desc = desc ? desc.Description : '';
170
+ desc = desc;
171
+ }
172
+
173
+ desc = desc || '未知状态';
174
+ return desc;
175
+ },
154
176
  };
155
177
 
156
178
  export default (app, root) => {
@@ -161,8 +183,7 @@ export default (app, root) => {
161
183
  return {
162
184
  config: {
163
185
  backendDependencies: ["core-modules"],
164
- dictFields: [
165
- {
186
+ dictFields: [{
166
187
  Type: 'Category',
167
188
  Label: '字典数据信息',
168
189
  },
@@ -191,17 +212,14 @@ export default (app, root) => {
191
212
  Type: 'Tabs',
192
213
  Label: '显示内容',
193
214
  DataType: 'Array',
194
- Default: [
195
- {
196
- Locale: appStore.locale || app.config.defaultLocale,
197
- },
198
- ],
215
+ Default: [{
216
+ Locale: appStore.locale || app.config.defaultLocale,
217
+ }, ],
199
218
  Options: {
200
219
  Dense: true,
201
220
  LabelField: 'Name',
202
221
  ValueField: 'Locale',
203
- List: [
204
- {
222
+ List: [{
205
223
  Name: 'Locale',
206
224
  Label: '语言',
207
225
  Type: 'String',
@@ -242,7 +260,11 @@ export default (app, root) => {
242
260
  Label: '图片/图标/文件',
243
261
  Type: 'File',
244
262
  MaxValue: '100m',
245
- Options: { Dense: false, AsLink: false, Ext: 'jpg,png,pdf,doc,docx,zip' },
263
+ Options: {
264
+ Dense: false,
265
+ AsLink: false,
266
+ Ext: 'jpg,png,pdf,doc,docx,zip'
267
+ },
246
268
  Tips: [{
247
269
  Text: '文件不可超过100M。格式支持:PNG、JPG、PDF、DOC、DOCX、ZIP。',
248
270
  }],
@@ -255,9 +277,9 @@ export default (app, root) => {
255
277
  Name: 'Info',
256
278
  Label: '附加信息',
257
279
  Type: 'Text',
258
- }],
259
- menuFields: [
260
- {
280
+ }
281
+ ],
282
+ menuFields: [{
261
283
  Type: "Category",
262
284
  Label: "菜单信息",
263
285
  },
@@ -306,6 +328,10 @@ export default (app, root) => {
306
328
  NoDataScope: true,
307
329
  },
308
330
  ],
331
+
332
+ defaultInputFieldPlaceholder: '',
333
+ defaultSelectFieldPlaceholder: '',
334
+ defaultSearchFieldPlaceholder: '',
309
335
  },
310
336
  routers,
311
337
  filters,
@@ -326,25 +352,12 @@ export default (app, root) => {
326
352
  fieldComponents: FieldComponents.fieldComponents,
327
353
 
328
354
  validators: {
329
- validatorNotEmpty: (d) =>
330
- d && d.length > 0 && d.trim().length > 0,
331
- validatorMobilePhone: (d) =>
332
- !d || /^(0|86|17951)?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$/.test(
333
- d
334
- ),
335
- validatorEmail: (d) =>
336
- !d || /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
337
- d
338
- ),
339
- validatorPhoneOrEmail: (d) =>
340
- d !== void 0 &&
341
- d.length > 0 &&
342
- (this.validatorMobilePhone(d) || this.validatorEmail(d)),
355
+ validatorNotEmpty: (d) => d !== void 0 && d.length > 0 && d.trim().length > 0,
356
+ validatorMobilePhone: (d) => !d || /^(0|86|17951)?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$/.test(d),
357
+ validatorEmail: (d) => !d || /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(d),
358
+ validatorPhoneOrEmail: (d) => d !== void 0 && d.length > 0 && (this.validatorMobilePhone(d) || this.validatorEmail(d)),
343
359
  // validatorMinLength: (d, len = 0) => d !== undefined && d.length >= len,
344
- validatorChinaIDNumber: (d) =>
345
- !d || /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(
346
- d
347
- ),
360
+ validatorChinaIDNumber: (d) => !d || /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(d),
348
361
  // validatorSame: (d, to) => d === to,
349
362
  // validatorDifferent: (d, to) => d !== to,
350
363
  // validatorGT: (d, to) => d > to,
@@ -369,26 +382,16 @@ export default (app, root) => {
369
382
  validatorOnlyNIZ: (d) => /^([0]|-[1-9][0-9]+)$/.test(d.toString()),
370
383
 
371
384
  //
372
- validatorUrl: (d) =>
373
- /^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?/.test(
374
- d
375
- ),
385
+ validatorUrl: (d) => /^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?/.test(d),
376
386
  validatorOfficePhone: (d) => /^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{8}$/.test(d),
377
387
  validatorChinaZip: (d) => /^[1-9]{1}(\d+){5}$/.test(d),
378
388
 
379
389
  // password
380
390
  validatorPwd0: (d) => /^.*(?=.{6,16}).*$/.test(d),
381
391
  validatorPwd1: (d) => /^.{6,16}$/.test(d),
382
- validatorPwd2: (d) =>
383
- /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z]).*$/.test(d),
384
- validatorPwd3: (d) =>
385
- /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?\(\)]).*$/.test(
386
- d
387
- ),
388
- validatorPwd4: (d) =>
389
- /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z]{2,})(?=.*[a-z]{2,})(?=.*[!@#$%^&*?\(\)]).*$/.test(
390
- d
391
- ),
392
+ validatorPwd2: (d) => /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z]).*$/.test(d),
393
+ validatorPwd3: (d) => /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?\(\)]).*$/.test(d),
394
+ validatorPwd4: (d) => /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z]{2,})(?=.*[a-z]{2,})(?=.*[!@#$%^&*?\(\)]).*$/.test(d),
392
395
  },
393
396
  }
394
- };
397
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "free-fe-core-modules",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/freeeis/free-fe-core-modules.git",
6
6
  "author": "zhiquan",
@@ -1,11 +1,8 @@
1
- // import Vue from 'vue';
2
1
  import {
3
2
  getDict,
4
3
  createDict, updateDict, deleteDict,
5
4
  } from './api';
6
5
 
7
- // const bus = new Vue();
8
-
9
6
  const CHINA_NUMBERS = ' 一二三四五六七八九十';
10
7
 
11
8
  export default {
@@ -43,6 +40,5 @@ export default {
43
40
  addDict: (d) => createDict(d),
44
41
  editDict: (d) => updateDict(d),
45
42
  deleteDict: (d) => deleteDict(d),
46
- // Bus: bus,
47
43
  }),
48
44
  };
@@ -1,11 +1,8 @@
1
- // import Vue from 'vue';
2
1
  import { getErrorCode } from './api';
3
2
 
4
3
  import { i18n } from '@/boot/i18n';
5
4
  const {global:{t}} = i18n;
6
5
 
7
- // const bus = new Vue();
8
-
9
6
  export default {
10
7
  list: (app) => () => ({
11
8
  GetData: (o) => getErrorCode(o).then((data) => {
@@ -31,6 +28,5 @@ export default {
31
28
 
32
29
  return d;
33
30
  }),
34
- // Bus: bus,
35
31
  }),
36
32
  };
@@ -1,11 +1,8 @@
1
- // import Vue from 'vue';
2
1
  import {
3
2
  getMenus,
4
3
  createMenu, updateMenu, deleteMenu,
5
4
  } from './api';
6
5
 
7
- // const bus = new Vue();
8
-
9
6
  const CHINA_NUMBERS = ' 一二三四五六七八九十';
10
7
 
11
8
  export default {
@@ -80,6 +77,5 @@ export default {
80
77
  addMenu: (d) => createMenu(d),
81
78
  editMenu: (d) => updateMenu(d),
82
79
  deleteMenu: (d) => deleteMenu(d),
83
- // Bus: bus,
84
80
  }),
85
81
  };
@@ -1,7 +1,7 @@
1
- // import Vue from 'vue';
2
1
  import { getConfig } from './api';
2
+ import { i18n } from '@/boot/i18n';
3
3
 
4
- // const bus = new Vue();
4
+ const {global:{t}} = i18n;
5
5
 
6
6
  export default {
7
7
  systemConfig: () => ({
@@ -28,7 +28,7 @@ export default {
28
28
  Index: i + 1,
29
29
  Actions: [
30
30
  {
31
- Label: '保存',
31
+ Label: t('保存'),
32
32
  Action: 'save',
33
33
  },
34
34
  ],
@@ -41,6 +41,5 @@ export default {
41
41
 
42
42
  return data;
43
43
  }),
44
- // Bus: bus,
45
44
  }),
46
45
  };