ywana-core8 0.0.14 → 0.0.18
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 +115 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -3
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +115 -28
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +115 -28
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/publish.sh +1 -0
- package/src/domain/CollectionPage.js +2 -2
- package/src/domain/CreateContentDialog.js +26 -30
- package/src/domain/CreateContentDialog_old.js +59 -0
- package/src/index.js +0 -1
- package/src/css/fonts.css +0 -162
- package/src/fonts/Assistant-Bold.ttf +0 -0
- package/src/fonts/Assistant-ExtraBold.ttf +0 -0
- package/src/fonts/Assistant-ExtraLight.ttf +0 -0
- package/src/fonts/Assistant-Light.ttf +0 -0
- package/src/fonts/Assistant-Medium.ttf +0 -0
- package/src/fonts/Assistant-Regular.ttf +0 -0
- package/src/fonts/Assistant-SemiBold.ttf +0 -0
- package/src/fonts/Assistant-VariableFont_wght.ttf +0 -0
package/dist/index.cjs
CHANGED
@@ -3134,16 +3134,16 @@ var CollectionAdder = function CollectionAdder(_ref11) {
|
|
3134
3134
|
* Create Content Dialog
|
3135
3135
|
*/
|
3136
3136
|
|
3137
|
-
var CreateContentDialog = function CreateContentDialog(_ref) {
|
3137
|
+
var CreateContentDialog$1 = function CreateContentDialog(_ref) {
|
3138
3138
|
var label = _ref.label,
|
3139
3139
|
type = _ref.type,
|
3140
|
+
_ref$value = _ref.value,
|
3141
|
+
value = _ref$value === void 0 ? {} : _ref$value,
|
3140
3142
|
validator = _ref.validator,
|
3141
|
-
onOK = _ref.onOK
|
3142
|
-
_ref$onActionClose = _ref.onActionClose,
|
3143
|
-
onActionClose = _ref$onActionClose === void 0 ? true : _ref$onActionClose;
|
3143
|
+
onOK = _ref.onOK;
|
3144
3144
|
var site = React.useContext(SiteContext);
|
3145
3145
|
|
3146
|
-
var _useState = React.useState(
|
3146
|
+
var _useState = React.useState(value),
|
3147
3147
|
form = _useState[0],
|
3148
3148
|
setForm = _useState[1];
|
3149
3149
|
|
@@ -3155,7 +3155,7 @@ var CreateContentDialog = function CreateContentDialog(_ref) {
|
|
3155
3155
|
errors = _useState3[0],
|
3156
3156
|
setErrors = _useState3[1];
|
3157
3157
|
|
3158
|
-
function change(form
|
3158
|
+
function change(form) {
|
3159
3159
|
setForm(form);
|
3160
3160
|
|
3161
3161
|
if (validator) {
|
@@ -3164,28 +3164,20 @@ var CreateContentDialog = function CreateContentDialog(_ref) {
|
|
3164
3164
|
_validator$errors = _validator.errors,
|
3165
3165
|
_errors = _validator$errors === void 0 ? [] : _validator$errors;
|
3166
3166
|
|
3167
|
-
setValid(
|
3167
|
+
setValid(validation);
|
3168
3168
|
setErrors(_errors);
|
3169
3169
|
} else {
|
3170
|
-
setValid(
|
3170
|
+
setValid(true);
|
3171
3171
|
}
|
3172
3172
|
}
|
3173
3173
|
|
3174
3174
|
function onAction(action) {
|
3175
|
-
if (action === 'OK' && onOK) onOK(form);
|
3176
|
-
|
3175
|
+
if (action === 'OK' && onOK) onOK(Object.assign({}, value, form));
|
3176
|
+
site.closeDialog();
|
3177
3177
|
}
|
3178
3178
|
|
3179
|
-
function
|
3180
|
-
|
3181
|
-
required = _field$required === void 0 ? false : _field$required;
|
3182
|
-
return required;
|
3183
|
-
}
|
3184
|
-
|
3185
|
-
function isOptional(field) {
|
3186
|
-
var _field$creation = field.creation,
|
3187
|
-
creation = _field$creation === void 0 ? false : _field$creation;
|
3188
|
-
return creation;
|
3179
|
+
function createFilter(field, content) {
|
3180
|
+
return field.required === true || field.optional === true; // TODO: execute props.filter
|
3189
3181
|
}
|
3190
3182
|
|
3191
3183
|
var actions = /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement(Button, {
|
@@ -3193,6 +3185,8 @@ var CreateContentDialog = function CreateContentDialog(_ref) {
|
|
3193
3185
|
action: function action() {
|
3194
3186
|
return onAction("CLOSE");
|
3195
3187
|
}
|
3188
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
3189
|
+
className: "expand"
|
3196
3190
|
}), /*#__PURE__*/React__default["default"].createElement(Button, {
|
3197
3191
|
label: "OK",
|
3198
3192
|
action: function action() {
|
@@ -3210,12 +3204,10 @@ var CreateContentDialog = function CreateContentDialog(_ref) {
|
|
3210
3204
|
open: true,
|
3211
3205
|
onAction: onAction,
|
3212
3206
|
actions: actions
|
3213
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
3207
|
+
}, /*#__PURE__*/React__default["default"].createElement(ContentEditor, {
|
3214
3208
|
content: content,
|
3215
|
-
|
3216
|
-
|
3217
|
-
},
|
3218
|
-
onChange: change
|
3209
|
+
onChange: change,
|
3210
|
+
filter: createFilter
|
3219
3211
|
}), errors.map(function (error) {
|
3220
3212
|
return /*#__PURE__*/React__default["default"].createElement(Text, {
|
3221
3213
|
use: "overline",
|
@@ -3309,6 +3301,101 @@ var EditContentDialog = function EditContentDialog(_ref) {
|
|
3309
3301
|
}));
|
3310
3302
|
};
|
3311
3303
|
|
3304
|
+
/**
|
3305
|
+
* Create Content Dialog
|
3306
|
+
*/
|
3307
|
+
|
3308
|
+
var CreateContentDialog = function CreateContentDialog(_ref) {
|
3309
|
+
var label = _ref.label,
|
3310
|
+
type = _ref.type,
|
3311
|
+
validator = _ref.validator,
|
3312
|
+
onOK = _ref.onOK,
|
3313
|
+
_ref$onActionClose = _ref.onActionClose,
|
3314
|
+
onActionClose = _ref$onActionClose === void 0 ? true : _ref$onActionClose;
|
3315
|
+
var site = React.useContext(SiteContext);
|
3316
|
+
|
3317
|
+
var _useState = React.useState({}),
|
3318
|
+
form = _useState[0],
|
3319
|
+
setForm = _useState[1];
|
3320
|
+
|
3321
|
+
var _useState2 = React.useState(false),
|
3322
|
+
isValid = _useState2[0],
|
3323
|
+
setValid = _useState2[1];
|
3324
|
+
|
3325
|
+
var _useState3 = React.useState([]),
|
3326
|
+
errors = _useState3[0],
|
3327
|
+
setErrors = _useState3[1];
|
3328
|
+
|
3329
|
+
function change(form, validForm) {
|
3330
|
+
setForm(form);
|
3331
|
+
|
3332
|
+
if (validator) {
|
3333
|
+
var _validator = validator(form),
|
3334
|
+
validation = _validator.validation,
|
3335
|
+
_validator$errors = _validator.errors,
|
3336
|
+
_errors = _validator$errors === void 0 ? [] : _validator$errors;
|
3337
|
+
|
3338
|
+
setValid(validForm && validation);
|
3339
|
+
setErrors(_errors);
|
3340
|
+
} else {
|
3341
|
+
setValid(validForm);
|
3342
|
+
}
|
3343
|
+
}
|
3344
|
+
|
3345
|
+
function onAction(action) {
|
3346
|
+
if (action === 'OK' && onOK) onOK(form);
|
3347
|
+
if (action === 'CLOSE' || onActionClose === true) site.closeDialog();
|
3348
|
+
}
|
3349
|
+
|
3350
|
+
function isRequired(field) {
|
3351
|
+
var _field$required = field.required,
|
3352
|
+
required = _field$required === void 0 ? false : _field$required;
|
3353
|
+
return required;
|
3354
|
+
}
|
3355
|
+
|
3356
|
+
function isOptional(field) {
|
3357
|
+
var _field$creation = field.creation,
|
3358
|
+
creation = _field$creation === void 0 ? false : _field$creation;
|
3359
|
+
return creation;
|
3360
|
+
}
|
3361
|
+
|
3362
|
+
var actions = /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement(Button, {
|
3363
|
+
label: "CLOSE",
|
3364
|
+
action: function action() {
|
3365
|
+
return onAction("CLOSE");
|
3366
|
+
}
|
3367
|
+
}), /*#__PURE__*/React__default["default"].createElement(Button, {
|
3368
|
+
label: "OK",
|
3369
|
+
action: function action() {
|
3370
|
+
return onAction("OK");
|
3371
|
+
},
|
3372
|
+
disabled: !isValid,
|
3373
|
+
raised: true
|
3374
|
+
}));
|
3375
|
+
var title = /*#__PURE__*/React__default["default"].createElement(Text, {
|
3376
|
+
use: "headline6"
|
3377
|
+
}, label);
|
3378
|
+
var content = new Content(type, form);
|
3379
|
+
return /*#__PURE__*/React__default["default"].createElement(Dialog, {
|
3380
|
+
title: title,
|
3381
|
+
open: true,
|
3382
|
+
onAction: onAction,
|
3383
|
+
actions: actions
|
3384
|
+
}, /*#__PURE__*/React__default["default"].createElement(ContentForm, {
|
3385
|
+
content: content,
|
3386
|
+
filter: function filter(field) {
|
3387
|
+
return isRequired(field) || isOptional(field);
|
3388
|
+
},
|
3389
|
+
onChange: change
|
3390
|
+
}), errors.map(function (error) {
|
3391
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, {
|
3392
|
+
use: "overline",
|
3393
|
+
tag: "div",
|
3394
|
+
className: "error"
|
3395
|
+
}, error);
|
3396
|
+
}));
|
3397
|
+
};
|
3398
|
+
|
3312
3399
|
function _catch(body, recover) {
|
3313
3400
|
try {
|
3314
3401
|
var result = body();
|
@@ -3384,8 +3471,8 @@ var CollectionPage = function CollectionPage(props) {
|
|
3384
3471
|
}
|
3385
3472
|
};
|
3386
3473
|
|
3387
|
-
site.openDialog( /*#__PURE__*/React__default["default"].createElement(
|
3388
|
-
label: "
|
3474
|
+
site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
3475
|
+
label: "" + name,
|
3389
3476
|
type: schema,
|
3390
3477
|
onOK: onOK
|
3391
3478
|
}));
|
@@ -4100,7 +4187,7 @@ exports.CollectionPage = CollectionPage;
|
|
4100
4187
|
exports.Content = Content;
|
4101
4188
|
exports.ContentEditor = ContentEditor;
|
4102
4189
|
exports.ContentForm = ContentForm;
|
4103
|
-
exports.CreateContentDialog = CreateContentDialog;
|
4190
|
+
exports.CreateContentDialog = CreateContentDialog$1;
|
4104
4191
|
exports.DataTable = DataTable;
|
4105
4192
|
exports.Dialog = Dialog;
|
4106
4193
|
exports.DropDown = DropDown;
|