ywana-core8 0.0.626 → 0.0.629
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 +60 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +16 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +60 -25
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +60 -25
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +8 -4
- package/src/html/textfield.css +2 -1
- package/src/html/textfield.js +1 -1
package/dist/index.modern.js
CHANGED
@@ -174,7 +174,8 @@ var Icon = function Icon(_ref) {
|
|
174
174
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
175
175
|
action = _ref.action,
|
176
176
|
_ref$eventPropagation = _ref.eventPropagation,
|
177
|
-
eventPropagation = _ref$eventPropagation === void 0 ? false : _ref$eventPropagation
|
177
|
+
eventPropagation = _ref$eventPropagation === void 0 ? false : _ref$eventPropagation,
|
178
|
+
className = _ref.className;
|
178
179
|
|
179
180
|
function click(event) {
|
180
181
|
if (!eventPropagation) {
|
@@ -187,7 +188,7 @@ var Icon = function Icon(_ref) {
|
|
187
188
|
|
188
189
|
var style = disabled ? "disabled" : clickable ? "clickable" : "";
|
189
190
|
return /*#__PURE__*/React.createElement("i", {
|
190
|
-
className: "icon " + size + " " + style + " material-icons",
|
191
|
+
className: "icon " + size + " " + style + " " + className + " material-icons",
|
191
192
|
onClick: click
|
192
193
|
}, icon);
|
193
194
|
};
|
@@ -1440,6 +1441,8 @@ var DropDown = function DropDown(props) {
|
|
1440
1441
|
readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3,
|
1441
1442
|
_props$verbose = props.verbose,
|
1442
1443
|
verbose = _props$verbose === void 0 ? true : _props$verbose,
|
1444
|
+
_props$editable = props.editable,
|
1445
|
+
editable = _props$editable === void 0 ? false : _props$editable,
|
1443
1446
|
onBlur = props.onBlur;
|
1444
1447
|
|
1445
1448
|
var _useState = useState(false),
|
@@ -1458,7 +1461,8 @@ var DropDown = function DropDown(props) {
|
|
1458
1461
|
|
1459
1462
|
var _label = option ? option.label : "";
|
1460
1463
|
|
1461
|
-
|
1464
|
+
if (editable && _label === "") setLabel(value);
|
1465
|
+
if (!editable) setLabel(_label);
|
1462
1466
|
}
|
1463
1467
|
}, [value]);
|
1464
1468
|
|
@@ -1466,10 +1470,15 @@ var DropDown = function DropDown(props) {
|
|
1466
1470
|
if (predictive) {
|
1467
1471
|
setLabel(value);
|
1468
1472
|
} else {
|
1473
|
+
console.log('change', id, value);
|
1469
1474
|
if (onChange) onChange(id, value);
|
1470
1475
|
}
|
1471
1476
|
}
|
1472
1477
|
|
1478
|
+
function onFocus() {
|
1479
|
+
if (!editable) toggle();
|
1480
|
+
}
|
1481
|
+
|
1473
1482
|
function toggle() {
|
1474
1483
|
if (site && site.changeFocus) {
|
1475
1484
|
site.changeFocus({
|
@@ -1520,14 +1529,22 @@ var DropDown = function DropDown(props) {
|
|
1520
1529
|
}
|
1521
1530
|
}
|
1522
1531
|
|
1532
|
+
var title = editable ? /*#__PURE__*/React.createElement("div", {
|
1533
|
+
className: "row"
|
1534
|
+
}, props.label, /*#__PURE__*/React.createElement(Icon, {
|
1535
|
+
className: "decorator",
|
1536
|
+
icon: "edit",
|
1537
|
+
size: "small"
|
1538
|
+
})) : props.label;
|
1523
1539
|
return /*#__PURE__*/React.createElement("div", {
|
1524
1540
|
className: "dropdown"
|
1525
1541
|
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
1526
|
-
|
1542
|
+
label: title,
|
1543
|
+
onClick: onFocus,
|
1527
1544
|
value: label,
|
1528
1545
|
onChange: change,
|
1529
1546
|
onBlur: blur,
|
1530
|
-
readOnly: !predictive
|
1547
|
+
readOnly: !predictive && !editable
|
1531
1548
|
})), !readOnly ? /*#__PURE__*/React.createElement(Icon, {
|
1532
1549
|
icon: "expand_more",
|
1533
1550
|
clickable: true,
|
@@ -4651,6 +4668,8 @@ var StringEditor = function StringEditor(_ref7) {
|
|
4651
4668
|
predictive = _field$predictive === void 0 ? false : _field$predictive,
|
4652
4669
|
_field$multivalue = field.multivalue,
|
4653
4670
|
multivalue = _field$multivalue === void 0 ? false : _field$multivalue,
|
4671
|
+
_field$freeValue = field.freeValue,
|
4672
|
+
freeValue = _field$freeValue === void 0 ? false : _field$freeValue,
|
4654
4673
|
Editor = field.Editor;
|
4655
4674
|
|
4656
4675
|
function change(id, value) {
|
@@ -4733,7 +4752,8 @@ var StringEditor = function StringEditor(_ref7) {
|
|
4733
4752
|
onChange: change,
|
4734
4753
|
options: buildOptions(),
|
4735
4754
|
readOnly: !editable,
|
4736
|
-
predictive: predictive
|
4755
|
+
predictive: predictive,
|
4756
|
+
editable: freeValue
|
4737
4757
|
}) : multivalue ? /*#__PURE__*/React.createElement(TokenField, {
|
4738
4758
|
id: id,
|
4739
4759
|
label: label,
|
@@ -5635,6 +5655,8 @@ var CollectionPage = function CollectionPage(props) {
|
|
5635
5655
|
autosave = _props$autosave === void 0 ? false : _props$autosave,
|
5636
5656
|
_props$delay = props.delay,
|
5637
5657
|
delay = _props$delay === void 0 ? 1000 : _props$delay,
|
5658
|
+
_props$patch = props.patch,
|
5659
|
+
patch = _props$patch === void 0 ? false : _props$patch,
|
5638
5660
|
groupBy = props.groupBy,
|
5639
5661
|
levels = props.levels,
|
5640
5662
|
sorter = props.sorter,
|
@@ -5753,7 +5775,8 @@ var CollectionPage = function CollectionPage(props) {
|
|
5753
5775
|
delay: delay,
|
5754
5776
|
canDelete: canDelete,
|
5755
5777
|
canEdit: canEdit,
|
5756
|
-
onReload: reloadSelection
|
5778
|
+
onReload: reloadSelection,
|
5779
|
+
patch: patch
|
5757
5780
|
}), children ? /*#__PURE__*/React.createElement("article", null, children) : null, /*#__PURE__*/React.createElement("footer", null, footer)));
|
5758
5781
|
};
|
5759
5782
|
var CollectionFilters = function CollectionFilters(props) {
|
@@ -5860,7 +5883,7 @@ var CollectionList = function CollectionList(props) {
|
|
5860
5883
|
function search() {
|
5861
5884
|
var items = filter ? all.filter(function (item) {
|
5862
5885
|
var result = searchBy.some(function (fieldName) {
|
5863
|
-
var value = item[fieldName];
|
5886
|
+
var value = item[fieldName] ? item[fieldName].toUpperCase() : "";
|
5864
5887
|
return value ? value.indexOf(filter.toUpperCase()) >= 0 : false;
|
5865
5888
|
});
|
5866
5889
|
return result;
|
@@ -6035,9 +6058,19 @@ var CollectionTree = function CollectionTree(props) {
|
|
6035
6058
|
var CollectionEditor = function CollectionEditor(props) {
|
6036
6059
|
var save = function save() {
|
6037
6060
|
try {
|
6038
|
-
|
6061
|
+
var _temp3 = function _temp3() {
|
6039
6062
|
setPageContext(Object.assign({}, pageContext));
|
6040
|
-
}
|
6063
|
+
};
|
6064
|
+
|
6065
|
+
var _temp4 = function () {
|
6066
|
+
if (patch) {
|
6067
|
+
return Promise.resolve(pageContext.patch(form.id, form)).then(function () {});
|
6068
|
+
} else {
|
6069
|
+
return Promise.resolve(pageContext.update(form)).then(function () {});
|
6070
|
+
}
|
6071
|
+
}();
|
6072
|
+
|
6073
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
|
6041
6074
|
} catch (e) {
|
6042
6075
|
return Promise.reject(e);
|
6043
6076
|
}
|
@@ -6067,7 +6100,9 @@ var CollectionEditor = function CollectionEditor(props) {
|
|
6067
6100
|
_props$delay2 = props.delay,
|
6068
6101
|
delay = _props$delay2 === void 0 ? 1000 : _props$delay2,
|
6069
6102
|
canDelete = props.canDelete,
|
6070
|
-
onReload = props.onReload
|
6103
|
+
onReload = props.onReload,
|
6104
|
+
_props$patch2 = props.patch,
|
6105
|
+
patch = _props$patch2 === void 0 ? false : _props$patch2;
|
6071
6106
|
var timer = useRef(null);
|
6072
6107
|
|
6073
6108
|
var _useState5 = useState(selected),
|
@@ -6165,7 +6200,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6165
6200
|
try {
|
6166
6201
|
var _this2 = this;
|
6167
6202
|
|
6168
|
-
var
|
6203
|
+
var _temp6 = _catch$3(function () {
|
6169
6204
|
return Promise.resolve(API.all(null, page)).then(function (data) {
|
6170
6205
|
_this2.all = field ? data[field] : data;
|
6171
6206
|
});
|
@@ -6173,7 +6208,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6173
6208
|
console.log(error);
|
6174
6209
|
});
|
6175
6210
|
|
6176
|
-
return Promise.resolve(
|
6211
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
6177
6212
|
} catch (e) {
|
6178
6213
|
return Promise.reject(e);
|
6179
6214
|
}
|
@@ -6182,7 +6217,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6182
6217
|
try {
|
6183
6218
|
var _this4 = this;
|
6184
6219
|
|
6185
|
-
var
|
6220
|
+
var _temp8 = function () {
|
6186
6221
|
if (fetching) {
|
6187
6222
|
return Promise.resolve(_this4.fetch(id)).then(function (result) {
|
6188
6223
|
_this4.selected = result;
|
@@ -6196,7 +6231,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6196
6231
|
}
|
6197
6232
|
}();
|
6198
6233
|
|
6199
|
-
return Promise.resolve(
|
6234
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
|
6200
6235
|
} catch (e) {
|
6201
6236
|
return Promise.reject(e);
|
6202
6237
|
}
|
@@ -6230,7 +6265,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6230
6265
|
try {
|
6231
6266
|
var _this8 = this;
|
6232
6267
|
|
6233
|
-
var
|
6268
|
+
var _temp10 = _catch$3(function () {
|
6234
6269
|
return Promise.resolve(API.create(form)).then(function () {
|
6235
6270
|
return Promise.resolve(_this8.load()).then(function () {});
|
6236
6271
|
});
|
@@ -6238,7 +6273,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6238
6273
|
console.log(error);
|
6239
6274
|
});
|
6240
6275
|
|
6241
|
-
return Promise.resolve(
|
6276
|
+
return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
|
6242
6277
|
} catch (e) {
|
6243
6278
|
return Promise.reject(e);
|
6244
6279
|
}
|
@@ -6247,7 +6282,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6247
6282
|
try {
|
6248
6283
|
var _this10 = this;
|
6249
6284
|
|
6250
|
-
var
|
6285
|
+
var _temp12 = _catch$3(function () {
|
6251
6286
|
return Promise.resolve(API.update(form)).then(function () {
|
6252
6287
|
return Promise.resolve(_this10.load()).then(function () {});
|
6253
6288
|
});
|
@@ -6255,7 +6290,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6255
6290
|
console.log(error);
|
6256
6291
|
});
|
6257
6292
|
|
6258
|
-
return Promise.resolve(
|
6293
|
+
return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
|
6259
6294
|
} catch (e) {
|
6260
6295
|
return Promise.reject(e);
|
6261
6296
|
}
|
@@ -6264,7 +6299,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6264
6299
|
try {
|
6265
6300
|
var _this12 = this;
|
6266
6301
|
|
6267
|
-
var
|
6302
|
+
var _temp14 = _catch$3(function () {
|
6268
6303
|
return Promise.resolve(API.patch(id, form)).then(function () {
|
6269
6304
|
return Promise.resolve(_this12.load()).then(function () {});
|
6270
6305
|
});
|
@@ -6272,7 +6307,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6272
6307
|
console.log(error);
|
6273
6308
|
});
|
6274
6309
|
|
6275
|
-
return Promise.resolve(
|
6310
|
+
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
|
6276
6311
|
} catch (e) {
|
6277
6312
|
return Promise.reject(e);
|
6278
6313
|
}
|
@@ -6281,7 +6316,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6281
6316
|
try {
|
6282
6317
|
var _this14 = this;
|
6283
6318
|
|
6284
|
-
var
|
6319
|
+
var _temp16 = _catch$3(function () {
|
6285
6320
|
return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
|
6286
6321
|
return Promise.resolve(_this14.load()).then(function () {});
|
6287
6322
|
});
|
@@ -6289,7 +6324,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6289
6324
|
console.log(error);
|
6290
6325
|
});
|
6291
6326
|
|
6292
|
-
return Promise.resolve(
|
6327
|
+
return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(function () {}) : void 0);
|
6293
6328
|
} catch (e) {
|
6294
6329
|
return Promise.reject(e);
|
6295
6330
|
}
|
@@ -6298,7 +6333,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6298
6333
|
try {
|
6299
6334
|
var _this16 = this;
|
6300
6335
|
|
6301
|
-
var
|
6336
|
+
var _temp18 = _catch$3(function () {
|
6302
6337
|
return Promise.resolve(API.remove(id)).then(function () {
|
6303
6338
|
return Promise.resolve(_this16.load()).then(function () {});
|
6304
6339
|
});
|
@@ -6306,7 +6341,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
|
|
6306
6341
|
console.log(error);
|
6307
6342
|
});
|
6308
6343
|
|
6309
|
-
return Promise.resolve(
|
6344
|
+
return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
|
6310
6345
|
} catch (e) {
|
6311
6346
|
return Promise.reject(e);
|
6312
6347
|
}
|