@tmagic/form 1.4.16 → 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.
@@ -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 HH:mm:ss",
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(v[index]?.toString(), "");
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(props.model[props.name], "", props.config.valueFormat);
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] = datetimeFormatter(v[index]?.toString(), "");
4178
+ props.model[item] = v[index];
4168
4179
  } else {
4169
4180
  props.model[item] = void 0;
4170
4181
  }
@@ -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 HH:mm:ss",
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(v[index]?.toString(), "");
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(props.model[props.name], "", props.config.valueFormat);
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] = utils.datetimeFormatter(v[index]?.toString(), "");
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.16",
2
+ "version": "1.4.17",
3
3
  "name": "@tmagic/form",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -54,8 +54,8 @@
54
54
  "peerDependencies": {
55
55
  "vue": "^3.4.35",
56
56
  "typescript": "*",
57
- "@tmagic/utils": "1.4.16",
58
- "@tmagic/design": "1.4.16"
57
+ "@tmagic/design": "1.4.17",
58
+ "@tmagic/utils": "1.4.17"
59
59
  },
60
60
  "peerDependenciesMeta": {
61
61
  "typescript": {
@@ -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 HH:mm:ss'"
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);
@@ -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(props.model[props.name], '', props.config.valueFormat);
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
 
@@ -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(v[index]?.toString(), '');
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
  );
@@ -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] = datetimeFormatter(v[index]?.toString(), '');
61
+ props.model[item] = v[index];
63
62
  } else {
64
63
  props.model[item] = undefined;
65
64
  }
package/src/schema.ts CHANGED
@@ -296,6 +296,9 @@ export interface DaterangeConfig extends FormItem {
296
296
  type: 'daterange';
297
297
  defaultTime?: Date[];
298
298
  names?: string[];
299
+ valueFormat?: string;
300
+ dateFormat?: string;
301
+ timeFormat?: string;
299
302
  }
300
303
 
301
304
  /**
package/types/schema.d.ts CHANGED
@@ -229,6 +229,9 @@ export interface DaterangeConfig extends FormItem {
229
229
  type: 'daterange';
230
230
  defaultTime?: Date[];
231
231
  names?: string[];
232
+ valueFormat?: string;
233
+ dateFormat?: string;
234
+ timeFormat?: string;
232
235
  }
233
236
  /**
234
237
  * html编辑器