eddev 0.3.26 → 0.3.28
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/blocks/ContentBlocks.js +1 -1
- package/blocks/blockAttributes.d.ts +2 -0
- package/blocks/blockAttributes.js +7 -1
- package/blocks/index.d.ts +1 -1
- package/blocks/index.js +4 -1
- package/blocks/installGutenbergHooks.js +1 -1
- package/gravityforms/useGravityForm.js +17 -15
- package/package-lock.json +13535 -0
- package/package.json +1 -1
package/blocks/ContentBlocks.js
CHANGED
|
@@ -80,7 +80,7 @@ function ContentBlocks(props) {
|
|
|
80
80
|
var Component = blockTypes[block.blockName];
|
|
81
81
|
if (!Component)
|
|
82
82
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {}, void 0);
|
|
83
|
-
blockNode = ((0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ block: [block.blockName, block.props], values: block.inline, innerBlocks: block.innerBlocks }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, block.props, { innerHTML: block.innerHTML,
|
|
83
|
+
blockNode = ((0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ block: [block.blockName, block.props], values: block.inline, innerBlocks: block.innerBlocks, index: index }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, block.props, { innerHTML: block.innerHTML,
|
|
84
84
|
// innerBlocks={block.innerBlocks}
|
|
85
85
|
children: Array.isArray(block.innerBlocks) && block.innerBlocks.length ? ((0, jsx_runtime_1.jsx)(ContentBlocks, { blocks: block.innerBlocks }, void 0)) : null }), void 0) }), void 0));
|
|
86
86
|
}
|
|
@@ -9,10 +9,12 @@ declare type ProviderProps = PropsWithChildren<{
|
|
|
9
9
|
block: [string, Attributes];
|
|
10
10
|
onChange?: (attrs: Attributes) => void;
|
|
11
11
|
insertBlocksAfter?: (block: any) => void;
|
|
12
|
+
index: number;
|
|
12
13
|
}>;
|
|
13
14
|
export declare function InlineEditingContextProvider(props: ProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export declare function useInlineEditableValue<T>(key: string, defaultValue?: T): [T, (value: T) => void];
|
|
15
16
|
export declare function useBlockAppender(): ((block: any) => void) | undefined;
|
|
16
17
|
export declare function useInnerBlocks(): ContentBlock[];
|
|
17
18
|
export declare function useBlockParents(): [string, Attributes][];
|
|
19
|
+
export declare function useBlockIndex(): number;
|
|
18
20
|
export {};
|
|
@@ -20,7 +20,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.useBlockParents = exports.useInnerBlocks = exports.useBlockAppender = exports.useInlineEditableValue = exports.InlineEditingContextProvider = void 0;
|
|
23
|
+
exports.useBlockIndex = exports.useBlockParents = exports.useInnerBlocks = exports.useBlockAppender = exports.useInlineEditableValue = exports.InlineEditingContextProvider = void 0;
|
|
24
24
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
25
25
|
var react_1 = require("react");
|
|
26
26
|
var InlineEditingContext = (0, react_1.createContext)(undefined);
|
|
@@ -41,6 +41,7 @@ function InlineEditingContextProvider(props) {
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
insertBlocksAfter: props.insertBlocksAfter,
|
|
44
|
+
index: props.index,
|
|
44
45
|
} }, { children: props.children }), void 0));
|
|
45
46
|
}
|
|
46
47
|
exports.InlineEditingContextProvider = InlineEditingContextProvider;
|
|
@@ -70,3 +71,8 @@ function useBlockParents() {
|
|
|
70
71
|
return (ctx === null || ctx === void 0 ? void 0 : ctx.parents) || [];
|
|
71
72
|
}
|
|
72
73
|
exports.useBlockParents = useBlockParents;
|
|
74
|
+
function useBlockIndex() {
|
|
75
|
+
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
76
|
+
return (ctx === null || ctx === void 0 ? void 0 : ctx.index) || -1;
|
|
77
|
+
}
|
|
78
|
+
exports.useBlockIndex = useBlockIndex;
|
package/blocks/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export * from "./defineBlock";
|
|
|
2
2
|
export * from "./inlineEditing";
|
|
3
3
|
export * from "./ContentBlocks";
|
|
4
4
|
export * from "./InspectorControls";
|
|
5
|
-
export { useInlineEditableValue, useInnerBlocks } from "./blockAttributes";
|
|
5
|
+
export { useInlineEditableValue, useInnerBlocks, useBlockParents, useBlockAppender, useBlockIndex, } from "./blockAttributes";
|
package/blocks/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.useInnerBlocks = exports.useInlineEditableValue = void 0;
|
|
13
|
+
exports.useBlockIndex = exports.useBlockAppender = exports.useBlockParents = exports.useInnerBlocks = exports.useInlineEditableValue = void 0;
|
|
14
14
|
__exportStar(require("./defineBlock"), exports);
|
|
15
15
|
__exportStar(require("./inlineEditing"), exports);
|
|
16
16
|
__exportStar(require("./ContentBlocks"), exports);
|
|
@@ -18,3 +18,6 @@ __exportStar(require("./InspectorControls"), exports);
|
|
|
18
18
|
var blockAttributes_1 = require("./blockAttributes");
|
|
19
19
|
Object.defineProperty(exports, "useInlineEditableValue", { enumerable: true, get: function () { return blockAttributes_1.useInlineEditableValue; } });
|
|
20
20
|
Object.defineProperty(exports, "useInnerBlocks", { enumerable: true, get: function () { return blockAttributes_1.useInnerBlocks; } });
|
|
21
|
+
Object.defineProperty(exports, "useBlockParents", { enumerable: true, get: function () { return blockAttributes_1.useBlockParents; } });
|
|
22
|
+
Object.defineProperty(exports, "useBlockAppender", { enumerable: true, get: function () { return blockAttributes_1.useBlockAppender; } });
|
|
23
|
+
Object.defineProperty(exports, "useBlockIndex", { enumerable: true, get: function () { return blockAttributes_1.useBlockIndex; } });
|
|
@@ -116,7 +116,7 @@ function installEDGutenbergHooks() {
|
|
|
116
116
|
}, []);
|
|
117
117
|
return ((0, jsx_runtime_1.jsx)(BlockContext.Provider, __assign({ value: { name: name, props: props } }, { children: (0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ values: props.attributes.inline || {}, innerBlocks: children, block: [name, props], onChange: function (attrs) {
|
|
118
118
|
props.setAttributes(__assign(__assign({}, props.attributes), { inline: attrs }));
|
|
119
|
-
}, insertBlocksAfter: props.insertBlocksAfter }, { children: edit_1.call(self, props) }), void 0) }), void 0));
|
|
119
|
+
}, insertBlocksAfter: props.insertBlocksAfter, index: -1 }, { children: edit_1.call(self, props) }), void 0) }), void 0));
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
// Remember the block type name
|
|
@@ -152,6 +152,7 @@ function useGravityForm(opts) {
|
|
|
152
152
|
dispatch({ type: "field", id: field.id, value: value });
|
|
153
153
|
} }), optionsForField(field)), { showLabel: field.labelPlacement !== "hidden_label" })); });
|
|
154
154
|
var _b = (0, react_2.useState)(null), submitter = _b[0], setSubmitter = _b[1];
|
|
155
|
+
console.log("form.fields", opts.form.fields);
|
|
155
156
|
(0, react_1.useEffect)(function () {
|
|
156
157
|
var cancelled = false;
|
|
157
158
|
setSubmitter({
|
|
@@ -184,7 +185,7 @@ function useGravityForm(opts) {
|
|
|
184
185
|
}
|
|
185
186
|
exports.useGravityForm = useGravityForm;
|
|
186
187
|
function prepareValuesPayload(form, state, data) {
|
|
187
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
188
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
188
189
|
var _loop_1 = function (field) {
|
|
189
190
|
var value = state.values[field.id];
|
|
190
191
|
var key = "input_" + field.id;
|
|
@@ -195,23 +196,24 @@ function prepareValuesPayload(form, state, data) {
|
|
|
195
196
|
}
|
|
196
197
|
else if (field.type === "consent") {
|
|
197
198
|
data.append("".concat(key, "_1"), value ? "1" : "");
|
|
198
|
-
data.append("".concat(key, ".
|
|
199
|
+
data.append("".concat(key, ".1"), value ? "1" : "");
|
|
200
|
+
data.append("".concat(key, ".2"), (_b = (_a = field === null || field === void 0 ? void 0 : field.consentText) !== null && _a !== void 0 ? _a : field === null || field === void 0 ? void 0 : field.checkboxLabel) !== null && _b !== void 0 ? _b : "");
|
|
199
201
|
data.append("".concat(key, ".3"), "2");
|
|
200
202
|
}
|
|
201
203
|
else if (field.type === "name") {
|
|
202
|
-
data.append("".concat(key, "_2"), (
|
|
203
|
-
data.append("".concat(key, "_3"), (
|
|
204
|
-
data.append("".concat(key, "_4"), (
|
|
205
|
-
data.append("".concat(key, "_6"), (
|
|
206
|
-
data.append("".concat(key, "_8"), (
|
|
204
|
+
data.append("".concat(key, "_2"), (_c = value === null || value === void 0 ? void 0 : value.prefix) !== null && _c !== void 0 ? _c : "");
|
|
205
|
+
data.append("".concat(key, "_3"), (_d = value === null || value === void 0 ? void 0 : value.first) !== null && _d !== void 0 ? _d : "");
|
|
206
|
+
data.append("".concat(key, "_4"), (_e = value === null || value === void 0 ? void 0 : value.middle) !== null && _e !== void 0 ? _e : "");
|
|
207
|
+
data.append("".concat(key, "_6"), (_f = value === null || value === void 0 ? void 0 : value.last) !== null && _f !== void 0 ? _f : "");
|
|
208
|
+
data.append("".concat(key, "_8"), (_g = value === null || value === void 0 ? void 0 : value.suffix) !== null && _g !== void 0 ? _g : "");
|
|
207
209
|
}
|
|
208
210
|
else if (field.type === "address") {
|
|
209
|
-
data.append("".concat(key, "_1"), (
|
|
210
|
-
data.append("".concat(key, "_2"), (
|
|
211
|
-
data.append("".concat(key, "_3"), (
|
|
212
|
-
data.append("".concat(key, "_4"), (
|
|
213
|
-
data.append("".concat(key, "_5"), (
|
|
214
|
-
data.append("".concat(key, "_6"), (
|
|
211
|
+
data.append("".concat(key, "_1"), (_h = value === null || value === void 0 ? void 0 : value.address1) !== null && _h !== void 0 ? _h : "");
|
|
212
|
+
data.append("".concat(key, "_2"), (_j = value === null || value === void 0 ? void 0 : value.address2) !== null && _j !== void 0 ? _j : "");
|
|
213
|
+
data.append("".concat(key, "_3"), (_k = value === null || value === void 0 ? void 0 : value.city) !== null && _k !== void 0 ? _k : "");
|
|
214
|
+
data.append("".concat(key, "_4"), (_l = value === null || value === void 0 ? void 0 : value.state) !== null && _l !== void 0 ? _l : "");
|
|
215
|
+
data.append("".concat(key, "_5"), (_m = value === null || value === void 0 ? void 0 : value.zip) !== null && _m !== void 0 ? _m : "");
|
|
216
|
+
data.append("".concat(key, "_6"), (_o = value === null || value === void 0 ? void 0 : value.country) !== null && _o !== void 0 ? _o : "");
|
|
215
217
|
}
|
|
216
218
|
else if (field.type === "captcha") {
|
|
217
219
|
data.append("g-recaptcha-response", value);
|
|
@@ -236,8 +238,8 @@ function prepareValuesPayload(form, state, data) {
|
|
|
236
238
|
}
|
|
237
239
|
}
|
|
238
240
|
};
|
|
239
|
-
for (var _i = 0,
|
|
240
|
-
var field =
|
|
241
|
+
for (var _i = 0, _p = form.fields; _i < _p.length; _i++) {
|
|
242
|
+
var field = _p[_i];
|
|
241
243
|
_loop_1(field);
|
|
242
244
|
}
|
|
243
245
|
}
|