iglooform 3.3.6 → 3.3.7

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 (72) hide show
  1. package/.dumi/tmp/core/defineApp.ts +1 -1
  2. package/.dumi/tmp/core/helmet.ts +1 -1
  3. package/.dumi/tmp/core/history.ts +1 -1
  4. package/.dumi/tmp/core/historyIntelli.ts +1 -1
  5. package/.dumi/tmp/core/plugin.ts +2 -2
  6. package/.dumi/tmp/core/polyfill.ts +197 -197
  7. package/.dumi/tmp/core/route.tsx +33 -33
  8. package/.dumi/tmp/dumi/exports.ts +1 -1
  9. package/.dumi/tmp/dumi/locales/runtime.tsx +2 -2
  10. package/.dumi/tmp/dumi/meta/index.ts +33 -33
  11. package/.dumi/tmp/dumi/meta/runtime.ts +1 -1
  12. package/.dumi/tmp/dumi/theme/ContextWrapper.tsx +2 -2
  13. package/.dumi/tmp/dumi/theme/builtins/API.ts +1 -1
  14. package/.dumi/tmp/dumi/theme/builtins/Badge.ts +1 -1
  15. package/.dumi/tmp/dumi/theme/builtins/Container.ts +1 -1
  16. package/.dumi/tmp/dumi/theme/builtins/Previewer.ts +1 -1
  17. package/.dumi/tmp/dumi/theme/builtins/SourceCode.ts +1 -1
  18. package/.dumi/tmp/dumi/theme/builtins/Table.ts +1 -1
  19. package/.dumi/tmp/dumi/theme/builtins/Tree.ts +1 -1
  20. package/.dumi/tmp/dumi/theme/layouts/DocLayout.ts +1 -1
  21. package/.dumi/tmp/dumi/theme/loading.tsx +1 -1
  22. package/.dumi/tmp/dumi/theme/slots/ColorSwitch.ts +1 -1
  23. package/.dumi/tmp/dumi/theme/slots/Content.ts +1 -1
  24. package/.dumi/tmp/dumi/theme/slots/ContentFooter.ts +1 -1
  25. package/.dumi/tmp/dumi/theme/slots/ContentTabs.ts +1 -1
  26. package/.dumi/tmp/dumi/theme/slots/Features.ts +1 -1
  27. package/.dumi/tmp/dumi/theme/slots/Footer.ts +1 -1
  28. package/.dumi/tmp/dumi/theme/slots/Header.ts +1 -1
  29. package/.dumi/tmp/dumi/theme/slots/HeaderExtra.ts +1 -1
  30. package/.dumi/tmp/dumi/theme/slots/Hero.ts +1 -1
  31. package/.dumi/tmp/dumi/theme/slots/HeroTitle.ts +1 -1
  32. package/.dumi/tmp/dumi/theme/slots/LangSwitch.ts +1 -1
  33. package/.dumi/tmp/dumi/theme/slots/Logo.ts +1 -1
  34. package/.dumi/tmp/dumi/theme/slots/Navbar.ts +1 -1
  35. package/.dumi/tmp/dumi/theme/slots/NavbarExtra.ts +1 -1
  36. package/.dumi/tmp/dumi/theme/slots/NotFound.ts +1 -1
  37. package/.dumi/tmp/dumi/theme/slots/PreviewerActions.ts +1 -1
  38. package/.dumi/tmp/dumi/theme/slots/PreviewerActionsExtra.ts +1 -1
  39. package/.dumi/tmp/dumi/theme/slots/RtlSwitch.ts +1 -1
  40. package/.dumi/tmp/dumi/theme/slots/SearchBar.ts +2 -2
  41. package/.dumi/tmp/dumi/theme/slots/SearchResult.ts +1 -1
  42. package/.dumi/tmp/dumi/theme/slots/Sidebar.ts +1 -1
  43. package/.dumi/tmp/dumi/theme/slots/SocialIcon.ts +1 -1
  44. package/.dumi/tmp/dumi/theme/slots/Toc.ts +1 -1
  45. package/.dumi/tmp/exports.ts +5 -5
  46. package/.dumi/tmp/testBrowser.tsx +3 -3
  47. package/.dumi/tmp/umi.ts +4 -4
  48. package/.idea/iglooform.iml +4 -7
  49. package/.idea/misc.xml +5 -0
  50. package/es/config-provider.d.ts +9 -0
  51. package/es/form/step-items-selection/components/checkbox-group-items/style/index.d.ts +1 -0
  52. package/es/form/step-items-selection/components/item-info/style/index.d.ts +1 -0
  53. package/es/form/step-items-selection/components/section-of-item-condition/style/index.d.ts +1 -0
  54. package/es/locale/locale-provider.d.ts +13 -0
  55. package/es/media/file-icon.d.ts +9 -0
  56. package/es/media/media.js +1 -1
  57. package/es/utils/option-utils.js +19 -15
  58. package/es/utils/tools.d.ts +5 -0
  59. package/lib/config-provider.d.ts +9 -0
  60. package/lib/form/step-items-selection/components/checkbox-group-items/style/index.d.ts +1 -0
  61. package/lib/form/step-items-selection/components/item-info/style/index.d.ts +1 -0
  62. package/lib/form/step-items-selection/components/section-of-item-condition/style/index.d.ts +1 -0
  63. package/lib/locale/locale-provider.d.ts +13 -0
  64. package/lib/media/file-icon.d.ts +9 -0
  65. package/lib/media/media.js +1 -1
  66. package/lib/utils/option-utils.js +19 -15
  67. package/lib/utils/tools.d.ts +5 -0
  68. package/package.json +1 -1
  69. package/.idea/codeStyles/Project.xml +0 -59
  70. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  71. package/.idea/prettier.xml +0 -6
  72. package/yarn-error.log +0 -16168
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1,13 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { ConfigProviderProps } from 'antd/es/config-provider';
3
+ export declare const locales: {
4
+ [key: string]: {
5
+ [id: string]: string;
6
+ };
7
+ };
8
+ declare const LocaleProvider: FC<{
9
+ currentLang: string;
10
+ antdConfig?: ConfigProviderProps;
11
+ children?: ReactNode;
12
+ }>;
13
+ export default LocaleProvider;
@@ -0,0 +1,9 @@
1
+ import type { FC } from 'react';
2
+ import './style/file-icon.less';
3
+ type Props = {
4
+ type: string;
5
+ onDownloadClick?: () => void;
6
+ disabledDownload?: boolean;
7
+ };
8
+ declare const FileIcon: FC<Props>;
9
+ export default FileIcon;
package/es/media/media.js CHANGED
@@ -5,7 +5,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React, { useRef, useState, useContext } from 'react';
8
- import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
8
+ import { Document, Page } from 'react-pdf/dist/esm/entry.webpack5';
9
9
  import { Tooltip } from 'antd';
