@pisell/materials 1.0.545 → 1.0.547

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 (44) hide show
  1. package/build/lowcode/assets/3aabdcc7a349f06ed35f441355ffd5be.png +0 -0
  2. package/build/lowcode/assets-daily.json +11 -11
  3. package/build/lowcode/assets-dev.json +2 -2
  4. package/build/lowcode/assets-prod.json +11 -11
  5. package/build/lowcode/index.js +1 -1
  6. package/build/lowcode/meta.js +5 -5
  7. package/build/lowcode/preview.js +7 -7
  8. package/build/lowcode/render/default/assets/3aabdcc7a349f06ed35f441355ffd5be.png +0 -0
  9. package/build/lowcode/render/default/view.css +1 -1
  10. package/build/lowcode/render/default/view.js +19 -19
  11. package/build/lowcode/view.css +1 -1
  12. package/build/lowcode/view.js +18 -18
  13. package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +11 -4
  14. package/es/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
  15. package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +3 -0
  16. package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +9 -3
  17. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +0 -1
  18. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +16 -13
  19. package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +3 -0
  20. package/es/components/organizationTenantSwitcher/index.less +1 -1
  21. package/es/components/saasLogin/img/leftImg.png +0 -0
  22. package/es/components/saasLogin/index.d.ts +83 -0
  23. package/es/components/saasLogin/index.js +369 -0
  24. package/es/components/saasLogin/index.less +249 -0
  25. package/es/index.d.ts +1 -0
  26. package/es/index.js +2 -1
  27. package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +10 -3
  28. package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
  29. package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +3 -0
  30. package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +16 -3
  31. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +0 -1
  32. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +6 -5
  33. package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +3 -0
  34. package/lib/components/organizationTenantSwitcher/index.less +1 -1
  35. package/lib/components/saasLogin/img/leftImg.png +0 -0
  36. package/lib/components/saasLogin/index.d.ts +83 -0
  37. package/lib/components/saasLogin/index.js +262 -0
  38. package/lib/components/saasLogin/index.less +249 -0
  39. package/lib/index.d.ts +1 -0
  40. package/lib/index.js +3 -0
  41. package/lowcode/data-source-form/meta.ts +64 -0
  42. package/lowcode/saas-login/meta.ts +541 -0
  43. package/lowcode/saas-login/snippets.ts +38 -0
  44. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- var _excluded = ["title", "description", "dataSource", "showTitle", "showDescription", "groupInfoPosition", "variables", "renderMode", "children", "currentValue", "className", "onDataSourceFinish"];
