@tmagic/form 1.4.15 → 1.4.17
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/dist/tmagic-form.js +19 -8
- package/dist/tmagic-form.umd.cjs +19 -8
- package/package.json +6 -6
- package/src/fields/Date.vue +3 -3
- package/src/fields/DateTime.vue +5 -1
- package/src/fields/Daterange.vue +9 -2
- package/src/fields/Timerange.vue +1 -2
- package/src/schema.ts +3 -0
- package/types/Form.vue.d.ts +30 -30
- package/types/FormBox.vue.d.ts +288 -37
- package/types/FormDialog.vue.d.ts +293 -42
- package/types/FormDrawer.vue.d.ts +295 -44
- package/types/containers/Col.vue.d.ts +14 -14
- package/types/containers/Container.vue.d.ts +16 -16
- package/types/containers/Fieldset.vue.d.ts +10 -10
- package/types/containers/GroupList.vue.d.ts +10 -10
- package/types/containers/GroupListItem.vue.d.ts +10 -10
- package/types/containers/Panel.vue.d.ts +19 -17
- package/types/containers/Row.vue.d.ts +12 -12
- package/types/containers/Step.vue.d.ts +10 -10
- package/types/containers/Table.vue.d.ts +32 -30
- package/types/containers/Tabs.vue.d.ts +12 -12
- package/types/schema.d.ts +3 -0
- package/types/utils/form.d.ts +1 -1
package/dist/tmagic-form.js
CHANGED
|
@@ -2455,7 +2455,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2455
2455
|
const props = __props;
|
|
2456
2456
|
const emit = __emit;
|
|
2457
2457
|
useAddField(props.prop);
|
|
2458
|
-
props.model[props.name] = datetimeFormatter(props.model[props.name], "");
|
|
2458
|
+
props.model[props.name] = datetimeFormatter(props.model[props.name], "", "YYYY/MM/DD");
|
|
2459
2459
|
const changeHandler = (v) => {
|
|
2460
2460
|
emit("change", v);
|
|
2461
2461
|
};
|
|
@@ -2467,8 +2467,8 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2467
2467
|
size: _ctx.size,
|
|
2468
2468
|
placeholder: _ctx.config.placeholder,
|
|
2469
2469
|
disabled: _ctx.disabled,
|
|
2470
|
-
format: _ctx.config.format,
|
|
2471
|
-
"value-format": _ctx.config.valueFormat || "YYYY/MM/DD
|
|
2470
|
+
format: _ctx.config.format || "YYYY/MM/DD",
|
|
2471
|
+
"value-format": _ctx.config.valueFormat || "YYYY/MM/DD",
|
|
2472
2472
|
onChange: changeHandler
|
|
2473
2473
|
}, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format"]);
|
|
2474
2474
|
};
|
|
@@ -2532,7 +2532,11 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2532
2532
|
return;
|
|
2533
2533
|
}
|
|
2534
2534
|
if (Array.isArray(v)) {
|
|
2535
|
-
props.model[item] = datetimeFormatter(
|
|
2535
|
+
props.model[item] = datetimeFormatter(
|
|
2536
|
+
v[index]?.toString(),
|
|
2537
|
+
"",
|
|
2538
|
+
props.config.valueFormat || "YYYY/MM/DD HH:mm:ss"
|
|
2539
|
+
);
|
|
2536
2540
|
} else {
|
|
2537
2541
|
props.model[item] = void 0;
|
|
2538
2542
|
}
|
|
@@ -2544,7 +2548,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2544
2548
|
emit(
|
|
2545
2549
|
"change",
|
|
2546
2550
|
value2.map((item) => {
|
|
2547
|
-
if (item) return datetimeFormatter(item, "");
|
|
2551
|
+
if (item) return datetimeFormatter(item, "", props.config.valueFormat || "YYYY/MM/DD HH:mm:ss");
|
|
2548
2552
|
return void 0;
|
|
2549
2553
|
})
|
|
2550
2554
|
);
|
|
@@ -2567,8 +2571,11 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2567
2571
|
"unlink-panels": true,
|
|
2568
2572
|
disabled: _ctx.disabled,
|
|
2569
2573
|
"default-time": _ctx.config.defaultTime,
|
|
2574
|
+
"value-format": _ctx.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
|
|
2575
|
+
"date-format": _ctx.config.dateFormat || "YYYY/MM/DD",
|
|
2576
|
+
"time-format": _ctx.config.timeFormat || "HH:mm:ss",
|
|
2570
2577
|
onChange: changeHandler
|
|
2571
|
-
}, null, 8, ["modelValue", "size", "disabled", "default-time"]);
|
|
2578
|
+
}, null, 8, ["modelValue", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
|
|
2572
2579
|
};
|
|
2573
2580
|
}
|
|
2574
2581
|
});
|
|
@@ -2599,7 +2606,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
2599
2606
|
if (value === "Invalid Date") {
|
|
2600
2607
|
props.model[props.name] = "";
|
|
2601
2608
|
} else {
|
|
2602
|
-
props.model[props.name] = datetimeFormatter(
|
|
2609
|
+
props.model[props.name] = datetimeFormatter(
|
|
2610
|
+
props.model[props.name],
|
|
2611
|
+
"",
|
|
2612
|
+
props.config.valueFormat || "YYYY/MM/DD HH:mm:ss"
|
|
2613
|
+
);
|
|
2603
2614
|
}
|
|
2604
2615
|
}
|
|
2605
2616
|
const changeHandler = (v) => {
|
|
@@ -4164,7 +4175,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
4164
4175
|
return;
|
|
4165
4176
|
}
|
|
4166
4177
|
if (Array.isArray(v)) {
|
|
4167
|
-
props.model[item] =
|
|
4178
|
+
props.model[item] = v[index];
|
|
4168
4179
|
} else {
|
|
4169
4180
|
props.model[item] = void 0;
|
|
4170
4181
|
}
|
package/dist/tmagic-form.umd.cjs
CHANGED
|
@@ -2454,7 +2454,7 @@
|
|
|
2454
2454
|
const props = __props;
|
|
2455
2455
|
const emit = __emit;
|
|
2456
2456
|
useAddField(props.prop);
|
|
2457
|
-
props.model[props.name] = utils.datetimeFormatter(props.model[props.name], "");
|
|
2457
|
+
props.model[props.name] = utils.datetimeFormatter(props.model[props.name], "", "YYYY/MM/DD");
|
|
2458
2458
|
const changeHandler = (v) => {
|
|
2459
2459
|
emit("change", v);
|
|
2460
2460
|
};
|
|
@@ -2466,8 +2466,8 @@
|
|
|
2466
2466
|
size: _ctx.size,
|
|
2467
2467
|
placeholder: _ctx.config.placeholder,
|
|
2468
2468
|
disabled: _ctx.disabled,
|
|
2469
|
-
format: _ctx.config.format,
|
|
2470
|
-
"value-format": _ctx.config.valueFormat || "YYYY/MM/DD
|
|
2469
|
+
format: _ctx.config.format || "YYYY/MM/DD",
|
|
2470
|
+
"value-format": _ctx.config.valueFormat || "YYYY/MM/DD",
|
|
2471
2471
|
onChange: changeHandler
|
|
2472
2472
|
}, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format"]);
|
|
2473
2473
|
};
|
|
@@ -2531,7 +2531,11 @@
|
|
|
2531
2531
|
return;
|
|
2532
2532
|
}
|
|
2533
2533
|
if (Array.isArray(v)) {
|
|
2534
|
-
props.model[item] = utils.datetimeFormatter(
|
|
2534
|
+
props.model[item] = utils.datetimeFormatter(
|
|
2535
|
+
v[index]?.toString(),
|
|
2536
|
+
"",
|
|
2537
|
+
props.config.valueFormat || "YYYY/MM/DD HH:mm:ss"
|
|
2538
|
+
);
|
|
2535
2539
|
} else {
|
|
2536
2540
|
props.model[item] = void 0;
|
|
2537
2541
|
}
|
|
@@ -2543,7 +2547,7 @@
|
|
|
2543
2547
|
emit(
|
|
2544
2548
|
"change",
|
|
2545
2549
|
value2.map((item) => {
|
|
2546
|
-
if (item) return utils.datetimeFormatter(item, "");
|
|
2550
|
+
if (item) return utils.datetimeFormatter(item, "", props.config.valueFormat || "YYYY/MM/DD HH:mm:ss");
|
|
2547
2551
|
return void 0;
|
|
2548
2552
|
})
|
|
2549
2553
|
);
|
|
@@ -2566,8 +2570,11 @@
|
|
|
2566
2570
|
"unlink-panels": true,
|
|
2567
2571
|
disabled: _ctx.disabled,
|
|
2568
2572
|
"default-time": _ctx.config.defaultTime,
|
|
2573
|
+
"value-format": _ctx.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
|
|
2574
|
+
"date-format": _ctx.config.dateFormat || "YYYY/MM/DD",
|
|
2575
|
+
"time-format": _ctx.config.timeFormat || "HH:mm:ss",
|
|
2569
2576
|
onChange: changeHandler
|
|
2570
|
-
}, null, 8, ["modelValue", "size", "disabled", "default-time"]);
|
|
2577
|
+
}, null, 8, ["modelValue", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
|
|
2571
2578
|
};
|
|
2572
2579
|
}
|
|
2573
2580
|
});
|
|
@@ -2598,7 +2605,11 @@
|
|
|
2598
2605
|
if (value === "Invalid Date") {
|
|
2599
2606
|
props.model[props.name] = "";
|
|
2600
2607
|
} else {
|
|
2601
|
-
props.model[props.name] = utils.datetimeFormatter(
|
|
2608
|
+
props.model[props.name] = utils.datetimeFormatter(
|
|
2609
|
+
props.model[props.name],
|
|
2610
|
+
"",
|
|
2611
|
+
props.config.valueFormat || "YYYY/MM/DD HH:mm:ss"
|
|
2612
|
+
);
|
|
2602
2613
|
}
|
|
2603
2614
|
}
|
|
2604
2615
|
const changeHandler = (v) => {
|
|
@@ -4163,7 +4174,7 @@
|
|
|
4163
4174
|
return;
|
|
4164
4175
|
}
|
|
4165
4176
|
if (Array.isArray(v)) {
|
|
4166
|
-
props.model[item] =
|
|
4177
|
+
props.model[item] = v[index];
|
|
4167
4178
|
} else {
|
|
4168
4179
|
props.model[item] = void 0;
|
|
4169
4180
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.4.
|
|
2
|
+
"version": "1.4.17",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"@types/lodash-es": "^4.17.4",
|
|
44
44
|
"@types/node": "^18.19.0",
|
|
45
45
|
"@types/sortablejs": "^1.15.8",
|
|
46
|
-
"@vitejs/plugin-vue": "^5.
|
|
46
|
+
"@vitejs/plugin-vue": "^5.1.1",
|
|
47
47
|
"@vue/compiler-sfc": "^3.4.27",
|
|
48
48
|
"@vue/test-utils": "^2.4.6",
|
|
49
49
|
"rimraf": "^3.0.2",
|
|
50
50
|
"sass": "^1.77.0",
|
|
51
|
-
"vite": "^5.3.
|
|
51
|
+
"vite": "^5.3.5",
|
|
52
52
|
"vue-tsc": "^2.0.19"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"vue": "^3.4.
|
|
55
|
+
"vue": "^3.4.35",
|
|
56
56
|
"typescript": "*",
|
|
57
|
-
"@tmagic/design": "1.4.
|
|
58
|
-
"@tmagic/utils": "1.4.
|
|
57
|
+
"@tmagic/design": "1.4.17",
|
|
58
|
+
"@tmagic/utils": "1.4.17"
|
|
59
59
|
},
|
|
60
60
|
"peerDependenciesMeta": {
|
|
61
61
|
"typescript": {
|
package/src/fields/Date.vue
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
:size="size"
|
|
6
6
|
:placeholder="config.placeholder"
|
|
7
7
|
:disabled="disabled"
|
|
8
|
-
:format="config.format"
|
|
9
|
-
:value-format="config.valueFormat || 'YYYY/MM/DD
|
|
8
|
+
:format="config.format || 'YYYY/MM/DD'"
|
|
9
|
+
:value-format="config.valueFormat || 'YYYY/MM/DD'"
|
|
10
10
|
@change="changeHandler"
|
|
11
11
|
></TMagicDatePicker>
|
|
12
12
|
</template>
|
|
@@ -30,7 +30,7 @@ const emit = defineEmits<{
|
|
|
30
30
|
|
|
31
31
|
useAddField(props.prop);
|
|
32
32
|
|
|
33
|
-
props.model[props.name] = datetimeFormatter(props.model[props.name], '');
|
|
33
|
+
props.model[props.name] = datetimeFormatter(props.model[props.name], '', 'YYYY/MM/DD');
|
|
34
34
|
|
|
35
35
|
const changeHandler = (v: string) => {
|
|
36
36
|
emit('change', v);
|
package/src/fields/DateTime.vue
CHANGED
|
@@ -37,7 +37,11 @@ if (props.model) {
|
|
|
37
37
|
if (value === 'Invalid Date') {
|
|
38
38
|
props.model[props.name] = '';
|
|
39
39
|
} else {
|
|
40
|
-
props.model[props.name] = datetimeFormatter(
|
|
40
|
+
props.model[props.name] = datetimeFormatter(
|
|
41
|
+
props.model[props.name],
|
|
42
|
+
'',
|
|
43
|
+
props.config.valueFormat || 'YYYY/MM/DD HH:mm:ss',
|
|
44
|
+
);
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
|
package/src/fields/Daterange.vue
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
:unlink-panels="true"
|
|
10
10
|
:disabled="disabled"
|
|
11
11
|
:default-time="config.defaultTime"
|
|
12
|
+
:value-format="config.valueFormat || 'YYYY/MM/DD HH:mm:ss'"
|
|
13
|
+
:date-format="config.dateFormat || 'YYYY/MM/DD'"
|
|
14
|
+
:time-format="config.timeFormat || 'HH:mm:ss'"
|
|
12
15
|
@change="changeHandler"
|
|
13
16
|
></TMagicDatePicker>
|
|
14
17
|
</template>
|
|
@@ -71,7 +74,11 @@ const setValue = (v: Date[] | Date) => {
|
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
76
|
if (Array.isArray(v)) {
|
|
74
|
-
props.model[item] = datetimeFormatter(
|
|
77
|
+
props.model[item] = datetimeFormatter(
|
|
78
|
+
v[index]?.toString(),
|
|
79
|
+
'',
|
|
80
|
+
props.config.valueFormat || 'YYYY/MM/DD HH:mm:ss',
|
|
81
|
+
);
|
|
75
82
|
} else {
|
|
76
83
|
props.model[item] = undefined;
|
|
77
84
|
}
|
|
@@ -85,7 +92,7 @@ const changeHandler = (v: Date[]) => {
|
|
|
85
92
|
emit(
|
|
86
93
|
'change',
|
|
87
94
|
value.map((item?: Date) => {
|
|
88
|
-
if (item) return datetimeFormatter(item, '');
|
|
95
|
+
if (item) return datetimeFormatter(item, '', props.config.valueFormat || 'YYYY/MM/DD HH:mm:ss');
|
|
89
96
|
return undefined;
|
|
90
97
|
}),
|
|
91
98
|
);
|
package/src/fields/Timerange.vue
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
import { ref, watch } from 'vue';
|
|
18
18
|
|
|
19
19
|
import { TMagicTimePicker } from '@tmagic/design';
|
|
20
|
-
import { datetimeFormatter } from '@tmagic/utils';
|
|
21
20
|
|
|
22
21
|
import type { DaterangeConfig, FieldProps } from '../schema';
|
|
23
22
|
import { useAddField } from '../utils/useAddField';
|
|
@@ -59,7 +58,7 @@ const setValue = (v: Date[] | Date) => {
|
|
|
59
58
|
return;
|
|
60
59
|
}
|
|
61
60
|
if (Array.isArray(v)) {
|
|
62
|
-
props.model[item] =
|
|
61
|
+
props.model[item] = v[index];
|
|
63
62
|
} else {
|
|
64
63
|
props.model[item] = undefined;
|
|
65
64
|
}
|
package/src/schema.ts
CHANGED
package/types/Form.vue.d.ts
CHANGED
|
@@ -5,20 +5,20 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
5
5
|
/** 表单值 */
|
|
6
6
|
initValues: Record<string, any>;
|
|
7
7
|
/** 需对比的值(开启对比模式时传入) */
|
|
8
|
-
lastValues?: Record<string, any
|
|
8
|
+
lastValues?: Record<string, any>;
|
|
9
9
|
/** 是否开启对比模式 */
|
|
10
|
-
isCompare?: boolean
|
|
11
|
-
parentValues?: Record<string, any
|
|
12
|
-
labelWidth?: string
|
|
13
|
-
disabled?: boolean
|
|
14
|
-
height?: string
|
|
15
|
-
stepActive?: string | number
|
|
16
|
-
size?: "
|
|
17
|
-
inline?: boolean
|
|
18
|
-
labelPosition?: string
|
|
19
|
-
keyProp?: string
|
|
20
|
-
popperClass?: string
|
|
21
|
-
extendState?: (
|
|
10
|
+
isCompare?: boolean;
|
|
11
|
+
parentValues?: Record<string, any>;
|
|
12
|
+
labelWidth?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
height?: string;
|
|
15
|
+
stepActive?: string | number;
|
|
16
|
+
size?: "small" | "default" | "large";
|
|
17
|
+
inline?: boolean;
|
|
18
|
+
labelPosition?: string;
|
|
19
|
+
keyProp?: string;
|
|
20
|
+
popperClass?: string;
|
|
21
|
+
extendState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
22
22
|
}>, {
|
|
23
23
|
config: () => never[];
|
|
24
24
|
initValues: () => {};
|
|
@@ -33,13 +33,13 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
33
33
|
labelPosition: string;
|
|
34
34
|
keyProp: string;
|
|
35
35
|
}>, {
|
|
36
|
-
values: import("vue").Ref<FormValue>;
|
|
37
|
-
lastValuesProcessed: import("vue").Ref<FormValue>;
|
|
36
|
+
values: import("vue").Ref<FormValue, FormValue>;
|
|
37
|
+
lastValuesProcessed: import("vue").Ref<FormValue, FormValue>;
|
|
38
38
|
formState: FormState;
|
|
39
|
-
initialized: import("vue").Ref<boolean>;
|
|
39
|
+
initialized: import("vue").Ref<boolean, boolean>;
|
|
40
40
|
changeHandler: () => void;
|
|
41
41
|
resetForm: () => any;
|
|
42
|
-
submitForm: (native?: boolean
|
|
42
|
+
submitForm: (native?: boolean) => Promise<any>;
|
|
43
43
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
44
44
|
change: (...args: any[]) => void;
|
|
45
45
|
error: (...args: any[]) => void;
|
|
@@ -51,20 +51,20 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
51
51
|
/** 表单值 */
|
|
52
52
|
initValues: Record<string, any>;
|
|
53
53
|
/** 需对比的值(开启对比模式时传入) */
|
|
54
|
-
lastValues?: Record<string, any
|
|
54
|
+
lastValues?: Record<string, any>;
|
|
55
55
|
/** 是否开启对比模式 */
|
|
56
|
-
isCompare?: boolean
|
|
57
|
-
parentValues?: Record<string, any
|
|
58
|
-
labelWidth?: string
|
|
59
|
-
disabled?: boolean
|
|
60
|
-
height?: string
|
|
61
|
-
stepActive?: string | number
|
|
62
|
-
size?: "
|
|
63
|
-
inline?: boolean
|
|
64
|
-
labelPosition?: string
|
|
65
|
-
keyProp?: string
|
|
66
|
-
popperClass?: string
|
|
67
|
-
extendState?: (
|
|
56
|
+
isCompare?: boolean;
|
|
57
|
+
parentValues?: Record<string, any>;
|
|
58
|
+
labelWidth?: string;
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
height?: string;
|
|
61
|
+
stepActive?: string | number;
|
|
62
|
+
size?: "small" | "default" | "large";
|
|
63
|
+
inline?: boolean;
|
|
64
|
+
labelPosition?: string;
|
|
65
|
+
keyProp?: string;
|
|
66
|
+
popperClass?: string;
|
|
67
|
+
extendState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
68
68
|
}>, {
|
|
69
69
|
config: () => never[];
|
|
70
70
|
initValues: () => {};
|