@next-bricks/form 0.6.0 → 0.8.0

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 (127) hide show
  1. package/dist/bricks.json +9 -3
  2. package/dist/chunks/1970.d03acec3.js +3 -0
  3. package/dist/chunks/{1970.1bf0f5c1.js.map → 1970.d03acec3.js.map} +1 -1
  4. package/dist/chunks/3494.46a2a943.js +2 -0
  5. package/dist/chunks/{3494.81238413.js.map → 3494.46a2a943.js.map} +1 -1
  6. package/dist/chunks/3914.8c8cac45.js +2 -0
  7. package/dist/chunks/3914.8c8cac45.js.map +1 -0
  8. package/dist/chunks/4131.2e43de8e.js +2 -0
  9. package/dist/chunks/4131.2e43de8e.js.map +1 -0
  10. package/dist/chunks/5202.8f6dfe2d.js +2 -0
  11. package/dist/chunks/{5202.e887583f.js.map → 5202.8f6dfe2d.js.map} +1 -1
  12. package/dist/chunks/7325.90c2d158.js +2 -0
  13. package/dist/chunks/7325.90c2d158.js.map +1 -0
  14. package/dist/chunks/737.1aa717c1.js +2 -0
  15. package/dist/chunks/737.1aa717c1.js.map +1 -0
  16. package/dist/chunks/7822.71579dbc.js +2 -0
  17. package/dist/chunks/{7822.8c36398f.js.map → 7822.71579dbc.js.map} +1 -1
  18. package/dist/chunks/873.2b11a4db.js +2 -0
  19. package/dist/chunks/{873.cc3010b0.js.map → 873.2b11a4db.js.map} +1 -1
  20. package/dist/chunks/{8826.4444fb49.js → 9223.c35f1d9a.js} +2 -2
  21. package/dist/chunks/9223.c35f1d9a.js.map +1 -0
  22. package/dist/chunks/9351.e05442c4.js +2 -0
  23. package/dist/chunks/9351.e05442c4.js.map +1 -0
  24. package/dist/chunks/9549.35485e5a.js +2 -0
  25. package/dist/chunks/{9549.530da202.js.map → 9549.35485e5a.js.map} +1 -1
  26. package/dist/chunks/{code-editor.c7e4ccfa.js → code-editor.85b3ad33.js} +2 -2
  27. package/dist/chunks/code-editor.85b3ad33.js.map +1 -0
  28. package/dist/chunks/dynamic-form-item.92484a7f.js +2 -0
  29. package/dist/chunks/dynamic-form-item.92484a7f.js.map +1 -0
  30. package/dist/chunks/general-checkbox.997a7827.js +3 -0
  31. package/dist/chunks/general-checkbox.997a7827.js.map +1 -0
  32. package/dist/chunks/general-form-item.9a3d11f7.js +3 -0
  33. package/dist/chunks/general-form-item.9a3d11f7.js.map +1 -0
  34. package/dist/chunks/general-form.4d14b937.js +2 -0
  35. package/dist/chunks/general-form.4d14b937.js.map +1 -0
  36. package/dist/chunks/general-input.b61b949e.js +3 -0
  37. package/dist/chunks/general-input.b61b949e.js.map +1 -0
  38. package/dist/chunks/general-radio.c0e646e6.js +3 -0
  39. package/dist/chunks/general-radio.c0e646e6.js.map +1 -0
  40. package/dist/chunks/general-select.73da9dc8.js +3 -0
  41. package/dist/chunks/general-select.73da9dc8.js.map +1 -0
  42. package/dist/chunks/general-textarea.82fcd5ff.js +3 -0
  43. package/dist/chunks/general-textarea.82fcd5ff.js.map +1 -0
  44. package/dist/chunks/icon-select.4a1e136f.js +3 -0
  45. package/dist/chunks/icon-select.4a1e136f.js.map +1 -0
  46. package/dist/chunks/main.92315fdf.js +2 -0
  47. package/dist/chunks/main.92315fdf.js.map +1 -0
  48. package/dist/chunks/submit-buttons.95d58206.js +2 -0
  49. package/dist/chunks/submit-buttons.95d58206.js.map +1 -0
  50. package/dist/chunks/upload-image.4cb5e7d4.js +3 -0
  51. package/dist/chunks/upload-image.4cb5e7d4.js.LICENSE.txt +5 -0
  52. package/dist/chunks/upload-image.4cb5e7d4.js.map +1 -0
  53. package/dist/index.5dee6e52.js +2 -0
  54. package/dist/index.5dee6e52.js.map +1 -0
  55. package/dist/manifest.json +147 -93
  56. package/dist-types/bootstrap.d.ts +1 -0
  57. package/dist-types/checkbox/index.d.ts +2 -2
  58. package/dist-types/code-editor/index.d.ts +2 -2
  59. package/dist-types/dynamic-form-item/index.d.ts +2 -2
  60. package/dist-types/form/index.d.ts +3 -3
  61. package/dist-types/form-item/index.d.ts +3 -4
  62. package/dist-types/icon-select/index.d.ts +2 -2
  63. package/dist-types/input/index.d.ts +2 -2
  64. package/dist-types/radio/index.d.ts +2 -2
  65. package/dist-types/select/index.d.ts +2 -2
  66. package/dist-types/submit-buttons/index.d.ts +2 -2
  67. package/dist-types/textarea/calculateAutoSizeStyle.d.ts +1 -0
  68. package/dist-types/textarea/index.d.ts +2 -2
  69. package/dist-types/upload/Upload.d.ts +22 -0
  70. package/dist-types/upload/Upload.spec.d.ts +1 -0
  71. package/dist-types/upload/upload-image/i18n.d.ts +13 -0
  72. package/dist-types/upload/upload-image/index.d.ts +55 -0
  73. package/dist-types/upload/upload-image/index.spec.d.ts +1 -0
  74. package/dist-types/upload/utils.d.ts +27 -0
  75. package/docs/upload-image.md +14 -0
  76. package/package.json +2 -2
  77. package/dist/chunks/1970.1bf0f5c1.js +0 -3
  78. package/dist/chunks/3494.81238413.js +0 -2
  79. package/dist/chunks/3914.2e2d5e08.js +0 -2
  80. package/dist/chunks/3914.2e2d5e08.js.map +0 -1
  81. package/dist/chunks/4131.cd33579d.js +0 -2
  82. package/dist/chunks/4131.cd33579d.js.map +0 -1
  83. package/dist/chunks/4795.90b6991e.js +0 -2
  84. package/dist/chunks/4795.90b6991e.js.map +0 -1
  85. package/dist/chunks/5202.e887583f.js +0 -2
  86. package/dist/chunks/7822.8c36398f.js +0 -2
  87. package/dist/chunks/873.cc3010b0.js +0 -2
  88. package/dist/chunks/8826.4444fb49.js.map +0 -1
  89. package/dist/chunks/8971.3c456032.js +0 -2
  90. package/dist/chunks/8971.3c456032.js.map +0 -1
  91. package/dist/chunks/9549.530da202.js +0 -2
  92. package/dist/chunks/code-editor.c7e4ccfa.js.map +0 -1
  93. package/dist/chunks/dynamic-form-item.3422b9a9.js +0 -2
  94. package/dist/chunks/dynamic-form-item.3422b9a9.js.map +0 -1
  95. package/dist/chunks/general-checkbox.6e66bf0c.js +0 -3
  96. package/dist/chunks/general-checkbox.6e66bf0c.js.map +0 -1
  97. package/dist/chunks/general-form-item.c64f3d47.js +0 -3
  98. package/dist/chunks/general-form-item.c64f3d47.js.map +0 -1
  99. package/dist/chunks/general-form.c99d1966.js +0 -2
  100. package/dist/chunks/general-form.c99d1966.js.map +0 -1
  101. package/dist/chunks/general-input.75439cfd.js +0 -3
  102. package/dist/chunks/general-input.75439cfd.js.map +0 -1
  103. package/dist/chunks/general-radio.d3d10247.js +0 -3
  104. package/dist/chunks/general-radio.d3d10247.js.map +0 -1
  105. package/dist/chunks/general-select.9b116d99.js +0 -3
  106. package/dist/chunks/general-select.9b116d99.js.map +0 -1
  107. package/dist/chunks/general-textarea.cd20b779.js +0 -3
  108. package/dist/chunks/general-textarea.cd20b779.js.map +0 -1
  109. package/dist/chunks/icon-select.17e7993f.js +0 -3
  110. package/dist/chunks/icon-select.17e7993f.js.map +0 -1
  111. package/dist/chunks/main.3078c5a8.js +0 -2
  112. package/dist/chunks/main.3078c5a8.js.map +0 -1
  113. package/dist/chunks/submit-buttons.c0d01f4c.js +0 -2
  114. package/dist/chunks/submit-buttons.c0d01f4c.js.map +0 -1
  115. package/dist/index.2550b502.js +0 -2
  116. package/dist/index.2550b502.js.map +0 -1
  117. package/dist-types/form/formStore.d.ts +0 -53
  118. package/dist-types/form-item/FormItemElement.d.ts +0 -22
  119. package/dist-types/utils/PubSub.d.ts +0 -6
  120. /package/dist/chunks/{1970.1bf0f5c1.js.LICENSE.txt → 1970.d03acec3.js.LICENSE.txt} +0 -0
  121. /package/dist/chunks/{general-checkbox.6e66bf0c.js.LICENSE.txt → general-checkbox.997a7827.js.LICENSE.txt} +0 -0
  122. /package/dist/chunks/{general-form-item.c64f3d47.js.LICENSE.txt → general-form-item.9a3d11f7.js.LICENSE.txt} +0 -0
  123. /package/dist/chunks/{general-input.75439cfd.js.LICENSE.txt → general-input.b61b949e.js.LICENSE.txt} +0 -0
  124. /package/dist/chunks/{general-radio.d3d10247.js.LICENSE.txt → general-radio.c0e646e6.js.LICENSE.txt} +0 -0
  125. /package/dist/chunks/{general-select.9b116d99.js.LICENSE.txt → general-select.73da9dc8.js.LICENSE.txt} +0 -0
  126. /package/dist/chunks/{general-textarea.cd20b779.js.LICENSE.txt → general-textarea.82fcd5ff.js.LICENSE.txt} +0 -0
  127. /package/dist/chunks/{icon-select.17e7993f.js.LICENSE.txt → icon-select.4a1e136f.js.LICENSE.txt} +0 -0