1
+ var _excluded = ["title", "description", "dataSource", "showTitle", "showDescription", "groupInfoPosition", "variables", "renderMode", "children", "currentValue", "className", "onDataSourceFinish", "formatSubmitValues", "formatInitialValues", "customSubmit"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -27,6 +27,9 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
27
27
  currentValue = props.currentValue,
28
28
  className = props.className,
29
29
  onDataSourceFinish = props.onDataSourceFinish,
30
+ formatSubmitValues = props.formatSubmitValues,
31
+ formatInitialValues = props.formatInitialValues,
32
+ customSubmit = props.customSubmit,
30
33
  others = _objectWithoutProperties(props, _excluded);
31
34
  var formRef = useRef(null);
32
35
  var _useDataSource = useDataSource(),
@@ -45,16 +48,20 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
45
48
  if (['edit', 'view'].includes(renderMode || '') && dataSource) {
46
49
  get === null || get === void 0 ? void 0 : get.runAsync().then(function (res) {
47
50
  var _formRef$current2;
48
- (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.setFieldsValue(res);
51
+ var formattedValues = formatInitialValues ? formatInitialValues(res) : res;
52
+ (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.setFieldsValue(formattedValues);
49
53
  });
50
54
  }
51
- }, [renderMode, dataSource]);
55
+ }, [renderMode, dataSource, formatInitialValues]);
52
56
  return /*#__PURE__*/React.createElement(FormSettingProvider, {
53
57
  renderMode: renderMode,
54
58
  groupInfoPosition: groupInfoPosition,
55
59
  currentValue: currentValue,
56
60
  size: others.size,
57
- onDataSourceFinish: onDataSourceFinish
61
+ onDataSourceFinish: onDataSourceFinish,
62
+ formatSubmitValues: formatSubmitValues,
63
+ formatInitialValues: formatInitialValues,
64
+ customSubmit: customSubmit
58
65
  }, /*#__PURE__*/React.createElement(Form, _extends({}, others, {
59
66
  className: classNames('pisell-lowcode-data-source-form', className),
60
67
  ref: formRef,
@@ -29,7 +29,7 @@ var FormItem = function FormItem(props) {
29
29
  dataSource = _useDataSource.dataSource;
30
30
  var fields = dataSource === null || dataSource === void 0 ? void 0 : dataSource.fields;
31
31
  var _useFormSetting = useFormSetting(),
32
- globalMode = _useFormSetting.mode;
32
+ globalMode = _useFormSetting.renderMode;
33
33
  var field = fields === null || fields === void 0 ? void 0 : fields.find(function (item) {
34
34
  return item.name === name;
35
35
  });
@@ -7,6 +7,9 @@ export interface FormSettingContextType {
7
7
  children?: React.ReactNode;
8
8
  currentValue?: 'server' | 'local';
9
9
  size?: 'small' | 'middle' | 'large';
10
+ formatSubmitValues?: (values: Record<string, any>) => Record<string, any>;
11
+ formatInitialValues?: (values: Record<string, any>) => Record<string, any>;
12
+ customSubmit?: (values: Record<string, any>) => Promise<any>;
10
13
  }
11
14
  export declare const FormSettingContext: import("react").Context<FormSettingContextType>;
12
15
  export default FormSettingContext;
@@ -11,16 +11,22 @@ var FormSettingProvider = function FormSettingProvider(props) {
11
11
  groupInfoPosition = props.groupInfoPosition,
12
12
  currentValue = props.currentValue,
13
13
  size = props.size,
14
- onDataSourceFinish = props.onDataSourceFinish;
14
+ onDataSourceFinish = props.onDataSourceFinish,
15
+ formatSubmitValues = props.formatSubmitValues,
16
+ formatInitialValues = props.formatInitialValues,
17
+ customSubmit = props.customSubmit;
15
18
  var value = React.useMemo(function () {
16
19
  return {
17
20
  renderMode: renderMode,
18
21
  groupInfoPosition: groupInfoPosition,
19
22
  currentValue: currentValue,
20
23
  size: size,
21
- onDataSourceFinish: onDataSourceFinish
24
+ onDataSourceFinish: onDataSourceFinish,
25
+ formatSubmitValues: formatSubmitValues,
26
+ formatInitialValues: formatInitialValues,
27
+ customSubmit: customSubmit
22
28
  };
23
- }, [renderMode, groupInfoPosition, currentValue, size, onDataSourceFinish]);
29
+ }, [renderMode, groupInfoPosition, currentValue, size, onDataSourceFinish, formatSubmitValues, formatInitialValues, customSubmit]);
24
30
  return /*#__PURE__*/React.createElement(FormSettingContext.Provider, {
25
31
  value: value
26
32
  }, children);
@@ -33,7 +33,6 @@ export interface SubmitButtonProps extends ButtonProps {
33
33
  duration: number;
34
34
  placement: 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
35
35
  };
36
- customSubmit?: (values: Record<string, any>) => void;
37
36
  }
38
37
  declare const SubmitButton: (props: SubmitButtonProps) => React.JSX.Element | null;
39
38
  export default SubmitButton;
@@ -29,8 +29,7 @@ var SubmitButton = function SubmitButton(props) {
29
29
  afterSubmitType = props.afterSubmitType,
30
30
  afterSubmitModalConfig = props.afterSubmitModalConfig,
31
31
  afterSubmitNotificationConfig = props.afterSubmitNotificationConfig,
32
- childrenString = props.childrenString,
33
- customSubmit = props.customSubmit;
32
+ childrenString = props.childrenString;
34
33
  var _useState = useState(false),
35
34
  _useState2 = _slicedToArray(_useState, 2),
36
35
  loading = _useState2[0],
@@ -42,7 +41,9 @@ var SubmitButton = function SubmitButton(props) {
42
41
  var form = Form.useFormInstance();
43
42
  var _useFormSetting = useFormSetting(),
44
43
  renderMode = _useFormSetting.renderMode,
45
- onDataSourceFinish = _useFormSetting.onDataSourceFinish;
44
+ onDataSourceFinish = _useFormSetting.onDataSourceFinish,
45
+ formatSubmitValues = _useFormSetting.formatSubmitValues,
46
+ customSubmit = _useFormSetting.customSubmit;
46
47
  var _useCtxActions = useCtxActions(),
47
48
  setVisible = _useCtxActions.setVisible,
48
49
  refreshTableData = _useCtxActions.refreshTableData;
@@ -128,7 +129,7 @@ var SubmitButton = function SubmitButton(props) {
128
129
  // 验证表单并提交
129
130
  var handleValideFieldsSubmit = /*#__PURE__*/function () {
130
131
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
131
- var allValues, result, afterSubmitFunc;
132
+ var allValues, filteredValues, formattedValues, result, afterSubmitFunc;
132
133
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
133
134
  while (1) switch (_context2.prev = _context2.next) {
134
135
  case 0:
@@ -146,13 +147,15 @@ var SubmitButton = function SubmitButton(props) {
146
147
  content: toastConfig.title
147
148
  });
148
149
  }
149
- _context2.next = 8;
150
- return onSubmit(filterSystemFields(allValues));
151
- case 8:
150
+ filteredValues = filterSystemFields(allValues); // 格式化提交数据
151
+ formattedValues = formatSubmitValues ? formatSubmitValues(filteredValues) : filteredValues;
152
+ _context2.next = 10;
153
+ return onSubmit(formattedValues);
154
+ case 10:
152
155
  result = _context2.sent;
153
156
  // 数据源提交成功
154
157
  if (onDataSourceFinish) {
155
- onDataSourceFinish(filterSystemFields(allValues), result);
158
+ onDataSourceFinish(formattedValues, result);
156
159
  }
157
160
  if (refreshData) {
158
161
  refreshTableData === null || refreshTableData === void 0 ? void 0 : refreshTableData();
@@ -168,19 +171,19 @@ var SubmitButton = function SubmitButton(props) {
168
171
  afterSubmitFunc();
169
172
  }
170
173
  }
171
- _context2.next = 18;
174
+ _context2.next = 20;
172
175
  break;
173
- case 15:
174
- _context2.prev = 15;
176
+ case 17:
177
+ _context2.prev = 17;
175
178
  _context2.t0 = _context2["catch"](0);
176
179
  PisellToast({
177
180
  content: "".concat(_context2.t0.message)
178
181
  });
179
- case 18:
182
+ case 20:
180
183
  case "end":
181
184
  return _context2.stop();
182
185
  }
183
- }, _callee2, null, [[0, 15]]);
186
+ }, _callee2, null, [[0, 17]]);
184
187
  }));
