pui9-components 1.16.4
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/README.md +43 -0
- package/dist/demo.html +10 -0
- package/dist/pui9-components.common.js +81953 -0
- package/dist/pui9-components.common.js.map +1 -0
- package/dist/pui9-components.css +5 -0
- package/dist/pui9-components.umd.js +81963 -0
- package/dist/pui9-components.umd.js.map +1 -0
- package/dist/pui9-components.umd.min.js +308 -0
- package/dist/pui9-components.umd.min.js.map +1 -0
- package/package-lock.json +15945 -0
- package/package.json +78 -0
- package/src/App.vue +117 -0
- package/src/components/PuiCheckbox.vue +105 -0
- package/src/components/PuiCodeEditor.vue +123 -0
- package/src/components/PuiDateField.vue +1004 -0
- package/src/components/PuiField.vue +30 -0
- package/src/components/PuiFieldSet.vue +27 -0
- package/src/components/PuiFormFooter.vue +64 -0
- package/src/components/PuiFormFooterBtns.vue +118 -0
- package/src/components/PuiFormHeader.vue +25 -0
- package/src/components/PuiFormLoading.vue +12 -0
- package/src/components/PuiFormMiniAudit.vue +53 -0
- package/src/components/PuiMasterDetail.vue +96 -0
- package/src/components/PuiModalDialog.vue +87 -0
- package/src/components/PuiModalDialogForm.vue +205 -0
- package/src/components/PuiMultiSelect.vue +499 -0
- package/src/components/PuiNumberField.vue +503 -0
- package/src/components/PuiPasswordField.vue +105 -0
- package/src/components/PuiRadioGroup.vue +105 -0
- package/src/components/PuiRichTextEditor.vue +117 -0
- package/src/components/PuiSelect.vue +1638 -0
- package/src/components/PuiSelectDetailDialog.vue +106 -0
- package/src/components/PuiSelectTextService.vue +61 -0
- package/src/components/PuiSpinnerField.vue +484 -0
- package/src/components/PuiSwitch.vue +104 -0
- package/src/components/PuiTextArea.vue +203 -0
- package/src/components/PuiTextField.vue +272 -0
- package/src/dateTimeUtils.js +78 -0
- package/src/index.js +73 -0
- package/src/main.js +33 -0
- package/src/mixins/PuiFormComponentMixin.js +81 -0
- package/src/mixins/PuiMultiSelectMixin.js +106 -0
- package/src/mixins/PuiUtilsNumberMixin.js +19 -0
- package/src/plugins/vuetify.js +32 -0
- package/src/tests/TestAutocomplete.vue +138 -0
- package/src/tests/TestCodeEditor.vue +48 -0
- package/src/tests/TestField.vue +22 -0
- package/src/tests/TestFieldSet.vue +30 -0
- package/src/tests/TestInputCheckbox.vue +53 -0
- package/src/tests/TestInputDate.vue +146 -0
- package/src/tests/TestInputNumber.vue +77 -0
- package/src/tests/TestInputRadioGroup.vue +86 -0
- package/src/tests/TestInputSpinner.vue +77 -0
- package/src/tests/TestInputSwitch.vue +52 -0
- package/src/tests/TestInputText.vue +120 -0
- package/src/tests/TestInputTextArea.vue +73 -0
- package/src/tests/TestMultiSelect.vue +127 -0
- package/src/tests/TestPuiForm.vue +68 -0
- package/src/tests/TestRichTextEditor.vue +54 -0
- package/src/utils.js +148 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import PuiCheckbox from './components/PuiCheckbox';
|
|
2
|
+
import PuiCodeEditor from './components/PuiCodeEditor';
|
|
3
|
+
import PuiDateField from './components/PuiDateField';
|
|
4
|
+
import PuiField from './components/PuiField';
|
|
5
|
+
import PuiFieldSet from './components/PuiFieldSet';
|
|
6
|
+
import PuiMultiSelect from './components/PuiMultiSelect';
|
|
7
|
+
import PuiNumberField from './components/PuiNumberField';
|
|
8
|
+
import PuiPasswordField from './components/PuiPasswordField';
|
|
9
|
+
import PuiRadioGroup from './components/PuiRadioGroup';
|
|
10
|
+
import PuiRichTextEditor from './components/PuiRichTextEditor';
|
|
11
|
+
import PuiSpinnerField from './components/PuiSpinnerField';
|
|
12
|
+
import PuiSwitch from './components/PuiSwitch';
|
|
13
|
+
import PuiTextArea from './components/PuiTextArea';
|
|
14
|
+
import PuiTextField from './components/PuiTextField';
|
|
15
|
+
import PuiFormFooter from './components/PuiFormFooter';
|
|
16
|
+
import PuiFormFooterBtns from './components/PuiFormFooterBtns';
|
|
17
|
+
import PuiFormHeader from './components/PuiFormHeader';
|
|
18
|
+
import PuiFormLoading from './components/PuiFormLoading';
|
|
19
|
+
import PuiFormMiniAudit from './components/PuiFormMiniAudit';
|
|
20
|
+
import PuiMasterDetail from './components/PuiMasterDetail';
|
|
21
|
+
import PuiModalDialog from './components/PuiModalDialog';
|
|
22
|
+
import PuiModalDialogForm from './components/PuiModalDialogForm';
|
|
23
|
+
import PuiSelect from './components/PuiSelect';
|
|
24
|
+
import PuiSelectDetailDialog from './components/PuiSelectDetailDialog';
|
|
25
|
+
|
|
26
|
+
import VueInfiniteLoading from 'vue-infinite-loading';
|
|
27
|
+
import VueDraggable from 'vuedraggable';
|
|
28
|
+
import moment from 'moment';
|
|
29
|
+
|
|
30
|
+
import DateTimeUtils from './dateTimeUtils';
|
|
31
|
+
import Utils from './utils';
|
|
32
|
+
|
|
33
|
+
const Components = {
|
|
34
|
+
PuiCheckbox,
|
|
35
|
+
PuiCodeEditor,
|
|
36
|
+
PuiDateField,
|
|
37
|
+
PuiField,
|
|
38
|
+
PuiFieldSet,
|
|
39
|
+
PuiMultiSelect,
|
|
40
|
+
PuiNumberField,
|
|
41
|
+
PuiPasswordField,
|
|
42
|
+
PuiRadioGroup,
|
|
43
|
+
PuiRichTextEditor,
|
|
44
|
+
PuiSpinnerField,
|
|
45
|
+
PuiSwitch,
|
|
46
|
+
PuiTextArea,
|
|
47
|
+
PuiTextField,
|
|
48
|
+
PuiFormFooter,
|
|
49
|
+
PuiFormFooterBtns,
|
|
50
|
+
PuiFormHeader,
|
|
51
|
+
PuiFormLoading,
|
|
52
|
+
PuiFormMiniAudit,
|
|
53
|
+
PuiMasterDetail,
|
|
54
|
+
PuiModalDialog,
|
|
55
|
+
PuiModalDialogForm,
|
|
56
|
+
PuiSelect,
|
|
57
|
+
PuiSelectDetailDialog
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
install(Vue) {
|
|
62
|
+
Object.keys(Components).forEach(name => {
|
|
63
|
+
Vue.component(name, Components[name]);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
Vue.component('infinite-loading', VueInfiniteLoading);
|
|
67
|
+
Vue.component('draggable', VueDraggable);
|
|
68
|
+
|
|
69
|
+
Object.defineProperty(Vue.prototype, '$moment', { value: moment });
|
|
70
|
+
Object.defineProperty(Vue.prototype, '$dateTimeUtils', { value: DateTimeUtils });
|
|
71
|
+
Object.defineProperty(Vue.prototype, '$puiUtils', { value: Utils });
|
|
72
|
+
}
|
|
73
|
+
};
|
package/src/main.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import Vuex from 'vuex';
|
|
3
|
+
import VueI18n from 'vue-i18n';
|
|
4
|
+
import vuetify from './plugins/vuetify';
|
|
5
|
+
import App from './App.vue';
|
|
6
|
+
|
|
7
|
+
import '@fortawesome/fontawesome-pro/css/all.css';
|
|
8
|
+
import 'vuetify/dist/vuetify.min.css';
|
|
9
|
+
import '../../pui9-styles/pui9.css';
|
|
10
|
+
|
|
11
|
+
import storeObj from '../../pui9-store';
|
|
12
|
+
|
|
13
|
+
import enPuiTranslations from '../../pui9-translations/translations/en.json';
|
|
14
|
+
import esPuiTranslations from '../../pui9-translations/translations/es.json';
|
|
15
|
+
|
|
16
|
+
Vue.config.productionTip = false;
|
|
17
|
+
|
|
18
|
+
Vue.use(Vuex);
|
|
19
|
+
Vue.use(VueI18n);
|
|
20
|
+
|
|
21
|
+
const store = new Vuex.Store(storeObj);
|
|
22
|
+
const i18n = new VueI18n({
|
|
23
|
+
locale: 'es',
|
|
24
|
+
fallbackLocale: 'en',
|
|
25
|
+
messages: { en: enPuiTranslations, es: esPuiTranslations }
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
new Vue({
|
|
29
|
+
vuetify,
|
|
30
|
+
store,
|
|
31
|
+
i18n,
|
|
32
|
+
render: (h) => h(App)
|
|
33
|
+
}).$mount('#app');
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as sanitizeHtml from 'sanitize-html';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
noeditable: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: false
|
|
8
|
+
},
|
|
9
|
+
required: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: false
|
|
12
|
+
},
|
|
13
|
+
label: {
|
|
14
|
+
type: String
|
|
15
|
+
},
|
|
16
|
+
toplabel: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
initialValue: '',
|
|
28
|
+
internalModel: '',
|
|
29
|
+
firstLazyLoad: false,
|
|
30
|
+
internalError: false
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
computed: {
|
|
34
|
+
isMobile() {
|
|
35
|
+
return this.$store.getters.isMobile;
|
|
36
|
+
},
|
|
37
|
+
isEdited() {
|
|
38
|
+
if (this.noeditable || this.disabled || this.readonly) {
|
|
39
|
+
return false;
|
|
40
|
+
} else {
|
|
41
|
+
try {
|
|
42
|
+
if (this.initialValue.toString() !== this.internalModel.toString()) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
} catch (e) {
|
|
47
|
+
if (this.initialValue !== this.internalModel) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
getLabel() {
|
|
55
|
+
return this.allProps.label;
|
|
56
|
+
},
|
|
57
|
+
allProps() {
|
|
58
|
+
return { ...this.$attrs, ...this.$props };
|
|
59
|
+
},
|
|
60
|
+
getLocale() {
|
|
61
|
+
return (this.$store && this.$store.getters && this.$store.getters.getUserLanguage) || null;
|
|
62
|
+
},
|
|
63
|
+
getPlaceholder() {
|
|
64
|
+
return this.placeholder;
|
|
65
|
+
},
|
|
66
|
+
hasLabel() {
|
|
67
|
+
if (this.label && this.label.length > 0) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
},
|
|
72
|
+
requiredMessage() {
|
|
73
|
+
return this.$t('pui9.error.field_required');
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
sanitizePuiFormHtmlText(dirtyText) {
|
|
78
|
+
return sanitizeHtml(dirtyText);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
value: {
|
|
4
|
+
required: false
|
|
5
|
+
},
|
|
6
|
+
/* Array of Objects provided by the parent component */
|
|
7
|
+
items: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: null,
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
/**
|
|
13
|
+
* Los items seleccionados que se pasan de inicio, se pasa en la directiva v-model al utilizar este componente
|
|
14
|
+
* puede ser un array de Items igual que en la propiedad :items, o un array con los id's solamente
|
|
15
|
+
*/
|
|
16
|
+
itemsToSelect: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: () => []
|
|
19
|
+
},
|
|
20
|
+
trackItemsToSelect: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
/* Type: String
|
|
25
|
+
The items text property name */
|
|
26
|
+
itemText: {
|
|
27
|
+
type: [String, Array, Function],
|
|
28
|
+
default: 'text'
|
|
29
|
+
},
|
|
30
|
+
/* Type: String
|
|
31
|
+
The items id property name */
|
|
32
|
+
itemValue: {
|
|
33
|
+
type: [String, Array, Function],
|
|
34
|
+
default: 'value'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
data() {
|
|
38
|
+
return {
|
|
39
|
+
itemTextMultiple: false,
|
|
40
|
+
itemValueMultiple: false,
|
|
41
|
+
itemTextNested: false,
|
|
42
|
+
itemValueNested: false,
|
|
43
|
+
search: '',
|
|
44
|
+
selected: false
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
watch: {
|
|
48
|
+
items(newValue, oldValue) {
|
|
49
|
+
const newValueStr = JSON.stringify(newValue);
|
|
50
|
+
const oldValueStr = JSON.stringify(oldValue);
|
|
51
|
+
if (newValueStr !== oldValueStr) {
|
|
52
|
+
this.selectItems();
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
itemsToSelect: {
|
|
56
|
+
handler() {
|
|
57
|
+
this.trackItemsToSelect === true && this.selectItems();
|
|
58
|
+
},
|
|
59
|
+
deep: true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
created() {
|
|
63
|
+
this.checkItemText();
|
|
64
|
+
this.checkItemValue();
|
|
65
|
+
|
|
66
|
+
this.selectItems();
|
|
67
|
+
},
|
|
68
|
+
methods: {
|
|
69
|
+
checkForNestedFields(stringField) {
|
|
70
|
+
if (stringField instanceof Function) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return stringField.split('.').length > 1;
|
|
75
|
+
},
|
|
76
|
+
checkItemText() {
|
|
77
|
+
this.itemTextMultiple = Array.isArray(this.itemText);
|
|
78
|
+
if (this.itemTextMultiple === false) {
|
|
79
|
+
this.itemTextNested = this.checkForNestedFields(this.itemText);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
checkItemValue() {
|
|
83
|
+
this.itemValueMultiple = Array.isArray(this.itemValue);
|
|
84
|
+
if (this.itemValueMultiple === false) {
|
|
85
|
+
this.itemValueNested = this.checkForNestedFields(this.itemValue);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
selectItems() {
|
|
89
|
+
this.selectedItems = [];
|
|
90
|
+
|
|
91
|
+
this.setAvailableItems && this.setAvailableItems();
|
|
92
|
+
if (!this.itemsToSelect || this.itemsToSelect.length === 0) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.getSelectedItems();
|
|
97
|
+
|
|
98
|
+
this.selected = true;
|
|
99
|
+
},
|
|
100
|
+
getSelectedItems() {
|
|
101
|
+
for (let i = 0, length = this.itemsToSelect.length; i < length; i++) {
|
|
102
|
+
this.selectItemById(this.itemsToSelect[i][this.itemValue] || this.itemsToSelect[i], this.itemsToSelect[i]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
checkInteger(val) {
|
|
4
|
+
const regexp = /(^[0-9]*$)|(^-[0-9]+$)/;
|
|
5
|
+
return regexp.test(val);
|
|
6
|
+
},
|
|
7
|
+
checkFloat(val) {
|
|
8
|
+
const regexp = /^[-]?\d*(\.\d+)?$/;
|
|
9
|
+
return regexp.test(val);
|
|
10
|
+
},
|
|
11
|
+
truncateDecimal(number, decimals) {
|
|
12
|
+
var a = Math.pow(10, decimals);
|
|
13
|
+
var b = number * a;
|
|
14
|
+
var c = parseInt(b);
|
|
15
|
+
var d = c / a;
|
|
16
|
+
return d;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import Vuetify from 'vuetify/lib';
|
|
3
|
+
import colors from 'vuetify/es5/util/colors';
|
|
4
|
+
import es from 'vuetify/es5/locale/es';
|
|
5
|
+
import ca from 'vuetify/es5/locale/ca';
|
|
6
|
+
import en from 'vuetify/es5/locale/en';
|
|
7
|
+
import fr from 'vuetify/es5/locale/fr';
|
|
8
|
+
|
|
9
|
+
Vue.use(Vuetify);
|
|
10
|
+
|
|
11
|
+
const opts = {
|
|
12
|
+
theme: {
|
|
13
|
+
light: true,
|
|
14
|
+
themes: {
|
|
15
|
+
light: {
|
|
16
|
+
primary: '#199af2',
|
|
17
|
+
secondary: '#e56208',
|
|
18
|
+
accent: colors.orange.darken1,
|
|
19
|
+
error: colors.red.darken1
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
icons: {
|
|
24
|
+
iconfont: 'fa'
|
|
25
|
+
},
|
|
26
|
+
lang: {
|
|
27
|
+
locales: { en, es, ca, fr },
|
|
28
|
+
current: 'es'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default new Vuetify(opts);
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container>
|
|
3
|
+
<v-flex xs12>
|
|
4
|
+
<v-card class="pa-4 mt-4">
|
|
5
|
+
<h2 class="mb-4">Autocomplete simple</h2>
|
|
6
|
+
<pui-autocomplete :label="label" toplabel :required="required">
|
|
7
|
+
<v-autocomplete
|
|
8
|
+
id="autocomplete1"
|
|
9
|
+
attach="autocomplete1"
|
|
10
|
+
ref="autocomplete1"
|
|
11
|
+
class="pui-autocomplete-select--simple"
|
|
12
|
+
v-model="model1.car"
|
|
13
|
+
:items="items"
|
|
14
|
+
:item-text="item => item.name"
|
|
15
|
+
:required="required"
|
|
16
|
+
:disabled="disabled"
|
|
17
|
+
:rules="[value => !!value || 'Campo obligatorio']"
|
|
18
|
+
:return-object="false"
|
|
19
|
+
clearable
|
|
20
|
+
/>
|
|
21
|
+
</pui-autocomplete>
|
|
22
|
+
<span>{{ model1.car }}</span>
|
|
23
|
+
<h2 class="mb-4">Autocomplete multiple con slots</h2>
|
|
24
|
+
<pui-autocomplete :label="label" toplabel :required="required">
|
|
25
|
+
<v-autocomplete
|
|
26
|
+
id="autocomplete2"
|
|
27
|
+
attach="autocomplete2"
|
|
28
|
+
ref="autocomplete2"
|
|
29
|
+
class="pui-autocomplete-select--simple"
|
|
30
|
+
v-model="model2"
|
|
31
|
+
:items="items"
|
|
32
|
+
:item-text="item => item.name"
|
|
33
|
+
:required="required"
|
|
34
|
+
:disabled="disabled"
|
|
35
|
+
:rules="[value => !!value || 'Campo obligatorio']"
|
|
36
|
+
multiple
|
|
37
|
+
return-object
|
|
38
|
+
clearable
|
|
39
|
+
>
|
|
40
|
+
<template slot="item" slot-scope="data">
|
|
41
|
+
<pui-autocomplete-slot-item :data="data" property="name"></pui-autocomplete-slot-item>
|
|
42
|
+
</template>
|
|
43
|
+
<template slot="selection" slot-scope="{ selected, parent, item }">
|
|
44
|
+
<pui-autocomplete-slot-multiple-selection
|
|
45
|
+
:selected="selected"
|
|
46
|
+
:parent="parent"
|
|
47
|
+
:item="item"
|
|
48
|
+
property="name"
|
|
49
|
+
></pui-autocomplete-slot-multiple-selection>
|
|
50
|
+
</template>
|
|
51
|
+
</v-autocomplete>
|
|
52
|
+
</pui-autocomplete>
|
|
53
|
+
<span>{{ model2 }}</span>
|
|
54
|
+
</v-card>
|
|
55
|
+
</v-flex>
|
|
56
|
+
</v-container>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script>
|
|
60
|
+
import PuiAutocomplete from '@/components/Autocomplete/PuiAutocomplete';
|
|
61
|
+
import PuiAutocompleteSlotItem from '@/components/Autocomplete/PuiAutocompleteSlotItem';
|
|
62
|
+
import PuiAutocompleteSlotMultipleSelection from '@/components/Autocomplete/PuiAutocompleteSlotMultipleSelection';
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
components: {
|
|
66
|
+
PuiAutocomplete,
|
|
67
|
+
PuiAutocompleteSlotItem,
|
|
68
|
+
PuiAutocompleteSlotMultipleSelection
|
|
69
|
+
},
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
required: true,
|
|
73
|
+
disabled: false,
|
|
74
|
+
label: 'Car',
|
|
75
|
+
model1: {
|
|
76
|
+
car: null
|
|
77
|
+
},
|
|
78
|
+
model2: [],
|
|
79
|
+
items: [
|
|
80
|
+
{ id: 1, name: 'Ford' },
|
|
81
|
+
{ id: 2, name: 'Mercedes' },
|
|
82
|
+
{ id: 3, name: 'BMW' }
|
|
83
|
+
]
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
created() {
|
|
87
|
+
this.lazyLoadTest();
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
lazyLoadTest() {
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
this.model1.car = 2;
|
|
93
|
+
}, 3000);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/*created() {
|
|
97
|
+
this.debounceSearchCars = debounce(() => {
|
|
98
|
+
this.carsItems = [];
|
|
99
|
+
this.carsPagination.page = 1;
|
|
100
|
+
this.fetchCars();
|
|
101
|
+
}, 700);
|
|
102
|
+
|
|
103
|
+
this.fetchCars();
|
|
104
|
+
},
|
|
105
|
+
methods: {
|
|
106
|
+
async fetchCars() {
|
|
107
|
+
try {
|
|
108
|
+
this.carsPagination.loading = true;
|
|
109
|
+
const params = this.carsPagination;
|
|
110
|
+
const queryFields = clienteQueryFields;
|
|
111
|
+
const queryText = this.clienteTextSearch;
|
|
112
|
+
const body = generateCarsPagination(queryText, { params, queryFields });
|
|
113
|
+
const filter = this.amasFilter;
|
|
114
|
+
|
|
115
|
+
// prettier-ignore
|
|
116
|
+
const { data: { data, totalPages } } = await pui9api.requestFactory.postRequest('/cliente/list', { ...body, filter });
|
|
117
|
+
|
|
118
|
+
this.carsItems = [...this.carsItems, ...data];
|
|
119
|
+
this.carsPagination.totalPages = totalPages;
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.error(error);
|
|
122
|
+
} finally {
|
|
123
|
+
this.carsPagination.loading = false;
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
async loadMoreCars() {
|
|
128
|
+
const { page, totalPages } = this.carsPagination;
|
|
129
|
+
if (page >= totalPages) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this.carsPagination.page++;
|
|
134
|
+
this.fetchCars();
|
|
135
|
+
}
|
|
136
|
+
}*/
|
|
137
|
+
};
|
|
138
|
+
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container>
|
|
3
|
+
<v-flex xs12>
|
|
4
|
+
<v-card class="pa-4 mt-4">
|
|
5
|
+
<h2 class="mb-4">Code Editor</h2>
|
|
6
|
+
<pui-code-editor mode="javascript" :label="label" v-model="model1"></pui-code-editor>
|
|
7
|
+
</v-card>
|
|
8
|
+
<v-card class="pa-4 mt-4">
|
|
9
|
+
<h2 class="mb-4">Code Editor in Form</h2>
|
|
10
|
+
|
|
11
|
+
<v-form ref="form" v-model="valid" lazy-validation v-if="modelLoaded">
|
|
12
|
+
<pui-code-editor mode="css" :label="label" v-model="model1" required :validationErrors="formValidationErrors"></pui-code-editor>
|
|
13
|
+
<v-btn depressed color="secondary" class="elevation-0" @click.native="save(false)">
|
|
14
|
+
Save
|
|
15
|
+
</v-btn>
|
|
16
|
+
</v-form>
|
|
17
|
+
</v-card>
|
|
18
|
+
</v-flex>
|
|
19
|
+
</v-container>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import PuiCodeEditor from '@/components/PuiCodeEditor';
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
name: 'TestCodeEditor',
|
|
27
|
+
components: { PuiCodeEditor },
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
label: 'Etiqueta editor de código',
|
|
31
|
+
model1: 'Este texto se está editando con el componente PuiCodeEditor',
|
|
32
|
+
valid: true,
|
|
33
|
+
modelLoaded: true,
|
|
34
|
+
formValidationErrors: false
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
save() {
|
|
39
|
+
this.formValidationErrors = false;
|
|
40
|
+
if (this.$refs.form && this.$refs.form.validate && !this.$refs.form.validate()) {
|
|
41
|
+
this.formValidationErrors = true;
|
|
42
|
+
console.log('Hay errores de validación en el formulario');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container>
|
|
3
|
+
<v-card class="pa-4 mt-4">
|
|
4
|
+
<h2 class="mb-4">Campo etiqueta/valor</h2>
|
|
5
|
+
<pui-field label="Etiqueta" v-model="model0"></pui-field>
|
|
6
|
+
</v-card>
|
|
7
|
+
</v-container>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import PuiField from '@/components/PuiField';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
name: 'TestField',
|
|
15
|
+
components: { PuiField },
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
model0: 'Este es el valor del PuiField'
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container>
|
|
3
|
+
<v-card class="pa-4 mt-4">
|
|
4
|
+
<h2 class="mb-4">Cuadro de agrupación sin etiqueta</h2>
|
|
5
|
+
<pui-field-set>
|
|
6
|
+
{{ content }}
|
|
7
|
+
</pui-field-set>
|
|
8
|
+
</v-card>
|
|
9
|
+
<v-card class="pa-4 mt-4">
|
|
10
|
+
<h2 class="mb-4">Cuadro de agrupación con etiqueta y sombreado</h2>
|
|
11
|
+
<pui-field-set title="Etiqueta" highlighted>
|
|
12
|
+
{{ content }}
|
|
13
|
+
</pui-field-set>
|
|
14
|
+
</v-card>
|
|
15
|
+
</v-container>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import PuiFieldSet from '@/components/PuiFieldSet';
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
name: 'TestPuiFieldSet',
|
|
23
|
+
components: { PuiFieldSet },
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
content: 'Aquí va el contenido del fieldset'
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container>
|
|
3
|
+
<v-flex xs12>
|
|
4
|
+
<v-card class="pa-4 mt-4">
|
|
5
|
+
<h2 class="mb-4">Selectores</h2>
|
|
6
|
+
<!-- Checkbox simple-->
|
|
7
|
+
<pui-checkbox label="Checkbox simple" v-model="model60"></pui-checkbox>
|
|
8
|
+
<!-- Checkbox no seleccionado-->
|
|
9
|
+
<pui-checkbox label="Checkbox no seleccionado" v-model="model61"></pui-checkbox>
|
|
10
|
+
<!-- Checkbox obligatorio seleccionado-->
|
|
11
|
+
<pui-checkbox label="Checkbox obligatorio seleccionado" v-model="model62" required></pui-checkbox>
|
|
12
|
+
<!-- Checkbox obligatorio seleccionado-->
|
|
13
|
+
<pui-checkbox label="Checkbox desactivado" v-model="model63" disabled></pui-checkbox>
|
|
14
|
+
<!-- Checkbox obligatorio seleccionado-->
|
|
15
|
+
<pui-checkbox label="Checkbox desactivado seleccionado" v-model="model64" disabled></pui-checkbox>
|
|
16
|
+
<!-- Checkbox devolviendo 1 o 0-->
|
|
17
|
+
<pui-checkbox label="Checkbox devolviendo 1 ó 0" v-model="model65" true-value="1" false-value="0"></pui-checkbox>
|
|
18
|
+
</v-card>
|
|
19
|
+
</v-flex>
|
|
20
|
+
</v-container>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import PuiCheckbox from '@/components/PuiCheckbox';
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: 'TestInputCheckbox',
|
|
28
|
+
components: { PuiCheckbox },
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
model60: true,
|
|
32
|
+
model61: false,
|
|
33
|
+
model62: false,
|
|
34
|
+
model63: false,
|
|
35
|
+
model64: true,
|
|
36
|
+
model65: true,
|
|
37
|
+
errorMessage: 'Mensaje de error del input',
|
|
38
|
+
message:
|
|
39
|
+
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s.'
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
printModel(modelName, value) {
|
|
44
|
+
console.log(modelName, value);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
created() {
|
|
48
|
+
for (let i = 1; i <= 100; i++) {
|
|
49
|
+
this.$watch(() => this[`model${i}`], this.printModel.bind(this, `Model${i}`));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
</script>
|