@chengkejie/form-page 1.0.1

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 (78) hide show
  1. package/README.md +562 -0
  2. package/dist/cjs/FormPage.d.ts +26 -0
  3. package/dist/cjs/FormPage.d.ts.map +1 -0
  4. package/dist/cjs/FormPage.js +710 -0
  5. package/dist/cjs/assets/setting.svg +17 -0
  6. package/dist/cjs/components/CompanySelect/index.d.ts +7 -0
  7. package/dist/cjs/components/CompanySelect/index.d.ts.map +1 -0
  8. package/dist/cjs/components/CompanySelect/index.js +81 -0
  9. package/dist/cjs/components/CustomNode/index.d.ts +7 -0
  10. package/dist/cjs/components/CustomNode/index.d.ts.map +1 -0
  11. package/dist/cjs/components/CustomNode/index.js +13 -0
  12. package/dist/cjs/components/ExtraDatePicker/index.d.ts +8 -0
  13. package/dist/cjs/components/ExtraDatePicker/index.d.ts.map +1 -0
  14. package/dist/cjs/components/ExtraDatePicker/index.js +140 -0
  15. package/dist/cjs/components/ExtraDatePicker/index.module.scss +40 -0
  16. package/dist/cjs/components/Section/index.d.ts +7 -0
  17. package/dist/cjs/components/Section/index.d.ts.map +1 -0
  18. package/dist/cjs/components/Section/index.js +30 -0
  19. package/dist/cjs/components/SelectSearch/index.d.ts +7 -0
  20. package/dist/cjs/components/SelectSearch/index.d.ts.map +1 -0
  21. package/dist/cjs/components/SelectSearch/index.js +40 -0
  22. package/dist/cjs/components/SettingDialog/index.d.ts +12 -0
  23. package/dist/cjs/components/SettingDialog/index.d.ts.map +1 -0
  24. package/dist/cjs/components/SettingDialog/index.js +129 -0
  25. package/dist/cjs/components/SettingDialog/index.module.scss +67 -0
  26. package/dist/cjs/context.d.ts +34 -0
  27. package/dist/cjs/context.d.ts.map +1 -0
  28. package/dist/cjs/context.js +23 -0
  29. package/dist/cjs/index.d.ts +12 -0
  30. package/dist/cjs/index.d.ts.map +1 -0
  31. package/dist/cjs/index.js +71 -0
  32. package/dist/cjs/styles/index.module.scss +178 -0
  33. package/dist/cjs/tableKeyMap.d.ts +3 -0
  34. package/dist/cjs/tableKeyMap.d.ts.map +1 -0
  35. package/dist/cjs/tableKeyMap.js +13 -0
  36. package/dist/cjs/types.d.ts +197 -0
  37. package/dist/cjs/types.d.ts.map +1 -0
  38. package/dist/cjs/types.js +5 -0
  39. package/dist/cjs/typings.d.ts +14 -0
  40. package/dist/esm/FormPage.d.ts +26 -0
  41. package/dist/esm/FormPage.d.ts.map +1 -0
  42. package/dist/esm/FormPage.js +708 -0
  43. package/dist/esm/assets/setting.svg +17 -0
  44. package/dist/esm/components/CompanySelect/index.d.ts +7 -0
  45. package/dist/esm/components/CompanySelect/index.d.ts.map +1 -0
  46. package/dist/esm/components/CompanySelect/index.js +75 -0
  47. package/dist/esm/components/CustomNode/index.d.ts +7 -0
  48. package/dist/esm/components/CustomNode/index.d.ts.map +1 -0
  49. package/dist/esm/components/CustomNode/index.js +7 -0
  50. package/dist/esm/components/ExtraDatePicker/index.d.ts +8 -0
  51. package/dist/esm/components/ExtraDatePicker/index.d.ts.map +1 -0
  52. package/dist/esm/components/ExtraDatePicker/index.js +133 -0
  53. package/dist/esm/components/ExtraDatePicker/index.module.scss +40 -0
  54. package/dist/esm/components/Section/index.d.ts +7 -0
  55. package/dist/esm/components/Section/index.d.ts.map +1 -0
  56. package/dist/esm/components/Section/index.js +25 -0
  57. package/dist/esm/components/SelectSearch/index.d.ts +7 -0
  58. package/dist/esm/components/SelectSearch/index.d.ts.map +1 -0
  59. package/dist/esm/components/SelectSearch/index.js +34 -0
  60. package/dist/esm/components/SettingDialog/index.d.ts +12 -0
  61. package/dist/esm/components/SettingDialog/index.d.ts.map +1 -0
  62. package/dist/esm/components/SettingDialog/index.js +122 -0
  63. package/dist/esm/components/SettingDialog/index.module.scss +67 -0
  64. package/dist/esm/context.d.ts +34 -0
  65. package/dist/esm/context.d.ts.map +1 -0
  66. package/dist/esm/context.js +14 -0
  67. package/dist/esm/index.d.ts +12 -0
  68. package/dist/esm/index.d.ts.map +1 -0
  69. package/dist/esm/index.js +9 -0
  70. package/dist/esm/styles/index.module.scss +178 -0
  71. package/dist/esm/tableKeyMap.d.ts +3 -0
  72. package/dist/esm/tableKeyMap.d.ts.map +1 -0
  73. package/dist/esm/tableKeyMap.js +7 -0
  74. package/dist/esm/types.d.ts +197 -0
  75. package/dist/esm/types.d.ts.map +1 -0
  76. package/dist/esm/types.js +1 -0
  77. package/dist/esm/typings.d.ts +14 -0
  78. package/package.json +67 -0
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="16px" height="15px" viewBox="0 0 16 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>自定义字段</title>
4
+ <g id="实时监控/轨迹回放" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
+ <g id="版本新-实时监控-车辆信息弹窗" transform="translate(-1146, -642)" fill="#FF7E07" fill-rule="nonzero">
6
+ <g id="内容" transform="translate(5.5, 68)">
7
+ <g id="下方数据" transform="translate(264.5, 553)">
8
+ <g id="tab" transform="translate(10, 13)">
9
+ <g id="编组" transform="translate(866, 8)">
10
+ <path d="M15.9402305,6.38574265 C15.8775158,6.03682555 15.5418536,5.6816584 15.193696,5.60305548 L14.9333738,5.54335459 C14.3217322,5.35787166 13.7790855,4.95237868 13.4340681,4.35517443 C13.089029,3.75480176 13.0074306,3.07267945 13.1580022,2.44724152 L13.2395789,2.20203599 C13.3430711,1.86255905 13.2081782,1.39424015 12.935339,1.16159981 C12.935339,1.16159981 12.6906521,0.954154942 12.0005955,0.554955402 C11.3105173,0.158902584 11.0125359,0.0488975569 11.0125359,0.0488975569 C10.6768953,-0.0736726524 10.2064268,0.0426258164 9.96176158,0.303521542 L9.77978934,0.49840123 C9.31557933,0.93846474 8.69137754,1.20563221 8.0013643,1.20563221 C7.31135107,1.20563221 6.6808908,0.935361422 6.21661582,0.492129489 L6.04090207,0.30349984 C5.79937686,0.0426258164 5.32578996,-0.0736292493 4.99012774,0.0488975569 C4.99012774,0.0488975569 4.68902791,0.158902584 3.9989497,0.554933701 C3.3088715,0.957279961 3.06736795,1.16472483 3.06736795,1.16472483 C2.79450705,1.39419675 2.65961415,1.85939063 2.76312805,2.20201429 L2.83846797,2.45032313 C2.98587782,3.07580447 2.90744114,3.75480176 2.56240204,4.35510932 C2.21736294,4.95541689 1.66860936,5.3641651 1.05389273,5.54650131 L0.802968986,5.60305548 C0.457929884,5.6816584 0.119149259,6.03370053 0.0564345635,6.38574265 C0.0564345635,6.38574265 0,6.70004583 0,7.49844491 C0,8.29684399 0.0564345635,8.61114717 0.0564345635,8.61114717 C0.119149259,8.96318929 0.454789819,9.31523142 0.802968986,9.39383434 L1.04765591,9.45038851 C1.66241585,9.63274642 2.21446109,10.0413644 2.55950019,10.6448404 C2.90453929,11.2452348 2.98613769,11.9273354 2.83556612,12.552795 L2.76345288,12.7948321 C2.65996064,13.1343091 2.79485354,13.602628 3.06767113,13.8352683 C3.06767113,13.8352683 3.31235805,14.0427132 4.0024146,14.4419127 C4.69247115,14.8411123 4.99045258,14.9479706 4.99045258,14.9479706 C5.32609314,15.0705191 5.79656163,14.9542423 6.0412269,14.6933466 L6.21373562,14.5078636 C6.68104239,14.0646534 7.3084059,13.7943609 8.00162417,13.7943609 C8.69484244,13.7943609 9.32523774,14.0678001 9.78951272,14.5109887 L9.96202144,14.6964716 C10.2035467,14.9573456 10.6771336,15.0737092 11.0127958,14.9510739 C11.0127958,14.9510739 11.3138956,14.8410689 12.0039738,14.4450377 C12.694052,14.0458165 12.9355556,13.8383933 12.9355556,13.8383933 C13.2084165,13.6089214 13.3433094,13.1406025 13.2397738,12.7979571 L13.1644339,12.5464799 C13.017024,11.9241453 13.0954607,11.2451697 13.4404998,10.6479437 C13.7855389,10.0475494 14.3375625,9.63582804 14.9523441,9.45349183 L15.197031,9.39693766 C15.5420701,9.31833474 15.8808507,8.96629261 15.9435654,8.61425048 C15.9435654,8.61425048 16,8.29994731 16,7.50154823 C15.9967083,6.69995902 15.9402521,6.38563415 15.9402521,6.38563415 L15.9402305,6.38574265 Z M8.00155921,10.6951445 C6.24190959,10.6951445 4.81162041,9.26499239 4.81162041,7.49844491 C4.81162041,5.73506585 6.23874787,4.30487029 8.00155921,4.30487029 C9.76120882,4.30487029 11.191498,5.73502245 11.191498,7.50156993 C11.188293,9.26494899 9.76116551,10.6951445 8.00155921,10.6951445 Z" id="形状"></path>
11
+ </g>
12
+ </g>
13
+ </g>
14
+ </g>
15
+ </g>
16
+ </g>
17
+ </svg>
@@ -0,0 +1,7 @@
1
+ interface CompanySelectProps {
2
+ field: any;
3
+ data: any;
4
+ }
5
+ declare function CompanySelect({ field, data, }: CompanySelectProps): import("react/jsx-runtime").JSX.Element;
6
+ export default CompanySelect;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CompanySelect/index.tsx"],"names":[],"mappings":"AAMA,UAAU,kBAAkB;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,GAAG,CAAC;CACX;AAED,iBAAS,aAAa,CAAC,EACrB,KAAK,EAAE,IAAI,GACZ,EAAE,kBAAkB,2CA+CpB;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,75 @@
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ /* eslint-disable react/jsx-props-no-spreading */
8
+ import React from 'react';
9
+ import { Select } from '@alifd/next';
10
+ import { useRequest } from 'ahooks';
11
+ import { useConfig } from "../../context";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ function CompanySelect(_ref) {
14
+ var _getCompanyInfo, _data$customProps$pla, _data$customProps;
15
+ var field = _ref.field,
16
+ data = _ref.data;
17
+ var _useConfig = useConfig(),
18
+ onSearchCompany = _useConfig.onSearchCompany,
19
+ getCompanyInfo = _useConfig.getCompanyInfo;
20
+ var companyInfo = (_getCompanyInfo = getCompanyInfo === null || getCompanyInfo === void 0 ? void 0 : getCompanyInfo()) !== null && _getCompanyInfo !== void 0 ? _getCompanyInfo : {
21
+ id: '',
22
+ name: '',
23
+ isManage: true
24
+ };
25
+ var _useRequest = useRequest(function (v) {
26
+ return new Promise(function (resolve, reject) {
27
+ var _v$trim;
28
+ if (!onSearchCompany) {
29
+ resolve([]);
30
+ return;
31
+ }
32
+ onSearchCompany((_v$trim = v === null || v === void 0 ? void 0 : v.trim()) !== null && _v$trim !== void 0 ? _v$trim : '').then(function (res) {
33
+ resolve(res.map(function (e) {
34
+ return {
35
+ label: e.name,
36
+ value: e.id
37
+ };
38
+ }));
39
+ }).catch(reject);
40
+ });
41
+ }, {
42
+ debounceWait: 500
43
+ }),
44
+ dataSource = _useRequest.data,
45
+ getData = _useRequest.run;
46
+ return companyInfo.isManage || !data.hasDefault ? /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({}, field.init(data.name, _objectSpread({}, data.options), _objectSpread({}, data.customProps))), {}, {
47
+ showSearch: true,
48
+ onSearch: getData,
49
+ placeholder: (_data$customProps$pla = (_data$customProps = data.customProps) === null || _data$customProps === void 0 ? void 0 : _data$customProps.placeholder) !== null && _data$customProps$pla !== void 0 ? _data$customProps$pla : '请输入公司名称',
50
+ onVisibleChange: function onVisibleChange(v) {
51
+ return v && getData(undefined);
52
+ },
53
+ dataSource: dataSource,
54
+ filterLocal: false,
55
+ notFoundContent: "\u672A\u67E5\u8BE2\u5230\u8BE5\u4F01\u4E1A",
56
+ onRemove: function onRemove(item) {
57
+ var val = field.getValue(data.name);
58
+ var arr = val && (val === null || val === void 0 ? void 0 : val.split(',')) || [];
59
+ var str = arr.filter(function (a) {
60
+ return a != item.value;
61
+ }).join(',');
62
+ field.setValue(data.name, str);
63
+ }
64
+ })) : /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({}, field.init(data.name, _objectSpread(_objectSpread({}, data.options), {}, {
65
+ initValue: "".concat(companyInfo.id)
66
+ }), _objectSpread({}, data.customProps))), {}, {
67
+ dataSource: [{
68
+ label: companyInfo.name,
69
+ value: "".concat(companyInfo.id)
70
+ }],
71
+ mode: "multiple",
72
+ readOnly: true
73
+ }));
74
+ }
75
+ export default CompanySelect;
@@ -0,0 +1,7 @@
1
+ interface CustomNodeProps {
2
+ field: any;
3
+ data: any;
4
+ }
5
+ declare function CustomNode({ field, data, }: CustomNodeProps): any;
6
+ export default CustomNode;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CustomNode/index.tsx"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,GAAG,CAAC;CACX;AAED,iBAAS,UAAU,CAAC,EAClB,KAAK,EAAE,IAAI,GACZ,EAAE,eAAe,OAEjB;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,7 @@
1
+ function CustomNode(_ref) {
2
+ var _data$node;
3
+ var field = _ref.field,
4
+ data = _ref.data;
5
+ return (_data$node = data.node(field)) !== null && _data$node !== void 0 ? _data$node : null;
6
+ }
7
+ export default CustomNode;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface ExtraDatePickerProps {
3
+ field: any;
4
+ data: any;
5
+ }
6
+ declare const _default: React.ForwardRefExoticComponent<ExtraDatePickerProps & React.RefAttributes<any>>;
7
+ export default _default;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExtraDatePicker/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAMpF,UAAU,oBAAoB;IAC5B,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,GAAG,CAAC;CACX;;AA0HD,wBAA2C"}
@@ -0,0 +1,133 @@
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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); }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ /* eslint-disable react/jsx-props-no-spreading */
14
+ import React, { useEffect, useState, useImperativeHandle, forwardRef } from 'react';
15
+ import { DatePicker, Button, TimePicker, Box } from '@alifd/next';
16
+ import styles from "./index.module.scss";
17
+ import moment from 'moment';
18
+ import { useControllableValue, useUpdateEffect } from 'ahooks';
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ function ExtraDatePicker(_ref, ref) {
22
+ var field = _ref.field,
23
+ data = _ref.data;
24
+ var _useState = useState(data.extra.defaultBtn),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ btnKey = _useState2[0],
27
+ setBtnKey = _useState2[1];
28
+ useEffect(function () {
29
+ field.setValue(data.extra.name, data.extra.defaultBtn);
30
+ }, []);
31
+ useImperativeHandle(ref, function () {
32
+ return {
33
+ reset: function reset() {
34
+ setBtnKey(data.extra.defaultBtn);
35
+ field.setValue(data.extra.name, data.extra.defaultBtn);
36
+ }
37
+ };
38
+ }, [btnKey]);
39
+ useUpdateEffect(function () {
40
+ var obj = {};
41
+ var index = field.getValue(data.extra.name);
42
+ data.name.forEach(function (e, i) {
43
+ obj[e] = data.extra.buttons[index].date[i];
44
+ });
45
+ field.setValues(obj);
46
+ }, [field.getValue(data.extra.name)]);
47
+ return /*#__PURE__*/_jsxs("div", {
48
+ className: styles.content,
49
+ children: [/*#__PURE__*/_jsx(ExBtn, _objectSpread(_objectSpread({}, field.init(data.extra.name, {
50
+ initValue: data.extra.defaultBtn
51
+ })), {}, {
52
+ buttons: data.extra.buttons,
53
+ names: data.name
54
+ })), /*#__PURE__*/_jsx("div", {
55
+ className: styles.rangePicker,
56
+ children: data.name && data.name.map(function (e, i) {
57
+ var _data$extra$buttons$f;
58
+ return /*#__PURE__*/_jsxs(Box, {
59
+ direction: "row",
60
+ align: "center",
61
+ style: {
62
+ width: '100%'
63
+ },
64
+ children: [i !== 0 && /*#__PURE__*/_jsx("span", {
65
+ className: styles.sep,
66
+ children: "-"
67
+ }), /*#__PURE__*/_jsx(Picker, _objectSpread({
68
+ type: data.extra.buttons[field.getValue(data.extra.name)].datePickerType,
69
+ pickerProps: _objectSpread(_objectSpread({}, data.customProps[i]), (_data$extra$buttons$f = data.extra.buttons[field.getValue(data.extra.name)].props) !== null && _data$extra$buttons$f !== void 0 ? _data$extra$buttons$f : {})
70
+ }, field.init(e, _objectSpread({}, data.options[i]))))]
71
+ }, "extraDatePicker-".concat(i));
72
+ })
73
+ })]
74
+ });
75
+ }
76
+ var Picker = function Picker(props) {
77
+ var _props$type;
78
+ var _useControllableValue = useControllableValue(props),
79
+ _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
80
+ value = _useControllableValue2[0],
81
+ setValue = _useControllableValue2[1];
82
+ var obj = {
83
+ monthPicker: /*#__PURE__*/_jsx(DatePicker.MonthPicker, _objectSpread({
84
+ hasClear: true,
85
+ value: value,
86
+ onChange: function onChange(v) {
87
+ return setValue(v);
88
+ },
89
+ className: styles.datePicker
90
+ }, props.pickerProps)),
91
+ datePicker: /*#__PURE__*/_jsx(DatePicker, _objectSpread({
92
+ hasClear: true,
93
+ value: value,
94
+ onChange: function onChange(v) {
95
+ return setValue(v);
96
+ },
97
+ className: styles.datePicker
98
+ }, props.pickerProps)),
99
+ timePicker: /*#__PURE__*/_jsx(TimePicker, _objectSpread({
100
+ hasClear: true,
101
+ value: moment(value),
102
+ onChange: function onChange(v) {
103
+ setValue(v);
104
+ },
105
+ className: styles.datePicker
106
+ }, props.pickerProps))
107
+ };
108
+ return obj[(_props$type = props === null || props === void 0 ? void 0 : props.type) !== null && _props$type !== void 0 ? _props$type : 'datePicker'];
109
+ };
110
+ var ExBtn = function ExBtn(props) {
111
+ var _props$buttons;
112
+ var _useControllableValue3 = useControllableValue(props),
113
+ _useControllableValue4 = _slicedToArray(_useControllableValue3, 2),
114
+ btnKey = _useControllableValue4[0],
115
+ setBtnKey = _useControllableValue4[1];
116
+ var timeChange = function timeChange(date, index) {
117
+ setBtnKey(index);
118
+ };
119
+ return /*#__PURE__*/_jsx("div", {
120
+ className: styles.extraBtn,
121
+ children: props === null || props === void 0 || (_props$buttons = props.buttons) === null || _props$buttons === void 0 ? void 0 : _props$buttons.map(function (e, i) {
122
+ return /*#__PURE__*/_jsx(Button, {
123
+ type: btnKey === i ? 'primary' : 'normal',
124
+ className: "".concat(styles.btn, " ").concat(styles.active),
125
+ onClick: function onClick() {
126
+ timeChange(e.date, i);
127
+ },
128
+ children: e.name
129
+ }, "extraBtn-".concat(i));
130
+ })
131
+ });
132
+ };
133
+ export default /*#__PURE__*/forwardRef(ExtraDatePicker);
@@ -0,0 +1,40 @@
1
+ .content {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
+ align-items: center;
6
+
7
+ .extraBtn {
8
+ flex-shrink: 0;
9
+ height: 100% !important;
10
+
11
+ .btn {
12
+ padding: 0 12px !important;
13
+ width: auto !important;
14
+ min-width: 48px;
15
+ height: 30px !important;
16
+ margin-right: 10px;
17
+ }
18
+ }
19
+
20
+ .rangePicker {
21
+ flex: 1;
22
+ display: flex;
23
+ align-items: center;
24
+
25
+ .sep {
26
+ padding: 0 6px;
27
+ flex-shrink: 0;
28
+ }
29
+
30
+ .datePicker {
31
+ flex: 1;
32
+ }
33
+ }
34
+
35
+ :global {
36
+ .next-time-picker {
37
+ width: auto !important;
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,7 @@
1
+ interface SectionProps {
2
+ field: any;
3
+ data: any;
4
+ }
5
+ declare function Section({ field, data, }: SectionProps): import("react/jsx-runtime").JSX.Element;
6
+ export default Section;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Section/index.tsx"],"names":[],"mappings":"AAKA,UAAU,YAAY;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,GAAG,CAAC;CACX;AAED,iBAAS,OAAO,CAAC,EACf,KAAK,EACL,IAAI,GACL,EAAE,YAAY,2CASd;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,25 @@
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ /* eslint-disable react/jsx-props-no-spreading */
8
+ import React from 'react';
9
+ import { Input } from '@alifd/next';
10
+ import styles from "../../styles/index.module.scss";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ function Section(_ref) {
14
+ var field = _ref.field,
15
+ data = _ref.data;
16
+ return /*#__PURE__*/_jsxs("div", {
17
+ children: [/*#__PURE__*/_jsx(Input, _objectSpread({}, field.init(data.name[0], _objectSpread({}, data.options[0]), _objectSpread({}, data.customProps[0])))), /*#__PURE__*/_jsx("div", {
18
+ className: styles.sep,
19
+ children: "-"
20
+ }), /*#__PURE__*/_jsx(Input, _objectSpread({}, field.init(data.name[1], _objectSpread({}, data.options[1]), _objectSpread({}, data.customProps[1])))), data.unit && /*#__PURE__*/_jsx("div", {
21
+ children: data.unit
22
+ })]
23
+ });
24
+ }
25
+ export default Section;
@@ -0,0 +1,7 @@
1
+ interface SelectSearchProps {
2
+ field: any;
3
+ data: any;
4
+ }
5
+ declare function SelectSearch({ field, data, }: SelectSearchProps): import("react/jsx-runtime").JSX.Element;
6
+ export default SelectSearch;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SelectSearch/index.tsx"],"names":[],"mappings":"AAKA,UAAU,iBAAiB;IACzB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,GAAG,CAAC;CACX;AAED,iBAAS,YAAY,CAAC,EACpB,KAAK,EAAE,IAAI,GACZ,EAAE,iBAAiB,2CAgBnB;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,34 @@
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ /* eslint-disable react/jsx-props-no-spreading */
8
+ import React from 'react';
9
+ import { Select } from '@alifd/next';
10
+ import { useRequest } from 'ahooks';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ function SelectSearch(_ref) {
13
+ var field = _ref.field,
14
+ data = _ref.data;
15
+ var _useRequest = useRequest(function () {
16
+ var v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
17
+ return data === null || data === void 0 ? void 0 : data.request(v);
18
+ }, {
19
+ manual: true,
20
+ debounceWait: 500
21
+ }),
22
+ dataSource = _useRequest.data,
23
+ getData = _useRequest.run;
24
+ return /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({}, field.init(data.name, _objectSpread({}, data.options), _objectSpread({}, data.customProps))), {}, {
25
+ showSearch: true,
26
+ onSearch: getData,
27
+ onVisibleChange: function onVisibleChange(v) {
28
+ return v && getData();
29
+ },
30
+ dataSource: dataSource,
31
+ filterLocal: false
32
+ }));
33
+ }
34
+ export default SelectSearch;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ interface SettingDialogProps {
3
+ onChange: (id: string) => void;
4
+ id: string;
5
+ dataSource: any[];
6
+ container?: HTMLElement | null;
7
+ hiddenKeys: string[];
8
+ onSave: (params: any) => Promise<any>;
9
+ }
10
+ declare const _default: React.ForwardRefExoticComponent<SettingDialogProps & React.RefAttributes<any>>;
11
+ export default _default;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SettingDialog/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAKpF,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,GAAG,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACvC;;AAsFD,wBAAyC"}
@@ -0,0 +1,122 @@
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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); }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ /* eslint-disable react/jsx-props-no-spreading */
14
+ import { Box, Button, Checkbox, Dialog, Field, Form, Message } from '@alifd/next';
15
+ import React, { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
16
+ import { useRequest, useToggle } from 'ahooks';
17
+ import styles from "./index.module.scss";
18
+ import { useConfig } from "../../context";
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ function SettingDialog(props, ref) {
22
+ var _props$container;
23
+ var field = Field.useField();
24
+ var _useToggle = useToggle(false),
25
+ _useToggle2 = _slicedToArray(_useToggle, 2),
26
+ visible = _useToggle2[0],
27
+ toggle = _useToggle2[1].toggle;
28
+ var _useState = useState([]),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ dataSource = _useState2[0],
31
+ setDataSource = _useState2[1];
32
+ var _useConfig = useConfig(),
33
+ getTableName = _useConfig.getTableName;
34
+ var _useRequest = useRequest(props.onSave, {
35
+ manual: true,
36
+ onSuccess: function onSuccess() {
37
+ Message.success('保存成功');
38
+ props.onChange(props.id);
39
+ toggle();
40
+ }
41
+ }),
42
+ run = _useRequest.run;
43
+ var init = function init() {
44
+ var list = dataSource.filter(function (f) {
45
+ return !props.hiddenKeys.includes(f.value);
46
+ });
47
+ field.setValue('value', list.map(function (e) {
48
+ return e.value;
49
+ }));
50
+ field.setValue('tableId', props.id);
51
+ };
52
+ useEffect(function () {
53
+ var _props$dataSource$map, _props$dataSource;
54
+ setDataSource((_props$dataSource$map = (_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.map(function (e) {
55
+ return {
56
+ label: e.title,
57
+ value: e.dataIndex
58
+ };
59
+ })) !== null && _props$dataSource$map !== void 0 ? _props$dataSource$map : []);
60
+ }, [props.dataSource]);
61
+ useImperativeHandle(ref, function () {
62
+ return {
63
+ show: function show() {
64
+ toggle();
65
+ init();
66
+ }
67
+ };
68
+ });
69
+ return /*#__PURE__*/_jsx(Dialog, {
70
+ title: "\u5B9A\u5236\u5217",
71
+ visible: visible,
72
+ onClose: function onClose() {
73
+ toggle();
74
+ },
75
+ className: styles.carDilog,
76
+ footer: false,
77
+ popupContainer: (_props$container = props.container) !== null && _props$container !== void 0 ? _props$container : undefined,
78
+ v2: true,
79
+ centered: true,
80
+ width: 800,
81
+ children: /*#__PURE__*/_jsxs(Form, {
82
+ field: field,
83
+ inline: true,
84
+ className: styles.filterForm,
85
+ children: [/*#__PURE__*/_jsx(Form.Item, {
86
+ children: /*#__PURE__*/_jsx(Checkbox.Group, _objectSpread({
87
+ dataSource: dataSource
88
+ }, field.init('value', {})))
89
+ }), /*#__PURE__*/_jsxs(Box, {
90
+ direction: "row",
91
+ spacing: 8,
92
+ justify: "flex-end",
93
+ children: [/*#__PURE__*/_jsx(Button, {
94
+ onClick: function onClick() {
95
+ toggle();
96
+ },
97
+ children: "\u53D6\u6D88"
98
+ }), /*#__PURE__*/_jsx(Button, {
99
+ type: "primary",
100
+ onClick: function onClick() {
101
+ field.validate(function (err, val) {
102
+ var list = dataSource.filter(function (f) {
103
+ return !val.value.includes(f.value);
104
+ });
105
+ val.value = list.map(function (e) {
106
+ return e.value;
107
+ }).join(',');
108
+ val.name = list.map(function (e) {
109
+ return e.label;
110
+ }).join(',');
111
+ run(_objectSpread(_objectSpread({}, val), {}, {
112
+ tableName: getTableName === null || getTableName === void 0 ? void 0 : getTableName()
113
+ }));
114
+ });
115
+ },
116
+ children: "\u786E\u5B9A"
117
+ })]
118
+ })]
119
+ })
120
+ });
121
+ }
122
+ export default /*#__PURE__*/forwardRef(SettingDialog);
@@ -0,0 +1,67 @@
1
+ .carDilog {
2
+
3
+ // width: 400px;
4
+ :global {
5
+ .next-form-item .next-checkbox-wrapper {
6
+ width: 110px;
7
+ margin-left: 0;
8
+ }
9
+ }
10
+
11
+ .title {
12
+ padding-bottom: 12px;
13
+ height: 32px;
14
+ font-size: 16px;
15
+ font-weight: 400;
16
+ color: #2A2F33;
17
+ line-height: 20px;
18
+ display: flex;
19
+ box-sizing: border-box;
20
+
21
+ img {
22
+ width: 20px;
23
+ height: 20px;
24
+ margin-right: 8px;
25
+ }
26
+ }
27
+
28
+ .filterForm {
29
+
30
+ :global {
31
+ .next-form-item {
32
+ margin-right: 0px !important;
33
+ display: flex !important;
34
+ }
35
+
36
+ .next-checkbox-group {
37
+ width: 100%;
38
+
39
+ .next-checkbox-wrapper {
40
+ width: auto;
41
+ &:nth-child(4n) {
42
+ margin-right: 0 !important;
43
+ }
44
+ }
45
+ }
46
+ }
47
+
48
+ .fullFormItem {
49
+ width: 100%;
50
+
51
+ :global {
52
+ .next-form-item-label {
53
+ flex-shrink: 0;
54
+ }
55
+
56
+ .next-form-item-control {
57
+ // width: 100%;
58
+ flex: 1;
59
+ }
60
+
61
+ .next-select {
62
+ width: 100%;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }