@pisell/materials 1.0.453 → 1.0.455

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 (79) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +15 -15
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +20 -20
  11. package/es/components/button/index.js +0 -2
  12. package/es/components/buttonGroupEdit/index.js +0 -2
  13. package/es/components/buttonGroupPreview/index.js +1 -4
  14. package/es/components/dataSourceComponents/dataSourceForm/formItem.js +11 -1
  15. package/es/components/dataSourceComponents/dataSourceForm/provider/hooks/useJsonPrefixPath.d.ts +2 -0
  16. package/es/components/dataSourceComponents/dataSourceForm/provider/hooks/useJsonPrefixPath.js +7 -0
  17. package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperContext.d.ts +3 -0
  18. package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperContext.js +3 -0
  19. package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.d.ts +7 -0
  20. package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +25 -0
  21. package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
  22. package/es/components/dataSourceComponents/dataSourceForm/utils.js +20 -4
  23. package/es/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.js +14 -1
  24. package/es/components/dataSourceComponents/dataSourceTable/index.js +8 -7
  25. package/es/components/pisellQrcode/index.js +1 -3
  26. package/es/components/pisellStatistic/index.d.ts +2 -2
  27. package/es/components/pisellStatistic/index.js +3 -3
  28. package/es/components/productCard/index.js +3 -0
  29. package/es/components/productCard/utils.js +1 -0
  30. package/es/components/record-view/index.d.ts +1 -0
  31. package/es/components/record-view/index.js +37 -4
  32. package/es/components/record-view/index.less +19 -2
  33. package/es/components/tabs/index.js +0 -2
  34. package/es/index.d.ts +1 -0
  35. package/es/index.js +1 -0
  36. package/es/locales/en-US.d.ts +4 -0
  37. package/es/locales/en-US.js +6 -1
  38. package/es/locales/zh-CN.d.ts +4 -0
  39. package/es/locales/zh-CN.js +5 -1
  40. package/es/locales/zh-TW.d.ts +4 -0
  41. package/es/locales/zh-TW.js +6 -1
  42. package/lib/components/button/index.js +0 -2
  43. package/lib/components/buttonGroupEdit/index.js +246 -156
  44. package/lib/components/buttonGroupPreview/index.js +31 -15
  45. package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +5 -1
  46. package/lib/components/dataSourceComponents/dataSourceForm/provider/hooks/useJsonPrefixPath.d.ts +2 -0
  47. package/lib/components/dataSourceComponents/dataSourceForm/provider/hooks/useJsonPrefixPath.js +41 -0
  48. package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperContext.d.ts +3 -0
  49. package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperContext.js +27 -0
  50. package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.d.ts +7 -0
  51. package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +48 -0
  52. package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
  53. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +16 -2
  54. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.js +13 -1
  55. package/lib/components/dataSourceComponents/dataSourceTable/index.js +8 -7
  56. package/lib/components/pisellQrcode/index.js +0 -5
  57. package/lib/components/pisellStatistic/index.d.ts +2 -2
  58. package/lib/components/pisellStatistic/index.js +3 -3
  59. package/lib/components/productCard/index.js +3 -0
  60. package/lib/components/productCard/utils.js +1 -0
  61. package/lib/components/record-view/index.d.ts +1 -0
  62. package/lib/components/record-view/index.js +23 -1
  63. package/lib/components/record-view/index.less +19 -2
  64. package/lib/components/tabs/index.js +0 -2
  65. package/lib/index.d.ts +1 -0
  66. package/lib/index.js +3 -0
  67. package/lib/locales/en-US.d.ts +4 -0
  68. package/lib/locales/en-US.js +6 -1
  69. package/lib/locales/zh-CN.d.ts +4 -0
  70. package/lib/locales/zh-CN.js +5 -1
  71. package/lib/locales/zh-TW.d.ts +4 -0
  72. package/lib/locales/zh-TW.js +6 -1
  73. package/lowcode/data-source-form/constants.ts +4 -1
  74. package/lowcode/data-source-form/utils.ts +27 -15
  75. package/lowcode/form-item-input.text-area/meta.ts +2 -2
  76. package/lowcode/json-wrapper/meta.ts +65 -0
  77. package/lowcode/json-wrapper/snippets.ts +16 -0
  78. package/lowcode/record-view/meta.ts +8 -0
  79. package/package.json +1 -1
@@ -3,13 +3,11 @@ import React, { forwardRef, useMemo } from 'react';
3
3
  import { Button as OriginalButton } from 'antd';
