feat: use Object.assign
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { assign, forEach, isArray } from '@vben/utils';
|
||||
import { forEach, isArray } from '@vben/utils';
|
||||
|
||||
import { getChildLanes } from 'bpmn-js/lib/features/modeling/util/LaneUtil';
|
||||
import { isAny } from 'bpmn-js/lib/features/modeling/util/ModelingUtil';
|
||||
@@ -140,7 +140,9 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
}
|
||||
|
||||
function appendStart(event, element) {
|
||||
const shape = elementFactory.createShape(assign({ type }, options));
|
||||
const shape = elementFactory.createShape(
|
||||
Object.assign({ type }, options),
|
||||
);
|
||||
create.start(event, shape, {
|
||||
source: element,
|
||||
});
|
||||
@@ -148,7 +150,9 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
|
||||
const append = autoPlace
|
||||
? function (event, element) {
|
||||
const shape = elementFactory.createShape(assign({ type }, options));
|
||||
const shape = elementFactory.createShape(
|
||||
Object.assign({ type }, options),
|
||||
);
|
||||
|
||||
autoPlace.append(element, shape);
|
||||
}
|
||||
@@ -182,7 +186,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
) {
|
||||
const childLanes = getChildLanes(element);
|
||||
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'lane-insert-above': {
|
||||
group: 'lane-insert-above',
|
||||
className: 'bpmn-icon-lane-insert-above',
|
||||
@@ -197,7 +201,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
|
||||
if (childLanes.length < 2) {
|
||||
if (element.height >= 120) {
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'lane-divide-two': {
|
||||
group: 'lane-divide',
|
||||
className: 'bpmn-icon-lane-divide-two',
|
||||
@@ -210,7 +214,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
}
|
||||
|
||||
if (element.height >= 180) {
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'lane-divide-three': {
|
||||
group: 'lane-divide',
|
||||
className: 'bpmn-icon-lane-divide-three',
|
||||
@@ -223,7 +227,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
}
|
||||
}
|
||||
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'lane-insert-below': {
|
||||
group: 'lane-insert-below',
|
||||
className: 'bpmn-icon-lane-insert-below',
|
||||
@@ -239,7 +243,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
|
||||
if (is(businessObject, 'bpmn:FlowNode')) {
|
||||
if (is(businessObject, 'bpmn:EventBasedGateway')) {
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'append.receive-task': appendAction(
|
||||
'bpmn:ReceiveTask',
|
||||
'bpmn-icon-receive-task',
|
||||
@@ -277,7 +281,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
'bpmn:CompensateEventDefinition',
|
||||
)
|
||||
) {
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'append.compensation-activity': appendAction(
|
||||
'bpmn:Task',
|
||||
'bpmn-icon-task',
|
||||
@@ -297,7 +301,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
) &&
|
||||
!isEventSubProcess(businessObject)
|
||||
) {
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'append.end-event': appendAction(
|
||||
'bpmn:EndEvent',
|
||||
'bpmn-icon-end-event-none',
|
||||
@@ -324,14 +328,14 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
|
||||
if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
|
||||
// Replace menu entry
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
replace: {
|
||||
group: 'edit',
|
||||
className: 'bpmn-icon-screw-wrench',
|
||||
title: '修改类型',
|
||||
action: {
|
||||
click(event, element) {
|
||||
const position = assign(getReplaceMenuPosition(element), {
|
||||
const position = Object.assign(getReplaceMenuPosition(element), {
|
||||
cursor: { x: event.x, y: event.y },
|
||||
});
|
||||
|
||||
@@ -350,7 +354,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
'bpmn:DataStoreReference',
|
||||
])
|
||||
) {
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'append.text-annotation': appendAction(
|
||||
'bpmn:TextAnnotation',
|
||||
'bpmn-icon-text-annotation',
|
||||
@@ -378,7 +382,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
'bpmn:DataStoreReference',
|
||||
])
|
||||
) {
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
connect: {
|
||||
group: 'connect',
|
||||
className: 'bpmn-icon-connection-multi',
|
||||
@@ -392,7 +396,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
}
|
||||
|
||||
if (is(businessObject, 'bpmn:Group')) {
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'append.text-annotation': appendAction(
|
||||
'bpmn:TextAnnotation',
|
||||
'bpmn-icon-text-annotation',
|
||||
@@ -409,7 +413,7 @@ ContextPadProvider.prototype.getContextPadEntries = function (element) {
|
||||
}
|
||||
|
||||
if (deleteAllowed) {
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
delete: {
|
||||
group: 'edit',
|
||||
className: 'bpmn-icon-trash',
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { assign } from '@vben/utils';
|
||||
|
||||
import PaletteProvider from 'bpmn-js/lib/features/palette/PaletteProvider';
|
||||
|
||||
export default function CustomPalette(
|
||||
@@ -42,7 +40,9 @@ F.prototype.getPaletteEntries = function () {
|
||||
|
||||
function createAction(type, group, className, title, options) {
|
||||
function createListener(event) {
|
||||
const shape = elementFactory.createShape(assign({ type }, options));
|
||||
const shape = Object.assign(
|
||||
elementFactory.createShape({ type }, options),
|
||||
);
|
||||
|
||||
if (options) {
|
||||
shape.businessObject.di.isExpanded = options.isExpanded;
|
||||
@@ -90,7 +90,7 @@ F.prototype.getPaletteEntries = function () {
|
||||
create.start(event, elementFactory.createParticipantShape());
|
||||
}
|
||||
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'hand-tool': {
|
||||
group: 'tools',
|
||||
className: 'bpmn-icon-hand-tool',
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { assign } from '@vben/utils';
|
||||
|
||||
/**
|
||||
* A palette provider for BPMN 2.0 elements.
|
||||
*/
|
||||
@@ -48,7 +46,9 @@ PaletteProvider.prototype.getPaletteEntries = function () {
|
||||
|
||||
function createAction(type, group, className, title, options) {
|
||||
function createListener(event) {
|
||||
const shape = elementFactory.createShape(assign({ type }, options));
|
||||
const shape = elementFactory.createShape(
|
||||
Object.assign({ type }, options),
|
||||
);
|
||||
|
||||
if (options) {
|
||||
shape.businessObject.di.isExpanded = options.isExpanded;
|
||||
@@ -96,7 +96,7 @@ PaletteProvider.prototype.getPaletteEntries = function () {
|
||||
create.start(event, elementFactory.createParticipantShape());
|
||||
}
|
||||
|
||||
assign(actions, {
|
||||
Object.assign(actions, {
|
||||
'hand-tool': {
|
||||
group: 'tools',
|
||||
className: 'bpmn-icon-hand-tool',
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { assign } from 'min-dash';
|
||||
|
||||
defineOptions({ name: 'MyProcessPalette' });
|
||||
|
||||
@@ -11,7 +10,7 @@ const addTask = (event: MouseEvent, options: any = {}) => {
|
||||
const create = bpmnInstances().modeler.get('create');
|
||||
|
||||
const shape = ElementFactory.createShape(
|
||||
assign({ type: 'bpmn:UserTask' }, options),
|
||||
Object.assign({ type: 'bpmn:UserTask' }, options),
|
||||
);
|
||||
|
||||
if (options) {
|
||||
@@ -26,12 +25,6 @@ const addTask = (event: MouseEvent, options: any = {}) => {
|
||||
<Button type="primary" @click="addTask" @mousedown="addTask">
|
||||
测试任务
|
||||
</Button>
|
||||
<div class="test-container" id="palette-container">1</div>
|
||||
<div class="mt-4" id="palette-container">1</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.test-container {
|
||||
margin-top: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user