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
@@ -0,0 +1,105 @@
1
+ import { defineComponent, h } from 'vue';
2
+ import { useFreeField, freeFieldProps, useFreeFieldMethods } from '../composible/useFreeField';
3
+ import { QInput } from 'quasar';
4
+ import ReadonlyContent from '../composible/readonlyContent';
5
+ import freeFieldLabel from '../composible/freeFieldLabel';
6
+
7
+ export default defineComponent({
8
+ name: 'InputFieldString',
9
+ fieldInfo: {
10
+ Category: 'Simple',
11
+ Label: '字符串',
12
+ Value: 'String',
13
+ Extra: [
14
+ {
15
+ Type: 'String',
16
+ Label: '前缀',
17
+ Name: 'Options.Prefix',
18
+ },
19
+ {
20
+ Type: 'String',
21
+ Label: '后缀',
22
+ Name: 'Options.Postfix',
23
+ },
24
+ {
25
+ Type: 'String',
26
+ Label: '最小值',
27
+ Name: 'MinValue',
28
+ },
29
+ {
30
+ Type: 'String',
31
+ Label: '最大值',
32
+ Name: 'MaxValue',
33
+ },
34
+ {
35
+ Type: 'Number',
36
+ Label: '最大长度',
37
+ Name: 'Options.MaxLength',
38
+ },
39
+ {
40
+ Type: 'Labels',
41
+ Label: '类型检查',
42
+ Name: 'rules',
43
+ },
44
+ ],
45
+ Description: '',
46
+ },
47
+ props: {
48
+ ...freeFieldProps,
49
+ },
50
+ emits: ['input'],
51
+ methods: {
52
+ ...useFreeFieldMethods,
53
+ },
54
+ setup(props, { emit, slots }){
55
+ if (!props.Field) return {};
56
+
57
+ const { fieldData, setFieldData } = useFreeField(props);
58
+
59
+ const readonlyNode = () => h(ReadonlyContent, {
60
+ Field: props.Field,
61
+ Content: fieldData.value,
62
+ });
63
+
64
+ const before = () => h(freeFieldLabel, {
65
+ Field: props.Field,
66
+ });
67
+
68
+ const prepend = slots.prepend ? slots.prepend() : (props.Field.Options?.Prefix && h('span',{
69
+ class: 'prefix',
70
+ }, props.Field.Options?.Prefix));
71
+
72
+ const append = slots.append ? slots.append() : (props.Field.Options?.Postfix && h('span',{
73
+ class: 'postfix',
74
+ }, props.Field.Options?.Postfix));
75
+
76
+ const inputNode = () => h(QInput, {
77
+ maxlength: props.Field.Options?.MaxLength,
78
+ autocomplete: 'off',
79
+ // bottomSlots: true,
80
+ hideBottomSpace: true,
81
+ readonly: props.Field?.ReadOnly,
82
+
83
+ class: 'full-width',
84
+ style: props.Field.Info?.Style,
85
+
86
+ rules: props.Field.Rules,
87
+
88
+ modelValue: fieldData.value,
89
+ 'onUpdate:modelValue': (v) => {
90
+ setFieldData(v, emit);
91
+ },
92
+ }, {
93
+ before,
94
+ prepend,
95
+ append,
96
+ });
97
+
98
+ return () => h('div', {
99
+ class: 'simple-field input-field-string row items-center no-wrap',
100
+ }, [
101
+ props.Field.ReadOnly ? readonlyNode() : inputNode(),
102
+ slots.warning && slots.warning(),
103
+ ]);
104
+ },
105
+ });
@@ -0,0 +1,80 @@
1
+ import { defineComponent, h, ref, watchEffect } from 'vue';
2
+ import { useFreeField, freeFieldProps, useFreeFieldMethods } from '../composible/useFreeField';
3
+ import { QInput } from 'quasar';
4
+ import ReadonlyContent from '../composible/readonlyContent';
5
+ import freeFieldLabel from '../composible/freeFieldLabel';
6
+
7
+ export default defineComponent({
8
+ name: 'InputFieldText',
9
+ fieldInfo: {
10
+ Category: 'Simple',
11
+ Label: '文本',
12
+ Value: 'Text',
13
+ Extra: [
14
+ {
15
+ Type: 'Number',
16
+ Label: '最大长度',
17
+ Name: 'Options.MaxLength',
18
+ },
19
+ ],
20
+ Description: '',
21
+ },
22
+ props: {
23
+ ...freeFieldProps,
24
+ },
25
+ emits: ['input'],
26
+ methods: {
27
+ ...useFreeFieldMethods,
28
+ },
29
+ setup(props, { emit, slots }){
30
+ if (!props.Field) return {};
31
+
32
+ const { fieldData, setFieldData } = useFreeField(props);
33
+
34
+ const rows = ref(3);
35
+
36
+ watchEffect(() => {
37
+ const fVal = fieldData.value;
38
+ const contentLines = (fVal && typeof fVal === 'string') ? Math.max((fVal.match(/\n/g) || '').length + 1, fVal.length / 20) : 8;
39
+ rows.value = (props.Field.ReadOnly) ? Math.min(contentLines, 20) : 8;
40
+ })
41
+
42
+ const readonlyNode = () => h(ReadonlyContent, {
43
+ Field: props.Field,
44
+ Content: fieldData.value,
45
+ });
46
+
47
+ const before = () => h(freeFieldLabel, {
48
+ Field: props.Field,
49
+ });
50
+
51
+ const inputNode = () => h(QInput, {
52
+ type: 'textarea',
53
+ maxlength: props.Field.Options?.MaxLength,
54
+ hideBottomSpace: true,
55
+ readonly: props.Field?.ReadOnly,
56
+ rows: rows.value,
57
+
58
+ class: 'full-width',
59
+ style: props.Field.Info?.Style,
60
+
61
+ rules: props.Field.Rules,
62
+
63
+ modelValue: fieldData.value,
64
+ 'onUpdate:modelValue': (v) => {
65
+ setFieldData(v, emit);
66
+ },
67
+ }, {
68
+ before,
69
+ });
70
+
71
+ return () => h('div', {
72
+ class: 'input-field-text',
73
+ }, [
74
+ slots.warning && h('div', {
75
+ class: props.Field.Label ? 'warning-with-label' : 'warning-without-label',
76
+ }, slots.warning()),
77
+ props.Field.ReadOnly ? readonlyNode() : inputNode(),
78
+ ]);
79
+ },
80
+ });
@@ -4,18 +4,18 @@
4
4
  <span
