free-fe-core-modules 0.0.2 → 0.0.3
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.
- package/components/Basic/EIcon.vue +2 -4
- package/components/Basic/LeveledMenus.vue +0 -5
- package/components/Basic/SummaryHead.vue +10 -1
- package/components/Dialog/BasicDialog.vue +1 -1
- package/components/SlidingCarousel/index.vue +0 -1
- package/components/SlidingNews/index.vue +0 -1
- package/components/ThemeSwitch/index.vue +7 -5
- package/composible/useObjectData.js +69 -0
- package/free-field/Fields/AgreementCheck.js +170 -0
- package/free-field/Fields/ApiCall.js +123 -0
- package/{field-components/Fields/Boolean.vue → free-field/Fields/Boolean.js} +40 -46
- package/free-field/Fields/Category.js +28 -0
- package/free-field/Fields/Check.js +106 -0
- package/free-field/Fields/Customize.js +87 -0
- package/free-field/Fields/Date.js +133 -0
- package/free-field/Fields/DateRange.js +226 -0
- package/free-field/Fields/DynamicList.js +565 -0
- package/{field-components → free-field}/Fields/File.vue +1 -1
- package/{field-components → free-field}/Fields/FileList.vue +1 -1
- package/{field-components → free-field}/Fields/FileListCombined.vue +1 -1
- package/{field-components → free-field}/Fields/FixedList.vue +78 -83
- package/{field-components → free-field}/Fields/ImageList.vue +1 -1
- package/{field-components → free-field}/Fields/ImageListCombined.vue +1 -1
- package/free-field/Fields/InputFieldList.vue +324 -0
- package/{field-components → free-field}/Fields/Labels.vue +24 -15
- package/{field-components → free-field}/Fields/MixedTable.vue +53 -61
- package/free-field/Fields/Number.js +167 -0
- package/free-field/Fields/Password.js +81 -0
- package/{field-components → free-field}/Fields/Permission.vue +17 -13
- package/{field-components → free-field}/Fields/PermissionEditor.vue +63 -105
- package/{field-components → free-field}/Fields/QueryFilters.vue +65 -48
- package/{field-components → free-field}/Fields/RadioList.vue +36 -12
- package/{field-components → free-field}/Fields/Rich.vue +104 -114
- package/{field-components → free-field}/Fields/Search.vue +35 -26
- package/{field-components → free-field}/Fields/Select.vue +116 -87
- package/{field-components → free-field}/Fields/SelectionChain.vue +89 -67
- package/{field-components/Fields/Separator.vue → free-field/Fields/Separator.js} +11 -16
- package/{field-components → free-field}/Fields/SingleList.vue +27 -21
- package/free-field/Fields/Static.js +27 -0
- package/free-field/Fields/String.js +105 -0
- package/free-field/Fields/Text.js +80 -0
- package/{field-components → free-field}/Fields/Time.vue +59 -43
- package/{field-components → free-field}/Fields/TimeRange.vue +107 -92
- package/{field-components → free-field}/Fields/UltimateFile.vue +1 -1
- package/free-field/Fields/Year.js +137 -0
- package/{field-components → free-field}/Fields/YearRange.vue +63 -73
- package/{field-components → free-field}/Fields/index.js +16 -18
- package/free-field/composible/fieldWrapper.js +221 -0
- package/free-field/composible/freeFieldLabel.js +22 -0
- package/free-field/composible/readonlyContent.js +36 -0
- package/free-field/composible/useFileSizeUtils.js +52 -0
- package/free-field/composible/useFreeField.js +143 -0
- package/{field-components → free-field}/index.js +3 -3
- package/i18n/en-us/index.js +1 -1
- package/i18n/zh-cn/index.js +1 -1
- package/index.js +1 -4
- package/package.json +1 -1
- package/router/error/data.js +4 -1
- package/view/dict/index.vue +13 -2
- package/view/error/list.vue +22 -14
- package/view/menu/index.vue +19 -4
- package/view/system/index.vue +15 -2
- package/field-components/Fields/AgreementCheck.vue +0 -161
- package/field-components/Fields/ApiCall.vue +0 -139
- package/field-components/Fields/Category.vue +0 -33
- package/field-components/Fields/Check.vue +0 -131
- package/field-components/Fields/Customize.vue +0 -103
- package/field-components/Fields/Date.vue +0 -142
- package/field-components/Fields/DateRange.vue +0 -199
- package/field-components/Fields/DynamicList.vue +0 -575
- package/field-components/Fields/FieldEditor.vue +0 -379
- package/field-components/Fields/InputFieldList.vue +0 -299
- package/field-components/Fields/Number.vue +0 -247
- package/field-components/Fields/Password.vue +0 -79
- package/field-components/Fields/Static.vue +0 -22
- package/field-components/Fields/String.vue +0 -185
- package/field-components/Fields/Text.vue +0 -89
- package/field-components/Fields/Year.vue +0 -124
- package/field-components/Fields/components/FieldTypeOptions.vue +0 -248
- package/field-components/components/FieldComponents.vue +0 -246
- package/free-fields/AutoHide.js +0 -66
- package/free-fields/CenterContent.js +0 -15
- package/free-fields/Draggable.js +0 -30
- package/free-fields/Droppable.js +0 -114
- package/free-fields/EditableString.js +0 -63
- package/free-fields/FieldCategory.js +0 -83
- package/free-fields/FieldTypeSelect.js +0 -94
- package/free-fields/fieldEditors/arrayEditor.js +0 -3
- package/free-fields/fieldEditors/boolEditor.js +0 -22
- package/free-fields/fieldEditors/dateEditor.js +0 -23
- package/free-fields/fieldEditors/datetimeEditor.js +0 -23
- package/free-fields/fieldEditors/index.js +0 -21
- package/free-fields/fieldEditors/jsonEditor.js +0 -371
- package/free-fields/fieldEditors/labeledField.js +0 -74
- package/free-fields/fieldEditors/numberEditor.js +0 -51
- package/free-fields/fieldEditors/objectEditor.js +0 -3
- package/free-fields/fieldEditors/selectEditor.js +0 -0
- package/free-fields/fieldEditors/stringEditor.js +0 -49
- package/free-fields/fieldEditors/textEditor.js +0 -50
- package/free-fields/fieldEditors/timeEditor.js +0 -23
- package/free-fields/index.js +0 -402
- /package/{field-components → free-field}/Fields/Image.vue +0 -0
- /package/{field-components/Display → free-field/Layout}/index.js +0 -0
- /package/{field-components → free-field}/style.sass +0 -0
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span class="input-field-year simple-field row items-center no-wrap">
|
|
3
|
-
<q-select
|
|
4
|
-
v-model="fieldData"
|
|
5
|
-
hide-bottom-space
|
|
6
|
-
:options="yearOptions"
|
|
7
|
-
:readonly="Field.ReadOnly"
|
|
8
|
-
@input="$emit('input')"
|
|
9
|
-
:ref="`input_field_validator_${Field.Name || Field.Label}`"
|
|
10
|
-
map-options
|
|
11
|
-
:label="Field.Placeholder"
|
|
12
|
-
emit-value
|
|
13
|
-
v-bind="$attrs"
|
|
14
|
-
>
|
|
15
|
-
<template v-slot:before v-if="typeof Field.Label !== 'undefined'">
|
|
16
|
-
<span
|
|
17
|
-
:class="`field-label ${(Field.Label && Field.Label.trim().length)
|
|
18
|
-
? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`">
|
|
19
|
-
<q-tooltip v-if="Field.Description" anchor="top right">{{Field.Description}}</q-tooltip>
|
|
20
|
-
{{Field.Label || ''}}
|
|
21
|
-
<span v-if="Field.Required" class="required-mark">*</span>
|
|
22
|
-
</span>
|
|
23
|
-
</template>
|
|
24
|
-
</q-select>
|
|
25
|
-
<slot name="warning"></slot>
|
|
26
|
-
</span>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script>
|
|
30
|
-
import { defineComponent } from 'vue';
|
|
31
|
-
import mixins from 'free-fe-mixins';
|
|
32
|
-
|
|
33
|
-
export default defineComponent({
|
|
34
|
-
name: 'InputFieldYear',
|
|
35
|
-
mixins: [mixins.InputFieldMixin],
|
|
36
|
-
fieldInfo: {
|
|
37
|
-
Category: 'DateTime',
|
|
38
|
-
Label: '年份',
|
|
39
|
-
Value: 'Year',
|
|
40
|
-
Extra: [
|
|
41
|
-
{
|
|
42
|
-
Type: 'String',
|
|
43
|
-
Label: '最小值',
|
|
44
|
-
Name: 'MinValue',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
Type: 'String',
|
|
48
|
-
Label: '最大值',
|
|
49
|
-
Name: 'MaxValue',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
Type: 'Boolean',
|
|
53
|
-
Label: '最大至“现在”',
|
|
54
|
-
Name: 'Info.TillNow',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
Type: 'Boolean',
|
|
58
|
-
Label: '最小从“现在”',
|
|
59
|
-
Name: 'Info.FromNow',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
Type: 'DynamicList',
|
|
63
|
-
Label: '选项',
|
|
64
|
-
Name: 'Options',
|
|
65
|
-
Options: {
|
|
66
|
-
Columns: [
|
|
67
|
-
{
|
|
68
|
-
Label: 'Year',
|
|
69
|
-
Name: 'Value',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
Label: 'Extra',
|
|
73
|
-
Name: 'Extra',
|
|
74
|
-
Type: 'FieldList',
|
|
75
|
-
Options: {
|
|
76
|
-
Columns: [
|
|
77
|
-
{
|
|
78
|
-
Label: '#',
|
|
79
|
-
Name: 'Index',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
Label: '名称',
|
|
83
|
-
Name: 'Name',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
Label: '标题',
|
|
87
|
-
Name: 'Label',
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
Description: '',
|
|
97
|
-
},
|
|
98
|
-
computed: {
|
|
99
|
-
yearOptions() {
|
|
100
|
-
if (this.Field.Type !== 'Year') return [];
|
|
101
|
-
|
|
102
|
-
if (this.Field.Options && Array.isArray(this.Field.Options)) {
|
|
103
|
-
return this.Field.Options;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
let minYear = 1900;
|
|
107
|
-
let maxYear = Date.now().year;
|
|
108
|
-
|
|
109
|
-
if (this.Field.MinValue && Number(this.Field.MinValue)) {
|
|
110
|
-
minYear = Number(this.Field.MinValue);
|
|
111
|
-
}
|
|
112
|
-
if (this.Field.MaxValue && Number(this.Field.MaxValue)) {
|
|
113
|
-
maxYear = Number(this.Field.MaxValue);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const options = [];
|
|
117
|
-
for (let i = minYear; i <= maxYear; i += 1) {
|
|
118
|
-
options.push(i);
|
|
119
|
-
}
|
|
120
|
-
return options;
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
</script>
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span v-if="Field" class="simple-field input-field-field-type-options row items-center no-wrap">
|
|
3
|
-
<q-input
|
|
4
|
-
:value="optionLabel"
|
|
5
|
-
hide-bottom-space
|
|
6
|
-
readonly
|
|
7
|
-
v-bind="$attrs"
|
|
8
|
-
:ref="`input_field_validator_date`"
|
|
9
|
-
>
|
|
10
|
-
<template v-slot:before>
|
|
11
|
-
<span
|
|
12
|
-
:class="
|
|
13
|
-
`field-label ${
|
|
14
|
-
Field.Label && Field.Label.trim().length
|
|
15
|
-
? ''
|
|
16
|
-
: 'field-label-empty'
|
|
17
|
-
} ${Field.Required ? 'required' : ''}`
|
|
18
|
-
"
|
|
19
|
-
v-if="typeof Field.Label !== 'undefined'"
|
|
20
|
-
>
|
|
21
|
-
<q-tooltip v-if="Field.Description" anchor="top right">
|
|
22
|
-
{{
|
|
23
|
-
Field.Description
|
|
24
|
-
}}
|
|
25
|
-
</q-tooltip>
|
|
26
|
-
{{ Field.Label || '' }}
|
|
27
|
-
<span v-if="Field.Required" class="required-mark">*</span>
|
|
28
|
-
</span>
|
|
29
|
-
</template>
|
|
30
|
-
<q-popup-proxy ref="qTypeProxy" transition-show="scale" transition-hide="scale">
|
|
31
|
-
<div class="row input-field-field-type-options-content" style="max-height: 320px">
|
|
32
|
-
<q-card class="full-height" style="min-width: 500px">
|
|
33
|
-
<q-separator />
|
|
34
|
-
<q-splitter v-model="splitter" style="height: 300px">
|
|
35
|
-
<template v-slot:before>
|
|
36
|
-
<q-tabs v-model="leftTab" vertical active-bg-color="grey-4">
|
|
37
|
-
<q-tab
|
|
38
|
-
v-for="(category, index) in categoryList"
|
|
39
|
-
:key="index"
|
|
40
|
-
ripple
|
|
41
|
-
:name="category"
|
|
42
|
-
:label="$t(`fieldCategory${category}`)"
|
|
43
|
-
></q-tab>
|
|
44
|
-
</q-tabs>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<template v-slot:after>
|
|
48
|
-
<q-tab-panels
|
|
49
|
-
v-model="leftTab"
|
|
50
|
-
animated
|
|
51
|
-
transition-prev="slide-down"
|
|
52
|
-
transition-next="slide-up"
|
|
53
|
-
class="full-height"
|
|
54
|
-
>
|
|
55
|
-
<q-tab-panel
|
|
56
|
-
v-for="(category, index) in categoryList"
|
|
57
|
-
:key="index"
|
|
58
|
-
:name="category"
|
|
59
|
-
class="row full-height"
|
|
60
|
-
style="width: 800px;"
|
|
61
|
-
>
|
|
62
|
-
<q-list class="col full-height scroll" style="max-width: 180px">
|
|
63
|
-
<q-item
|
|
64
|
-
v-for="(option, index) in categoryFields(category)"
|
|
65
|
-
:key="index"
|
|
66
|
-
clickable
|
|
67
|
-
v-ripple
|
|
68
|
-
:active="fieldData === option.Value"
|
|
69
|
-
@click="typeChanged(option)"
|
|
70
|
-
>
|
|
71
|
-
<q-item-section>
|
|
72
|
-
<q-item-label>{{ option.Label }}</q-item-label>
|
|
73
|
-
</q-item-section>
|
|
74
|
-
</q-item>
|
|
75
|
-
</q-list>
|
|
76
|
-
<q-card
|
|
77
|
-
class="col full-height scroll"
|
|
78
|
-
flat
|
|
79
|
-
style="min-width: 500px; margin-bottom: 10px; border: 1px solid grey"
|
|
80
|
-
>
|
|
81
|
-
<q-card-section>
|
|
82
|
-
<free-field
|
|
83
|
-
v-for="(field, index)
|
|
84
|
-
in (Array.isArray(demoField) ? demoField : [demoField])"
|
|
85
|
-
:key="index"
|
|
86
|
-
:Field="field"
|
|
87
|
-
:values="demoData"
|
|
88
|
-
></free-field>
|
|
89
|
-
</q-card-section>
|
|
90
|
-
<q-card-section></q-card-section>
|
|
91
|
-
</q-card>
|
|
92
|
-
</q-tab-panel>
|
|
93
|
-
</q-tab-panels>
|
|
94
|
-
</template>
|
|
95
|
-
</q-splitter>
|
|
96
|
-
</q-card>
|
|
97
|
-
</div>
|
|
98
|
-
</q-popup-proxy>
|
|
99
|
-
<template v-slot:append>
|
|
100
|
-
<q-icon name="event" class="cursor-pointer"></q-icon>
|
|
101
|
-
</template>
|
|
102
|
-
</q-input>
|
|
103
|
-
</span>
|
|
104
|
-
</template>
|
|
105
|
-
|
|
106
|
-
<script>
|
|
107
|
-
import { defineComponent } from 'vue';
|
|
108
|
-
import mixins from 'free-fe-mixins';
|
|
109
|
-
|
|
110
|
-
export default defineComponent({
|
|
111
|
-
name: 'FieldTypeOptions',
|
|
112
|
-
mixins: [mixins.InputFieldMixin],
|
|
113
|
-
emits: ['updateOptions'],
|
|
114
|
-
data() {
|
|
115
|
-
return {
|
|
116
|
-
leftTab: 'Static',
|
|
117
|
-
splitter: 10,
|
|
118
|
-
testData: {
|
|
119
|
-
Type: 'String',
|
|
120
|
-
Label: 'Label',
|
|
121
|
-
Name: 'value',
|
|
122
|
-
Required: true,
|
|
123
|
-
value: 'test value',
|
|
124
|
-
Options: [
|
|
125
|
-
{
|
|
126
|
-
Label: 'Option one',
|
|
127
|
-
Value: 'test value',
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
Warning: 'This is some warning message.',
|
|
131
|
-
Description: 'This is some description',
|
|
132
|
-
Tips: [
|
|
133
|
-
{
|
|
134
|
-
Text: 'this is some tip',
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
},
|
|
138
|
-
optionLabel: '',
|
|
139
|
-
fieldCategory: [],
|
|
140
|
-
};
|
|
141
|
-
},
|
|
142
|
-
computed: {
|
|
143
|
-
demoField() {
|
|
144
|
-
if (!this.Field || !this.Field.Options) return [];// this.testData;
|
|
145
|
-
|
|
146
|
-
const f = this.Field.Options.find((o) => o.Value === this.fieldData);
|
|
147
|
-
|
|
148
|
-
if (f && f.fieldInfo && f.fieldInfo.demoField) {
|
|
149
|
-
return f.demoField;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return [];// { ...this.testData, Type: this.fieldData };
|
|
153
|
-
},
|
|
154
|
-
demoData() {
|
|
155
|
-
if (!this.Field || !this.Field.Options) return {};// this.testData;
|
|
156
|
-
|
|
157
|
-
const f = this.Field.Options.find((o) => o.Value === this.fieldData);
|
|
158
|
-
|
|
159
|
-
if (f && f.fieldInfo && f.fieldInfo.demoData) {
|
|
160
|
-
return f.demoData;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return {};// this.testData;
|
|
164
|
-
},
|
|
165
|
-
categoryList() {
|
|
166
|
-
return this.fieldCategory.map((fc) => fc.Name);
|
|
167
|
-
},
|
|
168
|
-
categoryFields() {
|
|
169
|
-
return (c) => {
|
|
170
|
-
const cat = this.fieldCategory.find((fc) => fc.Name === c);
|
|
171
|
-
if (cat) return cat.Fields || [];
|
|
172
|
-
return [];
|
|
173
|
-
};
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
async created() {
|
|
177
|
-
this.getTypeOptions();
|
|
178
|
-
this.getFieldOptionLabel();
|
|
179
|
-
},
|
|
180
|
-
methods: {
|
|
181
|
-
async getTypeOptions() {
|
|
182
|
-
const typeOptions = [];
|
|
183
|
-
for (let i = 0; i < Object.keys(this.ctx.FieldComponents).length; i += 1) {
|
|
184
|
-
const fk = Object.keys(this.ctx.FieldComponents)[i];
|
|
185
|
-
let fc = this.ctx.FieldComponents[fk];
|
|
186
|
-
|
|
187
|
-
if (typeof fc === 'function') {
|
|
188
|
-
// eslint-disable-next-line no-await-in-loop
|
|
189
|
-
fc = await fc();
|
|
190
|
-
fc = fc.default || fc;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (fc && fc.fieldInfo) {
|
|
194
|
-
typeOptions.push(fc.fieldInfo);
|
|
195
|
-
|
|
196
|
-
if (fc.fieldInfo.Value === this.fieldData) {
|
|
197
|
-
this.optionLabel = fc.fieldInfo.Label;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// category
|
|
201
|
-
const info = fc.fieldInfo;
|
|
202
|
-
if (info.Category) {
|
|
203
|
-
if (this.fieldCategory.findIndex((cl) => cl.Name === info.Category) < 0) {
|
|
204
|
-
this.fieldCategory.push({ Name: info.Category, Fields: [info] });
|
|
205
|
-
} else {
|
|
206
|
-
const c = this.fieldCategory.find((cat) => cat.Name === info.Category);
|
|
207
|
-
if (c) {
|
|
208
|
-
c.Fields = c.Fields || [];
|
|
209
|
-
c.Fields.push(info);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
} else if (this.fieldCategory.findIndex((cl) => cl.Name === 'Others') < 0) {
|
|
213
|
-
this.fieldCategory.push({ Name: 'Others', Fields: [info] });
|
|
214
|
-
} else {
|
|
215
|
-
const c = this.fieldCategory.find((cat) => cat.Name === 'Others');
|
|
216
|
-
if (c) {
|
|
217
|
-
c.Fields = c.Fields || [];
|
|
218
|
-
c.Fields.push(info);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
this.$emit('updateOptions', { Name: this.Field.Name, Options: typeOptions });
|
|
225
|
-
},
|
|
226
|
-
getFieldOptionLabel() {
|
|
227
|
-
const opt = this.Field.Options.find((op) => op.Value === this.fieldData);
|
|
228
|
-
if (opt) this.optionLabel = opt.Label;
|
|
229
|
-
},
|
|
230
|
-
typeChanged(option) {
|
|
231
|
-
this.fieldData = option.Value;
|
|
232
|
-
if (option.DataType) this.data.DataType = option.DataType;
|
|
233
|
-
|
|
234
|
-
this.$emit('input');
|
|
235
|
-
this.getFieldOptionLabel();
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
</script>
|
|
240
|
-
|
|
241
|
-
<style lang="sass">
|
|
242
|
-
.input-field-field-type-options
|
|
243
|
-
.q-field__control
|
|
244
|
-
padding: 0 8px
|
|
245
|
-
.input-field-field-type-options-content
|
|
246
|
-
.q-panel
|
|
247
|
-
overflow: hidden
|
|
248
|
-
</style>
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="Field"
|
|
4
|
-
:class="`free-field-wrapper ${localField.Label
|
|
5
|
-
&& localField.Label.trim().length ? 'with-label'
|
|
6
|
-
: 'without-label'} ${Field.Label ?
|
|
7
|
-
'free-field-wrapper-'+Field.Label : ''} ${Field.Name ?
|
|
8
|
-
'free-field-wrapper-'+dashedName : ''} ${(Field && Field.Info)
|
|
9
|
-
? (Field.Info.Classes || '') : ''}`"
|
|
10
|
-
>
|
|
11
|
-
<component
|
|
12
|
-
:style="shouldHide ? 'display: none;' : ''"
|
|
13
|
-
:is="realComp"
|
|
14
|
-
:Field="localField"
|
|
15
|
-
:modelValue="data"
|
|
16
|
-
:ref="`input_field_validator_${localField.Name || localField.Label}`"
|
|
17
|
-
:class="[
|
|
18
|
-
(localField && localField.ReadOnly) ? 'free-field--readonly' : '',
|
|
19
|
-
(!shouldHide && hasError) ? 'hasError' : ''
|
|
20
|
-
]"
|
|
21
|
-
@input="inputChanged"
|
|
22
|
-
v-bind="Object.assign({},vBindValue(localField), $attrs)"
|
|
23
|
-
>
|
|
24
|
-
<template
|
|
25
|
-
v-for="slt in ((Field && Field.Slots) || [])"
|
|
26
|
-
v-slot:[slt]="props"
|
|
27
|
-
>
|
|
28
|
-
<slot :name="slt" v-bind="props"></slot>
|
|
29
|
-
</template>
|
|
30
|
-
</component>
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script>
|
|
35
|
-
import { defineComponent, markRaw } from 'vue';
|
|
36
|
-
import mixins from 'free-fe-mixins';
|
|
37
|
-
|
|
38
|
-
// TODO: any other solution to replace the eval??
|
|
39
|
-
const evalFunc = (cond, pName = 'data') => {
|
|
40
|
-
const funcStr = `
|
|
41
|
-
(${pName}) => {
|
|
42
|
-
return ${cond};
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
// eslint-disable-next-line no-eval
|
|
48
|
-
return eval(funcStr);
|
|
49
|
-
} catch (ex) {
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default defineComponent({
|
|
55
|
-
name: 'FreeField',
|
|
56
|
-
mixins: [mixins.ObjectDataMixin, mixins.InputFieldValidator],
|
|
57
|
-
emits: ['input'],
|
|
58
|
-
props: {
|
|
59
|
-
Field: { type: Object },
|
|
60
|
-
},
|
|
61
|
-
data() {
|
|
62
|
-
return {
|
|
63
|
-
realComp: undefined,
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
computed: {
|
|
67
|
-
dashedName() {
|
|
68
|
-
return (this.Field.Name || '').replace(/\./g, '-');
|
|
69
|
-
},
|
|
70
|
-
shouldHide() {
|
|
71
|
-
if (!this.Field) {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// show when
|
|
76
|
-
if (this.Field.Info && this.Field.Info.ShowWhen) {
|
|
77
|
-
const theFunc = evalFunc(this.Field.Info.ShowWhen);
|
|
78
|
-
if (typeof theFunc !== 'function') {
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
const condResult = theFunc(this.data);
|
|
82
|
-
if (!condResult) return true;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// hide (when)
|
|
86
|
-
if (this.Field.Hidden
|
|
87
|
-
&& this.Field.Info
|
|
88
|
-
&& this.Field.Info.HideWhenUndefined) {
|
|
89
|
-
const checkField = this.Field.Info.HideWhenUndefinedField || this.Field.Name;
|
|
90
|
-
if (checkField) {
|
|
91
|
-
const fList = checkField.split(',');
|
|
92
|
-
for (let i = 0; i < fList.length; i += 1) {
|
|
93
|
-
const fl = fList[i];
|
|
94
|
-
|
|
95
|
-
const flv = Object.nestValue(this.data, fl.trim());
|
|
96
|
-
if (typeof flv === 'undefined') return true;
|
|
97
|
-
|
|
98
|
-
if (this.Field.Info.IncludeEmptyObject) {
|
|
99
|
-
return !Object.hasValue(flv);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return this.Field.Hidden;
|
|
107
|
-
},
|
|
108
|
-
localField() {
|
|
109
|
-
const rules = [];
|
|
110
|
-
const lField = { ...this.Field };
|
|
111
|
-
lField.Rules = lField.Rules || [];
|
|
112
|
-
for (let i = 0; i < lField.Rules.length; i += 1) {
|
|
113
|
-
const rule = lField.Rules[i];
|
|
114
|
-
|
|
115
|
-
if (typeof rule === 'string' && this.ctx.validators[rule] && this.ctx.validators[rule].validator) {
|
|
116
|
-
lField.Rules[i] = this.ctx.validators[rule].validator;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (lField.Required) {
|
|
121
|
-
rules.push(val => typeof val !== 'undefined' && val !== '');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
lField.rules = [].concat(this.Field.Rules).concat(rules).concat(lField.rules);
|
|
125
|
-
|
|
126
|
-
return lField;
|
|
127
|
-
},
|
|
128
|
-
vBindValue() {
|
|
129
|
-
return (d) => {
|
|
130
|
-
if (!d || typeof d !== 'object') return {};
|
|
131
|
-
|
|
132
|
-
const ret = {};
|
|
133
|
-
Object.keys(d).forEach((dk) => {
|
|
134
|
-
if (!dk) return;
|
|
135
|
-
|
|
136
|
-
if (
|
|
137
|
-
dk.charAt(0) === dk.charAt(0).toLowerCase()
|
|
138
|
-
|| ['Placeholder', 'ReadOnly'].indexOf(dk) >= 0
|
|
139
|
-
) {
|
|
140
|
-
switch (dk) {
|
|
141
|
-
case 'Placeholder':
|
|
142
|
-
ret.placeholder = d[dk];
|
|
143
|
-
break;
|
|
144
|
-
case 'ReadOnly':
|
|
145
|
-
ret.readonly = d[dk];
|
|
146
|
-
break;
|
|
147
|
-
default:
|
|
148
|
-
ret[dk] = d[dk];
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
return ret;
|
|
155
|
-
};
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
watch: {
|
|
159
|
-
// eslint-disable-next-line func-names
|
|
160
|
-
'Field.Type': function (nv) {
|
|
161
|
-
if (!this.realComp || this.realComp.name !== nv) {
|
|
162
|
-
this.getRRealComp();
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
created() {
|
|
167
|
-
this.getRRealComp();
|
|
168
|
-
|
|
169
|
-
if (this.Field && this.Field.Info && this.Field.Info.KeepChanged) {
|
|
170
|
-
this.$nextTick(() => {
|
|
171
|
-
this.$emit('input', this.Field);
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
methods: {
|
|
176
|
-
getRRealComp() {
|
|
177
|
-
// all components
|
|
178
|
-
const fComponents = this.ctx ? this.ctx.FieldComponents || {} : {};
|
|
179
|
-
let field;
|
|
180
|
-
|
|
181
|
-
// for some specified types
|
|
182
|
-
if (this.Field.Component) {
|
|
183
|
-
field = this.Field.Component;
|
|
184
|
-
} else if (this.Field.Type === 'Select' && this.Field.AsRadio) {
|
|
185
|
-
field = fComponents.RadioList;
|
|
186
|
-
} else {
|
|
187
|
-
if(typeof this.Field.Type === 'undefined') {
|
|
188
|
-
field = fComponents.String;
|
|
189
|
-
} else {
|
|
190
|
-
field = fComponents[this.Field.Type] || this.Field.Type;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
this.realComp = markRaw(field);
|
|
195
|
-
// return field;
|
|
196
|
-
},
|
|
197
|
-
inputChanged(f) {
|
|
198
|
-
this.$emit('input', f || this.Field);
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
</script>
|
|
203
|
-
|
|
204
|
-
<style lang="sass">
|
|
205
|
-
@import '../style.sass'
|
|
206
|
-
|
|
207
|
-
.free-field-wrapper
|
|
208
|
-
width: 100%
|
|
209
|
-
.free-field-wrapper
|
|
210
|
-
width: unset
|
|
211
|
-
.simple-field
|
|
212
|
-
// display: inline-block
|
|
213
|
-
width: 100%
|
|
214
|
-
.free-field-range-separator
|
|
215
|
-
margin: 0 6px
|
|
216
|
-
.field-label-empty
|
|
217
|
-
display: inline-block
|
|
218
|
-
margin-left: 0
|
|
219
|
-
padding-left: 0
|
|
220
|
-
width: $fieldLabelWidth
|
|
221
|
-
min-width: $fieldLabelWidth
|
|
222
|
-
|
|
223
|
-
.field-label
|
|
224
|
-
display: inline-block
|
|
225
|
-
margin-left: 0
|
|
226
|
-
padding-left: 0
|
|
227
|
-
font-size: $fieldLabelFontSize
|
|
228
|
-
width: $fieldLabelWidth
|
|
229
|
-
min-width: $fieldLabelWidth
|
|
230
|
-
color: $fieldLabelColor
|
|
231
|
-
text-align: right
|
|
232
|
-
white-space: normal
|
|
233
|
-
|
|
234
|
-
.field-label:after
|
|
235
|
-
content: $fieldLabelAfter
|
|
236
|
-
|
|
237
|
-
.required-mark
|
|
238
|
-
color: $fieldLabelRequiredColor
|
|
239
|
-
position: relative
|
|
240
|
-
top: 3px
|
|
241
|
-
|
|
242
|
-
.q-uploader
|
|
243
|
-
flex: 1
|
|
244
|
-
box-shadow: unset
|
|
245
|
-
|
|
246
|
-
</style>
|
package/free-fields/AutoHide.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineComponent,
|
|
3
|
-
h,
|
|
4
|
-
ref,
|
|
5
|
-
computed,
|
|
6
|
-
nextTick,
|
|
7
|
-
} from "vue";
|
|
8
|
-
import { QIcon } from 'quasar';
|
|
9
|
-
|
|
10
|
-
export default defineComponent({
|
|
11
|
-
name: "FreeFieldAutoHide",
|
|
12
|
-
props: {
|
|
13
|
-
hideIcon: String,
|
|
14
|
-
vertical: Boolean,
|
|
15
|
-
size: String,
|
|
16
|
-
duration: Number
|
|
17
|
-
},
|
|
18
|
-
setup(props, { slots }) {
|
|
19
|
-
const hovered = ref(false);
|
|
20
|
-
const defaultIcon = props.vertical ? 'more_vert' : 'more_horiz';
|
|
21
|
-
const freez = ref(false);
|
|
22
|
-
|
|
23
|
-
const renderH = computed(() => {
|
|
24
|
-
if(hovered.value) {
|
|
25
|
-
return h('div', {
|
|
26
|
-
onMouseleave: () => {
|
|
27
|
-
if(freez.value) return;
|
|
28
|
-
|
|
29
|
-
nextTick(() => {
|
|
30
|
-
hovered.value = false;
|
|
31
|
-
freez.value = true;
|
|
32
|
-
})
|
|
33
|
-
},
|
|
34
|
-
onMousemove: () => {
|
|
35
|
-
nextTick(() => {
|
|
36
|
-
freez.value = false;
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
}, slots.default ? slots.default() : undefined);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return h(
|
|
43
|
-
QIcon,
|
|
44
|
-
{
|
|
45
|
-
name: props.hideIcon || defaultIcon,
|
|
46
|
-
size: props.size || 'md',
|
|
47
|
-
onMouseenter: () => {
|
|
48
|
-
if(freez.value) return;
|
|
49
|
-
|
|
50
|
-
nextTick(() => {
|
|
51
|
-
freez.value = true;
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
onMousemove: () => {
|
|
55
|
-
nextTick(() => {
|
|
56
|
-
hovered.value = true;
|
|
57
|
-
freez.value = false;
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
return () => renderH.value;
|
|
65
|
-
},
|
|
66
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineComponent,
|
|
3
|
-
h,
|
|
4
|
-
} from "vue";
|
|
5
|
-
|
|
6
|
-
export default defineComponent({
|
|
7
|
-
name: "FreeFieldCenterContent",
|
|
8
|
-
setup(props, { slots }) {
|
|
9
|
-
return () => h('div', {
|
|
10
|
-
class: "relative-position full-height full-width"
|
|
11
|
-
}, h('div', {
|
|
12
|
-
class: "absolute-center"
|
|
13
|
-
}, slots.default ? slots.default() : undefined))
|
|
14
|
-
},
|
|
15
|
-
});
|