chore: 去掉 js require css 用法, 依赖的 css 内嵌在 amis css 文件中 (#3399)

This commit is contained in:
liaoxuezhi 2022-01-13 18:39:05 +08:00 committed by GitHub
parent da25c41847
commit d5f1462531
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 78 additions and 56 deletions

View File

@ -132,7 +132,7 @@
"css": "3.0.0", "css": "3.0.0",
"faker": "^5.5.3", "faker": "^5.5.3",
"fis-optimizer-terser": "^1.0.1", "fis-optimizer-terser": "^1.0.1",
"fis-parser-sass": "^1.1.0", "fis-parser-sass": "^1.1.1",
"fis-parser-svgr": "^1.0.0", "fis-parser-svgr": "^1.0.0",
"fis3": "^3.4.41", "fis3": "^3.4.41",
"fis3-deploy-skip-packed": "0.0.5", "fis3-deploy-skip-packed": "0.0.5",

7
scss/_thirds.scss Normal file
View File

@ -0,0 +1,7 @@
@import url('../node_modules/react-datetime/css/react-datetime.css?__inline');
@import url('../node_modules/codemirror/lib/codemirror.css?__inline');
@import url('../node_modules/froala-editor/css/froala_style.min.css?__inline');
@import url('../node_modules/froala-editor/css/froala_editor.pkgd.min.css?__inline');
@import url('../node_modules/tinymce/skins/ui/oxide/skin.css?__inline');
@import url('../node_modules/video-react/dist/video-react.css?__inline');
@import url('../node_modules/cropperjs/dist/cropper.css?__inline');

View File

@ -1,3 +1,5 @@
@import '../thirds';
@import '../mixins'; @import '../mixins';
@import '../base/reset'; @import '../base/reset';
@import '../base/normalize'; @import '../base/normalize';

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import 'codemirror/lib/codemirror.css'; // import 'codemirror/lib/codemirror.css';
import type CodeMirror from 'codemirror'; import type CodeMirror from 'codemirror';
import {autobind} from '../utils/helper'; import {autobind} from '../utils/helper';
import {resizeSensor} from '../utils/resize-sensor'; import {resizeSensor} from '../utils/resize-sensor';

View File

@ -14,7 +14,7 @@ import Overlay from './Overlay';
import {ClassNamesFn, themeable, ThemeProps} from '../theme'; import {ClassNamesFn, themeable, ThemeProps} from '../theme';
import {PlainObject} from '../types'; import {PlainObject} from '../types';
import Calendar from './calendar/Calendar'; import Calendar from './calendar/Calendar';
import 'react-datetime/css/react-datetime.css'; // import 'react-datetime/css/react-datetime.css';
import {localeable, LocaleProps, TranslateFn} from '../locale'; import {localeable, LocaleProps, TranslateFn} from '../locale';
import {isMobile, ucFirst} from '../utils/helper'; import {isMobile, ucFirst} from '../utils/helper';
import CalendarMobile from './CalendarMobile'; import CalendarMobile from './CalendarMobile';
@ -581,25 +581,36 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
const isOpened = this.state.isOpened; const isOpened = this.state.isOpened;
let date: moment.Moment | undefined = this.state.value; let date: moment.Moment | undefined = this.state.value;
const calendarMobile = <CalendarMobile const calendarMobile = (
isDatePicker={true} <CalendarMobile
timeFormat={timeFormat} isDatePicker={true}
inputFormat={inputFormat} timeFormat={timeFormat}
startDate={date} inputFormat={inputFormat}
defaultDate={date} startDate={date}
minDate={minDate} defaultDate={date}
maxDate={maxDate} minDate={minDate}
dateFormat={dateFormat} maxDate={maxDate}
embed={embed} dateFormat={dateFormat}
viewMode={viewMode} embed={embed}
close={this.close} viewMode={viewMode}
confirm={this.handleChange} close={this.close}
footerExtra={this.renderShortCuts(shortcuts)} confirm={this.handleChange}
showViewMode={viewMode === 'quarters' || viewMode === 'months' ? 'years' : 'months'} footerExtra={this.renderShortCuts(shortcuts)}
timeConstraints={timeConstraints} showViewMode={
/>; viewMode === 'quarters' || viewMode === 'months' ? 'years' : 'months'
const CalendarMobileTitle = <div className={`${ns}CalendarMobile-title`}>{__('Calendar.datepicker')}</div>; }
const useCalendarMobile = useMobileUI && isMobile() && ['days', 'months', 'quarters'].indexOf(viewMode) > -1; timeConstraints={timeConstraints}
/>
);
const CalendarMobileTitle = (
<div className={`${ns}CalendarMobile-title`}>
{__('Calendar.datepicker')}
</div>
);
const useCalendarMobile =
useMobileUI &&
isMobile() &&
['days', 'months', 'quarters'].indexOf(viewMode) > -1;
if (embed) { if (embed) {
let schedulesData: DateProps['schedules'] = undefined; let schedulesData: DateProps['schedules'] = undefined;
@ -736,8 +747,8 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
</Overlay> </Overlay>
) : null} ) : null}
{useMobileUI && isMobile() ? ( {useMobileUI && isMobile() ? (
mobileCalendarMode === 'calendar' && useCalendarMobile mobileCalendarMode === 'calendar' && useCalendarMobile ? (
? <PopUp <PopUp
isShow={isOpened} isShow={isOpened}
className={cx(`${ns}CalendarMobile-pop`)} className={cx(`${ns}CalendarMobile-pop`)}
onHide={this.close} onHide={this.close}
@ -745,34 +756,36 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
> >
{calendarMobile} {calendarMobile}
</PopUp> </PopUp>
: <PopUp ) : (
className={cx(`${ns}DatePicker-popup DatePicker-mobile`)} <PopUp
container={popOverContainer} className={cx(`${ns}DatePicker-popup DatePicker-mobile`)}
isShow={isOpened} container={popOverContainer}
showClose={false} isShow={isOpened}
onHide={this.handleClick} showClose={false}
> onHide={this.handleClick}
{this.renderShortCuts(shortcuts)} >
{this.renderShortCuts(shortcuts)}
<Calendar <Calendar
value={date} value={date}
onChange={this.handleChange} onChange={this.handleChange}
requiredConfirm={!!(dateFormat && timeFormat)} requiredConfirm={!!(dateFormat && timeFormat)}
dateFormat={dateFormat} dateFormat={dateFormat}
inputFormat={inputFormat} inputFormat={inputFormat}
timeFormat={timeFormat} timeFormat={timeFormat}
isValidDate={this.checkIsValidDate} isValidDate={this.checkIsValidDate}
viewMode={viewMode} viewMode={viewMode}
timeConstraints={timeConstraints} timeConstraints={timeConstraints}
input={false} input={false}
onClose={this.close} onClose={this.close}
locale={locale} locale={locale}
minDate={minDate} minDate={minDate}
maxDate={maxDate} maxDate={maxDate}
useMobileUI={useMobileUI} useMobileUI={useMobileUI}
// utc={utc} // utc={utc}
/> />
</PopUp> </PopUp>
)
) : null} ) : null}
</div> </div>
); );

