@iankibetsh/shframework 0.2.1 → 0.2.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.
@@ -30,3 +30,24 @@
30
30
  font-weight: 300;
31
31
  opacity: 0.5;
32
32
  }
33
+
34
+ :root {
35
+ --ck-z-default: 10555 !important;
36
+ --ck-z-modal: calc(var(--ck-z-default) + 999) !important;
37
+ }
38
+ .mceToolbar td {
39
+ display:table-row;
40
+ float: left;
41
+ }
42
+ .mceToolbar td:nth-of-type(11){
43
+ clear: left;
44
+ }
45
+
46
+ @media screen and (max-width:600px) {
47
+ .sh-editor{
48
+ width: 100% !important;
49
+ }
50
+ table.mceLayout, textarea.tinyMCE {
51
+ width: 100% !important;
52
+ }
53
+ }
package/dist/library.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var Axios = require('axios');
6
6
  var NProgress = require('nprogress');
7
7
  var vue = require('vue');
8
+ var Editor = require('@tinymce/tinymce-vue');
8
9
  var moment = require('moment');
9
10
  var Swal = require('sweetalert2');
10
11
  var pinia = require('pinia');
@@ -13,6 +14,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
13
14
 
14
15
  var Axios__default = /*#__PURE__*/_interopDefaultLegacy(Axios);
15
16
  var NProgress__default = /*#__PURE__*/_interopDefaultLegacy(NProgress);
17
+ var Editor__default = /*#__PURE__*/_interopDefaultLegacy(Editor);
16
18
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
17
19
  var Swal__default = /*#__PURE__*/_interopDefaultLegacy(Swal);
18
20
 
@@ -1542,7 +1544,7 @@ const countries = [
1542
1544
  }
1543
1545
  ];
1544
1546
 
1545
- var script$6 = {
1547
+ var script$7 = {
1546
1548
  name: 'ShPhone',
1547
1549
  props: ['modelValue', 'country_code'],
1548
1550
  data () {
@@ -1604,7 +1606,7 @@ var script$6 = {
1604
1606
  }
1605
1607
  };
1606
1608
 
1607
- const _hoisted_1$6 = { class: "sh-phone mb-3" };
1609
+ const _hoisted_1$7 = { class: "sh-phone mb-3" };
1608
1610
  const _hoisted_2$6 = {
1609
1611
  key: 0,
1610
1612
  style: {"display":"contents"}
@@ -1612,8 +1614,8 @@ const _hoisted_2$6 = {
1612
1614
  const _hoisted_3$6 = ["src"];
1613
1615
  const _hoisted_4$5 = ["value"];
1614
1616
 
1615
- function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1616
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
1617
+ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1618
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
1617
1619
  ($data.selectedCountry)
1618
1620
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$6, [
1619
1621
  vue.createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$6),
@@ -1647,15 +1649,95 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1647
1649
  ]))
1648
1650
  }
1649
1651
 
