@hanwenbo/x-web-pro-components 0.0.1

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 (150) hide show
  1. package/LICENSE +21 -0
  2. package/es/blocks/index.d.ts +1 -0
  3. package/es/blocks/index.js +2 -0
  4. package/es/blocks/shared.d.ts +24 -0
  5. package/es/blocks/shared.js +77 -0
  6. package/es/components/card/index.d.ts +82 -0
  7. package/es/components/card/index.js +361 -0
  8. package/es/components/descriptions/index.d.ts +31 -0
  9. package/es/components/descriptions/index.js +434 -0
  10. package/es/components/field/index.d.ts +75 -0
  11. package/es/components/field/index.js +761 -0
  12. package/es/components/form/captcha.d.ts +19 -0
  13. package/es/components/form/captcha.js +165 -0
  14. package/es/components/form/colorPicker.d.ts +7 -0
  15. package/es/components/form/colorPicker.js +73 -0
  16. package/es/components/form/fieldControls.d.ts +43 -0
  17. package/es/components/form/fieldControls.js +282 -0
  18. package/es/components/form/index.d.ts +285 -0
  19. package/es/components/form/index.js +2268 -0
  20. package/es/components/form/loginForm.d.ts +22 -0
  21. package/es/components/form/loginForm.js +159 -0
  22. package/es/components/form/schemaForm.d.ts +30 -0
  23. package/es/components/form/schemaForm.js +644 -0
  24. package/es/components/form/stepsForm.d.ts +26 -0
  25. package/es/components/form/stepsForm.js +183 -0
  26. package/es/components/form/uploadButton.d.ts +20 -0
  27. package/es/components/form/uploadButton.js +134 -0
  28. package/es/components/form/uploadDragger.d.ts +13 -0
  29. package/es/components/form/uploadDragger.js +144 -0
  30. package/es/components/index.d.ts +9 -0
  31. package/es/components/index.js +9 -0
  32. package/es/components/layout/components/Help/index.d.ts +72 -0
  33. package/es/components/layout/components/Help/index.js +350 -0
  34. package/es/components/layout/index.d.ts +182 -0
  35. package/es/components/layout/index.js +892 -0
  36. package/es/components/list/index.d.ts +80 -0
  37. package/es/components/list/index.js +431 -0
  38. package/es/components/provider/context.d.ts +7 -0
  39. package/es/components/provider/context.js +21 -0
  40. package/es/components/provider/index.d.ts +28 -0
  41. package/es/components/provider/index.js +117 -0
  42. package/es/components/provider/intl.d.ts +38 -0
  43. package/es/components/provider/intl.js +112 -0
  44. package/es/components/provider/types.d.ts +37 -0
  45. package/es/components/provider/types.js +1 -0
  46. package/es/components/provider/useStyle/index.d.ts +28 -0
  47. package/es/components/provider/useStyle/index.js +208 -0
  48. package/es/components/skeleton/index.d.ts +61 -0
  49. package/es/components/skeleton/index.js +388 -0
  50. package/es/components/table/dragSortTable.d.ts +8 -0
  51. package/es/components/table/dragSortTable.js +229 -0
  52. package/es/components/table/editableTable.d.ts +31 -0
  53. package/es/components/table/editableTable.js +507 -0
  54. package/es/components/table/index.d.ts +52 -0
  55. package/es/components/table/index.js +1554 -0
  56. package/es/components/table/listToolBar.d.ts +48 -0
  57. package/es/components/table/listToolBar.js +194 -0
  58. package/es/components/table/search.d.ts +5 -0
  59. package/es/components/table/search.js +13 -0
  60. package/es/index.d.ts +4 -0
  61. package/es/index.js +4 -0
  62. package/es/types.d.ts +219 -0
  63. package/es/types.js +1 -0
  64. package/es/utils/attachPropertiesToComponent.d.ts +1 -0
  65. package/es/utils/attachPropertiesToComponent.js +6 -0
  66. package/es/utils/getRequestParams.d.ts +19 -0
  67. package/es/utils/getRequestParams.js +57 -0
  68. package/es/utils/getTableListColumns.d.ts +20 -0
  69. package/es/utils/getTableListColumns.js +36 -0
  70. package/es/utils/index.d.ts +4 -0
  71. package/es/utils/index.js +4 -0
  72. package/es/utils/loading.d.ts +3 -0
  73. package/es/utils/loading.js +25 -0
  74. package/es/version.d.ts +2 -0
  75. package/es/version.js +2 -0
  76. package/lib/blocks/index.d.ts +1 -0
  77. package/lib/blocks/index.js +5 -0
  78. package/lib/blocks/shared.d.ts +24 -0
  79. package/lib/blocks/shared.js +83 -0
  80. package/lib/components/card/index.d.ts +82 -0
  81. package/lib/components/card/index.js +368 -0
  82. package/lib/components/descriptions/index.d.ts +31 -0
  83. package/lib/components/descriptions/index.js +440 -0
  84. package/lib/components/field/index.d.ts +75 -0
  85. package/lib/components/field/index.js +767 -0
  86. package/lib/components/form/captcha.d.ts +19 -0
  87. package/lib/components/form/captcha.js +172 -0
  88. package/lib/components/form/colorPicker.d.ts +7 -0
  89. package/lib/components/form/colorPicker.js +79 -0
  90. package/lib/components/form/fieldControls.d.ts +43 -0
  91. package/lib/components/form/fieldControls.js +288 -0
  92. package/lib/components/form/index.d.ts +285 -0
  93. package/lib/components/form/index.js +2332 -0
  94. package/lib/components/form/loginForm.d.ts +22 -0
  95. package/lib/components/form/loginForm.js +165 -0
  96. package/lib/components/form/schemaForm.d.ts +30 -0
  97. package/lib/components/form/schemaForm.js +651 -0
  98. package/lib/components/form/stepsForm.d.ts +26 -0
  99. package/lib/components/form/stepsForm.js +189 -0
  100. package/lib/components/form/uploadButton.d.ts +20 -0
  101. package/lib/components/form/uploadButton.js +141 -0
  102. package/lib/components/form/uploadDragger.d.ts +13 -0
  103. package/lib/components/form/uploadDragger.js +151 -0
  104. package/lib/components/index.d.ts +9 -0
  105. package/lib/components/index.js +104 -0
  106. package/lib/components/layout/components/Help/index.d.ts +72 -0
  107. package/lib/components/layout/components/Help/index.js +356 -0
  108. package/lib/components/layout/index.d.ts +182 -0
  109. package/lib/components/layout/index.js +930 -0
  110. package/lib/components/list/index.d.ts +80 -0
  111. package/lib/components/list/index.js +438 -0
  112. package/lib/components/provider/context.d.ts +7 -0
  113. package/lib/components/provider/context.js +27 -0
  114. package/lib/components/provider/index.d.ts +28 -0
  115. package/lib/components/provider/index.js +174 -0
  116. package/lib/components/provider/intl.d.ts +38 -0
  117. package/lib/components/provider/intl.js +118 -0
  118. package/lib/components/provider/types.d.ts +37 -0
  119. package/lib/components/provider/types.js +5 -0
  120. package/lib/components/provider/useStyle/index.d.ts +28 -0
  121. package/lib/components/provider/useStyle/index.js +217 -0
  122. package/lib/components/skeleton/index.d.ts +61 -0
  123. package/lib/components/skeleton/index.js +394 -0
  124. package/lib/components/table/dragSortTable.d.ts +8 -0
  125. package/lib/components/table/dragSortTable.js +236 -0
  126. package/lib/components/table/editableTable.d.ts +31 -0
  127. package/lib/components/table/editableTable.js +514 -0
  128. package/lib/components/table/index.d.ts +52 -0
  129. package/lib/components/table/index.js +1699 -0
  130. package/lib/components/table/listToolBar.d.ts +48 -0
  131. package/lib/components/table/listToolBar.js +200 -0
  132. package/lib/components/table/search.d.ts +5 -0
  133. package/lib/components/table/search.js +20 -0
  134. package/lib/index.d.ts +4 -0
  135. package/lib/index.js +49 -0
  136. package/lib/types.d.ts +219 -0
  137. package/lib/types.js +5 -0
  138. package/lib/utils/attachPropertiesToComponent.d.ts +1 -0
  139. package/lib/utils/attachPropertiesToComponent.js +12 -0
  140. package/lib/utils/getRequestParams.d.ts +19 -0
  141. package/lib/utils/getRequestParams.js +63 -0
  142. package/lib/utils/getTableListColumns.d.ts +20 -0
  143. package/lib/utils/getTableListColumns.js +42 -0
  144. package/lib/utils/index.d.ts +4 -0
  145. package/lib/utils/index.js +49 -0
  146. package/lib/utils/loading.d.ts +3 -0
  147. package/lib/utils/loading.js +31 -0
  148. package/lib/version.d.ts +2 -0
  149. package/lib/version.js +8 -0
  150. package/package.json +68 -0