@@ -288,6 +288,99 @@
288
288
  ],
289
289
  "description": "表单构件"
290
290
  },
291
+ {
292
+ "name": "form.general-radio",
293
+ "properties": [
294
+ {
295
+ "name": "name",
296
+ "description": "下拉框字段名",
297
+ "type": "string"
298
+ },
299
+ {
300
+ "name": "label",
301
+ "description": "单选框字段说明",
302
+ "type": "string"
303
+ },
304
+ {
305
+ "name": "options",
306
+ "description": "单选框选项表",
307
+ "required": true,
308
+ "attribute": false,
309
+ "type": "GeneralOption[]"
310
+ },
311
+ {
312
+ "name": "value",
313
+ "description": "单选框当前选中始值",
314
+ "attribute": false,
315
+ "type": "any"
316
+ },
317
+ {
318
+ "name": "required",
319
+ "description": "是否必填",
320
+ "type": "boolean"
321
+ },
322
+ {
323
+ "name": "message",
324
+ "description": "校验文本信息",
325
+ "attribute": false,
326
+ "type": "Record<string, string>"
327
+ },
328
+ {
329
+ "name": "disabled",
330
+ "description": "是否禁用",
331
+ "type": "boolean"
332
+ },
333
+ {
334
+ "name": "type",
335
+ "description": "单选框样式类型",
336
+ "default": "\"default\"",
337
+ "type": "RadioType"
338
+ },
339
+ {
340
+ "name": "ui",
341
+ "description": "UI样式",
342
+ "default": "\"default\"",
343
+ "type": "UIType"
344
+ },
345
+ {
346
+ "name": "size",
347
+ "description": "大小,只对按钮样式生效",
348
+ "default": "\"medium\"",
349
+ "type": "ComponentSize"
350
+ },
351
+ {
352
+ "name": "customStyle",
353
+ "description": "自定义radio的外层样式",
354
+ "attribute": false,
355
+ "type": "React.CSSProperties"
356
+ },
357
+ {
358
+ "name": "useBrick",
359
+ "description": "自定义radio的内容",
360
+ "attribute": false,
361
+ "type": "UseSingleBrickConf"
362
+ }
363
+ ],
364
+ "events": [
365
+ {
366
+ "name": "change",
367
+ "description": "值变化事件",
368
+ "detail": {
369
+ "type": "{\n label: string;\n value: any;\n [key: string]: any;\n }"
370
+ }
371
+ },
372
+ {
373
+ "name": "options.change",
374
+ "description": "选项列表变化事件",
375
+ "detail": {
376
+ "type": "{\n options: {\n label: string;\n value: any;\n [key: string]: any;\n };\n name: string;\n }"
377
+ }
378
+ }
379
+ ],
380
+ "slots": [],
381
+ "methods": [],
382
+ "description": "通用单选构件"
383
+ },
291
384
  {
292
385
  "name": "form.general-form-item",
293
386
  "properties": [
@@ -416,99 +509,6 @@
416
509
  "methods": [],
417
510
  "description": ""
418
511
  },
419
- {
420
- "name": "form.general-radio",
421
- "properties": [
422
- {
423
- "name": "name",
424
- "description": "下拉框字段名",
425
- "type": "string"
426
- },
427
- {
428
- "name": "label",
429
- "description": "单选框字段说明",
430
- "type": "string"
431
- },
432
- {
433
- "name": "options",
434
- "description": "单选框选项表",
435
- "required": true,
436
- "attribute": false,
437
- "type": "GeneralOption[]"
438
- },
439
- {
440
- "name": "value",
441
- "description": "单选框当前选中始值",
442
- "attribute": false,
443
- "type": "any"
444
- },
445
- {
446
- "name": "required",
447
- "description": "是否必填",
448
- "type": "boolean"
449
- },
450
- {
451
- "name": "message",
452
- "description": "校验文本信息",
453
- "attribute": false,
454
- "type": "Record<string, string>"
455
- },
456
- {
457
- "name": "disabled",
458
- "description": "是否禁用",
459
- "type": "boolean"
460
- },
461
- {
462
- "name": "type",
463
- "description": "单选框样式类型",
464
- "default": "\"default\"",
465
- "type": "RadioType"
466
- },
467
- {
468
- "name": "ui",
469
- "description": "UI样式",
470
- "default": "\"default\"",
471
- "type": "UIType"
472
- },
473
- {
474
- "name": "size",
475
- "description": "大小,只对按钮样式生效",
476
- "default": "\"medium\"",
477
- "type": "ComponentSize"
478
- },
479
- {
480
- "name": "customStyle",
481
- "description": "自定义radio的外层样式",
482
- "attribute": false,
483
- "type": "React.CSSProperties"
484
- },
485
- {
486
- "name": "useBrick",
487
- "description": "自定义radio的内容",
488
- "attribute": false,
489
- "type": "UseSingleBrickConf"
490
- }
491
- ],
492
- "events": [
493
- {
494
- "name": "change",
495
- "description": "值变化事件",
496
- "detail": {
497
- "type": "{\n label: string;\n value: any;\n [key: string]: any;\n }"
498
- }
499
- },
500
- {
501
- "name": "options.change",
502
- "description": "选项列表变化事件",
503
- "detail": {
504
- "type": "{\n options: {\n label: string;\n value: any;\n [key: string]: any;\n };\n name: string;\n }"
505
- }
506
- }
507
- ],
508
- "slots": [],
509
- "methods": [],
510
- "description": "通用单选构件"
511
- },
512
512
  {
513
513
  "name": "form.general-select",
514
514
  "properties": [
@@ -1060,6 +1060,60 @@
1060
1060
  "slots": [],
1061
1061
  "methods": [],
1062
1062
  "description": "图标选择构件"
1063
+ },
1064
+ {
1065
+ "name": "form.upload-image",
1066
+ "properties": [
1067
+ {
1068
+ "name": "name",
1069
+ "description": "字段名称",
1070
+ "type": "string"
1071
+ },
1072
+ {
1073
+ "name": "label",
1074
+ "description": "字段说明",
1075
+ "type": "string"
1076
+ },
1077
+ {
1078
+ "name": "value",
1079
+ "description": "值",
1080
+ "attribute": false,
1081
+ "type": "FileData[]"
1082
+ },
1083
+ {
1084
+ "name": "bucketName",
1085
+ "description": "对象存储桶名字",
1086
+ "type": "string"
1087
+ },
1088
+ {
1089
+ "name": "multiple",
1090
+ "description": "是否支持选定的多张图片",
1091
+ "type": "boolean"
1092
+ },
1093
+ {
1094
+ "name": "required",
1095
+ "description": "是否必填",
1096
+ "type": "boolean"
1097
+ },
1098
+ {
1099
+ "name": "message",
1100
+ "description": "校验文本信息",
1101
+ "attribute": false,
1102
+ "type": "Record<string, string>"
1103
+ }
1104
+ ],
1105
+ "events": [
1106
+ {
1107
+ "name": "change",
1108
+ "description": "值变化时触发",
1109
+ "detail": {
1110
+ "type": "FileData[]"
1111
+ }
1112
+ }
1113
+ ],
1114
+ "slots": [],
1115
+ "methods": [],
1116
+ "description": "上传图片构件"
1063
1117
  }
1064
1118
  ]
1065
1119
  }
