@pisell/materials 1.0.1057 → 1.0.1059

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 (202) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +3 -3
  6. package/build/lowcode/preview.js +9 -9
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +20 -20
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +23 -23
  11. package/es/components/PisellCards/index.d.ts +3 -0
  12. package/es/components/PisellCards/index.js +3 -1
  13. package/es/components/PisellContactBrief/PisellContactBrief.d.ts +13 -0
  14. package/es/components/PisellContactBrief/PisellContactBrief.js +223 -0
  15. package/es/components/PisellContactBrief/PisellContactBrief.less +192 -0
  16. package/es/components/PisellContactBrief/PisellContactBrief.stories.d.ts +31 -0
  17. package/es/components/PisellContactBrief/PisellContactBrief.stories.js +196 -0
  18. package/es/components/PisellContactBrief/components/ContactFormModal.d.ts +23 -0
  19. package/es/components/PisellContactBrief/components/ContactFormModal.js +177 -0
  20. package/es/components/PisellContactBrief/components/index.d.ts +5 -0
  21. package/es/components/PisellContactBrief/components/index.js +4 -0
  22. package/es/components/PisellContactBrief/index.d.ts +6 -0
  23. package/es/components/PisellContactBrief/index.js +5 -0
  24. package/es/components/PisellContactBrief/locales.d.ts +55 -0
  25. package/es/components/PisellContactBrief/locales.js +54 -0
  26. package/es/components/PisellContactBrief/types.d.ts +82 -0
  27. package/es/components/PisellContactBrief/types.js +1 -0
  28. package/es/components/dataSourceComponents/fields/Tabs/Tabs.less +8 -0
  29. package/es/components/pisellActionPanel/PisellActionPanel.d.ts +13 -0
  30. package/es/components/pisellActionPanel/PisellActionPanel.js +98 -0
  31. package/es/components/pisellActionPanel/PisellActionPanel.less +69 -0
  32. package/es/components/pisellActionPanel/PisellActionPanel.stories.d.ts +19 -0
  33. package/es/components/pisellActionPanel/PisellActionPanel.stories.js +208 -0
  34. package/es/components/pisellActionPanel/index.d.ts +6 -0
  35. package/es/components/pisellActionPanel/index.js +5 -0
  36. package/es/components/pisellActionPanel/types.d.ts +83 -0
  37. package/es/components/pisellActionPanel/types.js +1 -0
  38. package/es/components/pisellBaseCard/PisellBaseCard.d.ts +8 -0
  39. package/es/components/pisellBaseCard/PisellBaseCard.js +96 -0
  40. package/es/components/pisellBaseCard/PisellBaseCard.less +25 -0
  41. package/es/components/pisellBaseCard/PisellBaseCard.stories.d.ts +19 -0
  42. package/es/components/pisellBaseCard/PisellBaseCard.stories.js +99 -0
  43. package/es/components/pisellBaseCard/index.d.ts +5 -0
  44. package/es/components/pisellBaseCard/index.js +4 -0
  45. package/es/components/pisellBaseCard/types.d.ts +45 -0
  46. package/es/components/pisellBaseCard/types.js +1 -0
  47. package/es/components/pisellCurrency/PisellCurrency.js +18 -12
  48. package/es/components/pisellCurrency/PisellCurrency.less +0 -123
  49. package/es/components/pisellCustomerBrief/PisellCustomerBrief.d.ts +15 -0
  50. package/es/components/pisellCustomerBrief/PisellCustomerBrief.js +145 -0
  51. package/es/components/pisellCustomerBrief/PisellCustomerBrief.less +8 -0
  52. package/es/components/pisellCustomerBrief/PisellCustomerBrief.stories.d.ts +23 -0
  53. package/es/components/pisellCustomerBrief/PisellCustomerBrief.stories.js +193 -0
  54. package/es/components/pisellCustomerBrief/index.d.ts +6 -0
  55. package/es/components/pisellCustomerBrief/index.js +5 -0
  56. package/es/components/pisellCustomerBrief/types.d.ts +82 -0
  57. package/es/components/pisellCustomerBrief/types.js +1 -0
  58. package/es/components/pisellEmail/PisellEmail.js +48 -42
  59. package/es/components/pisellEmail/PisellEmail.less +0 -92
  60. package/es/components/pisellEntityCard/PisellEntityCard.d.ts +8 -0
  61. package/es/components/pisellEntityCard/PisellEntityCard.js +474 -0
  62. package/es/components/pisellEntityCard/PisellEntityCard.less +362 -0
  63. package/es/components/pisellEntityCard/PisellEntityCard.stories.d.ts +47 -0
  64. package/es/components/pisellEntityCard/PisellEntityCard.stories.js +450 -0
  65. package/es/components/pisellEntityCard/index.d.ts +5 -0
  66. package/es/components/pisellEntityCard/index.js +4 -0
  67. package/es/components/pisellEntityCard/types.d.ts +144 -0
  68. package/es/components/pisellEntityCard/types.js +1 -0
  69. package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.js +32 -4
  70. package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.stories.js +4 -2
  71. package/es/components/pisellFloorMapLayout/components/ViewControls.d.ts +4 -0
  72. package/es/components/pisellFloorMapLayout/components/ViewControls.js +12 -2
  73. package/es/components/pisellFloorMapLayout/types.d.ts +2 -0
  74. package/es/components/pisellLongText/PisellLongText.js +18 -12
  75. package/es/components/pisellLongText/PisellLongText.less +0 -67
  76. package/es/components/pisellLookup/PisellLookup.js +8 -1
  77. package/es/components/pisellMultipleSelect/PisellMultipleSelect.js +14 -6
  78. package/es/components/pisellMultipleSelect/PisellMultipleSelect.less +18 -139
  79. package/es/components/pisellMultipleSelect/components/EditView.js +1 -0
  80. package/es/components/pisellNumber/PisellNumber.js +18 -12
  81. package/es/components/pisellNumber/PisellNumber.less +0 -103
  82. package/es/components/pisellPhone/PisellPhone.js +18 -12
  83. package/es/components/pisellPhone/PisellPhone.less +0 -119
  84. package/es/components/pisellPhone/components/EditView.js +44 -33
  85. package/es/components/pisellPhone/constants/countryCodes.d.ts +1 -0
  86. package/es/components/pisellPhone/constants/countryCodes.js +26 -25
  87. package/es/components/pisellPhone/types.d.ts +2 -2
  88. package/es/components/pisellPhone/utils/countryCodeHelper.d.ts +4 -4
  89. package/es/components/pisellPhone/utils/countryCodeHelper.js +5 -5
  90. package/es/components/pisellRating/PisellRating.js +7 -3
  91. package/es/components/pisellSingleLineText/PisellSingleLineText.js +27 -20
  92. package/es/components/pisellSingleLineText/PisellSingleLineText.less +58 -201
  93. package/es/components/pisellSingleSelect/PisellSingleSelect.js +14 -5
  94. package/es/components/pisellSingleSelect/PisellSingleSelect.less +5 -106
  95. package/es/components/pisellUrl/PisellUrl.js +48 -42
  96. package/es/components/pisellWalletPassCard/index.js +2 -1
  97. package/es/index.d.ts +15 -4
  98. package/es/index.js +8 -4
  99. package/es/theme/pisell-components.d.ts +14 -0
  100. package/es/theme/pisell-components.js +74 -0
  101. package/lib/components/PisellCards/index.d.ts +3 -0
  102. package/lib/components/PisellCards/index.js +3 -1
  103. package/lib/components/PisellContactBrief/PisellContactBrief.d.ts +13 -0
  104. package/lib/components/PisellContactBrief/PisellContactBrief.js +231 -0
  105. package/lib/components/PisellContactBrief/PisellContactBrief.less +192 -0
  106. package/lib/components/PisellContactBrief/PisellContactBrief.stories.d.ts +31 -0
  107. package/lib/components/PisellContactBrief/PisellContactBrief.stories.js +188 -0
  108. package/lib/components/PisellContactBrief/components/ContactFormModal.d.ts +23 -0
  109. package/lib/components/PisellContactBrief/components/ContactFormModal.js +154 -0
  110. package/lib/components/PisellContactBrief/components/index.d.ts +5 -0
  111. package/lib/components/PisellContactBrief/components/index.js +29 -0
  112. package/lib/components/PisellContactBrief/index.d.ts +6 -0
  113. package/lib/components/PisellContactBrief/index.js +29 -0
  114. package/lib/components/PisellContactBrief/locales.d.ts +55 -0
  115. package/lib/components/PisellContactBrief/locales.js +74 -0
  116. package/lib/components/PisellContactBrief/types.d.ts +82 -0
  117. package/lib/components/PisellContactBrief/types.js +17 -0
  118. package/lib/components/dataSourceComponents/fields/Tabs/Tabs.less +8 -0
  119. package/lib/components/pisellActionPanel/PisellActionPanel.d.ts +13 -0
  120. package/lib/components/pisellActionPanel/PisellActionPanel.js +124 -0
  121. package/lib/components/pisellActionPanel/PisellActionPanel.less +69 -0
  122. package/lib/components/pisellActionPanel/PisellActionPanel.stories.d.ts +19 -0
  123. package/lib/components/pisellActionPanel/PisellActionPanel.stories.js +186 -0
  124. package/lib/components/pisellActionPanel/index.d.ts +6 -0
  125. package/lib/components/pisellActionPanel/index.js +29 -0
  126. package/lib/components/pisellActionPanel/types.d.ts +83 -0
  127. package/lib/components/pisellActionPanel/types.js +17 -0
  128. package/lib/components/pisellBaseCard/PisellBaseCard.d.ts +8 -0
  129. package/lib/components/pisellBaseCard/PisellBaseCard.js +124 -0
  130. package/lib/components/pisellBaseCard/PisellBaseCard.less +25 -0
  131. package/lib/components/pisellBaseCard/PisellBaseCard.stories.d.ts +19 -0
  132. package/lib/components/pisellBaseCard/PisellBaseCard.stories.js +107 -0
  133. package/lib/components/pisellBaseCard/index.d.ts +5 -0
  134. package/lib/components/pisellBaseCard/index.js +29 -0
  135. package/lib/components/pisellBaseCard/types.d.ts +45 -0
  136. package/lib/components/pisellBaseCard/types.js +17 -0
  137. package/lib/components/pisellCurrency/PisellCurrency.js +16 -10
  138. package/lib/components/pisellCurrency/PisellCurrency.less +0 -123
  139. package/lib/components/pisellCustomerBrief/PisellCustomerBrief.d.ts +15 -0
  140. package/lib/components/pisellCustomerBrief/PisellCustomerBrief.js +143 -0
  141. package/lib/components/pisellCustomerBrief/PisellCustomerBrief.less +8 -0
  142. package/lib/components/pisellCustomerBrief/PisellCustomerBrief.stories.d.ts +23 -0
  143. package/lib/components/pisellCustomerBrief/PisellCustomerBrief.stories.js +171 -0
  144. package/lib/components/pisellCustomerBrief/index.d.ts +6 -0
  145. package/lib/components/pisellCustomerBrief/index.js +29 -0
  146. package/lib/components/pisellCustomerBrief/types.d.ts +82 -0
  147. package/lib/components/pisellCustomerBrief/types.js +17 -0
  148. package/lib/components/pisellEmail/PisellEmail.js +16 -10
  149. package/lib/components/pisellEmail/PisellEmail.less +0 -92
  150. package/lib/components/pisellEntityCard/PisellEntityCard.d.ts +8 -0
  151. package/lib/components/pisellEntityCard/PisellEntityCard.js +426 -0
  152. package/lib/components/pisellEntityCard/PisellEntityCard.less +362 -0
  153. package/lib/components/pisellEntityCard/PisellEntityCard.stories.d.ts +47 -0
  154. package/lib/components/pisellEntityCard/PisellEntityCard.stories.js +349 -0
  155. package/lib/components/pisellEntityCard/index.d.ts +5 -0
  156. package/lib/components/pisellEntityCard/index.js +29 -0
  157. package/lib/components/pisellEntityCard/types.d.ts +144 -0
  158. package/lib/components/pisellEntityCard/types.js +17 -0
  159. package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.js +22 -3
  160. package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.stories.js +2 -2
  161. package/lib/components/pisellFloorMapLayout/components/ViewControls.d.ts +4 -0
  162. package/lib/components/pisellFloorMapLayout/components/ViewControls.js +11 -1
  163. package/lib/components/pisellFloorMapLayout/types.d.ts +2 -0
  164. package/lib/components/pisellLongText/PisellLongText.js +16 -10
  165. package/lib/components/pisellLongText/PisellLongText.less +0 -67
  166. package/lib/components/pisellLookup/PisellLookup.js +5 -1
  167. package/lib/components/pisellMultipleSelect/PisellMultipleSelect.js +62 -53
  168. package/lib/components/pisellMultipleSelect/PisellMultipleSelect.less +18 -139
  169. package/lib/components/pisellMultipleSelect/components/EditView.js +42 -30
  170. package/lib/components/pisellNumber/PisellNumber.js +16 -10
  171. package/lib/components/pisellNumber/PisellNumber.less +0 -103
  172. package/lib/components/pisellPhone/PisellPhone.js +16 -10
  173. package/lib/components/pisellPhone/PisellPhone.less +0 -119
  174. package/lib/components/pisellPhone/components/EditView.js +40 -24
  175. package/lib/components/pisellPhone/constants/countryCodes.d.ts +1 -0
  176. package/lib/components/pisellPhone/constants/countryCodes.js +24 -24
  177. package/lib/components/pisellPhone/types.d.ts +2 -2
  178. package/lib/components/pisellPhone/utils/countryCodeHelper.d.ts +4 -4
  179. package/lib/components/pisellPhone/utils/countryCodeHelper.js +1 -1
  180. package/lib/components/pisellRating/PisellRating.js +4 -2
  181. package/lib/components/pisellSingleLineText/PisellSingleLineText.js +16 -10
  182. package/lib/components/pisellSingleLineText/PisellSingleLineText.less +58 -201
  183. package/lib/components/pisellSingleSelect/PisellSingleSelect.js +34 -35
  184. package/lib/components/pisellSingleSelect/PisellSingleSelect.less +5 -106
  185. package/lib/components/pisellUrl/PisellUrl.js +16 -10
  186. package/lib/components/pisellWalletPassCard/index.js +1 -1
  187. package/lib/index.d.ts +15 -4
  188. package/lib/index.js +18 -3
  189. package/lib/theme/pisell-components.d.ts +14 -0
  190. package/lib/theme/pisell-components.js +89 -0
  191. package/lowcode/pisell-action-panel/meta.ts +146 -0
  192. package/lowcode/pisell-action-panel/snippets.ts +42 -0
  193. package/lowcode/pisell-base-card/meta.ts +98 -0
  194. package/lowcode/pisell-base-card/snippets.ts +13 -0
  195. package/lowcode/pisell-contact-brief/meta.ts +178 -0
  196. package/lowcode/pisell-contact-brief/snippets.ts +40 -0
  197. package/lowcode/pisell-customer-brief/meta.ts +262 -0
  198. package/lowcode/pisell-customer-brief/snippets.ts +46 -0
  199. package/lowcode/pisell-entity-card/meta.ts +296 -0
  200. package/lowcode/pisell-entity-card/snippets.ts +41 -0
  201. package/lowcode/pisell-floor-map-layout/meta.ts +37 -1
  202. package/package.json +4 -4
