free-fe-core-modules 0.0.2 → 0.0.4

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 (104) hide show
  1. package/components/Basic/EIcon.vue +2 -4
  2. package/components/Basic/LeveledMenus.vue +0 -5
  3. package/components/Basic/SummaryHead.vue +23 -3
  4. package/components/Dialog/BasicDialog.vue +2 -3
  5. package/components/SlidingCarousel/index.vue +13 -3
  6. package/components/SlidingNews/index.vue +13 -3
  7. package/components/ThemeSwitch/index.vue +7 -5
  8. package/composible/useObjectData.js +69 -0
  9. package/free-field/Fields/AgreementCheck.js +170 -0
  10. package/free-field/Fields/ApiCall.js +123 -0
  11. package/{field-components/Fields/Boolean.vue → free-field/Fields/Boolean.js} +40 -46
  12. package/free-field/Fields/Category.js +28 -0
  13. package/free-field/Fields/Check.js +106 -0
  14. package/free-field/Fields/Customize.js +87 -0
  15. package/free-field/Fields/Date.js +133 -0
  16. package/free-field/Fields/DateRange.js +226 -0
  17. package/free-field/Fields/DynamicList.js +565 -0
  18. package/{field-components → free-field}/Fields/FixedList.vue +78 -83
  19. package/free-field/Fields/InputFieldList.vue +324 -0
  20. package/{field-components → free-field}/Fields/Labels.vue +24 -15
  21. package/{field-components → free-field}/Fields/MixedTable.vue +53 -61
  22. package/free-field/Fields/Number.js +167 -0
  23. package/free-field/Fields/Password.js +81 -0
  24. package/{field-components → free-field}/Fields/Permission.vue +17 -13
  25. package/{field-components → free-field}/Fields/PermissionEditor.vue +62 -105
  26. package/{field-components → free-field}/Fields/QueryFilters.vue +65 -48
  27. package/{field-components → free-field}/Fields/RadioList.vue +36 -12
  28. package/{field-components → free-field}/Fields/Rich.vue +104 -114
  29. package/{field-components → free-field}/Fields/Search.vue +35 -26
  30. package/{field-components → free-field}/Fields/Select.vue +116 -87
  31. package/{field-components → free-field}/Fields/SelectionChain.vue +89 -67
  32. package/{field-components/Fields/Separator.vue → free-field/Fields/Separator.js} +11 -16
  33. package/{field-components → free-field}/Fields/SingleList.vue +27 -21
  34. package/free-field/Fields/Static.js +27 -0
  35. package/free-field/Fields/String.js +105 -0
  36. package/free-field/Fields/Text.js +80 -0
  37. package/{field-components → free-field}/Fields/Time.vue +59 -43
  38. package/{field-components → free-field}/Fields/TimeRange.vue +107 -92
  39. package/free-field/Fields/Year.js +137 -0
  40. package/{field-components → free-field}/Fields/YearRange.vue +63 -73
  41. package/{field-components → free-field}/Fields/index.js +28 -30
  42. package/free-field/composible/fieldWrapper.js +221 -0
  43. package/free-field/composible/freeFieldLabel.js +22 -0
  44. package/free-field/composible/readonlyContent.js +36 -0
  45. package/free-field/composible/useFileSizeUtils.js +52 -0
  46. package/free-field/composible/useFreeField.js +143 -0
  47. package/{field-components → free-field}/index.js +3 -3
  48. package/i18n/en-us/index.js +1 -1
  49. package/i18n/zh-cn/index.js +1 -1
  50. package/index.js +1 -4
  51. package/package.json +2 -2
  52. package/router/error/data.js +4 -1
  53. package/view/dict/index.vue +13 -2
  54. package/view/error/list.vue +22 -14
  55. package/view/menu/index.vue +19 -4
  56. package/view/system/index.vue +15 -2
  57. package/field-components/Fields/AgreementCheck.vue +0 -161
  58. package/field-components/Fields/ApiCall.vue +0 -139
  59. package/field-components/Fields/Category.vue +0 -33
  60. package/field-components/Fields/Check.vue +0 -131
  61. package/field-components/Fields/Customize.vue +0 -103
  62. package/field-components/Fields/Date.vue +0 -142
  63. package/field-components/Fields/DateRange.vue +0 -199
  64. package/field-components/Fields/DynamicList.vue +0 -575
  65. package/field-components/Fields/FieldEditor.vue +0 -379
  66. package/field-components/Fields/File.vue +0 -382
  67. package/field-components/Fields/FileList.vue +0 -405
  68. package/field-components/Fields/FileListCombined.vue +0 -142
  69. package/field-components/Fields/Image.vue +0 -328
  70. package/field-components/Fields/ImageList.vue +0 -285
  71. package/field-components/Fields/ImageListCombined.vue +0 -76
  72. package/field-components/Fields/InputFieldList.vue +0 -299
  73. package/field-components/Fields/Number.vue +0 -247
  74. package/field-components/Fields/Password.vue +0 -79
  75. package/field-components/Fields/Static.vue +0 -22
  76. package/field-components/Fields/String.vue +0 -185
  77. package/field-components/Fields/Text.vue +0 -89
  78. package/field-components/Fields/UltimateFile.vue +0 -100
  79. package/field-components/Fields/Year.vue +0 -124
  80. package/field-components/Fields/components/FieldTypeOptions.vue +0 -248
  81. package/field-components/components/FieldComponents.vue +0 -246
  82. package/free-fields/AutoHide.js +0 -66
  83. package/free-fields/CenterContent.js +0 -15
  84. package/free-fields/Draggable.js +0 -30
  85. package/free-fields/Droppable.js +0 -114
  86. package/free-fields/EditableString.js +0 -63
  87. package/free-fields/FieldCategory.js +0 -83
  88. package/free-fields/FieldTypeSelect.js +0 -94
  89. package/free-fields/fieldEditors/arrayEditor.js +0 -3
  90. package/free-fields/fieldEditors/boolEditor.js +0 -22
  91. package/free-fields/fieldEditors/dateEditor.js +0 -23
  92. package/free-fields/fieldEditors/datetimeEditor.js +0 -23
  93. package/free-fields/fieldEditors/index.js +0 -21
  94. package/free-fields/fieldEditors/jsonEditor.js +0 -371
  95. package/free-fields/fieldEditors/labeledField.js +0 -74
  96. package/free-fields/fieldEditors/numberEditor.js +0 -51
  97. package/free-fields/fieldEditors/objectEditor.js +0 -3
  98. package/free-fields/fieldEditors/selectEditor.js +0 -0
  99. package/free-fields/fieldEditors/stringEditor.js +0 -49
  100. package/free-fields/fieldEditors/textEditor.js +0 -50
  101. package/free-fields/fieldEditors/timeEditor.js +0 -23
  102. package/free-fields/index.js +0 -402
  103. /package/{field-components/Display → free-field/Layout}/index.js +0 -0
  104. /package/{field-components → free-field}/style.sass +0 -0
