shineout 3.8.0-beta.32 → 3.8.0-beta.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.8.0-beta.32'
525
+ version: '3.8.0-beta.34'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12386,7 +12386,7 @@ var handleStyle = function handleStyle(style) {
12386
12386
  };
12387
12387
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12388
12388
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12389
- /* harmony default export */ var version = ('3.8.0-beta.32');
12389
+ /* harmony default export */ var version = ('3.8.0-beta.34');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -35999,11 +35999,19 @@ var useCheck = function useCheck(props) {
35999
35999
  var handleInputRef = use_fork_ref(inputRef, inputRefPo);
36000
36000
  var handleClick = function handleClick(otherHandlers, needStopPropagation) {
36001
36001
  return function (event) {
36002
- var _inputRef$current, _otherHandlers$onClic;
36002
+ var _otherHandlers$onClic;
36003
36003
  if (needStopPropagation) {
36004
36004
  event.stopPropagation();
36005
36005
  }
36006
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.click();
36006
+
36007
+ // 检查是否被 label 元素包裹,如果是则不需要手动触发 input.click()
36008
+ // 因为 label 会自动将点击事件传递给内部的 input 元素
36009
+ var target = event.currentTarget;
36010
+ var isInsideLabel = target.closest('label') !== null;
36011
+ if (!isInsideLabel) {
36012
+ var _inputRef$current;
36013
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.click();
36014
+ }
36007
36015
  otherHandlers === null || otherHandlers === void 0 || (_otherHandlers$onClic = otherHandlers.onClick) === null || _otherHandlers$onClic === void 0 || _otherHandlers$onClic.call(otherHandlers, event);
36008
36016
  };
36009
36017
  };
@@ -51052,6 +51060,7 @@ var SchemaBuilder = /*#__PURE__*/function () {
51052
51060
  var itemType;
51053
51061
  if (typeof componentElement.type === 'function') {
51054
51062
  var componentName = componentElement.type.displayName || componentElement.type.name;
51063
+ var format = componentElement.props.format || componentElement.props.keygen;
51055
51064
  switch (componentName) {
51056
51065
  case 'ShineoutInput':
51057
51066
  case 'ShineoutEditableArea':
@@ -51066,10 +51075,10 @@ var SchemaBuilder = /*#__PURE__*/function () {
51066
51075
  case 'ShineoutTextarea':
51067
51076
  fieldSchemaInfo.type = 'string';
51068
51077
  break;
51078
+ case 'ShineoutCascader':
51069
51079
  case 'ShineoutSelect':
51070
51080
  case 'ShineoutTreeSelect':
51071
51081
  {
51072
- var format = componentElement.props.format || componentElement.props.keygen;
51073
51082
  if (typeof componentElement.props.keygen !== 'boolean') {
51074
51083
  if (typeof format === 'string') {
51075
51084
  var _data$;
@@ -51090,31 +51099,28 @@ var SchemaBuilder = /*#__PURE__*/function () {
51090
51099
  } else {
51091
51100
  fieldSchemaInfo.type = itemType;
51092
51101
  }
51093
- // props.data格式: [
51094
- // { "value": 1, "title": "年假" },
51095
- // { "value": 2, "title": "调休" },
51096
- // { "value": 3, "title": "事假" },
51097
- // { "value": 4, "title": "病假" },
51098
- // { "value": 5, "title": "其他" }
51099
- // ]
51100
- // 转换为jsonschema中的enum格式:
51101
- // "enum": {
51102
- // "anyOf": [
51103
- // { "const": 1, "title": "年假" },
51104
- // { "const": 2, "title": "调休" },
51105
- // { "const": 3, "title": "事假" },
51106
- // { "const": 4, "title": "病假" },
51107
- // { "const": 5, "title": "其他" }
51108
- // ]
51109
- // }
51110
- fieldSchemaInfo.enum = {
51111
- anyOf: componentElement.props.data.map(function (item) {
51112
- return {
51113
- const: (item === null || item === void 0 ? void 0 : item[format]) || item,
51114
- title: (item === null || item === void 0 ? void 0 : item.title) || item
51115
- };
51116
- })
51117
- };
51102
+ if (itemType === 'object') {
51103
+ // 对于对象类型,使用 oneOf 而不是 enum
51104
+ if (componentElement.props.multiple) {
51105
+ fieldSchemaInfo.items.oneOf = componentElement.props.data.map(function (item) {
51106
+ return {
51107
+ const: item,
51108
+ title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
51109
+ };
51110
+ });
51111
+ } else {
51112
+ fieldSchemaInfo.oneOf = componentElement.props.data.map(function (item) {
51113
+ return {
51114
+ const: item,
51115
+ title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
51116
+ };
51117
+ });
51118
+ }
51119
+ } else {
51120
+ fieldSchemaInfo.enum = componentElement.props.data.map(function (item) {
51121
+ return (item === null || item === void 0 ? void 0 : item[format]) || item;
51122
+ });
51123
+ }
51118
51124
  break;
51119
51125
  }
51120
51126
  case 'ShineoutDatePicker':
@@ -51137,15 +51143,71 @@ var SchemaBuilder = /*#__PURE__*/function () {
51137
51143
  break;
51138
51144
  case 'ShineoutCheckbox':
51139
51145
  case 'ShineoutCheckboxGroup':
51140
- fieldSchemaInfo.type = 'array';
51141
- fieldSchemaInfo.items = {
51142
- type: 'string'
51143
- };
51144
- break;
51146
+ {
51147
+ if (typeof componentElement.props.keygen !== 'boolean') {
51148
+ if (typeof format === 'string') {
51149
+ var _data$2;
51150
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]) === 'object' ? typeof_default()(data === null || data === void 0 || (_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2[format]) : typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51151
+ } else if (typeof format === 'function') {
51152
+ itemType = typeof_default()(format(data === null || data === void 0 ? void 0 : data[0]));
51153
+ } else {
51154
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51155
+ }
51156
+ } else {
51157
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51158
+ }
51159
+ fieldSchemaInfo.type = 'array';
51160
+ fieldSchemaInfo.items = {
51161
+ type: itemType
51162
+ };
51163
+
51164
+ // ShineoutCheckboxGroup 有 data 时(多选的)
51165
+ if (itemType === 'object') {
51166
+ fieldSchemaInfo.items.oneOf = componentElement.props.data.map(function (item) {
51167
+ return {
51168
+ const: item,
51169
+ title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
51170
+ };
51171
+ });
51172
+ } else {
51173
+ fieldSchemaInfo.items.enum = componentElement.props.data.map(function (item) {
51174
+ return (item === null || item === void 0 ? void 0 : item[format]) || item;
51175
+ });
51176
+ }
51177
+ break;
51178
+ }
51145
51179
  case 'ShineoutRadio':
51146
51180
  case 'ShineoutRadioGroup':
51147
- fieldSchemaInfo.type = 'string';
51148
- break;
51181
+ {
51182
+ if (typeof componentElement.props.keygen !== 'boolean') {
51183
+ if (typeof format === 'string') {
51184
+ var _data$3;
51185
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]) === 'object' ? typeof_default()(data === null || data === void 0 || (_data$3 = data[0]) === null || _data$3 === void 0 ? void 0 : _data$3[format]) : typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51186
+ } else if (typeof format === 'function') {
51187
+ itemType = typeof_default()(format(data === null || data === void 0 ? void 0 : data[0]));
51188
+ } else {
51189
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51190
+ }
51191
+ } else {
51192
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51193
+ }
51194
+ fieldSchemaInfo.type = itemType;
51195
+
51196
+ // ShineoutRadioGroup 有 data 时(单选的)
51197
+ if (itemType === 'object') {
51198
+ fieldSchemaInfo.oneOf = componentElement.props.data.map(function (item) {
51199
+ return {
51200
+ const: item,
51201
+ title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
51202
+ };
51203
+ });
51204
+ } else {
51205
+ fieldSchemaInfo.enum = componentElement.props.data.map(function (item) {
51206
+ return (item === null || item === void 0 ? void 0 : item[format]) || item;
51207
+ });
51208
+ }
51209
+ break;
51210
+ }
51149
51211
  case 'ShineoutSwitch':
51150
51212
  fieldSchemaInfo.type = 'boolean';
51151
51213
  break;
@@ -72830,7 +72892,7 @@ var upload_interface = __webpack_require__(8821);
72830
72892
 
72831
72893
 
72832
72894
  /* harmony default export */ var src_0 = ({
72833
- version: '3.8.0-beta.32'
72895
+ version: '3.8.0-beta.34'
72834
72896
  });
72835
72897
  }();
72836
72898
  /******/ return __webpack_exports__;