ywana-core8 0.0.877 → 0.0.878
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.cjs +57 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +58 -53
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +57 -52
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/checkbox.js +3 -2
- package/src/html/property.js +2 -1
- package/src/html/textfield.js +10 -4
- package/src/html/tooltip.js +2 -1
- package/src/incubator/task.js +2 -2
package/dist/index.modern.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import 'material-design-icons-iconfont/dist/material-design-icons.css';
|
2
|
-
import React, { useState, useEffect,
|
2
|
+
import React, { useContext, useState, useEffect, Fragment, useRef, useMemo, useCallback, Children } from 'react';
|
3
3
|
import RSwitch from 'react-switch';
|
4
4
|
import moment$1 from 'moment';
|
5
5
|
import { extendMoment } from 'moment-range';
|
@@ -187,6 +187,49 @@ function _extends() {
|
|
187
187
|
return _extends.apply(this, arguments);
|
188
188
|
}
|
189
189
|
|
190
|
+
/**
|
191
|
+
* Site Context
|
192
|
+
*/
|
193
|
+
var SiteContext = React.createContext({});
|
194
|
+
|
195
|
+
var TEXTFORMATS = {
|
196
|
+
NONE: '',
|
197
|
+
NUMERIC: 'numeric',
|
198
|
+
DATE: 'date',
|
199
|
+
TIME: 'time',
|
200
|
+
EMAIL: 'email',
|
201
|
+
HTML: 'HTML',
|
202
|
+
URL: 'URL'
|
203
|
+
};
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Text
|
207
|
+
*/
|
208
|
+
var Text = function Text(_ref) {
|
209
|
+
var format = _ref.format,
|
210
|
+
children = _ref.children,
|
211
|
+
className = _ref.className;
|
212
|
+
var site = useContext(SiteContext);
|
213
|
+
var value = children;
|
214
|
+
if (site) {
|
215
|
+
var lang = site.lang,
|
216
|
+
_site$dictionary = site.dictionary,
|
217
|
+
dictionary = _site$dictionary === void 0 ? {} : _site$dictionary;
|
218
|
+
var term = dictionary[children];
|
219
|
+
var text = term ? term[lang] : children;
|
220
|
+
if (text) value = text;
|
221
|
+
}
|
222
|
+
var formatter = Intl.NumberFormat();
|
223
|
+
switch (format) {
|
224
|
+
case TEXTFORMATS.NUMERIC:
|
225
|
+
value = formatter.format(children);
|
226
|
+
break;
|
227
|
+
}
|
228
|
+
return children ? /*#__PURE__*/React.createElement("span", {
|
229
|
+
className: className
|
230
|
+
}, value) : '';
|
231
|
+
};
|
232
|
+
|
190
233
|
/**
|
191
234
|
* Tooltip
|
192
235
|
*/
|
@@ -206,7 +249,7 @@ var Tooltip = function Tooltip(props) {
|
|
206
249
|
}, /*#__PURE__*/React.createElement("span", {
|
207
250
|
className: "tooltip-text",
|
208
251
|
style: style
|
209
|
-
}, text), props.children);
|
252
|
+
}, /*#__PURE__*/React.createElement(Text, null, text)), props.children);
|
210
253
|
};
|
211
254
|
|
212
255
|
/**
|
@@ -343,49 +386,6 @@ var AccordionSection = function AccordionSection(props) {
|
|
343
386
|
})), open ? /*#__PURE__*/React.createElement("main", null, children) : '');
|
344
387
|
};
|
345
388
|
|
346
|
-
/**
|
347
|
-
* Site Context
|
348
|
-
*/
|
349
|
-
var SiteContext = React.createContext({});
|
350
|
-
|
351
|
-
var TEXTFORMATS = {
|
352
|
-
NONE: '',
|
353
|
-
NUMERIC: 'numeric',
|
354
|
-
DATE: 'date',
|
355
|
-
TIME: 'time',
|
356
|
-
EMAIL: 'email',
|
357
|
-
HTML: 'HTML',
|
358
|
-
URL: 'URL'
|
359
|
-
};
|
360
|
-
|
361
|
-
/**
|
362
|
-
* Text
|
363
|
-
*/
|
364
|
-
var Text = function Text(_ref) {
|
365
|
-
var format = _ref.format,
|
366
|
-
children = _ref.children,
|
367
|
-
className = _ref.className;
|
368
|
-
var site = useContext(SiteContext);
|
369
|
-
var value = children;
|
370
|
-
if (site) {
|
371
|
-
var lang = site.lang,
|
372
|
-
_site$dictionary = site.dictionary,
|
373
|
-
dictionary = _site$dictionary === void 0 ? {} : _site$dictionary;
|
374
|
-
var term = dictionary[children];
|
375
|
-
var text = term ? term[lang] : children;
|
376
|
-
if (text) value = text;
|
377
|
-
}
|
378
|
-
var formatter = Intl.NumberFormat();
|
379
|
-
switch (format) {
|
380
|
-
case TEXTFORMATS.NUMERIC:
|
381
|
-
value = formatter.format(children);
|
382
|
-
break;
|
383
|
-
}
|
384
|
-
return children ? /*#__PURE__*/React.createElement("span", {
|
385
|
-
className: className
|
386
|
-
}, value) : '';
|
387
|
-
};
|
388
|
-
|
389
389
|
/**
|
390
390
|
* HTML Button
|
391
391
|
*/
|
@@ -434,13 +434,14 @@ var CheckBox = function CheckBox(props) {
|
|
434
434
|
if (onChange) onChange(id, value);
|
435
435
|
}
|
436
436
|
var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
|
437
|
+
var placeholderTxt = /*#__PURE__*/React.createElement(Text, null, placeholder);
|
437
438
|
return value === true ? /*#__PURE__*/React.createElement("div", {
|
438
439
|
className: "checkbox",
|
439
440
|
key: id + "1"
|
440
441
|
}, /*#__PURE__*/React.createElement("input", {
|
441
442
|
id: id,
|
442
443
|
type: "checkbox",
|
443
|
-
placeholder:
|
444
|
+
placeholder: placeholderTxt,
|
444
445
|
checked: true,
|
445
446
|
value: value,
|
446
447
|
onChange: change
|
@@ -454,7 +455,7 @@ var CheckBox = function CheckBox(props) {
|
|
454
455
|
}, /*#__PURE__*/React.createElement("input", {
|
455
456
|
id: id,
|
456
457
|
type: "checkbox",
|
457
|
-
placeholder:
|
458
|
+
placeholder: placeholderTxt,
|
458
459
|
value: value,
|
459
460
|
onChange: change
|
460
461
|
}), /*#__PURE__*/React.createElement("span", {
|
@@ -904,7 +905,7 @@ var Property = function Property(props) {
|
|
904
905
|
className: "property property-" + id + " " + className
|
905
906
|
}, /*#__PURE__*/React.createElement("div", {
|
906
907
|
className: "property-name"
|
907
|
-
}, name || label), /*#__PURE__*/React.createElement("div", {
|
908
|
+
}, /*#__PURE__*/React.createElement(Text, null, name || label)), /*#__PURE__*/React.createElement("div", {
|
908
909
|
className: "property-value"
|
909
910
|
}, editable ? /*#__PURE__*/React.createElement("input", {
|
910
911
|
type: "text",
|
@@ -1311,13 +1312,14 @@ var TextField = function TextField(props) {
|
|
1311
1312
|
var labelPositionStyle = labelPosition == 'left' ? "label-left" : "label-top";
|
1312
1313
|
var style = labelStyle + " " + labelPositionStyle + " " + borderStyle + " textfield-" + type;
|
1313
1314
|
var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
|
1315
|
+
var placeholderTxt = /*#__PURE__*/React.createElement(Text, null, placeholder);
|
1314
1316
|
return /*#__PURE__*/React.createElement("div", {
|
1315
1317
|
className: style + " " + id,
|
1316
1318
|
onClick: onClick
|
1317
1319
|
}, /*#__PURE__*/React.createElement("input", {
|
1318
1320
|
id: id,
|
1319
1321
|
type: type,
|
1320
|
-
placeholder:
|
1322
|
+
placeholder: placeholderTxt,
|
1321
1323
|
value: value,
|
1322
1324
|
required: true,
|
1323
1325
|
onChange: change,
|
@@ -1381,12 +1383,13 @@ var TextArea = function TextArea(props) {
|
|
1381
1383
|
var labelStyle = label ? "" : "no-label";
|
1382
1384
|
var style = "textarea " + labelStyle + " textarea-" + type;
|
1383
1385
|
var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
|
1386
|
+
var placeholderTxt = /*#__PURE__*/React.createElement(Text, null, placeholder);
|
1384
1387
|
return /*#__PURE__*/React.createElement("div", {
|
1385
1388
|
className: "" + style,
|
1386
1389
|
onClick: onClick
|
1387
1390
|
}, /*#__PURE__*/React.createElement("textarea", {
|
1388
1391
|
id: id,
|
1389
|
-
placeholder:
|
1392
|
+
placeholder: placeholderTxt,
|
1390
1393
|
value: value,
|
1391
1394
|
required: true,
|
1392
1395
|
onChange: change,
|
@@ -1544,9 +1547,10 @@ var DateRange = function DateRange(props) {
|
|
1544
1547
|
var next = Object.assign({}, form, (_Object$assign = {}, _Object$assign[id] = value, _Object$assign));
|
1545
1548
|
setForm(next);
|
1546
1549
|
}
|
1550
|
+
var labelTxt = label ? /*#__PURE__*/React.createElement(Text, null, label) : null;
|
1547
1551
|
return /*#__PURE__*/React.createElement("div", {
|
1548
1552
|
className: "date-range"
|
1549
|
-
}, label ? /*#__PURE__*/React.createElement("label", null,
|
1553
|
+
}, label ? /*#__PURE__*/React.createElement("label", null, labelTxt) : null, /*#__PURE__*/React.createElement(TextField, {
|
1550
1554
|
id: "from",
|
1551
1555
|
type: "date",
|
1552
1556
|
label: "From",
|
@@ -1571,12 +1575,13 @@ var PasswordField = function PasswordField(props) {
|
|
1571
1575
|
function toggle() {
|
1572
1576
|
setShow(!show);
|
1573
1577
|
}
|
1578
|
+
var labelTxt = label ? /*#__PURE__*/React.createElement(Text, null, label) : null;
|
1574
1579
|
return /*#__PURE__*/React.createElement("div", {
|
1575
1580
|
className: "password-field"
|
1576
1581
|
}, /*#__PURE__*/React.createElement(TextField, {
|
1577
1582
|
id: id,
|
1578
1583
|
type: show ? "text" : "password",
|
1579
|
-
label:
|
1584
|
+
label: labelTxt,
|
1580
1585
|
value: value,
|
1581
1586
|
onChange: onChange
|
1582
1587
|
}), /*#__PURE__*/React.createElement(Icon, {
|
@@ -4946,7 +4951,7 @@ var TaskMonitor = function TaskMonitor(props) {
|
|
4946
4951
|
}).map(function (task) {
|
4947
4952
|
return {
|
4948
4953
|
id: task.id,
|
4949
|
-
state: task.state,
|
4954
|
+
state: /*#__PURE__*/React.createElement(Text, null, task.state),
|
4950
4955
|
description: task.description,
|
4951
4956
|
progress: /*#__PURE__*/React.createElement(LinearProgress, {
|
4952
4957
|
progress: task.percentage
|