@@ -1,371 +0,0 @@
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
- });
@@ -1,74 +0,0 @@
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
- });
@@ -1,51 +0,0 @@
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
- });
@@ -1,3 +0,0 @@
1
- import jsonEditor from "./jsonEditor";
2
-
3
- export default jsonEditor();
File without changes
@@ -1,49 +0,0 @@
1
- import {
2
- defineComponent,
3
- h,
4
- watchEffect,
5
- } from "vue";
6
- import { QInput } from 'quasar';
7
-
8
- export default defineComponent({
9
- name: "FreeFieldStringEditor",
10
- props: {
11
- modelValue: String,
12
- submitOnClose: Boolean,
13
- },
14
- emits: ['update:modelValue'],
15
- setup(props, { emit, attrs }) {
16
- let localValue;
17
-
18
- watchEffect(() => {
19
- localValue = props.modelValue;
20
- })
21
-
22
- return () => h(QInput,{
23
- ...attrs,
24
- modelValue: props.modelValue,
25
- 'onUpdate:modelValue': (e) => {
26
- localValue = e || "";
27
- if(!props.submitOnClose) {
28
- emit('update:modelValue', localValue);
29
- }
30
- },
31
- onKeydown: (e) => {
32
- if(!props.submitOnClose) {
33
- return;
34
- }
35
-
36
- if(e.keyCode === 13) {
37
- emit('update:modelValue', localValue);
38
- }
39
- },
40
- onBlur: (e) => {
41
- if(!props.submitOnClose) {
42
- return;
43
- }
44
-
45
- emit('update:modelValue', localValue);
46
- }
47
- });
48
- },
49
- });
@@ -1,50 +0,0 @@
1
- import {
2
- defineComponent,
3
- h,
4
- watchEffect
5
- } from "vue";
6
- import { QInput } from 'quasar';
7
-
8
- export default defineComponent({
9
- name: "FreeFieldTextEditor",
10
- props: {
11
- modelValue: String,
12
- submitOnClose: Boolean,
13
- },
14
- emits: ['update:modelValue'],
15
- setup(props, { emit, attrs }) {
16
- let localValue;
17
-
18
- watchEffect(() => {
19
- localValue = props.modelValue;
20
- })
21
-
22
- return () => h(QInput,{
23
- ...attrs,
24
- type: 'textarea',
25
- modelValue: props.modelValue,
26
- 'onUpdate:modelValue': (e) => {
27
- localValue = e || "";
28
- if(!props.submitOnClose) {
29
- emit('update:modelValue', localValue);
30
- }
31
- },
32
- onKeydown: (e) => {
33
- if(!props.submitOnClose) {
34
- return;
35
- }
36
-
37
- if(e.keyCode === 13) {
38
- emit('update:modelValue', localValue);
39
- }
40
- },
41
- onBlur: (e) => {
42
- if(!props.submitOnClose) {
43
- return;
44
- }
45
-
46
- emit('update:modelValue', localValue);
47
- }
48
- });
49
- },
50
- });
@@ -1,23 +0,0 @@
1
-
2
- import {
3
- defineComponent,
4
- h,
5
- } from "vue";
6
- import { QInput } from 'quasar';
7
-
8
- export default defineComponent({
9
- name: "FreeFieldTimeEditor",
10
- props: {
11
- modelValue: String
12
- },
13
- emits: ['update:modelValue'],
14
- setup(props, { emit }) {
15
- return () => h(QInput,{
16
- type: 'time',
17
- modelValue: props.modelValue,
18
- 'onUpdate:modelValue': (e) => {
19
- emit('update:modelValue', e);
20
- }
21
- });
22
- },
23
- });