4
4
  var Button = /*#__PURE__*/forwardRef(function (props, ref) {
5
5
  var _props$href;
6
- console.log('%c [ props ]-15', 'font-size:13px; background:#e991b5; color:#ffd5f9;', props);
7
6
  var innerProps = {};
8
7
  if (!((_props$href = props.href) !== null && _props$href !== void 0 && _props$href.trim()) || props.__designMode === 'design') {
9
8
  // 解决低代码编辑器中按钮设置 href 属性造成按钮点击重定向问题
10
9
  innerProps.href = undefined;
11
10
  }
12
- debugger;
13
11
  var _children = useMemo(function () {
14
12
  if (props.rightIcon) {
15
13
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
@@ -175,7 +175,6 @@ var ButtonGroupEdit = /*#__PURE__*/forwardRef(function (props, ref) {
175
175
 
176
176
  // 保存按钮修改
177
177
  var handleSave = function handleSave(values) {
178
- console.log('%c [ values ]-153', 'font-size:13px; background:#968084; color:#dac4c8;', values);
179
178
  if (!currentButton) return;
180
179
  var updatedButton = _objectSpread(_objectSpread({}, currentButton), {}, {
181
180
  children: values.children,
@@ -309,7 +308,6 @@ var ButtonGroupEdit = /*#__PURE__*/forwardRef(function (props, ref) {
309
308
  console.error('拖拽结束时出错:', error);
310
309
  }
311
310
  };
312
- console.log('%c [ currentButton ]-235', 'font-size:13px; background:#07d83a; color:#4bff7e;', currentButton);
313
311
  return /*#__PURE__*/React.createElement(Flex, {
314
312
  wrap: true,
315
313
  justify: "space-between",
@@ -9,14 +9,13 @@ import React, { forwardRef, memo, useMemo } from 'react';
9
9
  import { Button, Space, Dropdown, Flex } from 'antd';
10
10
  import { MoreOutlined } from '@ant-design/icons';
11
11
  /**
12
- *
12
+ *
13
13
  * @param param0 { buttonConfig, buttonGroupList }
14
14
  * @returns 整合按钮配置 返回最新的组件数据
15
15
  */
16
16
  var updateSourceData = function updateSourceData(_ref) {
17
17
  var buttonConfig = _ref.buttonConfig,
18
18
  buttonGroupList = _ref.buttonGroupList;
19
- console.log('%c [ 0 ]-43', 'font-size:13px; background:#26c778; color:#6affbc;', Object.keys(buttonConfig).length !== 0);
20
19
  if (Object.keys(buttonConfig).length !== 0) {
21
20
  return buttonGroupList.map(function (subArray) {
22
21
  return subArray.map(function (item) {
@@ -29,7 +28,6 @@ var updateSourceData = function updateSourceData(_ref) {
29
28
  });
30
29
  }
31
30
 
32
- console.log('%c [ buttonGroupList ]-54', 'font-size:13px; background:#721db9; color:#b661fd;', buttonGroupList);
33
31
  return buttonGroupList;
34
32
  };
35
33
  var ButtonGroupPreview = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -37,7 +35,6 @@ var ButtonGroupPreview = /*#__PURE__*/forwardRef(function (props, ref) {
37
35
  buttonConfig = _props$buttonConfig === void 0 ? {} : _props$buttonConfig,
38
36
  _props$buttonGroupLis = props.buttonGroupList,
39
37
  buttonGroupList = _props$buttonGroupLis === void 0 ? [] : _props$buttonGroupLis;
40
- console.log('%c [ props ]-57', 'font-size:13px; background:#305767; color:#749bab;', props);
41
38
  var sourceDatas = useMemo(function () {
42
39
  return updateSourceData({
43
40
  buttonConfig: buttonConfig,
@@ -1,5 +1,11 @@
1
1
  var _excluded = ["children", "name", "label", "mode"];
2
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); }
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
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."); }
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
+ 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; }
3
9
  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; }
4
10
  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; }
5
11
  import React, { cloneElement, isValidElement, useMemo } from 'react';
@@ -7,6 +13,8 @@ import { isArr } from '@pisell/utils';
7
13
  import useDataSource from "../hooks/useDataSource";
8
14
  import useFormSetting from "./provider/hooks/useFormSetting";
9
15
  import Form from "../../form";
16
+ import useJsonPrefixPath from "./provider/hooks/useJsonPrefixPath";
17
+ import { toArr } from "./utils";
10
18
  var FormItem = function FormItem(props) {
11
19
  var _field$uiSchema;
12
20
  var children = props.children,
@@ -14,6 +22,7 @@ var FormItem = function FormItem(props) {
14
22
  propsLabel = props.label,
15
23
  propsMode = props.mode,
16
24
  other = _objectWithoutProperties(props, _excluded);
25
+ var prefixPath = useJsonPrefixPath();
17
26
  var _useDataSource = useDataSource(),
18
27
  dataSource = _useDataSource.dataSource;
19
28
  var fields = dataSource === null || dataSource === void 0 ? void 0 : dataSource.fields;
@@ -38,8 +47,9 @@ var FormItem = function FormItem(props) {
38
47
  }
39
48
  return children;
40
49
  }, [children, effectiveMode]);
50
+ var concatName = name !== undefined ? [].concat(_toConsumableArray(prefixPath), _toConsumableArray(toArr(name))) : undefined;
41
51
  return /*#__PURE__*/React.createElement(Form.Item, _extends({
42
- name: name,
52
+ name: concatName,
43
53
  label: label
44
54
  }, other), renderChildren);
45
55
  };
@@ -0,0 +1,2 @@
1
+ declare const useJsonPrefixPath: () => (string | number)[];
2
+ export default useJsonPrefixPath;
@@ -0,0 +1,7 @@
1
+ import { useContext } from 'react';
2
+ import JsonWrapperContext from "../jsonWrapper/JsonWrapperContext";
3
+ var useJsonPrefixPath = function useJsonPrefixPath() {
4
+ var prefixPath = useContext(JsonWrapperContext);
5
+ return prefixPath;
6
+ };
7
+ export default useJsonPrefixPath;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const JsonWrapperContext: import("react").Context<(string | number)[]>;
3
+ export default JsonWrapperContext;
@@ -0,0 +1,3 @@
1
+ import { createContext } from 'react';
2
+ var JsonWrapperContext = /*#__PURE__*/createContext([]);
3
+ export default JsonWrapperContext;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface JsonWrapperProps {
3
+ prefix: string | number | (string | number)[];
4
+ name?: string;
5
+ }
6
+ declare const JsonWrapperProvider: React.FC<React.PropsWithChildren<JsonWrapperProps>>;
7
+ export default JsonWrapperProvider;
@@ -0,0 +1,25 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ 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."); }
3
+ 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); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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
+ import React, { useMemo, useContext } from 'react';
8
+ import FormItem from "../../formItem";
9
+ import { toArr } from "../../utils";
10
+ import JsonWrapperContext from "./JsonWrapperContext";
11
+ var JsonWrapperProvider = function JsonWrapperProvider(props) {
12
+ var children = props.children,
13
+ prefix = props.prefix,
14
+ label = props.label;
15
+ var prefixPath = useContext(JsonWrapperContext);
16
+ var concatPath = useMemo(function () {
17
+ return [].concat(_toConsumableArray(prefixPath), _toConsumableArray(toArr(prefix)));
18
+ }, [prefixPath, prefix]);
19
+ return /*#__PURE__*/React.createElement(JsonWrapperContext.Provider, {
20
+ value: concatPath
21
+ }, /*#__PURE__*/React.createElement(FormItem, {
22
+ label: label
23
+ }, children));
24
+ };
25
+ export default JsonWrapperProvider;
@@ -34,3 +34,4 @@ export declare const formItemNameReverse: (name: string) => string;
34
34
  export declare const withFormItem: <P extends object>(WrappedComponent: React.ComponentType<P>) => React.FC<P & WithFormItemProps>;
35
35
  export declare const getNestedValue: (obj: Record<string, any>, path: string) => Record<string, any>;
36
36
  export declare const renderValueWithMap: (value: any, valueMap?: Record<string, string>) => React.JSX.Element | null;
37
+ export declare function toArr(str: string | number | (string | number)[]): (string | number)[];
@@ -1,8 +1,12 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  var _excluded = ["renderMode", "value", "onChange"],
3
- _excluded2 = ["name", "label", "mode", "tooltip", "noStyle", "extra", "required", "requiredobj", "minLengthobj", "maxLengthobj", "typeobj", "maxobj", "minobj", "style", "__designMode"];
3
+ _excluded2 = ["name", "label", "mode", "tooltip", "noStyle", "extra", "required", "requiredobj", "minLengthobj", "maxLengthobj", "typeobj", "maxobj", "minobj", "normalize", "getValueProps", "validator", "style", "__designMode"];
4
4
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
5
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
+ 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."); }
5
7
  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); }
8
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
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; }
7
11
  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); }
8
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -18,6 +22,7 @@ import { Tag } from 'antd';
18
22
  import Form from "../../form";
19
23
  import useDataSource from "../hooks/useDataSource";
20
24
  import useFormSetting from "./provider/hooks/useFormSetting";
25
+ import useJsonPrefixPath from "./provider/hooks/useJsonPrefixPath";
21
26
  /**
22
27
  * @title: 增加renderMode属性
23
28
  * @description: 基于renderMode属性控制渲染模式
@@ -87,9 +92,13 @@ export var withFormItem = function withFormItem(WrappedComponent) {
87
92
  typeobj = _ref2.typeobj,
88
93
  maxobj = _ref2.maxobj,
89
94
  minobj = _ref2.minobj,
95
+ normalize = _ref2.normalize,
96
+ getValueProps = _ref2.getValueProps,
97
+ validator = _ref2.validator,
90
98
  style = _ref2.style,
91
99
  __designMode = _ref2.__designMode,
92
100
  otherProps = _objectWithoutProperties(_ref2, _excluded2);
101
+ var prefixPath = useJsonPrefixPath();
93
102
  var _useDataSource = useDataSource(),
94
103
  dataSource = _useDataSource.dataSource;
95
104
  var _ref3 = dataSource || {},
@@ -116,6 +125,7 @@ export var withFormItem = function withFormItem(WrappedComponent) {
116
125
 
117
126
  // 如果name是字符串,并且包含.,则将name转换为数组 否则提交时会转换为对象
118
127
  var name = isString(propsName) && propsName.includes('.') ? [propsName] : propsName;
128
+ var concatName = name !== undefined ? [].concat(_toConsumableArray(prefixPath), _toConsumableArray(toArr(name))) : undefined;
119
129
  var rules = [];
120
130
  if (requiredobj && requiredobj.required) {
121
131
  rules.push(requiredobj);
@@ -142,13 +152,16 @@ export var withFormItem = function withFormItem(WrappedComponent) {
142
152
  }, style), {}, {
143
153
  opacity: isDesignMode && isHidden ? '0.3' : 1
144
154
  }),
145
- name: name,
155
+ name: concatName,
146
156
  label: label,
147
157
  tooltip: tooltip,
148
158
  noStyle: noStyle,
149
159
  extra: extra,
150
160
  hidden: isHidden && !isDesignMode,
151
- rules: rules
161
+ rules: rules,
162
+ normalize: normalize,
163
+ getValueProps: getValueProps,
164
+ validator: validator
152
165
  }, renderComponent);
153
166
  };
154
167
  };
@@ -185,4 +198,7 @@ export var renderValueWithMap = function renderValueWithMap(value, valueMap) {
185
198
  return /*#__PURE__*/React.createElement(Tag, null, (valueMap === null || valueMap === void 0 ? void 0 : valueMap[value]) || value);
186
199
  }
187
200
  return null;
188
- };
201
+ };
202
+ export function toArr(str) {
203
+ return Array.isArray(str) ? str : [str];
204
+ }
@@ -8,7 +8,8 @@ var useDesignMode = function useDesignMode(props, _ref) {
8
8
  data = _ref.data;
9
9
  var __designMode = props.__designMode,
10
10
  showDetailButton = props.showDetailButton,
11
- showEditButton = props.showEditButton;
11
+ showEditButton = props.showEditButton,
12
+ showAddButton = props.showAddButton;
12
13
  useEffect(function () {
13
14
  if (__designMode === 'design') {
14
15
  if (showDetailButton) {
@@ -35,5 +36,17 @@ var useDesignMode = function useDesignMode(props, _ref) {
35
36
  }
36
37
  }
37
38
  }, [showEditButton, __designMode]);
39
+ useEffect(function () {
40
+ if (__designMode === 'design') {
41
+ if (showAddButton) {
42
+ openDrawer('add');
43
+ registerVariable === null || registerVariable === void 0 ? void 0 : registerVariable({
44
+ currentRecord: null
45
+ });
46
+ } else {
47
+ closeDrawer();
48
+ }
49
+ }
50
+ }, [showAddButton, __designMode]);
38
51
  };
39
52
  export default useDesignMode;
@@ -21,10 +21,11 @@ import useDrawerState from "./hooks/useDrawerState";
21
21
  import useDesignMode from "./hooks/useDesignMode";
22
22
  import useTableQuery from "./hooks/useTableQuery";
23
23
  import useSetRequest from "../../../hooks/useSetRequest";
24
+ import { getText } from "../../../locales";
24
25
  var DRAWER_TITLES = {
25
- detail: '详情',
26
- edit: '编辑',
27
- add: '添加'
26
+ detail: getText('pisell-data-source-table-detail'),
27
+ edit: getText('pisell-data-source-table-edit'),
28
+ add: getText('pisell-data-source-table-add')
28
29
  };
29
30
  var DataSourceTable = function DataSourceTable(props) {
30
31
  var propsColumns = props.columns,
@@ -143,18 +144,18 @@ var DataSourceTable = function DataSourceTable(props) {
143
144
  return handleOpenDrawer(record, 'detail');
144
145
  },
145
146
  type: "link"
146
- }, "\u8BE6\u60C5"), showEditButton && /*#__PURE__*/React.createElement(Button, {
147
+ }, getText('pisell-data-source-table-detail')), showEditButton && /*#__PURE__*/React.createElement(Button, {
147
148
  onClick: function onClick() {
148
149
  return handleOpenDrawer(record, 'edit');
149
150
  },
150
151
  type: "link"
151
- }, "\u7F16\u8F91"), showDeleteButton && /*#__PURE__*/React.createElement(Button, {
152
+ }, getText('pisell-data-source-table-edit')), showDeleteButton && /*#__PURE__*/React.createElement(Button, {
152
153
  onClick: function onClick() {
153
154
  return handleDelete(record);
154
155
  },
155
156
  type: "link",
156
157
  danger: true
157
- }, "\u5220\u9664"));
158
+ }, getText('pisell-data-source-table-delete')));
158
159
  }
159
160
  }];
