free-fe-core-modules 0.0.1
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/README.md +7 -0
- package/components/.gitkeep +0 -0
- package/components/Basic/BreadCrumbs.vue +87 -0
- package/components/Basic/EIcon.vue +84 -0
- package/components/Basic/LeveledMenus.vue +92 -0
- package/components/Basic/SummaryHead.vue +312 -0
- package/components/Dialog/BasicDialog.vue +442 -0
- package/components/Dialog/index.js +38 -0
- package/components/Dialog/index1.js +49 -0
- package/components/FloatingWindow/index.vue +140 -0
- package/components/SelectLocales/index.vue +47 -0
- package/components/SlidingCarousel/index.vue +86 -0
- package/components/SlidingNews/index.vue +138 -0
- package/components/StickyButtons/index.vue +98 -0
- package/components/ThemeSwitch/index.vue +77 -0
- package/field-components/Display/index.js +3 -0
- package/field-components/Fields/AgreementCheck.vue +161 -0
- package/field-components/Fields/ApiCall.vue +139 -0
- package/field-components/Fields/Boolean.vue +112 -0
- package/field-components/Fields/Category.vue +33 -0
- package/field-components/Fields/Check.vue +131 -0
- package/field-components/Fields/Customize.vue +103 -0
- package/field-components/Fields/Date.vue +142 -0
- package/field-components/Fields/DateRange.vue +199 -0
- package/field-components/Fields/DynamicList.vue +575 -0
- package/field-components/Fields/FieldEditor.vue +379 -0
- package/field-components/Fields/File.vue +382 -0
- package/field-components/Fields/FileList.vue +405 -0
- package/field-components/Fields/FileListCombined.vue +142 -0
- package/field-components/Fields/FixedList.vue +372 -0
- package/field-components/Fields/Image.vue +328 -0
- package/field-components/Fields/ImageList.vue +285 -0
- package/field-components/Fields/ImageListCombined.vue +76 -0
- package/field-components/Fields/InputFieldList.vue +299 -0
- package/field-components/Fields/Labels.vue +182 -0
- package/field-components/Fields/MixedTable.vue +367 -0
- package/field-components/Fields/Number.vue +247 -0
- package/field-components/Fields/Password.vue +79 -0
- package/field-components/Fields/Permission.vue +83 -0
- package/field-components/Fields/PermissionEditor.vue +205 -0
- package/field-components/Fields/QueryFilters.vue +162 -0
- package/field-components/Fields/RadioList.vue +81 -0
- package/field-components/Fields/Rich.vue +369 -0
- package/field-components/Fields/Search.vue +499 -0
- package/field-components/Fields/Select.vue +376 -0
- package/field-components/Fields/SelectionChain.vue +198 -0
- package/field-components/Fields/Separator.vue +26 -0
- package/field-components/Fields/SingleList.vue +125 -0
- package/field-components/Fields/Static.vue +22 -0
- package/field-components/Fields/String.vue +185 -0
- package/field-components/Fields/Text.vue +89 -0
- package/field-components/Fields/Time.vue +160 -0
- package/field-components/Fields/TimeRange.vue +348 -0
- package/field-components/Fields/UltimateFile.vue +100 -0
- package/field-components/Fields/Year.vue +124 -0
- package/field-components/Fields/YearRange.vue +188 -0
- package/field-components/Fields/components/FieldTypeOptions.vue +248 -0
- package/field-components/Fields/index.js +117 -0
- package/field-components/components/FieldComponents.vue +246 -0
- package/field-components/index.js +13 -0
- package/field-components/style.sass +11 -0
- package/free-fields/AutoHide.js +66 -0
- package/free-fields/CenterContent.js +15 -0
- package/free-fields/Draggable.js +30 -0
- package/free-fields/Droppable.js +114 -0
- package/free-fields/EditableString.js +63 -0
- package/free-fields/FieldCategory.js +83 -0
- package/free-fields/FieldTypeSelect.js +94 -0
- package/free-fields/fieldEditors/arrayEditor.js +3 -0
- package/free-fields/fieldEditors/boolEditor.js +22 -0
- package/free-fields/fieldEditors/dateEditor.js +23 -0
- package/free-fields/fieldEditors/datetimeEditor.js +23 -0
- package/free-fields/fieldEditors/index.js +21 -0
- package/free-fields/fieldEditors/jsonEditor.js +371 -0
- package/free-fields/fieldEditors/labeledField.js +74 -0
- package/free-fields/fieldEditors/numberEditor.js +51 -0
- package/free-fields/fieldEditors/objectEditor.js +3 -0
- package/free-fields/fieldEditors/selectEditor.js +0 -0
- package/free-fields/fieldEditors/stringEditor.js +49 -0
- package/free-fields/fieldEditors/textEditor.js +50 -0
- package/free-fields/fieldEditors/timeEditor.js +23 -0
- package/free-fields/index.js +402 -0
- package/i18n/en-us/index.js +73 -0
- package/i18n/fields/en-us/index.js +9 -0
- package/i18n/fields/zh-cn/index.js +9 -0
- package/i18n/zh-cn/index.js +73 -0
- package/index.js +367 -0
- package/package.json +11 -0
- package/router/dict/api.js +18 -0
- package/router/dict/data.js +48 -0
- package/router/dict/index.js +7 -0
- package/router/error/api.js +14 -0
- package/router/error/data.js +33 -0
- package/router/error/index.js +9 -0
- package/router/index.js +13 -0
- package/router/menu/api.js +24 -0
- package/router/menu/data.js +85 -0
- package/router/menu/index.js +7 -0
- package/router/system/api.js +10 -0
- package/router/system/data.js +46 -0
- package/router/system/index.js +7 -0
- package/stores/index.js +17 -0
- package/stores/module-mourning/actions.js +3 -0
- package/stores/module-mourning/getters.js +1 -0
- package/stores/module-mourning/index.js +11 -0
- package/stores/module-mourning/state.js +3 -0
- package/stores/mourning.js +3 -0
- package/view/dict/index.vue +284 -0
- package/view/error/list.vue +197 -0
- package/view/menu/index.vue +332 -0
- package/view/mourning/mourning.vue +45 -0
- package/view/system/index.vue +149 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
h,
|
|
4
|
+
} from "vue";
|
|
5
|
+
import { QIcon, QItem, QItemSection,QSelect } from 'quasar';
|
|
6
|
+
|
|
7
|
+
const dataTypeIcons = {
|
|
8
|
+
String:"text_snippet",
|
|
9
|
+
Number:"looks_one",
|
|
10
|
+
Boolean:"toggle_on",
|
|
11
|
+
Date:"event",
|
|
12
|
+
Time:"schedule",
|
|
13
|
+
Array:"data_array",
|
|
14
|
+
Object:"data_object"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FreeFieldTypeSelect",
|
|
19
|
+
props: {
|
|
20
|
+
types: Array,
|
|
21
|
+
modelValue: String,
|
|
22
|
+
showLabel: Boolean,
|
|
23
|
+
dense: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
emits: ['update:modelValue'],
|
|
29
|
+
setup(props, { emit }) {
|
|
30
|
+
const options = props.types || [
|
|
31
|
+
{
|
|
32
|
+
value: "String",
|
|
33
|
+
label: "String",
|
|
34
|
+
icon: 'text_snippet'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: "Number",
|
|
38
|
+
label: "Number",
|
|
39
|
+
icon: 'looks_one'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: "Boolean",
|
|
43
|
+
label: "Boolean",
|
|
44
|
+
icon: 'toggle_on'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "Array",
|
|
48
|
+
label: "Array",
|
|
49
|
+
icon: 'data_array'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: "Object",
|
|
53
|
+
label: "Object",
|
|
54
|
+
icon: 'data_object'
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
return () => h(QSelect, {
|
|
59
|
+
dense: props.dense,
|
|
60
|
+
'options-dense': props.dense,
|
|
61
|
+
borderless: true,
|
|
62
|
+
rounded: true,
|
|
63
|
+
standout: true,
|
|
64
|
+
'hide-dropdown-icon': true,
|
|
65
|
+
'hide-bottom-space': true,
|
|
66
|
+
modelValue: props.modelValue,
|
|
67
|
+
class: '',
|
|
68
|
+
'popup-content-style': props.dense ? 'min-width: 60px; width: 60px; overflow: hidden;' : '',
|
|
69
|
+
options,
|
|
70
|
+
"onUpdate:modelValue": (e) => emit("update:modelValue", e.value),
|
|
71
|
+
},{
|
|
72
|
+
option: (op) => h(QItem, {
|
|
73
|
+
...op.itemProps,
|
|
74
|
+
}, () => [
|
|
75
|
+
h(QItemSection, {
|
|
76
|
+
class: 'q-ma-none q-pa-none',
|
|
77
|
+
avatar: true
|
|
78
|
+
}, () => h(QIcon, {
|
|
79
|
+
name: op.opt.icon
|
|
80
|
+
})),
|
|
81
|
+
props.showLabel ? h(QItemSection, {
|
|
82
|
+
class: 'q-ma-none q-pa-none',
|
|
83
|
+
avatar: true
|
|
84
|
+
}, () => props.showLabel ? op.opt.label : '') : undefined]),
|
|
85
|
+
'selected-item': (op) => h(QIcon, {
|
|
86
|
+
class: 'bg-grey-3 q-pa-xs self-center',
|
|
87
|
+
style: 'border-radius: 50%; margin: 0 auto;',
|
|
88
|
+
size: props.dense ? 'xs' : 'sm',
|
|
89
|
+
dense: props.dense,
|
|
90
|
+
name: dataTypeIcons[op.opt],
|
|
91
|
+
}),
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
h,
|
|
5
|
+
} from "vue";
|
|
6
|
+
import { QToggle } from 'quasar';
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: "FreeFieldBooleanEditor",
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: Boolean
|
|
12
|
+
},
|
|
13
|
+
emits: ['update:modelValue'],
|
|
14
|
+
setup(props, { emit }) {
|
|
15
|
+
return () => h(QToggle,{
|
|
16
|
+
modelValue: props.modelValue,
|
|
17
|
+
'onUpdate:modelValue': (e) => {
|
|
18
|
+
emit('update:modelValue', Boolean(e) || false);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
h,
|
|
5
|
+
} from "vue";
|
|
6
|
+
import { QInput } from 'quasar';
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: "FreeFieldDateEditor",
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: String
|
|
12
|
+
},
|
|
13
|
+
emits: ['update:modelValue'],
|
|
14
|
+
setup(props, { emit }) {
|
|
15
|
+
return () => h(QInput,{
|
|
16
|
+
type: 'date',
|
|
17
|
+
modelValue: props.modelValue,
|
|
18
|
+
'onUpdate:modelValue': (e) => {
|
|
19
|
+
emit('update:modelValue', e);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
h,
|
|
5
|
+
} from "vue";
|
|
6
|
+
import { QInput } from 'quasar';
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: "FreeFieldDateTimeEditor",
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: String
|
|
12
|
+
},
|
|
13
|
+
emits: ['update:modelValue'],
|
|
14
|
+
setup(props, { emit }) {
|
|
15
|
+
return () => h(QInput,{
|
|
16
|
+
type: 'datetime',
|
|
17
|
+
modelValue: props.modelValue,
|
|
18
|
+
'onUpdate:modelValue': (e) => {
|
|
19
|
+
emit('update:modelValue', e);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import NumberEditor from "./numberEditor";
|
|
2
|
+
import StringEditor from "./stringEditor";
|
|
3
|
+
import BooleanEditor from "./boolEditor";
|
|
4
|
+
import ArrayEditor from "./arrayEditor";
|
|
5
|
+
import ObjectEditor from "./objectEditor";
|
|
6
|
+
import DateEditor from './dateEditor';
|
|
7
|
+
import TimeEditor from "./timeEditor";
|
|
8
|
+
import TextEditor from "./textEditor";
|
|
9
|
+
import LabeledField from "./labeledField";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
NumberEditor,
|
|
13
|
+
StringEditor,
|
|
14
|
+
BooleanEditor,
|
|
15
|
+
ArrayEditor,
|
|
16
|
+
ObjectEditor,
|
|
17
|
+
DateEditor,
|
|
18
|
+
TimeEditor,
|
|
19
|
+
TextEditor,
|
|
20
|
+
LabeledField,
|
|
21
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
resolveDynamicComponent,
|
|
4
|
+
h,
|
|
5
|
+
ref,
|
|
6
|
+
reactive,
|
|
7
|
+
watchEffect,
|
|
8
|
+
nextTick,
|
|
9
|
+
computed,
|
|
10
|
+
} from "vue";
|
|
11
|
+
import { QBtn, QTree, QScrollArea } from "quasar";
|
|
12
|
+
import EditableString from "../EditableString";
|
|
13
|
+
import FieldTypeSelect from '../FieldTypeSelect';
|
|
14
|
+
|
|
15
|
+
import StringEditor from "./stringEditor";
|
|
16
|
+
import NumberEditor from "./numberEditor";
|
|
17
|
+
import BooleanEditor from "./boolEditor";
|
|
18
|
+
import DateEditor from "./dateEditor";
|
|
19
|
+
import TimeEditor from "./timeEditor";
|
|
20
|
+
|
|
21
|
+
//TODO: add selection field type by providing selections and default value
|
|
22
|
+
const fEditors = {
|
|
23
|
+
String: StringEditor,
|
|
24
|
+
Number: NumberEditor,
|
|
25
|
+
Boolean: BooleanEditor,
|
|
26
|
+
Date: DateEditor,
|
|
27
|
+
Time: TimeEditor,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default (isArray = false) =>
|
|
31
|
+
defineComponent({
|
|
32
|
+
name: "FreeFieldJsonEditor",
|
|
33
|
+
props: {
|
|
34
|
+
dense: Boolean,
|
|
35
|
+
icon: String,
|
|
36
|
+
modelValue: [Array, Object],
|
|
37
|
+
// TODO: to implement with provided schema
|
|
38
|
+
schema: [Array, Object],
|
|
39
|
+
valueClickStop: {type: Boolean, default: true},
|
|
40
|
+
submitOnClose: {type: Boolean, default: true}
|
|
41
|
+
},
|
|
42
|
+
emits: ["update:modelValue"],
|
|
43
|
+
setup(props, { emit }) {
|
|
44
|
+
const freeDialog = resolveDynamicComponent('freeDialog');
|
|
45
|
+
const showEditor = ref(false);
|
|
46
|
+
let expanded = reactive(['']);
|
|
47
|
+
const treeRef = ref(null);
|
|
48
|
+
let localValue;
|
|
49
|
+
|
|
50
|
+
watchEffect(() => {
|
|
51
|
+
localValue = props.modelValue;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const treeNodes = computed(() => {
|
|
55
|
+
const calcNode = (d, pp = "") => {
|
|
56
|
+
if (Array.isArray(d)) {
|
|
57
|
+
const ret = {
|
|
58
|
+
type: "Array",
|
|
59
|
+
path: pp,
|
|
60
|
+
children: [],
|
|
61
|
+
};
|
|
62
|
+
d.forEach((da, idx) => {
|
|
63
|
+
const pth = pp ? `${pp}.${idx}` : `${idx}`;
|
|
64
|
+
const cn = calcNode(da, pth);
|
|
65
|
+
|
|
66
|
+
if (cn !== void 0) {
|
|
67
|
+
ret.children.push({
|
|
68
|
+
...cn,
|
|
69
|
+
path: pth,
|
|
70
|
+
name: idx,
|
|
71
|
+
ptype: "Array",
|
|
72
|
+
parent: ret,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
ret.children.push({
|
|
78
|
+
path: pp ? `${pp}.${d.length}` : `${d.length}`,
|
|
79
|
+
name: d.length,
|
|
80
|
+
ptype: "Array",
|
|
81
|
+
type: "String",
|
|
82
|
+
value: "",
|
|
83
|
+
parent: ret,
|
|
84
|
+
new: true,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return ret;
|
|
88
|
+
} else if (typeof d === "object") {
|
|
89
|
+
const ret = {
|
|
90
|
+
type: "Object",
|
|
91
|
+
path: pp,
|
|
92
|
+
children: [],
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const dks = Object.keys(d);
|
|
96
|
+
dks.forEach((dk) => {
|
|
97
|
+
const pth = pp ? `${pp}.${dk}` : `${dk}`;
|
|
98
|
+
const cn = calcNode(d[dk], pth);
|
|
99
|
+
|
|
100
|
+
if (cn !== void 0) {
|
|
101
|
+
ret.children.push({
|
|
102
|
+
...cn,
|
|
103
|
+
path: pth,
|
|
104
|
+
name: dk,
|
|
105
|
+
ptype: "Object",
|
|
106
|
+
parent: ret,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const nextNum = dks.length + 1;
|
|
112
|
+
ret.children.push({
|
|
113
|
+
path: pp ? `${pp}.new${nextNum}` : `new${nextNum}`,
|
|
114
|
+
name: `new${nextNum}`,
|
|
115
|
+
ptype: "Object",
|
|
116
|
+
type: "String",
|
|
117
|
+
value: "",
|
|
118
|
+
parent: ret,
|
|
119
|
+
new: true,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return ret;
|
|
123
|
+
} else {
|
|
124
|
+
let type = "String";
|
|
125
|
+
const dtype = typeof d;
|
|
126
|
+
|
|
127
|
+
if (dtype === "string" || dtype === "undefined") {
|
|
128
|
+
type = "String";
|
|
129
|
+
} else if (dtype === "number") {
|
|
130
|
+
type = "Number";
|
|
131
|
+
} else if (dtype === "boolean") {
|
|
132
|
+
type = "Boolean";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
value: d,
|
|
137
|
+
type,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return (typeof localValue !== 'undefined') ? [{ ...calcNode(localValue), root: true, path: '' }] : [];
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
return () =>
|
|
146
|
+
showEditor.value
|
|
147
|
+
? h(freeDialog, {
|
|
148
|
+
visible: true,
|
|
149
|
+
wrapperStyle: 'min-width: 500px; min-height: 600px; max-height: 95%;max-width: 95%;',
|
|
150
|
+
shadow: '1',
|
|
151
|
+
background: 'white',
|
|
152
|
+
onFreeTrigger: (e) => {
|
|
153
|
+
if(e.trigger === 'closeDialog') {
|
|
154
|
+
showEditor.value = false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} ,{
|
|
158
|
+
default: () =>h(QScrollArea,
|
|
159
|
+
{
|
|
160
|
+
class: 'full-width absolute q-pa-sm',
|
|
161
|
+
style: 'height: calc(100% - 60px)',
|
|
162
|
+
},
|
|
163
|
+
() => [
|
|
164
|
+
h(QTree,
|
|
165
|
+
{
|
|
166
|
+
ref: treeRef,
|
|
167
|
+
dense: true,
|
|
168
|
+
nodes: treeNodes.value,
|
|
169
|
+
accordion: true,
|
|
170
|
+
expanded: expanded,
|
|
171
|
+
'onUpdate:expanded': (e) => {
|
|
172
|
+
Object.assign(expanded, e);
|
|
173
|
+
expanded.splice(e.length);
|
|
174
|
+
},
|
|
175
|
+
"node-key": "path",
|
|
176
|
+
"label-key": "name",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"default-header": (n) => {
|
|
180
|
+
return n.node.root
|
|
181
|
+
? "root"
|
|
182
|
+
: [
|
|
183
|
+
h(FieldTypeSelect, {
|
|
184
|
+
modelValue: n.node.type,
|
|
185
|
+
"onUpdate:modelValue": (e) => {
|
|
186
|
+
let nv = undefined;
|
|
187
|
+
switch (e) {
|
|
188
|
+
case "Array":
|
|
189
|
+
nv = [];
|
|
190
|
+
break;
|
|
191
|
+
case "Object":
|
|
192
|
+
nv = {};
|
|
193
|
+
break;
|
|
194
|
+
case "String":
|
|
195
|
+
nv = "";
|
|
196
|
+
break;
|
|
197
|
+
case "Number":
|
|
198
|
+
nv = 0;
|
|
199
|
+
break;
|
|
200
|
+
case "Boolean":
|
|
201
|
+
nv = false;
|
|
202
|
+
break;
|
|
203
|
+
case "Date":
|
|
204
|
+
nv = new Date();
|
|
205
|
+
break;
|
|
206
|
+
default:
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
Object.setValue(
|
|
211
|
+
localValue,
|
|
212
|
+
`${n.node.path}`,
|
|
213
|
+
nv
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
if(!props.submitOnClose)
|
|
217
|
+
emit("update:modelValue", localValue);
|
|
218
|
+
},
|
|
219
|
+
}),
|
|
220
|
+
h(EditableString, {
|
|
221
|
+
class: "q-mx-md",
|
|
222
|
+
modelValue: n.node.name,
|
|
223
|
+
"onUpdate:modelValue": (nv) => {
|
|
224
|
+
if(nv === void 0 || nv === '' || nv === n.node.name) return;
|
|
225
|
+
|
|
226
|
+
const parent = n.node.parent.path ? Object.nestValue(
|
|
227
|
+
localValue,
|
|
228
|
+
n.node.parent.path
|
|
229
|
+
) : localValue;
|
|
230
|
+
|
|
231
|
+
if (n.node.parent.type === "Array") {
|
|
232
|
+
parent[nv] = parent[n.node.name];
|
|
233
|
+
parent[n.node.name] = "";
|
|
234
|
+
|
|
235
|
+
Object.setValue(
|
|
236
|
+
localValue,
|
|
237
|
+
`${n.node.parent.path}`,
|
|
238
|
+
parent
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
if(!props.submitOnClose)
|
|
242
|
+
emit("update:modelValue", localValue);
|
|
243
|
+
} else if (
|
|
244
|
+
n.node.parent.type === "Object"
|
|
245
|
+
) {
|
|
246
|
+
const pks = Object.keys(parent);
|
|
247
|
+
const kidx = pks.indexOf(n.node.name);
|
|
248
|
+
|
|
249
|
+
if (kidx >= 0) {
|
|
250
|
+
pks[kidx] = nv;
|
|
251
|
+
|
|
252
|
+
if(n.node.parent.path){
|
|
253
|
+
const nobj = {};
|
|
254
|
+
pks.forEach((pk,idx) => {
|
|
255
|
+
if (idx === kidx) {
|
|
256
|
+
nobj[pk] = parent[n.node.name];
|
|
257
|
+
} else {
|
|
258
|
+
nobj[pk] = parent[pk];
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
Object.setValue(
|
|
263
|
+
localValue,
|
|
264
|
+
`${n.node.parent.path}`,
|
|
265
|
+
nobj
|
|
266
|
+
);
|
|
267
|
+
} else {
|
|
268
|
+
const copyValue = { ...localValue };
|
|
269
|
+
delete localValue[n.node.name];
|
|
270
|
+
pks.forEach(pk => delete localValue[pk]);
|
|
271
|
+
pks.forEach((pk,idx) => {
|
|
272
|
+
if (idx === kidx) {
|
|
273
|
+
localValue[pk] = copyValue[n.node.name];
|
|
274
|
+
} else {
|
|
275
|
+
localValue[pk] = copyValue[pk];
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
Object.setValue(parent, nv, n.node.value);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if(!props.submitOnClose)
|
|
284
|
+
emit("update:modelValue", localValue);
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
}),
|
|
288
|
+
(n.node.root || !fEditors[n.node.type])
|
|
289
|
+
? undefined
|
|
290
|
+
: h(fEditors[n.node.type], {
|
|
291
|
+
dense: true,
|
|
292
|
+
borderless: true,
|
|
293
|
+
filled: true,
|
|
294
|
+
placeholder: 'input',
|
|
295
|
+
style: "opacity: 0.6;",
|
|
296
|
+
modelValue: n.node.value,
|
|
297
|
+
class: 'q-space',
|
|
298
|
+
onClick: (e) => {
|
|
299
|
+
// workaround for issue: cannot focus the input control when putting in the header
|
|
300
|
+
if(props.valueClickStop) {
|
|
301
|
+
e.stopPropagation()
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
"onUpdate:modelValue": (e) => {
|
|
305
|
+
Object.setValue(
|
|
306
|
+
localValue,
|
|
307
|
+
`${n.node.path}`,
|
|
308
|
+
e
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
if(!props.submitOnClose)
|
|
312
|
+
emit("update:modelValue", localValue);
|
|
313
|
+
},
|
|
314
|
+
}
|
|
315
|
+
)
|
|
316
|
+
];
|
|
317
|
+
},
|
|
318
|
+
}
|
|
319
|
+
),
|
|
320
|
+
]),
|
|
321
|
+
actions: () => h(QBtn, {
|
|
322
|
+
label: 'Close',
|
|
323
|
+
class: '',
|
|
324
|
+
onClick: () => {
|
|
325
|
+
showEditor.value = false;
|
|
326
|
+
|
|
327
|
+
nextTick(() => {
|
|
328
|
+
if(props.submitOnClose) {
|
|
329
|
+
emit("update:modelValue", localValue);
|
|
330
|
+
}
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
})
|
|
334
|
+
})
|
|
335
|
+
: props.dense ? h(QBtn, {
|
|
336
|
+
dense: true,
|
|
337
|
+
flat: true,
|
|
338
|
+
size: 'sm',
|
|
339
|
+
icon: props.icon || 'edit',
|
|
340
|
+
onClick: () => {
|
|
341
|
+
nextTick(() => {
|
|
342
|
+
showEditor.value = true;
|
|
343
|
+
});
|
|
344
|
+
},
|
|
345
|
+
}) : h(
|
|
346
|
+
"div",
|
|
347
|
+
{
|
|
348
|
+
class: "row no-wrap",
|
|
349
|
+
style: "min-width: 100px;",
|
|
350
|
+
// modelValue: props.modelValue,
|
|
351
|
+
// "onUpdate:modelValue": (e) => {
|
|
352
|
+
// emit("update:modelValue", e);
|
|
353
|
+
// },
|
|
354
|
+
},
|
|
355
|
+
[
|
|
356
|
+
"...",
|
|
357
|
+
h(QBtn, {
|
|
358
|
+
class: "q-ml-xs",
|
|
359
|
+
dense: true,
|
|
360
|
+
flat: true,
|
|
361
|
+
icon: props.icon || "edit",
|
|
362
|
+
onClick: () => {
|
|
363
|
+
nextTick(() => {
|
|
364
|
+
showEditor.value = true;
|
|
365
|
+
});
|
|
366
|
+
},
|
|
367
|
+
}),
|
|
368
|
+
]
|
|
369
|
+
);
|
|
370
|
+
},
|
|
371
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
h,
|
|
5
|
+
resolveDynamicComponent
|
|
6
|
+
} from "vue";
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: "FreeFieldLabeledField",
|
|
10
|
+
props: {
|
|
11
|
+
dense: {type: Boolean, default: true},
|
|
12
|
+
label: String,
|
|
13
|
+
labelMinWidth: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: "100px"
|
|
16
|
+
},
|
|
17
|
+
required: Boolean,
|
|
18
|
+
requiredMark: String,
|
|
19
|
+
hideRequiredMark: Boolean,
|
|
20
|
+
readonly: Boolean,
|
|
21
|
+
modelValue: {},
|
|
22
|
+
type: String,
|
|
23
|
+
submitOnClose: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true,
|
|
26
|
+
},
|
|
27
|
+
valueClickStop: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true,
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
emits: ['update:modelValue'],
|
|
33
|
+
setup(props, { emit }) {
|
|
34
|
+
const dType = props.type || {
|
|
35
|
+
string: "String",
|
|
36
|
+
boolean: "Boolean",
|
|
37
|
+
number: "Number",
|
|
38
|
+
object: "Object",
|
|
39
|
+
array: "Array"
|
|
40
|
+
}[typeof props.modelValue] || 'String';
|
|
41
|
+
|
|
42
|
+
const theComp = resolveDynamicComponent(`${dType}Editor`);
|
|
43
|
+
|
|
44
|
+
return () => theComp ? h('div', {
|
|
45
|
+
class: "free-labeled-field row no-wrap items-center full-width",
|
|
46
|
+
}, [
|
|
47
|
+
h('div', {
|
|
48
|
+
class: "free-labeled-field-label q-pr-md text-right",
|
|
49
|
+
style: `min-width: ${props.labelMinWidth}`
|
|
50
|
+
}, [
|
|
51
|
+
props.label,
|
|
52
|
+
(!props.hideRequiredMark && props.required)? h('span', {
|
|
53
|
+
class: "text-red"
|
|
54
|
+
}, props.requiredMark || '*') : undefined,
|
|
55
|
+
]),
|
|
56
|
+
h(theComp,{
|
|
57
|
+
filled: true,
|
|
58
|
+
"bottom-slots": false,
|
|
59
|
+
// rules: props.required ? ([(val) => !!val]) : "",
|
|
60
|
+
dense: props.dense,
|
|
61
|
+
class: "col",
|
|
62
|
+
readonly: props.readonly,
|
|
63
|
+
valueClickStop: props.valueClickStop,
|
|
64
|
+
submitOnClose: props.submitOnClose,
|
|
65
|
+
modelValue: props.modelValue,
|
|
66
|
+
'onUpdate:modelValue': (e) => {
|
|
67
|
+
if(props.required && (!e && e !== 0 && e !== false)) return;
|
|
68
|
+
|
|
69
|
+
emit('update:modelValue', e);
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
]) : undefined;
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
h,
|
|
5
|
+
watchEffect
|
|
6
|
+
} from "vue";
|
|
7
|
+
import { QInput } from 'quasar';
|
|
8
|
+
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: "FreeFieldStringEditor",
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: Number,
|
|
13
|
+
submitOnClose: Boolean,
|
|
14
|
+
},
|
|
15
|
+
emits: ['update:modelValue'],
|
|
16
|
+
setup(props, { emit, attrs }) {
|
|
17
|
+
let localValue;
|
|
18
|
+
|
|
19
|
+
watchEffect(() => {
|
|
20
|
+
localValue = props.modelValue;
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
return () => h(QInput,{
|
|
24
|
+
...attrs,
|
|
25
|
+
type: 'number',
|
|
26
|
+
modelValue: props.modelValue,
|
|
27
|
+
'onUpdate:modelValue': (e) => {
|
|
28
|
+
localValue = Number(e) || 0;
|
|
29
|
+
if(!props.submitOnClose) {
|
|
30
|
+
emit('update:modelValue', localValue);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
onKeydown: (e) => {
|
|
34
|
+
if(!props.submitOnClose) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if(e.keyCode === 13) {
|
|
39
|
+
emit('update:modelValue', localValue);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
onBlur: (e) => {
|
|
43
|
+
if(!props.submitOnClose) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
emit('update:modelValue', localValue);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
});
|
|
File without changes
|