free-fe-core-modules 0.0.6 → 0.0.8

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,6 +1,6 @@
1
1
  import { defineComponent, h, ref, computed } from 'vue';
2
2
  import { QInput, QIcon } 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
 
@@ -29,9 +29,6 @@ export default defineComponent({
29
29
  ...freeFieldProps,
30
30
  },
31
31
  emits: ['input'],
32
- methods: {
33
- ...useFreeFieldMethods,
34
- },
35
32
  setup(props, { emit, slots, expose }){
36
33
  if (!props.Field) return {};
37
34
 
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div class="input-field-row row" :class="rowClasses">
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: 'InputFieldRow',
17
+ mixins: [InputFieldMixin],
18
+ fieldInfo: {
19
+ Category: 'Container',
20
+ Label: '行',
21
+ Value: 'Row',
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
+ rowClasses() {
119
+ return '';
120
+ },
121
+ },
122
+ };
123
+ </script>
124
+
125
+ <style lang="scss" scoped>
126
+ </style>
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, h, computed } from 'vue';
2
- import { useFreeField, freeFieldProps, useFreeFieldMethods } from '../composible/useFreeField';
2
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
3
3
  import { QInput } from 'quasar';
4
4
  import ReadonlyContent from '../composible/readonlyContent';
5
5
  import freeFieldLabel from '../composible/freeFieldLabel';
@@ -49,9 +49,6 @@ export default defineComponent({
49
49
  ...freeFieldProps,
50
50
  },
51
51
  emits: ['input'],
52
- methods: {
53
- ...useFreeFieldMethods,
54
- },
55
52
  setup(props, { emit, slots, expose }){
56
53
  if (!props.Field) return {};
57
54
 
@@ -0,0 +1,162 @@
1
+ <template>
2
+ <div class="input-field-tabs row no-wrap" 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
+ >
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
+ <div class="col input-field-tabs-tabs-wrapper">
20
+ <q-tabs
21
+ class="tabs"
22
+ v-model="tab"
23
+ :shrink="true"
24
+ no-caps
25
+ :vertical="Field.Options.vertical || false"
26
+ :align="Field.Options.align || 'left'"
27
+ :dense="Field.Options && Field.Options.dense">
28
+ <q-tab
29
+ v-for="(t, idx) in fieldData.value" :key="idx"
30
+ :name="idx"
31
+ :label="t[Field.Options.LabelField]"
32
+ :dense="Field.Options && Field.Options.dense">
33
+ </q-tab>
34
+ </q-tabs>
35
+ <q-tab-panels v-model="tab">
36
+ <q-tab-panel
37
+ v-for="(t, idx) in fieldData.value" :key="idx"
38
+ :name="idx">
39
+ <free-field
40
+ v-for="(field, idx) in Field.Options.List"
41
+ :Field="field"
42
+ :values="t"
43
+ :key="idx"
44
+ ref="fieldsToValidate"
45
+ @input="fieldChanged"></free-field>
46
+ </q-tab-panel>
47
+ </q-tab-panels>
48
+ </div>
49
+ </div>
50
+ </template>
51
+
52
+ <script>
53
+ import { defineComponent, ref } from 'vue';
54
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
55
+ import { useFormValidator} from '../../composible/useFormValidator';
56
+
57
+ export default defineComponent({
58
+ name: 'InputFieldTabs',
59
+ fieldInfo: {
60
+ DataType: 'Array',
61
+ Category: 'Container',
62
+ Label: '标签页',
63
+ Value: 'Tabs',
64
+ Extra: [
65
+ {
66
+ Type: 'String',
67
+ Label: '标签字段名',
68
+ Name: 'Options.LabelField',
69
+ },
70
+ {
71
+ Type: 'String',
72
+ Label: '数值字段名',
73
+ Name: 'Options.ValueField',
74
+ },
75
+ {
76
+ Label: '字段',
77
+ Name: 'Options.List',
78
+ Type: 'FieldList',
79
+ Options: {
80
+ Columns: [
81
+ {
82
+ Label: '#',
83
+ Name: 'Index',
84
+ sortable: true,
85
+ },
86
+ {
87
+ Label: '类型',
88
+ Name: 'Type',
89
+ style: 'max-width: 120px;',
90
+ sortable: true,
91
+ },
92
+ {
93
+ Label: '名称',
94
+ Name: 'Name',
95
+ style: 'max-width: 200px;',
96
+ },
97
+ {
98
+ Label: '默认',
99
+ Name: 'Default',
100
+ style: 'max-width: 200px;',
101
+ },
102
+ {
103
+ Label: '标题',
104
+ Name: 'Label',
105
+ style: 'max-width: 200px;',
106
+ sortable: true,
107
+ },
108
+ ],
109
+ },
110
+ },
111
+ ],
112
+ Description: '',
113
+ },
114
+ props: {
115
+ ...freeFieldProps,
116
+ },
117
+ emits: ['input'],
118
+ setup(props, { emit }) {
119
+ if(!props.Field) return () => null;
120
+
121
+ const { fieldData, setFieldData } = useFreeField(props);
122
+ const { validate } = useFormValidator('fieldsToValidate');
123
+
124
+ const tab = ref(0);
125
+
126
+ if (!Array.isArray(fieldData.value)) {
127
+ setFieldData([{}])
128
+ }
129
+
130
+ if (props.Field.Options?.ValueField && props.Field.Default) {
131
+ const defaultTab = fieldData.value.findIndex((d) => d[props.Field.Options?.ValueField] === props.Field.Default);
132
+
133
+ if (defaultTab >= 0) {
134
+ tab.value = defaultTab;
135
+ }
136
+ }
137
+
138
+ return {
139
+ tab,
140
+ fieldData,
141
+
142
+ fieldChanged: () => {
143
+ console.log('field changed', fieldData.value)
144
+ emit('input');
145
+ },
146
+ validate,
147
+ };
148
+ },
149
+ });
150
+ </script>
151
+
152
+ <style lang="scss" scoped>
153
+ .input-field-tabs {
154
+ &-tabs-wrapper {
155
+ margin-left: 12px;
156
+ border: 1px solid rgba($color: #000000, $alpha: 0.12);
157
+ .tabs {
158
+ border-bottom: 1px solid;
159
+ }
160
+ }
161
+ }
162
+ </style>
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, h, ref, watchEffect, computed } from 'vue';
2
2
  import { QInput } from 'quasar';
3
- import { useFreeField, freeFieldProps, useFreeFieldMethods } from '../composible/useFreeField';
3
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
4
4
  import ReadonlyContent from '../composible/readonlyContent';
5
5
  import freeFieldLabel from '../composible/freeFieldLabel';
6
6
  import { useFormValidator} from '../../composible/useFormValidator';
@@ -24,9 +24,6 @@ export default defineComponent({
24
24
  ...freeFieldProps,
25
25
  },
26
26
  emits: ['input'],
27
- methods: {
28
- ...useFreeFieldMethods,
29
- },
30
27
  setup(props, { emit, slots, expose }){
31
28
  if (!props.Field) return {};
32
29
 
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, h, computed } from 'vue';
2
2
  import { QSelect } 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
 
@@ -72,9 +72,6 @@ export default defineComponent({
72
72
  ...freeFieldProps,
73
73
  },
74
74
  emits: ['input'],
75
- methods: {
76
- ...useFreeFieldMethods,
77
- },
78
75
  setup(props, { emit, slots, expose }){
79
76
  if (!props.Field) return {};
80
77
 
@@ -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
  };
@@ -96,48 +96,3 @@ export function useFreeField(props) {
96
96
  },
97
97
  }
98
98
  };
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
+ }