@iankibetsh/shframework 1.5.3 → 1.5.5
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/library.js +41 -10
- package/dist/library.mjs +42 -11
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -3107,6 +3107,7 @@ var script$e = {
|
|
|
3107
3107
|
'helperTexts','labels','data',
|
|
3108
3108
|
'actionLabel',
|
|
3109
3109
|
'textAreas',
|
|
3110
|
+
'currentData',
|
|
3110
3111
|
'emails',
|
|
3111
3112
|
'phones','numbers','selects','dates'
|
|
3112
3113
|
],
|
|
@@ -3226,14 +3227,28 @@ const submitForm = e => {
|
|
|
3226
3227
|
return false
|
|
3227
3228
|
};
|
|
3228
3229
|
const submitBtnWidth = vue.ref(null);
|
|
3230
|
+
const setExistingData = ()=>{
|
|
3231
|
+
console.log(props.currentData, formFields.value);
|
|
3232
|
+
const existingData = props.currentData;
|
|
3233
|
+
if (props.currentData) {
|
|
3234
|
+
formFields.value.map(field=>{
|
|
3235
|
+
existingData[field.field] && (field.value = existingData[field.field]);
|
|
3236
|
+
});
|
|
3237
|
+
}
|
|
3238
|
+
};
|
|
3239
|
+
vue.watch(()=>props.currentData,()=>{
|
|
3240
|
+
setExistingData();
|
|
3241
|
+
});
|
|
3229
3242
|
vue.onMounted((ev)=>{
|
|
3230
3243
|
props.fields && props.fields.map(field=>{
|
|
3231
3244
|
if(typeof field === 'object') {
|
|
3232
3245
|
const fieldObj = {...field};
|
|
3233
|
-
fieldObj.label && getLabel(fieldObj.field)
|
|
3234
|
-
|
|
3235
|
-
fieldObj.helperText
|
|
3236
|
-
fieldObj.
|
|
3246
|
+
// fieldObj.label && getLabel(fieldObj.field)
|
|
3247
|
+
fieldObj.helper = fieldObj.helperText ?? fieldObj.helper;
|
|
3248
|
+
// !fieldObj.helper && fieldObj.helperText ? fieldObj.helper = fieldObj.helperText : fieldObj.helper = getHelperText(fieldObj.field)
|
|
3249
|
+
// fieldObj.helperText === undefined && ()
|
|
3250
|
+
fieldObj.label = fieldObj.label ?? getLabel(fieldObj.field);
|
|
3251
|
+
// fieldObj.placeholder && fieldObj.placeHolder && getPlaceholder(fieldObj.field)
|
|
3237
3252
|
fieldObj.value = null;
|
|
3238
3253
|
formFields.value.push(fieldObj);
|
|
3239
3254
|
} else {
|
|
@@ -3245,6 +3260,7 @@ vue.onMounted((ev)=>{
|
|
|
3245
3260
|
});
|
|
3246
3261
|
}
|
|
3247
3262
|
});
|
|
3263
|
+
setExistingData();
|
|
3248
3264
|
});
|
|
3249
3265
|
|
|
3250
3266
|
|
|
@@ -3274,9 +3290,8 @@ return (_ctx, _cache) => {
|
|
|
3274
3290
|
onClick: $event => (removeValidationError(field.field)),
|
|
3275
3291
|
"onUpdate:modelValue": [$event => (removeValidationError(field.field)), $event => ((formFields.value[index].value) = $event)],
|
|
3276
3292
|
modelValue: formFields.value[index].value,
|
|
3277
|
-
placeholder: vue.unref(isFloating) ? field.label:field.placeholder,
|
|
3278
3293
|
class: getComponentClass(field.field)
|
|
3279
|
-
}), null, 16 /* FULL_PROPS */, ["isInvalid", "onClick", "onUpdate:modelValue", "modelValue", "
|
|
3294
|
+
}), null, 16 /* FULL_PROPS */, ["isInvalid", "onClick", "onUpdate:modelValue", "modelValue", "class"])),
|
|
3280
3295
|
(vue.unref(isFloating) && field.label)
|
|
3281
3296
|
? (vue.openBlock(), vue.createElementBlock("label", {
|
|
3282
3297
|
key: 1,
|
|
@@ -3296,7 +3311,9 @@ return (_ctx, _cache) => {
|
|
|
3296
3311
|
key: 3,
|
|
3297
3312
|
class: vue.normalizeClass(getElementClass('invalidFeedback'))
|
|
3298
3313
|
}, vue.toDisplayString(validationErrors.value[field.field]), 3 /* TEXT, CLASS */))
|
|
3299
|
-
: vue.createCommentVNode("v-if", true)
|
|
3314
|
+
: vue.createCommentVNode("v-if", true),
|
|
3315
|
+
vue.createCommentVNode(" <h5>{{ getFieldComponent(field) }}</h5>"),
|
|
3316
|
+
vue.createCommentVNode(" <h5>{{ getComponentProps(field) }}</h5>")
|
|
3300
3317
|
], 2 /* CLASS */))
|
|
3301
3318
|
}), 128 /* KEYED_FRAGMENT */)),
|
|
3302
3319
|
vue.createElementVNode("div", {
|
|
@@ -3949,7 +3966,8 @@ var script$6 = {
|
|
|
3949
3966
|
downloading: false,
|
|
3950
3967
|
appUrl: window.VITE_APP_API_URL,
|
|
3951
3968
|
hasCanvas: 0,
|
|
3952
|
-
selectedRecord: null
|
|
3969
|
+
selectedRecord: null,
|
|
3970
|
+
timeOut: null
|
|
3953
3971
|
}
|
|
3954
3972
|
},
|
|
3955
3973
|
mounted () {
|
|
@@ -3963,6 +3981,17 @@ var script$6 = {
|
|
|
3963
3981
|
}
|
|
3964
3982
|
},
|
|
3965
3983
|
methods: {
|
|
3984
|
+
userTyping: function(){
|
|
3985
|
+
if (this.timeOut){
|
|
3986
|
+
console.log('timer cleared');
|
|
3987
|
+
clearTimeout(this.timeOut);
|
|
3988
|
+
}
|
|
3989
|
+
const self = this;
|
|
3990
|
+
this.timeOut = setTimeout(()=>{
|
|
3991
|
+
console.log('Searching');
|
|
3992
|
+
self.reloadData(1);
|
|
3993
|
+
},1000);
|
|
3994
|
+
},
|
|
3966
3995
|
cleanCanvasProps: function (actions) {
|
|
3967
3996
|
let replaced = actions;
|
|
3968
3997
|
replaced.class = null;
|
|
@@ -4369,9 +4398,11 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4369
4398
|
vue.createElementVNode("div", _hoisted_8$2, [
|
|
4370
4399
|
vue.createElementVNode("div", _hoisted_9$2, [
|
|
4371
4400
|
vue.withDirectives(vue.createElementVNode("input", {
|
|
4401
|
+
onKeydown: _cache[1] || (_cache[1] = (...args) => ($options.userTyping && $options.userTyping(...args))),
|
|
4402
|
+
onKeyup: _cache[2] || (_cache[2] = (...args) => ($options.userTyping && $options.userTyping(...args))),
|
|
4372
4403
|
type: "search",
|
|
4373
|
-
onChange: _cache[
|
|
4374
|
-
"onUpdate:modelValue": _cache[
|
|
4404
|
+
onChange: _cache[3] || (_cache[3] = $event => ($options.reloadData(1))),
|
|
4405
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = $event => (($data.filter_value) = $event)),
|
|
4375
4406
|
placeholder: $props.searchPlaceholder ? $props.searchPlaceholder : 'Search',
|
|
4376
4407
|
class: "form-control sh-search-input"
|
|
4377
4408
|
}, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$1), [
|
package/dist/library.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import Axios from 'axios';
|
|
|
2
2
|
import moment from 'moment';
|
|
3
3
|
import Swal from 'sweetalert2';
|
|
4
4
|
import NProgress from 'nprogress';
|
|
5
|
-
import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, withModifiers, createVNode, ref, onMounted, unref, normalizeClass, createBlock, resolveDynamicComponent, inject, mergeProps, normalizeStyle, renderSlot, normalizeProps, guardReactiveProps, withCtx, createStaticVNode, shallowRef, vModelCheckbox, pushScopeId, popScopeId, computed, isRef
|
|
5
|
+
import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, withModifiers, createVNode, ref, onMounted, unref, normalizeClass, createBlock, resolveDynamicComponent, inject, watch, mergeProps, normalizeStyle, renderSlot, normalizeProps, guardReactiveProps, withCtx, createStaticVNode, shallowRef, vModelCheckbox, pushScopeId, popScopeId, computed, isRef } from 'vue';
|
|
6
6
|
import Editor from '@tinymce/tinymce-vue';
|
|
7
7
|
import _ from 'lodash';
|
|
8
8
|
import { useRoute, useRouter } from 'vue-router';
|
|
@@ -3094,6 +3094,7 @@ var script$e = {
|
|
|
3094
3094
|
'helperTexts','labels','data',
|
|
3095
3095
|
'actionLabel',
|
|
3096
3096
|
'textAreas',
|
|
3097
|
+
'currentData',
|
|
3097
3098
|
'emails',
|
|
3098
3099
|
'phones','numbers','selects','dates'
|
|
3099
3100
|
],
|
|
@@ -3213,14 +3214,28 @@ const submitForm = e => {
|
|
|
3213
3214
|
return false
|
|
3214
3215
|
};
|
|
3215
3216
|
const submitBtnWidth = ref(null);
|
|
3217
|
+
const setExistingData = ()=>{
|
|
3218
|
+
console.log(props.currentData, formFields.value);
|
|
3219
|
+
const existingData = props.currentData;
|
|
3220
|
+
if (props.currentData) {
|
|
3221
|
+
formFields.value.map(field=>{
|
|
3222
|
+
existingData[field.field] && (field.value = existingData[field.field]);
|
|
3223
|
+
});
|
|
3224
|
+
}
|
|
3225
|
+
};
|
|
3226
|
+
watch(()=>props.currentData,()=>{
|
|
3227
|
+
setExistingData();
|
|
3228
|
+
});
|
|
3216
3229
|
onMounted((ev)=>{
|
|
3217
3230
|
props.fields && props.fields.map(field=>{
|
|
3218
3231
|
if(typeof field === 'object') {
|
|
3219
3232
|
const fieldObj = {...field};
|
|
3220
|
-
fieldObj.label && getLabel(fieldObj.field)
|
|
3221
|
-
|
|
3222
|
-
fieldObj.helperText
|
|
3223
|
-
fieldObj.
|
|
3233
|
+
// fieldObj.label && getLabel(fieldObj.field)
|
|
3234
|
+
fieldObj.helper = fieldObj.helperText ?? fieldObj.helper;
|
|
3235
|
+
// !fieldObj.helper && fieldObj.helperText ? fieldObj.helper = fieldObj.helperText : fieldObj.helper = getHelperText(fieldObj.field)
|
|
3236
|
+
// fieldObj.helperText === undefined && ()
|
|
3237
|
+
fieldObj.label = fieldObj.label ?? getLabel(fieldObj.field);
|
|
3238
|
+
// fieldObj.placeholder && fieldObj.placeHolder && getPlaceholder(fieldObj.field)
|
|
3224
3239
|
fieldObj.value = null;
|
|
3225
3240
|
formFields.value.push(fieldObj);
|
|
3226
3241
|
} else {
|
|
@@ -3232,6 +3247,7 @@ onMounted((ev)=>{
|
|
|
3232
3247
|
});
|
|
3233
3248
|
}
|
|
3234
3249
|
});
|
|
3250
|
+
setExistingData();
|
|
3235
3251
|
});
|
|
3236
3252
|
|
|
3237
3253
|
|
|
@@ -3261,9 +3277,8 @@ return (_ctx, _cache) => {
|
|
|
3261
3277
|
onClick: $event => (removeValidationError(field.field)),
|
|
3262
3278
|
"onUpdate:modelValue": [$event => (removeValidationError(field.field)), $event => ((formFields.value[index].value) = $event)],
|
|
3263
3279
|
modelValue: formFields.value[index].value,
|
|
3264
|
-
placeholder: unref(isFloating) ? field.label:field.placeholder,
|
|
3265
3280
|
class: getComponentClass(field.field)
|
|
3266
|
-
}), null, 16 /* FULL_PROPS */, ["isInvalid", "onClick", "onUpdate:modelValue", "modelValue", "
|
|
3281
|
+
}), null, 16 /* FULL_PROPS */, ["isInvalid", "onClick", "onUpdate:modelValue", "modelValue", "class"])),
|
|
3267
3282
|
(unref(isFloating) && field.label)
|
|
3268
3283
|
? (openBlock(), createElementBlock("label", {
|
|
3269
3284
|
key: 1,
|
|
@@ -3283,7 +3298,9 @@ return (_ctx, _cache) => {
|
|
|
3283
3298
|
key: 3,
|
|
3284
3299
|
class: normalizeClass(getElementClass('invalidFeedback'))
|
|
3285
3300
|
}, toDisplayString(validationErrors.value[field.field]), 3 /* TEXT, CLASS */))
|
|
3286
|
-
: createCommentVNode("v-if", true)
|
|
3301
|
+
: createCommentVNode("v-if", true),
|
|
3302
|
+
createCommentVNode(" <h5>{{ getFieldComponent(field) }}</h5>"),
|
|
3303
|
+
createCommentVNode(" <h5>{{ getComponentProps(field) }}</h5>")
|
|
3287
3304
|
], 2 /* CLASS */))
|
|
3288
3305
|
}), 128 /* KEYED_FRAGMENT */)),
|
|
3289
3306
|
createElementVNode("div", {
|
|
@@ -3936,7 +3953,8 @@ var script$6 = {
|
|
|
3936
3953
|
downloading: false,
|
|
3937
3954
|
appUrl: window.VITE_APP_API_URL,
|
|
3938
3955
|
hasCanvas: 0,
|
|
3939
|
-
selectedRecord: null
|
|
3956
|
+
selectedRecord: null,
|
|
3957
|
+
timeOut: null
|
|
3940
3958
|
}
|
|
3941
3959
|
},
|
|
3942
3960
|
mounted () {
|
|
@@ -3950,6 +3968,17 @@ var script$6 = {
|
|
|
3950
3968
|
}
|
|
3951
3969
|
},
|
|
3952
3970
|
methods: {
|
|
3971
|
+
userTyping: function(){
|
|
3972
|
+
if (this.timeOut){
|
|
3973
|
+
console.log('timer cleared');
|
|
3974
|
+
clearTimeout(this.timeOut);
|
|
3975
|
+
}
|
|
3976
|
+
const self = this;
|
|
3977
|
+
this.timeOut = setTimeout(()=>{
|
|
3978
|
+
console.log('Searching');
|
|
3979
|
+
self.reloadData(1);
|
|
3980
|
+
},1000);
|
|
3981
|
+
},
|
|
3953
3982
|
cleanCanvasProps: function (actions) {
|
|
3954
3983
|
let replaced = actions;
|
|
3955
3984
|
replaced.class = null;
|
|
@@ -4356,9 +4385,11 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4356
4385
|
createElementVNode("div", _hoisted_8$2, [
|
|
4357
4386
|
createElementVNode("div", _hoisted_9$2, [
|
|
4358
4387
|
withDirectives(createElementVNode("input", {
|
|
4388
|
+
onKeydown: _cache[1] || (_cache[1] = (...args) => ($options.userTyping && $options.userTyping(...args))),
|
|
4389
|
+
onKeyup: _cache[2] || (_cache[2] = (...args) => ($options.userTyping && $options.userTyping(...args))),
|
|
4359
4390
|
type: "search",
|
|
4360
|
-
onChange: _cache[
|
|
4361
|
-
"onUpdate:modelValue": _cache[
|
|
4391
|
+
onChange: _cache[3] || (_cache[3] = $event => ($options.reloadData(1))),
|
|
4392
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = $event => (($data.filter_value) = $event)),
|
|
4362
4393
|
placeholder: $props.searchPlaceholder ? $props.searchPlaceholder : 'Search',
|
|
4363
4394
|
class: "form-control sh-search-input"
|
|
4364
4395
|
}, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$1), [
|