160
161
  }, [showDetailButton, showEditButton, showDeleteButton]);
@@ -188,7 +189,7 @@ var DataSourceTable = function DataSourceTable(props) {
188
189
  onClick: function onClick() {
189
190
  return handleOpenDrawer(null, 'add');
190
191
  }
191
- }, "\u6DFB\u52A0")), /*#__PURE__*/React.createElement(Table, _extends({}, others, {
192
+ }, getText('pisell-data-source-table-add'))), /*#__PURE__*/React.createElement(Table, _extends({}, others, {
192
193
  columns: columns,
193
194
  dataSource: (data === null || data === void 0 ? void 0 : data.data) || [],
194
195
  loading: loading,
@@ -32,9 +32,7 @@ var PisellQrcode = function PisellQrcode(props) {
32
32
  }, []);
33
33
  var modalRef = useRef(null);
34
34
  useEffect(function () {
35
- if (open) {
36
- console.log('%c [ modalRef ]-22', 'font-size:13px; background:pink; color:#bf2c9f;', modalRef);
37
- }
35
+ if (open) {}
38
36
  }, [open]);
39
37
  var modalProps = {
40
38
  title: 'QR code',
@@ -6,5 +6,5 @@ interface PisellStatisticProps {
6
6
  hint?: React.ReactNode;
7
7
  tags?: React.ReactNode;
8
8
  }
9
- declare const pisellStatistic: (props: PisellStatisticProps) => import("react").JSX.Element;
10
- export default pisellStatistic;
9
+ declare const PisellStatistic: (props: PisellStatisticProps) => import("react").JSX.Element;
10
+ export default PisellStatistic;
@@ -2,12 +2,12 @@ import { useEffect } from 'react';
2
2
  import { Statistic } from 'antd';
3
3
  import classNames from 'classnames';
4
4
  import "./index.less";
5
- var pisellStatistic = function pisellStatistic(props) {
5
+ var PisellStatistic = function PisellStatistic(props) {
6
6
  useEffect(function () {
7
7
  document.body.id = 'body';
8
8
  }, []);
9
9
  var _props$title = props.title,
10
- title = _props$title === void 0 ? '123123' : _props$title,
10
+ title = _props$title === void 0 ? '' : _props$title,
11
11
  number = props.number,
12
12
  hint = props.hint,
13
13
  tags = props.tags;
@@ -22,4 +22,4 @@ var pisellStatistic = function pisellStatistic(props) {
22
22
  value: number
23
23
  }));
24
24
  };
25
- export default pisellStatistic;
25
+ export default PisellStatistic;
@@ -7,6 +7,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
7
7
  import React, { useMemo, useRef } from 'react';
8
8
  import classNames from 'classnames';
9
9
  import { Alert } from 'antd';
10
+ import { locales } from '@pisell/utils';
10
11
  import CardPro from "../cardPro";
11
12
  import Header from "./components/Header";
12
13
  import Time from "./components/Time";
@@ -16,7 +17,9 @@ import AmountFooter from "./components/AmountFooter";
16
17
  import Note from "./components/Note";
17
18
  import Action from "./components/Action";
18
19
  import UseOpenNote from "./hooks/useOpenNote";
20
+ import localeTexts from "./locales";
19
21
  import "./index.less";
22
+ locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
20
23
  var ProductCard = function ProductCard(props) {
21
24
  var _dataSource$_extend, _dataSource$_extend$d, _classNames;
22
25
  var dataSource = props.dataSource,
@@ -149,6 +149,7 @@ export var getServiceTime = function getServiceTime(item, currentDate) {
149
149
  if (!currentDate || !(item !== null && item !== void 0 && (_item$_extend = item._extend) !== null && _item$_extend !== void 0 && _item$_extend.start_time) || !dayjs(currentDate).isValid()) return '';
150
150
  var locale = (item === null || item === void 0 ? void 0 : item.locale) || 'en-US';
151
151
  var isEn = locale === 'en-US' || locale === 'en';
152
+ dayjs.locale(locale);
152
153
  var startDate = dayjs((currentDate === null || currentDate === void 0 ? void 0 : currentDate.format('YYYY-MM-DD')) + ' ' + getServeStartTime(item === null || item === void 0 ? void 0 : (_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.start_time));
153
154
  var startTime = startDate.format('HH:mm');
154
155
 
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import './index.less';
3
3
  export interface RecordViewProps {
4
4
  dataSource: any[];
5
+ doubleList: boolean;
5
6
  header?: React.ReactNode;
6
7
  footer?: React.ReactNode;
7
8
  renderItem?: (item: any) => React.ReactNode;
@@ -1,4 +1,4 @@
1
- var _excluded = ["detail", "leftSpan", "rightSpan", "gutter", "style", "pagination", "header", "footer", "renderItem", "onRowClick", "paginationType", "listGap", "loadMoreData", "listHeight", "pcDetailModalDisplay", "padDetailModalDisplay", "mobilePadDetailModalDisplay", "children", "locale", "emptyButtons"];
1
+ var _excluded = ["detail", "leftSpan", "rightSpan", "gutter", "style", "pagination", "header", "footer", "renderItem", "onRowClick", "paginationType", "listGap", "loadMoreData", "listHeight", "pcDetailModalDisplay", "padDetailModalDisplay", "mobilePadDetailModalDisplay", "children", "locale", "emptyButtons", "doubleList"];
2
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); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
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."); }
@@ -8,8 +8,8 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
8
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
9
  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; }
10
10
  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; }
11
- import React, { useCallback, useMemo, useState } from 'react';
12
- import { Button, Col, Empty, List, Row, Skeleton, Space } from 'antd';
11
+ import React, { useCallback, useMemo, useState, useEffect } from 'react';
12
+ import { Button, Col, Empty, List, Row, Skeleton, Space, Tag } from 'antd';
13
13
  import { getUniqueId } from '@pisell/utils';
14
14
  import Pagination from "../Pagination";
15
15
  import { CloseOutlined } from '@ant-design/icons';
@@ -39,7 +39,12 @@ var RecordView = function RecordView(props) {
39
39
  locale = props.locale,
40
40
  _props$emptyButtons = props.emptyButtons,
41
41
  emptyButtons = _props$emptyButtons === void 0 ? [] : _props$emptyButtons,
42
+ _props$doubleList = props.doubleList,
43
+ doubleList = _props$doubleList === void 0 ? false : _props$doubleList,
42
44
  others = _objectWithoutProperties(props, _excluded);
45
+ useEffect(function () {
46
+ document.body.id = 'body';
47
+ }, []);
43
48
  var responsive = useResponsive();
44
49
  var _useState = useState(false),
45
50
  _useState2 = _slicedToArray(_useState, 2),
@@ -127,7 +132,35 @@ var RecordView = function RecordView(props) {
127
132
  className: "".concat(prefix, "scroll-footer-wrap")
128
133
  }, _footer));
129
134
  }
130
- return /*#__PURE__*/React.createElement(List, _extends({}, others, {
135
+ return doubleList ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Space, {
136
+ size: 12,
137
+ align: "center",
138
+ style: {
139
+ marginBottom: 16
140
+ }
141
+ }, /*#__PURE__*/React.createElement("p", {
142
+ className: "".concat(prefix, "list-title")
143
+ }, "\u53EF\u7528"), /*#__PURE__*/React.createElement(Tag, {
144
+ className: "".concat(prefix, "list-tag")
145
+ }, 1)), /*#__PURE__*/React.createElement(List, _extends({}, others, {
146
+ renderItem: _renderItem,
147
+ header: header,
148
+ footer: _footer
149
+ }), emptyDom), /*#__PURE__*/React.createElement(Space, {
150
+ size: 12,
151
+ align: "center",
152
+ style: {
153
+ marginBottom: 16
154
+ }
155
+ }, /*#__PURE__*/React.createElement("p", {
156
+ className: "".concat(prefix, "detail-list-title")
157
+ }, "\u4E0D\u53EF\u7528"), /*#__PURE__*/React.createElement(Tag, {
158
+ className: "".concat(prefix, "detail-list-tag")
159
+ }, 2)), /*#__PURE__*/React.createElement(List, _extends({}, others, {
160
+ renderItem: _renderItem,
161
+ header: header,
162
+ footer: _footer
163
+ }), emptyDom)) : /*#__PURE__*/React.createElement(List, _extends({}, others, {
131
164
  renderItem: _renderItem,
132
165
  header: header,
133
166
  footer: _footer
@@ -1,7 +1,5 @@
1
1
  @pisell-prefix: pisell-lowcode;
2
2
 
3
-
4
-
5
3
  .@{pisell-prefix} {
6
4
  &-record-view {
7
5
  .pisell-lowcode-pagination {
@@ -12,6 +10,25 @@
12
10
  border: none;
13
11
  }
14
12
  }
13
+
14
+ &-list-title {
15
+ color: #000;
16
+
17
+ /* Text md/Semibold */
18
+ font-family: Inter;
19
+ font-size: 16px;
20
+ font-style: normal;
21
+ font-weight: 600;
22
+ line-height: 24px; /* 150% */
23
+ margin: 0;
24
+ }
25
+ &-list-tag {
26
+ border-radius: 16px;
27
+ border: 1px solid var(--Gray-200, #eaecf0);
28
+ background: var(--Gray-50, #f9fafb);
29
+ mix-blend-mode: multiply;
30
+ }
31
+
15
32
  &-empty-button {
16
33
  display: flex;
17
34
  justify-content: center;
@@ -54,8 +54,6 @@ var Tabs = /*#__PURE__*/function (_Component) {
54
54
  });
55
55
  _defineProperty(_assertThisInitialized(_this), "renderIconLabelTabBar", function (props, DefaultTabBar) {
56
56
  var _this$props2;
57
- console.log('%c [ props ]-31', 'font-size:13px; background:#4d3662; color:#917aa6;', props);
58
- debugger;
59
57
  var _this$props = _this.props,
60
58
  items = _this$props.items,
61
59
  sidebarWidth = _this$props.sidebarWidth;
package/es/index.d.ts CHANGED
@@ -126,6 +126,7 @@ export { ColorPicker } from 'antd';
126
126
  export { default as DataSourceForm } from './components/dataSourceComponents/dataSourceForm';
127
127
  export { default as FormGroup } from './components/dataSourceComponents/dataSourceForm/group';
128
128
  export { default as SubmitButton } from './components/dataSourceComponents/dataSourceForm/submitButton';
129
+ export { default as JsonWrapper } from './components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider';
129
130
  export { default as FormItemCheckbox } from './components/dataSourceComponents/fields/Checkbox';
130
131
  export { default as FormItemColorPicker } from './components/dataSourceComponents/fields/ColorPicker';
131
132
  export { default as FormItemDatePicker } from './components/dataSourceComponents/fields/DatePicker';
package/es/index.js CHANGED
@@ -153,6 +153,7 @@ export { ColorPicker } from 'antd';
153
153
  export { default as DataSourceForm } from "./components/dataSourceComponents/dataSourceForm";
154
154
  export { default as FormGroup } from "./components/dataSourceComponents/dataSourceForm/group";
155
155
  export { default as SubmitButton } from "./components/dataSourceComponents/dataSourceForm/submitButton";
156
+ export { default as JsonWrapper } from "./components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider";
156
157
  export { default as FormItemCheckbox } from "./components/dataSourceComponents/fields/Checkbox";
157
158
  export { default as FormItemColorPicker } from "./components/dataSourceComponents/fields/ColorPicker";
158
159
  export { default as FormItemDatePicker } from "./components/dataSourceComponents/fields/DatePicker";
@@ -126,5 +126,9 @@ declare const _default: {
126
126
  'pisell-adjust-price-discount-can-be-maximum': string;
127
127
  'pisell-discount-card-title': string;
128
128
  'pisell-discount-card-unit': string;
129
+ 'pisell-data-source-table-add': string;
130
+ 'pisell-data-source-table-edit': string;
131
+ 'pisell-data-source-table-detail': string;
132
+ 'pisell-data-source-table-delete': string;
129
133
  };
130
134
  export default _default;
@@ -152,5 +152,10 @@ export default {
152
152
  'pisell-adjust-price-total-after-discount': "Total after discount: ",
153
153
  'pisell-adjust-price-discount-can-be-maximum': "Discount can be maximum",
154
154
  'pisell-discount-card-title': 'Discount',
155
- 'pisell-discount-card-unit': 'off'
155
+ 'pisell-discount-card-unit': 'off',
156
+ // 数据源表格
157
+ 'pisell-data-source-table-add': 'Add',
158
+ 'pisell-data-source-table-edit': 'Edit',
159
+ 'pisell-data-source-table-detail': 'Detail',
160
+ 'pisell-data-source-table-delete': 'Delete'
156
161
  };
@@ -126,5 +126,9 @@ declare const _default: {
126
126
  'pisell-adjust-price-discount-can-be-maximum': string;
127
127
  'pisell-discount-card-title': string;
128
128
  'pisell-discount-card-unit': string;
129
+ 'pisell-data-source-table-add': string;
130
+ 'pisell-data-source-table-edit': string;
131
+ 'pisell-data-source-table-detail': string;
132
+ 'pisell-data-source-table-delete': string;
129
133
  };
130
134
  export default _default;
@@ -152,5 +152,9 @@ export default {
152
152
  'pisell-adjust-price-total-after-discount': "打折后总价",
153
153
  'pisell-adjust-price-discount-can-be-maximum': "折扣最高可达",
154
154
  'pisell-discount-card-title': '折扣',
155
- 'pisell-discount-card-unit': '折扣'
155
+ 'pisell-discount-card-unit': '折扣',
156
+ 'pisell-data-source-table-add': '添加',
157
+ 'pisell-data-source-table-edit': '编辑',
158
+ 'pisell-data-source-table-detail': '详情',
159
+ 'pisell-data-source-table-delete': '删除'
156
160
  };
@@ -126,5 +126,9 @@ declare const _default: {
126
126
  'pisell-adjust-price-discount-can-be-maximum': string;
127
127
  'pisell-discount-card-title': string;
128
128
  'pisell-discount-card-unit': string;
129
+ 'pisell-data-source-table-add': string;
130
+ 'pisell-data-source-table-edit': string;
131
+ 'pisell-data-source-table-detail': string;
132
+ 'pisell-data-source-table-delete': string;
129
133
  };
130
134
  export default _default;
@@ -152,5 +152,10 @@ export default {
152
152
  'pisell-adjust-price-total-after-discount': "打折后總價",
153
153
  'pisell-adjust-price-discount-can-be-maximum': "折扣最高可達",
154
154
  'pisell-discount-card-title': '折扣',
155
- 'pisell-discount-card-unit': '折扣'
155
+ 'pisell-discount-card-unit': '折扣',
156
+ // 数据源表格
157
+ 'pisell-data-source-table-add': '添加',
158
+ 'pisell-data-source-table-edit': '編輯',
159
+ 'pisell-data-source-table-detail': '詳情',
160
+ 'pisell-data-source-table-delete': '刪除'
156
161
  };
@@ -36,12 +36,10 @@ var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
37
  var Button = (0, import_react.forwardRef)((props, ref) => {
38
38
  var _a;
39
- console.log("%c [ props ]-15", "font-size:13px; background:#e991b5; color:#ffd5f9;", props);
40
39
  const innerProps = {};
41
40
  if (!((_a = props.href) == null ? void 0 : _a.trim()) || props.__designMode === "design") {
42
41
  innerProps.href = void 0;
43
42
  }
44
- debugger;
45
43
  const _children = (0, import_react.useMemo)(() => {
46
44
  if (props.rightIcon) {
47
45
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { style: { marginRight: 8 } }, " ", props.children), props.rightIcon);