@pisell/materials 6.0.18 → 6.0.20

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 (204) 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 +7 -7
  6. package/build/lowcode/preview.js +146 -146
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +51 -20
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +51 -20
  11. package/es/components/badge/index.d.ts +7 -0
  12. package/es/components/badge/index.js +44 -0
  13. package/es/components/badge/index.less +2 -0
  14. package/es/components/buttonGroupEdit/index.d.ts +8 -0
  15. package/es/components/buttonGroupEdit/index.js +408 -0
  16. package/es/components/buttonGroupPreview/index.d.ts +19 -0
  17. package/es/components/buttonGroupPreview/index.js +74 -0
  18. package/es/components/cardMetricItem/index.d.ts +12 -0
  19. package/es/components/cardMetricItem/index.js +39 -0
  20. package/es/components/cardMetricItem/index.less +39 -0
  21. package/es/components/cardPro/index.d.ts +3 -0
  22. package/es/components/cardPro/index.js +66 -0
  23. package/es/components/cardPro/index.less +55 -0
  24. package/es/components/cropPhoto/index.d.ts +3 -0
  25. package/es/components/cropPhoto/index.js +72 -0
  26. package/es/components/cropPhoto/index.less +15 -0
  27. package/es/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +8 -2
  28. package/es/components/dataSourceComponents/dataSourceMenu/Basic.js +13 -3
  29. package/es/components/dataSourceComponents/dataSourceMenu/index.d.ts +8 -2
  30. package/es/components/dataSourceComponents/fields/Input/WithMode.js +24 -1
  31. package/es/components/dataSourceComponents/fields/Input.Mobile/serve.js +31 -3
  32. package/es/components/dataSourceComponents/fields/Input.Phone/serve.js +31 -3
  33. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  34. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +2 -0
  35. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +102 -141
  36. package/es/components/dataSourceComponents/fields/Upload/WithMode.js +6 -3
  37. package/es/components/dataSourceComponents/fields/Upload/serve.js +13 -3
  38. package/es/components/dataSourceComponents/fields/Upload/shopUploadServe.d.ts +56 -0
  39. package/es/components/dataSourceComponents/fields/Upload/shopUploadServe.js +396 -0
  40. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
  41. package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -0
  42. package/es/components/dataSourceComponents/fields/Upload/utils.js +17 -2
  43. package/es/components/dataSourceComponents/fields/index.d.ts +8 -8
  44. package/es/components/dataSourceComponents/hooks/usePlatform.d.ts +3 -0
  45. package/es/components/dataSourceComponents/hooks/usePlatform.js +12 -0
  46. package/es/components/login-and-register/index.js +23 -21
  47. package/es/components/login-and-register/index.less +7 -7
  48. package/es/components/page/index.js +23 -57
  49. package/es/components/pisellAnchor/index.d.ts +23 -0
  50. package/es/components/pisellAnchor/index.js +303 -0
  51. package/es/components/pisellAnchor/index.less +197 -0
  52. package/es/components/pisellNavigationMenu/PisellNavigationMenu.js +18 -2
  53. package/es/components/pisellQrcode/index.d.ts +10 -0
  54. package/es/components/pisellQrcode/index.js +70 -0
  55. package/es/components/pisellQrcode/index.less +41 -0
  56. package/es/components/pisellStatisticList/index.d.ts +3 -0
  57. package/es/components/pisellStatisticList/index.js +17 -5
  58. package/es/components/pisellStatisticList/index.less +1 -1
  59. package/es/components/pisellText/components/Amount/index.d.ts +2 -0
  60. package/es/components/pisellText/components/Amount/index.js +3 -2
  61. package/es/components/pisellWalletPassCard/index.d.ts +4 -4
  62. package/es/components/pisellWalletPassCard/index.js +28 -12
  63. package/es/components/pisellWalletPassCard/index.less +26 -4
  64. package/es/components/record-view/index.d.ts +13 -5
  65. package/es/components/record-view/index.js +81 -30
  66. package/es/components/record-view/index.less +37 -2
  67. package/es/components/table/Table/utils.d.ts +1 -1
  68. package/es/components/tabs/index.d.ts +1 -0
  69. package/es/components/tabs/index.js +25 -7
  70. package/es/components/tabs/index.less +5 -5
  71. package/es/components/walletCard/Guest/index.d.ts +3 -0
  72. package/es/components/walletCard/Guest/index.js +83 -0
  73. package/es/components/walletCard/Guest/index.less +71 -0
  74. package/es/components/walletCard/index.d.ts +65 -0
  75. package/es/components/walletCard/index.js +402 -0
  76. package/es/components/walletCard/index.less +267 -0
  77. package/es/index.d.ts +10 -1
  78. package/es/index.js +10 -1
  79. package/es/locales/en-US.d.ts +38 -2
  80. package/es/locales/en-US.js +55 -10
  81. package/es/locales/index.js +4 -2
  82. package/es/locales/zh-CN.d.ts +36 -0
  83. package/es/locales/zh-CN.js +41 -1
  84. package/es/locales/zh-TW.d.ts +36 -0
  85. package/es/locales/zh-TW.js +41 -1
  86. package/es/utils/index.d.ts +1 -0
  87. package/es/utils/index.js +3 -0
  88. package/es/utils/platform.d.ts +1 -1
  89. package/lib/components/badge/index.d.ts +7 -0
  90. package/lib/components/badge/index.js +70 -0
  91. package/lib/components/badge/index.less +2 -0
  92. package/lib/components/buttonGroupEdit/index.d.ts +8 -0
  93. package/lib/components/buttonGroupEdit/index.js +317 -0
  94. package/lib/components/buttonGroupPreview/index.d.ts +19 -0
  95. package/lib/components/buttonGroupPreview/index.js +79 -0
  96. package/lib/components/cardMetricItem/index.d.ts +12 -0
  97. package/lib/components/cardMetricItem/index.js +75 -0
  98. package/lib/components/cardMetricItem/index.less +39 -0
  99. package/lib/components/cardPro/index.d.ts +3 -0
  100. package/lib/components/cardPro/index.js +98 -0
  101. package/lib/components/cardPro/index.less +55 -0
  102. package/lib/components/cropPhoto/index.d.ts +3 -0
  103. package/lib/components/cropPhoto/index.js +70 -0
  104. package/lib/components/cropPhoto/index.less +15 -0
  105. package/lib/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +8 -2
  106. package/lib/components/dataSourceComponents/dataSourceMenu/Basic.js +12 -3
  107. package/lib/components/dataSourceComponents/dataSourceMenu/index.d.ts +8 -2
  108. package/lib/components/dataSourceComponents/fields/Input/WithMode.js +21 -0
  109. package/lib/components/dataSourceComponents/fields/Input.Mobile/serve.js +37 -3
  110. package/lib/components/dataSourceComponents/fields/Input.Phone/serve.js +37 -3
  111. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  112. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +2 -0
  113. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +47 -72
  114. package/lib/components/dataSourceComponents/fields/Upload/WithMode.js +11 -9
  115. package/lib/components/dataSourceComponents/fields/Upload/serve.js +11 -2
  116. package/lib/components/dataSourceComponents/fields/Upload/shopUploadServe.d.ts +56 -0
  117. package/lib/components/dataSourceComponents/fields/Upload/shopUploadServe.js +247 -0
  118. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
  119. package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -0
  120. package/lib/components/dataSourceComponents/fields/Upload/utils.js +17 -2
  121. package/lib/components/dataSourceComponents/fields/index.d.ts +8 -8
  122. package/lib/components/dataSourceComponents/hooks/usePlatform.d.ts +3 -0
  123. package/lib/components/dataSourceComponents/hooks/usePlatform.js +51 -0
  124. package/lib/components/login-and-register/index.js +23 -21
  125. package/lib/components/login-and-register/index.less +7 -7
  126. package/lib/components/page/index.js +37 -65
  127. package/lib/components/pisellAnchor/index.d.ts +23 -0
  128. package/lib/components/pisellAnchor/index.js +251 -0
  129. package/lib/components/pisellAnchor/index.less +197 -0
  130. package/lib/components/pisellNavigationMenu/PisellNavigationMenu.js +24 -3
  131. package/lib/components/pisellQrcode/index.d.ts +10 -0
  132. package/lib/components/pisellQrcode/index.js +82 -0
  133. package/lib/components/pisellQrcode/index.less +41 -0
  134. package/lib/components/pisellStatisticList/index.d.ts +3 -0
  135. package/lib/components/pisellStatisticList/index.js +35 -15
  136. package/lib/components/pisellStatisticList/index.less +1 -1
  137. package/lib/components/pisellText/components/Amount/index.d.ts +2 -0
  138. package/lib/components/pisellText/components/Amount/index.js +2 -1
  139. package/lib/components/pisellWalletPassCard/index.d.ts +4 -4
  140. package/lib/components/pisellWalletPassCard/index.js +17 -9
  141. package/lib/components/pisellWalletPassCard/index.less +26 -4
  142. package/lib/components/record-view/index.d.ts +13 -5
  143. package/lib/components/record-view/index.js +63 -11
  144. package/lib/components/record-view/index.less +37 -2
  145. package/lib/components/table/Table/utils.d.ts +1 -1
  146. package/lib/components/tabs/index.d.ts +1 -0
  147. package/lib/components/tabs/index.js +12 -1
  148. package/lib/components/tabs/index.less +5 -5
  149. package/lib/components/walletCard/Guest/index.d.ts +3 -0
  150. package/lib/components/walletCard/Guest/index.js +138 -0
  151. package/lib/components/walletCard/Guest/index.less +71 -0
  152. package/lib/components/walletCard/index.d.ts +65 -0
  153. package/lib/components/walletCard/index.js +374 -0
  154. package/lib/components/walletCard/index.less +267 -0
  155. package/lib/index.d.ts +10 -1
  156. package/lib/index.js +26 -1
  157. package/lib/locales/en-US.d.ts +38 -2
  158. package/lib/locales/en-US.js +41 -3
  159. package/lib/locales/index.js +4 -2
  160. package/lib/locales/zh-CN.d.ts +36 -0
  161. package/lib/locales/zh-CN.js +41 -1
  162. package/lib/locales/zh-TW.d.ts +36 -0
  163. package/lib/locales/zh-TW.js +41 -1
  164. package/lib/utils/index.d.ts +1 -0
  165. package/lib/utils/index.js +6 -1
  166. package/lib/utils/platform.d.ts +1 -1
  167. package/lowcode/badge/meta.ts +20 -11
  168. package/lowcode/badge/snippets.ts +2 -0
  169. package/lowcode/button/meta.ts +2 -6
  170. package/lowcode/button-group/meta.ts +198 -0
  171. package/lowcode/button-group/snippets.ts +68 -0
  172. package/lowcode/button-group-edit/meta.ts +32 -0
  173. package/lowcode/button-group-edit/snippets.ts +98 -0
  174. package/lowcode/button-group-preview/meta.ts +55 -0
  175. package/lowcode/button-group-preview/snippets.ts +57 -0
  176. package/lowcode/card/snippets.ts +55 -55
  177. package/lowcode/card-metric-item/meta.ts +83 -0
  178. package/lowcode/card-metric-item/snippets.ts +13 -0
  179. package/lowcode/card-pro/meta.ts +338 -0
  180. package/lowcode/card-pro/snippe.ts +39 -0
  181. package/lowcode/crop-photo/meta.ts +77 -0
  182. package/lowcode/crop-photo/snippe.ts +12 -0
  183. package/lowcode/form-item-input/snippets.ts +1 -1
  184. package/lowcode/form-item-upload/meta.ts +11 -0
  185. package/lowcode/pisell-anchor/meta.ts +118 -0
  186. package/lowcode/pisell-anchor/snippets.ts +26 -0
  187. package/lowcode/pisell-card/meta.ts +63 -27
  188. package/lowcode/pisell-card/snippets.ts +6 -0
  189. package/lowcode/pisell-modal.information/meta.ts +8 -0
  190. package/lowcode/pisell-qrcode/__screenshots__/upload-1.png +0 -0
  191. package/lowcode/pisell-qrcode/meta.ts +46 -0
  192. package/lowcode/pisell-qrcode/snippets.ts +13 -0
  193. package/lowcode/pisell-tooltip/meta.ts +1 -1
  194. package/lowcode/record-view/meta.ts +20 -0
  195. package/lowcode/section-footers/meta.ts +66 -0
  196. package/lowcode/section-footers/snippe.ts +21 -0
  197. package/lowcode/spin/meta.ts +9 -0
  198. package/lowcode/tag/meta.ts +6 -0
  199. package/lowcode/timeline/meta.ts +32 -9
  200. package/lowcode/timeline/snippets.ts +12 -2
  201. package/lowcode/timeline.item/meta.ts +1 -1
  202. package/lowcode/wallet-card/meta.ts +283 -0
  203. package/lowcode/wallet-card/snippets.ts +44 -0
  204. package/package.json +5 -1
