dtable-ui-component 6.0.25 → 6.0.26-beta
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/lib/BodyPortal/index.js +29 -0
- package/lib/CheckboxEditor/index.js +17 -118
- package/lib/CheckboxEditor/lg.js +118 -0
- package/lib/CheckboxEditor/sm.js +101 -0
- package/lib/CollaboratorEditor/index.js +11 -4
- package/lib/CollaboratorEditor/{pc-collaborator-editor → lg}/index.js +2 -2
- package/lib/CollaboratorEditor/sm/index.css +41 -0
- package/lib/CollaboratorEditor/sm/index.js +87 -0
- package/lib/DTableCommonAddTool/index.js +1 -3
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +3 -3
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +4 -4
- package/lib/DateEditor/index.js +31 -30
- package/lib/DateEditor/{pc-date-editor-popover.js → large.js} +6 -6
- package/lib/DateEditor/sm/custom-rc-calendar.css +118 -0
- package/lib/DateEditor/sm/index.css +40 -0
- package/lib/DateEditor/{mb-date-editor-popover → sm}/index.js +18 -33
- package/lib/{Department-editor → DepartmentEditor}/constants.js +7 -0
- package/lib/{Department-editor → DepartmentEditor}/department-multiple-select/index.css +4 -1
- package/lib/{Department-editor → DepartmentEditor}/department-multiple-select/index.js +7 -4
- package/lib/DepartmentEditor/index.js +25 -0
- package/lib/{Department-editor → DepartmentEditor/lg}/department-single-select.js +10 -7
- package/lib/{Department-editor → DepartmentEditor/lg}/index.css +12 -3
- package/lib/{Department-editor → DepartmentEditor/lg}/index.js +8 -25
- package/lib/DepartmentEditor/sm/index.css +4 -0
- package/lib/DepartmentEditor/sm/index.js +220 -0
- package/lib/DigitalSignEditor/index.js +17 -173
- package/lib/DigitalSignEditor/lg/index.js +181 -0
- package/lib/DigitalSignEditor/sm/index.css +35 -0
- package/lib/DigitalSignEditor/sm/index.js +139 -0
- package/lib/FileEditor/files-previewer/index.js +16 -267
- package/lib/FileEditor/files-previewer/{file-previewer → lg/file-previewer}/dropdown-menu.js +1 -1
- package/lib/FileEditor/files-previewer/{file-previewer → lg/file-previewer}/file-name-editor/index.js +1 -1
- package/lib/FileEditor/files-previewer/{file-previewer → lg/file-previewer}/index.css +0 -2
- package/lib/FileEditor/files-previewer/{file-previewer → lg/file-previewer}/index.js +2 -2
- package/lib/FileEditor/files-previewer/lg/index.js +276 -0
- package/lib/FileEditor/files-previewer/sm/file-previewer/index.js +122 -0
- package/lib/FileEditor/files-previewer/sm/index.css +39 -0
- package/lib/FileEditor/files-previewer/sm/index.js +59 -0
- package/lib/FileEditor/index.css +0 -5
- package/lib/FileEditor/index.js +16 -264
- package/lib/FileEditor/lg/addition-previewer/index.css +1 -0
- package/lib/FileEditor/{addition-previewer → lg/addition-previewer}/index.js +1 -1
- package/lib/FileEditor/lg/addition-previewer/local-file-addition/index.css +1 -0
- package/lib/FileEditor/{addition-previewer → lg/addition-previewer}/local-file-addition/index.js +4 -4
- package/lib/FileEditor/lg/index.css +5 -0
- package/lib/FileEditor/lg/index.js +274 -0
- package/lib/FileEditor/sm/index.css +10 -0
- package/lib/FileEditor/sm/index.js +131 -0
- package/lib/FileFormatter/index.js +98 -38
- package/lib/FileItemFormatter/index.js +3 -1
- package/lib/FormulaFormatter/index.css +5 -5
- package/lib/GeolocationEditor/index.js +76 -231
- package/lib/GeolocationEditor/{country-editor.js → lg/country-editor.js} +5 -49
- package/lib/GeolocationEditor/{index.css → lg/index.css} +1 -2
- package/lib/GeolocationEditor/lg/index.js +247 -0
- package/lib/GeolocationEditor/{location-editor.js → lg/location-editor.js} +8 -41
- package/lib/GeolocationEditor/{map-editor → lg/map-editor}/index.js +6 -6
- package/lib/GeolocationEditor/{map-editor → lg/map-editor}/large-editor/index.js +7 -7
- package/lib/GeolocationEditor/{map-selection-editor → lg/map-selection-editor}/index.js +7 -7
- package/lib/GeolocationEditor/{map-selection-editor → lg/map-selection-editor}/large-editor/index.js +7 -7
- package/lib/GeolocationEditor/{province-city-editor.js → lg/province-city-editor.js} +7 -38
- package/lib/GeolocationEditor/{province-editor.js → lg/province-editor.js} +7 -31
- package/lib/GeolocationEditor/{selector-header-item.js → lg/selector-header-item.js} +1 -1
- package/lib/GeolocationEditor/map-editor-utils.js +6 -2
- package/lib/GeolocationEditor/sm/country-editor.js +70 -0
- package/lib/GeolocationEditor/sm/index.css +11 -0
- package/lib/GeolocationEditor/sm/index.js +125 -0
- package/lib/GeolocationEditor/sm/location-editor.js +93 -0
- package/lib/GeolocationEditor/sm/map-editor/index.css +11 -0
- package/lib/GeolocationEditor/sm/map-editor/index.js +469 -0
- package/lib/GeolocationEditor/sm/map-selection-editor/index.css +158 -0
- package/lib/GeolocationEditor/sm/map-selection-editor/index.js +525 -0
- package/lib/GeolocationEditor/sm/province-city-editor.js +68 -0
- package/lib/GeolocationEditor/sm/province-editor.js +67 -0
- package/lib/ImageEditor/images-previewer/image-preview/index.js +2 -2
- package/lib/ImageEditor/images-previewer/index.js +3 -3
- package/lib/ImageEditor/index.css +17 -16
- package/lib/ImageEditor/index.js +16 -184
- package/lib/ImageEditor/{addition-previewer → lg/addition-previewer}/image-link/index.js +1 -1
- package/lib/ImageEditor/{addition-previewer → lg/addition-previewer}/index.js +1 -1
- package/lib/ImageEditor/{addition-previewer → lg/addition-previewer}/local-image-addition/index.js +4 -4
- package/lib/ImageEditor/lg/images-previewer/index.js +140 -0
- package/lib/ImageEditor/lg/index.css +24 -0
- package/lib/ImageEditor/lg/index.js +194 -0
- package/lib/ImageEditor/sm/index.css +29 -0
- package/lib/ImageEditor/sm/index.js +131 -0
- package/lib/ImageThumbnail/index.js +2 -1
- package/lib/LinkEditor/pc-link-editor-popover/index.css +1 -1
- package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
- package/lib/MobileFullScreenPage/body/index.css +9 -0
- package/lib/MobileFullScreenPage/body/index.js +23 -0
- package/lib/MobileFullScreenPage/header/index.css +35 -0
- package/lib/MobileFullScreenPage/header/index.js +38 -0
- package/lib/MobileFullScreenPage/index.css +13 -0
- package/lib/MobileFullScreenPage/index.js +81 -0
- package/lib/MobileModal/index.js +41 -0
- package/lib/MobileOperationSheet/index.css +27 -0
- package/lib/MobileOperationSheet/index.js +92 -0
- package/lib/MobileSelectorEditor/empty/index.css +3 -0
- package/lib/MobileSelectorEditor/empty/index.js +23 -0
- package/lib/MobileSelectorEditor/index.css +32 -0
- package/lib/MobileSelectorEditor/index.js +57 -0
- package/lib/MobileSelectorEditor/option/index.css +28 -0
- package/lib/MobileSelectorEditor/option/index.js +36 -0
- package/lib/MobileSelectorEditor/options/index.css +8 -0
- package/lib/MobileSelectorEditor/options/index.js +18 -0
- package/lib/MobileSelectorEditor/search/index.css +7 -0
- package/lib/MobileSelectorEditor/search/index.js +26 -0
- package/lib/MobileUpload/index.css +1 -0
- package/lib/MobileUpload/index.js +160 -0
- package/lib/MultipleSelectEditor/index.js +3 -10
- package/lib/RowExpand/index.js +19 -0
- package/lib/{RowExpandDialog → RowExpand/lg}/body/index.js +4 -4
- package/lib/{RowExpandDialog → RowExpand/lg}/column-content/index.js +2 -2
- package/lib/{RowExpandDialog → RowExpand/lg}/header/index.js +3 -3
- package/lib/{RowExpandDialog → RowExpand/lg}/index.js +6 -6
- package/lib/RowExpand/sm/body/index.css +173 -0
- package/lib/RowExpand/sm/body/index.js +111 -0
- package/lib/RowExpand/sm/column-content/index.css +27 -0
- package/lib/RowExpand/sm/column-content/index.js +25 -0
- package/lib/RowExpand/sm/index.css +0 -0
- package/lib/RowExpand/sm/index.js +172 -0
- package/lib/RowExpandEditor/RightAngle/index.css +6 -0
- package/lib/RowExpandEditor/RightAngle/index.js +17 -0
- package/lib/RowExpandEditor/RowExpandAddBtn/index.js +12 -17
- package/lib/RowExpandEditor/RowExpandAddBtn/lg/index.js +26 -0
- package/lib/RowExpandEditor/RowExpandAddBtn/sm/index.css +3 -0
- package/lib/RowExpandEditor/RowExpandAddBtn/sm/index.js +19 -0
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +10 -33
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/lg.js +42 -0
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/sm/index.css +6 -0
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/sm/index.js +39 -0
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +10 -223
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/{index.css → lg/index.css} +1 -1
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/lg/index.js +231 -0
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/sm/index.css +9 -0
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/sm/index.js +163 -0
- package/lib/RowExpandEditor/RowExpandDateEditor/index.js +10 -121
- package/lib/RowExpandEditor/RowExpandDateEditor/lg.js +130 -0
- package/lib/RowExpandEditor/RowExpandDateEditor/sm.js +84 -0
- package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +11 -96
- package/lib/RowExpandEditor/RowExpandDepartmentEditor/lg.js +101 -0
- package/lib/RowExpandEditor/RowExpandDepartmentEditor/sm.js +65 -0
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +10 -199
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/{index.css → lg/index.css} +1 -1
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/lg/index.js +208 -0
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/sm/index.css +1 -0
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/sm/index.js +130 -0
- package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +11 -97
- package/lib/RowExpandEditor/RowExpandDurationEditor/lg.js +105 -0
- package/lib/RowExpandEditor/RowExpandDurationEditor/sm.js +71 -0
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +10 -116
- package/lib/RowExpandEditor/RowExpandEmailEditor/lg/index.css +1 -0
- package/lib/RowExpandEditor/RowExpandEmailEditor/lg/index.js +125 -0
- package/lib/RowExpandEditor/RowExpandEmailEditor/sm/index.css +1 -0
- package/lib/RowExpandEditor/RowExpandEmailEditor/sm/index.js +84 -0
- package/lib/RowExpandEditor/RowExpandFileEditor/index.js +10 -139
- package/lib/RowExpandEditor/RowExpandFileEditor/lg/index.css +1 -0
- package/lib/RowExpandEditor/RowExpandFileEditor/lg/index.js +148 -0
- package/lib/RowExpandEditor/RowExpandFileEditor/sm/index.js +116 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +10 -156
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/lg/index.js +164 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/sm/index.css +0 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/sm/index.js +101 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/index.js +10 -161
- package/lib/RowExpandEditor/RowExpandImageEditor/lg/index.js +170 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/sm/index.css +25 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/sm/index.js +109 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +11 -115
- package/lib/RowExpandEditor/RowExpandLongTextEditor/lg/index.js +123 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/sm/editor/index.css +10 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/sm/editor/index.js +80 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/sm/index.css +3 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/sm/index.js +91 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +10 -238
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/{index.css → lg/index.css} +1 -1
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/lg/index.js +247 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/sm/index.css +0 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/sm/index.js +155 -0
- package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +10 -96
- package/lib/RowExpandEditor/RowExpandNumberEditor/lg.js +105 -0
- package/lib/RowExpandEditor/RowExpandNumberEditor/sm/index.css +3 -0
- package/lib/RowExpandEditor/RowExpandNumberEditor/sm/index.js +76 -0
- package/lib/RowExpandEditor/RowExpandRateEditor/index.css +21 -0
- package/lib/RowExpandEditor/RowExpandRateEditor/index.js +10 -142
- package/lib/RowExpandEditor/RowExpandRateEditor/lg.js +151 -0
- package/lib/RowExpandEditor/RowExpandRateEditor/sm.js +92 -0
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +11 -198
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/lg/index.js +206 -0
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/sm/index.css +8 -0
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/sm/index.js +134 -0
- package/lib/RowExpandEditor/RowExpandTextEditor/index.js +11 -128
- package/lib/RowExpandEditor/RowExpandTextEditor/lg/index.js +136 -0
- package/lib/RowExpandEditor/RowExpandTextEditor/sm/index.css +14 -0
- package/lib/RowExpandEditor/RowExpandTextEditor/sm/index.js +37 -0
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +10 -121
- package/lib/RowExpandEditor/RowExpandUrlEditor/lg/index.js +130 -0
- package/lib/RowExpandEditor/RowExpandUrlEditor/sm/index.css +17 -0
- package/lib/RowExpandEditor/RowExpandUrlEditor/sm/index.js +87 -0
- package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +10 -18
- package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/lg.js +27 -0
- package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/sm.js +20 -0
- package/lib/RowExpandFormatter/RowExpandEmailFormatter/index.css +4 -4
- package/lib/RowExpandFormatter/RowExpandRateFormatter/index.css +1 -1
- package/lib/RowExpandFormatter/index.css +18 -18
- package/lib/RowExpandFormatter/index.js +1 -1
- package/lib/SelectItem/index.js +57 -33
- package/lib/SingleSelectEditor/index.js +3 -10
- package/lib/SvgIcon/index.js +2 -1
- package/lib/constants/file.js +1 -0
- package/lib/constants/index.js +3 -2
- package/lib/index.js +42 -98
- package/lib/locales/zh-CN.json +1 -1
- package/lib/select-editor/index.js +19 -21
- package/lib/select-editor/{pc-select-editor → lg}/index.css +1 -1
- package/lib/select-editor/{pc-select-editor → lg}/index.js +10 -10
- package/lib/select-editor/sm/index.css +1 -0
- package/lib/select-editor/sm/index.js +104 -0
- package/lib/utils/get-event-transfer.js +2 -1
- package/lib/utils/utils.js +11 -2
- package/package.json +3 -12
- package/lib/ActionSheet/index.js +0 -194
- package/lib/ActionSheet/style/index.css +0 -365
- package/lib/ActivityIndicator/index.css +0 -108
- package/lib/ActivityIndicator/index.js +0 -76
- package/lib/Badge/index.css +0 -96
- package/lib/Badge/index.js +0 -65
- package/lib/CollaboratorEditor/mb-collaborator-editor/index.css +0 -85
- package/lib/CollaboratorEditor/mb-collaborator-editor/index.js +0 -148
- package/lib/DateEditor/mb-date-editor-popover/custom-rc-calendar.css +0 -118
- package/lib/DateEditor/mb-date-editor-popover/index.css +0 -45
- package/lib/DatePicker/index.js +0 -120
- package/lib/DatePicker/locale/en_US.js +0 -14
- package/lib/DatePicker/locale/ru_RU.js +0 -14
- package/lib/DatePicker/locale/sv_SE.js +0 -14
- package/lib/DatePicker/locale/zh_CN.js +0 -14
- package/lib/DatePicker/style/index.css +0 -290
- package/lib/DatePicker/utils.js +0 -36
- package/lib/Drawer/index.css +0 -142
- package/lib/Drawer/index.js +0 -21
- package/lib/FileEditor/addition-previewer/index.css +0 -1
- package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
- package/lib/Icon/index.css +0 -50
- package/lib/Icon/index.js +0 -34
- package/lib/Icon/load-sprite.js +0 -56
- package/lib/InputItem/custom-input.js +0 -321
- package/lib/InputItem/custom-keyboard.js +0 -162
- package/lib/InputItem/index.js +0 -388
- package/lib/InputItem/input.js +0 -45
- package/lib/InputItem/locale/en_US.js +0 -12
- package/lib/InputItem/locale/ru_RU.js +0 -12
- package/lib/InputItem/locale/sv_SE.js +0 -12
- package/lib/InputItem/locale/zh_CN.js +0 -12
- package/lib/InputItem/portal.js +0 -23
- package/lib/InputItem/style/index.css +0 -512
- package/lib/List/index.css +0 -381
- package/lib/List/index.js +0 -41
- package/lib/List/list-item.js +0 -169
- package/lib/Modal/alert.js +0 -82
- package/lib/Modal/index.js +0 -15
- package/lib/Modal/modal.js +0 -118
- package/lib/Modal/operation.js +0 -77
- package/lib/Modal/prompt.js +0 -207
- package/lib/Picker/AbstractPicker.js +0 -190
- package/lib/Picker/index.js +0 -28
- package/lib/Picker/locale/en_US.js +0 -12
- package/lib/Picker/locale/ru_RU.js +0 -12
- package/lib/Picker/locale/sv_SE.js +0 -12
- package/lib/Picker/locale/zh_CN.js +0 -12
- package/lib/Picker/popupProps.js +0 -12
- package/lib/Picker/style/index.css +0 -141
- package/lib/Popover/index.js +0 -62
- package/lib/Popover/item.js +0 -55
- package/lib/Popover/style/index.css +0 -229
- package/lib/Progress/index.css +0 -22
- package/lib/Progress/index.js +0 -65
- package/lib/Radio/Radio.js +0 -47
- package/lib/Radio/RadioItem.js +0 -57
- package/lib/Radio/index.css +0 -90
- package/lib/Radio/index.js +0 -12
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
- package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
- package/lib/TabBar/Tab.js +0 -76
- package/lib/TabBar/index.css +0 -138
- package/lib/TabBar/index.js +0 -128
- package/lib/Tabs/index.css +0 -443
- package/lib/Tabs/index.js +0 -38
- package/lib/TextareaItem/index.css +0 -231
- package/lib/TextareaItem/index.js +0 -231
- package/lib/Toast/index.css +0 -65
- package/lib/Toast/index.js +0 -131
- package/lib/_util/class.js +0 -34
- package/lib/_util/closest.js +0 -17
- package/lib/_util/exenv.js +0 -8
- package/lib/_util/getDataAttr.js +0 -15
- package/lib/_util/getLocale.js +0 -42
- package/lib/select-editor/mb-select-editor/index.css +0 -127
- package/lib/select-editor/mb-select-editor/index.js +0 -197
- package/lib/select-editor/select-editor-option.js +0 -84
- /package/lib/CollaboratorEditor/{pc-collaborator-editor → lg}/index.css +0 -0
- /package/lib/{Department-editor → DepartmentEditor}/selected-departments/index.css +0 -0
- /package/lib/{Department-editor → DepartmentEditor}/selected-departments/index.js +0 -0
- /package/lib/{Department-editor → DepartmentEditor}/utils.js +0 -0
- /package/lib/DigitalSignEditor/{index.css → lg/index.css} +0 -0
- /package/lib/FileEditor/files-previewer/{file-previewer → lg/file-previewer}/file-name-editor/index.css +0 -0
- /package/lib/GeolocationEditor/{map-editor → lg/map-editor}/large-editor/index.css +0 -0
- /package/lib/GeolocationEditor/{map-selection-editor → lg/map-selection-editor}/large-editor/index.css +0 -0
- /package/lib/GeolocationEditor/{parse-geolocation.js → lg/parse-geolocation.js} +0 -0
- /package/lib/GeolocationEditor/{selector-list.js → lg/selector-list.js} +0 -0
- /package/lib/ImageEditor/{addition-previewer → lg/addition-previewer}/image-link/index.css +0 -0
- /package/lib/ImageEditor/{addition-previewer → lg/addition-previewer}/index.css +0 -0
- /package/lib/ImageEditor/{addition-previewer → lg/addition-previewer}/local-image-addition/index.css +0 -0
- /package/lib/{RowExpandDialog → RowExpand/lg}/body/index.css +0 -0
- /package/lib/{RowExpandDialog → RowExpand/lg}/column-content/index.css +0 -0
- /package/lib/{RowExpandDialog → RowExpand/lg}/header/index.css +0 -0
- /package/lib/{RowExpandDialog → RowExpand/lg}/index.css +0 -0
- /package/lib/RowExpandEditor/RowExpandAddBtn/{index.css → lg/index.css} +0 -0
- /package/lib/RowExpandEditor/RowExpandGeolocationEditor/{index.css → lg/index.css} +0 -0
- /package/lib/RowExpandEditor/RowExpandImageEditor/{index.css → lg/index.css} +0 -0
- /package/lib/RowExpandEditor/RowExpandLongTextEditor/{index.css → lg/index.css} +0 -0
- /package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/{index.css → lg/index.css} +0 -0
- /package/lib/RowExpandEditor/RowExpandTextEditor/{index.css → lg/index.css} +0 -0
- /package/lib/RowExpandEditor/RowExpandUrlEditor/{index.css → lg/index.css} +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _activityIndicator = _interopRequireDefault(require("antd-mobile/lib/activity-indicator"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _MobileFullScreenPage = _interopRequireDefault(require("../../MobileFullScreenPage"));
|
|
12
|
+
var _filesPreviewer = _interopRequireDefault(require("../files-previewer"));
|
|
13
|
+
var _MobileUpload = _interopRequireDefault(require("../../MobileUpload"));
|
|
14
|
+
var _toaster = _interopRequireDefault(require("../../toaster"));
|
|
15
|
+
var _utils = require("../../utils/utils");
|
|
16
|
+
var _lang = require("../../lang");
|
|
17
|
+
require("./index.css");
|
|
18
|
+
const Small = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
value: oldValue,
|
|
21
|
+
column,
|
|
22
|
+
config,
|
|
23
|
+
onToggle,
|
|
24
|
+
onCommit,
|
|
25
|
+
uploadFile
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [value, setValue] = (0, _react.useState)(oldValue || []);
|
|
28
|
+
const [isShowEditor, setShowEditor] = (0, _react.useState)(false);
|
|
29
|
+
const [uploadLocalFiles, setUploadLocalFiles] = (0, _react.useState)([]);
|
|
30
|
+
const [isUploading, setUploading] = (0, _react.useState)(false);
|
|
31
|
+
const uploadingFilesCount = (0, _react.useRef)(0);
|
|
32
|
+
const uploadedFilesCount = (0, _react.useRef)(0);
|
|
33
|
+
const {
|
|
34
|
+
mediaUrl
|
|
35
|
+
} = config || {};
|
|
36
|
+
const resetFileValue = (0, _react.useCallback)(() => {
|
|
37
|
+
setUploadLocalFiles([]);
|
|
38
|
+
}, []);
|
|
39
|
+
const openEditor = (0, _react.useCallback)(() => {
|
|
40
|
+
setShowEditor(true);
|
|
41
|
+
}, []);
|
|
42
|
+
const closeEditor = (0, _react.useCallback)(() => {
|
|
43
|
+
setShowEditor(false);
|
|
44
|
+
}, []);
|
|
45
|
+
const deleteFile = (0, _react.useCallback)(file => {
|
|
46
|
+
const newValue = value.slice(0);
|
|
47
|
+
const fileIndex = value.fileIndex(v => v.url === file.url);
|
|
48
|
+
newValue.splice(fileIndex, 1);
|
|
49
|
+
setValue(newValue);
|
|
50
|
+
onCommit(newValue);
|
|
51
|
+
}, [value, onCommit]);
|
|
52
|
+
const onChange = (0, _react.useCallback)(() => {
|
|
53
|
+
const newValue = value.concat(uploadLocalFiles);
|
|
54
|
+
setValue(newValue);
|
|
55
|
+
onCommit(newValue);
|
|
56
|
+
setShowEditor(false);
|
|
57
|
+
}, [value, uploadLocalFiles, onCommit]);
|
|
58
|
+
const uploadImage = (0, _react.useCallback)(file => {
|
|
59
|
+
uploadFile(file).then(res => {
|
|
60
|
+
const fileInfo = res;
|
|
61
|
+
const newUploadLocalImages = uploadLocalFiles.slice(0);
|
|
62
|
+
newUploadLocalImages.push(fileInfo);
|
|
63
|
+
setUploadLocalFiles(newUploadLocalImages);
|
|
64
|
+
uploadedFilesCount.current = uploadedFilesCount.current + 1;
|
|
65
|
+
}).catch(error => {
|
|
66
|
+
let errMsg = (0, _utils.getErrorMsg)(error, true);
|
|
67
|
+
if (!error.response || error.response.status !== 403) {
|
|
68
|
+
_toaster.default.danger((0, _lang.getLocale)(errMsg));
|
|
69
|
+
}
|
|
70
|
+
uploadedFilesCount.current = uploadedFilesCount.current + 1;
|
|
71
|
+
});
|
|
72
|
+
}, [uploadFile, uploadLocalFiles]);
|
|
73
|
+
const onFilesChange = (0, _react.useCallback)(function () {
|
|
74
|
+
let files = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
75
|
+
setUploading(true);
|
|
76
|
+
uploadingFilesCount.current = files.length;
|
|
77
|
+
uploadedFilesCount.current = 0;
|
|
78
|
+
for (let i = 0; i < uploadingFilesCount.current; i++) {
|
|
79
|
+
const file = files[i];
|
|
80
|
+
const reader = new FileReader();
|
|
81
|
+
reader.readAsDataURL(file);
|
|
82
|
+
reader.addEventListener('load', () => {
|
|
83
|
+
uploadImage(file);
|
|
84
|
+
}, false);
|
|
85
|
+
reader.addEventListener('error', () => {
|
|
86
|
+
const message = (0, _lang.getLocale)('Image_loading_failed');
|
|
87
|
+
_toaster.default.warning(message);
|
|
88
|
+
uploadedFilesCount.current = uploadedFilesCount.current + 1;
|
|
89
|
+
}, false);
|
|
90
|
+
}
|
|
91
|
+
}, [uploadImage]);
|
|
92
|
+
(0, _react.useEffect)(() => {
|
|
93
|
+
if (uploadingFilesCount.current === uploadedFilesCount.current && uploadedFilesCount.current !== 0) {
|
|
94
|
+
uploadedFilesCount.current = 0;
|
|
95
|
+
uploadingFilesCount.current = 0;
|
|
96
|
+
onChange();
|
|
97
|
+
setUploading(false);
|
|
98
|
+
}
|
|
99
|
+
}, [uploadingFilesCount, uploadedFilesCount, onChange]);
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement(_MobileFullScreenPage.default, {
|
|
101
|
+
onLeftClick: onToggle,
|
|
102
|
+
className: "mobile-dtable-ui-file-editor"
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
104
|
+
"aria-hidden": "true",
|
|
105
|
+
className: "dtable-font dtable-icon-return"
|
|
106
|
+
}), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, column.name), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _utils.isIPhone)() && (0, _utils.isQQBuiltInBrowser)() ? /*#__PURE__*/_react.default.createElement("div", {
|
|
107
|
+
className: "dtable-ui-file-open-external-browser"
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
109
|
+
className: "seatable-tip-danger"
|
|
110
|
+
}, '不支持 QQ 内置浏览器上传图片或者文件'), /*#__PURE__*/_react.default.createElement("div", {
|
|
111
|
+
className: "image-container"
|
|
112
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
113
|
+
src: mediaUrl + 'img/qq-upload-tip.png',
|
|
114
|
+
alt: "Open browser tip"
|
|
115
|
+
}))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_filesPreviewer.default, {
|
|
116
|
+
value: value,
|
|
117
|
+
togglePreviewer: openEditor,
|
|
118
|
+
closeEditor: closeEditor,
|
|
119
|
+
deleteFile: deleteFile,
|
|
120
|
+
resetFileValue: resetFileValue
|
|
121
|
+
}), isShowEditor && /*#__PURE__*/_react.default.createElement(_MobileUpload.default, {
|
|
122
|
+
type: "file",
|
|
123
|
+
onClose: closeEditor,
|
|
124
|
+
onChange: onFilesChange
|
|
125
|
+
}), isUploading && /*#__PURE__*/_react.default.createElement(_activityIndicator.default, {
|
|
126
|
+
toast: true,
|
|
127
|
+
text: (0, _lang.getLocale)('Files_are_uploading'),
|
|
128
|
+
animating: isUploading
|
|
129
|
+
}))));
|
|
130
|
+
};
|
|
131
|
+
var _default = exports.default = Small;
|
|
@@ -9,47 +9,107 @@ exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _FileItemFormatter = _interopRequireDefault(require("../FileItemFormatter"));
|
|
12
|
+
var _ImagePreviewerLightbox = _interopRequireDefault(require("../ImagePreviewerLightbox"));
|
|
13
|
+
var _url = require("../utils/url");
|
|
12
14
|
require("./index.css");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const FileFormatter = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
isSample = false,
|
|
18
|
+
value = [],
|
|
19
|
+
containerClassName = '',
|
|
20
|
+
renderItem,
|
|
21
|
+
isSupportOpenFile = false,
|
|
22
|
+
server,
|
|
23
|
+
workspaceID,
|
|
24
|
+
dtableUuid
|
|
25
|
+
} = _ref;
|
|
26
|
+
const [largeImageIndex, setLargeImageIndex] = (0, _react.useState)(-1);
|
|
27
|
+
const [fileImageUrlList, setFileImageUrlList] = (0, _react.useState)([]);
|
|
28
|
+
const getFileItemImageUrlList = (0, _react.useCallback)(value => {
|
|
29
|
+
let newFileImageUrlList = [];
|
|
30
|
+
value.forEach(fileItem => {
|
|
31
|
+
const {
|
|
32
|
+
url,
|
|
33
|
+
name
|
|
34
|
+
} = fileItem;
|
|
35
|
+
let assetFileIndex = typeof url === 'string' ? url.indexOf('/asset') : -1;
|
|
36
|
+
if (assetFileIndex > -1) {
|
|
37
|
+
const isImage = (0, _url.imageCheck)(name);
|
|
38
|
+
if (isImage) {
|
|
39
|
+
newFileImageUrlList.push(url);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
setFileImageUrlList(newFileImageUrlList);
|
|
44
|
+
}, []);
|
|
45
|
+
(0, _react.useEffect)(() => {
|
|
46
|
+
if (!isSupportOpenFile) return;
|
|
47
|
+
getFileItemImageUrlList(value);
|
|
48
|
+
}, [value, getFileItemImageUrlList, isSupportOpenFile]);
|
|
49
|
+
const showLargeImage = (0, _react.useCallback)(imageIndex => {
|
|
50
|
+
setLargeImageIndex(imageIndex);
|
|
51
|
+
}, []);
|
|
52
|
+
const openFile = (0, _react.useCallback)(fileItem => {
|
|
53
|
+
if (!isSupportOpenFile) return;
|
|
54
|
+
let openFileUrl = fileItem.url;
|
|
55
|
+
const imageIndex = fileImageUrlList.indexOf(openFileUrl);
|
|
56
|
+
if (imageIndex > -1) {
|
|
57
|
+
showLargeImage(imageIndex);
|
|
58
|
+
return;
|
|
23
59
|
}
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, /*#__PURE__*/_react.default.createElement(_FileItemFormatter.default, {
|
|
30
|
-
file: item
|
|
31
|
-
}), value.length !== 1 && /*#__PURE__*/_react.default.createElement("span", {
|
|
32
|
-
className: "file-item-count"
|
|
33
|
-
}, "+".concat(value.length)));
|
|
60
|
+
let previewerUrl;
|
|
61
|
+
let assetFileIndex = openFileUrl.indexOf('/asset');
|
|
62
|
+
if (assetFileIndex > -1) {
|
|
63
|
+
previewerUrl = openFileUrl.replace('/asset', '/asset-preview');
|
|
64
|
+
window.open(previewerUrl, '_blank');
|
|
34
65
|
}
|
|
66
|
+
}, [fileImageUrlList, isSupportOpenFile, showLargeImage]);
|
|
67
|
+
const moveNext = (0, _react.useCallback)(() => {
|
|
68
|
+
setLargeImageIndex(prevIndex => (prevIndex + 1) % fileImageUrlList.length);
|
|
69
|
+
}, [fileImageUrlList]);
|
|
70
|
+
const movePrev = (0, _react.useCallback)(() => {
|
|
71
|
+
setLargeImageIndex(prevIndex => (prevIndex + fileImageUrlList.length - 1) % fileImageUrlList.length);
|
|
72
|
+
}, [fileImageUrlList]);
|
|
73
|
+
const hideLargeImage = (0, _react.useCallback)(() => {
|
|
74
|
+
setLargeImageIndex(-1);
|
|
75
|
+
}, []);
|
|
76
|
+
const className = (0, _classnames.default)('dtable-ui cell-formatter-container file-formatter', containerClassName);
|
|
77
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
if (isSample) {
|
|
81
|
+
const item = value[0];
|
|
35
82
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
83
|
className: className
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
key: index
|
|
43
|
-
}, renderItem(dom));
|
|
44
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
45
|
-
key: index
|
|
46
|
-
}, dom);
|
|
47
|
-
}));
|
|
84
|
+
}, /*#__PURE__*/_react.default.createElement(_FileItemFormatter.default, {
|
|
85
|
+
file: item
|
|
86
|
+
}), value.length !== 1 && /*#__PURE__*/_react.default.createElement("span", {
|
|
87
|
+
className: "file-item-count"
|
|
88
|
+
}, "+".concat(value.length)));
|
|
48
89
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
+
className: className
|
|
92
|
+
}, value.map((item, index) => {
|
|
93
|
+
const dom = /*#__PURE__*/_react.default.createElement(_FileItemFormatter.default, {
|
|
94
|
+
openFile: openFile,
|
|
95
|
+
file: item
|
|
96
|
+
});
|
|
97
|
+
if (renderItem) return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
98
|
+
key: index
|
|
99
|
+
}, renderItem(dom));
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
101
|
+
key: index
|
|
102
|
+
}, dom);
|
|
103
|
+
}), largeImageIndex > -1 && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
|
|
104
|
+
server: server,
|
|
105
|
+
workspaceID: workspaceID,
|
|
106
|
+
dtableUuid: dtableUuid,
|
|
107
|
+
readOnly: true,
|
|
108
|
+
imageItems: fileImageUrlList,
|
|
109
|
+
imageIndex: largeImageIndex,
|
|
110
|
+
closeImagePopup: hideLargeImage,
|
|
111
|
+
moveToPrevImage: movePrev,
|
|
112
|
+
moveToNextImage: moveNext
|
|
113
|
+
}));
|
|
114
|
+
};
|
|
115
|
+
var _default = exports.default = FileFormatter;
|
|
@@ -10,13 +10,15 @@ var _url = require("../utils/url");
|
|
|
10
10
|
const FileItemFormatter = _ref => {
|
|
11
11
|
let {
|
|
12
12
|
file,
|
|
13
|
-
config
|
|
13
|
+
config,
|
|
14
|
+
openFile
|
|
14
15
|
} = _ref;
|
|
15
16
|
const {
|
|
16
17
|
fileIconUrl,
|
|
17
18
|
isImage
|
|
18
19
|
} = (0, _url.getFileThumbnailInfo)(file, config);
|
|
19
20
|
return /*#__PURE__*/_react.default.createElement("img", {
|
|
21
|
+
onClick: () => openFile && openFile(file),
|
|
20
22
|
className: "file-item-icon ".concat(isImage ? 'img' : ''),
|
|
21
23
|
src: fileIconUrl,
|
|
22
24
|
alt: (file === null || file === void 0 ? void 0 : file.name) || ''
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
margin-right: 10px;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.dtable-ui.dtable-row-expand-formatter .formula-formatter-content-item {
|
|
8
|
+
.dtable-ui.dtable-ui-row-expand-formatter .formula-formatter-content-item {
|
|
9
9
|
margin-top: 0.5rem;
|
|
10
10
|
margin-bottom: 5px;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.dtable-ui.dtable-row-expand-formatter .formula-url-formatter-column .formula-url-link,
|
|
14
|
-
.dtable-ui.dtable-row-expand-formatter .formula-url-formatter-column .formula-email-link {
|
|
13
|
+
.dtable-ui.dtable-ui-row-expand-formatter .formula-url-formatter-column .formula-url-link,
|
|
14
|
+
.dtable-ui.dtable-ui-row-expand-formatter .formula-url-formatter-column .formula-email-link {
|
|
15
15
|
display: flex;
|
|
16
16
|
align-items: center;
|
|
17
17
|
font-size: 14px;
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
box-shadow: 0 0 1px;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.dtable-ui.dtable-row-expand-formatter .formula-url-formatter-column .formula-email-link:hover,
|
|
32
|
-
.dtable-ui.dtable-row-expand-formatter .formula-url-formatter-column .formula-url-link:hover {
|
|
31
|
+
.dtable-ui.dtable-ui-row-expand-formatter .formula-url-formatter-column .formula-email-link:hover,
|
|
32
|
+
.dtable-ui.dtable-ui-row-expand-formatter .formula-url-formatter-column .formula-url-link:hover {
|
|
33
33
|
background: #f5f5f5;
|
|
34
34
|
border: 1px solid #c9c9c9;
|
|
35
35
|
}
|
|
@@ -1,240 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
|
-
var _react =
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
e.stopPropagation();
|
|
28
|
-
this.onCancel();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
this.getValue = () => {
|
|
33
|
-
return this.value;
|
|
34
|
-
};
|
|
35
|
-
this.setValue = value => {
|
|
36
|
-
this.value = value;
|
|
37
|
-
};
|
|
38
|
-
this.onSubmit = () => {
|
|
39
|
-
if (_objectUtils.default.isSameObject(this.initValue, this.value)) {
|
|
40
|
-
this.onCancel();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this.props.onCommit(this.value);
|
|
44
|
-
};
|
|
45
|
-
this.onCancel = () => {
|
|
46
|
-
this.props.onCommitCancel && this.props.onCommitCancel();
|
|
47
|
-
};
|
|
48
|
-
this.setEditorPosition = () => {
|
|
49
|
-
const {
|
|
50
|
-
isInModal
|
|
51
|
-
} = this.props;
|
|
52
|
-
const editorFormat = this.getGeoFormat();
|
|
53
|
-
if (this.ref && (editorFormat === _dtableUtils.GEOLOCATION_FORMAT.COUNTRY_REGION || editorFormat === _dtableUtils.GEOLOCATION_FORMAT.PROVINCE)) {
|
|
54
|
-
let height = 240;
|
|
55
|
-
let width = 200;
|
|
56
|
-
let left = this.ref.parentNode.getBoundingClientRect().x;
|
|
57
|
-
let top = this.ref.parentNode.getBoundingClientRect().y;
|
|
58
|
-
if (isInModal) {
|
|
59
|
-
left = 220;
|
|
60
|
-
}
|
|
61
|
-
if (top + height > window.innerHeight) {
|
|
62
|
-
top = window.innerHeight - height - 35;
|
|
63
|
-
}
|
|
64
|
-
this.setState({
|
|
65
|
-
editorPosition: {
|
|
66
|
-
top,
|
|
67
|
-
left,
|
|
68
|
-
width,
|
|
69
|
-
zIndex: 1000,
|
|
70
|
-
position: 'fixed'
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (this.ref && editorFormat === _dtableUtils.GEOLOCATION_FORMAT.PROVINCE_CITY) {
|
|
76
|
-
let height = 215;
|
|
77
|
-
let width = 400;
|
|
78
|
-
let left = this.ref.parentNode.getBoundingClientRect().x;
|
|
79
|
-
let top = this.ref.parentNode.getBoundingClientRect().y;
|
|
80
|
-
if (isInModal) {
|
|
81
|
-
left = 220;
|
|
82
|
-
if (top + height + 35 + 200 > window.innerHeight) {
|
|
83
|
-
top = window.innerHeight - height - 235;
|
|
84
|
-
}
|
|
85
|
-
} else {
|
|
86
|
-
if (top + height + 200 > window.innerHeight) {
|
|
87
|
-
top = window.innerHeight - height - 200 - 5;
|
|
88
|
-
}
|
|
89
|
-
if (left + width > window.innerWidth) {
|
|
90
|
-
left = window.innerWidth - width - 10;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
this.setState({
|
|
94
|
-
editorPosition: {
|
|
95
|
-
top,
|
|
96
|
-
left,
|
|
97
|
-
width,
|
|
98
|
-
zIndex: 1000,
|
|
99
|
-
position: 'fixed'
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (this.ref) {
|
|
105
|
-
const isMapTypeEditor = editorFormat === _dtableUtils.GEOLOCATION_FORMAT.LNG_LAT || editorFormat === _dtableUtils.GEOLOCATION_FORMAT.MAP_SELECTION;
|
|
106
|
-
let width = isMapTypeEditor ? 500 : 400;
|
|
107
|
-
let height = isMapTypeEditor ? 454 : 310;
|
|
108
|
-
let geoEditorTop = 0;
|
|
109
|
-
let geoEditorLeft = 0;
|
|
110
|
-
if (isInModal) {
|
|
111
|
-
let innerHeight = window.innerHeight;
|
|
112
|
-
const offsetTop = this.ref.parentNode.getBoundingClientRect().y;
|
|
113
|
-
geoEditorTop = offsetTop;
|
|
114
|
-
geoEditorTop = height + geoEditorTop > innerHeight ? innerHeight - height - 30 : geoEditorTop;
|
|
115
|
-
geoEditorLeft = -30;
|
|
116
|
-
} else {
|
|
117
|
-
let {
|
|
118
|
-
offsetLeft,
|
|
119
|
-
offsetTop
|
|
120
|
-
} = this.ref.parentNode;
|
|
121
|
-
geoEditorLeft = offsetLeft - width;
|
|
122
|
-
geoEditorTop = offsetTop;
|
|
123
|
-
if (offsetLeft < width) {
|
|
124
|
-
geoEditorLeft = offsetLeft + this.props.column.width;
|
|
125
|
-
}
|
|
126
|
-
if (geoEditorLeft + width > window.innerWidth) {
|
|
127
|
-
geoEditorLeft = window.innerWidth - width;
|
|
128
|
-
}
|
|
129
|
-
if (offsetTop + height > window.innerHeight) {
|
|
130
|
-
geoEditorTop = window.innerHeight - height;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
this.setState({
|
|
134
|
-
editorPosition: {
|
|
135
|
-
top: geoEditorTop,
|
|
136
|
-
left: geoEditorLeft,
|
|
137
|
-
zIndex: 1000,
|
|
138
|
-
position: 'fixed'
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
this.getGeoFormat = () => {
|
|
144
|
-
const {
|
|
145
|
-
column
|
|
146
|
-
} = this.props;
|
|
147
|
-
let data = column.data || {};
|
|
148
|
-
return data.geo_format ? data.geo_format : _dtableUtils.DEFAULT_GEOLOCATION_FORMAT;
|
|
149
|
-
};
|
|
150
|
-
this.getLargeEditorState = () => {
|
|
151
|
-
var _this$editor, _this$editor$state;
|
|
152
|
-
return (_this$editor = this.editor) === null || _this$editor === void 0 ? void 0 : (_this$editor$state = _this$editor.state) === null || _this$editor$state === void 0 ? void 0 : _this$editor$state.isShowLargeEditor;
|
|
153
|
-
};
|
|
154
|
-
this.createEditor = () => {
|
|
155
|
-
const geoFormat = this.getGeoFormat();
|
|
156
|
-
const {
|
|
157
|
-
config,
|
|
158
|
-
column
|
|
159
|
-
} = this.props;
|
|
160
|
-
const props = {
|
|
161
|
-
column,
|
|
162
|
-
config,
|
|
163
|
-
value: this.value,
|
|
164
|
-
setValue: this.setValue,
|
|
165
|
-
onSubmit: this.onSubmit,
|
|
166
|
-
onCancel: this.onCancel
|
|
167
|
-
};
|
|
168
|
-
switch (geoFormat) {
|
|
169
|
-
case _dtableUtils.GEOLOCATION_FORMAT.LNG_LAT:
|
|
170
|
-
{
|
|
171
|
-
return /*#__PURE__*/_react.default.createElement(_mapEditor.default, Object.assign({}, props, {
|
|
172
|
-
ref: ref => this.editor = ref
|
|
173
|
-
}));
|
|
174
|
-
}
|
|
175
|
-
case _dtableUtils.GEOLOCATION_FORMAT.MAP_SELECTION:
|
|
176
|
-
{
|
|
177
|
-
return /*#__PURE__*/_react.default.createElement(_mapSelectionEditor.default, Object.assign({}, props, {
|
|
178
|
-
ref: ref => this.editor = ref
|
|
179
|
-
}));
|
|
180
|
-
}
|
|
181
|
-
case _dtableUtils.GEOLOCATION_FORMAT.COUNTRY_REGION:
|
|
182
|
-
{
|
|
183
|
-
return /*#__PURE__*/_react.default.createElement(_countryEditor.default, Object.assign({}, props, {
|
|
184
|
-
ref: ref => this.editor = ref
|
|
185
|
-
}));
|
|
186
|
-
}
|
|
187
|
-
case _dtableUtils.GEOLOCATION_FORMAT.PROVINCE:
|
|
188
|
-
{
|
|
189
|
-
return /*#__PURE__*/_react.default.createElement(_provinceEditor.default, Object.assign({}, props, {
|
|
190
|
-
onPressTab: this.props.onPressTab,
|
|
191
|
-
ref: ref => this.editor = ref
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
case _dtableUtils.GEOLOCATION_FORMAT.PROVINCE_CITY:
|
|
195
|
-
{
|
|
196
|
-
return /*#__PURE__*/_react.default.createElement(_provinceCityEditor.default, Object.assign({}, props, {
|
|
197
|
-
ref: ref => this.editor = ref
|
|
198
|
-
}));
|
|
199
|
-
}
|
|
200
|
-
case _dtableUtils.GEOLOCATION_FORMAT.PROVINCE_CITY_DISTRICT:
|
|
201
|
-
{
|
|
202
|
-
return /*#__PURE__*/_react.default.createElement(_locationEditor.default, Object.assign({}, props, {
|
|
203
|
-
ref: ref => this.editor = ref
|
|
204
|
-
}));
|
|
205
|
-
}
|
|
206
|
-
default:
|
|
207
|
-
{
|
|
208
|
-
return /*#__PURE__*/_react.default.createElement(_locationEditor.default, Object.assign({}, props, {
|
|
209
|
-
isShowAddressDetail: true,
|
|
210
|
-
ref: ref => this.editor = ref
|
|
211
|
-
}));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
this.value = _props.value || {};
|
|
216
|
-
this.initValue = this.value;
|
|
217
|
-
this.state = {
|
|
218
|
-
editorPosition: null
|
|
219
|
-
};
|
|
220
|
-
this.editor = null;
|
|
221
|
-
}
|
|
222
|
-
componentDidMount() {
|
|
223
|
-
this.setEditorPosition();
|
|
224
|
-
document.addEventListener('keydown', this.onHotKey, true);
|
|
225
|
-
}
|
|
226
|
-
componentWillUnmount() {
|
|
227
|
-
document.removeEventListener('keydown', this.onHotKey, true);
|
|
228
|
-
}
|
|
229
|
-
render() {
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactResponsive = _interopRequireDefault(require("react-responsive"));
|
|
11
|
+
var _lg = _interopRequireDefault(require("./lg"));
|
|
12
|
+
var _sm = _interopRequireDefault(require("./sm"));
|
|
13
|
+
const GeolocationEditor = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
size,
|
|
16
|
+
config: oldConfig,
|
|
17
|
+
...props
|
|
18
|
+
} = _ref;
|
|
19
|
+
const config = (0, _react.useMemo)(() => ({
|
|
20
|
+
...window.dtable,
|
|
21
|
+
...oldConfig
|
|
22
|
+
}), [oldConfig]);
|
|
23
|
+
const getLocationData = (0, _react.useCallback)(() => {
|
|
24
|
+
var _window, _window$app;
|
|
25
|
+
if ((_window = window) !== null && _window !== void 0 && (_window$app = _window.app) !== null && _window$app !== void 0 && _window$app.location) return new Promise((resolve, reject) => {
|
|
26
|
+
resolve(window.app.location);
|
|
27
|
+
});
|
|
230
28
|
const {
|
|
231
|
-
|
|
232
|
-
} =
|
|
233
|
-
return
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
29
|
+
mediaUrl
|
|
30
|
+
} = config || {};
|
|
31
|
+
return fetch("".concat(mediaUrl, "geo-data/cn-location.json")).then(res => {
|
|
32
|
+
// get locations from server
|
|
33
|
+
return res.json();
|
|
34
|
+
}).catch(() => {
|
|
35
|
+
// get locations from local
|
|
36
|
+
return fetch('./geo-data/cn-location.json').then(res => {
|
|
37
|
+
return res.json();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}, [config]);
|
|
41
|
+
const getCountryData = (0, _react.useCallback)(lang => {
|
|
42
|
+
if (lang === 'cn' && window.app.countryListCn) return new Promise((resolve, reject) => {
|
|
43
|
+
resolve(window.app.countryListCn);
|
|
44
|
+
});
|
|
45
|
+
if (lang !== 'cn' && window.app.countryListEn) return new Promise((resolve, reject) => {
|
|
46
|
+
resolve(window.app.countryListEn);
|
|
47
|
+
});
|
|
48
|
+
const {
|
|
49
|
+
mediaUrl
|
|
50
|
+
} = config;
|
|
51
|
+
const geoFileName = lang === 'cn' ? 'cn-region-location' : 'en-region-location';
|
|
52
|
+
return fetch("".concat(mediaUrl, "geo-data/").concat(geoFileName, ".json")).then(res => {
|
|
53
|
+
return res.json();
|
|
54
|
+
}).catch(() => {
|
|
55
|
+
// get locations from local
|
|
56
|
+
return fetch("./geo-data/".concat(geoFileName, ".json")).then(res => {
|
|
57
|
+
return res.json();
|
|
58
|
+
});
|
|
59
|
+
}).then(res => {
|
|
60
|
+
const data = res || {};
|
|
61
|
+
if (lang === 'cn') {
|
|
62
|
+
window.app.countryListCn = data;
|
|
63
|
+
} else {
|
|
64
|
+
window.app.countryListEn = data;
|
|
65
|
+
}
|
|
66
|
+
return data;
|
|
67
|
+
});
|
|
68
|
+
}, [config]);
|
|
69
|
+
if (size === 'lg') return /*#__PURE__*/_react.default.createElement(_lg.default, props);
|
|
70
|
+
if (size === 'sm') return /*#__PURE__*/_react.default.createElement(_sm.default, props);
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
72
|
+
query: "(min-width: 768px)"
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement(_lg.default, Object.assign({}, props, {
|
|
74
|
+
config: config,
|
|
75
|
+
getLocationData: getLocationData,
|
|
76
|
+
getCountryData: getCountryData
|
|
77
|
+
}))), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
78
|
+
query: "(max-width: 768px)"
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement(_sm.default, Object.assign({}, props, {
|
|
80
|
+
config: config,
|
|
81
|
+
getLocationData: getLocationData,
|
|
82
|
+
getCountryData: getCountryData
|
|
83
|
+
}))));
|
|
84
|
+
};
|
|
240
85
|
var _default = exports.default = GeolocationEditor;
|