@vtx/components 4.0.0-beta.7 → 4.0.0-beta.71
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/README.md +19 -19
- package/es/index.js +3 -0
- package/es/utils/components/LabelIconTip/index.js +7 -7
- package/es/utils/conversionMomentValue/index.js +25 -25
- package/es/utils/filterSpecialCharacters.js +53 -52
- package/es/utils/genCopyable/index.js +6 -6
- package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/es/utils/hooks/useDebounceFn/index.js +4 -4
- package/es/utils/hooks/useDebounceValue/index.js +6 -6
- package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +5 -5
- package/es/utils/index.js +1 -2
- package/es/utils/isBrowser/index.js +7 -7
- package/es/utils/isUrl/index.js +4 -4
- package/es/utils/merge/index.js +4 -4
- package/es/utils/nanoid/index.js +4 -4
- package/es/utils/omitBoolean/index.js +4 -4
- package/es/utils/parseValueToMoment/index.js +4 -4
- package/es/utils/proFieldParsingText/index.js +10 -10
- package/es/utils/transformKeySubmitValue/index.js +57 -57
- package/es/utils/useEditableArray/index.js +46 -46
- package/es/utils/useEditableMap/index.js +22 -22
- package/es/utils/useMediaQuery/index.js +5 -5
- package/es/vtx-color-picker/index.js +138 -33
- package/es/vtx-color-picker/style/index.js +36 -12
- package/es/vtx-combogrid/Combogrid.js +16 -10
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-combogrid/style/index.js +4 -4
- package/es/vtx-datagrid/Store/Provide.js +109 -132
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +15 -9
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/index.js +2 -2
- package/es/vtx-datagrid/columnState.js +64 -0
- package/es/vtx-datagrid/index.js +114 -35
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +102 -20
- package/es/vtx-datagrid/style/index.less +242 -242
- package/es/vtx-date-picker/QdatePicker.js +1 -1
- package/es/vtx-date-picker/style/index.less +39 -39
- package/es/vtx-descriptions/Descriptions.js +29 -0
- package/es/vtx-descriptions/index.js +3 -0
- package/es/vtx-descriptions/style/index.js +19 -0
- package/es/vtx-ellipsis-text/index.js +7 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -33
- package/es/vtx-export-async/History.js +11 -3
- package/es/vtx-export-async/index.js +45 -15
- package/es/vtx-form-layout/Card.js +10 -10
- package/es/vtx-form-layout/Divider.js +1 -1
- package/es/vtx-form-layout/FormItem.js +18 -17
- package/es/vtx-form-layout/Pane.js +23 -12
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/Preview.js +11 -6
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +155 -43
- package/es/vtx-import/result.js +6 -2
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +31 -20
- package/es/vtx-import2/style/index.js +60 -9
- package/es/vtx-input/TextArea/index.js +11 -6
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-modal/style/index.js +5 -3
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/Content.js +1 -1
- package/es/vtx-page-layout/TabLayout.js +7 -13
- package/es/vtx-page-layout/TableLayout.js +24 -14
- package/es/vtx-page-layout/TableWrap.js +3 -2
- package/es/vtx-page-layout/TreeLayout.js +8 -14
- package/es/vtx-page-layout/container.js +8 -7
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +50 -40
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_US.js +65 -5
- package/es/vtx-provider/locale/zh_CN.js +75 -5
- package/es/vtx-provider/useStyle/index.js +25 -21
- package/es/vtx-scrollable-row/index.js +38 -28
- package/es/vtx-search/index.js +18 -13
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +132 -46
- package/es/vtx-select/style/index.js +11 -56
- package/es/vtx-signature/index.js +5 -4
- package/es/vtx-signature/style/index.js +1 -1
- package/es/vtx-split-pane/Resizer.js +0 -1
- package/es/vtx-split-pane/SplitPane.js +34 -25
- package/es/vtx-split-pane/style/index.js +8 -112
- package/es/vtx-time-picker/index.js +27 -1
- package/es/vtx-transfer/Transfer.js +29 -0
- package/es/vtx-transfer/index.js +3 -0
- package/es/vtx-transfer/style/index.js +19 -0
- package/es/vtx-transfer-select/TransferSelect.js +143 -0
- package/es/vtx-transfer-select/index.js +3 -0
- package/es/vtx-transfer-select/style/index.js +19 -0
- package/es/vtx-tree/index.js +104 -40
- package/es/vtx-tree-select/index.js +75 -105
- package/es/vtx-tree-select/style/index.js +9 -3
- package/es/vtx-upload/FilePreview.js +2 -1
- package/es/vtx-wang-editor/index.js +291 -113
- package/es/vtx-wang-editor/style/index.less +12 -12
- package/es/vtx-wang-editor/wangEditorUtil.js +59 -9
- package/lib/index.js +36 -0
- package/lib/utils/components/LabelIconTip/index.js +7 -7
- package/lib/utils/conversionMomentValue/index.js +25 -25
- package/lib/utils/filterSpecialCharacters.js +54 -52
- package/lib/utils/genCopyable/index.js +6 -6
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/lib/utils/hooks/useDebounceFn/index.js +4 -4
- package/lib/utils/hooks/useDebounceValue/index.js +6 -6
- package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/lib/utils/hooks/useLatest/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +5 -5
- package/lib/utils/index.js +0 -7
- package/lib/utils/isBrowser/index.js +7 -7
- package/lib/utils/isUrl/index.js +4 -4
- package/lib/utils/merge/index.js +4 -4
- package/lib/utils/nanoid/index.js +4 -4
- package/lib/utils/omitBoolean/index.js +4 -4
- package/lib/utils/parseValueToMoment/index.js +4 -4
- package/lib/utils/proFieldParsingText/index.js +10 -10
- package/lib/utils/transformKeySubmitValue/index.js +57 -57
- package/lib/utils/useEditableArray/index.js +46 -46
- package/lib/utils/useEditableMap/index.js +22 -22
- package/lib/utils/useMediaQuery/index.js +5 -5
- package/lib/vtx-color-picker/index.js +139 -34
- package/lib/vtx-color-picker/style/index.js +36 -12
- package/lib/vtx-combogrid/Combogrid.js +16 -10
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-combogrid/style/index.js +4 -4
- package/lib/vtx-datagrid/Store/Provide.js +116 -138
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +15 -10
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/index.js +2 -2
- package/lib/vtx-datagrid/columnState.js +73 -0
- package/lib/vtx-datagrid/index.js +115 -35
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +102 -20
- package/lib/vtx-datagrid/style/index.less +242 -242
- package/lib/vtx-date-picker/QdatePicker.js +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-descriptions/Descriptions.js +38 -0
- package/lib/vtx-descriptions/index.js +15 -0
- package/lib/vtx-descriptions/style/index.js +25 -0
- package/lib/vtx-ellipsis-text/index.js +7 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -34
- package/lib/vtx-export-async/History.js +11 -3
- package/lib/vtx-export-async/index.js +43 -13
- package/lib/vtx-form-layout/Card.js +9 -9
- package/lib/vtx-form-layout/Divider.js +1 -1
- package/lib/vtx-form-layout/FormItem.js +18 -17
- package/lib/vtx-form-layout/Pane.js +22 -11
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/Preview.js +11 -6
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +154 -42
- package/lib/vtx-import/result.js +6 -2
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +30 -19
- package/lib/vtx-import2/style/index.js +60 -9
- package/lib/vtx-input/TextArea/index.js +11 -6
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-modal/style/index.js +5 -3
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/Content.js +1 -1
- package/lib/vtx-page-layout/TabLayout.js +8 -14
- package/lib/vtx-page-layout/TableLayout.js +24 -14
- package/lib/vtx-page-layout/TableWrap.js +3 -2
- package/lib/vtx-page-layout/TreeLayout.js +9 -15
- package/lib/vtx-page-layout/container.js +8 -7
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +49 -40
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_US.js +65 -5
- package/lib/vtx-provider/locale/zh_CN.js +75 -5
- package/lib/vtx-provider/useStyle/index.js +25 -21
- package/lib/vtx-scrollable-row/index.js +38 -28
- package/lib/vtx-search/index.js +18 -13
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +134 -48
- package/lib/vtx-select/style/index.js +11 -56
- package/lib/vtx-signature/index.js +4 -3
- package/lib/vtx-signature/style/index.js +1 -1
- package/lib/vtx-split-pane/Resizer.js +0 -1
- package/lib/vtx-split-pane/SplitPane.js +32 -23
- package/lib/vtx-split-pane/style/index.js +8 -112
- package/lib/vtx-time-picker/index.js +27 -1
- package/lib/vtx-transfer/Transfer.js +38 -0
- package/lib/vtx-transfer/index.js +15 -0
- package/lib/vtx-transfer/style/index.js +25 -0
- package/lib/vtx-transfer-select/TransferSelect.js +151 -0
- package/lib/vtx-transfer-select/index.js +15 -0
- package/lib/vtx-transfer-select/style/index.js +25 -0
- package/lib/vtx-tree/index.js +102 -38
- package/lib/vtx-tree-select/index.js +75 -105
- package/lib/vtx-tree-select/style/index.js +9 -3
- package/lib/vtx-upload/FilePreview.js +2 -1
- package/lib/vtx-wang-editor/index.js +289 -113
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +59 -10
- package/package.json +238 -222
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
package/es/vtx-provider/index.js
CHANGED
|
@@ -31,6 +31,8 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
31
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
32
|
export * from "./intl";
|
|
33
33
|
export * from "./useStyle";
|
|
34
|
+
|
|
35
|
+
// 调接口前剔除无效字段,节省流量
|
|
34
36
|
var omitUndefined = function omitUndefined(obj) {
|
|
35
37
|
var newObj = {};
|
|
36
38
|
Object.keys(obj || {}).forEach(function (key) {
|
|
@@ -44,11 +46,11 @@ var omitUndefined = function omitUndefined(obj) {
|
|
|
44
46
|
return newObj;
|
|
45
47
|
};
|
|
46
48
|
|
|
47
|
-
/**
|
|
48
|
-
* 用于判断当前是否需要开启哈希(Hash)模式。
|
|
49
|
-
* 首先也会判断当前是否处于测试环境中(通过 process.env.NODE_ENV === 'TEST' 判断),
|
|
50
|
-
* 如果是,则返回 false。否则,直接返回 true 表示需要打开。
|
|
51
|
-
* @returns
|
|
49
|
+
/**
|
|
50
|
+
* 用于判断当前是否需要开启哈希(Hash)模式。
|
|
51
|
+
* 首先也会判断当前是否处于测试环境中(通过 process.env.NODE_ENV === 'TEST' 判断),
|
|
52
|
+
* 如果是,则返回 false。否则,直接返回 true 表示需要打开。
|
|
53
|
+
* @returns
|
|
52
54
|
*/
|
|
53
55
|
export var isNeedOpenHash = function isNeedOpenHash() {
|
|
54
56
|
var _process$env$NODE_ENV, _process$env$NODE_ENV2;
|
|
@@ -67,7 +69,7 @@ export var VtxConfigContext = /*#__PURE__*/React.createContext({
|
|
|
67
69
|
hashed: true,
|
|
68
70
|
dark: false,
|
|
69
71
|
token: _objectSpread(_objectSpread({}, antdTheme.getDesignToken()), {}, {
|
|
70
|
-
|
|
72
|
+
vtxComponentsCls: '.vtx',
|
|
71
73
|
antCls: '.ant',
|
|
72
74
|
themeId: 0
|
|
73
75
|
}),
|
|
@@ -83,10 +85,10 @@ export var VtxConfigContext = /*#__PURE__*/React.createContext({
|
|
|
83
85
|
});
|
|
84
86
|
var ConfigConsumer = VtxConfigContext.Consumer;
|
|
85
87
|
|
|
86
|
-
/**
|
|
87
|
-
* 组件解除挂载后清空一下 cache
|
|
88
|
-
* @date 2022-11-28
|
|
89
|
-
* @returns null
|
|
88
|
+
/**
|
|
89
|
+
* 组件解除挂载后清空一下 cache
|
|
90
|
+
* @date 2022-11-28
|
|
91
|
+
* @returns null
|
|
90
92
|
*/
|
|
91
93
|
export { ConfigConsumer };
|
|
92
94
|
var CacheClean = function CacheClean() {
|
|
@@ -100,10 +102,10 @@ var CacheClean = function CacheClean() {
|
|
|
100
102
|
return null;
|
|
101
103
|
};
|
|
102
104
|
|
|
103
|
-
/**
|
|
104
|
-
* 用于配置 Pro 的组件,分装之后会简单一些
|
|
105
|
-
* @param props
|
|
106
|
-
* @returns
|
|
105
|
+
/**
|
|
106
|
+
* 用于配置 Pro 的组件,分装之后会简单一些
|
|
107
|
+
* @param props
|
|
108
|
+
* @returns
|
|
107
109
|
*/
|
|
108
110
|
var ConfigProviderContainer = function ConfigProviderContainer(props) {
|
|
109
111
|
var _antdTheme$useToken;
|
|
@@ -122,17 +124,17 @@ var ConfigProviderContainer = function ConfigProviderContainer(props) {
|
|
|
122
124
|
var tokenContext = (_antdTheme$useToken = antdTheme.useToken) === null || _antdTheme$useToken === void 0 ? void 0 : _antdTheme$useToken.call(antdTheme);
|
|
123
125
|
var proProvide = useContext(VtxConfigContext);
|
|
124
126
|
|
|
125
|
-
/**
|
|
126
|
-
* pro 的 类
|
|
127
|
-
* @type {string}
|
|
128
|
-
* @example .ant-pro
|
|
127
|
+
/**
|
|
128
|
+
* pro 的 类
|
|
129
|
+
* @type {string}
|
|
130
|
+
* @example .ant-pro
|
|
129
131
|
*/
|
|
130
132
|
|
|
131
|
-
var
|
|
133
|
+
var vtxComponentsCls = prefixCls ? ".".concat(prefixCls) : ".vtx";
|
|
132
134
|
var antCls = '.' + getPrefixCls();
|
|
133
|
-
var salt = "".concat(
|
|
134
|
-
/**
|
|
135
|
-
* 合并一下token,不然导致嵌套 token 失效
|
|
135
|
+
var salt = "".concat(vtxComponentsCls);
|
|
136
|
+
/**
|
|
137
|
+
* 合并一下token,不然导致嵌套 token 失效
|
|
136
138
|
*/
|
|
137
139
|
var proLayoutTokenMerge = useMemo(function () {
|
|
138
140
|
return getLayoutDesignToken(propsToken || {}, tokenContext.token);
|
|
@@ -141,21 +143,22 @@ var ConfigProviderContainer = function ConfigProviderContainer(props) {
|
|
|
141
143
|
var _proProvide$intl;
|
|
142
144
|
var localeName = locale === null || locale === void 0 ? void 0 : locale.locale;
|
|
143
145
|
var key = findIntlKeyByAntdLocaleKey(localeName);
|
|
146
|
+
|
|
144
147
|
// antd 的 key 存在的时候以 antd 的为主
|
|
145
148
|
var resolvedIntl = intl !== null && intl !== void 0 ? intl : localeName && ((_proProvide$intl = proProvide.intl) === null || _proProvide$intl === void 0 ? void 0 : _proProvide$intl.locale) === 'default' ? intlMap[key] : proProvide.intl || intlMap[key];
|
|
146
149
|
return _objectSpread(_objectSpread({}, proProvide), {}, {
|
|
147
150
|
dark: dark !== null && dark !== void 0 ? dark : proProvide.dark,
|
|
148
151
|
token: merge(proProvide.token, tokenContext.token, {
|
|
149
|
-
|
|
152
|
+
vtxComponentsCls: vtxComponentsCls,
|
|
150
153
|
antCls: antCls,
|
|
151
154
|
themeId: tokenContext.theme.id,
|
|
152
155
|
layout: proLayoutTokenMerge
|
|
153
156
|
}),
|
|
154
157
|
intl: resolvedIntl || zhCNIntl
|
|
155
158
|
});
|
|
156
|
-
}, [locale === null || locale === void 0 ? void 0 : locale.locale, proProvide, dark, tokenContext.token, tokenContext.theme.id,
|
|
159
|
+
}, [locale === null || locale === void 0 ? void 0 : locale.locale, proProvide, dark, tokenContext.token, tokenContext.theme.id, antCls, proLayoutTokenMerge, intl]);
|
|
157
160
|
var finalToken = _objectSpread(_objectSpread({}, proProvideValue.token || {}), {}, {
|
|
158
|
-
|
|
161
|
+
vtxComponentsCls: vtxComponentsCls
|
|
159
162
|
});
|
|
160
163
|
var _useCacheToken = useCacheToken(tokenContext.theme, [tokenContext.token, finalToken !== null && finalToken !== void 0 ? finalToken : {}], {
|
|
161
164
|
salt: salt,
|
|
@@ -228,13 +231,13 @@ var ConfigProviderContainer = function ConfigProviderContainer(props) {
|
|
|
228
231
|
});
|
|
229
232
|
};
|
|
230
233
|
|
|
231
|
-
/**
|
|
232
|
-
* 用于配置 一些全局性的东西
|
|
233
|
-
* @param props
|
|
234
|
-
* @returns
|
|
234
|
+
/**
|
|
235
|
+
* 用于配置 一些全局性的东西
|
|
236
|
+
* @param props
|
|
237
|
+
* @returns
|
|
235
238
|
*/
|
|
236
239
|
export var VtxConfigProvider = function VtxConfigProvider(props) {
|
|
237
|
-
var _theme$components;
|
|
240
|
+
var _theme$components, _theme$components2;
|
|
238
241
|
var propsTheme = props.theme,
|
|
239
242
|
propsLocale = props.locale,
|
|
240
243
|
needDeps = props.needDeps,
|
|
@@ -261,18 +264,25 @@ export var VtxConfigProvider = function VtxConfigProvider(props) {
|
|
|
261
264
|
borderRadius: 8,
|
|
262
265
|
borderRadiusLG: 12,
|
|
263
266
|
borderRadiusSM: 4
|
|
264
|
-
}, dark ? {
|
|
267
|
+
}, dark ? {
|
|
268
|
+
colorBgLayoutTable: '#111'
|
|
269
|
+
} : _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
265
270
|
colorPrimary: '#3A6DFF',
|
|
271
|
+
colorLink: '#3A6DFF',
|
|
266
272
|
colorText: '#29343D',
|
|
267
273
|
colorTextSecondary: '#78829D',
|
|
268
274
|
colorBorder: '#DCDFE6',
|
|
269
275
|
colorTextPlaceholder: '#BFC3CB',
|
|
270
276
|
colorFillAlter: '#F5F7FA'
|
|
271
|
-
}, "colorFillAlter", '#F5F7FA'), "colorTextPlaceholder", '#BFC3CB'), "colorFillAlterSolid", '#F5F7FA'), "colorBgLayout", '#FAFAFA')), theme.token);
|
|
277
|
+
}, "colorFillAlter", '#F5F7FA'), "colorTextPlaceholder", '#BFC3CB'), "colorFillAlterSolid", '#F5F7FA'), "colorBgLayout", '#F0F2F5'), "colorBgLayoutTable", '#FAFAFA')), theme.token);
|
|
272
278
|
theme.components = _objectSpread(_objectSpread({}, theme.components), {}, {
|
|
273
279
|
Table: _objectSpread({
|
|
274
280
|
headerBorderRadius: 0
|
|
275
|
-
}, (_theme$components = theme.components) === null || _theme$components === void 0 ? void 0 : _theme$components.Table)
|
|
281
|
+
}, (_theme$components = theme.components) === null || _theme$components === void 0 ? void 0 : _theme$components.Table),
|
|
282
|
+
Modal: _objectSpread({
|
|
283
|
+
contentPadding: 0,
|
|
284
|
+
bodyPadding: 0
|
|
285
|
+
}, (_theme$components2 = theme.components) === null || _theme$components2 === void 0 ? void 0 : _theme$components2.Modal)
|
|
276
286
|
});
|
|
277
287
|
|
|
278
288
|
// 自动注入 antd 的配置
|
|
@@ -289,13 +299,13 @@ export var VtxConfigProvider = function VtxConfigProvider(props) {
|
|
|
289
299
|
}));
|
|
290
300
|
};
|
|
291
301
|
|
|
292
|
-
/**
|
|
293
|
-
* It returns the intl object from the context if it exists, otherwise it returns the intl object for
|
|
294
|
-
* 获取国际化的方法
|
|
295
|
-
* @param locale
|
|
296
|
-
* @param localeMap
|
|
297
|
-
* the current locale
|
|
298
|
-
* @returns The return value of the function is the intl object.
|
|
302
|
+
/**
|
|
303
|
+
* It returns the intl object from the context if it exists, otherwise it returns the intl object for
|
|
304
|
+
* 获取国际化的方法
|
|
305
|
+
* @param locale
|
|
306
|
+
* @param localeMap
|
|
307
|
+
* the current locale
|
|
308
|
+
* @returns The return value of the function is the intl object.
|
|
299
309
|
*/
|
|
300
310
|
export function useIntl() {
|
|
301
311
|
var _useContext3 = useContext(AntdConfigProvider.ConfigContext),
|
package/es/vtx-provider/intl.js
CHANGED
|
@@ -33,11 +33,11 @@ import zhCN from "./locale/zh_CN";
|
|
|
33
33
|
import zhHK from "./locale/zh_HK";
|
|
34
34
|
import zhTW from "./locale/zh_TW";
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* 创建一个国际化的操作函数
|
|
38
|
-
*
|
|
39
|
-
* @param locale
|
|
40
|
-
* @param localeMap
|
|
36
|
+
/**
|
|
37
|
+
* 创建一个国际化的操作函数
|
|
38
|
+
*
|
|
39
|
+
* @param locale
|
|
40
|
+
* @param localeMap
|
|
41
41
|
*/
|
|
42
42
|
export var createIntl = function createIntl(locale, localeMap) {
|
|
43
43
|
return {
|
|
@@ -125,10 +125,10 @@ var intlMap = {
|
|
|
125
125
|
};
|
|
126
126
|
var intlMapKeys = Object.keys(intlMap);
|
|
127
127
|
|
|
128
|
-
/**
|
|
129
|
-
* 根据 antd 的 key 来找到的 locale 插件的 key
|
|
130
|
-
*
|
|
131
|
-
* @param localeKey
|
|
128
|
+
/**
|
|
129
|
+
* 根据 antd 的 key 来找到的 locale 插件的 key
|
|
130
|
+
*
|
|
131
|
+
* @param localeKey
|
|
132
132
|
*/
|
|
133
133
|
export var findIntlKeyByAntdLocaleKey = function findIntlKeyByAntdLocaleKey(localeKey) {
|
|
134
134
|
var localeName = (localeKey || 'zh-CN').toLocaleLowerCase();
|
|
@@ -42,6 +42,7 @@ export default {
|
|
|
42
42
|
noFixedTitle: 'Not Fixed',
|
|
43
43
|
reset: 'Reset',
|
|
44
44
|
columnDisplay: 'Column Display',
|
|
45
|
+
columnAll: 'All',
|
|
45
46
|
columnSetting: 'Table Settings',
|
|
46
47
|
fullScreen: 'Full Screen',
|
|
47
48
|
exitFullScreen: 'Exit Full Screen',
|
|
@@ -50,7 +51,12 @@ export default {
|
|
|
50
51
|
densityDefault: 'Default',
|
|
51
52
|
densityLarger: 'Larger',
|
|
52
53
|
densityMiddle: 'Middle',
|
|
53
|
-
densitySmall: 'Compact'
|
|
54
|
+
densitySmall: 'Compact',
|
|
55
|
+
messageWarningOneText: 'Please select at least one column to save',
|
|
56
|
+
messageSuccessText: 'Operation successful',
|
|
57
|
+
striped: 'Striped',
|
|
58
|
+
border: 'Border',
|
|
59
|
+
headerBackground: 'Header Background'
|
|
54
60
|
},
|
|
55
61
|
stepsForm: {
|
|
56
62
|
next: 'Next',
|
|
@@ -119,6 +125,8 @@ export default {
|
|
|
119
125
|
operation: 'Import',
|
|
120
126
|
error: 'Upload failed',
|
|
121
127
|
success: 'Upload successful',
|
|
128
|
+
selectFile: 'Click to select file',
|
|
129
|
+
noFileSelected: "No file selected",
|
|
122
130
|
downloadTemplate: 'Download template',
|
|
123
131
|
pleaseSelectFile: 'Please select the file to upload',
|
|
124
132
|
upload: 'Upload',
|
|
@@ -142,7 +150,9 @@ export default {
|
|
|
142
150
|
delete: 'Delete',
|
|
143
151
|
add: 'Add',
|
|
144
152
|
import: 'Import',
|
|
145
|
-
export: 'Export'
|
|
153
|
+
export: 'Export',
|
|
154
|
+
queryResults: 'Query results',
|
|
155
|
+
deleteConfirm: 'Are you sure you want to delete'
|
|
146
156
|
},
|
|
147
157
|
select: {
|
|
148
158
|
selectAll: 'Select All',
|
|
@@ -174,8 +184,58 @@ export default {
|
|
|
174
184
|
download: 'Download'
|
|
175
185
|
},
|
|
176
186
|
wangEditor: {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
187
|
+
messageOverSizeText: 'Exceeds file size limit, maximum file size is',
|
|
188
|
+
messageUploadFailText: 'Upload error',
|
|
189
|
+
messageInsertImgFailText: 'Image Insertion Failed',
|
|
190
|
+
messageInsertVideoFailText: 'Video Insertion Failed',
|
|
191
|
+
messageInsertAttachmentFailText: 'Attachment Insertion Failed'
|
|
192
|
+
},
|
|
193
|
+
envPuzzle: {
|
|
194
|
+
common: {
|
|
195
|
+
startTime: 'Start time',
|
|
196
|
+
endTime: 'End time',
|
|
197
|
+
confirm: 'OK',
|
|
198
|
+
prompt: 'Prompt'
|
|
199
|
+
},
|
|
200
|
+
createModal: {
|
|
201
|
+
clear: 'Clear',
|
|
202
|
+
required: '{label} is required',
|
|
203
|
+
whitespace: '{label} cannot contain only whitespace'
|
|
204
|
+
},
|
|
205
|
+
template: {
|
|
206
|
+
selectedPrefix: 'Selected',
|
|
207
|
+
selectedSuffix: 'items',
|
|
208
|
+
clearSelected: 'Clear',
|
|
209
|
+
deleteItemConfirm: 'Delete this item?',
|
|
210
|
+
deleteRowConfirm: 'Confirm delete?',
|
|
211
|
+
deleteSelectedConfirm: 'Delete the selected {count} records?',
|
|
212
|
+
exportSelectedRows: 'Export selected rows',
|
|
213
|
+
exportCurrentPage: 'Export current page',
|
|
214
|
+
exportAll: 'Export all',
|
|
215
|
+
exportAllFields: 'Export all fields',
|
|
216
|
+
exportingFile: 'Exporting file...',
|
|
217
|
+
paginationTotal: 'Total {total} records'
|
|
218
|
+
},
|
|
219
|
+
import: {
|
|
220
|
+
rowNumber: 'Row',
|
|
221
|
+
errorMessage: 'Error message',
|
|
222
|
+
pleaseUploadFile: 'Please upload a file',
|
|
223
|
+
uploadFile: 'Upload file'
|
|
224
|
+
},
|
|
225
|
+
map: {
|
|
226
|
+
goToMap: 'Open map',
|
|
227
|
+
locate: 'Locate',
|
|
228
|
+
calibrate: 'Calibrate',
|
|
229
|
+
redraw: 'Redraw',
|
|
230
|
+
keywordPlaceholder: 'Enter keywords',
|
|
231
|
+
invalidLayerOptions: 'data and options cannot be empty, and map is required'
|
|
232
|
+
},
|
|
233
|
+
upload: {
|
|
234
|
+
downloading: 'Downloading...',
|
|
235
|
+
pictureUnit: 'files'
|
|
236
|
+
},
|
|
237
|
+
request: {
|
|
238
|
+
operationFailed: 'Operation failed'
|
|
239
|
+
}
|
|
180
240
|
}
|
|
181
241
|
};
|
|
@@ -53,7 +53,10 @@ export default {
|
|
|
53
53
|
densityMiddle: '中等',
|
|
54
54
|
densitySmall: '紧凑',
|
|
55
55
|
messageWarningOneText: '至少勾选一列保存',
|
|
56
|
-
messageSuccessText: '操作成功'
|
|
56
|
+
messageSuccessText: '操作成功',
|
|
57
|
+
striped: '斑马纹',
|
|
58
|
+
border: '边框',
|
|
59
|
+
headerBackground: '表头背景'
|
|
57
60
|
},
|
|
58
61
|
stepsForm: {
|
|
59
62
|
next: '下一步',
|
|
@@ -121,6 +124,8 @@ export default {
|
|
|
121
124
|
operation: '导入',
|
|
122
125
|
error: '上传失败',
|
|
123
126
|
success: '上传成功',
|
|
127
|
+
selectFile: '选择文件',
|
|
128
|
+
noFileSelected: "未选择任何文件",
|
|
124
129
|
downloadTemplate: '下载模板',
|
|
125
130
|
pleaseSelectFile: '请选择需要上传的文件',
|
|
126
131
|
upload: '上传',
|
|
@@ -144,7 +149,9 @@ export default {
|
|
|
144
149
|
delete: '删除',
|
|
145
150
|
add: '新增',
|
|
146
151
|
import: '导入',
|
|
147
|
-
export: '导出'
|
|
152
|
+
export: '导出',
|
|
153
|
+
queryResults: '查询结果',
|
|
154
|
+
deleteConfirm: '是否确认删除'
|
|
148
155
|
},
|
|
149
156
|
select: {
|
|
150
157
|
selectAll: '全选',
|
|
@@ -176,8 +183,71 @@ export default {
|
|
|
176
183
|
download: '下载'
|
|
177
184
|
},
|
|
178
185
|
wangEditor: {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
messageOverSizeText: '超过文件大小限制,最大文件大小为',
|
|
187
|
+
messageUploadFailText: '上传出错',
|
|
188
|
+
messageInsertImgFailText: '插入图片失败',
|
|
189
|
+
messageInsertVideoFailText: '插入视频失败',
|
|
190
|
+
messageInsertAttachmentFailText: '插入附件失败'
|
|
191
|
+
},
|
|
192
|
+
colorPicker: {
|
|
193
|
+
primary: '主要',
|
|
194
|
+
// 主色调
|
|
195
|
+
danger: '红色',
|
|
196
|
+
// 危险/错误
|
|
197
|
+
success: '绿色',
|
|
198
|
+
// 成功
|
|
199
|
+
info: '青色',
|
|
200
|
+
// 信息/提示
|
|
201
|
+
basic: '基础颜色',
|
|
202
|
+
// 基础色板
|
|
203
|
+
chart: '图表颜色' // 图表专用色
|
|
204
|
+
},
|
|
205
|
+
envPuzzle: {
|
|
206
|
+
common: {
|
|
207
|
+
startTime: '开始时间',
|
|
208
|
+
endTime: '结束时间',
|
|
209
|
+
confirm: '确定',
|
|
210
|
+
prompt: '提示'
|
|
211
|
+
},
|
|
212
|
+
createModal: {
|
|
213
|
+
clear: '清空',
|
|
214
|
+
required: '{label}不能为空',
|
|
215
|
+
whitespace: '{label}不能只包含空白字符'
|
|
216
|
+
},
|
|
217
|
+
template: {
|
|
218
|
+
selectedPrefix: '已选择',
|
|
219
|
+
selectedSuffix: '项',
|
|
220
|
+
clearSelected: '清空',
|
|
221
|
+
deleteItemConfirm: '确定删除该项吗?',
|
|
222
|
+
deleteRowConfirm: '是否确认删除',
|
|
223
|
+
deleteSelectedConfirm: '确定删除选中的{count}条数据吗?',
|
|
224
|
+
exportSelectedRows: '导出选中行',
|
|
225
|
+
exportCurrentPage: '导出当前页',
|
|
226
|
+
exportAll: '导出全部',
|
|
227
|
+
exportAllFields: '导出全量字段',
|
|
228
|
+
exportingFile: '导出文件中...',
|
|
229
|
+
paginationTotal: '总共{total}条记录'
|
|
230
|
+
},
|
|
231
|
+
import: {
|
|
232
|
+
rowNumber: '行数',
|
|
233
|
+
errorMessage: '错误信息',
|
|
234
|
+
pleaseUploadFile: '请上传文件',
|
|
235
|
+
uploadFile: '上传文件'
|
|
236
|
+
},
|
|
237
|
+
map: {
|
|
238
|
+
goToMap: '去地图',
|
|
239
|
+
locate: '定位',
|
|
240
|
+
calibrate: '校正',
|
|
241
|
+
redraw: '重新绘制',
|
|
242
|
+
keywordPlaceholder: '请输入关键字',
|
|
243
|
+
invalidLayerOptions: 'data,options 不能为空或者是map对象没有'
|
|
244
|
+
},
|
|
245
|
+
upload: {
|
|
246
|
+
downloading: '下载中...',
|
|
247
|
+
pictureUnit: '张'
|
|
248
|
+
},
|
|
249
|
+
request: {
|
|
250
|
+
operationFailed: '操作失败'
|
|
251
|
+
}
|
|
182
252
|
}
|
|
183
253
|
};
|
|
@@ -9,25 +9,24 @@ import { TinyColor } from '@ctrl/tinycolor';
|
|
|
9
9
|
import { ConfigProvider as AntdConfigProvider, theme as antdTheme } from 'antd';
|
|
10
10
|
import { useContext } from 'react';
|
|
11
11
|
import { VtxProvider } from "../index";
|
|
12
|
-
import { merge } from "../utils/merge";
|
|
13
12
|
|
|
14
|
-
/**
|
|
15
|
-
* 把一个颜色设置一下透明度
|
|
16
|
-
* @example (#fff, 0.5) => rgba(255, 255, 255, 0.5)
|
|
17
|
-
* @param baseColor {string}
|
|
18
|
-
* @param alpha {0-1}
|
|
19
|
-
* @returns rgba {string}
|
|
13
|
+
/**
|
|
14
|
+
* 把一个颜色设置一下透明度
|
|
15
|
+
* @example (#fff, 0.5) => rgba(255, 255, 255, 0.5)
|
|
16
|
+
* @param baseColor {string}
|
|
17
|
+
* @param alpha {0-1}
|
|
18
|
+
* @returns rgba {string}
|
|
20
19
|
*/
|
|
21
20
|
export var setAlpha = function setAlpha(baseColor, alpha) {
|
|
22
21
|
return new TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
/**
|
|
26
|
-
* 把一个颜色修改一些明度
|
|
27
|
-
* @example (#000, 50) => #808080
|
|
28
|
-
* @param baseColor {string}
|
|
29
|
-
* @param brightness {0-100}
|
|
30
|
-
* @returns hexColor {string}
|
|
24
|
+
/**
|
|
25
|
+
* 把一个颜色修改一些明度
|
|
26
|
+
* @example (#000, 50) => #808080
|
|
27
|
+
* @param baseColor {string}
|
|
28
|
+
* @param brightness {0-100}
|
|
29
|
+
* @returns hexColor {string}
|
|
31
30
|
*/
|
|
32
31
|
export var lighten = function lighten(baseColor, brightness) {
|
|
33
32
|
var instance = new TinyColor(baseColor);
|
|
@@ -62,14 +61,14 @@ export var operationUnit = function operationUnit(token) {
|
|
|
62
61
|
};
|
|
63
62
|
};
|
|
64
63
|
|
|
65
|
-
/**
|
|
66
|
-
* 封装了一下 antd 的 useStyle
|
|
67
|
-
* @param componentName {string} 组件的名字
|
|
68
|
-
* @param styleFn {GenerateStyle} 生成样式的函数
|
|
69
|
-
* @returns UseStyleResult
|
|
64
|
+
/**
|
|
65
|
+
* 封装了一下 antd 的 useStyle
|
|
66
|
+
* @param componentName {string} 组件的名字
|
|
67
|
+
* @param styleFn {GenerateStyle} 生成样式的函数
|
|
68
|
+
* @returns UseStyleResult
|
|
70
69
|
*/
|
|
71
70
|
export function useStyle(componentName, styleFn) {
|
|
72
|
-
var _token$
|
|
71
|
+
var _token$vtxComponentsC;
|
|
73
72
|
// eslint-disable-next-line prefer-const
|
|
74
73
|
var _useContext = useContext(VtxProvider),
|
|
75
74
|
_useContext$token = _useContext.token,
|
|
@@ -87,8 +86,13 @@ export function useStyle(componentName, styleFn) {
|
|
|
87
86
|
if (!token.layout) {
|
|
88
87
|
token = _objectSpread({}, antdToken);
|
|
89
88
|
}
|
|
90
|
-
token.
|
|
89
|
+
token.vtxComponentsCls = (_token$vtxComponentsC = token.vtxComponentsCls) !== null && _token$vtxComponentsC !== void 0 ? _token$vtxComponentsC : ".vtx";
|
|
91
90
|
token.antCls = ".".concat(getPrefixCls());
|
|
91
|
+
// wrapSSR 样式注入器 支持 SSR
|
|
92
|
+
// useStyleRegister 生成注入器的工厂
|
|
93
|
+
// nonce CSP 通行证 把生成的 <style> 标签加上 nonce="xxx",防止内联样式被 CSP 拦截
|
|
94
|
+
// path 缓存键 相同 path 就复用已编译的 CSS,避免重复生成样式
|
|
95
|
+
// layer @layer 名称:把全部规则包进 @layer vtx- { ... },方便后续层叠控制与覆盖
|
|
92
96
|
return {
|
|
93
97
|
wrapSSR: useStyleRegister({
|
|
94
98
|
theme: theme,
|
|
@@ -96,7 +100,7 @@ export function useStyle(componentName, styleFn) {
|
|
|
96
100
|
path: [componentName],
|
|
97
101
|
nonce: csp === null || csp === void 0 ? void 0 : csp.nonce,
|
|
98
102
|
layer: {
|
|
99
|
-
name: 'vtx
|
|
103
|
+
name: 'vtx'
|
|
100
104
|
}
|
|
101
105
|
}, function () {
|
|
102
106
|
return styleFn(token);
|
|
@@ -52,44 +52,54 @@ function VtxScrollableRow(props) {
|
|
|
52
52
|
setNextPrev();
|
|
53
53
|
}, 200);
|
|
54
54
|
window.addEventListener('resize', debouncedResize);
|
|
55
|
-
|
|
55
|
+
// 使用 requestAnimationFrame 确保 DOM 已渲染
|
|
56
|
+
requestAnimationFrame(function () {
|
|
57
|
+
setNextPrev();
|
|
58
|
+
});
|
|
56
59
|
return function () {
|
|
60
|
+
debouncedResize.cancel();
|
|
57
61
|
window.removeEventListener('resize', debouncedResize);
|
|
58
62
|
};
|
|
59
|
-
}, [
|
|
63
|
+
}, []);
|
|
60
64
|
function setNextPrev() {
|
|
61
65
|
if (navRef !== null && navRef !== void 0 && navRef.current && containerRef.current && navWrapRef.current) {
|
|
62
66
|
var navNodeW = navRef.current.scrollWidth;
|
|
63
67
|
var containerW = containerRef.current.offsetWidth;
|
|
64
68
|
var navWrapNodeW = navWrapRef.current.offsetWidth;
|
|
65
69
|
var minOffset = containerW - navNodeW;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
offset.current
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
|
|
71
|
+
// ✅ 使用函数式更新确保状态一致性
|
|
72
|
+
setState(function (prevState) {
|
|
73
|
+
var next = prevState.next,
|
|
74
|
+
prev = prevState.prev;
|
|
75
|
+
var newOffset = offset.current;
|
|
76
|
+
if (minOffset >= 0) {
|
|
77
|
+
next = false;
|
|
78
|
+
setOffset(0, false);
|
|
79
|
+
newOffset = 0;
|
|
80
|
+
} else if (minOffset < newOffset) {
|
|
81
|
+
next = true;
|
|
82
|
+
} else {
|
|
83
|
+
next = false;
|
|
84
|
+
var realOffset = navWrapNodeW - navNodeW;
|
|
85
|
+
setOffset(realOffset, false);
|
|
86
|
+
newOffset = realOffset;
|
|
87
|
+
}
|
|
88
|
+
if (newOffset < 0) {
|
|
89
|
+
prev = true;
|
|
90
|
+
} else {
|
|
91
|
+
prev = false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 同步更新 ref 值
|
|
95
|
+
offset.current = newOffset;
|
|
96
|
+
|
|
97
|
+
// 返回新的状态对象
|
|
98
|
+
return {
|
|
99
|
+
next: next,
|
|
100
|
+
prev: prev
|
|
101
|
+
};
|
|
88
102
|
});
|
|
89
|
-
return {
|
|
90
|
-
next: _next,
|
|
91
|
-
prev: _prev
|
|
92
|
-
};
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
var setOffset = function setOffset(os) {
|