@bigbinary/neeto-form-frontend 1.2.1 → 1.2.2

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/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { Input, Email as Email$2, Phone as Phone$2, Up, Down, MenuHorizontal, De
11
11
  import axios from 'axios';
12
12
  import { Input as Input$1, Textarea, Checkbox, ActionBlock } from '@bigbinary/neetoui/formik';
13
13
  import { useTranslation, Trans } from 'react-i18next';
14
- import { withImmutableActions, useHotKeys } from '@bigbinary/neeto-commons-frontend/react-utils';
14
+ import { withImmutableActions, useDebounce, useHotKeys } from '@bigbinary/neeto-commons-frontend/react-utils';
15
15
  import { create as create$1 } from 'zustand';
16
16
  import classnames from 'classnames';
17
17
  import { Editor as Editor$1, isEditorEmpty, EditorContent } from '@bigbinary/neeto-editor';
@@ -49976,7 +49976,7 @@ var RatingField = function RatingField(_ref) {
49976
49976
 
49977
49977
  function cov_169joloac6() {
49978
49978
  var path = "/home/runner/work/neeto-form-frontend/neeto-form-frontend/src/components/ExternalForm/Fields/RichTextEditor.jsx";
49979
- var hash = "6ba7fc3833833f3e5a9b53ad73dcbbb33833852b";
49979
+ var hash = "606c74303adb3d540387836761d6cccb9f3cc43f";
49980
49980
  var global = new Function("return this")();
49981
49981
  var gcv = "__coverage__";
49982
49982
  var coverageData = {
@@ -49984,61 +49984,81 @@ function cov_169joloac6() {
49984
49984
  statementMap: {
49985
49985
  "0": {
49986
49986
  start: {
49987
- line: 9,
49987
+ line: 10,
49988
49988
  column: 23
49989
49989
  },
49990
49990
  end: {
49991
- line: 46,
49991
+ line: 54,
49992
49992
  column: 1
49993
49993
  }
49994
49994
  },
49995
49995
  "1": {
49996
49996
  start: {
49997
- line: 10,
49997
+ line: 11,
49998
49998
  column: 69
49999
49999
  },
50000
50000
  end: {
50001
- line: 10,
50001
+ line: 11,
50002
50002
  column: 77
50003
50003
  }
50004
50004
  },
50005
50005
  "2": {
50006
50006
  start: {
50007
- line: 12,
50007
+ line: 13,
50008
+ column: 31
50009
+ },
50010
+ end: {
50011
+ line: 13,
50012
+ column: 60
50013
+ }
50014
+ },
50015
+ "3": {
50016
+ start: {
50017
+ line: 15,
50008
50018
  column: 2
50009
50019
  },
50010
50020
  end: {
50011
- line: 45,
50021
+ line: 53,
50012
50022
  column: 4
50013
50023
  }
50014
50024
  },
50015
- "3": {
50025
+ "4": {
50016
50026
  start: {
50017
- line: 26,
50027
+ line: 29,
50018
50028
  column: 10
50019
50029
  },
50020
50030
  end: {
50021
- line: 41,
50031
+ line: 29,
50032
+ column: 75
50033
+ }
50034
+ },
50035
+ "5": {
50036
+ start: {
50037
+ line: 33,
50038
+ column: 10
50039
+ },
50040
+ end: {
50041
+ line: 49,
50022
50042
  column: 12
50023
50043
  }
50024
50044
  },
50025
- "4": {
50045
+ "6": {
50026
50046
  start: {
50027
- line: 38,
50047
+ line: 46,
50028
50048
  column: 26
50029
50049
  },
50030
50050
  end: {
50031
- line: 38,
50051
+ line: 46,
50032
50052
  column: 58
50033
50053
  }
50034
50054
  },
50035
- "5": {
50055
+ "7": {
50036
50056
  start: {
50037
- line: 39,
50057
+ line: 47,
50038
50058
  column: 31
50039
50059
  },
50040
50060
  end: {
50041
- line: 39,
50061
+ line: 47,
50042
50062
  column: 62
50043
50063
  }
50044
50064
  }
@@ -50048,222 +50068,246 @@ function cov_169joloac6() {
50048
50068
  name: "(anonymous_0)",
50049
50069
  decl: {
50050
50070
  start: {
50051
- line: 9,
50071
+ line: 10,
50052
50072
  column: 23
50053
50073
  },
50054
50074
  end: {
50055
- line: 9,
50075
+ line: 10,
50056
50076
  column: 24
50057
50077
  }
50058
50078
  },
50059
50079
  loc: {
50060
50080
  start: {
50061
- line: 9,
50081
+ line: 10,
50062
50082
  column: 70
50063
50083
  },
50064
50084
  end: {
50065
- line: 46,
50085
+ line: 54,
50066
50086
  column: 1
50067
50087
  }
50068
50088
  },
50069
- line: 9
50089
+ line: 10
50070
50090
  },
50071
50091
  "1": {
50072
50092
  name: "(anonymous_1)",
50073
50093
  decl: {
50074
50094
  start: {
50075
- line: 25,
50095
+ line: 28,
50096
+ column: 22
50097
+ },
50098
+ end: {
50099
+ line: 28,
50100
+ column: 23
50101
+ }
50102
+ },
50103
+ loc: {
50104
+ start: {
50105
+ line: 29,
50106
+ column: 10
50107
+ },
50108
+ end: {
50109
+ line: 29,
50110
+ column: 75
50111
+ }
50112
+ },
50113
+ line: 29
50114
+ },
50115
+ "2": {
50116
+ name: "(anonymous_2)",
50117
+ decl: {
50118
+ start: {
50119
+ line: 32,
50076
50120
  column: 9
50077
50121
  },
50078
50122
  end: {
50079
- line: 25,
50123
+ line: 32,
50080
50124
  column: 10
50081
50125
  }
50082
50126
  },
50083
50127
  loc: {
50084
50128
  start: {
50085
- line: 26,
50129
+ line: 33,
50086
50130
  column: 10
50087
50131
  },
50088
50132
  end: {
50089
- line: 41,
50133
+ line: 49,
50090
50134
  column: 12
50091
50135
  }
50092
50136
  },
50093
- line: 26
50137
+ line: 33
50094
50138
  },
50095
- "2": {
50096
- name: "(anonymous_2)",
50139
+ "3": {
50140
+ name: "(anonymous_3)",
50097
50141
  decl: {
50098
50142
  start: {
50099
- line: 38,
50143
+ line: 46,
50100
50144
  column: 20
50101
50145
  },
50102
50146
  end: {
50103
- line: 38,
50147
+ line: 46,
50104
50148
  column: 21
50105
50149
  }
50106
50150
  },
50107
50151
  loc: {
50108
50152
  start: {
50109
- line: 38,
50153
+ line: 46,
50110
50154
  column: 26
50111
50155
  },
50112
50156
  end: {
50113
- line: 38,
50157
+ line: 46,
50114
50158
  column: 58
50115
50159
  }
50116
50160
  },
50117
- line: 38
50161
+ line: 46
50118
50162
  },
50119
- "3": {
50120
- name: "(anonymous_3)",
50163
+ "4": {
50164
+ name: "(anonymous_4)",
50121
50165
  decl: {
50122
50166
  start: {
50123
- line: 39,
50167
+ line: 47,
50124
50168
  column: 22
50125
50169
  },
50126
50170
  end: {
50127
- line: 39,
50171
+ line: 47,
50128
50172
  column: 23
50129
50173
  }
50130
50174
  },
50131
50175
  loc: {
50132
50176
  start: {
50133
- line: 39,
50177
+ line: 47,
50134
50178
  column: 31
50135
50179
  },
50136
50180
  end: {
50137
- line: 39,
50181
+ line: 47,
50138
50182
  column: 62
50139
50183
  }
50140
50184
  },
50141
- line: 39
50185
+ line: 47
50142
50186
  }
50143
50187
  },
50144
50188
  branchMap: {
50145
50189
  "0": {
50146
50190
  loc: {
50147
50191
  start: {
50148
- line: 9,
50192
+ line: 10,
50149
50193
  column: 47
50150
50194
  },
50151
50195
  end: {
50152
- line: 9,
50196
+ line: 10,
50153
50197
  column: 63
50154
50198
  }
50155
50199
  },
50156
50200
  type: "default-arg",
50157
50201
  locations: [{
50158
50202
  start: {
50159
- line: 9,
50203
+ line: 10,
50160
50204
  column: 61
50161
50205
  },
50162
50206
  end: {
50163
- line: 9,
50207
+ line: 10,
50164
50208
  column: 63
50165
50209
  }
50166
50210
  }],
50167
- line: 9
50211
+ line: 10
50168
50212
  },
50169
50213
  "1": {
50170
50214
  loc: {
50171
50215
  start: {
50172
- line: 15,
50216
+ line: 18,
50173
50217
  column: 9
50174
50218
  },
50175
50219
  end: {
50176
- line: 19,
50220
+ line: 22,
50177
50221
  column: 9
50178
50222
  }
50179
50223
  },
50180
50224
  type: "binary-expr",
50181
50225
  locations: [{
50182
50226
  start: {
50183
- line: 15,
50227
+ line: 18,
50184
50228
  column: 9
50185
50229
  },
50186
50230
  end: {
50187
- line: 15,
50231
+ line: 18,
50188
50232
  column: 14
50189
50233
  }
50190
50234
  }, {
50191
50235
  start: {
50192
- line: 16,
50236
+ line: 19,
50193
50237
  column: 10
50194
50238
  },
50195
50239
  end: {
50196
- line: 18,
50240
+ line: 21,
50197
50241
  column: 18
50198
50242
  }
50199
50243
  }],
50200
- line: 15
50244
+ line: 18
50201
50245
  },
50202
50246
  "2": {
50203
50247
  loc: {
50204
50248
  start: {
50205
- line: 22,
50249
+ line: 26,
50206
50250
  column: 14
50207
50251
  },
50208
50252
  end: {
50209
- line: 22,
50253
+ line: 26,
50210
50254
  column: 28
50211
50255
  }
50212
50256
  },
50213
50257
  type: "binary-expr",
50214
50258
  locations: [{
50215
50259
  start: {
50216
- line: 22,
50260
+ line: 26,
50217
50261
  column: 14
50218
50262
  },
50219
50263
  end: {
50220
- line: 22,
50264
+ line: 26,
50221
50265
  column: 18
50222
50266
  }
50223
50267
  }, {
50224
50268
  start: {
50225
- line: 22,
50269
+ line: 26,
50226
50270
  column: 22
50227
50271
  },
50228
50272
  end: {
50229
- line: 22,
50273
+ line: 26,
50230
50274
  column: 28
50231
50275
  }
50232
50276
  }],
50233
- line: 22
50277
+ line: 26
50234
50278
  },
50235
50279
  "3": {
50236
50280
  loc: {
50237
50281
  start: {
50238
- line: 28,
50282
+ line: 35,
50239
50283
  column: 19
50240
50284
  },
50241
50285
  end: {
50242
- line: 28,
50286
+ line: 35,
50243
50287
  column: 49
50244
50288
  }
50245
50289
  },
50246
50290
  type: "cond-expr",
50247
50291
  locations: [{
50248
50292
  start: {
50249
- line: 28,
50293
+ line: 35,
50250
50294
  column: 34
50251
50295
  },
50252
50296
  end: {
50253
- line: 28,
50297
+ line: 35,
50254
50298
  column: 44
50255
50299
  }
50256
50300
  }, {
50257
50301
  start: {
50258
- line: 28,
50302
+ line: 35,
50259
50303
  column: 47
50260
50304
  },
50261
50305
  end: {
50262
- line: 28,
50306
+ line: 35,
50263
50307
  column: 49
50264
50308
  }
50265
50309
  }],
50266
- line: 28
50310
+ line: 35
50267
50311
  }
50268
50312
  },
50269
50313
  s: {
@@ -50272,13 +50316,16 @@ function cov_169joloac6() {
50272
50316
  "2": 0,
50273
50317
  "3": 0,
50274
50318
  "4": 0,
50275
- "5": 0
50319
+ "5": 0,
50320
+ "6": 0,
50321
+ "7": 0
50276
50322
  },
50277
50323
  f: {
50278
50324
  "0": 0,
50279
50325
  "1": 0,
50280
50326
  "2": 0,
50281
- "3": 0
50327
+ "3": 0,
50328
+ "4": 0
50282
50329
  },
50283
50330
  b: {
50284
50331
  "0": [0],
@@ -50287,7 +50334,7 @@ function cov_169joloac6() {
50287
50334
  "3": [0, 0]
50288
50335
  },
50289
50336
  _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
50290
- hash: "6ba7fc3833833f3e5a9b53ad73dcbbb33833852b"
50337
+ hash: "606c74303adb3d540387836761d6cccb9f3cc43f"
50291
50338
  };
50292
50339
  var coverage = global[gcv] || (global[gcv] = {});
50293
50340
  if (!coverage[path] || coverage[path].hash !== hash) {
@@ -50317,7 +50364,8 @@ var RichTextEditor = function RichTextEditor(_ref) {
50317
50364
  isRequired = _ref2.isRequired,
50318
50365
  nodeId = _ref2.nodeId,
50319
50366
  placeholder = _ref2.placeholder;
50320
- cov_169joloac6().s[2]++;
50367
+ var debouncedPlaceholder = (cov_169joloac6().s[2]++, useDebounce(placeholder, 300));
50368
+ cov_169joloac6().s[3]++;
50321
50369
  return /*#__PURE__*/React__default.createElement("div", {
50322
50370
  className: "neeto-form-engine-input__wrapper"
50323
50371
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -50325,33 +50373,40 @@ var RichTextEditor = function RichTextEditor(_ref) {
50325
50373
  }, (cov_169joloac6().b[1][0]++, label) && (cov_169joloac6().b[1][1]++, /*#__PURE__*/React__default.createElement("label", {
50326
50374
  className: "neeto-form-engine-label"
50327
50375
  }, getLabel$1(label, isRequired)))), /*#__PURE__*/React__default.createElement(FastField, {
50376
+ debouncedPlaceholder: debouncedPlaceholder,
50328
50377
  name: (cov_169joloac6().b[2][0]++, name) || (cov_169joloac6().b[2][1]++, nodeId),
50329
50378
  validate: validateFieldValue({
50330
50379
  kind: kind,
50331
50380
  label: label,
50332
50381
  isRequired: isRequired
50333
- })
50382
+ }),
50383
+ shouldUpdate: function shouldUpdate(nextProps, prevProps) {
50384
+ cov_169joloac6().f[1]++;
50385
+ cov_169joloac6().s[4]++;
50386
+ return nextProps.debouncedPlaceholder !== prevProps.debouncedPlaceholder;
50387
+ }
50334
50388
  }, function (_ref3) {
50335
50389
  var field = _ref3.field,
50336
50390
  form = _ref3.form,
50337
50391
  meta = _ref3.meta;
50338
- cov_169joloac6().f[1]++;
50339
- cov_169joloac6().s[3]++;
50392
+ cov_169joloac6().f[2]++;
50393
+ cov_169joloac6().s[5]++;
50340
50394
  return /*#__PURE__*/React__default.createElement(Editor$1, _extends$8({
50341
50395
  className: "neeto-form-engine-rich-text-input",
50342
50396
  error: meta.touched ? (cov_169joloac6().b[3][0]++, meta.error) : (cov_169joloac6().b[3][1]++, ""),
50343
50397
  initialValue: field.value,
50344
- placeholder: placeholder,
50398
+ key: debouncedPlaceholder,
50399
+ placeholder: debouncedPlaceholder,
50345
50400
  ref: editorRef,
50346
50401
  addons: ["attachments", "block-quote", "code-block", "image-upload"],
50347
50402
  onBlur: function onBlur() {
50348
- cov_169joloac6().f[2]++;
50349
- cov_169joloac6().s[4]++;
50403
+ cov_169joloac6().f[3]++;
50404
+ cov_169joloac6().s[6]++;
50350
50405
  return form.setFieldTouched(name, true);
50351
50406
  },
50352
50407
  onChange: function onChange(value) {
50353
- cov_169joloac6().f[3]++;
50354
- cov_169joloac6().s[5]++;
50408
+ cov_169joloac6().f[4]++;
50409
+ cov_169joloac6().s[7]++;
50355
50410
  return form.setFieldValue(name, value);
50356
50411
  }
50357
50412
  }, editorProps));