ywana-core8 0.0.572 → 0.0.573
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 +91 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +91 -107
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +91 -107
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentEditor.js +4 -3
- package/src/domain/TablePage.js +6 -0
- package/src/domain/TablePage2.js +28 -29
- package/src/site/site.test.js +9 -10
package/dist/index.modern.js
CHANGED
@@ -4837,6 +4837,8 @@ var CollectionEditor$1 = function CollectionEditor(_ref11) {
|
|
4837
4837
|
var id = field.id,
|
4838
4838
|
item = field.item,
|
4839
4839
|
label = field.label,
|
4840
|
+
_field$groupBy = field.groupBy,
|
4841
|
+
groupBy = _field$groupBy === void 0 ? "field1" : _field$groupBy,
|
4840
4842
|
Feeder = field.Feeder,
|
4841
4843
|
Renderer = field.Renderer,
|
4842
4844
|
_field$Adder = field.Adder,
|
@@ -4858,42 +4860,24 @@ var CollectionEditor$1 = function CollectionEditor(_ref11) {
|
|
4858
4860
|
}
|
4859
4861
|
}
|
4860
4862
|
|
4861
|
-
function change(index, cellId, cellValue) {
|
4862
|
-
if (onChange) {
|
4863
|
-
var next = value.slice();
|
4864
|
-
next[index][cellId] = cellValue;
|
4865
|
-
onChange(id, next);
|
4866
|
-
}
|
4867
|
-
}
|
4868
|
-
|
4869
4863
|
function reload() {
|
4870
4864
|
if (onReload) onReload();
|
4871
4865
|
}
|
4866
|
+
/* const columns = Object.values(item)
|
4867
|
+
.filter(field => field.column === true)
|
4868
|
+
.map((item) => ({ ...item, onChange: change }))
|
4869
|
+
columns.push({ id: 'actions', label: 'Actions' })
|
4870
|
+
const rows = value.map((item, index) => ({
|
4871
|
+
...item,
|
4872
|
+
id: index,
|
4873
|
+
actions: [
|
4874
|
+
<Icon icon='delete' clickable action={() => remove(index)} size="small" />
|
4875
|
+
]
|
4876
|
+
}))
|
4877
|
+
const table = { columns, rows }
|
4878
|
+
*/
|
4879
|
+
|
4872
4880
|
|
4873
|
-
var columns = Object.values(item).filter(function (field) {
|
4874
|
-
return field.column === true;
|
4875
|
-
}).map(function (item) {
|
4876
|
-
return _extends({}, item, {
|
4877
|
-
onChange: change
|
4878
|
-
});
|
4879
|
-
});
|
4880
|
-
columns.push({
|
4881
|
-
id: 'actions',
|
4882
|
-
label: 'Actions'
|
4883
|
-
});
|
4884
|
-
value.map(function (item, index) {
|
4885
|
-
return _extends({}, item, {
|
4886
|
-
id: index,
|
4887
|
-
actions: [/*#__PURE__*/React.createElement(Icon, {
|
4888
|
-
icon: "delete",
|
4889
|
-
clickable: true,
|
4890
|
-
action: function action() {
|
4891
|
-
return remove(index);
|
4892
|
-
},
|
4893
|
-
size: "small"
|
4894
|
-
})]
|
4895
|
-
});
|
4896
|
-
});
|
4897
4881
|
return /*#__PURE__*/React.createElement("div", {
|
4898
4882
|
className: "collection-editor"
|
4899
4883
|
}, Renderer ? /*#__PURE__*/React.createElement(Renderer, {
|
@@ -4908,7 +4892,7 @@ var CollectionEditor$1 = function CollectionEditor(_ref11) {
|
|
4908
4892
|
title: label,
|
4909
4893
|
data: value,
|
4910
4894
|
schema: item,
|
4911
|
-
groupBy:
|
4895
|
+
groupBy: groupBy,
|
4912
4896
|
canDelete: true,
|
4913
4897
|
remove: remove
|
4914
4898
|
}), /*#__PURE__*/React.createElement("footer", null, Feeder ? /*#__PURE__*/React.createElement(Feeder, {
|
@@ -6626,8 +6610,10 @@ var TableSelector$2 = function TableSelector(props) {
|
|
6626
6610
|
action: function action() {
|
6627
6611
|
return _action(checked, pageContext, function () {
|
6628
6612
|
try {
|
6629
|
-
return Promise.resolve(pageContext.
|
6630
|
-
|
6613
|
+
return Promise.resolve(pageContext.clearChecks()).then(function () {
|
6614
|
+
return Promise.resolve(pageContext.load()).then(function () {
|
6615
|
+
setPageContext(Object.assign({}, pageContext));
|
6616
|
+
});
|
6631
6617
|
});
|
6632
6618
|
} catch (e) {
|
6633
6619
|
return Promise.reject(e);
|
@@ -7099,6 +7085,9 @@ var TableContext$2 = function TableContext(url, field, host, urlQuery, params) {
|
|
7099
7085
|
});
|
7100
7086
|
}
|
7101
7087
|
},
|
7088
|
+
clearChecks: function clearChecks() {
|
7089
|
+
this.checked = new Set([]);
|
7090
|
+
},
|
7102
7091
|
select: function select(id) {
|
7103
7092
|
var result = this.all.find(function (item) {
|
7104
7093
|
return item.id === id;
|
@@ -7306,44 +7295,6 @@ function _catch$1(body, recover) {
|
|
7306
7295
|
|
7307
7296
|
|
7308
7297
|
var TablePage2 = function TablePage2(props) {
|
7309
|
-
var playScenario = function playScenario() {
|
7310
|
-
try {
|
7311
|
-
var promises1 = pageContext.all.map(function (item) {
|
7312
|
-
try {
|
7313
|
-
return Promise.resolve(pageContext.remove(item.id));
|
7314
|
-
} catch (e) {
|
7315
|
-
return Promise.reject(e);
|
7316
|
-
}
|
7317
|
-
});
|
7318
|
-
Promise.all(promises1).then(function () {
|
7319
|
-
try {
|
7320
|
-
var promises2 = scenario.map(function (item) {
|
7321
|
-
try {
|
7322
|
-
return Promise.resolve(pageContext.create(item));
|
7323
|
-
} catch (e) {
|
7324
|
-
return Promise.reject(e);
|
7325
|
-
}
|
7326
|
-
});
|
7327
|
-
Promise.all(promises2).then(function () {
|
7328
|
-
try {
|
7329
|
-
return Promise.resolve(pageContext.load()).then(function () {
|
7330
|
-
setPageContext(Object.assign({}, pageContext));
|
7331
|
-
});
|
7332
|
-
} catch (e) {
|
7333
|
-
return Promise.reject(e);
|
7334
|
-
}
|
7335
|
-
});
|
7336
|
-
return Promise.resolve();
|
7337
|
-
} catch (e) {
|
7338
|
-
return Promise.reject(e);
|
7339
|
-
}
|
7340
|
-
});
|
7341
|
-
return Promise.resolve();
|
7342
|
-
} catch (e) {
|
7343
|
-
return Promise.reject(e);
|
7344
|
-
}
|
7345
|
-
};
|
7346
|
-
|
7347
7298
|
var save = function save() {
|
7348
7299
|
try {
|
7349
7300
|
return Promise.resolve(pageContext.update(form)).then(function () {
|
@@ -7376,15 +7327,17 @@ var TablePage2 = function TablePage2(props) {
|
|
7376
7327
|
host = props.host,
|
7377
7328
|
_props$params = props.params,
|
7378
7329
|
params = _props$params === void 0 ? "" : _props$params,
|
7330
|
+
_props$canQuery = props.canQuery,
|
7331
|
+
canQuery = _props$canQuery === void 0 ? false : _props$canQuery,
|
7332
|
+
urlQuery = props.urlQuery,
|
7333
|
+
user = props.user,
|
7334
|
+
editable = props.editable,
|
7379
7335
|
_props$autosave = props.autosave,
|
7380
7336
|
autosave = _props$autosave === void 0 ? true : _props$autosave,
|
7381
7337
|
_props$delay = props.delay,
|
7382
7338
|
delay = _props$delay === void 0 ? 1000 : _props$delay,
|
7383
|
-
editable = props.editable,
|
7384
7339
|
_props$actions = props.actions,
|
7385
7340
|
actions = _props$actions === void 0 ? [] : _props$actions,
|
7386
|
-
_props$dev = props.dev,
|
7387
|
-
dev = _props$dev === void 0 ? false : _props$dev,
|
7388
7341
|
tableActions = props.tableActions,
|
7389
7342
|
_props$selectionActio = props.selectionActions,
|
7390
7343
|
selectionActions = _props$selectionActio === void 0 ? [] : _props$selectionActio,
|
@@ -7396,26 +7349,22 @@ var TablePage2 = function TablePage2(props) {
|
|
7396
7349
|
canDelete = _props$canDelete === void 0 ? true : _props$canDelete,
|
7397
7350
|
_props$canEdit = props.canEdit,
|
7398
7351
|
canEdit = _props$canEdit === void 0 ? true : _props$canEdit,
|
7399
|
-
_props$canQuery = props.canQuery,
|
7400
|
-
canQuery = _props$canQuery === void 0 ? false : _props$canQuery,
|
7401
|
-
urlQuery = props.urlQuery,
|
7402
|
-
user = props.user,
|
7403
7352
|
groupBy = props.groupBy,
|
7404
7353
|
validator = props.validator,
|
7405
|
-
scenario = props.scenario,
|
7406
7354
|
formFilter = props.formFilter,
|
7407
7355
|
tableFilter = props.tableFilter,
|
7408
7356
|
_props$editorFilter = props.editorFilter,
|
7409
7357
|
editorFilter = _props$editorFilter === void 0 ? false : _props$editorFilter,
|
7358
|
+
tabbedBy = props.tabbedBy,
|
7410
7359
|
tableClassName = props.tableClassName,
|
7411
7360
|
children = props.children;
|
7412
7361
|
|
7413
7362
|
var _useContext = useContext(PageContext),
|
7414
|
-
pageContext = _useContext[0],
|
7415
7363
|
setPageContext = _useContext[1];
|
7416
7364
|
|
7417
7365
|
var context = TableContext$1(url, field, host, urlQuery, params);
|
7418
|
-
var
|
7366
|
+
var _pageContext = pageContext,
|
7367
|
+
selected = _pageContext.selected;
|
7419
7368
|
var timer = useRef(null);
|
7420
7369
|
|
7421
7370
|
var _useState = useState(selected),
|
@@ -7554,12 +7503,7 @@ var TablePage2 = function TablePage2(props) {
|
|
7554
7503
|
icon: "refresh",
|
7555
7504
|
label: "Reload",
|
7556
7505
|
action: reload
|
7557
|
-
}),
|
7558
|
-
align: "alignRight"
|
7559
|
-
}, /*#__PURE__*/React.createElement(MenuItem, {
|
7560
|
-
label: "Cargar Escenario 1",
|
7561
|
-
onSelect: playScenario
|
7562
|
-
})) : null, renderActions()), canQuery || canFilter ? /*#__PURE__*/React.createElement("menu", {
|
7506
|
+
}), renderActions()), canQuery || canFilter ? /*#__PURE__*/React.createElement("menu", {
|
7563
7507
|
className: "table-page"
|
7564
7508
|
}, canQuery ? /*#__PURE__*/React.createElement(TableQueries$1, {
|
7565
7509
|
schema: schema,
|
@@ -7577,6 +7521,7 @@ var TablePage2 = function TablePage2(props) {
|
|
7577
7521
|
schema: schema,
|
7578
7522
|
delay: delay,
|
7579
7523
|
editable: editable,
|
7524
|
+
tabbedBy: tabbedBy,
|
7580
7525
|
groupBy: groupBy,
|
7581
7526
|
filter: tableFilter,
|
7582
7527
|
actions: tableActions,
|
@@ -7865,7 +7810,7 @@ var TableEditor$1 = function TableEditor(props) {
|
|
7865
7810
|
var remove = function remove(id) {
|
7866
7811
|
try {
|
7867
7812
|
return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
|
7868
|
-
var
|
7813
|
+
var _temp5 = function () {
|
7869
7814
|
if (confirm) {
|
7870
7815
|
return Promise.resolve(pageContext.remove(id)).then(function () {
|
7871
7816
|
pageContext.clear();
|
@@ -7874,7 +7819,7 @@ var TableEditor$1 = function TableEditor(props) {
|
|
7874
7819
|
}
|
7875
7820
|
}();
|
7876
7821
|
|
7877
|
-
if (
|
7822
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
7878
7823
|
});
|
7879
7824
|
} catch (e) {
|
7880
7825
|
return Promise.reject(e);
|
@@ -7902,6 +7847,29 @@ var TableEditor$1 = function TableEditor(props) {
|
|
7902
7847
|
groupBy = _useState4[0],
|
7903
7848
|
setGroupBy = _useState4[1];
|
7904
7849
|
|
7850
|
+
var _useState5 = useState(0),
|
7851
|
+
tab = _useState5[0];
|
7852
|
+
|
7853
|
+
useEffect(function () {
|
7854
|
+
try {
|
7855
|
+
var _temp4 = function () {
|
7856
|
+
if (tab) {
|
7857
|
+
var _filter2;
|
7858
|
+
|
7859
|
+
var _filter = (_filter2 = {}, _filter2[tab.field] = tab.value, _filter2);
|
7860
|
+
|
7861
|
+
return Promise.resolve(pageContext.load(_filter, [])).then(function () {
|
7862
|
+
setPageContext(Object.assign({}, pageContext));
|
7863
|
+
});
|
7864
|
+
}
|
7865
|
+
}();
|
7866
|
+
|
7867
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
|
7868
|
+
} catch (e) {
|
7869
|
+
return Promise.reject(e);
|
7870
|
+
}
|
7871
|
+
}, [tab]);
|
7872
|
+
|
7905
7873
|
function changeGroup(id, value) {
|
7906
7874
|
setGroupBy(value);
|
7907
7875
|
}
|
@@ -7961,6 +7929,14 @@ var TableEditor$1 = function TableEditor(props) {
|
|
7961
7929
|
}
|
7962
7930
|
}
|
7963
7931
|
|
7932
|
+
var tabField = Object.values(schema).find(function (field) {
|
7933
|
+
return field.tab === true;
|
7934
|
+
});
|
7935
|
+
var tabs = tabField ? tabField.options.map(function (option) {
|
7936
|
+
return Object.assign({}, option, {
|
7937
|
+
field: tabField.id
|
7938
|
+
});
|
7939
|
+
}) : [];
|
7964
7940
|
var table = useMemo(function () {
|
7965
7941
|
return {
|
7966
7942
|
columns: Object.values(schema).filter(function (field) {
|
@@ -8053,7 +8029,15 @@ var TableEditor$1 = function TableEditor(props) {
|
|
8053
8029
|
value: groupBy,
|
8054
8030
|
options: buildGroupOptions(schema),
|
8055
8031
|
onChange: changeGroup
|
8056
|
-
}) : null
|
8032
|
+
}) : null, tabbedBy ? /*#__PURE__*/React.createElement(Tabs, {
|
8033
|
+
fillRight: true,
|
8034
|
+
fillLeft: false
|
8035
|
+
}, tabs.map(function (tab) {
|
8036
|
+
return /*#__PURE__*/React.createElement(Tab, {
|
8037
|
+
id: tab.value,
|
8038
|
+
label: tab.label
|
8039
|
+
});
|
8040
|
+
})) : ''), /*#__PURE__*/React.createElement("main", {
|
8057
8041
|
className: "table-editor"
|
8058
8042
|
}, /*#__PURE__*/React.createElement(Accordion, {
|
8059
8043
|
sections: sections
|
@@ -8075,7 +8059,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8075
8059
|
try {
|
8076
8060
|
var _this2 = this;
|
8077
8061
|
|
8078
|
-
var
|
8062
|
+
var _temp7 = _catch$1(function () {
|
8079
8063
|
var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
|
8080
8064
|
var field = filter[key];
|
8081
8065
|
|
@@ -8099,7 +8083,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8099
8083
|
console.log(error);
|
8100
8084
|
});
|
8101
8085
|
|
8102
|
-
return Promise.resolve(
|
8086
|
+
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
|
8103
8087
|
} catch (e) {
|
8104
8088
|
return Promise.reject(e);
|
8105
8089
|
}
|
@@ -8134,7 +8118,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8134
8118
|
try {
|
8135
8119
|
var _this5 = this;
|
8136
8120
|
|
8137
|
-
var
|
8121
|
+
var _temp9 = _catch$1(function () {
|
8138
8122
|
return Promise.resolve(API.create(form)).then(function () {
|
8139
8123
|
return Promise.resolve(_this5.load()).then(function () {});
|
8140
8124
|
});
|
@@ -8142,7 +8126,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8142
8126
|
console.log(error);
|
8143
8127
|
});
|
8144
8128
|
|
8145
|
-
return Promise.resolve(
|
8129
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
|
8146
8130
|
} catch (e) {
|
8147
8131
|
return Promise.reject(e);
|
8148
8132
|
}
|
@@ -8151,7 +8135,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8151
8135
|
try {
|
8152
8136
|
var _this7 = this;
|
8153
8137
|
|
8154
|
-
var
|
8138
|
+
var _temp11 = _catch$1(function () {
|
8155
8139
|
return Promise.resolve(API.update(form)).then(function () {
|
8156
8140
|
return Promise.resolve(_this7.load()).then(function () {});
|
8157
8141
|
});
|
@@ -8159,7 +8143,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8159
8143
|
console.log(error);
|
8160
8144
|
});
|
8161
8145
|
|
8162
|
-
return Promise.resolve(
|
8146
|
+
return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
|
8163
8147
|
} catch (e) {
|
8164
8148
|
return Promise.reject(e);
|
8165
8149
|
}
|
@@ -8168,7 +8152,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8168
8152
|
try {
|
8169
8153
|
var _this9 = this;
|
8170
8154
|
|
8171
|
-
var
|
8155
|
+
var _temp13 = _catch$1(function () {
|
8172
8156
|
return Promise.resolve(API.remove(id)).then(function () {
|
8173
8157
|
return Promise.resolve(_this9.load()).then(function () {});
|
8174
8158
|
});
|
@@ -8176,7 +8160,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8176
8160
|
console.log(error);
|
8177
8161
|
});
|
8178
8162
|
|
8179
|
-
return Promise.resolve(
|
8163
|
+
return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
|
8180
8164
|
} catch (e) {
|
8181
8165
|
return Promise.reject(e);
|
8182
8166
|
}
|
@@ -8188,7 +8172,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8188
8172
|
try {
|
8189
8173
|
var _this11 = this;
|
8190
8174
|
|
8191
|
-
var
|
8175
|
+
var _temp15 = _catch$1(function () {
|
8192
8176
|
return Promise.resolve(API.queries(user, urlQuery)).then(function (_API$queries) {
|
8193
8177
|
_this11.queries = _API$queries;
|
8194
8178
|
});
|
@@ -8196,7 +8180,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8196
8180
|
console.log(error);
|
8197
8181
|
});
|
8198
8182
|
|
8199
|
-
return Promise.resolve(
|
8183
|
+
return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
|
8200
8184
|
} catch (e) {
|
8201
8185
|
return Promise.reject(e);
|
8202
8186
|
}
|
@@ -8205,7 +8189,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8205
8189
|
try {
|
8206
8190
|
var _this13 = this;
|
8207
8191
|
|
8208
|
-
var
|
8192
|
+
var _temp17 = _catch$1(function () {
|
8209
8193
|
return Promise.resolve(API.createQuery(query, urlQuery)).then(function () {
|
8210
8194
|
return Promise.resolve(_this13.loadQueries(user)).then(function () {});
|
8211
8195
|
});
|
@@ -8213,7 +8197,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8213
8197
|
console.log(error);
|
8214
8198
|
});
|
8215
8199
|
|
8216
|
-
return Promise.resolve(
|
8200
|
+
return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
|
8217
8201
|
} catch (e) {
|
8218
8202
|
return Promise.reject(e);
|
8219
8203
|
}
|
@@ -8222,7 +8206,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8222
8206
|
try {
|
8223
8207
|
var _this15 = this;
|
8224
8208
|
|
8225
|
-
var
|
8209
|
+
var _temp19 = _catch$1(function () {
|
8226
8210
|
return Promise.resolve(API.removeQuery(id, urlQuery)).then(function () {
|
8227
8211
|
return Promise.resolve(_this15.loadQueries(user)).then(function () {});
|
8228
8212
|
});
|
@@ -8230,7 +8214,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8230
8214
|
console.log(error);
|
8231
8215
|
});
|
8232
8216
|
|
8233
|
-
return Promise.resolve(
|
8217
|
+
return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
|
8234
8218
|
} catch (e) {
|
8235
8219
|
return Promise.reject(e);
|
8236
8220
|
}
|
@@ -8238,7 +8222,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
|
|
8238
8222
|
};
|
8239
8223
|
};
|
8240
8224
|
/**
|
8241
|
-
*
|
8225
|
+
* Table API
|
8242
8226
|
*/
|
8243
8227
|
|
8244
8228
|
|