5
5
  :class="`field-label field-label-readonly ${(Field.Label && Field.Label.trim().length)
6
6
  ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
7
- v-if="typeof Field.Label !== 'undefined'">
7
+ v-if="Field.Label !== void 0">
8
8
  <q-tooltip v-if="Field.Description" anchor="top right">{{Field.Description}}</q-tooltip>
9
9
  {{Field.Label || ''}}
10
10
  <span v-if="Field.Required" class="required-mark">*</span>
11
11
  </span>
12
- <span class="readonly-content">{{fieldData}}</span>
12
+ <span class="readonly-content">{{fieldData.value}}</span>
13
13
  </span>
14
- <q-input v-else v-model="fieldData" hide-bottom-space
14
+ <q-input v-else v-model="fieldData.value" hide-bottom-space
15
15
  :readonly="Field.ReadOnly"
16
- v-bind="$attrs" @input="$emit('input')"
16
+ @input="$emit('input')"
17
17
  :ref="`input_field_validator_${Field.Name || Field.Label}`">
18
- <template v-slot:before v-if="typeof Field.Label !== 'undefined'">
18
+ <template v-slot:before v-if="Field.Label !== void 0">
19
19
  <span
20
20
  :class="`field-label ${(Field.Label && Field.Label.trim().length)
21
21
  ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`">
@@ -27,20 +27,20 @@
27
27
  <q-popup-proxy v-if="!Field.ReadOnly" transition-show="scale" transition-hide="scale">
28
28
  <span class="row">
29
29
  <q-date
30
- v-model="fieldData"
30
+ :modelValue="fieldData.value"
31
31
  mask="YYYY-MM-DD HH:mm:ss"
32
32
  :hour-options="hourOptions"
33
33
  :minute-options="minuteOptions"
34
34
  :second-options="secondOptions"
35
35
  :options="timeOptions"
36
- @input="$emit('input')"
36
+ @update:modelValue="changed"
37
37
  :locale="locale"
38
38
  />
39
39
  <q-time
40
- v-model="fieldData"
40
+ :modelValue="fieldData.value"
41
41
  mask="YYYY-MM-DD HH:mm:ss"
42
42
  format24h
43
- @input="$emit('input')"
43
+ @update:modelValue="changed"
44
44
  />
45
45
  </span>
46
46
  </q-popup-proxy>
@@ -54,12 +54,11 @@
54
54
  </template>
55
55
 
56
56
  <script>
57
- import { defineComponent } from 'vue';
58
- import mixins from 'free-fe-mixins';
57
+ import { computed, defineComponent, getCurrentInstance } from 'vue';
58
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
59
59
 
60
60
  export default defineComponent({
61
61
  name: 'InputFieldTime',
62
- mixins: [mixins.InputFieldMixin],
63
62
  fieldInfo: {
64
63
  Category: 'DateTime',
65
64
  Label: '时间',
@@ -88,34 +87,37 @@ export default defineComponent({
88
87
  ],
89
88
  Description: '',
90
89
  },
91
- data() {
92
- return {};
90
+ props: {
91
+ ...freeFieldProps,
93
92
  },
94
- computed: {
95
- locale() {
96
- return this.ctx.config.locales.find(
97
- (l) => l.locale === (this.ctx.config.locale || this.ctx.config.defaultLocale),
98
- ).calendar;
99
- },
100
- hourOptions() {
101
- return this.objOptions ? this.objOptions[0] : undefined;
102
- },
103
- minuteOptions() {
104
- return this.objOptions ? this.objOptions[1] : undefined;
105
- },
106
- secondOptions() {
107
- return this.objOptions ? this.objOptions[2] : undefined;
108
- },
109
- objOptions() {
110
- if (this.Field.Options) {
111
- return this.Field.Options;
112
- }
113
- return undefined;
114
- },
115
- timeOptions() {
116
- if (this.objOptions) return undefined;
93
+ emits:['input'],
94
+ setup(props, { emit }) {
95
+ if (!props.Field) return () => null;
96
+
97
+ const { proxy:vm } = getCurrentInstance();
98
+
99
+ const { fieldData, setFieldData } = useFreeField(props);
100
+
101
+ const locale = vm.ctx.config.locales.find(
102
+ (l) => l.locale === (vm.ctx.config.locale || vm.ctx.config.defaultLocale),
103
+ )?.calendar;
104
+
105
+
106
+ const hourOptions = computed(() => {
107
+ return objOptions.value ? objOptions.value[0] : undefined;
108
+ });
109
+ const minuteOptions = computed(() => {
110
+ return objOptions.value ? objOptions.value[1] : undefined;
111
+ });
112
+ const secondOptions = computed(() => {
113
+ return objOptions.value ? objOptions.value[2] : undefined;
114
+ });
115
+ const objOptions = computed(() => props.Field.Options || undefined);
117
116
 
118
- if (!this.Field.MinValue && !this.Field.MaxValue) {
117
+ const timeOptions = computed(() => {
118
+ if (objOptions.value) return undefined;
119
+
120
+ if (!props.Field.MinValue && !props.Field.MaxValue) {
119
121
  return undefined;
120
122
  }
121
123
 
@@ -123,15 +125,15 @@ export default defineComponent({
123
125
  let minM;
124
126
  let minS;
125
127
 
126
- if (this.Field.MinValue) {
127
- [minH, minM, minS] = this.Field.MinValue;
128
+ if (props.Field.MinValue) {
129
+ [minH, minM, minS] = props.Field.MinValue;
128
130
  }
129
131
 
130
132
  let maxH;
131
133
  let maxM;
132
134
  let maxS;
133
- if (this.Field.MaxValue) {
134
- [maxH, maxM, maxS] = this.Field.MaxValue;
135
+ if (props.Field.MaxValue) {
136
+ [maxH, maxM, maxS] = props.Field.MaxValue;
135
137
  }
136
138
 
137
139
  minH = minH || 0;
@@ -154,7 +156,21 @@ export default defineComponent({
154
156
  }
155
157
  return true;
156
158
  };
157
- },
159
+ });
160
+
161
+ return {
162
+ fieldData,
163
+ locale,
164
+
165
+ hourOptions,
166
+ minuteOptions,
167
+ secondOptions,
168
+ timeOptions,
169
+
170
+ changed: (v) => {
171
+ setFieldData(v, emit);
172
+ }
173
+ };
158
174
  },
159
175
  });
160
176
  </script>
@@ -4,16 +4,16 @@
4
4
  <span
5
5
  :class="`field-label field-label-readonly ${(Field.Label && Field.Label.trim().length)
6
6
  ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
7
- v-if="typeof Field.Label !== 'undefined'"
7
+ v-if="Field.Label !== void 0"
8
8
  >
9
9
  <q-tooltip v-if="Field.Description" anchor="top right">{{Field.Description}}</q-tooltip>
10
10
  {{Field.Label || ''}}
11
11
  <span v-if="Field.Required" class="required-mark">*</span>
12
12
  </span>
13
- <span class="readonly-content">{{fieldData}}</span>
13
+ <span class="readonly-content">{{fieldData.value}}</span>
14
14
  </span>
15
15
  <span v-else class="row items-center no-wrap">
16
- <span v-if="typeof Field.Label !== 'undefined'" class="q-field__before">
16
+ <span v-if="Field.Label !== void 0" class="q-field__before">
17
17
  <span
18
18
  :class="`field-label ${(Field.Label && Field.Label.trim().length)
19
19
  ? '' : 'field-label-empty'} ${Field.Required ? 'required' : ''}`"
@@ -25,7 +25,6 @@
25
25
  </span>
26
26
  <q-input
27
27
  v-model="min"
28
- v-bind="$attrs"
29
28
  hide-bottom-space
30
29
  :readonly="Field.ReadOnly"
31
30
  :ref="`input_field_validator_first`"
@@ -61,7 +60,6 @@
61
60
 
62
61
  <q-input
63
62
  v-model="max"
64
- v-bind="$attrs"
65
63
  hide-bottom-space
66
64
  :readonly="Field.ReadOnly"
67
65
  :ref="`input_field_validator_second`"
@@ -98,12 +96,14 @@
98
96
  </template>
99
97
 
100
98
  <script>
101
- import { defineComponent } from 'vue';
102
- import mixins from 'free-fe-mixins';
99
+ import { defineComponent, ref, getCurrentInstance } from 'vue';
100
+ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
103
101
 
104
102
  export default defineComponent({
105
103
  name: 'InputFieldTimeRange',
106
- mixins: [mixins.InputFieldMixin],
104
+ props: {
105
+ ...freeFieldProps,
106
+ },
107
107
  emits:['input'],
108
108
  fieldInfo: {
109
109
  Category: 'DateTime',
@@ -155,84 +155,85 @@ export default defineComponent({
155
155
  ],
156
156
  Description: '',
157
157
  },
158
- data() {
159
- return {
160
- min: '',
161
- max: '',
158
+ setup(props, { emit }) {
159
+ if (!props.Field) return () => null;
160
+
161
+ const { proxy:vm } = getCurrentInstance();
162
+
163
+ const { fieldData, setFieldData } = useFreeField(props);
164
+
165
+ const updateFieldDate = () => {
166
+ setFieldData([min.value, max.value].join(props.Field.Separator || '~'), emit);
162
167
  };
163
- },
164
- watch: {
165
- fieldData() {
166
- const yl = (this.fieldData || '').split(this.Field.Separator || '~');
167
- this.min = yl[0] && yl[0].trim();
168
- this.max = yl[1] && yl[1].trim();
169
- },
170
- min() {
171
- this.fieldData = [this.min, this.max].join(this.Field.Separator || '~');
172
- this.$emit('input');
173
- },
174
- max() {
175
- this.fieldData = [this.min, this.max].join(this.Field.Separator || '~');
176
- this.$emit('input');
177
- },
178
- },
179
- computed: {
180
- locale() {
181
- return this.ctx.config.locales.find(
182
- (l) => l.locale === (this.ctx.config.locale || this.ctx.config.defaultLocale),
183
- ).calendar;
184
- },
185
- minDateOptions() {
168
+
169
+ const min = ref('');
170
+ const max = ref('');
171
+
172
+ watch(min, () => updateFieldDate());
173
+ watch(max, () => updateFieldDate());
174
+
175
+ watchEffect(() => {
176
+ const yl = (fieldData.value || '').split(props.Field.Separator || '~');
177
+ min.value = yl[0] && yl[0].trim();
178
+ max.value = yl[1] && yl[1].trim();
179
+ });
180
+
181
+ const locale = vm.ctx.config.locales.find(
182
+ (l) => l.locale === (vm.ctx.config.locale || vm.ctx.config.defaultLocale),
183
+ )?.calendar;
184
+
185
+
186
+ const minDateOptions = computed(() => {
186
187
  let minDate = '1900/01/01';
187
188
  let maxDate = '2050/12/31';
188
189
 
189
- if (this.Field.MinValue) {
190
- minDate = this.Field.MinValue.replace(/-/g, '/');
190
+ if (props.Field.MinValue) {
191
+ minDate = props.Field.MinValue.replace(/-/g, '/');
191
192
  [minDate] = minDate.split(' ');
192
193
  }
193
194
 
194
- if (this.Field.TillNow) {
195
+ if (props.Field.TillNow) {
195
196
  maxDate = new Date().toLocaleDateString();
196
- } else if (this.Field.MaxValue) {
197
- maxDate = this.Field.MaxValue.replace(/-/g, '/');
197
+ } else if (props.Field.MaxValue) {
198
+ maxDate = props.Field.MaxValue.replace(/-/g, '/');
198
199
  [maxDate] = maxDate.split(' ');
199
200
  }
200
201
 
201
- if (this.max && this.max.replace(/-/g, '/') < maxDate) {
202
- return (date) => date >= minDate && date <= this.max.replace(/-/g, '/').split(' ')[0];
202
+ if (max.value && max.value.replace(/-/g, '/') < maxDate) {
203
+ return (date) => date >= minDate && date <= max.value.replace(/-/g, '/').split(' ')[0];
203
204
  }
204
205
 
205
206
  return (date) => date >= minDate && date <= maxDate;
206
- },
207
- maxDateOptions() {
207
+ });
208
+ const maxDateOptions = computed(() => {
208
209
  let minDate = '1900/01/01';
209
210
  let maxDate = '2050/12/31';
210
211
 
211
- if (this.Field.MinValue) {
212
- minDate = this.Field.MinValue.replace(/-/g, '/');
212
+ if (props.Field.MinValue) {
213
+ minDate = props.Field.MinValue.replace(/-/g, '/');
213
214
  [minDate] = minDate.split(' ');
214
215
  }
215
216
 
216
- if (this.Field.TillNow) {
217
+ if (props.Field.TillNow) {
217
218
  maxDate = new Date().toLocaleDateString();
218
- } else if (this.Field.MaxValue) {
219
- maxDate = this.Field.MaxValue.replace(/-/g, '/');
219
+ } else if (props.Field.MaxValue) {
220
+ maxDate = props.Field.MaxValue.replace(/-/g, '/');
220
221
  [maxDate] = maxDate.split(' ');
221
222
  }
222
223
 
223
- if (this.min && this.min.replace(/-/g, '/') > minDate) {
224
- return (date) => date >= this.min.replace(/-/g, '/').split(' ')[0] && date <= maxDate;
224
+ if (min.value && min.value.replace(/-/g, '/') > minDate) {
225
+ return (date) => date >= min.value.replace(/-/g, '/').split(' ')[0] && date <= maxDate;
225
226
  }
226
227
 
227
228
  return (date) => date >= minDate && date <= maxDate;
228
- },
229
- minTimeLimit() {
230
- if (this.min && this.Field.MinValue) {
229
+ });
230
+ const minTimeLimit = computed(() => {
231
+ if (min.value && props.Field.MinValue) {
231
232
  try {
232
- const dSplit = this.Field.MinValue.split(' ');
233
+ const dSplit = props.Field.MinValue.split(' ');
233
234
  const mD = dSplit[0];
234
235
 
235
- if (this.min.split(' ')[0] <= mD) {
236
+ if (min.value.split(' ')[0] <= mD) {
236
237
  const [mH, mM] = dSplit[1].split(':');
237
238
 
238
239
  if (mH && mM) {
@@ -251,14 +252,14 @@ export default defineComponent({
251
252
  hour: (t) => t >= 0,
252
253
  minute: (t) => t >= 0,
253
254
  };
254
- },
255
- maxTimeLimit() {
256
- if (this.max && this.Field.MaxValue) {
255
+ });
256
+ const maxTimeLimit = computed(() => {
257
+ if (max.value && props.Field.MaxValue) {
257
258
  try {
258
- const dSplit = this.Field.MaxValue.split(' ');
259
+ const dSplit = props.Field.MaxValue.split(' ');
259
260
  const mD = dSplit[0];
260
261
 
261
- if (this.max.split(' ')[0] >= mD) {
262
+ if (max.value.split(' ')[0] >= mD) {
262
263
  const [mH, mM] = dSplit[1].split(':');
263
264
 
264
265
  if (mH && mM) {
@@ -277,33 +278,30 @@ export default defineComponent({
277
278
  hour: (t) => t >= 0,
278
279
  minute: (t) => t >= 0,
279
280
  };
280
- },
281
- minHourOptions() {
282
- return this.objOptions
283
- ? (this.objOptions.hour || []).filter(this.minTimeLimit.hour) : undefined;
284
- },
285
- minMinuteOptions() {
286
- return this.objOptions
287
- ? (this.objOptions.minute || []).filter(this.minTimeLimit.minute) : undefined;
288
- },
289
- maxHourOptions() {
290
- return this.objOptions
291
- ? (this.objOptions.hour || []).filter(this.maxTimeLimit.hour) : undefined;
292
- },
293
- maxMinuteOptions() {
294
- return this.objOptions
295
- ? (this.objOptions.minute || []).filter(this.maxTimeLimit.minute) : undefined;
296
- },
297
- objOptions() {
298
- if (this.Field.Options) {
299
- return this.Field.Options;
300
- }
301
- return undefined;
302
- },
303
- timeOptions() {
304
- if (this.objOptions) return undefined;
281
+ });
282
+ const minHourOptions = computed(() => {
283
+ return objOptions.value
284
+ ? (objOptions.value.hour || []).filter(minTimeLimit.value.hour) : undefined;
285
+ });
286
+ const minMinuteOptions = computed(() => {
287
+ return objOptions.value
288
+ ? (objOptions.value.minute || []).filter(minTimeLimit.value.minute) : undefined;
289
+ });
290
+ const maxHourOptions = computed(() => {
291
+ return objOptions.value
292
+ ? (objOptions.value.hour || []).filter(maxTimeLimit.value.hour) : undefined;
293
+ });
294
+ const maxMinuteOptions = computed(() => {
295
+ return objOptions.value
296
+ ? (objOptions.value.minute || []).filter(maxTimeLimit.value.minute) : undefined;
297
+ });
305
298
 
306
- if (!this.Field.MinValue && !this.Field.MaxValue) {
299
+ const objOptions = computed(() => props.Field.Options || undefined);
300
+
301
+ const timeOptions = computed(() => {
302
+ if (objOptions.values) return undefined;
303
+
304
+ if (!props.Field.MinValue && !props.Field.MaxValue) {
307
305
  return undefined;
308
306
  }
309
307
 
@@ -311,15 +309,15 @@ export default defineComponent({
311
309
  let minM;
312
310
  let minS;
313
311
 
314
- if (this.Field.MinValue) {
315
- [minH, minM, minS] = this.Field.MinValue;
312
+ if (props.Field.MinValue) {
313
+ [minH, minM, minS] = props.Field.MinValue;
316
314
  }
317
315
 
318
316
  let maxH;
319
317
  let maxM;
320
318
  let maxS;
321
- if (this.Field.MaxValue) {
322
- [maxH, maxM, maxS] = this.Field.MaxValue;
319
+ if (props.Field.MaxValue) {
320
+ [maxH, maxM, maxS] = props.Field.MaxValue;
323
321
  }
324
322
 
325
323
  minH = minH || 0;
@@ -342,7 +340,24 @@ export default defineComponent({
342
340
  }
343
341
  return true;
344
342
  };
345
- },
343
+ });
344
+
345
+ return {
346
+ fieldData,
347
+ locale,
348
+
349
+ minDateOptions,
350
+ maxDateOptions,
351
+ minHourOptions,
352
+ minMinuteOptions,
353
+ maxHourOptions,
354
+ maxMinuteOptions,
355
+ timeOptions,
356
+
357
+ changed: (v) => {
358
+ setFieldData(v, emit);
359
+ }
360
+ };
346
361
  },
347
362
  });
348
363
  </script>