@@ -83,7 +83,7 @@ var Page = (props) => {
83
83
  token: {
84
84
  ...props.theme.token,
85
85
  // 外部透传主题时,如果没有传入colorPrimary 默认使用主项目内主题色
86
- colorPrimary: ((_b2 = (_a2 = props == null ? void 0 : props.theme) == null ? void 0 : _a2.token) == null ? void 0 : _b2.colorPrimary) || themeColor || "#7F56D9"
86
+ colorPrimary: ((_b2 = (_a2 = props == null ? void 0 : props.theme) == null ? void 0 : _a2.token) == null ? void 0 : _b2.colorPrimary) || themeColor || "#5D3F9F"
87
87
  }
88
88
  };
89
89
  }
@@ -120,10 +120,10 @@ var Page = (props) => {
120
120
  colorErrorBg: "#FEF3F2",
121
121
  colorErrorBorderHover: "#FDA29B",
122
122
  colorErrorOutline: "rgba(217, 45, 32, 0.06)",
123
- colorLink: "#175CD3",
124
- colorLinkActive: "#194185",
125
- colorLinkHover: "#1849A9",
126
- // colorPrimaryActive: '#7f56d9',
123
+ colorLink: "#7F56DA",
124
+ colorLinkActive: "#5F3DA8",
125
+ colorLinkHover: "#6D48C4",
126
+ // colorPrimaryActive: '#5D3F9F',
127
127
  // colorPrimaryBorder: '#E9D7FE',
128
128
  colorText: "#344054",
129
129
  colorTextDisabled: "#D0D5DD",
@@ -170,59 +170,25 @@ var Page = (props) => {
170
170
  Select: {
171
171
  fontSizeIcon: 16
172
172
  // "lineHeight": 1
173
+ },
174
+ Menu: {
175
+ subMenuItemSelectedColor: "#9976e3"
173
176
  }
174
177
  },
175
178
  token: {
176
- colorPrimary: themeColor || "#7F56D9",
177
- // colorPrimaryBg: '#F9F5FF',
178
- // colorPrimaryBgHover: '#F4EBFF',
179
- // colorPrimaryBorder: '#E9D7FE',
180
- // colorPrimaryBorderHover: '#D6BBFB',
181
- // colorPrimaryHover: '#6941C6',
182
- // colorPrimaryActive: '#53389E',
183
- // colorPrimaryTextHover: '#53389E',
184
- // colorPrimaryText: '#6941C6',
185
- // colorPrimaryTextActive: '#42307D',
186
- colorSuccess: "#079455",
187
- colorSuccessBg: "#ECFDF3",
188
- colorSuccessBgHover: "#DCFAE6",
189
- colorSuccessBorder: "#ABEFC6",
190
- colorSuccessBorderHover: "#75E0A7",
191
- colorSuccessHover: "#067647",
192
- colorSuccessText: "#067647",
193
- colorSuccessActive: "#085D3A",
194
- colorSuccessTextHover: "#085D3A",
195
- colorSuccessTextActive: "#074D31",
196
- colorWarning: "#dc6803",
197
- colorWarningBg: "#FFFAEB",
198
- colorWarningBgHover: "#FEF0C7",
199
- colorWarningBorder: "#FEDF89",
200
- colorWarningBorderHover: "#FEC84B",
201
- colorWarningHover: "#B54708",
202
- colorWarningText: "#B54708",
203
- colorWarningActive: "#93370D",
204
- colorWarningTextHover: "#93370D",
205
- colorWarningTextActive: "#7A2E0E",
206
- colorError: "#d92d20",
207
- colorErrorBg: "#FEF3F2",
208
- colorErrorBgHover: "#FEE4E2",
209
- colorErrorBorder: "#FECDCA",
210
- colorErrorBorderHover: "#FDA29B",
211
- colorErrorHover: "#B42318",
212
- colorErrorText: "#B42318",
213
- colorErrorActive: "#912018",
214
- colorErrorTextHover: "#912018",
215
- colorErrorTextActive: "#7A271A",
216
- colorInfo: "#1570ef",
217
- colorInfoBg: "#EFF8FF",
218
- colorInfoBgHover: "#D1E9FF",
219
- colorInfoBorder: "#B2DDFF",
220
- colorInfoBorderHover: "#84CAFF",
221
- colorInfoHover: "#175CD3",
222
- colorInfoText: "#175CD3",
223
- colorInfoActive: "#1849A9",
224
- colorInfoTextHover: "#1849A9",
225
- colorInfoTextActive: "#194185",
179
+ colorPrimary: themeColor || "#5D3F9F",
180
+ colorPrimaryBg: "#eee5ff",
181
+ colorPrimaryBgHover: "#e4d9fc",
182
+ colorPrimaryBorder: "#d4c3f7",
183
+ colorSuccess: "#5f9e3f",
184
+ colorInfo: "#5d3f9f",
185
+ colorError: "#f5222d",
186
+ colorSuccessBg: "#e5fcd9",
187
+ colorSuccessBgHover: "#d5f7c3",
188
+ // 链接色
189
+ colorLink: "#7F56DA",
190
+ colorLinkActive: "#5F3DA8",
191
+ colorLinkHover: "#6D48C4",
226
192
  colorText: "#101828",
227
193
  colorTextSecondary: "#475467",
228
194
  colorTextTertiary: "#667085",
@@ -245,7 +211,7 @@ var Page = (props) => {
245
211
  var _a2;
246
212
  return (0, import_date_picker.createTheme)({
247
213
  palette: {
248
- primary: { main: ((_a2 = theme.token) == null ? void 0 : _a2.colorPrimary) || "#7F56D9" }
214
+ primary: { main: ((_a2 = theme.token) == null ? void 0 : _a2.colorPrimary) || "#5D3F9F" }
249
215
  }
250
216
  });
251
217
  }, [platform, themeColor]);
@@ -271,17 +237,23 @@ var Page = (props) => {
271
237
  dateAdapter: import_AdapterDayjs.AdapterDayjs,
272
238
  adapterLocale: ((_d = localeDateMap == null ? void 0 : localeDateMap[locale]) == null ? void 0 : _d.adapterLocale) || "en"
273
239
  },
274
- /* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, /* @__PURE__ */ import_react.default.createElement(import_date_picker.LocaleProvider, { value: { locale } }, /* @__PURE__ */ import_react.default.createElement(import_pisell_config_provider.default, { locale }, /* @__PURE__ */ import_react.default.createElement(import_VariablesProvider.default, { variables: ((_f = (_e = context.engine) == null ? void 0 : _e.props) == null ? void 0 : _f.variables) || {} }, /* @__PURE__ */ import_react.default.createElement(
275
- "div",
240
+ /* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, /* @__PURE__ */ import_react.default.createElement(import_date_picker.LocaleProvider, { value: { locale } }, /* @__PURE__ */ import_react.default.createElement(import_pisell_config_provider.default, { locale }, /* @__PURE__ */ import_react.default.createElement(
241
+ import_VariablesProvider.default,
276
242
  {
277
- style: {
278
- ...style,
279
- "--theme-color": themeColor || "#7F56D9"
280
- },
281
- className
243
+ variables: ((_f = (_e = context.engine) == null ? void 0 : _e.props) == null ? void 0 : _f.variables) || {}
282
244
  },
283
- children
284
- )))))
245
+ /* @__PURE__ */ import_react.default.createElement(
246
+ "div",
247
+ {
248
+ style: {
249
+ ...style,
250
+ "--theme-color": themeColor || "#5D3F9F"
251
+ },
252
+ className
253
+ },
254
+ children
255
+ )
256
+ ))))
285
257
  )
