@panneau/core 2.0.69 → 2.0.71
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/es/index.js +2 -0
- package/es/utils.js +120 -1
- package/lib/index.js +2 -0
- package/lib/utils.js +122 -0
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -10,6 +10,8 @@ import 'lodash/isNumber';
|
|
|
10
10
|
import 'snake-case';
|
|
11
11
|
import isObject from 'lodash/isObject';
|
|
12
12
|
import 'react';
|
|
13
|
+
import '@babel/runtime/helpers/regeneratorRuntime';
|
|
14
|
+
import '@babel/runtime/helpers/asyncToGenerator';
|
|
13
15
|
import { pascalCase } from 'change-case';
|
|
14
16
|
import ReactIs from 'react-is';
|
|
15
17
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
package/es/utils.js
CHANGED
|
@@ -2,6 +2,8 @@ import isNumber from 'lodash/isNumber';
|
|
|
2
2
|
import { snakeCase } from 'snake-case';
|
|
3
3
|
import isObject from 'lodash/isObject';
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
|
+
import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime';
|
|
6
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
5
7
|
import { pascalCase, paramCase, snakeCase as snakeCase$1 } from 'change-case';
|
|
6
8
|
export { paramCase as dashCase, pascalCase, snakeCase } from 'change-case';
|
|
7
9
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
@@ -56,6 +58,123 @@ var createUseEvent = function createUseEvent(eventsManager) {
|
|
|
56
58
|
};
|
|
57
59
|
};
|
|
58
60
|
|
|
61
|
+
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
62
|
+
|
|
63
|
+
// @note vendoring this: https://github.com/feross/clipboard-copy/blob/master/index.js
|
|
64
|
+
// we might want to add that to the npm deps and just use it
|
|
65
|
+
|
|
66
|
+
function makeError() {
|
|
67
|
+
return new DOMException('The request is not allowed', 'NotAllowedError');
|
|
68
|
+
}
|
|
69
|
+
function copyClipboardApi(_x) {
|
|
70
|
+
return _copyClipboardApi.apply(this, arguments);
|
|
71
|
+
}
|
|
72
|
+
function _copyClipboardApi() {
|
|
73
|
+
_copyClipboardApi = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(text) {
|
|
74
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
75
|
+
while (1) switch (_context.prev = _context.next) {
|
|
76
|
+
case 0:
|
|
77
|
+
if (navigator.clipboard) {
|
|
78
|
+
_context.next = 2;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
throw makeError();
|
|
82
|
+
case 2:
|
|
83
|
+
return _context.abrupt("return", navigator.clipboard.writeText(text));
|
|
84
|
+
case 3:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee);
|
|
89
|
+
}));
|
|
90
|
+
return _copyClipboardApi.apply(this, arguments);
|
|
91
|
+
}
|
|
92
|
+
function copyExecCommand(_x2) {
|
|
93
|
+
return _copyExecCommand.apply(this, arguments);
|
|
94
|
+
}
|
|
95
|
+
function _copyExecCommand() {
|
|
96
|
+
_copyExecCommand = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(text) {
|
|
97
|
+
var span, selection, range, success;
|
|
98
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
99
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
100
|
+
case 0:
|
|
101
|
+
// Put the text to copy into a <span>
|
|
102
|
+
span = document.createElement('span');
|
|
103
|
+
span.textContent = text;
|
|
104
|
+
|
|
105
|
+
// Preserve consecutive spaces and newlines
|
|
106
|
+
span.style.whiteSpace = 'pre';
|
|
107
|
+
span.style.webkitUserSelect = 'auto';
|
|
108
|
+
span.style.userSelect = 'all';
|
|
109
|
+
|
|
110
|
+
// Add the <span> to the page
|
|
111
|
+
document.body.appendChild(span);
|
|
112
|
+
|
|
113
|
+
// Make a selection object representing the range of text selected by the user
|
|
114
|
+
selection = window.getSelection();
|
|
115
|
+
range = window.document.createRange();
|
|
116
|
+
selection.removeAllRanges();
|
|
117
|
+
range.selectNode(span);
|
|
118
|
+
selection.addRange(range);
|
|
119
|
+
|
|
120
|
+
// Copy text to the clipboard
|
|
121
|
+
success = false;
|
|
122
|
+
try {
|
|
123
|
+
success = window.document.execCommand('copy');
|
|
124
|
+
} finally {
|
|
125
|
+
// Cleanup
|
|
126
|
+
selection.removeAllRanges();
|
|
127
|
+
window.document.body.removeChild(span);
|
|
128
|
+
}
|
|
129
|
+
if (success) {
|
|
130
|
+
_context2.next = 15;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
throw makeError();
|
|
134
|
+
case 15:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context2.stop();
|
|
137
|
+
}
|
|
138
|
+
}, _callee2);
|
|
139
|
+
}));
|
|
140
|
+
return _copyExecCommand.apply(this, arguments);
|
|
141
|
+
}
|
|
142
|
+
function copyToClipboard(_x3) {
|
|
143
|
+
return _copyToClipboard.apply(this, arguments);
|
|
144
|
+
}
|
|
145
|
+
function _copyToClipboard() {
|
|
146
|
+
_copyToClipboard = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(text) {
|
|
147
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
_context3.prev = 0;
|
|
151
|
+
_context3.next = 3;
|
|
152
|
+
return copyClipboardApi(text);
|
|
153
|
+
case 3:
|
|
154
|
+
_context3.next = 15;
|
|
155
|
+
break;
|
|
156
|
+
case 5:
|
|
157
|
+
_context3.prev = 5;
|
|
158
|
+
_context3.t0 = _context3["catch"](0);
|
|
159
|
+
_context3.prev = 7;
|
|
160
|
+
_context3.next = 10;
|
|
161
|
+
return copyExecCommand(text);
|
|
162
|
+
case 10:
|
|
163
|
+
_context3.next = 15;
|
|
164
|
+
break;
|
|
165
|
+
case 12:
|
|
166
|
+
_context3.prev = 12;
|
|
167
|
+
_context3.t1 = _context3["catch"](7);
|
|
168
|
+
throw _context3.t1 || _context3.t0 || makeError();
|
|
169
|
+
case 15:
|
|
170
|
+
case "end":
|
|
171
|
+
return _context3.stop();
|
|
172
|
+
}
|
|
173
|
+
}, _callee3, null, [[0, 5], [7, 12]]);
|
|
174
|
+
}));
|
|
175
|
+
return _copyToClipboard.apply(this, arguments);
|
|
176
|
+
}
|
|
177
|
+
|
|
59
178
|
var flattenComponents = function flattenComponents(components) {
|
|
60
179
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
61
180
|
if (components === null) {
|
|
@@ -330,4 +449,4 @@ var validateFields = function validateFields(fields, value) {
|
|
|
330
449
|
}, true);
|
|
331
450
|
};
|
|
332
451
|
|
|
333
|
-
export { convertStyleToString, createNullableOnChange, createUseEvent, flattenComponents, getColumnsWithFields, getComponent, getComponentFromName, getDefinitionFromId, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getPathValue, getSelectOptions, isMessage, loadPackage, setValue as setFieldValue, slug, validateFields };
|
|
452
|
+
export { convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, flattenComponents, getColumnsWithFields, getComponent, getComponentFromName, getDefinitionFromId, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getPathValue, getSelectOptions, isMessage, loadPackage, setValue as setFieldValue, slug, validateFields };
|
package/lib/index.js
CHANGED
|
@@ -14,6 +14,8 @@ require('lodash/isNumber');
|
|
|
14
14
|
require('snake-case');
|
|
15
15
|
var isObject = require('lodash/isObject');
|
|
16
16
|
require('react');
|
|
17
|
+
require('@babel/runtime/helpers/regeneratorRuntime');
|
|
18
|
+
require('@babel/runtime/helpers/asyncToGenerator');
|
|
17
19
|
var changeCase = require('change-case');
|
|
18
20
|
var ReactIs = require('react-is');
|
|
19
21
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
package/lib/utils.js
CHANGED
|
@@ -6,6 +6,8 @@ var isNumber = require('lodash/isNumber');
|
|
|
6
6
|
var snakeCase = require('snake-case');
|
|
7
7
|
var isObject = require('lodash/isObject');
|
|
8
8
|
var react = require('react');
|
|
9
|
+
var _regeneratorRuntime = require('@babel/runtime/helpers/regeneratorRuntime');
|
|
10
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
9
11
|
var changeCase = require('change-case');
|
|
10
12
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
13
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
@@ -23,6 +25,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
23
25
|
|
|
24
26
|
var isNumber__default = /*#__PURE__*/_interopDefaultLegacy(isNumber);
|
|
25
27
|
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
28
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
29
|
+
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
26
30
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
27
31
|
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
28
32
|
var ReactIs__default = /*#__PURE__*/_interopDefaultLegacy(ReactIs);
|
|
@@ -75,6 +79,123 @@ var createUseEvent = function createUseEvent(eventsManager) {
|
|
|
75
79
|
};
|
|
76
80
|
};
|
|
77
81
|
|
|
82
|
+
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
83
|
+
|
|
84
|
+
// @note vendoring this: https://github.com/feross/clipboard-copy/blob/master/index.js
|
|
85
|
+
// we might want to add that to the npm deps and just use it
|
|
86
|
+
|
|
87
|
+
function makeError() {
|
|
88
|
+
return new DOMException('The request is not allowed', 'NotAllowedError');
|
|
89
|
+
}
|
|
90
|
+
function copyClipboardApi(_x) {
|
|
91
|
+
return _copyClipboardApi.apply(this, arguments);
|
|
92
|
+
}
|
|
93
|
+
function _copyClipboardApi() {
|
|
94
|
+
_copyClipboardApi = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"]().mark(function _callee(text) {
|
|
95
|
+
return _regeneratorRuntime__default["default"]().wrap(function _callee$(_context) {
|
|
96
|
+
while (1) switch (_context.prev = _context.next) {
|
|
97
|
+
case 0:
|
|
98
|
+
if (navigator.clipboard) {
|
|
99
|
+
_context.next = 2;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
throw makeError();
|
|
103
|
+
case 2:
|
|
104
|
+
return _context.abrupt("return", navigator.clipboard.writeText(text));
|
|
105
|
+
case 3:
|
|
106
|
+
case "end":
|
|
107
|
+
return _context.stop();
|
|
108
|
+
}
|
|
109
|
+
}, _callee);
|
|
110
|
+
}));
|
|
111
|
+
return _copyClipboardApi.apply(this, arguments);
|
|
112
|
+
}
|
|
113
|
+
function copyExecCommand(_x2) {
|
|
114
|
+
return _copyExecCommand.apply(this, arguments);
|
|
115
|
+
}
|
|
116
|
+
function _copyExecCommand() {
|
|
117
|
+
_copyExecCommand = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"]().mark(function _callee2(text) {
|
|
118
|
+
var span, selection, range, success;
|
|
119
|
+
return _regeneratorRuntime__default["default"]().wrap(function _callee2$(_context2) {
|
|
120
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
121
|
+
case 0:
|
|
122
|
+
// Put the text to copy into a <span>
|
|
123
|
+
span = document.createElement('span');
|
|
124
|
+
span.textContent = text;
|
|
125
|
+
|
|
126
|
+
// Preserve consecutive spaces and newlines
|
|
127
|
+
span.style.whiteSpace = 'pre';
|
|
128
|
+
span.style.webkitUserSelect = 'auto';
|
|
129
|
+
span.style.userSelect = 'all';
|
|
130
|
+
|
|
131
|
+
// Add the <span> to the page
|
|
132
|
+
document.body.appendChild(span);
|
|
133
|
+
|
|
134
|
+
// Make a selection object representing the range of text selected by the user
|
|
135
|
+
selection = window.getSelection();
|
|
136
|
+
range = window.document.createRange();
|
|
137
|
+
selection.removeAllRanges();
|
|
138
|
+
range.selectNode(span);
|
|
139
|
+
selection.addRange(range);
|
|
140
|
+
|
|
141
|
+
// Copy text to the clipboard
|
|
142
|
+
success = false;
|
|
143
|
+
try {
|
|
144
|
+
success = window.document.execCommand('copy');
|
|
145
|
+
} finally {
|
|
146
|
+
// Cleanup
|
|
147
|
+
selection.removeAllRanges();
|
|
148
|
+
window.document.body.removeChild(span);
|
|
149
|
+
}
|
|
150
|
+
if (success) {
|
|
151
|
+
_context2.next = 15;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
throw makeError();
|
|
155
|
+
case 15:
|
|
156
|
+
case "end":
|
|
157
|
+
return _context2.stop();
|
|
158
|
+
}
|
|
159
|
+
}, _callee2);
|
|
160
|
+
}));
|
|
161
|
+
return _copyExecCommand.apply(this, arguments);
|
|
162
|
+
}
|
|
163
|
+
function copyToClipboard(_x3) {
|
|
164
|
+
return _copyToClipboard.apply(this, arguments);
|
|
165
|
+
}
|
|
166
|
+
function _copyToClipboard() {
|
|
167
|
+
_copyToClipboard = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"]().mark(function _callee3(text) {
|
|
168
|
+
return _regeneratorRuntime__default["default"]().wrap(function _callee3$(_context3) {
|
|
169
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
170
|
+
case 0:
|
|
171
|
+
_context3.prev = 0;
|
|
172
|
+
_context3.next = 3;
|
|
173
|
+
return copyClipboardApi(text);
|
|
174
|
+
case 3:
|
|
175
|
+
_context3.next = 15;
|
|
176
|
+
break;
|
|
177
|
+
case 5:
|
|
178
|
+
_context3.prev = 5;
|
|
179
|
+
_context3.t0 = _context3["catch"](0);
|
|
180
|
+
_context3.prev = 7;
|
|
181
|
+
_context3.next = 10;
|
|
182
|
+
return copyExecCommand(text);
|
|
183
|
+
case 10:
|
|
184
|
+
_context3.next = 15;
|
|
185
|
+
break;
|
|
186
|
+
case 12:
|
|
187
|
+
_context3.prev = 12;
|
|
188
|
+
_context3.t1 = _context3["catch"](7);
|
|
189
|
+
throw _context3.t1 || _context3.t0 || makeError();
|
|
190
|
+
case 15:
|
|
191
|
+
case "end":
|
|
192
|
+
return _context3.stop();
|
|
193
|
+
}
|
|
194
|
+
}, _callee3, null, [[0, 5], [7, 12]]);
|
|
195
|
+
}));
|
|
196
|
+
return _copyToClipboard.apply(this, arguments);
|
|
197
|
+
}
|
|
198
|
+
|
|
78
199
|
var flattenComponents = function flattenComponents(components) {
|
|
79
200
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
80
201
|
if (components === null) {
|
|
@@ -362,6 +483,7 @@ Object.defineProperty(exports, 'snakeCase', {
|
|
|
362
483
|
get: function () { return changeCase.snakeCase; }
|
|
363
484
|
});
|
|
364
485
|
exports.convertStyleToString = convertStyleToString;
|
|
486
|
+
exports.copyToClipboard = copyToClipboard;
|
|
365
487
|
exports.createNullableOnChange = createNullableOnChange;
|
|
366
488
|
exports.createUseEvent = createUseEvent;
|
|
367
489
|
exports.flattenComponents = flattenComponents;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.71",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"publishConfig": {
|
|
115
115
|
"access": "public"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "1967f2257b7e36b5807c4127ec368d2bb1edf687"
|
|
118
118
|
}
|