@@ -0,0 +1,117 @@
1
+ var _excluded = ["prefixCls", "valueTypeMap", "token", "hashed", "dark", "intl", "autoClearCache", "needDeps", "children"];
2
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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
+ 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; }
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ 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; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ import React, { useContext, useMemo } from 'react';
11
+ import { ConfigProvider } from '@hanwenbo/x-web-ui/configProvider';
12
+ import { ProProvider } from "./context";
13
+ import { zhCNIntl } from "./intl";
14
+ import { Fragment as _Fragment } from "react/jsx-runtime";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ export * from "./context";
17
+ export * from "./intl";
18
+ export * from "./types";
19
+ export * from "./useStyle";
20
+ var getNodeEnv = function getNodeEnv() {
21
+ var _process;
22
+ return (_process = globalThis.process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.NODE_ENV;
23
+ };
24
+ export var isNeedOpenHash = function isNeedOpenHash() {
25
+ var _getNodeEnv;
26
+ var env = (_getNodeEnv = getNodeEnv()) === null || _getNodeEnv === void 0 ? void 0 : _getNodeEnv.toUpperCase();
27
+ if (env === 'TEST' || env === 'DEV') {
28
+ return false;
29
+ }
30
+ return true;
31
+ };
32
+ export var useProConfig = function useProConfig() {
33
+ return useContext(ProProvider);
34
+ };
35
+ export var useIntl = function useIntl() {
36
+ return useProConfig().intl;
37
+ };
38
+ export var ConfigConsumer = ProProvider.Consumer;
39
+ export var IntlConsumer = ProProvider.Consumer;
40
+ var hashString = function hashString(input) {
41
+ var hash = 5381;
42
+ for (var index = 0; index < input.length; index += 1) {
43
+ hash = hash * 33 ^ input.charCodeAt(index);
44
+ }
45
+ return (hash >>> 0).toString(36);
46
+ };
47
+ var mergeToken = function mergeToken(parentToken, currentToken, prefixCls) {
48
+ var mergedToken = _objectSpread(_objectSpread({}, parentToken || {}), currentToken || {});
49
+ mergedToken.antCls = mergedToken.antCls || '.x-web-ui';
50
+ mergedToken.proComponentsCls = mergedToken.proComponentsCls || ".".concat(prefixCls);
51
+ mergedToken.themeId = mergedToken.themeId || 0;
52
+ return mergedToken;
53
+ };
54
+ export var ProConfigProvider = function ProConfigProvider(_ref) {
55
+ var _ref2, _ref3;
56
+ var prefixCls = _ref.prefixCls,
57
+ _ref$valueTypeMap = _ref.valueTypeMap,
58
+ valueTypeMap = _ref$valueTypeMap === void 0 ? {} : _ref$valueTypeMap,
59
+ token = _ref.token,
60
+ hashed = _ref.hashed,
61
+ dark = _ref.dark,
62
+ _ref$intl = _ref.intl,
63
+ intl = _ref$intl === void 0 ? zhCNIntl : _ref$intl,
64
+ _ref$autoClearCache = _ref.autoClearCache,
65
+ autoClearCache = _ref$autoClearCache === void 0 ? false : _ref$autoClearCache,
66
+ _ref$needDeps = _ref.needDeps,
67
+ needDeps = _ref$needDeps === void 0 ? false : _ref$needDeps,
68
+ children = _ref.children,
69
+ configProviderProps = _objectWithoutProperties(_ref, _excluded);
70
+ var parentConfig = useContext(ProProvider);
71
+ var isNeedDepsPassThrough = needDeps && parentConfig.hashId !== undefined && Object.keys({
72
+ children: children,
73
+ needDeps: needDeps
74
+ }).sort().join('-') === 'children-needDeps';
75
+ var resolvedHashed = (_ref2 = hashed !== null && hashed !== void 0 ? hashed : parentConfig.hashed) !== null && _ref2 !== void 0 ? _ref2 : isNeedOpenHash();
76
+ var mergedPrefixCls = (_ref3 = prefixCls !== null && prefixCls !== void 0 ? prefixCls : parentConfig.prefixCls) !== null && _ref3 !== void 0 ? _ref3 : 'x-web-pro';
77
+ var mergedIntl = intl || parentConfig.intl || zhCNIntl;
78
+ var mergedToken = useMemo(function () {
79
+ return mergeToken(parentConfig.token, token, mergedPrefixCls);
80
+ }, [mergedPrefixCls, parentConfig.token, token]);
81
+ var mergedCache = useMemo(function () {
82
+ if (!autoClearCache && parentConfig.cache) {
83
+ return parentConfig.cache;
84
+ }
85
+ return new Map();
86
+ }, [autoClearCache, parentConfig.cache]);
87
+ var computedHashId = useMemo(function () {
88
+ if (!resolvedHashed) {
89
+ return '';
90
+ }
91
+ return "".concat(mergedPrefixCls, "-").concat(hashString(JSON.stringify(mergedToken)));
92
+ }, [mergedPrefixCls, mergedToken, resolvedHashed]);
93
+ var contextValue = useMemo(function () {
94
+ return {
95
+ cache: mergedCache,
96
+ dark: dark !== null && dark !== void 0 ? dark : parentConfig.dark,
97
+ hashId: computedHashId,
98
+ hashed: resolvedHashed,
99
+ intl: mergedIntl,
100
+ prefixCls: mergedPrefixCls,
101
+ token: mergedToken,
102
+ valueTypeMap: _objectSpread(_objectSpread({}, parentConfig.valueTypeMap || {}), valueTypeMap)
103
+ };
104
+ }, [computedHashId, dark, mergedCache, mergedIntl, mergedPrefixCls, mergedToken, parentConfig.dark, parentConfig.valueTypeMap, resolvedHashed, valueTypeMap]);
105
+ if (isNeedDepsPassThrough) {
106
+ return /*#__PURE__*/_jsx(_Fragment, {
107
+ children: children
108
+ });
109
+ }
110
+ return /*#__PURE__*/_jsx(ConfigProvider, _objectSpread(_objectSpread({}, configProviderProps), {}, {
111
+ children: /*#__PURE__*/_jsx(ProProvider.Provider, {
112
+ value: contextValue,
113
+ children: children
114
+ })
115
+ }));
116
+ };
117
+ export default ProProvider;
@@ -0,0 +1,38 @@
1
+ import type { IntlType } from './types';
2
+ export declare const createIntl: (locale: string, messages?: Record<string, string>) => IntlType;
3
+ export declare const mnMNIntl: IntlType;
4
+ export declare const arEGIntl: IntlType;
5
+ export declare const zhCNIntl: IntlType;
6
+ export declare const enUSIntl: IntlType;
7
+ export declare const enGBIntl: IntlType;
8
+ export declare const viVNIntl: IntlType;
9
+ export declare const itITIntl: IntlType;
10
+ export declare const jaJPIntl: IntlType;
11
+ export declare const esESIntl: IntlType;
12
+ export declare const caESIntl: IntlType;
13
+ export declare const ruRUIntl: IntlType;
14
+ export declare const srRSIntl: IntlType;
15
+ export declare const msMYIntl: IntlType;
16
+ export declare const zhTWIntl: IntlType;
17
+ export declare const zhHKIntl: IntlType;
18
+ export declare const frFRIntl: IntlType;
19
+ export declare const ptBRIntl: IntlType;
20
+ export declare const koKRIntl: IntlType;
21
+ export declare const idIDIntl: IntlType;
22
+ export declare const deDEIntl: IntlType;
23
+ export declare const faIRIntl: IntlType;
24
+ export declare const trTRIntl: IntlType;
25
+ export declare const plPLIntl: IntlType;
26
+ export declare const hrHRIntl: IntlType;
27
+ export declare const thTHIntl: IntlType;
28
+ export declare const csCZIntl: IntlType;
29
+ export declare const skSKIntl: IntlType;
30
+ export declare const heILIntl: IntlType;
31
+ export declare const ukUAIntl: IntlType;
32
+ export declare const uzUZIntl: IntlType;
33
+ export declare const nlNLIntl: IntlType;
34
+ export declare const roROIntl: IntlType;
35
+ export declare const svSEIntl: IntlType;
36
+ export declare const intlMap: Record<string, IntlType>;
37
+ export declare const intlMapKeys: string[];
38
+ export declare const findIntlKeyByAntdLocaleKey: <T extends string>(localeKey?: T | undefined) => T | undefined;
@@ -0,0 +1,112 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ var createMessages = function createMessages(locale, overrides) {
8
+ return _objectSpread({
9
+ moneySymbol: locale.toLowerCase().startsWith('en') ? '$' : locale.toLowerCase().startsWith('zh') ? '¥' : '¥',
10
+ 'tableForm.search': locale.toLowerCase().startsWith('zh') ? '查询' : 'Search',
11
+ 'tableForm.reset': locale.toLowerCase().startsWith('zh') ? '重置' : 'Reset',
12
+ 'tableForm.option': locale.toLowerCase().startsWith('zh') ? '操作' : 'Actions',
13
+ 'tableForm.expand': locale.toLowerCase().startsWith('zh') ? '收起' : 'Collapse',
14
+ 'tableForm.collapsed': locale.toLowerCase().startsWith('zh') ? '展开' : 'Expand',
15
+ 'modalForm.submit': locale.toLowerCase().startsWith('zh') ? '提交' : 'Submit',
16
+ 'modalForm.cancel': locale.toLowerCase().startsWith('zh') ? '取消' : 'Cancel',
17
+ 'tableForm.empty': locale.toLowerCase().startsWith('zh') ? '暂无数据' : undefined
18
+ }, overrides);
19
+ };
20
+ var zhCNMessages = createMessages('zh-CN');
21
+ export var createIntl = function createIntl(locale) {
22
+ var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23
+ var normalizedLocale = locale.replace(/_/g, '-');
24
+ var mergedMessages = createMessages(normalizedLocale, messages);
25
+ return {
26
+ locale: normalizedLocale,
27
+ getMessage: function getMessage(id, defaultMessage) {
28
+ if (mergedMessages[id]) {
29
+ return mergedMessages[id];
30
+ }
31
+ if (normalizedLocale.toLowerCase() !== 'zh-cn' && zhCNMessages[id]) {
32
+ return zhCNMessages[id];
33
+ }
34
+ return defaultMessage || id;
35
+ }
36
+ };
37
+ };
38
+ export var mnMNIntl = createIntl('mn-MN');
39
+ export var arEGIntl = createIntl('ar-EG');
40
+ export var zhCNIntl = createIntl('zh-CN');
41
+ export var enUSIntl = createIntl('en-US');
42
+ export var enGBIntl = createIntl('en-GB');
43
+ export var viVNIntl = createIntl('vi-VN');
44
+ export var itITIntl = createIntl('it-IT');
45
+ export var jaJPIntl = createIntl('ja-JP');
46
+ export var esESIntl = createIntl('es-ES');
47
+ export var caESIntl = createIntl('ca-ES');
48
+ export var ruRUIntl = createIntl('ru-RU');
49
+ export var srRSIntl = createIntl('sr-RS');
50
+ export var msMYIntl = createIntl('ms-MY');
51
+ export var zhTWIntl = createIntl('zh-TW');
52
+ export var zhHKIntl = createIntl('zh-HK');
53
+ export var frFRIntl = createIntl('fr-FR');
54
+ export var ptBRIntl = createIntl('pt-BR');
55
+ export var koKRIntl = createIntl('ko-KR');
56
+ export var idIDIntl = createIntl('id-ID');
57
+ export var deDEIntl = createIntl('de-DE');
58
+ export var faIRIntl = createIntl('fa-IR');
59
+ export var trTRIntl = createIntl('tr-TR');
60
+ export var plPLIntl = createIntl('pl-PL');
61
+ export var hrHRIntl = createIntl('hr-HR');
62
+ export var thTHIntl = createIntl('th-TH');
63
+ export var csCZIntl = createIntl('cs-CZ');
64
+ export var skSKIntl = createIntl('sk-SK');
65
+ export var heILIntl = createIntl('he-IL');
66
+ export var ukUAIntl = createIntl('uk-UA');
67
+ export var uzUZIntl = createIntl('uz-UZ');
68
+ export var nlNLIntl = createIntl('nl-NL');
69
+ export var roROIntl = createIntl('ro-RO');
70
+ export var svSEIntl = createIntl('sv-SE');
71
+ export var intlMap = {
72
+ 'ar-EG': arEGIntl,
73
+ 'ca-ES': caESIntl,
74
+ 'cs-CZ': csCZIntl,
75
+ 'de-DE': deDEIntl,
76
+ 'en-GB': enGBIntl,
77
+ 'en-US': enUSIntl,
78
+ 'es-ES': esESIntl,
79
+ 'fa-IR': faIRIntl,
80
+ 'fr-FR': frFRIntl,
81
+ 'he-IL': heILIntl,
82
+ 'hr-HR': hrHRIntl,
83
+ 'id-ID': idIDIntl,
84
+ 'it-IT': itITIntl,
85
+ 'ja-JP': jaJPIntl,
86
+ 'ko-KR': koKRIntl,
87
+ 'mn-MN': mnMNIntl,
88
+ 'ms-MY': msMYIntl,
89
+ 'nl-NL': nlNLIntl,
90
+ 'pl-PL': plPLIntl,
91
+ 'pt-BR': ptBRIntl,
92
+ 'ro-RO': roROIntl,
93
+ 'ru-RU': ruRUIntl,
94
+ 'sk-SK': skSKIntl,
95
+ 'sr-RS': srRSIntl,
96
+ 'sv-SE': svSEIntl,
97
+ 'th-TH': thTHIntl,
98
+ 'tr-TR': trTRIntl,
99
+ 'uk-UA': ukUAIntl,
100
+ 'uz-UZ': uzUZIntl,
101
+ 'vi-VN': viVNIntl,
102
+ 'zh-CN': zhCNIntl,
103
+ 'zh-HK': zhHKIntl,
104
+ 'zh-TW': zhTWIntl
105
+ };
106
+ export var intlMapKeys = Object.keys(intlMap);
107
+ export var findIntlKeyByAntdLocaleKey = function findIntlKeyByAntdLocaleKey(localeKey) {
108
+ var localeName = (localeKey || 'zh-CN').toLowerCase().replace(/_/g, '-');
109
+ return intlMapKeys.find(function (intlKey) {
110
+ return intlKey.toLowerCase() === localeName;
111
+ });
112
+ };
@@ -0,0 +1,37 @@
1
+ import type React from 'react';
2
+ import type { ProFieldFCMode, ProRenderFieldPropsType, ProSchemaValueEnumType } from '../../types';
3
+ import type { IntlType } from './intl';
4
+ export type { ProFieldFCMode, ProRenderFieldPropsType, ProSchemaValueEnumType };
5
+ export declare type ParamsType = Record<string, any>;
6
+ export declare type DeepPartial<T> = {
7
+ [P in keyof T]?: T[P] extends Record<string, any> ? DeepPartial<T[P]> : T[P];
8
+ };
9
+ export declare type ProTokenType = Record<string, any>;
10
+ export declare type ProFieldFCRenderProps = {
11
+ label?: React.ReactNode;
12
+ light?: boolean;
13
+ mode?: ProFieldFCMode;
14
+ onChange?: (...args: any[]) => void;
15
+ placeholder?: string | string[];
16
+ readonly?: boolean;
17
+ value?: any;
18
+ };
19
+ export declare type BaseProFieldFC = {
20
+ fieldProps?: any;
21
+ label?: React.ReactNode;
22
+ light?: boolean;
23
+ mode?: ProFieldFCMode;
24
+ proFieldKey?: React.Key;
25
+ text: React.ReactNode;
26
+ valueEnum?: Record<string, ProSchemaValueEnumType | React.ReactNode> | Map<any, any>;
27
+ };
28
+ export declare type ConfigContextPropsType = {
29
+ cache?: Map<any, any>;
30
+ dark?: boolean;
31
+ hashId?: string;
32
+ hashed?: boolean;
33
+ intl: IntlType;
34
+ prefixCls: string;
35
+ token: ProTokenType;
36
+ valueTypeMap: Record<string, ProRenderFieldPropsType>;
37
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import type { ProTokenType } from '../types';
3
+ export declare const setAlpha: (baseColor: string, alpha: number) => string;
4
+ export declare const lighten: (baseColor: string, brightness: number) => string;
5
+ export declare type CSSObject = Record<string, any>;
6
+ export declare type CSSInterpolation = CSSObject | string | number | Array<CSSObject | string | number>;
7
+ export declare type GenerateStyle<ComponentToken extends object = Record<string, any>, ReturnType = CSSInterpolation> = (token: ComponentToken, ...rest: any[]) => ReturnType;
8
+ export declare type ProAliasToken = ProTokenType & {
9
+ themeId: number;
10
+ proComponentsCls: string;
11
+ antCls: string;
12
+ };
13
+ export declare const proTheme: {
14
+ useToken: () => {
15
+ hashId: string;
16
+ theme: {
17
+ id: number;
18
+ };
19
+ token: ProAliasToken;
20
+ };
21
+ };
22
+ export declare const resetComponent: (token: ProAliasToken) => CSSObject;
23
+ export declare const operationUnit: (token: ProAliasToken) => CSSObject;
24
+ export declare type UseStyleResult = {
25
+ wrapSSR: (node: React.ReactElement) => React.ReactElement;
26
+ hashId: string;
27
+ };
28
+ export declare function useStyle(componentName: string, styleFn: (token: ProAliasToken) => CSSInterpolation): UseStyleResult;
@@ -0,0 +1,208 @@
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ 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); }
9
+ 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; }
10
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ 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; }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
16
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
+ import React, { useEffect, useMemo } from 'react';
18
+ import { useProConfig } from "../context";
19
+ var clamp = function clamp(value, min, max) {
20
+ return Math.min(Math.max(value, min), max);
21
+ };
22
+ var normalizeHex = function normalizeHex(color) {
23
+ var raw = color.replace('#', '').trim();
24
+ if (raw.length === 3) {
25
+ return raw.split('').map(function (char) {
26
+ return char + char;
27
+ }).join('');
28
+ }
29
+ return raw.length === 6 ? raw : '';
30
+ };
31
+ var toRgb = function toRgb(color) {
32
+ var hex = normalizeHex(color);
33
+ if (!hex) {
34
+ return undefined;
35
+ }
36
+ return {
37
+ r: parseInt(hex.slice(0, 2), 16),
38
+ g: parseInt(hex.slice(2, 4), 16),
39
+ b: parseInt(hex.slice(4, 6), 16)
40
+ };
41
+ };
42
+ export var setAlpha = function setAlpha(baseColor, alpha) {
43
+ var rgb = toRgb(baseColor);
44
+ if (!rgb) {
45
+ return baseColor;
46
+ }
47
+ return "rgba(".concat(rgb.r, ", ").concat(rgb.g, ", ").concat(rgb.b, ", ").concat(clamp(alpha, 0, 1), ")");
48
+ };
49
+ export var lighten = function lighten(baseColor, brightness) {
50
+ var rgb = toRgb(baseColor);
51
+ if (!rgb) {
52
+ return baseColor;
53
+ }
54
+ var ratio = clamp(brightness, 0, 100) / 100;
55
+ var toHex = function toHex(value) {
56
+ return Math.round(value).toString(16).padStart(2, '0');
57
+ };
58
+ return "#".concat(toHex(rgb.r + (255 - rgb.r) * ratio)).concat(toHex(rgb.g + (255 - rgb.g) * ratio)).concat(toHex(rgb.b + (255 - rgb.b) * ratio));
59
+ };
60
+ export var proTheme = {
61
+ useToken: function useToken() {
62
+ var _useProConfig = useProConfig(),
63
+ hashId = _useProConfig.hashId,
64
+ hashed = _useProConfig.hashed,
65
+ prefixCls = _useProConfig.prefixCls,
66
+ token = _useProConfig.token;
67
+ return {
68
+ hashId: hashed ? hashId || "".concat(prefixCls, "-hash") : '',
69
+ theme: {
70
+ id: 0
71
+ },
72
+ token: _objectSpread(_objectSpread({}, token), {}, {
73
+ antCls: '.x-web-ui',
74
+ proComponentsCls: ".".concat(prefixCls),
75
+ themeId: 0
76
+ })
77
+ };
78
+ }
79
+ };
80
+ export var resetComponent = function resetComponent(token) {
81
+ return {
82
+ boxSizing: 'border-box',
83
+ color: token.colorText || 'inherit',
84
+ fontSize: token.fontSize || 14,
85
+ lineHeight: token.lineHeight || 1.5,
86
+ margin: 0,
87
+ padding: 0,
88
+ '*, *::before, *::after': {
89
+ boxSizing: 'border-box'
90
+ }
91
+ };
92
+ };
93
+ export var operationUnit = function operationUnit(token) {
94
+ return {
95
+ color: token.colorLink || token.colorPrimary || 'inherit',
96
+ cursor: 'pointer',
97
+ outline: 'none',
98
+ transition: 'color 0.2s'
99
+ };
100
+ };
101
+ var styleUsageMap = new Map();
102
+ var toKebabCase = function toKebabCase(value) {
103
+ return value.replace(/[A-Z]/g, function (match) {
104
+ return "-".concat(match.toLowerCase());
105
+ });
106
+ };
107
+ var isPlainObject = function isPlainObject(value) {
108
+ return Object.prototype.toString.call(value) === '[object Object]';
109
+ };
110
+ var serializeDeclarations = function serializeDeclarations(styles) {
111
+ return Object.entries(styles).filter(function (_ref) {
112
+ var _ref2 = _slicedToArray(_ref, 2),
113
+ value = _ref2[1];
114
+ return value !== undefined && value !== null && _typeof(value) !== 'object';
115
+ }).map(function (_ref3) {
116
+ var _ref4 = _slicedToArray(_ref3, 2),
117
+ key = _ref4[0],
118
+ value = _ref4[1];
119
+ return "".concat(toKebabCase(key), ":").concat(String(value), ";");
120
+ }).join('');
121
+ };
122
+ var serializeRules = function serializeRules(selector, styles) {
123
+ var declarations = serializeDeclarations(styles);
124
+ var nestedRules = Object.entries(styles).filter(function (_ref5) {
125
+ var _ref6 = _slicedToArray(_ref5, 2),
126
+ value = _ref6[1];
127
+ return value !== undefined && value !== null && _typeof(value) === 'object';
128
+ }).flatMap(function (_ref7) {
129
+ var _ref8 = _slicedToArray(_ref7, 2),
130
+ key = _ref8[0],
131
+ value = _ref8[1];
132
+ if (!isPlainObject(value) && !Array.isArray(value)) {
133
+ return [];
134
+ }
135
+ if (key.startsWith('@')) {
136
+ return "".concat(key, "{").concat(serializeRules(selector, value), "}");
137
+ }
138
+ var nextSelector = key.includes('&') ? key.replace(/&/g, selector) : "".concat(selector, " ").concat(key);
139
+ return serializeRules(nextSelector, value);
140
+ });
141
+ var currentRule = declarations ? "".concat(selector, "{").concat(declarations, "}") : '';
142
+ return [currentRule].concat(_toConsumableArray(nestedRules)).filter(Boolean).join('');
143
+ };
144
+ var styleToCssText = function styleToCssText(selector, style) {
145
+ if (typeof style === 'string' || typeof style === 'number') {
146
+ return "".concat(selector, "{").concat(String(style), "}");
147
+ }
148
+ if (Array.isArray(style)) {
149
+ return style.map(function (item) {
150
+ return styleToCssText(selector, item);
151
+ }).join('');
152
+ }
153
+ if (!style || !isPlainObject(style)) {
154
+ return '';
155
+ }
156
+ return serializeRules(selector, style);
157
+ };
158
+ export function useStyle(componentName, styleFn) {
159
+ var _useProConfig2 = useProConfig(),
160
+ hashId = _useProConfig2.hashId,
161
+ hashed = _useProConfig2.hashed,
162
+ token = _useProConfig2.token;
163
+ var mergedHashId = hashed ? "".concat(hashId || 'x-web-pro', "-").concat(componentName) : '';
164
+ var styleId = mergedHashId ? "x-web-pro-style-".concat(mergedHashId) : '';
165
+ var cssText = useMemo(function () {
166
+ if (!mergedHashId) {
167
+ return '';
168
+ }
169
+ return styleToCssText(".".concat(mergedHashId), styleFn(token));
170
+ }, [mergedHashId, styleFn, token]);
171
+ useEffect(function () {
172
+ if (!mergedHashId || !cssText || typeof document === 'undefined') {
173
+ return undefined;
174
+ }
175
+ var styleTag = document.getElementById(styleId);
176
+ var nextUsage = (styleUsageMap.get(styleId) || 0) + 1;
177
+ styleUsageMap.set(styleId, nextUsage);
178
+ if (!styleTag) {
179
+ styleTag = document.createElement('style');
180
+ styleTag.id = styleId;
181
+ styleTag.setAttribute('data-x-web-pro-style', mergedHashId);
182
+ document.head.appendChild(styleTag);
183
+ }
184
+ styleTag.textContent = cssText;
185
+ return function () {
186
+ var currentUsage = (styleUsageMap.get(styleId) || 1) - 1;
187
+ if (currentUsage <= 0) {
188
+ var _styleTag;
189
+ styleUsageMap.delete(styleId);
190
+ (_styleTag = styleTag) === null || _styleTag === void 0 || (_styleTag = _styleTag.parentNode) === null || _styleTag === void 0 || _styleTag.removeChild(styleTag);
191
+ return;
192
+ }
193
+ styleUsageMap.set(styleId, currentUsage);
194
+ };
195
+ }, [cssText, mergedHashId, styleId]);
196
+ return {
197
+ wrapSSR: function wrapSSR(node) {
198
+ if (!mergedHashId) {
199
+ return node;
200
+ }
201
+ var className = [node.props.className, mergedHashId].filter(Boolean).join(' ');
202
+ return /*#__PURE__*/React.cloneElement(node, {
203
+ className: className
204
+ });
205
+ },
206
+ hashId: mergedHashId
207
+ };
208
+ }
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ export interface PageHeaderSkeletonProps {
3
+ active?: boolean;
4
+ className?: string;
5
+ }
6
+ export interface ListToolbarSkeletonProps {
7
+ active?: boolean;
8
+ className?: string;
9
+ }
10
+ export interface ListSkeletonItemProps {
11
+ active?: boolean;
12
+ className?: string;
13
+ }
14
+ export interface ListSkeletonProps {
15
+ active?: boolean;
16
+ itemCount?: number;
17
+ className?: string;
18
+ }
19
+ export interface ListPageSkeletonProps extends ListSkeletonProps {
20
+ pageHeader?: false;
21
+ statistic?: number | false;
22
+ actionButton?: React.ReactNode | false;
23
+ toolbar?: false;
24
+ list?: number | false;
25
+ }
26
+ export interface TableSkeletonProps {
27
+ active?: boolean;
28
+ rowCount?: number;
29
+ columnCount?: number;
30
+ className?: string;
31
+ }
32
+ export interface DescriptionsSkeletonProps {
33
+ active?: boolean;
34
+ column?: number;
35
+ className?: string;
36
+ }
37
+ export interface DescriptionsPageSkeletonProps extends DescriptionsSkeletonProps {
38
+ pageHeader?: false;
39
+ list?: false | number;
40
+ }
41
+ export interface ProSkeletonProps extends ListPageSkeletonProps, TableSkeletonProps, DescriptionsSkeletonProps {
42
+ type?: 'list' | 'result' | 'descriptions' | 'table' | 'pageHeader';
43
+ pageHeader?: false;
44
+ toolbar?: false;
45
+ statistic?: number | false;
46
+ actionButton?: React.ReactNode | false;
47
+ list?: number | false;
48
+ }
49
+ export declare const PageHeaderSkeleton: React.FC<PageHeaderSkeletonProps>;
50
+ export declare const ListToolbarSkeleton: React.FC<ListToolbarSkeletonProps>;
51
+ export declare const ListSkeletonItem: React.FC<ListSkeletonItemProps>;
52
+ export declare const ListSkeleton: React.FC<ListSkeletonProps>;
53
+ export declare const TableItemSkeleton: React.FC<TableSkeletonProps>;
54
+ export declare const TableSkeleton: React.FC<TableSkeletonProps>;
55
+ export declare const DescriptionsSkeleton: React.FC<DescriptionsSkeletonProps>;
56
+ export declare const ProSkeleton: React.FC<ProSkeletonProps>;
57
+ export declare const ListPageSkeleton: React.FC<ProSkeletonProps>;
58
+ export declare const DescriptionsPageSkeleton: React.FC<ProSkeletonProps>;
59
+ export declare const ResultPageSkeleton: React.FC<ProSkeletonProps>;
60
+ export type { ListPageSkeletonProps as ProListPageSkeletonProps, DescriptionsPageSkeletonProps as ProDescriptionsPageSkeletonProps };
61
+ export default ProSkeleton;