10
10
  import { LocaleContext } from "../locale";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -22,6 +22,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
22
22
  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); }
23
23
  import { useEffect, useState, useContext, useRef } from 'react';
24
24
  import FormContext from "../form-context";
25
+ import LocaleContext from "../locale/locale-context";
25
26
  import invariant from 'invariant';
26
27
  import { jsx as _jsx } from "react/jsx-runtime";
27
28
  export var compareOptions = function compareOptions(newOptions, oldOptions) {
@@ -84,6 +85,8 @@ export function optionsHOC(Component) {
84
85
  var optionsRef = useRef(_options);
85
86
  var _useContext = useContext(FormContext),
86
87
  selectDatasourceApi = _useContext.selectDatasourceApi;
88
+ var _useContext2 = useContext(LocaleContext),
89
+ currentLang = _useContext2.currentLang;
87
90
  var getFormInstance = rest.getFormInstance;
88
91
  var form = typeof getFormInstance === 'function' && getFormInstance();
89
92
  var dependFieldValue = form && dependField && form.getFieldValue(dependField);
@@ -150,7 +153,7 @@ export function optionsHOC(Component) {
150
153
  return _context.abrupt("return", _options2);
151
154
  case 9:
152
155
  if (!(selectDatasourceApi && datasourceKey)) {
153
- _context.next = 30;
156
+ _context.next = 31;
154
157
  break;
155
158
  }
156
159
  if (!(dependField && dependFieldValue === undefined)) {
@@ -166,34 +169,35 @@ export function optionsHOC(Component) {
166
169
  query += "&search_keyword=".concat(searchKey);
167
170
  }
168
171
  if (datasourceFilters) {
169
- query = dependFieldValue ? "".concat(query, "&") : query;
172
+ query = query ? "".concat(query, "&") : query;
170
173
  query += datasourceFilters.map(function (f) {
171
174
  return "filter=".concat(f);
172
175
  }).join('&');
173
176
  }
174
177
  api = "".concat(selectDatasourceApi, "/").concat(datasourceKey);
175
- _context.prev = 16;
176
- _context.next = 19;
177
- return fetch(query ? "".concat(api, "?").concat(query) : api);
178
- case 19:
178
+ query = query ? "".concat(query, "&lang=").concat(currentLang) : "lang=".concat(currentLang);
179
+ _context.prev = 17;
180
+ _context.next = 20;
181
+ return fetch("".concat(api, "?").concat(query));
182
+ case 20:
179
183
  rst = _context.sent;
180
- _context.next = 22;
184
+ _context.next = 23;
181
185
  return rst.json();
182
- case 22:
186
+ case 23:
183
187
  _yield$rst$json = _context.sent;
184
188
  data = _yield$rst$json.data;
185
189
  return _context.abrupt("return", data || []);
186
- case 27:
187
- _context.prev = 27;
188
- _context.t0 = _context["catch"](16);
189
- return _context.abrupt("return", []);
190
- case 30:
190
+ case 28:
191
+ _context.prev = 28;
192
+ _context.t0 = _context["catch"](17);
191
193
  return _context.abrupt("return", []);
192
194
  case 31:
195
+ return _context.abrupt("return", []);
196
+ case 32:
193
197
  case "end":
194
198
  return _context.stop();
195
199
  }
196
- }, _callee, null, [[16, 27]]);
200
+ }, _callee, null, [[17, 28]]);
197
201
  }));