@@ -10,3 +10,4 @@ import "./code-editor/index.js";
10
10
  import "./dynamic-form-item/index.js";
11
11
  import "./search/index.js";
12
12
  import "./icon-select/index.js";
13
+ import "./upload/upload-image/index.js";
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import "@next-core/theme";
3
- import { FormItemElement } from "../form-item/FormItemElement.js";
4
3
  import type { FormItemProps } from "../form-item/index.js";
4
+ import { FormItemElementBase } from "@next-shared/form";
5
5
  export type CheckboxType = "default" | "icon";
6
6
  export declare type CheckboxValueType = string | number | boolean;
7
7
  export interface CheckboxOptionType {
@@ -34,7 +34,7 @@ export interface CheckboxProps extends FormItemProps {
34
34
  * 表单复选框构件
35
35
  * @author derrickma
36
36
  */
37
- declare class Checkbox extends FormItemElement {
37
+ declare class Checkbox extends FormItemElementBase {
38
38
  #private;
39
39
  /**
40
40
  * 字段名称
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { CodeEditorProps, HighlightTokenSettings, Annotation } from "./interfaces.js";
3
- import { FormItemElement } from "../form-item/FormItemElement.js";
3
+ import { FormItemElementBase } from "@next-shared/form";
4
4
  export interface Error {
5
5
  err: Annotation[];
6
6
  hasError: boolean;
@@ -13,7 +13,7 @@ export interface Error {
13
13
  * @author sailor
14
14
  * @noInheritDoc
15
15
  */
16
- declare class CodeEditor extends FormItemElement {
16
+ declare class CodeEditor extends FormItemElementBase {
17
17
  #private;
18
18
  /**
19
19
  * @description
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { FormItemElement } from "../form-item/FormItemElement.js";
3
2
  import { UseBrickConf } from "@next-core/types";
4
3
  import "@next-core/theme";
4
+ import { FormItemElementBase } from "@next-shared/form";
5
5
  type DynamicFormValuesItem = Record<string, any>;
6
6
  /**
7
7
  * @id form.dynamic-form-item
@@ -11,7 +11,7 @@ type DynamicFormValuesItem = Record<string, any>;
11
11
  * @author sailor
12
12
  * @noInheritDoc
13
13
  */
14
- declare class DynamicFormItem extends FormItemElement {
14
+ declare class DynamicFormItem extends FormItemElementBase {
15
15
  #private;
16
16
  /**
17
17
  * 字段名称
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ReactNextElement } from "@next-core/react-element";
3
- import { FormStore } from "./formStore.js";
3
+ import { AbstractForm, FormStore } from "@next-shared/form";
4
4
  import { ComponentSize, Layout } from "../interface.js";
5
5
  interface FormProps {
6
6
  values?: Record<string, any>;
@@ -22,12 +22,12 @@ export interface FormMapEvents {
22
22
  * @author sailor
23
23
  * @slot - 表单内容
24
24
  */
25
- declare class Form extends ReactNextElement implements FormProps {
25
+ declare class Form extends ReactNextElement implements FormProps, AbstractForm {
26
26
  #private;
27
- readonly isFormElement = true;
28
27
  formStore: FormStore;
29
28
  defaultEmitValuesChange: boolean;
30
29
  constructor();
30
+ get isFormElement(): true;
31
31
  set values(value: Record<string, unknown>);
32
32
  get values(): Record<string, unknown>;
33
33
  /**
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { FormItemElement } from "./FormItemElement.js";
2
+ import { AbstractForm, FormItemElementBase, MessageBody } from "@next-shared/form";
3
3
  import type { Form } from "../form/index.jsx";
4
4
  import type { ComponentSize, Layout } from "../interface.js";
5
- import type { MessageBody } from "../form/formStore.js";
6
5
  import "@next-core/theme";
7
6
  type CurrentElement = HTMLElement & {
8
7
  size?: ComponentSize;
@@ -10,7 +9,7 @@ type CurrentElement = HTMLElement & {
10
9
  [key: string]: any;
11
10
  };
12
11
  export interface FormItemProps {
13
- formElement?: Form;
12
+ formElement?: AbstractForm | null;
14
13
  curElement: CurrentElement;
15
14
  name?: string;
16
15
  label?: string;
@@ -37,7 +36,7 @@ export interface FormItemProps {
37
36
  * @author sailor
38
37
  * @noInheritDoc
39
38
  */
40
- declare class FormItem extends FormItemElement implements FormItemProps {
39
+ declare class FormItem extends FormItemElementBase implements FormItemProps {
41
40
  /**
42
41
  * @default
43
42
  * @required
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { FormItemElement } from "../form-item/FormItemElement.js";
2
+ import { FormItemElementBase } from "@next-shared/form";
3
3
  import "@next-core/theme";
4
4
  import type { FormItemProps } from "../form-item/index.js";
5
5
  import type { GeneralIconProps } from "@next-bricks/icons/general-icon";
@@ -17,7 +17,7 @@ export interface IconSelectProps {
17
17
  /**
18
18
  * 图标选择构件
19
19
  */
20
- export declare class IconSelect extends FormItemElement implements IconSelectProps {
20
+ export declare class IconSelect extends FormItemElementBase implements IconSelectProps {
21
21
  #private;
22
22
  /**
23
23
  * 字段名称
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { ComponentSize, InputType } from "../interface.js";
3
+ import { FormItemElementBase } from "@next-shared/form";
3
4
  import "@next-core/theme";
4
- import { FormItemElement } from "../form-item/FormItemElement.js";
5
5
  import type { FormItemProps } from "../form-item/index.jsx";
6
6
  interface InputProps extends FormItemProps {
7
7
  value?: string;
@@ -23,7 +23,7 @@ interface InputProps extends FormItemProps {
23
23
  * @slot prefix - 输入框前置插槽
24
24
  * @slot suffix - 输入框后置插槽
25
25
  */
26
- declare class Input extends FormItemElement {
26
+ declare class Input extends FormItemElementBase {
27
27
  #private;
28
28
  /**
29
29
  * 字段名称
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
+ import { FormItemElementBase } from "@next-shared/form";
2
3
  import type { RadioType, GeneralOption, GeneralComplexOption, UIType, RadioGroupButtonStyle, ComponentSize } from "../interface.js";
3
4
  import "@next-core/theme";
4
5
  import type { FormItemProps } from "../form-item/index.jsx";
5
6
  import { UseSingleBrickConf } from "@next-core/types";
6
- import { FormItemElement } from "../form-item/FormItemElement.js";
7
7
  interface CustomOptions {
8
8
  url: string;
9
9
  description?: string;
@@ -38,7 +38,7 @@ export interface RadioEventsMapping {
38
38
  * 通用单选构件
39
39
  * @author sailor
40
40
  */
41
- declare class Radio extends FormItemElement {
41
+ declare class Radio extends FormItemElementBase {
42
42
  #private;
43
43
  /**
44
44
  * 下拉框字段名
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
+ import { FormItemElementBase } from "@next-shared/form";
2
3
  import type { GeneralComplexOption } from "../interface.js";
3
4
  import "@next-core/theme";
4
5
  import type { FormItemProps } from "../form-item/index.jsx";
5
- import { FormItemElement } from "../form-item/FormItemElement.js";
6
6
  export interface SelectProps extends FormItemProps {
7
7
  value?: any;
8
8
  options: GeneralComplexOption[];
@@ -19,7 +19,7 @@ export interface SelectProps extends FormItemProps {
19
19
  * 通用下拉选择构件
20
20
  * @author julielai
21
21
  */
22
- declare class Select extends FormItemElement {
22
+ declare class Select extends FormItemElementBase {
23
23
  #private;
24
24
  /**
25
25
  * 字段名称
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
+ import { FormItemElementBase } from "@next-shared/form";
2
3
  import type { ButtonType } from "../interface.js";
3
- import { FormItemElement } from "../form-item/FormItemElement.js";
4
4
  interface SubmitButtonsProps {
5
5
  curElement: HTMLElement;
6
6
  submitText?: string;
@@ -15,7 +15,7 @@ interface SubmitButtonsProps {
15
15
  * 用于general-forms的通用按钮
16
16
  * @author zhendong
17
17
  */
18
- declare class SubmitButtons extends FormItemElement {
18
+ declare class SubmitButtons extends FormItemElementBase {
19
19
  #private;
20
20
  /**
21
21
  * 提交按钮的文字
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" resolution-mode="require"/>
2
3
  export default function calculateAutoSizeStyle(uiTextNode: HTMLTextAreaElement, minRows?: number | null, maxRows?: number | null): React.CSSProperties;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { FormItemElement } from "../form-item/FormItemElement.js";
2
+ import { FormItemElementBase } from "@next-shared/form";
3
3
  import type { FormItemProps } from "../form-item/index.jsx";
4
4
  import "@next-core/theme";
5
5
  type AutoSize = boolean | {
@@ -22,7 +22,7 @@ interface TextareaProps extends FormItemProps {
22
22
  * 通用多行文本输入框构件
23
23
  * @author sailor
24
24
  */
25
- declare class Textarea extends FormItemElement {
25
+ declare class Textarea extends FormItemElementBase {
26
26
  #private;
27
27
  /**
28
28
  * 字段名称
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import "@next-core/theme";
3
+ import { type FileData } from "./utils.js";
4
+ export interface UploadActions {
5
+ upload: () => void;
6
+ }
7
+ export interface ItemActions {
8
+ remove: () => void;
9
+ }
10
+ export interface UploadProps {
11
+ uploadRender: (fileDataList: FileData[], actions: UploadActions) => React.ReactElement;
12
+ itemRender: (fileData: FileData, fileDataList: FileData[], actions: ItemActions) => React.ReactElement;
13
+ fileList?: FileData[];
14
+ autoUpload?: boolean;
15
+ uploadName?: string;
16
+ action?: string;
17
+ method?: string;
18
+ accept?: string;
19
+ multiple?: boolean;
20
+ onChange?: (fileDataList: FileData[]) => void;
21
+ }
22
+ export declare function Upload(props: UploadProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare enum K {
2
+ UPLOAD = "UPLOAD",
3
+ FILE_UPLOADING = "FILE_UPLOADING"
4
+ }
5
+ export declare const NS = "bricks/form/upload-image";
6
+ export declare const locales: {
7
+ en: Locale;
8
+ zh: Locale;
9
+ };
10
+ type Locale = {
11
+ [key in K]: string;
12
+ };
13
+ export {};
@@ -0,0 +1,55 @@
1
+ /// <reference types="react" />
2
+ import "@next-core/theme";
3
+ import { FormItemElementBase } from "@next-shared/form";
4
+ import type { FormItemProps } from "../../form-item/index.js";
5
+ import { type FileData } from "../utils.js";
6
+ export interface UploadImageProps {
7
+ label?: string;
8
+ name?: string;
9
+ required?: boolean;
10
+ message?: Record<string, string>;
11
+ value?: FileData[];
12
+ bucketName: string;
13
+ multiple?: boolean;
14
+ }
15
+ /**
16
+ * 上传图片构件
17
+ */
18
+ export declare class UploadImage extends FormItemElementBase implements UploadImageProps {
19
+ #private;
20
+ /**
21
+ * 字段名称
22
+ */
23
+ accessor name: string | undefined;
24
+ /**
25
+ * 字段说明
26
+ */
27
+ accessor label: string | undefined;
28
+ /**
29
+ * 值
30
+ */
31
+ accessor value: FileData[] | undefined;
32
+ /**
33
+ * 对象存储桶名字
34
+ */
35
+ accessor bucketName: string;
36
+ /**
37
+ * 是否支持选定的多张图片
38
+ */
39
+ accessor multiple: boolean | undefined;
40
+ /**
41
+ * 是否必填
42
+ */
43
+ accessor required: boolean | undefined;
44
+ /**
45
+ * 校验文本信息
46
+ */
47
+ accessor message: Record<string, string> | undefined;
48
+ handleChange: (fileDataList: FileData[]) => void;
49
+ render(): JSX.Element;
50
+ }
51
+ interface UploadImageComponentProps extends UploadImageProps, FormItemProps {
52
+ onChange?: (fileDataList: FileData[]) => void;
53
+ }
54
+ export declare function UploadImageComponent(props: UploadImageComponentProps): JSX.Element;
55
+ export {};
@@ -0,0 +1 @@
1
+ import "./index.jsx";
@@ -0,0 +1,27 @@
1
+ export declare const symbolForAbortController: unique symbol;
2
+ export declare const LIST_IGNORE: unique symbol;
3
+ export declare const getUid: () => string;
4
+ export declare const getImage: (file: string | File, revokeUrl?: boolean) => Promise<HTMLImageElement>;
5
+ export declare const acceptValidator: (file: File, accepts?: string | string[]) => boolean;
6
+ export declare const sizeValidator: (file: File, limitSize?: number) => Promise<unknown>;
7
+ export declare const imageValidator: (file: File, limit?: {
8
+ width?: number;
9
+ height?: number;
10
+ }) => Promise<unknown>;
11
+ export declare const getUserData: (file: File) => Promise<{
12
+ url: string;
13
+ naturalWidth: number;
14
+ naturalHeight: number;
15
+ }>;
16
+ export type UploadStatus = "uploading" | "done" | "error";
17
+ export interface FileData {
18
+ uid?: string;
19
+ file?: File & {
20
+ uid?: string;
21
+ };
22
+ response?: any;
23
+ userData?: any;
24
+ status?: UploadStatus;
25
+ errors?: Error[];
26
+ [symbolForAbortController]?: AbortController;
27
+ }
@@ -0,0 +1,14 @@
1
+ 上传图片构件
2
+
3
+ ## Examples
4
+
5
+ ### Basic
6
+
7
+ ```yaml preview
8
+ - brick: form.upload-image
9
+ events:
10
+ change:
11
+ action: console.log
12
+ args:
13
+ - "<% EVENT.detail %>"
14
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/form",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/form",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,5 +37,5 @@
37
37
  "@next-core/build-next-bricks": "^1.7.2",
38
38
  "@next-core/test-next": "^1.0.6"
39
39
  },
40
- "gitHead": "8d1311247a4b4cfe6a06e269c1acc358e06b4cd0"
40
+ "gitHead": "48d2da6ad924e806a65ec2907f03e9d161ded64f"
41
41
  }