@@ -0,0 +1,188 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/PisellContactBrief/PisellContactBrief.stories.tsx
20
+ var PisellContactBrief_stories_exports = {};
21
+ __export(PisellContactBrief_stories_exports, {
22
+ CreateButtonOnly: () => CreateButtonOnly,
23
+ Default: () => Default,
24
+ Disabled: () => Disabled,
25
+ ListWithCreateButton: () => ListWithCreateButton,
26
+ NoAvatar: () => NoAvatar,
27
+ NoEmail: () => NoEmail,
28
+ NoPhone: () => NoPhone,
29
+ PrimaryLineClamp: () => PrimaryLineClamp,
30
+ SwipeToDelete: () => SwipeToDelete,
31
+ Vertical: () => Vertical,
32
+ WithAvatar: () => WithAvatar,
33
+ WithEditSubmit: () => WithEditSubmit,
34
+ WithExtraFields: () => WithExtraFields,
35
+ default: () => PisellContactBrief_stories_default
36
+ });
37
+ module.exports = __toCommonJS(PisellContactBrief_stories_exports);
38
+ var import_PisellContactBrief = require("./PisellContactBrief");
39
+ var meta = {
40
+ title: "Data Display/PisellContactBrief",
41
+ component: import_PisellContactBrief.PisellContactBrief,
42
+ tags: ["autodocs"],
43
+ decorators: [
44
+ (Story) => /* @__PURE__ */ React.createElement("div", { style: { width: 340 } }, /* @__PURE__ */ React.createElement(Story, null))
45
+ ],
46
+ argTypes: {
47
+ layout: {
48
+ description: "布局方向",
49
+ control: "radio",
50
+ options: ["horizontal", "vertical"]
51
+ },
52
+ showAvatar: { description: "显示头像", control: "boolean" },
53
+ showPhone: { description: "显示电话", control: "boolean" },
54
+ showEmail: { description: "显示邮箱", control: "boolean" },
55
+ swipeToDelete: { description: "开启左滑删除", control: "boolean" }
56
+ }
57
+ };
58
+ var PisellContactBrief_stories_default = meta;
59
+ var Default = {
60
+ args: {
61
+ name: "Allen King",
62
+ phone: "+61 412 345 1656",
63
+ email: "Allenking@pisell.com",
64
+ layout: "horizontal"
65
+ }
66
+ };
67
+ var NoAvatar = {
68
+ args: {
69
+ name: "Bill Camp",
70
+ phone: "+86 151 0548 2457",
71
+ email: "Billcamp@pisell.com",
72
+ showAvatar: true,
73
+ avatar: void 0
74
+ }
75
+ };
76
+ var WithAvatar = {
77
+ args: {
78
+ name: "张三",
79
+ phone: "+86 138 0000 0000",
80
+ email: "zhangsan@example.com",
81
+ avatar: "https://ui-avatars.com/api/?name=Zhang+San&background=4a90d9&color=fff&size=32"
82
+ }
83
+ };
84
+ var Vertical = {
85
+ args: {
86
+ name: "Allen King",
87
+ phone: "+61 412 345 1656",
88
+ email: "Allenking@pisell.com",
89
+ layout: "vertical"
90
+ }
91
+ };
92
+ var NoEmail = {
93
+ args: {
94
+ name: "Bill Camp",
95
+ phone: "(+86 151 0548 2457)",
96
+ showEmail: false
97
+ }
98
+ };
99
+ var NoPhone = {
100
+ args: {
101
+ name: "Bill Camp",
102
+ email: "Billcamp@pisell.com",
103
+ showPhone: false
104
+ }
105
+ };
106
+ var WithExtraFields = {
107
+ args: {
108
+ name: "Bill Camp",
109
+ phone: "+86 151 0548 2457",
110
+ email: "Billcamp@pisell.com",
111
+ extraFields: [
112
+ { key: "birthday", label: "生日" },
113
+ { key: "address", label: "地址" }
114
+ ],
115
+ extraData: {
116
+ birthday: "30 July 1990",
117
+ address: "30 Jersey Parade, suburban, VIC, 3000"
118
+ }
119
+ }
120
+ };
121
+ var SwipeToDelete = {
122
+ args: {
123
+ name: "Bill Camp",
124
+ phone: "+86 151 0548 2457",
125
+ email: "Billcamp@pisell.com",
126
+ swipeToDelete: true,
127
+ onDelete: () => console.log("onDelete")
128
+ }
129
+ };
130
+ var WithEditSubmit = {
131
+ args: {
132
+ name: "张三",
133
+ phone: "138 0000 0000",
134
+ email: "zhangsan@example.com",
135
+ onSubmit: (values) => console.log("onSubmit", values)
136
+ }
137
+ };
138
+ var Disabled = {
139
+ args: {
140
+ name: "张三",
141
+ phone: "138 0000 0000",
142
+ email: "a@b.com",
143
+ disabled: true
144
+ }
145
+ };
146
+ var PrimaryLineClamp = {
147
+ args: {
148
+ name: "非常长的联系人姓名用于测试单行省略效果",
149
+ phone: "138 0000 0000",
150
+ email: "a@b.com",
151
+ primaryLineClamp: 1
152
+ }
153
+ };
154
+ var CreateButtonOnly = {
155
+ render: () => /* @__PURE__ */ React.createElement(
156
+ import_PisellContactBrief.PisellContactBrief.CreateButton,
157
+ {
158
+ onCreate: (values) => console.log("onCreate", values)
159
+ }
160
+ )
161
+ };
162
+ var ListWithCreateButton = {
163
+ render: () => /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 8, width: 340 } }, /* @__PURE__ */ React.createElement(
164
+ import_PisellContactBrief.PisellContactBrief,
165
+ {
166
+ name: "Allen King",
167
+ phone: "+61 412 345 1656",
168
+ email: "Allenking@pisell.com",
169
+ onSubmit: (v) => console.log("onSubmit", v)
170
+ }
171
+ ), /* @__PURE__ */ React.createElement(import_PisellContactBrief.PisellContactBrief.CreateButton, { onCreate: (v) => console.log("onCreate", v) }))
172
+ };
173
+ // Annotate the CommonJS export names for ESM import in node:
174
+ 0 && (module.exports = {
175
+ CreateButtonOnly,
176
+ Default,
177
+ Disabled,
178
+ ListWithCreateButton,
179
+ NoAvatar,
180
+ NoEmail,
181
+ NoPhone,
182
+ PrimaryLineClamp,
183
+ SwipeToDelete,
184
+ Vertical,
185
+ WithAvatar,
186
+ WithEditSubmit,
187
+ WithExtraFields
188
+ });
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import type { ContactFormValues } from '../types';
3
+ import type { ContactBriefExtraField } from '../types';
4
+ export declare type ContactFormModalMode = 'create' | 'edit';
5
+ export interface ContactFormModalProps {
6
+ /** 显隐 */
7
+ visible: boolean;
8
+ /** 关闭回调 */
9
+ onCancel: () => void;
10
+ /** 提交回调(新建时即 onCreate,编辑时即 onSubmit) */
11
+ onSubmit: (values: ContactFormValues) => void;
12
+ /** 新建 / 编辑 */
13
+ mode: ContactFormModalMode;
14
+ /** 初始值(编辑时传入) */
15
+ initialValues?: Partial<ContactFormValues>;
16
+ /** 可增加字段配置,顺序即表单项顺序 */
17
+ extraFields?: ContactBriefExtraField[];
18
+ }
19
+ /**
20
+ * 联系人新建/编辑弹窗
21
+ * 表单含 Firstname、Lastname、Phone、Email + extraFields,与 Figma 新建/编辑弹窗一致
22
+ */
23
+ export declare function ContactFormModal({ visible, onCancel, onSubmit, mode, initialValues, extraFields, }: ContactFormModalProps): JSX.Element;
@@ -0,0 +1,154 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/PisellContactBrief/components/ContactFormModal.tsx
30
+ var ContactFormModal_exports = {};
31
+ __export(ContactFormModal_exports, {
32
+ ContactFormModal: () => ContactFormModal
33
+ });
34
+ module.exports = __toCommonJS(ContactFormModal_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_utils = require("@pisell/utils");
38
+ var import_pisellSingleLineText = require("../../pisellSingleLineText");
39
+ var import_pisellPhone = require("../../pisellPhone");
40
+ var import_pisellEmail = require("../../pisellEmail");
41
+ var FIRSTNAME_FIELD = "firstname";
42
+ var LASTNAME_FIELD = "lastname";
43
+ var PHONE_FIELD = "phone";
44
+ var EMAIL_FIELD = "email";
45
+ function splitName(name) {
46
+ if (!name || !name.trim()) return ["", ""];
47
+ const idx = name.trim().indexOf(" ");
48
+ if (idx <= 0) return [name.trim(), ""];
49
+ return [name.trim().slice(0, idx), name.trim().slice(idx + 1)];
50
+ }
51
+ function joinName(first, last) {
52
+ return [first, last].map((s) => s == null ? void 0 : s.trim()).filter(Boolean).join(" ");
53
+ }
54
+ function ContactFormModal({
55
+ visible,
56
+ onCancel,
57
+ onSubmit,
58
+ mode,
59
+ initialValues,
60
+ extraFields = []
61
+ }) {
62
+ const [form] = import_antd.Form.useForm();
63
+ (0, import_react.useEffect)(() => {
64
+ if (visible) {
65
+ const [firstname, lastname] = splitName(initialValues == null ? void 0 : initialValues.name);
66
+ const values = {
67
+ firstname,
68
+ lastname,
69
+ name: (initialValues == null ? void 0 : initialValues.name) ?? "",
70
+ phone: (initialValues == null ? void 0 : initialValues.phone) ?? "",
71
+ email: (initialValues == null ? void 0 : initialValues.email) ?? ""
72
+ };
73
+ if (initialValues && extraFields.length > 0) {
74
+ extraFields.forEach((f) => {
75
+ values[f.key] = initialValues[f.key] ?? "";
76
+ });
77
+ }
78
+ form.setFieldsValue(values);
79
+ }
80
+ }, [visible, initialValues, extraFields, form]);
81
+ const handleOk = async () => {
82
+ try {
83
+ const raw = await form.validateFields();
84
+ const name = joinName(raw.firstname ?? "", raw.lastname ?? "");
85
+ const values = {
86
+ name,
87
+ phone: raw.phone,
88
+ email: raw.email
89
+ };
90
+ extraFields.forEach((f) => {
91
+ values[f.key] = raw[f.key];
92
+ });
93
+ onSubmit(values);
94
+ form.resetFields();
95
+ onCancel();
96
+ } catch {
97
+ }
98
+ };
99
+ const handleCancel = () => {
100
+ form.resetFields();
101
+ onCancel();
102
+ };
103
+ const title = mode === "create" ? import_utils.locales.getText("pisell.contact.brief.modal.title.create") : import_utils.locales.getText("pisell.contact.brief.modal.title.edit");
104
+ const okText = import_utils.locales.getText("pisell.contact.brief.modal.save");
105
+ const cancelText = import_utils.locales.getText("pisell.contact.brief.modal.cancel");
106
+ return /* @__PURE__ */ import_react.default.createElement(
107
+ import_antd.Modal,
108
+ {
109
+ title,
110
+ open: visible,
111
+ onOk: handleOk,
112
+ onCancel: handleCancel,
113
+ okText,
114
+ cancelText,
115
+ destroyOnClose: true,
116
+ width: 480,
117
+ className: "pisell-contact-brief-modal"
118
+ },
119
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { form, layout: "vertical", preserve: false, className: "pisell-contact-brief-modal-form" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-contact-brief-modal-form-row" }, /* @__PURE__ */ import_react.default.createElement(
120
+ import_antd.Form.Item,
121
+ {
122
+ name: FIRSTNAME_FIELD,
123
+ label: import_utils.locales.getText("pisell.contact.brief.modal.field.firstname"),
124
+ rules: [{ required: true, message: import_utils.locales.getText("pisell.contact.brief.modal.field.required") }],
125
+ className: "pisell-contact-brief-modal-form-item-half"
126
+ },
127
+ /* @__PURE__ */ import_react.default.createElement(import_pisellSingleLineText.PisellSingleLineText, { placeholder: "", mode: "edit" })
128
+ ), /* @__PURE__ */ import_react.default.createElement(
129
+ import_antd.Form.Item,
130
+ {
131
+ name: LASTNAME_FIELD,
132
+ label: import_utils.locales.getText("pisell.contact.brief.modal.field.lastname"),
133
+ className: "pisell-contact-brief-modal-form-item-half"
134
+ },
135
+ /* @__PURE__ */ import_react.default.createElement(import_pisellSingleLineText.PisellSingleLineText, { placeholder: "", mode: "edit" })
136
+ )), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: PHONE_FIELD, label: import_utils.locales.getText("pisell.contact.brief.modal.field.phone") }, /* @__PURE__ */ import_react.default.createElement(
137
+ import_pisellPhone.PisellPhone,
138
+ {
139
+ placeholder: import_utils.locales.getText("pisell.contact.brief.modal.field.phone.placeholder"),
140
+ mode: "edit"
141
+ }
142
+ )), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: EMAIL_FIELD, label: import_utils.locales.getText("pisell.contact.brief.modal.field.email") }, /* @__PURE__ */ import_react.default.createElement(
143
+ import_pisellEmail.PisellEmail,
144
+ {
145
+ placeholder: import_utils.locales.getText("pisell.contact.brief.modal.field.email.placeholder"),
146
+ mode: "edit"
147
+ }
148
+ )), extraFields.map((f) => /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { key: f.key, name: f.key, label: f.label }, /* @__PURE__ */ import_react.default.createElement(import_pisellSingleLineText.PisellSingleLineText, { placeholder: "", mode: "edit" }))))
149
+ );
150
+ }
151
+ // Annotate the CommonJS export names for ESM import in node:
152
+ 0 && (module.exports = {
153
+ ContactFormModal
154
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * PisellContactBrief 子组件导出
3
+ */
4
+ export { ContactFormModal } from './ContactFormModal';
5
+ export type { ContactFormModalProps, ContactFormModalMode } from './ContactFormModal';
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/PisellContactBrief/components/index.tsx
20
+ var components_exports = {};
21
+ __export(components_exports, {
22
+ ContactFormModal: () => import_ContactFormModal.ContactFormModal
23
+ });
24
+ module.exports = __toCommonJS(components_exports);
25
+ var import_ContactFormModal = require("./ContactFormModal");
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ ContactFormModal
29
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * PisellContactBrief 组件导出
3
+ * 联系人简要卡片 + CreateButton(PisellContactBrief.CreateButton)
4
+ */
5
+ export { PisellContactBrief } from './PisellContactBrief';
6
+ export type { PisellContactBriefProps, PisellContactBriefCreateButtonProps, PisellContactBriefComponent, ContactFormValues, ContactBriefExtraField, } from './types';
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/PisellContactBrief/index.tsx
20
+ var PisellContactBrief_exports = {};
21
+ __export(PisellContactBrief_exports, {
22
+ PisellContactBrief: () => import_PisellContactBrief.PisellContactBrief
23
+ });
24
+ module.exports = __toCommonJS(PisellContactBrief_exports);
25
+ var import_PisellContactBrief = require("./PisellContactBrief");
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ PisellContactBrief
29
+ });
@@ -0,0 +1,55 @@
1
+ /**
2
+ * PisellContactBrief 多语言文案
3
+ * 中、英、繁;由业务 locales.init 合并或组件内 init 后使用 locales.getText(key)
4
+ */
5
+ declare const _default: {
6
+ en: {
7
+ 'pisell.contact.brief.addContact': string;
8
+ 'pisell.contact.brief.edit': string;
9
+ 'pisell.contact.brief.delete': string;
10
+ 'pisell.contact.brief.modal.title.create': string;
11
+ 'pisell.contact.brief.modal.title.edit': string;
12
+ 'pisell.contact.brief.modal.cancel': string;
13
+ 'pisell.contact.brief.modal.save': string;
14
+ 'pisell.contact.brief.modal.field.firstname': string;
15
+ 'pisell.contact.brief.modal.field.lastname': string;
16
+ 'pisell.contact.brief.modal.field.phone': string;
17
+ 'pisell.contact.brief.modal.field.email': string;
18
+ 'pisell.contact.brief.modal.field.phone.placeholder': string;
19
+ 'pisell.contact.brief.modal.field.email.placeholder': string;
20
+ 'pisell.contact.brief.modal.field.required': string;
21
+ };
22
+ 'zh-CN': {
23
+ 'pisell.contact.brief.addContact': string;
24
+ 'pisell.contact.brief.edit': string;
25
+ 'pisell.contact.brief.delete': string;
26
+ 'pisell.contact.brief.modal.title.create': string;
27
+ 'pisell.contact.brief.modal.title.edit': string;
28
+ 'pisell.contact.brief.modal.cancel': string;
29
+ 'pisell.contact.brief.modal.save': string;
30
+ 'pisell.contact.brief.modal.field.firstname': string;
31
+ 'pisell.contact.brief.modal.field.lastname': string;
32
+ 'pisell.contact.brief.modal.field.phone': string;
33
+ 'pisell.contact.brief.modal.field.email': string;
34
+ 'pisell.contact.brief.modal.field.phone.placeholder': string;
35
+ 'pisell.contact.brief.modal.field.email.placeholder': string;
36
+ 'pisell.contact.brief.modal.field.required': string;
37
+ };
38
+ 'zh-HK': {
39
+ 'pisell.contact.brief.addContact': string;
40
+ 'pisell.contact.brief.edit': string;
41
+ 'pisell.contact.brief.delete': string;
42
+ 'pisell.contact.brief.modal.title.create': string;
43
+ 'pisell.contact.brief.modal.title.edit': string;
44
+ 'pisell.contact.brief.modal.cancel': string;
45
+ 'pisell.contact.brief.modal.save': string;
46
+ 'pisell.contact.brief.modal.field.firstname': string;
47
+ 'pisell.contact.brief.modal.field.lastname': string;
48
+ 'pisell.contact.brief.modal.field.phone': string;
49
+ 'pisell.contact.brief.modal.field.email': string;
50
+ 'pisell.contact.brief.modal.field.phone.placeholder': string;
51
+ 'pisell.contact.brief.modal.field.email.placeholder': string;
52
+ 'pisell.contact.brief.modal.field.required': string;
53
+ };
54
+ };
55
+ export default _default;
@@ -0,0 +1,74 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/PisellContactBrief/locales.ts
20
+ var locales_exports = {};
21
+ __export(locales_exports, {
22
+ default: () => locales_default
23
+ });
24
+ module.exports = __toCommonJS(locales_exports);
25
+ var locales_default = {
26
+ en: {
27
+ "pisell.contact.brief.addContact": "Add Contact",
28
+ "pisell.contact.brief.edit": "Edit",
29
+ "pisell.contact.brief.delete": "Delete",
30
+ "pisell.contact.brief.modal.title.create": "Add Contact",
31
+ "pisell.contact.brief.modal.title.edit": "Edit Contact",
32
+ "pisell.contact.brief.modal.cancel": "Cancel",
33
+ "pisell.contact.brief.modal.save": "Save",
34
+ "pisell.contact.brief.modal.field.firstname": "Firstname",
35
+ "pisell.contact.brief.modal.field.lastname": "Lastname",
36
+ "pisell.contact.brief.modal.field.phone": "Phone number",
37
+ "pisell.contact.brief.modal.field.email": "Email address",
38
+ "pisell.contact.brief.modal.field.phone.placeholder": "+1 (555) 000-0000",
39
+ "pisell.contact.brief.modal.field.email.placeholder": "Enter your email",
40
+ "pisell.contact.brief.modal.field.required": "Required"
41
+ },
42
+ "zh-CN": {
43
+ "pisell.contact.brief.addContact": "添加联系人",
44
+ "pisell.contact.brief.edit": "编辑",
45
+ "pisell.contact.brief.delete": "删除",
46
+ "pisell.contact.brief.modal.title.create": "新建联系人",
47
+ "pisell.contact.brief.modal.title.edit": "编辑联系人",
48
+ "pisell.contact.brief.modal.cancel": "取消",
49
+ "pisell.contact.brief.modal.save": "保存",
50
+ "pisell.contact.brief.modal.field.firstname": "名",
51
+ "pisell.contact.brief.modal.field.lastname": "姓",
52
+ "pisell.contact.brief.modal.field.phone": "电话",
53
+ "pisell.contact.brief.modal.field.email": "邮箱",
54
+ "pisell.contact.brief.modal.field.phone.placeholder": "请输入电话",
55
+ "pisell.contact.brief.modal.field.email.placeholder": "请输入邮箱",
56
+ "pisell.contact.brief.modal.field.required": "必填"
57
+ },
58
+ "zh-HK": {
59
+ "pisell.contact.brief.addContact": "添加聯繫人",
60
+ "pisell.contact.brief.edit": "編輯",
61
+ "pisell.contact.brief.delete": "刪除",
62
+ "pisell.contact.brief.modal.title.create": "新建聯繫人",
63
+ "pisell.contact.brief.modal.title.edit": "編輯聯繫人",
64
+ "pisell.contact.brief.modal.cancel": "取消",
65
+ "pisell.contact.brief.modal.save": "保存",
66
+ "pisell.contact.brief.modal.field.firstname": "名",
67
+ "pisell.contact.brief.modal.field.lastname": "姓",
68
+ "pisell.contact.brief.modal.field.phone": "電話",
69
+ "pisell.contact.brief.modal.field.email": "郵箱",
70
+ "pisell.contact.brief.modal.field.phone.placeholder": "請輸入電話",
71
+ "pisell.contact.brief.modal.field.email.placeholder": "請輸入郵箱",
72
+ "pisell.contact.brief.modal.field.required": "必填"
73
+ }
74
+ };
@@ -0,0 +1,82 @@
1
+ import type React from 'react';
2
+ import type { PisellBaseCardProps } from '../pisellBaseCard/types';
3
+ import type { EntityCardLayout } from '../pisellEntityCard/types';
4
+ /**
5
+ * 联系人表单值(新建/编辑弹窗提交结构)
6
+ * 基础字段 name、phone、email + 扩展字段(与 extraFields[].key 对应)扁平在同一对象
7
+ */
8
+ export interface ContactFormValues {
9
+ /** 姓名 */
10
+ name: string;
11
+ /** 电话 */
12
+ phone?: string;
13
+ /** 邮箱 */
14
+ email?: string;
15
+ /** 扩展字段及任意表单项,key 与 extraFields 配置对应 */
16
+ [key: string]: string | undefined;
17
+ }
18
+ /**
19
+ * 可增加字段配置项
20
+ * 顺序即卡片展示与弹窗表单项顺序
21
+ */
22
+ export interface ContactBriefExtraField {
23
+ /** 字段 key,与 extraData / ContactFormValues 对应 */
24
+ key: string;
25
+ /** 展示与表单项 label(可配合多语言) */
26
+ label: string;
27
+ }
28
+ /**
29
+ * PisellContactBrief 组件 Props
30
+ * 基于 PisellEntityCard 展示联系人简要信息,内置编辑弹窗
31
+ */
32
+ export interface PisellContactBriefProps extends Pick<PisellBaseCardProps, 'className' | 'style' | 'hoverStyle' | 'activeStyle' | 'disabledStyle' | 'clickable' | 'disabled' | 'onClick'> {
33
+ /** 联系人姓名(主文案) */
34
+ name: string;
35
+ /** 电话(副标题,与姓名同行) */
36
+ phone?: string;
37
+ /** 邮箱(次级文案) */
38
+ email?: string;
39
+ /** 头像图片地址,不传则显示默认占位 */
40
+ avatar?: string;
41
+ /** 扩展字段值,key 与 extraFields 配置对应 */
42
+ extraData?: Record<string, string>;
43
+ /** 可增加字段配置,顺序即展示与表单顺序 */
44
+ extraFields?: ContactBriefExtraField[];
45
+ /** 编辑弹窗提交回调 */
46
+ onSubmit?: (values: ContactFormValues) => void;
47
+ /** 左滑删除回调(透传 Entity Card) */
48
+ onDelete?: () => void;
49
+ /** 是否开启左滑删除 @default false */
50
+ swipeToDelete?: boolean;
51
+ /** 布局方向 @default 'horizontal' */
52
+ layout?: EntityCardLayout;
53
+ /** 是否显示头像 @default true */
54
+ showAvatar?: boolean;
55
+ /** 是否显示电话 @default true */
56
+ showPhone?: boolean;
57
+ /** 是否显示邮箱 @default true */
58
+ showEmail?: boolean;
59
+ /** 主文案行数限制 */
60
+ primaryLineClamp?: number;
61
+ /** 次级文案行数限制 */
62
+ secondaryLineClamp?: number;
63
+ }
64
+ /**
65
+ * PisellContactBrief.CreateButton 组件 Props
66
+ * 点击后打开新建联系人弹窗
67
+ */
68
+ export interface PisellContactBriefCreateButtonProps extends Pick<PisellBaseCardProps, 'className' | 'style'> {
69
+ /** 可增加字段配置,与卡片一致,弹窗内表单项与之对应 */
70
+ extraFields?: ContactBriefExtraField[];
71
+ /** 新建弹窗提交回调,调用方保存数据后可更新列表 */
72
+ onCreate?: (values: ContactFormValues) => void;
73
+ /** 自定义点击行为;不传则使用内置打开新建弹窗 */
74
+ onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
75
+ }
76
+ /**
77
+ * 复合组件类型:PisellContactBrief + CreateButton
78
+ */
79
+ export interface PisellContactBriefComponent {
80
+ (props: PisellContactBriefProps): React.ReactElement;
81
+ CreateButton: React.ComponentType<PisellContactBriefCreateButtonProps>;
82
+ }
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/components/PisellContactBrief/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);