@pisell/materials 1.0.1107 → 1.0.1109
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +3 -3
- package/build/lowcode/preview.css +1 -1
- package/build/lowcode/preview.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +48 -48
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +48 -48
- package/es/components/PisellBasicGrid/PisellBasicGrid.d.ts +1 -2
- package/es/components/PisellCards/components/GraphicTextCard/GraphicTextCard.d.ts +1 -2
- package/es/components/PisellCards/components/MultilevelCard/MultilevelCard.d.ts +1 -1
- package/es/components/PisellCards/components/PisellImageCard/PisellImageCard.d.ts +1 -2
- package/es/components/PisellCards/components/TabCard/TabCard.d.ts +1 -2
- package/es/components/PisellCards/components/TextCard/TextCard.d.ts +1 -2
- package/es/components/PisellCards/index.d.ts +5 -6
- package/es/components/PisellContactBrief/PisellContactBrief.d.ts +2 -2
- package/es/components/PisellLayouts/index.d.ts +2 -2
- package/es/components/PisellMetrics/index.d.ts +2 -2
- package/es/components/appVersionControl/index.d.ts +1 -2
- package/es/components/auto-complete-number/index.d.ts +1 -2
- package/es/components/badge/index.d.ts +1 -2
- package/es/components/batch-editor/index.d.ts +1 -2
- package/es/components/calendar/index.d.ts +1 -4
- package/es/components/cardMetricItem/index.d.ts +1 -1
- package/es/components/cardPro/index.d.ts +1 -2
- package/es/components/checkbox/index.d.ts +1 -4
- package/es/components/classicLayout/index.d.ts +1 -2
- package/es/components/config-provider/index.d.ts +1 -2
- package/es/components/customSelect/index.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/group/index.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceMenu/index.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -4
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +1 -2
- package/es/components/dataSourceComponents/fields/IdentityRecognition/IdentityRecognitionEditor.d.ts +15 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/IdentityRecognitionEditor.js +202 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/SortableList.js +66 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/config.d.ts +10 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/config.js +61 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/index.d.ts +24 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/index.js +38 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/locales.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/locales.js +191 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/model.d.ts +8 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/model.js +77 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/style.less +114 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/types.d.ts +48 -0
- package/es/components/dataSourceComponents/fields/IdentityRecognition/useIdentityText.js +14 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -2
- package/es/components/dataSourceComponents/fields/index.js +4 -1
- package/es/components/dataSourceComponents/fields/utils.js +2 -0
- package/es/components/date-picker/index.d.ts +1 -4
- package/es/components/drag-sort-tree/index.d.ts +1 -2
- package/es/components/dropdown/index.d.ts +1 -3
- package/es/components/filter/index.d.ts +1 -2
- package/es/components/hardwareErrorTip/errorCard/index.d.ts +0 -1
- package/es/components/hardwareErrorTip/errorTipStatistics/index.d.ts +0 -1
- package/es/components/hardwareErrorTip/logCard/index.d.ts +0 -1
- package/es/components/keyboard/index.d.ts +1 -1
- package/es/components/list/index.d.ts +2 -2
- package/es/components/lowCodePage/index.d.ts +1 -3
- package/es/components/page/index.d.ts +1 -2
- package/es/components/page-header/index.d.ts +1 -1
- package/es/components/pisellActionPanel/PisellActionPanel.d.ts +2 -2
- package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +1 -2
- package/es/components/pisellAdjustPrice/index.d.ts +1 -2
- package/es/components/pisellAlert/index.d.ts +1 -1
- package/es/components/pisellBaseCard/PisellBaseCard.d.ts +2 -2
- package/es/components/pisellCalendar/PisellCalendar.d.ts +2 -2
- package/es/components/pisellCalendar/PisellCalendar.js +1 -1
- package/es/components/pisellCard/index.d.ts +1 -2
- package/es/components/pisellCheckboxGroup/index.d.ts +1 -1
- package/es/components/pisellCountdown/index.d.ts +1 -1
- package/es/components/pisellCustomerBrief/PisellCustomerBrief.d.ts +2 -2
- package/es/components/pisellDatePicker/index.d.ts +1 -4
- package/es/components/pisellDraggable/index.d.ts +1 -1
- package/es/components/pisellEmpty/index.d.ts +1 -1
- package/es/components/pisellEntityCard/PisellEntityCard.d.ts +2 -2
- package/es/components/pisellExport/PisellExport.d.ts +2 -2
- package/es/components/pisellFilter/index.d.ts +1 -2
- package/es/components/pisellFloatingPanel/index.d.ts +1 -1
- package/es/components/pisellFloorMapLayout/components/FigmaTableCard.d.ts +5 -5
- package/es/components/pisellFloorMapLayout/components/FloorMapBuiltinShapeElement.d.ts +2 -2
- package/es/components/pisellFloorMapLayout/components/FloorMapImageElement.d.ts +2 -3
- package/es/components/pisellFloorMapLayout/components/FloorMapSelectionZoneElement.d.ts +2 -2
- package/es/components/pisellFloorMapLayout/context/FloorMapLayoutContext.d.ts +1 -1
- package/es/components/pisellGantt/PisellGantt.d.ts +2 -2
- package/es/components/pisellGoodPassCard/index.d.ts +1 -1
- package/es/components/pisellGridPro/GridView/index.d.ts +1 -2
- package/es/components/pisellImport/PisellImport.d.ts +2 -2
- package/es/components/pisellInformationEntry/index.d.ts +1 -1
- package/es/components/pisellInput/components/BankCard/index.d.ts +0 -1
- package/es/components/pisellInput/components/Copy/index.d.ts +0 -1
- package/es/components/pisellInput/components/SecurityCode/index.d.ts +0 -1
- package/es/components/pisellInput/index.d.ts +5 -5
- package/es/components/pisellLoading/index.d.ts +1 -2
- package/es/components/pisellMobileDateRangePicker/PisellMobileDateRangePicker.js +1 -0
- package/es/components/pisellMobileDateRangePicker/types.d.ts +4 -3
- package/es/components/pisellModal/index.d.ts +2 -2
- package/es/components/pisellRecordBoard/shellFrame/Calendar/PisellRecordBoardCalendarView.d.ts +2 -2
- package/es/components/pisellReservationSchedule/PisellReservationSchedule.d.ts +1 -1
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.d.ts +2 -2
- package/es/components/pisellRow/index.d.ts +1 -1
- package/es/components/pisellSort/index.d.ts +1 -2
- package/es/components/pisellStatisticList/index.d.ts +1 -1
- package/es/components/pisellTags/index.d.ts +1 -1
- package/es/components/pisellText/index.d.ts +2 -2
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.d.ts +2 -2
- package/es/components/pisellTooltip/index.d.ts +1 -2
- package/es/components/pisellUpload/index.d.ts +1 -2
- package/es/components/pisellWalletPassCard/index.d.ts +1 -1
- package/es/components/qrcode/index.d.ts +1 -3
- package/es/components/radio/index.d.ts +1 -4
- package/es/components/section-footers/index.d.ts +1 -3
- package/es/components/segmented/index.d.ts +1 -2
- package/es/components/select-time/index.d.ts +1 -2
- package/es/components/skeleton/index.d.ts +1 -4
- package/es/components/slider/index.d.ts +1 -3
- package/es/components/tabs/index.d.ts +2 -2
- package/es/components/time-picker/index.d.ts +1 -4
- package/es/components/upload/index.d.ts +1 -4
- package/es/components/versionSelect/index.d.ts +0 -1
- package/es/components/virtual-keyboard/Amount/index.d.ts +1 -2
- package/es/components/virtual-keyboard/Number/index.d.ts +1 -2
- package/es/components/virtual-keyboard/Time/index.d.ts +1 -1
- package/es/components/virtual-keyboard/index.d.ts +1 -1
- package/es/index.d.ts +7 -1
- package/es/index.js +6 -1
- package/es/pisell-materials.tw.css +1 -1
- package/lib/components/PisellBasicGrid/PisellBasicGrid.d.ts +2 -2
- package/lib/components/PisellCards/components/GraphicTextCard/GraphicTextCard.d.ts +2 -2
- package/lib/components/PisellCards/components/MultilevelCard/MultilevelCard.d.ts +1 -1
- package/lib/components/PisellCards/components/PisellImageCard/PisellImageCard.d.ts +2 -2
- package/lib/components/PisellCards/components/TabCard/TabCard.d.ts +2 -2
- package/lib/components/PisellCards/components/TextCard/TextCard.d.ts +2 -2
- package/lib/components/PisellCards/index.d.ts +5 -6
- package/lib/components/PisellContactBrief/PisellContactBrief.d.ts +2 -2
- package/lib/components/PisellLayouts/index.d.ts +2 -2
- package/lib/components/PisellMetrics/index.d.ts +2 -2
- package/lib/components/appVersionControl/index.d.ts +2 -2
- package/lib/components/auto-complete-number/index.d.ts +2 -2
- package/lib/components/badge/index.d.ts +2 -2
- package/lib/components/batch-editor/index.d.ts +2 -2
- package/lib/components/calendar/index.d.ts +1 -3
- package/lib/components/cardMetricItem/index.d.ts +1 -1
- package/lib/components/cardPro/index.d.ts +2 -2
- package/lib/components/checkbox/index.d.ts +1 -3
- package/lib/components/classicLayout/index.d.ts +2 -2
- package/lib/components/config-provider/index.d.ts +2 -2
- package/lib/components/customSelect/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/group/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceMenu/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -3
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/IdentityRecognitionEditor.d.ts +15 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/IdentityRecognitionEditor.js +205 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/SortableList.js +68 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/config.d.ts +10 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/config.js +64 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/index.d.ts +25 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/index.js +41 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/locales.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/locales.js +191 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/model.d.ts +8 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/model.js +81 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/style.less +114 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/types.d.ts +48 -0
- package/lib/components/dataSourceComponents/fields/IdentityRecognition/useIdentityText.js +15 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -2
- package/lib/components/dataSourceComponents/fields/index.js +32 -29
- package/lib/components/dataSourceComponents/fields/utils.js +2 -0
- package/lib/components/date-picker/index.d.ts +1 -3
- package/lib/components/drag-sort-tree/index.d.ts +2 -2
- package/lib/components/dropdown/index.d.ts +2 -3
- package/lib/components/filter/index.d.ts +2 -2
- package/lib/components/hardwareErrorTip/errorCard/index.d.ts +1 -1
- package/lib/components/hardwareErrorTip/errorTipStatistics/index.d.ts +1 -1
- package/lib/components/hardwareErrorTip/logCard/index.d.ts +1 -1
- package/lib/components/keyboard/index.d.ts +1 -1
- package/lib/components/list/index.d.ts +2 -2
- package/lib/components/lowCodePage/index.d.ts +2 -3
- package/lib/components/page/index.d.ts +2 -2
- package/lib/components/page-header/index.d.ts +1 -1
- package/lib/components/pisellActionPanel/PisellActionPanel.d.ts +2 -2
- package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +2 -2
- package/lib/components/pisellAdjustPrice/index.d.ts +2 -2
- package/lib/components/pisellAlert/index.d.ts +1 -1
- package/lib/components/pisellBaseCard/PisellBaseCard.d.ts +2 -2
- package/lib/components/pisellCalendar/PisellCalendar.d.ts +2 -2
- package/lib/components/pisellCalendar/PisellCalendar.js +1 -1
- package/lib/components/pisellCard/index.d.ts +2 -2
- package/lib/components/pisellCheckboxGroup/index.d.ts +1 -1
- package/lib/components/pisellCountdown/index.d.ts +1 -1
- package/lib/components/pisellCustomerBrief/PisellCustomerBrief.d.ts +2 -2
- package/lib/components/pisellDatePicker/index.d.ts +1 -3
- package/lib/components/pisellDraggable/index.d.ts +1 -1
- package/lib/components/pisellEmpty/index.d.ts +1 -1
- package/lib/components/pisellEntityCard/PisellEntityCard.d.ts +2 -2
- package/lib/components/pisellExport/PisellExport.d.ts +2 -2
- package/lib/components/pisellFilter/index.d.ts +2 -2
- package/lib/components/pisellFloatingPanel/index.d.ts +1 -1
- package/lib/components/pisellFloorMapLayout/components/FigmaTableCard.d.ts +5 -5
- package/lib/components/pisellFloorMapLayout/components/FloorMapBuiltinShapeElement.d.ts +2 -2
- package/lib/components/pisellFloorMapLayout/components/FloorMapImageElement.d.ts +2 -3
- package/lib/components/pisellFloorMapLayout/components/FloorMapSelectionZoneElement.d.ts +2 -2
- package/lib/components/pisellFloorMapLayout/context/FloorMapLayoutContext.d.ts +1 -1
- package/lib/components/pisellGantt/PisellGantt.d.ts +2 -2
- package/lib/components/pisellGoodPassCard/index.d.ts +1 -1
- package/lib/components/pisellGridPro/GridView/index.d.ts +2 -2
- package/lib/components/pisellImport/PisellImport.d.ts +2 -2
- package/lib/components/pisellInformationEntry/index.d.ts +1 -1
- package/lib/components/pisellInput/components/BankCard/index.d.ts +1 -1
- package/lib/components/pisellInput/components/Copy/index.d.ts +1 -1
- package/lib/components/pisellInput/components/SecurityCode/index.d.ts +1 -1
- package/lib/components/pisellInput/index.d.ts +5 -5
- package/lib/components/pisellLoading/index.d.ts +2 -2
- package/lib/components/pisellMobileDateRangePicker/PisellMobileDateRangePicker.js +1 -0
- package/lib/components/pisellMobileDateRangePicker/types.d.ts +4 -3
- package/lib/components/pisellModal/index.d.ts +2 -2
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/PisellRecordBoardCalendarView.d.ts +2 -2
- package/lib/components/pisellReservationSchedule/PisellReservationSchedule.d.ts +1 -1
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.d.ts +2 -2
- package/lib/components/pisellRow/index.d.ts +1 -1
- package/lib/components/pisellSort/index.d.ts +2 -2
- package/lib/components/pisellStatisticList/index.d.ts +1 -1
- package/lib/components/pisellTags/index.d.ts +1 -1
- package/lib/components/pisellText/index.d.ts +2 -2
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.d.ts +2 -2
- package/lib/components/pisellTooltip/index.d.ts +2 -2
- package/lib/components/pisellUpload/index.d.ts +2 -2
- package/lib/components/pisellWalletPassCard/index.d.ts +1 -1
- package/lib/components/qrcode/index.d.ts +2 -3
- package/lib/components/radio/index.d.ts +1 -3
- package/lib/components/section-footers/index.d.ts +1 -3
- package/lib/components/segmented/index.d.ts +2 -2
- package/lib/components/select-time/index.d.ts +2 -2
- package/lib/components/skeleton/index.d.ts +1 -3
- package/lib/components/slider/index.d.ts +2 -3
- package/lib/components/tabs/index.d.ts +2 -2
- package/lib/components/time-picker/index.d.ts +1 -3
- package/lib/components/upload/index.d.ts +1 -3
- package/lib/components/versionSelect/index.d.ts +1 -1
- package/lib/components/virtual-keyboard/Amount/index.d.ts +2 -2
- package/lib/components/virtual-keyboard/Number/index.d.ts +2 -2
- package/lib/components/virtual-keyboard/Time/index.d.ts +1 -1
- package/lib/components/virtual-keyboard/index.d.ts +1 -1
- package/lib/index.d.ts +7 -1
- package/lib/index.js +115 -102
- package/lib/pisell-materials.tw.css +1 -1
- package/lowcode/_utils/identificationMeta.ts +59 -0
- package/lowcode/data-source-form/constants.ts +6 -0
- package/lowcode/data-source-form/utils.ts +20 -2
- package/lowcode/form-item-smart-locker-identification/meta.ts +8 -0
- package/lowcode/form-item-smart-locker-identification/snippets.ts +17 -0
- package/lowcode/form-item-vending-machine-identification/meta.ts +8 -0
- package/lowcode/form-item-vending-machine-identification/snippets.ts +17 -0
- package/package.json +19 -19
- package/lowcode/pisell-brand/meta.ts +0 -363
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IdentityRecognitionProps } from "./types.js";
|
|
3
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/IdentityRecognitionEditor.d.ts
|
|
4
|
+
declare function IdentityRecognitionEditor({
|
|
5
|
+
config,
|
|
6
|
+
value,
|
|
7
|
+
onChange,
|
|
8
|
+
disabled,
|
|
9
|
+
readOnly,
|
|
10
|
+
renderMode,
|
|
11
|
+
className,
|
|
12
|
+
style
|
|
13
|
+
}: IdentityRecognitionProps): JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { IdentityRecognitionEditor };
|
package/lib/components/dataSourceComponents/fields/IdentityRecognition/IdentityRecognitionEditor.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
|
+
const require_index = require("../../../pisellModal/index.js");
|
|
4
|
+
const require_useIdentityText = require("./useIdentityText.js");
|
|
5
|
+
const require_SortableList = require("./SortableList.js");
|
|
6
|
+
const require_model = require("./model.js");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
react = require_runtime.__toESM(react);
|
|
9
|
+
let antd = require("antd");
|
|
10
|
+
let _ant_design_icons = require("@ant-design/icons");
|
|
11
|
+
let lodash_isEqual = require("lodash/isEqual");
|
|
12
|
+
lodash_isEqual = require_runtime.__toESM(lodash_isEqual);
|
|
13
|
+
require("./style.less");
|
|
14
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/IdentityRecognitionEditor.tsx
|
|
15
|
+
function IdentityRecognitionEditor({ config, value, onChange, disabled, readOnly, renderMode, className, style }) {
|
|
16
|
+
const t = require_useIdentityText.default();
|
|
17
|
+
const { token } = antd.theme.useToken();
|
|
18
|
+
const padding = antd.Grid.useBreakpoint().sm === false ? token.padding : token.paddingLG;
|
|
19
|
+
const themeStyle = {
|
|
20
|
+
"--identity-border": token.colorBorderSecondary,
|
|
21
|
+
"--identity-radius": `${token.borderRadiusLG}px`,
|
|
22
|
+
"--identity-background": token.colorBgContainer,
|
|
23
|
+
"--identity-text": token.colorText,
|
|
24
|
+
"--identity-muted": token.colorTextTertiary,
|
|
25
|
+
"--identity-hover": token.colorFillTertiary,
|
|
26
|
+
"--identity-primary": token.colorPrimary,
|
|
27
|
+
"--identity-error": token.colorError,
|
|
28
|
+
"--identity-font-size": `${token.fontSize}px`,
|
|
29
|
+
"--identity-font-family": token.fontFamily
|
|
30
|
+
};
|
|
31
|
+
const [draft, setDraft] = (0, react.useState)(null);
|
|
32
|
+
const initialDraft = (0, react.useRef)(null);
|
|
33
|
+
const [confirmClose, setConfirmClose] = (0, react.useState)(false);
|
|
34
|
+
const [errors, setErrors] = (0, react.useState)({});
|
|
35
|
+
const isDisabled = disabled || renderMode === "disabled";
|
|
36
|
+
const locked = isDisabled || readOnly || renderMode === "view" || renderMode === "tableView";
|
|
37
|
+
(0, react.useEffect)(() => {
|
|
38
|
+
setDraft(null);
|
|
39
|
+
initialDraft.current = null;
|
|
40
|
+
setConfirmClose(false);
|
|
41
|
+
setErrors({});
|
|
42
|
+
}, [value, config]);
|
|
43
|
+
const rows = Array.isArray(value) ? value.filter((row) => row && config.methods.some((method) => method.id === row.id)) : [];
|
|
44
|
+
const activeMethod = config.methods.find((method) => method.id === (draft === null || draft === void 0 ? void 0 : draft.id));
|
|
45
|
+
const close = () => {
|
|
46
|
+
setDraft(null);
|
|
47
|
+
initialDraft.current = null;
|
|
48
|
+
setConfirmClose(false);
|
|
49
|
+
setErrors({});
|
|
50
|
+
};
|
|
51
|
+
const requestClose = () => {
|
|
52
|
+
if (draft && !(0, lodash_isEqual.default)(draft, initialDraft.current)) setConfirmClose(true);
|
|
53
|
+
else close();
|
|
54
|
+
};
|
|
55
|
+
const updateSettings = (id, settings) => {
|
|
56
|
+
if (!draft || locked) return;
|
|
57
|
+
setDraft(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, draft), {}, { settings: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, draft.settings), {}, { [id]: settings }) }));
|
|
58
|
+
setErrors((current) => {
|
|
59
|
+
const next = require_objectSpread2._objectSpread2({}, current);
|
|
60
|
+
delete next[id];
|
|
61
|
+
return next;
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const save = () => {
|
|
65
|
+
if (!draft || locked) return;
|
|
66
|
+
const nextErrors = require_model.validateIdentityRow(draft, config, t);
|
|
67
|
+
setErrors(nextErrors);
|
|
68
|
+
if (Object.keys(nextErrors).length) return;
|
|
69
|
+
onChange === null || onChange === void 0 || onChange(rows.map((row) => row.id === draft.id ? require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, row), {}, { settings: draft.settings }) : row));
|
|
70
|
+
close();
|
|
71
|
+
};
|
|
72
|
+
const sortingText = {
|
|
73
|
+
reorderLabel: (method) => t("reorder", { method }),
|
|
74
|
+
instructions: t("sortInstructions")
|
|
75
|
+
};
|
|
76
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
77
|
+
className: `identity-recognition ${className || ""}`,
|
|
78
|
+
style: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, themeStyle), style)
|
|
79
|
+
}, !rows.length && /* @__PURE__ */ react.default.createElement(antd.Alert, {
|
|
80
|
+
type: "info",
|
|
81
|
+
message: t("empty")
|
|
82
|
+
}), /* @__PURE__ */ react.default.createElement(require_SortableList.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
|
|
83
|
+
items: rows,
|
|
84
|
+
disabled: locked
|
|
85
|
+
}, sortingText), {}, {
|
|
86
|
+
label: (row) => t(config.methods.find((method) => method.id === row.id).label),
|
|
87
|
+
onChange: (next) => onChange === null || onChange === void 0 ? void 0 : onChange(next)
|
|
88
|
+
}), (row) => {
|
|
89
|
+
const label = t(config.methods.find((item) => item.id === row.id).label);
|
|
90
|
+
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "identity-recognition__label" }, label), /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
91
|
+
disabled: isDisabled,
|
|
92
|
+
"aria-label": t("settingsTitle", { method: label }),
|
|
93
|
+
onClick: () => {
|
|
94
|
+
const nextDraft = require_model.createIdentityDraft(row, config);
|
|
95
|
+
initialDraft.current = nextDraft;
|
|
96
|
+
setDraft(nextDraft);
|
|
97
|
+
setConfirmClose(false);
|
|
98
|
+
setErrors({});
|
|
99
|
+
}
|
|
100
|
+
}, t("settings")), /* @__PURE__ */ react.default.createElement(antd.Switch, {
|
|
101
|
+
"aria-label": t("enable", { method: label }),
|
|
102
|
+
checked: row.enabled === true,
|
|
103
|
+
disabled: locked,
|
|
104
|
+
onChange: (enabled) => onChange === null || onChange === void 0 ? void 0 : onChange(rows.map((item) => item.id === row.id ? require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, { enabled }) : item))
|
|
105
|
+
}));
|
|
106
|
+
}), /* @__PURE__ */ react.default.createElement(antd.Drawer, {
|
|
107
|
+
open: !!draft,
|
|
108
|
+
onClose: requestClose,
|
|
109
|
+
width: 720,
|
|
110
|
+
rootClassName: "identity-recognition-drawer",
|
|
111
|
+
rootStyle: themeStyle,
|
|
112
|
+
contentWrapperStyle: { maxWidth: "100vw" },
|
|
113
|
+
destroyOnClose: true,
|
|
114
|
+
styles: {
|
|
115
|
+
header: { padding: `${token.padding}px ${padding}px` },
|
|
116
|
+
body: {
|
|
117
|
+
padding,
|
|
118
|
+
background: token.colorBgLayout
|
|
119
|
+
},
|
|
120
|
+
footer: { padding: `${token.paddingSM}px ${padding}px` }
|
|
121
|
+
},
|
|
122
|
+
closable: false,
|
|
123
|
+
extra: /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
124
|
+
type: "text",
|
|
125
|
+
"aria-label": t("close"),
|
|
126
|
+
title: t("close"),
|
|
127
|
+
icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.CloseOutlined, null),
|
|
128
|
+
onClick: requestClose
|
|
129
|
+
}),
|
|
130
|
+
title: /* @__PURE__ */ react.default.createElement("div", { className: "identity-recognition__drawer-heading" }, /* @__PURE__ */ react.default.createElement(antd.Typography.Text, {
|
|
131
|
+
type: "secondary",
|
|
132
|
+
style: {
|
|
133
|
+
fontSize: token.fontSizeSM,
|
|
134
|
+
fontWeight: 400
|
|
135
|
+
}
|
|
136
|
+
}, t("sharedMethod")), /* @__PURE__ */ react.default.createElement(antd.Typography.Text, {
|
|
137
|
+
strong: true,
|
|
138
|
+
style: { fontSize: token.fontSizeLG }
|
|
139
|
+
}, activeMethod ? t("settingsTitle", { method: t(activeMethod.label) }) : t("settings"))),
|
|
140
|
+
footer: /* @__PURE__ */ react.default.createElement("div", { className: "identity-recognition__footer" }, /* @__PURE__ */ react.default.createElement(antd.Button, { onClick: requestClose }, t(locked ? "close" : "cancel")), !locked && /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
141
|
+
type: "primary",
|
|
142
|
+
onClick: save
|
|
143
|
+
}, t("save")))
|
|
144
|
+
}, /* @__PURE__ */ react.default.createElement("div", { className: "identity-recognition__groups" }, draft && activeMethod && config.groups.map((group) => {
|
|
145
|
+
const settings = draft.settings[group.id];
|
|
146
|
+
const groupTitle = t(group.title);
|
|
147
|
+
return /* @__PURE__ */ react.default.createElement(antd.Card, {
|
|
148
|
+
key: group.id,
|
|
149
|
+
className: "identity-recognition__group",
|
|
150
|
+
role: "region",
|
|
151
|
+
"aria-label": groupTitle,
|
|
152
|
+
headStyle: {
|
|
153
|
+
padding: `${token.padding}px ${padding}px`,
|
|
154
|
+
minHeight: "auto"
|
|
155
|
+
},
|
|
156
|
+
bodyStyle: { padding },
|
|
157
|
+
title: /* @__PURE__ */ react.default.createElement("div", { className: "identity-recognition__group-heading" }, /* @__PURE__ */ react.default.createElement(antd.Typography.Text, { strong: true }, groupTitle), /* @__PURE__ */ react.default.createElement(antd.Typography.Text, {
|
|
158
|
+
type: "secondary",
|
|
159
|
+
style: {
|
|
160
|
+
fontWeight: 400,
|
|
161
|
+
fontSize: token.fontSizeSM
|
|
162
|
+
}
|
|
163
|
+
}, t("groupDescription")))
|
|
164
|
+
}, /* @__PURE__ */ react.default.createElement("div", { className: "identity-recognition__section" }, /* @__PURE__ */ react.default.createElement("div", { className: "identity-recognition__verification" }, /* @__PURE__ */ react.default.createElement("div", { className: "identity-recognition__field-heading" }, /* @__PURE__ */ react.default.createElement(antd.Typography.Text, { strong: true }, t("requireVerification")), /* @__PURE__ */ react.default.createElement(antd.Typography.Text, { type: "secondary" }, t("verificationHint"))), /* @__PURE__ */ react.default.createElement(antd.Switch, {
|
|
165
|
+
"aria-label": `${groupTitle}: ${t("requireVerification")}`,
|
|
166
|
+
checked: settings.requireVerification,
|
|
167
|
+
disabled: locked,
|
|
168
|
+
onChange: (requireVerification) => updateSettings(group.id, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, settings), {}, { requireVerification }))
|
|
169
|
+
})), settings.requireVerification && /* @__PURE__ */ react.default.createElement("div", { className: "identity-recognition__methods" }, /* @__PURE__ */ react.default.createElement("div", { className: "identity-recognition__field-heading" }, /* @__PURE__ */ react.default.createElement(antd.Typography.Text, { strong: true }, t("verificationMethods")), /* @__PURE__ */ react.default.createElement(antd.Typography.Text, { type: "secondary" }, t("sortHint"))), /* @__PURE__ */ react.default.createElement(require_SortableList.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
|
|
170
|
+
items: settings.methods,
|
|
171
|
+
disabled: locked || !settings.requireVerification
|
|
172
|
+
}, sortingText), {}, {
|
|
173
|
+
label: (item) => t(activeMethod.verificationMethods.find((method) => method.id === item.id).label),
|
|
174
|
+
onChange: (methods) => updateSettings(group.id, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, settings), {}, { methods }))
|
|
175
|
+
}), (item) => {
|
|
176
|
+
const method = activeMethod.verificationMethods.find((entry) => entry.id === item.id);
|
|
177
|
+
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "identity-recognition__label" }, t(method.label)), /* @__PURE__ */ react.default.createElement(antd.Switch, {
|
|
178
|
+
"aria-label": `${groupTitle}: ${t(method.label)}`,
|
|
179
|
+
checked: item.enabled,
|
|
180
|
+
disabled: locked || !settings.requireVerification || !require_model.canDisableVerification(settings, item.id),
|
|
181
|
+
onChange: (enabled) => updateSettings(group.id, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, settings), {}, { methods: settings.methods.map((entry) => entry.id === item.id ? require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, entry), {}, { enabled }) : entry) }))
|
|
182
|
+
}));
|
|
183
|
+
})), errors[group.id] && /* @__PURE__ */ react.default.createElement("div", {
|
|
184
|
+
role: "alert",
|
|
185
|
+
className: "identity-recognition__error"
|
|
186
|
+
}, errors[group.id])));
|
|
187
|
+
}))), /* @__PURE__ */ react.default.createElement(require_index.default, {
|
|
188
|
+
open: confirmClose,
|
|
189
|
+
title: t("unsavedTitle"),
|
|
190
|
+
onCancel: () => setConfirmClose(false),
|
|
191
|
+
onOk: close,
|
|
192
|
+
okText: t("discardChanges"),
|
|
193
|
+
cancelText: t("continueEditing"),
|
|
194
|
+
size: "small",
|
|
195
|
+
closable: false,
|
|
196
|
+
headerDivider: false,
|
|
197
|
+
footerDivider: false,
|
|
198
|
+
keyboard: true,
|
|
199
|
+
mobileModalHeight: "auto",
|
|
200
|
+
wrapClassName: "identity-recognition-confirm",
|
|
201
|
+
centered: true
|
|
202
|
+
}, t("unsavedDescription")));
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
exports.default = IdentityRecognitionEditor;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_runtime.__toESM(react);
|
|
5
|
+
let _ant_design_icons = require("@ant-design/icons");
|
|
6
|
+
let _dnd_kit_core = require("@dnd-kit/core");
|
|
7
|
+
let _dnd_kit_sortable = require("@dnd-kit/sortable");
|
|
8
|
+
let _dnd_kit_utilities = require("@dnd-kit/utilities");
|
|
9
|
+
let _dnd_kit_modifiers = require("@dnd-kit/modifiers");
|
|
10
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/SortableList.tsx
|
|
11
|
+
function SortableRow({ id, label, disabled, onMove, children }) {
|
|
12
|
+
const { setNodeRef, setActivatorNodeRef, attributes, listeners, transform, transition, isDragging } = (0, _dnd_kit_sortable.useSortable)({
|
|
13
|
+
id,
|
|
14
|
+
disabled
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
17
|
+
ref: setNodeRef,
|
|
18
|
+
className: "identity-recognition__row",
|
|
19
|
+
role: "listitem",
|
|
20
|
+
style: {
|
|
21
|
+
transform: _dnd_kit_utilities.CSS.Transform.toString(transform),
|
|
22
|
+
transition,
|
|
23
|
+
position: "relative",
|
|
24
|
+
zIndex: isDragging ? 1 : void 0
|
|
25
|
+
}
|
|
26
|
+
}, /* @__PURE__ */ react.default.createElement("button", require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, attributes), listeners), {}, {
|
|
27
|
+
ref: setActivatorNodeRef,
|
|
28
|
+
type: "button",
|
|
29
|
+
className: "identity-recognition__handle",
|
|
30
|
+
disabled,
|
|
31
|
+
"aria-label": label,
|
|
32
|
+
"aria-keyshortcuts": "Alt+ArrowUp Alt+ArrowDown",
|
|
33
|
+
onKeyDown: (event) => {
|
|
34
|
+
if (!disabled && event.altKey && ["ArrowUp", "ArrowDown"].includes(event.key)) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
onMove(event.key === "ArrowUp" ? -1 : 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}), /* @__PURE__ */ react.default.createElement(_ant_design_icons.HolderOutlined, null)), children);
|
|
40
|
+
}
|
|
41
|
+
function SortableList({ items, disabled, label, reorderLabel, instructions, onChange, children }) {
|
|
42
|
+
const sensors = (0, _dnd_kit_core.useSensors)((0, _dnd_kit_core.useSensor)(_dnd_kit_core.PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
43
|
+
const move = (from, to) => {
|
|
44
|
+
if (!disabled && from >= 0 && to >= 0 && to < items.length && from !== to) onChange((0, _dnd_kit_sortable.arrayMove)(items, from, to));
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ react.default.createElement(_dnd_kit_core.DndContext, {
|
|
47
|
+
sensors,
|
|
48
|
+
accessibility: { screenReaderInstructions: { draggable: instructions } },
|
|
49
|
+
modifiers: [_dnd_kit_modifiers.restrictToVerticalAxis],
|
|
50
|
+
onDragEnd: ({ active, over }) => {
|
|
51
|
+
if (over) move(items.findIndex((item) => item.id === active.id), items.findIndex((item) => item.id === over.id));
|
|
52
|
+
}
|
|
53
|
+
}, /* @__PURE__ */ react.default.createElement(_dnd_kit_sortable.SortableContext, {
|
|
54
|
+
items: items.map((item) => item.id),
|
|
55
|
+
strategy: _dnd_kit_sortable.verticalListSortingStrategy
|
|
56
|
+
}, /* @__PURE__ */ react.default.createElement("div", {
|
|
57
|
+
className: "identity-recognition__list",
|
|
58
|
+
role: "list"
|
|
59
|
+
}, items.map((item, index) => /* @__PURE__ */ react.default.createElement(SortableRow, {
|
|
60
|
+
key: item.id,
|
|
61
|
+
id: item.id,
|
|
62
|
+
label: reorderLabel(label(item)),
|
|
63
|
+
disabled,
|
|
64
|
+
onMove: (direction) => move(index, index + direction)
|
|
65
|
+
}, children(item))))));
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.default = SortableList;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IdentityConfig } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/config.d.ts
|
|
4
|
+
declare const identificationConfigs: {
|
|
5
|
+
SmartLockerIdentification: IdentityConfig;
|
|
6
|
+
VendingMachineIdentification: IdentityConfig;
|
|
7
|
+
};
|
|
8
|
+
declare const isIdentificationInterface: (value: unknown) => value is "SmartLockerIdentification" | "VendingMachineIdentification";
|
|
9
|
+
//#endregion
|
|
10
|
+
export { identificationConfigs, isIdentificationInterface };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/config.ts
|
|
2
|
+
const verificationMethods = (ids) => ids.map((id, index) => ({
|
|
3
|
+
id,
|
|
4
|
+
label: id,
|
|
5
|
+
enabled: index === 0
|
|
6
|
+
}));
|
|
7
|
+
const methods = [
|
|
8
|
+
{
|
|
9
|
+
id: "scan",
|
|
10
|
+
label: "scan",
|
|
11
|
+
enabled: false,
|
|
12
|
+
verificationMethods: verificationMethods([
|
|
13
|
+
"phone_last4",
|
|
14
|
+
"phone_full",
|
|
15
|
+
"account_password",
|
|
16
|
+
"sms_code",
|
|
17
|
+
"email_code"
|
|
18
|
+
])
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "phone_number",
|
|
22
|
+
label: "phone_number",
|
|
23
|
+
enabled: false,
|
|
24
|
+
verificationMethods: verificationMethods(["sms_code", "account_password"])
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "email",
|
|
28
|
+
label: "email",
|
|
29
|
+
enabled: false,
|
|
30
|
+
verificationMethods: verificationMethods([
|
|
31
|
+
"email_code",
|
|
32
|
+
"phone_last4",
|
|
33
|
+
"phone_full",
|
|
34
|
+
"account_password"
|
|
35
|
+
])
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
const smartLockerConfig = {
|
|
39
|
+
methods,
|
|
40
|
+
groups: [{
|
|
41
|
+
id: "store",
|
|
42
|
+
title: "store"
|
|
43
|
+
}, {
|
|
44
|
+
id: "collect",
|
|
45
|
+
title: "collect"
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
const vendingMachineConfig = {
|
|
49
|
+
methods,
|
|
50
|
+
groups: [{
|
|
51
|
+
id: "redeem",
|
|
52
|
+
title: "redeem"
|
|
53
|
+
}]
|
|
54
|
+
};
|
|
55
|
+
const identificationConfigs = {
|
|
56
|
+
SmartLockerIdentification: smartLockerConfig,
|
|
57
|
+
VendingMachineIdentification: vendingMachineConfig
|
|
58
|
+
};
|
|
59
|
+
const isIdentificationInterface = (value) => typeof value === "string" && Object.prototype.hasOwnProperty.call(identificationConfigs, value);
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.identificationConfigs = identificationConfigs;
|
|
62
|
+
exports.isIdentificationInterface = isIdentificationInterface;
|
|
63
|
+
exports.smartLockerConfig = smartLockerConfig;
|
|
64
|
+
exports.vendingMachineConfig = vendingMachineConfig;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WithFormItemProps } from "../../dataSourceForm/utils.js";
|
|
3
|
+
import { IdentityConfig, IdentityMethodId, IdentityRecognitionProps, IdentityRowValue, IdentityValue, VerificationMethodId, VerificationSettings, VerificationValue } from "./types.js";
|
|
4
|
+
import { IdentityRecognitionEditor } from "./IdentityRecognitionEditor.js";
|
|
5
|
+
import { identificationConfigs, isIdentificationInterface } from "./config.js";
|
|
6
|
+
import { getIdentityText } from "./locales.js";
|
|
7
|
+
import { createIdentityDefaultValue, validateIdentityValue } from "./model.js";
|
|
8
|
+
|
|
9
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/index.d.ts
|
|
10
|
+
type IdentificationFieldProps = Omit<IdentityRecognitionProps, 'config'> & WithFormItemProps & {
|
|
11
|
+
defaultValue?: IdentityValue;
|
|
12
|
+
validator?: (value: IdentityValue) => Promise<void> | void;
|
|
13
|
+
};
|
|
14
|
+
declare const SmartLockerIdentification: ({
|
|
15
|
+
defaultValue,
|
|
16
|
+
validator,
|
|
17
|
+
...props
|
|
18
|
+
}: IdentificationFieldProps) => JSX.Element;
|
|
19
|
+
declare const VendingMachineIdentification: ({
|
|
20
|
+
defaultValue,
|
|
21
|
+
validator,
|
|
22
|
+
...props
|
|
23
|
+
}: IdentificationFieldProps) => JSX.Element;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { SmartLockerIdentification, VendingMachineIdentification };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
|
+
const require_objectWithoutProperties = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
|
|
4
|
+
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
5
|
+
const require_utils = require("../../dataSourceForm/utils.js");
|
|
6
|
+
require("./locales.js");
|
|
7
|
+
const require_useIdentityText = require("./useIdentityText.js");
|
|
8
|
+
const require_model = require("./model.js");
|
|
9
|
+
const require_IdentityRecognitionEditor = require("./IdentityRecognitionEditor.js");
|
|
10
|
+
const require_config = require("./config.js");
|
|
11
|
+
let react = require("react");
|
|
12
|
+
react = require_runtime.__toESM(react);
|
|
13
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/index.tsx
|
|
14
|
+
const _excluded = ["defaultValue", "validator"];
|
|
15
|
+
function createIdentificationField(config) {
|
|
16
|
+
const Editor = (props) => /* @__PURE__ */ react.default.createElement(require_IdentityRecognitionEditor.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props), {}, { config }));
|
|
17
|
+
const Field = require_utils.withFormItem(require_utils.withMode(Editor, Editor));
|
|
18
|
+
return function IdentificationField(_ref) {
|
|
19
|
+
let { defaultValue, validator } = _ref, props = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
const t = require_useIdentityText.default();
|
|
21
|
+
const defaults = (0, react.useMemo)(() => require_model.createIdentityDefaultValue(config), []);
|
|
22
|
+
return /* @__PURE__ */ react.default.createElement(Field, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props), {}, {
|
|
23
|
+
initialValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : defaults,
|
|
24
|
+
validator: function() {
|
|
25
|
+
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (value) {
|
|
26
|
+
const error = require_model.validateIdentityValue(value, config, t);
|
|
27
|
+
if (error) throw new Error(error);
|
|
28
|
+
yield validator === null || validator === void 0 ? void 0 : validator(value);
|
|
29
|
+
});
|
|
30
|
+
return function(_x) {
|
|
31
|
+
return _ref2.apply(this, arguments);
|
|
32
|
+
};
|
|
33
|
+
}()
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const SmartLockerIdentification = createIdentificationField(require_config.smartLockerConfig);
|
|
38
|
+
const VendingMachineIdentification = createIdentificationField(require_config.vendingMachineConfig);
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.SmartLockerIdentification = SmartLockerIdentification;
|
|
41
|
+
exports.VendingMachineIdentification = VendingMachineIdentification;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/locales.d.ts
|
|
2
|
+
type IdentityText = (key: string, params?: Record<string, string>) => string;
|
|
3
|
+
declare function getIdentityText(locale?: string): IdentityText;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { IdentityText, getIdentityText };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/locales.ts
|
|
2
|
+
const en = {
|
|
3
|
+
scan: "Scan",
|
|
4
|
+
phone_number: "Phone Number",
|
|
5
|
+
email: "Email",
|
|
6
|
+
phone_last4: "Last 4 phone digits",
|
|
7
|
+
phone_full: "Full phone number",
|
|
8
|
+
account_password: "Account password",
|
|
9
|
+
sms_code: "SMS verification code",
|
|
10
|
+
email_code: "Email verification code",
|
|
11
|
+
store: "When Storing Items",
|
|
12
|
+
collect: "When Collecting Items",
|
|
13
|
+
redeem: "When Redeeming Items",
|
|
14
|
+
sharedMethod: "Shared identification method",
|
|
15
|
+
settings: "Settings",
|
|
16
|
+
settingsTitle: "{method} Settings",
|
|
17
|
+
groupDescription: "Configure verification for this identification method.",
|
|
18
|
+
requireVerification: "Require Verification",
|
|
19
|
+
verificationHint: "When off, account identification is enough.",
|
|
20
|
+
verificationMethods: "Verification Methods",
|
|
21
|
+
sortHint: "Customers complete one method. Drag to set priority.",
|
|
22
|
+
sortInstructions: "Use Alt + Arrow Up or Down to change priority.",
|
|
23
|
+
reorder: "Reorder {method}",
|
|
24
|
+
enable: "Enable {method}",
|
|
25
|
+
save: "Save",
|
|
26
|
+
cancel: "Cancel",
|
|
27
|
+
close: "Close",
|
|
28
|
+
unsavedTitle: "Unsaved Changes",
|
|
29
|
+
unsavedDescription: "You have unsaved changes. Are you sure you want to leave?",
|
|
30
|
+
discardChanges: "Leave",
|
|
31
|
+
continueEditing: "Back",
|
|
32
|
+
empty: "No identification methods configured",
|
|
33
|
+
minimumMethod: "Enable at least one verification method when verification is required.",
|
|
34
|
+
incomplete: "Identification settings are incomplete. Please configure them again.",
|
|
35
|
+
invalidMethods: "Verification methods are invalid. Please configure them again.",
|
|
36
|
+
invalidValue: "Configure Scan, Phone Number and Email identification methods."
|
|
37
|
+
};
|
|
38
|
+
const zhCN = {
|
|
39
|
+
scan: "扫描",
|
|
40
|
+
phone_number: "手机号",
|
|
41
|
+
email: "邮箱",
|
|
42
|
+
phone_last4: "手机号后四位",
|
|
43
|
+
phone_full: "完整手机号",
|
|
44
|
+
account_password: "账号密码",
|
|
45
|
+
sms_code: "短信验证码",
|
|
46
|
+
email_code: "邮件验证码",
|
|
47
|
+
store: "存物时",
|
|
48
|
+
collect: "取物时",
|
|
49
|
+
redeem: "兑换物品时",
|
|
50
|
+
sharedMethod: "通用身份识别方式",
|
|
51
|
+
settings: "设置",
|
|
52
|
+
settingsTitle: "{method}设置",
|
|
53
|
+
groupDescription: "配置此身份识别方式的验证规则。",
|
|
54
|
+
requireVerification: "需要验证",
|
|
55
|
+
verificationHint: "关闭后,仅需识别账号即可。",
|
|
56
|
+
verificationMethods: "验证方式",
|
|
57
|
+
sortHint: "客户完成其中一种验证即可。拖拽调整优先级。",
|
|
58
|
+
sortInstructions: "使用 Alt + 上/下方向键调整优先级。",
|
|
59
|
+
reorder: "调整{method}顺序",
|
|
60
|
+
enable: "启用{method}",
|
|
61
|
+
save: "保存",
|
|
62
|
+
cancel: "取消",
|
|
63
|
+
close: "关闭",
|
|
64
|
+
unsavedTitle: "未保存的更改",
|
|
65
|
+
unsavedDescription: "您有未保存的更改,确定要离开?",
|
|
66
|
+
discardChanges: "离开",
|
|
67
|
+
continueEditing: "返回",
|
|
68
|
+
empty: "暂无身份识别配置",
|
|
69
|
+
minimumMethod: "开启验证后,至少需要启用一种验证方式。",
|
|
70
|
+
incomplete: "身份识别配置不完整,请重新配置。",
|
|
71
|
+
invalidMethods: "验证方式配置无效,请重新配置。",
|
|
72
|
+
invalidValue: "请配置扫描、手机号和邮箱身份识别方式。"
|
|
73
|
+
};
|
|
74
|
+
const zhHK = {
|
|
75
|
+
scan: "掃描",
|
|
76
|
+
phone_number: "手機號碼",
|
|
77
|
+
email: "電郵",
|
|
78
|
+
phone_last4: "手機號碼後四位",
|
|
79
|
+
phone_full: "完整手機號碼",
|
|
80
|
+
account_password: "帳戶密碼",
|
|
81
|
+
sms_code: "短訊驗證碼",
|
|
82
|
+
email_code: "電郵驗證碼",
|
|
83
|
+
store: "存放物品時",
|
|
84
|
+
collect: "領取物品時",
|
|
85
|
+
redeem: "兌換物品時",
|
|
86
|
+
sharedMethod: "通用身份識別方式",
|
|
87
|
+
settings: "設定",
|
|
88
|
+
settingsTitle: "{method}設定",
|
|
89
|
+
groupDescription: "設定此身份識別方式的驗證規則。",
|
|
90
|
+
requireVerification: "需要驗證",
|
|
91
|
+
verificationHint: "關閉後,僅需識別帳戶即可。",
|
|
92
|
+
verificationMethods: "驗證方式",
|
|
93
|
+
sortHint: "客戶完成其中一種驗證即可。拖曳調整優先次序。",
|
|
94
|
+
sortInstructions: "使用 Alt + 上/下方向鍵調整優先次序。",
|
|
95
|
+
reorder: "調整{method}次序",
|
|
96
|
+
enable: "啟用{method}",
|
|
97
|
+
save: "儲存",
|
|
98
|
+
cancel: "取消",
|
|
99
|
+
close: "關閉",
|
|
100
|
+
unsavedTitle: "未儲存的更改",
|
|
101
|
+
unsavedDescription: "您有未儲存的更改,確定要離開?",
|
|
102
|
+
discardChanges: "離開",
|
|
103
|
+
continueEditing: "返回",
|
|
104
|
+
empty: "尚未設定身份識別方式",
|
|
105
|
+
minimumMethod: "開啟驗證後,至少需要啟用一種驗證方式。",
|
|
106
|
+
incomplete: "身份識別設定不完整,請重新設定。",
|
|
107
|
+
invalidMethods: "驗證方式無效,請重新設定。",
|
|
108
|
+
invalidValue: "請設定掃描、手機號碼和電郵身份識別方式。"
|
|
109
|
+
};
|
|
110
|
+
const ja = {
|
|
111
|
+
scan: "スキャン",
|
|
112
|
+
phone_number: "電話番号",
|
|
113
|
+
email: "メールアドレス",
|
|
114
|
+
phone_last4: "電話番号の下4桁",
|
|
115
|
+
phone_full: "電話番号全桁",
|
|
116
|
+
account_password: "アカウントのパスワード",
|
|
117
|
+
sms_code: "SMS認証コード",
|
|
118
|
+
email_code: "メール認証コード",
|
|
119
|
+
store: "荷物を預けるとき",
|
|
120
|
+
collect: "荷物を受け取るとき",
|
|
121
|
+
redeem: "商品を引き換えるとき",
|
|
122
|
+
sharedMethod: "共通の本人確認方法",
|
|
123
|
+
settings: "設定",
|
|
124
|
+
settingsTitle: "{method}の設定",
|
|
125
|
+
groupDescription: "この本人確認方法の認証ルールを設定します。",
|
|
126
|
+
requireVerification: "認証を必須にする",
|
|
127
|
+
verificationHint: "オフの場合、アカウントの識別のみ行います。",
|
|
128
|
+
verificationMethods: "認証方法",
|
|
129
|
+
sortHint: "いずれか1つの認証を完了します。ドラッグで優先順位を変更できます。",
|
|
130
|
+
sortInstructions: "Alt + 上下キーで優先順位を変更します。",
|
|
131
|
+
reorder: "{method}の順序を変更",
|
|
132
|
+
enable: "{method}を有効にする",
|
|
133
|
+
save: "保存",
|
|
134
|
+
cancel: "キャンセル",
|
|
135
|
+
close: "閉じる",
|
|
136
|
+
unsavedTitle: "未保存の変更",
|
|
137
|
+
unsavedDescription: "未保存の変更があります。このまま離れますか?",
|
|
138
|
+
discardChanges: "離れる",
|
|
139
|
+
continueEditing: "戻る",
|
|
140
|
+
empty: "本人確認方法が設定されていません",
|
|
141
|
+
minimumMethod: "認証を必須にする場合、認証方法を1つ以上有効にしてください。",
|
|
142
|
+
incomplete: "本人確認の設定が不完全です。再設定してください。",
|
|
143
|
+
invalidMethods: "認証方法が無効です。再設定してください。",
|
|
144
|
+
invalidValue: "スキャン、電話番号、メールアドレスによる本人確認を設定してください。"
|
|
145
|
+
};
|
|
146
|
+
const pt = {
|
|
147
|
+
scan: "Leitura",
|
|
148
|
+
phone_number: "Número de telefone",
|
|
149
|
+
email: "E-mail",
|
|
150
|
+
phone_last4: "Últimos 4 dígitos do telefone",
|
|
151
|
+
phone_full: "Número de telefone completo",
|
|
152
|
+
account_password: "Senha da conta",
|
|
153
|
+
sms_code: "Código de verificação por SMS",
|
|
154
|
+
email_code: "Código de verificação por e-mail",
|
|
155
|
+
store: "Ao guardar itens",
|
|
156
|
+
collect: "Ao retirar itens",
|
|
157
|
+
redeem: "Ao resgatar itens",
|
|
158
|
+
sharedMethod: "Método de identificação compartilhado",
|
|
159
|
+
settings: "Configurações",
|
|
160
|
+
settingsTitle: "Configurações de {method}",
|
|
161
|
+
groupDescription: "Configure a verificação para este método de identificação.",
|
|
162
|
+
requireVerification: "Exigir verificação",
|
|
163
|
+
verificationHint: "Quando desativada, basta identificar a conta.",
|
|
164
|
+
verificationMethods: "Métodos de verificação",
|
|
165
|
+
sortHint: "O cliente conclui um dos métodos. Arraste para definir a prioridade.",
|
|
166
|
+
sortInstructions: "Use Alt + seta para cima/baixo para alterar a prioridade.",
|
|
167
|
+
reorder: "Reordenar {method}",
|
|
168
|
+
enable: "Ativar {method}",
|
|
169
|
+
save: "Salvar",
|
|
170
|
+
cancel: "Cancelar",
|
|
171
|
+
close: "Fechar",
|
|
172
|
+
unsavedTitle: "Alterações não salvas",
|
|
173
|
+
unsavedDescription: "Você tem alterações não salvas. Tem certeza de que deseja sair?",
|
|
174
|
+
discardChanges: "Sair",
|
|
175
|
+
continueEditing: "Voltar",
|
|
176
|
+
empty: "Nenhum método de identificação configurado",
|
|
177
|
+
minimumMethod: "Ative pelo menos um método quando a verificação for obrigatória.",
|
|
178
|
+
incomplete: "As configurações de identificação estão incompletas. Configure novamente.",
|
|
179
|
+
invalidMethods: "Os métodos de verificação são inválidos. Configure novamente.",
|
|
180
|
+
invalidValue: "Configure os métodos de identificação por leitura, telefone e e-mail."
|
|
181
|
+
};
|
|
182
|
+
function getIdentityText(locale = "en") {
|
|
183
|
+
const language = locale.toLowerCase().replace(/_/g, "-");
|
|
184
|
+
const messages = language.startsWith("zh-hk") || language.startsWith("zh-tw") ? zhHK : language.startsWith("zh") ? zhCN : language.startsWith("ja") ? ja : language.startsWith("pt") ? pt : en;
|
|
185
|
+
return (key, params = {}) => (messages[key] || en[key] || key).replace(/\{(\w+)\}/g, (match, name) => {
|
|
186
|
+
var _params$name;
|
|
187
|
+
return (_params$name = params[name]) !== null && _params$name !== void 0 ? _params$name : match;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
exports.getIdentityText = getIdentityText;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IdentityConfig, IdentityValue } from "./types.js";
|
|
2
|
+
import { IdentityText } from "./locales.js";
|
|
3
|
+
|
|
4
|
+
//#region src/components/dataSourceComponents/fields/IdentityRecognition/model.d.ts
|
|
5
|
+
declare const createIdentityDefaultValue: (config: IdentityConfig) => IdentityValue;
|
|
6
|
+
declare function validateIdentityValue(value: unknown, config: IdentityConfig, t?: IdentityText): string | undefined;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { createIdentityDefaultValue, validateIdentityValue };
|