szld-libs 0.2.71 → 0.2.73

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.
@@ -18,6 +18,8 @@ export interface IformConfigItem {
18
18
  }
19
19
 
20
20
  export interface Ijson {
21
+ 'regexp-message'?: string; // 正则表达式提示信息
22
+ regexp: any; // 正则表达式
21
23
  'properties-width'?: number; // 属性集表单宽度
22
24
  'properties-multiple'?: boolean; // 是否支持可增减的表单列表
23
25
  propertiesID: string;
@@ -63,6 +65,7 @@ export interface Ijson {
63
65
  // 定义支持的输入类型枚举
64
66
  export type InputType =
65
67
  | 'text'
68
+ | 'password'
66
69
  | 'textarea'
67
70
  | 'number'
68
71
  | 'select'
@@ -126,6 +126,12 @@ function useDynamicForm(props) {
126
126
  value: (value == null ? void 0 : value.map((v) => dayjs(v))) || null
127
127
  });
128
128
  break;
129
+ case "multiple-date-picker":
130
+ baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.map((d) => d == null ? void 0 : d.format(format || "YYYY-MM-DD"));
131
+ baseProps.getValueProps = (value) => ({
132
+ value: (value == null ? void 0 : value.map((v) => dayjs(v))) || null
133
+ });
134
+ break;
129
135
  }
130
136
  return baseProps;
131
137
  },
@@ -155,6 +161,14 @@ function useDynamicForm(props) {
155
161
  initialValue = void 0;
156
162
  }
157
163
  }