198
202
  return function calcOptions() {
199
203
  return _ref.apply(this, arguments);
@@ -206,7 +210,7 @@ export function optionsHOC(Component) {
206
210
  }
207
211
  setUpdating(false);
208
212
  });
209
- }, [options, optionsFromGetOptions, optionGroups, dependFieldValue, searchKey]);
213
+ }, [options, optionsFromGetOptions, optionGroups, dependFieldValue, searchKey, currentLang]);
210
214
  return _options ? /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({
211
215
  options: _options
212
216
  }, rest), {}, {
@@ -0,0 +1,5 @@
1
+ export declare const parseFileSize: (size: number) => string;
2
+ export declare function classifyType(mimeType: string): string;
3
+ export declare const downloadByUrl: (filename: string, url: string) => void;
4
+ export declare const getFileNameByUrl: (fileUrl: string) => string;
5
+ export declare const getResourceContentType: (resourceUrl: string) => Promise<string | undefined>;
@@ -0,0 +1,9 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { ConfigProviderProps } from 'antd/es/config-provider';
3
+ export declare let staticAntdConfig: ConfigProviderProps;
4
+ declare const ConfigProvider: FC<{
5
+ currentLang: string;
6
+ config?: ConfigProviderProps;
7
+ children?: ReactNode;
8
+ }>;
9
+ export default ConfigProvider;
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1,13 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { ConfigProviderProps } from 'antd/es/config-provider';
3
+ export declare const locales: {
4
+ [key: string]: {
5
+ [id: string]: string;
6
+ };
7
+ };
8
+ declare const LocaleProvider: FC<{
9
+ currentLang: string;
10
+ antdConfig?: ConfigProviderProps;
11
+ children?: ReactNode;
12
+ }>;
13
+ export default LocaleProvider;
@@ -0,0 +1,9 @@
1
+ import type { FC } from 'react';
2
+ import './style/file-icon.less';
3
+ type Props = {
4
+ type: string;
5
+ onDownloadClick?: () => void;
6
+ disabledDownload?: boolean;
7
+ };
8
+ declare const FileIcon: FC<Props>;
9
+ export default FileIcon;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _entry = require("react-pdf/dist/esm/entry.webpack");
9
+ var _entry = require("react-pdf/dist/esm/entry.webpack5");
10
10
  var _antd = require("antd");
11
11
  var _locale = require("../locale");
12
12
  var _jsxRuntime = require("react/jsx-runtime");
@@ -8,6 +8,7 @@ exports.optionsHOC = optionsHOC;
8
8
  exports.previewSelectedOptions = previewSelectedOptions;
9
9
  var _react = require("react");
10
10
  var _formContext = _interopRequireDefault(require("../form-context"));
11
+ var _localeContext = _interopRequireDefault(require("../locale/locale-context"));
11
12
  var _invariant = _interopRequireDefault(require("invariant"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  var _excluded = ["options", "optionGroups", "getOptions", "datasourceFilters", "datasourceKey", "dependField", "children", "onSearch"];
@@ -95,6 +96,8 @@ function optionsHOC(Component) {
95
96
  var optionsRef = (0, _react.useRef)(_options);
96
97
  var _useContext = (0, _react.useContext)(_formContext.default),
97
98
  selectDatasourceApi = _useContext.selectDatasourceApi;
99
+ var _useContext2 = (0, _react.useContext)(_localeContext.default),
100
+ currentLang = _useContext2.currentLang;
98
101
  var getFormInstance = rest.getFormInstance;
99
102
  var form = typeof getFormInstance === 'function' && getFormInstance();
100
103
  var dependFieldValue = form && dependField && form.getFieldValue(dependField);
@@ -161,7 +164,7 @@ function optionsHOC(Component) {
161
164
  return _context.abrupt("return", _options2);
162
165
  case 9:
163
166
  if (!(selectDatasourceApi && datasourceKey)) {
164
- _context.next = 30;
167
+ _context.next = 31;
165
168
  break;
166
169
  }
167
170
  if (!(dependField && dependFieldValue === undefined)) {
@@ -177,34 +180,35 @@ function optionsHOC(Component) {
177
180
  query += "&search_keyword=".concat(searchKey);
178
181
  }
179
182
  if (datasourceFilters) {
180
- query = dependFieldValue ? "".concat(query, "&") : query;
183
+ query = query ? "".concat(query, "&") : query;
181
184
  query += datasourceFilters.map(function (f) {
182
185
  return "filter=".concat(f);
183
186
  }).join('&');
184
187
  }
185
188
  api = "".concat(selectDatasourceApi, "/").concat(datasourceKey);
186
- _context.prev = 16;
187
- _context.next = 19;
188
- return fetch(query ? "".concat(api, "?").concat(query) : api);
189
- case 19:
189
+ query = query ? "".concat(query, "&lang=").concat(currentLang) : "lang=".concat(currentLang);
190
+ _context.prev = 17;
191
+ _context.next = 20;
192
+ return fetch("".concat(api, "?").concat(query));
193
+ case 20:
190
194
  rst = _context.sent;
191
- _context.next = 22;
195
+ _context.next = 23;
192
196
  return rst.json();
193
- case 22:
197
+ case 23:
194
198
  _yield$rst$json = _context.sent;
195
199
  data = _yield$rst$json.data;
196
200
  return _context.abrupt("return", data || []);
197
- case 27:
198
- _context.prev = 27;
199
- _context.t0 = _context["catch"](16);
200
- return _context.abrupt("return", []);
201
- case 30:
201
+ case 28:
202
+ _context.prev = 28;
203
+ _context.t0 = _context["catch"](17);
202
204
  return _context.abrupt("return", []);
203
205
  case 31:
206
+ return _context.abrupt("return", []);
207
+ case 32:
204
208
  case "end":
205
209
  return _context.stop();
206
210
  }
207
- }, _callee, null, [[16, 27]]);
211
+ }, _callee, null, [[17, 28]]);
208
212
  }));
