Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
605 changes: 295 additions & 310 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions dist/js/field.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@

/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
* @license
* Lodash <https://lodash.com/>
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/

/**
* @license
* Lodash <https://lodash.com/>
Expand All @@ -100,9 +109,9 @@
/**
* filesize
*
* @copyright 2023 Jason Mulligan <[email protected]>
* @copyright 2024 Jason Mulligan <[email protected]>
* @license BSD-3-Clause
* @version 10.1.0
* @version 10.1.2
*/

/**!
Expand Down
10,902 changes: 9,728 additions & 1,174 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"filesize": "^10.0.5",
"flatpickr": "^4.6.13",
"liquor-tree": "^0.2.70",
"loadsh": "^0.0.4",
"luxon": "^3.2.1",
"md5": "^2.3.0",
"mitt": "^3.0.0",
Expand Down
15 changes: 14 additions & 1 deletion resources/js/components/date-time/DateTimePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ export default {
type: Number,
default: 0,
},
maxDate:{
type: String,
default: null
},
minDate:{
type: String,
default: null
},
},

data: () => ({ flatpickr: null }),
Expand Down Expand Up @@ -118,7 +126,12 @@ export default {
}
}
};

if (this.maxDate !== null) {
options.maxDate = this.maxDate;
}
if (this.minDate !== null) {
options.minDate = this.minDate;
}
this.flatpickr = flatpickr(this.$refs.datePicker, options);
if (!this.enableMinutes) {
this.$nextTick(() => {
Expand Down
37 changes: 25 additions & 12 deletions resources/js/components/date-time/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
:enable-minutes="enableMinutes"
:enable-time="enableTime"
:disabled="isReadonly"
:maxDate="maxDate"
:minDate="minDate"
/>

<a
Expand Down Expand Up @@ -99,18 +101,23 @@ export default {
* Update the field's internal value when it's value changes
*/
handleChange(value) {
if(this.field.setDefaultMinuteZero == true && value !== ''){
let date = new Date(value);
if (!isNaN(date) && date instanceof Date) {
let onlyDate = date.getFullYear()+'-'+ ('0' + (date.getMonth()+1)).slice(-2) +'-'+ ('0' + date.getDate()).slice(-2) +" "+('0' + date.getHours()).slice(-2)+":00"+":00";
this.value = onlyDate;
this.$refs.dateTimePicker.getUpdatedValue(onlyDate);
} else {
this.value = '';
}
}else{
this.value = value;
}
if (this.field.setDefaultMinuteZero == true && value !== '') {
let date = new Date(value);
if ((!isNaN(date) && date instanceof Date)) {
let onlyDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2) + " " + ('0' + date.getHours()).slice(-2) + ":00" + ":00";
if (this.field.maxDate) {
onlyDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2) + "";
}
this.value = onlyDate;
this.$refs.dateTimePicker.getUpdatedValue(onlyDate);
} else {
if (!value instanceof Event) {
this.value = '';
}
}
} else {
this.value = value;
}
},
},

Expand Down Expand Up @@ -157,6 +164,12 @@ export default {
defaultMinute() {
return this.field.defaultMinute || 0
},
maxDate(){
return this.field.maxDate || null
},
minDate(){
return this.field.minDate || null
},
},

}
Expand Down
10 changes: 10 additions & 0 deletions resources/js/components/multiselect/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import Multiselect from '@vueform/multiselect';
import {VueDraggableNext} from 'vue-draggable-next'
import debounce from 'lodash/debounce';
import R64Field from '../../mixins/R64Field'
import _ from "loadsh";

export default {
components: { Multiselect, draggable : VueDraggableNext},
Expand Down Expand Up @@ -217,6 +218,15 @@ export default {
this.value = this.getValueFromOptions(this.field.value);
}
}

if(_.isEmpty(this.value) && this.field.defaultValue) {
if(this.isMultiselect) {
this.value = this.options && this.options.length > 0 ?[ _.find(this.options, {value: this.field.defaultValue})] : [];
} else {
this.value = this.field.defaultValue;
}
}

},

fill(formData) {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/simple-repetable/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>

<draggable v-model="fieldsWithValues"
:sort="true"
:sort="field.canDraggable ? true : false"
class="dragArea list-group w-full"
:scroll-sensitivity="400"
>
Expand Down
3 changes: 2 additions & 1 deletion resources/js/mixins/HasOptions.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { isObject } from "lodash";
export default {
methods: {
/**
* Just determins if the option could potentially have an option.
*/
hasOptionHint(option) {
return typeof option === 'object';
return isObject(option);
},

/**
Expand Down
8 changes: 8 additions & 0 deletions src/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,12 @@ public function pickerDisplayFormat($value)
{
return $this->withMeta([__FUNCTION__ => $value]);
}
public function maxDate($value)
{
return $this->withMeta([__FUNCTION__ => $value]);
}
public function minDate($value)
{
return $this->withMeta([__FUNCTION__ => $value]);
}
}
6 changes: 6 additions & 0 deletions src/Multiselect.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,10 @@ public function canClear($bool = true)
{
return $this->withMeta(['canClear' => $bool]);
}

/** Setting Default Value */
public function defaultValue($value = "")
{
return $this->withMeta(['defaultValue' => $value]);
}
}