@titaui/pc 1.11.27 → 1.11.30
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/components/avatar/text-avatar/index.css +7 -0
- package/lib/components/avatar/text-avatar/index.js +32 -7
- package/lib/components/button/icon-btn/index.js +17 -8
- package/lib/components/button/rect-btn/index.js +7 -7
- package/lib/components/change-okr-modal/Item.js +14 -14
- package/lib/components/drawer/index.js +4 -4
- package/lib/components/drop-selector/index.js +25 -10
- package/lib/components/dynamic/constant.js +33 -32
- package/lib/components/dynamic/dynamic-item/dynamic-ai-dialy/dynamic-footer.js +9 -9
- package/lib/components/dynamic/dynamic-item/dynamic-ai-dialy/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-interview/img/wifi.svg +24 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview/index.css +51 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview/index.js +50 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview/interview-content.js +65 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview-share/img/wifi.svg +24 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.css +61 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.js +61 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview-share/interview-content.js +69 -0
- package/lib/components/dynamic/dynamic-item/dynamic-kr/index.js +5 -5
- package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.js +6 -6
- package/lib/components/dynamic/dynamic-item/dynamic-progress/index.js +10 -10
- package/lib/components/dynamic/dynamic-item/dynamic-reply/index.js +13 -13
- package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +9 -9
- package/lib/components/dynamic/dynamic-item/index.js +50 -32
- package/lib/components/dynamic/dynamic-list/index.js +4 -4
- package/lib/components/e-priority/index.js +8 -8
- package/lib/components/eReport/eReportShare/index.js +11 -11
- package/lib/components/form/form-fields/date/index.css +24 -0
- package/lib/components/form/form-fields/date/index.js +102 -0
- package/lib/components/form/form-fields/input/index.js +10 -10
- package/lib/components/form/form-fields/user/index.css +23 -3
- package/lib/components/form/form-fields/user/index.js +18 -8
- package/lib/components/form/form-fields/user/user-input.js +15 -6
- package/lib/components/form/index.js +10 -3
- package/lib/components/grid-layout/sub-employee-okr/person-okr.js +5 -5
- package/lib/components/icon-button-list/index.js +3 -3
- package/lib/components/img-viewer/index.css +3 -3
- package/lib/components/img-viewer/index.js +11 -11
- package/lib/components/menus/components/menu-tree/images/interview-menu/my-interview.svg +16 -0
- package/lib/components/menus/components/menu-tree/images/interview-menu/template.svg +16 -0
- package/lib/components/menus/components/menu-tree/images/interview-menu/todo.svg +16 -0
- package/lib/components/menus/components/menu-tree/index.css +4 -2
- package/lib/components/menus/components/menu-tree/tree-node/index.css +85 -1
- package/lib/components/menus/export-modules/interview-menus/constant.js +30 -0
- package/lib/components/menus/export-modules/interview-menus/handle-highlight.js +63 -0
- package/lib/components/menus/export-modules/interview-menus/index.css +7 -0
- package/lib/components/menus/export-modules/interview-menus/index.js +128 -0
- package/lib/components/menus/index.js +11 -5
- package/lib/components/nav-top/components/menu/index.js +14 -14
- package/lib/components/nav-top/components/user-message/components/inform/inform-item.js +25 -19
- package/lib/components/nav-top/components/user-message/components/remind/remind-item.js +48 -10
- package/lib/components/nav-top/components/user-message/constant.js +1 -0
- package/lib/components/nav-top/components/user-message/hrMessage.js +22 -19
- package/lib/components/nav-top/components/user-message/index.js +23 -20
- package/lib/components/nav-top/request.apis.js +3 -1
- package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-priority-dropdown.js +7 -7
- package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +3 -2
- package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/range-picker-pop.js +10 -0
- package/lib/components/okr-detail/detail-header/actions.js +23 -23
- package/lib/components/okr-detail/index.js +19 -19
- package/lib/components/okr-detail/okr-list/index.js +5 -3
- package/lib/components/okr-flow/child-node/index.css +6 -6
- package/lib/components/okr-flow/child-node/work-node.js +21 -21
- package/lib/components/okr-flow/export-modal/index.js +37 -19
- package/lib/components/okr-flow/export-modules/okr-search-panel/index.js +14 -14
- package/lib/components/okr-flow/okr-map/index.js +5 -5
- package/lib/components/okr-flow/request-apis.js +4 -4
- package/lib/components/okr-flow/root-node/index.js +25 -24
- package/lib/components/okr-flow/utils/index.js +5 -5
- package/lib/components/okr-flow/utils/tree-handler.js +17 -17
- package/lib/components/okrcase-library/okrcases-components/submitOkr-dialog.js +30 -30
- package/lib/components/pagination/index.css +3 -3
- package/lib/components/pagination/select.css +58 -23
- package/lib/components/period-selector/index.css +3 -3
- package/lib/components/period-selector/index.js +11 -11
- package/lib/components/picker/components/panels/date-panel/date-body.js +118 -0
- package/lib/components/picker/components/panels/date-panel/date-head.js +87 -0
- package/lib/components/picker/components/panels/date-panel/index.css +14 -0
- package/lib/components/picker/components/panels/date-panel/index.js +49 -0
- package/lib/components/picker/components/panels/month-panel/index.css +27 -0
- package/lib/components/picker/components/panels/month-panel/index.js +63 -0
- package/lib/components/picker/components/panels/month-panel/month-body.js +89 -0
- package/lib/components/picker/components/panels/month-panel/month-head.js +47 -0
- package/lib/components/picker/components/panels/panel-body/index.js +53 -0
- package/lib/components/picker/components/panels/panel-head/index.js +48 -0
- package/lib/components/picker/components/panels/year-panel/index.css +23 -0
- package/lib/components/picker/components/panels/year-panel/index.js +65 -0
- package/lib/components/picker/components/panels/year-panel/year-body.js +92 -0
- package/lib/components/picker/components/panels/year-panel/year-head.js +35 -0
- package/lib/components/picker/components/picker-trigger/index.css +57 -0
- package/lib/components/picker/components/picker-trigger/index.js +94 -0
- package/lib/components/picker/context.js +15 -0
- package/lib/components/picker/index.css +121 -0
- package/lib/components/picker/index.js +13 -0
- package/lib/components/picker/picker-panels.js +182 -0
- package/lib/components/picker/picker.js +132 -0
- package/lib/components/picker/type.js +5 -0
- package/lib/components/picker/utils.js +28 -0
- package/lib/components/popup/index.js +4 -4
- package/lib/components/radio/index.css +9 -9
- package/lib/components/scrollbar/scroll-mask/index.js +1 -1
- package/lib/components/superset-charts/utils/axios.js +5 -5
- package/lib/components/survey-model/index.css +18 -18
- package/lib/components/survey-model/instance.js +1 -1
- package/lib/components/task-tree/helper.js +61 -0
- package/lib/components/task-tree/images/P1.svg +15 -0
- package/lib/components/task-tree/images/P2.svg +15 -0
- package/lib/components/task-tree/images/P3.svg +15 -0
- package/lib/components/task-tree/images/P4.svg +15 -0
- package/lib/components/task-tree/images/P5.svg +15 -0
- package/lib/components/task-tree/images/arrow.svg +9 -0
- package/lib/components/task-tree/images/empty-131.png +0 -0
- package/lib/components/task-tree/images/followed.svg +33 -0
- package/lib/components/task-tree/images/nice.svg +108 -0
- package/lib/components/task-tree/images/struc12.png +0 -0
- package/lib/components/task-tree/images/struc2.png +0 -0
- package/lib/components/task-tree/images/xialat-s.svg +13 -0
- package/lib/components/task-tree/index.js +22 -0
- package/lib/components/task-tree/mock.js +944 -0
- package/lib/components/task-tree/precls.js +8 -0
- package/lib/components/task-tree/request-apis.js +88 -0
- package/lib/components/task-tree/task-item-node/constant.js +45 -0
- package/lib/components/task-tree/task-item-node/e-empty.js +29 -0
- package/lib/components/task-tree/task-item-node/e-project.js +212 -0
- package/lib/components/task-tree/task-item-node/e-status-dropdown.js +94 -0
- package/lib/components/task-tree/task-item-node/e-task.js +426 -0
- package/lib/components/task-tree/task-item-node/get-process-color.js +62 -0
- package/lib/components/task-tree/task-item-node/index.css +289 -0
- package/lib/components/task-tree/task-item-node/task-node-render.js +43 -0
- package/lib/components/task-tree/task-tree.css +16 -0
- package/lib/components/task-tree/task-tree.js +49 -0
- package/lib/components/time-picker/index.css +123 -0
- package/lib/components/time-picker/index.js +13 -0
- package/lib/components/time-picker/time-picker-selector.js +138 -0
- package/lib/components/time-picker/time-picker.js +336 -0
- package/lib/components/time-picker/timer-picker-input.js +96 -0
- package/lib/components/time-picker/utils.js +52 -0
- package/lib/components/user-selector/select-tree/tree-nodes/tree-person-node/index.css +1 -0
- package/lib/components-v1/radio/radio.js +3 -3
- package/lib/components-v1/radio/style/index.css +8 -8
- package/lib/pages/aha2021/index.js +5 -1
- package/lib/pages/okr-map/export-modules/okr-map/header/index.js +24 -24
- package/lib/pages/okr-map/export-modules/okr-map/okr-map.js +31 -31
- package/lib/pages/okr-map/export-modules/share-okr-page/header/index.css +2 -2
- package/lib/pages/okr-map/export-modules/share-okr-page/header/index.js +11 -11
- package/lib/pages/okr-map/export-modules/share-okr-page/share-okr-map.js +8 -8
- package/lib/pages/okr-map/number-select/index.js +2 -2
- package/lib/utils/auth.js +6 -6
- package/lib/utils/bs-global.js +12 -12
- package/lib/utils/hooks.js +72 -0
- package/lib/utils/open-data.js +26 -26
- package/package.json +5 -2
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -223
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -31
- package/.prettierrc.js +0 -90
- package/.vscode/settings.json +0 -5
|
@@ -55,7 +55,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
55
55
|
|
|
56
56
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
57
57
|
|
|
58
|
-
var preCls =
|
|
58
|
+
var preCls = 'titapage-okr-map';
|
|
59
59
|
|
|
60
60
|
function _default(props) {
|
|
61
61
|
var onShowKrClick = props.onShowKrClick,
|
|
@@ -85,23 +85,23 @@ function _default(props) {
|
|
|
85
85
|
setOVisible = _useState4[1];
|
|
86
86
|
|
|
87
87
|
var iconButtons = [{
|
|
88
|
-
icon:
|
|
89
|
-
overlay: (0, _getLocale.getLocale)(
|
|
88
|
+
icon: 'daochu',
|
|
89
|
+
overlay: (0, _getLocale.getLocale)('Mod_Export'),
|
|
90
90
|
type: 'export'
|
|
91
91
|
}, {
|
|
92
|
-
icon:
|
|
93
|
-
overlay: (0, _getLocale.getLocale)(
|
|
92
|
+
icon: 'fenxiang',
|
|
93
|
+
overlay: (0, _getLocale.getLocale)('OKR_MyO_Share'),
|
|
94
94
|
type: 'share'
|
|
95
95
|
}, {
|
|
96
|
-
icon: fullScreen ?
|
|
97
|
-
overlay: (0, _getLocale.getLocale)(
|
|
96
|
+
icon: fullScreen ? 'restore' : 'quanping',
|
|
97
|
+
overlay: (0, _getLocale.getLocale)('OKR_Ali_Butt_Fullscreen'),
|
|
98
98
|
type: fullScreen ? 'quit-fullscreen' : 'fullscreen'
|
|
99
99
|
}, {
|
|
100
|
-
icon: direction ==
|
|
101
|
-
overlay: direction ==
|
|
102
|
-
placement:
|
|
103
|
-
rotate: direction ==
|
|
104
|
-
type: direction ==
|
|
100
|
+
icon: direction == 'horizontal' ? 'yangshi-ditu' : 'yangshi-ditu',
|
|
101
|
+
overlay: direction == 'horizontal' ? "".concat((0, _getLocale.getLocale)('OKR_Ali_Butt_Toggleportrait')) : "".concat((0, _getLocale.getLocale)('OKR_Ali_Butt_Togglelandscape')),
|
|
102
|
+
placement: 'topRight',
|
|
103
|
+
rotate: direction == 'horizontal' ? 0 : -90,
|
|
104
|
+
type: direction == 'horizontal' ? 'vertical' : 'horizontal'
|
|
105
105
|
}];
|
|
106
106
|
|
|
107
107
|
var onConfirmHandler = function onConfirmHandler(checked) {
|
|
@@ -129,13 +129,13 @@ function _default(props) {
|
|
|
129
129
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
130
130
|
className: (0, _classnames["default"])("".concat(preCls, "__header-action-showkr"))
|
|
131
131
|
}, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
|
|
132
|
-
label: (0, _getLocale.getLocale)(
|
|
132
|
+
label: (0, _getLocale.getLocale)('OKR_Db_KRDetails'),
|
|
133
133
|
checked: showCardKr,
|
|
134
134
|
onChange: onhandleShowCardKr
|
|
135
135
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
136
136
|
className: (0, _classnames["default"])("".concat(preCls, "__header-action-showkr"))
|
|
137
137
|
}, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
|
|
138
|
-
label: (0, _getLocale.getLocale)(
|
|
138
|
+
label: (0, _getLocale.getLocale)('OKR_Ali_Butt_ExhibitionKRs'),
|
|
139
139
|
checked: showkr,
|
|
140
140
|
onChange: onConfirmHandler
|
|
141
141
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -146,7 +146,7 @@ function _default(props) {
|
|
|
146
146
|
onChange: function onChange(num) {
|
|
147
147
|
return onLevelChange(num);
|
|
148
148
|
},
|
|
149
|
-
label: (0, _getLocale.getLocale)(
|
|
149
|
+
label: (0, _getLocale.getLocale)('OKR_Ali_Butt_Displaylevel'),
|
|
150
150
|
defaultValue: openLevel
|
|
151
151
|
})));
|
|
152
152
|
|
|
@@ -161,12 +161,12 @@ function _default(props) {
|
|
|
161
161
|
className: (0, _classnames["default"])("".concat(preCls, "__header-title"))
|
|
162
162
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
163
163
|
className: (0, _classnames["default"])("".concat(preCls, "__header-title-text"))
|
|
164
|
-
}, (0, _getLocale.getLocale)(
|
|
164
|
+
}, (0, _getLocale.getLocale)('OKR_Ali_Title_Objectivemap')), /*#__PURE__*/_react["default"].createElement("span", {
|
|
165
165
|
className: (0, _classnames["default"])("".concat(preCls, "__header-title-right"))
|
|
166
166
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
167
167
|
className: (0, _classnames["default"])("".concat(preCls, "__header-theme")),
|
|
168
168
|
onClick: onThemeChange
|
|
169
|
-
}, "\u5207\u6362", darkTheme ?
|
|
169
|
+
}, "\u5207\u6362", darkTheme ? '浅色' : '深色', "\u6A21\u5F0F"), /*#__PURE__*/_react["default"].createElement(_periodSelector["default"], {
|
|
170
170
|
align: "bottomRight",
|
|
171
171
|
onChange: onPeriodChange,
|
|
172
172
|
selected: period,
|
|
@@ -177,22 +177,22 @@ function _default(props) {
|
|
|
177
177
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
178
178
|
className: (0, _classnames["default"])("".concat(preCls, "__header-action-search"))
|
|
179
179
|
}, /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"], {
|
|
180
|
-
placeholder: (0, _getLocale.getLocale)(
|
|
180
|
+
placeholder: (0, _getLocale.getLocale)('Mod_Pleaseselect'),
|
|
181
181
|
value: searchType,
|
|
182
182
|
onChange: onSearchChange
|
|
183
183
|
}, /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
|
|
184
184
|
value: "company"
|
|
185
|
-
}, (0, _getLocale.getLocale)(
|
|
185
|
+
}, (0, _getLocale.getLocale)('OKR_Ali_From_Companyobje')), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
|
|
186
186
|
value: "depart"
|
|
187
|
-
}, (0, _getLocale.getLocale)(
|
|
187
|
+
}, (0, _getLocale.getLocale)('OKR_Ali_From_Viewdepartment')), _utils.OkrTypeSetting && /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
|
|
188
188
|
value: "group"
|
|
189
|
-
}, (0, _getLocale.getLocale)(
|
|
189
|
+
}, (0, _getLocale.getLocale)('OKR_Ali_From_Viewteam')), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
|
|
190
190
|
value: "user"
|
|
191
|
-
}, (0, _getLocale.getLocale)(
|
|
191
|
+
}, (0, _getLocale.getLocale)('OKR_Ali_From_Viewmember')))), /*#__PURE__*/_react["default"].createElement(_popup["default"], {
|
|
192
192
|
popup: popup
|
|
193
193
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
194
194
|
className: (0, _classnames["default"])("".concat(preCls, "__header-action--show-more"))
|
|
195
|
-
}, (0, _getLocale.getLocale)(
|
|
195
|
+
}, (0, _getLocale.getLocale)('OKR_Ali_Butt_Exhibitionmore'))), /*#__PURE__*/_react["default"].createElement("span", {
|
|
196
196
|
className: (0, _classnames["default"])("".concat(preCls, "__header-action-btns"))
|
|
197
197
|
}, /*#__PURE__*/_react["default"].createElement(_iconButtonList["default"], {
|
|
198
198
|
items: iconButtons,
|
|
@@ -200,7 +200,7 @@ function _default(props) {
|
|
|
200
200
|
return onBtnClick(iconType);
|
|
201
201
|
}
|
|
202
202
|
}))), /*#__PURE__*/_react["default"].createElement(_rcTooltip["default"], {
|
|
203
|
-
overlay: fold ? "".concat((0, _getLocale.getLocale)(
|
|
203
|
+
overlay: fold ? "".concat((0, _getLocale.getLocale)('Mod_Unfold')) : "".concat((0, _getLocale.getLocale)('Mod_Fold')),
|
|
204
204
|
placement: "top"
|
|
205
205
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
206
206
|
className: (0, _classnames["default"])("".concat(preCls, "__header-fold"), _defineProperty({}, "".concat(preCls, "__header-fold__close"), fold)),
|
|
@@ -75,38 +75,38 @@ function _default(props) {
|
|
|
75
75
|
_objectDestructuringEmpty(props); // 使用存储的State
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
var _useStorage = (0, _useStorage15["default"])(
|
|
78
|
+
var _useStorage = (0, _useStorage15["default"])('period', {
|
|
79
79
|
annualNum: "".concat(new Date().getFullYear()),
|
|
80
|
-
cycleType:
|
|
80
|
+
cycleType: '2',
|
|
81
81
|
yqmNum: "".concat((0, _dayjs["default"])().quarter())
|
|
82
82
|
}),
|
|
83
83
|
_useStorage2 = _slicedToArray(_useStorage, 2),
|
|
84
84
|
period = _useStorage2[0],
|
|
85
85
|
setPeriod = _useStorage2[1];
|
|
86
86
|
|
|
87
|
-
var _useStorage3 = (0, _useStorage15["default"])(
|
|
87
|
+
var _useStorage3 = (0, _useStorage15["default"])('showkr', false),
|
|
88
88
|
_useStorage4 = _slicedToArray(_useStorage3, 2),
|
|
89
89
|
showkr = _useStorage4[0],
|
|
90
90
|
setShowKr = _useStorage4[1];
|
|
91
91
|
|
|
92
|
-
var _useStorage5 = (0, _useStorage15["default"])(
|
|
92
|
+
var _useStorage5 = (0, _useStorage15["default"])('showCardKr', false),
|
|
93
93
|
_useStorage6 = _slicedToArray(_useStorage5, 2),
|
|
94
94
|
showCardKr = _useStorage6[0],
|
|
95
95
|
setShowCardKr = _useStorage6[1];
|
|
96
96
|
|
|
97
|
-
var _useStorage7 = (0, _useStorage15["default"])(
|
|
97
|
+
var _useStorage7 = (0, _useStorage15["default"])('searchType', 'company'),
|
|
98
98
|
_useStorage8 = _slicedToArray(_useStorage7, 2),
|
|
99
99
|
searchType = _useStorage8[0],
|
|
100
100
|
setSearchType = _useStorage8[1];
|
|
101
101
|
|
|
102
|
-
var _useStorage9 = (0, _useStorage15["default"])(
|
|
102
|
+
var _useStorage9 = (0, _useStorage15["default"])('level2Selected', {}),
|
|
103
103
|
_useStorage10 = _slicedToArray(_useStorage9, 2),
|
|
104
104
|
level2Selected = _useStorage10[0],
|
|
105
105
|
setLevel2Selected = _useStorage10[1];
|
|
106
106
|
|
|
107
|
-
var _useStorage11 = (0, _useStorage15["default"])(
|
|
107
|
+
var _useStorage11 = (0, _useStorage15["default"])('rootNode', {
|
|
108
108
|
rootId: 0,
|
|
109
|
-
rootName:
|
|
109
|
+
rootName: ''
|
|
110
110
|
}, {
|
|
111
111
|
noLocal: true
|
|
112
112
|
}),
|
|
@@ -130,7 +130,7 @@ function _default(props) {
|
|
|
130
130
|
darkTheme = _useState6[0],
|
|
131
131
|
setDarkTheme = _useState6[1];
|
|
132
132
|
|
|
133
|
-
var _useState7 = (0, _react.useState)(
|
|
133
|
+
var _useState7 = (0, _react.useState)('horizontal'),
|
|
134
134
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
135
135
|
direction = _useState8[0],
|
|
136
136
|
setDirection = _useState8[1]; // 默认水平
|
|
@@ -157,7 +157,7 @@ function _default(props) {
|
|
|
157
157
|
showMask = _useState16[0],
|
|
158
158
|
setShowMask = _useState16[1];
|
|
159
159
|
|
|
160
|
-
var _useStorage13 = (0, _useStorage15["default"])(
|
|
160
|
+
var _useStorage13 = (0, _useStorage15["default"])('openLevel', 2),
|
|
161
161
|
_useStorage14 = _slicedToArray(_useStorage13, 2),
|
|
162
162
|
openLevel = _useStorage14[0],
|
|
163
163
|
setOpenLevel = _useStorage14[1];
|
|
@@ -182,7 +182,7 @@ function _default(props) {
|
|
|
182
182
|
}
|
|
183
183
|
}, [fullScreen]);
|
|
184
184
|
(0, _react.useEffect)(function () {
|
|
185
|
-
if (searchType ==
|
|
185
|
+
if (searchType == 'company') {
|
|
186
186
|
setRootNode({
|
|
187
187
|
rootId: 0,
|
|
188
188
|
rootName: _utils.tenantName
|
|
@@ -197,15 +197,15 @@ function _default(props) {
|
|
|
197
197
|
|
|
198
198
|
var onMapActionsHandler = function onMapActionsHandler(iconType) {
|
|
199
199
|
switch (iconType) {
|
|
200
|
-
case
|
|
200
|
+
case 'export':
|
|
201
201
|
exportCurrentFlow();
|
|
202
202
|
break;
|
|
203
203
|
|
|
204
|
-
case
|
|
204
|
+
case 'share':
|
|
205
205
|
setShareDialogVisible(true);
|
|
206
206
|
break;
|
|
207
207
|
|
|
208
|
-
case
|
|
208
|
+
case 'fullscreen':
|
|
209
209
|
// 全屏
|
|
210
210
|
var cardFlat = document.querySelector('.titaui-menus__menu-card');
|
|
211
211
|
|
|
@@ -216,7 +216,7 @@ function _default(props) {
|
|
|
216
216
|
setFullScreen(true);
|
|
217
217
|
break;
|
|
218
218
|
|
|
219
|
-
case
|
|
219
|
+
case 'quit-fullscreen':
|
|
220
220
|
// 退出全屏
|
|
221
221
|
var cardFlat = document.querySelector('.titaui-menus__menu-card');
|
|
222
222
|
|
|
@@ -227,7 +227,7 @@ function _default(props) {
|
|
|
227
227
|
setFullScreen(false);
|
|
228
228
|
break;
|
|
229
229
|
|
|
230
|
-
case
|
|
230
|
+
case 'horizontal':
|
|
231
231
|
setDirection(iconType);
|
|
232
232
|
setForceRender(true);
|
|
233
233
|
setTimeout(function () {
|
|
@@ -235,7 +235,7 @@ function _default(props) {
|
|
|
235
235
|
}, 100);
|
|
236
236
|
break;
|
|
237
237
|
|
|
238
|
-
case
|
|
238
|
+
case 'vertical':
|
|
239
239
|
setDirection(iconType);
|
|
240
240
|
setForceRender(true);
|
|
241
241
|
setTimeout(function () {
|
|
@@ -252,7 +252,7 @@ function _default(props) {
|
|
|
252
252
|
var setLevel2SelectedHandler = function setLevel2SelectedHandler(node) {
|
|
253
253
|
var restAttrs = {}; // 把用户头像带过去
|
|
254
254
|
|
|
255
|
-
if (node.nodeType ==
|
|
255
|
+
if (node.nodeType == 'person') {
|
|
256
256
|
restAttrs.avatar = node.data.avatar;
|
|
257
257
|
}
|
|
258
258
|
|
|
@@ -274,23 +274,23 @@ function _default(props) {
|
|
|
274
274
|
setSearchType(iconType);
|
|
275
275
|
|
|
276
276
|
switch (iconType) {
|
|
277
|
-
case
|
|
277
|
+
case 'company':
|
|
278
278
|
return setHasSubSearch(false);
|
|
279
279
|
|
|
280
|
-
case
|
|
280
|
+
case 'depart':
|
|
281
281
|
setLevel2Selected({
|
|
282
282
|
id: DepartmentId,
|
|
283
283
|
name: Department
|
|
284
284
|
});
|
|
285
285
|
break;
|
|
286
286
|
|
|
287
|
-
case
|
|
287
|
+
case 'group':
|
|
288
288
|
// 群组的默认显示项为数据列表的第一个节点
|
|
289
289
|
// 清空其他选项值,等待异步回调选中第一个数据
|
|
290
290
|
setLevel2Selected({});
|
|
291
291
|
break;
|
|
292
292
|
|
|
293
|
-
case
|
|
293
|
+
case 'user':
|
|
294
294
|
var userAvatar = {
|
|
295
295
|
color: UserAvatar.Color,
|
|
296
296
|
small: UserAvatar.Small,
|
|
@@ -348,7 +348,7 @@ function _default(props) {
|
|
|
348
348
|
var onKrPushChange = function onKrPushChange(name, value, id) {
|
|
349
349
|
var data = {};
|
|
350
350
|
|
|
351
|
-
if (name ==
|
|
351
|
+
if (name == 'user') {
|
|
352
352
|
var avatar = {};
|
|
353
353
|
|
|
354
354
|
for (var key in value.UserAvatar) {
|
|
@@ -362,16 +362,16 @@ function _default(props) {
|
|
|
362
362
|
userId: value.Id
|
|
363
363
|
}
|
|
364
364
|
};
|
|
365
|
-
} else if (name ==
|
|
365
|
+
} else if (name == 'date') {
|
|
366
366
|
data = {
|
|
367
367
|
startDate: value.startDate,
|
|
368
368
|
endDate: value.endDate
|
|
369
369
|
};
|
|
370
|
-
} else if (name ==
|
|
370
|
+
} else if (name == 'progress') {
|
|
371
371
|
data = {
|
|
372
372
|
progress: value
|
|
373
373
|
};
|
|
374
|
-
} else if (name ==
|
|
374
|
+
} else if (name == 'mileStoneName') {
|
|
375
375
|
data = {
|
|
376
376
|
mileStoneName: value
|
|
377
377
|
};
|
|
@@ -391,11 +391,11 @@ function _default(props) {
|
|
|
391
391
|
var modelType = node.modelType,
|
|
392
392
|
data = node.data;
|
|
393
393
|
|
|
394
|
-
if (modelType ==
|
|
395
|
-
_drawerManager["default"].open(
|
|
394
|
+
if (modelType == 'work') {
|
|
395
|
+
_drawerManager["default"].open('okrDetail', {
|
|
396
396
|
okrId: data.workId
|
|
397
397
|
});
|
|
398
|
-
} else if (modelType ==
|
|
398
|
+
} else if (modelType == 'kr') {
|
|
399
399
|
if (!data.mapkrVisible) return;
|
|
400
400
|
setSelectOkr(_objectSpread(_objectSpread({}, data), {}, {
|
|
401
401
|
workId: data.mileStoneId,
|
|
@@ -413,7 +413,7 @@ function _default(props) {
|
|
|
413
413
|
principalUser: data.user
|
|
414
414
|
}));
|
|
415
415
|
|
|
416
|
-
_drawerManager["default"].open(
|
|
416
|
+
_drawerManager["default"].open('krDetail', {
|
|
417
417
|
krId: data.mileStoneId
|
|
418
418
|
});
|
|
419
419
|
}
|
|
@@ -474,7 +474,7 @@ function _default(props) {
|
|
|
474
474
|
}, function () {
|
|
475
475
|
// 根据选择的搜索类型不同,show出不同的组件
|
|
476
476
|
if (!hasSubSearch) return undefined;
|
|
477
|
-
if (searchType ==
|
|
477
|
+
if (searchType == 'company') return undefined;
|
|
478
478
|
return /*#__PURE__*/_react["default"].createElement(_level2Search["default"], {
|
|
479
479
|
key: searchType,
|
|
480
480
|
type: searchType,
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
.titapage-okr-map__dark .titapage-okr-map-share-okr__header-dark {
|
|
96
|
-
color: #
|
|
96
|
+
color: #89919f;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
.titapage-okr-map__dark .titapage-okr-map-share-okr__header-dark:before {
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
.titapage-okr-map__dark .titapage-okr-map-share-okr__header .titaui-icon-button-list__btn:hover {
|
|
132
|
-
background-color: #
|
|
132
|
+
background-color: #515a69;
|
|
133
133
|
}
|
|
@@ -43,15 +43,15 @@ function _default(props) {
|
|
|
43
43
|
direction = props.direction;
|
|
44
44
|
var period = {};
|
|
45
45
|
var iconButtons = [{
|
|
46
|
-
icon:
|
|
47
|
-
overlay: (0, _getLocale.getLocale)(
|
|
46
|
+
icon: 'daochu',
|
|
47
|
+
overlay: (0, _getLocale.getLocale)('Mod_Export'),
|
|
48
48
|
type: 'export'
|
|
49
49
|
}, {
|
|
50
|
-
icon: direction ==
|
|
51
|
-
overlay: direction ==
|
|
52
|
-
placement:
|
|
53
|
-
rotate: direction ==
|
|
54
|
-
type: direction ==
|
|
50
|
+
icon: direction == 'horizontal' ? 'yangshi-ditu' : 'yangshi-ditu',
|
|
51
|
+
overlay: direction == 'horizontal' ? "".concat((0, _getLocale.getLocale)('OKR_Ali_Butt_Toggleportrait')) : "".concat((0, _getLocale.getLocale)('OKR_Ali_Butt_Togglelandscape')),
|
|
52
|
+
placement: 'topRight',
|
|
53
|
+
rotate: direction == 'horizontal' ? 0 : -90,
|
|
54
|
+
type: direction == 'horizontal' ? 'vertical' : 'horizontal'
|
|
55
55
|
}]; // 获取地图数据
|
|
56
56
|
|
|
57
57
|
(0, _react.useEffect)(function () {// ...
|
|
@@ -83,13 +83,13 @@ function _default(props) {
|
|
|
83
83
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
84
84
|
className: (0, _classnames["default"])("".concat(_precls["default"], "__header-action-showkr"))
|
|
85
85
|
}, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
|
|
86
|
-
label: (0, _getLocale.getLocale)(
|
|
86
|
+
label: (0, _getLocale.getLocale)('OKR_Db_KRDetails'),
|
|
87
87
|
checked: showCardKr,
|
|
88
88
|
onChange: onhandleShowCardKr
|
|
89
89
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
90
90
|
className: (0, _classnames["default"])("".concat(_precls["default"], "__header-action-showkr"))
|
|
91
91
|
}, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
|
|
92
|
-
label: (0, _getLocale.getLocale)(
|
|
92
|
+
label: (0, _getLocale.getLocale)('OKR_Ali_Butt_ExhibitionKRs'),
|
|
93
93
|
checked: showkr,
|
|
94
94
|
onChange: onConfirmHandler
|
|
95
95
|
})));
|
|
@@ -99,11 +99,11 @@ function _default(props) {
|
|
|
99
99
|
className: (0, _classnames["default"])("".concat(_precls["default"], "-share-okr__header"))
|
|
100
100
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
101
101
|
className: (0, _classnames["default"])("".concat(_precls["default"], "-share-okr__header-title"))
|
|
102
|
-
}, (0, _getLocale.getLocale)(
|
|
102
|
+
}, (0, _getLocale.getLocale)('OKR_Menu_Title_Alignment')), /*#__PURE__*/_react["default"].createElement(_popup["default"], {
|
|
103
103
|
popup: popup
|
|
104
104
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
105
105
|
className: (0, _classnames["default"])("".concat(_precls["default"], "-share-okr__header-showMore"))
|
|
106
|
-
}, (0, _getLocale.getLocale)(
|
|
106
|
+
}, (0, _getLocale.getLocale)('OKR_Ali_Butt_Exhibitionmore'))), /*#__PURE__*/_react["default"].createElement("span", {
|
|
107
107
|
className: (0, _classnames["default"])("".concat(_precls["default"], "-share-okr__header-direction"))
|
|
108
108
|
}, /*#__PURE__*/_react["default"].createElement(_iconButtonList["default"], {
|
|
109
109
|
items: iconButtons,
|
|
@@ -55,14 +55,14 @@ function _default() {
|
|
|
55
55
|
var _useState = (0, _react.useState)(function () {
|
|
56
56
|
var hashQuery = {};
|
|
57
57
|
var urlHash = decodeURIComponent(window.location.hash);
|
|
58
|
-
var hashQueryStr = urlHash.split(
|
|
59
|
-
hashQueryStr.split(
|
|
60
|
-
var _it$split = it.split(
|
|
58
|
+
var hashQueryStr = urlHash.split('?')[1];
|
|
59
|
+
hashQueryStr.split('&').forEach(function (it) {
|
|
60
|
+
var _it$split = it.split('='),
|
|
61
61
|
_it$split2 = _slicedToArray(_it$split, 2),
|
|
62
62
|
key = _it$split2[0],
|
|
63
63
|
value = _it$split2[1];
|
|
64
64
|
|
|
65
|
-
if (key ==
|
|
65
|
+
if (key == 'level2Selected' || key == 'period' || key == 'rootNode') hashQuery[key] = JSON.parse(value);else if (key == 'showkr' || key == 'darkTheme') hashQuery[key] = value == 'true';else hashQuery[key] = value;
|
|
66
66
|
});
|
|
67
67
|
return hashQuery;
|
|
68
68
|
}),
|
|
@@ -112,11 +112,11 @@ function _default() {
|
|
|
112
112
|
|
|
113
113
|
var onMapActionsHandler = function onMapActionsHandler(iconType) {
|
|
114
114
|
switch (iconType) {
|
|
115
|
-
case
|
|
115
|
+
case 'export':
|
|
116
116
|
exportCurrentFlow();
|
|
117
117
|
break;
|
|
118
118
|
|
|
119
|
-
case
|
|
119
|
+
case 'horizontal':
|
|
120
120
|
setDirection(iconType);
|
|
121
121
|
setForceRender(true);
|
|
122
122
|
setTimeout(function () {
|
|
@@ -124,7 +124,7 @@ function _default() {
|
|
|
124
124
|
}, 100);
|
|
125
125
|
break;
|
|
126
126
|
|
|
127
|
-
case
|
|
127
|
+
case 'vertical':
|
|
128
128
|
setDirection(iconType);
|
|
129
129
|
setForceRender(true);
|
|
130
130
|
setTimeout(function () {
|
|
@@ -169,7 +169,7 @@ function _default() {
|
|
|
169
169
|
direction: direction,
|
|
170
170
|
darkTheme: darkTheme
|
|
171
171
|
}, period, rootNode, {
|
|
172
|
-
okrType: _utils.OkrTypeSetting ? _utils.okrTypeMap[searchType] :
|
|
172
|
+
okrType: _utils.OkrTypeSetting ? _utils.okrTypeMap[searchType] : ''
|
|
173
173
|
}));
|
|
174
174
|
}())));
|
|
175
175
|
});
|
|
@@ -29,7 +29,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
29
29
|
|
|
30
30
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
31
|
|
|
32
|
-
var preCls =
|
|
32
|
+
var preCls = 'titaui-number-select';
|
|
33
33
|
|
|
34
34
|
function NumberSelect(props) {
|
|
35
35
|
var _props$max = props.max,
|
|
@@ -41,7 +41,7 @@ function NumberSelect(props) {
|
|
|
41
41
|
_props$defaultValue = props.defaultValue,
|
|
42
42
|
defaultValue = _props$defaultValue === void 0 ? 2 : _props$defaultValue,
|
|
43
43
|
_props$label = props.label,
|
|
44
|
-
label = _props$label === void 0 ? (0, _getLocale.getLocale)(
|
|
44
|
+
label = _props$label === void 0 ? (0, _getLocale.getLocale)('Mod_Editor') : _props$label;
|
|
45
45
|
|
|
46
46
|
var _useState = (0, _react.useState)(defaultValue),
|
|
47
47
|
_useState2 = _slicedToArray(_useState, 2),
|
package/lib/utils/auth.js
CHANGED
|
@@ -33,7 +33,7 @@ var BaseAuth = /*#__PURE__*/function () {
|
|
|
33
33
|
function BaseAuth() {
|
|
34
34
|
_classCallCheck(this, BaseAuth);
|
|
35
35
|
|
|
36
|
-
this.loginUserInfor = (0, _bsGlobal.getBSGlobal)(
|
|
36
|
+
this.loginUserInfor = (0, _bsGlobal.getBSGlobal)('loginUserInfo');
|
|
37
37
|
} // 老板
|
|
38
38
|
|
|
39
39
|
|
|
@@ -123,7 +123,7 @@ var KRAuth = /*#__PURE__*/function (_BaseAuth2) {
|
|
|
123
123
|
_this2 = _super2.call(this, props);
|
|
124
124
|
var user = props.user,
|
|
125
125
|
createUserId = props.createUserId;
|
|
126
|
-
_this2.loginUserInfor = (0, _bsGlobal.getBSGlobal)(
|
|
126
|
+
_this2.loginUserInfor = (0, _bsGlobal.getBSGlobal)('loginUserInfo');
|
|
127
127
|
_this2.userId = _this2.loginUserInfor.Id;
|
|
128
128
|
_this2.user = user;
|
|
129
129
|
_this2.createUserId = createUserId;
|
|
@@ -211,7 +211,7 @@ var EAuth = /*#__PURE__*/function (_BaseAuth3) {
|
|
|
211
211
|
exports.EAuth = EAuth;
|
|
212
212
|
|
|
213
213
|
var hasSuperior = function hasSuperior() {
|
|
214
|
-
return !!(0, _bsGlobal.getBSGlobal)(
|
|
214
|
+
return !!(0, _bsGlobal.getBSGlobal)('loginUserInfo').ManagerId;
|
|
215
215
|
}; // 动态和项目文件管理权限
|
|
216
216
|
|
|
217
217
|
|
|
@@ -228,8 +228,8 @@ var DynamicManagerAuth = /*#__PURE__*/function (_BaseAuth4) {
|
|
|
228
228
|
_classCallCheck(this, DynamicManagerAuth);
|
|
229
229
|
|
|
230
230
|
_this4 = _super4.call(this, props);
|
|
231
|
-
_this4.isDynamicManager = (0, _bsGlobal.getBSGlobal)(
|
|
232
|
-
_this4.isLeader = (0, _bsGlobal.getBSGlobal)(
|
|
231
|
+
_this4.isDynamicManager = (0, _bsGlobal.getBSGlobal)('loginUserInfo').IsFeedAndFileManager;
|
|
232
|
+
_this4.isLeader = (0, _bsGlobal.getBSGlobal)('loginUserInfo').IsLeader;
|
|
233
233
|
return _this4;
|
|
234
234
|
}
|
|
235
235
|
|
|
@@ -298,7 +298,7 @@ var MyRole = /*#__PURE__*/function () {
|
|
|
298
298
|
function MyRole() {
|
|
299
299
|
_classCallCheck(this, MyRole);
|
|
300
300
|
|
|
301
|
-
this.loginUserInfo = (0, _bsGlobal.getBSGlobal)(
|
|
301
|
+
this.loginUserInfo = (0, _bsGlobal.getBSGlobal)('loginUserInfo');
|
|
302
302
|
this.role_label = {
|
|
303
303
|
1: 'assistant',
|
|
304
304
|
// 助理或者说动态管理员
|
package/lib/utils/bs-global.js
CHANGED
|
@@ -38,14 +38,14 @@ var getVersion = function getVersion() {
|
|
|
38
38
|
exports.getVersion = getVersion;
|
|
39
39
|
|
|
40
40
|
var getSource = function getSource() {
|
|
41
|
-
var info = getBSGlobal(
|
|
41
|
+
var info = getBSGlobal('tenantInfo');
|
|
42
42
|
return info.Source;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
exports.getSource = getSource;
|
|
46
46
|
|
|
47
47
|
var getUploadMaxSize = function getUploadMaxSize() {
|
|
48
|
-
var info = getBSGlobal(
|
|
48
|
+
var info = getBSGlobal('tenantInfo');
|
|
49
49
|
if (info.Id === 352728) return 150;
|
|
50
50
|
var isDingDing = info.Source === 861;
|
|
51
51
|
var isDingZhi = window.dingZhiSize && window.dingZhiSize.indexOf(info.Id) !== -1;
|
|
@@ -65,8 +65,8 @@ function isWx() {
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
var getAppHead = function getAppHead(appId) {
|
|
68
|
-
var appHead = getBSGlobal(
|
|
69
|
-
var apps = getBSGlobal(
|
|
68
|
+
var appHead = getBSGlobal('WebHead');
|
|
69
|
+
var apps = getBSGlobal('apps');
|
|
70
70
|
if (!appHead && apps) return undefined;
|
|
71
71
|
var app = appHead && appHead.AppHead || apps && apps || [];
|
|
72
72
|
var appItem = app.find(function (item) {
|
|
@@ -110,14 +110,14 @@ var hasWebHead = function hasWebHead(webHeadName) {
|
|
|
110
110
|
|
|
111
111
|
exports.hasWebHead = hasWebHead;
|
|
112
112
|
var VERSION_MAP = {
|
|
113
|
-
1:
|
|
114
|
-
2:
|
|
115
|
-
3:
|
|
116
|
-
6:
|
|
117
|
-
8:
|
|
118
|
-
9:
|
|
119
|
-
10:
|
|
120
|
-
100:
|
|
113
|
+
1: '试用版',
|
|
114
|
+
2: '标准版',
|
|
115
|
+
3: '个人版',
|
|
116
|
+
6: '旗舰版',
|
|
117
|
+
8: '考核版',
|
|
118
|
+
9: '专业版',
|
|
119
|
+
10: 'OKR版',
|
|
120
|
+
100: 'OKR模板购买'
|
|
121
121
|
};
|
|
122
122
|
exports.VERSION_MAP = VERSION_MAP;
|
|
123
123
|
var _default = {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = useQuery;
|
|
7
|
+
exports.parseUrl = parseUrl;
|
|
8
|
+
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
|
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
+
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
18
|
+
|
|
19
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
20
|
+
|
|
21
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
+
|
|
23
|
+
function parseUrl(fragmentStr) {
|
|
24
|
+
var queryObject = {};
|
|
25
|
+
if (!fragmentStr) return queryObject;
|
|
26
|
+
var markIndex = fragmentStr.indexOf("?"); // contain query string in fragments
|
|
27
|
+
|
|
28
|
+
if (markIndex > -1) {
|
|
29
|
+
// build query object
|
|
30
|
+
var queryString = fragmentStr.slice(markIndex + 1);
|
|
31
|
+
var queryArray = queryString.split("&");
|
|
32
|
+
|
|
33
|
+
for (var i = 0; i < queryArray.length; i += 1) {
|
|
34
|
+
var queryPair = queryArray[i].split("=");
|
|
35
|
+
queryObject[queryPair[0]] = decodeURIComponent(queryPair[1]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return queryObject;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function useQuery(name) {
|
|
43
|
+
var initValue = name ? parseUrl(decodeURIComponent(window.location.hash))[name] : parseUrl(decodeURIComponent(window.location.hash));
|
|
44
|
+
|
|
45
|
+
var _useState = (0, _react.useState)(initValue),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
state = _useState2[0],
|
|
48
|
+
setState = _useState2[1];
|
|
49
|
+
|
|
50
|
+
var stateRef = (0, _react.useRef)();
|
|
51
|
+
stateRef.current = {
|
|
52
|
+
state: state,
|
|
53
|
+
setState: setState
|
|
54
|
+
};
|
|
55
|
+
var hashChangeHandler = (0, _react.useCallback)(function () {
|
|
56
|
+
var _stateRef$current = stateRef.current,
|
|
57
|
+
state = _stateRef$current.state,
|
|
58
|
+
setState = _stateRef$current.setState;
|
|
59
|
+
var value = name ? parseUrl(decodeURIComponent(window.location.hash))[name] : parseUrl(decodeURIComponent(window.location.hash));
|
|
60
|
+
|
|
61
|
+
if (value !== state) {
|
|
62
|
+
setState(value);
|
|
63
|
+
}
|
|
64
|
+
}, []);
|
|
65
|
+
(0, _react.useEffect)(function () {
|
|
66
|
+
window.addEventListener("hashchange", hashChangeHandler);
|
|
67
|
+
return function () {
|
|
68
|
+
window.removeEventListener("hashchange", hashChangeHandler);
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
return state;
|
|
72
|
+
}
|