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