ywana-core8 0.0.94 → 0.0.98

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.
@@ -989,6 +989,7 @@ var DataTable = function DataTable(props) {
989
989
  rows = _props$rows === void 0 ? [] : _props$rows,
990
990
  onRowSelection = props.onRowSelection,
991
991
  onSort = props.onSort,
992
+ onCheckAll = props.onCheckAll,
992
993
  editable = props.editable,
993
994
  outlined = props.outlined;
994
995
 
@@ -1044,13 +1045,23 @@ var DataTable = function DataTable(props) {
1044
1045
  if (onSort) onSort(dragged, dropped);
1045
1046
  }
1046
1047
 
1048
+ function checkAll() {
1049
+ var ids = rows.map(function (row) {
1050
+ return row.id;
1051
+ });
1052
+ if (onCheckAll) onCheckAll(ids);
1053
+ }
1054
+
1047
1055
  var style = outlined ? "outlined" : "";
1048
1056
  return /*#__PURE__*/React.createElement("div", {
1049
1057
  className: "datatable8 " + style
1050
1058
  }, /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, columns.map(function (_ref) {
1051
- var label = _ref.label,
1059
+ var id = _ref.id,
1060
+ label = _ref.label,
1052
1061
  sortable = _ref.sortable;
1053
- return /*#__PURE__*/React.createElement("th", null, /*#__PURE__*/React.createElement(Text, null, label), sortable ? /*#__PURE__*/React.createElement(Icon, {
1062
+ return /*#__PURE__*/React.createElement("th", null, id === "checked" ? /*#__PURE__*/React.createElement(CheckBox, {
1063
+ action: checkAll
1064
+ }) : /*#__PURE__*/React.createElement(Text, null, label), sortable ? /*#__PURE__*/React.createElement(Icon, {
1054
1065
  icon: "arrow_up",
1055
1066
  size: "small",
1056
1067
  clickable: true
@@ -1128,7 +1139,15 @@ var DataTableCell = function DataTableCell(_ref2) {
1128
1139
  _onChange = column.onChange,
1129
1140
  options = column.options;
1130
1141
 
1131
- if (editable && _onChange) {
1142
+ if (id === "checked") {
1143
+ return /*#__PURE__*/React.createElement(CheckBox, {
1144
+ id: id,
1145
+ value: cell,
1146
+ onChange: function onChange(id, value) {
1147
+ return _onChange(row.id, id, value);
1148
+ }
1149
+ });
1150
+ } else if (editable && _onChange) {
1132
1151
  switch (type) {
1133
1152
  case "ICON":
1134
1153
  return /*#__PURE__*/React.createElement(Icon, {
@@ -4051,31 +4070,32 @@ var TablePage = function TablePage(props) {
4051
4070
  id = _props$id === void 0 ? "table" : _props$id,
4052
4071
  icon = props.icon,
4053
4072
  title = props.title,
4054
- _props$name = props.name,
4055
- name = _props$name === void 0 ? "table 1" : _props$name,
4073
+ name = props.name,
4056
4074
  schema = props.schema,
4057
4075
  url = props.url,
4058
4076
  field = props.field,
4059
- _props$delay = props.delay,
4060
- delay = _props$delay === void 0 ? 1000 : _props$delay,
4061
4077
  actions = props.actions,
4078
+ _props$dev = props.dev,
4079
+ dev = _props$dev === void 0 ? false : _props$dev,
4080
+ tableActions = props.tableActions,
4062
4081
  editable = props.editable,
4063
4082
  _props$canFilter = props.canFilter,
4064
4083
  canFilter = _props$canFilter === void 0 ? false : _props$canFilter,
4084
+ _props$canQuery = props.canQuery,
4085
+ canQuery = _props$canQuery === void 0 ? false : _props$canQuery,
4065
4086
  _props$canAdd = props.canAdd,
4066
4087
  canAdd = _props$canAdd === void 0 ? true : _props$canAdd,
4067
4088
  _props$canDelete = props.canDelete,
4068
4089
  canDelete = _props$canDelete === void 0 ? true : _props$canDelete,
4069
- _props$dev = props.dev,
4070
- dev = _props$dev === void 0 ? false : _props$dev,
4071
4090
  _props$autosave = props.autosave,
4072
4091
  autosave = _props$autosave === void 0 ? true : _props$autosave,
4092
+ _props$delay = props.delay,
4093
+ delay = _props$delay === void 0 ? 1000 : _props$delay,
4073
4094
  groupBy = props.groupBy,
4074
4095
  validator = props.validator,
4075
4096
  scenario = props.scenario,
4076
4097
  formFilter = props.formFilter,
4077
- tableFilter = props.tableFilter,
4078
- tableActions = props.tableActions;
4098
+ tableFilter = props.tableFilter;
4079
4099
 
4080
4100
  var _useContext = useContext(PageContext),
4081
4101
  pageContext = _useContext[0],
@@ -4178,11 +4198,13 @@ var TablePage = function TablePage(props) {
4178
4198
  }, /*#__PURE__*/React.createElement(MenuItem, {
4179
4199
  label: "Cargar Escenario 1",
4180
4200
  onSelect: playScenario
4181
- })) : null, actions), canFilter ? /*#__PURE__*/React.createElement("menu", {
4201
+ })) : null, actions), /*#__PURE__*/React.createElement("menu", {
4182
4202
  className: "table-page"
4183
- }, /*#__PURE__*/React.createElement(TableFilters, {
4203
+ }, canQuery ? /*#__PURE__*/React.createElement(TableQueries, {
4184
4204
  schema: schema
4185
- })) : null, /*#__PURE__*/React.createElement("main", {
4205
+ }) : null, canFilter ? /*#__PURE__*/React.createElement(TableFilters, {
4206
+ schema: schema
4207
+ }) : null), /*#__PURE__*/React.createElement("main", {
4186
4208
  key: id,
4187
4209
  className: "table-page"
4188
4210
  }, /*#__PURE__*/React.createElement(TableEditor, {
@@ -4197,10 +4219,23 @@ var TablePage = function TablePage(props) {
4197
4219
  canDelete: canDelete
4198
4220
  })), renderAside());
4199
4221
  };
4222
+ /**
4223
+ * Table Queries
4224
+ */
4225
+
4226
+ var TableQueries = function TableQueries(props) {
4227
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Header, {
4228
+ className: "table-queries",
4229
+ title: /*#__PURE__*/React.createElement(Text, null, "Queries")
4230
+ }), /*#__PURE__*/React.createElement("main", {
4231
+ className: "table-queries"
4232
+ }, "..."));
4233
+ };
4200
4234
  /**
4201
4235
  * Table Filters
4202
4236
  */
4203
4237
 
4238
+
4204
4239
  var TableFilters = function TableFilters(props) {
4205
4240
  var change = function change(next) {
4206
4241
  try {
@@ -4238,17 +4273,20 @@ var TableFilters = function TableFilters(props) {
4238
4273
  }, [schema]);
4239
4274
 
4240
4275
  function clear() {
4241
- setForm({});
4276
+ change({});
4242
4277
  }
4243
4278
 
4244
4279
  var content = new Content(filterSchema, form);
4245
4280
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Header, {
4246
- title: /*#__PURE__*/React.createElement(Text, null, "Filtros")
4281
+ className: "table-filters",
4282
+ title: /*#__PURE__*/React.createElement(Text, null, "Filters")
4247
4283
  }, /*#__PURE__*/React.createElement(Button$1, {
4248
4284
  icon: "filter_list_off",
4249
- label: "Limpiar",
4285
+ label: "Clean",
4250
4286
  action: clear
4251
- })), /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement(ContentEditor, {
4287
+ })), /*#__PURE__*/React.createElement("main", {
4288
+ className: "table-filters"
4289
+ }, /*#__PURE__*/React.createElement(ContentEditor, {
4252
4290
  content: content,
4253
4291
  onChange: change
4254
4292
  })));
@@ -4259,6 +4297,11 @@ var TableFilters = function TableFilters(props) {
4259
4297
 
4260
4298
 
4261
4299
  var TableEditor = function TableEditor(props) {
4300
+ var check = function check(ids) {
4301
+
4302
+ return Promise.resolve();
4303
+ };
4304
+
4262
4305
  var select = function select(row, event) {
4263
4306
  try {
4264
4307
  clear();
@@ -4401,7 +4444,8 @@ var TableEditor = function TableEditor(props) {
4401
4444
  className: "size"
4402
4445
  }, groupSize)), /*#__PURE__*/React.createElement(DataTable, _extends({}, table, {
4403
4446
  onRowSelection: select,
4404
- editable: editable
4447
+ editable: editable,
4448
+ onCheckAll: check
4405
4449
  })));
4406
4450
  });
4407
4451
  }