@experium/findy-form 1.2.61 → 1.3.3

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/.gitlab-ci.yml ADDED
@@ -0,0 +1,57 @@
1
+ variables:
2
+ DOCKER_TLS_CERTDIR: "/certs"
3
+ NODE_OPTIONS: '--max_old_space_size=4072'
4
+
5
+ image: node:14.15-stretch
6
+
7
+ cache: &global_cache
8
+ key:
9
+ files:
10
+ - yarn.lock
11
+ paths:
12
+ - node_modules/
13
+ - .yarn
14
+ policy: pull
15
+
16
+ stages:
17
+ - install
18
+ - build
19
+ - publish
20
+
21
+ install:
22
+ tags:
23
+ - runner2
24
+ stage: install
25
+ before_script:
26
+ - npm set registry https://npm.dev.experium.net
27
+ - npm set //npm.dev.experium.net/:_authToken $NPM_TOKEN
28
+ script:
29
+ - yarn install --frozen-lockfile
30
+ cache:
31
+ <<: *global_cache
32
+ policy: pull-push
33
+
34
+ build:
35
+ tags:
36
+ - runner2
37
+ stage: build
38
+ script:
39
+ - yarn package
40
+ artifacts:
41
+ paths:
42
+ - lib/
43
+
44
+ publish:
45
+ tags:
46
+ - runner2
47
+ stage: publish
48
+ before_script:
49
+ - git config user.email "webdev@experium.ru"
50
+ - git config user.name "Experium"
51
+ - npm set //registry.npmjs.org/:_authToken $NPM_API_TOKEN
52
+ script:
53
+ - npm version 1.3.$CI_PIPELINE_IID && npm publish
54
+ dependencies:
55
+ - build
56
+ only:
57
+ - master
@@ -469,7 +469,8 @@ var Fields = /*#__PURE__*/function (_Component) {
469
469
 
470
470
  return isLinked ? /*#__PURE__*/_react["default"].createElement(_LinkedFieldWrapper["default"], {
471
471
  field: field,
472
- form: form
472
+ form: form,
473
+ fieldName: fieldName
473
474
  }, renderLinkedField) : /*#__PURE__*/_react["default"].createElement(_reactFinalForm.Field, (0, _extends4["default"])({
474
475
  name: fieldName,
475
476
  component: getFieldComponent(field, components) || function () {
@@ -245,7 +245,7 @@ var DateSelect = /*#__PURE__*/function (_Component) {
245
245
  }, showDay && /*#__PURE__*/_react["default"].createElement(_reactTextMask["default"], {
246
246
  id: "".concat(name, "-day"),
247
247
  className: styles.formInput,
248
- value: day,
248
+ value: day || '',
249
249
  onChange: this.onChangeDay,
250
250
  onBlur: this.onBlurDay,
251
251
  mask: _masks.DAY_MASK,
@@ -270,7 +270,7 @@ var DateSelect = /*#__PURE__*/function (_Component) {
270
270
  id: "".concat(name, "-year"),
271
271
  disabled: disabled,
272
272
  className: styles.formInput,
273
- value: year,
273
+ value: year || '',
274
274
  onChange: this.onChangeYear,
275
275
  onBlur: this.onBlurYear,
276
276
  mask: _masks.YEAR_MASK,
@@ -49,8 +49,6 @@ var _i18n = require("../../utils/i18n");
49
49
 
50
50
  var _withFieldWrapper = _interopRequireDefault(require("../hocs/withFieldWrapper"));
51
51
 
52
- var _Select = require("./Select");
53
-
54
52
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
55
53
 
56
54
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -434,7 +432,6 @@ var Select = /*#__PURE__*/function (_Component) {
434
432
  onChange: this.onChange,
435
433
  mode: multiple ? 'multiple' : 'single',
436
434
  showSearch: options.length > 10,
437
- filterSort: _Select.sorterByLabel,
438
435
  optionFilterProp: "label",
439
436
  notFoundContent: t('noOptionsMessage'),
440
437
  placeholder: placeholder,
@@ -103,7 +103,7 @@ var MaskedInput = /*#__PURE__*/function (_Component) {
103
103
  id: name,
104
104
  disabled: disabled,
105
105
  className: "".concat(styles.formInput, " input"),
106
- value: value,
106
+ value: value || '',
107
107
  onChange: onChange,
108
108
  mask: mask,
109
109
  placeholderChar: "\u2000",
@@ -247,7 +247,6 @@ var Select = /*#__PURE__*/function (_Component) {
247
247
  value: (this.allowUserValue() && this.state.other ? this.getUserValueQuestion().value : value) || undefined,
248
248
  onChange: this.onChange,
249
249
  showSearch: options.length > 10,
250
- filterSort: sorterByLabel,
251
250
  optionFilterProp: "label",
252
251
  placeholder: placeholder,
253
252
  notFoundContent: t('noOptionsMessage'),
@@ -44,14 +44,14 @@ var LinkedFieldWatcher = /*#__PURE__*/function (_Component) {
44
44
  value: function componentDidUpdate(prev) {
45
45
  var _this$props = this.props,
46
46
  value = _this$props.value,
47
- field = _this$props.field,
47
+ fieldName = _this$props.fieldName,
48
48
  linkType = _this$props.linkType,
49
49
  linkValue = _this$props.linkValue;
50
50
 
51
51
  if (prev.value !== value) {
52
- var fieldName = (0, _ramda.path)(['field'], field);
52
+ var isHidding = linkType === 'hide' || linkType === 'show';
53
53
  var valueMatch = value === linkValue;
54
- var needClear = linkType === 'hide' && !valueMatch || linkType === 'hide' && valueMatch;
54
+ var needClear = isHidding && !valueMatch || isHidding && valueMatch;
55
55
 
56
56
  if (fieldName && needClear) {
57
57
  this.props.form.change(fieldName, undefined);
@@ -82,13 +82,16 @@ var LinkedFieldWrapper = /*#__PURE__*/function (_Component2) {
82
82
  value: function render() {
83
83
  var _this$props2 = this.props,
84
84
  field = _this$props2.field,
85
+ fieldName = _this$props2.fieldName,
85
86
  form = _this$props2.form,
86
87
  children = _this$props2.children;
87
88
  var linkField = (0, _ramda.path)(['settings', 'linkField'], field);
88
89
  var linkType = (0, _ramda.path)(['settings', 'linkType'], field);
89
90
  var linkValue = (0, _ramda.path)(['settings', 'linkValue'], field);
91
+ var required = field.required;
92
+ var parent = "".concat(fieldName || '').replace(field.field, '');
90
93
  return /*#__PURE__*/_react["default"].createElement(_reactFinalForm.Field, {
91
- name: linkField,
94
+ name: "".concat(parent).concat(linkField),
92
95
  subscription: {
93
96
  value: true
94
97
  }
@@ -97,13 +100,14 @@ var LinkedFieldWrapper = /*#__PURE__*/function (_Component2) {
97
100
  return /*#__PURE__*/_react["default"].createElement(LinkedFieldWatcher, {
98
101
  value: value,
99
102
  field: field,
103
+ fieldName: fieldName,
100
104
  form: form,
101
105
  linkType: linkType,
102
106
  linkValue: linkValue
103
107
  }, linkType === 'hide' ? value === linkValue ? children({
104
- required: true
108
+ required: required
105
109
  }) : null : linkType === 'show' ? value !== linkValue ? children({
106
- required: true
110
+ required: required
107
111
  }) : null : value !== linkValue ? children({
108
112
  required: false
109
113
  }) : children({
@@ -11,8 +11,7 @@ var isLinkedField = function isLinkedField(field) {
11
11
  var settings = field.settings;
12
12
  var linkType = (0, _ramda.prop)('linkType', settings);
13
13
  var linkField = (0, _ramda.prop)('linkField', settings);
14
- var linkValue = (0, _ramda.prop)('linkValue', settings);
15
- return linkType && linkField && linkValue;
14
+ return linkType && linkField;
16
15
  };
17
16
 
18
17
  exports.isLinkedField = isLinkedField;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experium/findy-form",
3
- "version": "1.2.61",
3
+ "version": "1.3.3",
4
4
  "main": "./lib/index.js",
5
5
  "homepage": "https://experium.github.io/findy-form",
6
6
  "repository": "https://github.com/experium/findy-form",
@@ -297,7 +297,7 @@ class Fields extends Component {
297
297
  );
298
298
 
299
299
  return isLinked ? (
300
- <LinkedFieldWrapper field={field} form={form}>
300
+ <LinkedFieldWrapper field={field} form={form} fieldName={fieldName}>
301
301
  { renderLinkedField }
302
302
  </LinkedFieldWrapper>
303
303
  ) : (
@@ -150,7 +150,7 @@ class DateSelect extends Component {
150
150
  <Masked
151
151
  id={`${name}-day`}
152
152
  className={styles.formInput}
153
- value={day}
153
+ value={day || ''}
154
154
  onChange={this.onChangeDay}
155
155
  onBlur={this.onBlurDay}
156
156
  mask={DAY_MASK}
@@ -178,7 +178,7 @@ class DateSelect extends Component {
178
178
  id={`${name}-year`}
179
179
  disabled={disabled}
180
180
  className={styles.formInput}
181
- value={year}
181
+ value={year || ''}
182
182
  onChange={this.onChangeYear}
183
183
  onBlur={this.onBlurYear}
184
184
  mask={YEAR_MASK}
@@ -10,7 +10,6 @@ import styles from '../../styles/index.module.css';
10
10
  import { CompanyDictionaryContext } from '../../context/CompanyDictionary';
11
11
  import { translateOptionLabel } from '../../utils/i18n';
12
12
  import withFieldWrapper from '../hocs/withFieldWrapper';
13
- import { sorterByLabel } from './Select';
14
13
 
15
14
  class Select extends Component {
16
15
  constructor(props) {
@@ -273,7 +272,6 @@ class Select extends Component {
273
272
  onChange={this.onChange}
274
273
  mode={multiple ? 'multiple' : 'single'}
275
274
  showSearch={options.length > 10}
276
- filterSort={sorterByLabel}
277
275
  optionFilterProp='label'
278
276
  notFoundContent={t('noOptionsMessage')}
279
277
  placeholder={placeholder}
@@ -19,7 +19,7 @@ class MaskedInput extends Component {
19
19
  id={name}
20
20
  disabled={disabled}
21
21
  className={`${styles.formInput} input`}
22
- value={value}
22
+ value={value || ''}
23
23
  onChange={onChange}
24
24
  mask={mask}
25
25
  placeholderChar={'\u2000'}
@@ -157,7 +157,6 @@ class Select extends Component {
157
157
  value={(this.allowUserValue() && this.state.other ? this.getUserValueQuestion().value : value) || undefined}
158
158
  onChange={this.onChange}
159
159
  showSearch={options.length > 10}
160
- filterSort={sorterByLabel}
161
160
  optionFilterProp='label'
162
161
  placeholder={placeholder}
163
162
  notFoundContent={t('noOptionsMessage')}
@@ -4,12 +4,12 @@ import { path } from 'ramda';
4
4
 
5
5
  class LinkedFieldWatcher extends Component {
6
6
  componentDidUpdate(prev) {
7
- const { value, field, linkType, linkValue } = this.props;
7
+ const { value, fieldName, linkType, linkValue } = this.props;
8
8
 
9
9
  if (prev.value !== value) {
10
- const fieldName = path(['field'], field);
10
+ const isHidding = linkType === 'hide' || linkType === 'show';
11
11
  const valueMatch = value === linkValue;
12
- const needClear = ((linkType === 'hide') && !valueMatch) || ((linkType === 'hide') && valueMatch);
12
+ const needClear = (isHidding && !valueMatch) || (isHidding && valueMatch);
13
13
 
14
14
  if (fieldName && needClear) {
15
15
  this.props.form.change(fieldName, undefined);
@@ -24,19 +24,21 @@ class LinkedFieldWatcher extends Component {
24
24
 
25
25
  class LinkedFieldWrapper extends Component {
26
26
  render() {
27
- const { field, form, children } = this.props;
27
+ const { field, fieldName, form, children } = this.props;
28
28
  const linkField = path(['settings', 'linkField'], field);
29
29
  const linkType = path(['settings', 'linkType'], field);
30
30
  const linkValue = path(['settings', 'linkValue'], field);
31
+ const required = field.required;
32
+ const parent = `${fieldName || ''}`.replace(field.field, '');
31
33
 
32
34
  return (
33
- <Field name={linkField} subscription={{ value: true }}>
35
+ <Field name={`${parent}${linkField}`} subscription={{ value: true }}>
34
36
  { ({ input: { value } }) => (
35
- <LinkedFieldWatcher value={value} field={field} form={form} linkType={linkType} linkValue={linkValue}>
37
+ <LinkedFieldWatcher value={value} field={field} fieldName={fieldName} form={form} linkType={linkType} linkValue={linkValue}>
36
38
  {(linkType === 'hide') ? (
37
- value === linkValue ? children({ required: true }) : null
39
+ value === linkValue ? children({ required }) : null
38
40
  ) : (linkType === 'show') ? (
39
- value !== linkValue ? children({ required: true }) : null
41
+ value !== linkValue ? children({ required }) : null
40
42
  ) : (
41
43
  value !== linkValue ? children({ required: false }) : children({ required: true })
42
44
  )}
@@ -4,6 +4,5 @@ export const isLinkedField = (field) => {
4
4
  const { settings } = field;
5
5
  const linkType = prop('linkType', settings);
6
6
  const linkField = prop('linkField', settings);
7
- const linkValue = prop('linkValue', settings);
8
- return linkType && linkField && linkValue;
7
+ return linkType && linkField;
9
8
  };
package/dist/404.html DELETED
@@ -1,22 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>App</title>
6
- <script type="text/javascript">
7
- var segmentCount = 1;
8
-
9
- var l = window.location;
10
- l.replace(
11
- l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
12
- l.pathname.split('/').slice(0, 1 + segmentCount).join('/') + '/?p=/' +
13
- l.pathname.slice(1).split('/').slice(segmentCount).join('/').replace(/&/g, '~and~') +
14
- (l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
15
- l.hash
16
- );
17
-
18
- </script>
19
- </head>
20
- <body>
21
- </body>
22
- </html>