source: trip-planner-front/node_modules/@angular/cdk/esm2015/drag-drop/drag-styling.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 8.4 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8/**
9 * Shallow-extends a stylesheet object with another stylesheet-like object.
10 * Note that the keys in `source` have to be dash-cased.
11 * @docs-private
12 */
13export function extendStyles(dest, source, importantProperties) {
14 for (let key in source) {
15 if (source.hasOwnProperty(key)) {
16 const value = source[key];
17 if (value) {
18 dest.setProperty(key, value, (importantProperties === null || importantProperties === void 0 ? void 0 : importantProperties.has(key)) ? 'important' : '');
19 }
20 else {
21 dest.removeProperty(key);
22 }
23 }
24 }
25 return dest;
26}
27/**
28 * Toggles whether the native drag interactions should be enabled for an element.
29 * @param element Element on which to toggle the drag interactions.
30 * @param enable Whether the drag interactions should be enabled.
31 * @docs-private
32 */
33export function toggleNativeDragInteractions(element, enable) {
34 const userSelect = enable ? '' : 'none';
35 extendStyles(element.style, {
36 'touch-action': enable ? '' : 'none',
37 '-webkit-user-drag': enable ? '' : 'none',
38 '-webkit-tap-highlight-color': enable ? '' : 'transparent',
39 'user-select': userSelect,
40 '-ms-user-select': userSelect,
41 '-webkit-user-select': userSelect,
42 '-moz-user-select': userSelect
43 });
44}
45/**
46 * Toggles whether an element is visible while preserving its dimensions.
47 * @param element Element whose visibility to toggle
48 * @param enable Whether the element should be visible.
49 * @param importantProperties Properties to be set as `!important`.
50 * @docs-private
51 */
52export function toggleVisibility(element, enable, importantProperties) {
53 extendStyles(element.style, {
54 position: enable ? '' : 'fixed',
55 top: enable ? '' : '0',
56 opacity: enable ? '' : '0',
57 left: enable ? '' : '-999em'
58 }, importantProperties);
59}
60/**
61 * Combines a transform string with an optional other transform
62 * that exited before the base transform was applied.
63 */
64export function combineTransforms(transform, initialTransform) {
65 return initialTransform && initialTransform != 'none' ?
66 (transform + ' ' + initialTransform) :
67 transform;
68}
69//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhZy1zdHlsaW5nLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2Nkay9kcmFnLWRyb3AvZHJhZy1zdHlsaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQVdIOzs7O0dBSUc7QUFDSCxNQUFNLFVBQVUsWUFBWSxDQUFDLElBQXlCLEVBQ3pCLE1BQThCLEVBQzlCLG1CQUFpQztJQUM1RCxLQUFLLElBQUksR0FBRyxJQUFJLE1BQU0sRUFBRTtRQUN0QixJQUFJLE1BQU0sQ0FBQyxjQUFjLENBQUMsR0FBRyxDQUFDLEVBQUU7WUFDOUIsTUFBTSxLQUFLLEdBQUcsTUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFDO1lBRTFCLElBQUksS0FBSyxFQUFFO2dCQUNULElBQUksQ0FBQyxXQUFXLENBQUMsR0FBRyxFQUFFLEtBQUssRUFBRSxDQUFBLG1CQUFtQixhQUFuQixtQkFBbUIsdUJBQW5CLG1CQUFtQixDQUFFLEdBQUcsQ0FBQyxHQUFHLENBQUMsRUFBQyxDQUFDLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQzthQUNoRjtpQkFBTTtnQkFDTCxJQUFJLENBQUMsY0FBYyxDQUFDLEdBQUcsQ0FBQyxDQUFDO2FBQzFCO1NBQ0Y7S0FDRjtJQUVELE9BQU8sSUFBSSxDQUFDO0FBQ2QsQ0FBQztBQUdEOzs7OztHQUtHO0FBQ0gsTUFBTSxVQUFVLDRCQUE0QixDQUFDLE9BQW9CLEVBQUUsTUFBZTtJQUNoRixNQUFNLFVBQVUsR0FBRyxNQUFNLENBQ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ICAgICAgICAgIGVuYWJsZTogYm9vbGVhbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltcG9ydGFudFByb3BlcnRpZXM/OiBTZXQ8c3RyaW5nPikge1xuICBleHRlbmRTdHlsZXMoZWxlbWVudC5zdHlsZSwge1xuICAgIHBvc2l0aW9uOiBlbmFibGUgPyAnJyA6ICdmaXhlZCcsXG4gICAgdG9wOiBlbmFibGUgPyAnJyA6ICcwJyxcbiAgICBvcGFjaXR5OiBlbmFibGUgPyAnJyA6ICcwJyxcbiAgICBsZWZ0OiBlbmFibGUgPyAnJyA6ICctOTk5ZW0nXG4gIH0sIGltcG9ydGFudFByb3BlcnRpZXMpO1xufVxuXG4vKipcbiAqIENvbWJpbmVzIGEgdHJhbnNmb3JtIHN0cmluZyB3aXRoIGFuIG9wdGlvbmFsIG90aGVyIHRyYW5zZm9ybVxuICogdGhhdCBleGl0ZWQgYmVmb3JlIHRoZSBiYXNlIHRyYW5zZm9ybSB3YXMgYXBwbGllZC5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGNvbWJpbmVUcmFuc2Zvcm1zKHRyYW5zZm9ybTogc3RyaW5nLCBpbml0aWFsVHJhbnNmb3JtPzogc3RyaW5nKTogc3RyaW5nIHtcbiAgcmV0dXJuIGluaXRpYWxUcmFuc2Zvcm0gJiYgaW5pdGlhbFRyYW5zZm9ybSAhPSAnbm9uZScgP1xuICAgICAgKHRyYW5zZm9ybSArICcgJyArIGluaXRpYWxUcmFuc2Zvcm0pIDpcbiAgICAgIHRyYW5zZm9ybTtcbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.