@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.170
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/.eslintignore +1 -0
- package/.eslintrc.js +49 -10
- package/.prettierrc +6 -0
- package/CHANGELOG.md +5 -0
- package/README.md +855 -0
- package/bin/cli.js +215 -46
- package/cert/Tsicsezwild-22-23.crt +37 -0
- package/cert/Tsicsezwild-22-23.key +27 -0
- package/docs/CustomChunks.md +26 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -0
- package/files/prettierrc.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +24 -0
- package/lib/babel/es-plugins-presets.js +34 -0
- package/lib/common/getEntries.js +33 -46
- package/lib/common/getPublicPathConfig.js +40 -0
- package/lib/common/index.js +24 -19
- package/lib/common/splitChunks.js +110 -25
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/templateParameters.js +25 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +31 -27
- package/lib/configs/libAlias.js +31 -0
- package/lib/configs/webpack.component.umd.config.js +46 -53
- package/lib/configs/webpack.css.umd.config.js +47 -46
- package/lib/configs/webpack.dev.config.js +98 -84
- package/lib/configs/webpack.docs.config.js +64 -57
- package/lib/configs/webpack.impact.config.js +108 -0
- package/lib/configs/webpack.prod.config.js +146 -104
- package/lib/hooks/docsProptypeHook.js +32 -38
- package/lib/jest/commitedFilesResult.js +144 -71
- package/lib/jest/coverageCollector.js +68 -35
- package/lib/jest/jsonMaker.js +54 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
- package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
- package/lib/jest/result.js +92 -42
- package/lib/jest/run.js +75 -28
- package/lib/jest/setup.js +103 -102
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +113 -0
- package/lib/loaderUtils/getDevJsLoaders.js +35 -23
- package/lib/loaderUtils/index.js +14 -7
- package/lib/loaders/docsLoader.js +15 -15
- package/lib/loaders/docsPropsLoader.js +14 -17
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/fileLoader.js +47 -38
- package/lib/loaders/scriptInstrumentLoader.js +23 -20
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +136 -0
- package/lib/middlewares/HMRMiddleware.js +90 -72
- package/lib/middlewares/SSTMiddleware.js +21 -0
- package/lib/pluginUtils/getDevPlugins.js +177 -30
- package/lib/pluginUtils/getDocsPlugins.js +36 -15
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getLibraryPlugins.js +8 -10
- package/lib/pluginUtils/getProdPlugins.js +244 -37
- package/lib/pluginUtils/getServerPlugins.js +8 -11
- package/lib/pluginUtils/getUMDCSSPlugins.js +14 -18
- package/lib/pluginUtils/getUMDComponentPlugins.js +14 -9
- package/lib/pluginUtils/index.js +36 -43
- package/lib/plugins/CdnChangePlugin.js +77 -0
- package/lib/plugins/CleanupStatsPlugin.js +28 -0
- package/lib/plugins/EFCPlugin.js +241 -0
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -0
- package/lib/plugins/I18nSplitPlugin/README.md +25 -0
- package/lib/plugins/I18nSplitPlugin/index.js +185 -0
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
- package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
- package/lib/plugins/ManifestPlugin.js +86 -0
- package/lib/plugins/ModuleStatsPlugin.js +98 -97
- package/lib/plugins/OptimizeJSPlugin.js +41 -0
- package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
- package/lib/plugins/PublicPathChangePlugin.js +226 -0
- package/lib/plugins/ReportGeneratePlugin.js +181 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +67 -0
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
- package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
- package/lib/plugins/ServiceWorkerPlugin.js +107 -0
- package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
- package/lib/plugins/SourceMapHookPlugin.js +25 -59
- package/lib/plugins/TPHashMappingPlugin.js +67 -0
- package/lib/plugins/UglifyCSSPlugin.js +39 -0
- package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
- package/lib/plugins/index.js +127 -37
- package/lib/plugins/libraryImpactPlugin.js +190 -0
- package/lib/plugins/webpackwatchrunplugin.js +26 -0
- package/lib/postcss-plugins/ExcludePlugin.js +23 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +365 -0
- package/lib/postcss-plugins/variableModifier.js +243 -0
- package/lib/schemas/index.js +534 -66
- package/lib/servers/clusterHubServer.js +22 -26
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServer.js +3 -5
- package/lib/servers/docsServerCore.js +94 -79
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/helpServer.js +19 -21
- package/lib/servers/httpsOptions.js +18 -0
- package/lib/servers/impactServer.js +123 -115
- package/lib/servers/mockserver.js +44 -0
- package/lib/servers/nowatchserver.js +200 -0
- package/lib/servers/scrServer.js +147 -0
- package/lib/servers/server.js +134 -132
- package/lib/servers/ssServer.js +106 -70
- package/lib/sh/reportPublish.sh +16 -10
- package/lib/templates/CoverageScriptTemplate.js +45 -18
- package/lib/templates/WMSTemplate.js +17 -18
- package/lib/templates/linterConstant.js +10 -0
- package/lib/utils/babelPresets.js +12 -4
- package/lib/utils/buildstats.html +148 -0
- package/lib/utils/clean.js +12 -11
- package/lib/utils/copy.js +16 -109
- package/lib/utils/copyTimezones.js +21 -0
- package/lib/utils/createEventStream.js +24 -19
- package/lib/utils/cssClassNameGenerate.js +77 -0
- package/lib/utils/cssURLReplacer.js +136 -0
- package/lib/utils/dependencyPostPublish.js +42 -0
- package/lib/utils/fileUtils.js +125 -0
- package/lib/utils/folderIterator.js +47 -0
- package/lib/utils/getComponents.js +126 -0
- package/lib/utils/getCurrentBranch.js +11 -17
- package/lib/utils/getDependenciesImpactList.js +151 -0
- package/lib/utils/getHash.js +26 -0
- package/lib/utils/getIp.js +20 -0
- package/lib/utils/getOptions.js +113 -28
- package/lib/utils/getServerURL.js +25 -8
- package/lib/utils/index.js +283 -68
- package/lib/utils/init.js +2 -2
- package/lib/utils/initPreCommitHook.js +47 -27
- package/lib/utils/jsonHelper.js +106 -0
- package/lib/utils/libraryImpactConfig.js +63 -0
- package/lib/utils/lint/addScripts.js +27 -0
- package/lib/utils/lint/checkExistingConfig.js +67 -0
- package/lib/utils/lint/copyConfigs.js +24 -0
- package/lib/utils/lint/index.js +54 -0
- package/lib/utils/lint/lintScripts.js +11 -0
- package/lib/utils/lint/lintSetup.js +31 -0
- package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
- package/lib/utils/lint/question.js +30 -0
- package/lib/utils/lintReporter.js +142 -0
- package/lib/utils/mailSender.js +16 -25
- package/lib/utils/pullOrigin.js +28 -0
- package/lib/utils/reinstallDependencies.js +133 -0
- package/lib/utils/removeAttributes.js +25 -23
- package/lib/utils/repoClone.js +59 -63
- package/lib/utils/request.js +64 -77
- package/lib/utils/resultSchema.json +73 -0
- package/lib/utils/rtl.js +59 -0
- package/lib/utils/setEnvVariables.js +13 -0
- package/lib/utils/ssTestHack.js +48 -0
- package/lib/utils/switchBranch.js +28 -0
- package/lib/utils/urlConcat.js +22 -0
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +96 -64
- package/postpublish.js +6 -0
- package/templates/app/.eslintrc.js +140 -0
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -8
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -13
- package/templates/app/package.json +37 -17
- package/templates/app/src/actions/SampleActions/index.js +37 -0
- package/templates/app/src/actions/index.js +65 -0
- package/templates/app/src/appUrls.js +19 -0
- package/templates/app/src/components/Alert/Alert.js +134 -0
- package/templates/app/src/components/Alert/Alert.module.css +79 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
- package/templates/app/src/components/Sample/Sample.module.css +11 -0
- package/templates/app/src/components/Sample/SampleList.js +61 -0
- package/templates/app/src/components/Slider/Slider.css +41 -0
- package/templates/app/src/components/Slider/Slider.js +55 -0
- package/templates/app/src/containers/AlertContainer/index.js +15 -0
- package/templates/app/src/containers/AppContainer/index.js +96 -0
- package/templates/app/src/containers/AppContainer/index.module.css +27 -0
- package/templates/app/src/containers/CustomMatch/index.js +65 -0
- package/templates/app/src/containers/DevTools/index.js +10 -0
- package/templates/app/src/containers/Header/index.js +67 -0
- package/templates/app/src/containers/Header/index.module.css +43 -0
- package/templates/app/src/containers/Redirect/index.js +63 -0
- package/templates/app/src/containers/Redirector/index.js +47 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
- package/templates/app/src/historyChange.js +5 -0
- package/templates/app/src/index.html +10 -0
- package/templates/app/src/index.js +24 -0
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
- package/templates/app/src/reducers/alertData.js +11 -0
- package/templates/app/src/reducers/index.js +6 -0
- package/templates/app/src/reducers/samples.js +19 -0
- package/templates/app/src/store/configureStore.dev.js +51 -0
- package/templates/app/src/store/configureStore.js +5 -0
- package/templates/app/src/store/configureStore.prod.js +26 -0
- package/templates/app/src/util/Common.js +5 -0
- package/templates/app/src/util/RequestAPI.js +132 -0
- package/templates/appold/README.md +12 -0
- package/templates/appold/app/index.html +8 -0
- package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
- package/templates/appold/app/properties/i18nkeys.json +3 -0
- package/templates/appold/docs/all.html +69 -0
- package/templates/appold/mockapi/index.js +13 -0
- package/templates/{app → appold}/mockapi/tickets.json +0 -0
- package/templates/appold/package.json +17 -0
- package/templates/appold/src/components/Text/Text.css +0 -0
- package/templates/appold/src/components/Text/Text.js +23 -0
- package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
- package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
- package/templates/appold/src/components/docs.js +1 -0
- package/templates/appold/src/components/index.js +5 -0
- package/templates/appold/src/index.js +13 -0
- package/templates/docs/all.html +1 -1
- package/templates/docs/component.html +110 -69
- package/templates/docs/components.html +221 -0
- package/templates/docs/css/component.css +12 -14
- package/templates/docs/css/componentTest.css +7 -0
- package/templates/docs/css/style.css +150 -206
- package/templates/docs/impactReportTemplate.html +154 -0
- package/templates/docs/index.html +1482 -1336
- package/templates/library/src/index.js +0 -0
- package/.npmignore +0 -3
- package/cert/cert.pem +0 -129
- package/cert/key.pem +0 -27
- package/lib/common/getInsertAt.js +0 -36
- package/lib/common/getInsertIntoFunction.js +0 -13
- package/lib/configs/webpack.server.config.js +0 -93
- package/lib/plugins/ChunkManifestReplacePlugin.js +0 -94
- package/lib/plugins/RuntimePublicPathPlugin.js +0 -46
- package/lib/rmcntrlm.sh +0 -14
- package/lib/servers/nodeServer.js +0 -238
- package/lib/templates/HMRTemplate.js +0 -256
- package/lib/templates/publicPathTemplate.js +0 -16
- package/lib/utils/setConfig.js +0 -14
- package/node_modules/history/CHANGES.md +0 -395
- package/node_modules/history/DOMUtils.js +0 -3
- package/node_modules/history/ExecutionEnvironment.js +0 -3
- package/node_modules/history/LICENSE +0 -21
- package/node_modules/history/LocationUtils.js +0 -3
- package/node_modules/history/PathUtils.js +0 -3
- package/node_modules/history/README.md +0 -282
- package/node_modules/history/cjs/history.js +0 -933
- package/node_modules/history/cjs/history.min.js +0 -1
- package/node_modules/history/createBrowserHistory.js +0 -3
- package/node_modules/history/createHashHistory.js +0 -3
- package/node_modules/history/createMemoryHistory.js +0 -3
- package/node_modules/history/createTransitionManager.js +0 -3
- package/node_modules/history/es/DOMUtils.js +0 -7
- package/node_modules/history/es/ExecutionEnvironment.js +0 -7
- package/node_modules/history/es/LocationUtils.js +0 -7
- package/node_modules/history/es/PathUtils.js +0 -7
- package/node_modules/history/es/createBrowserHistory.js +0 -7
- package/node_modules/history/es/createHashHistory.js +0 -7
- package/node_modules/history/es/createMemoryHistory.js +0 -7
- package/node_modules/history/es/createTransitionManager.js +0 -7
- package/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
- package/node_modules/history/esm/history.js +0 -904
- package/node_modules/history/index.js +0 -7
- package/node_modules/history/package.json +0 -134
- package/node_modules/history/umd/history.js +0 -1059
- package/node_modules/history/umd/history.min.js +0 -1
- package/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
- package/templates/app/.npmignore +0 -9
- package/templates/library/.npmignore +0 -9
@@ -0,0 +1,37 @@
|
|
1
|
+
import { generateAPITypes } from "../../util/Common";
|
2
|
+
import requestAPI from "../../util/RequestAPI";
|
3
|
+
|
4
|
+
export function getSampleList(isForce = true) {
|
5
|
+
return {
|
6
|
+
types: generateAPITypes("SAMPLE_LIST"),
|
7
|
+
shouldCallAPI: state => {
|
8
|
+
if (!isForce) {
|
9
|
+
const { sampleDataList = [] } = state;
|
10
|
+
return sampleDataList.length === 0;
|
11
|
+
}
|
12
|
+
return true;
|
13
|
+
},
|
14
|
+
callAPI: state =>
|
15
|
+
requestAPI(`${mockServerURL}/api/v1/sampleapi`, {})
|
16
|
+
.get()
|
17
|
+
.then(res => {
|
18
|
+
return res;
|
19
|
+
})
|
20
|
+
};
|
21
|
+
}
|
22
|
+
|
23
|
+
export function addSample(payload) {
|
24
|
+
return {
|
25
|
+
types: generateAPITypes("ADD_SAMPLE"),
|
26
|
+
callAPI: state => {
|
27
|
+
return new Promise((resolve, reject) => {
|
28
|
+
let url = `${mockServerURL}/api/v1/addSample`;
|
29
|
+
requestAPI(url, {})
|
30
|
+
.post("", payload)
|
31
|
+
.then(res => {
|
32
|
+
resolve(res);
|
33
|
+
});
|
34
|
+
});
|
35
|
+
}
|
36
|
+
};
|
37
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import {
|
2
|
+
push as routerPush,
|
3
|
+
replace as routerReplace
|
4
|
+
} from "redux-router-middleware";
|
5
|
+
|
6
|
+
export function push(obj, isHref) {
|
7
|
+
//obj.pathname = isHref ? obj.pathname : URL_PREFIX + obj.pathname;
|
8
|
+
return (dispatch, getState) => {
|
9
|
+
let state = getState();
|
10
|
+
dispatch(routerPush(obj));
|
11
|
+
};
|
12
|
+
}
|
13
|
+
|
14
|
+
export function replace(obj) {
|
15
|
+
return (dispatch, getState) => {
|
16
|
+
let state = getState();
|
17
|
+
if (
|
18
|
+
!state.routing.location ||
|
19
|
+
obj.href !== state.routing.location.pathname
|
20
|
+
) {
|
21
|
+
let locationState =
|
22
|
+
state.routing.location && state.routing.location.state;
|
23
|
+
if (!obj.state && locationState) {
|
24
|
+
obj.state = {};
|
25
|
+
Object.assign(obj.state, locationState);
|
26
|
+
}
|
27
|
+
dispatch(routerReplace(obj));
|
28
|
+
}
|
29
|
+
};
|
30
|
+
}
|
31
|
+
|
32
|
+
export function showAlert(data) {
|
33
|
+
return {
|
34
|
+
type: "ALERT_SHOW",
|
35
|
+
data
|
36
|
+
};
|
37
|
+
}
|
38
|
+
|
39
|
+
export function hideAlert() {
|
40
|
+
return {
|
41
|
+
type: "ALERT_HIDE"
|
42
|
+
};
|
43
|
+
}
|
44
|
+
|
45
|
+
export const alertAction = (() => {
|
46
|
+
let ob = { resolve: null, reject: null };
|
47
|
+
function showConfirmBox(data) {
|
48
|
+
return dispatch =>
|
49
|
+
new Promise((res, rej) => {
|
50
|
+
ob.resolve = () => {
|
51
|
+
dispatch(hideAlert());
|
52
|
+
res();
|
53
|
+
};
|
54
|
+
ob.reject = () => {
|
55
|
+
dispatch(hideAlert());
|
56
|
+
rej();
|
57
|
+
};
|
58
|
+
dispatch(showAlert(data));
|
59
|
+
});
|
60
|
+
}
|
61
|
+
return {
|
62
|
+
ob,
|
63
|
+
showConfirmBox
|
64
|
+
};
|
65
|
+
})();
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { URL_PREFIX } from "./util/Common";
|
2
|
+
|
3
|
+
export default function getUrls(isDomainMapped) {
|
4
|
+
let urls = [
|
5
|
+
{
|
6
|
+
name: "root",
|
7
|
+
pattern: "/"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
name: "sampleList",
|
11
|
+
pattern: "/sample"
|
12
|
+
}
|
13
|
+
];
|
14
|
+
|
15
|
+
return urls.map(url => {
|
16
|
+
url.pattern = `${URL_PREFIX}${url.pattern}`;
|
17
|
+
return url;
|
18
|
+
});
|
19
|
+
}
|
@@ -0,0 +1,134 @@
|
|
1
|
+
import React, { Component } from "react";
|
2
|
+
import PropTypes from "prop-types";
|
3
|
+
import style from "./Alert.module.css";
|
4
|
+
import {
|
5
|
+
TopbandFontIcon,
|
6
|
+
TicketsFontIcon,
|
7
|
+
CommonFontIcon,
|
8
|
+
Button
|
9
|
+
} from "@zohodesk/components";
|
10
|
+
|
11
|
+
import FreezeLayer from "../FreezeLayer/FreezeLayer";
|
12
|
+
|
13
|
+
export default class Alert extends Component {
|
14
|
+
constructor(props) {
|
15
|
+
super(props);
|
16
|
+
this.documentKeyupHandler = this.documentKeyupHandler.bind(this);
|
17
|
+
}
|
18
|
+
|
19
|
+
componentDidMount() {
|
20
|
+
document.addEventListener("keyup", this.documentKeyupHandler);
|
21
|
+
}
|
22
|
+
|
23
|
+
componentWillUnmount() {
|
24
|
+
document.removeEventListener("keyup", this.documentKeyupHandler);
|
25
|
+
}
|
26
|
+
|
27
|
+
documentKeyupHandler(e = {}) {
|
28
|
+
e && e.preventDefault();
|
29
|
+
let { onSubmitClick, onCancelClick, isActive } = this.props;
|
30
|
+
if (e.keyCode === 27 && isActive) {
|
31
|
+
onCancelClick();
|
32
|
+
} else if (e.keyCode === 13 && isActive) {
|
33
|
+
onSubmitClick();
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
render() {
|
38
|
+
let {
|
39
|
+
onSubmitClick,
|
40
|
+
onCancelClick,
|
41
|
+
alertData,
|
42
|
+
isActive,
|
43
|
+
palette,
|
44
|
+
type
|
45
|
+
} = this.props;
|
46
|
+
let {
|
47
|
+
iconName,
|
48
|
+
iconSize,
|
49
|
+
title,
|
50
|
+
message,
|
51
|
+
confirmationMessage,
|
52
|
+
submitText,
|
53
|
+
cancelText,
|
54
|
+
isBoldIcon
|
55
|
+
} = alertData;
|
56
|
+
return (
|
57
|
+
<FreezeLayer
|
58
|
+
zIndex="7"
|
59
|
+
isActive={isActive}
|
60
|
+
animationName="fadeIn"
|
61
|
+
childAnimationName="scaleIn"
|
62
|
+
align="both"
|
63
|
+
>
|
64
|
+
<div className={`${style[palette]}`}>
|
65
|
+
<div className={style.container}>
|
66
|
+
<div className={style.header}>
|
67
|
+
<span className={style.icon}>
|
68
|
+
{iconName === "splitNew" ? (
|
69
|
+
<TicketsFontIcon
|
70
|
+
name={iconName}
|
71
|
+
size="14"
|
72
|
+
isBold={isBoldIcon}
|
73
|
+
/>
|
74
|
+
) : iconName === "taskDemo" ? (
|
75
|
+
<TopbandFontIcon
|
76
|
+
name={iconName}
|
77
|
+
size={iconSize ? iconSize : "15"}
|
78
|
+
isBold={isBoldIcon}
|
79
|
+
/>
|
80
|
+
) : (
|
81
|
+
<CommonFontIcon
|
82
|
+
name={iconName || ""}
|
83
|
+
size={iconSize ? iconSize : "15"}
|
84
|
+
isBold={isBoldIcon}
|
85
|
+
/>
|
86
|
+
)}
|
87
|
+
</span>
|
88
|
+
<span className={style.title}>{title}</span>
|
89
|
+
</div>
|
90
|
+
<div className={style.middle}>
|
91
|
+
<div dangerouslySetInnerHTML={{ __html: message }} />
|
92
|
+
{confirmationMessage && (
|
93
|
+
<div className={style.text}>{confirmationMessage}</div>
|
94
|
+
)}
|
95
|
+
<div className={style.footer}>
|
96
|
+
<span className={`${style.button}`}>
|
97
|
+
<Button
|
98
|
+
text={submitText}
|
99
|
+
palette={
|
100
|
+
palette === "success" ? "primaryFilled" : "dangerFilled"
|
101
|
+
}
|
102
|
+
onClick={onSubmitClick}
|
103
|
+
/>
|
104
|
+
</span>
|
105
|
+
{type === "confirmation" && (
|
106
|
+
<span className={`${style.button}`}>
|
107
|
+
<Button
|
108
|
+
text={cancelText}
|
109
|
+
palette="secondary"
|
110
|
+
onClick={onCancelClick}
|
111
|
+
/>
|
112
|
+
</span>
|
113
|
+
)}
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
</FreezeLayer>
|
119
|
+
);
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
Alert.propTypes = {
|
124
|
+
alertData: PropTypes.object,
|
125
|
+
isActive: PropTypes.bool,
|
126
|
+
onCancelClick: PropTypes.func,
|
127
|
+
onSubmitClick: PropTypes.func,
|
128
|
+
palette: PropTypes.oneOf(["success", "danger"]),
|
129
|
+
type: PropTypes.oneOf(["alert", "confirmation"])
|
130
|
+
};
|
131
|
+
Alert.defaultProps = {
|
132
|
+
isActive: false,
|
133
|
+
palette: "danger"
|
134
|
+
};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
.container {
|
2
|
+
background-color: var(--zd_bg_pure);
|
3
|
+
border-radius: var(--zd_size2);
|
4
|
+
width: var(--zd_size430);
|
5
|
+
}
|
6
|
+
.header {
|
7
|
+
text-transform: capitalize;
|
8
|
+
padding: var(--zd_size12) var(--zd_size20);
|
9
|
+
box-shadow: 0 0 var(--zd_size3) 0 var(--zd_shadow_smoke36);
|
10
|
+
display: -webkit-box;
|
11
|
+
display: -ms-flexbox;
|
12
|
+
display: flex;
|
13
|
+
-webkit-box-orient: horizontal;
|
14
|
+
-webkit-box-direction: normal;
|
15
|
+
-webkit-flex-direction: row;
|
16
|
+
-ms-flex-direction: row;
|
17
|
+
flex-direction: row;
|
18
|
+
-webkit-box-align: center;
|
19
|
+
-ms-flex-align: center;
|
20
|
+
align-items: center;
|
21
|
+
}
|
22
|
+
.danger .header {
|
23
|
+
background-color: var(--zd_bg_danger5);
|
24
|
+
color: var(--zd_text_danger4);
|
25
|
+
}
|
26
|
+
.success .header {
|
27
|
+
background-color: var(--zd_bg_primarytrans2);
|
28
|
+
color: var(--zd_text_prime);
|
29
|
+
}
|
30
|
+
.icon {
|
31
|
+
margin-right: var(--zd_size10);
|
32
|
+
font-size: 0;
|
33
|
+
}
|
34
|
+
.danger .icon {
|
35
|
+
color: var(--zd_text_danger4);
|
36
|
+
}
|
37
|
+
.success .icon {
|
38
|
+
color: var(--zd_text_prime);
|
39
|
+
}
|
40
|
+
.title {
|
41
|
+
-webkit-box-flex: 1;
|
42
|
+
-ms-flex-positive: 1;
|
43
|
+
flex-grow: 1;
|
44
|
+
min-height: 0;
|
45
|
+
min-width: 0;
|
46
|
+
white-space: nowrap;
|
47
|
+
word-wrap: normal;
|
48
|
+
overflow: hidden;
|
49
|
+
text-overflow: ellipsis;
|
50
|
+
font-size: var(--zd_size15);
|
51
|
+
}
|
52
|
+
|
53
|
+
.middle {
|
54
|
+
padding: var(--zd_size30) var(--zd_size20) var(--zd_size20);
|
55
|
+
line-height: var(--zd_size25);
|
56
|
+
color: var(--zd_text_dark4);
|
57
|
+
font-size: var(--zd_size15);
|
58
|
+
word-break: break-word;
|
59
|
+
}
|
60
|
+
.text {
|
61
|
+
margin-top: var(--zd_size20);
|
62
|
+
}
|
63
|
+
.footer {
|
64
|
+
margin-top: var(--zd_size20);
|
65
|
+
}
|
66
|
+
|
67
|
+
.button {
|
68
|
+
margin-right: var(--zd_size20);
|
69
|
+
display: inline-block;
|
70
|
+
}
|
71
|
+
|
72
|
+
html[dir="rtl"] .button {
|
73
|
+
margin-right: 0;
|
74
|
+
margin-left: var(--zd_size20);
|
75
|
+
}
|
76
|
+
html[dir="rtl"] .icon {
|
77
|
+
margin-left: var(--zd_size10);
|
78
|
+
margin-right: 0;
|
79
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
.container {
|
2
|
+
top: 0;
|
3
|
+
left: 0;
|
4
|
+
bottom: 0;
|
5
|
+
right: 0;
|
6
|
+
position: absolute;
|
7
|
+
}
|
8
|
+
.default {
|
9
|
+
background-color: rgba(0, 0, 0, 0.7);
|
10
|
+
}
|
11
|
+
.dark {
|
12
|
+
background-color: rgba(0, 0, 0, 0.9);
|
13
|
+
}
|
14
|
+
.darkLight {
|
15
|
+
background-color: var(--zd_bg_dark16);
|
16
|
+
}
|
17
|
+
.plain {
|
18
|
+
background-color: transparent;
|
19
|
+
}
|
20
|
+
.snow {
|
21
|
+
background-color: rgba(30, 38, 51, 0.4);
|
22
|
+
}
|
23
|
+
.index3 {
|
24
|
+
z-index: 3;
|
25
|
+
}
|
26
|
+
.index5 {
|
27
|
+
z-index: 5;
|
28
|
+
}
|
29
|
+
.index7 {
|
30
|
+
z-index: 7;
|
31
|
+
}
|
32
|
+
.index10 {
|
33
|
+
z-index: 10;
|
34
|
+
}
|
35
|
+
.delay {
|
36
|
+
transition-delay: 0.2s;
|
37
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import React, { Component } from "react";
|
2
|
+
import PropTypes from "prop-types";
|
3
|
+
|
4
|
+
import style from "./FreezeLayer.css";
|
5
|
+
import { Container, Animation } from "@zohodesk/components";
|
6
|
+
export default class FreezeLayer extends Component {
|
7
|
+
constructor(props) {
|
8
|
+
super(props);
|
9
|
+
this.state = { isActive: props.isActive, isChildActive: false };
|
10
|
+
this.toggleChild = this.toggleChild.bind(this);
|
11
|
+
}
|
12
|
+
|
13
|
+
toggleChild() {
|
14
|
+
this.setState({ isChildActive: !this.state.isChildActive });
|
15
|
+
}
|
16
|
+
|
17
|
+
render() {
|
18
|
+
let {
|
19
|
+
children,
|
20
|
+
align,
|
21
|
+
childAnimationName,
|
22
|
+
palette,
|
23
|
+
onClick,
|
24
|
+
animationName,
|
25
|
+
zIndex,
|
26
|
+
isActive
|
27
|
+
} = this.props;
|
28
|
+
let { isChildActive } = this.state;
|
29
|
+
return (
|
30
|
+
<Animation
|
31
|
+
name={animationName}
|
32
|
+
isActive={isActive}
|
33
|
+
onExit={this.toggleChild}
|
34
|
+
onEntered={this.toggleChild}
|
35
|
+
delayClassName={childAnimationName ? style.delay : ""}
|
36
|
+
exitDuration={childAnimationName && 500}
|
37
|
+
>
|
38
|
+
<div
|
39
|
+
className={`
|
40
|
+
${style.container} ${style[`index${zIndex}`]} ${style[palette]}
|
41
|
+
`}
|
42
|
+
onClick={onClick ? onClick : null}
|
43
|
+
>
|
44
|
+
{children && (
|
45
|
+
<Container alignBox="row" align={align}>
|
46
|
+
{childAnimationName ? (
|
47
|
+
<Animation name={childAnimationName} isActive={isChildActive}>
|
48
|
+
{children}
|
49
|
+
</Animation>
|
50
|
+
) : (
|
51
|
+
children
|
52
|
+
)}
|
53
|
+
</Container>
|
54
|
+
)}
|
55
|
+
</div>
|
56
|
+
</Animation>
|
57
|
+
);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
FreezeLayer.propTypes = {
|
61
|
+
align: PropTypes.oneOf(["horizontal", "vertical", "both"]),
|
62
|
+
animationName: PropTypes.oneOf([
|
63
|
+
"zoomIn",
|
64
|
+
"scaleIn",
|
65
|
+
"fadeIn",
|
66
|
+
"slideLeft",
|
67
|
+
"slideDown",
|
68
|
+
"skewIn",
|
69
|
+
"default",
|
70
|
+
"none"
|
71
|
+
]),
|
72
|
+
childAnimationName: PropTypes.string,
|
73
|
+
children: PropTypes.node,
|
74
|
+
isActive: PropTypes.bool,
|
75
|
+
onClick: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
76
|
+
palette: PropTypes.oneOf(["dark", "default", "darkLight", "plain", "snow"]),
|
77
|
+
zIndex: PropTypes.oneOf(["3", "5", "7", "10"])
|
78
|
+
};
|
79
|
+
FreezeLayer.defaultProps = {
|
80
|
+
animationName: "default",
|
81
|
+
isActive: false,
|
82
|
+
palette: "default",
|
83
|
+
zIndex: "5"
|
84
|
+
};
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React, { Component } from "react";
|
2
|
+
import PropTypes from "prop-types";
|
3
|
+
import { URL_PREFIX } from "../../util/Common";
|
4
|
+
import { Button, Container, Box, Switch } from "@zohodesk/components";
|
5
|
+
import Card, {
|
6
|
+
CardHeader,
|
7
|
+
CardContent
|
8
|
+
} from "@zohodesk/components/lib/Card/Card";
|
9
|
+
import style from "./Sample.module.css";
|
10
|
+
|
11
|
+
/**
|
12
|
+
* BlockList
|
13
|
+
*/
|
14
|
+
class SampleList extends Component {
|
15
|
+
constructor(props) {
|
16
|
+
super(props);
|
17
|
+
}
|
18
|
+
render() {
|
19
|
+
let { samples = {} } = this.props;
|
20
|
+
|
21
|
+
samples = samples.map((sample, index) => {
|
22
|
+
const { id, name, status } = sample;
|
23
|
+
const url = `${URL_PREFIX}/block/${id}`;
|
24
|
+
const editUrl = `${URL_PREFIX}/block/${id}/edit`;
|
25
|
+
|
26
|
+
return (
|
27
|
+
<div key={id} className={style.listItem}>
|
28
|
+
{id}-{name}
|
29
|
+
</div>
|
30
|
+
);
|
31
|
+
});
|
32
|
+
|
33
|
+
if (samples.length === 0) {
|
34
|
+
samples = <div>There is no samples</div>;
|
35
|
+
}
|
36
|
+
return (
|
37
|
+
<Card isScrollAttribute={true}>
|
38
|
+
<CardHeader>
|
39
|
+
<div className={style.addButtonContainer}>
|
40
|
+
<Button
|
41
|
+
palette="primaryFilled"
|
42
|
+
size="medium"
|
43
|
+
text="Add Sample"
|
44
|
+
onClick={this.goAddForm}
|
45
|
+
/>
|
46
|
+
</div>
|
47
|
+
</CardHeader>
|
48
|
+
<CardContent isScrollAttribute={true} scroll="vertical">
|
49
|
+
<div className={style.listContainer}>{samples}</div>
|
50
|
+
</CardContent>
|
51
|
+
</Card>
|
52
|
+
);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
SampleList.propTypes = {
|
57
|
+
push: PropTypes.func,
|
58
|
+
samples: PropTypes.object
|
59
|
+
};
|
60
|
+
|
61
|
+
export default SampleList;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
.container {
|
2
|
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.176);
|
3
|
+
background-color: var(--zd_bg_pure);
|
4
|
+
right: 0;
|
5
|
+
top: 0;
|
6
|
+
bottom: 0;
|
7
|
+
position: absolute;
|
8
|
+
z-index: 5;
|
9
|
+
overflow: auto;
|
10
|
+
}
|
11
|
+
.xsmall {
|
12
|
+
width: 360px;
|
13
|
+
}
|
14
|
+
.small {
|
15
|
+
width: 410px;
|
16
|
+
}
|
17
|
+
.medium {
|
18
|
+
width: 660px;
|
19
|
+
}
|
20
|
+
.large {
|
21
|
+
width: 936px;
|
22
|
+
}
|
23
|
+
|
24
|
+
.close a,
|
25
|
+
.close input,
|
26
|
+
.close textarea,
|
27
|
+
.close button,
|
28
|
+
.close iframe {
|
29
|
+
display: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
@media only screen and (max-width: 22.5em) {
|
33
|
+
.container {
|
34
|
+
width: 100%;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
html[dir="rtl"] .container {
|
39
|
+
left: 0;
|
40
|
+
right: initial;
|
41
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import PropTypes from "prop-types";
|
3
|
+
import style from "./Slider.css";
|
4
|
+
import FreezeLayer from "../FreezeLayer/FreezeLayer";
|
5
|
+
|
6
|
+
import { Animation } from "@zohodesk/components";
|
7
|
+
export default class Slider extends React.Component {
|
8
|
+
render() {
|
9
|
+
let { children, needFreeze, isActive, onClick, palette, size } = this.props;
|
10
|
+
return needFreeze ? (
|
11
|
+
<FreezeLayer
|
12
|
+
onClick={onClick}
|
13
|
+
isActive={isActive}
|
14
|
+
animationName="fadeIn"
|
15
|
+
childAnimationName="slideLeft"
|
16
|
+
palette={palette}
|
17
|
+
>
|
18
|
+
<div
|
19
|
+
className={`${style.container} ${isActive ? "" : style.close} ${
|
20
|
+
style[size]
|
21
|
+
}`}
|
22
|
+
onClick={e => {
|
23
|
+
e.stopPropagation();
|
24
|
+
}}
|
25
|
+
>
|
26
|
+
{children}
|
27
|
+
</div>
|
28
|
+
</FreezeLayer>
|
29
|
+
) : (
|
30
|
+
<Animation isActive={isActive} name="slideLeft">
|
31
|
+
<div
|
32
|
+
className={`${style.container} ${style[size]}`}
|
33
|
+
onClick={e => {
|
34
|
+
e.stopPropagation();
|
35
|
+
}}
|
36
|
+
>
|
37
|
+
{children}
|
38
|
+
</div>
|
39
|
+
</Animation>
|
40
|
+
);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
Slider.propTypes = {
|
44
|
+
children: PropTypes.node,
|
45
|
+
isActive: PropTypes.bool,
|
46
|
+
needFreeze: PropTypes.bool,
|
47
|
+
onClick: PropTypes.func,
|
48
|
+
palette: PropTypes.oneOf(["dark", "default", "darkLight", "plain"]),
|
49
|
+
size: PropTypes.oneOf(["small", "xsmall", "medium", "large"])
|
50
|
+
};
|
51
|
+
Slider.defaultProps = {
|
52
|
+
isActive: false,
|
53
|
+
palette: "default",
|
54
|
+
size: "xsmall"
|
55
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { connect } from "react-redux";
|
2
|
+
import Alert from "../../components/Alert/Alert";
|
3
|
+
import { alertAction } from "../../actions/index.js";
|
4
|
+
|
5
|
+
function mapStateToProps() {
|
6
|
+
return {
|
7
|
+
onSubmitClick: alertAction.ob.resolve,
|
8
|
+
onCancelClick: alertAction.ob.reject
|
9
|
+
};
|
10
|
+
}
|
11
|
+
|
12
|
+
export default connect(
|
13
|
+
mapStateToProps,
|
14
|
+
{}
|
15
|
+
)(Alert);
|