@pisell/materials 6.0.5 → 6.0.7
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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +21 -53
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +18 -50
- package/es/components/config-provider/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +20 -11
- package/es/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
- package/es/components/dataSourceComponents/dataSourceForm/index.js +4 -2
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +11 -3
- package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +10 -3
- package/es/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
- package/es/components/dataSourceComponents/dataSourceForm/serve.js +36 -20
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +50 -35
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +38 -10
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +14 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +48 -4
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/index.js +4 -2
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +15 -1
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +7 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +16 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
- package/es/components/dataSourceComponents/fields/Select/index.js +7 -1
- package/es/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
- package/es/components/dataSourceComponents/fields/Upload/serve.js +10 -31
- package/es/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
- package/es/components/dataSourceComponents/hooks/useActions.js +73 -36
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +53 -6
- package/es/components/login-and-register/index.d.ts +82 -0
- package/es/components/login-and-register/index.js +360 -0
- package/es/components/login-and-register/index.less +211 -0
- package/es/components/organizationTenantSwitcher/defaultLogo.png +0 -0
- package/es/components/organizationTenantSwitcher/index.d.ts +17 -0
- package/es/components/organizationTenantSwitcher/index.js +96 -0
- package/es/components/organizationTenantSwitcher/index.less +88 -0
- package/es/components/page/index.js +8 -6
- package/es/components/page-header/index.d.ts +14 -0
- package/es/components/page-header/index.js +36 -0
- package/es/components/page-header/index.less +45 -0
- package/es/components/pisellAvatar/index.d.ts +19 -0
- package/es/components/pisellAvatar/index.js +89 -0
- package/es/components/pisellAvatar/index.less +26 -0
- package/es/components/pisellModal/components/PcModal/index.js +1 -1
- package/es/components/pisellTags/index.d.ts +13 -0
- package/es/components/pisellTags/index.js +83 -0
- package/es/components/pisellTags/index.less +17 -0
- package/es/components/pisellTags/utils.d.ts +1 -0
- package/es/components/pisellTags/utils.js +89 -0
- package/es/components/pisellText/components/Amount/index.js +1 -1
- package/es/components/profileMenu/index.d.ts +26 -0
- package/es/components/profileMenu/index.js +115 -0
- package/es/components/profileMenu/index.less +135 -0
- package/es/components/select/index.js +3 -2
- package/es/components/table/Header/index.js +8 -11
- package/es/index.d.ts +6 -0
- package/es/index.js +7 -1
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/en-US.js +1 -0
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +1 -0
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/locales/zh-TW.js +1 -0
- package/lib/components/config-provider/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +22 -4
- package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
- package/lib/components/dataSourceComponents/dataSourceForm/index.js +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +17 -3
- package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +16 -6
- package/lib/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/serve.js +9 -5
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +19 -9
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +51 -5
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +14 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +46 -3
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/index.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +15 -1
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +6 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +17 -2
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
- package/lib/components/dataSourceComponents/fields/Select/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
- package/lib/components/dataSourceComponents/fields/Upload/serve.js +20 -12
- package/lib/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
- package/lib/components/dataSourceComponents/hooks/useActions.js +25 -7
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +48 -7
- package/lib/components/login-and-register/index.d.ts +82 -0
- package/lib/components/login-and-register/index.js +261 -0
- package/lib/components/login-and-register/index.less +211 -0
- package/lib/components/organizationTenantSwitcher/defaultLogo.png +0 -0
- package/lib/components/organizationTenantSwitcher/index.d.ts +17 -0
- package/lib/components/organizationTenantSwitcher/index.js +119 -0
- package/lib/components/organizationTenantSwitcher/index.less +88 -0
- package/lib/components/page/index.js +6 -6
- package/lib/components/page-header/index.d.ts +14 -0
- package/lib/components/page-header/index.js +63 -0
- package/lib/components/page-header/index.less +45 -0
- package/lib/components/pisellAvatar/index.d.ts +19 -0
- package/lib/components/pisellAvatar/index.js +108 -0
- package/lib/components/pisellAvatar/index.less +26 -0
- package/lib/components/pisellModal/components/PcModal/index.js +1 -1
- package/lib/components/pisellTags/index.d.ts +13 -0
- package/lib/components/pisellTags/index.js +113 -0
- package/lib/components/pisellTags/index.less +17 -0
- package/lib/components/pisellTags/utils.d.ts +1 -0
- package/lib/components/pisellTags/utils.js +86 -0
- package/lib/components/pisellText/components/Amount/index.js +2 -2
- package/lib/components/profileMenu/index.d.ts +26 -0
- package/lib/components/profileMenu/index.js +113 -0
- package/lib/components/profileMenu/index.less +135 -0
- package/lib/components/select/index.js +2 -1
- package/lib/components/table/Header/index.js +11 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.js +18 -0
- package/lib/locales/en-US.d.ts +1 -0
- package/lib/locales/en-US.js +1 -0
- package/lib/locales/zh-CN.d.ts +1 -0
- package/lib/locales/zh-CN.js +1 -0
- package/lib/locales/zh-TW.d.ts +1 -0
- package/lib/locales/zh-TW.js +1 -0
- package/lowcode/_utils/defaultSchema.ts +64 -0
- package/lowcode/data-source-form/meta.ts +130 -0
- package/lowcode/data-source-form/utils.ts +33 -3
- package/lowcode/data-source-table/meta.ts +420 -3
- package/lowcode/data-source-table/utils.tsx +6 -0
- package/lowcode/form-item-date-picker/snippets.ts +3 -0
- package/lowcode/form-item-input/snippets.ts +3 -1
- package/lowcode/form-item-input-number/snippets.ts +4 -0
- package/lowcode/form-item-input.email/snippets.ts +3 -0
- package/lowcode/form-item-input.json/snippets.ts +4 -1
- package/lowcode/form-item-input.password/snippets.ts +3 -0
- package/lowcode/form-item-input.phone/snippets.ts +3 -0
- package/lowcode/form-item-input.text-area/snippets.ts +3 -1
- package/lowcode/form-item-input.url/snippets.ts +3 -0
- package/lowcode/form-item-select/meta.ts +2 -1
- package/lowcode/form-item-select/snippets.ts +6 -0
- package/lowcode/form-item-time-picker/snippets.ts +3 -0
- package/lowcode/form-item-translation/snippets.ts +3 -1
- package/lowcode/login-and-register/meta.ts +541 -0
- package/lowcode/login-and-register/snippets.ts +38 -0
- package/lowcode/organization-tenant-switch/meta.ts +127 -0
- package/lowcode/page-header/meta.ts +68 -124
- package/lowcode/page-header/snippets.ts +1 -1
- package/lowcode/pisell-avatar/__screenshots__/avatar-1.jpg +0 -0
- package/lowcode/pisell-avatar/meta.ts +111 -0
- package/lowcode/pisell-avatar/snippets.ts +14 -0
- package/lowcode/pisell-tags/__screenshots__/tag-1.png +0 -0
- package/lowcode/pisell-tags/meta.ts +123 -0
- package/lowcode/pisell-tags/snippets.ts +14 -0
- package/lowcode/profile-menu/meta.ts +175 -0
- package/lowcode/profile-menu/snippets.ts +71 -0
- package/lowcode/submit-button/meta.ts +6 -0
- package/package.json +3 -3
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// 定义 RGB 类型,包括 r, g, b 和可选的 a(透明度)分量
|
|
2
|
+
|
|
3
|
+
// 辅助函数:将 16 进制颜色转换为 RGB
|
|
4
|
+
var hexToRgb = function hexToRgb(hex) {
|
|
5
|
+
hex = hex.replace(/^#/, ''); // 去掉开头的 #
|
|
6
|
+
if (hex.length === 3) {
|
|
7
|
+
// 处理三位颜色码,扩展为六位颜色码
|
|
8
|
+
hex = hex.split('').map(function (h) {
|
|
9
|
+
return h + h;
|
|
10
|
+
}).join('');
|
|
11
|
+
}
|
|
12
|
+
var intVal = parseInt(hex, 16); // 将 16 进制转换为整数
|
|
13
|
+
return {
|
|
14
|
+
r: intVal >> 16 & 255,
|
|
15
|
+
// 提取红色分量
|
|
16
|
+
g: intVal >> 8 & 255,
|
|
17
|
+
// 提取绿色分量
|
|
18
|
+
b: intVal & 255 // 提取蓝色分量
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// 辅助函数:将 RGB 转换为 16 进制颜色
|
|
23
|
+
var rgbToHex = function rgbToHex(r, g, b) {
|
|
24
|
+
return '#' + [r, g, b].map(function (x) {
|
|
25
|
+
var hex = x.toString(16); // 将数值转换为 16 进制字符串
|
|
26
|
+
return hex.length === 1 ? '0' + hex : hex; // 确保每个分量都是两位
|
|
27
|
+
}).join(''); // 将 RGB 分量组合为 16 进制颜色码
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// 辅助函数:解析输入的颜色字符串,并返回 RGB 或 RGBA 对象
|
|
31
|
+
var parseColor = function parseColor(color) {
|
|
32
|
+
if (color.startsWith('#')) {
|
|
33
|
+
return hexToRgb(color); // 处理 16 进制颜色
|
|
34
|
+
} else if (color.startsWith('rgb')) {
|
|
35
|
+
// 处理 RGB 或 RGBA 颜色
|
|
36
|
+
var rgba = color.replace(/rgba?\(|\s+|\)/g, '').split(',').map(Number);
|
|
37
|
+
return {
|
|
38
|
+
r: rgba[0],
|
|
39
|
+
g: rgba[1],
|
|
40
|
+
b: rgba[2],
|
|
41
|
+
a: rgba[3] !== undefined ? rgba[3] : 1
|
|
42
|
+
};
|
|
43
|
+
} else {
|
|
44
|
+
throw new Error('无效的颜色格式');
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// 生成颜色阶梯的函数
|
|
49
|
+
export var generateColorShades = function generateColorShades(color) {
|
|
50
|
+
var _parseColor = parseColor(color),
|
|
51
|
+
r = _parseColor.r,
|
|
52
|
+
g = _parseColor.g,
|
|
53
|
+
b = _parseColor.b,
|
|
54
|
+
a = _parseColor.a;
|
|
55
|
+
var max = 700;
|
|
56
|
+
var gap = 1 / max;
|
|
57
|
+
|
|
58
|
+
// 定义相对于 700 阶梯的 50, 200, 500 阶梯的比例
|
|
59
|
+
var ratios = {
|
|
60
|
+
50: gap * 50,
|
|
61
|
+
200: gap * 200,
|
|
62
|
+
500: gap * 500,
|
|
63
|
+
600: gap * 600,
|
|
64
|
+
700: gap * 700
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// 调整颜色分量的函数,基于比例计算新的分量值
|
|
68
|
+
var adjustColorComponent = function adjustColorComponent(component, ratio) {
|
|
69
|
+
return Math.round(component * ratio + 255 * (1 - ratio));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// 生成不同阶梯的颜色
|
|
73
|
+
var shades = {
|
|
74
|
+
'color_50': rgbToHex(adjustColorComponent(r, ratios[50]), adjustColorComponent(g, ratios[50]), adjustColorComponent(b, ratios[50])),
|
|
75
|
+
'color_200': rgbToHex(adjustColorComponent(r, ratios[200]), adjustColorComponent(g, ratios[200]), adjustColorComponent(b, ratios[200])),
|
|
76
|
+
'color_500': rgbToHex(adjustColorComponent(r, ratios[500]), adjustColorComponent(g, ratios[500]), adjustColorComponent(b, ratios[500])),
|
|
77
|
+
'color_600': rgbToHex(adjustColorComponent(r, ratios[600]), adjustColorComponent(g, ratios[600]), adjustColorComponent(b, ratios[600])),
|
|
78
|
+
'color_700': color
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// 如果原始颜色带有透明度 (RGBA),在返回结果中包含透明度信息
|
|
82
|
+
if (a !== undefined) {
|
|
83
|
+
shades['color_50'] = "rgba(".concat(adjustColorComponent(r, ratios[50]), ", ").concat(adjustColorComponent(g, ratios[50]), ", ").concat(adjustColorComponent(b, ratios[50]), ", ").concat(a, ")");
|
|
84
|
+
shades['color_200'] = "rgba(".concat(adjustColorComponent(r, ratios[200]), ", ").concat(adjustColorComponent(g, ratios[200]), ", ").concat(adjustColorComponent(b, ratios[200]), ", ").concat(a, ")");
|
|
85
|
+
shades['color_500'] = "rgba(".concat(adjustColorComponent(r, ratios[500]), ", ").concat(adjustColorComponent(g, ratios[500]), ", ").concat(adjustColorComponent(b, ratios[500]), ", ").concat(a, ")");
|
|
86
|
+
shades['color_600'] = "rgba(".concat(adjustColorComponent(r, ratios[600]), ", ").concat(adjustColorComponent(g, ratios[600]), ", ").concat(adjustColorComponent(b, ratios[600]), ", ").concat(a, ")");
|
|
87
|
+
}
|
|
88
|
+
return shades;
|
|
89
|
+
};
|
|
@@ -2,7 +2,7 @@ var _excluded = ["value", "precision", "showCurrencySymbol", "useThousandsSepara
|
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
|
-
import { formatAmountWithOptions } from '@pisell/utils
|
|
5
|
+
import { formatAmountWithOptions } from '@pisell/utils';
|
|
6
6
|
import usePisellConfig from "../../../pisell-config-provider/hooks/usePisellConfig";
|
|
7
7
|
var Amount = function Amount(props) {
|
|
8
8
|
var value = props.value,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MenuProps } from 'antd';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface AvatarConfig {
|
|
5
|
+
src?: string;
|
|
6
|
+
alt?: string;
|
|
7
|
+
}
|
|
8
|
+
interface ProfileMenuProps {
|
|
9
|
+
menuIcon?: React.ReactNode;
|
|
10
|
+
userName?: string;
|
|
11
|
+
email?: string;
|
|
12
|
+
isShowUserName?: boolean;
|
|
13
|
+
isShowEmail?: boolean;
|
|
14
|
+
isShowUserInfo?: boolean;
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
avatar?: AvatarConfig;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
menuItems?: MenuProps['items'];
|
|
20
|
+
placement?: 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight';
|
|
21
|
+
trigger?: ('click' | 'hover')[];
|
|
22
|
+
showBadge?: boolean;
|
|
23
|
+
badgeCount?: number;
|
|
24
|
+
}
|
|
25
|
+
declare const ProfileMenu: React.FC<ProfileMenuProps>;
|
|
26
|
+
export default ProfileMenu;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
import React, { useEffect, useMemo } from 'react';
|
|
14
|
+
import { Dropdown, Badge } from 'antd';
|
|
15
|
+
import { UserOutlined } from "@ant-design/icons";
|
|
16
|
+
import classNames from 'classnames';
|
|
17
|
+
import PisellAvatar from "../pisellAvatar";
|
|
18
|
+
import "./index.less";
|
|
19
|
+
var ProfileMenu = function ProfileMenu(_ref) {
|
|
20
|
+
var menuIcon = _ref.menuIcon,
|
|
21
|
+
_ref$userName = _ref.userName,
|
|
22
|
+
userName = _ref$userName === void 0 ? '' : _ref$userName,
|
|
23
|
+
_ref$email = _ref.email,
|
|
24
|
+
email = _ref$email === void 0 ? '' : _ref$email,
|
|
25
|
+
_ref$isShowUserName = _ref.isShowUserName,
|
|
26
|
+
isShowUserName = _ref$isShowUserName === void 0 ? true : _ref$isShowUserName,
|
|
27
|
+
_ref$isShowEmail = _ref.isShowEmail,
|
|
28
|
+
isShowEmail = _ref$isShowEmail === void 0 ? true : _ref$isShowEmail,
|
|
29
|
+
_ref$isShowUserInfo = _ref.isShowUserInfo,
|
|
30
|
+
isShowUserInfo = _ref$isShowUserInfo === void 0 ? false : _ref$isShowUserInfo,
|
|
31
|
+
onClick = _ref.onClick,
|
|
32
|
+
avatar = _ref.avatar,
|
|
33
|
+
className = _ref.className,
|
|
34
|
+
style = _ref.style,
|
|
35
|
+
_ref$menuItems = _ref.menuItems,
|
|
36
|
+
menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
|
|
37
|
+
_ref$placement = _ref.placement,
|
|
38
|
+
placement = _ref$placement === void 0 ? 'bottomRight' : _ref$placement,
|
|
39
|
+
_ref$trigger = _ref.trigger,
|
|
40
|
+
trigger = _ref$trigger === void 0 ? ['click'] : _ref$trigger,
|
|
41
|
+
_ref$showBadge = _ref.showBadge,
|
|
42
|
+
showBadge = _ref$showBadge === void 0 ? false : _ref$showBadge,
|
|
43
|
+
_ref$badgeCount = _ref.badgeCount,
|
|
44
|
+
badgeCount = _ref$badgeCount === void 0 ? 1 : _ref$badgeCount;
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
document.body.id = 'body';
|
|
47
|
+
}, []);
|
|
48
|
+
var handleClick = function handleClick(e) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
51
|
+
};
|
|
52
|
+
var renderAvatar = function renderAvatar(avatarProps) {
|
|
53
|
+
return /*#__PURE__*/React.createElement(PisellAvatar, {
|
|
54
|
+
style: {
|
|
55
|
+
margin: '0 6px'
|
|
56
|
+
},
|
|
57
|
+
size: "md",
|
|
58
|
+
src: (avatarProps === null || avatarProps === void 0 ? void 0 : avatarProps.src) || '',
|
|
59
|
+
alt: (avatarProps === null || avatarProps === void 0 ? void 0 : avatarProps.alt) || '',
|
|
60
|
+
icon: /*#__PURE__*/React.createElement(UserOutlined, {
|
|
61
|
+
style: {
|
|
62
|
+
fontSize: 24,
|
|
63
|
+
color: '#475467'
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
var finalMenuItems = useMemo(function () {
|
|
69
|
+
if (!isShowUserInfo) return menuItems;
|
|
70
|
+
var userInfoItem = {
|
|
71
|
+
key: 'user-info',
|
|
72
|
+
label: /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "profile-menu-user-info-item"
|
|
74
|
+
}, renderAvatar(avatar), /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: "profile-menu-user-info"
|
|
76
|
+
}, userName && /*#__PURE__*/React.createElement("p", {
|
|
77
|
+
className: "profile-menu-user-info-name"
|
|
78
|
+
}, userName), email && /*#__PURE__*/React.createElement("p", {
|
|
79
|
+
className: "profile-menu-user-info-email"
|
|
80
|
+
}, email)))
|
|
81
|
+
};
|
|
82
|
+
return [userInfoItem, {
|
|
83
|
+
type: 'divider'
|
|
84
|
+
}].concat(_toConsumableArray(menuItems || []));
|
|
85
|
+
}, [isShowUserInfo, menuItems, userName, email, avatar]);
|
|
86
|
+
var showUserInfo = isShowUserName && userName || isShowEmail && email;
|
|
87
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
88
|
+
menu: {
|
|
89
|
+
items: finalMenuItems
|
|
90
|
+
},
|
|
91
|
+
placement: placement,
|
|
92
|
+
trigger: trigger,
|
|
93
|
+
overlayClassName: "profile-menu-dropdown"
|
|
94
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
className: classNames('profile-menu-wrap', className),
|
|
96
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
97
|
+
paddingRight: showUserInfo ? 16 : 0
|
|
98
|
+
}),
|
|
99
|
+
onClick: handleClick
|
|
100
|
+
}, menuIcon && /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "profile-menu-icon"
|
|
102
|
+
}, menuIcon), /*#__PURE__*/React.createElement(Badge, {
|
|
103
|
+
count: showBadge ? badgeCount : 0,
|
|
104
|
+
offset: [-6, 6]
|
|
105
|
+
}, renderAvatar(avatar)), showUserInfo && /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: "profile-menu-user-info"
|
|
107
|
+
}, isShowUserName && userName && /*#__PURE__*/React.createElement("p", {
|
|
108
|
+
className: "profile-menu-user-info-name",
|
|
109
|
+
title: userName
|
|
110
|
+
}, userName), isShowEmail && email && /*#__PURE__*/React.createElement("p", {
|
|
111
|
+
className: "profile-menu-user-info-email",
|
|
112
|
+
title: email
|
|
113
|
+
}, email))));
|
|
114
|
+
};
|
|
115
|
+
export default ProfileMenu;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
.profile-menu-wrap {
|
|
2
|
+
display: flex;
|
|
3
|
+
max-width: 250px;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
width: fit-content;
|
|
7
|
+
align-items: center;
|
|
8
|
+
padding-top: 6px;
|
|
9
|
+
padding-bottom: 6px;
|
|
10
|
+
padding-left: 16px;
|
|
11
|
+
|
|
12
|
+
border-radius: 50px;
|
|
13
|
+
border: 1px solid var(--Gray-100, #f2f4f7);
|
|
14
|
+
background: var(--Base-White, #fff);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
transition: all 0.3s ease;
|
|
17
|
+
|
|
18
|
+
/* Shadow/sm */
|
|
19
|
+
// box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.1),
|
|
20
|
+
// 0px 1px 2px 0px rgba(16, 24, 40, 0.06);
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
border-color: var(--Gray-200, #e5e7eb);
|
|
24
|
+
box-shadow: 0px 2px 4px 0px rgba(16, 24, 40, 0.15);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.profile-menu-icon {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.profile-menu-user-info{
|
|
33
|
+
flex: 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
.profile-menu-user-info {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
min-width: 0;
|
|
43
|
+
padding: 0;
|
|
44
|
+
|
|
45
|
+
&-item {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: 12px;
|
|
49
|
+
width: 100%;
|
|
50
|
+
flex-wrap: nowrap;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&-name {
|
|
54
|
+
color: var(--Gray-700, #344054);
|
|
55
|
+
font-family: Inter;
|
|
56
|
+
font-size: 14px;
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
line-height: 20px;
|
|
59
|
+
margin: 0;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
text-overflow: ellipsis;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&-email {
|
|
66
|
+
color: var(--Gray-600, #475467);
|
|
67
|
+
font-family: Inter;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
font-weight: 400;
|
|
70
|
+
line-height: 20px;
|
|
71
|
+
margin: 0;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.profile-menu-dropdown {
|
|
79
|
+
.ant-dropdown-menu {
|
|
80
|
+
min-width: fit-content;
|
|
81
|
+
max-width: 250px;
|
|
82
|
+
padding: 8px;
|
|
83
|
+
border-radius: 8px;
|
|
84
|
+
border: 1px solid var(--Gray-100, #f2f4f7);
|
|
85
|
+
background: var(--Base-White, #fff);
|
|
86
|
+
box-shadow: 0px 4px 6px -2px rgba(16, 24, 40, 0.03),
|
|
87
|
+
0px 12px 16px -4px rgba(16, 24, 40, 0.08);
|
|
88
|
+
|
|
89
|
+
.ant-dropdown-menu-item {
|
|
90
|
+
padding: 8px 12px;
|
|
91
|
+
border-radius: 6px;
|
|
92
|
+
min-height: 40px;
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
|
|
96
|
+
&:hover {
|
|
97
|
+
background: var(--Gray-50, #f9fafb);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&:active {
|
|
101
|
+
background: var(--Gray-100, #f2f4f7);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.profile-menu-user-info-item {
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: 12px;
|
|
108
|
+
width: 100%;
|
|
109
|
+
flex-wrap: nowrap;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
|
|
112
|
+
.profile-menu-user-info {
|
|
113
|
+
flex: 1;
|
|
114
|
+
min-width: 0;
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
|
|
117
|
+
&-name,
|
|
118
|
+
&-email {
|
|
119
|
+
width: 100%;
|
|
120
|
+
padding-right: 8px;
|
|
121
|
+
margin: 0;
|
|
122
|
+
white-space: nowrap;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.ant-dropdown-menu-item-divider {
|
|
131
|
+
margin: 8px 0;
|
|
132
|
+
background-color: var(--Gray-100, #f2f4f7);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -73,10 +73,11 @@ var SelectBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
73
73
|
return mode === 'multiple' && isShowDropdown && selectAll;
|
|
74
74
|
}, [mode, selectAll, isShowDropdown]);
|
|
75
75
|
var checkboxChecked = useMemo(function () {
|
|
76
|
+
var _state$sort, _filteredOptions$map, _filteredOptions$map$;
|
|
76
77
|
if (mode !== 'multiple') return false;
|
|
77
|
-
return (state === null || state === void 0 ? void 0 : state.length) === (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) && state.sort().join('') === filteredOptions.map(function (item) {
|
|
78
|
+
return (state === null || state === void 0 ? void 0 : state.length) === (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) && (state === null || state === void 0 ? void 0 : (_state$sort = state.sort()) === null || _state$sort === void 0 ? void 0 : _state$sort.join('')) === (filteredOptions === null || filteredOptions === void 0 ? void 0 : (_filteredOptions$map = filteredOptions.map(function (item) {
|
|
78
79
|
return item.value;
|
|
79
|
-
}).sort()
|
|
80
|
+
})) === null || _filteredOptions$map === void 0 ? void 0 : (_filteredOptions$map$ = _filteredOptions$map.sort()) === null || _filteredOptions$map$ === void 0 ? void 0 : _filteredOptions$map$.join(''));
|
|
80
81
|
}, [state, filteredOptions]);
|
|
81
82
|
var dropdownRender = useCallback(propsDropdownRender ? propsDropdownRender : function (originNode) {
|
|
82
83
|
return /*#__PURE__*/React.createElement(React.Fragment, null, showSearch && /*#__PURE__*/React.createElement(Input, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { isFunction } from '@pisell/utils';
|
|
3
|
+
import PageHeader from "../../page-header";
|
|
3
4
|
import Buttons from "./Buttons";
|
|
4
5
|
import "./index.less";
|
|
5
6
|
var Header = function Header(_ref) {
|
|
@@ -31,16 +32,12 @@ var Header = function Header(_ref) {
|
|
|
31
32
|
}
|
|
32
33
|
return subTitle;
|
|
33
34
|
}, [subTitle]);
|
|
34
|
-
return showHeader ? /*#__PURE__*/React.createElement(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
className: 'right-wrap'
|
|
42
|
-
}, buttonsNode)), showSubTitle && subTitleNode && /*#__PURE__*/React.createElement("div", {
|
|
43
|
-
className: 'materials-grid-sub-title'
|
|
44
|
-
}, subTitleNode)) : null;
|
|
35
|
+
return showHeader ? /*#__PURE__*/React.createElement(PageHeader, {
|
|
36
|
+
title: titleNode,
|
|
37
|
+
showTitle: showTitle,
|
|
38
|
+
subTitle: subTitleNode,
|
|
39
|
+
showSubTitle: showSubTitle,
|
|
40
|
+
extra: buttonsNode
|
|
41
|
+
}) : null;
|
|
45
42
|
};
|
|
46
43
|
export default Header;
|
package/es/index.d.ts
CHANGED
|
@@ -98,6 +98,8 @@ export { default as PisellToast } from './components/pisellToast';
|
|
|
98
98
|
export { default as PisellWalletPassCard } from './components/pisellWalletPassCard';
|
|
99
99
|
export { default as PisellScan } from './components/pisellScan';
|
|
100
100
|
export { default as PisellAlert } from './components/pisellAlert';
|
|
101
|
+
export { default as PisellAvatar } from './components/pisellAvatar';
|
|
102
|
+
export { default as ProfileMenu } from './components/profileMenu';
|
|
101
103
|
export { default as PisellCard } from './components/pisellCard';
|
|
102
104
|
export { default as PisellInformationEntry } from './components/pisellInformationEntry';
|
|
103
105
|
export { default as usePisellConfig } from './components/pisell-config-provider/hooks/usePisellConfig';
|
|
@@ -129,3 +131,7 @@ export { default as DataSourceWrapper } from './components/dataSourceComponents/
|
|
|
129
131
|
export { default as DataSourceTypography } from './components/dataSourceComponents/dataSourceShow/dataSourceTypography';
|
|
130
132
|
export { default as DataSourceImage } from './components/dataSourceComponents/dataSourceShow/dataSourceImage';
|
|
131
133
|
export { default as DataSourceQRCode } from './components/dataSourceComponents/dataSourceShow/dataSourceQRCode';
|
|
134
|
+
export { default as PageHeader } from './components/page-header';
|
|
135
|
+
export { default as OrganizationTenantSwitcher } from './components/organizationTenantSwitcher';
|
|
136
|
+
export { default as PisellTags } from './components/pisellTags';
|
|
137
|
+
export { default as loginAndRegister } from './components/login-and-register';
|
package/es/index.js
CHANGED
|
@@ -122,6 +122,8 @@ export { default as PisellToast } from "./components/pisellToast";
|
|
|
122
122
|
export { default as PisellWalletPassCard } from "./components/pisellWalletPassCard";
|
|
123
123
|
export { default as PisellScan } from "./components/pisellScan";
|
|
124
124
|
export { default as PisellAlert } from "./components/pisellAlert";
|
|
125
|
+
export { default as PisellAvatar } from "./components/pisellAvatar";
|
|
126
|
+
export { default as ProfileMenu } from "./components/profileMenu";
|
|
125
127
|
export { default as PisellCard } from "./components/pisellCard";
|
|
126
128
|
export { default as PisellInformationEntry } from "./components/pisellInformationEntry";
|
|
127
129
|
export { default as usePisellConfig } from "./components/pisell-config-provider/hooks/usePisellConfig";
|
|
@@ -152,4 +154,8 @@ export { default as DataSourceTable } from "./components/dataSourceComponents/da
|
|
|
152
154
|
export { default as DataSourceWrapper } from "./components/dataSourceComponents/dataSourceWrapper";
|
|
153
155
|
export { default as DataSourceTypography } from "./components/dataSourceComponents/dataSourceShow/dataSourceTypography";
|
|
154
156
|
export { default as DataSourceImage } from "./components/dataSourceComponents/dataSourceShow/dataSourceImage";
|
|
155
|
-
export { default as DataSourceQRCode } from "./components/dataSourceComponents/dataSourceShow/dataSourceQRCode";
|
|
157
|
+
export { default as DataSourceQRCode } from "./components/dataSourceComponents/dataSourceShow/dataSourceQRCode";
|
|
158
|
+
export { default as PageHeader } from "./components/page-header";
|
|
159
|
+
export { default as OrganizationTenantSwitcher } from "./components/organizationTenantSwitcher";
|
|
160
|
+
export { default as PisellTags } from "./components/pisellTags";
|
|
161
|
+
export { default as loginAndRegister } from "./components/login-and-register";
|
package/es/locales/en-US.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ declare const _default: {
|
|
|
133
133
|
'pisell-data-source-table-delete': string;
|
|
134
134
|
'pisell-data-source-form-required-message': string;
|
|
135
135
|
'pisell-data-source-form-email-message': string;
|
|
136
|
+
'pisell-data-source-form-domain-message': string;
|
|
136
137
|
'pisell-data-source-form-url-message': string;
|
|
137
138
|
'pisell-data-source-form-phone-message': string;
|
|
138
139
|
'pisell-data-source-form-min-length-message': (minLength: number) => string;
|
package/es/locales/en-US.js
CHANGED
|
@@ -161,6 +161,7 @@ export default {
|
|
|
161
161
|
'pisell-data-source-table-delete': 'Delete',
|
|
162
162
|
'pisell-data-source-form-required-message': 'This field is required',
|
|
163
163
|
'pisell-data-source-form-email-message': 'Please enter a valid email address',
|
|
164
|
+
'pisell-data-source-form-domain-message': 'Please enter a valid domain',
|
|
164
165
|
'pisell-data-source-form-url-message': 'Please enter a valid URL',
|
|
165
166
|
'pisell-data-source-form-phone-message': 'Please enter a valid phone number',
|
|
166
167
|
'pisell-data-source-form-min-length-message': function pisellDataSourceFormMinLengthMessage(minLength) {
|
package/es/locales/zh-CN.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ declare const _default: {
|
|
|
133
133
|
'pisell-data-source-table-delete': string;
|
|
134
134
|
'pisell-data-source-form-required-message': string;
|
|
135
135
|
'pisell-data-source-form-email-message': string;
|
|
136
|
+
'pisell-data-source-form-domain-message': string;
|
|
136
137
|
'pisell-data-source-form-url-message': string;
|
|
137
138
|
'pisell-data-source-form-phone-message': string;
|
|
138
139
|
'pisell-data-source-form-min-length-message': (minLength: number) => string;
|
package/es/locales/zh-CN.js
CHANGED
|
@@ -160,6 +160,7 @@ export default {
|
|
|
160
160
|
'pisell-data-source-table-delete': '删除',
|
|
161
161
|
'pisell-data-source-form-required-message': '该字段为必填项',
|
|
162
162
|
'pisell-data-source-form-email-message': '请输入有效的电子邮件地址',
|
|
163
|
+
'pisell-data-source-form-domain-message': '请输入有效的域名',
|
|
163
164
|
'pisell-data-source-form-url-message': '请输入正确的网址',
|
|
164
165
|
'pisell-data-source-form-phone-message': '请输入有效的电话号码',
|
|
165
166
|
'pisell-data-source-form-min-length-message': function pisellDataSourceFormMinLengthMessage(minLength) {
|
package/es/locales/zh-TW.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ declare const _default: {
|
|
|
133
133
|
'pisell-data-source-table-delete': string;
|
|
134
134
|
'pisell-data-source-form-required-message': string;
|
|
135
135
|
'pisell-data-source-form-email-message': string;
|
|
136
|
+
'pisell-data-source-form-domain-message': string;
|
|
136
137
|
'pisell-data-source-form-url-message': string;
|
|
137
138
|
'pisell-data-source-form-phone-message': string;
|
|
138
139
|
'pisell-data-source-form-min-length-message': (minLength: number) => string;
|
package/es/locales/zh-TW.js
CHANGED
|
@@ -161,6 +161,7 @@ export default {
|
|
|
161
161
|
'pisell-data-source-table-delete': '刪除',
|
|
162
162
|
'pisell-data-source-form-required-message': '該字段為必填項',
|
|
163
163
|
'pisell-data-source-form-email-message': '請輸入有效的電子郵件地址',
|
|
164
|
+
'pisell-data-source-form-domain-message': '請輸入有效的域名',
|
|
164
165
|
'pisell-data-source-form-url-message': '請輸入正確的網址',
|
|
165
166
|
'pisell-data-source-form-phone-message': '請輸入有效的電話號碼',
|
|
166
167
|
'pisell-data-source-form-min-length-message': function pisellDataSourceFormMinLengthMessage(minLength) {
|
|
@@ -36,7 +36,7 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_antd = require("antd");
|
|
37
37
|
var import_dayjs = __toESM(require("dayjs"));
|
|
38
38
|
var import_zh_cn = require("dayjs/locale/zh-cn");
|
|
39
|
-
var import_zh_CN = __toESM(require("antd/locale/zh_CN"));
|
|
39
|
+
var import_zh_CN = __toESM(require("antd/es/locale/zh_CN"));
|
|
40
40
|
var ConfigProvider = (props) => {
|
|
41
41
|
const { locale, ...rest } = props;
|
|
42
42
|
let localeData = locale;
|
|
@@ -37,6 +37,7 @@ var import_classnames = __toESM(require("classnames"));
|
|
|
37
37
|
var import_useDataSource = __toESM(require("../hooks/useDataSource"));
|
|
38
38
|
var import_form = __toESM(require("../../form"));
|
|
39
39
|
var import_FormSettingProvider = __toESM(require("./provider/formSetting/FormSettingProvider"));
|
|
40
|
+
var import_page_header = __toESM(require("../../page-header"));
|
|
40
41
|
var import_index = require("./index.less");
|
|
41
42
|
var BaseForm = (0, import_react.forwardRef)(
|
|
42
43
|
(props, ref) => {
|
|
@@ -52,6 +53,10 @@ var BaseForm = (0, import_react.forwardRef)(
|
|
|
52
53
|
children,
|
|
53
54
|
currentValue,
|
|
54
55
|
className,
|
|
56
|
+
onDataSourceFinish,
|
|
57
|
+
formatSubmitValues,
|
|
58
|
+
formatInitialValues,
|
|
59
|
+
customSubmit,
|
|
55
60
|
...others
|
|
56
61
|
} = props;
|
|
57
62
|
const formRef = (0, import_react.useRef)(null);
|
|
@@ -68,17 +73,22 @@ var BaseForm = (0, import_react.forwardRef)(
|
|
|
68
73
|
if (["edit", "view"].includes(renderMode || "") && dataSource) {
|
|
69
74
|
get == null ? void 0 : get.runAsync().then((res) => {
|
|
70
75
|
var _a;
|
|
71
|
-
|
|
76
|
+
const formattedValues = formatInitialValues ? formatInitialValues(res) : res;
|
|
77
|
+
(_a = formRef.current) == null ? void 0 : _a.setFieldsValue(formattedValues);
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
|
-
}, [renderMode, dataSource]);
|
|
80
|
+
}, [renderMode, dataSource, formatInitialValues]);
|
|
75
81
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
76
82
|
import_FormSettingProvider.default,
|
|
77
83
|
{
|
|
78
84
|
renderMode,
|
|
79
85
|
groupInfoPosition,
|
|
80
86
|
currentValue,
|
|
81
|
-
size: others.size
|
|
87
|
+
size: others.size,
|
|
88
|
+
onDataSourceFinish,
|
|
89
|
+
formatSubmitValues,
|
|
90
|
+
formatInitialValues,
|
|
91
|
+
customSubmit
|
|
82
92
|
},
|
|
83
93
|
/* @__PURE__ */ import_react.default.createElement(
|
|
84
94
|
import_form.default,
|
|
@@ -88,7 +98,15 @@ var BaseForm = (0, import_react.forwardRef)(
|
|
|
88
98
|
ref: formRef,
|
|
89
99
|
preserve: true
|
|
90
100
|
},
|
|
91
|
-
|
|
101
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
102
|
+
import_page_header.default,
|
|
103
|
+
{
|
|
104
|
+
title,
|
|
105
|
+
showTitle,
|
|
106
|
+
subTitle: description,
|
|
107
|
+
showSubTitle: showDescription
|
|
108
|
+
}
|
|
109
|
+
),
|
|
92
110
|
children
|
|
93
111
|
)
|
|
94
112
|
);
|
|
@@ -45,7 +45,7 @@ var FormItem = (props) => {
|
|
|
45
45
|
const { path: prefixPath = [] } = (0, import_useJsonPrefixPath.default)();
|
|
46
46
|
const { dataSource } = (0, import_useDataSource.default)();
|
|
47
47
|
const fields = dataSource == null ? void 0 : dataSource.fields;
|
|
48
|
-
const {
|
|
48
|
+
const { renderMode: globalMode } = (0, import_useFormSetting.default)();
|
|
49
49
|
const field = fields == null ? void 0 : fields.find((item) => item.name === name);
|
|
50
50
|
const label = propsLabel || ((_a = field == null ? void 0 : field.uiSchema) == null ? void 0 : _a.title) || name;
|
|
51
51
|
const effectiveMode = propsMode || globalMode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.pisell-lowcode-data-source-form-group {
|
|
2
2
|
display: flex;
|
|
3
|
-
padding: 20px;
|
|
3
|
+
padding: 20px 20px 0;
|
|
4
4
|
border-radius: 8px;
|
|
5
5
|
border: 1px solid var(--Gray-300, #d0d5dd);
|
|
6
6
|
margin-bottom: 24px;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
.pisell-lowcode-data-source-form-group-content {
|
|
27
27
|
border: 1px solid var(--Gray-300, #d0d5dd);
|
|
28
28
|
border-radius: 8px;
|
|
29
|
-
padding: 20px;
|
|
29
|
+
padding: 20px 20px 0;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
&-info {
|
|
@@ -39,13 +39,14 @@ var import_BaseForm = __toESM(require("./BaseForm"));
|
|
|
39
39
|
var import_index = require("./index.less");
|
|
40
40
|
var DataSourceForm = (0, import_react.forwardRef)(
|
|
41
41
|
(props, ref) => {
|
|
42
|
-
const { dataSource, currentValue, __designMode } = props;
|
|
42
|
+
const { dataSource, currentValue, __designMode, extraParams } = props;
|
|
43
43
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
44
44
|
import_DataSourceProvider.default,
|
|
45
45
|
{
|
|
46
46
|
dataSource,
|
|
47
47
|
currentValue,
|
|
48
|
-
__designMode
|
|
48
|
+
__designMode,
|
|
49
|
+
extraParams
|
|
49
50
|
},
|
|
50
51
|
/* @__PURE__ */ import_react.default.createElement(import_BaseForm.default, { ...props, ref })
|
|
51
52
|
);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ModeType } from '../../type';
|
|
3
3
|
export interface FormSettingContextType {
|
|
4
|
+
onDataSourceFinish?: (values: any, result: any) => void;
|
|
4
5
|
renderMode?: ModeType;
|
|
5
6
|
groupInfoPosition?: 'top' | 'side';
|
|
6
7
|
children?: React.ReactNode;
|
|
7
8
|
currentValue?: 'server' | 'local';
|
|
8
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>;
|
|
9
13
|
}
|
|
10
14
|
export declare const FormSettingContext: import("react").Context<FormSettingContextType>;
|
|
11
15
|
export default FormSettingContext;
|