@plasmicpkgs/plasmic-strapi 0.1.62 → 0.1.64
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/plasmic-strapi.cjs.development.js +98 -215
- package/dist/plasmic-strapi.cjs.development.js.map +1 -1
- package/dist/plasmic-strapi.cjs.production.min.js +1 -1
- package/dist/plasmic-strapi.cjs.production.min.js.map +1 -1
- package/dist/plasmic-strapi.esm.js +98 -215
- package/dist/plasmic-strapi.esm.js.map +1 -1
- package/package.json +8 -8
|
@@ -15,49 +15,40 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
15
15
|
reject(error);
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
if (info.done) {
|
|
20
19
|
resolve(value);
|
|
21
20
|
} else {
|
|
22
21
|
Promise.resolve(value).then(_next, _throw);
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
function _asyncToGenerator(fn) {
|
|
27
25
|
return function () {
|
|
28
26
|
var self = this,
|
|
29
|
-
|
|
27
|
+
args = arguments;
|
|
30
28
|
return new Promise(function (resolve, reject) {
|
|
31
29
|
var gen = fn.apply(self, args);
|
|
32
|
-
|
|
33
30
|
function _next(value) {
|
|
34
31
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
function _throw(err) {
|
|
38
34
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
_next(undefined);
|
|
42
37
|
});
|
|
43
38
|
};
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
function _extends() {
|
|
47
|
-
_extends = Object.assign
|
|
41
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
48
42
|
for (var i = 1; i < arguments.length; i++) {
|
|
49
43
|
var source = arguments[i];
|
|
50
|
-
|
|
51
44
|
for (var key in source) {
|
|
52
45
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
53
46
|
target[key] = source[key];
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
49
|
}
|
|
57
|
-
|
|
58
50
|
return target;
|
|
59
51
|
};
|
|
60
|
-
|
|
61
52
|
return _extends.apply(this, arguments);
|
|
62
53
|
}
|
|
63
54
|
|
|
@@ -72,17 +63,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
72
63
|
* This source code is licensed under the MIT license found in the
|
|
73
64
|
* LICENSE file in the root directory of this source tree.
|
|
74
65
|
*/
|
|
66
|
+
|
|
75
67
|
var runtime = function (exports) {
|
|
76
68
|
|
|
77
69
|
var Op = Object.prototype;
|
|
78
70
|
var hasOwn = Op.hasOwnProperty;
|
|
79
71
|
var undefined$1; // More compressible than void 0.
|
|
80
|
-
|
|
81
72
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
82
73
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
83
74
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
84
75
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
85
|
-
|
|
86
76
|
function define(obj, key, value) {
|
|
87
77
|
Object.defineProperty(obj, key, {
|
|
88
78
|
value: value,
|
|
@@ -92,7 +82,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
92
82
|
});
|
|
93
83
|
return obj[key];
|
|
94
84
|
}
|
|
95
|
-
|
|
96
85
|
try {
|
|
97
86
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
98
87
|
define({}, "");
|
|
@@ -101,19 +90,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
101
90
|
return obj[key] = value;
|
|
102
91
|
};
|
|
103
92
|
}
|
|
104
|
-
|
|
105
93
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
106
94
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
107
95
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
108
96
|
var generator = Object.create(protoGenerator.prototype);
|
|
109
|
-
var context = new Context(tryLocsList || []);
|
|
110
|
-
// .throw, and .return methods.
|
|
97
|
+
var context = new Context(tryLocsList || []);
|
|
111
98
|
|
|
99
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
100
|
+
// .throw, and .return methods.
|
|
112
101
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
113
102
|
return generator;
|
|
114
103
|
}
|
|
104
|
+
exports.wrap = wrap;
|
|
115
105
|
|
|
116
|
-
|
|
106
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
117
107
|
// record like context.tryEntries[i].completion. This interface could
|
|
118
108
|
// have been (and was previously) designed to take a closure to be
|
|
119
109
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -123,7 +113,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
123
113
|
// in every case, so we don't have to touch the arguments object. The
|
|
124
114
|
// only additional allocation required is the completion record, which
|
|
125
115
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
126
|
-
|
|
127
116
|
function tryCatch(fn, obj, arg) {
|
|
128
117
|
try {
|
|
129
118
|
return {
|
|
@@ -137,46 +126,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
137
126
|
};
|
|
138
127
|
}
|
|
139
128
|
}
|
|
140
|
-
|
|
141
129
|
var GenStateSuspendedStart = "suspendedStart";
|
|
142
130
|
var GenStateSuspendedYield = "suspendedYield";
|
|
143
131
|
var GenStateExecuting = "executing";
|
|
144
|
-
var GenStateCompleted = "completed";
|
|
132
|
+
var GenStateCompleted = "completed";
|
|
133
|
+
|
|
134
|
+
// Returning this object from the innerFn has the same effect as
|
|
145
135
|
// breaking out of the dispatch switch statement.
|
|
136
|
+
var ContinueSentinel = {};
|
|
146
137
|
|
|
147
|
-
|
|
138
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
148
139
|
// .constructor.prototype properties for functions that return Generator
|
|
149
140
|
// objects. For full spec compliance, you may wish to configure your
|
|
150
141
|
// minifier not to mangle the names of these two functions.
|
|
151
|
-
|
|
152
142
|
function Generator() {}
|
|
153
|
-
|
|
154
143
|
function GeneratorFunction() {}
|
|
144
|
+
function GeneratorFunctionPrototype() {}
|
|
155
145
|
|
|
156
|
-
|
|
146
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
157
147
|
// don't natively support it.
|
|
158
|
-
|
|
159
|
-
|
|
160
148
|
var IteratorPrototype = {};
|
|
161
149
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
162
150
|
return this;
|
|
163
151
|
});
|
|
164
152
|
var getProto = Object.getPrototypeOf;
|
|
165
153
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
166
|
-
|
|
167
154
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
168
155
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
169
156
|
// of the polyfill.
|
|
170
157
|
IteratorPrototype = NativeIteratorPrototype;
|
|
171
158
|
}
|
|
172
|
-
|
|
173
159
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
174
160
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
175
161
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
176
162
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
177
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
178
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
163
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
179
164
|
|
|
165
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
166
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
180
167
|
function defineIteratorMethods(prototype) {
|
|
181
168
|
["next", "throw", "return"].forEach(function (method) {
|
|
182
169
|
define(prototype, method, function (arg) {
|
|
@@ -184,14 +171,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
184
171
|
});
|
|
185
172
|
});
|
|
186
173
|
}
|
|
187
|
-
|
|
188
174
|
exports.isGeneratorFunction = function (genFun) {
|
|
189
175
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
190
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
176
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
177
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
191
178
|
// do is to check its .name property.
|
|
192
179
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
193
180
|
};
|
|
194
|
-
|
|
195
181
|
exports.mark = function (genFun) {
|
|
196
182
|
if (Object.setPrototypeOf) {
|
|
197
183
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -199,31 +185,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
199
185
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
200
186
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
201
187
|
}
|
|
202
|
-
|
|
203
188
|
genFun.prototype = Object.create(Gp);
|
|
204
189
|
return genFun;
|
|
205
|
-
};
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// Within the body of any async function, `await x` is transformed to
|
|
206
193
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
207
194
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
208
195
|
// meant to be awaited.
|
|
209
|
-
|
|
210
|
-
|
|
211
196
|
exports.awrap = function (arg) {
|
|
212
197
|
return {
|
|
213
198
|
__await: arg
|
|
214
199
|
};
|
|
215
200
|
};
|
|
216
|
-
|
|
217
201
|
function AsyncIterator(generator, PromiseImpl) {
|
|
218
202
|
function invoke(method, arg, resolve, reject) {
|
|
219
203
|
var record = tryCatch(generator[method], generator, arg);
|
|
220
|
-
|
|
221
204
|
if (record.type === "throw") {
|
|
222
205
|
reject(record.arg);
|
|
223
206
|
} else {
|
|
224
207
|
var result = record.arg;
|
|
225
208
|
var value = result.value;
|
|
226
|
-
|
|
227
209
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
228
210
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
229
211
|
invoke("next", value, resolve, reject);
|
|
@@ -231,7 +213,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
231
213
|
invoke("throw", err, resolve, reject);
|
|
232
214
|
});
|
|
233
215
|
}
|
|
234
|
-
|
|
235
216
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
236
217
|
// When a yielded Promise is resolved, its final value becomes
|
|
237
218
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -245,17 +226,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
245
226
|
});
|
|
246
227
|
}
|
|
247
228
|
}
|
|
248
|
-
|
|
249
229
|
var previousPromise;
|
|
250
|
-
|
|
251
230
|
function enqueue(method, arg) {
|
|
252
231
|
function callInvokeWithMethodAndArg() {
|
|
253
232
|
return new PromiseImpl(function (resolve, reject) {
|
|
254
233
|
invoke(method, arg, resolve, reject);
|
|
255
234
|
});
|
|
256
235
|
}
|
|
257
|
-
|
|
258
|
-
|
|
236
|
+
return previousPromise =
|
|
237
|
+
// If enqueue has been called before, then we want to wait until
|
|
259
238
|
// all previous Promises have been resolved before calling invoke,
|
|
260
239
|
// so that results are always delivered in the correct order. If
|
|
261
240
|
// enqueue has not been called before, then it is important to
|
|
@@ -267,24 +246,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
267
246
|
// execute code before the first await. Since we implement simple
|
|
268
247
|
// async functions in terms of async generators, it is especially
|
|
269
248
|
// important to get this right, even though it requires care.
|
|
270
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
249
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
250
|
+
// Avoid propagating failures to Promises returned by later
|
|
271
251
|
// invocations of the iterator.
|
|
272
252
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
273
|
-
}
|
|
274
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
275
|
-
|
|
253
|
+
}
|
|
276
254
|
|
|
255
|
+
// Define the unified helper method that is used to implement .next,
|
|
256
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
277
257
|
this._invoke = enqueue;
|
|
278
258
|
}
|
|
279
|
-
|
|
280
259
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
281
260
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
282
261
|
return this;
|
|
283
262
|
});
|
|
284
|
-
exports.AsyncIterator = AsyncIterator;
|
|
263
|
+
exports.AsyncIterator = AsyncIterator;
|
|
264
|
+
|
|
265
|
+
// Note that simple async functions are implemented on top of
|
|
285
266
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
286
267
|
// the final result produced by the iterator.
|
|
287
|
-
|
|
288
268
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
289
269
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
290
270
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -293,39 +273,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
293
273
|
return result.done ? result.value : iter.next();
|
|
294
274
|
});
|
|
295
275
|
};
|
|
296
|
-
|
|
297
276
|
function makeInvokeMethod(innerFn, self, context) {
|
|
298
277
|
var state = GenStateSuspendedStart;
|
|
299
278
|
return function invoke(method, arg) {
|
|
300
279
|
if (state === GenStateExecuting) {
|
|
301
280
|
throw new Error("Generator is already running");
|
|
302
281
|
}
|
|
303
|
-
|
|
304
282
|
if (state === GenStateCompleted) {
|
|
305
283
|
if (method === "throw") {
|
|
306
284
|
throw arg;
|
|
307
|
-
}
|
|
308
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
309
|
-
|
|
285
|
+
}
|
|
310
286
|
|
|
287
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
288
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
311
289
|
return doneResult();
|
|
312
290
|
}
|
|
313
|
-
|
|
314
291
|
context.method = method;
|
|
315
292
|
context.arg = arg;
|
|
316
|
-
|
|
317
293
|
while (true) {
|
|
318
294
|
var delegate = context.delegate;
|
|
319
|
-
|
|
320
295
|
if (delegate) {
|
|
321
296
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
322
|
-
|
|
323
297
|
if (delegateResult) {
|
|
324
298
|
if (delegateResult === ContinueSentinel) continue;
|
|
325
299
|
return delegateResult;
|
|
326
300
|
}
|
|
327
301
|
}
|
|
328
|
-
|
|
329
302
|
if (context.method === "next") {
|
|
330
303
|
// Setting context._sent for legacy support of Babel's
|
|
331
304
|
// function.sent implementation.
|
|
@@ -335,51 +308,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
335
308
|
state = GenStateCompleted;
|
|
336
309
|
throw context.arg;
|
|
337
310
|
}
|
|
338
|
-
|
|
339
311
|
context.dispatchException(context.arg);
|
|
340
312
|
} else if (context.method === "return") {
|
|
341
313
|
context.abrupt("return", context.arg);
|
|
342
314
|
}
|
|
343
|
-
|
|
344
315
|
state = GenStateExecuting;
|
|
345
316
|
var record = tryCatch(innerFn, self, context);
|
|
346
|
-
|
|
347
317
|
if (record.type === "normal") {
|
|
348
318
|
// If an exception is thrown from innerFn, we leave state ===
|
|
349
319
|
// GenStateExecuting and loop back for another invocation.
|
|
350
320
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
351
|
-
|
|
352
321
|
if (record.arg === ContinueSentinel) {
|
|
353
322
|
continue;
|
|
354
323
|
}
|
|
355
|
-
|
|
356
324
|
return {
|
|
357
325
|
value: record.arg,
|
|
358
326
|
done: context.done
|
|
359
327
|
};
|
|
360
328
|
} else if (record.type === "throw") {
|
|
361
|
-
state = GenStateCompleted;
|
|
329
|
+
state = GenStateCompleted;
|
|
330
|
+
// Dispatch the exception by looping back around to the
|
|
362
331
|
// context.dispatchException(context.arg) call above.
|
|
363
|
-
|
|
364
332
|
context.method = "throw";
|
|
365
333
|
context.arg = record.arg;
|
|
366
334
|
}
|
|
367
335
|
}
|
|
368
336
|
};
|
|
369
|
-
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
370
340
|
// result, either by returning a { value, done } result from the
|
|
371
341
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
372
342
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
373
|
-
|
|
374
|
-
|
|
375
343
|
function maybeInvokeDelegate(delegate, context) {
|
|
376
344
|
var method = delegate.iterator[context.method];
|
|
377
|
-
|
|
378
345
|
if (method === undefined$1) {
|
|
379
346
|
// A .throw or .return when the delegate iterator has no .throw
|
|
380
347
|
// method always terminates the yield* loop.
|
|
381
348
|
context.delegate = null;
|
|
382
|
-
|
|
383
349
|
if (context.method === "throw") {
|
|
384
350
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
385
351
|
if (delegate.iterator["return"]) {
|
|
@@ -388,51 +354,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
388
354
|
context.method = "return";
|
|
389
355
|
context.arg = undefined$1;
|
|
390
356
|
maybeInvokeDelegate(delegate, context);
|
|
391
|
-
|
|
392
357
|
if (context.method === "throw") {
|
|
393
358
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
394
359
|
// "return" to "throw", let that override the TypeError below.
|
|
395
360
|
return ContinueSentinel;
|
|
396
361
|
}
|
|
397
362
|
}
|
|
398
|
-
|
|
399
363
|
context.method = "throw";
|
|
400
364
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
401
365
|
}
|
|
402
|
-
|
|
403
366
|
return ContinueSentinel;
|
|
404
367
|
}
|
|
405
|
-
|
|
406
368
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
407
|
-
|
|
408
369
|
if (record.type === "throw") {
|
|
409
370
|
context.method = "throw";
|
|
410
371
|
context.arg = record.arg;
|
|
411
372
|
context.delegate = null;
|
|
412
373
|
return ContinueSentinel;
|
|
413
374
|
}
|
|
414
|
-
|
|
415
375
|
var info = record.arg;
|
|
416
|
-
|
|
417
376
|
if (!info) {
|
|
418
377
|
context.method = "throw";
|
|
419
378
|
context.arg = new TypeError("iterator result is not an object");
|
|
420
379
|
context.delegate = null;
|
|
421
380
|
return ContinueSentinel;
|
|
422
381
|
}
|
|
423
|
-
|
|
424
382
|
if (info.done) {
|
|
425
383
|
// Assign the result of the finished delegate to the temporary
|
|
426
384
|
// variable specified by delegate.resultName (see delegateYield).
|
|
427
|
-
context[delegate.resultName] = info.value;
|
|
385
|
+
context[delegate.resultName] = info.value;
|
|
386
|
+
|
|
387
|
+
// Resume execution at the desired location (see delegateYield).
|
|
388
|
+
context.next = delegate.nextLoc;
|
|
428
389
|
|
|
429
|
-
|
|
390
|
+
// If context.method was "throw" but the delegate handled the
|
|
430
391
|
// exception, let the outer generator proceed normally. If
|
|
431
392
|
// context.method was "next", forget context.arg since it has been
|
|
432
393
|
// "consumed" by the delegate iterator. If context.method was
|
|
433
394
|
// "return", allow the original .return call to continue in the
|
|
434
395
|
// outer generator.
|
|
435
|
-
|
|
436
396
|
if (context.method !== "return") {
|
|
437
397
|
context.method = "next";
|
|
438
398
|
context.arg = undefined$1;
|
|
@@ -440,54 +400,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
440
400
|
} else {
|
|
441
401
|
// Re-yield the result returned by the delegate method.
|
|
442
402
|
return info;
|
|
443
|
-
}
|
|
444
|
-
// the outer generator.
|
|
445
|
-
|
|
403
|
+
}
|
|
446
404
|
|
|
405
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
406
|
+
// the outer generator.
|
|
447
407
|
context.delegate = null;
|
|
448
408
|
return ContinueSentinel;
|
|
449
|
-
}
|
|
450
|
-
// unified ._invoke helper method.
|
|
451
|
-
|
|
409
|
+
}
|
|
452
410
|
|
|
411
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
412
|
+
// unified ._invoke helper method.
|
|
453
413
|
defineIteratorMethods(Gp);
|
|
454
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
414
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
415
|
+
|
|
416
|
+
// A Generator should always return itself as the iterator object when the
|
|
455
417
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
456
418
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
457
419
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
458
420
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
459
|
-
|
|
460
421
|
define(Gp, iteratorSymbol, function () {
|
|
461
422
|
return this;
|
|
462
423
|
});
|
|
463
424
|
define(Gp, "toString", function () {
|
|
464
425
|
return "[object Generator]";
|
|
465
426
|
});
|
|
466
|
-
|
|
467
427
|
function pushTryEntry(locs) {
|
|
468
428
|
var entry = {
|
|
469
429
|
tryLoc: locs[0]
|
|
470
430
|
};
|
|
471
|
-
|
|
472
431
|
if (1 in locs) {
|
|
473
432
|
entry.catchLoc = locs[1];
|
|
474
433
|
}
|
|
475
|
-
|
|
476
434
|
if (2 in locs) {
|
|
477
435
|
entry.finallyLoc = locs[2];
|
|
478
436
|
entry.afterLoc = locs[3];
|
|
479
437
|
}
|
|
480
|
-
|
|
481
438
|
this.tryEntries.push(entry);
|
|
482
439
|
}
|
|
483
|
-
|
|
484
440
|
function resetTryEntry(entry) {
|
|
485
441
|
var record = entry.completion || {};
|
|
486
442
|
record.type = "normal";
|
|
487
443
|
delete record.arg;
|
|
488
444
|
entry.completion = record;
|
|
489
445
|
}
|
|
490
|
-
|
|
491
446
|
function Context(tryLocsList) {
|
|
492
447
|
// The root entry object (effectively a try statement without a catch
|
|
493
448
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -498,97 +453,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
498
453
|
tryLocsList.forEach(pushTryEntry, this);
|
|
499
454
|
this.reset(true);
|
|
500
455
|
}
|
|
501
|
-
|
|
502
456
|
exports.keys = function (object) {
|
|
503
457
|
var keys = [];
|
|
504
|
-
|
|
505
458
|
for (var key in object) {
|
|
506
459
|
keys.push(key);
|
|
507
460
|
}
|
|
461
|
+
keys.reverse();
|
|
508
462
|
|
|
509
|
-
|
|
463
|
+
// Rather than returning an object with a next method, we keep
|
|
510
464
|
// things simple and return the next function itself.
|
|
511
|
-
|
|
512
465
|
return function next() {
|
|
513
466
|
while (keys.length) {
|
|
514
467
|
var key = keys.pop();
|
|
515
|
-
|
|
516
468
|
if (key in object) {
|
|
517
469
|
next.value = key;
|
|
518
470
|
next.done = false;
|
|
519
471
|
return next;
|
|
520
472
|
}
|
|
521
|
-
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// To avoid creating an additional object, we just hang the .value
|
|
522
476
|
// and .done properties off the next function object itself. This
|
|
523
477
|
// also ensures that the minifier will not anonymize the function.
|
|
524
|
-
|
|
525
|
-
|
|
526
478
|
next.done = true;
|
|
527
479
|
return next;
|
|
528
480
|
};
|
|
529
481
|
};
|
|
530
|
-
|
|
531
482
|
function values(iterable) {
|
|
532
483
|
if (iterable) {
|
|
533
484
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
534
|
-
|
|
535
485
|
if (iteratorMethod) {
|
|
536
486
|
return iteratorMethod.call(iterable);
|
|
537
487
|
}
|
|
538
|
-
|
|
539
488
|
if (typeof iterable.next === "function") {
|
|
540
489
|
return iterable;
|
|
541
490
|
}
|
|
542
|
-
|
|
543
491
|
if (!isNaN(iterable.length)) {
|
|
544
492
|
var i = -1,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
493
|
+
next = function next() {
|
|
494
|
+
while (++i < iterable.length) {
|
|
495
|
+
if (hasOwn.call(iterable, i)) {
|
|
496
|
+
next.value = iterable[i];
|
|
497
|
+
next.done = false;
|
|
498
|
+
return next;
|
|
499
|
+
}
|
|
551
500
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
return next;
|
|
557
|
-
};
|
|
558
|
-
|
|
501
|
+
next.value = undefined$1;
|
|
502
|
+
next.done = true;
|
|
503
|
+
return next;
|
|
504
|
+
};
|
|
559
505
|
return next.next = next;
|
|
560
506
|
}
|
|
561
|
-
}
|
|
562
|
-
|
|
507
|
+
}
|
|
563
508
|
|
|
509
|
+
// Return an iterator with no values.
|
|
564
510
|
return {
|
|
565
511
|
next: doneResult
|
|
566
512
|
};
|
|
567
513
|
}
|
|
568
|
-
|
|
569
514
|
exports.values = values;
|
|
570
|
-
|
|
571
515
|
function doneResult() {
|
|
572
516
|
return {
|
|
573
517
|
value: undefined$1,
|
|
574
518
|
done: true
|
|
575
519
|
};
|
|
576
520
|
}
|
|
577
|
-
|
|
578
521
|
Context.prototype = {
|
|
579
522
|
constructor: Context,
|
|
580
523
|
reset: function reset(skipTempReset) {
|
|
581
524
|
this.prev = 0;
|
|
582
|
-
this.next = 0;
|
|
525
|
+
this.next = 0;
|
|
526
|
+
// Resetting context._sent for legacy support of Babel's
|
|
583
527
|
// function.sent implementation.
|
|
584
|
-
|
|
585
528
|
this.sent = this._sent = undefined$1;
|
|
586
529
|
this.done = false;
|
|
587
530
|
this.delegate = null;
|
|
588
531
|
this.method = "next";
|
|
589
532
|
this.arg = undefined$1;
|
|
590
533
|
this.tryEntries.forEach(resetTryEntry);
|
|
591
|
-
|
|
592
534
|
if (!skipTempReset) {
|
|
593
535
|
for (var name in this) {
|
|
594
536
|
// Not sure about the optimal order of these conditions:
|
|
@@ -602,50 +544,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
602
544
|
this.done = true;
|
|
603
545
|
var rootEntry = this.tryEntries[0];
|
|
604
546
|
var rootRecord = rootEntry.completion;
|
|
605
|
-
|
|
606
547
|
if (rootRecord.type === "throw") {
|
|
607
548
|
throw rootRecord.arg;
|
|
608
549
|
}
|
|
609
|
-
|
|
610
550
|
return this.rval;
|
|
611
551
|
},
|
|
612
552
|
dispatchException: function dispatchException(exception) {
|
|
613
553
|
if (this.done) {
|
|
614
554
|
throw exception;
|
|
615
555
|
}
|
|
616
|
-
|
|
617
556
|
var context = this;
|
|
618
|
-
|
|
619
557
|
function handle(loc, caught) {
|
|
620
558
|
record.type = "throw";
|
|
621
559
|
record.arg = exception;
|
|
622
560
|
context.next = loc;
|
|
623
|
-
|
|
624
561
|
if (caught) {
|
|
625
562
|
// If the dispatched exception was caught by a catch block,
|
|
626
563
|
// then let that catch block handle the exception normally.
|
|
627
564
|
context.method = "next";
|
|
628
565
|
context.arg = undefined$1;
|
|
629
566
|
}
|
|
630
|
-
|
|
631
567
|
return !!caught;
|
|
632
568
|
}
|
|
633
|
-
|
|
634
569
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
635
570
|
var entry = this.tryEntries[i];
|
|
636
571
|
var record = entry.completion;
|
|
637
|
-
|
|
638
572
|
if (entry.tryLoc === "root") {
|
|
639
573
|
// Exception thrown outside of any try block that could handle
|
|
640
574
|
// it, so set the completion value of the entire function to
|
|
641
575
|
// throw the exception.
|
|
642
576
|
return handle("end");
|
|
643
577
|
}
|
|
644
|
-
|
|
645
578
|
if (entry.tryLoc <= this.prev) {
|
|
646
579
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
647
580
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
648
|
-
|
|
649
581
|
if (hasCatch && hasFinally) {
|
|
650
582
|
if (this.prev < entry.catchLoc) {
|
|
651
583
|
return handle(entry.catchLoc, true);
|
|
@@ -669,36 +601,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
669
601
|
abrupt: function abrupt(type, arg) {
|
|
670
602
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
671
603
|
var entry = this.tryEntries[i];
|
|
672
|
-
|
|
673
604
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
674
605
|
var finallyEntry = entry;
|
|
675
606
|
break;
|
|
676
607
|
}
|
|
677
608
|
}
|
|
678
|
-
|
|
679
609
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
680
610
|
// Ignore the finally entry if control is not jumping to a
|
|
681
611
|
// location outside the try/catch block.
|
|
682
612
|
finallyEntry = null;
|
|
683
613
|
}
|
|
684
|
-
|
|
685
614
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
686
615
|
record.type = type;
|
|
687
616
|
record.arg = arg;
|
|
688
|
-
|
|
689
617
|
if (finallyEntry) {
|
|
690
618
|
this.method = "next";
|
|
691
619
|
this.next = finallyEntry.finallyLoc;
|
|
692
620
|
return ContinueSentinel;
|
|
693
621
|
}
|
|
694
|
-
|
|
695
622
|
return this.complete(record);
|
|
696
623
|
},
|
|
697
624
|
complete: function complete(record, afterLoc) {
|
|
698
625
|
if (record.type === "throw") {
|
|
699
626
|
throw record.arg;
|
|
700
627
|
}
|
|
701
|
-
|
|
702
628
|
if (record.type === "break" || record.type === "continue") {
|
|
703
629
|
this.next = record.arg;
|
|
704
630
|
} else if (record.type === "return") {
|
|
@@ -708,13 +634,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
708
634
|
} else if (record.type === "normal" && afterLoc) {
|
|
709
635
|
this.next = afterLoc;
|
|
710
636
|
}
|
|
711
|
-
|
|
712
637
|
return ContinueSentinel;
|
|
713
638
|
},
|
|
714
639
|
finish: function finish(finallyLoc) {
|
|
715
640
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
716
641
|
var entry = this.tryEntries[i];
|
|
717
|
-
|
|
718
642
|
if (entry.finallyLoc === finallyLoc) {
|
|
719
643
|
this.complete(entry.completion, entry.afterLoc);
|
|
720
644
|
resetTryEntry(entry);
|
|
@@ -725,21 +649,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
725
649
|
"catch": function _catch(tryLoc) {
|
|
726
650
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
727
651
|
var entry = this.tryEntries[i];
|
|
728
|
-
|
|
729
652
|
if (entry.tryLoc === tryLoc) {
|
|
730
653
|
var record = entry.completion;
|
|
731
|
-
|
|
732
654
|
if (record.type === "throw") {
|
|
733
655
|
var thrown = record.arg;
|
|
734
656
|
resetTryEntry(entry);
|
|
735
657
|
}
|
|
736
|
-
|
|
737
658
|
return thrown;
|
|
738
659
|
}
|
|
739
|
-
}
|
|
740
|
-
// argument that corresponds to a known catch block.
|
|
741
|
-
|
|
660
|
+
}
|
|
742
661
|
|
|
662
|
+
// The context.catch method must only be called with a location
|
|
663
|
+
// argument that corresponds to a known catch block.
|
|
743
664
|
throw new Error("illegal catch attempt");
|
|
744
665
|
},
|
|
745
666
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -748,27 +669,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
748
669
|
resultName: resultName,
|
|
749
670
|
nextLoc: nextLoc
|
|
750
671
|
};
|
|
751
|
-
|
|
752
672
|
if (this.method === "next") {
|
|
753
673
|
// Deliberately forget the last sent value so that we don't
|
|
754
674
|
// accidentally pass it on to the delegate.
|
|
755
675
|
this.arg = undefined$1;
|
|
756
676
|
}
|
|
757
|
-
|
|
758
677
|
return ContinueSentinel;
|
|
759
678
|
}
|
|
760
|
-
};
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
761
682
|
// or not, return the runtime object so that we can declare the variable
|
|
762
683
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
763
684
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
764
|
-
|
|
765
685
|
return exports;
|
|
766
|
-
}(
|
|
686
|
+
}(
|
|
687
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
767
688
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
768
689
|
// object. Either way, the resulting object will be used to initialize
|
|
769
690
|
// the regeneratorRuntime variable at the top of this file.
|
|
770
691
|
module.exports );
|
|
771
|
-
|
|
772
692
|
try {
|
|
773
693
|
regeneratorRuntime = runtime;
|
|
774
694
|
} catch (accidentalStrictMode) {
|
|
@@ -834,11 +754,9 @@ function ensure(x) {
|
|
|
834
754
|
}
|
|
835
755
|
}
|
|
836
756
|
var modulePath = "@plasmicpkgs/plasmic-strapi";
|
|
837
|
-
|
|
838
757
|
var makeDataProviderName = function makeDataProviderName(collection) {
|
|
839
758
|
return "currentStrapi" + pascalCase(collection) + "Item";
|
|
840
759
|
};
|
|
841
|
-
|
|
842
760
|
var CredentialsContext = /*#__PURE__*/React.createContext(undefined);
|
|
843
761
|
var strapiCredentialsProviderMeta = {
|
|
844
762
|
name: "StrapiCredentialsProvider",
|
|
@@ -863,10 +781,9 @@ var strapiCredentialsProviderMeta = {
|
|
|
863
781
|
};
|
|
864
782
|
function StrapiCredentialsProvider(_ref) {
|
|
865
783
|
var _host;
|
|
866
|
-
|
|
867
784
|
var host = _ref.host,
|
|
868
|
-
|
|
869
|
-
|
|
785
|
+
token = _ref.token,
|
|
786
|
+
children = _ref.children;
|
|
870
787
|
host = ((_host = host) == null ? void 0 : _host.slice(-1)) === "/" ? host.slice(0, -1) : host;
|
|
871
788
|
return React.createElement(CredentialsContext.Provider, {
|
|
872
789
|
value: {
|
|
@@ -913,7 +830,6 @@ var strapiCollectionMeta = {
|
|
|
913
830
|
description: "Field (from Collection) to filter by",
|
|
914
831
|
options: function options(props, ctx) {
|
|
915
832
|
var _ctx$strapiFields;
|
|
916
|
-
|
|
917
833
|
return (_ctx$strapiFields = ctx == null ? void 0 : ctx.strapiFields) != null ? _ctx$strapiFields : [];
|
|
918
834
|
},
|
|
919
835
|
hidden: function hidden(props, ctx) {
|
|
@@ -965,21 +881,19 @@ var strapiCollectionMeta = {
|
|
|
965
881
|
};
|
|
966
882
|
function StrapiCollection(_ref2) {
|
|
967
883
|
var name = _ref2.name,
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
884
|
+
filterParameter = _ref2.filterParameter,
|
|
885
|
+
filterValue = _ref2.filterValue,
|
|
886
|
+
filterField = _ref2.filterField,
|
|
887
|
+
limit = _ref2.limit,
|
|
888
|
+
children = _ref2.children,
|
|
889
|
+
className = _ref2.className,
|
|
890
|
+
noLayout = _ref2.noLayout,
|
|
891
|
+
noAutoRepeat = _ref2.noAutoRepeat,
|
|
892
|
+
setControlContextData = _ref2.setControlContextData;
|
|
977
893
|
var creds = ensure(useContext(CredentialsContext));
|
|
978
|
-
|
|
979
894
|
if (!creds.host) {
|
|
980
895
|
return React.createElement("div", null, "Please specify a host.");
|
|
981
896
|
}
|
|
982
|
-
|
|
983
897
|
var query = creds.host + "/api/" + name;
|
|
984
898
|
var cacheKey = JSON.stringify({
|
|
985
899
|
creds: creds,
|
|
@@ -990,7 +904,6 @@ function StrapiCollection(_ref2) {
|
|
|
990
904
|
});
|
|
991
905
|
var data = usePlasmicQueryData(cacheKey, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
992
906
|
var _filterField, _filters;
|
|
993
|
-
|
|
994
907
|
var requestInit, queryParams, resp;
|
|
995
908
|
return runtime_1.wrap(function _callee$(_context) {
|
|
996
909
|
while (1) {
|
|
@@ -1000,20 +913,16 @@ function StrapiCollection(_ref2) {
|
|
|
1000
913
|
_context.next = 2;
|
|
1001
914
|
break;
|
|
1002
915
|
}
|
|
1003
|
-
|
|
1004
916
|
return _context.abrupt("return", null);
|
|
1005
|
-
|
|
1006
917
|
case 2:
|
|
1007
918
|
requestInit = {
|
|
1008
919
|
method: "GET"
|
|
1009
920
|
};
|
|
1010
|
-
|
|
1011
921
|
if (creds.token) {
|
|
1012
922
|
requestInit.headers = {
|
|
1013
923
|
Authorization: "Bearer " + creds.token
|
|
1014
924
|
};
|
|
1015
925
|
}
|
|
1016
|
-
|
|
1017
926
|
queryParams = stringify(_extends({}, filterField && filterParameter && filterValue ? {
|
|
1018
927
|
filters: (_filters = {}, _filters[filterField] = (_filterField = {}, _filterField[filterParameter] = filterValue, _filterField), _filters)
|
|
1019
928
|
} : {}, {
|
|
@@ -1021,11 +930,9 @@ function StrapiCollection(_ref2) {
|
|
|
1021
930
|
}));
|
|
1022
931
|
_context.next = 7;
|
|
1023
932
|
return fetch(query + "?" + queryParams, requestInit);
|
|
1024
|
-
|
|
1025
933
|
case 7:
|
|
1026
934
|
resp = _context.sent;
|
|
1027
935
|
return _context.abrupt("return", resp.json());
|
|
1028
|
-
|
|
1029
936
|
case 9:
|
|
1030
937
|
case "end":
|
|
1031
938
|
return _context.stop();
|
|
@@ -1033,21 +940,17 @@ function StrapiCollection(_ref2) {
|
|
|
1033
940
|
}
|
|
1034
941
|
}, _callee);
|
|
1035
942
|
})));
|
|
1036
|
-
|
|
1037
943
|
if (!(data != null && data.data)) {
|
|
1038
944
|
return React.createElement("div", null, "Please configure the Strapi provider with a valid host and token.");
|
|
1039
945
|
}
|
|
1040
|
-
|
|
1041
946
|
if (!get(data.data, ["data"])) {
|
|
1042
947
|
return React.createElement("div", null, "Please specify a valid collection.");
|
|
1043
948
|
}
|
|
1044
|
-
|
|
1045
949
|
var collectionData = get(data.data, ["data"]);
|
|
1046
950
|
var filterFieds = collectionData.flatMap(function (item) {
|
|
1047
951
|
var attributes = get(item, ["attributes"]);
|
|
1048
952
|
var displayableFields = Object.keys(attributes).filter(function (field) {
|
|
1049
953
|
var _value$data, _value$data$attribute;
|
|
1050
|
-
|
|
1051
954
|
var value = attributes[field];
|
|
1052
955
|
var maybeMime = (_value$data = value.data) == null ? void 0 : (_value$data$attribute = _value$data.attributes) == null ? void 0 : _value$data$attribute.mime;
|
|
1053
956
|
return typeof value !== "object" || typeof maybeMime === "string" && maybeMime.startsWith("image");
|
|
@@ -1057,37 +960,28 @@ function StrapiCollection(_ref2) {
|
|
|
1057
960
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
1058
961
|
strapiFields: uniq(filterFieds != null ? filterFieds : [])
|
|
1059
962
|
});
|
|
1060
|
-
|
|
1061
963
|
if (filterParameter && !filterValue && !filterField) {
|
|
1062
964
|
return React.createElement("div", null, "Please specify a Filter Field and a Filter Value");
|
|
1063
965
|
}
|
|
1064
|
-
|
|
1065
966
|
if (!filterParameter && filterValue && !filterField) {
|
|
1066
967
|
return React.createElement("div", null, "Please specify a Filter Parameter and a Filter Field");
|
|
1067
968
|
}
|
|
1068
|
-
|
|
1069
969
|
if (!filterParameter && !filterValue && filterField) {
|
|
1070
970
|
return React.createElement("div", null, "Please specify a Filter Parameter and a Filter Value");
|
|
1071
971
|
}
|
|
1072
|
-
|
|
1073
972
|
if (filterParameter && filterValue && !filterField) {
|
|
1074
973
|
return React.createElement("div", null, "Please specify a Filter Field");
|
|
1075
974
|
}
|
|
1076
|
-
|
|
1077
975
|
if (!filterParameter && filterValue && filterField) {
|
|
1078
976
|
return React.createElement("div", null, "Please specify a Filter Parameter");
|
|
1079
977
|
}
|
|
1080
|
-
|
|
1081
978
|
if (filterParameter && !filterValue && filterField) {
|
|
1082
979
|
return React.createElement("div", null, "Please specify a Filter Value");
|
|
1083
980
|
}
|
|
1084
|
-
|
|
1085
981
|
var collection = limit > 0 ? collectionData.slice(0, limit) : collectionData;
|
|
1086
|
-
|
|
1087
982
|
if (collection.length === 0) {
|
|
1088
983
|
return React.createElement("div", null, "No collection found ");
|
|
1089
984
|
}
|
|
1090
|
-
|
|
1091
985
|
var repElements = noAutoRepeat ? children : collection.map(function (item, index) {
|
|
1092
986
|
return React.createElement(DataProvider, {
|
|
1093
987
|
key: item.id,
|
|
@@ -1116,7 +1010,6 @@ var strapiFieldMeta = {
|
|
|
1116
1010
|
type: "choice",
|
|
1117
1011
|
options: function options(props, ctx) {
|
|
1118
1012
|
var _ctx$fields;
|
|
1119
|
-
|
|
1120
1013
|
return (_ctx$fields = ctx == null ? void 0 : ctx.fields) != null ? _ctx$fields : [];
|
|
1121
1014
|
},
|
|
1122
1015
|
displayName: "Field",
|
|
@@ -1126,21 +1019,17 @@ var strapiFieldMeta = {
|
|
|
1126
1019
|
};
|
|
1127
1020
|
function StrapiField(_ref4) {
|
|
1128
1021
|
var _data$data, _data$data$attributes;
|
|
1129
|
-
|
|
1130
1022
|
var className = _ref4.className,
|
|
1131
|
-
|
|
1132
|
-
|
|
1023
|
+
path = _ref4.path,
|
|
1024
|
+
setControlContextData = _ref4.setControlContextData;
|
|
1133
1025
|
var item = useSelector("strapiItem");
|
|
1134
|
-
|
|
1135
1026
|
if (!item) {
|
|
1136
1027
|
return React.createElement("div", null, "StrapiField must be used within a StrapiCollection");
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1028
|
+
}
|
|
1029
|
+
// Getting only fields that aren't objects
|
|
1140
1030
|
var attributes = get(item, ["attributes"]);
|
|
1141
1031
|
var displayableFields = Object.keys(attributes).filter(function (field) {
|
|
1142
1032
|
var _value$data2, _value$data2$attribut;
|
|
1143
|
-
|
|
1144
1033
|
var value = attributes[field];
|
|
1145
1034
|
var maybeMime = (_value$data2 = value.data) == null ? void 0 : (_value$data2$attribut = _value$data2.attributes) == null ? void 0 : _value$data2$attribut.mime;
|
|
1146
1035
|
return typeof value !== "object" || typeof maybeMime === "string" && maybeMime.startsWith("image");
|
|
@@ -1149,18 +1038,15 @@ function StrapiField(_ref4) {
|
|
|
1149
1038
|
fields: displayableFields,
|
|
1150
1039
|
isImage: false
|
|
1151
1040
|
});
|
|
1152
|
-
|
|
1153
1041
|
if (!path) {
|
|
1154
1042
|
return React.createElement("div", null, "StrapiField must specify a field name.");
|
|
1155
1043
|
}
|
|
1156
|
-
|
|
1157
1044
|
var data = get(item, ["attributes", path]);
|
|
1158
1045
|
var maybeMime = data == null ? void 0 : (_data$data = data.data) == null ? void 0 : (_data$data$attributes = _data$data.attributes) == null ? void 0 : _data$data$attributes.mime;
|
|
1159
1046
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
1160
1047
|
fields: displayableFields,
|
|
1161
1048
|
isImage: typeof maybeMime === "string" && maybeMime.startsWith("image")
|
|
1162
1049
|
});
|
|
1163
|
-
|
|
1164
1050
|
if (!data) {
|
|
1165
1051
|
return React.createElement("div", null, "Please specify a valid field name.");
|
|
1166
1052
|
} else if (typeof maybeMime === "string" && maybeMime.startsWith("image")) {
|
|
@@ -1190,15 +1076,12 @@ function registerAll(loader) {
|
|
|
1190
1076
|
registerComponent(Component, defaultMeta);
|
|
1191
1077
|
}
|
|
1192
1078
|
};
|
|
1193
|
-
|
|
1194
1079
|
if (loader) {
|
|
1195
1080
|
loader.registerGlobalContext(StrapiCredentialsProvider, strapiCredentialsProviderMeta);
|
|
1196
1081
|
} else {
|
|
1197
1082
|
registerGlobalContext(StrapiCredentialsProvider, strapiCredentialsProviderMeta);
|
|
1198
1083
|
}
|
|
1199
|
-
|
|
1200
1084
|
_registerComponent(StrapiCollection, strapiCollectionMeta);
|
|
1201
|
-
|
|
1202
1085
|
_registerComponent(StrapiField, strapiFieldMeta);
|
|
1203
1086
|
}
|
|
1204
1087
|
|