164
+ if (inputType === "multiple-date-picker" && initialValue) {
165
+ try {
166
+ initialValue = initialValue == null ? void 0 : initialValue.split(",");
167
+ initialValue = initialValue.map((v) => dayjs(v));
168
+ } catch (error) {
169
+ initialValue = void 0;
170
+ }
171
+ }
158
172
  if (inputType === "cascader" && initialValue && typeof initialValue === "string") {
159
173
  const delimiter = (_e = itemWithJson.json) == null ? void 0 : _e["cascader-delimiter"];
160
174
  if (delimiter) {
@@ -227,7 +241,7 @@ function useDynamicForm(props) {
227
241
  formListField,
228
242
  isShowLabel = true
229
243
  }) => {
230
- var _a, _b, _c, _d, _e;
244
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
231
245
  const isFormList = (_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a["properties-multiple"];
232
246
  let formListInitValue = [];
233
247
  if (isFormList) {
@@ -366,7 +380,7 @@ function useDynamicForm(props) {
366
380
  const { combinations = [] } = itemWithJson.json || {};
367
381
  if (combinations == null ? void 0 : combinations.length) {
368
382
  return /* @__PURE__ */ jsx(Col, { span: 24 / colNum, children: /* @__PURE__ */ jsx(Form.Item, { label: (_c = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c["combination-name"], children: /* @__PURE__ */ jsx(Space.Compact, { children: combinations.map((item, index) => {
369
- var _a2, _b2;
383
+ var _a2, _b2, _c2, _d2;
370
384
  let initValue = handleSetFormItemInitialValue(item);
371
385
  let width = defaultWidth;
372
386
  const customWidth = {};
@@ -394,6 +408,12 @@ function useDynamicForm(props) {
394
408
  required: true,
395
409
  message: `${placeholder}${item.attrname}`
396
410
  }
411
+ ] : [],
412
+ ...((_c2 = itemWithJson.json) == null ? void 0 : _c2.regexp) ? [
413
+ {
414
+ pattern: new RegExp(itemWithJson.json.regexp),
415
+ message: ((_d2 = itemWithJson.json) == null ? void 0 : _d2["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
416
+ }
397
417
  ] : []
398
418
  ],
399
419
  ...handleSetFormItemProps(item),
@@ -425,6 +445,12 @@ function useDynamicForm(props) {
425
445
  required: true,
426
446
  message: `${placeholder}${itemWithJson.attrname}`
427
447
  }
448
+ ] : [],
449
+ ...((_e = itemWithJson.json) == null ? void 0 : _e.regexp) ? [
450
+ {
451
+ pattern: new RegExp(itemWithJson.json.regexp),
452
+ message: ((_f = itemWithJson.json) == null ? void 0 : _f["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
453
+ }
428
454
  ] : []
429
455
  ],
430
456
  ...handleSetFormItemProps(itemWithJson),
@@ -448,11 +474,17 @@ function useDynamicForm(props) {
448
474
  label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
449
475
  initialValue,
450
476
  rules: [
451
- ...((_e = itemWithJson.json) == null ? void 0 : _e.must) ? [
477
+ ...((_g = itemWithJson.json) == null ? void 0 : _g.must) ? [
452
478
  {
453
479
  required: true,
454
480
  message: `${placeholder}${itemWithJson.attrname}`
455
481
  }
482
+ ] : [],
483
+ ...((_h = itemWithJson.json) == null ? void 0 : _h.regexp) ? [
484
+ {
485
+ pattern: new RegExp(itemWithJson.json.regexp),
486
+ message: ((_i = itemWithJson.json) == null ? void 0 : _i["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
487
+ }
456
488
  ] : []
457
489
  ],
458
490
  ...handleSetFormItemProps(itemWithJson),
@@ -535,6 +567,17 @@ function useDynamicForm(props) {
535
567
  style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
536
568
  }
537
569
  );
570
+ case "password":
571
+ return /* @__PURE__ */ jsx(
572
+ Input.Password,
573
+ {
574
+ placeholder: "请输入",
575
+ ...params,
576
+ disabled: readonly,
577
+ allowClear: true,
578
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
579
+ }
580
+ );
538
581
  case "textarea":
539
582
  return /* @__PURE__ */ jsx(
540
583
  Input.TextArea,
@@ -633,6 +676,15 @@ function useDynamicForm(props) {
633
676
  style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
634
677
  }
635
678
  );
679
+ case "multiple-date-picker":
680
+ return /* @__PURE__ */ jsx(
681
+ DatePicker,
682
+ {
683
+ multiple: true,
684
+ disabled: readonly,
685
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
686
+ }
687
+ );
636
688
  case "radio":
637
689
  return /* @__PURE__ */ jsx(
638
690
  MyRadio,
@@ -106,6 +106,13 @@ const handleSubmitForm = (originalData, allValues) => {
106
106
  attrItem.attrvalue = "";
107
107
  }
108
108
  break;
109
+ case "multiple-date-picker":
110
+ if (Array.isArray(formValue) && formValue.length > 0) {
111
+ attrItem.attrvalue = formValue.join(",");
112
+ } else {
113
+ attrItem.attrvalue = formValue;
114
+ }
115
+ break;
109
116
  case "checkbox":
110
117
  case "mult-select":
111
118
  if (Array.isArray(formValue) && formValue.length > 0) {
@@ -18,6 +18,8 @@ export interface IformConfigItem {
18
18
  }
19
19
 
20
20
  export interface Ijson {
21
+ 'regexp-message'?: string; // 正则表达式提示信息
22
+ regexp: any; // 正则表达式
21
23
  'properties-width'?: number; // 属性集表单宽度
22
24
  'properties-multiple'?: boolean; // 是否支持可增减的表单列表
23
25
  propertiesID: string;
@@ -63,6 +65,7 @@ export interface Ijson {
63
65
  // 定义支持的输入类型枚举
64
66
  export type InputType =
65
67
  | 'text'
68
+ | 'password'
66
69
  | 'textarea'
67
70
  | 'number'
68
71
  | 'select'
@@ -127,6 +127,12 @@ function useDynamicForm(props) {
127
127
  value: (value == null ? void 0 : value.map((v) => dayjs(v))) || null
128
128
  });
129
129
  break;
130
+ case "multiple-date-picker":
131
+ baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.map((d) => d == null ? void 0 : d.format(format || "YYYY-MM-DD"));
132
+ baseProps.getValueProps = (value) => ({
133
+ value: (value == null ? void 0 : value.map((v) => dayjs(v))) || null
134
+ });
135
+ break;
130
136
  }
131
137
  return baseProps;
132
138
  },
@@ -156,6 +162,14 @@ function useDynamicForm(props) {
156
162
  initialValue = void 0;
157
163
  }
158
164
  }
165
+ if (inputType === "multiple-date-picker" && initialValue) {
166
+ try {
167
+ initialValue = initialValue == null ? void 0 : initialValue.split(",");
168
+ initialValue = initialValue.map((v) => dayjs(v));
169
+ } catch (error) {
170
+ initialValue = void 0;
171
+ }
172
+ }
159
173
  if (inputType === "cascader" && initialValue && typeof initialValue === "string") {
160
174
  const delimiter = (_e = itemWithJson.json) == null ? void 0 : _e["cascader-delimiter"];
161
175
  if (delimiter) {
@@ -228,7 +242,7 @@ function useDynamicForm(props) {
228
242
  formListField,
229
243
  isShowLabel = true
230
244
  }) => {
231
- var _a, _b, _c, _d, _e;
245
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
232
246
  const isFormList = (_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a["properties-multiple"];
233
247
  let formListInitValue = [];
234
248
  if (isFormList) {
@@ -367,7 +381,7 @@ function useDynamicForm(props) {
367
381
  const { combinations = [] } = itemWithJson.json || {};
368
382
  if (combinations == null ? void 0 : combinations.length) {
369
383
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { label: (_c = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c["combination-name"], children: /* @__PURE__ */ jsxRuntime.jsx(antd.Space.Compact, { children: combinations.map((item, index) => {
370
- var _a2, _b2;
384
+ var _a2, _b2, _c2, _d2;
371
385
  let initValue = handleSetFormItemInitialValue(item);
372
386
  let width = defaultWidth;
373
387
  const customWidth = {};
@@ -395,6 +409,12 @@ function useDynamicForm(props) {
395
409
  required: true,
396
410
  message: `${placeholder}${item.attrname}`
397
411
  }
412
+ ] : [],
413
+ ...((_c2 = itemWithJson.json) == null ? void 0 : _c2.regexp) ? [
414
+ {
415
+ pattern: new RegExp(itemWithJson.json.regexp),
416
+ message: ((_d2 = itemWithJson.json) == null ? void 0 : _d2["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
417
+ }
398
418
  ] : []
399
419
  ],
400
420
  ...handleSetFormItemProps(item),
@@ -426,6 +446,12 @@ function useDynamicForm(props) {
426
446
  required: true,
427
447
  message: `${placeholder}${itemWithJson.attrname}`
428
448
  }
449
+ ] : [],
450
+ ...((_e = itemWithJson.json) == null ? void 0 : _e.regexp) ? [
451
+ {
452
+ pattern: new RegExp(itemWithJson.json.regexp),
453
+ message: ((_f = itemWithJson.json) == null ? void 0 : _f["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
454
+ }
429
455
  ] : []
430
456
  ],
431
457
  ...handleSetFormItemProps(itemWithJson),
@@ -449,11 +475,17 @@ function useDynamicForm(props) {
449
475
  label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
450
476
  initialValue,
451
477
  rules: [
452
- ...((_e = itemWithJson.json) == null ? void 0 : _e.must) ? [
478
+ ...((_g = itemWithJson.json) == null ? void 0 : _g.must) ? [
453
479
  {
454
480
  required: true,
455
481
  message: `${placeholder}${itemWithJson.attrname}`
456
482
  }
483
+ ] : [],
484
+ ...((_h = itemWithJson.json) == null ? void 0 : _h.regexp) ? [
485
+ {
486
+ pattern: new RegExp(itemWithJson.json.regexp),
487
+ message: ((_i = itemWithJson.json) == null ? void 0 : _i["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
488
+ }
457
489
  ] : []
458
490
  ],
459
491
  ...handleSetFormItemProps(itemWithJson),
@@ -536,6 +568,17 @@ function useDynamicForm(props) {
536
568
  style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
537
569
  }
538
570
  );
571
+ case "password":
572
+ return /* @__PURE__ */ jsxRuntime.jsx(
573
+ antd.Input.Password,
574
+ {
575
+ placeholder: "请输入",
576
+ ...params,
577
+ disabled: readonly,
578
+ allowClear: true,
579
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
580
+ }
581
+ );
539
582
  case "textarea":
540
583
  return /* @__PURE__ */ jsxRuntime.jsx(
541
584
  antd.Input.TextArea,
@@ -634,6 +677,15 @@ function useDynamicForm(props) {
634
677
  style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
635
678
  }
636
679
  );
680
+ case "multiple-date-picker":
681
+ return /* @__PURE__ */ jsxRuntime.jsx(
682
+ antd.DatePicker,
683
+ {
684
+ multiple: true,
685
+ disabled: readonly,
686
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
687
+ }
688
+ );
637
689
  case "radio":
638
690
  return /* @__PURE__ */ jsxRuntime.jsx(
639
691
  MyRadio,
@@ -108,6 +108,13 @@ const handleSubmitForm = (originalData, allValues) => {
108
108
  attrItem.attrvalue = "";
109
109
  }
110
110
  break;
111
+ case "multiple-date-picker":
112
+ if (Array.isArray(formValue) && formValue.length > 0) {
113
+ attrItem.attrvalue = formValue.join(",");
114
+ } else {
115
+ attrItem.attrvalue = formValue;
116
+ }
117
+ break;
111
118
  case "checkbox":
112
119
  case "mult-select":
113
120
  if (Array.isArray(formValue) && formValue.length > 0) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.2.71",
4
+ "version": "0.2.73",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",