286
258
  )
287
259
  );
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface Option {
4
+ id: string | number;
5
+ name: React.ReactNode;
6
+ }
7
+ export interface PisellAnchorProps {
8
+ options?: Option[];
9
+ tab?: string | number;
10
+ className?: string;
11
+ style?: React.CSSProperties;
12
+ onChange?: (key: string | number) => void;
13
+ onTabClick?: () => void;
14
+ containerRef?: React.RefObject<HTMLElement>;
15
+ /**
16
+ * 平台类型,仅用于样式调整,不再影响锚点滚动功能
17
+ * 无论pc还是h5模式,点击锚点都会自动滚动到对应内容
18
+ * @default 'pc'
19
+ */
20
+ platform?: 'pc' | 'h5';
21
+ }
22
+ declare const PisellAnchor: React.ForwardRefExoticComponent<PisellAnchorProps & React.RefAttributes<any>>;
23
+ export default PisellAnchor;
@@ -0,0 +1,251 @@
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/pisellAnchor/index.tsx
30
+ var pisellAnchor_exports = {};
31
+ __export(pisellAnchor_exports, {
32
+ default: () => pisellAnchor_default
33
+ });
34
+ module.exports = __toCommonJS(pisellAnchor_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_classnames = __toESM(require("classnames"));
37
+ var import_ahooks = require("ahooks");
38
+ var import_ChevronLeft = __toESM(require("@pisell/icon/es/ChevronLeft"));
39
+ var import_ChevronRight = __toESM(require("@pisell/icon/es/ChevronRight"));
40
+ var import_index = require("./index.less");
41
+ var PisellAnchor = (0, import_react.forwardRef)((props, ref) => {
42
+ const {
43
+ options = [],
44
+ tab,
45
+ className,
46
+ style,
47
+ onChange,
48
+ onTabClick,
49
+ containerRef,
50
+ platform = "pc"
51
+ } = props;
52
+ const contentRef = (0, import_react.useRef)(null);
53
+ const scrollTimeoutRef = (0, import_react.useRef)(null);
54
+ const isClickScrolling = (0, import_react.useRef)(false);
55
+ const clickedTabRef = (0, import_react.useRef)(null);
56
+ const [leftWidth, setLeftWidth] = (0, import_react.useState)(0);
57
+ const [rightWidth, setRightWidth] = (0, import_react.useState)(40);
58
+ const [showButtons, setShowButtons] = (0, import_react.useState)(false);
59
+ const [hoveredTab, setHoveredTab] = (0, import_react.useState)(null);
60
+ (0, import_react.useEffect)(() => {
61
+ if (contentRef.current) {
62
+ const { scrollWidth, clientWidth } = contentRef.current;
63
+ setShowButtons(scrollWidth > clientWidth);
64
+ }
65
+ }, [options]);
66
+ (0, import_react.useEffect)(() => {
67
+ return () => {
68
+ if (scrollTimeoutRef.current) {
69
+ clearTimeout(scrollTimeoutRef.current);
70
+ }
71
+ };
72
+ }, []);
73
+ const { run: onScrollDebounced } = (0, import_ahooks.useDebounceFn)(
74
+ (e) => {
75
+ const { scrollLeft, scrollWidth, clientWidth } = e.target;
76
+ setLeftWidth(scrollLeft > 0 ? 40 : 0);
77
+ setRightWidth(scrollLeft + clientWidth >= scrollWidth ? 0 : 40);
78
+ },
79
+ { wait: 200 }
80
+ );
81
+ const { run: handleScrollThrottled } = (0, import_ahooks.useThrottleFn)(
82
+ () => {
83
+ if (isClickScrolling.current) return;
84
+ if (!(containerRef == null ? void 0 : containerRef.current)) return;
85
+ const container = containerRef.current;
86
+ const headerHeight = 65;
87
+ const containerRect = container.getBoundingClientRect();
88
+ const scrollTop = container.scrollTop;
89
+ const containerHeight = containerRect.height;
90
+ const scrollHeight = container.scrollHeight;
91
+ const isAtBottom = scrollTop + containerHeight >= scrollHeight - 50;
92
+ if (isAtBottom) {
93
+ const lastOption = options[options.length - 1];
94
+ if (tab !== lastOption.id && lastOption.id !== clickedTabRef.current) {
95
+ onChange == null ? void 0 : onChange(lastOption.id);
96
+ }
97
+ return;
98
+ }
99
+ let closestOption = null;
100
+ let minDistance = Infinity;
101
+ for (const option of options) {
102
+ const elementById = document.getElementById(option.id);
103
+ const elementByDataAttr = document.querySelector(`[data-section="${option.id}"]`);
104
+ const element = elementById || elementByDataAttr;
105
+ if (element) {
106
+ const htmlElement = element;
107
+ const elementOffsetTop = htmlElement.offsetTop;
108
+ const elementHeight = htmlElement.offsetHeight;
109
+ const elementTopRelativeToViewport = elementOffsetTop - scrollTop;
110
+ const isTopVisible = elementTopRelativeToViewport >= headerHeight && elementTopRelativeToViewport <= containerHeight;
111
+ const isBottomVisible = elementTopRelativeToViewport + elementHeight >= headerHeight && elementTopRelativeToViewport + elementHeight <= containerHeight;
112
+ const isElementPartiallyVisible = isTopVisible || isBottomVisible || elementTopRelativeToViewport < headerHeight && elementTopRelativeToViewport + elementHeight > containerHeight;
113
+ const distance = Math.abs(elementTopRelativeToViewport - headerHeight);
114
+ if (distance < minDistance) {
115
+ minDistance = distance;
116
+ closestOption = option;
117
+ }
118
+ }
119
+ }
120
+ if (closestOption && tab !== closestOption.id && closestOption.id !== clickedTabRef.current && minDistance < 50) {
121
+ onChange == null ? void 0 : onChange(closestOption.id);
122
+ }
123
+ },
124
+ { wait: 150 }
125
+ );
126
+ (0, import_react.useEffect)(() => {
127
+ if (!(containerRef == null ? void 0 : containerRef.current)) return;
128
+ const handleScroll = () => {
129
+ if (!isClickScrolling.current) {
130
+ handleScrollThrottled();
131
+ }
132
+ };
133
+ const container = containerRef.current;
134
+ container.addEventListener("scroll", handleScroll);
135
+ return () => {
136
+ container.removeEventListener("scroll", handleScroll);
137
+ };
138
+ }, [handleScrollThrottled]);
139
+ const handleOptionClick = (item) => {
140
+ console.log("PisellAnchor: Tab clicked", item.id);
141
+ if (scrollTimeoutRef.current) {
142
+ clearTimeout(scrollTimeoutRef.current);
143
+ }
144
+ onChange == null ? void 0 : onChange(item.id);
145
+ onTabClick == null ? void 0 : onTabClick();
146
+ const elementById = document.getElementById(String(item.id));
147
+ const elementByDataAttr = document.querySelector(`[data-section="${String(item.id)}"]`);
148
+ const element = elementById || elementByDataAttr;
149
+ console.log("PisellAnchor: Target element found?", !!element);
150
+ console.log("PisellAnchor: Container ref exists?", !!(containerRef == null ? void 0 : containerRef.current));
151
+ if (element && (containerRef == null ? void 0 : containerRef.current)) {
152
+ isClickScrolling.current = true;
153
+ clickedTabRef.current = item.id;
154
+ requestAnimationFrame(() => {
155
+ if (!(containerRef == null ? void 0 : containerRef.current)) return;
156
+ const htmlElement = element;
157
+ const headerHeight = 65;
158
+ const elementOffsetTop = htmlElement.offsetTop;
159
+ console.log("PisellAnchor: Scrolling using offsetTop", {
160
+ elementOffsetTop,
161
+ targetScrollTop: elementOffsetTop - headerHeight
162
+ });
163
+ containerRef.current.scrollTo({
164
+ top: elementOffsetTop - headerHeight,
165
+ behavior: "smooth"
166
+ });
167
+ setTimeout(() => {
168
+ if (!(containerRef == null ? void 0 : containerRef.current)) return;
169
+ containerRef.current.scrollTo({
170
+ top: elementOffsetTop - headerHeight,
171
+ behavior: "auto"
172
+ // 使用即时滚动确保位置准确
173
+ });
174
+ }, 300);
175
+ });
176
+ scrollTimeoutRef.current = setTimeout(() => {
177
+ isClickScrolling.current = false;
178
+ clickedTabRef.current = null;
179
+ }, 1e3);
180
+ } else {
181
+ console.warn("PisellAnchor: Cannot scroll, element or container not found", {
182
+ elementId: item.id,
183
+ elementByIdExists: !!elementById,
184
+ elementByDataAttrExists: !!elementByDataAttr,
185
+ containerExists: !!(containerRef == null ? void 0 : containerRef.current)
186
+ });
187
+ }
188
+ };
189
+ const onPageChange = (type) => {
190
+ if (contentRef.current) {
191
+ const { scrollLeft, clientWidth } = contentRef.current;
192
+ const newScrollLeft = scrollLeft + (type === "left" ? -clientWidth : clientWidth);
193
+ contentRef.current.scrollTo({
194
+ left: newScrollLeft,
195
+ behavior: "smooth"
196
+ });
197
+ }
198
+ };
199
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-anchor-tabs", className), style }, showButtons && /* @__PURE__ */ import_react.default.createElement(
200
+ "div",
201
+ {
202
+ className: "pisell-anchor-tabs-btn-left",
203
+ style: { width: leftWidth },
204
+ onClick: () => onPageChange("left")
205
+ },
206
+ /* @__PURE__ */ import_react.default.createElement(import_ChevronLeft.default, { className: "pisell-anchor-tabs-btn-icon" })
207
+ ), /* @__PURE__ */ import_react.default.createElement(
208
+ "div",
209
+ {
210
+ ref: contentRef,
211
+ className: "pisell-anchor-tabs-content",
212
+ id: `tab-${tab}-content`,
213
+ onScroll: onScrollDebounced
214
+ },
215
+ options.map((item) => /* @__PURE__ */ import_react.default.createElement(
216
+ "div",
217
+ {
218
+ key: item.id,
219
+ id: `tab-${item.id}`,
220
+ className: (0, import_classnames.default)("pisell-anchor-tabs-tab", {
221
+ "pisell-anchor-tabs-tab-active": tab === item.id
222
+ }),
223
+ onClick: () => {
224
+ console.log("PisellAnchor: Tab div clicked", item.id);
225
+ handleOptionClick(item);
226
+ }
227
+ },
228
+ /* @__PURE__ */ import_react.default.createElement(
229
+ "span",
230
+ {
231
+ className: "pisell-anchor-tabs-tab-content",
232
+ onClick: (e) => {
233
+ e.stopPropagation();
234
+ console.log("PisellAnchor: Tab span clicked", item.id);
235
+ handleOptionClick(item);
236
+ }
237
+ },
238
+ item.name
239
+ )
240
+ ))
241
+ ), showButtons && /* @__PURE__ */ import_react.default.createElement(
242
+ "div",
243
+ {
244
+ className: "pisell-anchor-tabs-btn-right",
245
+ style: { width: rightWidth },
246
+ onClick: () => onPageChange("right")
247
+ },
248
+ /* @__PURE__ */ import_react.default.createElement(import_ChevronRight.default, { className: "pisell-anchor-tabs-btn-icon" })
249
+ ));
250
+ });
251
+ var pisellAnchor_default = PisellAnchor;
@@ -0,0 +1,197 @@
1
+ .pisell-anchor-containers {
2
+ // display: flex;
3
+ // align-items: center;
4
+ // background-color: #fff;
5
+ // height: 40px;
6
+ .pisell-lowcode-anchor-wrapper {
7
+ &::before {
8
+ content: '';
9
+ display: none;
10
+ }
11
+ .pisell-lowcode-anchor {
12
+ height: 40px;
13
+ border-bottom: none !important;
14
+ background-color: #fff;
15
+
16
+ .pisell-lowcode-anchor-ink {
17
+ display: none;
18
+ }
19
+
20
+ .pisell-lowcode-anchor-link {
21
+ height: 100%;
22
+ padding: 0 16px;
23
+ display: flex;
24
+ align-items: center;
25
+
26
+ &-title {
27
+ color: var(--Gray-900, #101828);
28
+ font-family: Inter;
29
+ font-size: 16px;
30
+ font-weight: 600;
31
+ line-height: 40px;
32
+ }
33
+ }
34
+
35
+ .pisell-lowcode-anchor-link-active {
36
+ border-radius: 100px;
37
+ background: var(--theme-color, #7f56d9);
38
+ height: 40px;
39
+
40
+ .pisell-lowcode-anchor-link-title {
41
+ color: var(--White, #fff);
42
+ line-height: 40px;
43
+ }
44
+ }
45
+ }
46
+ }
47
+ .pisell-anchor-scroll {
48
+ height: 40px;
49
+ flex: 1;
50
+ overflow-x: auto;
51
+
52
+ // 隐藏滚动条 - Firefox
53
+ scrollbar-width: none;
54
+
55
+ // 隐藏滚动条 - IE and Edge
56
+ -ms-overflow-style: none;
57
+
58
+ // 隐藏滚动条 - Chrome, Safari, Opera
59
+ &::-webkit-scrollbar {
60
+ display: none;
61
+ }
62
+ }
63
+
64
+ .pisell-anchor-buttons {
65
+ display: flex;
66
+ gap: 8px;
67
+ margin-left: 16px;
68
+
69
+ .scroll-button {
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ width: 24px;
74
+ height: 24px;
75
+ border: 1px solid #d9d9d9;
76
+ border-radius: 4px;
77
+ background: white;
78
+ cursor: pointer;
79
+ transition: all 0.3s;
80
+
81
+ &:hover:not(.disabled) {
82
+ color: #1890ff;
83
+ border-color: #1890ff;
84
+ }
85
+
86
+ &.disabled {
87
+ color: #d9d9d9;
88
+ cursor: not-allowed;
89
+ background: #f5f5f5;
90
+ }
91
+ }
92
+ }
93
+ }
94
+
95
+ .pisell-anchor-tabs {
96
+ display: flex;
97
+ align-items: center;
98
+ width: 100%;
99
+ height: 100%;
100
+ font-size: 17px;
101
+ font-weight: 400;
102
+ color: #0d1619;
103
+ cursor: default;
104
+ position: relative;
105
+
106
+ .pisell-anchor-tabs-btn-left,
107
+ .pisell-anchor-tabs-btn-right {
108
+ position: absolute;
109
+ top: 50%;
110
+ transform: translateY(-50%);
111
+ z-index: 1;
112
+ width: 40px;
113
+ height: 40px;
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ background: linear-gradient(90deg, #fff 30%, rgba(255, 255, 255, 0.8) 100%);
118
+ cursor: pointer;
119
+ transition: width 300ms ease;
120
+ user-select: none;
121
+
122
+ .pisell-anchor-tabs-btn-icon {
123
+ width: 24px;
124
+ height: 24px;
125
+ background: #f1f1f1;
126
+ border-radius: 50%;
127
+ display: flex;
128
+ align-items: center;
129
+ justify-content: center;
130
+ color: #262626;
131
+ font-size: 20px;
132
+ }
133
+ }
134
+
135
+ .pisell-anchor-tabs-btn-left {
136
+ left: 0;
137
+ background: linear-gradient(270deg, rgba(255, 255, 255, 0.8) 0%, #fff 70%);
138
+ }
139
+
140
+ .pisell-anchor-tabs-btn-right {
141
+ right: 0;
142
+ background: linear-gradient(90deg, rgba(255, 255, 255, 0.8) 0%, #fff 70%);
143
+ }
144
+
145
+ .pisell-anchor-tabs-content {
146
+ flex: 1;
147
+ display: flex;
148
+ overflow-x: auto;
149
+ overflow-y: hidden;
150
+ scroll-behavior: smooth;
151
+ -webkit-overflow-scrolling: touch;
152
+ scrollbar-width: none;
153
+ -ms-overflow-style: none;
154
+ padding: 0;
155
+ gap: 16px;
156
+
157
+ &::-webkit-scrollbar {
158
+ display: none;
159
+ }
160
+
161
+ .pisell-anchor-tabs-tab {
162
+ flex: 0 0 auto;
163
+ padding: 0 16px;
164
+ cursor: pointer;
165
+ white-space: nowrap;
166
+ transition: all 0.3s;
167
+ height: 48px;
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: center;
171
+ font-size: 16px;
172
+ border-radius: 100px;
173
+
174
+ &:hover:not(.pisell-anchor-tabs-tab-active) {
175
+ color: var(--theme-color, #7f56d9);
176
+ }
177
+
178
+ &.pisell-anchor-tabs-tab-active {
179
+ color: #fff;
180
+ font-weight: 600;
181
+ background-color: var(--theme-color, #7f56d9);
182
+ }
183
+
184
+ .pisell-anchor-tabs-tab-content {
185
+ line-height: 24px;
186
+ }
187
+ }
188
+ }
189
+ }
190
+
191
+ .pisell-anchor {
192
+ border-bottom: 1px solid #EAECF0;
193
+
194
+ &.pisell-anchor-no-border {
195
+ border-bottom: none;
196
+ }
197
+ }
@@ -88,12 +88,31 @@ var PisellNavigationMenu = ({
88
88
  onAddPage == null ? void 0 : onAddPage(item);
89
89
  }
90
90
  }, []);
91
+ const tagTextMap = (0, import_react.useMemo)(() => {
92
+ return {
93
+ base: {
94
+ text: (0, import_locales.getText)("pisell-lowcode-navigation-menu-tag-base"),
95
+ color: "#7f56d9"
96
+ },
97
+ pisellV1: {
98
+ text: (0, import_locales.getText)("pisell-lowcode-navigation-menu-tag-pisell1"),
99
+ color: "#ee837a"
100
+ }
101
+ };
102
+ }, []);
91
103
  const renderMenuItem = (0, import_react.useCallback)(
92
104
  (itemProps) => {
105
+ var _a, _b;
93
106
  const { item } = itemProps;
94
- const { allowEdit = true, allowDelete: allowDelete2 = true, allowAddChild: allowAddChild2 = true, allowAddSubmenu = true, allowAddPage = true } = item;
107
+ const {
108
+ allowEdit = true,
109
+ allowDelete: allowDelete2 = true,
110
+ allowAddChild: allowAddChild2 = true,
111
+ allowAddSubmenu = true,
112
+ allowAddPage = true
113
+ } = item;
95
114
  const isShowAddButton = item.isGroup && allowAddChild2 && (allowAddSubmenu || allowAddPage);
96
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-content-icon" }, /* @__PURE__ */ import_react.default.createElement(import_icon.default, { type: item.icon })), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-content-text" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-description" }, item.description, !item.isGroup && item.version && /* @__PURE__ */ import_react.default.createElement(import_pisellTags.default, { type: "pill_color", color: "success" }, item.version)))), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-action-wrap" }, allowEdit && /* @__PURE__ */ import_react.default.createElement(
115
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-content-icon" }, /* @__PURE__ */ import_react.default.createElement(import_icon.default, { type: item.icon })), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-content-text" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-description" }, item.description, item.source && /* @__PURE__ */ import_react.default.createElement(import_pisellTags.default, { type: "pill_color", color: (_a = tagTextMap[item.source]) == null ? void 0 : _a.color }, ((_b = tagTextMap[item.source]) == null ? void 0 : _b.text) || ""), !item.isGroup && item.version && /* @__PURE__ */ import_react.default.createElement(import_pisellTags.default, { type: "pill_color", color: "success" }, "v", item.version)))), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-navigation-menu-item-action-wrap" }, allowEdit && /* @__PURE__ */ import_react.default.createElement(
97
116
  import_button.default,
98
117
  {
99
118
  type: "text",
@@ -114,7 +133,9 @@ var PisellNavigationMenu = ({
114
133
  items: [
115
134
  allowAddSubmenu && {
116
135
  key: "add-child",
117
- label: (0, import_locales.getText)("pisell-lowcode-navigation-menu-add-sub-menu"),
136
+ label: (0, import_locales.getText)(
137
+ "pisell-lowcode-navigation-menu-add-sub-menu"
138
+ ),
118
139
  onClick: () => handleClick("add-child", item)
119
140
  },
120
141
  allowAddPage && {
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface PisellQrcodeProps {
4
+ size?: number;
5
+ platform: 'pc' | 'h5' | 'ipad';
6
+ value: string;
7
+ className: string;
8
+ }
9
+ declare const PisellQrcode: React.FC<PisellQrcodeProps>;
10
+ export default PisellQrcode;