@coreui/vue-pro 4.4.2 → 4.5.0

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.js CHANGED
@@ -8471,7 +8471,7 @@ const CFormInput = vue.defineComponent({
8471
8471
  onInput: (event) => handleInput(event),
8472
8472
  readonly: props.readonly,
8473
8473
  type: props.type,
8474
- ...(props.modelValue && { value: props.modelValue }),
8474
+ ...((props.modelValue || props.modelValue === 0) && { value: props.modelValue })
8475
8475
  }, slots.default && slots.default()),
8476
8476
  ...(slots.feedback && { feedback: () => slots.feedback && slots.feedback() }),
8477
8477
  ...(slots.feedbackInvalid && {
@@ -14577,6 +14577,14 @@ const CMultiSelect = vue.defineComponent({
14577
14577
  required: false,
14578
14578
  default: true,
14579
14579
  },
14580
+ /**
14581
+ * Toggle the disabled state for the component.
14582
+ */
14583
+ disabled: {
14584
+ type: Boolean,
14585
+ required: false,
14586
+ default: false,
14587
+ },
14580
14588
  /**
14581
14589
  * It specifies that multiple options can be selected at once.
14582
14590
  *
@@ -14689,6 +14697,18 @@ const CMultiSelect = vue.defineComponent({
14689
14697
  default: 'item(s) selected',
14690
14698
  required: false,
14691
14699
  },
14700
+ /**
14701
+ * Size the component small or large.
14702
+ *
14703
+ * @values 'sm', 'lg'
14704
+ */
14705
+ size: {
14706
+ type: String,
14707
+ required: false,
14708
+ validator: (value) => {
14709
+ return ['sm', 'lg'].includes(value);
14710
+ },
14711
+ },
14692
14712
  /**
14693
14713
  * Toggle the visibility of multi select dropdown.
14694
14714
  *
@@ -14771,7 +14791,6 @@ const CMultiSelect = vue.defineComponent({
14771
14791
  }, [])
14772
14792
  : options.value;
14773
14793
  };
14774
- const multiSelectRef = vue.ref();
14775
14794
  const nativeSelectRef = vue.ref();
14776
14795
  vue.provide('nativeSelectRef', nativeSelectRef);
14777
14796
  const searchRef = vue.ref();
@@ -14781,8 +14800,9 @@ const CMultiSelect = vue.defineComponent({
14781
14800
  const visible = vue.ref(props.visible);
14782
14801
  const selected = vue.ref(getSelectedOptions(props.options));
14783
14802
  const count = vue.ref(0);
14784
- vue.watch(() => props.options, () => {
14785
- options.value = props.options;
14803
+ vue.watch(() => props.options, (newValue, oldValue) => {
14804
+ if (JSON.stringify(newValue) !== JSON.stringify(oldValue))
14805
+ options.value = newValue;
14786
14806
  });
14787
14807
  vue.watch(options, () => {
14788
14808
  const _selected = options.value && getSelectedOptions(options.value);
@@ -14805,24 +14825,6 @@ const CMultiSelect = vue.defineComponent({
14805
14825
  nativeSelectRef.value &&
14806
14826
  nativeSelectRef.value.dispatchEvent(new Event('change', { bubbles: true }));
14807
14827
  });
14808
- vue.onMounted(() => {
14809
- window.addEventListener('click', handleClickOutside);
14810
- window.addEventListener('keyup', handleKeyup);
14811
- });
14812
- vue.onUnmounted(() => {
14813
- window.removeEventListener('click', handleClickOutside);
14814
- window.removeEventListener('keyup', handleKeyup);
14815
- });
14816
- const handleKeyup = (event) => {
14817
- if (multiSelectRef.value && !multiSelectRef.value.contains(event.target)) {
14818
- visible.value = false;
14819
- }
14820
- };
14821
- const handleClickOutside = (event) => {
14822
- if (multiSelectRef.value && !multiSelectRef.value.contains(event.target)) {
14823
- visible.value = false;
14824
- }
14825
- };
14826
14828
  const handleSearchChange = (event) => {
14827
14829
  const target = event.target;
14828
14830
  search.value = target.value.toLowerCase();
@@ -14856,56 +14858,64 @@ const CMultiSelect = vue.defineComponent({
14856
14858
  : selected.value.map((option) => option.value)[0],
14857
14859
  onChange: () => emit('change', selected.value),
14858
14860
  }),
14859
- vue.h('div', {
14861
+ vue.h(CPicker, {
14860
14862
  class: [
14861
14863
  'form-multi-select',
14862
14864
  {
14863
- show: visible.value,
14865
+ 'form-multi-select-with-cleaner': props.cleaner,
14866
+ disabled: props.disabled,
14867
+ [`form-multi-select-${props.size}`]: props.size,
14864
14868
  'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
14869
+ show: visible.value,
14865
14870
  },
14866
14871
  ],
14867
- onClick: () => {
14868
- visible.value = true;
14872
+ disabled: props.disabled,
14873
+ onShow: () => {
14869
14874
  props.search && searchRef.value && searchRef.value.focus();
14870
14875
  },
14871
- ref: multiSelectRef,
14872
- }, [
14873
- vue.h(CMultiSelectSelection, {
14874
- multiple: props.multiple,
14875
- onRemove: (option) => handleOptionClick(option),
14876
- search: props.search,
14877
- selected: selected.value,
14878
- selectionType: props.selectionType,
14879
- selectionTypeCounterText: props.selectionTypeCounterText,
14880
- }),
14881
- props.multiple &&
14882
- props.cleaner &&
14883
- selected.value.length > 0 &&
14884
- vue.h('button', {
14885
- type: 'button',
14886
- class: 'form-multi-select-selection-cleaner',
14887
- onClick: () => handleDeselectAll(),
14876
+ }, {
14877
+ toggler: () => vue.h('div', {}, [
14878
+ vue.h(CMultiSelectSelection, {
14879
+ multiple: props.multiple,
14880
+ onRemove: (option) => !props.disabled && handleOptionClick(option),
14881
+ search: props.search,
14882
+ selected: selected.value,
14883
+ selectionType: props.selectionType,
14884
+ selectionTypeCounterText: props.selectionTypeCounterText,
14888
14885
  }),
14889
- props.search &&
14890
- vue.h('input', {
14891
- type: 'text',
14892
- class: 'form-multi-select-search',
14893
- autocomplete: 'off',
14894
- ...(selected.value.length === 0 && { placeholder: props.placeholder }),
14895
- ...(selected.value.length &&
14896
- props.selectionType === 'counter' && {
14897
- placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
14886
+ props.multiple &&
14887
+ props.cleaner &&
14888
+ selected.value.length > 0 &&
14889
+ !props.disabled &&
14890
+ vue.h('button', {
14891
+ type: 'button',
14892
+ class: 'form-multi-select-selection-cleaner',
14893
+ onClick: () => handleDeselectAll(),
14898
14894
  }),
14899
- ...(selected.value.length &&
14900
- !props.multiple && { placeholder: selected.value.map((option) => option.text)[0] }),
14901
- onInput: (event) => handleSearchChange(event),
14902
- onKeydown: (event) => handleSearchKeyDown(event),
14903
- ...(props.multiple &&
14904
- selected.value.length &&
14905
- props.selectionType !== 'counter' && { size: search.value.length + 2 }),
14906
- ref: searchRef,
14907
- }),
14908
- vue.h('div', { class: 'form-multi-select-dropdown' }, [
14895
+ props.search &&
14896
+ vue.h('input', {
14897
+ type: 'text',
14898
+ class: 'form-multi-select-search',
14899
+ autocomplete: 'off',
14900
+ ...(selected.value.length === 0 && { placeholder: props.placeholder }),
14901
+ ...(selected.value.length &&
14902
+ props.selectionType === 'counter' && {
14903
+ placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
14904
+ }),
14905
+ ...(selected.value.length &&
14906
+ !props.multiple && {
14907
+ placeholder: selected.value.map((option) => option.text)[0],
14908
+ }),
14909
+ disabled: props.disabled,
14910
+ onInput: (event) => handleSearchChange(event),
14911
+ onKeydown: (event) => handleSearchKeyDown(event),
14912
+ ...(props.multiple &&
14913
+ selected.value.length &&
14914
+ props.selectionType !== 'counter' && { size: search.value.length + 2 }),
14915
+ ref: searchRef,
14916
+ }),
14917
+ ]),
14918
+ default: () => vue.h('div', {}, [
14909
14919
  props.multiple &&
14910
14920
  props.selectAll &&
14911
14921
  vue.h('button', { class: 'form-multi-select-all', onClick: () => handleSelectAll() }, props.selectAllLabel),
@@ -14917,7 +14927,7 @@ const CMultiSelect = vue.defineComponent({
14917
14927
  searchNoResultsLabel: props.searchNoResultsLabel,
14918
14928
  }),
14919
14929
  ]),
14920
- ]),
14930
+ }),
14921
14931
  ];
14922
14932
  },
14923
14933
  });
@@ -16576,142 +16586,6 @@ const CSidebarPlugin = {
16576
16586
  },
16577
16587
  };
16578
16588
 
16579
- const CTable = vue.defineComponent({
16580
- name: 'CTable',
16581
- props: {
16582
- /**
16583
- * Set the vertical aligment.
16584
- *
16585
- * @values 'bottom', 'middle', 'top'
16586
- */
16587
- align: {
16588
- type: String,
16589
- default: undefined,
16590
- required: false,
16591
- validator: (value) => {
16592
- return ['bottom', 'middle', 'top'].includes(value);
16593
- },
16594
- },
16595
- /**
16596
- * Sets the border color of the component to one of CoreUI’s themed colors.
16597
- *
16598
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
16599
- */
16600
- borderColor: Color,
16601
- /**
16602
- * Add borders on all sides of the table and cells.
16603
- */
16604
- bordered: {
16605
- type: Boolean,
16606
- required: false,
16607
- },
16608
- /**
16609
- * Remove borders on all sides of the table and cells.
16610
- */
16611
- borderless: {
16612
- type: Boolean,
16613
- required: false,
16614
- },
16615
- /**
16616
- * Put the `<caption>` on the top of the table.
16617
- *
16618
- * @values 'top'
16619
- */
16620
- caption: {
16621
- type: String,
16622
- default: undefined,
16623
- required: false,
16624
- validator: (value) => {
16625
- return value === 'top';
16626
- },
16627
- },
16628
- /**
16629
- * Sets the color context of the component to one of CoreUI’s themed colors.
16630
- *
16631
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
16632
- */
16633
- color: Color,
16634
- /**
16635
- * Enable a hover state on table rows within a `<CTableBody>`.
16636
- */
16637
- hover: {
16638
- type: Boolean,
16639
- required: false,
16640
- },
16641
- /**
16642
- * Make any table responsive across all viewports or pick a maximum breakpoint with which to have a responsive table up to.
16643
- *
16644
- * @values boolean, 'sm', 'md', 'lg', 'xl', 'xxl'
16645
- */
16646
- responsive: {
16647
- type: [Boolean, String],
16648
- default: undefined,
16649
- required: false,
16650
- validator: (value) => {
16651
- if (typeof value == 'string') {
16652
- return ['sm', 'md', 'lg', 'xl', 'xxl'].includes(value);
16653
- }
16654
- if (typeof value == 'boolean') {
16655
- return true;
16656
- }
16657
- return false;
16658
- },
16659
- },
16660
- /**
16661
- * Make table more compact by cutting all cell `padding` in half.
16662
- */
16663
- small: {
16664
- type: Boolean,
16665
- required: false,
16666
- },
16667
- /**
16668
- * Add zebra-striping to any table row within the `<CTableBody>`.
16669
- */
16670
- striped: {
16671
- type: Boolean,
16672
- required: false,
16673
- },
16674
- /**
16675
- * Add zebra-striping to any table column.
16676
- *
16677
- * @since 4.4.0
16678
- */
16679
- stripedColumns: {
16680
- type: Boolean,
16681
- required: false,
16682
- },
16683
- },
16684
- setup(props, { slots, attrs }) {
16685
- const table = () => vue.h('table', {
16686
- class: [
16687
- 'table',
16688
- {
16689
- [`align-${props.align}`]: props.align,
16690
- [`caption-${props.caption}`]: props.caption,
16691
- [`border-${props.borderColor}`]: props.borderColor,
16692
- 'table-bordered': props.bordered,
16693
- 'table-borderless': props.borderless,
16694
- [`table-${props.color}`]: props.color,
16695
- 'table-hover': props.hover,
16696
- 'table-sm': props.small,
16697
- 'table-striped': props.striped,
16698
- 'table-striped-columns': props.stripedColumns,
16699
- },
16700
- attrs.class,
16701
- ],
16702
- }, slots.default && slots.default());
16703
- return () => [
16704
- props.responsive
16705
- ? vue.h('div', {
16706
- class: typeof props.responsive === 'boolean'
16707
- ? 'table-responsive'
16708
- : `table-responsive-${props.responsive}`,
16709
- }, table())
16710
- : table(),
16711
- ];
16712
- },
16713
- });
16714
-
16715
16589
  const CTableBody = vue.defineComponent({
16716
16590
  name: 'CTableBody',
16717
16591
  props: {
@@ -16770,9 +16644,16 @@ const CTableDataCell = vue.defineComponent({
16770
16644
  * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
16771
16645
  */
16772
16646
  color: Color,
16647
+ /**
16648
+ * @ignore
16649
+ */
16650
+ scope: {
16651
+ type: String,
16652
+ required: false,
16653
+ },
16773
16654
  },
16774
16655
  setup(props, { slots }) {
16775
- return () => vue.h('td', {
16656
+ return () => vue.h(props.scope ? 'th' : 'td', {
16776
16657
  class: [
16777
16658
  {
16778
16659
  [`align-${props.align}`]: props.align,
@@ -16780,6 +16661,7 @@ const CTableDataCell = vue.defineComponent({
16780
16661
  [`table-${props.color}`]: props.color,
16781
16662
  },
16782
16663
  ],
16664
+ ...(props.scope && { scope: props.scope }),
16783
16665
  }, slots.default && slots.default());
16784
16666
  },
16785
16667
  });
@@ -16890,6 +16772,293 @@ const CTableRow = vue.defineComponent({
16890
16772
  },
16891
16773
  });
16892
16774
 
16775
+ const pretifyName = (name) => {
16776
+ return name
16777
+ .replace(/[-_.]/g, ' ')
16778
+ .replace(/ +/g, ' ')
16779
+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
16780
+ .split(' ')
16781
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
16782
+ .join(' ');
16783
+ };
16784
+ const label = (column) => typeof column === 'object'
16785
+ ? column.label !== undefined
16786
+ ? column.label
16787
+ : pretifyName(column.key)
16788
+ : pretifyName(column);
16789
+ const CTable = vue.defineComponent({
16790
+ name: 'CTable',
16791
+ props: {
16792
+ /**
16793
+ * Set the vertical aligment.
16794
+ *
16795
+ * @values 'bottom', 'middle', 'top'
16796
+ */
16797
+ align: {
16798
+ type: String,
16799
+ default: undefined,
16800
+ required: false,
16801
+ validator: (value) => {
16802
+ return ['bottom', 'middle', 'top'].includes(value);
16803
+ },
16804
+ },
16805
+ /**
16806
+ * Sets the border color of the component to one of CoreUI’s themed colors.
16807
+ *
16808
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
16809
+ */
16810
+ borderColor: Color,
16811
+ /**
16812
+ * Add borders on all sides of the table and cells.
16813
+ */
16814
+ bordered: {
16815
+ type: Boolean,
16816
+ required: false,
16817
+ },
16818
+ /**
16819
+ * Remove borders on all sides of the table and cells.
16820
+ */
16821
+ borderless: {
16822
+ type: Boolean,
16823
+ required: false,
16824
+ },
16825
+ /**
16826
+ * Put the `<caption>` on the top of the table.
16827
+ *
16828
+ * @values 'top' | string
16829
+ */
16830
+ caption: {
16831
+ type: String,
16832
+ default: undefined,
16833
+ required: false,
16834
+ },
16835
+ /**
16836
+ * Set the text of the table caption and the caption on the top of the table.
16837
+ *
16838
+ * @since 4.5.0
16839
+ */
16840
+ captionTop: {
16841
+ type: String,
16842
+ default: undefined,
16843
+ required: false,
16844
+ },
16845
+ /**
16846
+ * Prop for table columns configuration. If prop is not defined, table will display columns based on the first item keys, omitting keys that begins with underscore (e.g. '_props')
16847
+ *
16848
+ * In columns prop each array item represents one column. Item might be specified in two ways:
16849
+ * String: each item define column name equal to item value.
16850
+ * Object: item is object with following keys available as column configuration:
16851
+ * - key (required)(String) - define column name equal to item key.
16852
+ * - label (String) - define visible label of column. If not defined, label will be generated automatically based on column name, by converting kebab-case and snake_case to individual words and capitalization of each word.
16853
+ * - _props (Object) - adds classes to all cels in column, ex. _props: { scope: 'col', className: 'custom-class' },
16854
+ * - _style (Object) - adds styles to the column header (useful for defining widths)
16855
+ *
16856
+ * @since 4.5.0
16857
+ */
16858
+ columns: {
16859
+ type: Array,
16860
+ required: false,
16861
+ },
16862
+ /**
16863
+ * Sets the color context of the component to one of CoreUI’s themed colors.
16864
+ *
16865
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
16866
+ */
16867
+ color: Color,
16868
+ /**
16869
+ * Array of objects or strings, where each element represents one cell in the table footer.
16870
+ *
16871
+ * Example items:
16872
+ * ['FooterCell', 'FooterCell', 'FooterCell']
16873
+ * or
16874
+ * [{ label: 'FooterCell', _props: { color: 'success' }, ...]
16875
+ *
16876
+ * @since 4.5.0
16877
+ */
16878
+ footer: {
16879
+ type: Array,
16880
+ default: () => [],
16881
+ required: false,
16882
+ },
16883
+ /**
16884
+ * Enable a hover state on table rows within a `<CTableBody>`.
16885
+ */
16886
+ hover: {
16887
+ type: Boolean,
16888
+ required: false,
16889
+ },
16890
+ /**
16891
+ * Array of objects, where each object represents one item - row in table. Additionally, you can add style classes to each row by passing them by '_props' key and to single cell by '_cellProps'.
16892
+ *
16893
+ * Example item:
16894
+ * { name: 'John' , age: 12, _props: { color: 'success' }, _cellProps: { age: { className: 'fw-bold'}}}
16895
+ *
16896
+ * @since 4.5.0
16897
+ */
16898
+ items: {
16899
+ type: Array,
16900
+ default: () => [],
16901
+ required: false,
16902
+ },
16903
+ responsive: {
16904
+ type: [Boolean, String],
16905
+ default: undefined,
16906
+ required: false,
16907
+ validator: (value) => {
16908
+ if (typeof value == 'string') {
16909
+ return ['sm', 'md', 'lg', 'xl', 'xxl'].includes(value);
16910
+ }
16911
+ if (typeof value == 'boolean') {
16912
+ return true;
16913
+ }
16914
+ return false;
16915
+ },
16916
+ },
16917
+ /**
16918
+ * Make table more compact by cutting all cell `padding` in half.
16919
+ */
16920
+ small: {
16921
+ type: Boolean,
16922
+ required: false,
16923
+ },
16924
+ /**
16925
+ * Add zebra-striping to any table row within the `<CTableBody>`.
16926
+ */
16927
+ striped: {
16928
+ type: Boolean,
16929
+ required: false,
16930
+ },
16931
+ /**
16932
+ * Add zebra-striping to any table column.
16933
+ *
16934
+ * @since 4.4.0
16935
+ */
16936
+ stripedColumns: {
16937
+ type: Boolean,
16938
+ required: false,
16939
+ },
16940
+ /**
16941
+ * Properties that will be passed to the table footer component.
16942
+ *
16943
+ * Properties to [CTableFoot](#ctablefoot) component.
16944
+ * @since 4.5.0
16945
+ */
16946
+ tableFootProps: {
16947
+ type: Object,
16948
+ default: undefined,
16949
+ required: false,
16950
+ },
16951
+ /**
16952
+ * Properties that will be passed to the table head component.
16953
+ *
16954
+ * Properties to [CTableHead](#ctablehead) component.
16955
+ * @since 4.5.0
16956
+ */
16957
+ tableHeadProps: {
16958
+ type: Object,
16959
+ default: undefined,
16960
+ required: false,
16961
+ },
16962
+ },
16963
+ setup(props, { slots, attrs }) {
16964
+ const rawColumnNames = vue.computed(() => props.columns
16965
+ ? props.columns.map((column) => {
16966
+ if (typeof column === 'object')
16967
+ return column.key;
16968
+ else
16969
+ return column;
16970
+ })
16971
+ : Object.keys(props.items[0] || {}).filter((el) => el.charAt(0) !== '_'));
16972
+ const table = () => vue.h('table', {
16973
+ class: [
16974
+ 'table',
16975
+ {
16976
+ [`align-${props.align}`]: props.align,
16977
+ [`caption-top`]: props.captionTop || props.caption === 'top',
16978
+ [`border-${props.borderColor}`]: props.borderColor,
16979
+ 'table-bordered': props.bordered,
16980
+ 'table-borderless': props.borderless,
16981
+ [`table-${props.color}`]: props.color,
16982
+ 'table-hover': props.hover,
16983
+ 'table-sm': props.small,
16984
+ 'table-striped': props.striped,
16985
+ 'table-striped-columns': props.stripedColumns,
16986
+ },
16987
+ attrs.class,
16988
+ ],
16989
+ }, {
16990
+ default: () => [
16991
+ ((props.caption && props.caption !== 'top') || props.captionTop) &&
16992
+ vue.h(CTableCaption, {}, {
16993
+ default: () => props.caption || props.captionTop,
16994
+ }),
16995
+ props.columns &&
16996
+ vue.h(CTableHead, {
16997
+ ...props.tableHeadProps,
16998
+ }, {
16999
+ default: () => vue.h(CTableRow, {}, {
17000
+ default: () => [
17001
+ props.columns &&
17002
+ props.columns.map((column) => vue.h(CTableHeaderCell, {
17003
+ ...(typeof column === 'object' &&
17004
+ column._props && { ...column._props }),
17005
+ ...(typeof column === 'object' &&
17006
+ column._style && { style: { ...column._style } }),
17007
+ }, {
17008
+ default: () => label(column),
17009
+ })),
17010
+ ],
17011
+ }),
17012
+ }),
17013
+ props.items &&
17014
+ vue.h(CTableBody, {}, {
17015
+ default: () => [
17016
+ props.items.map((item) => vue.h(CTableRow, {
17017
+ ...(item._props && { ...item._props }),
17018
+ }, {
17019
+ default: () => [
17020
+ rawColumnNames.value.map((colName) => item[colName] &&
17021
+ vue.h(CTableDataCell, {
17022
+ ...(item._cellProps &&
17023
+ item._cellProps['all'] && { ...item._cellProps['all'] }),
17024
+ ...(item._cellProps &&
17025
+ item._cellProps[colName] && { ...item._cellProps[colName] }),
17026
+ }, {
17027
+ default: () => item[colName],
17028
+ })),
17029
+ ],
17030
+ })),
17031
+ ],
17032
+ }),
17033
+ slots.default && slots.default(),
17034
+ props.footer &&
17035
+ vue.h(CTableFoot, {
17036
+ ...props.tableFootProps,
17037
+ }, {
17038
+ default: () => vue.h(CTableRow, {}, {
17039
+ default: () => [
17040
+ props.footer.map((item) => vue.h(CTableDataCell, {
17041
+ ...(typeof item === 'object' && item._props && { ...item._props }),
17042
+ }, {
17043
+ default: () => (typeof item === 'object' ? item.label : item),
17044
+ })),
17045
+ ],
17046
+ }),
17047
+ }),
17048
+ ],
17049
+ });
17050
+ return () => [
17051
+ props.responsive
17052
+ ? vue.h('div', {
17053
+ class: typeof props.responsive === 'boolean'
17054
+ ? 'table-responsive'
17055
+ : `table-responsive-${props.responsive}`,
17056
+ }, table())
17057
+ : table(),
17058
+ ];
17059
+ },
17060
+ });
17061
+
16893
17062
  const CTablePlugin = {
16894
17063
  install: (app) => {
16895
17064
  app.component(CTable.name, CTable);
@@ -17052,6 +17221,11 @@ const CSmartTableHead = vue.defineComponent({
17052
17221
  default: () => [],
17053
17222
  required: false,
17054
17223
  },
17224
+ items: {
17225
+ type: Array,
17226
+ default: () => [],
17227
+ required: false,
17228
+ },
17055
17229
  selectable: Boolean,
17056
17230
  selectAll: [Boolean, String],
17057
17231
  sorterState: {
@@ -17060,7 +17234,7 @@ const CSmartTableHead = vue.defineComponent({
17060
17234
  require: false,
17061
17235
  },
17062
17236
  },
17063
- emits: ['filterInput', 'filterChange', 'selectAllChecked', 'sortClick'],
17237
+ emits: ['customFilterChange', 'filterInput', 'filterChange', 'selectAllChecked', 'sortClick'],
17064
17238
  setup(props, { slots, emit }) {
17065
17239
  const handleSortClick = (key, index) => {
17066
17240
  emit('sortClick', key, index);
@@ -17107,6 +17281,9 @@ const CSmartTableHead = vue.defineComponent({
17107
17281
  }
17108
17282
  return 0;
17109
17283
  };
17284
+ const getValues = (items, key) => {
17285
+ return items.map((a) => a[key]);
17286
+ };
17110
17287
  const columnSorterIcon = (column) => {
17111
17288
  if (getColumnSorterState(key(column)) === 0) {
17112
17289
  return vue.h('span', { class: 'opacity-25 float-end me-1' }, slots.sortingIcon && slots.sortingIcon());
@@ -17119,6 +17296,9 @@ const CSmartTableHead = vue.defineComponent({
17119
17296
  }
17120
17297
  return;
17121
17298
  };
17299
+ const handleOnCustomFilterChange = (key, value) => {
17300
+ emit('customFilterChange', key, value);
17301
+ };
17122
17302
  const handleFilterInput = (key, value) => {
17123
17303
  emit('filterInput', key, value);
17124
17304
  };
@@ -17169,17 +17349,20 @@ const CSmartTableHead = vue.defineComponent({
17169
17349
  ? true
17170
17350
  : typeof column.filter === 'undefined'
17171
17351
  ? true
17172
- : column.filter) &&
17173
- vue.h(CFormInput, {
17174
- size: 'sm',
17175
- onInput: (event) => handleFilterInput(key(column), event.target.value),
17176
- onChange: (event) => handleFilterChange(key(column), event.target.value),
17177
- 'aria-label': `column name: '${label(column)}' filter input`,
17178
- ...(props.columnFilterValue &&
17179
- props.columnFilterValue[key(column)] && {
17180
- value: props.columnFilterValue[key(column)],
17181
- }),
17182
- }),
17352
+ : column.filter)
17353
+ ? typeof column !== 'string' && typeof column.filter === 'function'
17354
+ ? column.filter(getValues(props.items, key(column)), (value) => handleOnCustomFilterChange(key(column), value))
17355
+ : vue.h(CFormInput, {
17356
+ size: 'sm',
17357
+ onInput: (event) => handleFilterInput(key(column), event.target.value),
17358
+ onChange: (event) => handleFilterChange(key(column), event.target.value),
17359
+ 'aria-label': `column name: '${label(column)}' filter input`,
17360
+ ...(props.columnFilterValue &&
17361
+ props.columnFilterValue[key(column)] && {
17362
+ value: props.columnFilterValue[key(column)],
17363
+ }),
17364
+ })
17365
+ : '',
17183
17366
  })),
17184
17367
  ],
17185
17368
  }),
@@ -17300,7 +17483,7 @@ const CSmartTableItemsPerPageSelector = vue.defineComponent({
17300
17483
  vue.h('div', {
17301
17484
  class: 'col-auto',
17302
17485
  }, vue.h(CFormSelect, {
17303
- defaultValue: props.itemsPerPage,
17486
+ value: props.itemsPerPage,
17304
17487
  onChange: handleChange,
17305
17488
  }, {
17306
17489
  default: () => props.itemsPerPageOptions &&
@@ -17792,6 +17975,7 @@ const CSmartTable = vue.defineComponent({
17792
17975
  }
17793
17976
  });
17794
17977
  // functions
17978
+ const isLazy = (columnFilter) => columnFilter && typeof columnFilter === 'object' && columnFilter.lazy === true;
17795
17979
  const isSortable = (i) => {
17796
17980
  const isDataColumn = itemsDataColumns.value.includes(rawColumnNames.value[i]);
17797
17981
  let column;
@@ -17863,10 +18047,8 @@ const CSmartTable = vue.defineComponent({
17863
18047
  });
17864
18048
  };
17865
18049
  const columnFilterChange = (colName, value, type) => {
17866
- const isLazy = props.columnFilter &&
17867
- typeof props.columnFilter === 'object' &&
17868
- props.columnFilter.lazy === true;
17869
- if ((isLazy && type === 'input') || (!isLazy && type === 'change')) {
18050
+ const _isLazy = isLazy(props.columnFilter);
18051
+ if ((_isLazy && type === 'input') || (!_isLazy && type === 'change')) {
17870
18052
  return;
17871
18053
  }
17872
18054
  activePage.value = 1;
@@ -17874,10 +18056,8 @@ const CSmartTable = vue.defineComponent({
17874
18056
  emit('columnFilterChange', columnFilterState.value);
17875
18057
  };
17876
18058
  const tableFilterChange = (value, type) => {
17877
- const isLazy = props.columnFilter &&
17878
- typeof props.columnFilter === 'object' &&
17879
- props.columnFilter.lazy === true;
17880
- if ((isLazy && type === 'input') || (!isLazy && type === 'change')) {
18059
+ const _isLazy = isLazy(props.columnFilter);
18060
+ if ((_isLazy && type === 'input') || (!_isLazy && type === 'change')) {
17881
18061
  return;
17882
18062
  }
17883
18063
  activePage.value = 1;
@@ -17902,7 +18082,7 @@ const CSmartTable = vue.defineComponent({
17902
18082
  : genCols.value); //! || el
17903
18083
  const itemsDataColumns = vue.computed(() => rawColumnNames.value.filter((name) => genCols.value.includes(name)));
17904
18084
  // variables
17905
- const columnFiltered = () => {
18085
+ const filteredColumns = vue.computed(() => {
17906
18086
  let _items = items.value;
17907
18087
  if (props.columnFilter &&
17908
18088
  typeof props.columnFilter === 'object' &&
@@ -17910,6 +18090,10 @@ const CSmartTable = vue.defineComponent({
17910
18090
  return _items;
17911
18091
  }
17912
18092
  Object.entries(columnFilterState.value).forEach(([key, value]) => {
18093
+ if (value instanceof Function) {
18094
+ _items = _items.filter((item) => value(item[key]));
18095
+ return;
18096
+ }
17913
18097
  const columnFilter = String(value).toLowerCase();
17914
18098
  if (columnFilter && itemsDataColumns.value.includes(key)) {
17915
18099
  _items = _items.filter((item) => {
@@ -17918,9 +18102,9 @@ const CSmartTable = vue.defineComponent({
17918
18102
  }
17919
18103
  });
17920
18104
  return _items;
17921
- };
17922
- const tableFiltered = vue.computed(() => {
17923
- let items = columnFiltered();
18105
+ });
18106
+ const filteredTable = vue.computed(() => {
18107
+ let items = filteredColumns.value;
17924
18108
  if (!tableFilterState.value ||
17925
18109
  (props.tableFilter && typeof props.tableFilter === 'object' && props.tableFilter.external)) {
17926
18110
  return items;
@@ -17940,12 +18124,12 @@ const CSmartTable = vue.defineComponent({
17940
18124
  (props.columnSorter &&
17941
18125
  typeof props.columnSorter === 'object' &&
17942
18126
  props.columnSorter.external)) {
17943
- return tableFiltered.value;
18127
+ return filteredTable.value;
17944
18128
  }
17945
18129
  //if values in column are to be sorted by numeric value they all have to be type number
17946
18130
  // const flip = sorterState.asc ? 1 : -1
17947
18131
  const flip = sorterState.state === 'asc' ? 1 : sorterState.state === 'desc' ? -1 : 0;
17948
- const sorted = tableFiltered.value.slice().sort((item, item2) => {
18132
+ const sorted = filteredTable.value.slice().sort((item, item2) => {
17949
18133
  const value = item[col];
17950
18134
  const value2 = item2[col];
17951
18135
  const a = typeof value === 'number' ? value : String(value).toLowerCase();
@@ -18008,9 +18192,11 @@ const CSmartTable = vue.defineComponent({
18008
18192
  columnFilterValue: columnFilterState.value,
18009
18193
  columns: props.columns ? props.columns : rawColumnNames.value,
18010
18194
  columnSorter: props.columnSorter,
18195
+ items: items.value,
18011
18196
  selectable: props.selectable,
18012
18197
  selectAll: selectedAll.value,
18013
18198
  sorterState: sorterState,
18199
+ onCustomFilterChange: (key, value) => columnFilterChange(key, value),
18014
18200
  onFilterInput: (key, value) => columnFilterChange(key, value, 'input'),
18015
18201
  onFilterChange: (key, value) => columnFilterChange(key, value, 'change'),
18016
18202
  onSelectAllChecked: () => handleSelectAllChecked(),
@@ -18070,8 +18256,6 @@ const CSmartTable = vue.defineComponent({
18070
18256
  columns: props.columns ? props.columns : rawColumnNames.value,
18071
18257
  selectable: props.selectable,
18072
18258
  selectAll: selectedAll.value,
18073
- onFilterInput: (key, value) => columnFilterChange(key, value, 'input'),
18074
- onFilterChange: (key, value) => columnFilterChange(key, value, 'change'),
18075
18259
  onSelectAllChecked: () => handleSelectAllChecked(),
18076
18260
  }),
18077
18261
  ],