View File

@ -42,8 +42,8 @@ import 'froala-editor/js/plugins/word_paste.min';
import 'froala-editor/js/languages/zh_cn.js'; import 'froala-editor/js/languages/zh_cn.js';
// Require Editor CSS files. // Require Editor CSS files.
import 'froala-editor/css/froala_style.min.css'; // import 'froala-editor/css/froala_style.min.css';
import 'froala-editor/css/froala_editor.pkgd.min.css'; // import 'froala-editor/css/froala_editor.pkgd.min.css';
export interface FroalaEditorComponentProps { export interface FroalaEditorComponentProps {
config: any; config: any;

View File

@ -6,7 +6,7 @@ import tinymce from 'tinymce/tinymce';
// A theme is also required // A theme is also required
import 'tinymce/icons/default/index'; import 'tinymce/icons/default/index';
import 'tinymce/themes/silver'; import 'tinymce/themes/silver';
import 'tinymce/skins/ui/oxide/skin.css'; // import 'tinymce/skins/ui/oxide/skin.css';
// Any plugins you want to use has to be imported // Any plugins you want to use has to be imported
import 'tinymce/plugins/advlist'; import 'tinymce/plugins/advlist';

View File

@ -1,6 +1,6 @@
import React, {Suspense} from 'react'; import React, {Suspense} from 'react';
import {FormItem, FormControlProps, FormBaseControl} from './Item'; import {FormItem, FormControlProps, FormBaseControl} from './Item';
import 'cropperjs/dist/cropper.css'; // import 'cropperjs/dist/cropper.css';
const Cropper = React.lazy(() => import('react-cropper')); const Cropper = React.lazy(() => import('react-cropper'));
import DropZone from 'react-dropzone'; import DropZone from 'react-dropzone';
import {FileRejection} from 'react-dropzone'; import {FileRejection} from 'react-dropzone';

View File

@ -18,7 +18,7 @@ import {Renderer, RendererProps} from '../factory';
import {resolveVariable} from '../utils/tpl-builtin'; import {resolveVariable} from '../utils/tpl-builtin';
import {filter} from '../utils/tpl'; import {filter} from '../utils/tpl';
// import css // import css
import 'video-react/dist/video-react.css'; // import 'video-react/dist/video-react.css';
import {BaseSchema, SchemaClassName, SchemaUrlPath} from '../Schema'; import {BaseSchema, SchemaClassName, SchemaUrlPath} from '../Schema';
/** /**