@icos-desktop/react-components 3.0.3 → 4.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.
- package/dist/es/components/BookDetail/BookDetail.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/BookGroupImport.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/components/Existing/MatchBook/TargetModal/index.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/components/Existing/MatchField/index.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/components/Existing/SelectBook/SourceModal/SelectBookGroup/index.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/components/Existing/SelectBook/SourceModal/SelectData/index.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/components/Existing/SelectBook/SourceModal/index.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/components/Existing/SelectBook/index.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/components/Existing/Steps/index.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/components/Existing/index.module.less.js +1 -1
- package/dist/es/components/BookGroupImport/components/Upload/index.module.less.js +1 -1
- package/dist/es/components/BookGroupTable/BookGroupTable.module.less.js +1 -1
- package/dist/es/components/BookImport/BookImport.module.less.js +1 -1
- package/dist/es/components/BookInfo/BookInfo.module.less.js +1 -1
- package/dist/es/components/BookTable/BookTable.module.less.js +1 -1
- package/dist/es/components/BookTable/components/ExportModal/index.module.less.js +1 -1
- package/dist/es/components/EntityClassFilter/EntityClassFilter.module.less.js +1 -1
- package/dist/es/components/ImportTable/ImportTable.module.less.js +1 -1
- package/dist/es/components/Modal/index.module.less.js +1 -1
- package/dist/es/components/PersonSelector/PersonSelector.module.less.js +1 -1
- package/dist/es/components/ProTable/index.module.less.js +1 -1
- package/dist/es/components/SenseContentTable/SenseContentTable.module.less.js +1 -1
- package/dist/es/components/SenseContentTable/components/ExportModal/index.module.less.js +1 -1
- package/dist/es/components/SenseContentTable/components/Filter/index.module.less.js +1 -1
- package/dist/es/components/SenseCreate/SenseCreate.module.less.js +1 -1
- package/dist/es/components/SenseCreate/components/CreateSense/index.module.less.js +1 -1
- package/dist/es/components/SenseCreate/components/Footer/index.module.less.js +1 -1
- package/dist/es/components/SenseCreate/components/SelectBook/index.module.less.js +1 -1
- package/dist/es/components/SenseCreate/components/SelectTemplate/Item/index.module.less.js +1 -1
- package/dist/es/components/SenseCreate/components/SelectTemplate/index.module.less.js +1 -1
- package/dist/es/components/SenseDetail/SenseDetail.js +3 -3
- package/dist/es/components/SenseDetail/SenseDetail.module.less.js +1 -1
- package/dist/es/components/SenseDetail/SenseDetail.types.d.ts +4 -0
- package/dist/es/components/SenseDetail/components/Base/index.d.ts +1 -0
- package/dist/es/components/SenseDetail/components/Base/index.js +7 -3
- package/dist/es/components/SenseDetail/components/BookList/index.module.less.js +1 -1
- package/dist/es/components/SenseDetail/components/Content/components/Card/index.module.less.js +1 -1
- package/dist/es/components/SenseDetail/components/Content/index.module.less.js +1 -1
- package/dist/es/components/SenseDetail/settings.js +6 -0
- package/dist/es/components/SenseEdit/SenseEdit.module.less.js +1 -1
- package/dist/es/components/SenseFullTable/SenseFullTable.module.less.js +1 -1
- package/dist/es/components/SenseFullTable/components/Catalog/index.module.less.js +1 -1
- package/dist/es/components/SenseFullTable/components/Filter/index.module.less.js +1 -1
- package/dist/es/components/SenseFullTable/components/SideBar/index.module.less.js +1 -1
- package/dist/es/components/SenseInfo/components/FileView/index.module.less.js +1 -1
- package/dist/es/components/SenseInfo/components/ImageView/index.module.less.js +1 -1
- package/dist/es/components/SenseInfo/components/Render/index.module.less.js +1 -1
- package/dist/es/components/SenseInfo/components/TagsView/index.module.less.js +1 -1
- package/dist/es/components/SenseManager/SenseManager.module.less.js +1 -1
- package/dist/es/components/SenseSearch/SenseSearch.module.less.js +1 -1
- package/dist/es/components/SenseSearch/components/AdvancedSearch/KnnItems/index.module.less.js +1 -1
- package/dist/es/components/SenseSearch/components/AdvancedSearch/index.module.less.js +1 -1
- package/dist/es/components/SenseSearch/components/Tabs/index.module.less.js +1 -1
- package/dist/es/components/SenseTable/SenseTable.module.less.js +1 -1
- package/dist/es/components/SenseTable/components/ExportModal/index.module.less.js +1 -1
- package/dist/es/components/SenseTable/components/TagsModal/index.module.less.js +1 -1
- package/dist/es/components/SenseTable/components/widgets/FileView/index.module.less.js +1 -1
- package/dist/es/components/SenseTable/components/widgets/ImageView/index.module.less.js +1 -1
- package/dist/es/components/SenseTree/SenseTree.module.less.js +1 -1
- package/dist/es/components/SenseTree/components/ExportModal/index.module.less.js +1 -1
- package/dist/es/components/SenseView/SenseView.module.less.js +1 -1
- package/dist/es/components/TagConfig/components/SenseList/index.module.less.js +1 -1
- package/dist/es/components/TagConfig/components/TagList/index.module.less.js +1 -1
- package/dist/es/components/VideoControl/VideoControl.module.less.js +1 -1
- package/dist/es/components/VideoPlayer/VideoPlayer.module.less.js +1 -1
- package/dist/es/hooks/useRelationList/RelationList/index.module.less.js +1 -1
- package/dist/es/index.d.ts +3 -1
- package/dist/es/index.js +3 -2
- package/dist/es/node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/Cache.js +51 -0
- package/dist/es/node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/StyleContext.js +85 -0
- package/dist/es/node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/hooks/useCacheToken.js +8 -0
- package/dist/es/node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/hooks/useHMR.js +26 -0
- package/dist/es/node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/transformers/autoPrefix.js +3 -0
- package/dist/es/node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/transformers/legacyLogicalProperties.js +12 -0
- package/dist/es/node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/transformers/px2rem.js +57 -0
- package/dist/es/node_modules/.pnpm/@emotion_unitless@0.7.5/node_modules/@emotion/unitless/dist/unitless.browser.esm.js +50 -0
- package/dist/es/node_modules/.pnpm/@rc-component_util@1.4.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@rc-component/util/es/hooks/useMemo.js +12 -0
- package/dist/es/node_modules/.pnpm/@rc-component_util@1.4.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@rc-component/util/es/isEqual.js +51 -0
- package/dist/es/node_modules/.pnpm/@rc-component_util@1.4.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@rc-component/util/es/warning.js +65 -0
- package/dist/es/providers/AntdPxToRemProvider.d.ts +37 -0
- package/dist/es/providers/AntdPxToRemProvider.js +56 -0
- package/dist/icos-desktop.js +533 -78
- package/dist/icos-desktop.umd.cjs +1 -1
- package/package.json +5 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".VideoPlayer-module_container__Afx8w {\n position: relative;\n width: 100%;\n height: 100%;\n}\n.VideoPlayer-module_container__Afx8w * {\n box-sizing: border-box;\n}\n.VideoPlayer-module_container__Afx8w .VideoPlayer-module_control__BUSKK {\n position: absolute;\n top:
|
|
3
|
+
var css_248z = ".VideoPlayer-module_container__Afx8w {\n position: relative;\n width: 100%;\n height: 100%;\n}\n.VideoPlayer-module_container__Afx8w * {\n box-sizing: border-box;\n}\n.VideoPlayer-module_container__Afx8w .VideoPlayer-module_control__BUSKK {\n position: absolute;\n top: 1rem;\n right: 0.5rem;\n z-index: 999;\n display: flex;\n column-gap: 0.25rem;\n padding: 0.25rem 0.75rem;\n font-size: 1rem;\n font-weight: 400;\n color: #fff;\n cursor: pointer;\n background: linear-gradient(0deg, rgba(0, 255, 255, 0.3) 0%, rgba(0, 255, 255, 0.3) 100%), rgba(0, 43, 102, 0.4);\n border: 1px solid rgba(0, 255, 255, 0.6);\n border-radius: 0.125rem;\n backdrop-filter: blur(2px);\n}\n";
|
|
4
4
|
var styles = {"container":"VideoPlayer-module_container__Afx8w","control":"VideoPlayer-module_control__BUSKK"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".index-module_modal__Tbml9 p {\n height:
|
|
3
|
+
var css_248z = ".index-module_modal__Tbml9 p {\n height: 2rem;\n padding: 0 0.75rem;\n margin-bottom: 0;\n}\n.index-module_modal__Tbml9 .index-module_item__RvDDK {\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 2rem;\n color: #fff;\n white-space: nowrap;\n cursor: pointer;\n}\n.index-module_modal__Tbml9 .index-module_item__RvDDK:hover {\n background-color: rgba(0, 255, 255, 0.1);\n}\n.index-module_modal__Tbml9 .index-module_loading__E5UmT {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.index-module_modal__Tbml9 .index-module_more__iyL8t {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0 0.75rem;\n line-height: 2rem;\n color: #2bf2f8;\n cursor: pointer;\n}\n.index-module_modal__Tbml9 .index-module_more__iyL8t > span {\n margin-left: 0.8125rem;\n}\n.index-module_modal__Tbml9 .index-module_more__iyL8t > svg {\n margin-right: 0.8125rem;\n margin-left: 0.25rem;\n}\n.index-module_modal__Tbml9 .index-module_more__iyL8t::before,\n.index-module_modal__Tbml9 .index-module_more__iyL8t::after {\n flex: 1;\n height: 0.5px;\n content: '';\n background-color: #2bf2f8;\n}\n.index-module_modal__Tbml9 .ant-modal-content {\n padding: 0.25rem 0;\n color: #fff;\n background-color: #0f366a;\n box-shadow: 0 9px 28px 8px rgba(0, 0, 0, 0.05), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12);\n}\n.index-module_modal__Tbml9 .ant-modal-content .ant-modal-body {\n max-height: 18.75rem;\n overflow: hidden auto;\n}\n";
|
|
4
4
|
var styles = {"modal":"index-module_modal__Tbml9","item":"index-module_item__RvDDK","loading":"index-module_loading__E5UmT","more":"index-module_more__iyL8t"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import BookDetail from './components/BookDetail';
|
|
2
|
+
import { AntdPxToRemProvider } from './providers/AntdPxToRemProvider';
|
|
3
|
+
export type { AntdPxToRemProviderProps } from './providers/AntdPxToRemProvider';
|
|
2
4
|
import CcosBookDetail from './components/BookDetail/ccos';
|
|
3
5
|
import BookGroupImport from './components/BookGroupImport';
|
|
4
6
|
import BookGroupTable from './components/BookGroupTable';
|
|
@@ -46,7 +48,7 @@ import CcosVideoControl from './components/VideoControl/ccos';
|
|
|
46
48
|
import VideoPlayer from './components/VideoPlayer';
|
|
47
49
|
import CcosVideoPlayer from './components/VideoPlayer/ccos';
|
|
48
50
|
import config from './utils/config';
|
|
49
|
-
export { BookDetail, BookGroupImport, BookGroupTable, BookImport, BookInfo, BookSelect, BookTable, CcosBookDetail, // 台账属性
|
|
51
|
+
export { AntdPxToRemProvider, BookDetail, BookGroupImport, BookGroupTable, BookImport, BookInfo, BookSelect, BookTable, CcosBookDetail, // 台账属性
|
|
50
52
|
CcosImportTable, // 导入管理
|
|
51
53
|
CcosSenseContentTable, // 实体内容列表
|
|
52
54
|
CcosSenseCreate, // 实体新建
|
package/dist/es/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as BookDetail } from './components/BookDetail/BookDetail.js';
|
|
2
|
+
export { AntdPxToRemProvider } from './providers/AntdPxToRemProvider.js';
|
|
2
3
|
export { default as CcosBookDetail } from './components/BookDetail/ccos.js';
|
|
3
4
|
export { default as BookGroupImport } from './components/BookGroupImport/BookGroupImport.js';
|
|
4
5
|
export { default as BookGroupTable } from './components/BookGroupTable/BookGroupTable.js';
|
|
@@ -48,9 +49,9 @@ export { default as CcosVideoPlayer } from './components/VideoPlayer/ccos.js';
|
|
|
48
49
|
export { setCconfig as config } from './utils/config.js';
|
|
49
50
|
|
|
50
51
|
try {
|
|
51
|
-
window._ICOS_DESKTOP_VERSION_ = JSON.parse('{"version":"
|
|
52
|
+
window._ICOS_DESKTOP_VERSION_ = JSON.parse('{"version":"4.0.1","branch":"release_v4.0.0","buildDate":"2026-04-08 14:23:35"}');
|
|
52
53
|
}
|
|
53
54
|
catch (err) {
|
|
54
55
|
console.warn(err);
|
|
55
|
-
window._ICOS_DESKTOP_VERSION_ = '{"version":"
|
|
56
|
+
window._ICOS_DESKTOP_VERSION_ = '{"version":"4.0.1","branch":"release_v4.0.0","buildDate":"2026-04-08 14:23:35"}';
|
|
56
57
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// [times, realValue]
|
|
2
|
+
|
|
3
|
+
const SPLIT = '%';
|
|
4
|
+
|
|
5
|
+
/** Connect key with `SPLIT` */
|
|
6
|
+
function pathKey(keys) {
|
|
7
|
+
return keys.join(SPLIT);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Record update id for extract static style order. */
|
|
11
|
+
let updateId = 0;
|
|
12
|
+
class Entity {
|
|
13
|
+
instanceId;
|
|
14
|
+
constructor(instanceId) {
|
|
15
|
+
this.instanceId = instanceId;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** @private Internal cache map. Do not access this directly */
|
|
19
|
+
cache = new Map();
|
|
20
|
+
|
|
21
|
+
/** @private Record update times for each key */
|
|
22
|
+
updateTimes = new Map();
|
|
23
|
+
extracted = new Set();
|
|
24
|
+
get(keys) {
|
|
25
|
+
return this.opGet(pathKey(keys));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A fast get cache with `get` concat. */
|
|
29
|
+
opGet(keyPathStr) {
|
|
30
|
+
return this.cache.get(keyPathStr) || null;
|
|
31
|
+
}
|
|
32
|
+
update(keys, valueFn) {
|
|
33
|
+
return this.opUpdate(pathKey(keys), valueFn);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A fast get cache with `get` concat. */
|
|
37
|
+
opUpdate(keyPathStr, valueFn) {
|
|
38
|
+
const prevValue = this.cache.get(keyPathStr);
|
|
39
|
+
const nextValue = valueFn(prevValue);
|
|
40
|
+
if (nextValue === null) {
|
|
41
|
+
this.cache.delete(keyPathStr);
|
|
42
|
+
this.updateTimes.delete(keyPathStr);
|
|
43
|
+
} else {
|
|
44
|
+
this.cache.set(keyPathStr, nextValue);
|
|
45
|
+
this.updateTimes.set(keyPathStr, updateId);
|
|
46
|
+
updateId += 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { Entity as default, pathKey };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import useMemo from '../../../../../@rc-component_util@1.4.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@rc-component/util/es/hooks/useMemo.js';
|
|
2
|
+
import isEqual from '../../../../../@rc-component_util@1.4.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@rc-component/util/es/isEqual.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import Entity from './Cache.js';
|
|
5
|
+
import { AUTO_PREFIX } from './transformers/autoPrefix.js';
|
|
6
|
+
|
|
7
|
+
const ATTR_MARK = 'data-css-hash';
|
|
8
|
+
|
|
9
|
+
// Mark css-in-js instance in style element
|
|
10
|
+
const CSS_IN_JS_INSTANCE = '__cssinjs_instance__';
|
|
11
|
+
function createCache() {
|
|
12
|
+
const cssinjsInstanceId = Math.random().toString(12).slice(2);
|
|
13
|
+
|
|
14
|
+
// Tricky SSR: Move all inline style to the head.
|
|
15
|
+
// PS: We do not recommend tricky mode.
|
|
16
|
+
if (typeof document !== 'undefined' && document.head && document.body) {
|
|
17
|
+
const styles = document.body.querySelectorAll(`style[${ATTR_MARK}]`) || [];
|
|
18
|
+
const {
|
|
19
|
+
firstChild
|
|
20
|
+
} = document.head;
|
|
21
|
+
Array.from(styles).forEach(style => {
|
|
22
|
+
style[CSS_IN_JS_INSTANCE] = style[CSS_IN_JS_INSTANCE] || cssinjsInstanceId;
|
|
23
|
+
|
|
24
|
+
// Not force move if no head
|
|
25
|
+
if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
|
|
26
|
+
document.head.insertBefore(style, firstChild);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Deduplicate of moved styles
|
|
31
|
+
const styleHash = {};
|
|
32
|
+
Array.from(document.querySelectorAll(`style[${ATTR_MARK}]`)).forEach(style => {
|
|
33
|
+
const hash = style.getAttribute(ATTR_MARK);
|
|
34
|
+
if (styleHash[hash]) {
|
|
35
|
+
if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
|
|
36
|
+
style.parentNode?.removeChild(style);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
styleHash[hash] = true;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return new Entity(cssinjsInstanceId);
|
|
44
|
+
}
|
|
45
|
+
const StyleContext = /*#__PURE__*/React.createContext({
|
|
46
|
+
hashPriority: 'low',
|
|
47
|
+
cache: createCache(),
|
|
48
|
+
defaultCache: true,
|
|
49
|
+
autoPrefix: false
|
|
50
|
+
});
|
|
51
|
+
const StyleProvider = props => {
|
|
52
|
+
const {
|
|
53
|
+
children,
|
|
54
|
+
...restProps
|
|
55
|
+
} = props;
|
|
56
|
+
const parentContext = React.useContext(StyleContext);
|
|
57
|
+
const context = useMemo(() => {
|
|
58
|
+
const mergedContext = {
|
|
59
|
+
...parentContext
|
|
60
|
+
};
|
|
61
|
+
Object.keys(restProps).forEach(key => {
|
|
62
|
+
const value = restProps[key];
|
|
63
|
+
if (restProps[key] !== undefined) {
|
|
64
|
+
mergedContext[key] = value;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const {
|
|
68
|
+
cache,
|
|
69
|
+
transformers = []
|
|
70
|
+
} = restProps;
|
|
71
|
+
mergedContext.cache = mergedContext.cache || createCache();
|
|
72
|
+
mergedContext.defaultCache = !cache && parentContext.defaultCache;
|
|
73
|
+
|
|
74
|
+
// autoPrefix
|
|
75
|
+
if (transformers.includes(AUTO_PREFIX)) {
|
|
76
|
+
mergedContext.autoPrefix = true;
|
|
77
|
+
}
|
|
78
|
+
return mergedContext;
|
|
79
|
+
}, [parentContext, restProps], (prev, next) => !isEqual(prev[0], next[0], true) || !isEqual(prev[1], next[1], true));
|
|
80
|
+
return /*#__PURE__*/React.createElement(StyleContext.Provider, {
|
|
81
|
+
value: context
|
|
82
|
+
}, children);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export { ATTR_MARK, CSS_IN_JS_INSTANCE, StyleProvider, createCache, StyleContext as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../StyleContext.js';
|
|
3
|
+
import '../../../../../../@rc-component_util@1.4.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@rc-component/util/es/warning.js';
|
|
4
|
+
import './useHMR.js';
|
|
5
|
+
|
|
6
|
+
// Generate different prefix to make user selector break in production env.
|
|
7
|
+
// This helps developer not to do style override directly on the hash id.
|
|
8
|
+
process.env.NODE_ENV !== 'production' ? 'css-dev-only-do-not-override' : 'css';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function useProdHMR() {
|
|
2
|
+
return false;
|
|
3
|
+
}
|
|
4
|
+
let webpackHMR = false;
|
|
5
|
+
function useDevHMR() {
|
|
6
|
+
return webpackHMR;
|
|
7
|
+
}
|
|
8
|
+
process.env.NODE_ENV === 'production' ? useProdHMR : useDevHMR;
|
|
9
|
+
|
|
10
|
+
// Webpack `module.hot.accept` do not support any deps update trigger
|
|
11
|
+
// We have to hack handler to force mark as HRM
|
|
12
|
+
if (process.env.NODE_ENV !== 'production' && typeof module !== 'undefined' && module && module.hot && typeof window !== 'undefined') {
|
|
13
|
+
// Use `globalThis` first, and `window` for older browsers
|
|
14
|
+
// const win = globalThis as any;
|
|
15
|
+
const win = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : null;
|
|
16
|
+
if (win && typeof win.webpackHotUpdate === 'function') {
|
|
17
|
+
const originWebpackHotUpdate = win.webpackHotUpdate;
|
|
18
|
+
win.webpackHotUpdate = (...args) => {
|
|
19
|
+
webpackHMR = true;
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
webpackHMR = false;
|
|
22
|
+
}, 0);
|
|
23
|
+
return originWebpackHotUpdate(...args);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function noSplit(list) {
|
|
2
|
+
list.notSplit = true;
|
|
3
|
+
return list;
|
|
4
|
+
}
|
|
5
|
+
({
|
|
6
|
+
// Border
|
|
7
|
+
borderBlock: noSplit(['borderTop', 'borderBottom']),
|
|
8
|
+
borderBlockStart: noSplit(['borderTop']),
|
|
9
|
+
borderBlockEnd: noSplit(['borderBottom']),
|
|
10
|
+
borderInline: noSplit(['borderLeft', 'borderRight']),
|
|
11
|
+
borderInlineStart: noSplit(['borderLeft']),
|
|
12
|
+
borderInlineEnd: noSplit(['borderRight'])});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import unitlessKeys from '../../../../../../@emotion_unitless@0.7.5/node_modules/@emotion/unitless/dist/unitless.browser.esm.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* respect https://github.com/cuth/postcss-pxtorem
|
|
5
|
+
*/
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
const pxRegex = /url\([^)]+\)|var\([^)]+\)|(\d*\.?\d+)px/g;
|
|
8
|
+
function toFixed(number, precision) {
|
|
9
|
+
const multiplier = Math.pow(10, precision + 1),
|
|
10
|
+
wholeNumber = Math.floor(number * multiplier);
|
|
11
|
+
return Math.round(wholeNumber / 10) * 10 / multiplier;
|
|
12
|
+
}
|
|
13
|
+
const transform = (options = {}) => {
|
|
14
|
+
const {
|
|
15
|
+
rootValue = 16,
|
|
16
|
+
precision = 5,
|
|
17
|
+
mediaQuery = false
|
|
18
|
+
} = options;
|
|
19
|
+
const pxReplace = (m, $1) => {
|
|
20
|
+
if (!$1) return m;
|
|
21
|
+
const pixels = parseFloat($1);
|
|
22
|
+
// covenant: pixels <= 1, not transform to rem @zombieJ
|
|
23
|
+
if (pixels <= 1) return m;
|
|
24
|
+
const fixedVal = toFixed(pixels / rootValue, precision);
|
|
25
|
+
return `${fixedVal}rem`;
|
|
26
|
+
};
|
|
27
|
+
const visit = cssObj => {
|
|
28
|
+
const clone = {
|
|
29
|
+
...cssObj
|
|
30
|
+
};
|
|
31
|
+
Object.entries(cssObj).forEach(([key, value]) => {
|
|
32
|
+
if (typeof value === 'string' && value.includes('px')) {
|
|
33
|
+
const newValue = value.replace(pxRegex, pxReplace);
|
|
34
|
+
clone[key] = newValue;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// no unit
|
|
38
|
+
if (!unitlessKeys[key] && typeof value === 'number' && value !== 0) {
|
|
39
|
+
clone[key] = `${value}px`.replace(pxRegex, pxReplace);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Media queries
|
|
43
|
+
const mergedKey = key.trim();
|
|
44
|
+
if (mergedKey.startsWith('@') && mergedKey.includes('px') && mediaQuery) {
|
|
45
|
+
const newKey = key.replace(pxRegex, pxReplace);
|
|
46
|
+
clone[newKey] = clone[key];
|
|
47
|
+
delete clone[key];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return clone;
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
visit
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { transform as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var unitlessKeys = {
|
|
2
|
+
animationIterationCount: 1,
|
|
3
|
+
borderImageOutset: 1,
|
|
4
|
+
borderImageSlice: 1,
|
|
5
|
+
borderImageWidth: 1,
|
|
6
|
+
boxFlex: 1,
|
|
7
|
+
boxFlexGroup: 1,
|
|
8
|
+
boxOrdinalGroup: 1,
|
|
9
|
+
columnCount: 1,
|
|
10
|
+
columns: 1,
|
|
11
|
+
flex: 1,
|
|
12
|
+
flexGrow: 1,
|
|
13
|
+
flexPositive: 1,
|
|
14
|
+
flexShrink: 1,
|
|
15
|
+
flexNegative: 1,
|
|
16
|
+
flexOrder: 1,
|
|
17
|
+
gridRow: 1,
|
|
18
|
+
gridRowEnd: 1,
|
|
19
|
+
gridRowSpan: 1,
|
|
20
|
+
gridRowStart: 1,
|
|
21
|
+
gridColumn: 1,
|
|
22
|
+
gridColumnEnd: 1,
|
|
23
|
+
gridColumnSpan: 1,
|
|
24
|
+
gridColumnStart: 1,
|
|
25
|
+
msGridRow: 1,
|
|
26
|
+
msGridRowSpan: 1,
|
|
27
|
+
msGridColumn: 1,
|
|
28
|
+
msGridColumnSpan: 1,
|
|
29
|
+
fontWeight: 1,
|
|
30
|
+
lineHeight: 1,
|
|
31
|
+
opacity: 1,
|
|
32
|
+
order: 1,
|
|
33
|
+
orphans: 1,
|
|
34
|
+
tabSize: 1,
|
|
35
|
+
widows: 1,
|
|
36
|
+
zIndex: 1,
|
|
37
|
+
zoom: 1,
|
|
38
|
+
WebkitLineClamp: 1,
|
|
39
|
+
// SVG-related properties
|
|
40
|
+
fillOpacity: 1,
|
|
41
|
+
floodOpacity: 1,
|
|
42
|
+
stopOpacity: 1,
|
|
43
|
+
strokeDasharray: 1,
|
|
44
|
+
strokeDashoffset: 1,
|
|
45
|
+
strokeMiterlimit: 1,
|
|
46
|
+
strokeOpacity: 1,
|
|
47
|
+
strokeWidth: 1
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { unitlessKeys as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
function useMemo(getValue, condition, shouldUpdate) {
|
|
4
|
+
const cacheRef = React.useRef({});
|
|
5
|
+
if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
6
|
+
cacheRef.current.value = getValue();
|
|
7
|
+
cacheRef.current.condition = condition;
|
|
8
|
+
}
|
|
9
|
+
return cacheRef.current.value;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { useMemo as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { warningOnce } from './warning.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deeply compares two object literals.
|
|
5
|
+
* @param obj1 object 1
|
|
6
|
+
* @param obj2 object 2
|
|
7
|
+
* @param shallow shallow compare
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
function isEqual(obj1, obj2, shallow = false) {
|
|
11
|
+
// https://github.com/mapbox/mapbox-gl-js/pull/5979/files#diff-fde7145050c47cc3a306856efd5f9c3016e86e859de9afbd02c879be5067e58f
|
|
12
|
+
const refSet = new Set();
|
|
13
|
+
function deepEqual(a, b, level = 1) {
|
|
14
|
+
const circular = refSet.has(a);
|
|
15
|
+
warningOnce(!circular, 'Warning: There may be circular references');
|
|
16
|
+
if (circular) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (a === b) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (shallow && level > 1) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
refSet.add(a);
|
|
26
|
+
const newLevel = level + 1;
|
|
27
|
+
if (Array.isArray(a)) {
|
|
28
|
+
if (!Array.isArray(b) || a.length !== b.length) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
for (let i = 0; i < a.length; i++) {
|
|
32
|
+
if (!deepEqual(a[i], b[i], newLevel)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
39
|
+
const keys = Object.keys(a);
|
|
40
|
+
if (keys.length !== Object.keys(b).length) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return keys.every(key => deepEqual(a[key], b[key], newLevel));
|
|
44
|
+
}
|
|
45
|
+
// other
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return deepEqual(obj1, obj2);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { isEqual as default };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
let warned = {};
|
|
3
|
+
const preWarningFns = [];
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Pre warning enable you to parse content before console.error.
|
|
7
|
+
* Modify to null will prevent warning.
|
|
8
|
+
*/
|
|
9
|
+
const preMessage = fn => {
|
|
10
|
+
preWarningFns.push(fn);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Warning if condition not match.
|
|
15
|
+
* @param valid Condition
|
|
16
|
+
* @param message Warning message
|
|
17
|
+
* @example
|
|
18
|
+
* ```js
|
|
19
|
+
* warning(false, 'some error'); // print some error
|
|
20
|
+
* warning(true, 'some error'); // print nothing
|
|
21
|
+
* warning(1 === 2, 'some error'); // print some error
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function warning(valid, message) {
|
|
25
|
+
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
26
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? '', 'warning'), message);
|
|
27
|
+
if (finalMessage) {
|
|
28
|
+
console.error(`Warning: ${finalMessage}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** @see Similar to {@link warning} */
|
|
34
|
+
function note(valid, message) {
|
|
35
|
+
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
36
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? '', 'note'), message);
|
|
37
|
+
if (finalMessage) {
|
|
38
|
+
console.warn(`Note: ${finalMessage}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function resetWarned() {
|
|
43
|
+
warned = {};
|
|
44
|
+
}
|
|
45
|
+
function call(method, valid, message) {
|
|
46
|
+
if (!valid && !warned[message]) {
|
|
47
|
+
method(false, message);
|
|
48
|
+
warned[message] = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
53
|
+
function warningOnce(valid, message) {
|
|
54
|
+
call(warning, valid, message);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
58
|
+
function noteOnce(valid, message) {
|
|
59
|
+
call(note, valid, message);
|
|
60
|
+
}
|
|
61
|
+
warningOnce.preMessage = preMessage;
|
|
62
|
+
warningOnce.resetWarned = resetWarned;
|
|
63
|
+
warningOnce.noteOnce = noteOnce;
|
|
64
|
+
|
|
65
|
+
export { call, warningOnce as default, note, noteOnce, preMessage, resetWarned, warning, warningOnce };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AntdPxToRemProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* 将 antd 运行时注入的 CSS-in-JS 样式中的 px 单位转换为 rem。
|
|
7
|
+
*
|
|
8
|
+
* 与构建期的 postcss-pxtorem 配合使用,可实现组件库样式(Less)和
|
|
9
|
+
* antd 内部样式(CSS-in-JS)的统一 rem 输出,满足大屏等比缩放需求。
|
|
10
|
+
*
|
|
11
|
+
* 用法:在应用根节点(最外层)包裹此 Provider,位于 ConfigProvider / App 的外侧。
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { AntdPxToRemProvider } from '@icos-desktop/react-components';
|
|
16
|
+
* import { ConfigProvider, App } from 'antd';
|
|
17
|
+
*
|
|
18
|
+
* function Root() {
|
|
19
|
+
* return (
|
|
20
|
+
* <AntdPxToRemProvider>
|
|
21
|
+
* <ConfigProvider theme={theme}>
|
|
22
|
+
* <App>
|
|
23
|
+
* <YourApp />
|
|
24
|
+
* </App>
|
|
25
|
+
* </ConfigProvider>
|
|
26
|
+
* </AntdPxToRemProvider>
|
|
27
|
+
* );
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* 注意事项:
|
|
32
|
+
* - 每个应用只需包裹一层,重复嵌套会导致 px 被多次转换。
|
|
33
|
+
* - 仅转换 antd CSS-in-JS 注入的样式;业务的 Less/CSS 样式由构建期 postcss-pxtorem 处理。
|
|
34
|
+
* - 转换生效的前提是宿主应用统一设置了根字号缩放策略,否则视觉效果与使用 px 相同。
|
|
35
|
+
*/
|
|
36
|
+
export declare function AntdPxToRemProvider({ children }: AntdPxToRemProviderProps): React.JSX.Element;
|
|
37
|
+
export default AntdPxToRemProvider;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import '../node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/hooks/useCacheToken.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { StyleProvider } from '../node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/StyleContext.js';
|
|
4
|
+
import '../node_modules/.pnpm/@rc-component_util@1.4.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@rc-component/util/es/warning.js';
|
|
5
|
+
import '../node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/hooks/useHMR.js';
|
|
6
|
+
import '../node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/transformers/legacyLogicalProperties.js';
|
|
7
|
+
import transform from '../node_modules/.pnpm/@ant-design_cssinjs@2.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/transformers/px2rem.js';
|
|
8
|
+
|
|
9
|
+
var px2rem = transform({
|
|
10
|
+
/**
|
|
11
|
+
* 根字号基准,与 postcss-pxtorem 的 rootValue 保持一致
|
|
12
|
+
* 1rem = 16px,宿主应用通过动态修改 html { font-size } 实现大屏等比缩放
|
|
13
|
+
*/
|
|
14
|
+
rootValue: 16,
|
|
15
|
+
/** 转换精度,保留 5 位小数 */
|
|
16
|
+
precision: 5,
|
|
17
|
+
/** 是否转换媒体查询中的 px,默认关闭 */
|
|
18
|
+
mediaQuery: false,
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* 将 antd 运行时注入的 CSS-in-JS 样式中的 px 单位转换为 rem。
|
|
22
|
+
*
|
|
23
|
+
* 与构建期的 postcss-pxtorem 配合使用,可实现组件库样式(Less)和
|
|
24
|
+
* antd 内部样式(CSS-in-JS)的统一 rem 输出,满足大屏等比缩放需求。
|
|
25
|
+
*
|
|
26
|
+
* 用法:在应用根节点(最外层)包裹此 Provider,位于 ConfigProvider / App 的外侧。
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* import { AntdPxToRemProvider } from '@icos-desktop/react-components';
|
|
31
|
+
* import { ConfigProvider, App } from 'antd';
|
|
32
|
+
*
|
|
33
|
+
* function Root() {
|
|
34
|
+
* return (
|
|
35
|
+
* <AntdPxToRemProvider>
|
|
36
|
+
* <ConfigProvider theme={theme}>
|
|
37
|
+
* <App>
|
|
38
|
+
* <YourApp />
|
|
39
|
+
* </App>
|
|
40
|
+
* </ConfigProvider>
|
|
41
|
+
* </AntdPxToRemProvider>
|
|
42
|
+
* );
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* 注意事项:
|
|
47
|
+
* - 每个应用只需包裹一层,重复嵌套会导致 px 被多次转换。
|
|
48
|
+
* - 仅转换 antd CSS-in-JS 注入的样式;业务的 Less/CSS 样式由构建期 postcss-pxtorem 处理。
|
|
49
|
+
* - 转换生效的前提是宿主应用统一设置了根字号缩放策略,否则视觉效果与使用 px 相同。
|
|
50
|
+
*/
|
|
51
|
+
function AntdPxToRemProvider(_a) {
|
|
52
|
+
var children = _a.children;
|
|
53
|
+
return React__default.createElement(StyleProvider, { transformers: [px2rem] }, children);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { AntdPxToRemProvider, AntdPxToRemProvider as default };
|