fan-standard-comp 4.1.48 → 4.1.49

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.
@@ -16,6 +16,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
16
16
  import React, { useMemo, forwardRef } from 'react';
17
17
  import Field from "../FieldComponent/index";
18
18
  import dayjs from "dayjs";
19
+ import isoWeek from 'dayjs/plugin/isoWeek'; // 引入ISO周插件
20
+
21
+ dayjs.extend(isoWeek); // 必须执行此步才能使用 isoWeek 方法
22
+
19
23
  import classNames from 'classnames';
20
24
  import useStyle from "./style";
21
25
  var DateTimeRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -41,6 +45,9 @@ var DateTimeRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
41
45
  }, {
42
46
  label: '日',
43
47
  value: 'day'
48
+ }, {
49
+ label: '周',
50
+ value: 'week'
44
51
  }, {
45
52
  label: '月',
46
53
  value: 'month'
@@ -77,6 +84,14 @@ var DateTimeRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
77
84
  config.format = 'YYYY-MM-DD';
78
85
  config = _objectSpread(_objectSpread({}, config), (timeTypeConfig === null || timeTypeConfig === void 0 ? void 0 : timeTypeConfig[activeType]) || {});
79
86
  break;
87
+ case "week":
88
+ config.picker = 'week';
89
+ var customWeekStartEndFormat = function customWeekStartEndFormat(date) {
90
+ return "".concat(date.year(), "\u5E74\u7B2C").concat(dayjs(date).isoWeek(), "\u5468");
91
+ };
92
+ config.format = customWeekStartEndFormat;
93
+ config = _objectSpread(_objectSpread({}, config), (timeTypeConfig === null || timeTypeConfig === void 0 ? void 0 : timeTypeConfig[activeType]) || {});
94
+ break;
80
95
  case "month":
81
96
  config.picker = 'month';
82
97
  config.format = 'MM月';
@@ -1,4 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
4
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -82,7 +83,9 @@ var StandardList = /*#__PURE__*/forwardRef(function (props, ref) {
82
83
  _providerConfig$props4 = _providerConfig$props.loading,
83
84
  loading = _providerConfig$props4 === void 0 ? false : _providerConfig$props4,
84
85
  sortable = _providerConfig$props.sortable,
85
- onChange = _providerConfig$props.onChange;
86
+ onChange = _providerConfig$props.onChange,
87
+ _providerConfig$props5 = _providerConfig$props.dndContextConfig,
88
+ dndContextConfig = _providerConfig$props5 === void 0 ? {} : _providerConfig$props5;
86
89
  var contentRef = useRef();
87
90
  useImperativeHandle(ref, function () {
88
91
  return contentRef === null || contentRef === void 0 ? void 0 : contentRef.current;
@@ -127,7 +130,19 @@ var StandardList = /*#__PURE__*/forwardRef(function (props, ref) {
127
130
  // useEffect(() => {
128
131
  // props?.onChange(dataList);// 这里写你自己对父组件传值的方式
129
132
  // }, []);
130
-
133
+ // 关键配置:设置拖拽激活的最小移动距离
134
+ // const sensors = useSensors(
135
+ // useSensor(MouseSensor, {
136
+ // activationConstraint: {
137
+ // distance: 5, // 移动超过 5px 才开始拖拽
138
+ // },
139
+ // }),
140
+ // useSensor(TouchSensor, {
141
+ // activationConstraint: {
142
+ // distance: 5, // 触摸设备同理
143
+ // },
144
+ // })
145
+ // );
131
146
  return wrapSSR( /*#__PURE__*/React.createElement("div", {
132
147
  className: classNames(componentName, className, hashId, fullHeight ? 'spec-standard-list-fullheight' : ''),
133
148
  style: style,
@@ -136,10 +151,10 @@ var StandardList = /*#__PURE__*/forwardRef(function (props, ref) {
136
151
  spinning: loading,
137
152
  wrapperClassName: 'spec-standard-list-loading'
138
153
  }, sortable // 开启排序
139
- ? /*#__PURE__*/React.createElement(DndContext, {
154
+ ? /*#__PURE__*/React.createElement(DndContext, _extends({
140
155
  onDragEnd: dragEndEvent,
141
156
  modifiers: [restrictToParentElement] // 拖动范围只能是父节点下区域
142
- }, /*#__PURE__*/React.createElement(SortableContext, {
157
+ }, dndContextConfig), /*#__PURE__*/React.createElement(SortableContext, {
143
158
  items: options.map(function (c) {
144
159
  return c[optionName === null || optionName === void 0 ? void 0 : optionName.value];
145
160
  }),
@@ -8,6 +8,7 @@ exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _index = _interopRequireDefault(require("../FieldComponent/index"));
10
10
  var _dayjs = _interopRequireDefault(require("dayjs"));
11
+ var _isoWeek = _interopRequireDefault(require("dayjs/plugin/isoWeek"));
11
12
  var _classnames = _interopRequireDefault(require("classnames"));
12
13
  var _style = _interopRequireDefault(require("./style"));
13
14
  var _excluded = ["options", "value", "onChange", "optionType", "timeTypeConfig", "radioConfig", "outerStyle", "outerClassname"];
@@ -27,6 +28,10 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
27
28
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
29
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
29
30
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
31
+ // 引入ISO周插件
32
+
33
+ _dayjs.default.extend(_isoWeek.default); // 必须执行此步才能使用 isoWeek 方法
34
+
30
35
  var DateTimeRangePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
31
36
  var options = props.options,
32
37
  value = props.value,
@@ -50,6 +55,9 @@ var DateTimeRangePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, r
50
55
  }, {
51
56
  label: '日',
52
57
  value: 'day'
58
+ }, {
59
+ label: '周',
60
+ value: 'week'
53
61
  }, {
54
62
  label: '月',
55
63
  value: 'month'
@@ -86,6 +94,14 @@ var DateTimeRangePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, r
86
94
  config.format = 'YYYY-MM-DD';
87
95
  config = _objectSpread(_objectSpread({}, config), (timeTypeConfig === null || timeTypeConfig === void 0 ? void 0 : timeTypeConfig[activeType]) || {});
88
96
  break;
97
+ case "week":
98
+ config.picker = 'week';
99
+ var customWeekStartEndFormat = function customWeekStartEndFormat(date) {
100
+ return "".concat(date.year(), "\u5E74\u7B2C").concat((0, _dayjs.default)(date).isoWeek(), "\u5468");
101
+ };
102
+ config.format = customWeekStartEndFormat;
103
+ config = _objectSpread(_objectSpread({}, config), (timeTypeConfig === null || timeTypeConfig === void 0 ? void 0 : timeTypeConfig[activeType]) || {});
104
+ break;
89
105
  case "month":
90
106
  config.picker = 'month';
91
107
  config.format = 'MM月';
@@ -17,6 +17,7 @@ var _SortableItem = _interopRequireDefault(require("./SortableItem"));
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
20
21
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
22
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
23
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -90,7 +91,9 @@ var StandardList = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
90
91
  _providerConfig$props4 = _providerConfig$props.loading,
91
92
  loading = _providerConfig$props4 === void 0 ? false : _providerConfig$props4,
92
93
  sortable = _providerConfig$props.sortable,
93
- onChange = _providerConfig$props.onChange;
94
+ onChange = _providerConfig$props.onChange,
95
+ _providerConfig$props5 = _providerConfig$props.dndContextConfig,
96
+ dndContextConfig = _providerConfig$props5 === void 0 ? {} : _providerConfig$props5;
94
97
  var contentRef = (0, _react.useRef)();
95
98
  (0, _react.useImperativeHandle)(ref, function () {
96
99
  return contentRef === null || contentRef === void 0 ? void 0 : contentRef.current;
@@ -135,7 +138,19 @@ var StandardList = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
135
138
  // useEffect(() => {
136
139
  // props?.onChange(dataList);// 这里写你自己对父组件传值的方式
137
140
  // }, []);
138
-
141
+ // 关键配置:设置拖拽激活的最小移动距离
142
+ // const sensors = useSensors(
143
+ // useSensor(MouseSensor, {
144
+ // activationConstraint: {
145
+ // distance: 5, // 移动超过 5px 才开始拖拽
146
+ // },
147
+ // }),
148
+ // useSensor(TouchSensor, {
149
+ // activationConstraint: {
150
+ // distance: 5, // 触摸设备同理
151
+ // },
152
+ // })
153
+ // );
139
154
  return wrapSSR( /*#__PURE__*/_react.default.createElement("div", {
140
155
  className: (0, _classnames.default)(componentName, className, hashId, fullHeight ? 'spec-standard-list-fullheight' : ''),
141
156
  style: style,
@@ -144,10 +159,10 @@ var StandardList = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
144
159
  spinning: loading,
145
160
  wrapperClassName: 'spec-standard-list-loading'
146
161
  }, sortable // 开启排序
147
- ? /*#__PURE__*/_react.default.createElement(_core.DndContext, {
162
+ ? /*#__PURE__*/_react.default.createElement(_core.DndContext, _extends({
148
163
  onDragEnd: dragEndEvent,
149
164
  modifiers: [_modifiers.restrictToParentElement] // 拖动范围只能是父节点下区域
150
- }, /*#__PURE__*/_react.default.createElement(_sortable.SortableContext, {
165
+ }, dndContextConfig), /*#__PURE__*/_react.default.createElement(_sortable.SortableContext, {
151
166
  items: options.map(function (c) {
152
167
  return c[optionName === null || optionName === void 0 ? void 0 : optionName.value];
153
168
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fan-standard-comp",
3
- "version": "4.1.48",
3
+ "version": "4.1.49",
4
4
  "description": "FZ standard-comp,basic of antd5.0 and custom component.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",