Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove momentJS#333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
FalkWolsky merged 6 commits intolowcoder-org:mainfromraheeliftikhar5:remove-moment
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ import {
booleanExposingStateControl,
}from"comps/controls/codeStateControl";

import{getMomentLocale}from"i18n/momentLocale";
import{getDayJSLocale}from"i18n/dayjsLocale";
import{
autoCompleteDate,
itemsDataTooltip,
Expand DownExpand Up@@ -151,7 +151,7 @@ let AutoCompleteCompBase = (function () {
const[validateState,setvalidateState]=useState({});

// 是否中文环境
const[chineseEnv,setChineseEnv]=useState(getMomentLocale()==="zh-cn");
const[chineseEnv,setChineseEnv]=useState(getDayJSLocale()==="zh-cn");

useEffect(()=>{
setsearchtext(props.value.value);
Expand DownExpand Up@@ -346,11 +346,11 @@ let AutoCompleteCompBase = (function () {
tooltip:itemsDataTooltip,
placeholder:"[]",
})}
{getMomentLocale()==="zh-cn"&&
{getDayJSLocale()==="zh-cn"&&
children.searchFirstPY.propertyView({
label:trans("autoComplete.searchFirstPY"),
})}
{getMomentLocale()==="zh-cn"&&
{getDayJSLocale()==="zh-cn"&&
children.searchCompletePY.propertyView({
label:trans("autoComplete.searchCompletePY"),
})}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,9 +88,9 @@ const multiSelectComps: CompConfig[] = [
constdateComp:CompConfig={
type:"date",
};
// TODO: RAHEEL

functiondateTimeToTimestamp(compName:string){
return"moment("+compName+".value || 0).valueOf()";
return"dayjs("+compName+".value || 0).valueOf()";
}
functiondateTimeComp(toTimestamp?:boolean):CompConfig{
return{
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ export function hookToStateComp(useHookFn: () => JSONObject) {
}

/**
* Provide a comp of static data, such as exposure of lodash,moment library
* Provide a comp of static data, such as exposure of lodash,day.js library
*/
exportfunctionsimpleValueComp(value:any){
returnsimpleValueGetterComp(()=>value);
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
/**
* Hooks for managing dependencies
* lodash andmoment are supported by default
* lodash anddayJS are supported by default
*/
exportconstDependecyHook=null;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -125,7 +125,7 @@ let TmpDrawerComp = (function () {
<Drawer
resizable={resizable}
onResizeStop={onResizeStop}
style={props.visible.value ?{overflow:"auto",pointerEvents:"auto"} :{}}
rootStyle={props.visible.value ?{overflow:"auto",pointerEvents:"auto"} :{}}
contentWrapperStyle={{maxHeight:"100%",maxWidth:"100%"}}
bodyStyle={{padding:0,backgroundColor:props.style.background}}
closable={false}
Expand Down
2 changes: 1 addition & 1 deletionclient/packages/lowcoder/src/comps/hooks/hookComp.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,7 +85,7 @@ const HookMap: HookCompMapRawType = {
currentTime:CurrentTimeHookComp,
lodashJsLib:LodashJsLib,
dayJsLib:DayJsLib,
momentJsLib:DayJsLib,
momentJsLib:DayJsLib,// old components use this hook
utils:UtilsComp,
message:MessageComp,
localStorage:LocalStorageComp,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@ const defaultHookListValue = [
// { compType: "windowSize", name: "windowSize" },
{compType:"urlParams",name:"url"},
{compType:"dayJsLib",name:"dayjs"},
// { compType: "momentJsLib", name: "dayjs" },
{compType:"lodashJsLib",name:"_"},
{compType:"utils",name:"utils"},
{compType:"message",name:"message"},
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import{language}from"i18n";

exportfunctiongetMomentLocale(){
exportfunctiongetDayJSLocale(){
switch(language){
case"zh":
return"zh-cn";
Expand Down
4 changes: 2 additions & 2 deletionsclient/packages/lowcoder/src/i18n/locales/en.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1700,7 +1700,7 @@ export const en = {
preloadCSSApply:"Apply to the homepage of the workspace",
preloadLibsTitle:"JavaScript library",
preloadLibsHelp:
"Set up preloaded JavaScript libraries for all applications in the current workspace, and the system has built-in lodash,moment, uuid, numbro for direct use. JavaScript libraries are loaded before the app is initialized, so there is a certain impact on app performance.",
"Set up preloaded JavaScript libraries for all applications in the current workspace, and the system has built-in lodash,day.js, uuid, numbro for direct use. JavaScript libraries are loaded before the app is initialized, so there is a certain impact on app performance.",
preloadLibsEmpty:"No JavaScript libraries were added",
preloadLibsAddBtn:"Add a library",
saveSuccess:"Saved successfully",
Expand DownExpand Up@@ -1962,7 +1962,7 @@ export const en = {
},
preLoad:{
jsLibraryHelpText:
"Add JavaScript libraries to your current application via URL addresses. lodash,moment, uuid, numbro are built into the system for immediate use. JavaScript libraries are loaded before the application is initialized, which can have an impact on application performance.",
"Add JavaScript libraries to your current application via URL addresses. lodash,day.js, uuid, numbro are built into the system for immediate use. JavaScript libraries are loaded before the application is initialized, which can have an impact on application performance.",
exportedAs:"Exported as",
urlTooltip:
"URL address of the JavaScript library, [unpkg.com](https://unpkg.com/) or [jsdelivr.net](https://www.jsdelivr.com/) is recommended",
Expand Down
4 changes: 2 additions & 2 deletionsclient/packages/lowcoder/src/i18n/locales/zh.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1677,7 +1677,7 @@ advanced: {
preloadCSSApply:"应用到工作空间的首页",
preloadLibsTitle:"JavaScript 库",
preloadLibsHelp:
"为当前工作空间中的所有应用程序设置预加载的 JavaScript 库,系统内置了 lodash、moment、uuid、numbro 可供直接使用.JavaScript 库在应用程序初始化之前加载,因此对应用程序性能有一定影响.",
"为当前工作空间中的所有应用程序设置预加载的 JavaScript 库,系统内置了 lodash、day.js、uuid、numbro 可供直接使用.JavaScript 库在应用程序初始化之前加载,因此对应用程序性能有一定影响.",
preloadLibsEmpty:"尚未添加 JavaScript 库",
preloadLibsAddBtn:"添加库",
saveSuccess:"保存成功",
Expand DownExpand Up@@ -1935,7 +1935,7 @@ userAuth: {
copyPassword:"复制密码",
},
preLoad:{
jsLibraryHelpText:"通过URL链接向当前应用程序添加JavaScript库.lodash、moment、uuid、numbro内置于系统中,可立即使用.JavaScript库在应用程序初始化之前加载,这可能会影响应用程序的性能.",
jsLibraryHelpText:"通过URL链接向当前应用程序添加JavaScript库.lodash、day.js、uuid、numbro内置于系统中,可立即使用.JavaScript库在应用程序初始化之前加载,这可能会影响应用程序的性能.",
exportedAs:"导出为",
urlTooltip:"JavaScript库的URL链接,建议使用[unpkg.com](https://unpkg.com/)或[jsdelivr.net](https://www.jsdelivr.com/).",
recommended:"推荐",
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -285,7 +285,7 @@ export default function BottomMetaDrawer(props: BottomMetaDrawerProps) {
boxShadow:"none",
borderRadius:"0",
}}
style={{
rootStyle={{
position:"absolute",
height:"100%",
bottom:0,
Expand Down
4 changes: 2 additions & 2 deletionsclient/packages/lowcoder/src/util/commonUtils.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
importlog,{LogLevelDesc}from"loglevel";
importdayjsfrom"dayjs";
import{getMomentLocale}from"i18n/momentLocale";
import{getDayJSLocale}from"i18n/dayjsLocale";
import_from"lodash";

// https://github.com/vitejs/vite/discussions/7492#discussioncomment-2449310
import"dayjs/locale/en-gb";
import"dayjs/locale/zh-cn";

exportfunctioninitApp(){
dayjs.locale(getMomentLocale());
dayjs.locale(getDayJSLocale());
constlogLevel=getEnvLogLevel();
log.setLevel(logLevel);
}
Expand Down
2 changes: 1 addition & 1 deletiondocs/build-apps/use-third-party-libraries.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@ Lowcoder provides some JavaScript built-in libraries for use.
| Library| Docs| Version|
| ---------| --------------------------------------------------------------------| --------------------------|
| lodash|[https://lodash.com/docs/](https://lodash.com/docs/)| 4.17.21|
|moment|[https://momentjs.com/docs/](https://momentjs.com/docs/)| 2.29.3|
|day.js|[https://day.js.org/docs](https://day.js.org/docs/)| 2.29.3|
| uuid|[https://github.com/uuidjs/uuid](https://github.com/uuidjs/uuid)| 8.3.2(Support v1/v3/v4/v5)|
| numbro|[https://numbrojs.com/format.html](https://numbrojs.com/format.html)| 2.3.6|
| papaparse|[https://www.papaparse.com/docs](https://www.papaparse.com/docs)| 5.3.2|
Expand Down
4 changes: 2 additions & 2 deletionsdocs/build-apps/write-javascript/javascript-query.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -188,9 +188,9 @@ function isMultiple(num1, num2) {
return num1 % num2 === 0;
}
// Call themoment library to return the current date
// Call theday.js library to return the current date
function getCurrentDate() {
returnmoment().format("YYYY-MM-DD");
returndayjs().format("YYYY-MM-DD");
}
```
Expand Down
4 changes: 2 additions & 2 deletionsdocs/build-apps/write-javascript/transformers.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,13 +24,13 @@ In the following example, `transformer1` uses the data of star rating in `rating

###Transform timestamp

Use the`moment().format()` method to transform timestamp formats. The following example converts the timestamp value of`start_time` returned by`query1` to`YYYY-MM-DD` format.
Use the`dayjs().format()` method to transform timestamp formats. The following example converts the timestamp value of`start_time` returned by`query1` to`YYYY-MM-DD` format.

```javascript
returnquery1.data.map(it=> {
return {
...it,
start_time:moment(it.start_time).format('YYYY-MM-DD')
start_time:dayjs(it.start_time).format('YYYY-MM-DD')
};
})
```
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,7 @@ Lowercase a string.
Change date format.

```javascript
{{moment(table1.selectedRow.date_column).format('YYYY-MM-DD')}}
{{dayjs(table1.selectedRow.date_column).format('YYYY-MM-DD')}}
```

Return name from query results.
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp