@nocobase/client-v2 2.4.0-alpha.2 → 2.4.0-alpha.20
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/README.md +4 -4
- package/es/RouteRepository.d.ts +6 -0
- package/es/components/form/ScanInput/useCodeScanner.d.ts +12 -2
- package/es/components/form/ScanInput/zxingWasmDecoder.d.ts +9 -0
- package/es/components/form/VariableInput.d.ts +1 -0
- package/es/flow/FlowModelRepository.d.ts +4 -1
- package/es/flow/FlowPage.d.ts +1 -1
- package/es/flow/admin-shell/admin-layout/MobileTopbarActionsContext.d.ts +10 -0
- package/es/flow/components/FieldAssignValueInput.d.ts +2 -0
- package/es/flow/components/field-value-variable/FieldValueVariableInput.d.ts +1 -0
- package/es/flow/components/filter/VariableFilterItem.d.ts +10 -1
- package/es/flow/internal/utils/quickEditDataScope.d.ts +48 -0
- package/es/flow/internal/utils/quickEditViewContainer.d.ts +27 -0
- package/es/flow/models/actions/LinkActionUtils.d.ts +1 -0
- package/es/flow/models/actions/getHasManyDeleteFilterByTk.d.ts +12 -0
- package/es/flow/models/base/PageModel/closeGuard.d.ts +8 -1
- package/es/flow/models/blocks/assign-form/assignFormValue.d.ts +29 -0
- package/es/flow/models/blocks/form/EditFormModel.d.ts +2 -0
- package/es/flow/models/blocks/form/QuickEditFormModel.d.ts +1 -0
- package/es/flow/models/blocks/table/sortUtils.d.ts +3 -0
- package/es/flow/models/topbar/UserCenterTopbarActionModel.d.ts +2 -0
- package/es/flow/useRouteContentRequest.d.ts +20 -0
- package/es/index.mjs +141 -104
- package/lib/index.js +178 -141
- package/package.json +9 -8
- package/src/BaseApplication.tsx +2 -0
- package/src/RouteRepository.ts +14 -0
- package/src/__tests__/RouteRepository.test.ts +51 -0
- package/src/__tests__/app.test.tsx +13 -0
- package/src/collection-manager/__tests__/field-configure.test.ts +52 -0
- package/src/collection-manager/field-configure.ts +2 -2
- package/src/components/form/ScanInput/CodeScanner.tsx +3 -1
- package/src/components/form/ScanInput/__tests__/CodeScanner.test.tsx +7 -1
- package/src/components/form/ScanInput/__tests__/useCodeScanner.test.tsx +182 -8
- package/src/components/form/ScanInput/__tests__/zxingWasmDecoder.test.ts +78 -0
- package/src/components/form/ScanInput/useCodeScanner.ts +135 -20
- package/src/components/form/ScanInput/zxingWasmDecoder.ts +64 -0
- package/src/components/form/VariableInput.tsx +1 -0
- package/src/flow/FlowModelRepository.ts +47 -1
- package/src/flow/FlowPage.tsx +25 -10
- package/src/flow/__tests__/FlowModelRepository.test.ts +38 -1
- package/src/flow/__tests__/FlowPage.test.tsx +78 -46
- package/src/flow/actions/__tests__/validation.test.ts +48 -0
- package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +8 -1
- package/src/flow/admin-shell/admin-layout/HelpLite.tsx +5 -1
- package/src/flow/admin-shell/admin-layout/MobileTopbarActionsContext.ts +13 -0
- package/src/flow/admin-shell/admin-layout/TopbarActionsBar.tsx +13 -2
- package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.mobile.test.tsx +259 -0
- package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.test.tsx +39 -0
- package/src/flow/components/FieldAssignValueInput.tsx +4 -0
- package/src/flow/components/field-value-variable/FieldValueVariableInput.tsx +21 -12
- package/src/flow/components/field-value-variable/__tests__/FieldValueVariableInput.test.tsx +9 -0
- package/src/flow/components/filter/VariableFilterItem.tsx +14 -4
- package/src/flow/components/filter/__tests__/VariableFilterItem.rightMetaTree.test.tsx +158 -0
- package/src/flow/flows/editMarkdownFlow.tsx +1 -1
- package/src/flow/internal/utils/__tests__/quickEditDataScope.test.ts +156 -0
- package/src/flow/internal/utils/__tests__/quickEditViewContainer.test.ts +52 -0
- package/src/flow/internal/utils/quickEditDataScope.tsx +177 -0
- package/src/flow/internal/utils/quickEditViewContainer.ts +46 -0
- package/src/flow/models/actions/BulkDeleteActionModel.tsx +13 -2
- package/src/flow/models/actions/DeleteActionModel.tsx +16 -2
- package/src/flow/models/actions/JSItemActionModel.tsx +19 -3
- package/src/flow/models/actions/LinkActionModel.tsx +11 -9
- package/src/flow/models/actions/LinkActionUtils.ts +4 -2
- package/src/flow/models/actions/__tests__/DeleteActionModel.test.ts +256 -0
- package/src/flow/models/actions/__tests__/JSItemActionModel.test.tsx +47 -1
- package/src/flow/models/actions/__tests__/LinkActionModel.test.ts +14 -0
- package/src/flow/models/actions/getHasManyDeleteFilterByTk.ts +40 -0
- package/src/flow/models/base/GridModel.tsx +0 -1
- package/src/flow/models/base/PageModel/PageTabModel.tsx +27 -12
- package/src/flow/models/base/PageModel/closeGuard.ts +9 -8
- package/src/flow/models/blocks/assign-form/AssignFormGridModel.tsx +22 -1
- package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +40 -12
- package/src/flow/models/blocks/assign-form/__tests__/assignFieldValuesFlow.editor.test.tsx +140 -0
- package/src/flow/models/blocks/assign-form/__tests__/assignFieldValuesFlow.multipleSelect.test.tsx +216 -0
- package/src/flow/models/blocks/assign-form/__tests__/assignFormValue.test.ts +41 -0
- package/src/flow/models/blocks/assign-form/assignFormValue.ts +64 -0
- package/src/flow/models/blocks/details/DetailsItemModel.tsx +62 -1
- package/src/flow/models/blocks/details/__tests__/DetailsItemModel.spacing.test.tsx +77 -0
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormGridModel.toggleFormFieldsCollapse.test.ts +29 -0
- package/src/flow/models/blocks/filter-form/fields/FieldComponentProps.tsx +1 -1
- package/src/flow/models/blocks/filter-form/fields/__tests__/FieldComponentProps.options.test.tsx +61 -0
- package/src/flow/models/blocks/form/EditFormModel.tsx +23 -1
- package/src/flow/models/blocks/form/FormBlockModel.tsx +26 -5
- package/src/flow/models/blocks/form/QuickEditFormModel.tsx +45 -11
- package/src/flow/models/blocks/form/__tests__/EditFormModel.pagination.test.tsx +77 -0
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +145 -0
- package/src/flow/models/blocks/form/__tests__/QuickEditFormModel.quickEdit.test.ts +120 -0
- package/src/flow/models/blocks/form/__tests__/popupLinkage.test.tsx +175 -0
- package/src/flow/models/blocks/js-block/JSBlock.tsx +5 -1
- package/src/flow/models/blocks/js-block/__tests__/JSBlockModel.test.tsx +23 -1
- package/src/flow/models/blocks/table/TableBlockModel.tsx +4 -10
- package/src/flow/models/blocks/table/TableColumnModel.tsx +31 -0
- package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +64 -0
- package/src/flow/models/blocks/table/__tests__/sortUtils.test.ts +11 -1
- package/src/flow/models/blocks/table/sortUtils.ts +10 -0
- package/src/flow/models/fields/AssociationFieldModel/CascadeSelectFieldModel.tsx +11 -2
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.tsx +4 -3
- package/src/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.tsx +13 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.tsx +47 -17
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.tsx +6 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableColumnModel.largeField.test.tsx +178 -0
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableField.disabled.test.tsx +90 -0
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordSelectFieldModel.quickCreatePopup.test.tsx +183 -0
- package/src/flow/models/fields/AssociationFieldModel/__tests__/associationSelect.search.test.ts +113 -0
- package/src/flow/models/fields/DisplayAssociationField/DisplaySubTableFieldModel.tsx +42 -7
- package/src/flow/models/fields/DisplayAssociationField/__tests__/DisplaySubTableFieldModel.test.tsx +351 -0
- package/src/flow/models/fields/InputFieldModel.tsx +1 -1
- package/src/flow/models/fields/SelectFieldModel.tsx +5 -0
- package/src/flow/models/fields/__tests__/InputFieldModel.test.tsx +16 -0
- package/src/flow/models/fields/__tests__/SelectFieldModel.test.tsx +29 -1
- package/src/flow/models/fields/mobile-components/MobileLazySelect.tsx +1 -0
- package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +20 -0
- package/src/flow/models/topbar/UserCenterTopbarActionModel.tsx +64 -30
- package/src/flow/useRouteContentRequest.tsx +46 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { FlowEngineContext, ModelConstructor } from '@nocobase/flow-engine';
|
|
11
|
+
import {
|
|
12
|
+
CollectionField,
|
|
13
|
+
FlowModel,
|
|
14
|
+
createCollectionContextMeta,
|
|
15
|
+
createCurrentRecordMetaFactory,
|
|
16
|
+
createEphemeralContext,
|
|
17
|
+
useFlowSettingsContext,
|
|
18
|
+
} from '@nocobase/flow-engine';
|
|
19
|
+
import { Skeleton } from 'antd';
|
|
20
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
21
|
+
import { FilterGroup, VariableFilterItem } from '../../components/filter';
|
|
22
|
+
import { FormItemModel } from '../../models/blocks/form/FormItemModel';
|
|
23
|
+
|
|
24
|
+
const DATA_SCOPE_ACTION_NAME = 'dataScope';
|
|
25
|
+
|
|
26
|
+
export const QUICK_EDIT_DATA_SCOPE_FLOW_KEY = 'tableColumnSettings';
|
|
27
|
+
export const QUICK_EDIT_DATA_SCOPE_STEP_KEY = 'quickEditDataScope';
|
|
28
|
+
|
|
29
|
+
export type DataScopeStepLocation = { flowKey: string; stepKey: string };
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Minimal shape read off a model class: the static flow registry and the `use` of each step. `ModelConstructor` does not
|
|
33
|
+
* declare the registry, so the lookup reaches for it through this shape instead of widening to `any`.
|
|
34
|
+
*/
|
|
35
|
+
type FlowRegistryHolder = {
|
|
36
|
+
globalFlowRegistry?: {
|
|
37
|
+
getFlows?: () => Map<string, { steps?: Record<string, { use?: string } | undefined> } | undefined>;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type DataScopeFilter = { logic?: string; items?: unknown[] } | undefined;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Locate the flow and step that carry the shared `dataScope` action on a field model class. Both association editors
|
|
45
|
+
* currently keep it under `selectSettings`, but the lookup resolves it from the class instead of hard-coding that name,
|
|
46
|
+
* so an editor registered later is picked up without touching the quick edit path. Returns the first match.
|
|
47
|
+
*/
|
|
48
|
+
export function findDataScopeStep(
|
|
49
|
+
ModelClass: ModelConstructor | typeof FlowModel | undefined | null,
|
|
50
|
+
): DataScopeStepLocation | null {
|
|
51
|
+
const flows = (ModelClass as unknown as FlowRegistryHolder | undefined)?.globalFlowRegistry?.getFlows?.();
|
|
52
|
+
if (!flows) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
for (const [flowKey, flow] of flows) {
|
|
56
|
+
for (const [stepKey, step] of Object.entries(flow?.steps || {})) {
|
|
57
|
+
if (step?.use === DATA_SCOPE_ACTION_NAME) {
|
|
58
|
+
return { flowKey, stepKey };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Resolve the data scope step of the editor model that the quick edit popover builds for `collectionField`. Returns null
|
|
67
|
+
* when the field is not an association or when its default editor has no data scope step, which is what the column
|
|
68
|
+
* setting uses to decide whether to offer the item at all.
|
|
69
|
+
*/
|
|
70
|
+
export function resolveQuickEditDataScopeStep(
|
|
71
|
+
ctx: FlowEngineContext,
|
|
72
|
+
collectionField: CollectionField,
|
|
73
|
+
): DataScopeStepLocation | null {
|
|
74
|
+
if (!collectionField?.isAssociationField?.()) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
// Resolve through the same class the quick edit popover builds its editor with, so the setting is offered exactly
|
|
78
|
+
// when the editor that will actually open has a data scope step.
|
|
79
|
+
const binding = FormItemModel.getDefaultBindingByField(ctx, collectionField);
|
|
80
|
+
if (!binding?.modelName) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return findDataScopeStep(ctx.engine?.getModelClass?.(binding.modelName));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function isEmptyDataScopeFilter(filter: DataScopeFilter) {
|
|
87
|
+
return !filter || !Array.isArray(filter.items) || filter.items.length === 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Read the quick edit data scope filter stored on the table column that owns `sourceFieldModel`. */
|
|
91
|
+
export function getQuickEditDataScopeFilter(sourceFieldModel?: FlowModel): DataScopeFilter {
|
|
92
|
+
const columnModel = sourceFieldModel?.parent as FlowModel | undefined;
|
|
93
|
+
const params = columnModel?.getStepParams?.(QUICK_EDIT_DATA_SCOPE_FLOW_KEY, QUICK_EDIT_DATA_SCOPE_STEP_KEY);
|
|
94
|
+
const filter = params?.filter as DataScopeFilter;
|
|
95
|
+
return isEmptyDataScopeFilter(filter) ? undefined : filter;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Context the filter builder is configured against. The setting lives on the table column, but the filter describes
|
|
100
|
+
* records of the association target, so `collection` points at the target collection to drive the left-hand field list.
|
|
101
|
+
* `record` is declared with meta only so that "Current record" is offered as a right-hand variable and describes the row
|
|
102
|
+
* being edited rather than whatever record an enclosing popup happens to supply; it has no value while configuring and
|
|
103
|
+
* resolves per row once the popover opens.
|
|
104
|
+
*/
|
|
105
|
+
export function createQuickEditDataScopeContext(columnModel: FlowModel) {
|
|
106
|
+
const collectionField = columnModel.context.collectionField as CollectionField;
|
|
107
|
+
const getTargetCollection = () => collectionField?.targetCollection ?? null;
|
|
108
|
+
const getSourceCollection = () => columnModel.context.collection ?? null;
|
|
109
|
+
return createEphemeralContext(columnModel.context, {
|
|
110
|
+
defineProperties: {
|
|
111
|
+
collection: {
|
|
112
|
+
get: getTargetCollection,
|
|
113
|
+
meta: createCollectionContextMeta(getTargetCollection, 'Current collection'),
|
|
114
|
+
},
|
|
115
|
+
record: {
|
|
116
|
+
get: () => undefined,
|
|
117
|
+
meta: createCurrentRecordMetaFactory(columnModel.context, getSourceCollection),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Wrap the column model so the filter builder reads the scoped context instead of the column's own. */
|
|
124
|
+
function useQuickEditDataScopeModel(columnModel: FlowModel): FlowModel | null {
|
|
125
|
+
const [scopedModel, setScopedModel] = useState<FlowModel | null>(null);
|
|
126
|
+
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
let cancelled = false;
|
|
129
|
+
|
|
130
|
+
const build = async () => {
|
|
131
|
+
const scopedContext = await createQuickEditDataScopeContext(columnModel);
|
|
132
|
+
if (cancelled) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
setScopedModel(
|
|
136
|
+
new Proxy(columnModel, {
|
|
137
|
+
get(target, key, receiver) {
|
|
138
|
+
if (key === 'context') {
|
|
139
|
+
return scopedContext;
|
|
140
|
+
}
|
|
141
|
+
const value = Reflect.get(target, key, receiver);
|
|
142
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
143
|
+
},
|
|
144
|
+
}),
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
build();
|
|
149
|
+
|
|
150
|
+
return () => {
|
|
151
|
+
cancelled = true;
|
|
152
|
+
};
|
|
153
|
+
}, [columnModel]);
|
|
154
|
+
|
|
155
|
+
return scopedModel;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function QuickEditDataScopeInput(props: { value?: Record<string, any> }) {
|
|
159
|
+
const flowContext = useFlowSettingsContext<FlowModel>();
|
|
160
|
+
const scopedModel = useQuickEditDataScopeModel(flowContext.model);
|
|
161
|
+
// The right-hand variable tree defaults to the settings view context, which delegates to the table column and
|
|
162
|
+
// therefore carries no row record. Feed it the scoped context so "Current record" is offered and describes the row.
|
|
163
|
+
const rightMetaTree = useCallback(() => scopedModel?.context.getPropertyMetaTree() ?? [], [scopedModel]);
|
|
164
|
+
|
|
165
|
+
if (!scopedModel) {
|
|
166
|
+
return <Skeleton.Input active size="small" />;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<FilterGroup
|
|
171
|
+
value={props.value}
|
|
172
|
+
FilterItem={(p) => (
|
|
173
|
+
<VariableFilterItem {...p} model={scopedModel} rightAsVariable rightMetaTree={rightMetaTree} />
|
|
174
|
+
)}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
type QuickEditViewContainerLike = {
|
|
11
|
+
update?: (newConfig: { preventClose?: boolean }) => unknown;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type QuickEditFieldModelLike = {
|
|
15
|
+
parent?: {
|
|
16
|
+
use?: string;
|
|
17
|
+
viewContainer?: QuickEditViewContainerLike;
|
|
18
|
+
} | null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function getQuickEditViewContainer(model: QuickEditFieldModelLike | undefined) {
|
|
22
|
+
const parent = model?.parent;
|
|
23
|
+
if (parent?.use !== 'QuickEditFormModel') {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return parent.viewContainer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Keeps the quick edit popover open while a nested dropdown (Select / Cascader) is open. The outside click that
|
|
31
|
+
* closes the dropdown would otherwise also close the popover and drop the unsaved edit. Releasing is deferred so the
|
|
32
|
+
* closing click itself never reaches the popover as a close request.
|
|
33
|
+
*/
|
|
34
|
+
export function syncQuickEditPreventClose(model: QuickEditFieldModelLike | undefined, dropdownOpen: boolean) {
|
|
35
|
+
const container = getQuickEditViewContainer(model);
|
|
36
|
+
if (!container?.update) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (dropdownOpen) {
|
|
40
|
+
container.update({ preventClose: true });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
container.update?.({ preventClose: false });
|
|
45
|
+
}, 0);
|
|
46
|
+
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { tExpr, MultiRecordResource } from '@nocobase/flow-engine';
|
|
11
11
|
import { ButtonProps } from 'antd';
|
|
12
12
|
import { ActionModel, ActionSceneEnum } from '../base';
|
|
13
|
+
import { getHasManyDeleteFilterByTk } from './getHasManyDeleteFilterByTk';
|
|
13
14
|
|
|
14
15
|
export class BulkDeleteActionModel extends ActionModel {
|
|
15
16
|
static scene = ActionSceneEnum.collection;
|
|
@@ -49,11 +50,21 @@ BulkDeleteActionModel.registerFlow({
|
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
52
|
const resource = ctx.blockModel.resource as MultiRecordResource;
|
|
52
|
-
|
|
53
|
+
const selectedRows = resource.getSelectedRows();
|
|
54
|
+
if (selectedRows.length === 0) {
|
|
53
55
|
ctx.message.warning(ctx.t('Please select at least one record to delete'));
|
|
54
56
|
return;
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
const association = ctx.blockModel.association;
|
|
59
|
+
const filterByTk =
|
|
60
|
+
association?.type === 'hasMany'
|
|
61
|
+
? getHasManyDeleteFilterByTk(association.targetKey, selectedRows)
|
|
62
|
+
: ctx.blockModel.collection.getFilterByTK(selectedRows);
|
|
63
|
+
if (association?.type === 'hasMany' && filterByTk === undefined) {
|
|
64
|
+
ctx.message.error(ctx.t('The association target key is missing or invalid.'));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
await resource.destroy(filterByTk);
|
|
57
68
|
ctx.message.success(ctx.t('Selected records deleted successfully'));
|
|
58
69
|
},
|
|
59
70
|
},
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { tExpr } from '@nocobase/flow-engine';
|
|
10
|
+
import { tExpr, SingleRecordResource } from '@nocobase/flow-engine';
|
|
11
11
|
import type { ButtonProps } from 'antd/es/button';
|
|
12
12
|
import { ActionModel, ActionSceneEnum } from '../base';
|
|
13
|
+
import { getHasManyDeleteFilterByTk } from './getHasManyDeleteFilterByTk';
|
|
13
14
|
|
|
14
15
|
export class DeleteActionModel extends ActionModel {
|
|
15
16
|
static scene = ActionSceneEnum.record;
|
|
@@ -53,7 +54,20 @@ DeleteActionModel.registerFlow({
|
|
|
53
54
|
ctx.message.error(ctx.t('No resource or record selected for deletion'));
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
const association = ctx.blockModel.association;
|
|
58
|
+
const filterByTk =
|
|
59
|
+
association?.type === 'hasMany'
|
|
60
|
+
? getHasManyDeleteFilterByTk(association.targetKey, ctx.record)
|
|
61
|
+
: ctx.blockModel.collection.getFilterByTK(ctx.record);
|
|
62
|
+
if (association?.type === 'hasMany' && filterByTk === undefined) {
|
|
63
|
+
ctx.message.error(ctx.t('The association target key is missing or invalid.'));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (association?.type === 'hasMany' && ctx.resource instanceof SingleRecordResource) {
|
|
67
|
+
await ctx.resource.destroy({ params: { filterByTk } });
|
|
68
|
+
} else {
|
|
69
|
+
await ctx.resource.destroy(filterByTk);
|
|
70
|
+
}
|
|
57
71
|
ctx.message.success(ctx.t('Record deleted successfully'));
|
|
58
72
|
},
|
|
59
73
|
},
|
|
@@ -37,14 +37,30 @@ export class JSItemActionModel extends ActionModel {
|
|
|
37
37
|
static scene = ActionSceneEnum.all;
|
|
38
38
|
|
|
39
39
|
render() {
|
|
40
|
-
return
|
|
40
|
+
return (
|
|
41
|
+
<div
|
|
42
|
+
ref={this.context.ref}
|
|
43
|
+
style={{
|
|
44
|
+
display: 'inline-flex',
|
|
45
|
+
minHeight: 22,
|
|
46
|
+
minWidth: this.context.flowSettingsEnabled ? this.context.themeToken?.controlHeightLG ?? 40 : undefined,
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
41
51
|
}
|
|
42
52
|
|
|
43
53
|
renderHiddenInConfig(): React.ReactNode | undefined {
|
|
44
54
|
return (
|
|
45
55
|
<div
|
|
46
56
|
ref={this.context.ref}
|
|
47
|
-
style={{
|
|
57
|
+
style={{
|
|
58
|
+
display: 'inline-flex',
|
|
59
|
+
minHeight: 22,
|
|
60
|
+
minWidth: this.context.themeToken?.controlHeightLG ?? 40,
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
opacity: 0.3,
|
|
63
|
+
}}
|
|
48
64
|
/>
|
|
49
65
|
);
|
|
50
66
|
}
|
|
@@ -62,7 +78,7 @@ export class JSItemActionModel extends ActionModel {
|
|
|
62
78
|
}
|
|
63
79
|
|
|
64
80
|
if (this._mountedOnce && this.context.ref?.current) {
|
|
65
|
-
|
|
81
|
+
this.applyFlow('jsSettings');
|
|
66
82
|
}
|
|
67
83
|
this._mountedOnce = true;
|
|
68
84
|
}
|
|
@@ -46,21 +46,23 @@ LinkActionModel.registerFlow({
|
|
|
46
46
|
|
|
47
47
|
if (link) {
|
|
48
48
|
const isExternalLink = isURL(link);
|
|
49
|
+
// embed 是页面容器,不应销毁;仅弹窗视图在站内同窗口跳转后销毁。
|
|
50
|
+
const shouldDestroyView =
|
|
51
|
+
!!ctx.view &&
|
|
52
|
+
shouldDestroyViewAfterLinkNavigation({
|
|
53
|
+
openInNewWindow,
|
|
54
|
+
isExternalLink,
|
|
55
|
+
viewType: ctx.view.type,
|
|
56
|
+
});
|
|
49
57
|
handleLinkNavigation({
|
|
50
58
|
link,
|
|
51
59
|
openInNewWindow,
|
|
52
60
|
router: ctx.router,
|
|
53
61
|
isExternalLink,
|
|
62
|
+
// 弹窗会被销毁,用 replace 丢弃弹窗路由;页面(含移动端 embed)跳转需保留历史,以便逐级返回。
|
|
63
|
+
replace: shouldDestroyView,
|
|
54
64
|
});
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
ctx.view &&
|
|
58
|
-
shouldDestroyViewAfterLinkNavigation({
|
|
59
|
-
openInNewWindow,
|
|
60
|
-
isExternalLink,
|
|
61
|
-
viewType: ctx.view.type,
|
|
62
|
-
})
|
|
63
|
-
) {
|
|
65
|
+
if (shouldDestroyView) {
|
|
64
66
|
ctx.view.destroy();
|
|
65
67
|
}
|
|
66
68
|
} else {
|
|
@@ -25,10 +25,11 @@ export function handleLinkNavigation(options: {
|
|
|
25
25
|
openInNewWindow?: boolean;
|
|
26
26
|
router: { navigate: (to: string, options?: { replace?: boolean }) => void };
|
|
27
27
|
isExternalLink: boolean;
|
|
28
|
+
replace?: boolean;
|
|
28
29
|
setLocationHref?: (url: string) => void;
|
|
29
30
|
openWindow?: (url?: string, target?: string) => Window | null;
|
|
30
31
|
}) {
|
|
31
|
-
const { link, openInNewWindow, router, isExternalLink } = options;
|
|
32
|
+
const { link, openInNewWindow, router, isExternalLink, replace = false } = options;
|
|
32
33
|
const setLocationHref = options.setLocationHref ?? ((url: string) => (window.location.href = url));
|
|
33
34
|
const openWindow = options.openWindow ?? ((url?: string, target?: string) => window.open(url, target));
|
|
34
35
|
|
|
@@ -44,7 +45,8 @@ export function handleLinkNavigation(options: {
|
|
|
44
45
|
|
|
45
46
|
// 该辅助方法仅负责导航,是否关闭弹窗由调用方按场景决定;
|
|
46
47
|
// 在弹窗上下文中,错误的关闭时机会把新路由回滚为原页面。
|
|
47
|
-
|
|
48
|
+
// 默认 push 新的历史记录,保证浏览器/手机右滑返回能逐级回退;仅在需要丢弃当前弹窗路由时由调用方传 replace。
|
|
49
|
+
router.navigate(link, { replace });
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
/**
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
11
|
+
import { Collection, FlowEngine, MultiRecordResource, SingleRecordResource } from '@nocobase/flow-engine';
|
|
12
|
+
import { APIClient } from '@nocobase/sdk';
|
|
13
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
14
|
+
import { DeleteActionModel } from '../DeleteActionModel';
|
|
15
|
+
import { BulkDeleteActionModel } from '../BulkDeleteActionModel';
|
|
16
|
+
import { parseQuery } from '../../../../../../resourcer/src/utils';
|
|
17
|
+
|
|
18
|
+
type RecordData = Record<string, unknown>;
|
|
19
|
+
|
|
20
|
+
function setup(single = false) {
|
|
21
|
+
const engine = new FlowEngine();
|
|
22
|
+
const resource = single ? engine.createResource(SingleRecordResource) : engine.createResource(MultiRecordResource);
|
|
23
|
+
const collection = new Collection({ name: 'users', filterTargetKey: ['code', 'staffname'] });
|
|
24
|
+
const ctx = {
|
|
25
|
+
record: { code: 'S1523968', staffname: 'Test user' } as RecordData,
|
|
26
|
+
resource,
|
|
27
|
+
blockModel: {
|
|
28
|
+
resource,
|
|
29
|
+
collection,
|
|
30
|
+
association: { type: 'hasMany', targetKey: 'code' } as { type: string; targetKey?: unknown } | undefined,
|
|
31
|
+
},
|
|
32
|
+
message: { success: vi.fn(), error: vi.fn(), warning: vi.fn() },
|
|
33
|
+
t: (value: string) => value,
|
|
34
|
+
};
|
|
35
|
+
const model = new DeleteActionModel({ uid: 'delete', flowEngine: engine });
|
|
36
|
+
const bulkModel = new BulkDeleteActionModel({ uid: 'bulk-delete', flowEngine: engine });
|
|
37
|
+
const handler = model.getFlow('deleteSettings').getStep('delete').serialize().handler;
|
|
38
|
+
const bulkHandler = bulkModel.getFlow('deleteSettings').getStep('delete').serialize().handler;
|
|
39
|
+
return {
|
|
40
|
+
ctx,
|
|
41
|
+
resource,
|
|
42
|
+
run: () => handler(ctx as Parameters<typeof handler>[0], {}),
|
|
43
|
+
runBulk: () => bulkHandler(ctx as Parameters<typeof bulkHandler>[0], {}),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
afterEach(() => vi.restoreAllMocks());
|
|
48
|
+
|
|
49
|
+
describe('hasMany delete actions', () => {
|
|
50
|
+
it('uses the association target key when the collection has multiple identifier fields', async () => {
|
|
51
|
+
const { ctx, resource, run } = setup();
|
|
52
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
53
|
+
await run();
|
|
54
|
+
expect(destroy).toHaveBeenCalledWith('S1523968');
|
|
55
|
+
expect(ctx.message.success).toHaveBeenCalledOnce();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('uses the association target key when the collection identifier is a different scalar', async () => {
|
|
59
|
+
const { ctx, resource, run } = setup();
|
|
60
|
+
ctx.blockModel.collection = new Collection({ name: 'users', filterTargetKey: 'staffname' });
|
|
61
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
62
|
+
await run();
|
|
63
|
+
expect(destroy).toHaveBeenCalledWith('S1523968');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('supports uppercase target keys', async () => {
|
|
67
|
+
const { ctx, resource, run } = setup();
|
|
68
|
+
ctx.blockModel.association.targetKey = 'ID';
|
|
69
|
+
ctx.record = { ID: 'A' };
|
|
70
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
71
|
+
await run();
|
|
72
|
+
expect(destroy).toHaveBeenCalledWith('A');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it.each([0, '0', 42, '9223372036854775807'])('preserves target key %s', async (value) => {
|
|
76
|
+
const { ctx, resource, run } = setup();
|
|
77
|
+
ctx.record.code = value;
|
|
78
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
79
|
+
await run();
|
|
80
|
+
expect(destroy).toHaveBeenCalledWith(value);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it.each([undefined, null, '', {}, [], false, NaN, Infinity])('rejects invalid target value %s', async (value) => {
|
|
84
|
+
const { ctx, resource, run } = setup();
|
|
85
|
+
ctx.record.code = value;
|
|
86
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
87
|
+
await run();
|
|
88
|
+
expect(destroy).not.toHaveBeenCalled();
|
|
89
|
+
expect(ctx.message.error).toHaveBeenCalledWith('The association target key is missing or invalid.');
|
|
90
|
+
expect(ctx.message.success).not.toHaveBeenCalled();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('rejects missing association target key metadata', async () => {
|
|
94
|
+
const { ctx, resource, run } = setup();
|
|
95
|
+
ctx.blockModel.association.targetKey = undefined;
|
|
96
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
97
|
+
await run();
|
|
98
|
+
expect(destroy).not.toHaveBeenCalled();
|
|
99
|
+
expect(ctx.message.error).toHaveBeenCalledOnce();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it.each([undefined, 'belongsToMany', 'hasOne', 'belongsTo'])('preserves identifiers for %s', async (type) => {
|
|
103
|
+
const { ctx, resource, run } = setup();
|
|
104
|
+
ctx.blockModel.association = type ? { type, targetKey: 'code' } : undefined;
|
|
105
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
106
|
+
await run();
|
|
107
|
+
expect(destroy).toHaveBeenCalledWith(ctx.record);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('preserves the existing call for a non-hasMany single record resource', async () => {
|
|
111
|
+
const { ctx, resource, run } = setup(true);
|
|
112
|
+
ctx.blockModel.association = undefined;
|
|
113
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
114
|
+
await run();
|
|
115
|
+
expect(destroy).toHaveBeenCalledWith(ctx.record);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it.each([false, true])('serializes a scalar URL with singleRecord=%s', async (single) => {
|
|
119
|
+
const { ctx, resource, run } = setup(single);
|
|
120
|
+
const api = new APIClient({ baseURL: 'http://localhost/api/' });
|
|
121
|
+
const mock = new MockAdapter(api.axios);
|
|
122
|
+
mock.onPost('orgs/110013/users:destroy').reply(200, { data: true });
|
|
123
|
+
resource.setAPIClient(api).setResourceName('orgs.users').setSourceId('110013');
|
|
124
|
+
resource.setFilterByTk(ctx.record);
|
|
125
|
+
vi.spyOn(resource, 'refresh').mockResolvedValue();
|
|
126
|
+
try {
|
|
127
|
+
await run();
|
|
128
|
+
expect(mock.history.post).toHaveLength(1);
|
|
129
|
+
const url = new URL(api.axios.getUri(mock.history.post[0]));
|
|
130
|
+
expect(url.pathname).toBe('/api/orgs/110013/users:destroy');
|
|
131
|
+
expect(url.searchParams.get('filterByTk')).toBe('S1523968');
|
|
132
|
+
expect(url.searchParams.has('filterByTk[code]')).toBe(false);
|
|
133
|
+
expect(ctx.message.success).toHaveBeenCalledOnce();
|
|
134
|
+
} finally {
|
|
135
|
+
mock.restore();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
describe.each([false, true])('literal hasMany keys with singleRecord=%s', (single) => {
|
|
140
|
+
it.each([
|
|
141
|
+
'["A","B"]',
|
|
142
|
+
'{"code":"A"}',
|
|
143
|
+
'{"0":"A","1":"B"}',
|
|
144
|
+
'[]',
|
|
145
|
+
'{}',
|
|
146
|
+
' \n ["A","B"] \t',
|
|
147
|
+
'[not JSON',
|
|
148
|
+
'{not JSON',
|
|
149
|
+
'["中文 & + %", "B"]',
|
|
150
|
+
])('preserves %s through server query parsing', async (key) => {
|
|
151
|
+
const { ctx, resource, run } = setup(single);
|
|
152
|
+
ctx.record.code = key;
|
|
153
|
+
const api = new APIClient({ baseURL: 'http://localhost/api/' });
|
|
154
|
+
const mock = new MockAdapter(api.axios);
|
|
155
|
+
mock.onPost('orgs/110013/users:destroy').reply(200, { data: true });
|
|
156
|
+
resource.setAPIClient(api).setResourceName('orgs.users').setSourceId('110013');
|
|
157
|
+
resource.setFilterByTk(ctx.record);
|
|
158
|
+
vi.spyOn(resource, 'refresh').mockResolvedValue();
|
|
159
|
+
try {
|
|
160
|
+
await run();
|
|
161
|
+
expect(mock.history.post).toHaveLength(1);
|
|
162
|
+
const config = mock.history.post[0];
|
|
163
|
+
const paramsSerializer =
|
|
164
|
+
typeof config.paramsSerializer === 'function'
|
|
165
|
+
? { serialize: config.paramsSerializer }
|
|
166
|
+
: config.paramsSerializer;
|
|
167
|
+
const url = new URL(api.axios.getUri({ ...config, paramsSerializer }));
|
|
168
|
+
expect(url.pathname).toBe('/api/orgs/110013/users:destroy');
|
|
169
|
+
expect(parseQuery(url.search.slice(1)).filterByTk).toEqual([key]);
|
|
170
|
+
expect(ctx.message.success).toHaveBeenCalledOnce();
|
|
171
|
+
} finally {
|
|
172
|
+
mock.restore();
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it.each([undefined, 'belongsToMany', 'hasOne', 'belongsTo'])(
|
|
178
|
+
'does not wrap scalar keys outside hasMany: %s',
|
|
179
|
+
async (type) => {
|
|
180
|
+
const { ctx, resource, run } = setup();
|
|
181
|
+
ctx.blockModel.association = type ? { type, targetKey: 'code' } : undefined;
|
|
182
|
+
ctx.blockModel.collection = new Collection({ name: 'users', filterTargetKey: 'code' });
|
|
183
|
+
ctx.record.code = '["A","B"]';
|
|
184
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
185
|
+
await run();
|
|
186
|
+
expect(destroy).toHaveBeenCalledWith('["A","B"]');
|
|
187
|
+
},
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
it('preserves special string elements in a hasMany bulk request', async () => {
|
|
191
|
+
const { resource, runBulk } = setup();
|
|
192
|
+
const keys = ['["A","B"]', '{"code":"A"}'];
|
|
193
|
+
(resource as MultiRecordResource).setSelectedRows(keys.map((code) => ({ code })));
|
|
194
|
+
const api = new APIClient({ baseURL: 'http://localhost/api/' });
|
|
195
|
+
const mock = new MockAdapter(api.axios);
|
|
196
|
+
mock.onPost('orgs/110013/users:destroy').reply(200, { data: true });
|
|
197
|
+
resource.setAPIClient(api).setResourceName('orgs.users').setSourceId('110013');
|
|
198
|
+
vi.spyOn(resource, 'refresh').mockResolvedValue();
|
|
199
|
+
try {
|
|
200
|
+
await runBulk();
|
|
201
|
+
expect(mock.history.post).toHaveLength(1);
|
|
202
|
+
const config = mock.history.post[0];
|
|
203
|
+
const paramsSerializer =
|
|
204
|
+
typeof config.paramsSerializer === 'function'
|
|
205
|
+
? { serialize: config.paramsSerializer }
|
|
206
|
+
: config.paramsSerializer;
|
|
207
|
+
const url = new URL(api.axios.getUri({ ...config, paramsSerializer }));
|
|
208
|
+
expect(parseQuery(url.search.slice(1)).filterByTk).toEqual(keys);
|
|
209
|
+
} finally {
|
|
210
|
+
mock.restore();
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it('sends scalar target keys for selected hasMany records', async () => {
|
|
215
|
+
const { resource, runBulk } = setup();
|
|
216
|
+
const rows = [
|
|
217
|
+
{ code: 'A', staffname: 'a' },
|
|
218
|
+
{ code: 'B', staffname: 'b' },
|
|
219
|
+
];
|
|
220
|
+
(resource as MultiRecordResource).setSelectedRows(rows);
|
|
221
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
222
|
+
await runBulk();
|
|
223
|
+
expect(destroy).toHaveBeenCalledWith(['A', 'B']);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it('rejects the entire batch when one selected row has no target key', async () => {
|
|
227
|
+
const { ctx, resource, runBulk } = setup();
|
|
228
|
+
(resource as MultiRecordResource).setSelectedRows([{ code: 'A' }, { staffname: 'b' }]);
|
|
229
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
230
|
+
await runBulk();
|
|
231
|
+
expect(destroy).not.toHaveBeenCalled();
|
|
232
|
+
expect(ctx.message.error).toHaveBeenCalledOnce();
|
|
233
|
+
expect(ctx.message.success).not.toHaveBeenCalled();
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it('preserves collection identifiers for other bulk deletion', async () => {
|
|
237
|
+
const { ctx, resource, runBulk } = setup();
|
|
238
|
+
ctx.blockModel.association = { type: 'belongsToMany', targetKey: 'code' };
|
|
239
|
+
const rows = [
|
|
240
|
+
{ code: 'A', staffname: 'a' },
|
|
241
|
+
{ code: 'B', staffname: 'b' },
|
|
242
|
+
];
|
|
243
|
+
(resource as MultiRecordResource).setSelectedRows(rows);
|
|
244
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
245
|
+
await runBulk();
|
|
246
|
+
expect(destroy).toHaveBeenCalledWith(rows);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('does not delete an empty selection', async () => {
|
|
250
|
+
const { ctx, resource, runBulk } = setup();
|
|
251
|
+
const destroy = vi.spyOn(resource, 'destroy').mockResolvedValue();
|
|
252
|
+
await runBulk();
|
|
253
|
+
expect(destroy).not.toHaveBeenCalled();
|
|
254
|
+
expect(ctx.message.warning).toHaveBeenCalledOnce();
|
|
255
|
+
});
|
|
256
|
+
});
|