1652
+ script$7.render = render$7;
1653
+ script$7.__file = "src/views/ShPhone.vue";
1654
+
1655
+ var script$6 = {
1656
+ name: 'ShEditor',
1657
+ props: ['modelValue'],
1658
+ components: {
1659
+ editor: Editor__default["default"]
1660
+ },
1661
+ data () {
1662
+ return {
1663
+ editorData: this.modelValue
1664
+ }
1665
+ },
1666
+ computed: {
1667
+ value: {
1668
+ get () {
1669
+ return this.modelValue
1670
+ },
1671
+ set (value) {
1672
+ this.$emit('update:modelValue', value);
1673
+ }
1674
+ }
1675
+ },
1676
+ created () {
1677
+ document.addEventListener('focusin', function (e) {
1678
+ const closest = e.target.closest('.tox-tinymce-aux, .tox-dialog, .moxman-window, .tam-assetmanager-root');
1679
+ if (closest !== null && closest !== undefined) {
1680
+ e.stopImmediatePropagation();
1681
+ }
1682
+ });
1683
+ },
1684
+ mounted () {
1685
+ this.editorData = this.modelValue;
1686
+ },
1687
+ methods: {
1688
+ updateValue: function () {
1689
+ // alert('paste')
1690
+ }
1691
+ }
1692
+ };
1693
+
1694
+ const _hoisted_1$6 = /*#__PURE__*/vue.createElementVNode("textarea", {
1695
+ id: "tiny",
1696
+ style: {"display":"none"},
1697
+ "data-cy": "tinymce_editor"
1698
+ }, null, -1 /* HOISTED */);
1699
+
1700
+ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1701
+ const _component_editor = vue.resolveComponent("editor");
1702
+
1703
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
1704
+ vue.createCommentVNode(" <ckeditor @input=\"updateValue\" :editor=\"editor\" v-model=\"editorData\" :config=\"editorConfig\"></ckeditor>"),
1705
+ _hoisted_1$6,
1706
+ vue.createElementVNode("div", {
1707
+ onFocusin: _cache[1] || (_cache[1] = vue.withModifiers(() => {}, ["stop"])),
1708
+ class: "sh-editor w-100"
1709
+ }, [
1710
+ vue.createCommentVNode(" MCE editor placed here "),
1711
+ vue.createVNode(_component_editor, {
1712
+ class: "tinyEditor",
1713
+ "api-key": "v5otxmculqf59xfg2bqr2ucw56cbqgbqo4x9gym2kwbv1rvi",
1714
+ onInput: $options.updateValue,
1715
+ onKeyup: $options.updateValue,
1716
+ modelValue: $options.value,
1717
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($options.value) = $event)),
1718
+ init: {
1719
+ selector: 'textarea#tiny',
1720
+ valid_children : '+body[style],+body[script]',
1721
+ extended_valid_elements : '*[*]',
1722
+ contextmenu: false,
1723
+ plugins: 'lists link image emoticons code autolink',
1724
+ toolbar: 'styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist | link image emoticons code'
1725
+ }
1726
+ }, null, 8 /* PROPS */, ["onInput", "onKeyup", "modelValue"])
1727
+ ], 32 /* HYDRATE_EVENTS */)
1728
+ ], 64 /* STABLE_FRAGMENT */))
1729
+ }
1730
+
1650
1731
  script$6.render = render$6;
1651
- script$6.__file = "src/views/ShPhone.vue";
1732
+ script$6.__file = "src/views/FormComponent/ShEditor.vue";
1652
1733
 
