@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,96 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
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; }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Dropdown } from 'antd';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import Check from '@pisell/icon/es/Check';
|
|
11
|
+
import ChevronDown from '@pisell/icon/es/ChevronDown';
|
|
12
|
+
import defaultLogo from "./defaultLogo.png";
|
|
13
|
+
import "./index.less";
|
|
14
|
+
var Logo = function Logo(_ref) {
|
|
15
|
+
var logo = _ref.logo,
|
|
16
|
+
className = _ref.className;
|
|
17
|
+
return /*#__PURE__*/React.createElement("img", {
|
|
18
|
+
src: logo || defaultLogo,
|
|
19
|
+
alt: "logo",
|
|
20
|
+
className: classNames('organization-tenant-switcher-item-logo', className)
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var OrganizationTenantSwitcher = function OrganizationTenantSwitcher(_ref2) {
|
|
24
|
+
var onChange = _ref2.onChange,
|
|
25
|
+
value = _ref2.value,
|
|
26
|
+
options = _ref2.options,
|
|
27
|
+
_ref2$showLogo = _ref2.showLogo,
|
|
28
|
+
showLogo = _ref2$showLogo === void 0 ? true : _ref2$showLogo,
|
|
29
|
+
_ref2$showName = _ref2.showName,
|
|
30
|
+
showName = _ref2$showName === void 0 ? true : _ref2$showName,
|
|
31
|
+
_ref2$readOnly = _ref2.readOnly,
|
|
32
|
+
readOnly = _ref2$readOnly === void 0 ? false : _ref2$readOnly,
|
|
33
|
+
onClick = _ref2.onClick;
|
|
34
|
+
var getCurrentOrg = function getCurrentOrg() {
|
|
35
|
+
return options.find(function (opt) {
|
|
36
|
+
return (opt === null || opt === void 0 ? void 0 : opt.value) === value;
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
var items = _toConsumableArray(options.map(function (opt) {
|
|
40
|
+
return {
|
|
41
|
+
key: opt === null || opt === void 0 ? void 0 : opt.value,
|
|
42
|
+
label: /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: "organization-tenant-switcher-item"
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Logo, {
|
|
45
|
+
logo: opt === null || opt === void 0 ? void 0 : opt.logo
|
|
46
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: "organization-tenant-switcher-item-name",
|
|
48
|
+
title: opt === null || opt === void 0 ? void 0 : opt.label
|
|
49
|
+
}, opt === null || opt === void 0 ? void 0 : opt.label), (opt === null || opt === void 0 ? void 0 : opt.value) === value && /*#__PURE__*/React.createElement(Check, {
|
|
50
|
+
className: "organization-tenant-switcher-item-check"
|
|
51
|
+
}))
|
|
52
|
+
};
|
|
53
|
+
}));
|
|
54
|
+
var handleMenuClick = function handleMenuClick(e) {
|
|
55
|
+
if (e.key !== 'create') {
|
|
56
|
+
var selectedOption = options.find(function (opt) {
|
|
57
|
+
return opt.value === e.key;
|
|
58
|
+
});
|
|
59
|
+
if (selectedOption) {
|
|
60
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectedOption.value, selectedOption);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var currentOrg = getCurrentOrg();
|
|
65
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
66
|
+
overlayClassName: "organization-tenant-switcher-overlay",
|
|
67
|
+
menu: {
|
|
68
|
+
items: items,
|
|
69
|
+
onClick: handleMenuClick,
|
|
70
|
+
selectedKeys: [value],
|
|
71
|
+
style: {
|
|
72
|
+
maxHeight: 370,
|
|
73
|
+
overflow: 'auto'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
trigger: readOnly ? [] : ['click'],
|
|
77
|
+
disabled: readOnly
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: classNames('organization-tenant-switcher-switch', {
|
|
80
|
+
'organization-tenant-switcher-switch-readonly': readOnly
|
|
81
|
+
}),
|
|
82
|
+
style: !showLogo ? {
|
|
83
|
+
paddingLeft: 16
|
|
84
|
+
} : {},
|
|
85
|
+
onClick: onClick
|
|
86
|
+
}, showLogo && /*#__PURE__*/React.createElement(Logo, {
|
|
87
|
+
logo: currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.logo,
|
|
88
|
+
className: "organization-tenant-switcher-switch-logo"
|
|
89
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "organization-tenant-switcher-switch-name",
|
|
91
|
+
title: currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.label
|
|
92
|
+
}, showName && (currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.label)), !readOnly && /*#__PURE__*/React.createElement(ChevronDown, {
|
|
93
|
+
className: "organization-tenant-switcher-switch-chevron"
|
|
94
|
+
})));
|
|
95
|
+
};
|
|
96
|
+
export default OrganizationTenantSwitcher;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.organization-tenant-switcher-switch {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
padding: 6px 16px 6px 6px;
|
|
7
|
+
height: 52px;
|
|
8
|
+
width: fit-content;
|
|
9
|
+
max-width: 220px;
|
|
10
|
+
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
border: 1px solid var(--Gray-100, #f2f4f7);
|
|
13
|
+
background: var(--Base-White, #fff);
|
|
14
|
+
transition: all 0.3s ease;
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
border-color: var(--Gray-200, #e5e7eb);
|
|
18
|
+
box-shadow: 0px 2px 4px 0px rgba(16, 24, 40, 0.15);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-readonly {
|
|
22
|
+
border: none;
|
|
23
|
+
padding-right: 16px;
|
|
24
|
+
|
|
25
|
+
&:hover {
|
|
26
|
+
border: none;
|
|
27
|
+
box-shadow: none;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.organization-tenant-switcher-overlay {
|
|
33
|
+
.pisell-lowcode-dropdown-menu-item {
|
|
34
|
+
padding: 9px 10px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.organization-tenant-switcher-switch-name {
|
|
39
|
+
flex: 1;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
text-overflow: ellipsis;
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
color: var(--Gray-700, #344054);
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
font-style: normal;
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
line-height: 20px; /* 142.857% */
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.organization-tenant-switcher-switch-logo {
|
|
51
|
+
margin-right: 6px;
|
|
52
|
+
color: #344054;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.organization-tenant-switcher-item-check {
|
|
56
|
+
font-size: 16px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.organization-tenant-switcher-item-name {
|
|
60
|
+
flex: 1;
|
|
61
|
+
color: var(--Gray-700, #344054);
|
|
62
|
+
font-size: 14px;
|
|
63
|
+
font-style: normal;
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
line-height: 20px; /* 142.857% */
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.organization-tenant-switcher-item {
|
|
72
|
+
width: 208px;
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 12px;
|
|
76
|
+
//padding: 9px 10px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.organization-tenant-switcher-item-logo {
|
|
80
|
+
width: 40px;
|
|
81
|
+
height: 40px;
|
|
82
|
+
border-radius: 6px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.organization-tenant-switcher-switch-chevron {
|
|
86
|
+
font-size: 16px;
|
|
87
|
+
color: #101828;
|
|
88
|
+
}
|
|
@@ -14,10 +14,10 @@ import { AdapterDayjs } from '@pisell/date-picker/es/AdapterDayjs';
|
|
|
14
14
|
import VariablesProvider from "../dataSourceComponents/provider/variables/VariablesProvider";
|
|
15
15
|
import { LocalizationProvider, createTheme, ThemeProvider, LocaleProvider } from '@pisell/date-picker';
|
|
16
16
|
import { App } from 'antd';
|
|
17
|
-
import enUS from 'antd/locale/en_US';
|
|
18
|
-
import zhCN from 'antd/locale/zh_CN';
|
|
19
|
-
import zhTW from 'antd/locale/zh_TW';
|
|
20
|
-
import zhHK from 'antd/locale/zh_HK';
|
|
17
|
+
import enUS from 'antd/es/locale/en_US';
|
|
18
|
+
import zhCN from 'antd/es/locale/zh_CN';
|
|
19
|
+
import zhTW from 'antd/es/locale/zh_TW';
|
|
20
|
+
import zhHK from 'antd/es/locale/zh_HK';
|
|
21
21
|
import PisellConfigProvider from "../pisell-config-provider";
|
|
22
22
|
import useEngineContext from "../../hooks/useEngineContext";
|
|
23
23
|
var localMap = {
|
|
@@ -45,7 +45,7 @@ var localeDateMap = {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
var Page = function Page(props) {
|
|
48
|
-
var _context$appHelper, _context$engine, _context$engine$props, _localeDateMap;
|
|
48
|
+
var _context$appHelper, _context$engine, _context$engine$props, _localeDateMap, _context$engine2, _context$engine2$prop;
|
|
49
49
|
var children = props.children,
|
|
50
50
|
style = props.style,
|
|
51
51
|
className = props.className,
|
|
@@ -253,7 +253,9 @@ var Page = function Page(props) {
|
|
|
253
253
|
}
|
|
254
254
|
}, /*#__PURE__*/React.createElement(PisellConfigProvider, {
|
|
255
255
|
locale: locale
|
|
256
|
-
}, /*#__PURE__*/React.createElement(VariablesProvider,
|
|
256
|
+
}, /*#__PURE__*/React.createElement(VariablesProvider, {
|
|
257
|
+
variables: ((_context$engine2 = context.engine) === null || _context$engine2 === void 0 ? void 0 : (_context$engine2$prop = _context$engine2.props) === null || _context$engine2$prop === void 0 ? void 0 : _context$engine2$prop.variables) || {}
|
|
258
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
257
259
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
258
260
|
'--theme-color': themeColor || '#7F56D9'
|
|
259
261
|
}),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
interface PageHeaderProps {
|
|
4
|
+
title?: React.ReactNode;
|
|
5
|
+
showTitle?: boolean;
|
|
6
|
+
subTitle?: React.ReactNode;
|
|
7
|
+
showSubTitle?: boolean;
|
|
8
|
+
showDivider?: boolean;
|
|
9
|
+
extra?: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
declare const PageHeader: (props: PageHeaderProps) => React.JSX.Element | null;
|
|
14
|
+
export default PageHeader;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Divider } from 'antd';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import "./index.less";
|
|
5
|
+
var PageHeader = function PageHeader(props) {
|
|
6
|
+
var title = props.title,
|
|
7
|
+
showTitle = props.showTitle,
|
|
8
|
+
subTitle = props.subTitle,
|
|
9
|
+
showSubTitle = props.showSubTitle,
|
|
10
|
+
showDivider = props.showDivider,
|
|
11
|
+
extra = props.extra,
|
|
12
|
+
className = props.className,
|
|
13
|
+
style = props.style;
|
|
14
|
+
|
|
15
|
+
// 如果没有内容需要显示,则返回 null
|
|
16
|
+
if ((!showTitle || !title) && (!showSubTitle || !subTitle) && !extra) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: classNames('pisell-lowcode-page-header-wrap', className),
|
|
21
|
+
style: style
|
|
22
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: 'pisell-lowcode-page-header'
|
|
24
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: 'pisell-lowcode-page-header-left'
|
|
26
|
+
}, showTitle && title && /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: 'pisell-lowcode-page-header-title'
|
|
28
|
+
}, title), showSubTitle && subTitle && /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: 'pisell-lowcode-page-header-sub-title'
|
|
30
|
+
}, subTitle)), /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: 'pisell-lowcode-page-header-extra'
|
|
32
|
+
}, extra)), showDivider && /*#__PURE__*/React.createElement(Divider, {
|
|
33
|
+
className: 'pisell-lowcode-page-header-divider'
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
export default PageHeader;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.pisell-lowcode-page-header-wrap {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 4px;
|
|
5
|
+
margin-bottom: 16px;
|
|
6
|
+
.pisell-lowcode-page-header {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
width: 100%;
|
|
11
|
+
|
|
12
|
+
.pisell-lowcode-page-header-left {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 4px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.pisell-lowcode-page-header-title {
|
|
19
|
+
color: var(--Colors-Neutral-Text-colorText, rgba(0, 0, 0, 0.88));
|
|
20
|
+
font-size: var(--Typography-Font-Size-fontSizeHeading4, 20px);
|
|
21
|
+
font-weight: var(--Typography-Font-Weight-fontWeightStrong, 700);
|
|
22
|
+
line-height: var(
|
|
23
|
+
--Typography-Line-Height-lineHeightHeading4,
|
|
24
|
+
28px
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pisell-lowcode-page-header-extra {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.pisell-lowcode-page-header-sub-title {
|
|
35
|
+
color: var(--Colors-Neutral-Text-colorTextSecondary, rgba(0, 0, 0, 0.65));
|
|
36
|
+
font-size: var(--Typography-Font-Size-fontSize, 14px);
|
|
37
|
+
font-style: normal;
|
|
38
|
+
font-weight: var(--Typography-Font-Weight-fontWeightNormal, 400);
|
|
39
|
+
line-height: var(--Typography-Line-Height-lineHeight, 22px);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.pisell-lowcode-page-header-divider {
|
|
43
|
+
margin: 16px 0 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AvatarProps } from 'antd';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export declare type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
5
|
+
export interface PisellAvatarProps extends Omit<AvatarProps, 'size' | 'shape'> {
|
|
6
|
+
shape?: 'circle' | 'square';
|
|
7
|
+
size?: AvatarSize;
|
|
8
|
+
src?: string;
|
|
9
|
+
alt?: string;
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
useTextAvatar?: boolean;
|
|
15
|
+
borderRadius?: number;
|
|
16
|
+
onError?: () => boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const PisellAvatar: React.FC<PisellAvatarProps>;
|
|
19
|
+
export default PisellAvatar;
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
var _excluded = ["shape", "size", "src", "alt", "icon", "children", "className", "style", "useTextAvatar", "borderRadius", "onError"];
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import React, { useMemo } from 'react';
|
|
12
|
+
import { Avatar } from 'antd';
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import Iconfont from "../iconfont";
|
|
15
|
+
import "./index.less";
|
|
16
|
+
// 尺寸映射表(单位:像素)
|
|
17
|
+
var sizeMap = {
|
|
18
|
+
xs: 24,
|
|
19
|
+
sm: 32,
|
|
20
|
+
md: 40,
|
|
21
|
+
lg: 48,
|
|
22
|
+
xl: 56,
|
|
23
|
+
xxl: 64
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// 字体大小映射表(单位:像素)
|
|
27
|
+
var fontSizeMap = {
|
|
28
|
+
xs: 12,
|
|
29
|
+
sm: 14,
|
|
30
|
+
md: 16,
|
|
31
|
+
lg: 18,
|
|
32
|
+
xl: 20,
|
|
33
|
+
xxl: 24
|
|
34
|
+
};
|
|
35
|
+
var PisellAvatar = function PisellAvatar(_ref) {
|
|
36
|
+
var _ref$shape = _ref.shape,
|
|
37
|
+
shape = _ref$shape === void 0 ? 'circle' : _ref$shape,
|
|
38
|
+
_ref$size = _ref.size,
|
|
39
|
+
size = _ref$size === void 0 ? 'xs' : _ref$size,
|
|
40
|
+
src = _ref.src,
|
|
41
|
+
alt = _ref.alt,
|
|
42
|
+
icon = _ref.icon,
|
|
43
|
+
children = _ref.children,
|
|
44
|
+
className = _ref.className,
|
|
45
|
+
style = _ref.style,
|
|
46
|
+
useTextAvatar = _ref.useTextAvatar,
|
|
47
|
+
_ref$borderRadius = _ref.borderRadius,
|
|
48
|
+
borderRadius = _ref$borderRadius === void 0 ? 4 : _ref$borderRadius,
|
|
49
|
+
onError = _ref.onError,
|
|
50
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
51
|
+
var classes = classNames('pisell-avatar', "pisell-avatar-".concat(size), "pisell-avatar-".concat(shape), {
|
|
52
|
+
'pisell-avatar-with-text': !src && !icon && children
|
|
53
|
+
}, className);
|
|
54
|
+
var mergedStyle = _objectSpread(_objectSpread({}, style), {}, {
|
|
55
|
+
width: sizeMap[size],
|
|
56
|
+
height: sizeMap[size],
|
|
57
|
+
fontSize: children || icon ? fontSizeMap[size] : undefined,
|
|
58
|
+
lineHeight: "".concat(sizeMap[size], "px"),
|
|
59
|
+
borderRadius: shape === 'square' ? "".concat(borderRadius, "px") : '50%'
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @title: 渲染头像内容
|
|
64
|
+
* @description:
|
|
65
|
+
* @param {*} useMemo
|
|
66
|
+
* @return {*}
|
|
67
|
+
* @Author: WangHan
|
|
68
|
+
* @Date: 2025-01-07 11:58
|
|
69
|
+
*/
|
|
70
|
+
var renderChildren = useMemo(function () {
|
|
71
|
+
// 使用文本头像并且有文本内容
|
|
72
|
+
if (useTextAvatar && children) {
|
|
73
|
+
return children;
|
|
74
|
+
}
|
|
75
|
+
return /*#__PURE__*/React.createElement(Iconfont, {
|
|
76
|
+
type: "pisell2-user-01"
|
|
77
|
+
});
|
|
78
|
+
}, [useTextAvatar, children]);
|
|
79
|
+
return /*#__PURE__*/React.createElement(Avatar, _extends({}, restProps, {
|
|
80
|
+
className: classes,
|
|
81
|
+
shape: shape,
|
|
82
|
+
style: mergedStyle,
|
|
83
|
+
src: src,
|
|
84
|
+
alt: alt,
|
|
85
|
+
icon: icon,
|
|
86
|
+
onError: onError
|
|
87
|
+
}), renderChildren);
|
|
88
|
+
};
|
|
89
|
+
export default PisellAvatar;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@prefix: pisell-avatar;
|
|
2
|
+
|
|
3
|
+
.@{prefix} {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
background: var(--Gray-100, #f2f4f7); // 默认背景色
|
|
8
|
+
border: 1px solid #D0D5DD; // 移除默认边框
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
|
|
11
|
+
img {
|
|
12
|
+
object-fit: cover;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.anticon {
|
|
16
|
+
font-size: inherit !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 文本头像样式
|
|
20
|
+
&.pisell-avatar-with-text {
|
|
21
|
+
background: var(--Gray-100, #f2f4f7); // 文本头像的背景色
|
|
22
|
+
color: var(--Gray-600, #475467); // 文本颜色
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
// border: 0.75px solid var(--Gray-900, #101828);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -10,7 +10,7 @@ import { Button } from 'antd';
|
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import { isBoolean, isUndefined } from '@pisell/utils';
|
|
12
12
|
import XClose from '@pisell/icon/es/XClose';
|
|
13
|
-
import Delete_wght300_24px from '@pisell/icon/
|
|
13
|
+
import Delete_wght300_24px from '@pisell/icon/es/Delete_wght300_24px';
|
|
14
14
|
import Modal from "../../../modal";
|
|
15
15
|
import { sizeMap } from "../../constants";
|
|
16
16
|
import "./index.less";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export declare type PisellTagsType = 'pill_color' | 'pill_outline';
|
|
4
|
+
export declare type PisellTagsColor = 'success' | 'warning' | 'error' | 'gray' | string;
|
|
5
|
+
export interface PisellTagsProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
others?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
|
|
8
|
+
type: PisellTagsType;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
color?: PisellTagsColor;
|
|
11
|
+
}
|
|
12
|
+
declare const PisellTags: (props: PisellTagsProps) => React.JSX.Element;
|
|
13
|
+
export default PisellTags;
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
var _excluded = ["children", "type", "icon", "color", "style", "others"];
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import React, { useMemo } from 'react';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import { generateColorShades } from "./utils";
|
|
14
|
+
import "./index.less";
|
|
15
|
+
|
|
16
|
+
// Pisell Tags 样式类型
|
|
17
|
+
|
|
18
|
+
// 预设颜色枚举
|
|
19
|
+
var pisellTagsColors = {
|
|
20
|
+
success: '#067647',
|
|
21
|
+
warning: '#B54708',
|
|
22
|
+
error: '#B42318',
|
|
23
|
+
gray: '#344054'
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @title: 获取颜色
|
|
28
|
+
* @description:
|
|
29
|
+
* @param {PisellTagsColor} _color
|
|
30
|
+
* @return {*}
|
|
31
|
+
* @Author: zhiwei.Wang
|
|
32
|
+
* @Date: 2024-08-23 16:07
|
|
33
|
+
*/
|
|
34
|
+
var getColor = function getColor(_color) {
|
|
35
|
+
if (_color) {
|
|
36
|
+
return pisellTagsColors[_color] || _color;
|
|
37
|
+
}
|
|
38
|
+
return '#344054';
|
|
39
|
+
};
|
|
40
|
+
var getPillColorStyles = function getPillColorStyles(_color) {
|
|
41
|
+
var colorShades = generateColorShades(_color);
|
|
42
|
+
return {
|
|
43
|
+
'--pisell-tags-bg-color': colorShades['color_50'],
|
|
44
|
+
'--pisell-tags-font-color': colorShades['color_700'],
|
|
45
|
+
'--pisell-tags-border-color': colorShades['color_200']
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
var getPillOutlineStyles = function getPillOutlineStyles(_color) {
|
|
49
|
+
var colorShades = generateColorShades(_color);
|
|
50
|
+
return {
|
|
51
|
+
'--pisell-tags-bg-color': 'transparent',
|
|
52
|
+
'--pisell-tags-font-color': colorShades['color_700'],
|
|
53
|
+
'--pisell-tags-border-color': colorShades['color_600']
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
var PisellTags = function PisellTags(props) {
|
|
57
|
+
var children = props.children,
|
|
58
|
+
type = props.type,
|
|
59
|
+
icon = props.icon,
|
|
60
|
+
color = props.color,
|
|
61
|
+
_props$style = props.style,
|
|
62
|
+
style = _props$style === void 0 ? {} : _props$style,
|
|
63
|
+
_props$others = props.others,
|
|
64
|
+
others = _props$others === void 0 ? {} : _props$others,
|
|
65
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
66
|
+
var styles = useMemo(function () {
|
|
67
|
+
var obj = _objectSpread(_objectSpread({}, style), others.style);
|
|
68
|
+
var _color = getColor(props.color);
|
|
69
|
+
if (type === 'pill_color') {
|
|
70
|
+
obj = _objectSpread(_objectSpread({}, obj), getPillColorStyles(_color));
|
|
71
|
+
}
|
|
72
|
+
if (type === 'pill_outline') {
|
|
73
|
+
obj = _objectSpread(_objectSpread({}, obj), getPillOutlineStyles(_color));
|
|
74
|
+
}
|
|
75
|
+
return obj;
|
|
76
|
+
}, [color, style, others.style, type]);
|
|
77
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
|
78
|
+
style: _objectSpread(_objectSpread({}, styles), style)
|
|
79
|
+
}, others, otherProps, {
|
|
80
|
+
className: classNames('pisell-tags', others.className, otherProps.className)
|
|
81
|
+
}), icon ? icon : null, children);
|
|
82
|
+
};
|
|
83
|
+
export default PisellTags;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.pisell-tags {
|
|
2
|
+
--pisell-tags-bg-color: #F9FAFB;
|
|
3
|
+
--pisell-tags-font-color: #344054;
|
|
4
|
+
--pisell-tags-border-color: #EAECF0;
|
|
5
|
+
border-radius: 16px;
|
|
6
|
+
border: 1px solid var(--pisell-tags-border-color);
|
|
7
|
+
background: var(--pisell-tags-bg-color);
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
padding: 2px 12px;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 6px;
|
|
12
|
+
|
|
13
|
+
color: var(--pisell-tags-font-color);
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
font-style: normal;
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateColorShades: (color: string) => Record<string, string>;
|