fan-standard-comp 3.1.13 → 3.1.15

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.
Files changed (37) hide show
  1. package/dist/e3378c145b7db195ad068735e15fb28a.svg +165 -0
  2. package/dist/fan-standard-comp.umd.js +15 -15
  3. package/dist/fonts/iconfont.ttf +0 -0
  4. package/dist/fonts/iconfont.woff +0 -0
  5. package/es/CalendarCoordPicker/CalendarMonthPicker.d.ts +4 -0
  6. package/es/CalendarCoordPicker/CalendarMonthPicker.js +26 -0
  7. package/es/CalendarCoordPicker/index.d.ts +7 -0
  8. package/es/CalendarCoordPicker/index.js +296 -0
  9. package/es/CalendarCoordPicker/index.less +31 -0
  10. package/es/SpecIcon/fonts/demo_index.html +559 -5
  11. package/es/SpecIcon/fonts/iconfont.css +101 -3
  12. package/es/SpecIcon/fonts/iconfont.js +34 -27
  13. package/es/SpecIcon/fonts/iconfont.json +168 -0
  14. package/es/SpecIcon/fonts/iconfont.svg +163 -171
  15. package/es/SpecIcon/fonts/iconfont.ttf +0 -0
  16. package/es/SpecIcon/fonts/iconfont.woff +0 -0
  17. package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
  18. package/es/SpecIcon/style/iconfont.less +106 -11
  19. package/es/utils/filterPermission.js +1 -1
  20. package/lib/CalendarCoordPicker/CalendarMonthPicker.d.ts +4 -0
  21. package/lib/CalendarCoordPicker/CalendarMonthPicker.js +37 -0
  22. package/lib/CalendarCoordPicker/index.d.ts +7 -0
  23. package/lib/CalendarCoordPicker/index.js +306 -0
  24. package/lib/CalendarCoordPicker/index.less +31 -0
  25. package/lib/SpecIcon/fonts/demo_index.html +559 -5
  26. package/lib/SpecIcon/fonts/iconfont.css +101 -3
  27. package/lib/SpecIcon/fonts/iconfont.js +34 -27
  28. package/lib/SpecIcon/fonts/iconfont.json +168 -0
  29. package/lib/SpecIcon/fonts/iconfont.svg +163 -171
  30. package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
  31. package/lib/SpecIcon/fonts/iconfont.woff +0 -0
  32. package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
  33. package/lib/SpecIcon/style/iconfont.less +106 -11
  34. package/lib/utils/filterPermission.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
  37. package/dist/fonts/iconfont.eot +0 -0
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ import './index.less';
2
+ import 'moment/locale/zh-cn';
3
+ declare const CalendarMonthPicker: (props: any) => JSX.Element;
4
+ export default CalendarMonthPicker;
@@ -0,0 +1,26 @@
1
+ import "antd/es/calendar/style";
2
+ import _Calendar from "antd/es/calendar";
3
+ import { __rest } from "tslib";
4
+ import React, { useMemo } from 'react';
5
+ import './index.less';
6
+ import moment from 'moment';
7
+ import 'moment/locale/zh-cn';
8
+ import locale from 'antd/es/date-picker/locale/zh_CN';
9
+ var CalendarMonthPicker = function CalendarMonthPicker(props) {
10
+ var year = props.year,
11
+ month = props.month,
12
+ others = __rest(props, ["year", "month"]);
13
+ var monthRangeDays = useMemo(function () {
14
+ var time = (year || moment().year()) + '-01';
15
+ var startTime = moment(time).month(month - 1).date(1).startOf("month"); //.format('YYYY-MM-DD')
16
+ var endTime = moment(time).month(month - 1).date(1).endOf("month"); //.format('YYYY-MM-DD')
17
+ return [startTime, endTime];
18
+ }, [year]);
19
+ return /*#__PURE__*/React.createElement(_Calendar, Object.assign({
20
+ fullscreen: false,
21
+ value: moment((year || moment().year()) + '-' + month),
22
+ validRange: monthRangeDays,
23
+ locale: locale
24
+ }, others));
25
+ };
26
+ export default CalendarMonthPicker;
@@ -0,0 +1,7 @@
1
+ import './index.less';
2
+ interface CalendarCoordPickerProps {
3
+ type: string;
4
+ year?: number;
5
+ }
6
+ declare const CalendarCoordPicker: (props: CalendarCoordPickerProps) => JSX.Element;
7
+ export default CalendarCoordPicker;
@@ -0,0 +1,296 @@
1
+ import "antd/es/button/style";
2
+ import _Button from "antd/es/button";
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ 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); }
6
+ 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; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ import React, { useEffect, useMemo, useState } from 'react';
10
+ // import type { CalendarProps } from 'antd';
11
+ // import type { Dayjs } from 'dayjs';
12
+ import './index.less';
13
+ import { LeftOutlined, RightOutlined } from '@ant-design/icons';
14
+ import CalendarMonthPicker from './CalendarMonthPicker';
15
+ var CalendarCoordPicker = function CalendarCoordPicker(props) {
16
+ var _props$type = props.type,
17
+ type = _props$type === void 0 ? 'directPick' : _props$type,
18
+ year = props.year;
19
+ var _useState = useState(2023),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ yearNum = _useState2[0],
22
+ setYearNum = _useState2[1];
23
+ useEffect(function () {
24
+ setYearNum(year);
25
+ }, [year]);
26
+ // const cellDays = useMemo(() => {
27
+ // return
28
+ // }, [])
29
+ // const onPanelChange = (value: Dayjs, mode: CalendarProps<Dayjs>['mode']) => {
30
+ // console.log(value.format('YYYY-MM-DD'), mode);
31
+ // };
32
+ useEffect(function () {
33
+ // 获取日历格子元素
34
+ // var calendarCells = document.querySelectorAll('.calendar-cell');
35
+ var calendarCells = document.querySelectorAll('.ant-picker-cell');
36
+ // console.log('calendarCells', calendarCells)
37
+ // console.log('calendarCells', document.getElementsByClassName('ant-picker-cell-in-view'))
38
+ // 记录鼠标按下的位置
39
+ var startX, startY;
40
+ // 记录鼠标框选的起始位置和结束位置
41
+ // let startCell: any;
42
+ var endCell;
43
+ var startCellIndex, endCellIndex;
44
+ var startCellRect, endCellRect;
45
+ var cellSelectProcessing = false;
46
+ // 监听鼠标按下事件
47
+ document.addEventListener('mousedown', function (event) {
48
+ // 记录鼠标按下的位置
49
+ startX = event.clientX;
50
+ startY = event.clientY;
51
+ var startCellConfig = getCellFromCoordinates(startX, startY);
52
+ // 获取鼠标按下的日历格子
53
+ // startCell = startCellConfig.cell;
54
+ startCellIndex = startCellConfig.cellIndex;
55
+ startCellRect = startCellConfig.cellRect;
56
+ cellSelectProcessing = true;
57
+ });
58
+ // 监听鼠标移动事件
59
+ document.addEventListener('mousemove', function (event) {
60
+ // 获取鼠标移动的位置
61
+ var currentX = event.clientX;
62
+ var currentY = event.clientY;
63
+ // 获取鼠标移动的日历格子
64
+ var currentCellConfig = getCellFromCoordinates(currentX, currentY);
65
+ var currentCell = currentCellConfig.cell;
66
+ var currentCellIndex = currentCellConfig.cellIndex;
67
+ var currentCellRect = currentCellConfig.cellRect;
68
+ // 如果鼠标移动的日历格子不为空,则进行框选
69
+ if (cellSelectProcessing && currentCell) {
70
+ // 清除之前的框选样式
71
+ clearSelection();
72
+ // 设置当前日历格子的框选样式
73
+ // currentCell.classList.add('spec-calendar-coordinate-picker__order-selected');
74
+ // 记录结束位置
75
+ endCell = currentCell;
76
+ endCellIndex = currentCellIndex;
77
+ endCellRect = currentCellRect;
78
+ type === 'orderPick' ? getCellSelected() : getCellCoordinate();
79
+ }
80
+ });
81
+ // 监听鼠标松开事件
82
+ document.addEventListener('mouseup', function (event) {
83
+ // 清除框选样式
84
+ clearSelection();
85
+ // 获取鼠标松开的位置
86
+ var endX = event.clientX;
87
+ var endY = event.clientY;
88
+ // 获取鼠标松开的日历格子
89
+ var endCellConfig = getCellFromCoordinates(endX, endY);
90
+ endCell = endCellConfig.cell;
91
+ endCellIndex = endCellConfig.cellIndex;
92
+ endCellRect = endCellConfig.cellRect;
93
+ // 如果鼠标松开的日历格子不为空,则进行框选
94
+ if (endCell) {
95
+ type === 'orderPick' ? getCellSelected() : getCellCoordinate();
96
+ }
97
+ cellSelectProcessing = false;
98
+ });
99
+ // 按坐标内的顺序选中
100
+ var getCellSelected = function getCellSelected() {
101
+ for (var i = Math.min(startCellIndex, endCellIndex); i <= Math.max(startCellIndex, endCellIndex); i++) {
102
+ // const rect = calendarCells[i].getBoundingClientRect();
103
+ if (calendarCells[i].classList.contains('ant-picker-cell-in-view')) {
104
+ calendarCells[i].classList.add('spec-calendar-coordinate-picker__order-selected');
105
+ }
106
+ }
107
+ };
108
+ // 按坐标内的范围选中
109
+ var getCellCoordinate = function getCellCoordinate() {
110
+ var direct = ''; // 选中单元格方位
111
+ if (!startCellRect && !endCellRect) return;
112
+ if ((startCellRect === null || startCellRect === void 0 ? void 0 : startCellRect.x) === (endCellRect === null || endCellRect === void 0 ? void 0 : endCellRect.x)) {
113
+ if (startCellRect.y === endCellRect.y) {
114
+ direct = 'center';
115
+ } else if (startCellRect.y > endCellRect.y) {
116
+ direct = 'centerTop';
117
+ } else if (startCellRect.y < endCellRect.y) {
118
+ direct = 'centerBottom';
119
+ }
120
+ } else if ((startCellRect === null || startCellRect === void 0 ? void 0 : startCellRect.x) > (endCellRect === null || endCellRect === void 0 ? void 0 : endCellRect.x)) {
121
+ if (startCellRect.y === endCellRect.y) {
122
+ direct = 'centerLeft';
123
+ } else if (startCellRect.y > endCellRect.y) {
124
+ direct = 'leftTop';
125
+ } else if (startCellRect.y < endCellRect.y) {
126
+ direct = 'leftBottom';
127
+ }
128
+ } else if ((startCellRect === null || startCellRect === void 0 ? void 0 : startCellRect.x) < (endCellRect === null || endCellRect === void 0 ? void 0 : endCellRect.x)) {
129
+ if (startCellRect.y === endCellRect.y) {
130
+ direct = 'centerRight';
131
+ } else if (startCellRect.y > endCellRect.y) {
132
+ direct = 'rightTop';
133
+ } else if (startCellRect.y < endCellRect.y) {
134
+ direct = 'rightBottom';
135
+ }
136
+ }
137
+ var selectedCells = []; // 过滤当前选中的单元格
138
+ for (var i = 0; i < calendarCells.length; i++) {
139
+ var rect = calendarCells[i].getBoundingClientRect();
140
+ if (rect && calendarCells[i].classList.contains('ant-picker-cell-in-view')) {
141
+ switch (direct) {
142
+ case 'center':
143
+ if (rect.x === endCellRect.x && rect.y === endCellRect.y) {
144
+ selectedCells.push(calendarCells[i]);
145
+ }
146
+ break;
147
+ case 'centerTop':
148
+ if (rect.x === endCellRect.x && rect.y >= endCellRect.y && rect.x === endCellRect.x && rect.y <= startCellRect.y) {
149
+ selectedCells.push(calendarCells[i]);
150
+ }
151
+ break;
152
+ case 'centerBottom':
153
+ if (rect.x === endCellRect.x && rect.y <= endCellRect.y && rect.x === endCellRect.x && rect.y >= startCellRect.y) {
154
+ selectedCells.push(calendarCells[i]);
155
+ }
156
+ break;
157
+ case 'centerRight':
158
+ if (rect.y === endCellRect.y && rect.x <= endCellRect.x && rect.y === endCellRect.y && rect.x >= startCellRect.x) {
159
+ selectedCells.push(calendarCells[i]);
160
+ }
161
+ break;
162
+ case 'rightBottom':
163
+ if (rect.y >= startCellRect.y && rect.y <= endCellRect.y && rect.x >= startCellRect.x && rect.x <= endCellRect.x) {
164
+ selectedCells.push(calendarCells[i]);
165
+ }
166
+ break;
167
+ case 'rightTop':
168
+ if (rect.x >= startCellRect.x && rect.x <= endCellRect.x && rect.y >= endCellRect.y && rect.y <= startCellRect.y) {
169
+ selectedCells.push(calendarCells[i]);
170
+ }
171
+ break;
172
+ case 'centerLeft':
173
+ if (rect.y === endCellRect.y && rect.x >= endCellRect.x && rect.y === endCellRect.y && rect.x <= startCellRect.x) {
174
+ selectedCells.push(calendarCells[i]);
175
+ }
176
+ break;
177
+ case 'leftBottom':
178
+ if (rect.y >= startCellRect.y && rect.y <= endCellRect.y && rect.x <= startCellRect.x && rect.x >= endCellRect.x) {
179
+ selectedCells.push(calendarCells[i]);
180
+ }
181
+ break;
182
+ case 'leftTop':
183
+ if (rect.y <= startCellRect.y && rect.y >= endCellRect.y && rect.x <= startCellRect.x && rect.x >= endCellRect.x) {
184
+ selectedCells.push(calendarCells[i]);
185
+ }
186
+ break;
187
+ }
188
+ }
189
+ }
190
+ // console.log('selectedCells', calendarCells)
191
+ for (var j = 0; j < selectedCells.length; j++) {
192
+ // rect.x >= startX && rect.x <= overX && rect.y >= startY && rect.y <= overY
193
+ selectedCells[j].classList.add('spec-calendar-coordinate-picker__directed-selected');
194
+ }
195
+ };
196
+ // 获取指定坐标的日历格子(按坐标)
197
+ var getCellFromCoordinates = function getCellFromCoordinates(x, y) {
198
+ var cell = null;
199
+ var cellIndex = null;
200
+ var cellRect = null; // 当前格子的坐标信息
201
+ // 遍历所有日历格子
202
+ for (var i = 0; i < calendarCells.length; i++) {
203
+ var rect = calendarCells[i].getBoundingClientRect();
204
+ // 判断坐标是否在日历格子的范围内
205
+ if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
206
+ cell = calendarCells[i];
207
+ cellIndex = i;
208
+ cellRect = rect;
209
+ break;
210
+ }
211
+ }
212
+ return {
213
+ cellIndex: cellIndex,
214
+ cell: cell,
215
+ cellRect: cellRect
216
+ };
217
+ };
218
+ // 清除框选样式
219
+ var clearSelection = function clearSelection() {
220
+ for (var i = 0; i < calendarCells.length; i++) {
221
+ calendarCells[i].classList.remove('spec-calendar-coordinate-picker__order-selected');
222
+ calendarCells[i].classList.remove('spec-calendar-coordinate-picker__directed-selected');
223
+ }
224
+ };
225
+ return function () {
226
+ document.removeEventListener('mousedown', function () {}, false);
227
+ document.removeEventListener('mousemove', function () {}, false);
228
+ document.removeEventListener('mouseup', function () {}, false);
229
+ };
230
+ }, [type]);
231
+ var renderPickerHeader = function renderPickerHeader(_ref) {
232
+ var value = _ref.value;
233
+ //
234
+ // const start = 0;
235
+ // const end = 12;
236
+ // const monthOptions = [];
237
+ var current = value.clone();
238
+ var localeData = value.localeData();
239
+ var months = [];
240
+ for (var i = 0; i < 12; i++) {
241
+ current.month(i);
242
+ months.push(localeData.monthsShort(current));
243
+ }
244
+ return /*#__PURE__*/React.createElement("div", {
245
+ style: {
246
+ textAlign: 'right',
247
+ fontSize: '16px',
248
+ paddingRight: '10px'
249
+ }
250
+ }, months[value.month()]);
251
+ };
252
+ var monthArray = useMemo(function () {
253
+ var months = [];
254
+ for (var i = 0; i < 12; i++) {
255
+ months.push(i + 1);
256
+ }
257
+ return months;
258
+ }, []);
259
+ return /*#__PURE__*/React.createElement("div", {
260
+ className: 'spec-calendar-coordinate'
261
+ }, /*#__PURE__*/React.createElement("div", {
262
+ className: 'spec-calendar-coordinate-header'
263
+ }, /*#__PURE__*/React.createElement("div", {
264
+ className: 'spec-calendar-coordinate-header-action prev'
265
+ }, /*#__PURE__*/React.createElement(_Button, {
266
+ size: 'small',
267
+ icon: /*#__PURE__*/React.createElement(LeftOutlined, null),
268
+ title: "".concat(yearNum - 1, "\u5E74"),
269
+ onClick: function onClick() {
270
+ return setYearNum(year - 1);
271
+ }
272
+ })), /*#__PURE__*/React.createElement("div", {
273
+ className: 'spec-calendar-coordinate-header-year'
274
+ }, year, "\u5E74"), /*#__PURE__*/React.createElement("div", {
275
+ className: 'spec-calendar-coordinate-header-action next'
276
+ }, /*#__PURE__*/React.createElement(_Button, {
277
+ size: 'small',
278
+ icon: /*#__PURE__*/React.createElement(RightOutlined, null),
279
+ title: "".concat(yearNum + 1, "\u5E74"),
280
+ onClick: function onClick() {
281
+ return setYearNum(year + 1);
282
+ }
283
+ }))), /*#__PURE__*/React.createElement("div", {
284
+ className: 'spec-calendar-coordinate-picker'
285
+ }, monthArray.map(function (mItem) {
286
+ return /*#__PURE__*/React.createElement("div", {
287
+ className: 'spec-calendar-coordinate-picker-col',
288
+ key: mItem
289
+ }, /*#__PURE__*/React.createElement(CalendarMonthPicker, {
290
+ month: mItem,
291
+ year: yearNum,
292
+ headerRender: renderPickerHeader
293
+ }));
294
+ })));
295
+ };
296
+ export default CalendarCoordPicker;
@@ -0,0 +1,31 @@
1
+ @import (reference) '~antd/es/style/themes/index';
2
+ .spec-calendar-coordinate-header {
3
+ display: flex;
4
+ padding: @padding-sm @padding-md;
5
+ background-color: @body-background;
6
+ margin-bottom: @padding-sm;
7
+ &-year{
8
+ flex: 1;
9
+ text-align: center;
10
+ font-size: 18px;
11
+ }
12
+ }
13
+ .spec-calendar-coordinate-picker{
14
+ display: flex;
15
+ flex-wrap: wrap;
16
+ }
17
+
18
+ .spec-calendar-coordinate-picker-col {
19
+ width: 25%;
20
+ padding: 0 10px;
21
+ user-select: none;
22
+
23
+ .spec-calendar-coordinate-picker__order-selected{
24
+ background-color: #795da3;
25
+
26
+ }
27
+
28
+ .spec-calendar-coordinate-picker__directed-selected {
29
+ background-color: @primary-color !important;
30
+ }
31
+ }