shineout 3.8.0-beta.32 → 3.8.0-beta.33

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.33'
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.33');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -51052,6 +51052,7 @@ var SchemaBuilder = /*#__PURE__*/function () {
51052
51052
  var itemType;
51053
51053
  if (typeof componentElement.type === 'function') {
51054
51054
  var componentName = componentElement.type.displayName || componentElement.type.name;
51055
+ var format = componentElement.props.format || componentElement.props.keygen;
51055
51056
  switch (componentName) {
51056
51057
  case 'ShineoutInput':
51057
51058
  case 'ShineoutEditableArea':
@@ -51066,10 +51067,10 @@ var SchemaBuilder = /*#__PURE__*/function () {
51066
51067
  case 'ShineoutTextarea':
51067
51068
  fieldSchemaInfo.type = 'string';
51068
51069
  break;
51070
+ case 'ShineoutCascader':
51069
51071
  case 'ShineoutSelect':
51070
51072
  case 'ShineoutTreeSelect':
51071
51073
  {
51072
- var format = componentElement.props.format || componentElement.props.keygen;
51073
51074
  if (typeof componentElement.props.keygen !== 'boolean') {
51074
51075
  if (typeof format === 'string') {
51075
51076
  var _data$;
@@ -51090,31 +51091,28 @@ var SchemaBuilder = /*#__PURE__*/function () {
51090
51091
  } else {
51091
51092
  fieldSchemaInfo.type = itemType;
51092
51093
  }
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
- };
51094
+ if (itemType === 'object') {
51095
+ // 对于对象类型,使用 oneOf 而不是 enum
51096
+ if (componentElement.props.multiple) {
51097
+ fieldSchemaInfo.items.oneOf = componentElement.props.data.map(function (item) {
51098
+ return {
51099
+ const: item,
51100
+ title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
51101
+ };
51102
+ });
51103
+ } else {
51104
+ fieldSchemaInfo.oneOf = componentElement.props.data.map(function (item) {
51105
+ return {
51106
+ const: item,
51107
+ title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
51108
+ };
51109
+ });
51110
+ }
51111
+ } else {
51112
+ fieldSchemaInfo.enum = componentElement.props.data.map(function (item) {
51113
+ return (item === null || item === void 0 ? void 0 : item[format]) || item;
51114
+ });
51115
+ }
51118
51116
  break;
51119
51117
  }
51120
51118
  case 'ShineoutDatePicker':
@@ -51137,15 +51135,71 @@ var SchemaBuilder = /*#__PURE__*/function () {
51137
51135
  break;
51138
51136
  case 'ShineoutCheckbox':
51139
51137
  case 'ShineoutCheckboxGroup':
51140
- fieldSchemaInfo.type = 'array';
51141
- fieldSchemaInfo.items = {
51142
- type: 'string'
51143
- };
51144
- break;
51138
+ {
51139
+ if (typeof componentElement.props.keygen !== 'boolean') {
51140
+ if (typeof format === 'string') {
51141
+ var _data$2;
51142
+ 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]);
51143
+ } else if (typeof format === 'function') {
51144
+ itemType = typeof_default()(format(data === null || data === void 0 ? void 0 : data[0]));
51145
+ } else {
51146
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51147
+ }
51148
+ } else {
51149
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51150
+ }
51151
+ fieldSchemaInfo.type = 'array';
51152
+ fieldSchemaInfo.items = {
51153
+ type: itemType
51154
+ };
51155
+
51156
+ // ShineoutCheckboxGroup 有 data 时(多选的)
51157
+ if (itemType === 'object') {
51158
+ fieldSchemaInfo.items.oneOf = componentElement.props.data.map(function (item) {
51159
+ return {
51160
+ const: item,
51161
+ title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
51162
+ };
51163
+ });
51164
+ } else {
51165
+ fieldSchemaInfo.items.enum = componentElement.props.data.map(function (item) {
51166
+ return (item === null || item === void 0 ? void 0 : item[format]) || item;
51167
+ });
51168
+ }
51169
+ break;
51170
+ }
51145
51171
  case 'ShineoutRadio':
51146
51172
  case 'ShineoutRadioGroup':
51147
- fieldSchemaInfo.type = 'string';
51148
- break;
51173
+ {
51174
+ if (typeof componentElement.props.keygen !== 'boolean') {
51175
+ if (typeof format === 'string') {
51176
+ var _data$3;
51177
+ 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]);
51178
+ } else if (typeof format === 'function') {
51179
+ itemType = typeof_default()(format(data === null || data === void 0 ? void 0 : data[0]));
51180
+ } else {
51181
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51182
+ }
51183
+ } else {
51184
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
51185
+ }
51186
+ fieldSchemaInfo.type = itemType;
51187
+
51188
+ // ShineoutRadioGroup 有 data 时(单选的)
51189
+ if (itemType === 'object') {
51190
+ fieldSchemaInfo.oneOf = componentElement.props.data.map(function (item) {
51191
+ return {
51192
+ const: item,
51193
+ title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
51194
+ };
51195
+ });
51196
+ } else {
51197
+ fieldSchemaInfo.enum = componentElement.props.data.map(function (item) {
51198
+ return (item === null || item === void 0 ? void 0 : item[format]) || item;
51199
+ });
51200
+ }
51201
+ break;
51202
+ }
51149
51203
  case 'ShineoutSwitch':
51150
51204
  fieldSchemaInfo.type = 'boolean';
51151
51205
  break;
@@ -72830,7 +72884,7 @@ var upload_interface = __webpack_require__(8821);
72830
72884
 
72831
72885
 
72832
72886
  /* harmony default export */ var src_0 = ({
72833
- version: '3.8.0-beta.32'
72887
+ version: '3.8.0-beta.33'
72834
72888
  });
72835
72889
  }();
72836
72890
  /******/ return __webpack_exports__;