@bigbinary/neeto-editor 1.43.29 → 1.43.30
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/FormikEditor.js
CHANGED
|
@@ -119,12 +119,21 @@ var FormikEditor = function FormikEditor(_ref, ref) {
|
|
|
119
119
|
_ref$variables = _ref.variables,
|
|
120
120
|
variables = _ref$variables === void 0 ? [] : _ref$variables,
|
|
121
121
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
122
|
+
// Similar to the `shouldComponentUpdate` logic of FastField component.
|
|
123
|
+
// https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FastField.tsx#L75-L93
|
|
124
|
+
// Additionally calls the shouldUpdate function passed from the host application and compares to
|
|
125
|
+
// the rest of the values.
|
|
126
|
+
var internalShouldUpdate = function internalShouldUpdate(prevProps, nextProps) {
|
|
127
|
+
var prevFormikProps = prevProps.formik;
|
|
128
|
+
var nextFormikProps = nextProps.formik;
|
|
129
|
+
return prevFormikProps.errors[name] !== nextFormikProps.errors[name] || prevFormikProps.touched[name] !== nextFormikProps.touched[name] || Object.keys(nextProps).length !== Object.keys(prevProps).length || prevFormikProps.isSubmitting !== nextFormikProps.isSubmitting || Boolean(shouldUpdate === null || shouldUpdate === void 0 ? void 0 : shouldUpdate(prevProps, nextProps));
|
|
130
|
+
};
|
|
122
131
|
return /*#__PURE__*/jsx(FastField, {
|
|
123
132
|
attachments: attachments,
|
|
124
133
|
mentions: mentions,
|
|
125
134
|
name: name,
|
|
126
|
-
shouldUpdate: shouldUpdate,
|
|
127
135
|
variables: variables,
|
|
136
|
+
shouldUpdate: internalShouldUpdate,
|
|
128
137
|
children: function children(_ref2) {
|
|
129
138
|
var field = _ref2.field,
|
|
130
139
|
form = _ref2.form,
|
|
@@ -138,7 +147,7 @@ var FormikEditor = function FormikEditor(_ref, ref) {
|
|
|
138
147
|
error: meta.touched ? meta.error : "",
|
|
139
148
|
initialValue: field.value,
|
|
140
149
|
onBlur: function onBlur() {
|
|
141
|
-
|
|
150
|
+
form.setFieldTouched(name, true);
|
|
142
151
|
},
|
|
143
152
|
onChange: function onChange(value) {
|
|
144
153
|
form.setFieldValue(name, value);
|
package/dist/FormikEditor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormikEditor.js","sources":["../src/components/Editor/FormikEditor.jsx"],"sourcesContent":["import { forwardRef, memo } from \"react\";\n\nimport { FastField } from \"formik\";\nimport { noop } from \"neetocist\";\n\nimport Editor from \".\";\n\nconst FormikEditor = (\n {\n name,\n onChange = noop,\n shouldUpdate,\n attachments = [],\n mentions = [],\n variables = [],\n ...otherProps\n },\n ref\n) => (\n <FastField
|
|
1
|
+
{"version":3,"file":"FormikEditor.js","sources":["../src/components/Editor/FormikEditor.jsx"],"sourcesContent":["import { forwardRef, memo } from \"react\";\n\nimport { FastField } from \"formik\";\nimport { noop } from \"neetocist\";\n\nimport Editor from \".\";\n\nconst FormikEditor = (\n {\n name,\n onChange = noop,\n shouldUpdate,\n attachments = [],\n mentions = [],\n variables = [],\n ...otherProps\n },\n ref\n) => {\n // Similar to the `shouldComponentUpdate` logic of FastField component.\n // https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FastField.tsx#L75-L93\n // Additionally calls the shouldUpdate function passed from the host application and compares to\n // the rest of the values.\n const internalShouldUpdate = (prevProps, nextProps) => {\n const prevFormikProps = prevProps.formik;\n const nextFormikProps = nextProps.formik;\n\n return (\n prevFormikProps.errors[name] !== nextFormikProps.errors[name] ||\n prevFormikProps.touched[name] !== nextFormikProps.touched[name] ||\n Object.keys(nextProps).length !== Object.keys(prevProps).length ||\n prevFormikProps.isSubmitting !== nextFormikProps.isSubmitting ||\n Boolean(shouldUpdate?.(prevProps, nextProps))\n );\n };\n\n return (\n <FastField\n {...{ attachments, mentions, name, variables }}\n shouldUpdate={internalShouldUpdate}\n >\n {({ field, form, meta }) => (\n <Editor\n {...{ attachments, mentions, name, ref, variables }}\n error={meta.touched ? meta.error : \"\"}\n initialValue={field.value}\n onBlur={() => {\n form.setFieldTouched(name, true);\n }}\n onChange={value => {\n form.setFieldValue(name, value);\n onChange?.(value);\n }}\n {...otherProps}\n />\n )}\n </FastField>\n );\n};\n\nFormikEditor.displayName = \"FormikNeetoEditor\";\n\nexport default memo(forwardRef(FormikEditor));\n"],"names":["FormikEditor","_ref","ref","name","_ref$onChange","onChange","noop","shouldUpdate","_ref$attachments","attachments","_ref$mentions","mentions","_ref$variables","variables","otherProps","_objectWithoutProperties","_excluded","internalShouldUpdate","prevProps","nextProps","prevFormikProps","formik","nextFormikProps","errors","touched","Object","keys","length","isSubmitting","Boolean","_jsx","FastField","children","_ref2","field","form","meta","Editor","_objectSpread","error","initialValue","value","onBlur","setFieldTouched","setFieldValue","displayName","memo","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAUhBC,GAAG,EACA;AAAA,EAAA,IATDC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAAC,aAAA,GAAAH,IAAA,CACJI,QAAQ;AAARA,IAAAA,SAAQ,GAAAD,aAAA,KAAGE,KAAAA,CAAAA,GAAAA,IAAI,GAAAF,aAAA;IACfG,YAAY,GAAAN,IAAA,CAAZM,YAAY;IAAAC,gBAAA,GAAAP,IAAA,CACZQ,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,gBAAA;IAAAE,aAAA,GAAAT,IAAA,CAChBU,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,aAAA;IAAAE,cAAA,GAAAX,IAAA,CACbY,SAAS;AAATA,IAAAA,SAAS,GAAAD,cA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AA,CAAJG,IAAI,CAAA;AAAA,MAAA,oBACnBN,GAAA,CAACO,MAAM,EAAAC,aAAA,CAAA;AACC7B,QAAAA,WAAW,EAAXA,WAAW;AAAEE,QAAAA,QAAQ,EAARA,QAAQ;AAAER,QAAAA,IAAI,EAAJA,IAAI;AAAED,QAAAA,GAAG,EAAHA,GAAG;AAAEW,QAAAA,SAAS,EAATA,SAAS;QACjD0B,KAAK,EAAEH,IAAI,CAACZ,OAAO,GAAGY,IAAI,CAACG,KAAK,GAAG,EAAG;QACtCC,YAAY,EAAEN,KAAK,CAACO,KAAM;QAC1BC,MAAM,EAAE,SAAAA,MAAAA,GAAM;AACZP,UAAAA,IAAI,CAACQ,eAAe,CAACxC,IAAI,EAAE,IAAI,CAAC,CAAA;SAChC;AACFE,QAAAA,QAAQ,EAAE,SAAAA,QAAAoC,CAAAA,KAAK,EAAI;AACjBN,UAAAA,IAAI,CAACS,aAAa,CAACzC,IAAI,EAAEsC,KAAK,CAAC,CAAA;AAC/BpC,UAAAA,SAAQ,aAARA,SAAQ,KAAA,KAAA,CAAA,IAARA,SAAQ,CAAGoC,KAAK,CAAC,CAAA;AACnB,SAAA;OACI3B,EAAAA,UAAU,CACf,CAAC,CAAA;AAAA,KAAA;AACH,GACQ,CAAC,CAAA;AAEhB,CAAC,CAAA;AAEDd,YAAY,CAAC6C,WAAW,GAAG,mBAAmB,CAAA;AAE9C,qBAAA,aAAeC,IAAI,eAACC,UAAU,CAAC/C,YAAY,CAAC,CAAC;;;;"}
|
|
@@ -121,12 +121,21 @@ var FormikEditor = function FormikEditor(_ref, ref) {
|
|
|
121
121
|
_ref$variables = _ref.variables,
|
|
122
122
|
variables = _ref$variables === void 0 ? [] : _ref$variables,
|
|
123
123
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
124
|
+
// Similar to the `shouldComponentUpdate` logic of FastField component.
|
|
125
|
+
// https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FastField.tsx#L75-L93
|
|
126
|
+
// Additionally calls the shouldUpdate function passed from the host application and compares to
|
|
127
|
+
// the rest of the values.
|
|
128
|
+
var internalShouldUpdate = function internalShouldUpdate(prevProps, nextProps) {
|
|
129
|
+
var prevFormikProps = prevProps.formik;
|
|
130
|
+
var nextFormikProps = nextProps.formik;
|
|
131
|
+
return prevFormikProps.errors[name] !== nextFormikProps.errors[name] || prevFormikProps.touched[name] !== nextFormikProps.touched[name] || Object.keys(nextProps).length !== Object.keys(prevProps).length || prevFormikProps.isSubmitting !== nextFormikProps.isSubmitting || Boolean(shouldUpdate === null || shouldUpdate === void 0 ? void 0 : shouldUpdate(prevProps, nextProps));
|
|
132
|
+
};
|
|
124
133
|
return /*#__PURE__*/jsxRuntime.jsx(formik.FastField, {
|
|
125
134
|
attachments: attachments,
|
|
126
135
|
mentions: mentions,
|
|
127
136
|
name: name,
|
|
128
|
-
shouldUpdate: shouldUpdate,
|
|
129
137
|
variables: variables,
|
|
138
|
+
shouldUpdate: internalShouldUpdate,
|
|
130
139
|
children: function children(_ref2) {
|
|
131
140
|
var field = _ref2.field,
|
|
132
141
|
form = _ref2.form,
|
|
@@ -140,7 +149,7 @@ var FormikEditor = function FormikEditor(_ref, ref) {
|
|
|
140
149
|
error: meta.touched ? meta.error : "",
|
|
141
150
|
initialValue: field.value,
|
|
142
151
|
onBlur: function onBlur() {
|
|
143
|
-
|
|
152
|
+
form.setFieldTouched(name, true);
|
|
144
153
|
},
|
|
145
154
|
onChange: function onChange(value) {
|
|
146
155
|
form.setFieldValue(name, value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormikEditor.cjs.js","sources":["../../src/components/Editor/FormikEditor.jsx"],"sourcesContent":["import { forwardRef, memo } from \"react\";\n\nimport { FastField } from \"formik\";\nimport { noop } from \"neetocist\";\n\nimport Editor from \".\";\n\nconst FormikEditor = (\n {\n name,\n onChange = noop,\n shouldUpdate,\n attachments = [],\n mentions = [],\n variables = [],\n ...otherProps\n },\n ref\n) => (\n <FastField
|
|
1
|
+
{"version":3,"file":"FormikEditor.cjs.js","sources":["../../src/components/Editor/FormikEditor.jsx"],"sourcesContent":["import { forwardRef, memo } from \"react\";\n\nimport { FastField } from \"formik\";\nimport { noop } from \"neetocist\";\n\nimport Editor from \".\";\n\nconst FormikEditor = (\n {\n name,\n onChange = noop,\n shouldUpdate,\n attachments = [],\n mentions = [],\n variables = [],\n ...otherProps\n },\n ref\n) => {\n // Similar to the `shouldComponentUpdate` logic of FastField component.\n // https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FastField.tsx#L75-L93\n // Additionally calls the shouldUpdate function passed from the host application and compares to\n // the rest of the values.\n const internalShouldUpdate = (prevProps, nextProps) => {\n const prevFormikProps = prevProps.formik;\n const nextFormikProps = nextProps.formik;\n\n return (\n prevFormikProps.errors[name] !== nextFormikProps.errors[name] ||\n prevFormikProps.touched[name] !== nextFormikProps.touched[name] ||\n Object.keys(nextProps).length !== Object.keys(prevProps).length ||\n prevFormikProps.isSubmitting !== nextFormikProps.isSubmitting ||\n Boolean(shouldUpdate?.(prevProps, nextProps))\n );\n };\n\n return (\n <FastField\n {...{ attachments, mentions, name, variables }}\n shouldUpdate={internalShouldUpdate}\n >\n {({ field, form, meta }) => (\n <Editor\n {...{ attachments, mentions, name, ref, variables }}\n error={meta.touched ? meta.error : \"\"}\n initialValue={field.value}\n onBlur={() => {\n form.setFieldTouched(name, true);\n }}\n onChange={value => {\n form.setFieldValue(name, value);\n onChange?.(value);\n }}\n {...otherProps}\n />\n )}\n </FastField>\n );\n};\n\nFormikEditor.displayName = \"FormikNeetoEditor\";\n\nexport default memo(forwardRef(FormikEditor));\n"],"names":["FormikEditor","_ref","ref","name","_ref$onChange","onChange","noop","shouldUpdate","_ref$attachments","attachments","_ref$mentions","mentions","_ref$variables","variables","otherProps","_objectWithoutProperties","_excluded","internalShouldUpdate","prevProps","nextProps","prevFormikProps","formik","nextFormikProps","errors","touched","Object","keys","length","isSubmitting","Boolean","_jsx","FastField","children","_ref2","field","form","meta","Editor","_objectSpread","error","initialValue","value","onBlur","setFieldTouched","setFieldValue","displayName","memo","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAUhBC,GAAG,EACA;AAAA,EAAA,IATDC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAAC,aAAA,GAAAH,IAAA,CACJI,QAAQ;AAARA,IAAAA,SAAQ,GAAAD,aAAA,KAAGE,KAAAA,CAAAA,GAAAA,cAAI,GAAAF,aAAA;IACfG,YAAY,GAAAN,IAAA,CAAZM,YAAY;IAAAC,gBAAA,GAAAP,IAAA,CACZQ,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,gBAAA;IAAAE,aAAA,GAAAT,IAAA,CAChBU,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,aAAA;IAAAE,cAAA,GAAAX,IAAA,CACbY,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,cAAA;AACXE,IAAAA,UAAU,GAAAC,wBAAA,CAAAd,IAAA,EAAAe,SAAA,CAAA,CAAA;AAIf;AACA;AACA;AACA;EACA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIC,SAAS,EAAEC,SAAS,EAAK;AACrD,IAAA,IAAMC,eAAe,GAAGF,SAAS,CAACG,MAAM,CAAA;AACxC,IAAA,IAAMC,eAAe,GAAGH,SAAS,CAACE,MAAM,CAAA;AAExC,IAAA,OACED,eAAe,CAACG,MAAM,CAACpB,IAAI,CAAC,KAAKmB,eAAe,CAACC,MAAM,CAACpB,IAAI,CAAC,IAC7D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