@nocobase/client-v2 2.2.0-beta.8 → 2.2.0
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/es/APIClient.d.ts +13 -3
- package/es/BaseApplication.d.ts +3 -0
- package/es/RouteRepository.d.ts +8 -0
- package/es/RouterManager.d.ts +15 -0
- package/es/authRedirect.d.ts +1 -0
- package/es/collection-field-interface/CollectionFieldInterface.d.ts +1 -0
- package/es/collection-field-interface/CollectionFieldInterfaceManager.d.ts +1 -0
- package/es/components/category-tabs/SortableCategoryTabs.d.ts +55 -0
- package/es/components/category-tabs/index.d.ts +9 -0
- package/es/components/form/ScanInput/useCodeScanner.d.ts +3 -2
- package/es/components/form/TypedVariableInput.d.ts +31 -5
- package/es/components/form/filter/CollectionFilter.d.ts +2 -0
- package/es/components/form/filter/CollectionFilterItem.d.ts +11 -1
- package/es/components/form/filter/CollectionFilterPanel.d.ts +2 -0
- package/es/components/form/filter/index.d.ts +2 -0
- package/es/components/form/filter/useFilterActionProps.d.ts +2 -0
- package/es/components/index.d.ts +1 -0
- package/es/entry-actions/EntryActionManager.d.ts +24 -0
- package/es/entry-actions/index.d.ts +9 -0
- package/es/flow/actions/index.d.ts +1 -1
- package/es/flow/actions/linkageRules.d.ts +27 -0
- package/es/flow/admin-shell/BaseLayoutModel.d.ts +6 -0
- package/es/flow/admin-shell/BaseLayoutRouteCoordinator.d.ts +7 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutMenuModels.d.ts +1 -0
- package/es/flow/admin-shell/admin-layout/AppListRender.d.ts +2 -1
- package/es/flow/admin-shell/admin-layout/AppSwitcherActionPanelModel.d.ts +24 -0
- package/es/flow/admin-shell/admin-layout/index.d.ts +1 -0
- package/es/flow/admin-shell/admin-layout/useApplications.d.ts +7 -2
- package/es/flow/components/FieldAssignExactDatePicker.d.ts +1 -0
- package/es/flow/components/FieldAssignValueInput.d.ts +7 -24
- package/es/flow/components/FlowRoute.d.ts +2 -2
- package/es/flow/components/RunJSValueEditor.d.ts +1 -0
- package/es/flow/components/field-value-variable/DateVariableEditor.d.ts +24 -0
- package/es/flow/components/field-value-variable/FieldValueVariableInput.d.ts +31 -0
- package/es/flow/components/field-value-variable/dateValue.d.ts +36 -0
- package/es/flow/components/field-value-variable/index.d.ts +11 -0
- package/es/flow/components/filter/FilterGroup.d.ts +1 -0
- package/es/flow/components/filter/VariableFilterItem.d.ts +6 -1
- package/es/flow/components/placeholders/BlockPlaceholder.d.ts +1 -0
- package/es/flow/index.d.ts +1 -0
- package/es/flow/internal/registerDeviceTypeContext.d.ts +10 -0
- package/es/flow/internal/utils/operatorSchemaHelper.d.ts +2 -2
- package/es/flow/models/actions/UpdateRecordActionUtils.d.ts +8 -2
- package/es/flow/models/base/ActionModelCore.d.ts +6 -2
- package/es/flow/models/base/BlockGridModel.d.ts +3 -0
- package/es/flow/models/base/CollectionBlockModel.d.ts +3 -0
- package/es/flow/models/base/PageModel/PageModel.d.ts +12 -0
- package/es/flow/models/base/PageModel/PageModelTabBar.d.ts +22 -0
- package/es/flow/models/base/PageModel/PageTabModel.d.ts +12 -0
- package/es/flow/models/blocks/details/DetailsBlockModel.d.ts +3 -0
- package/es/flow/models/blocks/filter-form/FilterFormGridModel.d.ts +1 -0
- package/es/flow/models/blocks/filter-form/FilterFormSubmitActionModel.d.ts +3 -1
- package/es/flow/models/blocks/form/FormBlockModel.d.ts +7 -0
- package/es/flow/models/blocks/form/FormGridModel.d.ts +6 -0
- package/es/flow/models/blocks/form/QuickEditFormModel.d.ts +17 -2
- package/es/flow/models/blocks/form/value-runtime/rules.d.ts +1 -0
- package/es/flow/models/blocks/table/JSColumnModel.d.ts +2 -0
- package/es/flow/models/blocks/table/TableBlockModel.d.ts +1 -0
- package/es/flow/models/blocks/table/TableColumnModel.d.ts +12 -0
- package/es/flow/models/blocks/table/utils.d.ts +1 -0
- package/es/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.d.ts +2 -1
- package/es/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.d.ts +0 -17
- package/es/flow/models/fields/AssociationFieldModel/recordSelectShared.d.ts +41 -0
- package/es/flow/models/fields/DateTimeFieldModel/dateLimit.d.ts +15 -7
- package/es/flow/routeTransientInputArgs.d.ts +14 -0
- package/es/flow-compat/fieldValidationConstants.d.ts +1 -1
- package/es/flow-compat/passwordUtils.d.ts +1 -1
- package/es/flow-compat/routeTypes.d.ts +1 -0
- package/es/index.d.ts +7 -0
- package/es/index.mjs +301 -177
- package/es/ui-operation/index.d.ts +15 -0
- package/es/ui-operation/ui-operation-codec.d.ts +10 -0
- package/es/utils/getRouteRuntimeVersion.d.ts +23 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/markdownSanitize.d.ts +11 -0
- package/lib/index.js +313 -189
- package/lib/locale/languageCodes.js +3 -1
- package/package.json +9 -7
- package/src/APIClient.ts +90 -7
- package/src/Application.tsx +7 -1
- package/src/BaseApplication.tsx +13 -6
- package/src/RouteRepository.ts +25 -0
- package/src/RouterManager.tsx +142 -1
- package/src/__tests__/APIClient.test.tsx +58 -0
- package/src/__tests__/RouteRepository.test.ts +23 -0
- package/src/__tests__/RouterManager.test.ts +125 -0
- package/src/__tests__/app.test.tsx +73 -0
- package/src/__tests__/authRedirect.test.ts +17 -0
- package/src/__tests__/browserChecker.test.ts +61 -0
- package/src/__tests__/getRouteRuntimeVersion.test.ts +68 -0
- package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +35 -2
- package/src/__tests__/settings-center.test.tsx +270 -6
- package/src/acl/ACLProvider.tsx +2 -0
- package/src/acl/__tests__/ACLProvider.test.tsx +92 -0
- package/src/authRedirect.ts +38 -0
- package/src/collection-field-interface/CollectionFieldInterface.ts +1 -0
- package/src/collection-field-interface/CollectionFieldInterfaceManager.ts +1 -0
- package/src/collection-manager/field-validation.ts +1 -1
- package/src/components/README.md +7 -1
- package/src/components/README.zh-CN.md +6 -1
- package/src/components/category-tabs/SortableCategoryTabs.tsx +210 -0
- package/src/components/category-tabs/index.ts +10 -0
- package/src/components/form/JsonTextArea.tsx +4 -0
- package/src/components/form/ScanInput/CodeScanner.tsx +79 -35
- package/src/components/form/ScanInput/__tests__/CodeScanner.test.tsx +101 -0
- package/src/components/form/ScanInput/__tests__/useCodeScanner.test.tsx +284 -11
- package/src/components/form/ScanInput/useCodeScanner.ts +332 -24
- package/src/components/form/TypedVariableInput.tsx +452 -101
- package/src/components/form/__tests__/TypedVariableInput.test.tsx +364 -12
- package/src/components/form/filter/CollectionFilter.tsx +4 -0
- package/src/components/form/filter/CollectionFilterItem.tsx +36 -9
- package/src/components/form/filter/CollectionFilterPanel.tsx +4 -0
- package/src/components/form/filter/__tests__/CollectionFilterItem.test.tsx +55 -0
- package/src/components/form/filter/__tests__/useFilterActionProps.test.tsx +95 -0
- package/src/components/form/filter/index.ts +2 -0
- package/src/components/form/filter/useFilterActionProps.ts +37 -6
- package/src/components/form/table/Table.tsx +81 -6
- package/src/components/form/table/__tests__/Table.columnWidth.test.tsx +433 -0
- package/src/components/index.ts +1 -0
- package/src/entry-actions/EntryActionManager.ts +76 -0
- package/src/entry-actions/index.ts +10 -0
- package/src/flow/FlowPage.tsx +38 -3
- package/src/flow/__tests__/FlowPage.test.tsx +201 -27
- package/src/flow/__tests__/FlowRoute.test.tsx +675 -12
- package/src/flow/__tests__/PluginFlowEngine.test.ts +58 -0
- package/src/flow/actions/__tests__/actionLinkageRules.forkProps.test.ts +314 -0
- package/src/flow/actions/__tests__/dataScopeFilter.test.ts +62 -0
- package/src/flow/actions/__tests__/dataScopeFormValueClear.test.ts +102 -0
- package/src/flow/actions/__tests__/linkageRules.actionStates.test.ts +33 -0
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +72 -0
- package/src/flow/actions/__tests__/linkageRules.tab.test.ts +171 -0
- package/src/flow/actions/__tests__/linkageRulesRefresh.test.ts +7 -3
- package/src/flow/actions/__tests__/openView.defineProps.route.test.tsx +80 -20
- package/src/flow/actions/dataScopeFilter.ts +10 -1
- package/src/flow/actions/dateTimeFormat.tsx +2 -2
- package/src/flow/actions/index.ts +2 -0
- package/src/flow/actions/linkageRules.tsx +144 -26
- package/src/flow/actions/linkageRulesRefresh.tsx +2 -6
- package/src/flow/actions/openView.tsx +21 -1
- package/src/flow/admin-shell/BaseLayoutModel.tsx +124 -0
- package/src/flow/admin-shell/BaseLayoutRouteCoordinator.ts +184 -42
- package/src/flow/admin-shell/__tests__/AdminLayoutRouteCoordinator.test.ts +1016 -119
- package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +41 -5
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.test.tsx +177 -1
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +20 -0
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuUtils.tsx +78 -59
- package/src/flow/admin-shell/admin-layout/AppListRender.tsx +13 -2
- package/src/flow/admin-shell/admin-layout/AppSwitcherActionPanelModel.tsx +289 -0
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutComponent.test.tsx +253 -6
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutMenuModels.test.ts +228 -0
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutModel.test.tsx +436 -2
- package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.test.tsx +48 -0
- package/src/flow/admin-shell/admin-layout/index.ts +1 -0
- package/src/flow/admin-shell/admin-layout/useApplications.tsx +81 -12
- package/src/flow/common/Markdown/Display.tsx +14 -3
- package/src/flow/common/Markdown/Edit.tsx +19 -7
- package/src/flow/common/Markdown/style.ts +4 -0
- package/src/flow/components/BlockItemCard.tsx +2 -2
- package/src/flow/components/FieldAssignExactDatePicker.tsx +25 -11
- package/src/flow/components/FieldAssignValueInput.tsx +72 -584
- package/src/flow/components/FlowRoute.tsx +204 -46
- package/src/flow/components/RunJSValueEditor.tsx +9 -1
- package/src/flow/components/__tests__/FieldAssignValueInput.context.test.tsx +216 -0
- package/src/flow/components/field-value-variable/DateVariableEditor.tsx +181 -0
- package/src/flow/components/field-value-variable/FieldValueVariableInput.tsx +326 -0
- package/src/flow/components/field-value-variable/__tests__/FieldValueVariableInput.test.tsx +380 -0
- package/src/flow/components/field-value-variable/dateValue.ts +223 -0
- package/src/flow/components/field-value-variable/index.ts +12 -0
- package/src/flow/components/filter/FilterGroup.tsx +33 -5
- package/src/flow/components/filter/VariableFilterItem.tsx +170 -13
- package/src/flow/components/filter/__tests__/FilterGroup.test.tsx +45 -0
- package/src/flow/components/filter/__tests__/VariableFilterItem.leftMetaTree.test.tsx +9 -0
- package/src/flow/components/filter/__tests__/VariableFilterItem.test.tsx +195 -1
- package/src/flow/components/placeholders/BlockPlaceholder.tsx +70 -23
- package/src/flow/components/placeholders/__tests__/BlockPlaceholder.test.tsx +57 -7
- package/src/flow/index.ts +3 -0
- package/src/flow/internal/components/Markdown/util.ts +2 -1
- package/src/flow/internal/registerDeviceTypeContext.ts +39 -0
- package/src/flow/internal/utils/operatorSchemaHelper.ts +3 -2
- package/src/flow/models/actions/UpdateRecordActionModel.tsx +18 -1
- package/src/flow/models/actions/UpdateRecordActionUtils.ts +18 -6
- package/src/flow/models/actions/__tests__/UpdateRecordActionModel.test.ts +76 -4
- package/src/flow/models/base/ActionModel.tsx +10 -8
- package/src/flow/models/base/ActionModelCore.tsx +16 -2
- package/src/flow/models/base/BlockGridModel.tsx +26 -0
- package/src/flow/models/base/CollectionBlockModel.tsx +38 -3
- package/src/flow/models/base/PageModel/PageModel.tsx +387 -53
- package/src/flow/models/base/PageModel/PageModelTabBar.tsx +114 -0
- package/src/flow/models/base/PageModel/PageTabModel.tsx +249 -18
- package/src/flow/models/base/PageModel/__tests__/PageModel.test.ts +790 -10
- package/src/flow/models/base/PageModel/__tests__/PageModelTabBar.module-isolation.test.tsx +130 -0
- package/src/flow/models/base/PageModel/__tests__/PageModelTabBar.test.tsx +118 -0
- package/src/flow/models/base/PageModel/__tests__/PageTabModel.test.ts +1075 -7
- package/src/flow/models/base/__tests__/ActionModelCore.render.test.tsx +49 -0
- package/src/flow/models/base/__tests__/BlockGridModel.selectSceneActivation.test.ts +124 -0
- package/src/flow/models/base/__tests__/CollectionBlockModel.addAppends.test.ts +41 -0
- package/src/flow/models/base/__tests__/CollectionBlockModel.initialBeforeRenderRefresh.test.ts +125 -9
- package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +28 -53
- package/src/flow/models/blocks/details/DetailsBlockModel.tsx +8 -3
- package/src/flow/models/blocks/details/__tests__/DetailsBlockModel.initialPaginationChangeRefresh.test.ts +32 -1
- package/src/flow/models/blocks/filter-form/FilterFormBlockModel.tsx +28 -3
- package/src/flow/models/blocks/filter-form/FilterFormGridModel.tsx +36 -5
- package/src/flow/models/blocks/filter-form/FilterFormItemModel.tsx +155 -25
- package/src/flow/models/blocks/filter-form/FilterFormSubmitActionModel.tsx +57 -4
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormGridModel.onModelCreated.test.ts +174 -1
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormItemModel.defineChildren.test.ts +395 -1
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormItemModel.getFilterValue.test.ts +72 -0
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormSubmitActionModel.lifecycle.test.ts +90 -0
- package/src/flow/models/blocks/filter-form/__tests__/defaultValues.wiring.test.ts +66 -4
- package/src/flow/models/blocks/filter-manager/FilterManager.ts +5 -0
- package/src/flow/models/blocks/filter-manager/__tests__/FilterManager.test.ts +40 -0
- package/src/flow/models/blocks/form/FormBlockModel.tsx +47 -0
- package/src/flow/models/blocks/form/FormGridModel.tsx +4 -0
- package/src/flow/models/blocks/form/QuickEditFormModel.tsx +189 -36
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +8 -2
- package/src/flow/models/blocks/form/__tests__/QuickEditFormModel.quickEdit.test.ts +350 -2
- package/src/flow/models/blocks/form/__tests__/runJsFormSubmit.test.ts +131 -0
- package/src/flow/models/blocks/form/value-runtime/__tests__/runtime.test.ts +435 -0
- package/src/flow/models/blocks/form/value-runtime/rules.ts +67 -14
- package/src/flow/models/blocks/form/value-runtime/runtime.ts +43 -19
- package/src/flow/models/blocks/js-block/JSBlock.tsx +1 -1
- package/src/flow/models/blocks/table/JSColumnModel.tsx +10 -1
- package/src/flow/models/blocks/table/TableActionsColumnModel.tsx +2 -1
- package/src/flow/models/blocks/table/TableBlockModel.tsx +29 -3
- package/src/flow/models/blocks/table/TableColumnModel.tsx +54 -11
- package/src/flow/models/blocks/table/__tests__/JSColumnModel.test.tsx +52 -5
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.filterReset.test.ts +78 -0
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.quickEditRefresh.test.ts +12 -0
- package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +84 -0
- package/src/flow/models/blocks/table/utils.ts +7 -0
- package/src/flow/models/fields/AssociationFieldModel/CascadeSelectFieldModel.tsx +33 -1
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.tsx +10 -1
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/__tests__/popupContext.test.ts +120 -0
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/PopupSubTableEditActionModel.tsx +10 -2
- package/src/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.tsx +24 -1
- package/src/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.tsx +54 -149
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordPickerFieldModel.itemContext.test.ts +167 -3
- package/src/flow/models/fields/AssociationFieldModel/recordSelectShared.tsx +156 -0
- package/src/flow/models/fields/DateTimeFieldModel/__tests__/DateTimeNoTzFieldModel.dateLimit.test.tsx +149 -0
- package/src/flow/models/fields/DateTimeFieldModel/dateLimit.ts +149 -113
- package/src/flow/models/fields/DisplayNumberFieldModel.tsx +1 -1
- package/src/flow/models/fields/JsonFieldModel.tsx +31 -8
- package/src/flow/models/fields/NumberFieldModel.tsx +1 -1
- package/src/flow/models/fields/TextareaFieldModel.tsx +42 -19
- package/src/flow/models/fields/VariableFieldFormModel.tsx +3 -3
- package/src/flow/models/fields/__tests__/DisplayNumberFieldModel.test.ts +33 -0
- package/src/flow/models/fields/__tests__/JsonFieldModel.test.ts +82 -0
- package/src/flow/models/fields/__tests__/NumberFieldModel.test.tsx +47 -0
- package/src/flow/models/fields/__tests__/TextareaFieldModel.test.tsx +32 -1
- package/src/flow/models/fields/__tests__/VariableFieldFormModel.test.tsx +51 -0
- package/src/flow/models/fields/mobile-components/MobileLazySelect.tsx +26 -10
- package/src/flow/models/fields/mobile-components/MobileSelect.tsx +51 -14
- package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +139 -13
- package/src/flow/models/topbar/TopbarActionModel.tsx +78 -3
- package/src/flow/routeTransientInputArgs.ts +27 -0
- package/src/flow/utils/__tests__/dateTimeFormat.test.ts +42 -0
- package/src/flow/utils/dataScopeFormValueClear.ts +4 -3
- package/src/flow-compat/fieldValidationConstants.ts +1 -1
- package/src/flow-compat/routeTypes.ts +1 -0
- package/src/index.ts +7 -0
- package/src/layout-manager/LayoutContentRoute.tsx +2 -1
- package/src/layout-manager/LayoutRoute.tsx +2 -1
- package/src/layout-manager/__tests__/LayoutRoute.test.tsx +87 -1
- package/src/locale/languageCodes.ts +3 -1
- package/src/nocobase-buildin-plugin/index.tsx +19 -1
- package/src/settings-center/AdminSettingsLayout.tsx +23 -2
- package/src/ui-operation/index.ts +33 -0
- package/src/ui-operation/ui-operation-codec.ts +54 -0
- package/src/utils/getRouteRuntimeVersion.ts +185 -0
- package/src/utils/index.tsx +1 -0
- package/src/utils/markdownSanitize.ts +88 -0
|
@@ -0,0 +1,210 @@
|
|
|
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 { MenuOutlined } from '@ant-design/icons';
|
|
11
|
+
import {
|
|
12
|
+
DndContext,
|
|
13
|
+
DragOverlay,
|
|
14
|
+
MouseSensor,
|
|
15
|
+
useDraggable,
|
|
16
|
+
useDroppable,
|
|
17
|
+
useSensor,
|
|
18
|
+
useSensors,
|
|
19
|
+
type DragEndEvent,
|
|
20
|
+
type DragStartEvent,
|
|
21
|
+
} from '@dnd-kit/core';
|
|
22
|
+
import { Badge, Button, Dropdown, Space, Tabs } from 'antd';
|
|
23
|
+
import type { TabsProps } from 'antd';
|
|
24
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A category descriptor for {@link SortableCategoryTabs}. The component is
|
|
28
|
+
* i18n-agnostic: `label` is rendered verbatim, so consumers pass an
|
|
29
|
+
* already-compiled/translated node. `color` is an antd preset color name or a
|
|
30
|
+
* hex string; `'default'` / `undefined` renders no badge color.
|
|
31
|
+
*/
|
|
32
|
+
export type SortableCategoryTabItem = {
|
|
33
|
+
id: string | number;
|
|
34
|
+
label: React.ReactNode;
|
|
35
|
+
color?: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type SortableCategoryTabsProps = {
|
|
39
|
+
activeKey: string;
|
|
40
|
+
onChange: (key: string) => void;
|
|
41
|
+
/** Draggable category tabs (the fixed leading tab is configured via `allTab`). */
|
|
42
|
+
categories: SortableCategoryTabItem[];
|
|
43
|
+
/** The fixed, non-draggable leading tab, e.g. "All". */
|
|
44
|
+
allTab: { key: string; label: React.ReactNode };
|
|
45
|
+
/** Show the "+" add button and handle its click. */
|
|
46
|
+
onAdd?: () => void;
|
|
47
|
+
/** Per-category edit menu item handler; menu is hidden when omitted. */
|
|
48
|
+
onEdit?: (id: string | number) => void;
|
|
49
|
+
/** Per-category delete menu item handler; menu is hidden when omitted. */
|
|
50
|
+
onDelete?: (id: string | number) => void;
|
|
51
|
+
/** Reorder handler. Receives the dragged and dropped category ids. */
|
|
52
|
+
onSort?: (sourceId: string | number, targetId: string | number) => void | Promise<void>;
|
|
53
|
+
/** Consumer-translated labels for the per-category dropdown menu. */
|
|
54
|
+
menuLabels?: { edit?: string; delete?: string };
|
|
55
|
+
className?: string;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
function DraggableTab(props: { id: string; children: React.ReactNode }) {
|
|
59
|
+
const { attributes, listeners, setNodeRef } = useDraggable({ id: props.id });
|
|
60
|
+
return (
|
|
61
|
+
<div ref={setNodeRef} {...listeners} {...attributes}>
|
|
62
|
+
{props.children}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function DroppableTab(props: { id: string; children: React.ReactNode }) {
|
|
68
|
+
const { isOver, setNodeRef } = useDroppable({ id: props.id });
|
|
69
|
+
return (
|
|
70
|
+
<div ref={setNodeRef} style={isOver ? { color: 'green' } : undefined}>
|
|
71
|
+
{props.children}
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function CategoryTabContent(props: {
|
|
77
|
+
item: SortableCategoryTabItem;
|
|
78
|
+
onEdit?: (id: string | number) => void;
|
|
79
|
+
onDelete?: (id: string | number) => void;
|
|
80
|
+
menuLabels?: { edit?: string; delete?: string };
|
|
81
|
+
}) {
|
|
82
|
+
const { item, onEdit, onDelete, menuLabels } = props;
|
|
83
|
+
const hasMenu = Boolean(onEdit || onDelete);
|
|
84
|
+
const editLabel = menuLabels?.edit ?? 'Edit';
|
|
85
|
+
const deleteLabel = menuLabels?.delete ?? 'Delete';
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<Space size={6}>
|
|
89
|
+
<Badge color={item.color === 'default' ? undefined : item.color} />
|
|
90
|
+
{item.label}
|
|
91
|
+
{hasMenu ? (
|
|
92
|
+
<Dropdown
|
|
93
|
+
trigger={['click']}
|
|
94
|
+
menu={{
|
|
95
|
+
items: [
|
|
96
|
+
onEdit ? { key: 'edit', label: editLabel } : null,
|
|
97
|
+
onDelete ? { key: 'delete', label: deleteLabel } : null,
|
|
98
|
+
].filter(Boolean) as { key: string; label: string }[],
|
|
99
|
+
onClick({ key, domEvent }) {
|
|
100
|
+
domEvent.stopPropagation();
|
|
101
|
+
if (key === 'edit') {
|
|
102
|
+
onEdit?.(item.id);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
onDelete?.(item.id);
|
|
106
|
+
},
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<Button
|
|
110
|
+
aria-label={editLabel}
|
|
111
|
+
icon={<MenuOutlined />}
|
|
112
|
+
size="small"
|
|
113
|
+
type="text"
|
|
114
|
+
onClick={(event) => event.stopPropagation()}
|
|
115
|
+
/>
|
|
116
|
+
</Dropdown>
|
|
117
|
+
) : null}
|
|
118
|
+
</Space>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* A draggable, editable category tab bar. Renders only the tab bar (no content
|
|
124
|
+
* panes) — the page renders its content below and reacts to `activeKey`.
|
|
125
|
+
*
|
|
126
|
+
* Shared by settings pages that group records under reorderable categories
|
|
127
|
+
* (data-source collections, workflows, …). Drag-to-reorder is powered by
|
|
128
|
+
* `@dnd-kit`; the "+" / per-tab edit-delete affordances are optional.
|
|
129
|
+
*/
|
|
130
|
+
export function SortableCategoryTabs(props: SortableCategoryTabsProps) {
|
|
131
|
+
const { activeKey, onChange, categories, allTab, onAdd, onEdit, onDelete, onSort, menuLabels, className } = props;
|
|
132
|
+
const [activeDragId, setActiveDragId] = useState<string | null>(null);
|
|
133
|
+
const sensors = useSensors(useSensor(MouseSensor, { activationConstraint: { distance: 10 } }));
|
|
134
|
+
|
|
135
|
+
const handleDragStart = useCallback((event: DragStartEvent) => {
|
|
136
|
+
setActiveDragId(String(event.active.id));
|
|
137
|
+
}, []);
|
|
138
|
+
|
|
139
|
+
const handleDragEnd = useCallback(
|
|
140
|
+
async (event: DragEndEvent) => {
|
|
141
|
+
const { active, over } = event;
|
|
142
|
+
setActiveDragId(null);
|
|
143
|
+
if (!over || over.id === active.id) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
await onSort?.(active.id as string | number, over.id as string | number);
|
|
147
|
+
},
|
|
148
|
+
[onSort],
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const items = useMemo<TabsProps['items']>(
|
|
152
|
+
() => [
|
|
153
|
+
{ key: allTab.key, label: allTab.label, closable: false },
|
|
154
|
+
...categories.map((item) => ({
|
|
155
|
+
key: String(item.id),
|
|
156
|
+
closable: false,
|
|
157
|
+
label: onSort ? (
|
|
158
|
+
<DroppableTab id={String(item.id)}>
|
|
159
|
+
<DraggableTab id={String(item.id)}>
|
|
160
|
+
<CategoryTabContent item={item} onEdit={onEdit} onDelete={onDelete} menuLabels={menuLabels} />
|
|
161
|
+
</DraggableTab>
|
|
162
|
+
</DroppableTab>
|
|
163
|
+
) : (
|
|
164
|
+
<CategoryTabContent item={item} onEdit={onEdit} onDelete={onDelete} menuLabels={menuLabels} />
|
|
165
|
+
),
|
|
166
|
+
})),
|
|
167
|
+
],
|
|
168
|
+
[allTab.key, allTab.label, categories, onSort, onEdit, onDelete, menuLabels],
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const activeDragItem = useMemo(
|
|
172
|
+
() => categories.find((item) => String(item.id) === activeDragId),
|
|
173
|
+
[categories, activeDragId],
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const tabs = (
|
|
177
|
+
<Tabs
|
|
178
|
+
className={className}
|
|
179
|
+
activeKey={activeKey}
|
|
180
|
+
type="editable-card"
|
|
181
|
+
hideAdd={!onAdd}
|
|
182
|
+
items={items}
|
|
183
|
+
onChange={onChange}
|
|
184
|
+
onEdit={(_, action) => {
|
|
185
|
+
if (action === 'add') {
|
|
186
|
+
onAdd?.();
|
|
187
|
+
}
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
if (!onSort) {
|
|
193
|
+
return tabs;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<DndContext sensors={sensors} onDragStart={handleDragStart} onDragEnd={handleDragEnd}>
|
|
198
|
+
{tabs}
|
|
199
|
+
<DragOverlay dropAnimation={null}>
|
|
200
|
+
{activeDragItem ? (
|
|
201
|
+
<span style={{ whiteSpace: 'nowrap' }}>
|
|
202
|
+
<CategoryTabContent item={activeDragItem} menuLabels={menuLabels} />
|
|
203
|
+
</span>
|
|
204
|
+
) : null}
|
|
205
|
+
</DragOverlay>
|
|
206
|
+
</DndContext>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export default SortableCategoryTabs;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './SortableCategoryTabs';
|
|
@@ -11,7 +11,7 @@ import { FileImageOutlined, LeftOutlined } from '@ant-design/icons';
|
|
|
11
11
|
import { css } from '@emotion/css';
|
|
12
12
|
import { Button, message, theme } from 'antd';
|
|
13
13
|
import { Html5Qrcode } from 'html5-qrcode';
|
|
14
|
-
import React, { useCallback, useEffect, useId,
|
|
14
|
+
import React, { useCallback, useEffect, useId, useRef, useState } from 'react';
|
|
15
15
|
import ReactDOM from 'react-dom';
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import { ScanBox } from './ScanBox';
|
|
@@ -26,6 +26,14 @@ type CodeScannerProps = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const MAX_CODE_IMAGE_SIZE = 10 * 1024 * 1024;
|
|
29
|
+
const SCANNER_RENDER_WIDTH = 1280;
|
|
30
|
+
|
|
31
|
+
function getViewportSize() {
|
|
32
|
+
return {
|
|
33
|
+
width: Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),
|
|
34
|
+
height: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
29
37
|
|
|
30
38
|
function CodeScannerContent({ visible, formatsToSupport, onClose, onScanSuccess }: CodeScannerProps) {
|
|
31
39
|
const { t } = useTranslation();
|
|
@@ -34,21 +42,35 @@ function CodeScannerContent({ visible, formatsToSupport, onClose, onScanSuccess
|
|
|
34
42
|
const scannerElementId = `code-scanner-${inputId}`;
|
|
35
43
|
const imgUploaderRef = useRef<HTMLInputElement>(null);
|
|
36
44
|
const [cameraAvailable, setCameraAvailable] = useState(false);
|
|
45
|
+
const [scannerSize, setScannerSize] = useState({ width: 0, height: 0 });
|
|
46
|
+
const [viewport, setViewport] = useState(getViewportSize);
|
|
37
47
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
() => getCodeScanBoxSize(viewport.width, viewport.height),
|
|
45
|
-
[viewport.height, viewport.width],
|
|
46
|
-
);
|
|
48
|
+
const previewScale = scannerSize.width
|
|
49
|
+
? Math.max(viewport.width / scannerSize.width, viewport.height / scannerSize.height)
|
|
50
|
+
: Math.min(1, viewport.width / SCANNER_RENDER_WIDTH);
|
|
51
|
+
const visibleScanBoxSize = scannerSize.width
|
|
52
|
+
? getCodeScanBoxSize(viewport.width, viewport.height)
|
|
53
|
+
: { width: 0, height: 0 };
|
|
47
54
|
|
|
48
55
|
const showScanFailure = useCallback(() => {
|
|
49
56
|
message.error(t('Code recognition failed, please scan again'));
|
|
50
57
|
}, [t]);
|
|
51
58
|
|
|
59
|
+
const showCameraStartFailure = useCallback(
|
|
60
|
+
(error: unknown) => {
|
|
61
|
+
const errorName = error instanceof Error ? error.name : '';
|
|
62
|
+
const errorMessage = error instanceof Error ? error.message : '';
|
|
63
|
+
const errorMap: Record<string, string> = {
|
|
64
|
+
NotFoundError: t('No camera device detected'),
|
|
65
|
+
NotAllowedError: t('You have not granted permission to use the camera'),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
message.error(errorMap[errorName] || errorMessage || t('You have not granted permission to use the camera'));
|
|
69
|
+
onClose();
|
|
70
|
+
},
|
|
71
|
+
[onClose, t],
|
|
72
|
+
);
|
|
73
|
+
|
|
52
74
|
const handleScanSuccess = useCallback(
|
|
53
75
|
(text: string) => {
|
|
54
76
|
onScanSuccess(text);
|
|
@@ -61,11 +83,18 @@ function CodeScannerContent({ visible, formatsToSupport, onClose, onScanSuccess
|
|
|
61
83
|
enabled: visible && cameraAvailable,
|
|
62
84
|
elementId: scannerElementId,
|
|
63
85
|
formatsToSupport,
|
|
64
|
-
|
|
86
|
+
onScannerSizeChanged: setScannerSize,
|
|
65
87
|
onScanSuccess: handleScanSuccess,
|
|
66
88
|
onScanFailure: showScanFailure,
|
|
89
|
+
onCameraStartFailure: showCameraStartFailure,
|
|
67
90
|
});
|
|
68
91
|
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
const handleResize = () => setViewport(getViewportSize());
|
|
94
|
+
window.addEventListener('resize', handleResize);
|
|
95
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
69
98
|
useEffect(() => {
|
|
70
99
|
if (!visible) {
|
|
71
100
|
return;
|
|
@@ -129,24 +158,29 @@ function CodeScannerContent({ visible, formatsToSupport, onClose, onScanSuccess
|
|
|
129
158
|
inset: 0;
|
|
130
159
|
z-index: ${token.zIndexPopupBase + 1000};
|
|
131
160
|
overflow: hidden;
|
|
132
|
-
background:
|
|
161
|
+
background: #000;
|
|
133
162
|
`;
|
|
134
163
|
const scannerWrapperClass = css`
|
|
135
164
|
position: absolute;
|
|
136
165
|
inset: 0;
|
|
137
166
|
overflow: hidden;
|
|
138
167
|
`;
|
|
168
|
+
const scannerSurfaceClass = css`
|
|
169
|
+
position: absolute;
|
|
170
|
+
top: 50%;
|
|
171
|
+
left: 50%;
|
|
172
|
+
transform-origin: center;
|
|
173
|
+
`;
|
|
139
174
|
const scannerClass = css`
|
|
175
|
+
position: relative;
|
|
140
176
|
width: 100%;
|
|
141
|
-
height:
|
|
142
|
-
display: flex;
|
|
143
|
-
justify-content: center;
|
|
144
|
-
align-items: center;
|
|
177
|
+
line-height: 0;
|
|
145
178
|
|
|
146
179
|
video {
|
|
147
|
-
width:
|
|
148
|
-
height:
|
|
180
|
+
width: 100% !important;
|
|
181
|
+
height: auto !important;
|
|
149
182
|
max-width: none !important;
|
|
183
|
+
display: block !important;
|
|
150
184
|
}
|
|
151
185
|
|
|
152
186
|
#qr-shaded-region {
|
|
@@ -174,26 +208,36 @@ function CodeScannerContent({ visible, formatsToSupport, onClose, onScanSuccess
|
|
|
174
208
|
return (
|
|
175
209
|
<div className={rootClass}>
|
|
176
210
|
<div className={scannerWrapperClass}>
|
|
177
|
-
<div
|
|
211
|
+
<div
|
|
212
|
+
className={scannerSurfaceClass}
|
|
213
|
+
style={{
|
|
214
|
+
width: `${SCANNER_RENDER_WIDTH}px`,
|
|
215
|
+
transform: `translate(-50%, -50%) scale(${previewScale})`,
|
|
216
|
+
}}
|
|
217
|
+
>
|
|
218
|
+
<div id={scannerElementId} className={scannerClass} />
|
|
219
|
+
</div>
|
|
178
220
|
</div>
|
|
221
|
+
{cameraAvailable && scannerSize.width > 0 && (
|
|
222
|
+
<ScanBox
|
|
223
|
+
style={{
|
|
224
|
+
position: 'fixed',
|
|
225
|
+
top: `${(viewport.height - visibleScanBoxSize.height) / 2}px`,
|
|
226
|
+
left: `${(viewport.width - visibleScanBoxSize.width) / 2}px`,
|
|
227
|
+
width: `${visibleScanBoxSize.width}px`,
|
|
228
|
+
height: `${visibleScanBoxSize.height}px`,
|
|
229
|
+
}}
|
|
230
|
+
/>
|
|
231
|
+
)}
|
|
232
|
+
<Button
|
|
233
|
+
aria-label={t('Close')}
|
|
234
|
+
className={closeButtonClass}
|
|
235
|
+
icon={<LeftOutlined />}
|
|
236
|
+
type="text"
|
|
237
|
+
onClick={onClose}
|
|
238
|
+
/>
|
|
179
239
|
{cameraAvailable && (
|
|
180
240
|
<>
|
|
181
|
-
<ScanBox
|
|
182
|
-
style={{
|
|
183
|
-
position: 'fixed',
|
|
184
|
-
top: `${(viewport.height - scanBoxSize.height) / 2}px`,
|
|
185
|
-
left: `${(viewport.width - scanBoxSize.width) / 2}px`,
|
|
186
|
-
width: `${scanBoxSize.width}px`,
|
|
187
|
-
height: `${scanBoxSize.height}px`,
|
|
188
|
-
}}
|
|
189
|
-
/>
|
|
190
|
-
<Button
|
|
191
|
-
aria-label={t('Close')}
|
|
192
|
-
className={closeButtonClass}
|
|
193
|
-
icon={<LeftOutlined />}
|
|
194
|
-
type="text"
|
|
195
|
-
onClick={onClose}
|
|
196
|
-
/>
|
|
197
241
|
<Button className={albumClass} icon={<FileImageOutlined />} type="text" onClick={handleImageButtonClick}>
|
|
198
242
|
{t('Album')}
|
|
199
243
|
</Button>
|
|
@@ -0,0 +1,101 @@
|
|
|
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 { act, render, waitFor } from '@testing-library/react';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
13
|
+
import { CodeScanner } from '../CodeScanner';
|
|
14
|
+
|
|
15
|
+
const mocks = vi.hoisted(() => ({
|
|
16
|
+
getCameras: vi.fn().mockResolvedValue([{ id: 'rear-camera' }]),
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
vi.mock('html5-qrcode', () => ({
|
|
20
|
+
Html5Qrcode: {
|
|
21
|
+
getCameras: mocks.getCameras,
|
|
22
|
+
},
|
|
23
|
+
Html5QrcodeScannerState: {
|
|
24
|
+
PAUSED: 3,
|
|
25
|
+
SCANNING: 2,
|
|
26
|
+
},
|
|
27
|
+
Html5QrcodeSupportedFormats: {
|
|
28
|
+
CODABAR: 2,
|
|
29
|
+
CODE_128: 5,
|
|
30
|
+
CODE_39: 3,
|
|
31
|
+
CODE_93: 4,
|
|
32
|
+
DATA_MATRIX: 6,
|
|
33
|
+
EAN_13: 9,
|
|
34
|
+
EAN_8: 10,
|
|
35
|
+
ITF: 8,
|
|
36
|
+
PDF_417: 11,
|
|
37
|
+
QR_CODE: 0,
|
|
38
|
+
UPC_A: 14,
|
|
39
|
+
UPC_E: 15,
|
|
40
|
+
},
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
vi.mock('react-i18next', () => ({
|
|
44
|
+
useTranslation: () => ({ t: (key: string) => key }),
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
vi.mock('../useCodeScanner', async (importOriginal) => {
|
|
48
|
+
const actual = await importOriginal<typeof import('../useCodeScanner')>();
|
|
49
|
+
const ReactModule = await import('react');
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
...actual,
|
|
53
|
+
useCodeScanner: ({
|
|
54
|
+
enabled,
|
|
55
|
+
onScannerSizeChanged,
|
|
56
|
+
}: {
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
onScannerSizeChanged?: (size: { width: number; height: number }) => void;
|
|
59
|
+
}) => {
|
|
60
|
+
ReactModule.useEffect(() => {
|
|
61
|
+
if (enabled) {
|
|
62
|
+
onScannerSizeChanged?.({ width: 1280, height: 720 });
|
|
63
|
+
}
|
|
64
|
+
}, [enabled, onScannerSizeChanged]);
|
|
65
|
+
|
|
66
|
+
return { startScanFile: vi.fn() };
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('CodeScanner', () => {
|
|
72
|
+
afterEach(() => {
|
|
73
|
+
vi.restoreAllMocks();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('keeps the camera preview covering portrait and landscape viewports', async () => {
|
|
77
|
+
let viewportWidth = 390;
|
|
78
|
+
let viewportHeight = 844;
|
|
79
|
+
vi.spyOn(window, 'innerWidth', 'get').mockImplementation(() => viewportWidth);
|
|
80
|
+
vi.spyOn(window, 'innerHeight', 'get').mockImplementation(() => viewportHeight);
|
|
81
|
+
|
|
82
|
+
render(<CodeScanner visible onClose={() => undefined} onScanSuccess={() => undefined} />);
|
|
83
|
+
|
|
84
|
+
await waitFor(() => expect(document.getElementById('code-scan-box')).toBeInTheDocument());
|
|
85
|
+
|
|
86
|
+
const scannerElement = document.querySelector<HTMLElement>('[id^="code-scanner-"]');
|
|
87
|
+
const scannerSurface = scannerElement?.parentElement;
|
|
88
|
+
const scanBox = document.getElementById('code-scan-box');
|
|
89
|
+
expect(scannerSurface?.style.transform).toBe(`translate(-50%, -50%) scale(${844 / 720})`);
|
|
90
|
+
expect(scanBox).toHaveStyle({ width: '351px', height: '540px' });
|
|
91
|
+
|
|
92
|
+
viewportWidth = 844;
|
|
93
|
+
viewportHeight = 390;
|
|
94
|
+
act(() => window.dispatchEvent(new Event('resize')));
|
|
95
|
+
|
|
96
|
+
await waitFor(() => {
|
|
97
|
+
expect(scannerSurface?.style.transform).toBe(`translate(-50%, -50%) scale(${844 / 1280})`);
|
|
98
|
+
expect(scanBox).toHaveStyle({ width: '759px', height: '273px' });
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|