209
213
  return function calcOptions() {
210
214
  return _ref.apply(this, arguments);
@@ -217,7 +221,7 @@ function optionsHOC(Component) {
217
221
  }
218
222
  setUpdating(false);
219
223
  });
220
- }, [options, optionsFromGetOptions, optionGroups, dependFieldValue, searchKey]);
224
+ }, [options, optionsFromGetOptions, optionGroups, dependFieldValue, searchKey, currentLang]);
221
225
  return _options ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread(_objectSpread({
222
226
  options: _options
223
227
  }, rest), {}, {
@@ -0,0 +1,5 @@
1
+ export declare const parseFileSize: (size: number) => string;
2
+ export declare function classifyType(mimeType: string): string;
3
+ export declare const downloadByUrl: (filename: string, url: string) => void;
4
+ export declare const getFileNameByUrl: (fileUrl: string) => string;
5
+ export declare const getResourceContentType: (resourceUrl: string) => Promise<string | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "3.3.6",
3
+ "version": "3.3.7",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",
@@ -1,59 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <code_scheme name="Project" version="173">
3
- <HTMLCodeStyleSettings>
4
- <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
- </HTMLCodeStyleSettings>
6
- <JSCodeStyleSettings version="0">
7
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
8
- <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
9
- <option name="USE_DOUBLE_QUOTES" value="false" />
10
- <option name="FORCE_QUOTE_STYlE" value="true" />
11
- <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
12
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
13
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
14
- </JSCodeStyleSettings>
15
- <TypeScriptCodeStyleSettings version="0">
16
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
17
- <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
18
- <option name="USE_DOUBLE_QUOTES" value="false" />
19
- <option name="FORCE_QUOTE_STYlE" value="true" />
20
- <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
21
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
22
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
23
- </TypeScriptCodeStyleSettings>
24
- <VueCodeStyleSettings>
25
- <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
26
- <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
27
- </VueCodeStyleSettings>
28
- <codeStyleSettings language="HTML">
29
- <option name="SOFT_MARGINS" value="80" />
30
- <indentOptions>
31
- <option name="INDENT_SIZE" value="2" />
32
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
33
- <option name="TAB_SIZE" value="2" />
34
- </indentOptions>
35
- </codeStyleSettings>
36
- <codeStyleSettings language="JavaScript">
37
- <option name="SOFT_MARGINS" value="80" />
38
- <indentOptions>
39
- <option name="INDENT_SIZE" value="2" />
40
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
41
- <option name="TAB_SIZE" value="2" />
42
- </indentOptions>
43
- </codeStyleSettings>
44
- <codeStyleSettings language="TypeScript">
45
- <option name="SOFT_MARGINS" value="80" />
46
- <indentOptions>
47
- <option name="INDENT_SIZE" value="2" />
48
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
49
- <option name="TAB_SIZE" value="2" />
50
- </indentOptions>
51
- </codeStyleSettings>
52
- <codeStyleSettings language="Vue">
53
- <option name="SOFT_MARGINS" value="80" />
54
- <indentOptions>
55
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
56
- </indentOptions>
57
- </codeStyleSettings>
58
- </code_scheme>
59
- </component>
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
- </state>
5
- </component>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="PrettierConfiguration">
4
- <option name="myConfigurationMode" value="MANUAL" />
5
- </component>
6
- </project>