1653
1734
  var script$5 = {
1654
1735
  name: 'ShForm',
1655
1736
  components: {
1656
- ShPhone: script$6
1737
+ ShEditor: script$6,
1738
+ ShPhone: script$7
1657
1739
  },
1658
- props: ['action', 'classes', 'hasTerms', 'country_code', 'submit_btn_class', 'fields', 'columns', 'placeholders', 'field_permissions', 'retain_data_after_submission', 'current_data', 'action_label', 'fill_selects', 'phones', 'successCallback', 'failed_callback', 'labels'],
1740
+ props: ['action', 'classes', 'hasTerms', 'country_code', 'submitBtnClass', 'fields', 'columns', 'placeholders', 'field_permissions', 'retainDataAfterSubmission', 'currentData', 'actionLabel', 'fillSelects', 'phones', 'successCallback', 'failed_callback', 'labels', 'editors'],
1659
1741
  data: function () {
1660
1742
  return {
1661
1743
  form_elements: {},
@@ -1671,14 +1753,9 @@ var script$5 = {
1671
1753
  allLabels: {}
1672
1754
  }
1673
1755
  },
1674
- computed: {
1675
- currentData () {
1676
- return this.current_data
1677
- }
1678
- },
1679
1756
  methods: {
1680
1757
  getSubmitBtnClass: function () {
1681
- const btnClass = this.submit_btn_class;
1758
+ const btnClass = this.submitBtnClass;
1682
1759
  if (!btnClass) {
1683
1760
  return 'btn btn-primary mt-2'
1684
1761
  } else {
@@ -1702,7 +1779,10 @@ var script$5 = {
1702
1779
  const selects = ['gender', 'payment_method', 'allow_view_mode', 'reasons_name', 'has_free_tier', 'payment_period', 'role', 'register_as', 'account_type'];
1703
1780
  const numbers = ['age'];
1704
1781
  const datePickers = ['free_tier_days', 'recurring_date', 'date', 'paid_at'];
1705
- const editors = ['html_content', 'listing_description', 'mail'];
1782
+ let editors = ['html_content', 'listing_description', 'mail'];
1783
+ if(this.editors){
1784
+ editors = editors.concat(this.editors);
1785
+ }
1706
1786
  const mapLocations = ['building_location'];
1707
1787
  const files = ['file', 'logo'];
1708
1788
  const phones = ['phone'];
@@ -1817,7 +1897,7 @@ var script$5 = {
1817
1897
  this.form_status = 2;
1818
1898
  Object.keys(this.form_elements).forEach(key => {
1819
1899
  this.form_errors[key] = null;
1820
- if (!this.retain_data_after_submission) {
1900
+ if (!this.retainDataAfterSubmission) {
1821
1901
  this.form_elements[key] = '';
1822
1902
  }
1823
1903
  });
@@ -1886,14 +1966,14 @@ var script$5 = {
1886
1966
  },
1887
1967
  mounted: async function () {
1888
1968
  const selectData = {};
1889
- if (this.fill_selects) {
1890
- Object.keys(this.fill_selects).forEach(key => {
1891
- if (this.fill_selects[key].data) {
1892
- selectData[key] = this.fill_selects[key].data;
1969
+ if (this.fillSelects) {
1970
+ Object.keys(this.fillSelects).forEach(key => {
1971
+ if (this.fillSelects[key].data) {
1972
+ selectData[key] = this.fillSelects[key].data;
1893
1973
  this.selectData = selectData;
1894
1974
  console.log(this.selectData);
1895
1975
  } else {
1896
- apis.doGet(this.fill_selects[key].url, { all: 1 }).then(res => {
1976
+ apis.doGet(this.fillSelects[key].url, { all: 1 }).then(res => {
1897
1977
  // selectData[key] = res.data
1898
1978
  // console.log(res)
1899
1979
  this.selectData[key] = res.data.data;
@@ -1946,7 +2026,7 @@ const _hoisted_15$2 = ["name", "onFocus", "onUpdate:modelValue"];
1946
2026
  const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
1947
2027
  const _hoisted_17$2 = ["value"];
1948
2028
  const _hoisted_18$2 = {
1949
- key: 9,
2029
+ key: 10,
1950
2030
  class: "invalid-feedback"
1951
2031
  };
1952
2032
  const _hoisted_19$2 = {
@@ -1979,6 +2059,7 @@ const _hoisted_23$2 = {
1979
2059
 
1980
2060
  function render$5(_ctx, _cache, $props, $setup, $data, $options) {
1981
2061
  const _component_ShPhone = vue.resolveComponent("ShPhone");
2062
+ const _component_ShEditor = vue.resolveComponent("ShEditor");
1982
2063
 
1983
2064
  return (vue.openBlock(), vue.createElementBlock("form", _hoisted_1$5, [
1984
2065
  vue.createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
@@ -2083,9 +2164,20 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2083
2164
  required: ""
2084
2165
  }, null, 8 /* PROPS */, ["country_code", "placeholder", "name", "onFocus", "class", "modelValue", "onUpdate:modelValue"]))
2085
2166
  : vue.createCommentVNode("v-if", true),
2167
+ ($options.getFieldType(field) === 'editor')
2168
+ ? (vue.openBlock(), vue.createBlock(_component_ShEditor, {
2169
+ key: 6,
2170
+ placeholder: _ctx.allPlaceHolders[field] ? _ctx.allPlaceHolders[field] : '',
2171
+ name: field,
2172
+ onFocus: $event => ($options.removeErrors(field)),
2173
+ class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2174
+ modelValue: _ctx.form_elements[field],
2175
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2176
+ }, null, 8 /* PROPS */, ["placeholder", "name", "onFocus", "class", "modelValue", "onUpdate:modelValue"]))
2177
+ : vue.createCommentVNode("v-if", true),
2086
2178
  ($options.getFieldType(field) === 'text')
2087
2179
  ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
2088
- key: 6,
2180
+ key: 7,
2089
2181
  disabled: $options.isDisabled(field),
2090
2182
  placeholder: field === 'phone_number' ? 'e.g 0712 345 678':'',
2091
2183
  name: field,
@@ -2099,7 +2191,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2099
2191
  : vue.createCommentVNode("v-if", true),
2100
2192
  ($options.getFieldType(field) === 'textarea')
2101
2193
  ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("textarea", {
2102
- key: 7,
2194
+ key: 8,
2103
2195
  name: field,
2104
2196
  onFocus: $event => ($options.removeErrors(field)),
2105
2197
  class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
@@ -2110,7 +2202,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2110
2202
  : vue.createCommentVNode("v-if", true),
2111
2203
  ($options.getFieldType(field) === 'select' && _ctx.selectData[field] != null)
2112
2204
  ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("select", {
2113
- key: 8,
2205
+ key: 9,
2114
2206
  name: field,
2115
2207
  onFocus: $event => ($options.removeErrors(field)),
2116
2208
  class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
@@ -2142,7 +2234,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2142
2234
  type: "button",
2143
2235
  onClick: _cache[1] || (_cache[1] = (...args) => ($options.submitForm && $options.submitForm(...args)))
2144
2236
  }, [
2145
- vue.createTextVNode(vue.toDisplayString($props.action_label ? $props.action_label:'Submit') + " ", 1 /* TEXT */),
2237
+ vue.createTextVNode(vue.toDisplayString($props.actionLabel ? $props.actionLabel:'Submit') + " ", 1 /* TEXT */),
2146
2238
  (_ctx.form_status == 1)
2147
2239
  ? (vue.openBlock(), vue.createElementBlock("img", _hoisted_23$2))
2148
2240
  : vue.createCommentVNode("v-if", true)
@@ -2864,25 +2956,37 @@ const _hoisted_13 = {
2864
2956
  key: 0,
2865
2957
  class: "text-center"
2866
2958
  };
2867
- const _hoisted_14 = /*#__PURE__*/vue.createElementVNode("span", { colspan: 2 }, [
2868
- /*#__PURE__*/vue.createElementVNode("img", { src: "/src/views/assets/images/loading.gif" })
2959
+ const _hoisted_14 = /*#__PURE__*/vue.createElementVNode("div", {
2960
+ class: "spinner-border",
2961
+ role: "status"
2962
+ }, [
2963
+ /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2869
2964
  ], -1 /* HOISTED */);
2870
2965
  const _hoisted_15 = [
2871
2966
  _hoisted_14
2872
2967
  ];
2873
- const _hoisted_16 = { key: 1 };
2968
+ const _hoisted_16 = {
2969
+ key: 1,
2970
+ class: "alert alert-danger"
2971
+ };
2874
2972
  const _hoisted_17 = { colspan: 2 };
2875
2973
  const _hoisted_18 = {
2876
2974
  key: 0,
2877
2975
  class: "text-center"
2878
2976
  };
2879
- const _hoisted_19 = /*#__PURE__*/vue.createElementVNode("span", { colspan: 2 }, [
2880
- /*#__PURE__*/vue.createElementVNode("img", { src: "/src/views/assets/images/loading.gif" })
2977
+ const _hoisted_19 = /*#__PURE__*/vue.createElementVNode("div", {
2978
+ class: "spinner-border",
2979
+ role: "status"
2980
+ }, [
2981
+ /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2881
2982
  ], -1 /* HOISTED */);
2882
2983
  const _hoisted_20 = [
2883
2984
  _hoisted_19
2884
2985
  ];
2885
- const _hoisted_21 = { key: 1 };
2986
+ const _hoisted_21 = {
2987
+ key: 1,
2988
+ class: "alert alert-danger"
2989
+ };
2886
2990
  const _hoisted_22 = { colspan: 2 };
2887
2991
  const _hoisted_23 = {
2888
2992
  key: 4,
@@ -3427,10 +3531,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3427
3531
  ]),
3428
3532
  vue.createElementVNode("div", _hoisted_3, [
3429
3533
  vue.createVNode(_component_router_view, {
3430
- current_tab: $data.currentTab,
3534
+ currentTab: $data.currentTab,
3431
3535
  sharedData: $props.sharedData,
3432
3536
  tabCounts: $props.tabCounts
3433
- }, null, 8 /* PROPS */, ["current_tab", "sharedData", "tabCounts"])
3537
+ }, null, 8 /* PROPS */, ["currentTab", "sharedData", "tabCounts"])
3434
3538
  ])
3435
3539
  ]))
3436
3540
  }
@@ -3519,7 +3623,7 @@ const useUserStore = pinia.defineStore('user-store', {
3519
3623
  exports.ShCanvas = script$4;
3520
3624
  exports.ShForm = script$5;
3521
3625
  exports.ShModal = script$3;
3522
- exports.ShPhone = script$6;
3626
+ exports.ShPhone = script$7;
3523
3627
  exports.ShTable = script$1;
3524
3628
  exports.ShTabs = script;
3525
3629
  exports.shApis = apis;
package/dist/library.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import Axios from 'axios';
2
2
  import NProgress from 'nprogress';
3
- import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, normalizeClass, createBlock, renderSlot, createStaticVNode, withCtx, createVNode } from 'vue';
3
+ import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, withModifiers, createVNode, normalizeClass, createBlock, renderSlot, createStaticVNode, withCtx } from 'vue';
4
+ import Editor from '@tinymce/tinymce-vue';
4
5
  import moment from 'moment';
5
6
  import Swal from 'sweetalert2';
6
7
  import { defineStore } from 'pinia';
@@ -1531,7 +1532,7 @@ const countries = [
1531
1532
  }
1532
1533
  ];
1533
1534
 
1534
- var script$6 = {
1535
+ var script$7 = {
1535
1536
  name: 'ShPhone',
1536
1537
  props: ['modelValue', 'country_code'],
1537
1538
  data () {
@@ -1593,7 +1594,7 @@ var script$6 = {
1593
1594
  }
1594
1595
  };
1595
1596
 
1596
- const _hoisted_1$6 = { class: "sh-phone mb-3" };
1597
+ const _hoisted_1$7 = { class: "sh-phone mb-3" };
1597
1598
  const _hoisted_2$6 = {
1598
1599
  key: 0,
1599
1600
  style: {"display":"contents"}
@@ -1601,8 +1602,8 @@ const _hoisted_2$6 = {
1601
1602
  const _hoisted_3$6 = ["src"];
1602
1603
  const _hoisted_4$5 = ["value"];
1603
1604
 
1604
- function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1605
- return (openBlock(), createElementBlock("div", _hoisted_1$6, [
1605
+ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1606
+ return (openBlock(), createElementBlock("div", _hoisted_1$7, [
1606
1607
  ($data.selectedCountry)
1607
1608
  ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
1608
1609
  createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$6),
@@ -1636,15 +1637,95 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1636
1637
  ]))
1637
1638
  }
1638
1639
 
1640
+ script$7.render = render$7;
1641
+ script$7.__file = "src/views/ShPhone.vue";
1642
+
1643
+ var script$6 = {
1644
+ name: 'ShEditor',
1645
+ props: ['modelValue'],
1646
+ components: {
1647
+ editor: Editor
1648
+ },
1649
+ data () {
1650
+ return {
1651
+ editorData: this.modelValue
1652
+ }
1653
+ },
1654
+ computed: {
1655
+ value: {
1656
+ get () {
1657
+ return this.modelValue
1658
+ },
1659
+ set (value) {
1660
+ this.$emit('update:modelValue', value);
1661
+ }
1662
+ }
1663
+ },
1664
+ created () {
1665
+ document.addEventListener('focusin', function (e) {
1666
+ const closest = e.target.closest('.tox-tinymce-aux, .tox-dialog, .moxman-window, .tam-assetmanager-root');
1667
+ if (closest !== null && closest !== undefined) {
1668
+ e.stopImmediatePropagation();
1669
+ }
1670
+ });
1671
+ },
1672
+ mounted () {
1673
+ this.editorData = this.modelValue;
1674
+ },
1675
+ methods: {
1676
+ updateValue: function () {
1677
+ // alert('paste')
1678
+ }
1679
+ }
1680
+ };
1681
+
1682
+ const _hoisted_1$6 = /*#__PURE__*/createElementVNode("textarea", {
1683
+ id: "tiny",
1684
+ style: {"display":"none"},
1685
+ "data-cy": "tinymce_editor"
1686
+ }, null, -1 /* HOISTED */);
1687
+
1688
+ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1689
+ const _component_editor = resolveComponent("editor");
1690
+
1691
+ return (openBlock(), createElementBlock(Fragment, null, [
1692
+ createCommentVNode(" <ckeditor @input=\"updateValue\" :editor=\"editor\" v-model=\"editorData\" :config=\"editorConfig\"></ckeditor>"),
1693
+ _hoisted_1$6,
1694
+ createElementVNode("div", {
1695
+ onFocusin: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
1696
+ class: "sh-editor w-100"
1697
+ }, [
1698
+ createCommentVNode(" MCE editor placed here "),
1699
+ createVNode(_component_editor, {
1700
+ class: "tinyEditor",
1701
+ "api-key": "v5otxmculqf59xfg2bqr2ucw56cbqgbqo4x9gym2kwbv1rvi",
1702
+ onInput: $options.updateValue,
1703
+ onKeyup: $options.updateValue,
1704
+ modelValue: $options.value,
1705
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($options.value) = $event)),
1706
+ init: {
1707
+ selector: 'textarea#tiny',
1708
+ valid_children : '+body[style],+body[script]',
1709
+ extended_valid_elements : '*[*]',
1710
+ contextmenu: false,
1711
+ plugins: 'lists link image emoticons code autolink',
1712
+ toolbar: 'styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist | link image emoticons code'
1713
+ }
1714
+ }, null, 8 /* PROPS */, ["onInput", "onKeyup", "modelValue"])
1715
+ ], 32 /* HYDRATE_EVENTS */)
1716
+ ], 64 /* STABLE_FRAGMENT */))
1717
+ }
1718
+
1639
1719
  script$6.render = render$6;
1640
- script$6.__file = "src/views/ShPhone.vue";
1720
+ script$6.__file = "src/views/FormComponent/ShEditor.vue";
1641
1721
 
1642
1722
  var script$5 = {
1643
1723
  name: 'ShForm',
1644
1724
  components: {
1645
- ShPhone: script$6
1725
+ ShEditor: script$6,
1726
+ ShPhone: script$7
1646
1727
  },
1647
- props: ['action', 'classes', 'hasTerms', 'country_code', 'submit_btn_class', 'fields', 'columns', 'placeholders', 'field_permissions', 'retain_data_after_submission', 'current_data', 'action_label', 'fill_selects', 'phones', 'successCallback', 'failed_callback', 'labels'],
1728
+ props: ['action', 'classes', 'hasTerms', 'country_code', 'submitBtnClass', 'fields', 'columns', 'placeholders', 'field_permissions', 'retainDataAfterSubmission', 'currentData', 'actionLabel', 'fillSelects', 'phones', 'successCallback', 'failed_callback', 'labels', 'editors'],
1648
1729
  data: function () {
1649
1730
  return {
1650
1731
  form_elements: {},
@@ -1660,14 +1741,9 @@ var script$5 = {
1660
1741
  allLabels: {}
1661
1742
  }
1662
1743
  },
1663
- computed: {
1664
- currentData () {
1665
- return this.current_data
1666
- }
1667
- },
1668
1744
  methods: {
1669
1745
  getSubmitBtnClass: function () {
1670
- const btnClass = this.submit_btn_class;
1746
+ const btnClass = this.submitBtnClass;
1671
1747
  if (!btnClass) {
1672
1748
  return 'btn btn-primary mt-2'
1673
1749
  } else {
@@ -1691,7 +1767,10 @@ var script$5 = {
1691
1767
  const selects = ['gender', 'payment_method', 'allow_view_mode', 'reasons_name', 'has_free_tier', 'payment_period', 'role', 'register_as', 'account_type'];
1692
1768
  const numbers = ['age'];
1693
1769
  const datePickers = ['free_tier_days', 'recurring_date', 'date', 'paid_at'];
1694
- const editors = ['html_content', 'listing_description', 'mail'];
1770
+ let editors = ['html_content', 'listing_description', 'mail'];
1771
+ if(this.editors){
1772
+ editors = editors.concat(this.editors);
1773
+ }
1695
1774
  const mapLocations = ['building_location'];
1696
1775
  const files = ['file', 'logo'];
1697
1776
  const phones = ['phone'];
@@ -1806,7 +1885,7 @@ var script$5 = {
1806
1885
  this.form_status = 2;
1807
1886
  Object.keys(this.form_elements).forEach(key => {
1808
1887
  this.form_errors[key] = null;
1809
- if (!this.retain_data_after_submission) {
1888
+ if (!this.retainDataAfterSubmission) {
1810
1889
  this.form_elements[key] = '';
1811
1890
  }
1812
1891
  });
@@ -1875,14 +1954,14 @@ var script$5 = {
1875
1954
  },
1876
1955
  mounted: async function () {
1877
1956
  const selectData = {};
1878
- if (this.fill_selects) {
1879
- Object.keys(this.fill_selects).forEach(key => {
1880
- if (this.fill_selects[key].data) {
1881
- selectData[key] = this.fill_selects[key].data;
1957
+ if (this.fillSelects) {
1958
+ Object.keys(this.fillSelects).forEach(key => {
1959
+ if (this.fillSelects[key].data) {
1960
+ selectData[key] = this.fillSelects[key].data;
1882
1961
  this.selectData = selectData;
1883
1962
  console.log(this.selectData);
1884
1963
  } else {
1885
- apis.doGet(this.fill_selects[key].url, { all: 1 }).then(res => {
1964
+ apis.doGet(this.fillSelects[key].url, { all: 1 }).then(res => {
1886
1965
  // selectData[key] = res.data
1887
1966
  // console.log(res)
1888
1967
  this.selectData[key] = res.data.data;
@@ -1935,7 +2014,7 @@ const _hoisted_15$2 = ["name", "onFocus", "onUpdate:modelValue"];
1935
2014
  const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
1936
2015
  const _hoisted_17$2 = ["value"];
1937
2016
  const _hoisted_18$2 = {
1938
- key: 9,
2017
+ key: 10,
1939
2018
  class: "invalid-feedback"
1940
2019
  };
1941
2020
  const _hoisted_19$2 = {
@@ -1968,6 +2047,7 @@ const _hoisted_23$2 = {
1968
2047
 
1969
2048
  function render$5(_ctx, _cache, $props, $setup, $data, $options) {
1970
2049
  const _component_ShPhone = resolveComponent("ShPhone");
2050
+ const _component_ShEditor = resolveComponent("ShEditor");
1971
2051
 
1972
2052
  return (openBlock(), createElementBlock("form", _hoisted_1$5, [
1973
2053
  createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
@@ -2072,9 +2152,20 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2072
2152
  required: ""
2073
2153
  }, null, 8 /* PROPS */, ["country_code", "placeholder", "name", "onFocus", "class", "modelValue", "onUpdate:modelValue"]))
2074
2154
  : createCommentVNode("v-if", true),
2155
+ ($options.getFieldType(field) === 'editor')
2156
+ ? (openBlock(), createBlock(_component_ShEditor, {
2157
+ key: 6,
2158
+ placeholder: _ctx.allPlaceHolders[field] ? _ctx.allPlaceHolders[field] : '',
2159
+ name: field,
2160
+ onFocus: $event => ($options.removeErrors(field)),
2161
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2162
+ modelValue: _ctx.form_elements[field],
2163
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2164
+ }, null, 8 /* PROPS */, ["placeholder", "name", "onFocus", "class", "modelValue", "onUpdate:modelValue"]))
2165
+ : createCommentVNode("v-if", true),
2075
2166
  ($options.getFieldType(field) === 'text')
2076
2167
  ? withDirectives((openBlock(), createElementBlock("input", {
2077
- key: 6,
2168
+ key: 7,
2078
2169
  disabled: $options.isDisabled(field),
2079
2170
  placeholder: field === 'phone_number' ? 'e.g 0712 345 678':'',
2080
2171
  name: field,
@@ -2088,7 +2179,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2088
2179
  : createCommentVNode("v-if", true),
2089
2180
  ($options.getFieldType(field) === 'textarea')
2090
2181
  ? withDirectives((openBlock(), createElementBlock("textarea", {
2091
- key: 7,
2182
+ key: 8,
2092
2183
  name: field,
2093
2184
  onFocus: $event => ($options.removeErrors(field)),
2094
2185
  class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
@@ -2099,7 +2190,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2099
2190
  : createCommentVNode("v-if", true),
2100
2191
  ($options.getFieldType(field) === 'select' && _ctx.selectData[field] != null)
2101
2192
  ? withDirectives((openBlock(), createElementBlock("select", {
2102
- key: 8,
2193
+ key: 9,
2103
2194
  name: field,
2104
2195
  onFocus: $event => ($options.removeErrors(field)),
2105
2196
  class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
@@ -2131,7 +2222,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2131
2222
  type: "button",
2132
2223
  onClick: _cache[1] || (_cache[1] = (...args) => ($options.submitForm && $options.submitForm(...args)))
2133
2224
  }, [
2134
- createTextVNode(toDisplayString($props.action_label ? $props.action_label:'Submit') + " ", 1 /* TEXT */),
2225
+ createTextVNode(toDisplayString($props.actionLabel ? $props.actionLabel:'Submit') + " ", 1 /* TEXT */),
2135
2226
  (_ctx.form_status == 1)
2136
2227
  ? (openBlock(), createElementBlock("img", _hoisted_23$2))
2137
2228
  : createCommentVNode("v-if", true)
@@ -2853,25 +2944,37 @@ const _hoisted_13 = {
2853
2944
  key: 0,
2854
2945
  class: "text-center"
2855
2946
  };
2856
- const _hoisted_14 = /*#__PURE__*/createElementVNode("span", { colspan: 2 }, [
2857
- /*#__PURE__*/createElementVNode("img", { src: "/src/views/assets/images/loading.gif" })
2947
+ const _hoisted_14 = /*#__PURE__*/createElementVNode("div", {
2948
+ class: "spinner-border",
2949
+ role: "status"
2950
+ }, [
2951
+ /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2858
2952
  ], -1 /* HOISTED */);
2859
2953
  const _hoisted_15 = [
2860
2954
  _hoisted_14
2861
2955
  ];
2862
- const _hoisted_16 = { key: 1 };
2956
+ const _hoisted_16 = {
2957
+ key: 1,
2958
+ class: "alert alert-danger"
2959
+ };
2863
2960
  const _hoisted_17 = { colspan: 2 };
2864
2961
  const _hoisted_18 = {
2865
2962
  key: 0,
2866
2963
  class: "text-center"
2867
2964
  };
2868
- const _hoisted_19 = /*#__PURE__*/createElementVNode("span", { colspan: 2 }, [
2869
- /*#__PURE__*/createElementVNode("img", { src: "/src/views/assets/images/loading.gif" })
2965
+ const _hoisted_19 = /*#__PURE__*/createElementVNode("div", {
2966
+ class: "spinner-border",
2967
+ role: "status"
2968
+ }, [
2969
+ /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2870
2970
  ], -1 /* HOISTED */);
2871
2971
  const _hoisted_20 = [
2872
2972
  _hoisted_19
2873
2973
  ];
2874
- const _hoisted_21 = { key: 1 };
2974
+ const _hoisted_21 = {
2975
+ key: 1,
2976
+ class: "alert alert-danger"
2977
+ };
2875
2978
  const _hoisted_22 = { colspan: 2 };
2876
2979
  const _hoisted_23 = {
2877
2980
  key: 4,
@@ -3416,10 +3519,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3416
3519
  ]),
3417
3520
  createElementVNode("div", _hoisted_3, [
3418
3521
  createVNode(_component_router_view, {
3419
- current_tab: $data.currentTab,
3522
+ currentTab: $data.currentTab,
3420
3523
  sharedData: $props.sharedData,
3421
3524
  tabCounts: $props.tabCounts
3422
- }, null, 8 /* PROPS */, ["current_tab", "sharedData", "tabCounts"])
3525
+ }, null, 8 /* PROPS */, ["currentTab", "sharedData", "tabCounts"])
3423
3526
  ])
3424
3527
  ]))
3425
3528
  }
@@ -3505,4 +3608,4 @@ const useUserStore = defineStore('user-store', {
3505
3608
  }
3506
3609
  });
3507
3610
 
3508
- export { script$4 as ShCanvas, script$5 as ShForm, script$3 as ShModal, script$6 as ShPhone, script$1 as ShTable, script as ShTabs, apis as shApis, helpers as shRepo, shstorage as shStorage, useUserStore };
3611
+ export { script$4 as ShCanvas, script$5 as ShForm, script$3 as ShModal, script$7 as ShPhone, script$1 as ShTable, script as ShTabs, apis as shApis, helpers as shRepo, shstorage as shStorage, useUserStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "0.2.1",
3
+ "version": "0.2.4",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",
@@ -22,7 +22,8 @@
22
22
  "nprogress": "^0.2.0",
23
23
  "pinia": "^2.0.13",
24
24
  "sweetalert2": "^11.4.14",
25
- "vue": "^3.2.37"
25
+ "vue": "^3.2.37",
26
+ "@tinymce/tinymce-vue": "^4.0.7"
26
27
  },
27
28
  "devDependencies": {
28
29
  "rollup": "^2.75.7",