ywana-core8 0.0.488 → 0.0.491
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 +440 -369
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +25 -18
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +440 -370
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +440 -369
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +43 -7
- package/src/domain/index.js +1 -1
- package/src/html/table.css +7 -0
- package/src/html/table.js +19 -7
- package/src/html/table.test.js +13 -12
- package/src/site/site.test.js +36 -2
package/dist/index.cjs
CHANGED
@@ -926,307 +926,6 @@ var Stack = function Stack(props) {
|
|
926
926
|
return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, child);
|
927
927
|
};
|
928
928
|
|
929
|
-
/**
|
930
|
-
* Text Field
|
931
|
-
*/
|
932
|
-
|
933
|
-
var TextField = function TextField(props) {
|
934
|
-
var site = React.useContext(SiteContext);
|
935
|
-
var id = props.id,
|
936
|
-
_props$type = props.type,
|
937
|
-
type = _props$type === void 0 ? 'text' : _props$type,
|
938
|
-
label = props.label,
|
939
|
-
placeholder = props.placeholder,
|
940
|
-
value = props.value,
|
941
|
-
outlined = props.outlined,
|
942
|
-
_props$readOnly = props.readOnly,
|
943
|
-
readOnly = _props$readOnly === void 0 ? false : _props$readOnly,
|
944
|
-
_props$canClear = props.canClear,
|
945
|
-
canClear = _props$canClear === void 0 ? true : _props$canClear,
|
946
|
-
onChange = props.onChange,
|
947
|
-
onEnter = props.onEnter,
|
948
|
-
onClick = props.onClick,
|
949
|
-
onBlur = props.onBlur;
|
950
|
-
|
951
|
-
function onKeyPress(event) {
|
952
|
-
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
|
953
|
-
|
954
|
-
if (key == 13) {
|
955
|
-
if (onEnter) onEnter();
|
956
|
-
}
|
957
|
-
}
|
958
|
-
|
959
|
-
function change(event) {
|
960
|
-
event.stopPropagation();
|
961
|
-
event.preventDefault();
|
962
|
-
var value = event.target.value;
|
963
|
-
if (onChange) onChange(id, value);
|
964
|
-
}
|
965
|
-
|
966
|
-
function focus() {
|
967
|
-
if (site && site.changeFocus) {
|
968
|
-
site.changeFocus({
|
969
|
-
lose: function lose() {// DO NOTHING
|
970
|
-
}
|
971
|
-
});
|
972
|
-
}
|
973
|
-
}
|
974
|
-
|
975
|
-
function blur() {
|
976
|
-
if (onBlur) onBlur();
|
977
|
-
}
|
978
|
-
|
979
|
-
function clear() {
|
980
|
-
if (onChange) onChange(id, "");
|
981
|
-
}
|
982
|
-
|
983
|
-
var borderStyle = outlined ? "textfield-outlined" : "textfield";
|
984
|
-
var labelStyle = label ? "" : "no-label";
|
985
|
-
var style = labelStyle + " " + borderStyle + " textfield-" + type;
|
986
|
-
var labelTxt = /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
987
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
988
|
-
className: "" + style,
|
989
|
-
onClick: onClick
|
990
|
-
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
991
|
-
id: id,
|
992
|
-
type: type,
|
993
|
-
placeholder: placeholder,
|
994
|
-
value: value,
|
995
|
-
required: true,
|
996
|
-
onChange: change,
|
997
|
-
onKeyDown: onKeyPress,
|
998
|
-
onFocus: focus,
|
999
|
-
onBlur: blur,
|
1000
|
-
readOnly: readOnly
|
1001
|
-
}), canClear && value && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
1002
|
-
icon: "close",
|
1003
|
-
clickable: true,
|
1004
|
-
size: "small",
|
1005
|
-
action: clear
|
1006
|
-
}) : null, /*#__PURE__*/React__default["default"].createElement("span", {
|
1007
|
-
className: "bar"
|
1008
|
-
}), label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null);
|
1009
|
-
};
|
1010
|
-
/**
|
1011
|
-
* Text Area
|
1012
|
-
*/
|
1013
|
-
|
1014
|
-
var TextArea = function TextArea(props) {
|
1015
|
-
var site = React.useContext(SiteContext);
|
1016
|
-
var id = props.id,
|
1017
|
-
_props$type2 = props.type,
|
1018
|
-
type = _props$type2 === void 0 ? 'text' : _props$type2,
|
1019
|
-
label = props.label,
|
1020
|
-
placeholder = props.placeholder,
|
1021
|
-
value = props.value,
|
1022
|
-
_props$readOnly2 = props.readOnly,
|
1023
|
-
readOnly = _props$readOnly2 === void 0 ? false : _props$readOnly2,
|
1024
|
-
_props$canClear2 = props.canClear,
|
1025
|
-
canClear = _props$canClear2 === void 0 ? true : _props$canClear2,
|
1026
|
-
onChange = props.onChange,
|
1027
|
-
onEnter = props.onEnter,
|
1028
|
-
onClick = props.onClick;
|
1029
|
-
|
1030
|
-
function onKeyPress(event) {
|
1031
|
-
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
|
1032
|
-
|
1033
|
-
if (key == 13) {
|
1034
|
-
if (onEnter) onEnter();
|
1035
|
-
}
|
1036
|
-
}
|
1037
|
-
|
1038
|
-
function change(event) {
|
1039
|
-
event.stopPropagation();
|
1040
|
-
event.preventDefault();
|
1041
|
-
var value = event.target.value;
|
1042
|
-
if (onChange) onChange(id, value);
|
1043
|
-
}
|
1044
|
-
|
1045
|
-
function focus() {
|
1046
|
-
if (site && site.changeFocus) {
|
1047
|
-
site.changeFocus({
|
1048
|
-
lose: function lose() {// DO NOTHING
|
1049
|
-
}
|
1050
|
-
});
|
1051
|
-
}
|
1052
|
-
}
|
1053
|
-
|
1054
|
-
function clear() {
|
1055
|
-
if (onChange) onChange(id, "");
|
1056
|
-
}
|
1057
|
-
|
1058
|
-
var labelStyle = label ? "" : "no-label";
|
1059
|
-
var style = "textarea " + labelStyle + " textarea-" + type;
|
1060
|
-
var labelTxt = /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
1061
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
1062
|
-
className: "" + style,
|
1063
|
-
onClick: onClick
|
1064
|
-
}, /*#__PURE__*/React__default["default"].createElement("textarea", {
|
1065
|
-
id: id,
|
1066
|
-
placeholder: placeholder,
|
1067
|
-
value: value,
|
1068
|
-
required: true,
|
1069
|
-
onChange: change,
|
1070
|
-
onKeyDown: onKeyPress,
|
1071
|
-
onFocus: focus,
|
1072
|
-
readOnly: readOnly
|
1073
|
-
}), canClear && value && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
1074
|
-
icon: "close",
|
1075
|
-
clickable: true,
|
1076
|
-
size: "small",
|
1077
|
-
action: clear
|
1078
|
-
}) : null, /*#__PURE__*/React__default["default"].createElement("span", {
|
1079
|
-
className: "bar"
|
1080
|
-
}), label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null);
|
1081
|
-
};
|
1082
|
-
/**
|
1083
|
-
* Dropdown
|
1084
|
-
*/
|
1085
|
-
|
1086
|
-
var DropDown = function DropDown(props) {
|
1087
|
-
var site = React.useContext(SiteContext);
|
1088
|
-
var id = props.id,
|
1089
|
-
_props$options = props.options,
|
1090
|
-
options = _props$options === void 0 ? [] : _props$options,
|
1091
|
-
value = props.value,
|
1092
|
-
onChange = props.onChange,
|
1093
|
-
_props$predictive = props.predictive,
|
1094
|
-
predictive = _props$predictive === void 0 ? false : _props$predictive,
|
1095
|
-
_props$readOnly3 = props.readOnly,
|
1096
|
-
readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3,
|
1097
|
-
_props$verbose = props.verbose,
|
1098
|
-
verbose = _props$verbose === void 0 ? true : _props$verbose,
|
1099
|
-
onBlur = props.onBlur;
|
1100
|
-
|
1101
|
-
var _useState = React.useState(false),
|
1102
|
-
open = _useState[0],
|
1103
|
-
setOpen = _useState[1];
|
1104
|
-
|
1105
|
-
var _useState2 = React.useState(),
|
1106
|
-
label = _useState2[0],
|
1107
|
-
setLabel = _useState2[1];
|
1108
|
-
|
1109
|
-
React.useEffect(function () {
|
1110
|
-
if (Array.isArray(options)) {
|
1111
|
-
var option = options.find(function (option) {
|
1112
|
-
return option.value === value;
|
1113
|
-
});
|
1114
|
-
|
1115
|
-
var _label = option ? option.label : "";
|
1116
|
-
|
1117
|
-
setLabel(_label);
|
1118
|
-
}
|
1119
|
-
}, [value]);
|
1120
|
-
|
1121
|
-
function change(id, value) {
|
1122
|
-
if (predictive) {
|
1123
|
-
setLabel(value);
|
1124
|
-
} else {
|
1125
|
-
if (onChange) onChange(id, value);
|
1126
|
-
}
|
1127
|
-
}
|
1128
|
-
|
1129
|
-
function toggle() {
|
1130
|
-
if (site && site.changeFocus) {
|
1131
|
-
site.changeFocus({
|
1132
|
-
lose: function lose() {
|
1133
|
-
setOpen(false);
|
1134
|
-
}
|
1135
|
-
});
|
1136
|
-
}
|
1137
|
-
|
1138
|
-
if (!readOnly) setOpen(!open);
|
1139
|
-
}
|
1140
|
-
|
1141
|
-
function select(event) {
|
1142
|
-
var next = event.target.getAttribute("value");
|
1143
|
-
var option = options.find(function (option) {
|
1144
|
-
return option.value === next;
|
1145
|
-
});
|
1146
|
-
setOpen(false);
|
1147
|
-
var label = verbose ? option.label : "";
|
1148
|
-
setLabel(label);
|
1149
|
-
if (onChange) onChange(id, next);
|
1150
|
-
}
|
1151
|
-
|
1152
|
-
function blur() {
|
1153
|
-
if (onBlur) onBlur();
|
1154
|
-
}
|
1155
|
-
|
1156
|
-
function renderOptions() {
|
1157
|
-
var canShow = open == true && Array.isArray(options);
|
1158
|
-
|
1159
|
-
if (canShow) {
|
1160
|
-
var filterActive = predictive === true && label && label.length > 0;
|
1161
|
-
var items = filterActive ? options.filter(function (option) {
|
1162
|
-
return option.label.toUpperCase().indexOf(label.toUpperCase()) >= 0;
|
1163
|
-
}) : options;
|
1164
|
-
var lis = items.map(function (option) {
|
1165
|
-
return /*#__PURE__*/React__default["default"].createElement("li", {
|
1166
|
-
key: option.value,
|
1167
|
-
value: option.value
|
1168
|
-
}, option.label);
|
1169
|
-
});
|
1170
|
-
return /*#__PURE__*/React__default["default"].createElement("menu", null, /*#__PURE__*/React__default["default"].createElement("ul", {
|
1171
|
-
onMouseDown: select
|
1172
|
-
}, lis));
|
1173
|
-
} else {
|
1174
|
-
return null;
|
1175
|
-
}
|
1176
|
-
}
|
1177
|
-
|
1178
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
1179
|
-
className: "dropdown"
|
1180
|
-
}, /*#__PURE__*/React__default["default"].createElement(TextField, _extends({}, props, {
|
1181
|
-
onClick: toggle,
|
1182
|
-
value: label,
|
1183
|
-
onChange: change,
|
1184
|
-
onBlur: blur,
|
1185
|
-
readOnly: !predictive
|
1186
|
-
})), !readOnly ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
1187
|
-
icon: "expand_more",
|
1188
|
-
clickable: true,
|
1189
|
-
size: "small",
|
1190
|
-
action: toggle
|
1191
|
-
}) : null, renderOptions());
|
1192
|
-
};
|
1193
|
-
var DateRange = function DateRange(props) {
|
1194
|
-
var id = props.id,
|
1195
|
-
label = props.label,
|
1196
|
-
onChange = props.onChange;
|
1197
|
-
|
1198
|
-
var _useState3 = React.useState({}),
|
1199
|
-
form = _useState3[0],
|
1200
|
-
setForm = _useState3[1];
|
1201
|
-
|
1202
|
-
React.useEffect(function () {
|
1203
|
-
if (onChange) onChange(id, form);
|
1204
|
-
}, [form]);
|
1205
|
-
|
1206
|
-
function change(id, value) {
|
1207
|
-
var _Object$assign;
|
1208
|
-
|
1209
|
-
var next = Object.assign({}, form, (_Object$assign = {}, _Object$assign[id] = value, _Object$assign));
|
1210
|
-
setForm(next);
|
1211
|
-
}
|
1212
|
-
|
1213
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
1214
|
-
className: "date-range"
|
1215
|
-
}, label ? /*#__PURE__*/React__default["default"].createElement("label", null, label) : null, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
1216
|
-
id: "from",
|
1217
|
-
type: "date",
|
1218
|
-
label: "From",
|
1219
|
-
value: form.from,
|
1220
|
-
onChange: change
|
1221
|
-
}), /*#__PURE__*/React__default["default"].createElement(TextField, {
|
1222
|
-
id: "to",
|
1223
|
-
type: "date",
|
1224
|
-
label: "To",
|
1225
|
-
value: form.to,
|
1226
|
-
onChange: change
|
1227
|
-
}));
|
1228
|
-
};
|
1229
|
-
|
1230
929
|
/**
|
1231
930
|
* TYPES
|
1232
931
|
*/
|
@@ -1413,77 +1112,354 @@ var ContentType = /*#__PURE__*/function () {
|
|
1413
1112
|
}) : [];
|
1414
1113
|
}
|
1415
1114
|
|
1416
|
-
break;
|
1115
|
+
break;
|
1116
|
+
|
1117
|
+
default:
|
1118
|
+
next[name] = field;
|
1119
|
+
break;
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
return next;
|
1123
|
+
}, {});
|
1124
|
+
return next;
|
1125
|
+
};
|
1126
|
+
|
1127
|
+
return ContentType;
|
1128
|
+
}();
|
1129
|
+
/**
|
1130
|
+
* Content
|
1131
|
+
*/
|
1132
|
+
|
1133
|
+
var Content = /*#__PURE__*/function () {
|
1134
|
+
function Content(type, value) {
|
1135
|
+
this.type = type;
|
1136
|
+
this._type = new ContentType(type);
|
1137
|
+
this._value = value;
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
var _proto2 = Content.prototype;
|
1141
|
+
|
1142
|
+
_proto2.isValid = function isValid() {
|
1143
|
+
return this._type.validate(this._value);
|
1144
|
+
};
|
1145
|
+
|
1146
|
+
_proto2.value = function value() {
|
1147
|
+
return this._type.value(this._value);
|
1148
|
+
};
|
1149
|
+
|
1150
|
+
_proto2.form = function form() {
|
1151
|
+
return this._type.form(this._value);
|
1152
|
+
};
|
1153
|
+
|
1154
|
+
_proto2.sections = function sections() {
|
1155
|
+
return this._type.sections(this._value);
|
1156
|
+
};
|
1157
|
+
|
1158
|
+
_proto2.update = function update(value) {
|
1159
|
+
this._value = value;
|
1160
|
+
};
|
1161
|
+
|
1162
|
+
return Content;
|
1163
|
+
}();
|
1164
|
+
|
1165
|
+
/**
|
1166
|
+
* Text Field
|
1167
|
+
*/
|
1168
|
+
|
1169
|
+
var TextField = function TextField(props) {
|
1170
|
+
var site = React.useContext(SiteContext);
|
1171
|
+
var id = props.id,
|
1172
|
+
_props$type = props.type,
|
1173
|
+
type = _props$type === void 0 ? 'text' : _props$type,
|
1174
|
+
label = props.label,
|
1175
|
+
placeholder = props.placeholder,
|
1176
|
+
value = props.value,
|
1177
|
+
outlined = props.outlined,
|
1178
|
+
_props$readOnly = props.readOnly,
|
1179
|
+
readOnly = _props$readOnly === void 0 ? false : _props$readOnly,
|
1180
|
+
_props$canClear = props.canClear,
|
1181
|
+
canClear = _props$canClear === void 0 ? true : _props$canClear,
|
1182
|
+
onChange = props.onChange,
|
1183
|
+
onEnter = props.onEnter,
|
1184
|
+
onClick = props.onClick,
|
1185
|
+
onBlur = props.onBlur;
|
1186
|
+
|
1187
|
+
function onKeyPress(event) {
|
1188
|
+
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
|
1189
|
+
|
1190
|
+
if (key == 13) {
|
1191
|
+
if (onEnter) onEnter();
|
1192
|
+
}
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
function change(event) {
|
1196
|
+
event.stopPropagation();
|
1197
|
+
event.preventDefault();
|
1198
|
+
var value = event.target.value;
|
1199
|
+
if (onChange) onChange(id, value);
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
function focus() {
|
1203
|
+
if (site && site.changeFocus) {
|
1204
|
+
site.changeFocus({
|
1205
|
+
lose: function lose() {// DO NOTHING
|
1206
|
+
}
|
1207
|
+
});
|
1208
|
+
}
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
function blur() {
|
1212
|
+
if (onBlur) onBlur();
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
function clear() {
|
1216
|
+
if (onChange) onChange(id, "");
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
var borderStyle = outlined ? "textfield-outlined" : "textfield";
|
1220
|
+
var labelStyle = label ? "" : "no-label";
|
1221
|
+
var style = labelStyle + " " + borderStyle + " textfield-" + type;
|
1222
|
+
var labelTxt = /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
1223
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
1224
|
+
className: "" + style,
|
1225
|
+
onClick: onClick
|
1226
|
+
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
1227
|
+
id: id,
|
1228
|
+
type: type,
|
1229
|
+
placeholder: placeholder,
|
1230
|
+
value: value,
|
1231
|
+
required: true,
|
1232
|
+
onChange: change,
|
1233
|
+
onKeyDown: onKeyPress,
|
1234
|
+
onFocus: focus,
|
1235
|
+
onBlur: blur,
|
1236
|
+
readOnly: readOnly
|
1237
|
+
}), canClear && value && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
1238
|
+
icon: "close",
|
1239
|
+
clickable: true,
|
1240
|
+
size: "small",
|
1241
|
+
action: clear
|
1242
|
+
}) : null, /*#__PURE__*/React__default["default"].createElement("span", {
|
1243
|
+
className: "bar"
|
1244
|
+
}), label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null);
|
1245
|
+
};
|
1246
|
+
/**
|
1247
|
+
* Text Area
|
1248
|
+
*/
|
1249
|
+
|
1250
|
+
var TextArea = function TextArea(props) {
|
1251
|
+
var site = React.useContext(SiteContext);
|
1252
|
+
var id = props.id,
|
1253
|
+
_props$type2 = props.type,
|
1254
|
+
type = _props$type2 === void 0 ? 'text' : _props$type2,
|
1255
|
+
label = props.label,
|
1256
|
+
placeholder = props.placeholder,
|
1257
|
+
value = props.value,
|
1258
|
+
_props$readOnly2 = props.readOnly,
|
1259
|
+
readOnly = _props$readOnly2 === void 0 ? false : _props$readOnly2,
|
1260
|
+
_props$canClear2 = props.canClear,
|
1261
|
+
canClear = _props$canClear2 === void 0 ? true : _props$canClear2,
|
1262
|
+
onChange = props.onChange,
|
1263
|
+
onEnter = props.onEnter,
|
1264
|
+
onClick = props.onClick;
|
1265
|
+
|
1266
|
+
function onKeyPress(event) {
|
1267
|
+
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
|
1268
|
+
|
1269
|
+
if (key == 13) {
|
1270
|
+
if (onEnter) onEnter();
|
1271
|
+
}
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
function change(event) {
|
1275
|
+
event.stopPropagation();
|
1276
|
+
event.preventDefault();
|
1277
|
+
var value = event.target.value;
|
1278
|
+
if (onChange) onChange(id, value);
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
function focus() {
|
1282
|
+
if (site && site.changeFocus) {
|
1283
|
+
site.changeFocus({
|
1284
|
+
lose: function lose() {// DO NOTHING
|
1285
|
+
}
|
1286
|
+
});
|
1287
|
+
}
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
function clear() {
|
1291
|
+
if (onChange) onChange(id, "");
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
var labelStyle = label ? "" : "no-label";
|
1295
|
+
var style = "textarea " + labelStyle + " textarea-" + type;
|
1296
|
+
var labelTxt = /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
1297
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
1298
|
+
className: "" + style,
|
1299
|
+
onClick: onClick
|
1300
|
+
}, /*#__PURE__*/React__default["default"].createElement("textarea", {
|
1301
|
+
id: id,
|
1302
|
+
placeholder: placeholder,
|
1303
|
+
value: value,
|
1304
|
+
required: true,
|
1305
|
+
onChange: change,
|
1306
|
+
onKeyDown: onKeyPress,
|
1307
|
+
onFocus: focus,
|
1308
|
+
readOnly: readOnly
|
1309
|
+
}), canClear && value && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
1310
|
+
icon: "close",
|
1311
|
+
clickable: true,
|
1312
|
+
size: "small",
|
1313
|
+
action: clear
|
1314
|
+
}) : null, /*#__PURE__*/React__default["default"].createElement("span", {
|
1315
|
+
className: "bar"
|
1316
|
+
}), label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null);
|
1317
|
+
};
|
1318
|
+
/**
|
1319
|
+
* Dropdown
|
1320
|
+
*/
|
1321
|
+
|
1322
|
+
var DropDown = function DropDown(props) {
|
1323
|
+
var site = React.useContext(SiteContext);
|
1324
|
+
var id = props.id,
|
1325
|
+
_props$options = props.options,
|
1326
|
+
options = _props$options === void 0 ? [] : _props$options,
|
1327
|
+
value = props.value,
|
1328
|
+
onChange = props.onChange,
|
1329
|
+
_props$predictive = props.predictive,
|
1330
|
+
predictive = _props$predictive === void 0 ? false : _props$predictive,
|
1331
|
+
_props$readOnly3 = props.readOnly,
|
1332
|
+
readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3,
|
1333
|
+
_props$verbose = props.verbose,
|
1334
|
+
verbose = _props$verbose === void 0 ? true : _props$verbose,
|
1335
|
+
onBlur = props.onBlur;
|
1336
|
+
|
1337
|
+
var _useState = React.useState(false),
|
1338
|
+
open = _useState[0],
|
1339
|
+
setOpen = _useState[1];
|
1340
|
+
|
1341
|
+
var _useState2 = React.useState(),
|
1342
|
+
label = _useState2[0],
|
1343
|
+
setLabel = _useState2[1];
|
1417
1344
|
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1345
|
+
React.useEffect(function () {
|
1346
|
+
if (Array.isArray(options)) {
|
1347
|
+
var option = options.find(function (option) {
|
1348
|
+
return option.value === value;
|
1349
|
+
});
|
1422
1350
|
|
1423
|
-
|
1424
|
-
}, {});
|
1425
|
-
return next;
|
1426
|
-
};
|
1351
|
+
var _label = option ? option.label : "";
|
1427
1352
|
|
1428
|
-
|
1429
|
-
}
|
1430
|
-
|
1431
|
-
* Content
|
1432
|
-
*/
|
1353
|
+
setLabel(_label);
|
1354
|
+
}
|
1355
|
+
}, [value]);
|
1433
1356
|
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1357
|
+
function change(id, value) {
|
1358
|
+
if (predictive) {
|
1359
|
+
setLabel(value);
|
1360
|
+
} else {
|
1361
|
+
if (onChange) onChange(id, value);
|
1362
|
+
}
|
1439
1363
|
}
|
1440
1364
|
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1365
|
+
function toggle() {
|
1366
|
+
if (site && site.changeFocus) {
|
1367
|
+
site.changeFocus({
|
1368
|
+
lose: function lose() {
|
1369
|
+
setOpen(false);
|
1370
|
+
}
|
1371
|
+
});
|
1372
|
+
}
|
1446
1373
|
|
1447
|
-
|
1448
|
-
|
1449
|
-
};
|
1374
|
+
if (!readOnly) setOpen(!open);
|
1375
|
+
}
|
1450
1376
|
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1377
|
+
function select(event) {
|
1378
|
+
var next = event.target.getAttribute("value");
|
1379
|
+
var option = options.find(function (option) {
|
1380
|
+
return option.value === next;
|
1381
|
+
});
|
1382
|
+
setOpen(false);
|
1383
|
+
var label = verbose ? option.label : "";
|
1384
|
+
setLabel(label);
|
1385
|
+
if (onChange) onChange(id, next);
|
1386
|
+
}
|
1454
1387
|
|
1455
|
-
|
1456
|
-
|
1457
|
-
}
|
1388
|
+
function blur() {
|
1389
|
+
if (onBlur) onBlur();
|
1390
|
+
}
|
1458
1391
|
|
1459
|
-
|
1460
|
-
|
1461
|
-
};
|
1392
|
+
function renderOptions() {
|
1393
|
+
var canShow = open == true && Array.isArray(options);
|
1462
1394
|
|
1463
|
-
|
1464
|
-
|
1395
|
+
if (canShow) {
|
1396
|
+
var filterActive = predictive === true && label && label.length > 0;
|
1397
|
+
var items = filterActive ? options.filter(function (option) {
|
1398
|
+
return option.label.toUpperCase().indexOf(label.toUpperCase()) >= 0;
|
1399
|
+
}) : options;
|
1400
|
+
var lis = items.map(function (option) {
|
1401
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
1402
|
+
key: option.value,
|
1403
|
+
value: option.value
|
1404
|
+
}, option.label);
|
1405
|
+
});
|
1406
|
+
return /*#__PURE__*/React__default["default"].createElement("menu", null, /*#__PURE__*/React__default["default"].createElement("ul", {
|
1407
|
+
onMouseDown: select
|
1408
|
+
}, lis));
|
1409
|
+
} else {
|
1410
|
+
return null;
|
1411
|
+
}
|
1412
|
+
}
|
1465
1413
|
|
1466
|
-
|
1414
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
1415
|
+
className: "dropdown"
|
1416
|
+
}, /*#__PURE__*/React__default["default"].createElement(TextField, _extends({}, props, {
|
1417
|
+
onClick: toggle,
|
1418
|
+
value: label,
|
1419
|
+
onChange: change,
|
1420
|
+
onBlur: blur,
|
1421
|
+
readOnly: !predictive
|
1422
|
+
})), !readOnly ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
1423
|
+
icon: "expand_more",
|
1424
|
+
clickable: true,
|
1425
|
+
size: "small",
|
1426
|
+
action: toggle
|
1427
|
+
}) : null, renderOptions());
|
1428
|
+
};
|
1429
|
+
var DateRange = function DateRange(props) {
|
1467
1430
|
var id = props.id,
|
1468
|
-
|
1469
|
-
label = _props$label === void 0 ? "Color" : _props$label,
|
1470
|
-
value = props.value,
|
1431
|
+
label = props.label,
|
1471
1432
|
onChange = props.onChange;
|
1472
1433
|
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1434
|
+
var _useState3 = React.useState({}),
|
1435
|
+
form = _useState3[0],
|
1436
|
+
setForm = _useState3[1];
|
1437
|
+
|
1438
|
+
React.useEffect(function () {
|
1439
|
+
if (onChange) onChange(id, form);
|
1440
|
+
}, [form]);
|
1441
|
+
|
1442
|
+
function change(id, value) {
|
1443
|
+
var _Object$assign;
|
1444
|
+
|
1445
|
+
var next = Object.assign({}, form, (_Object$assign = {}, _Object$assign[id] = value, _Object$assign));
|
1446
|
+
setForm(next);
|
1476
1447
|
}
|
1477
1448
|
|
1478
1449
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
1479
|
-
className: "
|
1480
|
-
}, /*#__PURE__*/React__default["default"].createElement("label", {
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
onChange: change
|
1486
|
-
|
1450
|
+
className: "date-range"
|
1451
|
+
}, label ? /*#__PURE__*/React__default["default"].createElement("label", null, label) : null, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
1452
|
+
id: "from",
|
1453
|
+
type: "date",
|
1454
|
+
label: "From",
|
1455
|
+
value: form.from,
|
1456
|
+
onChange: change
|
1457
|
+
}), /*#__PURE__*/React__default["default"].createElement(TextField, {
|
1458
|
+
id: "to",
|
1459
|
+
type: "date",
|
1460
|
+
label: "To",
|
1461
|
+
value: form.to,
|
1462
|
+
onChange: change
|
1487
1463
|
}));
|
1488
1464
|
};
|
1489
1465
|
|
@@ -1510,17 +1486,31 @@ var DataTable = function DataTable(props) {
|
|
1510
1486
|
className = props.className;
|
1511
1487
|
|
1512
1488
|
var _useState = React.useState({}),
|
1513
|
-
sortDir = _useState[0]
|
1489
|
+
sortDir = _useState[0],
|
1490
|
+
setSortDir = _useState[1];
|
1514
1491
|
|
1515
1492
|
var _useState2 = React.useState(false),
|
1516
1493
|
allChecked = _useState2[0],
|
1517
1494
|
setAllChecked = _useState2[1];
|
1518
1495
|
|
1496
|
+
React.useEffect(function () {
|
1497
|
+
console.log(sortDir);
|
1498
|
+
}, [sortDir]);
|
1499
|
+
|
1500
|
+
function changeSort(id) {
|
1501
|
+
var _Object$assign;
|
1502
|
+
|
1503
|
+
var nextDir = sortDir[id] ? sortDir[id] * -1 : 1;
|
1504
|
+
var next = Object.assign({}, sortDir, (_Object$assign = {}, _Object$assign[id] = nextDir, _Object$assign));
|
1505
|
+
setSortDir(next);
|
1506
|
+
}
|
1507
|
+
|
1519
1508
|
function multiSort(array, sortObject) {
|
1520
1509
|
if (sortObject === void 0) {
|
1521
1510
|
sortObject = {};
|
1522
1511
|
}
|
1523
1512
|
|
1513
|
+
console.log('multisort', sortObject);
|
1524
1514
|
var sortKeys = Object.keys(sortObject);
|
1525
1515
|
|
1526
1516
|
if (!sortKeys.length) {
|
@@ -1563,7 +1553,7 @@ var DataTable = function DataTable(props) {
|
|
1563
1553
|
}
|
1564
1554
|
}
|
1565
1555
|
|
1566
|
-
function
|
1556
|
+
function moveRow(dragged, dropped) {
|
1567
1557
|
if (onSort) onSort(dragged, dropped);
|
1568
1558
|
}
|
1569
1559
|
|
@@ -1595,16 +1585,19 @@ var DataTable = function DataTable(props) {
|
|
1595
1585
|
key: id,
|
1596
1586
|
rowSpan: rowspan,
|
1597
1587
|
colSpan: colspan
|
1598
|
-
}, id === "checked" ? /*#__PURE__*/React__default["default"].createElement(CheckBox, {
|
1588
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", null, id === "checked" ? /*#__PURE__*/React__default["default"].createElement(CheckBox, {
|
1599
1589
|
onChange: checkAll,
|
1600
1590
|
value: allChecked
|
1601
1591
|
}) : /*#__PURE__*/React__default["default"].createElement(Text, {
|
1602
1592
|
key: "th_" + id
|
1603
1593
|
}, label), sortable ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
1604
|
-
icon: "
|
1594
|
+
icon: "expand_less",
|
1605
1595
|
size: "small",
|
1606
|
-
clickable: true
|
1607
|
-
|
1596
|
+
clickable: true,
|
1597
|
+
action: function action() {
|
1598
|
+
return changeSort(id);
|
1599
|
+
}
|
1600
|
+
}) : null));
|
1608
1601
|
}), /*#__PURE__*/React__default["default"].createElement("th", {
|
1609
1602
|
rowSpan: 2,
|
1610
1603
|
colSpan: 1
|
@@ -1625,7 +1618,7 @@ var DataTable = function DataTable(props) {
|
|
1625
1618
|
row: row,
|
1626
1619
|
columns: columns,
|
1627
1620
|
onSelect: select,
|
1628
|
-
onDrop:
|
1621
|
+
onDrop: moveRow,
|
1629
1622
|
editable: editable,
|
1630
1623
|
expanded: expanded
|
1631
1624
|
});
|
@@ -3824,6 +3817,30 @@ var NumberField = function NumberField(_ref3) {
|
|
3824
3817
|
});
|
3825
3818
|
};
|
3826
3819
|
|
3820
|
+
var ColorField = function ColorField(props) {
|
3821
|
+
var id = props.id,
|
3822
|
+
_props$label = props.label,
|
3823
|
+
label = _props$label === void 0 ? "Color" : _props$label,
|
3824
|
+
value = props.value,
|
3825
|
+
onChange = props.onChange;
|
3826
|
+
|
3827
|
+
function change(event) {
|
3828
|
+
var color = event.target.value;
|
3829
|
+
if (onChange) onChange(id, color);
|
3830
|
+
}
|
3831
|
+
|
3832
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
3833
|
+
className: "color-field"
|
3834
|
+
}, /*#__PURE__*/React__default["default"].createElement("label", {
|
3835
|
+
htmlFor: id
|
3836
|
+
}, label), /*#__PURE__*/React__default["default"].createElement("input", {
|
3837
|
+
id: id,
|
3838
|
+
type: "color",
|
3839
|
+
onChange: change,
|
3840
|
+
value: value
|
3841
|
+
}));
|
3842
|
+
};
|
3843
|
+
|
3827
3844
|
/**
|
3828
3845
|
* Content Editor
|
3829
3846
|
*/
|
@@ -4872,17 +4889,70 @@ var CollectionPage = function CollectionPage(props) {
|
|
4872
4889
|
delay: delay
|
4873
4890
|
}), children ? /*#__PURE__*/React__default["default"].createElement("article", null, children) : null));
|
4874
4891
|
};
|
4875
|
-
|
4876
4892
|
var CollectionFilters = function CollectionFilters(props) {
|
4877
|
-
|
4878
|
-
|
4879
|
-
|
4893
|
+
var change = function change(next) {
|
4894
|
+
try {
|
4895
|
+
setForm(next);
|
4896
|
+
return Promise.resolve();
|
4897
|
+
} catch (e) {
|
4898
|
+
return Promise.reject(e);
|
4899
|
+
}
|
4900
|
+
};
|
4901
|
+
|
4902
|
+
var schema = props.schema,
|
4903
|
+
onChange = props.onChange;
|
4904
|
+
|
4905
|
+
var _useState = React.useState({}),
|
4906
|
+
form = _useState[0],
|
4907
|
+
setForm = _useState[1];
|
4908
|
+
|
4909
|
+
var filterSchema = React.useMemo(function () {
|
4910
|
+
var filterSchema = Object.assign({}, schema);
|
4911
|
+
|
4912
|
+
for (var key in filterSchema) {
|
4913
|
+
if (filterSchema[key].filter === false) {
|
4914
|
+
delete filterSchema[key];
|
4915
|
+
} else {
|
4916
|
+
if (filterSchema[key].type === TYPES.ENTITY) {
|
4917
|
+
var fs = filterSchema[key].item;
|
4918
|
+
|
4919
|
+
for (var key in fs) {
|
4920
|
+
if (fs[key].filter === false) delete fs[key];
|
4921
|
+
}
|
4922
|
+
}
|
4923
|
+
}
|
4924
|
+
}
|
4925
|
+
|
4926
|
+
return filterSchema;
|
4927
|
+
}, [schema]);
|
4928
|
+
React.useEffect(function () {
|
4929
|
+
if (onChange) onChange(form);
|
4930
|
+
}, [form]);
|
4931
|
+
|
4932
|
+
function clear() {
|
4933
|
+
change({});
|
4934
|
+
}
|
4935
|
+
|
4936
|
+
var content = new Content(filterSchema, form);
|
4937
|
+
return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement(Header, {
|
4938
|
+
className: "table-filters",
|
4939
|
+
title: /*#__PURE__*/React__default["default"].createElement(Text, null, "Filters")
|
4940
|
+
}, /*#__PURE__*/React__default["default"].createElement(Icon, {
|
4941
|
+
icon: "filter_list_off",
|
4942
|
+
size: "small",
|
4943
|
+
clickable: true,
|
4944
|
+
action: clear
|
4945
|
+
})), /*#__PURE__*/React__default["default"].createElement("main", {
|
4946
|
+
className: "table-filters"
|
4947
|
+
}, /*#__PURE__*/React__default["default"].createElement(ContentEditor, {
|
4948
|
+
content: content,
|
4949
|
+
onChange: change
|
4950
|
+
})));
|
4880
4951
|
};
|
4881
4952
|
/**
|
4882
4953
|
* Collection List
|
4883
4954
|
*/
|
4884
4955
|
|
4885
|
-
|
4886
4956
|
var CollectionList = function CollectionList(props) {
|
4887
4957
|
var select = function select(id) {
|
4888
4958
|
try {
|
@@ -5052,9 +5122,9 @@ var CollectionEditor = function CollectionEditor(props) {
|
|
5052
5122
|
delay = _props$delay2 === void 0 ? 1000 : _props$delay2;
|
5053
5123
|
var timer = React.useRef(null);
|
5054
5124
|
|
5055
|
-
var
|
5056
|
-
form =
|
5057
|
-
setForm =
|
5125
|
+
var _useState2 = React.useState(selected),
|
5126
|
+
form = _useState2[0],
|
5127
|
+
setForm = _useState2[1];
|
5058
5128
|
|
5059
5129
|
React.useEffect(function () {
|
5060
5130
|
setForm(selected);
|
@@ -7591,6 +7661,7 @@ exports.Chips = Chips;
|
|
7591
7661
|
exports.CircularProgress = CircularProgress;
|
7592
7662
|
exports.CollectionContext = CollectionContext;
|
7593
7663
|
exports.CollectionEditor = CollectionEditor$1;
|
7664
|
+
exports.CollectionFilters = CollectionFilters;
|
7594
7665
|
exports.CollectionPage = CollectionPage;
|
7595
7666
|
exports.CollectionTree = CollectionTree;
|
7596
7667
|
exports.Content = Content;
|