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