185
188
  return function handleValideFieldsSubmit(_x3) {
186
189
  return _ref2.apply(this, arguments);
@@ -17,4 +17,7 @@ export interface DataSourceFormProps {
17
17
  size?: 'small' | 'middle' | 'large';
18
18
  onDataSourceFinish?: (values: any, result: any) => void;
19
19
  __designMode?: string;
20
+ formatSubmitValues?: (values: Record<string, any>) => Record<string, any>;
21
+ formatInitialValues?: (values: Record<string, any>) => Record<string, any>;
22
+ customSubmit?: (values: Record<string, any>) => Promise<any>;
20
23
  }
@@ -5,7 +5,7 @@
5
5
  gap: 10px;
6
6
  padding: 6px 16px 6px 6px;
7
7
  height: 52px;
8
-
8
+ width: fit-content;
9
9
  max-width: 220px;
10
10
 
11
11
  border-radius: 8px;
@@ -0,0 +1,83 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ import { I18nData } from '@/types';
4
+ /**
5
+ * SaasLogin组件的属性接口
6
+ */
7
+ export interface SaasLoginProps {
8
+ /** Logo相关配置 */
9
+ showLogo?: boolean;
10
+ logo?: string;
11
+ logoPosition?: 'left' | 'center' | 'right';
12
+ logoSize?: {
13
+ width?: number;
14
+ height?: number;
15
+ };
16
+ /** 标题相关配置 */
17
+ title?: string | I18nData;
18
+ showTitle?: boolean;
19
+ titleAlign?: 'left' | 'center' | 'right';
20
+ /** 副标题相关配置 */
21
+ subtitle?: string | I18nData;
22
+ showSubtitle?: boolean;
23
+ subtitleAlign?: 'left' | 'center' | 'right';
24
+ /** 登录方式配置 */
25
+ loginMethods?: ('email' | 'google' | 'facebook' | 'apple')[];
26
+ defaultLoginMethod?: 'email' | 'google' | 'facebook' | 'apple';
27
+ /** 表单配置 */
28
+ emailLabel?: string | I18nData;
29
+ passwordLabel?: string | I18nData;
30
+ emailPlaceholder?: string | I18nData;
31
+ passwordPlaceholder?: string | I18nData;
32
+ emailRules?: any[];
33
+ buttonText?: string | I18nData;
34
+ rememberMeText?: string | I18nData;
35
+ forgotPasswordText?: string | I18nData;
36
+ showRememberMe?: boolean;
37
+ showForgotPassword?: boolean;
38
+ /** 社交登录配置 */
39
+ socialLoginTexts?: {
40
+ google?: string | I18nData;
41
+ facebook?: string | I18nData;
42
+ apple?: string | I18nData;
43
+ };
44
+ /** 底部配置 */
45
+ showFooter?: boolean;
46
+ showSignUp?: boolean;
47
+ signUpText?: string | I18nData;
48
+ signUpLink?: string;
49
+ signUpPosition?: 'left' | 'center' | 'right';
50
+ otherLinks?: Array<{
51
+ text: string | I18nData;
52
+ url: string;
53
+ }>;
54
+ otherLinksPosition?: 'left' | 'center' | 'right';
55
+ /** 登录/注册切换配置 */
56
+ showTabs?: boolean;
57
+ loginTabText?: string | I18nData;
58
+ registerTabText?: string | I18nData;
59
+ /** 注册表单配置 */
60
+ registerEmailPlaceholder?: string | I18nData;
61
+ registerPasswordPlaceholder?: string | I18nData;
62
+ registerButtonText?: string | I18nData;
63
+ /** 事件回调 */
64
+ onLogin?: (values: {
65
+ email: string;
66
+ loginMethod: string;
67
+ }) => void;
68
+ onSocialLogin?: (type: 'google' | 'facebook' | 'apple') => void;
69
+ onSignUp?: () => void;
70
+ onRegister?: (values: {
71
+ email: string;
72
+ password: string;
73
+ }) => void;
74
+ /** 新增背景图片属性 */
75
+ backgroundImage?: string;
76
+ }
77
+ /**
78
+ * Saas登录组件
79
+ * @param props - 组件属性
80
+ * @returns React组件
81
+ */
82
+ declare const SaasLogin: React.FC<SaasLoginProps>;
83
+ export default SaasLogin;