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