69 changed files with 2470 additions and 692 deletions
@ -0,0 +1,21 @@ |
|||||
|
package io.sc.engine.rule.core.function; |
||||
|
|
||||
|
import io.sc.platform.util.CollectionUtil; |
||||
|
|
||||
|
public class CollectionFunction { |
||||
|
public static boolean hasElements(Object object){ |
||||
|
return CollectionUtil.hasElements(object); |
||||
|
} |
||||
|
|
||||
|
public static int collectionSize(Object object){ |
||||
|
return CollectionUtil.size(object); |
||||
|
} |
||||
|
|
||||
|
public static Object collectionMax(Object object){ |
||||
|
return CollectionUtil.max(object); |
||||
|
} |
||||
|
|
||||
|
public static Object collectionMin(Object object){ |
||||
|
return CollectionUtil.min(object); |
||||
|
} |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>collectionMax</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>c</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>collectionMax</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>c</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('collectionMax(c)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,44 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>collectionMin</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>c</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>collectionMin</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>c</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('collectionMin(c)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,44 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>collectionSize</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>c</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>collectionSize</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>c</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('collectionSize(c)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,173 @@ |
|||||
|
<template> |
||||
|
<q-item clickable> |
||||
|
<q-item-section> |
||||
|
<q-item-label>{{ $t('math.toolbar.functions.date.format') }}</q-item-label> |
||||
|
</q-item-section> |
||||
|
<q-item-section side> |
||||
|
<q-icon name="keyboard_arrow_right" /> |
||||
|
</q-item-section> |
||||
|
|
||||
|
<q-menu anchor="top end" self="top start"> |
||||
|
<q-list dense> |
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.formatDate')" |
||||
|
draggable="true" |
||||
|
@dragstart="formatDate_Ref?.dragstart" |
||||
|
@click="formatDate_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<formatDate ref="formatDate_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></formatDate> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
|
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.yyyy_MM_dd_HH_mm_ss_SSS')" |
||||
|
draggable="true" |
||||
|
@dragstart="yyyy_MM_dd_HH_mm_ss_SSS_Ref?.dragstart" |
||||
|
@click="yyyy_MM_dd_HH_mm_ss_SSS_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<yyyy_MM_dd_HH_mm_ss_SSS ref="yyyy_MM_dd_HH_mm_ss_SSS_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></yyyy_MM_dd_HH_mm_ss_SSS> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
|
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.yyyy_MM_dd_HH_mm_ss')" |
||||
|
draggable="true" |
||||
|
@dragstart="yyyy_MM_dd_HH_mm_ss_Ref?.dragstart" |
||||
|
@click="yyyy_MM_dd_HH_mm_ss_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<yyyy_MM_dd_HH_mm_ss ref="yyyy_MM_dd_HH_mm_ss_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></yyyy_MM_dd_HH_mm_ss> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
|
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.yyyy_MM_dd_HH_mm')" |
||||
|
draggable="true" |
||||
|
@dragstart="yyyy_MM_dd_HH_mm_Ref?.dragstart" |
||||
|
@click="yyyy_MM_dd_HH_mm_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<yyyy_MM_dd_HH_mm ref="yyyy_MM_dd_HH_mm_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></yyyy_MM_dd_HH_mm> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
|
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.yyyy_MM_dd_HH')" |
||||
|
draggable="true" |
||||
|
@dragstart="yyyy_MM_dd_HH_Ref?.dragstart" |
||||
|
@click="yyyy_MM_dd_HH_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<yyyy_MM_dd_HH ref="yyyy_MM_dd_HH_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></yyyy_MM_dd_HH> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
|
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.yyyy_MM_dd')" |
||||
|
draggable="true" |
||||
|
@dragstart="yyyy_MM_dd_Ref?.dragstart" |
||||
|
@click="yyyy_MM_dd_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<yyyy_MM_dd ref="yyyy_MM_dd_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></yyyy_MM_dd> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
|
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.yyyyMMdd')" |
||||
|
draggable="true" |
||||
|
@dragstart="yyyyMMdd_Ref?.dragstart" |
||||
|
@click="yyyyMMdd_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<yyyyMMdd ref="yyyyMMdd_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></yyyyMMdd> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
|
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.yyyy_MM')" |
||||
|
draggable="true" |
||||
|
@dragstart="yyyy_MM_Ref?.dragstart" |
||||
|
@click="yyyy_MM_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<yyyy_MM ref="yyyy_MM_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></yyyy_MM> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
|
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.yyyyMM')" |
||||
|
draggable="true" |
||||
|
@dragstart="yyyyMM_Ref?.dragstart" |
||||
|
@click="yyyyMM_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<yyyyMM ref="yyyyMM_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></yyyyMM> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
|
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.format.yyyy')" |
||||
|
draggable="true" |
||||
|
@dragstart="yyyy_Ref?.dragstart" |
||||
|
@click="yyyy_Ref?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<yyyy ref="yyyy_Ref" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></yyyy> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
</q-list> |
||||
|
</q-menu> |
||||
|
</q-item> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue'; |
||||
|
import formatDate from './formatDate.vue'; |
||||
|
import yyyy_MM_dd_HH_mm_ss_SSS from './yyyy_MM_dd_HH_mm_ss_SSS.vue'; |
||||
|
import yyyy_MM_dd_HH_mm_ss from './yyyy_MM_dd_HH_mm_ss.vue'; |
||||
|
import yyyy_MM_dd_HH_mm from './yyyy_MM_dd_HH_mm.vue'; |
||||
|
import yyyy_MM_dd_HH from './yyyy_MM_dd_HH.vue'; |
||||
|
import yyyy_MM_dd from './yyyy_MM_dd.vue'; |
||||
|
import yyyyMMdd from './yyyyMMdd.vue'; |
||||
|
import yyyy_MM from './yyyy_MM.vue'; |
||||
|
import yyyyMM from './yyyyMM.vue'; |
||||
|
import yyyy from './yyyy.vue'; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const formatDate_Ref = ref(); |
||||
|
const yyyy_MM_dd_HH_mm_ss_SSS_Ref = ref(); |
||||
|
const yyyy_MM_dd_HH_mm_ss_Ref = ref(); |
||||
|
const yyyy_MM_dd_HH_mm_Ref = ref(); |
||||
|
const yyyy_MM_dd_HH_Ref = ref(); |
||||
|
const yyyy_MM_dd_Ref = ref(); |
||||
|
const yyyyMMdd_Ref = ref(); |
||||
|
const yyyy_MM_Ref = ref(); |
||||
|
const yyyyMM_Ref = ref(); |
||||
|
const yyyy_Ref = ref(); |
||||
|
</script> |
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>formatDate</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mo>,</mo> |
||||
|
<mi>f</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>formatDate</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mo>,</mo> |
||||
|
<mspace></mspace> |
||||
|
<mi>f</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('formatDate(d,f)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,46 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>yyyy</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>yyyy</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yyyy(d)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,46 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>yyyyMM</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>yyyyMM</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yyyyMM(d)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,46 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>yyyyMMdd</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>yyyyMMdd</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yyyyMMdd(d)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,46 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yyyy_MM(d)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,46 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yyyy_MM_dd(d)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,46 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd_HH</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd_HH</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yyyy_MM_dd_HH(d)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,46 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd_HH_mm</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd_HH_mm</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yyyy_MM_dd_HH_mm(d)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,46 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd_HH_mm_ss</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd_HH_mm_ss</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yyyy_MM_dd_HH_mm_ss(d)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,46 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd_HH_mm_ss_SSS</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>d</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>yyyy_MM_dd_HH_mm_ss_SSS</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>d</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yyyy_MM_dd_HH_mm_ss_SSS(d)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,122 @@ |
|||||
|
<template> |
||||
|
<q-item clickable> |
||||
|
<q-item-section> |
||||
|
<q-item-label>{{ $t('math.toolbar.functions.date.plus') }}</q-item-label> |
||||
|
</q-item-section> |
||||
|
<q-item-section side> |
||||
|
<q-icon name="keyboard_arrow_right" /> |
||||
|
</q-item-section> |
||||
|
|
||||
|
<q-menu anchor="top end" self="top start"> |
||||
|
<q-list dense> |
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.plus.plusYears')" |
||||
|
draggable="true" |
||||
|
@dragstart="plusYearsRef?.dragstart" |
||||
|
@click="plusYearsRef?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<PlusYears ref="plusYearsRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></PlusYears> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.plus.plusMonths')" |
||||
|
draggable="true" |
||||
|
@dragstart="plusMonthsRef?.dragstart" |
||||
|
@click="plusMonthsRef?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<PlusMonths ref="plusMonthsRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></PlusMonths> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.plus.plusWeeks')" |
||||
|
draggable="true" |
||||
|
@dragstart="plusWeeksRef?.dragstart" |
||||
|
@click="plusWeeksRef?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<PlusWeeks ref="plusWeeksRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></PlusWeeks> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.plus.plusDays')" |
||||
|
draggable="true" |
||||
|
@dragstart="plusDaysRef?.dragstart" |
||||
|
@click="plusDaysRef?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<PlusDays ref="plusDaysRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></PlusDays> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.plus.plusHours')" |
||||
|
draggable="true" |
||||
|
@dragstart="plusHoursRef?.dragstart" |
||||
|
@click="plusHoursRef?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<PlusHours ref="plusHoursRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></PlusHours> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.plus.plusMinutes')" |
||||
|
draggable="true" |
||||
|
@dragstart="plusMinutesRef?.dragstart" |
||||
|
@click="plusMinutesRef?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<PlusMinutes ref="plusMinutesRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></PlusMinutes> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
<q-item |
||||
|
v-close-popup |
||||
|
clickable |
||||
|
:title="$t('math.toolbar.functions.date.plus.plusSeconds')" |
||||
|
draggable="true" |
||||
|
@dragstart="plusSecondsRef?.dragstart" |
||||
|
@click="plusSecondsRef?.append" |
||||
|
> |
||||
|
<q-item-section> |
||||
|
<PlusSeconds ref="plusSecondsRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></PlusSeconds> |
||||
|
</q-item-section> |
||||
|
</q-item> |
||||
|
</q-list> |
||||
|
</q-menu> |
||||
|
</q-item> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue'; |
||||
|
import PlusYears from './PlusYears.vue'; |
||||
|
import PlusMonths from './PlusMonths.vue'; |
||||
|
import PlusWeeks from './PlusWeeks.vue'; |
||||
|
import PlusDays from './PlusDays.vue'; |
||||
|
import PlusHours from './PlusHours.vue'; |
||||
|
import PlusMinutes from './PlusMinutes.vue'; |
||||
|
import PlusSeconds from './PlusSeconds.vue'; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const plusYearsRef = ref(); |
||||
|
const plusMonthsRef = ref(); |
||||
|
const plusWeeksRef = ref(); |
||||
|
const plusDaysRef = ref(); |
||||
|
const plusHoursRef = ref(); |
||||
|
const plusMinutesRef = ref(); |
||||
|
const plusSecondsRef = ref(); |
||||
|
</script> |
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>plusDays</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>date</mi> |
||||
|
<mo>,</mo> |
||||
|
<mi>days</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>plusDays</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>date</mi> |
||||
|
<mspace></mspace> |
||||
|
<mo>,</mo> |
||||
|
<mspace></mspace> |
||||
|
<mi>days</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('plusDays(date,days)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>plusHours</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>date</mi> |
||||
|
<mo>,</mo> |
||||
|
<mi>hours</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>plusHours</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>date</mi> |
||||
|
<mspace></mspace> |
||||
|
<mo>,</mo> |
||||
|
<mspace></mspace> |
||||
|
<mi>hours</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('plusHours(date,hours)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>plusMinutes</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>date</mi> |
||||
|
<mo>,</mo> |
||||
|
<mi>minutes</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>plusMinutes</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>date</mi> |
||||
|
<mspace></mspace> |
||||
|
<mo>,</mo> |
||||
|
<mspace></mspace> |
||||
|
<mi>minutes</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('plusMinutes(date,minutes)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>plusMonths</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>date</mi> |
||||
|
<mo>,</mo> |
||||
|
<mi>months</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>plusMonths</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>date</mi> |
||||
|
<mspace></mspace> |
||||
|
<mo>,</mo> |
||||
|
<mspace></mspace> |
||||
|
<mi>months</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('plusMonths(date,months)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>plusSeconds</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>date</mi> |
||||
|
<mo>,</mo> |
||||
|
<mi>seconds</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>plusSeconds</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>date</mi> |
||||
|
<mspace></mspace> |
||||
|
<mo>,</mo> |
||||
|
<mspace></mspace> |
||||
|
<mi>seconds</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('plusSeconds(date,seconds)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>plusWeeks</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>date</mi> |
||||
|
<mo>,</mo> |
||||
|
<mi>weeks</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>plusWeeks</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>date</mi> |
||||
|
<mspace></mspace> |
||||
|
<mo>,</mo> |
||||
|
<mspace></mspace> |
||||
|
<mi>weeks</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('plusWeeks(date,weeks)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<span> |
||||
|
<math display="inline"> |
||||
|
<mrow> |
||||
|
<mo>plusYears</mo> |
||||
|
<mi>(</mi> |
||||
|
<mi>date</mi> |
||||
|
<mo>,</mo> |
||||
|
<mi>years</mi> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
</math> |
||||
|
</span> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
const xmlData = ` |
||||
|
<mspace></mspace> |
||||
|
<mrow> |
||||
|
<mo>plusYears</mo> |
||||
|
<mi>(</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>date</mi> |
||||
|
<mspace></mspace> |
||||
|
<mo>,</mo> |
||||
|
<mspace></mspace> |
||||
|
<mi>years</mi> |
||||
|
<mspace></mspace> |
||||
|
<mi>)</mi> |
||||
|
</mrow> |
||||
|
<mspace></mspace> |
||||
|
`; |
||||
|
|
||||
|
const modelValueRef = defineModel({ type: String, default: '' }); |
||||
|
const props = defineProps({ |
||||
|
sourceCodeEditor: { type: Object, default: undefined }, |
||||
|
}); |
||||
|
|
||||
|
const dragstart = (event: any) => { |
||||
|
event.dataTransfer.setData('math', xmlData); |
||||
|
event.dataTransfer.setDragImage(event.srcElement, 0, 0); |
||||
|
}; |
||||
|
|
||||
|
const append = () => { |
||||
|
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('plusYears(date,years)')); |
||||
|
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', ''); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
dragstart, |
||||
|
append, |
||||
|
}); |
||||
|
</script> |
@ -1,190 +0,0 @@ |
|||||
import { Tools } from '@/platform'; |
|
||||
|
|
||||
class AutoCompletionManager2 { |
|
||||
parameters: object[]; |
|
||||
valueTypes: object[]; |
|
||||
|
|
||||
public setParameters(parameters) { |
|
||||
this.parameters = parameters; |
|
||||
} |
|
||||
public setValueTypes(valueTypes) { |
|
||||
this.valueTypes = valueTypes; |
|
||||
} |
|
||||
|
|
||||
public getOptions(path: string): any { |
|
||||
if (!path) { |
|
||||
return this.getParameterOptions(); |
|
||||
} |
|
||||
if (path.endsWith('.')) { |
|
||||
path = path.substring(0, path.length - 1); |
|
||||
} |
|
||||
const names = path.split('.'); |
|
||||
if (!names) { |
|
||||
return this.getParameterOptions(); |
|
||||
} |
|
||||
//参数
|
|
||||
const parameter = this.findParmeter(names[0]); |
|
||||
if (!parameter) { |
|
||||
return null; |
|
||||
} |
|
||||
const valueTypeString = parameter.valueType; |
|
||||
const valueTypeVersion = parameter.valueTypeVersion; |
|
||||
let valueType = this.findValueType(valueTypeString, valueTypeVersion); |
|
||||
if (!valueType || !valueType.properties || valueType.properties.length <= 0) { |
|
||||
return null; |
|
||||
} |
|
||||
let index = 1; |
|
||||
let lastNameIsNotCompleted = false; |
|
||||
while (index < names.length) { |
|
||||
const _valueType = this.findValueTypeByProperty(valueType.code, valueType.version, names[index]); |
|
||||
if (_valueType) { |
|
||||
valueType = _valueType; |
|
||||
} else { |
|
||||
lastNameIsNotCompleted = true; |
|
||||
} |
|
||||
index++; |
|
||||
} |
|
||||
|
|
||||
const options = []; |
|
||||
if (lastNameIsNotCompleted) { |
|
||||
for (const property of valueType.properties) { |
|
||||
if (property.name.indexOf(names[names.length - 1]) != -1) { |
|
||||
const propertyValueType = this.findValueType(property.valueType, property.valueTypeVersion); |
|
||||
if (!propertyValueType) { |
|
||||
continue; |
|
||||
} |
|
||||
const info = propertyValueType.version ? propertyValueType.name + '(V' + propertyValueType.version + ')' : propertyValueType.name; |
|
||||
options.push({ label: property.name, type: 'property', apply: '${' + property.name + '}', info: info }); |
|
||||
} |
|
||||
} |
|
||||
return options; |
|
||||
} else { |
|
||||
for (const property of valueType.properties) { |
|
||||
const propertyValueType = this.findValueType(property.valueType, property.valueTypeVersion); |
|
||||
if (!propertyValueType) { |
|
||||
continue; |
|
||||
} |
|
||||
const info = propertyValueType.version ? propertyValueType.name + '(V' + propertyValueType.version + ')' : propertyValueType.name; |
|
||||
options.push({ label: property.name, type: 'property', apply: '${' + property.name + '}', info: info }); |
|
||||
} |
|
||||
return options; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public findParmeter(parameterName) { |
|
||||
for (const parameter of this.parameters) { |
|
||||
if (parameter.name === parameterName) { |
|
||||
return parameter; |
|
||||
} |
|
||||
} |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
public findValueType(valueTypeString, valueTypeVersion) { |
|
||||
for (const valueType of this.valueTypes) { |
|
||||
if (valueType.code === valueTypeString && valueType.version === valueTypeVersion) { |
|
||||
return valueType; |
|
||||
} |
|
||||
} |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
public findValueTypeByProperty(valueTypeString, valueTypeVersion, propertyName) { |
|
||||
const valueType = this.findValueType(valueTypeString, valueTypeVersion); |
|
||||
if (!valueType) { |
|
||||
return null; |
|
||||
} |
|
||||
for (const property of valueType.properties) { |
|
||||
if (property.name === propertyName) { |
|
||||
return this.findValueType(property.valueType, property.valueTypeVersion); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public getParameterOptions(): any { |
|
||||
const options = []; |
|
||||
for (const parameter of this.parameters) { |
|
||||
const valueType = this.findValueType(parameter.valueType, parameter.valueTypeVersion); |
|
||||
const info = valueType.version ? valueType.name + '(V' + valueType.version + ')' : valueType.name; |
|
||||
options.push({ label: parameter.name, type: 'variable', apply: '${' + parameter.name + '}', info: info }); |
|
||||
} |
|
||||
return options; |
|
||||
} |
|
||||
|
|
||||
public getPropertyOptions(parameterName: string): any { |
|
||||
let parameterType = undefined; |
|
||||
for (const parameter of this.parameters) { |
|
||||
if (parameter.name === parameterName) { |
|
||||
parameterType = parameter.valueType; |
|
||||
} |
|
||||
} |
|
||||
if (!parameterType) { |
|
||||
return null; |
|
||||
} |
|
||||
for (const type of this.valueTypes) { |
|
||||
if (type.code === parameterType) { |
|
||||
parameterType = type; |
|
||||
} |
|
||||
} |
|
||||
if (!parameterType) { |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
if (parameterType.properties && parameterType.properties.length > 0) { |
|
||||
const options = []; |
|
||||
for (const property of parameterType.properties) { |
|
||||
options.push({ label: property.name, type: 'property', apply: '${' + property.name + '}', detail: this.findValueTypeInfo(property.valueType) }); |
|
||||
} |
|
||||
return options; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public autoCompletionParameters(to, matchedText): any { |
|
||||
return { |
|
||||
from: to, |
|
||||
options: this.getParameterOptions(), |
|
||||
validFor: /(.*)?/, |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
public autoCompletionProperties(to, matchedText): any { |
|
||||
const matchedTextReverse = Tools.reverseString(matchedText); |
|
||||
const regReverse = /((.*)?\}(.+?)\{\$)+/g; //匹配 'xxx.}xxx{$' 模式
|
|
||||
const matcheds = matchedTextReverse.match(regReverse); |
|
||||
if (Tools.isUndefinedOrNull(matcheds) || matcheds.length <= 0) { |
|
||||
return null; |
|
||||
} |
|
||||
const matched = Tools.reverseString(matcheds[0]); |
|
||||
const parameterName = matched.replace(/\$\{(.+?)\}/g, '$1'); |
|
||||
console.log(parameterName); |
|
||||
if (Tools.isUndefinedOrNull(parameterName)) { |
|
||||
return null; |
|
||||
} |
|
||||
const options = this.getOptions(parameterName); |
|
||||
if (Tools.isUndefinedOrNull(options)) { |
|
||||
return null; |
|
||||
} |
|
||||
return { |
|
||||
from: to, |
|
||||
options: options, |
|
||||
//validFor: /^(.*)?$/,
|
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
public autoCompletion(context): any { |
|
||||
const beforeMatched = context.matchBefore(/(.+?)/g); |
|
||||
if (Tools.isUndefinedOrNull(beforeMatched)) { |
|
||||
return null; |
|
||||
} |
|
||||
const beforeText = beforeMatched.text || ''; |
|
||||
if (beforeText.endsWith(' ')) { |
|
||||
//匹配参数
|
|
||||
return this.autoCompletionParameters(beforeMatched.to); |
|
||||
} else { |
|
||||
//匹配属性
|
|
||||
return this.autoCompletionProperties(beforeMatched.to, beforeText); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
export { AutoCompletionManager2 }; |
|
@ -1,190 +0,0 @@ |
|||||
import { Tools } from '@/platform'; |
|
||||
|
|
||||
class AutoCompletionManager2 { |
|
||||
parameters: object[]; |
|
||||
valueTypes: object[]; |
|
||||
|
|
||||
public setParameters(parameters) { |
|
||||
this.parameters = parameters; |
|
||||
} |
|
||||
public setValueTypes(valueTypes) { |
|
||||
this.valueTypes = valueTypes; |
|
||||
} |
|
||||
|
|
||||
public getOptions(path: string): any { |
|
||||
if (!path) { |
|
||||
return this.getParameterOptions(); |
|
||||
} |
|
||||
if (path.endsWith('.')) { |
|
||||
path = path.substring(0, path.length - 1); |
|
||||
} |
|
||||
const names = path.split('.'); |
|
||||
if (!names) { |
|
||||
return this.getParameterOptions(); |
|
||||
} |
|
||||
//参数
|
|
||||
const parameter = this.findParmeter(names[0]); |
|
||||
if (!parameter) { |
|
||||
return null; |
|
||||
} |
|
||||
const valueTypeString = parameter.valueType; |
|
||||
const valueTypeVersion = parameter.valueTypeVersion; |
|
||||
let valueType = this.findValueType(valueTypeString, valueTypeVersion); |
|
||||
if (!valueType || !valueType.properties || valueType.properties.length <= 0) { |
|
||||
return null; |
|
||||
} |
|
||||
let index = 1; |
|
||||
let lastNameIsNotCompleted = false; |
|
||||
while (index < names.length) { |
|
||||
const _valueType = this.findValueTypeByProperty(valueType.code, valueType.version, names[index]); |
|
||||
if (_valueType) { |
|
||||
valueType = _valueType; |
|
||||
} else { |
|
||||
lastNameIsNotCompleted = true; |
|
||||
} |
|
||||
index++; |
|
||||
} |
|
||||
|
|
||||
const options = []; |
|
||||
if (lastNameIsNotCompleted) { |
|
||||
for (const property of valueType.properties) { |
|
||||
if (property.name.indexOf(names[names.length - 1]) != -1) { |
|
||||
const propertyValueType = this.findValueType(property.valueType, property.valueTypeVersion); |
|
||||
if (!propertyValueType) { |
|
||||
continue; |
|
||||
} |
|
||||
const info = propertyValueType.version ? propertyValueType.name + '(V' + propertyValueType.version + ')' : propertyValueType.name; |
|
||||
options.push({ label: property.name, type: 'property', apply: '${' + property.name + '}', info: info }); |
|
||||
} |
|
||||
} |
|
||||
return options; |
|
||||
} else { |
|
||||
for (const property of valueType.properties) { |
|
||||
const propertyValueType = this.findValueType(property.valueType, property.valueTypeVersion); |
|
||||
if (!propertyValueType) { |
|
||||
continue; |
|
||||
} |
|
||||
const info = propertyValueType.version ? propertyValueType.name + '(V' + propertyValueType.version + ')' : propertyValueType.name; |
|
||||
options.push({ label: property.name, type: 'property', apply: '${' + property.name + '}', info: info }); |
|
||||
} |
|
||||
return options; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public findParmeter(parameterName) { |
|
||||
for (const parameter of this.parameters) { |
|
||||
if (parameter.name === parameterName) { |
|
||||
return parameter; |
|
||||
} |
|
||||
} |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
public findValueType(valueTypeString, valueTypeVersion) { |
|
||||
for (const valueType of this.valueTypes) { |
|
||||
if (valueType.code === valueTypeString && valueType.version === valueTypeVersion) { |
|
||||
return valueType; |
|
||||
} |
|
||||
} |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
public findValueTypeByProperty(valueTypeString, valueTypeVersion, propertyName) { |
|
||||
const valueType = this.findValueType(valueTypeString, valueTypeVersion); |
|
||||
if (!valueType) { |
|
||||
return null; |
|
||||
} |
|
||||
for (const property of valueType.properties) { |
|
||||
if (property.name === propertyName) { |
|
||||
return this.findValueType(property.valueType, property.valueTypeVersion); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public getParameterOptions(): any { |
|
||||
const options = []; |
|
||||
for (const parameter of this.parameters) { |
|
||||
const valueType = this.findValueType(parameter.valueType, parameter.valueTypeVersion); |
|
||||
const info = valueType.version ? valueType.name + '(V' + valueType.version + ')' : valueType.name; |
|
||||
options.push({ label: parameter.name, type: 'variable', apply: '${' + parameter.name + '}', info: info }); |
|
||||
} |
|
||||
return options; |
|
||||
} |
|
||||
|
|
||||
public getPropertyOptions(parameterName: string): any { |
|
||||
let parameterType = undefined; |
|
||||
for (const parameter of this.parameters) { |
|
||||
if (parameter.name === parameterName) { |
|
||||
parameterType = parameter.valueType; |
|
||||
} |
|
||||
} |
|
||||
if (!parameterType) { |
|
||||
return null; |
|
||||
} |
|
||||
for (const type of this.valueTypes) { |
|
||||
if (type.code === parameterType) { |
|
||||
parameterType = type; |
|
||||
} |
|
||||
} |
|
||||
if (!parameterType) { |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
if (parameterType.properties && parameterType.properties.length > 0) { |
|
||||
const options = []; |
|
||||
for (const property of parameterType.properties) { |
|
||||
options.push({ label: property.name, type: 'property', apply: '${' + property.name + '}', detail: this.findValueTypeInfo(property.valueType) }); |
|
||||
} |
|
||||
return options; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public autoCompletionParameters(to, matchedText): any { |
|
||||
return { |
|
||||
from: to, |
|
||||
options: this.getParameterOptions(), |
|
||||
validFor: /(.*)?/, |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
public autoCompletionProperties(to, matchedText): any { |
|
||||
const matchedTextReverse = Tools.reverseString(matchedText); |
|
||||
const regReverse = /((.*)?\}(.+?)\{\$)+/g; //匹配 'xxx.}xxx{$' 模式
|
|
||||
const matcheds = matchedTextReverse.match(regReverse); |
|
||||
if (Tools.isUndefinedOrNull(matcheds) || matcheds.length <= 0) { |
|
||||
return null; |
|
||||
} |
|
||||
const matched = Tools.reverseString(matcheds[0]); |
|
||||
const parameterName = matched.replace(/\$\{(.+?)\}/g, '$1'); |
|
||||
console.log(parameterName); |
|
||||
if (Tools.isUndefinedOrNull(parameterName)) { |
|
||||
return null; |
|
||||
} |
|
||||
const options = this.getOptions(parameterName); |
|
||||
if (Tools.isUndefinedOrNull(options)) { |
|
||||
return null; |
|
||||
} |
|
||||
return { |
|
||||
from: to, |
|
||||
options: options, |
|
||||
//validFor: /^(.*)?$/,
|
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
public autoCompletion(context): any { |
|
||||
const beforeMatched = context.matchBefore(/(.+?)/g); |
|
||||
if (Tools.isUndefinedOrNull(beforeMatched)) { |
|
||||
return null; |
|
||||
} |
|
||||
const beforeText = beforeMatched.text || ''; |
|
||||
if (beforeText.endsWith(' ')) { |
|
||||
//匹配参数
|
|
||||
return this.autoCompletionParameters(beforeMatched.to); |
|
||||
} else { |
|
||||
//匹配属性
|
|
||||
return this.autoCompletionProperties(beforeMatched.to, beforeText); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
export { AutoCompletionManager2 }; |
|
@ -0,0 +1,339 @@ |
|||||
|
package io.sc.platform.util; |
||||
|
|
||||
|
public class ArrayUtil { |
||||
|
/** |
||||
|
* 获取数组是否含有元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组是否含有元素 |
||||
|
*/ |
||||
|
public static boolean hasElements(boolean[] arrays){ |
||||
|
if(arrays==null){ return false; } |
||||
|
return arrays.length>0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组是否含有元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组是否含有元素 |
||||
|
*/ |
||||
|
public static boolean hasElements(byte[] arrays){ |
||||
|
if(arrays==null){ return false; } |
||||
|
return arrays.length>0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组是否含有元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组是否含有元素 |
||||
|
*/ |
||||
|
public static boolean hasElements(char[] arrays){ |
||||
|
if(arrays==null){ return false; } |
||||
|
return arrays.length>0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组是否含有元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组是否含有元素 |
||||
|
*/ |
||||
|
public static boolean hasElements(short[] arrays){ |
||||
|
if(arrays==null){ return false; } |
||||
|
return arrays.length>0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组是否含有元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组是否含有元素 |
||||
|
*/ |
||||
|
public static boolean hasElements(int[] arrays){ |
||||
|
if(arrays==null){ return false; } |
||||
|
return arrays.length>0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组是否含有元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组是否含有元素 |
||||
|
*/ |
||||
|
public static boolean hasElements(long[] arrays){ |
||||
|
if(arrays==null){ return false; } |
||||
|
return arrays.length>0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组是否含有元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组是否含有元素 |
||||
|
*/ |
||||
|
public static boolean hasElements(float[] arrays){ |
||||
|
if(arrays==null){ return false; } |
||||
|
return arrays.length>0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组是否含有元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组是否含有元素 |
||||
|
*/ |
||||
|
public static boolean hasElements(double[] arrays){ |
||||
|
if(arrays==null){ return false; } |
||||
|
return arrays.length>0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组是否含有元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组是否含有元素 |
||||
|
*/ |
||||
|
public static boolean hasElements(Object[] arrays){ |
||||
|
if(arrays==null){ return false; } |
||||
|
return arrays.length>0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组中最大的元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组中最大的元素 |
||||
|
*/ |
||||
|
public static boolean max(boolean[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
for(boolean v : arrays){ |
||||
|
if(v){ |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组中最大的元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组中最大的元素 |
||||
|
*/ |
||||
|
public static byte max(byte[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
byte r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]>r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组中最大的元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组中最大的元素 |
||||
|
*/ |
||||
|
public static char max(char[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
char r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]>r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组中最大的元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组中最大的元素 |
||||
|
*/ |
||||
|
public static short max(short[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
short r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]>r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组中最大的元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组中最大的元素 |
||||
|
*/ |
||||
|
public static int max(int[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
int r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]>r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组中最大的元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组中最大的元素 |
||||
|
*/ |
||||
|
public static long max(long[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
long r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]>r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组中最大的元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组中最大的元素 |
||||
|
*/ |
||||
|
public static float max(float[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
float r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]>r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组中最大的元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组中最大的元素 |
||||
|
*/ |
||||
|
public static double max(double[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
double r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]>r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取数组中最大的元素 |
||||
|
* @param arrays 数组对象 |
||||
|
* @return 数组中最大的元素 |
||||
|
*/ |
||||
|
public static Comparable max(Comparable[] arrays){ |
||||
|
if(arrays==null){ return null; } |
||||
|
Comparable r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i].compareTo(r)>0){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
public static boolean min(boolean[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
for(boolean v : arrays){ |
||||
|
if(!v){ |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
public static byte min(byte[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
byte r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]<r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
public static char min(char[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
char r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]<r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
public static short min(short[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
short r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]<r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
public static int min(int[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
int r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]<r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
public static long min(long[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
long r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]<r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
public static float min(float[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
float r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]<r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
public static double min(double[] arrays){ |
||||
|
if(arrays==null){ throw new RuntimeException("parameter must NOT null"); } |
||||
|
double r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i]<r){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
|
||||
|
public static Comparable min(Comparable[] arrays){ |
||||
|
if(arrays==null){ return null; } |
||||
|
Comparable r =arrays[0]; |
||||
|
for(int i=1;i<arrays.length;i++){ |
||||
|
if(arrays[i].compareTo(r)<0){ |
||||
|
r =arrays[i]; |
||||
|
} |
||||
|
} |
||||
|
return r; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue