iglooform 3.0.11 → 3.0.12

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.
@@ -30,7 +30,7 @@ export default function DumiContextWrapper() {
30
30
 
31
31
  return (
32
32
  <SiteContext.Provider value={{
33
- pkg: {"name":"iglooform","version":"3.0.9","license":"MIT"},
33
+ pkg: {"name":"iglooform","version":"3.0.12","license":"MIT"},
34
34
  historyType: "browser",
35
35
  entryExports,
36
36
  demos,
@@ -29,10 +29,11 @@ var useBreakpoint = Grid.useBreakpoint;
29
29
  var AddableSection = function AddableSection(_ref) {
30
30
  var parentName = _ref.parentName,
31
31
  config = _ref.config,
32
- preview = _ref.preview,
32
+ previewPropsFromInnerConfig = _ref.preview,
33
33
  disabled = _ref.disabled,
34
34
  setShowStepButton = _ref.setShowStepButton;
35
- var _config$elements = config.elements,
35
+ var formItemPreview = config.preview,
36
+ _config$elements = config.elements,
36
37
  elements = _config$elements === void 0 ? [] : _config$elements,
37
38
  name = config.name,
38
39
  label = config.label,
@@ -51,6 +52,7 @@ var AddableSection = function AddableSection(_ref) {
51
52
  addButtonText = config.addButtonText,
52
53
  addButtonIcon = config.addButtonIcon,
53
54
  description = config.description;
55
+ var preview = previewPropsFromInnerConfig || formItemPreview;
54
56
  var _useBreakpoint = useBreakpoint(),
55
57
  md = _useBreakpoint.md;
56
58
  var _useContext = useContext(LocaleContext),
@@ -130,7 +132,7 @@ var AddableSection = function AddableSection(_ref) {
130
132
  level: !md ? 'body1' : 'h3b',
131
133
  wrapElement: "div",
132
134
  children: label
133
- })) : /*#__PURE__*/_jsx("div", {}), groupKeys.length > min && !preview && /*#__PURE__*/_jsx(Button, {
135
+ })) : /*#__PURE__*/_jsx("div", {}), groupKeys.length > min && !preview && !elementProps.disabled && /*#__PURE__*/_jsx(Button, {
134
136
  type: "link",
135
137
  className: "igloo-addable-section-label-remove",
136
138
  onClick: function onClick() {
@@ -203,7 +205,7 @@ var AddableSection = function AddableSection(_ref) {
203
205
  whiteSpace: 'pre-wrap'
204
206
  },
205
207
  children: description
206
- }), /*#__PURE__*/_jsx(Button, {
208
+ }), !elementProps.disabled && /*#__PURE__*/_jsx(Button, {
207
209
  onClick: function onClick() {
208
210
  return dispath({
209
211
  type: 'add',
@@ -212,7 +214,6 @@ var AddableSection = function AddableSection(_ref) {
212
214
  },
213
215
  className: "igloo-form-addable-section-button",
214
216
  icon: addButtonIcon,
215
- disabled: elementProps.disabled,
216
217
  children: addButtonText || "".concat(formatMessage({
217
218
  id: 'Add'
218
219
  }), " ").concat(label)
@@ -242,7 +242,7 @@ var AddableSection = function AddableSection(props) {
242
242
  level: !md ? 'body1' : 'h3b',
243
243
  wrapElement: "div",
244
244
  children: label
245
- })) : /*#__PURE__*/_jsx("div", {}), groupKeys.length > min && !preview && /*#__PURE__*/_jsx(Button, {
245
+ })) : /*#__PURE__*/_jsx("div", {}), groupKeys.length > min && !preview && !elementProps.disabled && /*#__PURE__*/_jsx(Button, {
246
246
  type: "link",
247
247
  className: "igloo-addable-section-label-remove",
248
248
  onClick: function onClick() {
@@ -287,7 +287,7 @@ var AddableSection = function AddableSection(props) {
287
287
  whiteSpace: 'pre-wrap'
288
288
  },
289
289
  children: description
290
- }), /*#__PURE__*/_jsx(Button, {
290
+ }), !elementProps.disabled && /*#__PURE__*/_jsx(Button, {
291
291
  onClick: function onClick() {
292
292
  return dispath({
293
293
  type: 'add',
@@ -145,7 +145,9 @@ var UploadPhoto = function UploadPhoto(props) {
145
145
  id = props.id,
146
146
  validateField = props.validateField,
147
147
  _props$capture = props.capture,
148
- capture = _props$capture === void 0 ? false : _props$capture;
148
+ capture = _props$capture === void 0 ? false : _props$capture,
149
+ disabled = props.disabled;
150
+ console.log(props, 'props');
149
151
  var _useContext2 = useContext(LocaleContext),
150
152
  formatMessage = _useContext2.formatMessage;
151
153
  var _useState = useState(isMobileAgent()),
@@ -575,7 +577,7 @@ var UploadPhoto = function UploadPhoto(props) {
575
577
  });
576
578
  };
577
579
  return /*#__PURE__*/_jsxs("div", {
578
- className: classnames(prefix, className),
580
+ className: classnames(prefix, className, disabled ? "".concat(prefix, "-disabled") : ''),
579
581
  id: id,
580
582
  ref: DomRef,
581
583
  children: [Boolean(descriptions || samples.length) && /*#__PURE__*/_jsx("div", {
@@ -614,6 +616,7 @@ var UploadPhoto = function UploadPhoto(props) {
614
616
  })]
615
617
  })
616
618
  }), /*#__PURE__*/_jsx("input", {
619
+ disabled: disabled,
617
620
  id: uploadId,
618
621
  type: "file",
619
622
  style: {
@@ -654,7 +657,7 @@ var UploadPhoto = function UploadPhoto(props) {
654
657
  type = _ref9.type,
655
658
  uid = _ref9.uid;
656
659
  return /*#__PURE__*/_jsx(Badge, {
657
- count: getBadge(status, index, limit),
660
+ count: disabled ? null : getBadge(status, index, limit),
658
661
  children: /*#__PURE__*/_jsxs("div", {
659
662
  className: classnames((_classnames5 = {}, _defineProperty(_classnames5, "".concat(prefix, "-content-container"), true), _defineProperty(_classnames5, "".concat(prefix, "-content-error"), status === 'failed'), _classnames5)),
660
663
  onMouseEnter: function onMouseEnter() {
@@ -159,6 +159,19 @@
159
159
  }
160
160
  }
161
161
 
162
+ .igloo-upload-photo-disabled {
163
+ color: rgba(0, 0, 0, 0.25);
164
+ cursor: not-allowed;
165
+
166
+ & label {
167
+ cursor: not-allowed !important;
168
+ }
169
+
170
+ & .igloo-icon {
171
+ color: rgba(0, 0, 0, 0.25) !important;
172
+ }
173
+ }
174
+
162
175
  .ant-form-item-has-error .igloo-upload-photo-content-button {
163
176
  border-color: @error-color;
164
177
  }
@@ -1,2 +1,2 @@
1
1
  export declare const parseFileSize: (size: number) => string;
2
- export declare function classifyType(type: string): "image" | "video" | "pdf" | "unknown";
2
+ export declare function classifyType(type: string): "video" | "image" | "pdf" | "unknown";
@@ -37,10 +37,11 @@ var useBreakpoint = _antd.Grid.useBreakpoint;
37
37
  var AddableSection = function AddableSection(_ref) {
38
38
  var parentName = _ref.parentName,
39
39
  config = _ref.config,
40
- preview = _ref.preview,
40
+ previewPropsFromInnerConfig = _ref.preview,
41
41
  disabled = _ref.disabled,
42
42
  setShowStepButton = _ref.setShowStepButton;
43
- var _config$elements = config.elements,
43
+ var formItemPreview = config.preview,
44
+ _config$elements = config.elements,
44
45
  elements = _config$elements === void 0 ? [] : _config$elements,
45
46
  name = config.name,
46
47
  label = config.label,
@@ -59,6 +60,7 @@ var AddableSection = function AddableSection(_ref) {
59
60
  addButtonText = config.addButtonText,
60
61
  addButtonIcon = config.addButtonIcon,
61
62
  description = config.description;
63
+ var preview = previewPropsFromInnerConfig || formItemPreview;
62
64
  var _useBreakpoint = useBreakpoint(),
63
65
  md = _useBreakpoint.md;
64
66
  var _useContext = (0, _react.useContext)(_locale.LocaleContext),
@@ -138,7 +140,7 @@ var AddableSection = function AddableSection(_ref) {
138
140
  level: !md ? 'body1' : 'h3b',
139
141
  wrapElement: "div",
140
142
  children: label
141
- })) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {}), groupKeys.length > min && !preview && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
143
+ })) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {}), groupKeys.length > min && !preview && !elementProps.disabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
142
144
  type: "link",
143
145
  className: "igloo-addable-section-label-remove",
144
146
  onClick: function onClick() {
@@ -211,7 +213,7 @@ var AddableSection = function AddableSection(_ref) {
211
213
  whiteSpace: 'pre-wrap'
212
214
  },
213
215
  children: description
214
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
216
+ }), !elementProps.disabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
215
217
  onClick: function onClick() {
216
218
  return dispath({
217
219
  type: 'add',
@@ -220,7 +222,6 @@ var AddableSection = function AddableSection(_ref) {
220
222
  },
221
223
  className: "igloo-form-addable-section-button",
222
224
  icon: addButtonIcon,
223
- disabled: elementProps.disabled,
224
225
  children: addButtonText || "".concat(formatMessage({
225
226
  id: 'Add'
226
227
  }), " ").concat(label)
@@ -249,7 +249,7 @@ var AddableSection = function AddableSection(props) {
249
249
  level: !md ? 'body1' : 'h3b',
250
250
  wrapElement: "div",
251
251
  children: label
252
- })) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {}), groupKeys.length > min && !preview && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
252
+ })) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {}), groupKeys.length > min && !preview && !elementProps.disabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
253
253
  type: "link",
254
254
  className: "igloo-addable-section-label-remove",
255
255
  onClick: function onClick() {
@@ -294,7 +294,7 @@ var AddableSection = function AddableSection(props) {
294
294
  whiteSpace: 'pre-wrap'
295
295
  },
296
296
  children: description
297
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
297
+ }), !elementProps.disabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
298
298
  onClick: function onClick() {
299
299
  return dispath({
300
300
  type: 'add',
@@ -149,7 +149,9 @@ var UploadPhoto = function UploadPhoto(props) {
149
149
  id = props.id,
150
150
  validateField = props.validateField,
151
151
  _props$capture = props.capture,
152
- capture = _props$capture === void 0 ? false : _props$capture;
152
+ capture = _props$capture === void 0 ? false : _props$capture,
153
+ disabled = props.disabled;
154
+ console.log(props, 'props');
153
155
  var _useContext2 = (0, _react.useContext)(_locale.LocaleContext),
154
156
  formatMessage = _useContext2.formatMessage;
155
157
  var _useState = (0, _react.useState)((0, _agentDetect.isMobileAgent)()),
@@ -579,7 +581,7 @@ var UploadPhoto = function UploadPhoto(props) {
579
581
  });
580
582
  };
581
583
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
582
- className: (0, _classnames6.default)(prefix, className),
584
+ className: (0, _classnames6.default)(prefix, className, disabled ? "".concat(prefix, "-disabled") : ''),
583
585
  id: id,
584
586
  ref: DomRef,
585
587
  children: [Boolean(descriptions || samples.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -618,6 +620,7 @@ var UploadPhoto = function UploadPhoto(props) {
618
620
  })]
619
621
  })
620
622
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
623
+ disabled: disabled,
621
624
  id: uploadId,
622
625
  type: "file",
623
626
  style: {
@@ -658,7 +661,7 @@ var UploadPhoto = function UploadPhoto(props) {
658
661
  type = _ref9.type,
659
662
  uid = _ref9.uid;
660
663
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Badge, {
661
- count: getBadge(status, index, limit),
664
+ count: disabled ? null : getBadge(status, index, limit),
662
665
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
663
666
  className: (0, _classnames6.default)((_classnames5 = {}, _defineProperty(_classnames5, "".concat(prefix, "-content-container"), true), _defineProperty(_classnames5, "".concat(prefix, "-content-error"), status === 'failed'), _classnames5)),
664
667
  onMouseEnter: function onMouseEnter() {
@@ -159,6 +159,19 @@
159
159
  }
160
160
  }
161
161
 
162
+ .igloo-upload-photo-disabled {
163
+ color: rgba(0, 0, 0, 0.25);
164
+ cursor: not-allowed;
165
+
166
+ & label {
167
+ cursor: not-allowed !important;
168
+ }
169
+
170
+ & .igloo-icon {
171
+ color: rgba(0, 0, 0, 0.25) !important;
172
+ }
173
+ }
174
+
162
175
  .ant-form-item-has-error .igloo-upload-photo-content-button {
163
176
  border-color: @error-color;
164
177
  }
@@ -1,2 +1,2 @@
1
1
  export declare const parseFileSize: (size: number) => string;
2
- export declare function classifyType(type: string): "image" | "video" | "pdf" | "unknown";
2
+ export declare function classifyType(type: string): "video" | "image" | "pdf" | "unknown";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "3.0.11",
3
+ "version": "3.0.12",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",