@vidispine/vdt-react 0.15.0-pre.21 → 0.15.0-pre.25
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/index.es.js +105 -17
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +105 -16
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -3199,6 +3199,7 @@ var useCollectionAutoPlay = function useCollectionAutoPlay(_ref) {
|
|
|
3199
3199
|
function useHoverScrub() {
|
|
3200
3200
|
var srcList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3201
3201
|
var customOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3202
|
+
var durationSeconds = arguments.length > 2 ? arguments[2] : undefined;
|
|
3202
3203
|
|
|
3203
3204
|
var _React$useState = React__default.useState(0),
|
|
3204
3205
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -3215,6 +3216,21 @@ function useHoverScrub() {
|
|
|
3215
3216
|
showScrub = _React$useState6[0],
|
|
3216
3217
|
setShowScrub = _React$useState6[1];
|
|
3217
3218
|
|
|
3219
|
+
var _React$useState7 = React__default.useState([]),
|
|
3220
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
3221
|
+
thumbnailTimeCodeArray = _React$useState8[0],
|
|
3222
|
+
setThumbnailTimeCodeArray = _React$useState8[1];
|
|
3223
|
+
|
|
3224
|
+
var _React$useState9 = React__default.useState(0),
|
|
3225
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
3226
|
+
thumbnailTimeCode = _React$useState10[0],
|
|
3227
|
+
setThumbnailTimeCode = _React$useState10[1];
|
|
3228
|
+
|
|
3229
|
+
var _React$useState11 = React__default.useState(0),
|
|
3230
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
3231
|
+
thumbnailWidth = _React$useState12[0],
|
|
3232
|
+
setThumbnailWidth = _React$useState12[1];
|
|
3233
|
+
|
|
3218
3234
|
var getInnerLeft = React.useCallback(function (e) {
|
|
3219
3235
|
var left = e.clientX - e.currentTarget.offsetLeft - customOffset;
|
|
3220
3236
|
|
|
@@ -3230,16 +3246,46 @@ function useHoverScrub() {
|
|
|
3230
3246
|
}, [customOffset]);
|
|
3231
3247
|
|
|
3232
3248
|
var onMouseMove = function onMouseMove(e) {
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3249
|
+
var innerLeft = getInnerLeft(e);
|
|
3250
|
+
setScrubPosition(innerLeft - 1);
|
|
3251
|
+
setThumbnailWidth(e.currentTarget.offsetWidth);
|
|
3252
|
+
var pxToSec = e.currentTarget.offsetWidth / +durationSeconds;
|
|
3253
|
+
var pxAsTimeCode = innerLeft / pxToSec;
|
|
3254
|
+
setThumbnailTimeCode(pxAsTimeCode);
|
|
3255
|
+
|
|
3256
|
+
for (var index = 0; index < thumbnailTimeCodeArray.length; index += 1) {
|
|
3257
|
+
var timeCode = thumbnailTimeCodeArray[index];
|
|
3258
|
+
var nextTimeCode = thumbnailTimeCodeArray[index + 1] || thumbnailTimeCodeArray[thumbnailTimeCodeArray.length - 1];
|
|
3259
|
+
|
|
3260
|
+
if (timeCode <= pxAsTimeCode && nextTimeCode >= pxAsTimeCode) {
|
|
3261
|
+
setThumbnailIndex(index);
|
|
3262
|
+
}
|
|
3237
3263
|
}
|
|
3238
3264
|
};
|
|
3239
3265
|
|
|
3266
|
+
React__default.useEffect(function () {
|
|
3267
|
+
var timeCodes = [];
|
|
3268
|
+
|
|
3269
|
+
for (var index = 0; index < srcList.length; index += 1) {
|
|
3270
|
+
var uri = srcList[index];
|
|
3271
|
+
|
|
3272
|
+
if (uri && typeof uri === 'string') {
|
|
3273
|
+
try {
|
|
3274
|
+
var timeCodeFromURI = uri.split('version')[1].split('/')[1].split('?')[0];
|
|
3275
|
+
var timecodeText = vdtJs.formatTimeCodeText(timeCodeFromURI);
|
|
3276
|
+
timeCodes.push(timecodeText.toSeconds().toFixed(0));
|
|
3277
|
+
} catch (error) {
|
|
3278
|
+
return;
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
setThumbnailTimeCodeArray(timeCodes);
|
|
3284
|
+
}, [srcList]);
|
|
3285
|
+
|
|
3240
3286
|
var handleShowScrub = function handleShowScrub(value) {
|
|
3241
3287
|
return function () {
|
|
3242
|
-
if (
|
|
3288
|
+
if (durationSeconds > 0) {
|
|
3243
3289
|
setShowScrub(value);
|
|
3244
3290
|
}
|
|
3245
3291
|
};
|
|
@@ -3247,6 +3293,8 @@ function useHoverScrub() {
|
|
|
3247
3293
|
|
|
3248
3294
|
return {
|
|
3249
3295
|
thumbnailIndex: thumbnailIndex,
|
|
3296
|
+
thumbnailTimeCode: thumbnailTimeCode,
|
|
3297
|
+
thumbnailWidth: thumbnailWidth,
|
|
3250
3298
|
showScrub: showScrub,
|
|
3251
3299
|
scrubPosition: scrubPosition,
|
|
3252
3300
|
handleShowScrub: handleShowScrub,
|
|
@@ -3254,12 +3302,19 @@ function useHoverScrub() {
|
|
|
3254
3302
|
};
|
|
3255
3303
|
}
|
|
3256
3304
|
|
|
3257
|
-
function
|
|
3258
|
-
var
|
|
3305
|
+
function useDocSearchAutocomplete(_ref) {
|
|
3306
|
+
var searchDoc = _ref.searchDoc,
|
|
3307
|
+
queryParams = _ref.queryParams,
|
|
3308
|
+
debounceTime = _ref.debounceTime,
|
|
3309
|
+
_ref$suggestionSettin = _ref.suggestionSettings,
|
|
3310
|
+
suggestionSettings = _ref$suggestionSettin === void 0 ? {
|
|
3259
3311
|
maximumSuggestions: 10,
|
|
3260
3312
|
accuracy: 1
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3313
|
+
} : _ref$suggestionSettin,
|
|
3314
|
+
_ref$triggerLength = _ref.triggerLength,
|
|
3315
|
+
triggerLength = _ref$triggerLength === void 0 ? 1 : _ref$triggerLength,
|
|
3316
|
+
_ref$apiCall = _ref.apiCall,
|
|
3317
|
+
apiCall = _ref$apiCall === void 0 ? vdtApi.item.searchItem : _ref$apiCall;
|
|
3263
3318
|
|
|
3264
3319
|
var _React$useState = React__default.useState(''),
|
|
3265
3320
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -3268,7 +3323,7 @@ function useItemSearchAutocomplete(itemSearchDoc, queryParams, debounceTime) {
|
|
|
3268
3323
|
|
|
3269
3324
|
var handleAutocompleteChange = React__default.useRef(debounce(setTextValue, debounceTime)).current;
|
|
3270
3325
|
|
|
3271
|
-
var _useApi = useApi(
|
|
3326
|
+
var _useApi = useApi(apiCall),
|
|
3272
3327
|
_useApi$data = _useApi.data;
|
|
3273
3328
|
|
|
3274
3329
|
_useApi$data = _useApi$data === void 0 ? {} : _useApi$data;
|
|
@@ -3276,14 +3331,14 @@ function useItemSearchAutocomplete(itemSearchDoc, queryParams, debounceTime) {
|
|
|
3276
3331
|
autocomplete = _useApi$data$autocomp === void 0 ? [] : _useApi$data$autocomp,
|
|
3277
3332
|
request = _useApi.request;
|
|
3278
3333
|
|
|
3279
|
-
var
|
|
3280
|
-
|
|
3281
|
-
suggestion =
|
|
3334
|
+
var _ref2 = autocomplete[0] || {},
|
|
3335
|
+
_ref2$suggestion = _ref2.suggestion,
|
|
3336
|
+
suggestion = _ref2$suggestion === void 0 ? [] : _ref2$suggestion;
|
|
3282
3337
|
|
|
3283
3338
|
useDeepCompareEffect(function () {
|
|
3284
|
-
if (
|
|
3339
|
+
if (searchDoc && textValue && textValue.length >= triggerLength) {
|
|
3285
3340
|
request({
|
|
3286
|
-
body: _objectSpread2(_objectSpread2({},
|
|
3341
|
+
body: _objectSpread2(_objectSpread2({}, searchDoc), {}, {
|
|
3287
3342
|
suggestion: suggestionSettings,
|
|
3288
3343
|
autocomplete: [{
|
|
3289
3344
|
text: textValue
|
|
@@ -3305,6 +3360,39 @@ function useItemSearchAutocomplete(itemSearchDoc, queryParams, debounceTime) {
|
|
|
3305
3360
|
};
|
|
3306
3361
|
}
|
|
3307
3362
|
|
|
3363
|
+
function useGetFieldMetadataDataset() {
|
|
3364
|
+
var _useApi = useApi(vdtApi.metadatafield.getMetadataFieldAllowedValues),
|
|
3365
|
+
request = _useApi.request,
|
|
3366
|
+
_useApi$data = _useApi.data;
|
|
3367
|
+
|
|
3368
|
+
_useApi$data = _useApi$data === void 0 ? {} : _useApi$data;
|
|
3369
|
+
var _useApi$data$value = _useApi$data.value,
|
|
3370
|
+
constraintValueListType = _useApi$data$value === void 0 ? [] : _useApi$data$value,
|
|
3371
|
+
isLoading = _useApi.isLoading;
|
|
3372
|
+
|
|
3373
|
+
var getMetadataDataset = function getMetadataDataset(datasetField, parentValue, parentField) {
|
|
3374
|
+
var metadataFieldValueConstraintListDocument = {
|
|
3375
|
+
constraint: parentValue ? [{
|
|
3376
|
+
field: parentField,
|
|
3377
|
+
value: parentValue
|
|
3378
|
+
}] : []
|
|
3379
|
+
};
|
|
3380
|
+
|
|
3381
|
+
if (datasetField) {
|
|
3382
|
+
request({
|
|
3383
|
+
fieldName: datasetField,
|
|
3384
|
+
metadataFieldValueConstraintListDocument: metadataFieldValueConstraintListDocument
|
|
3385
|
+
});
|
|
3386
|
+
}
|
|
3387
|
+
};
|
|
3388
|
+
|
|
3389
|
+
return {
|
|
3390
|
+
getMetadataDataset: getMetadataDataset,
|
|
3391
|
+
dataset: constraintValueListType,
|
|
3392
|
+
isLoading: isLoading
|
|
3393
|
+
};
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3308
3396
|
function MetadataType(_ref) {
|
|
3309
3397
|
var itemType = _ref.itemType,
|
|
3310
3398
|
collectionType = _ref.collectionType,
|
|
@@ -4946,15 +5034,16 @@ exports.useApi = useApi;
|
|
|
4946
5034
|
exports.useAuthContext = useAuthContext;
|
|
4947
5035
|
exports.useAutocomplete = useAutocomplete;
|
|
4948
5036
|
exports.useCollectionAutoPlay = useCollectionAutoPlay;
|
|
5037
|
+
exports.useDocSearchAutocomplete = useDocSearchAutocomplete;
|
|
4949
5038
|
exports.useEntityAccess = useEntityAccess;
|
|
4950
5039
|
exports.useGetCollection = useGetCollection;
|
|
4951
5040
|
exports.useGetCollectionItem = useGetCollection$1;
|
|
4952
5041
|
exports.useGetEntity = useGetEntity;
|
|
5042
|
+
exports.useGetFieldMetadataDataset = useGetFieldMetadataDataset;
|
|
4953
5043
|
exports.useGetItem = useGetItem;
|
|
4954
5044
|
exports.useGroup = useGroup;
|
|
4955
5045
|
exports.useHoverScrub = useHoverScrub;
|
|
4956
5046
|
exports.useInterval = useInterval;
|
|
4957
|
-
exports.useItemSearchAutocomplete = useItemSearchAutocomplete;
|
|
4958
5047
|
exports.useJobSearch = useJobSearch;
|
|
4959
5048
|
exports.useListGroup = useListGroup;
|
|
4960
5049
|
exports.useListUser = useListUser;
|